Save data rewrite & Game module (#91)

This commit is contained in:
Joni Savolainen
2021-02-28 23:26:16 +02:00
committed by GitHub
parent a112a21a87
commit 9c2b6e943b
15 changed files with 1038 additions and 342 deletions

View File

@@ -16,44 +16,6 @@ def pbChooseLanguage
return pbShowCommands(nil,commands)
end
def pbSetUpSystem
begin
trainer = nil
framecount = 0
game_system = nil
pokemonSystem = nil
havedata = false
File.open(RTP.getSaveFileName("Game.rxdata")) { |f|
trainer = Marshal.load(f)
framecount = Marshal.load(f)
game_system = Marshal.load(f)
pokemonSystem = Marshal.load(f)
}
raise "Corrupted file" if !trainer.is_a?(PlayerTrainer)
raise "Corrupted file" if !framecount.is_a?(Numeric)
raise "Corrupted file" if !game_system.is_a?(Game_System)
raise "Corrupted file" if !pokemonSystem.is_a?(PokemonSystem)
havedata = true
rescue
game_system = Game_System.new
pokemonSystem = PokemonSystem.new
end
if $INEDITOR
pbSetResizeFactor(1.0)
else
$game_system = game_system
$PokemonSystem = pokemonSystem
pbSetResizeFactor([$PokemonSystem.screensize, 4].min)
end
# Load constants
GameData.load_all
if Settings::LANGUAGES.length>=2
pokemonSystem.language = pbChooseLanguage if !havedata
pbLoadMessages("Data/"+Settings::LANGUAGES[pokemonSystem.language][1])
end
end
def pbScreenCapture
t = pbGetTimeNow
filestart = t.strftime("[%Y-%m-%d] %H_%M_%S")