Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Pacman Advanced Creative (PAC) Engine - Main Menu 1.7
- # 25/7/2011
- # Type: Menu
- # Installation: Heavy arrays and hashes.
- # Level: Simple, Average, Difficult
- #
- #===============================================================================
- #
- # Description:
- # The PAC Main Menu is focused around simple customization. The layout of
- # configuration is similar to that of Main Menu Melody, but the menu itself and
- # the code used is much different. Nothing much has been done in terms of
- # display to the menu, the focus of the first version, 1.7, is to get the core
- # code out of the way so I can focus more on exotic displays in later versions.
- #
- #===============================================================================
- #
- # Instructions:
- # INSTALLATION
- # Paste above main, below materials. It's not very difficult, even an XP
- # user could do it.
- # CONFIGURATION
- # There are detailed instructions for the configuration beginning at line 39.
- # Follow them closely, they shall lead you to your dream menu.
- #
- #===============================================================================
- #
- # CONFIGURATION BEGINS AT LINE 39
- #
- #===============================================================================
- module PAC
- module MM
- #===============================================================================
- #
- # BEGIN CONFIGURATION
- #
- #===============================================================================
- # This array holds the commands in the menu, in order. Any command listed
- # here MUST have an iteration in the other hashes. Syntax:
- # ITEMS = [
- # 'Command Name',
- # ]
- ITEMS = [
- 'Item',
- 'Skill',
- 'Equip',
- 'Status',
- 'Party',
- 'Save',
- 'End Game',
- ]
- # This hash determines what to do when the specified command is selected.
- # The syntax:
- # COMMAND = {
- # 'Command Name' => 'command',
- # }
- COMMAND = {
- 'Item' => '$scene = Scene_Item.new',
- 'Skill' => '$scene = Scene_Skill.new(@status_window.index)',
- 'Equip' => '$scene = Scene_Equip.new(@status_window.index)',
- 'Status' => '$scene = Scene_Status.new(@status_window.index)',
- 'Party' => '$scene = Scene_Party.new(false, true)',
- 'Save' => '$scene = Scene_File.new(true, false, false)',
- 'End Game' => '$scene = Scene_End.new',
- }
- # This hash determines the requirements needed to be met for the item to
- # be disabled. The syntax:
- # DISABLES = {
- # 'Command Name' => 'condition',
- # }
- DISABLES = {
- # Disables the save menu if needed.
- 'Save' => '$game_system.save_disabled',
- # Disables the party menu if needed.
- 'Party' => '$game_party.party_menu_disabled or
- $game_party.members.size == 0',
- }
- # Use icons in the main menu command window? (true/false)
- USE_ICONS = true
- # This hash decides which icons are used for each menu option. If you want
- # a command to have no icon, use nil. Syntax:
- # ICONS = {
- # 'Command Name' => Icon_ID',
- # }
- ICONS = {
- 'Item' => 144,
- 'Skill' => 137,
- 'Equip' => 1,
- 'Status' => 130,
- 'Party' => 96,
- 'Save' => 200,
- 'End Game' => 224,
- }
- #===============================================================================
- #
- # END CONFIGURATION
- #
- #===============================================================================
- end
- end
- $imported = {} if $imported == nil
- $imported["PAC_Menu 1.7"] = true
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system-related data. Also manages vehicles and BGM, etc.
- # The instance of this class is referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :menu_index
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_mm_initialize initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- pac_mm_initialize
- @menu_index = 0
- end
- end
- #==============================================================================
- # ** Window_MenuCommand
- #------------------------------------------------------------------------------
- # This window displays selectable commands on the menu screen.
- #==============================================================================
- class Window_MenuCommand < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
- if row_max == 0
- row_max = (commands.size + column_max - 1) / column_max
- end
- super(0, 0, width, row_max * WLH + 32, spacing)
- @commands = commands
- @item_max = commands.size
- @column_max = column_max
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- $game_system.menu_index = self.index
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- # index : Item number
- #--------------------------------------------------------------------------
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- if PAC::MM::ICONS[@commands[index]] != nil and PAC::MM::USE_ICONS
- draw_icon(PAC::MM::ICONS[@commands[index]], rect.x, rect.y)
- rect.x += 24
- end
- self.contents.draw_text(rect, @commands[index])
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs the menu screen processing.
- #==============================================================================
- class Scene_Menu < Scene_Base
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_mm_initialize initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(menu_index = $game_system.menu_index)
- pac_mm_initialize(menu_index)
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- commands = PAC::MM::ITEMS
- @command_window = Window_MenuCommand.new(160, commands)
- @command_window.index = @menu_index
- pac_mm_disable_commands
- end
- #--------------------------------------------------------------------------
- # * Disable Commands
- #--------------------------------------------------------------------------
- def pac_mm_disable_commands
- if $game_party.members.size == 0
- for i in 0...PAC::MM::ITEMS.size
- command = PAC::MM::ITEMS[i]
- if selection?(command)
- @command_window.draw_item(i, false)
- end
- end
- end
- for i in 0...PAC::MM::ITEMS.size
- command = PAC::MM::ITEMS[i]
- if PAC::MM::DISABLES.key?(command)
- @command_window.draw_item(i, false) if eval(PAC::MM::DISABLES[command])
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Require selection?
- #--------------------------------------------------------------------------
- def selection?(command)
- return PAC::MM::COMMAND[command].include?('@status_window.index')
- end
- #--------------------------------------------------------------------------
- # * Update Command Selection
- #--------------------------------------------------------------------------
- def update_command_selection
- $game_system.menu_index = @command_window.index
- selection = PAC::MM::ITEMS[@command_window.index]
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- if $game_party.members.size == 0 and selection?(selection)
- Sound.play_buzzer
- return
- elsif PAC::MM::DISABLES.key?(selection)
- if eval(PAC::MM::DISABLES[selection])
- Sound.play_buzzer
- return
- end
- end
- Sound.play_decision
- if selection?(selection)
- start_actor_selection
- else
- eval(PAC::MM::COMMAND[selection])
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Update Actor Selection
- #--------------------------------------------------------------------------
- def update_actor_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_actor_selection
- elsif Input.trigger?(Input::C)
- selection = PAC::MM::ITEMS[@command_window.index]
- $game_party.last_actor_index = @status_window.index
- Sound.play_decision
- eval(PAC::MM::COMMAND[selection])
- end
- end
- end
- #==============================================================================
- # ** Scene_Base
- #------------------------------------------------------------------------------
- # This is a superclass of all scenes in the game.
- #==============================================================================
- class Scene_Base
- #--------------------------------------------------------------------------
- # * Dispose of Background for Menu Screen
- #--------------------------------------------------------------------------
- def dispose_menu_background
- @menuback_sprite.dispose if @menuback_sprite != nil
- end
- end
- #==============================================================================
- # ** Scene_Item
- #------------------------------------------------------------------------------
- # This class performs the item screen processing.
- #==============================================================================
- class Scene_Item < Scene_Base
- #--------------------------------------------------------------------------
- # * Return to Original Screen
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Menu.new
- end
- end
- #==============================================================================
- # ** Scene_Skill
- #------------------------------------------------------------------------------
- # This class performs the skill screen processing.
- #==============================================================================
- class Scene_Skill < Scene_Base
- #--------------------------------------------------------------------------
- # * Return to Original Screen
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Menu.new
- end
- end
- #==============================================================================
- # ** Scene_Equip
- #------------------------------------------------------------------------------
- # This class performs the equipment screen processing.
- #==============================================================================
- class Scene_Equip < Scene_Base
- #--------------------------------------------------------------------------
- # * Return to Original Screen
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Menu.new
- end
- end
- #==============================================================================
- # ** Scene_Status
- #------------------------------------------------------------------------------
- # This class performs the status screen processing.
- #==============================================================================
- class Scene_Status < Scene_Base
- #--------------------------------------------------------------------------
- # * Return to Original Screen
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Menu.new
- end
- end
- #==============================================================================
- # ** Scene_File
- #------------------------------------------------------------------------------
- # This class performs the save and load screen processing.
- #==============================================================================
- class Scene_File < Scene_Base
- #--------------------------------------------------------------------------
- # * Return to Original Screen
- #--------------------------------------------------------------------------
- def return_scene
- if @from_title
- $scene = Scene_Title.new
- elsif @from_event
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new
- end
- end
- end
- #==============================================================================
- # ** Scene_End
- #------------------------------------------------------------------------------
- # This class performs game end screen processing.
- #==============================================================================
- class Scene_End < Scene_Base
- #--------------------------------------------------------------------------
- # * Return to Original Screen
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Menu.new
- end
- end
- #===============================================================================
- #
- # END OF SCRIPT
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement