AngryPacman

[VXA] PAC MM Compact Addon

Jul 16th, 2012
1,020
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. #
  3. # PAC Main Menu Ace - Compact Display Addon (1.0)
  4. # 16/7/2012
  5. # By Pacman
  6. #
  7. #===============================================================================
  8. #
  9. # This is the Compact Display Addon for the PAC Main Menu Ace. This script
  10. # requires PAC Main Menu Ace to work. This is a graphical change to the menu,
  11. # "compacting" the menu screen to only display the status window when required.
  12. # The extra windows (the gold, map and playtime windows) can now by closed by
  13. # pressing a designated button.
  14. #
  15. #===============================================================================
  16. #------------------------------------
  17. module PAC; module MM; module Compact # <- Do not touch.
  18.   #----------------------------------
  19.   Use_Compact = true  # Use the compact menu?
  20.   Show_Extras = true  # Show the extra display windows when the menu opens?
  21.   Show_Button = :X    # Button used to open and close the extra windows.
  22.   Move_Speed = 10      # Number of pixels per second the windows move when
  23.                       # sliding.
  24. #------------------------------------
  25. end; end; end
  26. #------------------------------------
  27.  
  28. #===============================================================================
  29. #
  30. # END OF CONFIGURATION
  31. #
  32. #===============================================================================
  33.  
  34. if PAC::MM::Compact::Use_Compact
  35. if !($pac ||= {})[:main_menu] || $pac[:main_menu] < 1.2
  36.   msgbox "You require the PAC MM 1.2 base script to use the Compact Addon."
  37.   exit
  38. end
  39.  
  40. #==============================================================================
  41. # ** Game_System
  42. #------------------------------------------------------------------------------
  43. #  This class handles system data. It saves the disable state of saving and
  44. # menus. Instances of this class are referenced by $game_system.
  45. #==============================================================================
  46.  
  47. class Game_System
  48.   #--------------------------------------------------------------------------
  49.   # Public Instance Variables
  50.   #--------------------------------------------------------------------------
  51.   attr_accessor :menu_window_vis
  52.   #--------------------------------------------------------------------------
  53.   # Alias listing
  54.   #--------------------------------------------------------------------------
  55.   alias pac_mmc_initialize initialize
  56.   #--------------------------------------------------------------------------
  57.   # * Object Initialization
  58.   #--------------------------------------------------------------------------
  59.   def initialize(*args)
  60.     pac_mmc_initialize(*args)
  61.     @menu_window_vis = PAC::MM::Compact::Show_Extras
  62.   end
  63. end
  64.  
  65. #==============================================================================
  66. # ** Scene_Menu
  67. #------------------------------------------------------------------------------
  68. #  This class performs the menu screen processing.
  69. #==============================================================================
  70.  
  71. class Scene_Menu < Scene_MenuBase
  72.   #--------------------------------------------------------------------------
  73.   # Alias listing
  74.   #--------------------------------------------------------------------------
  75.   alias pac_mmc_start start
  76.   alias pac_mmc_comper command_personal
  77.   alias pac_mmc_comfor command_formation
  78.   alias pac_mmc_opc on_personal_cancel
  79.   alias pac_mmc_ofc on_formation_cancel
  80.   alias pac_mmc_update update
  81.   #--------------------------------------------------------------------------
  82.   # * Start Processing
  83.   #--------------------------------------------------------------------------
  84.   def start(*args)
  85.     #----------- Original Method
  86.     pac_mmc_start(*args)
  87.     #----------- Setup window visibility
  88.     if $game_system.menu_window_vis == false
  89.       @gold_window.openness = @time_window.openness = @map_window.openness = 0
  90.     end
  91.     #----------- Setup window coordinates (y)
  92.     @command_window.y = (Graphics.height - @command_window.height) / 2
  93.     @map_window.y = @command_window.height + @command_window.y
  94.     @gold_window.y = @map_window.y
  95.     @gold_window.y += @map_window.height if PAC::MM::Map_Window
  96.     @time_window.y = @command_window.y - @time_window.height
  97.     #----------- Setup window coordinates (x)
  98.     @windows = [@command_window, @gold_window, @time_window, @map_window]
  99.     unless @@start_personal
  100.       @status_window.hide
  101.       @status_window.openness = 0
  102.       @windows.each do |window| window.x = (Graphics.width -
  103.        @command_window.width) / 2 end
  104.     else
  105.       @windows.each do |window| window.x = PAC::MM::Windows_Pos == :right ?
  106.        Graphics.width - @command_window.width : 0 end
  107.     end
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # * [Skill], [Equipment] and [Status] Commands
  111.   #--------------------------------------------------------------------------
  112.   def command_personal(*args)
  113.     pac_mmc_open_status
  114.     pac_mmc_comper(*args)
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # * [Cancel] Personal Command
  118.   #--------------------------------------------------------------------------
  119.   def on_personal_cancel(*args)
  120.     pac_mmc_close_status
  121.     pac_mmc_opc(*args)
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # * [Formation] Command
  125.   #--------------------------------------------------------------------------
  126.   def command_formation(*args)
  127.     pac_mmc_open_status
  128.     pac_mmc_comfor(*args)
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # * Formation [Cancel]
  132.   #--------------------------------------------------------------------------
  133.   def on_formation_cancel(*args)
  134.     pac_mmc_close_status
  135.     pac_mmc_ofc(*args)
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # * Open Status Window
  139.   #--------------------------------------------------------------------------
  140.   def pac_mmc_open_status
  141.     c = 0
  142.     c = Graphics.width - @command_window.width if PAC::MM::Windows_Pos == :right
  143.     unless @command_window.x == c
  144.       s = PAC::MM::Compact::Move_Speed
  145.       s *= -1 if PAC::MM::Windows_Pos != :right
  146.       c = 0
  147.     c = Graphics.width - @command_window.width if PAC::MM::Windows_Pos == :right
  148.       begin
  149.         @windows.each do |window| window.x += s end
  150.         Graphics.update
  151.       end until PAC::MM::Windows_Pos == :right ? @command_window.x >= c :
  152.        @command_window.x <= c
  153.       @windows.each do |window| window.x = c end
  154.     end
  155.     @status_window.show if @status_window.visible == false
  156.     @status_window.open if @status_window.openness == 0
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # * Close Status Window
  160.   #--------------------------------------------------------------------------
  161.   def pac_mmc_close_status
  162.     @status_window.close
  163.     begin; @status_window.update; Graphics.update
  164.     end until @status_window.openness == 0
  165.     s = PAC::MM::Compact::Move_Speed
  166.     s *= -1 if PAC::MM::Windows_Pos == :right
  167.     c = (Graphics.width - @command_window.width) / 2
  168.     begin
  169.       @windows.each do |window| window.x += s end
  170.       Graphics.update
  171.     end until PAC::MM::Windows_Pos == :right ? @command_window.x <= c :
  172.      @command_window.x >= c
  173.     @windows.each do |window| window.x = c end
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # * Frame Update
  177.   #--------------------------------------------------------------------------
  178.   def update(*args)
  179.     pac_mmc_update(*args)
  180.     update_window_vis
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # * Update Window Visibility
  184.   #--------------------------------------------------------------------------
  185.   def update_window_vis
  186.     if PAC::MM::Compact::Show_Button != nil &&
  187.      Input.trigger?(PAC::MM::Compact::Show_Button)
  188.       Sound.play_cursor
  189.       win = [@gold_window, @map_window, @time_window]
  190.       if @gold_window.open?
  191.         win.each do |window| window.close end
  192.         $game_system.menu_window_vis = false
  193.       else
  194.         win.each do |window| window.open end
  195.         $game_system.menu_window_vis = true
  196.       end
  197.     end
  198.   end
  199. end
  200.  
  201. $pac[:compact] = 1.0
  202.  
  203. end
  204.  
  205. #===============================================================================
  206. #
  207. # END OF SCRIPT
  208. #
  209. #===============================================================================
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×