Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. =begin ************************************************************************
  2.   Alternate Save Layout Ver.1.01
  3.   ---------------------------------------------------------------------------
  4.     Changes the layout of the save and load screen.
  5.     Source: http://neomemo.web.fc2.com [Neo Memo] (defunct)
  6. =end # ************************************************************************
  7.  
  8. #-information------------------------------------------------------------------
  9. $ziifee ||= {}
  10. $ziifee[:SaveLayout] = :TypeA
  11. #------------------------------------------------------------------------------
  12. #-memo-------------------------------------------------------------------------
  13. #  
  14. #  
  15. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  16. #  
  17. #  
  18. #------------------------------------------------------------------------------
  19.  
  20. module ZiifSaveLayoutA
  21.   #
  22.   #
  23.   File_column  = 3              # number of columns
  24.   File_row     = 6              # number of rows
  25.   D_LineNumber = 6              # draw line number
  26.   File_Align   = 1              # Test position (0:left, 1:center, 2:right)
  27.   D_StoryList  = false          # Draw story list? ( true / false )
  28.   V_None       = "No Data"      # Message for none
  29.  
  30.   #
  31.   WindowMargin       = 8        # Window margin by   (px)
  32.   WindowLineNumber   = 7        # Window line number limit
  33.   WindowTransparency = false    # Set window transparency ( true / false )
  34.  
  35.   #
  36.   HelpWTransparency  = false    # Use help transparency ( true / false )
  37.  
  38.   #
  39.   SaveConfirm          = true   # Save confirmation? ( true / false )
  40.   SConfirmationDefault = 0      # Set default cursor ( 0:Yes / 1:No )
  41.   V_SConfirmation      = "Do you want to save?"   # Message prompt
  42.   V_SConfirmationYes   = "Yes"                     # Message for yes
  43.   V_SConfirmationNo    = "No"                         # Message for no
  44.  
  45.   #
  46.   LoadConfirm          = true   # Load confirmation? ( true / false )
  47.   LConfirmationDefault = 0      # Set default cursor ( 0:Yes / 1:No )
  48.   V_LConfirmation      = "Do you want to load?"   # Message prompt
  49.   V_LConfirmationYes   = "Yes"                     # Message for yes
  50.   V_LConfirmationNo    = "No"                         # Message for no
  51.  
  52.   # Set picture background ( "" : put the image in Graphics/Pictures folder)
  53.   SaveBackground = ""           # picture for Save Background
  54.   LoadBackground = ""           # picture for Load Background
  55.  
  56.   #
  57.  
  58.   # Display settings ( true : display / false : don't display )
  59.   #
  60.   D_File       = true      # Show file?
  61.   D_Story      = true      # Show story?
  62.   D_Playtime   = true      # Show playtime?
  63.  
  64.   #
  65.   D_Area       = true      # Show area?
  66.   D_Gold       = true      # Show gold?
  67.   D_AG_Line    = false     # Adjust sprite on facesets?
  68.  
  69.   #
  70.   D_PartyFaces = false     # Show party face? (false, due to clutter)
  71.   D_Characters = true      # Show characters?
  72.  
  73.   #
  74.   D_LeaderInfo = true      # Show leader info? (true, to show stats)
  75.  
  76.   D_Face       = true      # Show face?
  77.   D_Name       = true      # Show name?
  78.   D_Level      = true      # Show level?
  79.   D_Class      = true      # Show class?
  80.   D_Nickname   = true      # Show nickname?
  81.   D_HPMP       = true      # Show hp/mp?
  82.   D_UnderName  = :level    # Show something under name? ( :level / :class / nil )
  83.   D_Param      = true      # Show param/ stats?
  84.   D_Equip      = false     # Show equip?
  85.  
  86.   #
  87. end
  88.  
  89. module ZiifManager
  90.   # [ 2 ]
  91.   # Texts : Color.new (R, G, B)
  92.   Story_Color    = Color.new(255, 255, 128)        # Texts for story
  93.   Area_Color     = Color.new(128, 255, 0)          # Area text body
  94.  
  95.   #
  96.   Story_VarID    = 0                               # ID
  97.   StorySet     ||= Hash.new("")
  98.   StorySet[1]    = ""               # ID:01
  99.   StorySet[2]    = "l"     # ID:02
  100.   StorySet[3]    = ""       # ID:03
  101.   #-memo---------------------------------------------------------------------
  102.   #  StorySet[l] = ""           #
  103.   #--------------------------------------------------------------------------
  104.  
  105.   #
  106.   AreaSet      ||= Hash.new(Hash.new(nil))
  107.   AreaSet[1]     = Hash.new(nil)                   #
  108.   AreaSet[1][1]  = ""                #
  109.   AreaSet[1][2]  = ""                  #
  110.   AreaSet[2]     = Hash.new(nil)                   #
  111.   AreaSet[2][1]  = ""                    #
  112.   #-memo---------------------------------------------------------------------
  113.   #  AreaSet[vID] = Hash.new(nil)             #
  114.   #  AreaSet[vID][[ID] = ""  #
  115.   #  
  116.   #--------------------------------------------------------------------------
  117. end
  118.  
  119. #******************************************************************************
  120. #
  121. #******************************************************************************
  122.  
  123. #==============================================================================
  124. # ZiifSaveLayoutA
  125. #==============================================================================
  126.  
  127. module ZiifSaveLayoutA
  128.   #--------------------------------------------------------------------------
  129.   # self.savefile_max
  130.   #--------------------------------------------------------------------------
  131.   def self.savefile_max
  132.     File_column * File_row
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # self.save_background?
  136.   #--------------------------------------------------------------------------
  137.   def self.save_background?
  138.     SaveBackground != ""
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # self.save_background_bitmap
  142.   #--------------------------------------------------------------------------
  143.   def self.save_background_bitmap
  144.     Cache.picture(SaveBackground)
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # self.load_background?
  148.   #--------------------------------------------------------------------------
  149.   def self.load_background?
  150.     LoadBackground != ""
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # self.load_background_bitmap
  154.   #--------------------------------------------------------------------------
  155.   def self.load_background_bitmap
  156.     Cache.picture(LoadBackground)
  157.   end
  158. end
  159.  
  160. #==============================================================================
  161. # ZiifManager
  162. #==============================================================================
  163.  
  164. module ZiifManager
  165.   #--------------------------------------------------------------------------
  166.   # self.story_name
  167.   #--------------------------------------------------------------------------
  168.   def self.story_name(story_id)
  169.     StorySet[story_id]
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # self.area_name
  173.   #--------------------------------------------------------------------------
  174.   def self.area_name(map_id, region_id = nil)
  175.     AreaSet[map_id][region_id] || map_name(map_id)
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # self.map_name
  179.   #--------------------------------------------------------------------------
  180.   def self.map_name(map_id)
  181.     @map_name_cache ||= {}
  182.     unless @map_name_cache[map_id]
  183.       map = load_data(sprintf("Data/Map%03d.rvdata2", map_id)) rescue nil
  184.       @map_name_cache[map_id] = (map ? map.display_name : "No MapData")
  185.     end
  186.     @map_name_cache[map_id]
  187.   end
  188. end
  189.  
  190. #==============================================================================
  191. # ZiifManager::DrawingModule
  192. #==============================================================================
  193.  
  194. module ZiifManager::DrawingModule
  195.   #--------------------------------------------------------------------------
  196.   # story_color
  197.   #--------------------------------------------------------------------------
  198.   def story_color
  199.     ZiifManager::Story_Color
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # area_color
  203.   #--------------------------------------------------------------------------
  204.   def area_color
  205.     ZiifManager::Area_Color
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # draw_file_number
  209.   #--------------------------------------------------------------------------
  210.   def draw_file_number(index, x, y, enabled = true, width = 120, align = 0)
  211.     change_color(normal_color, enabled)
  212.     draw_text(x, y, width, line_height, Vocab::File + " #{index + 1}", align)
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # draw_story_name
  216.   #--------------------------------------------------------------------------
  217.   def draw_story_name(story_id, x, y, width = 256, align = 0)
  218.     change_color(story_color)
  219.     text = ZiifManager.story_name(story_id)
  220.     draw_text(x, y, width, line_height, text, align)
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # draw_area_map
  224.   #--------------------------------------------------------------------------
  225.   def draw_area_map(map_id, region_id, x, y, width = 256, align = 0)
  226.     change_color(area_color)
  227.     text = ZiifManager.area_name(map_id, region_id)
  228.     draw_text(x, y, width, line_height, text, align)
  229.   end
  230. end
  231.  
  232. #==============================================================================
  233. # �� DataManager
  234. #==============================================================================
  235.  
  236. class << DataManager
  237.   #--------------------------------------------------------------------------
  238.   # savefile_max
  239.   #--------------------------------------------------------------------------
  240.   def savefile_max
  241.     return ZiifSaveLayoutA.savefile_max
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # make_save_header
  245.   #--------------------------------------------------------------------------
  246.   alias :ziif_save_layout_01_make_save_header :make_save_header
  247.   def make_save_header
  248.     header = ziif_save_layout_01_make_save_header
  249.     header[:story_id]  = $game_system.ziif_story_id
  250.     header[:map_id]    = $game_map.map_id
  251.     header[:region_id] = $game_player.region_id
  252.     header[:gold]      = $game_party.gold
  253.     header[:faces]     = $game_party.ziif_faces_for_savefile
  254.     header[:leader]    = $game_party.ziif_leader_for_savefile
  255.     header
  256.   end
  257. end
  258.  
  259. #******************************************************************************
  260. #
  261. #******************************************************************************
  262.  
  263. #==============================================================================
  264. # Game_System
  265. #==============================================================================
  266.  
  267. class Game_System
  268.   #--------------------------------------------------------------------------
  269.   # ziif_story_id
  270.   #--------------------------------------------------------------------------
  271.   def ziif_story_id
  272.     $game_variables[ZiifManager::Story_VarID]
  273.   end
  274. end
  275.  
  276. #==============================================================================
  277. # Game_Party
  278. #==============================================================================
  279.  
  280. class Game_Party
  281.   #--------------------------------------------------------------------------
  282.   # ziif_faces_for_savefile
  283.   #--------------------------------------------------------------------------
  284.   def ziif_faces_for_savefile
  285.     battle_members.collect do |actor|
  286.       [actor.face_name, actor.face_index]
  287.     end
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ziif_leader_for_savefile
  291.   #--------------------------------------------------------------------------
  292.   def ziif_leader_for_savefile
  293.     return leader
  294.   end
  295. end
  296.  
  297. #******************************************************************************
  298. #
  299. #******************************************************************************
  300.  
  301. #==============================================================================
  302. # Window_ZiifFileList
  303. #------------------------------------------------------------------------------
  304. #
  305. #==============================================================================
  306.  
  307. class Window_ZiifFileList < Window_Selectable
  308.   #--------------------------------------------------------------------------
  309.   # Mix-In
  310.   #--------------------------------------------------------------------------
  311.   include ZiifManager::DrawingModule      #
  312.   #--------------------------------------------------------------------------
  313.   # initialize
  314.   #--------------------------------------------------------------------------
  315.   def initialize
  316.     rect = window_rect
  317.     super(rect.x, rect.y, rect.width, rect.height)
  318.     self.opacity = 0
  319.     refresh
  320.     activate
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # window_rect
  324.   #--------------------------------------------------------------------------
  325.   def window_rect
  326.     rect = Rect.new
  327.     rect.x      = 4
  328.     rect.y      = 48
  329.     rect.width  = Graphics.width-8
  330.     rect.height = fitting_height(ZiifSaveLayoutA::D_LineNumber)
  331.     rect
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # column_max
  335.   #--------------------------------------------------------------------------
  336.   def col_max
  337.     ZiifSaveLayoutA::File_column
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # item_max
  341.   #--------------------------------------------------------------------------
  342.   def item_max
  343.     DataManager.savefile_max
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # alignment
  347.   #--------------------------------------------------------------------------
  348.   def alignment
  349.     return ZiifSaveLayoutA::File_Align
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # file_number_draw
  353.   #--------------------------------------------------------------------------
  354.   def file_number_draw?
  355.     !ZiifSaveLayoutA::D_StoryList
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # story_name_draw
  359.   #--------------------------------------------------------------------------
  360.   def story_name_draw?
  361.     ZiifSaveLayoutA::D_StoryList
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # header
  365.   #--------------------------------------------------------------------------
  366.   def header(index)
  367.     DataManager.load_header(index)
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # enable
  371.   #--------------------------------------------------------------------------
  372.   def enable?(index)
  373.     header(index)
  374.   end
  375.   #--------------------------------------------------------------------------
  376.   # process_ok
  377.   #--------------------------------------------------------------------------
  378.   def process_ok
  379.     if current_item_enabled?
  380.       Input.update
  381.       deactivate
  382.       call_ok_handler
  383.     else
  384.       Sound.play_buzzer
  385.     end
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   #
  389.   #--------------------------------------------------------------------------
  390.   def current_item_enabled?
  391.     !SceneManager.scene_is?(Scene_Load) || enable?(self.index)
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   #
  395.   #--------------------------------------------------------------------------
  396.   def draw_item(index)
  397.     rect  = item_rect(index)
  398.     #
  399.     if file_number_draw?
  400.       draw_file_number(index,rect.x,rect.y,enable?(index),rect.width,alignment)
  401.     end
  402.     #
  403.     if story_name_draw?
  404.       header = header(index)
  405.       if header && header[:story_id]
  406.         draw_story_name(header[:story_id],rect.x,rect.y,rect.width,alignment)
  407.       else
  408.         change_color(normal_color, false)
  409.         draw_text(rect, ZiifSaveLayoutA::V_None, alignment)
  410.       end
  411.     end
  412.   end
  413. end
  414.  
  415. #==============================================================================
  416. # Window_ZiifSaveFile
  417. #------------------------------------------------------------------------------
  418. #
  419. #==============================================================================
  420.  
  421. class Window_ZiifSaveFile < Window_Base
  422.   #--------------------------------------------------------------------------
  423.   #  Mix-In
  424.   #--------------------------------------------------------------------------
  425.   include ZiifManager::DrawingModule      #
  426.   #--------------------------------------------------------------------------
  427.   #
  428.   #--------------------------------------------------------------------------
  429.   attr_reader   :selected                 #
  430.   attr_reader   :header                   #
  431.   #--------------------------------------------------------------------------
  432.   # initialize
  433.   #     index :
  434.   #--------------------------------------------------------------------------
  435.   def initialize(dummy_height, index)
  436.     rect = window_rect
  437.     super(rect.x, rect.y, rect.width, rect.height)
  438.     self.opacity = 0 if ZiifSaveLayoutA::WindowTransparency
  439.     @file_index = index
  440.     clear_header
  441.     refresh
  442.     self.visible = false
  443.     @selected = false
  444.   end
  445.   #--------------------------------------------------------------------------
  446.   # window_rect
  447.   #--------------------------------------------------------------------------
  448.   def window_rect
  449.     rect = Rect.new
  450.     rect.x      = ZiifSaveLayoutA::WindowMargin
  451.     rect.y      = Graphics.height - ZiifSaveLayoutA::WindowMargin
  452.     rect.width  = Graphics.width - ZiifSaveLayoutA::WindowMargin * 2
  453.     rect.height = fitting_height(ZiifSaveLayoutA::WindowLineNumber)
  454.     rect.y     -= rect.height
  455.     rect
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # selected
  459.   #--------------------------------------------------------------------------
  460.   def selected=(selected)
  461.     @selected = selected
  462.     update_select
  463.   end
  464.   #--------------------------------------------------------------------------
  465.   # update_select
  466.   #--------------------------------------------------------------------------
  467.   def update_select
  468.     self.visible = self.selected
  469.     update
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # icon_header
  473.   #--------------------------------------------------------------------------
  474.   def load_header
  475.     @header = DataManager.load_header(@file_index)
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # clear_header
  479.   #--------------------------------------------------------------------------
  480.   def clear_header
  481.     @header = nil
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # header
  485.   #--------------------------------------------------------------------------
  486.   def header?(symbol)
  487.     @header && @header[symbol]
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # refresh
  491.   #--------------------------------------------------------------------------
  492.   def refresh
  493.     contents.clear
  494.     load_header
  495.     draw_file_contents
  496.     draw_no_file unless @header
  497.     clear_header
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   # draw_file_contents
  501.   #--------------------------------------------------------------------------
  502.   def draw_file_contents
  503.   end
  504.   #--------------------------------------------------------------------------
  505.   # draw_no_file
  506.   #--------------------------------------------------------------------------
  507.   def draw_no_file
  508.     rect   = Rect.new(0, 0, contents.width, line_height)
  509.     rect.y = (contents.height - rect.height) / 2
  510.     change_color(normal_color, false)
  511.     draw_text(rect, ZiifSaveLayoutA::V_None, 1)
  512.   end
  513. end
  514.  
  515. #==============================================================================
  516. # Window_ZiifFileConfirmation
  517. #------------------------------------------------------------------------------
  518. #
  519. #==============================================================================
  520.  
  521. class Window_ZiifFileConfirmation < Window_Command
  522.   #--------------------------------------------------------------------------
  523.   # initialize
  524.   #--------------------------------------------------------------------------
  525.   def initialize
  526.     super(window_x, window_y)
  527.     self.z        = 200
  528.     self.openness = 0
  529.     deactivate
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # window_x
  533.   #--------------------------------------------------------------------------
  534.   def window_x
  535.     return (Graphics.width-window_width) / 2
  536.   end
  537.   #--------------------------------------------------------------------------
  538.   # window_y
  539.   #--------------------------------------------------------------------------
  540.   def window_y
  541.     return (Graphics.height-window_height) / 2
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # window_width
  545.   #--------------------------------------------------------------------------
  546.   def window_width
  547.     return 128
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # visible_line_number
  551.   #--------------------------------------------------------------------------
  552.   def visible_line_number
  553.     return 2
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # select_default
  557.   #--------------------------------------------------------------------------
  558.   def select_default
  559.   end
  560. end
  561.  
  562. #==============================================================================
  563. # �� Window_ZiifSaveConfirmation
  564. #------------------------------------------------------------------------------
  565. #
  566. #==============================================================================
  567.  
  568. class Window_ZiifSaveConfirmation < Window_ZiifFileConfirmation
  569.   #--------------------------------------------------------------------------
  570.   # make_command_list
  571.   #--------------------------------------------------------------------------
  572.   def make_command_list
  573.     add_command(ZiifSaveLayoutA::V_SConfirmationYes, :save)
  574.     add_command(ZiifSaveLayoutA::V_SConfirmationNo, :cancel)
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # update_help
  578.   #--------------------------------------------------------------------------
  579.   def update_help
  580.     @help_window.set_text(ZiifSaveLayoutA::V_SConfirmation)
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # select_default
  584.   #--------------------------------------------------------------------------
  585.   def select_default
  586.     select(ZiifSaveLayoutA::SConfirmationDefault)
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # process_ok
  590.   #--------------------------------------------------------------------------
  591.   def process_ok
  592.     return super if current_symbol != :save
  593.     if current_item_enabled?
  594.       Input.update
  595.       deactivate
  596.       call_ok_handler
  597.     else
  598.       Sound.play_buzzer
  599.     end
  600.   end
  601. end
  602.  
  603. #==============================================================================
  604. # �� Window_ZiifLoadConfirmation
  605. #------------------------------------------------------------------------------
  606. #
  607. #==============================================================================
  608.  
  609. class Window_ZiifLoadConfirmation < Window_ZiifFileConfirmation
  610.   #--------------------------------------------------------------------------
  611.   # make_command_list
  612.   #--------------------------------------------------------------------------
  613.   def make_command_list
  614.     add_command(ZiifSaveLayoutA::V_LConfirmationYes, :load)
  615.     add_command(ZiifSaveLayoutA::V_LConfirmationNo, :cancel)
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # update_help
  619.   #--------------------------------------------------------------------------
  620.   def update_help
  621.     @help_window.set_text(ZiifSaveLayoutA::V_LConfirmation)
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # select_default
  625.   #--------------------------------------------------------------------------
  626.   def select_default
  627.     select(ZiifSaveLayoutA::LConfirmationDefault)
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # process_ok
  631.   #--------------------------------------------------------------------------
  632.   def process_ok
  633.     return super if current_symbol != :load
  634.     if current_item_enabled?
  635.       Input.update
  636.       deactivate
  637.       call_ok_handler
  638.     else
  639.       Sound.play_buzzer
  640.     end
  641.   end
  642. end
  643.  
  644. #******************************************************************************
  645. #
  646. #******************************************************************************
  647.  
  648. #==============================================================================
  649. # Scene_File
  650. #==============================================================================
  651.  
  652. class Scene_File
  653.   #--------------------------------------------------------------------------
  654.   # ziif_file_background
  655.   #--------------------------------------------------------------------------
  656.   def ziif_file_background?
  657.     return false
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # ziif_file_background_bitmap
  661.   #--------------------------------------------------------------------------
  662.   def ziif_file_background_bitmap
  663.     SceneManager.background_bitmap
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # file_confirm
  667.   #--------------------------------------------------------------------------
  668.   def file_confirm?
  669.     return false
  670.   end
  671.   #--------------------------------------------------------------------------
  672.   # confirmation_window
  673.   #--------------------------------------------------------------------------
  674.   def confirmation_window
  675.     return Window_ZiifFileConfirmation
  676.   end
  677.   #--------------------------------------------------------------------------
  678.   # create_background
  679.   #--------------------------------------------------------------------------
  680.   alias :ziif_save_layout_01_create_background :create_background
  681.   def create_background
  682.     if ziif_file_background?
  683.       create_ziif_file_background
  684.     else
  685.       ziif_save_layout_01_create_background
  686.     end
  687.   end
  688.   #--------------------------------------------------------------------------
  689.   # create_ziif_file_background
  690.   #--------------------------------------------------------------------------
  691.   def create_ziif_file_background
  692.     @background_sprite = Sprite.new
  693.     @background_sprite.bitmap = ziif_file_background_bitmap
  694.   end
  695.   #--------------------------------------------------------------------------
  696.   # create_help_window
  697.   #--------------------------------------------------------------------------
  698.   alias :ziif_save_layout_01_create_help_window :create_help_window
  699.   def create_help_window
  700.     ziif_save_layout_01_create_help_window
  701.     @help_window.opacity = 0 if ZiifSaveLayoutA::HelpWTransparency
  702.   end
  703.   #--------------------------------------------------------------------------
  704.   # create_savefile_windows
  705.   #--------------------------------------------------------------------------
  706.   def create_savefile_windows
  707.     create_filelist_window
  708.     create_savefile_windows_sub
  709.     create_confirmation_window
  710.   end
  711.   #--------------------------------------------------------------------------
  712.   # create_filelist_window
  713.   #--------------------------------------------------------------------------
  714.   def create_filelist_window
  715.     @filelist_window = Window_ZiifFileList.new
  716.     @filelist_window.set_handler(:ok,     method(:on_filelist_ok))
  717.     @filelist_window.set_handler(:cancel, method(:return_scene))
  718.   end
  719.   #--------------------------------------------------------------------------
  720.   # create_savefile_windows_sub
  721.   #--------------------------------------------------------------------------
  722.   def create_savefile_windows_sub
  723.     @savefile_windows = Array.new(item_max) do |i|
  724.       Window_ZiifSaveFile.new(0, i)
  725.     end
  726.   end
  727.   #--------------------------------------------------------------------------
  728.   # create_confirmation_window
  729.   #--------------------------------------------------------------------------
  730.   def create_confirmation_window
  731.     @confirmation_window = confirmation_window.new
  732.     @confirmation_window.help_window = @help_window
  733.     @confirmation_window.set_handler(:ok,     method(:on_confirmation_ok))
  734.     @confirmation_window.set_handler(:cancel, method(:on_confirmation_cancel))
  735.     @confirmation_window.select_default
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # init_selection
  739.   #--------------------------------------------------------------------------
  740.   def init_selection
  741.     @filelist_window.select(first_savefile_index)
  742.     @savefile_windows[index].selected = true
  743.     @last_index = index
  744.     set_file_index
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # index
  748.   #--------------------------------------------------------------------------
  749.   def index
  750.     @filelist_window.index
  751.   end
  752.   #--------------------------------------------------------------------------
  753.   # set_file_index
  754.   #--------------------------------------------------------------------------
  755.   def set_file_index
  756.     @index = index
  757.   end
  758.   #--------------------------------------------------------------------------
  759.   # update_savefile_selection
  760.   #--------------------------------------------------------------------------
  761.   def update_savefile_selection
  762.     if index != @last_index
  763.       set_file_index
  764.       @savefile_windows[@last_index].selected = false
  765.       @savefile_windows[index].selected = true
  766.       @last_index = index
  767.     end
  768.   end
  769.   #--------------------------------------------------------------------------
  770.   # on_filelist_ok
  771.   #--------------------------------------------------------------------------
  772.   def on_filelist_ok
  773.     set_file_index
  774.     if file_confirm?
  775.       Sound.play_ok
  776.       activate_confirmation_window
  777.     else
  778.       on_savefile_ok
  779.     end
  780.   end
  781.   #--------------------------------------------------------------------------
  782.   # activate_confirmation_window
  783.   #--------------------------------------------------------------------------
  784.   def activate_confirmation_window
  785.     @confirmation_window.activate
  786.     @confirmation_window.open
  787.   end
  788.   #--------------------------------------------------------------------------
  789.   # on_confirmation_ok
  790.   #--------------------------------------------------------------------------
  791.   def on_confirmation_ok
  792.     on_savefile_ok
  793.   end
  794.   #--------------------------------------------------------------------------
  795.   # on_confirmation_cancel
  796.   #--------------------------------------------------------------------------
  797.   def on_confirmation_cancel
  798.     @help_window.set_text(help_window_text)
  799.     @confirmation_window.select_default
  800.     @confirmation_window.close
  801.     @filelist_window.activate
  802.   end
  803. end
  804.  
  805. #==============================================================================
  806. # Scene_Save
  807. #==============================================================================
  808.  
  809. class Scene_Save
  810.   #--------------------------------------------------------------------------
  811.   # ziif_file_background
  812.   #--------------------------------------------------------------------------
  813.   def ziif_file_background?
  814.     ZiifSaveLayoutA.save_background?
  815.   end
  816.   #--------------------------------------------------------------------------
  817.   # ziif_file_background_bitmap
  818.   #--------------------------------------------------------------------------
  819.   def ziif_file_background_bitmap
  820.     ZiifSaveLayoutA.save_background_bitmap
  821.   end
  822.   #--------------------------------------------------------------------------
  823.   # file_confirm
  824.   #--------------------------------------------------------------------------
  825.   def file_confirm?
  826.     ZiifSaveLayoutA::SaveConfirm
  827.   end
  828.   #--------------------------------------------------------------------------
  829.   # confirmation_window
  830.   #--------------------------------------------------------------------------
  831.   def confirmation_window
  832.     return Window_ZiifSaveConfirmation
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # on_savefile_ok
  836.   #--------------------------------------------------------------------------
  837.   alias :ziif_save_layout_01_save_on_savefile_ok :on_savefile_ok
  838.   def on_savefile_ok
  839.     ziif_save_layout_01_save_on_savefile_ok
  840.     @confirmation_window.close
  841.     @filelist_window.activate
  842.   end
  843. end
  844.  
  845. #==============================================================================
  846. # Scene_Load
  847. #==============================================================================
  848.  
  849. class Scene_Load
  850.   #--------------------------------------------------------------------------
  851.   # ziif_file_background
  852.   #--------------------------------------------------------------------------
  853.   def ziif_file_background?
  854.     ZiifSaveLayoutA.load_background?
  855.   end
  856.   #--------------------------------------------------------------------------
  857.   # ziif_file_background_bitmap
  858.   #--------------------------------------------------------------------------
  859.   def ziif_file_background_bitmap
  860.     ZiifSaveLayoutA.load_background_bitmap
  861.   end
  862.   #--------------------------------------------------------------------------
  863.   # file_confirm
  864.   #--------------------------------------------------------------------------
  865.   def file_confirm?
  866.     ZiifSaveLayoutA::LoadConfirm
  867.   end
  868.   #--------------------------------------------------------------------------
  869.   # confirmation_window
  870.   #--------------------------------------------------------------------------
  871.   def confirmation_window
  872.     return Window_ZiifLoadConfirmation
  873.   end
  874.   #--------------------------------------------------------------------------
  875.   # on_savefile_ok
  876.   #--------------------------------------------------------------------------
  877.   alias :ziif_save_layout_01_load_on_savefile_ok :on_savefile_ok
  878.   def on_savefile_ok
  879.     ziif_save_layout_01_load_on_savefile_ok
  880.     @confirmation_window.close
  881.     @filelist_window.activate
  882.   end
  883. end
  884.  
  885. #******************************************************************************
  886. #
  887. #******************************************************************************
  888. #-memo-------------------------------------------------------------------------
  889. #  
  890. #------------------------------------------------------------------------------
  891.  
  892. #==============================================================================
  893. # Window_ZiifFileList
  894. #==============================================================================
  895.  
  896. class Window_ZiifFileList < Window_Selectable
  897.   #--------------------------------------------------------------------------
  898.   # window_rect
  899.   #--------------------------------------------------------------------------
  900.   alias :ziif_line_help_file_window_rect :window_rect
  901.   def window_rect
  902.     rect    = ziif_line_help_file_window_rect
  903.     rect.y -= 6 if $ziifee[:LineHelp]
  904.     rect
  905.   end
  906. end
  907.  
  908. #==============================================================================
  909. # Scene_File
  910. #==============================================================================
  911.  
  912. class Scene_File
  913.   #--------------------------------------------------------------------------
  914.   # create_help_window
  915.   #--------------------------------------------------------------------------
  916.   alias :ziif_line_help_file_create_help_window :create_help_window
  917.   def create_help_window
  918.     return ziif_line_help_file_create_help_window unless $ziifee[:LineHelp]
  919.     @help_window = Window_ZiifLineHelp.new(1)
  920.     @help_window.set_text(help_window_text)
  921.   end
  922. end
  923.  
  924. #******************************************************************************
  925. #
  926. #******************************************************************************
  927. #-memo-------------------------------------------------------------------------
  928. #  For Window_ZiifSaveFile
  929. #------------------------------------------------------------------------------
  930.  
  931. #==============================================================================
  932. # Window_ZiifSaveFile
  933. #==============================================================================
  934.  
  935. class Window_ZiifSaveFile
  936.   #--------------------------------------------------------------------------
  937.   # draw_file_contents
  938.   #--------------------------------------------------------------------------
  939.   def draw_file_contents
  940.     draw_file_info
  941.     draw_party_info
  942.     draw_leader_info
  943.     draw_party_faces
  944.     draw_party_characters
  945.   end
  946.   #--------------------------------------------------------------------------
  947.   # draw_file_info
  948.   #--------------------------------------------------------------------------
  949.   def draw_file_info
  950.     draw_x = 4
  951.     #
  952.     if ZiifSaveLayoutA::D_File
  953.       draw_file_number(@file_index, draw_x, 0)
  954.       draw_x += 128
  955.     end
  956.     #
  957.     if ZiifSaveLayoutA::D_Story && header?(:story_id)
  958.       draw_story_name(@header[:story_id], draw_x, 0)
  959.     end
  960.     #
  961.     if ZiifSaveLayoutA::D_Playtime && header?(:playtime_s)
  962.       change_color(normal_color)
  963.       draw_text(4, 0, contents.width - 8, line_height, @header[:playtime_s], 2)
  964.     end
  965.   end
  966.   #--------------------------------------------------------------------------
  967.   # currency_unit
  968.   #--------------------------------------------------------------------------
  969.   def currency_unit
  970.     Vocab::currency_unit
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # draw_party_info
  974.   #--------------------------------------------------------------------------
  975.   def draw_party_info
  976.     draw_y = contents.height - line_height
  977.     #
  978.     if ZiifSaveLayoutA::D_Area && header?(:map_id)
  979.       map_align = (ZiifSaveLayoutA::D_AG_Line ? 0 : 2)
  980.       map_id    = @header[:map_id]
  981.       region_id = @header[:region_id]
  982.       draw_area_map(map_id, region_id, 4, draw_y, contents.width-8, map_align)
  983.       draw_y -= line_height unless ZiifSaveLayoutA::D_AG_Line
  984.     end
  985.     #
  986.     if ZiifSaveLayoutA::D_Gold && header?(:gold)
  987.       gold = @header[:gold]
  988.       draw_currency_value(gold, currency_unit, 4, draw_y, contents.width - 8)
  989.     end
  990.   end
  991.   #--------------------------------------------------------------------------
  992.   # file_info_draw
  993.   #--------------------------------------------------------------------------
  994.   def file_info_draw?
  995.     ZiifSaveLayoutA::D_File || ZiifSaveLayoutA::D_Story ||
  996.     ZiifSaveLayoutA::D_Playtime
  997.   end
  998.   #--------------------------------------------------------------------------
  999.   # draw_leader_info
  1000.   #--------------------------------------------------------------------------
  1001.   def draw_leader_info
  1002.     return 0, 0 unless ZiifSaveLayoutA::D_LeaderInfo && header?(:leader)
  1003.     actor  = @header[:leader]
  1004.     draw_x = 4
  1005.     draw_y = (file_info_draw? ? line_height : 0)
  1006.     #
  1007.     if ZiifSaveLayoutA::D_Face
  1008.       draw_actor_face(actor, draw_x, draw_y)
  1009.       draw_x += 100
  1010.     end
  1011.     bw = draw_leader_base_info(actor, draw_x, draw_y + line_height)
  1012.     nw = draw_leader_name_info(actor, draw_x, draw_y) - draw_x
  1013.     #
  1014.     if nw <= bw && bw > 0
  1015.       draw_x += bw + 8
  1016.     elsif nw > 0 && bw == 0
  1017.       draw_y += line_height
  1018.     elsif nw > bw && bw > 0
  1019.       draw_x += bw + 8
  1020.       draw_y += line_height
  1021.     end
  1022.     #
  1023.     param_width = contents.width - draw_x
  1024.     line = draw_leader_parameters(actor, draw_x, draw_y, param_width)
  1025.     draw_y += line * line_height
  1026.     #
  1027.     line = draw_leader_equipments(actor, draw_x + 16, draw_y)
  1028.     draw_y += line * line_height
  1029.     return draw_x, draw_y
  1030.   end
  1031.   #--------------------------------------------------------------------------
  1032.   # draw_leader_base_info
  1033.   #--------------------------------------------------------------------------
  1034.   def draw_leader_base_info(actor, x, y)
  1035.     draw_width = 0
  1036.     #
  1037.     if ZiifSaveLayoutA::D_Level && ZiifSaveLayoutA::D_UnderName == :level
  1038.       draw_actor_level(actor, x, y)
  1039.       draw_width = [draw_width, 96].max
  1040.     end
  1041.     #
  1042.     if ZiifSaveLayoutA::D_Class && ZiifSaveLayoutA::D_UnderName == :class
  1043.       draw_actor_class(actor, x, y)
  1044.       draw_width = [draw_width, 112].max
  1045.     end
  1046.     #
  1047.     if ZiifSaveLayoutA::D_HPMP
  1048.       draw_actor_hp(actor, x, y + line_height * 1)
  1049.       draw_actor_mp(actor, x, y + line_height * 2)
  1050.       draw_width = [draw_width, 124].max
  1051.     end
  1052.     return draw_width
  1053.   end
  1054.   #--------------------------------------------------------------------------
  1055.   # draw_leader_name_info
  1056.   #--------------------------------------------------------------------------
  1057.   def draw_leader_name_info(actor, x, y)
  1058.     draw_x = x
  1059.     #
  1060.     if ZiifSaveLayoutA::D_Name
  1061.       draw_actor_name(actor, draw_x, y)
  1062.       draw_x += 126
  1063.     end
  1064.     #
  1065.     if ZiifSaveLayoutA::D_Level && ZiifSaveLayoutA::D_UnderName != :level
  1066.       draw_actor_level(actor, draw_x, y)
  1067.       draw_x += 80
  1068.     end
  1069.     #
  1070.     if ZiifSaveLayoutA::D_Class && ZiifSaveLayoutA::D_UnderName != :class
  1071.       draw_actor_class(actor, draw_x, y)
  1072.       draw_x += 110
  1073.     end
  1074.     #
  1075.     if ZiifSaveLayoutA::D_Nickname
  1076.       draw_actor_nickname(actor, draw_x, y)
  1077.       draw_x += 180
  1078.     end
  1079.     return draw_x
  1080.   end
  1081.   #--------------------------------------------------------------------------
  1082.   # draw_leader_parameters
  1083.   #--------------------------------------------------------------------------
  1084.   def draw_leader_parameters(actor, x, y, width = 120)
  1085.     return 0 unless ZiifSaveLayoutA::D_Param
  1086.     col_num    = [width / 128, 1].max
  1087.     draw_width = width / col_num
  1088.     6.times do |i|
  1089.       draw_x = x + draw_width  * (i % col_num) + 4
  1090.       draw_y = y + line_height * (i / col_num)
  1091.       draw_actor_param_with_width(actor, draw_x, draw_y, i + 2, draw_width - 8)
  1092.     end
  1093.     return (5 + col_num) / col_num
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # draw_actor_param_with_width
  1097.   #--------------------------------------------------------------------------
  1098.   def draw_actor_param_with_width(actor, x, y, param_id, width)
  1099.     change_color(system_color)
  1100.     draw_text(x, y, width - 36, line_height, Vocab::param(param_id))
  1101.     change_color(normal_color)
  1102.     draw_text(x + width - 36, y, 36, line_height, actor.param(param_id), 2)
  1103.   end
  1104.   #--------------------------------------------------------------------------
  1105.   # draw_leader_equipments
  1106.   #--------------------------------------------------------------------------
  1107.   def draw_leader_equipments(actor, x, y)
  1108.     return 0 unless ZiifSaveLayoutA::D_Equip
  1109.     actor.equips.each_with_index do |item, i|
  1110.       draw_item_name(item, x, y + line_height * i)
  1111.     end
  1112.     return actor.equips.size
  1113.   end
  1114.   #--------------------------------------------------------------------------
  1115.   # leader_face_draw
  1116.   #--------------------------------------------------------------------------
  1117.   def leader_face_draw?
  1118.     header?(:leader) &&
  1119.     ZiifSaveLayoutA::D_LeaderInfo && ZiifSaveLayoutA::D_Face
  1120.   end
  1121.   #--------------------------------------------------------------------------
  1122.   # draw_party_faces
  1123.   #--------------------------------------------------------------------------
  1124.   def draw_party_faces
  1125.     return unless ZiifSaveLayoutA::D_PartyFaces && header?(:faces)
  1126.     draw_y = (file_info_draw? ? line_height : 0)
  1127.     draw_y += [96, line_height * 4].max if ZiifSaveLayoutA::D_LeaderInfo
  1128.     draw_x = 4
  1129.     @header[:faces].each_with_index do |data, i|
  1130.       next if i == 0 && leader_face_draw?
  1131.       draw_face_height88(data[0], data[1], draw_x, draw_y)
  1132.       draw_x += 100
  1133.     end
  1134.   end
  1135.   #--------------------------------------------------------------------------
  1136.   # draw_party_characters
  1137.   #--------------------------------------------------------------------------
  1138.   def draw_party_characters
  1139.     return unless ZiifSaveLayoutA::D_Characters && header?(:characters)
  1140.     draw_y  = contents.height - 8
  1141.     draw_y -= line_height if ZiifSaveLayoutA::D_AG_Line
  1142.     draw_x  = 28
  1143.     @header[:characters].each_with_index do |data, i|
  1144.       draw_character(data[0], data[1], draw_x, draw_y)
  1145.       draw_x += 48
  1146.     end
  1147.   end
  1148.   #--------------------------------------------------------------------------
  1149.   # draw_face_height (88px)
  1150.   #--------------------------------------------------------------------------
  1151.   def draw_face_height88(face_name, face_index, x, y, enabled = true)
  1152.     bitmap = Cache.face(face_name)
  1153.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + 4, 96, 88)
  1154.     contents.blt(x, y + 4, bitmap, rect, enabled ? 255 : translucent_alpha)
  1155.   end
  1156. end