summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/api.js14
-rw-r--r--www/js/imachine.js10
2 files changed, 15 insertions, 9 deletions
diff --git a/www/js/api.js b/www/js/api.js
index 4aebde1..5b494ab 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -30,7 +30,6 @@ window.html5ks.api = {
return deferred.promise;
},
play: function (channel, name, fade) {
- // TODO: fade
var deferred = when.defer(),
audio = html5ks.elements.audio[channel];
audio.src = "dump/" + (channel === "music" ? "bgm/" + html5ks.data.music[name] + ".ogg" : html5ks.data.sfx[name]);
@@ -202,11 +201,14 @@ window.html5ks.api = {
bgright: { xpos: 0.6, xanchor: 0.5, ypos: 1.0, yanchor: 1.0 }
};
var pos = positions[location];
- el.style.left = pos.xpos * 800 + "px";
- el.style.top = pos.ypos * 600 + "px";
- el.style.marginLeft = "-" + pos.xanchor * el.width + "px";
- el.style.marginTop = "-" + pos.yanchor * el.height + "px";
- el.style.display = "block";
+ // TODO: implement transitions
+ if (pos) {
+ el.style.left = pos.xpos * 800 + "px";
+ el.style.top = pos.ypos * 600 + "px";
+ el.style.marginLeft = "-" + pos.xanchor * el.width + "px";
+ el.style.marginTop = "-" + pos.yanchor * el.height + "px";
+ el.style.display = "block";
+ }
}
deferred.resolve();
};
diff --git a/www/js/imachine.js b/www/js/imachine.js
index a256019..b6117f7 100644
--- a/www/js/imachine.js
+++ b/www/js/imachine.js
@@ -19,6 +19,7 @@ html5ks.imachine = (function () {
console.log(inst);
switch (typeof inst) {
case "undefined":
+ deferred.resolve();
break;
case "string": // jump_out
if (!html5ks.data.imachine[inst]) {
@@ -44,15 +45,18 @@ html5ks.imachine = (function () {
case "imenu":
html5ks.api.menu(args[0]).then(function (choice) {
var next = args[1][choice] || args[1].else;
- html5ks.imachine.run(typeof next[0] === "string" ? [next] : next);
+ return html5ks.imachine.run(typeof next[0] === "string" ? [next] : next).then(runInst);
});
break;
case "seen_scene":
+ var next;
if (this.seen_scene(inst[1])) {
- this.run(inst[2]);
+ next = inst[2];
} else {
- this.run(inst[3]);
+ next = inst[3];
}
+ // TODO: there's probably an easier way to do this
+ this.run(typeof next[0] === "string" ? [next] : next).then(runInst);
break;
case "attraction":
if (typeof inst[2] === "number") {