Displaying only the current file's Information - Save Menu

Started by Zexion, July 11, 2012, 11:41:42 am

Previous topic - Next topic

Zexion

I'm using this script (mog hunter's edited by me.)
Spoiler: ShowHide
#==============================================================================
# ORIGINAL
# ** MOG Scene File Ayumi V1.2
#     By Moghunter  
#     http://www.atelier-rgss.com
#------------------------------------------------------------------------------
# NEW
# *KH SAVE by Zexion/Linkyboy15
#==============================================================================
 

module MOG
 
 # BASIC MENU CONFIGURATION
   # File Graphics Used  
     FILE_LAYOUT     = "Layout-File"     # File Menu Graphics
     FILE_BACKGROUND = "Back-Other"      # Animated background graphic  
     FILE_STATUS     = "Status-File"     # File Window Graphic
     FILE_STATUS2     = "Status-FBG"     # File Window Graphic
     Map_end      = "_mgfx"             # Suffix for map graphics
   # File Effects
     FILE_MOVE_FX    = false             # If savefile moves side-to-side
     FILE_OPACITY_FX = false             # If savefile changes opacity
   # Menu
     FILE_FX         = 2                 # Back FX (0=Moving/ 1=Still/ 2=Map)
     FILE_TRAN_TIME  = 10                # Transition Time
     FILE_TRAN_TYPE  = "013-Square01"     # Transition Type (Name)
   # Font Used
     FILE_FONT       = "Georgia"         # Font used in file menu  
     
end

# Mogscript global
$mogscript = {} if $mogscript == nil
$mogscript["menu_ayumi"] = true



#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles the map. It includes scrolling and passable determining
#  functions. Refer to "$game_map" for the instance of this class.
#==============================================================================

class Game_Map
 #--------------------------------------------------------------------------
 # * Get Map Name
 #--------------------------------------------------------------------------  
 def map_name
   @mapinfo = load_data("Data/MapInfos.rxdata") if @mapinfo == nil
   return @mapinfo[@map_id].name
 end
end



#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base < Window
 #--------------------------------------------------------------------------
 # * Draw File Window
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate  
 #--------------------------------------------------------------------------    
 def drw_win_file(x, y)
   dwf = RPG::Cache.picture(MOG::FILE_STATUS)
   cw = dwf.width
   ch = dwf.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x , y - ch, dwf, src_rect)    
 end  
 
   def drw_no_file(x, y)
   dwf = RPG::Cache.picture(MOG::FILE_STATUS2)
   cw = dwf.width
   ch = dwf.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x , y - ch, dwf, src_rect)    
 end  
 #--------------------------------------------------------------------------
 # * Draw map3 (actor, x, y)
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #--------------------------------------------------------------------------  
 def draw_map3(actor, x, y)
   face = RPG::Cache.picture(actor.map_name + MOG::Map_end)
   cw = face.width
   ch = face.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x , y - ch, face, src_rect)    
 end  
 #--------------------------------------------------------------------------
 # * Draw Actor Level #6
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #--------------------------------------------------------------------------  
 def draw_actor_level6(actor, x, y)
   self.contents.font.name = "Zeroes Two"
   self.contents.font.color = Color.new(255,255,255,255)
   self.contents.draw_text(x + 17, y + 1, 24, 32, actor.level.to_s, 2)
 end
 #--------------------------------------------------------------------------
 # * Draw Actor munny1
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #--------------------------------------------------------------------------  
 def draw_munny1(x, y)
   self.contents.font.name = "Zeroes Two"
   self.contents.font.color = Color.new(255,255,255,255)
   self.contents.draw_text(x + 1, y + 1, 80, 32, @game_party.gold.to_s)
 end
end

#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
#  This window displays save files on the save and load screens.
#==============================================================================

class Window_SaveFile < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     file_index : save file index (0-3)
 #     filename   : file name
 #--------------------------------------------------------------------------  
 def initialize(file_index, filename)
   super(-10, 4 + file_index * 80, 680, 240)    
   self.contents = Bitmap.new(width - 32, height - 32)  
   self.opacity = 0
   @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)
     @game_troop     = Marshal.load(file)
     @game_map       = Marshal.load(file)
     @total_sec      = @frame_count / Graphics.frame_rate
     file.close
   end
   @wiref = 0
   refresh
   @selected = false
 end  
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------  
 def refresh
   self.contents.clear
   drw_no_file(20,65)
   self.contents.font.name = "Zeroes One"
   self.contents.font.size = 15
   name = "#{@file_index + 1}"
   self.contents.font.color = Color.new(74,0,0,255)
   self.contents.draw_text(116, -24, 600, 72, name)
   if @file_exist
   drw_win_file(20,65)
     for i in 0...@characters.size
       x = 58
       actors = @game_party.actors
       for i in 0...[actors.size, 4].min
       x     = i * 5
       actor = actors[0]    
       self.contents.font.size = 15  
       draw_actor_level6(actor, 17, 17)
       draw_munny1(200,17)
       actor = actors[0]  
   self.contents.font.name = "Zeroes One"
   self.contents.font.size = 15
   name = "#{@file_index + 1}"
   self.contents.font.color = Color.new(146,24,24,255)
   self.contents.draw_text(116, -24, 600, 72, name)
 end
end
     self.contents.font.size = 15
     hour = @total_sec / 60 / 60
     min = @total_sec / 60 % 60
     sec = @total_sec % 60
     text = sprintf("%02d:%02d:%02d", hour, min, sec)
     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
     self.contents.font.name = "Zeroes Two"
     self.contents.font.color = Color.new(255,255,255,255)
     self.contents.draw_text(-180 , -30, 368 , 167, @game_map.map_name.to_s, 2)
     self.contents.draw_text(-210 , -50, 368 , 167, text, 2)

   end
       else
 end
 
 #--------------------------------------------------------------------------
 # * Set Selected
 #     selected : new selected (true = selected, false = unselected)
 #--------------------------------------------------------------------------
 def selected=(selected)
   @selected = selected
 end
end



#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
#  This class performs save screen processing.
#==============================================================================

class Scene_Save < Scene_File
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias mog_init initialize
 def initialize
   mog_init
   $mog_scene_filesave_flag = 1
 end
end


#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias mog_init initialize
 def initialize
   mog_init
   $mog_scene_filesave_flag = 1
 end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This is a superclass for the save screen and load screen.
#==============================================================================

class Scene_File
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------  
 def main
   if $mog_scene_filesave_flag != 1
     @mnback = Plane.new
     @mnback.bitmap = RPG::Cache.picture(MOG::FILE_BACKGROUND)
     @mnback.z = 1000    
   else
     if MOG::FILE_FX == 0
       @mnback = Plane.new
       @mnback.bitmap = RPG::Cache.picture(MOG::FILE_BACKGROUND)
       @mnback.z = 1000
     elsif MOG::FILE_FX == 1
       @mnback = Plane.new
       @mnback.bitmap = RPG::Cache.picture(MOG::FILE_BACKGROUND)
       @mnback.z = 1000
     end
   end
   @mnlay = Sprite.new
   @mnlay.bitmap = RPG::Cache.picture(MOG::FILE_LAYOUT)
   @mnlay.z = 500
   @help_window = Window_Help.new
   @help_window.set_text(@help_text)
   @help_window.opacity = 0
   @savefile_windows = []
   @cursor_displace = 0
   for i in 0..2
     @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
   end
   
   @savefile_windows[0]
   @file_index = $game_temp.last_file_index
   @savefile_windows[@file_index].selected = true
   
   @savefile_windows[0].y = 20    
   @savefile_windows[1].y = 80
   @savefile_windows[2].y = 140    
   
   @win_move_time = 0
   @win_move = 0
   @win_dire = 0
   @win_opac = 255
   @win1_y = 0
   @win2_y = 0
   @win3_y = 0
   unless MOG::FILE_FX == 2
     Graphics.transition(MOG::FILE_TRAN_TIME, "Graphics/Transitions/" +
       MOG::FILE_TRAN_TYPE)
   else
     Graphics.transition
   end
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   for i in 0..50
     @mnback.ox += 1 if MOG::FILE_FX == 0
     @savefile_windows[0].x += 10    
     @savefile_windows[1].x -= 10
     @savefile_windows[2].x += 10
     for i in @savefile_windows
       i.contents_opacity -= 5
     end  
     Graphics.update  
   end      
   Graphics.freeze
   @help_window.dispose
   @mnback.dispose if MOG::FILE_FX == 0
   @mnback.dispose if MOG::FILE_FX == 1
   @mnback.dispose if MOG::FILE_FX == 2 && $mog_scene_filesave_flag != 1
   $mog_scene_filesave_flag = 0
   @mnlay.dispose
   for i in @savefile_windows ; i.dispose ; end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------    
 def update
   @mnback.ox += 1 if MOG::FILE_FX == 0
   if MOG::FILE_OPACITY_FX
     @win_opac += 3
     @win_opac = 150 if @win_opac > 254
   else
     @win_opac = 255
   end
   @win_move_time += 1    
   if @win_move_time > 60
     @win_dire += 1
     @win_move_time = 0    
   end
   @win_dire = 0 if @win_dire > 1
   if @win_dire == 0
      @win_move += 1
   else  
      @win_move -= 1
   end        
   # Update File Windows
   update_window_z
   update_moving_window if MOG::FILE_MOVE_FX
   update_window_opacity
   @help_window.update    
   for i in @savefile_windows ; i.update ; end
   if Input.trigger?(Input::C)
     on_decision(make_filename(@file_index))
     $game_temp.last_file_index = @file_index
     $scene = Scene_Map.new
     return
   end
 
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Map.new
     return
   end

   if Input.repeat?(Input::DOWN)
     if Input.trigger?(Input::DOWN) or @file_index < 3
       $game_system.se_play($data_system.cursor_se)
       @savefile_windows[@file_index].selected = false
       @file_index = (@file_index + 1) % 3
       @savefile_windows[@file_index].selected = true
       return
     end
   end
   if Input.repeat?(Input::UP)
     if Input.trigger?(Input::UP) or @file_index > 0
       $game_system.se_play($data_system.cursor_se)
       @savefile_windows[@file_index].selected = false
       @file_index = (@file_index - 1) % 3
       @savefile_windows[@file_index].selected = true
       return
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (Reposition File Window)
 #--------------------------------------------------------------------------
 def update_window_z
   if @file_index == 0
     @savefile_windows[0].z = 2000  
     @savefile_windows[1].z = 1000
     @savefile_windows[2].z = 500        
   elsif @file_index == 1
     @savefile_windows[0].z = 1000  
     @savefile_windows[1].z = 2000
     @savefile_windows[2].z = 1000        
   else
     @savefile_windows[0].z = 500  
     @savefile_windows[1].z = 1000
     @savefile_windows[2].z = 2000        
   end      
 end  
 #--------------------------------------------------------------------------
 # * Frame Update (Moving File Window)
 #--------------------------------------------------------------------------
 def update_moving_window
   if @file_index == 0
     @savefile_windows[0].x = @win_move
     @savefile_windows[1].x = 0
     @savefile_windows[1].x = 0
     @savefile_windows[2].x = 0    
   elsif @file_index == 1
     @savefile_windows[0].x = 0
     @savefile_windows[1].x = @win_move
     @savefile_windows[2].x = 0    
   else
     @savefile_windows[0].x = 0
     @savefile_windows[1].x = 0
     @savefile_windows[2].x = @win_move  
   end      
 end
 #--------------------------------------------------------------------------
 # * Frame Update (File Window Opacity)
 #--------------------------------------------------------------------------  
 def update_window_opacity
   if @file_index == 0
     @savefile_windows[0].contents_opacity =   @win_opac
     @savefile_windows[1].contents_opacity =   130
     @savefile_windows[2].contents_opacity =   130    
   elsif @file_index == 1
     @savefile_windows[0].contents_opacity =   130
     @savefile_windows[1].contents_opacity =   @win_opac
     @savefile_windows[2].contents_opacity =   130
   else
     @savefile_windows[0].contents_opacity =   130
     @savefile_windows[1].contents_opacity =   130
     @savefile_windows[2].contents_opacity =   @win_opac    
   end    
 end
end


I want to display the Current(save location)Map, the money, and the playtime in seperate windows from the file. Instead of drawing the information 3 times (once for each file) how would I make it draw the information once (for the selected/highlighted file).


Examples:
current: ShowHide