From bc1316aed72df7c8ff597f56f495d4aeb3a5769d Mon Sep 17 00:00:00 2001 From: inc0der Date: Wed, 30 Sep 2020 13:53:25 -0300 Subject: [PATCH] Fix cursor not being saved with game data (#16) --- src/Main.hx | 2 +- src/core/Stage.hx | 9 +++++---- src/scenes/Scene_Base.hx | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Main.hx b/src/Main.hx index 91cc1f8..8e1cd21 100644 --- a/src/Main.hx +++ b/src/Main.hx @@ -31,7 +31,7 @@ class Main { utils.Comment.title('DataManager'); FnMacros.jsPatch(false, RmTouchInput, TouchInput); FnMacros.jsPatch(true, RmStage, Stage); - FnMacros.jsPatch(false, RmGame_System, Game_System); + FnMacros.jsPatch(true, RmGame_System, Game_System); FnMacros.jsPatch(true, RmScene_Base, Scene_Base); FnMacros.jsPatch(true, RmScene_Map, Scene_Map); #if compileMV diff --git a/src/core/Stage.hx b/src/core/Stage.hx index ccf5d65..a341004 100644 --- a/src/core/Stage.hx +++ b/src/core/Stage.hx @@ -39,10 +39,11 @@ class Stage extends RmStage { public function updateCursors(): Void { var cursors: Array = Main.params.cursors; - var needsUpdate: Bool = DataManager.isDatabaseLoaded() && CursorLoader.activeData == null; - - if (needsUpdate && untyped GameSystem.activeCursor != null) { - CursorLoader.activeData = untyped GameSystem.activeCursor; + + if (DataManager.isDatabaseLoaded() && untyped GameSystem.activeCursor != null) { + if (untyped GameSystem.activeCursor != CursorLoader.activeData) { + CursorLoader.activeData = untyped GameSystem.activeCursor; + } } if (CursorLoader.hasActiveData()) { diff --git a/src/scenes/Scene_Base.hx b/src/scenes/Scene_Base.hx index 470e62d..5747c18 100644 --- a/src/scenes/Scene_Base.hx +++ b/src/scenes/Scene_Base.hx @@ -2,6 +2,7 @@ package scenes; import rm.core.TouchInput; import core.CursorLoader; +import rm.Globals; import rm.scenes.Scene_Base as RmScene_Base; class Scene_Base extends RmScene_Base { @@ -19,6 +20,7 @@ class Scene_Base extends RmScene_Base { public function onCursorChange(data) { untyped this._cursor.cursorData = data; + untyped Globals.GameSystem.activeCursor = data; } public function onCursorHoverChange(hoverName) {