#============================================================================== # ■ XP-RGSS-19 動くアクター(セーブ&ロード) by Claimh #------------------------------------------------------------------------------ #  ・セーブ&ロード画面にて、アクターが動きます。 #============================================================================== module Move_Actor # 動作タイプ # 0:歩く  1:回る FILE_MOVE = 0 # 動作タイプ<歩く>の向き(2:下 4:左 6:右 8:上) FILE_WA_DIREC = 2 end #============================================================================== # ■ Window_SaveFile #============================================================================== class Window_SaveFile < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化(再定義) #-------------------------------------------------------------------------- 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) @game_self_switches = Marshal.load(file) @game_screen = Marshal.load(file) @game_actors = Marshal.load(file) @game_party = Marshal.load(file) @total_sec = @frame_count / Graphics.frame_rate file.close # 動くアクター表示 @actor_file_sprite = [] for i in 0...@game_party.actors.size actor = @game_party.actors[i] @actor_file_sprite[actor.id] = Sprite_MoveActor.new(nil, actor) @actor_file_sprite[actor.id].move_type = Move_Actor::FILE_MOVE @actor_file_sprite[actor.id].direction = Move_Actor::FILE_WA_DIREC @actor_file_sprite[actor.id].x = 64 * i + 188 @actor_file_sprite[actor.id].y = @file_index * 104 + 148 @actor_file_sprite[actor.id].z = 160 @actor_file_sprite[actor.id].setup end end refresh @selected = false end #-------------------------------------------------------------------------- # ● リフレッシュ(再定義) #-------------------------------------------------------------------------- def refresh self.contents.clear # ファイル番号を描画 self.contents.font.color = normal_color name = "ファイル #{@file_index + 1}" self.contents.draw_text(4, 0, 600, 32, name) @name_width = contents.text_size(name).width # セーブファイルが存在する場合 if @file_exist # キャラクターを描画(動くアクター時は要らない) # 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 # プレイ時間を描画 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) # タイムスタンプを描画 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) end end #-------------------------------------------------------------------------- # ● 動くアクタースプライト更新 #-------------------------------------------------------------------------- def update super if @file_exist for actor in @game_party.actors @actor_file_sprite[actor.id].update end end end #-------------------------------------------------------------------------- # ● 動くアクタースプライト消去 #-------------------------------------------------------------------------- def dispose super if @file_exist for actor in @game_party.actors @actor_file_sprite[actor.id].dispose end end end end