Advertisement
AngryPacman

PAC Main Menu 1.7d

Aug 22nd, 2011
1,163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 41.46 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Pacman Advanced Creative (PAC) Engine - Main Menu 1.7d
  4. # 9/7/2012
  5. # Type: Menu
  6. # Installation: Heavy arrays and hashes, booleans and values.
  7. # Level: Difficult, Insane
  8. # Thanks: Cozziekuns, for the ring mode.
  9. #
  10. #===============================================================================
  11. #
  12. # Description:
  13. # So, here's the main menu. I'm sure you were looking for this. The setup is
  14. # now revolutionized; all the commands are done in one hash filled with arrays.
  15. # I'm pretty certain the configuration's going to stay like this.
  16. # With base code truly out of the way, I've begun working on aesthetic aspects
  17. # of the menu. So far, I've made two 'modes' for the menu, and Cozziekuns has
  18. # made 1.
  19. # Enjoy.
  20. #
  21. #===============================================================================
  22. #
  23. # Instructions:
  24. # INSTALLATION
  25. # Paste above main, below materials. It's not very difficult, even an XP
  26. # user could do it.
  27. # CONFIGURATION
  28. # There are detailed instructions for the configuration beginning at line 44.
  29. # Follow them closely, they shall lead you to your dream menu.
  30. #
  31. #===============================================================================
  32. #
  33. # CONFIGURATION BEGINS AT LINE 44
  34. #
  35. #==============================================================================
  36.  
  37. ($pac ||= {})["Main Menu"] = [1.7, :d]
  38.  
  39. module PAC
  40.   module MM
  41.  
  42. #==============================================================================
  43. #
  44. # BEGIN CONFIGURATION
  45. #
  46. #==============================================================================
  47.  
  48.     #--------------------------------------------------------------------------
  49.     # Use icons in the main menu? (true / false)
  50.     #--------------------------------------------------------------------------
  51.    
  52.     USE_ICONS = true
  53.    
  54.     #--------------------------------------------------------------------------
  55.     # Setup for commands in the menu. Each entry must be an array ([]), ended
  56.     # with a comma and begin with a number (the place where it is in the menu.
  57.     # The indexes start at 0, so make sure you have a 0 command.
  58.     # Syntax:
  59.     # COMMANDS = {
  60.     #   INDEX (number) => [
  61.     #     'Command Name',
  62.     #     'Command action',
  63.     #     IconID,
  64.     #     'Disable action', (optional)
  65.     #   ],
  66.     # }
  67.     # Command action should be left as is unless you know what you are doing.
  68.     # For example, if you are implementing a custom scene into this menu, you
  69.     # have to know the name of the scene and the arguments required. Disable
  70.     # action is code that will be evaluated; if it returns true then the command
  71.     # will not be allowed. Command Name, Command action and Disable action
  72.     # must all be string, i.e. in quotation marks ''. If you do not want a
  73.     # disable action, either do not enter one or enter it as nil.
  74.     # Note that for the command action, if the scene requires actor selection,
  75.     # place an @status_window.index in the paranthesis. It will trigger actor
  76.     # selection upon pressing the command.
  77.     # If you do not want to use an icon for a particular index, enter that
  78.     # entry as nil.
  79.     #--------------------------------------------------------------------------
  80.    
  81.     #--------------------------------------------------------------------------
  82.     COMMANDS = {  # Do not touch this!
  83.     #--------------------------------------------------------------------------
  84.       0 => [  # Do not touch this!
  85.         #----------------------------------------------------------------------
  86.         # Entry for command 1 (index 0)
  87.         #----------------------------------------------------------------------
  88.         'Inventory',                # Name
  89.         '$scene = Scene_Item.new',  # Command
  90.         144,                        # Icon
  91.         nil                         # Disable
  92.       #------------------------------------------------------------------------
  93.       ],  # Do not touch this!
  94.       #------------------------------------------------------------------------
  95.       1 => [  # Do not touch this!
  96.         #----------------------------------------------------------------------
  97.         # Entry for command 2 (index 1)
  98.         #----------------------------------------------------------------------
  99.         'Skills',                                           # Name
  100.         '$scene = Scene_Skill.new(@status_window.index)',   # Command
  101.         137,                                                # Icon
  102.                                                             # No disable needed.
  103.       #------------------------------------------------------------------------
  104.       ],  # Do not touch this!
  105.       #------------------------------------------------------------------------
  106.       2 => [  # Do not touch this!
  107.         #----------------------------------------------------------------------
  108.         # Entry for command 3 (index 2)
  109.         #----------------------------------------------------------------------
  110.         'Equip',                                          # Name
  111.         '$scene = Scene_Equip.new(@status_window.index)', # Command
  112.         1,                                                # Icon        
  113.       #------------------------------------------------------------------------
  114.       ],  # Do not touch this!
  115.       #------------------------------------------------------------------------
  116.       3 => [
  117.         'Status',
  118.         '$scene = Scene_Status.new(@status_window.index)',
  119.         130,
  120.       ],
  121.       4 => [
  122.         'Party',
  123.         '$scene = Scene_Party.new(false, true)',
  124.         rand(224)
  125.       ],
  126.       5 => [
  127.         'Save',
  128.         '$scene = Scene_File.new(true, false, false)',
  129.         200,
  130.         '$game_system.save_disabled',
  131.       ],
  132.       6 => [
  133.         'End Game',
  134.         '$scene = Scene_End.new',
  135.         224,
  136.       ],
  137.      
  138.     #--------------------------------------------------------------------------
  139.     } # Do not touch this!
  140.     #--------------------------------------------------------------------------
  141.    
  142.     # Button used to completely recover the party in the menu. This is only
  143.     # operational when the $TEST variable is true, so you'll only be able to
  144.     # do it in debug mode.
  145.    
  146.     HEAL_BUTTON = Input::F5
  147.    
  148.     # Mode of graphics used for the menu. Usable:
  149.     # :compact, :comprehensive, :ring
  150.     # If you use the :ring option, make sure you credit Cozziekuns.
  151.     # If you do not want to use this, set it to nil.
  152.    
  153.     WINDOW_MODE = :compact
  154.     #--------------------------------------------------------------------------
  155.     # THESE OPTIONS ARE FOR THE COMPACT OPTION
  156.     #--------------------------------------------------------------------------
  157.       # Pixels per frame the windows move (number)
  158.       COMPACT_SCROLL_SPEED = 4
  159.       # Direction the command window will move to when actor selection begins
  160.       # (:left / :right)
  161.       COMPACT_SELECTION = :right
  162.       # Button to toggle gold window visibility (Input::Button)
  163.       COMPACT_GOLD_BUTTON = Input::L
  164.       # Start scene with gold window visible? (true / false)
  165.       COMPACT_GOLD_WINDOW = true
  166.     #--------------------------------------------------------------------------
  167.     # THESE OPTIONS ARE FOR THE COMPREHENSIVE OPTION
  168.     #--------------------------------------------------------------------------
  169.       # Text displayed on the EXP gauge (string)
  170.       EXP_STRING = "E"
  171.     #--------------------------------------------------------------------------
  172.     module RING
  173.     #--------------------------------------------------------------------------
  174.     # THESE OPTIONS ARE FOR THE RING OPTION
  175.     #--------------------------------------------------------------------------
  176.       # Size of the ring menu (radius)
  177.       MENU_RADIUS = 128
  178.       # How many frames the menu takes while spinning. Higher = slower.
  179.       MENU_SPEED = 16
  180.       # Origin of text in the menu. (:top / :center)
  181.       MENU_TEXT_ORIGIN = :center
  182.       # Button to toggle gold window visibility (Input::Button)
  183.       MENU_GOLD_BUTTON = Input::L
  184.       # Start scene with gold window visible? (true / false)
  185.       MENU_GOLD_WINDOW = true
  186.     end
  187.  
  188. #===============================================================================
  189. #
  190. # END CONFIGURATION
  191. #
  192. #===============================================================================
  193.  
  194.   end
  195. end
  196.  
  197. #==============================================================================
  198. # *** Math
  199. #------------------------------------------------------------------------------
  200. #  A module that supports floating point calculations.
  201. #==============================================================================
  202.  
  203. if PAC::MM::WINDOW_MODE == :ring
  204.  
  205. module Math
  206.   #--------------------------------------------------------------------------
  207.   # * Sind
  208.   #--------------------------------------------------------------------------
  209.   def self.sind(value)
  210.     return self.sin(value * PI / 180)
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # * Cosd
  214.   #--------------------------------------------------------------------------
  215.   def self.cosd(value)
  216.     return self.cos(value * PI / 180)
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # * Tand
  220.   #--------------------------------------------------------------------------
  221.   def self.tand(value)
  222.     return self.tan(value * PI / 180)
  223.   end
  224. end
  225.  
  226. end
  227.  
  228. #==============================================================================
  229. # ** Game_System
  230. #------------------------------------------------------------------------------
  231. #  This class handles system-related data. Also manages vehicles and BGM, etc.
  232. # The instance of this class is referenced by $game_system.
  233. #==============================================================================
  234.  
  235. class Game_System
  236.   #--------------------------------------------------------------------------
  237.   # Public Instance Variables
  238.   #--------------------------------------------------------------------------
  239.   attr_accessor :menu_index
  240.   attr_accessor :menu_actor_selection
  241.   #--------------------------------------------------------------------------
  242.   # Alias listing
  243.   #--------------------------------------------------------------------------
  244.   alias pac_menu_initialize initialize
  245.   #--------------------------------------------------------------------------
  246.   # * Object Initialization
  247.   #--------------------------------------------------------------------------
  248.   def initialize
  249.     pac_menu_initialize
  250.     @menu_index = 0
  251.     @menu_actor_selection = false
  252.   end
  253. end
  254.  
  255. #==============================================================================
  256. # ** Game_Actor
  257. #------------------------------------------------------------------------------
  258. #  This class handles actors. It's used within the Game_Actors class
  259. # ($game_actors) and referenced by the Game_Party class ($game_party).
  260. #==============================================================================
  261.  
  262. class Game_Actor < Game_Battler
  263.   #--------------------------------------------------------------------------
  264.   # * Get current exp
  265.   #--------------------------------------------------------------------------
  266.   def current_exp
  267.     return @exp - @exp_list[@level]
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # * Get required exp for next level
  271.   #--------------------------------------------------------------------------
  272.   def required_exp
  273.     return @exp_list[@level + 1] > 0 ? @exp_list[@level + 1] -
  274.      @exp_list[@level] : 0
  275.   end
  276. end
  277.  
  278. #==============================================================================
  279. # ** Game_Map
  280. #------------------------------------------------------------------------------
  281. #  This class handles maps. It includes scrolling and passage determination
  282. # functions. The instance of this class is referenced by $game_map.
  283. #==============================================================================
  284.  
  285. class Game_Map
  286.   #--------------------------------------------------------------------------
  287.   # * Get map's name
  288.   #--------------------------------------------------------------------------
  289.   def map_name
  290.     m = load_data("Data/MapInfos.rvdata")
  291.     return m[@map_id].name
  292.   end
  293. end
  294.  
  295. #==============================================================================
  296. # ** Window_Base
  297. #------------------------------------------------------------------------------
  298. #  This is a superclass of all windows in the game.
  299. #==============================================================================
  300.  
  301. class Window_Base < Window
  302.   #--------------------------------------------------------------------------
  303.   # * Draw Actor's Level
  304.   #--------------------------------------------------------------------------
  305.   def draw_menu_actor_level(actor, x, y)
  306.     self.contents.font.color = system_color
  307.     self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
  308.     self.contents.font.color = normal_color
  309.     self.contents.draw_text(x + 16, y, 24, WLH, actor.level, 2)
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # * Draw Actor's Class
  313.   #--------------------------------------------------------------------------
  314.   def draw_menu_actor_class(actor, x, y)
  315.     self.contents.font.color = normal_color
  316.     self.contents.draw_text(x, y, 85, WLH, actor.class.name)
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # * Colour 1 for exp gauge
  320.   #--------------------------------------------------------------------------
  321.   def exp_gauge_color1
  322.     return text_color(30)
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # * Colour 2 for exp gauge
  326.   #--------------------------------------------------------------------------
  327.   def exp_gauge_color2
  328.     return text_color(31)
  329.   end
  330.   #--------------------------------------------------------------------------
  331.   # * Create exp gauge
  332.   #--------------------------------------------------------------------------
  333.   def draw_exp_meter(actor, x, y, width = 100)
  334.     exp = actor.required_exp != 0 ? actor.current_exp : 1
  335.     gw = width * exp / [actor.required_exp, 1].max
  336.     gc1, gc2 = exp_gauge_color1, exp_gauge_color2
  337.     self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  338.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  339.     self.contents.font.color = system_color
  340.     self.contents.draw_text(x, y, 30, WLH, "Exp")
  341.     self.contents.font.color = normal_color
  342.     gx = x + width
  343.     self.contents.draw_text(gx - 60, y, 60, WLH, actor.next_rest_exp_s, 2)
  344.   end
  345. end
  346.  
  347. #==============================================================================
  348. # ** Window_MapName
  349. #------------------------------------------------------------------------------
  350. #  This window displays the map name on the menu screen.
  351. #==============================================================================
  352.  
  353. class Window_MapName < Window_Base
  354.   #--------------------------------------------------------------------------
  355.   # * Object Initialization
  356.   #--------------------------------------------------------------------------
  357.   def initialize(x, y)
  358.     super(x, y, 160, WLH * 3)
  359.     refresh
  360.   end
  361.   #--------------------------------------------------------------------------
  362.   # * Refresh
  363.   #--------------------------------------------------------------------------
  364.   def refresh
  365.     self.contents.clear
  366.     self.contents.font.color = normal_color
  367.     text = $game_map.map_name.to_s
  368.     self.contents.draw_text(0, 0, 120, self.height / 2, text, 1)
  369.   end
  370. end
  371.  
  372. #==============================================================================
  373. # ** Window_Time
  374. #------------------------------------------------------------------------------
  375. #  This window displays playtime on the menu screen.
  376. #==============================================================================
  377.  
  378. class Window_Time < Window_Base
  379.   #--------------------------------------------------------------------------
  380.   # * Object Initialization
  381.   #--------------------------------------------------------------------------
  382.   def initialize(x, y)
  383.     super(x, y, 160, WLH * 3)
  384.     refresh
  385.   end
  386.   #--------------------------------------------------------------------------
  387.   # * Refresh
  388.   #--------------------------------------------------------------------------
  389.   def refresh
  390.     self.contents.clear
  391.     @time = Graphics.frame_count / Graphics.frame_rate
  392.     hour = @time / 60 / 60
  393.     min = @time / 60 % 60
  394.     sec = @time % 60
  395.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  396.     self.contents.font.color = normal_color
  397.     self.contents.draw_text(0, 0, 120, self.height / 2, text, 1)
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # * Frame Update
  401.   #--------------------------------------------------------------------------
  402.   def update
  403.     super
  404.     if Graphics.frame_count / Graphics.frame_rate != @time
  405.       refresh
  406.     end
  407.   end
  408. end
  409.  
  410. #==============================================================================
  411. # ** Window_MenuStatus
  412. #------------------------------------------------------------------------------
  413. #  This window displays party member status on the menu screen.
  414. #==============================================================================
  415.  
  416. class Window_MenuStatus < Window_Selectable
  417.   #--------------------------------------------------------------------------
  418.   # RING MODE
  419.   #--------------------------------------------------------------------------
  420.   if PAC::MM::WINDOW_MODE == :ring
  421.   #--------------------------------------------------------------------------
  422.   # Alias listing
  423.   #--------------------------------------------------------------------------
  424.   alias coz_pac_mm_wms_initialize initialize
  425.   alias coz_pac_mm_wms_update update
  426.   #--------------------------------------------------------------------------
  427.   # * Object Initialization
  428.   #--------------------------------------------------------------------------
  429.   def initialize(*args)
  430.     coz_pac_mm_wms_initialize(*args)
  431.     self.visible = self.active
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # * Frame Update
  435.   #--------------------------------------------------------------------------
  436.   def update(*args)
  437.     coz_pac_mm_wms_update(*args)
  438.     self.visible = self.active
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # END RING MODE
  442.   #--------------------------------------------------------------------------
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # * Refresh
  446.   #--------------------------------------------------------------------------
  447.   def refresh
  448.     self.contents.clear
  449.     @item_max = $game_party.members.size
  450.     for actor in $game_party.members
  451.       draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
  452.       x = 104; y = actor.index * 96 + WLH / 2
  453.       draw_actor_name(actor, x, y)
  454.       draw_menu_actor_class(actor, x + 120, y)
  455.       draw_menu_actor_level(actor, x + 200, y)
  456.       draw_actor_state(actor, x, y + WLH * 2)
  457.       draw_actor_hp(actor, x + 120, y + WLH * 1)
  458.       draw_actor_mp(actor, x + 120, y + WLH * 2)
  459.       draw_exp_meter(actor, x, y + WLH * 1)
  460.     end
  461.   end
  462. end
  463.  
  464. #==============================================================================
  465. # ** Window_MenuCommand
  466. #------------------------------------------------------------------------------
  467. #  This window displays selectable commands on the menu screen.
  468. #==============================================================================
  469.  
  470. class Window_MenuCommand < Window_Selectable
  471.   #--------------------------------------------------------------------------
  472.   # * Object Initialization
  473.   #     width      : window width
  474.   #     commands   : command string array
  475.   #     column_max : digit count (if 2 or more, horizontal selection)
  476.   #     row_max    : row count (0: match command count)
  477.   #     spacing    : blank space when items are arrange horizontally
  478.   #--------------------------------------------------------------------------
  479.   def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
  480.     if row_max == 0
  481.       row_max = (commands.size + column_max - 1) / column_max
  482.     end
  483.     super(0, 0, width, row_max * WLH + 32, spacing)
  484.     @commands = commands
  485.     @item_max = commands.size
  486.     @column_max = column_max
  487.     refresh
  488.     self.index = 0
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # * Refresh
  492.   #--------------------------------------------------------------------------
  493.   def refresh
  494.     self.contents.clear
  495.     for i in 0...@item_max
  496.       draw_item(i)
  497.     end
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   # * Draw Item
  501.   #     index   : item number
  502.   #     enabled : enabled flag. When false, draw semi-transparently.
  503.   #--------------------------------------------------------------------------
  504.   def draw_item(index, enabled = true)
  505.     rect = item_rect(index)
  506.     rect.x += 4
  507.     rect.width -= 8
  508.     self.contents.clear_rect(rect)
  509.     self.contents.font.color = normal_color
  510.     self.contents.font.color.alpha = enabled ? 255 : 128
  511.     if PAC::MM::COMMANDS[index][2] != nil and PAC::MM::USE_ICONS
  512.       draw_icon(PAC::MM::COMMANDS[index][2], rect.x, rect.y)
  513.       rect.x += 24
  514.     end
  515.     self.contents.draw_text(rect, PAC::MM::COMMANDS[index][0])
  516.   end
  517. end
  518.  
  519. #==============================================================================
  520. # ** Window_RingMenu
  521. #------------------------------------------------------------------------------
  522. #  This window displays the ring menu.
  523. #==============================================================================
  524.  
  525. if PAC::MM::WINDOW_MODE == :ring
  526.  
  527. class Window_RingMenu < Window_Base
  528.   #--------------------------------------------------------------------------
  529.   # Public Instance Variables
  530.   #--------------------------------------------------------------------------
  531.   attr_reader :index
  532.   #--------------------------------------------------------------------------
  533.   # * Object Initialization
  534.   #--------------------------------------------------------------------------
  535.   def initialize(commands)
  536.     super(0, 0, Graphics.width, Graphics.height)
  537.     @commands = commands
  538.     @item_max = commands.size
  539.     self.opacity = 0
  540.     self.index = 0
  541.     @angle = 0
  542.     @radius = PAC::MM::RING::MENU_RADIUS
  543.     refresh
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # * Set index
  547.   #--------------------------------------------------------------------------
  548.   def index=(n)
  549.     @index = n
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # * Refresh
  553.   #--------------------------------------------------------------------------
  554.   def refresh
  555.     self.contents.clear
  556.     for i in 0...@item_max
  557.       draw_item(i)
  558.     end
  559.   end
  560.   #--------------------------------------------------------------------------
  561.   # * Angle Size
  562.   #--------------------------------------------------------------------------
  563.   def angle_size
  564.     return 360 / @item_max
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # * Draw Item
  568.   #     index   : item number
  569.   #     enabled : enabled flag. When false, draw semi-transparently.
  570.   #--------------------------------------------------------------------------
  571.   def draw_item(index, enabled = true)
  572.     radius = @radius
  573.     n = (index - @index) * angle_size + @angle
  574.     cx = radius * Math.sind(n) + Graphics.width / 2
  575.     cy = -radius * Math.cosd(n) + Graphics.height / 2
  576.     if PAC::MM::COMMANDS[index][2] != nil and PAC::MM::USE_ICONS
  577.       draw_icon(PAC::MM::COMMANDS[index][2], cx - 12, cy - 12, (n == 0 and
  578.        enabled))
  579.     end
  580.     if n == 0
  581.       self.contents.font.color.alpha = enabled ? 255 : 128
  582.       case PAC::MM::RING::MENU_TEXT_ORIGIN
  583.       when :top
  584.         self.contents.draw_text(cx - 80, cy - 48, 160, WLH,
  585.          PAC::MM::COMMANDS[index][0], 1)
  586.       when :center
  587.         self.contents.draw_text(Graphics.width / 2 - 80, Graphics.height / 2 -
  588.          WLH, 160, WLH, PAC::MM::COMMANDS[index][0], 1)
  589.       end
  590.     end
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # * Spin Update
  594.   #--------------------------------------------------------------------------
  595.   def update_spin(reverse = false)
  596.     speed = PAC::MM::RING::MENU_SPEED
  597.     @angle += (reverse ? -angle_size : angle_size) / speed.to_f
  598.     Graphics.update
  599.     refresh
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # * Frame Update
  603.   #--------------------------------------------------------------------------
  604.   def update
  605.     super
  606.     update_index
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # * Index Update
  610.   #--------------------------------------------------------------------------
  611.   def update_index
  612.     if Input.trigger?(Input::LEFT)
  613.       Sound.play_cursor
  614.       while @angle.round < angle_size
  615.         update_spin
  616.       end
  617.       @index -= 1
  618.       @index %= @item_max
  619.       @angle = 0
  620.       refresh
  621.     elsif Input.trigger?(Input::RIGHT)
  622.       Sound.play_cursor
  623.       while @angle.round > -angle_size
  624.         update_spin(true)
  625.       end
  626.       @index += 1
  627.       @index %= @item_max
  628.       @angle = 0
  629.       refresh
  630.     end
  631.   end
  632. end
  633. end
  634.  
  635. #==============================================================================
  636. # ** Scene_Menu
  637. #------------------------------------------------------------------------------
  638. #  This class performs the menu screen processing.
  639. #==============================================================================
  640.  
  641. class Scene_Menu < Scene_Base
  642.   #--------------------------------------------------------------------------
  643.   # Include Configuration Data
  644.   #--------------------------------------------------------------------------
  645.   include PAC::MM
  646.   #--------------------------------------------------------------------------
  647.   # Alias listing
  648.   #--------------------------------------------------------------------------
  649.   alias pac_menu_initialize initialize
  650.   alias pac_menu_start start
  651.   #--------------------------------------------------------------------------
  652.   # * Object Initialization
  653.   #     menu_index : command cursor's initial position
  654.   #--------------------------------------------------------------------------
  655.   def initialize(menu_index = $game_system.menu_index)
  656.     pac_menu_initialize(menu_index)
  657.     @selection = $game_system.menu_actor_selection
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # * Start Processing
  661.   #--------------------------------------------------------------------------
  662.   def start
  663.     pac_menu_start
  664.     pac_compact_windows if WINDOW_MODE == :compact
  665.     if @selection && WINDOW_MODE == :compact
  666.       pac_compact_quick_actor_selection
  667.     elsif @selection
  668.       start_actor_selection
  669.     end
  670.   end
  671.   #--------------------------------------------------------------------------
  672.   # * Create Command Window
  673.   #--------------------------------------------------------------------------
  674.   def create_command_window
  675.     commands = COMMANDS
  676.     @command_window = Window_MenuCommand.new(160, commands)
  677.     @command_window.index = @menu_index
  678.     pac_menu_disable_commands
  679.   end
  680.   #--------------------------------------------------------------------------
  681.   # * Disable Menu Commands
  682.   #--------------------------------------------------------------------------
  683.   def pac_menu_disable_commands
  684.     if $game_party.members.size == 0
  685.       for i in 0...COMMANDS.size
  686.         if selection?(i)
  687.           @command_window.draw_item(i, false)
  688.         end
  689.       end
  690.     end
  691.     for i in 0...COMMANDS.size
  692.       unless COMMANDS[i][3].nil?
  693.         if eval(COMMANDS[i][3])
  694.           @command_window.draw_item(i, false)
  695.         end
  696.       end
  697.     end
  698.   end
  699.   #--------------------------------------------------------------------------
  700.   # * Require Selection?
  701.   #     command : command to be determined whether or not to have selection
  702.   #--------------------------------------------------------------------------
  703.   def selection?(command)
  704.     return COMMANDS[command][1].include?('@status_window.index')
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # * Update Command Selection
  708.   #--------------------------------------------------------------------------
  709.   def update_command_selection
  710.     $game_system.menu_index = @command_window.index
  711.     selection = @command_window.index
  712.     if Input.trigger?(Input::B)
  713.       Sound.play_cancel
  714.       $scene = Scene_Map.new
  715.     elsif $TEST and Input.trigger?(HEAL_BUTTON)
  716.       Sound.play_recovery
  717.       for member in $game_party.members
  718.         member.recover_all
  719.       end
  720.       @status_window.refresh
  721.     elsif Input.trigger?(Input::C)
  722.       if $game_party.members.size == 0 and selection?(selection)
  723.         Sound.play_buzzer
  724.         return
  725.       elsif !COMMANDS[selection][3].nil?
  726.         if eval(COMMANDS[selection][3])
  727.           Sound.play_buzzer
  728.           return
  729.         end
  730.       end
  731.       Sound.play_decision
  732.       if selection?(selection)
  733.         start_actor_selection
  734.       else
  735.         $game_system.menu_actor_selection = false
  736.         eval(COMMANDS[selection][1])
  737.       end
  738.     end
  739.   end
  740.   #--------------------------------------------------------------------------
  741.   # * Update Actor Selection
  742.   #--------------------------------------------------------------------------
  743.   def update_actor_selection
  744.     if Input.trigger?(Input::B)
  745.       Sound.play_cancel
  746.       end_actor_selection
  747.     elsif Input.trigger?(Input::C)
  748.       selection = @command_window.index
  749.       $game_party.last_actor_index = @status_window.index
  750.       Sound.play_decision
  751.       $game_system.menu_actor_selection = true
  752.       eval(COMMANDS[selection][1])
  753.     end
  754.   end
  755. #===============================================================================
  756. # COMPACT MODE
  757. #===============================================================================
  758.   if WINDOW_MODE == :compact
  759.   $pac["Compact Menu"] = true
  760.   #--------------------------------------------------------------------------
  761.   # Alias listing
  762.   #--------------------------------------------------------------------------
  763.   alias pac_compact_start start
  764.   alias pac_compact_start_actor_selection start_actor_selection
  765.   alias pac_compact_end_actor_selection end_actor_selection
  766.   alias pac_compact_update update
  767.   #--------------------------------------------------------------------------
  768.   # * Make Windows Compact
  769.   #--------------------------------------------------------------------------
  770.   def pac_compact_windows
  771.     @command_window.x = Graphics.width / 2 - @command_window.width / 2
  772.     @gold_window.visible = COMPACT_GOLD_WINDOW
  773.     @gold_window.x = @command_window.x
  774.     @gold_window.openness = COMPACT_GOLD_WINDOW ? 255 : 0
  775.     @status_window.x = case COMPACT_SELECTION
  776.     when :left then Graphics.width - @status_window.width
  777.     when :right then 0
  778.     end
  779.     @status_window.visible = false
  780.     @status_window.openness = 0
  781.     if @gold_window.visible
  782.       @command_window.y = Graphics.height / 2 - (@command_window.height +
  783.       @gold_window.height) / 2
  784.     else
  785.       @command_window.y = Graphics.height / 2 - @command_window.height / 2
  786.     end
  787.     @gold_window.y = @command_window.y + @command_window.height
  788.     @check_x = @command_window.x
  789.   end
  790.   #--------------------------------------------------------------------------
  791.   # * Quick Actor Selection
  792.   #--------------------------------------------------------------------------
  793.   def pac_compact_quick_actor_selection
  794.     @status_window.visible = true
  795.     @command_window.x = COMPACT_SELECTION == :left ? 0 : Graphics.width -
  796.      @command_window.width
  797.     @gold_window.x = @command_window.x
  798.     @status_window.open
  799.     begin
  800.       @status_window.update
  801.       Graphics.update
  802.     end until @status_window.openness == 255
  803.     pac_compact_start_actor_selection
  804.   end
  805.   #--------------------------------------------------------------------------
  806.   # * Start Actor Selection
  807.   #--------------------------------------------------------------------------
  808.   def start_actor_selection
  809.     @status_window.visible = true
  810.     check = case COMPACT_SELECTION
  811.     when :left then 0
  812.     when :right then Graphics.width - @command_window.width
  813.     end
  814.     begin
  815.       @command_window.x -= case COMPACT_SELECTION
  816.       when :left then COMPACT_SCROLL_SPEED
  817.       when :right then -COMPACT_SCROLL_SPEED
  818.       end
  819.       @gold_window.x = @command_window.x
  820.       Graphics.update
  821.     end until @command_window.x == check
  822.     @status_window.open
  823.     begin
  824.       @status_window.update
  825.       Graphics.update
  826.     end until @status_window.openness == 255
  827.     pac_compact_start_actor_selection
  828.   end
  829.   #--------------------------------------------------------------------------
  830.   # * End Actor Selection
  831.   #--------------------------------------------------------------------------
  832.   def end_actor_selection
  833.     pac_compact_end_actor_selection
  834.     @status_window.close
  835.     begin
  836.       @status_window.update
  837.       Graphics.update
  838.     end until @status_window.openness == 0
  839.     @status_window.visible = false
  840.     begin
  841.       unless @command_window.x == @check_x
  842.         @command_window.x += case COMPACT_SELECTION
  843.         when :left then COMPACT_SCROLL_SPEED
  844.         when :right then -COMPACT_SCROLL_SPEED
  845.         end
  846.       end
  847.       @gold_window.x = @command_window.x
  848.       Graphics.update
  849.     end until @command_window.x == @check_x
  850.   end
  851.   #--------------------------------------------------------------------------
  852.   # * Frame Update
  853.   #--------------------------------------------------------------------------
  854.   def update
  855.     pac_compact_update
  856.     update_gold_visible
  857.   end
  858.   #--------------------------------------------------------------------------
  859.   # * Update Visibility of Gold Window (and scroll to cater)
  860.   #--------------------------------------------------------------------------
  861.   def update_gold_visible
  862.     @gold_window.x = @command_window.x if @gold_window.x != @command_window.x
  863.     if Input.trigger?(COMPACT_GOLD_BUTTON)
  864.       Sound.play_decision
  865.       if @gold_window.visible
  866.         @gold_window.close
  867.         begin
  868.           @gold_window.update
  869.           Graphics.update
  870.         end until @gold_window.openness == 0
  871.         @gold_window.visible = false
  872.         begin
  873.           @command_window.y += COMPACT_SCROLL_SPEED
  874.           @command_window.update
  875.           Graphics.update
  876.         end until @command_window.y == Graphics.height / 2 -
  877.          @command_window.height / 2
  878.        else
  879.         begin
  880.           @command_window.y -= COMPACT_SCROLL_SPEED
  881.           @command_window.update
  882.           Graphics.update
  883.         end until @command_window.y == Graphics.height / 2 -
  884.          (@command_window.height + @gold_window.height) / 2
  885.         @gold_window.visible = true
  886.         @gold_window.open
  887.         begin
  888.           @gold_window.update
  889.           Graphics.update
  890.         end until @gold_window.openness == 255
  891.       end
  892.     end
  893.   end
  894. #===============================================================================
  895. # END COMPACT MODE
  896. #===============================================================================
  897.   end
  898. #===============================================================================
  899. # COMPREHENSIVE MODE
  900. #===============================================================================
  901.   if WINDOW_MODE == :comprehensive
  902.   $pac["Comprehensive Menu"] = true
  903.   #--------------------------------------------------------------------------
  904.   # Alias listing
  905.   #--------------------------------------------------------------------------
  906.   alias pac_comprehensive_start start
  907.   alias pac_comprehensive_terminate terminate
  908.   alias pac_comprehensive_update update
  909.   #--------------------------------------------------------------------------
  910.   # * Start Processing
  911.   #--------------------------------------------------------------------------
  912.   def start
  913.     pac_comprehensive_start
  914.     @location_window = Window_MapName.new(0, @command_window.height)
  915.     @time_window = Window_Time.new(0, @location_window.y +
  916.      @location_window.height)
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # * Termination Processing
  920.   #--------------------------------------------------------------------------
  921.   def terminate
  922.     pac_comprehensive_terminate
  923.     @location_window.dispose
  924.     @time_window.dispose
  925.   end
  926.   #--------------------------------------------------------------------------
  927.   # * Frame Update
  928.   #--------------------------------------------------------------------------
  929.   def update
  930.     pac_comprehensive_update
  931.     @location_window.update
  932.     @time_window.update
  933.   end
  934. #===============================================================================
  935. # END COMPREHENSIVE MODE
  936. #===============================================================================
  937.   end
  938. #===============================================================================
  939. # RING MODE
  940. #===============================================================================
  941.   if WINDOW_MODE == :ring
  942.   $pac["Ring Menu"] = true
  943.   #--------------------------------------------------------------------------
  944.   # Include configuration data
  945.   #--------------------------------------------------------------------------
  946.   include RING
  947.   #--------------------------------------------------------------------------
  948.   # Alias listing
  949.   #--------------------------------------------------------------------------
  950.   alias coz_pac_mm_sm_start start
  951.   alias coz_pac_mm_sm_update update
  952.   #--------------------------------------------------------------------------
  953.   # * Start Processing
  954.   #--------------------------------------------------------------------------
  955.   def start(*args)
  956.     coz_pac_mm_sm_start(*args)
  957.     @gold_window.visible = MENU_GOLD_WINDOW
  958.     @gold_window.openness = MENU_GOLD_WINDOW ? 255 : 0
  959.   end
  960.   #--------------------------------------------------------------------------
  961.   # * Create Command Window
  962.   #--------------------------------------------------------------------------
  963.   def create_command_window
  964.     commands = COMMANDS
  965.     @command_window = Window_RingMenu.new(commands)
  966.     @command_window.index = @menu_index
  967.     @command_window.refresh
  968.     pac_menu_disable_commands
  969.   end
  970.   #--------------------------------------------------------------------------
  971.   # * Frame Update
  972.   #--------------------------------------------------------------------------
  973.   def update(*args)
  974.     coz_pac_mm_sm_update(*args)
  975.     update_gold_visible
  976.   end
  977.   #--------------------------------------------------------------------------
  978.   # * Update Visibility of Gold window
  979.   #--------------------------------------------------------------------------
  980.   def update_gold_visible
  981.     if Input.trigger?(MENU_GOLD_BUTTON)
  982.       Sound.play_decision
  983.       if @gold_window.visible
  984.         @gold_window.close
  985.         while @gold_window.openness != 0
  986.           @gold_window.update
  987.           Graphics.update
  988.         end
  989.         @gold_window.visible = false
  990.       else
  991.         @gold_window.visible = true
  992.         @gold_window.open
  993.         while @gold_window.openness != 255
  994.           @gold_window.update
  995.           Graphics.update
  996.         end
  997.       end
  998.     end
  999.   end
  1000.   end
  1001. #===============================================================================
  1002. # END RING MODE
  1003. #==============================================================================
  1004. end
  1005.  
  1006. #==============================================================================
  1007. # ** Scene_Base
  1008. #------------------------------------------------------------------------------
  1009. #  This is a superclass of all scenes in the game.
  1010. #==============================================================================
  1011.  
  1012. class Scene_Base
  1013.   #--------------------------------------------------------------------------
  1014.   # * Dispose of Background for Menu Screen
  1015.   #--------------------------------------------------------------------------
  1016.   def dispose_menu_background
  1017.     @menuback_sprite.dispose if @menuback_sprite != nil
  1018.   end
  1019. end
  1020.  
  1021. #==============================================================================
  1022. # Menu Index Fix
  1023. #==============================================================================
  1024.  
  1025. ["Item", "Skill", "Equip", "Status", "End"].each { |klass|
  1026.   fix_return_scene = %Q(class Scene_#{klass}; def return_scene
  1027.   $scene = Scene_Menu.new; end; end); eval(fix_return_scene)
  1028. }
  1029.  
  1030. #==============================================================================
  1031. # ** Scene_File
  1032. #------------------------------------------------------------------------------
  1033. #  This class performs the save and load screen processing.
  1034. #==============================================================================
  1035.  
  1036. class Scene_File < Scene_Base
  1037.   #--------------------------------------------------------------------------
  1038.   # * Return to Original Screen
  1039.   #--------------------------------------------------------------------------
  1040.   def return_scene
  1041.     if @from_title
  1042.       $scene = Scene_Title.new
  1043.     elsif @from_event
  1044.       $scene = Scene_Map.new
  1045.     else
  1046.       $scene = Scene_Menu.new
  1047.     end
  1048.   end
  1049. end
  1050.  
  1051. #===============================================================================
  1052. #
  1053. # END OF SCRIPT
  1054. #
  1055. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement