#====================================================================
# SCENE FILE LIKE FINAL FANTASY
#====================================================================
# More saveslots by Erzengel, MapName by ccoa
#====================================================================
# Edits by Erzengel, snstar2006 and woratana
#====================================================================
# Crappy fusion by Maverick Highwind
#====================================================================
class Game_Map
attr_reader :name
def setup(map_id)
@map_id = map_id
@map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
@name = load_data("Data/MapInfos.rvdata")[@map_id].name
@display_x = 0
@display_y = 0
@passages = $data_system.passages
referesh_vehicles
setup_events
setup_scroll
setup_parallax
@need_refresh = false
end
end
class Scene_File < Scene_Base
def write_save_data(file)
characters = []
for actor in $game_party.members
characters.push([actor.character_name, actor.character_index])
end
$game_system.save_count += 1
$game_system.version_id = $data_system.version_id
@last_bgm = RPG::BGM::last
@last_bgs = RPG::BGS::last
Marshal.dump($game_map.name, file)
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
Marshal.dump(@last_bgm, file)
Marshal.dump(@last_bgs, file)
Marshal.dump($game_system, file)
Marshal.dump($game_message, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
def read_save_data(file)
map_name = Marshal.load(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
$game_system = Marshal.load(file)
$game_message = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
if $game_system.version_id != $data_system.version_id
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
end
class Window_SaveFile < Window_Base
def load_gamedata
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
begin
@mapname = Marshal.load(file)
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
@game_system = Marshal.load(file)
@game_message = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@game_self_switches = Marshal.load(file)
@game_actors = Marshal.load(file)
@game_party = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
rescue
@file_exist = false
ensure
file.close
end
end
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
name = Vocab::File + " #{@file_index + 1}"
self.contents.draw_text(4, 0, 200, WLH, name)
@name_width = contents.text_size(name).width
if @file_exist
#draw_party_characters(152, 58)
for i in 0...4
if !@game_party.members[i].nil?
actor = @game_party.members[i]
draw_actor_face(actor, 120+i*80, 2, 72)
end
end
for i in 0...1
if !@game_party.members[i].nil?
actor = @game_party.members[i]
draw_actor_name(actor, 4, 48)
end
end
draw_playtime(-420, 24, contents.width - 4, 2)
draw_mapname(0, 63, contents.width - 3, 32)
#draw_mapname(-372, 63, contents.width - 3, 32)
end
end
def draw_mapname(x, y, width, height)
self.contents.draw_text(x, y, width, height, @mapname, 2)
end
end
#==============================================================================
# ** More saveslots (v1.0 by ERZENGEL)
#------------------------------------------------------------------------------
# The value of the saveslots can be set
#==============================================================================
# value of the saveslots
SAVE_MAX = 99
#==============================================================================
class Window_SaveFile
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 56 + file_index % SAVE_MAX * 120, 544, 120)
@file_index = file_index
@filename = filename
load_gamedata
refresh
@selected = false
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Scene_File
#--------------------------------------------------------------------------
def start
super
@file_max = SAVE_MAX
create_menu_background
@help_window = Window_Help.new
create_savefile_windows
if @saving
@index = $game_temp.last_file_index
@help_window.set_text(Vocab::SaveMessage)
else
@index = self.latest_file_index
@help_window.set_text(Vocab::LoadMessage)
end
@savefile_windows[@index].selected = true
@page_file_max = ((416 - @help_window.height) / 120).truncate
for i in 0...@file_max
window = @savefile_windows[i]
if @index > @page_file_max - 1
if @index < @file_max - @page_file_max - 1
@top_row = @index
window.y -= @index * window.height
elsif @index >= @file_max - @page_file_max
@top_row = @file_max - @page_file_max
window.y -= (@file_max - @page_file_max) * window.height
else
@top_row = @index
window.y -= @index * window.height
end
end
window.visible = (window.y >= @help_window.height and
window.y < @help_window.height + @page_file_max * window.height)
end
end
#--------------------------------------------------------------------------
def create_savefile_windows
@top_row = 0
@savefile_windows = []
for i in 0...@file_max
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
end
#--------------------------------------------------------------------------
def cursor_down(wrap)
if @index < @file_max - 1 or wrap
@index = (@index + 1) % @file_max
for i in 0...@file_max
window = @savefile_windows[i]
if @index == 0
@top_row = 0
window.y = @help_window.height + i % @file_max * window.height
elsif @index - @top_row > @page_file_max - 1
window.y -= window.height
end
window.visible = (window.y >= @help_window.height and
window.y < @help_window.height + @page_file_max * window.height)
end
if @index - @top_row > @page_file_max - 1
@top_row += 1
end
end
end
#--------------------------------------------------------------------------
def cursor_up(wrap)
if @index > 0 or wrap
@index = (@index - 1 + @file_max) % @file_max
for i in 0...@file_max
window = @savefile_windows[i]
if @index == @file_max - 1
@top_row = @file_max - @page_file_max
window.y = @help_window.height + i % @file_max * window.height
window.y -= (@file_max - @page_file_max) * window.height
elsif @index - @top_row < 0
window.y += window.height
end
window.visible = (window.y >= @help_window.height and
window.y < @help_window.height + @page_file_max * window.height)
end
if @index - @top_row < 0
@top_row -= 1
end
end
end
#--------------------------------------------------------------------------
end
#==============================================================================