04-30-2020, 03:36 AM
Hrm... thinking thinking.... lotta projects in my mind (and others that I get suckered into...)
At first thought, I figured you would need to have the SaveFile change its design from saving files like Save1.rxdata, Save2.rxdata... and so on.
Instead, I was thinking something else.... When the default system shows the 'SaveFile' windows, it shows the party members as chararactersets in each window. This means, you can access the game data for each save file.
Now the default system only loads but so much data, and not the name of the game map. BUT that can be fixed... and I did. It just meant adding in a tried and true method of getting the map name, and performing a few edits to the Window_SaveFile class....
Enjoy.
At first thought, I figured you would need to have the SaveFile change its design from saving files like Save1.rxdata, Save2.rxdata... and so on.
Instead, I was thinking something else.... When the default system shows the 'SaveFile' windows, it shows the party members as chararactersets in each window. This means, you can access the game data for each save file.
Now the default system only loads but so much data, and not the name of the game map. BUT that can be fixed... and I did. It just meant adding in a tried and true method of getting the map name, and performing a few edits to the Window_SaveFile class....
Code:
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Get Map Name
#--------------------------------------------------------------------------
def map_name
@mapinfo = load_data("Data/MapInfos.rxdata") if @mapinfo == nil
return @mapinfo[@map_id].name
end
end
#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
# This window displays save files on the save and load screens.
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :filename # file name
attr_reader :selected # selected
#--------------------------------------------------------------------------
# * Object Initialization
# file_index : save file index (0-3)
# filename : file name
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 64 + file_index % 4 * 104, 640, 104)
self.contents = Bitmap.new(width - 32, height - 32)
@file_index = file_index
@filename = "Save#{@file_index + 1}.rxdata"
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
# ==================================================
# -- This skips through other pieces of data until
# We get to the game map section
t = Marshal.load(file) # Self Switches
t = Marshal.load(file) # Screen
t = Marshal.load(file) # Actors
t = Marshal.load(file) # Party
t = Marshal.load(file) # Troop
# ==================================================
@game_map = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
end
refresh
@selected = false
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# If save file exists
if @file_exist
# Draw file number
self.contents.font.color = normal_color
name = "File#{@file_index + 1}: " + @game_map.map_name
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
# Draw character
for i in 0...@characters.size
bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
x = 300 - @characters.size * 32 + i * 64 - cw / 2
self.contents.blt(x, 68 - ch, bitmap, src_rect)
end
# Draw play time
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 8, 600, 32, time_string, 2)
# Draw timestamp
self.contents.font.color = normal_color
time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
self.contents.draw_text(4, 40, 600, 32, time_string, 2)
else
# Draw file number
self.contents.font.color = normal_color
name = "File#{@file_index + 1}"
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
end
end
end
Enjoy.