Up-in-the-Air – commitdiff

You can use Git to clone the repository via the web URL. Download snapshot (zip)
Move cheat buffer to another place in the data structure
authorJulian Fietkau <git@fietkau.software>
Mon, 30 Sep 2024 20:06:05 +0000 (22:06 +0200)
committerJulian Fietkau <git@fietkau.software>
Mon, 30 Sep 2024 20:06:05 +0000 (22:06 +0200)
main.js

diff --git a/main.js b/main.js
index b89a52ff0170e48c42947afe53fa24e83019db7c..eda032a9f49131fd31e53f4917266e7995b402a9 100644 (file)
--- a/main.js
+++ b/main.js
@@ -668,7 +668,7 @@ game['fn'].reset = () => {
   }
 }
 
-game['fn'].animate = ( scene) => {
+game['fn'].animate = (scene) => {
   if(!('startTime' in game)) {
     game.startTime = game.view.clock.getElapsedTime();
   }
@@ -1687,8 +1687,8 @@ game['fn'].moveToPage = (target, skipFade = false) => {
       game.ui.reachedStart = true;
     }, fadeDuration);
   }
-  if(target == 'title') {
-    game.ui.cheatBuffer = '';
+  if(target == 'title' && game.view) {
+    game.view.cheatBuffer = '';
   }
   if(target == 'title' && (!game.ui.currentPage || ['loading', 'controls'].includes(game.ui.currentPage))) {
     game['fn'].initializeGame(game.ui.root.querySelector('canvas'));
@@ -2139,12 +2139,12 @@ game['fn'].start = () => {
       return;
     }
     if(game.ui.currentPage == 'title' && e.key.match(/[a-z]/)) {
-      game.ui.cheatBuffer = (game.ui.cheatBuffer + e.key).slice(-25);
+      game.view.cheatBuffer = (game.view.cheatBuffer + e.key).slice(-25);
       for(let len = 10; len <= 25; len++) {
-        if(game.ui.cheatBuffer.length < len) {
+        if(game.view.cheatBuffer.length < len) {
           break;
         }
-        let unlock = game['fn'].unlockWithKey(game.ui.cheatBuffer.slice(-len));
+        let unlock = game['fn'].unlockWithKey(game.view.cheatBuffer.slice(-len));
         if(unlock && unlock['type'] == 'feather' && !game.settings['unlocks'].includes(unlock['name'])) {
           game['fn'].playRandomSound();
           game['fn'].unlockFeather(unlock['name'], unlock['url']);
@@ -2225,6 +2225,7 @@ game['fn'].start = () => {
   }, (err) => {
     console.error(err);
   });
+
 };
 
 // Set up name mirrors for each function that should survive most minifiers and transpilers