Added ESSENTIALS_VERSION to the save file (with backwards compatibility)

This commit is contained in:
m3rein
2020-09-05 13:38:34 +02:00
parent 9aebe1e4d2
commit d57e1dd0c1
2 changed files with 10 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
class PokemonLoadPanel < SpriteWrapper class PokemonLoadPanel < SpriteWrapper
attr_reader :selected attr_reader :selected
TEXTCOLOR = Color.new(232,232,232) TEXTCOLOR = Color.new(232,232,232)
TEXTSHADOWCOLOR = Color.new(136,136,136) TEXTSHADOWCOLOR = Color.new(136,136,136)
MALETEXTCOLOR = Color.new(56,160,248) MALETEXTCOLOR = Color.new(56,160,248)
@@ -19,7 +19,7 @@ class PokemonLoadPanel < SpriteWrapper
@selected = (index==0) @selected = (index==0)
@bgbitmap = AnimatedBitmap.new("Graphics/Pictures/loadPanels") @bgbitmap = AnimatedBitmap.new("Graphics/Pictures/loadPanels")
@refreshBitmap = true @refreshBitmap = true
@refreshing = false @refreshing = false
refresh refresh
end end
@@ -356,6 +356,7 @@ class PokemonLoadScreen
metadata = Marshal.load(f) metadata = Marshal.load(f)
$PokemonBag = Marshal.load(f) $PokemonBag = Marshal.load(f)
$PokemonStorage = Marshal.load(f) $PokemonStorage = Marshal.load(f)
$SaveVersion = Marshal.load(f) unless f.eof?
pbRefreshResizeFactor # To fix Game_Screen pictures pbRefreshResizeFactor # To fix Game_Screen pictures
magicNumberMatches = false magicNumberMatches = false
if $data_system.respond_to?("magic_number") if $data_system.respond_to?("magic_number")
@@ -456,12 +457,12 @@ class PokemonLoadScreen
savedata = [] savedata = []
if safeExists?(savefile) if safeExists?(savefile)
File.open(savefile,"rb") { |f| File.open(savefile,"rb") { |f|
15.times { savedata.push(Marshal.load(f)) } 16.times { savedata.push(Marshal.load(f)) }
} }
savedata[3]=$PokemonSystem savedata[3]=$PokemonSystem
begin begin
File.open(RTP.getSaveFileName("Game.rxdata"),"wb") { |f| File.open(RTP.getSaveFileName("Game.rxdata"),"wb") { |f|
15.times { |i| Marshal.dump(savedata[i],f) } 16.times { |i| Marshal.dump(savedata[i],f) }
} }
rescue rescue
end end
@@ -495,7 +496,7 @@ module FontInstaller
'pkmnrs.ttf', 'pkmnrs.ttf',
'pkmndp.ttf', 'pkmndp.ttf',
'pkmnfl.ttf' 'pkmnfl.ttf'
] ]
# names (not filenames) of fonts to be installed # names (not filenames) of fonts to be installed
Names = [ Names = [
'Power Green', 'Power Green',
@@ -520,7 +521,7 @@ module FontInstaller
return ENV['windir'] + '\\Fonts\\' return ENV['windir'] + '\\Fonts\\'
else else
return '\\Windows\\Fonts\\' return '\\Windows\\Fonts\\'
end end
end end
AFR = Win32API.new('gdi32', 'AddFontResource', ['P'], 'L') AFR = Win32API.new('gdi32', 'AddFontResource', ['P'], 'L')
@@ -628,4 +629,4 @@ module FontInstaller
pbMessage(_INTL("To install the necessary fonts, copy the files in this game's Fonts folder to the Fonts folder in Control Panel.")) pbMessage(_INTL("To install the necessary fonts, copy the files in this game's Fonts folder to the Fonts folder in Control Panel."))
end end
end end
end end

View File

@@ -24,6 +24,7 @@ def pbSave(safesave=false)
Marshal.dump($PokemonMap,f) Marshal.dump($PokemonMap,f)
Marshal.dump($PokemonBag,f) Marshal.dump($PokemonBag,f)
Marshal.dump($PokemonStorage,f) Marshal.dump($PokemonStorage,f)
Marshal.dump(ESSENTIALS_VERSION,f)
} }
Graphics.frame_reset Graphics.frame_reset
rescue rescue
@@ -153,4 +154,4 @@ def pbSaveScreen
screen = PokemonSaveScreen.new(scene) screen = PokemonSaveScreen.new(scene)
ret = screen.pbSaveScreen ret = screen.pbSaveScreen
return ret return ret
end end