#============================================================================== # ■ Scene_Save (Version Pokémon) # Pokemon Script Project - Krosk # 01/08/07 #------------------------------------------------------------------------------ # Scène à ne pas modifier de préférence #------------------------------------------------------------------------------
module POKEMON_S class Pokemon_Save def initialize Graphics.freeze number = 0 # Nombre de cadres de sauvegarde à générer for i in 0..2 if FileTest.exist?("Save#{i+1}.rxdata") number += 1 end end @number = number @save_game_window_list = [] for i in 1..@number window = Window_Base.new(33, 10 + (83-20)*(i-1), 216, 45) window.contents = Bitmap.new(548, 48) @save_game_window_list.push(window) end # Cadre nouvelle sauvegarde @new_save_window = Window_Base.new(33, (16 + 48*@number), 216, 45) @new_save_window.z = 10000 @new_save_window.contents = Bitmap.new(216, 48) set_window(@new_save_window) @new_save_window.contents.font.color = Color.new(160,160,168,255) @new_save_window.contents.draw_text(1,-16,216,48,"Sauvegarder votre partie ?") @new_save_window.contents.draw_text(0,-15,216,48,"Sauvegarder votre partie ?") @new_save_window.contents.draw_text(1,-15,216,48,"Sauvegarder votre partie ?") @new_save_window.contents.font.color = Color.new(80,80,88,255) @new_save_window.contents.draw_text(0,-16,216,48,"Sauvegarder votre partie ?") if SAVEBOUNDSLOT @new_save_window.y = 150 end captured = 0 for i in 1..$data_pokedex.length-1 if $data_pokedex[i][/i][1] captured += 1 end end $read_data = [Player.name, Player.id, captured, $map_link] @index = 0 latest_time = Time.at(0) for i in 0..2 filename = "Save#{i + 1}.rxdata" if FileTest.exist?(filename) file = File.open(filename, "r") if file.mtime > latest_time latest_time = file.mtime @index = i end file.close end end if SAVEBOUNDSLOT @index = POKEMON_S::_SAVESLOT if @index != @number @new_save_window.visible = false end end end def main refresh_all @spriteset = Spriteset_Map.new @background = Sprite.new @background.bitmap = RPG::Cache.picture("fondsaved_max.png") @background.x = 13 @background.y = 227 @background.z = 9999 Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze for window in @save_game_window_list window.dispose end if $pokemon_party.size>0 and @index != @number for save in @icon_window save.dispose end end @new_save_window.dispose @background.dispose @spriteset.dispose end def wait(frame) i = 0 loop do i += 1 Graphics.update if i >= frame break end end end def update if SAVEBOUNDSLOT @background.update end if Input.trigger?(Input::DOWN) and not SAVEBOUNDSLOT @index += @index == @number ? 0 : @index == 1 ? 0 : 1 refresh_all $game_system.se_play($data_system.cursor_se) end if Input.trigger?(Input::UP) and not SAVEBOUNDSLOT @index -= @index == 0 ? 0 : 1 refresh_all $game_system.se_play($data_system.cursor_se) end decision = draw_choice if decision $game_system.se_play($data_system.decision_se) filename = "Save#{@index + 1}.rxdata" file = File.open(filename, "wb") write_save_data(file) file.close wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max0.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max1.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max2.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max3.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max4.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max5.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max6.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max7.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max8.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max9.png") wait(10) @background.bitmap = RPG::Cache.picture("fondsaved_max10.png") $game_system.se_play($data_system.save_se) # イベントから呼び出されている場合 if $game_temp.save_calling # セーブ呼び出しフラグをクリア $game_temp.save_calling = false # マップ画面に切り替え $scene = Scene_Map.new return end # メニュー画面に切り替え $scene = POKEMON_S::Pokemon_Menu.new(4) else $game_system.se_play($data_system.decision_se) $scene = POKEMON_S::Pokemon_Menu.new(4) return end if Input.trigger?(Input::B) if $game_temp.save_calling $game_temp.save_calling = false end $game_system.se_play($data_system.cancel_se) $scene = POKEMON_S::Pokemon_Menu.new(4) return end end def refresh_all for i in 0..@number-1 @save_game_window_list[i][/i].z = 10000 if i < @index @save_game_window_list[i][/i].opacity = 128 @save_game_window_list[i][/i].y = 229 + 48*i @save_game_window_list[i][/i].height = 48 @save_game_window_list[i][/i].contents = Bitmap.new(548, 48) set_window(@save_game_window_list[i][/i]) @save_game_window_list[i][/i].contents.font.color = Color.new(160,160,168,255) @save_game_window_list[i][/i].contents.draw_text(0, -16+1, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) @save_game_window_list[i][/i].contents.draw_text(0+1, -16, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) @save_game_window_list[i][/i].contents.draw_text(0+1, -16+1, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) @save_game_window_list[i][/i].contents.font.color = Color.new(80, 80, 88, 255) @save_game_window_list[i][/i].contents.draw_text(0, -16, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) if SAVEBOUNDSLOT @save_game_window_list[i][/i].visible = false end elsif i == @index @save_game_window_list[i][/i].opacity = 0 @save_game_window_list[i][/i].y = 229 + 48*i @save_game_window_list[i][/i].height = 256 @save_game_window_list[i][/i].contents = Bitmap.new(548, 256) set_window(@save_game_window_list[i][/i]) if SAVEBOUNDSLOT @save_game_window_list[i][/i].contents.font.color = Color.new(160,160,168,255) @save_game_window_list[i][/i].contents.draw_text(0, -16+1, 530, 48, "Sauvegarder votre partie ?") @save_game_window_list[i][/i].contents.draw_text(0+1, -16, 530, 48, "Sauvegarder votre partie ?") @save_game_window_list[i][/i].contents.draw_text(0+1, -16+1, 530, 48, "Sauvegarder votre partie ?") @save_game_window_list[i][/i].contents.font.color = Color.new(80, 80, 88, 255) @save_game_window_list[i][/i].contents.draw_text(0, -16, 530, 48, "Sauvegarder votre partie ?") @save_game_window_list[i][/i].y = 229 else @save_game_window_list[i][/i].contents.font.color = Color.new(160,160,168,255) @save_game_window_list[i][/i].contents.draw_text(0, -16+1, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) @save_game_window_list[i][/i].contents.draw_text(0+1, -16, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) @save_game_window_list[i][/i].contents.draw_text(0+1, -16+1, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) @save_game_window_list[i][/i].contents.font.color = Color.new(80, 80, 88, 255) @save_game_window_list[i][/i].contents.draw_text(0, -16, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) end @filename = "Save#{i + 1}.rxdata" list = read_preview(@filename) data = list[0] time_sec = list[1] #pokemon_party = list[2] hour = (time_sec / 3600).to_s minute = "00" minute += ((time_sec%3600)/60).to_s minute = minute[minute.size-2, 2] time = hour + ":" + minute name = data[0].to_s id = data[1].to_s captured = data[2].to_s badge = 0.to_s @save_game_window_list[i][/i].contents.font.color = Color.new(160,160,168,255) @save_game_window_list[i][/i].contents.draw_text(0+1, 26, 252, 48, "Joueur") @save_game_window_list[i][/i].contents.draw_text(-6+1, 26, 124, 48, name, 2) @save_game_window_list[i][/i].contents.draw_text(0+1, 44, 124, 48, $mappan.to_s) @save_game_window_list[i][/i].contents.draw_text(0+1, 62, 252, 48, "Badges") @save_game_window_list[i][/i].contents.draw_text(13+1, 62, 84, 48, badge , 2) @save_game_window_list[i][/i].contents.draw_text(0+1, 82, 252, 48, "Pokédex") @save_game_window_list[i][/i].contents.draw_text(-70+1, 82, 167, 48, captured, 2) @save_game_window_list[i][/i].contents.draw_text(0+1, 100, 252, 48, "Durée de jeu") @save_game_window_list[i][/i].contents.draw_text(0+1, 100, 113, 48, time, 2) @save_game_window_list[i][/i].contents.draw_text(0, 26+1, 252, 48, "Joueur") @save_game_window_list[i][/i].contents.draw_text(-6, 26+1, 124, 48, name, 2) @save_game_window_list[i][/i].contents.draw_text(0, 44+1, 124, 48, $mappan.to_s) @save_game_window_list[i][/i].contents.draw_text(0, 62+1, 252, 48, "Badges") @save_game_window_list[i][/i].contents.draw_text(13, 62+1, 84, 48, badge , 2) @save_game_window_list[i][/i].contents.draw_text(0, 82+1, 252, 48, "Pokédex") @save_game_window_list[i][/i].contents.draw_text(-70, 82+1, 167, 48, captured, 2) @save_game_window_list[i][/i].contents.draw_text(0, 100+1, 252, 48, "Durée de jeu") @save_game_window_list[i][/i].contents.draw_text(0, 100+1, 113, 48, time, 2) @save_game_window_list[i][/i].contents.draw_text(0+1, 26+1, 252, 48, "Joueur") @save_game_window_list[i][/i].contents.draw_text(-6+1, 26+1, 124, 48, name, 2) @save_game_window_list[i][/i].contents.draw_text(0+1, 44+1, 124, 48, $mappan.to_s) @save_game_window_list[i][/i].contents.draw_text(0+1, 62+1, 252, 48, "Badges") @save_game_window_list[i][/i].contents.draw_text(13+1, 62+1, 84, 48, badge , 2) @save_game_window_list[i][/i].contents.draw_text(0+1, 82+1, 252, 48, "Pokédex") @save_game_window_list[i][/i].contents.draw_text(-70+1, 82+1, 167, 48, captured, 2) @save_game_window_list[i][/i].contents.draw_text(0+1, 100+1, 252, 48, "Durée de jeu") @save_game_window_list[i][/i].contents.draw_text(0+1, 100+1, 113, 48, time, 2) @save_game_window_list[i][/i].contents.font.color = Color.new(80, 80, 88, 255) @save_game_window_list[i][/i].contents.draw_text(0, 26, 252, 48, "Joueur") @save_game_window_list[i][/i].contents.draw_text(-6, 26, 124, 48, name, 2) @save_game_window_list[i][/i].contents.draw_text(0, 44, 124, 48, $mappan.to_s) @save_game_window_list[i][/i].contents.draw_text(0, 62, 252, 48, "Badges") @save_game_window_list[i][/i].contents.draw_text(13, 62, 84, 48, badge , 2) @save_game_window_list[i][/i].contents.draw_text(0, 82, 252, 48, "Pokédex") @save_game_window_list[i][/i].contents.draw_text(-70, 82, 167, 48, captured, 2) @save_game_window_list[i][/i].contents.draw_text(0, 100, 252, 48, "Durée de jeu") @save_game_window_list[i][/i].contents.draw_text(0, 100, 113, 48, time, 2) @order = [0,1,2,3,4,5] @icon_window = [] file = File.open("Save#{@index + 1}.rxdata", "r") pokemon_party = Marshal.load(file) file.close for i in 0..($pokemon_party.size-1) pokemon = $pokemon_party.actors[@order[i][/i]] @icon_window.push(Icon_Window.new(pokemon, i, 10001)) end elsif i > @index @save_game_window_list[i][/i].opacity = 128 @save_game_window_list[i][/i].y = 229 + 48*i + 54 @save_game_window_list[i][/i].height = 48 @save_game_window_list[i][/i].contents = Bitmap.new(548, 48) set_window(@save_game_window_list[i][/i]) @save_game_window_list[i][/i].contents.font.color = Color.new(160,160,168,255) @save_game_window_list[i][/i].contents.draw_text(0, -16+1, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) @save_game_window_list[i][/i].contents.draw_text(0+1, -16, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) @save_game_window_list[i][/i].contents.draw_text(0+1, -16+1, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) @save_game_window_list[i][/i].contents.font.color = Color.new(80, 80, 88, 255) @save_game_window_list[i][/i].contents.draw_text(0, -16, 530, 48, "SAUVEGARDER PARTIE "+(i+1).to_s) if SAVEBOUNDSLOT @save_game_window_list[i][/i].visible = false end end end if @index == @number and @number < 2 @new_save_window.opacity = 0 @new_save_window.y = 229 #+ 48*@number elsif @number < 2 @new_save_window.opacity = 0 @new_save_window.y = 229 #+ 51*(@number+1) else @new_save_window.visible = false end end def set_window(window) window.contents.font.name = $fontface window.contents.font.size = $fontsizebig window.contents.font.color = window.normal_color end def read_preview(filename) 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) total_sec = Graphics.frame_count / Graphics.frame_rate # Non utilisé game_self_switches = Marshal.load(file) game_screen = 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) # ------------ read_data = Marshal.load(file) file.close return [$read_data, total_sec] end #-------------------------------------------------------------------------- # #-------------------------------------------------------------------------- def write_save_data(file) characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i][/i] characters.push([actor.character_name, actor.character_hue]) end Marshal.dump(characters, file) Marshal.dump(Graphics.frame_count, file) $game_system.save_count += 1 $game_system.magic_number = $data_system.magic_number Marshal.dump($game_system, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_screen, 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) Marshal.dump($read_data, file) Marshal.dump($mappan, file) #Marshal.dump(Player.code, file) #Marshal.dump(Player.id, file) #Marshal.dump(Player.name, file) #Marshal.dump(Player.battler , file) Marshal.dump($pokemon_party, file) Marshal.dump($random_encounter, file) Marshal.dump($data_pokedex, file) Marshal.dump($data_storage, file) Marshal.dump($battle_var, file) Marshal.dump($existing_pokemon, file) Marshal.dump($string, file) Marshal.dump($SPEED_MSG, file) Marshal.dump($color_menu, file) Marshal.dump($NB_MSG, file) Marshal.dump($MSG, file) Marshal.dump($voir_anim, file) Marshal.dump($choix_battle, file) end def draw_choice @command = Window_Command.new(57, ["OUI", "NON"], $fontsizebig) @command.x = 410 @command.y = 256 @command.opacity = 0 @command.z = 10000 @curseur = Sprite.new @curseur.z = 10000 @curseur.x = 213 @curseur.y = 296 loop do @curseur.bitmap = RPG::Cache.picture("Save_Choice_" + @command.index.to_s + ".png") Graphics.update Input.update @command.update if Input.trigger?(Input::C) and @command.index == 0 @curseur.dispose @command.dispose @command = nil Graphics.update Input.update return true end if Input.trigger?(Input::C) and @command.index == 1 @curseur.dispose @command.dispose @command = nil Graphics.update Input.update return false end end end end end
class Interpreter def forcer_sauvegarde if not SAVEBOUNDSLOT return end captured = 0 for i in 1..$data_pokedex.length-1 if $data_pokedex[i][/i][1] captured += 1 end end $read_data = [Player.name, Player.id, captured, $map_link] filename = "Save#{POKEMON_S::_SAVESLOT + 1}.rxdata" file = File.open(filename, "wb") characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i][/i] characters.push([actor.character_name, actor.character_hue]) end Marshal.dump(characters, file) Marshal.dump(Graphics.frame_count, file) $game_system.save_count += 1 $game_system.magic_number = $data_system.magic_number game_system = $game_system.clone game_system.reset_interpreter Marshal.dump(game_system, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_screen, 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) Marshal.dump($read_data, file) Marshal.dump($pokemon_party, file) Marshal.dump($random_encounter, file) Marshal.dump($data_pokedex, file) Marshal.dump($data_storage, file) Marshal.dump($battle_var, file) Marshal.dump($existing_pokemon, file) Marshal.dump($string, file) Marshal.dump($SPEED_MSG, file) Marshal.dump($color_menu, file) Marshal.dump($NB_MSG, file) Marshal.dump($MSG, file) Marshal.dump($voir_anim, file) Marshal.dump($choix_battle, file) file.close end end
#----------------------------------------------------------------------------- # Pokemon_Party_Window #----------------------------------------------------------------------------- # Window_Base #----------------------------------------------------------------------------- # Fenetre individuelle de statut dans la gestion d'équipe # Modify by Palbolsky #----------------------------------------------------------------------------- class Icon_Window < Window_Base def initialize(pokemon, index, z_level = 100) @pokemon = pokemon @z_level = z_level @icon = Sprite.new @icon.bitmap = RPG::Cache.battler(@pokemon.icon, 0) @icon.z = @z_level + 100 @icon.zoom_x = 0.5 @icon.zoom_y = 0.5
if index == 0 #Pokémon en tête de rang super(0, 210, 40, 80) @icon.x = 42 @icon.y = 318 end if index == 1 super(0, 210, 40, 80) @icon.x = 75 @icon.y = 318 end if index == 2 super(0, 210, 40, 80) @icon.x = 108 @icon.y = 318 end if index == 3 super(0, 210, 40, 80) @icon.x = 141 @icon.y = 318 end if index == 4 super(0, 210, 40, 80) @icon.x = 174 @icon.y = 318 end if index == 5 super(0, 210, 40, 80) @icon.x = 207 @icon.y = 318 end end def dispose @icon.dispose @icon = nil super end end
|