summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api.txt12
-rw-r--r--index.html10
-rw-r--r--js/api.js32
-rw-r--r--js/helpers.js6
-rw-r--r--js/imachine_api.js4
-rw-r--r--js/script_api.js28
-rw-r--r--lighttpd.conf2
7 files changed, 87 insertions, 7 deletions
diff --git a/api.txt b/api.txt
index 17d3213..eff997e 100644
--- a/api.txt
+++ b/api.txt
@@ -1,18 +1,20 @@
== imachine{,_replay} api ==
label * -> function
-jump_out -> save & register & call
-call -> ''
+jump_out -> seen_scenes & call
+call -> call
seen_scene(scene) -> return label in seen_scenes
int attraction_*
path_end(chr, is_good)
-iscene(name, is_h, is_end)
-act_op(movie)
-imenu(choice)
+iscene(name, is_h, is_end) -> promise
+✓ act_op(movie) -> promise
+imenu(choice) -> promise
== script api ==
chars: in ui_settings.rpy
e.g. his(text) -> promise
with(transition, action) -> promise
+play(stream, name, fade)
+stream: sound,music,ambient
== prefs ==
h-scenes (tied to shrinkwrap)
diff --git a/index.html b/index.html
index 3bf5749..bc45b25 100644
--- a/index.html
+++ b/index.html
@@ -30,12 +30,20 @@
left: -190px;
}
}
+ #bg,#vid {
+ position: relative;
+ }
</style>
+ <script src="/js/helpers.js"></script>
+ <script src="/js/api.js"></script>
+ <script src="/js/imachine_api.js"></script>
+ <script src="/js/script_api.js"></script>
</head>
<body>
<audio id="music" src="/dump/bgm/Ease.ogg" loop controls></audio>
<div id="container" style="position: relative;">
- <img src="/dump/bgs/school_girlsdormhall.jpg" style="position: relative; animation: 1.5s toright both ease-in;">
+ <img id="bg" src="/dump/bgs/school_girlsdormhall.jpg">
+ <video id="video"></video>
<img src="/dump/ui/bg-say.png" style="position: absolute; top: 440px; left: 0;">
<div style="font: 22px/27px Playtime; color: white; width: 750px; height: 90px; position: absolute; top: 493px; left: 28px;">It doesn't take long to identify the source as Lilly's room, though the deep timbre of the female voice unmistakably belongs not to her, but to her sister.</div>
</div>
diff --git a/js/api.js b/js/api.js
new file mode 100644
index 0000000..311f162
--- /dev/null
+++ b/js/api.js
@@ -0,0 +1,32 @@
+"use strict";
+var save = {
+ seen_scenes: {},
+ attraction: {
+ kenji: 0,
+ sc: 0,
+ hanako: 0
+ },
+ hdisabled: false
+};
+var video = document.getElementById("video");
+function seen_scene(scene) {
+ return !!save.seen_scenes[scene];
+}
+function scene_register(scene) {
+ save.seen_scenes.scene = true;
+}
+function play_video(vid_src) {
+ var deferred = when.defer();
+ video.src = "/video/" + vid_src + ".webm";
+ video.load();
+ video.addEventListener("ended", function () {
+ deferred.resolve(video);
+ }, false);
+ video.addEventListener("error", function () {
+ deferred.reject(video.error);
+ }, false);
+}
+function act_op(this_video) {
+ // strip off extension
+ return play_video(this_video.slice(0,-4));
+}
diff --git a/js/helpers.js b/js/helpers.js
new file mode 100644
index 0000000..e0c5180
--- /dev/null
+++ b/js/helpers.js
@@ -0,0 +1,6 @@
+function STUB() {
+ return console.log("STUB: " + arguments.caller);
+}
+function WARN(msg) {
+ return console.log("WARN: " + arguments.caller + ": " + msg);
+}
diff --git a/js/imachine_api.js b/js/imachine_api.js
new file mode 100644
index 0000000..672405c
--- /dev/null
+++ b/js/imachine_api.js
@@ -0,0 +1,4 @@
+function iscene(target, is_h, is_end) {
+ scene_register(target);
+ return window.script[target]();
+}
diff --git a/js/script_api.js b/js/script_api.js
new file mode 100644
index 0000000..afa5775
--- /dev/null
+++ b/js/script_api.js
@@ -0,0 +1,28 @@
+function windw(action, transition) {
+ var deferred = when.defer();
+ setTimeout(function () {
+ deferred.resolve(action);
+ }, 100);
+ return deferred.promise;
+}
+var types = {
+ "ev": "event",
+ "evh": "event",
+ "ovl": "event",
+ "bg": "bgs",
+ "": "vfx"
+}
+// NOT iscene
+function scene(type, name) {
+ if (typeof name == "undefined") name = type;
+ WARN("don't know extension, trying all");
+ var bg = document.getElementById("bg");
+ var img = "/" + types[type] + "/" + name;
+ bg.onerror = function () {
+ bg.onerror = function () {
+ bg.src = img + ".jpg";
+ };
+ bg.src = img + ".png";
+ };
+ bg.src = img + ".webp";
+}
diff --git a/lighttpd.conf b/lighttpd.conf
index a062b6a..ac7cac4 100644
--- a/lighttpd.conf
+++ b/lighttpd.conf
@@ -1,7 +1,7 @@
server.document-root = "/home/alex/html5ks"
server.port = 8080
mimetype.assign = (
- ".html" => "text/html",
+ ".html" => "text/html; charset=utf-8",
".js" => "text/javascript",
".css" => "text/css",
".txt" => "text/plain",