Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # // Last Modified :10/29/2011
- #==============================================================================#
- # Window_SaveFile
- #==============================================================================#
- class Window_SaveFile < Window_Base
- #--------------------------------------------------------------------------#
- # * overwrite method :initialize
- #--------------------------------------------------------------------------#
- def initialize(file_index, filename)
- super( 16, 32 + file_index % 4 * (96 + 32), Graphics.width-32, 96+32 )
- @file_index = file_index
- @filename = filename
- load_gamedata()
- refresh()
- @selected = false
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :refresh
- #--------------------------------------------------------------------------#
- def refresh
- self.contents.clear()
- self.contents.font.color = normal_color
- name = Vocab::File + " #{@file_index + 1}"
- @name_width = contents.text_size(name).width
- self.contents.font.color = normal_color
- if @file_exist
- draw_party_faces( 32, 24 )
- #draw_party_characters(152, 58)
- draw_location( 96, 0 )
- draw_playtime(0, 0, contents.width - 4, 2)
- end
- self.contents.font.color = system_color
- self.contents.draw_text( 4, 0, 200, WLH, name )
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :draw_face
- #--------------------------------------------------------------------------#
- def draw_face( face_name, face_index, x, y, wsize = 96, hsize = 96 )
- bitmap = Cache.face(face_name)
- rect = Rect.new( 0, 0, 0, 0 )
- rect.x = face_index % 4 * 96 + (96 - wsize) / 2
- rect.y = face_index / 4 * 96 + (96 - hsize) / 2
- rect.width = wsize
- rect.height = hsize
- self.contents.blt(x, y, bitmap, rect)
- bitmap.dispose
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :draw_party_faces
- #--------------------------------------------------------------------------#
- def draw_party_faces( x, y )
- for i in 0...@characters.size
- draw_face( @characters[i][2], @characters[i][3], x+(i*112), y, 96, 72 )
- end
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :draw_location
- #--------------------------------------------------------------------------#
- def draw_location( x, y )
- self.contents.font.size = Font.default_size - 2
- self.contents.font.color = system_color
- rect = Rect.new( x+64, y, self.contents.width-x, WLH )
- self.contents.draw_text( rect, @game_system.last_location_name )
- self.contents.font.size = Font.default_size - 4
- self.contents.font.color = normal_color
- rect = Rect.new( x, y, self.contents.width-x, WLH )
- self.contents.draw_text( rect, Vocab.location )
- self.contents.font.size = Font.default_size
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :draw_playtime
- #--------------------------------------------------------------------------#
- def draw_playtime( x, y, width, align )
- 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.size = 18
- self.contents.font.color = system_color
- self.contents.draw_text( x, y, width, WLH, time_string, 2 )
- self.contents.font.size = Font.default_size
- end
- end
- #==============================================================================#
- # Window_FileHelp
- #==============================================================================#
- class Window_FileHelp < IRS::Sprite_Help ; end
- #==============================================================================#
- # Scene_File
- #==============================================================================#
- class Scene_File < Scene_Base
- #--------------------------------------------------------------------------#
- # * overwrite method :start
- #--------------------------------------------------------------------------#
- def start()
- super()
- create_menu_background()
- @help_window = Window_FileHelp.new( 0, 0, Graphics.width, 32 )
- 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
- # // ----------------------------------------------------------------- // #
- @menuback_sprite.bitmap = Cache.system( "Menu_background" )
- @menuback_sprite.opacity= 255
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :create_savefile_windows
- #--------------------------------------------------------------------------#
- def create_savefile_windows
- @savefile_windows = []
- @item_max = 3
- for i in 0...@item_max
- @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
- end
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :write_save_data
- #--------------------------------------------------------------------------#
- def write_save_data(file)
- characters = []
- for actor in $game_party.members
- characters.push([actor.character_name, actor.character_index,
- actor.face_name, actor.face_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(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
- end
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment