Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Warning message
- # By gerkrt/gerrtunk
- # Version: 1
- # License: GPL, credits
- #==============================================================================
- =begin
- I created this script long ago for one of my menus and any other project. Its very flexible
- and can be used for a lot of things. It uses a modified window+sprite combination
- because i think that it looks better, anyway you can modify it or do what you want.
- -The window size and position is based on the text size.
- -All other sizes or positions are set automatically.
- -It have methods for automatically visible/invisible, dipose,etc, all sprites
- and windows.
- -You can add a question to it. With this a modified version of a window command
- is actived.
- -You can changue the text, ask option, x and y in every call.
- I use it with a variable in the Scene called "Warning_message_type" that defines
- the behavior of it.
- =end
- class Warning_Message
- def initialize
- # Default values when refreshing it
- @default_x = 200
- @default_y = 200
- # Back text window
- @text_window = Window_Base.new(120, 136, 400, 64)
- @text_window.z = 252
- @text_window.visible = false
- # Text sprite
- @text_sprite = Sprite.new
- @text_sprite.z = 254
- @text_sprite.x = 120
- @text_sprite.y = 136
- @text_sprite.bitmap = Bitmap.new(400,64)
- # Testing bitmap for size test
- @testing_bitmap = Bitmap.new(1,1)
- # Question window
- @question_window = Window_Selection.new(80, ["Yes", "No"])
- @question_window.x = 280
- @question_window.y = 200
- @question_window.z = 253
- @question_window.back_opacity = 0
- @question_window.opacity = 0
- @question_window.active = false
- @question_window.visible = false
- # Back question window
- @back_question_window = Window_Base.new(120, 136, 64, 64)
- @back_question_window.x = 280
- @back_question_window.y = 200
- @back_question_window.z = 254
- @back_question_window.visible = false
- end
- # Make all the sprites/windows visibles
- def visible
- @text_window.visible = true
- @text_sprite.visible = true
- # Question ones only if active
- if @question_window.active
- @question_window.visible = true
- @back_question_window.visible = true
- end
- end
- # Make all the sprites/windows invisibles
- def no_visible
- @text_window.visible = false
- @text_sprite.visible = false
- @question_window.visible = false
- @back_question_window.visible = false
- end
- # Is question window active?
- def active
- return @question_window.active
- end
- # Set question window active
- def active=(value)
- @question_window.active = value
- end
- # Update all the sprites/windows visibles
- def update
- @text_window.update
- @text_sprite.update
- @back_question_window.update
- @question_window.update
- end
- # Draw the warning message
- # question: called to add a yes/no window.
- def refresh(message, question=false, x=@default_x, y=@default_y)
- # Basic position settings
- @text_window.y = y
- @text_window.x = x
- @text_sprite.x = x
- @text_sprite.y = y
- rect = @testing_bitmap.text_size(message)
- # With question window or not. All the positions auto-setting are done here.
- if question
- @text_window.width = rect.width+26+40
- @question_window.visible = true
- @question_window.active = true
- @back_question_window.visible = true
- @question_window.x = @text_window.x+rect.width+4+6
- @question_window.y = @text_window.y - 16
- @back_question_window.x = @text_window.x+rect.width+4+16
- @back_question_window.y = @text_window.y
- else
- @text_window.width = rect.width+26
- end
- # First update the back window
- @text_window.update
- @text_sprite.bitmap.clear
- # Draw text
- @text_sprite.bitmap.draw_text(0+10,0,400,64,message, 0)
- @text_sprite.update
- end
- # Dispose all the sprites/windows visibles
- def dispose
- @text_window.dispose
- @text_sprite.dispose
- @question_window.dispose
- @back_question_window.dispose
- end
- end
- class Window_Selection < Window_Command
- #--------------------------------------------------------------------------
- # * Update Cursor Rectangle
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # If cursor position is less than 0
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # Get current row
- row = @index / @column_max
- # If current row is before top row
- if row < self.top_row
- # Scroll so that current row becomes top row
- self.top_row = row
- end
- # If current row is more to back than back row
- if row > self.top_row + (self.page_row_max - 1)
- # Scroll so that current row becomes back row
- self.top_row = row - (self.page_row_max - 1)
- end
- # Calculate cursor width
- cursor_width = (self.width / @column_max - 32)+11
- # Calculate cursor coordinates
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 32 - self.oy
- # Update cursor rectangle
- self.cursor_rect.set(x-4, y, cursor_width, 32)
- end
- end
- module Wep
- Save_windows_size = [640,104]
- end
- #--------------------------------------------------------------------------
- # * Compatibility check: Main menu modification
- #--------------------------------------------------------------------------
- if Wep::Main_menu_modification
- # Main menu quicksave addittion
- if Wep::Main_menu_quicksave and Wep::Quicksave
- #==============================================================================
- # ** Window_PlayTime
- #------------------------------------------------------------------------------
- # Modified
- #==============================================================================
- class Window_PlayTime < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 50)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- text = sprintf("%02d:%02d:%02d", hour, min, sec)
- self.contents.font.color = normal_color
- self.contents.draw_text(4, -5, 120, 32, text, 2)
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- if Graphics.frame_count / Graphics.frame_rate != @total_sec
- refresh
- end
- end
- end
- end
- #================================================================="=============
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs menu screen processing.
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # * Object Initialization
- # menu_index : command cursor's initial position
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- @warning_message_active = false # Used to check for warning message active or not
- end
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # Create warning window
- @warning_window = Warning_Message.new
- # If main menu quicksave are active all the initialitzation is modified
- if Wep::Main_menu_quicksave and Wep::Quicksave and not Wep::One_slot_mode_quicksaving
- # Make command window
- s1 = $data_system.words.item
- s2 = $data_system.words.skill
- s3 = $data_system.words.equip
- s4 = Wep::Main_menu_status_text
- s5 = Wep::Main_menu_save_text
- s6 = Wep::Main_menu_quicksave_text
- s7 = Wep::Main_menu_quit_text
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
- @command_window.index = @menu_index
- # If number of party members is 0
- if $game_party.actors.size == 0
- # Disable items, skills, equipment, and status
- @command_window.disable_item(0)
- @command_window.disable_item(1)
- @command_window.disable_item(2)
- @command_window.disable_item(3)
- end
- # If save is forbidden
- if $game_system.save_disabled
- # Disable save
- @command_window.disable_item(4)
- end
- if $game_system.disabled_quicksave != nil
- # If quick save is forbidden
- if $game_system.disabled_quicksave
- # Disable save
- @command_window.disable_item(6)
- end
- end
- # Resize windows and changue positions to give space to quicksave entry
- @command_window.height+= 14
- # Make play time window
- @playtime_window = Window_PlayTime.new
- @playtime_window.x = 0
- @playtime_window.y = 366
- # Make steps window
- @steps_window = Window_Steps.new
- @steps_window.x = 0
- @steps_window.y = 270
- # Crear ventana de lugares
- # Make gold window
- @gold_window = Window_Gold.new
- @gold_window.x = 0
- @gold_window.y = 416
- # Make status window
- @status_window = Window_MenuStatus.new
- @status_window.x = 160
- @status_window.y = 0
- else
- # Make command window
- s1 = $data_system.words.item
- s2 = $data_system.words.skill
- s3 = $data_system.words.equip
- s4 = Wep::Main_menu_status_text
- s5 = Wep::Main_menu_save_text
- s6 = Wep::Main_menu_quit_text
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
- @command_window.index = @menu_index
- # If number of party members is 0
- if $game_party.actors.size == 0
- # Disable items, skills, equipment, and status
- @command_window.disable_item(0)
- @command_window.disable_item(1)
- @command_window.disable_item(2)
- @command_window.disable_item(3)
- end
- # If save is forbidden
- if $game_system.save_disabled
- # Disable save
- @command_window.disable_item(4)
- end
- # Make play time window
- @playtime_window = Window_PlayTime.new
- @playtime_window.x = 0
- @playtime_window.y = 224
- # Make steps window
- @steps_window = Window_Steps.new
- @steps_window.x = 0
- @steps_window.y = 320
- # Make gold window
- @gold_window = Window_Gold.new
- @gold_window.x = 0
- @gold_window.y = 416
- # Make status window
- @status_window = Window_MenuStatus.new
- @status_window.x = 160
- @status_window.y = 0
- end
- # Execute transition
- Graphics.transition
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Prepare for transition
- Graphics.freeze
- # Dispose of windows
- @command_window.dispose
- @playtime_window.dispose
- @steps_window.dispose
- @gold_window.dispose
- @status_window.dispose
- @warning_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- # Update windows
- @command_window.update
- @playtime_window.update
- @steps_window.update
- @gold_window.update
- @status_window.update
- @warning_window.update
- # If warning message active
- if @warning_message_active
- update_advertencia
- return
- end
- # If command window is active: call update_command
- if @command_window.active
- update_command
- return
- end
- # If status window is active: call update_status
- if @status_window.active
- update_status
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (Advertencia)
- #--------------------------------------------------------------------------
- def update_advertencia
- # If any key is press, exit game checking for after quicksyve stle
- if Input.trigger?(Input::B) or Input.trigger?(Input::C) or Input.trigger?(Input::Z) or Input.trigger?(Input::B)
- if not Wep::One_slot_mode_quicksaving
- if Wep::After_quicksave == 0
- # End game
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- $scene = nil
- elsif Wep::After_quicksave == 1
- # To title
- $scene = Scene_Title.new
- end
- else
- if Wep::After_quicksaving == 0
- # End game
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- $scene = nil
- elsif Wep::After_quicksaving == 1
- # To title
- $scene = Scene_Title.new
- end
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (when command window is active)
- #--------------------------------------------------------------------------
- def update_command
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # If command other than save or end game, and party members = 0
- if $game_party.actors.size == 0 and @command_window.index < 4
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Branch by command window cursor position
- case @command_window.index
- when 0 # item
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to item screen
- $scene = Scene_Item.new
- when 1 # skill
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Make status window active
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 2 # equipment
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Make status window active
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 3 # status
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Make status window active
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 4 # save
- # If its one slot mode save directly in selected slot
- if Wep::One_slot_mode
- # If saving is forbidden
- if $game_system.save_disabled
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- slot = Wep::One_slot_mode_slot
- guard_rap = false
- temp = Scene_Save.new
- file = File.open(Wep::Save_folder+"\\"+Wep::File_name+slot.to_s+Wep::Saves_extension, "wb")
- temp.write_save_data(file, guard_rap)
- file.close
- # If its one slot quicksaving mode save directly in selected slot and exit
- elsif Wep::One_slot_mode_quicksaving
- # If saving is forbidden
- if $game_system.save_disabled
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- $game_system.se_play($data_system.save_se)
- $game_system.save_slot(Wep::One_slot_mode_slot)
- if Wep::Quicksaving_warning_message
- @warning_message_active = true
- @command_window.active = false
- @warning_window.visible
- @warning_window.refresh(Wep::Warning_message_one_slot_text, question=false, Wep::Warning_message_position[0], Wep::Warning_message_position[1])
- else
- if Wep::After_quicksaving == 0
- # Termina el programa
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- $scene = nil
- elsif Wep::After_quicksaving == 1
- # Vuelve al titulo
- $scene = Scene_Title.new
- end
- end
- # Normal save
- else
- # If saving is forbidden
- if $game_system.save_disabled
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to save screen
- $scene = Scene_Save.new
- end
- when 5 # quicksave or end
- # Depending on menu configuration
- if Wep::Main_menu_quicksave and Wep::Quicksave and not Wep::One_slot_mode_quicksaving
- # If quick saving is forbidden
- if $game_system.disabled_quicksave != nil
- if $game_system.disabled_quicksave
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- $game_system.map_quicksave
- $game_system.se_play($data_system.save_se)
- if Wep::Quicksave_warning_message and Wep::Quicksave
- @warning_message_active = true
- @command_window.active = false
- @warning_window.visible
- @warning_window.refresh(Wep::Warning_message_text, question=false, Wep::Warning_message_position[0], Wep::Warning_message_position[1])
- else
- if Wep::After_quicksave == 0
- # Termina el programa
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- $scene = nil
- elsif Wep::After_quicksave == 1
- # Vuelve al titulo
- $scene = Scene_Title.new
- end
- end
- else
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to end game screen
- $scene = Scene_End.new
- end
- when 6 # end game in quicksave mode
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to end game screen
- $scene = Scene_End.new
- end
- return
- end
- end
- end
- end
- class Game_System
- attr_accessor :disabled_quicksave
- attr_accessor :disabled_autosave
- attr_accessor :save_description
- attr_accessor :autosave_count
- attr_accessor :autosave_running
- alias old_initialize initialize
- def initialize
- @disabled_autosave = false
- @disabled_quicksave = false
- @save_description = "Chapter I"
- @autosave_count = Wep::Autosave_time
- @autosave_running = Wep::Autosave && Wep::Autosave_type == 0 ? true : false
- old_initialize
- end
- #--------------------------------------------------------------------------
- # * Autosave count restart
- #--------------------------------------------------------------------------
- def restart_auto_save_count
- # Restart timer
- @autosave_count = Wep::Autosave_time
- end
- #--------------------------------------------------------------------------
- # * Autosave check
- #--------------------------------------------------------------------------
- def auto_save_update
- # Reduces time if enabled
- if Wep::Autosave_type == 0 and @autosave_count > 0 and @autosave_running and not @disabled_autosave
- @autosave_count -= 1
- end
- if Wep::Autosave_type == 0 and @autosave_count == 0 and @autosave_running
- # Check for save
- map_autosave
- # Inform player
- $game_switches[Wep::Switch_info] = true
- # Restart timer
- @autosave_count = Wep::Autosave_time
- end
- end
- #--------------------------------------------------------------------------
- # * Update timer. Modded: Also updates autosave timer.
- #--------------------------------------------------------------------------
- def update
- if @timer_working and @timer > 0
- @timer -= 1
- end
- auto_save_update
- end
- end
- class Game_System
- #--------------------------------------------------------------------------
- # * Map autosave
- #--------------------------------------------------------------------------
- def map_autosave
- temp = Scene_Save.new
- file = File.open(Wep::Save_folder+"\\"+Wep::File_name+(Wep::Autosave_slot).to_s+Wep::Saves_extension, "wb")
- temp.write_save_data(file)
- file.close
- end
- #--------------------------------------------------------------------------
- # * Map quicksave
- #--------------------------------------------------------------------------
- def map_quicksave
- temp = Scene_Save.new
- file = File.open(Wep::Save_folder + "\\" + Wep::File_name + Wep::Quicksave_slot.to_s + Wep::Saves_extension, "wb")
- temp.write_save_data(file)
- file.close
- end
- #--------------------------------------------------------------------------
- # * Load slot
- #--------------------------------------------------------------------------
- def load_slot(slot)
- $scene = Transfer_Scene.new(slot)
- end
- #--------------------------------------------------------------------------
- # * Save slot
- #--------------------------------------------------------------------------
- def save_slot(slot)
- temp = Scene_Save.new
- file = File.open(Wep::Save_folder+"\\"+Wep::File_name+slot.to_s+Wep::Saves_extension, "wb")
- temp.write_save_data(file)
- file.close
- end
- #--------------------------------------------------------------------------
- # * Erase slot
- #--------------------------------------------------------------------------
- def erase_slot(slot)
- if FileTest.exist?( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension)
- File.delete( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension)
- end
- end
- #--------------------------------------------------------------------------
- # * Slot exist?
- #--------------------------------------------------------------------------
- def slot_exist(slot)
- if FileTest.exist?( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension)
- $game_switches[Wep::Sw_file_exist] = true
- return true
- else
- return false
- end
- end
- #--------------------------------------------------------------------------
- # * Slot info
- #--------------------------------------------------------------------------
- def slot_info(slot)
- if FileTest.exist?( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension)
- file = File.open( Wep::Save_folder+ "\\"+ Wep::File_name + slot.to_s + Wep::Saves_extension, "r")
- timestamp = file.mtime
- characters = Marshal.load(file)
- guard_rap = Marshal.load(file)
- psj = Marshal.load(file)
- dinero = 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
- i=0
- # Actors levels and ids
- for actor in game_party.actors
- $game_variables[Wep::Vars_actors_ids[i]] = actor.id
- $game_variables[Wep::Vars_actors_levels[i]] = actor.level
- i+=1
- end
- # Date
- $game_variables[Wep::Vars_date[0]] = timestamp.year
- $game_variables[Wep::Vars_date[1]] = timestamp.month
- $game_variables[Wep::Vars_date[2]] = timestamp.day
- $game_variables[Wep::Vars_date[3]] = timestamp.hour
- $game_variables[Wep::Vars_date[4]] = timestamp.min
- $game_variables[Wep::Vars_date[5]] = timestamp.sec
- # Time
- hour = total_sec / 60 / 60
- min = total_sec / 60 % 60
- sec = total_sec % 60
- $game_variables[Wep::Vars_time[0]] = hour
- $game_variables[Wep::Vars_time[1]] = min
- $game_variables[Wep::Vars_time[2]] = sec
- # Gold and steps
- $game_variables[Wep::Vars_money] = game_party.gold
- $game_variables[Wep::Vars_steps] = game_party.steps
- return true
- end
- end
- end
- #================================================================="=============
- # ** Transfer_Scene
- #------------------------------------------------------------------------------
- # This scene is used as an intermediate scene to load games
- # slot: slot to load
- #==============================================================================
- class Transfer_Scene
- def initialize(slot)
- @slot = slot
- end
- def main
- # Normal load process
- file = File.open(Wep::Save_folder+ "\\"+ Wep::File_name+ @slot.to_s + Wep::Saves_extension, "rb")
- # One sp/hp
- onehp = Marshal.load(file)
- onesp = Marshal.load(file)
- # Description
- description = Marshal.load(file)
- # % completed game
- comp = Marshal.load(file)
- # Map
- map = Marshal.load(file)
- # Steps
- steps = Marshal.load(file)
- # Make medium levels for ordering save file
- medium_level=Marshal.load(file)
- # Read character data for drawing save file
- characters = Marshal.load(file)
- # Cargar personajes
- @psj = Marshal.load(file)
- # Cargar dinero
- @dinero = Marshal.load(file)
- # Read frame count for measuring play time
- Graphics.frame_count = Marshal.load(file)
- # Read each type of game object
- $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)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- $game_temp = Game_Temp.new
- $game_system.bgm_stop
- # If magic number is different from when saving
- # (if editing was added with editor)
- if $game_system.magic_number != $data_system.magic_number
- # Load map
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- # Refresh party members
- $game_party.refresh
- file.close
- # Check to erase save slots with some modes
- if Wep::Quicksave and @slot == Wep::Quicksave_slot
- $game_system.erase_slot(Wep::Quicksave_slot)
- end
- if Wep::One_slot_mode_quicksaving and @slot == Wep::One_slot_mode_slot
- $game_system.erase_slot(Wep::One_slot_mode_slot)
- end
- # Switch to map screen
- $scene = Scene_Map.new
- end
- end
- #================================================================="=============
- # ** Window_HelpSave
- #------------------------------------------------------------------------------
- # Modified to that can be configurated by the player
- #==============================================================================
- class Window_HelpSave < Window_Help
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = Wep::Help_windows_opacity
- self.back_opacity = Wep::Help_windows_back_opacity
- if Wep::Help_window_font_name != ""
- self.contents.font.name = Wep::Help_window_font_name
- end
- end
- end
- #================================================================="=============
- # ** Slot_Window
- #------------------------------------------------------------------------------
- # This a window+sprite combined class. It enables to use very small
- # windows.
- # i: position multiplier
- #==============================================================================
- class Slot_Window
- def initialize(i)
- # Back window
- @ventana = Window_Base.new(0,104*i+64, 100,24)
- @ventana.visible = true
- @ventana.z = 249
- # Text sprite
- @sprite = Sprite.new
- @sprite.bitmap = Bitmap.new(@ventana.width, @ventana.height)
- @sprite.bitmap.font.size = 14
- # Font setting
- if Wep::Slot_window_font_name != ""
- @sprite.bitmap.font.name = Wep::Slot_window_font_name
- end
- @sprite.z = 250
- @sprite.x = 0
- @sprite.y = 104*i+64
- @sprite.visible = true
- end
- # Draw the text
- def refresh(text)
- @ventana.update
- @sprite.bitmap.clear
- # Font setting
- @sprite.bitmap.font.color = Wep::Basic_color
- @sprite.bitmap.draw_text(0,-2,@ventana.width,32, text.to_s, 1)
- end
- # Dispose all
- def dispose
- @ventana.dispose
- @sprite.dispose
- end
- end
- #==============================================================================
- # ** Scene_File
- #------------------------------------------------------------------------------
- # This is a superclass for the save screen and load screen.
- #==============================================================================
- class Scene_File
- #--------------------------------------------------------------------------
- # * Object Initialization
- # help_text : text string shown in the help window
- # type : true=save false=load scene
- #--------------------------------------------------------------------------
- def initialize(help_text, file_index, tipo)
- @help_text = help_text
- @file_index = file_index
- @type = tipo
- # Create Folder for Save file
- if Wep::Save_folder != ""
- Dir.mkdir(Wep::Save_folder) if !FileTest.directory?(Wep::Save_folder)
- end
- end
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # If quicksave and it must load it...
- # Make help window
- @help_window = Window_HelpSave.new
- @help_window.set_text(@help_text)
- @help_window.visible = Wep::Help_window_visible
- # Background sprite
- @backgrounds = Sprite.new
- @backgrounds.bitmap = Bitmap.new(640,480)
- @backgrounds.z = 1
- @backgrounds.visible = true
- # Faces sprite
- @faces = Sprite.new
- @faces.bitmap = Bitmap.new(640,480)
- @faces.z = 101
- @faces.visible = true
- # Check and load Scene background
- if Wep::Scene_background != ""
- bitmap = RPG::Cache.picture(Wep::Scene_background)
- @backgrounds.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 640, 480), 255)
- end
- # Check and load Help background
- if Wep::Help_window_background != ""
- bitmap = RPG::Cache.picture(Wep::Help_window_background)
- @backgrounds.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 640, 64), 255)
- end
- # Check and load Save background
- if Wep::Save_windows_background != ""
- for i in 0...3
- bitmap = RPG::Cache.picture(Wep::Save_windows_background)
- @backgrounds.bitmap.blt(0, 64 + i % 4 * 104, bitmap, Rect.new(0, 0, 640, 104), 255)
- end
- end
- # Make array of save slots info
- @save_slots = []
- for i in 0...Wep::Max_slots
- # Check if exist and put base info and ordered one
- if FileTest.exist?(make_filename(i))
- file = File.open(make_filename(i), "r")
- # One sp/hp
- onehp = Marshal.load(file)
- onesp = Marshal.load(file)
- # Description
- description = Marshal.load(file)
- # % completed game
- comp = Marshal.load(file)
- # Map
- map = Marshal.load(file)
- # Steps
- steps = Marshal.load(file)
- # Make medium levels for ordering save file
- medium_level=Marshal.load(file)
- # Read character data for drawing save file
- characters = Marshal.load(file)
- # Cargar personajes
- psj = Marshal.load(file)
- # Cargar dinero
- dinero = Marshal.load(file)
- # Read frame count for measuring play time
- frame_count = Marshal.load(file)
- time_stamp = file.mtime
- total_sec = frame_count / Graphics.frame_rate
- file.close
- @save_slots[i] = file_index=i, time_stamp, frame_count, medium_level
- else
- @save_slots[i] = [file_index=i]
- end
- end
- @file_index = 2
- # Make save file and slots windows
- @savefile_windows = []
- @slot_windows = []
- for i in 0..3
- @savefile_windows.push(Window_SaveFile.new(i))
- @slot_windows.push(Slot_Window.new(i))
- end
- # Refresh the windows
- for i in 0..3
- # Checks if its beyond the limit
- if i+@file_index > Wep::Max_slots-1
- @savefile_windows[i].refresh(@save_slots[Wep::Max_slots-i][0])
- @slot_windows[i].refresh(Wep::Slot+(@save_slots[Wep::Max_slots-i][0]+1).to_s)
- if Wep::Quicksave and Wep::Max_slots-i == Wep::Quicksave_slot-1
- @slot_windows[i].refresh(Wep::Quicksave_slot_text)
- end
- if Wep::Autosave and Wep::Max_slots-i == Wep::Autosave_slot-1
- @slot_windows[i].refresh(Wep::Autosave_slot_text)
- end
- else
- @savefile_windows[i].refresh(@save_slots[@file_index+i-2][0])
- @slot_windows[i].refresh(Wep::Slot+(@save_slots[@file_index+i-2][0]+1).to_s)
- if Wep::Quicksave and @file_index+i-2 == Wep::Quicksave_slot-1
- @slot_windows[i].refresh(Wep::Quicksave_slot_text)
- end
- if Wep::Autosave and @file_index+i-2 == Wep::Autosave_slot-1
- @slot_windows[i].refresh(Wep::Autosave_slot_text)
- end
- end
- end
- # Select slot 2
- @savefile_windows[@file_index].selected = true
- # Draw faces if enabled
- if Wep::Show_faces or Wep::Quick_actors_info.include?('face')
- if not Wep::Quick_actors_info
- draw_faces
- end
- end
- @file_index = 0
- # Execute transition
- Graphics.transition
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Prepare for transition
- Graphics.freeze
- # Dispose of windows
- @help_window.dispose
- for i in @savefile_windows
- i.dispose
- end
- @backgrounds.dispose
- @faces.dispose
- for i in 0..3
- @slot_windows[i].dispose
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- # Update windows
- @help_window.update
- @backgrounds.update
- for i in @savefile_windows
- i.update
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Check that it isnt in autosave or quicksave protected slots
- if Wep::Quicksave and @type and @save_slots[@file_index+2][0] == 0 and Wep::Quicksave_sep_slot
- # Play cursor SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if Wep::Autosave and @type and @save_slots[@file_index+2][0] == 1 and Wep::Autosave_sep_slot
- # Play cursor SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Call method: on_decision (defined by the subclasses)
- on_decision(make_filename(@save_slots[@file_index+2][0]))
- if Wep::Quicksave and Wep::Quicksave_slot == @save_slots[@file_index+2][0] and @type == false
- $game_system.erase_slot(Wep::Quicksave_slot)
- end
- $game_temp.last_file_index = @file_index
- return
- end
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Call method: on_cancel (defined by the subclasses)
- on_cancel
- return
- end
- # If the down directional button was pressed
- if Input.repeat?(Input::DOWN)
- # If the down directional button pressed down is not a repeat,
- # or cursor position is more in front than 3
- if Input.trigger?(Input::DOWN)
- # Check and correct list limit
- if @file_index+1 > Wep::Max_slots-1-2
- # Play cursor SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- #p @file_index
- # Play cursor SE
- $game_system.se_play($data_system.cursor_se)
- # Move cursor down
- @file_index +=1
- # Refresh the widows
- for i in 0..3
- # Checks if its beyond the limit
- if @file_index+i > Wep::Max_slots-1
- @savefile_windows[i].refresh(1001)
- @slot_windows[i].refresh(Wep::Slot_dont_exist)
- else
- @savefile_windows[i].refresh(@save_slots[@file_index+i][0])
- @slot_windows[i].refresh(Wep::Slot+(@save_slots[@file_index+i][0]+1).to_s)
- if Wep::Quicksave and @file_index+i == Wep::Quicksave_slot-1
- @slot_windows[i].refresh(Wep::Quicksave_slot_text)
- end
- if Wep::Autosave and @file_index+i == Wep::Autosave_slot-1
- @slot_windows[i].refresh(Wep::Autosave_slot_text)
- end
- end
- end
- # Draw faces if enabled
- if Wep::Show_faces or Wep::Quick_actors_info.include?('face')
- if not Wep::Quick_actors_info
- draw_faces
- end
- end
- return
- end
- end
- # If the up directional button was pressed
- if Input.repeat?(Input::UP)
- # If the up directional button pressed down is not a repeat、
- # or cursor position is more in back than 0
- if Input.trigger?(Input::UP)
- # # Check and correct list limit
- if @file_index-1 < 0-2
- # Play cursor SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play cursor SE
- $game_system.se_play($data_system.cursor_se)
- # Move cursor up
- @file_index -=1
- # Refresh the widows
- for i in 0..3
- # Checks if its beyond the limit
- if @file_index+i < 0
- @savefile_windows[i].refresh(1001)
- @slot_windows[i].refresh(Wep::Slot_dont_exist)
- else
- @savefile_windows[i].refresh(@save_slots[@file_index+i][0])
- @slot_windows[i].refresh(Wep::Slot+(@save_slots[@file_index+i][0]+1).to_s)
- if Wep::Quicksave and @file_index+i == Wep::Quicksave_slot-1
- @slot_windows[i].refresh(Wep::Quicksave_slot_text)
- end
- if Wep::Autosave and @file_index+i == Wep::Autosave_slot-1
- @slot_windows[i].refresh(Wep::Autosave_slot_text)
- end
- end
- end
- # Draw faces if enabled
- if Wep::Show_faces or Wep::Quick_actors_info.include?('face')
- if not Wep::Quick_actors_info
- draw_faces
- end
- end
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Faces
- #--------------------------------------------------------------------------
- def draw_faces
- # Clear bitmap each time
- @faces.bitmap.clear
- for i in 0..3
- # If the window dont have actors info skip it
- next if @savefile_windows[i].psj == nil
- # Draw the faces
- for j in 0...@savefile_windows[i].psj.size
- bitmap = RPG::Cache.picture('Saveface_'+@savefile_windows[i].psj[j].name+'.png')
- cw = bitmap.rect.width
- ch = bitmap.rect.height
- src_rect = Rect.new(0, 0, cw, ch)
- # Quick config option
- if not Wep::Quick_actors_info
- @faces.bitmap.blt(Wep::Face_position[0]+Wep::Face_separation*j, Wep::Face_position[1] + i % 4 * 104, bitmap, Rect.new(0, 0, 640, 104), Wep::Face_transparency)
- else
- @faces.bitmap.blt(0+Wep::Face_separation*j, 68 + i % 4 * 104, bitmap, Rect.new(0, 0, 640, 104), Wep::Face_transparency)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Make File Name
- # file_index : save file index (0-3)
- #--------------------------------------------------------------------------
- def make_filename(file_index)
- return Wep::Save_folder+"\\"+Wep::File_name+ "#{file_index + 1}"+Wep::Saves_extension
- end
- end
- #==============================================================================
- # ** Scene_Load
- #------------------------------------------------------------------------------
- # This class performs load screen processing.
- #==============================================================================
- class Scene_Load < Scene_File
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(de_mapa=false)
- @de_mapa = de_mapa
- # Remake temporary object
- $game_temp = Game_Temp.new
- # Timestamp selects new file
- $game_temp.last_file_index = 0
- latest_time = Time.at(0)
- for i in 0...Wep::Max_slots
- filename = make_filename(i)
- if FileTest.exist?(filename)
- file = File.open(filename, "r")
- if file.mtime > latest_time
- latest_time = file.mtime
- $game_temp.last_file_index = i
- end
- file.close
- end
- end
- super(Wep::Load_description_text, @file_index = 0, @tipo = false)
- end
- #--------------------------------------------------------------------------
- # * Decision Processing
- #--------------------------------------------------------------------------
- def on_decision(filename)
- # If file doesn't exist
- unless FileTest.exist?(filename)
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play load SE
- $game_system.se_play($data_system.load_se)
- # Read save data
- file = File.open(filename, "rb")
- read_save_data(file)
- file.close
- # Restore BGM and BGS
- $game_system.bgm_play($game_system.playing_bgm)
- $game_system.bgs_play($game_system.playing_bgs)
- # Update map (run parallel process event)
- $game_map.update
- # Switch to map screen
- $scene = Scene_Map.new
- end
- #--------------------------------------------------------------------------
- # * Cancel Processing
- #--------------------------------------------------------------------------
- def on_cancel
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- if not @de_mapa
- # Switch to title screen
- $scene = Scene_Title.new
- else
- $scene = Scene_Map.new
- end
- end
- #--------------------------------------------------------------------------
- # * Read Save Data
- # file : file object for reading (opened)
- #--------------------------------------------------------------------------
- def read_save_data(file)
- # One sp/hp
- onehp = Marshal.load(file)
- onesp = Marshal.load(file)
- # Description
- description = Marshal.load(file)
- # % completed game
- comp = Marshal.load(file)
- # Map
- map = Marshal.load(file)
- # Steps
- steps = Marshal.load(file)
- # Make medium levels for ordering save file
- medium_level=Marshal.load(file)
- # Read character data for drawing save file
- characters = Marshal.load(file)
- # Cargar personajes
- @psj = Marshal.load(file)
- # Cargar dinero
- @dinero = Marshal.load(file)
- # Read frame count for measuring play time
- Graphics.frame_count = Marshal.load(file)
- # Read each type of game object
- $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)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- # If magic number is different from when saving
- # (if editing was added with editor)
- if $game_system.magic_number != $data_system.magic_number
- # Load map
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- # Refresh party members
- $game_party.refresh
- end
- end
- #==============================================================================
- # ** Scene_Save
- #------------------------------------------------------------------------------
- # This class performs save screen processing.
- #==============================================================================
- class Scene_Save < Scene_File
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(Wep::Save_description_text, @file_index = 1, @tipo = true)
- end
- #--------------------------------------------------------------------------
- # * Decision Processing
- #--------------------------------------------------------------------------
- def on_decision(filename)
- # Play save SE
- $game_system.se_play($data_system.save_se)
- # Write save data
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- # If called from event
- if $game_temp.save_calling
- # Clear save call flag
- $game_temp.save_calling = false
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- # Switch to menu screen
- $scene = Scene_Menu.new(4)
- end
- #--------------------------------------------------------------------------
- # * Cancel Processing
- #--------------------------------------------------------------------------
- def on_cancel
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # If called from event
- if $game_temp.save_calling
- # Clear save call flag
- $game_temp.save_calling = false
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- # Switch to menu screen
- $scene = Scene_Menu.new(4)
- end
- #--------------------------------------------------------------------------
- # * Write Save Data
- # file : write file object (opened)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- one_pv = $game_party.actors[0].hp, $game_party.actors[0].maxhp
- one_sp = $game_party.actors[0].sp, $game_party.actors[0].maxsp
- # One actor mode info
- Marshal.dump(one_pv, file)
- Marshal.dump(one_sp, file)
- # Description
- if $game_system.save_description == nil
- Marshal.dump("", file)
- else
- description = $game_system.save_description
- Marshal.dump(description, file)
- end
- # % completed game
- comp = $game_variables[Wep::Variable_completed_game]
- Marshal.dump(comp, file)
- # Map
- map = $game_map.map_id
- Marshal.dump(map, file)
- # Steps
- steps = $game_party.steps
- Marshal.dump(steps, file)
- # Make medium levels for ordering save file
- medium_level=0
- for i in 0...$game_party.actors.size
- medium_level += $game_party.actors[i].level
- end
- medium_level/=$game_party.actors.size
- Marshal.dump(medium_level, file)
- # Make character data for drawing save file
- characters = []
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- characters.push([actor.character_name, actor.character_hue])
- end
- # Write character data for drawing save file
- Marshal.dump(characters, file)
- # Preparar archivo de personajes
- psj = []
- for i in 0...$game_party.actors.size
- wep = $game_party.actors[i].id
- psj[i] = $game_actors[wep]
- end
- # Guardar archivo de personajes
- Marshal.dump(psj, file)
- # Preparar dinero
- dinero = $game_party.gold
- # Guardar archivo de dinero
- Marshal.dump(dinero, file)
- # Wrire frame count for measuring play time
- Marshal.dump(Graphics.frame_count, file)
- # Increase save count by 1
- $game_system.save_count += 1
- # Save magic number
- # (A random value will be written each time saving with editor)
- $game_system.magic_number = $data_system.magic_number
- # Write each type of game object
- 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)
- 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
- attr_reader :file_index
- attr_reader :exist
- attr_reader :psj # Actors info for drawing faces
- #--------------------------------------------------------------------------
- # * Object Initialization
- # file_index : save file index (0-3)
- # filename : file name
- #--------------------------------------------------------------------------
- def initialize(i)
- super(0, 64 + i % 4 * 104, Wep::Save_windows_size[0], Wep::Save_windows_size[1])
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = Wep::Save_windows_opacity
- self.back_opacity = Wep::Save_windows_back_opacity
- @selected = false
- @position = i
- @psj = nil
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh(file_index)
- self.contents = Bitmap.new(width - 32, height - 32)
- # Font setting
- if Wep::Save_window_font_name != ""
- self.contents.font.name = Wep::Save_window_font_name
- end
- # Open and check file
- if file_index != nil
- filename = Wep::Save_folder+"\\"+Wep::File_name+ "#{file_index + 1}"+Wep::Saves_extension
- file_exist = FileTest.exist?(filename)
- else
- file_exist = false
- @psj= nil
- end
- # If file exist
- if file_exist
- # Make normal load
- file = File.open(filename, "r")
- # One sp/hp
- onehp = Marshal.load(file)
- onesp = Marshal.load(file)
- # Description
- description = Marshal.load(file)
- # % completed game
- comp = Marshal.load(file)
- # Map
- map = Marshal.load(file)
- # Steps
- steps = Marshal.load(file)
- # Make medium levels for ordering save file
- medium_level=Marshal.load(file)
- # Read character data for drawing save file
- @characters = Marshal.load(file)
- # Cargar personajes
- @psj = Marshal.load(file)
- # Cargar dinero
- @dinero = Marshal.load(file)
- # Read frame count for measuring play time
- @frame_count = Marshal.load(file)
- @time_stamp = file.mtime
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- # Testing bitmap
- tb = Bitmap.new(1,1)
- # Check for newbie option
- if Wep::Quick_actors_info
- self.contents.font.size = 22
- # Quick actors info with graphics
- if Wep::Quick_actors_info.include?('graphic')
- for i in 0...@characters.size
- if Wep::Quick_actors_info.include?('graphic')
- 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 = 160- @characters.size * 34 + i * 105 - cw / 2
- self.contents.blt(x, 54 - ch, bitmap, src_rect)
- end
- if Wep::Quick_actors_info.include?('name')
- self.contents.draw_text(i*108, 48, Wep::Save_windows_size[0]-32, 32, @psj[i].name)
- end
- if Wep::Quick_actors_info.include?('level')
- rect = tb.text_size(Wep::Level_text)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(i*108, 30, Wep::Save_windows_size[0]-32, 32, Wep::Level_text)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- self.contents.draw_text(i*108+rect.width, 30, Wep::Save_windows_size[0]-32, 32, @psj[i].level.to_s)
- end
- end
- # Quick actors info with faces
- else
- for i in 0...@characters.size
- if Wep::Quick_actors_info.include?('name')
- self.contents.draw_text(i*108, 48, Wep::Save_windows_size[0]-32, 32, @psj[i].name)
- end
- if Wep::Quick_actors_info.include?('level')
- rect = tb.text_size(Wep::Level_text)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(i*108, 30, Wep::Save_windows_size[0]-32, 32, Wep::Level_text)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- self.contents.draw_text(i*108+rect.width, 30, Wep::Save_windows_size[0]-32, 32, @psj[i].level.to_s)
- end
- if Wep::Quick_actors_info.include?('graphic')
- 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 = Wep::Graphic_position[0] - @characters.size * 32 + i * 64 - cw / 2
- self.contents.blt(x, Wep::Graphic_position[1] - ch, bitmap, src_rect)
- end
- end
- end
- # Quick actors info without graphic or face
- if not Wep::Quick_actors_info.include?('face') and not Wep::Quick_actors_info.include?('graphic')
- if Wep::Quick_actors_info.include?('name')
- self.contents.draw_text(i*Wep::Name_position[0], Wep::Name_position[1], Wep::Save_windows_size[0], 32, @psj[i].name)
- end
- if Wep::Quick_actors_info.include?('level')
- rect = tb.text_size(Wep::Level_text)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(i*108, 30, Wep::Save_windows_size[0]-32, 32, Wep::Level_text)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- self.contents.draw_text(i*108+rect.width, 30, Wep::Save_windows_size[0]-32, 32, @psj[i].level.to_s)
- end
- end
- end
- # Check for newbie option
- if Wep::Quick_general_info
- self.contents.font.size = 22
- i=0
- for option in Wep::Quick_general_info
- # The y is manually defined for each postion
- if i == 0
- y = -9
- elsif i == 1
- y = 11
- elsif i == 2
- y = 30
- elsif i == 3
- y = 46
- end
- if option == '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(0, y, Wep::Save_windows_size[0]-32, 32, time_string, 2)
- elsif option == 'map_description'
- for group in Wep::Map_descriptions
- if group == Wep::Map_descriptions[0]
- next
- end
- if group[0].include?(map)
- map_description = group[1]
- end
- end
- map_description = Wep::Map_descriptions[0] if map_description == nil
- self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, map_description, 2)
- elsif option == 'description'
- self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, description, 2)
- elsif option == 'steps'
- rect = tb.text_size(steps.to_s)
- self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, steps.to_s, 2)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(0-rect.width, y, Wep::Save_windows_size[0]-32, 32, Wep::Steps_text, 2)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- elsif option == 'money'
- rect = tb.text_size(dinero.to_s)
- self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, @dinero.to_s, 2)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(0-rect.width, y, Wep::Save_windows_size[0]-32, 32, Wep::Money_text, 2)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- elsif option == 'map_name'
- # Load mapinfo for map name
- mapinfos = load_data("Data/MapInfos.rxdata")
- self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, mapinfos[map].name, 2)
- elsif option == 'completed_game'
- rect = tb.text_size(comp.to_s+"%")
- self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, comp.to_s+"%", 2)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(0-rect.width, y, Wep::Save_windows_size[0]-32, 32, Wep::Completed_game_text, 2)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- elsif option == 'date'
- time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
- self.contents.draw_text(0, y, Wep::Save_windows_size[0]-32, 32, time_string, 2)
- end
- i+=1
- end
- end
- # Advanced settings
- # Font setting
- if not Wep::Quick_actors_info
- self.contents.font.size = Wep::Actors_info_font_size
- end
- for i in 0...@characters.size
- # Draw names
- if Wep::Show_name and not Wep::Quick_actors_info
- self.contents.draw_text(i*Wep::Name_position[0], Wep::Name_position[1], Wep::Save_windows_size[0], 32, @psj[i].name)
- end
- # Draw level
- if Wep::Show_level and not Wep::Quick_actors_info
- rect = tb.text_size(Wep::Level_text)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(i*Wep::Level_position[0], Wep::Level_position[1], Wep::Save_windows_size[0]-32, 32, Wep::Level_text)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- self.contents.draw_text(i*Wep::Level_position[0]+rect.width, Wep::Level_position[1], Wep::Save_windows_size[0]-32, 32, @psj[i].level.to_s)
- end
- # Draw graphic
- if Wep::Show_graphic and not Wep::Quick_actors_info
- 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 = Wep::Graphic_position[0] - @characters.size * 32 + i * 64 - cw / 2
- self.contents.blt(x, Wep::Graphic_position[1] - ch, bitmap, src_rect)
- end
- end
- # General info
- if not Wep::Quick_general_info
- self.contents.font.size = Wep::General_info_font_size
- end
- # Draw time
- if Wep::Show_time and not Wep::Quick_general_info
- 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(Wep::Time_position[0], Wep::Time_position[1], Wep::Save_windows_size[0], 32, time_string, 2)
- end
- # Draw money
- if Wep::Show_money and not Wep::Quick_general_info
- rect = tb.text_size(dinero.to_s)
- self.contents.draw_text(Wep::Gold_position[0], Wep::Gold_position[1], Wep::Save_windows_size[0]-32, 32, @dinero.to_s, 2)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(Wep::Gold_position[0]-rect.width, Wep::Gold_position[1], Wep::Save_windows_size[0]-32, 32, Wep::Money_text, 2)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- end
- # Draw map name
- if Wep::Show_map_name and not Wep::Quick_general_info
- # Load mapinfo for map name
- mapinfos = load_data("Data/MapInfos.rxdata")
- self.contents.draw_text(Wep::Map_name_position[0], Wep::Map_name_position[1], Wep::Save_windows_size[0]-32, 32, mapinfos[map].name, 2)
- end
- # Draw map description
- if Wep::Show_map_description and not Wep::Quick_general_info
- for group in Wep::Map_descriptions
- if group == Wep::Map_descriptions[0]
- next
- end
- if group[0].include?(map)
- map_description = group[1]
- end
- end
- map_description = Wep::Map_descriptions[0] if map_description == nil
- self.contents.draw_text(Wep::Map_description_position[0], Wep::Map_description_position[1], Wep::Save_windows_size[0], 32, map_description, 2)
- end
- # Draw description
- if Wep::Show_description and not Wep::Quick_general_info
- self.contents.draw_text(Wep::Description_position[0], Wep::Description_position[1], Wep::Save_windows_size[0]-32, 32, description, 2)
- end
- # Draw steps
- if Wep::Show_steps and not Wep::Quick_general_info
- rect = tb.text_size(steps.to_s)
- self.contents.draw_text(Wep::Steps_position[0], Wep::Steps_position[1], Wep::Save_windows_size[0]-32, 32, steps.to_s, 2)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(Wep::Steps_position[0]-rect.width, Wep::Steps_position[1], Wep::Save_windows_size[0]-32, 32, Wep::Steps_text, 2)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- end
- # Draw completed game
- if Wep::Show_completed_game and not Wep::Quick_general_info
- rect = tb.text_size(comp.to_s+"%")
- self.contents.draw_text(Wep::Completed_game_position[0], Wep::Completed_game_position[1], Wep::Save_windows_size[0]-32, 32, comp.to_s+"%", 2)
- self.contents.font.color = Wep::Description_color
- self.contents.font.bold = Wep::Description_bold
- self.contents.draw_text(Wep::Completed_game_position[0]-rect.width, Wep::Completed_game_position[1], Wep::Save_windows_size[0]-32, 32, Wep::Completed_game_text, 2)
- self.contents.font.color = Wep::Basic_color
- self.contents.font.bold = false
- end
- # Draw date
- if Wep::Show_date and not Wep::Quick_general_info
- time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
- self.contents.draw_text(Wep::Date_position[0], Wep::Date_position[1], Wep::Save_windows_size[0], 32, time_string, 2)
- end
- else
- # If the file didnt exist, make psj nil and draw empty slot text
- if file_exist == false
- @psj= nil
- if file_index == Wep::Quicksave_slot-1 and Wep::Quicksave
- name = Wep::Empty_quicksave_slot_text
- elsif file_index == Wep::Autosave_slot-1 and Wep::Autosave
- name = Wep::Empty_autosave_slot_text
- else
- name = Wep::Empty_slot
- end
- @name_width = contents.text_size(name).width
- self.contents.draw_text(Wep::Identifier_text_position[0],Wep::Identifier_text_position[1], Wep::Save_windows_size[0], 32, name)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Set Selected
- # selected : new selected (true = selected, false = unselected)
- #--------------------------------------------------------------------------
- def selected=(selected)
- @selected = selected
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # * Cursor Rectangle Update
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @selected
- self.cursor_rect.set(-14, -14, 640, 128)
- else
- self.cursor_rect.empty
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Compatibility check: Scene title modification
- #--------------------------------------------------------------------------
- if Wep::Title_modification
- #==============================================================================
- # ** Scene_Title
- #------------------------------------------------------------------------------
- # This class performs title screen processing.
- #==============================================================================
- class Scene_Title
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # If battle test
- if $BTEST
- battle_test
- return
- end
- # Load database
- $data_actors = load_data("Data/Actors.rxdata")
- $data_classes = load_data("Data/Classes.rxdata")
- $data_skills = load_data("Data/Skills.rxdata")
- $data_items = load_data("Data/Items.rxdata")
- $data_weapons = load_data("Data/Weapons.rxdata")
- $data_armors = load_data("Data/Armors.rxdata")
- $data_enemies = load_data("Data/Enemies.rxdata")
- $data_troops = load_data("Data/Troops.rxdata")
- $data_states = load_data("Data/States.rxdata")
- $data_animations = load_data("Data/Animations.rxdata")
- $data_tilesets = load_data("Data/Tilesets.rxdata")
- $data_common_events = load_data("Data/CommonEvents.rxdata")
- $data_system = load_data("Data/System.rxdata")
- # Make system object
- $game_system = Game_System.new
- # Make title graphic
- @sprite = Sprite.new
- @sprite.bitmap = RPG::Cache.title($data_system.title_name)
- # Make command window
- s1 = Wep::New_game_text
- s2 = Wep::Load_game_text
- # Changue Title syntax if quickload enabled
- if Wep::Must_load and Wep::Quicksave
- if FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::Quicksave_slot.to_s + Wep::Saves_extension)
- s2 = Wep::Title_quickload
- end
- end
- s3 = Wep::Quit_game_text
- @command_window = Window_Command.new(192, [s1, s2, s3])
- @command_window.back_opacity = 160
- @command_window.x = 320 - @command_window.width / 2
- @command_window.y = 288
- # Continue enabled determinant
- # Check if at least one save file exists
- # If enabled, make @continue_enabled true; if disabled, make it false
- @continue_enabled = false
- # Check for one slot slots if one slot modes are active
- if Wep::One_slot_mode or Wep::One_slot_mode_quicksaving
- @continue_enabled = FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::One_slot_mode_slot.to_s + Wep::Saves_extension)
- else
- for i in 0...Wep::Max_slots
- if FileTest.exist?(Wep::Save_folder+"\\"+Wep::File_name+ "#{i + 1}"+Wep::Saves_extension)
- @continue_enabled = true
- end
- end
- end
- # If continue is enabled, move cursor to "Continue"
- # If disabled, display "Continue" text in gray
- if @continue_enabled
- @command_window.index = 1
- else
- @command_window.disable_item(1)
- end
- # Play title BGM
- $game_system.bgm_play($data_system.title_bgm)
- # Stop playing ME and BGS
- Audio.me_stop
- Audio.bgs_stop
- # Execute transition
- Graphics.transition
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Prepare for transition
- Graphics.freeze
- # Dispose of command window
- @command_window.dispose
- # Dispose of title graphic
- @sprite.bitmap.dispose
- @sprite.dispose
- end
- #--------------------------------------------------------------------------
- # * Command: Continue
- #--------------------------------------------------------------------------
- def command_continue
- # If continue is disabled
- unless @continue_enabled
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # If must load quicksave
- if Wep::Must_load and Wep::Quicksave and FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::Quicksave_slot.to_s + Wep::Saves_extension)
- $game_system.load_slot(Wep::Quicksave_slot)
- return
- end
- # If its in one slot mode: NO ANIRA, HA DE CARREGAR
- if Wep::One_slot_mode and FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::One_slot_mode_slot.to_s + Wep::Saves_extension)
- $game_system.load_slot(Wep::One_slot_mode_slot)
- return
- end
- # If its in one slot quicksavig mode
- if Wep::One_slot_mode_quicksaving and FileTest.exist?(Wep::Save_folder+ "\\"+ Wep::File_name+ Wep::One_slot_mode_slot.to_s + Wep::Saves_extension)
- $game_system.load_slot(Wep::One_slot_mode_slot)
- return
- end
- # Normal switch to load screen
- $scene = Scene_Load.new
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement