Advertisement
LiTTleDRAgo

[RGSS] Blizz-ABS Custom PreMenu

Oct 21st, 2011
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.54 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # Custom Blizz ABS PreMenu
  3. # Version: 1.02
  4. # Author : LiTTleDRAgo
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  6.  
  7. module LiTTleDRAgo
  8.  
  9.   PAUSEMENU       = false # If you want the game to pause when in the menu.
  10.   DISABLE_PREMENU = false # If you want to dispose the Blizz ABS Premenu
  11.  
  12.   TEXT1, TEXT2, TEXT3 = 'Location', 'Steps', 'Money'
  13.   CommandsPreMenu  = ['Menu', 'Hotkeys', 'AI Behavior', 'AI Triggers', 'Cancel']
  14.   FontFacePreMenu = 'Calibri'
  15.   FontSizePreMenu  =  19
  16. end
  17.  
  18. module SetFont
  19.   def initialize
  20.     super(0, 0, 450, 96)
  21.     self.contents = Bitmap.new(width - 32, height - 32)
  22.     self.contents.font.name = LiTTleDRAgo::FontFacePreMenu
  23.     self.contents.font.size = LiTTleDRAgo::FontSizePreMenu
  24.     refresh
  25.   end
  26.   def update
  27.     super
  28.     refresh if Graphics.frame_count / Graphics.frame_rate != @total_sec
  29.   end
  30. end
  31.  
  32. class Game_Map
  33.   def name
  34.     load_data('Data/MapInfos.rxdata')[@map_id].name
  35.   end  
  36. end
  37.  
  38. if !LiTTleDRAgo::DISABLE_PREMENU
  39. class Window_Location < Window_Base
  40.   include SetFont
  41.   def refresh
  42.     self.contents.clear
  43.     self.contents.font.color = system_color
  44.     self.contents.draw_text(4, 0, 120, 32, LiTTleDRAgo::TEXT1)
  45.     self.contents.font.color = normal_color
  46.     self.contents.draw_text(4, 32, 120, 32, $game_map.name.to_s, 2)
  47.   end
  48. end
  49.  
  50. class Window_Steps < Window_Base
  51.   alias pre_menu_refresh refresh
  52.   def refresh
  53.     original = pre_menu_refresh
  54.     self.contents.clear
  55.     self.contents.font.color = system_color
  56.     self.contents.draw_text(4, 0, 120, 32, LiTTleDRAgo::TEXT2)
  57.     self.contents.font.color = normal_color
  58.     self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
  59.   end
  60. end
  61.  
  62. if $BlizzABS && BlizzABS::VERSION <= 2.84
  63.   class Map_Battler < Game_Character
  64.     def increase_steps
  65.       if @battler.is_a?(Game_Actor) && @battler.id == $game_party.actors[0].id
  66.         $game_party.steps = [$game_party.steps + 1, 9999999999999999].min
  67.       end
  68.     end
  69.   end
  70. end
  71.  
  72. class Window_NewGold < Window_Base
  73.   include SetFont
  74.   def refresh
  75.     self.contents.clear
  76.     self.contents.font.color = system_color
  77.     self.contents.draw_text(4, 0, 120, 32, LiTTleDRAgo::TEXT3)
  78.     self.contents.font.color = normal_color
  79.     self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s+" "+$data_system.words.gold, 2)
  80.   end
  81. end
  82.  
  83. class Window_Clock < Window_Base
  84.   if $ccts != nil
  85.     include SetFont
  86.     def refresh
  87.       self.contents.clear
  88.       self.contents.font.color = system_color
  89.       x = $game_system.time.month - 1
  90.       min, hour = $game_system.time.minute, $game_system.time.hour
  91.       day, day_name = $game_system.time.day.to_s, $game_system.time.day_name
  92.       month = $ccts < 1.2 ? CCTS::Months[x] : CCTS::MONTHS[x]
  93.       year = $game_system.time.year.to_s
  94.       date = "#{day} #{month}, #{year}"  
  95.       self.contents.draw_text(0, 0, 200, 32, day_name+", "+date,2)
  96.       self.contents.draw_text(0, 32, 200, 32, sprintf('%2d:%02d', hour, min),2)
  97.       self.contents.font.color = normal_color
  98.     end
  99.   end
  100. end
  101. end
  102.  
  103. class Scene_Menu
  104.   alias drago_blizzabs_later main_blizzabs_later
  105.   def main
  106.     if @index_flag == nil && !LiTTleDRAgo::DISABLE_PREMENU
  107.       $game_temp.in_battle = true
  108.       @hud     = Hud.new  if BlizzABS::Config::HUD_ENABLED && $game_system.hud
  109.       @hotkeys = Hotkey_Assignment.new if
  110.         BlizzABS::Config::HOTKEYS && $game_system.hotkeys
  111.       @window  = Window_Command.new(192, LiTTleDRAgo::CommandsPreMenu)
  112.       if $game_party.actors.size == 0
  113.         @window.disable_item(1)
  114.         @window.disable_item(2)
  115.         @window.disable_item(3)
  116.       end
  117.       @window.x, @window.y = 320 - @window.width/2, 240 - @window.height/2
  118.       @window.z = 21000
  119.       #-------------------------------------------------------------------------
  120.       @steps_w, @gold_w        = Window_Steps.new, Window_NewGold.new
  121.       @location_w, @playtime_w = Window_Location.new, Window_PlayTime.new
  122.       @clock                   = Window_Clock.new   if $ccts != nil
  123.       #-------------------------------------------------------------------------
  124.       @steps_w.x   , @steps_w.y          = 0  , 394
  125.       @gold_w.x    , @gold_w.y           = 0  , 345
  126.       @location_w.x, @location_w.y       = 480, 394
  127.       @playtime_w.x, @playtime_w.y       = 480, $ccts != nil ?  49 : 0
  128.       @clock.x, @clock.y, @clock.opacity = 400, 0,0 if $ccts != nil
  129.       #-------------------------------------------------------------------------
  130.       @gold_w.opacity, @window.back_opacity, @steps_w.opacity,
  131.       @location_w.opacity, @playtime_w.opacity = 0,0,0,0,0      
  132.       #-------------------------------------------------------------------------
  133.       @spriteset, @view = Spriteset_Map.new, Viewport.new(0, 0, 640, 480)
  134.       x = BlizzABS::Config::MENU_COLOR_TINT
  135.       tint = x > 0 ? BlizzABS::Config::MENU_COLOR_TINT : rand(8) + 1
  136.       case tint
  137.       when 1 then @view.tone = Tone.new(-40, -40, -40, 255)
  138.       when 2 then @view.tone = Tone.new(-255, -255, 0, 255)
  139.       when 3 then @view.tone = Tone.new(-255, 0, -255, 255)
  140.       when 4 then @view.tone = Tone.new(0, -255, -255, 255)
  141.       when 5 then @view.tone = Tone.new(0, 0, -255, 255)
  142.       when 6 then @view.tone = Tone.new(0, -255, 0, 255)
  143.       when 7 then @view.tone = Tone.new(-255, 0, 0, 255)
  144.       when 8 then @view.tone = Tone.new(-60, -60, -60, 0)
  145.       end
  146.       Graphics.transition
  147.       loop do
  148.         [Graphics, Input].each {|s| s.update if s != nil}
  149.         break if update_before_main
  150.       end
  151.       Graphics.freeze
  152.       [@hud, @hotkeys, @spriteset, @window, @playtime_w, @steps_w, @gold_w,
  153.       @location_w, @clock].each {|s| s.dispose if s != nil}
  154.       @view.dispose if $scene.is_a?(Scene_Menu) || $scene.is_a?(Scene_Map)
  155.       @window = @spriteset = @view = nil
  156.     end
  157.     drago_blizzabs_later if $scene.is_a?(Scene_Menu)
  158.   end
  159.   #----------------------------------------------------------------------------
  160.   #  Processes the pre-menu.
  161.   #----------------------------------------------------------------------------
  162.   alias drago_update_before update_before_main
  163.   def update_before_main
  164.     return drago_update_before if LiTTleDRAgo::DISABLE_PREMENU
  165.     [@spriteset, $game_map, $game_system.map_interpreter, $game_system,
  166.     $game_screen].each {|s| s.update if s != nil} if !LiTTleDRAgo::PAUSEMENU
  167.     $BlizzABS.AI.update
  168.     [@playtime_w, @steps_w, @gold_w, @location_w,
  169.     @clock].each {|s| s.update if s != nil}
  170.     drago_update_before
  171.   end
  172. end
  173.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement