From 9ce8b92fbd653b013cf1680109373ba35e58fe18 Mon Sep 17 00:00:00 2001 From: FL Date: Thu, 12 Aug 2021 16:23:27 -0300 Subject: [PATCH] Fix event command "Return to Title Screen" (#124) Fix loading a game after event command "Return to Title Screen" starting a loop. --- Data/Scripts/002_Save data/002_SaveData_Value.rb | 12 ++++++++++++ Data/Scripts/003_Game processing/002_Scene_Map.rb | 2 ++ 2 files changed, 14 insertions(+) diff --git a/Data/Scripts/002_Save data/002_SaveData_Value.rb b/Data/Scripts/002_Save data/002_SaveData_Value.rb index 92d2d2077..7e5bdf9da 100644 --- a/Data/Scripts/002_Save data/002_SaveData_Value.rb +++ b/Data/Scripts/002_Save data/002_SaveData_Value.rb @@ -75,6 +75,11 @@ module SaveData return @loaded end + # Marks value as unloaded. + def mark_as_unloaded + @loaded = false + end + # Uses the {#from_old_format} proc to select the correct data from # +old_format+ and return it. # Returns nil if the proc is undefined. @@ -221,6 +226,13 @@ module SaveData load_values(save_data) { |value| !value.loaded? } end + # Marks all values that aren't loaded on bootup as unloaded. + def self.mark_values_as_unloaded + @values.each do |value| + value.mark_as_unloaded unless value.load_in_bootup? + end + end + # Loads each value from the given save data that has # been set to be loaded during bootup. Done when a save file exists. # @param save_data [Hash] save data to load diff --git a/Data/Scripts/003_Game processing/002_Scene_Map.rb b/Data/Scripts/003_Game processing/002_Scene_Map.rb index 0a939dd2a..349261154 100644 --- a/Data/Scripts/003_Game processing/002_Scene_Map.rb +++ b/Data/Scripts/003_Game processing/002_Scene_Map.rb @@ -187,6 +187,8 @@ class Scene_Map end updateSpritesets if $game_temp.to_title + $game_temp.to_title = false + SaveData.mark_values_as_unloaded $scene = pbCallTitle return end