summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-08-03 16:21:37 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-08-03 16:35:16 -0400
commitd47fade7099b96fdabb3a5fd3d6196b9a66ce49e (patch)
tree687ac3a3af17007c71263c468e6b5bcd2bd9d6d7
parente3e9a0947a2b04348cc9b77aff054960485b4393 (diff)
downloadhtml5ks-d47fade7099b96fdabb3a5fd3d6196b9a66ce49e.tar.xz
html5ks-d47fade7099b96fdabb3a5fd3d6196b9a66ce49e.zip
fix stuff
-rw-r--r--nginx.conf2
-rw-r--r--unrpyc/Makefile4
-rw-r--r--unrpyc/decompiler.py54
-rw-r--r--www/js/api.js93
-rw-r--r--www/js/characters.js22
-rw-r--r--www/js/html5ks.js2
-rw-r--r--www/js/images.js2
-rw-r--r--www/js/menu.js22
8 files changed, 96 insertions, 105 deletions
diff --git a/nginx.conf b/nginx.conf
index be4b45a..cc1f0d7 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -37,7 +37,7 @@ http {
gzip on;
include nginx.gen.conf;
- gzip_types text/plain text/css application/javascript application/json;
+ gzip_types application/javascript application/json image/svg+xml text/plain text/css;
gzip_vary on;
sendfile on;
diff --git a/unrpyc/Makefile b/unrpyc/Makefile
index 0463da9..6e28df4 100644
--- a/unrpyc/Makefile
+++ b/unrpyc/Makefile
@@ -1,7 +1,7 @@
all: script.json.gz
script.json.gz: script.json
- gzip -c script.json > script.json.gz
+ gzip -9c script.json > script.json.gz
touch script.json script.json.gz
script.json: $(patsubst %.rpyc,%.json,$(wildcard *.rpyc))
@@ -16,7 +16,7 @@ script-%.json: script-%.json.o
sed -i -e 's/^{//;s/}$$/,/' $@
clean:
- rm -f *.json.o *.json
+ rm -f *.json.o *.json script.json.gz
test: all
jshint --show-non-errors *.json
diff --git a/unrpyc/decompiler.py b/unrpyc/decompiler.py
index 64d0e4c..5a9b3bb 100644
--- a/unrpyc/decompiler.py
+++ b/unrpyc/decompiler.py
@@ -24,7 +24,9 @@ import renpy.atl as atl
import code
DECOMPILE_SCREENS = False
+global firstLabel
firstLabel = True
+global warnedATL
warnedATL = False
def pretty_print_ast(out_file, ast):
@@ -64,7 +66,7 @@ def print_atl(f, atl_block, indent_level):
f.write('pass\n')
for stmt in atl_block.statements:
indent(f, indent_level)
-
+
if type(stmt) is atl.RawMultipurpose:
# warper
if stmt.warp_function:
@@ -76,38 +78,38 @@ def print_atl(f, atl_block, indent_level):
elif stmt.duration.strip() != '0':
f.write('pause')
f.write(" %s" % (stmt.duration.strip(), ))
-
+
# revolution
if stmt.revolution:
f.write("%s " % (stmt.revolution, ))
-
+
# circles
if stmt.circles != "0":
f.write("circles %s " % (stmt.circles.strip(), ))
-
+
# splines
for (name, exprs) in stmt.splines:
f.write("%s " % (name, ))
for expr in exprs:
f.write("knot %s " % (expr.strip(), ))
-
+
# properties
for (k, v) in stmt.properties:
f.write("%s %s " % (k, v.strip()))
-
+
# with
for (expr, with_expr) in stmt.expressions:
f.write("%s " % (expr.strip(), ))
if with_expr:
f.write("with %s " % (with_expr, ))
-
+
f.write("\n")
-
+
elif type(stmt) is atl.RawBlock:
# what does stmt.animation do?
f.write("block:\n")
print_atl(f, stmt, indent_level + 1)
-
+
elif type(stmt) is atl.RawChoice:
first = True
for (chance, block) in stmt.choices:
@@ -115,22 +117,22 @@ def print_atl(f, atl_block, indent_level):
first = False
else:
indent(f, indent_level)
-
+
f.write("choice")
if chance != "1.0":
f.write(" %s" % (chance, ))
f.write(":\n")
print_atl(f, block, indent_level + 1)
-
+
elif type(stmt) is atl.RawContainsExpr:
f.write("contains %s\n" % (stmt.expression, ))
-
+
elif type(stmt) is atl.RawEvent:
f.write("event %s\n" % (stmt.name, ))
-
+
elif type(stmt) is atl.RawFunction:
f.write("function %s\n" % (stmt.expr, ))
-
+
elif type(stmt) is atl.RawOn:
first = True
for name, block in list(stmt.handlers.items()):
@@ -138,10 +140,10 @@ def print_atl(f, atl_block, indent_level):
first = False
else:
indent(f, indent_level)
-
+
f.write("on %s:\n" % (name, ))
print_atl(f, block, indent_level + 1)
-
+
elif type(stmt) is atl.RawParallel:
first = True
for block in stmt.blocks:
@@ -149,19 +151,19 @@ def print_atl(f, atl_block, indent_level):
first = False
else:
indent(f, indent_level)
-
+
f.write("parallel:\n")
print_atl(f, block, indent_level + 1)
-
+
elif type(stmt) is atl.RawRepeat:
f.write("repeat")
if stmt.repeats:
f.write(" %s" % (stmt.repeats, )) # not sure if this is even a string
f.write("\n")
-
+
elif type(stmt) is atl.RawTime:
f.write("time %s\n" % (stmt.time, ))
-
+
else:
f.write("TODO atl.%s\n" % type(stmt).__name__)
@@ -467,16 +469,16 @@ def print_params(f, paraminfo):
f.write(")")
# Print while command, from http://forum.cheatengine.org/viewtopic.php?p=5377683
-def print_While(f, stmt, indent_level):
- f.write("while %s:\n" % (stmt.condition, ))
- for inner_stmt in stmt.block:
+def print_While(f, stmt, indent_level):
+ f.write("while %s:\n" % (stmt.condition, ))
+ for inner_stmt in stmt.block:
print_statement(f, inner_stmt, indent_level + 1)
# Print define command, by iAmGhost
-def print_Define(f, stmt, indent_level):
+def print_Define(f, stmt, indent_level):
f.write("define %s = %s\n" % (stmt.varname, stmt.code.source,))
-
-
+
+
statement_printer_dict = {
ast.Label: print_Label,
ast.Say: print_Say,
diff --git a/www/js/api.js b/www/js/api.js
index 44923ac..da45467 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -79,6 +79,10 @@ window.html5ks.api = {
video = html5ks.elements.video,
src = "dump/video/" + vid_src + ".";
+ this.stop("all");
+ this.speed("auto", false);
+ this.speed("skip", false);
+
if (Modernizr.video.webm) {
video.src = src + "webm";
} else if (Modernizr.video.ogg) {
@@ -87,8 +91,6 @@ window.html5ks.api = {
video.src = src + "mp4";
}
- this.stop("all");
-
video.load();
video.style.display = "block";
video.volume = html5ks.persistent.musicVolume;
@@ -149,10 +151,8 @@ window.html5ks.api = {
if (this[cmd]) {
return this[cmd].apply(this, args);
} else if (inst.length === 1) {
- console.log("hopefully this is dialogue");
return this.character("name_only", cmd);
} else if (/^[A-Z]/.test(cmd)) {
- console.log("cmd starts with caps, probably character");
return this.character(cmd, args[0]);
} else {
console.error("no such cmd " + cmd);
@@ -305,33 +305,17 @@ window.html5ks.api = {
return str;
},
- nvlsay: function (text) {
- var deferred = when.defer();
- html5ks.elements.nvlsay.innerHTML += "<span class='nvl-block'>" + text + "</span>";
- html5ks.elements.nvlctc.style.display = "block";
- html5ks.next = function () {
- html5ks.elements.nvlctc.style.display = "none";
- deferred.resolve();
- html5ks.next = function () {};
- };
- return deferred.promise;
- },
-
- character: function (name, str, extend, noc) {
+ character: function (charName, str, extend) {
var deferred = when.defer(),
text = this.tag(str),
- char = html5ks.data.characters[name],
- w = /{w(=\d*\.\d*)?}/.exec(str);
+ char = typeof charName === "string" ? html5ks.data.characters[charName] : charName,
+ w = /{w=?(\d*\.\d*)?}(.*)/.exec(str);
if (!char) {
- if (name) {
- char = {
- name: name,
- };
- } else {
- char = this._lastchar;
- }
+ char = {
+ name: name
+ };
}
if (typeof char.what_prefix === "undefined") {
char.what_prefix = "“";
@@ -348,9 +332,14 @@ window.html5ks.api = {
}
if (char.kind === "nvl") {
- this.nvlsay(text).then(function () {
+ var deferred = when.defer();
+ html5ks.elements.nvlsay.innerHTML += "<span class='nvl-block'>" + text + "</span>";
+ html5ks.elements.nvlctc.style.display = "block";
+ html5ks.next = function () {
+ html5ks.elements.nvlctc.style.display = "none";
deferred.resolve();
- });
+ html5ks.next = function () {};
+ };
return deferred.promise;
}
var who = html5ks.elements.who;
@@ -369,37 +358,35 @@ window.html5ks.api = {
html5ks.elements.say.innerHTML = text;
}
- if (!noc) {
- if (w) {
- html5ks.next = function () {
- html5ks.next = function () {};
- html5ks.api.extend(str.substring(w.index + w[0].length)).then(function () {
- deferred.resolve();
- });
- };
- if (w[1]) {
- setTimeout(html5ks.next, parseFloat(w[1].substring(1), 10) * 1000);
- return deferred.promise;
- }
- } else {
- html5ks.next = function () {
- html5ks.elements.ctc.style.display = "none";
- deferred.resolve(text);
- html5ks.next = function () {};
- };
- }
- html5ks.elements.ctc.style.display = "block";
- if (html5ks.state.skip || str.indexOf("{nw}") > -1) {
- html5ks.next();
- } else if (html5ks.state.auto) {
- setTimeout(html5ks.next, 1000 + html5ks.persistent.autoModeDelay * text.length);
+ if (w) {
+ html5ks.next = function () {
+ html5ks.next = function () {};
+ html5ks.api.extend(w[2]).then(function () {
+ deferred.resolve();
+ });
+ };
+ if (w[1]) {
+ setTimeout(html5ks.next, parseFloat(w[1], 10) * 1000);
+ return deferred.promise;
}
+ } else {
+ html5ks.next = function () {
+ html5ks.elements.ctc.style.display = "none";
+ deferred.resolve(text);
+ html5ks.next = function () {};
+ };
+ }
+ html5ks.elements.ctc.style.display = "block";
+ if (html5ks.state.skip || str.indexOf("{nw}") > -1) {
+ html5ks.next();
+ } else if (html5ks.state.auto) {
+ setTimeout(html5ks.next, 3.5 * html5ks.persistent.autoModeDelay * (3000 + text.length));
}
return deferred.promise;
},
extend: function (str) {
- return this.character(null, str, true);
+ return this.character(this._lastchar, str, true);
},
Pause: function (duration) {
diff --git a/www/js/characters.js b/www/js/characters.js
index c5d41d6..df6209c 100644
--- a/www/js/characters.js
+++ b/www/js/characters.js
@@ -1,18 +1,18 @@
window.html5ks.data.characters = {
name_only: {name: "", what_prefix: "", what_suffix: ""},
-
+
hi: {name: "Hisao", color: "#629276"},
-
+
ha: {name: "Hanako", color: "#897CBF"},
emi: {name: "Emi", color: "#FF8D7C"},
rin: {name: "Rin", color: "#b14343"},
li: {name: "Lilly", color: "#F9EAA0"},
shi: {name: "Shizune", color: "#72ADEE"},
mi: {name: "Misha", color: "#FF809F"},
-
+
mi_shi: {name: "Shizune", color: "#FF809F"},
mi_not_shi: {name: "{s}Shizune{/s} Misha", color: "#FF809F"},
-
+
ke: {name: "Kenji", color: "#CC7C2A"},
mu: {name: "Mutou", color: "#FFFFFF"},
nk: {name: "Nurse", color: "#FFFFFF"},
@@ -25,12 +25,12 @@ window.html5ks.data.characters = {
emm: {name: "Meiko", color: "#995050"},
sk: {name: "Shopkeep", color: "#7187A8"},
mk: {name: "Miki", color: "#AD735E"},
-
+
mystery: {name: "???"},
-
+
ssh: {name: "Shizune", color: "#72ADEE", what_prefix: "[ ", what_suffix: " ]"},
his: {name: "Hisao", color: "#629276", what_prefix: "[ ", what_suffix: " ]"},
-
+
ha_: {name: "Purple-haired girl", color: "#897CBF"},
emi_: {name: "Twintails girl", color: "#FF8D7C"},
rin_: {name: "Strange girl", color: "#b14343"},
@@ -46,17 +46,17 @@ window.html5ks.data.characters = {
hx_: {name: "Huge man", color: "#99AACC"},
hh_: {name: "Slim girl", color: "#6299FF"},
emm_: {name: "Woman with braid", color: "#995050"},
-
+
n: {name: null, kind: "nvl", what_prefix: "", what_suffix: ""},
-
- nb: {name: null,
+
+ nb: {name: null,
ctc: null,
what_color: "#666666",
what_line_spacing: 8,
what_prefix: "",
what_suffix: "",
window_style: "b_nvl_window"},
-
+
rinbabble: {name: null,
kind: "nvl",
what_prefix: "{color: #FF8D7C}{b}Rin{/b}{/color}\n“",
diff --git a/www/js/html5ks.js b/www/js/html5ks.js
index 4f54844..ab50cea 100644
--- a/www/js/html5ks.js
+++ b/www/js/html5ks.js
@@ -134,6 +134,8 @@ window.html5ks = {
window.onresize = html5ks.scale;
this.elements.container.addEventListener("mouseup", function (e) {
if (html5ks.state.status === "scene") {
+ html5ks.api.speed("skip", false);
+ html5ks.api.speed("auto", false);
switch (e.button) {
case 0:
html5ks.next();
diff --git a/www/js/images.js b/www/js/images.js
index c5e95ad..31e1434 100644
--- a/www/js/images.js
+++ b/www/js/images.js
@@ -1171,7 +1171,7 @@ window.html5ks.data.images = {
},
"mural_pan": "vfx/mural.jpg",
- rin_exhibition_paintings: "vfx/rin_exhibition_paintings.jpg",
+ rin_exhibition_paintings: "vfx/rin_exhibition_paintings.jpg",
rin_exhibition_sold: "vfx/rin_exhibition_sold.jpg",
rin_exhibition_c: "vfx/rin_exhibition_c.jpg",
diff --git a/www/js/menu.js b/www/js/menu.js
index c03212e..b940b30 100644
--- a/www/js/menu.js
+++ b/www/js/menu.js
@@ -43,7 +43,7 @@
var options = document.getElementsByClassName("option");
var change = function (e) {
var target = e.target;
- values[target.id] = target.type === "checkbox" ? target.checked : target.value;
+ html5ks.persistent[target.id] = target.type === "checkbox" ? target.checked : target.value;
switch (target.id) {
case "fullscreen":
if (target.checked) {
@@ -87,8 +87,6 @@
switch (html5ks.state.status) {
case "scene":
case "context":
- html5ks.api.speed("skip", false);
- html5ks.api.speed("auto", false);
this.context();
}
e.preventDefault();
@@ -106,16 +104,17 @@
e.stopPropagation();
}, false);
+ var close = function () {
+ window.close();
+ top.open('','_self','');
+ top.close();
+ };
["AppleWebKit", "MSIE", "Trident"].forEach(function (ua) {
if (navigator.userAgent.indexOf(ua) > -1) {
var quit = document.getElementsByClassName("quit");
- for (var i = quit.length - 1; i >= 0; i++) {
- quit[i].className = quit.className.replace("disabled", "");
- quit[i].addEventListener("click", function () {
- window.close();
- top.open('','_self','');
- top.close();
- }, false);
+ for (var i = quit.length - 1; i >= 0; i--) {
+ quit[i].className = quit[i].className.replace("disabled", "");
+ quit[i].addEventListener("click", close, false);
}
return false;
}
@@ -197,6 +196,7 @@
context: function (show, transitional) {
switch (show) {
case true:
+ this._hadWindow = html5ks.elements.window.style.display !== "none";
html5ks.state.status = "context";
html5ks.elements.gray.style.display = "block";
html5ks.elements.window.style.display = "none";
@@ -205,7 +205,7 @@
case false:
html5ks.state.status = "scene";
html5ks.elements.gray.style.display = "none";
- if (html5ks.state.status === "scene") {
+ if (html5ks.state.status === "scene" && this._hadWindow) {
html5ks.elements.window.style.display = "block";
}
this.elements.context.style.display = "none";