diff --git a/keyboard.json b/keyboard.json index e5fe3a3..f719dae 100644 --- a/keyboard.json +++ b/keyboard.json @@ -4,7 +4,6 @@ "c": "next", "d": "previous", "i": "video", - "j": "scribble", "1": "dtmfPlay1", "2": "dtmfPlay2", "3": "dtmfPlay3", diff --git a/plugins/hugo/cyxx/hugo.min.js b/plugins/hugo/cyxx/hugo.min.js index 6819f34..3c31cef 100644 --- a/plugins/hugo/cyxx/hugo.min.js +++ b/plugins/hugo/cyxx/hugo.min.js @@ -376,7 +376,8 @@ var Module = "undefined" !== typeof Module ? Module : {}, gameTicks = 0, keyboard_left_pressed = !1, keyboard_right_pressed = !1, - keyboard_f1_pressed = !1; + keyboard_f1_pressed = !1, + lagMode = !0; function doGameTick() { 0 == gameTicks && Module._train_init(MAP_NUMBER); Module._train_update(); @@ -408,24 +409,47 @@ Module.togglePalette = function () { keyboard_f1_pressed = !0; }; Module.onKeyDown = function (a) { - var r = Math.random(); - if (r < 0.3) return; - var exec = function () { + if ("KeyJ" == a.code) { lagMode = !lagMode; return; } + if (lagMode) { + var r = Math.random(); + if (r < 0.3) return; + var exec = function () { + if ("Digit4" == a.code) keyboard_left_pressed = !0; + else if ("Digit6" == a.code) keyboard_right_pressed = !0; + else if ("KeyV" == a.code || "KeyE" == a.code) keyboard_f1_pressed = !0; + else if ("KeyI" == a.code) Module.toggleGame(); + }; + if (r < 0.6) { + setTimeout(exec, 1000 + Math.random() * 2000); + return; + } + exec(); + } else { if ("Digit4" == a.code) keyboard_left_pressed = !0; else if ("Digit6" == a.code) keyboard_right_pressed = !0; else if ("KeyV" == a.code || "KeyE" == a.code) keyboard_f1_pressed = !0; else if ("KeyI" == a.code) Module.toggleGame(); - }; - if (r < 0.6) { - setTimeout(exec, 1000 + Math.random() * 2000); - return; } - exec(); }; Module.onMouseDown = function (a) { - var r = Math.random(); - if (r < 0.3) return; - var exec = function () { + if (lagMode) { + var r = Math.random(); + if (r < 0.3) return; + var exec = function () { + var b = document.getElementById("hugo-canvas").getBoundingClientRect(), + c = a.clientX - b.left; + a = a.clientY - b.top; + -51 <= a && + 164 >= a && + (0 <= c && 128 >= c && (keyboard_left_pressed = !0), + 128 <= c && 256 >= c && (keyboard_right_pressed = !0)); + }; + if (r < 0.6) { + setTimeout(exec, 1000 + Math.random() * 2000); + return; + } + exec(); + } else { var b = document.getElementById("hugo-canvas").getBoundingClientRect(), c = a.clientX - b.left; a = a.clientY - b.top; @@ -433,12 +457,7 @@ Module.onMouseDown = function (a) { 164 >= a && (0 <= c && 128 >= c && (keyboard_left_pressed = !0), 128 <= c && 256 >= c && (keyboard_right_pressed = !0)); - }; - if (r < 0.6) { - setTimeout(exec, 1000 + Math.random() * 2000); - return; } - exec(); }; var moduleOverrides = {}, key;