Advertisement
blackmorning

Blackmorning - Ace Menu

Nov 4th, 2015
570
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 45.11 KB | None | 0 0
  1. #==============================================================================
  2. # ** Blackmorning -> Advanced Animated Menu
  3. #------------------------------------------------------------------------------
  4. #  Blackmorning
  5. #  Version 2.00
  6. #  updated 11/05/2015
  7. # - fixed particle movement
  8. # - can adjust bust y position
  9. # - adjusted info locations
  10. # - added background image change
  11. # - can change opacity of main menu
  12. # - returned non-menu to default style (ie. item/skill)
  13. #==============================================================================
  14. #  - INTRODUCTION -
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. #  - adds custom music to the menu screens (Idea from Tsukihime)
  17. #  - column-based actor status on main menu screen (idea from Galv's)
  18. #  - gold window includes variables, time, steps, etc (Idea from Yanfly Scene Menu ReDux)
  19. #  - location window on main menu screen
  20. #  - animated actor graphics in menu screen
  21. #  - change input button for calling the menu
  22. #  - large portrait for actor if available
  23. #    found in folder assigned to portrait/bust images (see BM-Base)
  24. #    file format -  face_name-face-index
  25. #    (size:270px x 290px)
  26. #==============================================================================
  27. # ? Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below BM - Base but above Main.
  31. # If using Yanfly Shop Options, put this below it.
  32. # Remember to save.
  33. #==============================================================================
  34. module BM
  35.   module MENU
  36.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  37.     # Visual Options
  38.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  39.     OPTIONS ={
  40.       :spacing      => 0,   # spacing between actors in menu status
  41.       :actor_skip   => true, # skip the actor selection if there's only one party member
  42.       :right_side   => true, # menu to shift to the right side. status to left
  43.       :button       => :B,   # input button used to call the main menu (default = Input::B)
  44.     }# DO NOT REMOVE
  45.     BG_OPTIONS ={
  46.       :win_opacity  => 255,    # window opacity for menu
  47.       :show_bg_img  => true, # show background image
  48.       :bg_image     => "StarlitSky",   # image name (Located in Graphics/System
  49.       :bg_opacity   => 255,  # background image opacity
  50.       :bg_scroll_x  => 0,    # horizontal movement
  51.       :bg_scroll_y  => 0,    # vertical movement
  52.     }# DO NOT REMOVE
  53.     LOCATION_WINDOW_OPTIONS ={
  54.       :show     => true, # show/hide location window
  55.       :bottom   => true, # location window to appear on the bottom of the screen
  56.       :location => true, # show current location
  57.       :time     => false, # show game time
  58.       :hm_time  => false, # show in-game date if using Harvest Moon calender
  59.     }# DO NOT REMOVE
  60.     ACTOR_OPTIONS ={ # for main menu
  61.       :style        => 0,    
  62.       #style => 0, # column style actors
  63.       #style => 1, # row style actors
  64.       :use_bust      => true, # if none available, uses face (only for style 0)
  65.       :bust_height   => 250,  # size of image you want (cropped to size)
  66.       :bust_offset_y => 70,   # bust offset from the base of window (default 80)
  67.       :ani_sel_face  => false,# bounces selected face/bust
  68.       :ani_sel_char  => true, # bounces selected character graphic
  69.       :show_tp       => true, # shows tp gauge below hp and mp
  70.       :hpmp_box      => true, # darkens area around hp,mp,tp gauges
  71.       :show_char     => true, # shows walking character graphic
  72.       :walk_char     => true, # walking actor graphics (may slow down game in menu)
  73.       :hp_fontsize   => 16,   # font size of hp and mp gauge
  74.     }# DO NOT REMOVE
  75.     #------------------------------------------------------------------------------
  76.     # Multi Variable Window (Imported - Yanfly Scene Menu ReDux)
  77.     #------------------------------------------------------------------------------
  78.     VARIABLE_OPTIONS = {
  79.       :use_window => true, # alters the gold window at the bottom to display variables, time, steps, etc.
  80.       :icons => true, #true -> uses icons, false -> uses text
  81.       :style => 0,
  82.       #:style => 0, #goes below menu commands window (vertical)
  83.       #:style => 1, #goes opposite location window (horizontal)
  84.       #:style => 2, #goes right below location window (horizontal)
  85.       #:style => 3, #goes right above location window (horizontal)
  86.     }
  87.     VARIABLES_SHOWN = [-2, 0, 1] # Variables will be shown in this order.
  88.     # (-2 is steps, -1 is time, 0 is gold)
  89.     VARIABLES_HASH  ={ # Note that value zero must exist.
  90.     # VarID => [Icon, Text]
  91.           -2 => [ 467, "Steps"],# steps taken
  92.           -1 => [ 280, "Time"], # game time
  93.            0 => [ 262, "Gold"], # gold
  94.            # add variables as you like
  95.            1 => [ 341, "Jewels"],
  96.            61 => [ 41, "Whatever"],
  97.     }# DO NOT REMOVE
  98.     #------------------------------------------------------------------------------
  99.     # Music in Menu - (Imported - Tsukihime)
  100.     #------------------------------------------------------------------------------
  101.     MUSIC ={
  102.       :switch => 2, # switch_id to prevent menu music from auto-playing
  103.       :bgm    => "Theme4",
  104.       :mvol   => 100,
  105.       :bgs    => "",
  106.       :svol   => 100,
  107.     }# DO NOT REMOVE
  108.     #-----------------------------------------------------------------------------
  109.     # MENU_PARTICLES
  110.     #-----------------------------------------------------------------------------
  111.     # The particles needs to be in Graphics/System/ folder.
  112.     PARTICLE_OPTIONS = {
  113.       :show       => false,        # Show particles floating in menu
  114.       :name       => "Menu_Particles", # found in Graphics/System/
  115.       :num        => 20,          # number of particles found
  116.       :rand_color => true,        # random color change of particles
  117.       :blend_type => 0,           # (0 - Normal, 1 - Add, 2 - Substract)
  118.       :speed_x    => "(1 + rand(3))", # horizontal speed
  119.       :speed_y    => "(1 + rand(3))", # vertical speed
  120.       :a          => "(1 + rand(1))", # angle
  121.       :z          => "1000",
  122.     }
  123.   end
  124. end
  125. #===============================================================================
  126. # Editting anything past this point may potentially result in causing computer
  127. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  128. # Therefore, edit at your own risk.
  129. #===============================================================================
  130. module BM
  131.   def self.required(name, req, version, type = nil)
  132.     if !$imported[:bm_base]
  133.       msg = "The script '%s' requires the script\n"
  134.       msg += "'BM - Base' v%s or higher above it to work properly\n"
  135.       msg += "Go to bmscripts.weebly.com to download this script."
  136.       msgbox(sprintf(msg, self.script_name(name), version))
  137.       exit
  138.     else
  139.       self.required_script(name, req, version, type)
  140.     end
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # * script_name
  144.   #   Get the script name base on the imported value
  145.   #--------------------------------------------------------------------------
  146.   def self.script_name(name, ext = "BM")
  147.     name = name.to_s.gsub("_", " ").upcase.split
  148.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  149.     name.join(" ")
  150.   end
  151. end
  152. $imported ||= {}
  153. $imported[:bm_menustatus] = 2.00
  154. BM.required(:bm_menustatus, :bm_base, 1.23, :above)
  155. #=============================================================================#
  156. # ** Module Icon
  157. #=============================================================================#
  158. module Icon
  159.   def self.currency; BM::MENU::VARIABLES_HASH[0][0]; end
  160.   def self.steps; BM::MENU::VARIABLES_HASH[-2][0]; end
  161.   def self.time; BM::MENU::VARIABLES_HASH[-1][0]; end
  162.   def self.variable(id); BM::MENU::VARIABLES_HASH[id][0]; end
  163. end
  164. #=============================================================================#  
  165. class Game_Party < Game_Unit
  166.   #--------------------------------------------------------------------------
  167.   # * Get Actor Selected on Menu Screen
  168.   #--------------------------------------------------------------------------
  169.   alias :bm_ma :menu_actor
  170.   def menu_actor
  171.     if $game_party.members.size < 2 && BM::MENU::OPTIONS[:actor_skip]
  172.       members[0]
  173.     else
  174.       bm_ma
  175.     end
  176.   end
  177. end
  178. #=============================================================================#
  179. # ** Game Temp
  180. #=============================================================================#
  181. class Game_Temp  
  182.   #--------------------------------------------------------------------------
  183.   # * Public Instance Variables
  184.   #--------------------------------------------------------------------------
  185.   attr_accessor :map_bgm
  186.   attr_accessor :map_bgs
  187.   attr_reader :menu_bgm
  188.   attr_reader :menu_bgs
  189.   #--------------------------------------------------------------------------
  190.   # * Alias: Object Initialization
  191.   #--------------------------------------------------------------------------
  192.   alias :bm_menu_init :initialize
  193.   def initialize
  194.     bm_menu_init
  195.     @map_bgm = RPG::BGM.new
  196.     @map_bgs = RPG::BGS.new
  197.     @menu_bgm = RPG::BGM.new(BM::MENU::MUSIC[:bgm],BM::MENU::MUSIC[:mvol])
  198.     @menu_bgs = RPG::BGS.new(BM::MENU::MUSIC[:bgs],BM::MENU::MUSIC[:svol])
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # * New Method: replay map music
  202.   #--------------------------------------------------------------------------
  203.   def replay_map_music
  204.     @map_bgm.replay
  205.     @map_bgs.replay
  206.   end
  207. end
  208. #=============================================================================#
  209. # ** Game System
  210. #=============================================================================#
  211. class Game_System
  212.   #--------------------------------------------------------------------------
  213.   # * Public Instance Variables
  214.   #--------------------------------------------------------------------------
  215.   attr_accessor :menu_music_disabled
  216.   #--------------------------------------------------------------------------
  217.   # * New Method: menu music disabled
  218.   #--------------------------------------------------------------------------
  219.   def menu_music_disabled=(val)
  220.     $game_switches[BM::MENU::MUSIC[:switch]] = val
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # * New Method: menu music disabled
  224.   #--------------------------------------------------------------------------
  225.   def menu_music_disabled; $game_switches[BM::MENU::MUSIC[:switch]]; end
  226. end
  227. #==============================================================================
  228. # ** Menu Particles
  229. #==============================================================================
  230. class Menu_Particles < Sprite
  231.   #--------------------------------------------------------------------------
  232.   # * Initialize
  233.   #--------------------------------------------------------------------------            
  234.   def initialize(viewport = nil)
  235.     super(viewport)
  236.     @speed_part_x = 0
  237.     @speed_part_y = 0
  238.     @speed_part_a = 0
  239.     self.bitmap = Cache.system(BM::MENU::PARTICLE_OPTIONS[:name])
  240.     self.tone.set(rand(255),rand(255), rand(255), 255) if BM::MENU::PARTICLE_OPTIONS[:rand_color]
  241.     self.blend_type = BM::MENU::PARTICLE_OPTIONS[:blend_type]
  242.     self.z = eval(BM::MENU::PARTICLE_OPTIONS[:z])
  243.     reset_setting
  244.   end  
  245.   #--------------------------------------------------------------------------
  246.   # * Reset Setting
  247.   #--------------------------------------------------------------------------              
  248.   def reset_setting
  249.     zoom = (50 + rand(100)) / 100.1
  250.     self.zoom_x = zoom
  251.     self.zoom_y = zoom
  252.     self.x = rand(Graphics.width)
  253.     self.y = rand(Graphics.height)
  254.     self.opacity = 0
  255.     @speed_part_x = eval(BM::MENU::PARTICLE_OPTIONS[:speed_x])
  256.     @speed_part_y = eval(BM::MENU::PARTICLE_OPTIONS[:speed_y])
  257.     @speed_part_a = eval(BM::MENU::PARTICLE_OPTIONS[:a])
  258.   end  
  259.   #--------------------------------------------------------------------------
  260.   # * Dispose
  261.   #--------------------------------------------------------------------------              
  262.   def dispose
  263.     super; self.bitmap.dispose if self.bitmap != nil
  264.   end  
  265.   #--------------------------------------------------------------------------
  266.   # * Update
  267.   #--------------------------------------------------------------------------              
  268.   def update
  269.     super
  270.     self.x += @speed_part_x
  271.     self.y -= @speed_part_y
  272.     self.angle += @speed_part_a      
  273.     self.opacity += 5
  274.     reset_setting if can_reset_setting?
  275.   end    
  276.   #--------------------------------------------------------------------------
  277.   # * Can Reset Setting
  278.   #--------------------------------------------------------------------------                
  279.   def can_reset_setting?
  280.     hmin = -50
  281.     hmax = Graphics.height
  282.     wmax = Graphics.width
  283.     wmin = -50
  284.     return true if self.y < hmin if @speed_part_y > 0
  285.     return true if self.y > hmax if @speed_part_y < 0
  286.     return true if self.x < wmin if @speed_part_x < 0
  287.     return true if self.x > wmax if @speed_part_x > 0
  288.     return false
  289.   end
  290. end  
  291. #==============================================================================
  292. # ** PARTICLE_EX
  293. #==============================================================================
  294. module PARTICLE_EX  
  295.   #--------------------------------------------------------------------------
  296.   # * Start
  297.   #--------------------------------------------------------------------------          
  298.   def start
  299.     super; create_particles
  300.   end  
  301.   #--------------------------------------------------------------------------
  302.   # * Create Particles
  303.   #--------------------------------------------------------------------------  
  304.   def create_particles
  305.     return unless BM::MENU::PARTICLE_OPTIONS[:show]
  306.     @particles_sprite =[]
  307.     for i in 0...BM::MENU::PARTICLE_OPTIONS[:num]
  308.       @particles_sprite.push(Menu_Particles.new(nil))
  309.     end
  310.   end  
  311.   #--------------------------------------------------------------------------
  312.   # * Dispose Particles
  313.   #--------------------------------------------------------------------------    
  314.   def dispose_particles
  315.     return if @particles_sprite == nil
  316.     @particles_sprite.each {|sprite| sprite.dispose }
  317.   end    
  318.   #--------------------------------------------------------------------------
  319.   # * Terminate
  320.   #--------------------------------------------------------------------------  
  321.   def terminate
  322.     super; dispose_particles
  323.   end      
  324.   #--------------------------------------------------------------------------
  325.   # * Update
  326.   #--------------------------------------------------------------------------  
  327.   def update
  328.     super; update_particles
  329.   end
  330.   #--------------------------------------------------------------------------
  331.   # * Update Particles
  332.   #--------------------------------------------------------------------------  
  333.   def update_particles
  334.     return if @particles_sprite == nil
  335.     @particles_sprite.each {|sprite| sprite.update }
  336.   end
  337. end
  338. #=============================================================================#
  339. # ** Window_MenuStatus
  340. #=============================================================================#
  341. class Window_MenuStatus < Window_Selectable
  342.   alias :bm_menu_dai :draw_actor_icons
  343. end
  344. #=============================================================================#
  345. # ** Window_MenuStatus2
  346. #=============================================================================#
  347. class Window_MenuStatus2 < Window_MenuStatus
  348.   #--------------------------------------------------------------------------
  349.   # * Alias: Object Initialization
  350.   #--------------------------------------------------------------------------
  351.   alias :bm_menu_init :initialize
  352.   def initialize(*args, &block)
  353.     @walk = 0
  354.     @step = 0  # 0 is left, 1 is right
  355.     @animtime = 0
  356.     @e_images = {}
  357.     bm_menu_init(*args, &block)
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # * Alias: update
  361.   #--------------------------------------------------------------------------
  362.   alias :bm_menu_up :update
  363.   def update
  364.     bm_menu_up
  365.     ani_motion if BM::MENU::ACTOR_OPTIONS[:walk_char]
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   def location_height
  369.     i = 0
  370.     return 0 unless BM::MENU::LOCATION_WINDOW_OPTIONS[:show]
  371.     i += 1 if BM::MENU::LOCATION_WINDOW_OPTIONS[:location]
  372.     i += 1 if BM::MENU::LOCATION_WINDOW_OPTIONS[:time]
  373.     i += 1 if BM::MENU::LOCATION_WINDOW_OPTIONS[:hm_time] && BM::SELCHAR_CALENDER
  374.     return fitting_height(i) if i != 0
  375.     return 0
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # * Overwrite: Get Window Height
  379.   #--------------------------------------------------------------------------
  380.   def window_height
  381.     if BM::MENU::VARIABLE_OPTIONS[:style] == 0
  382.       Graphics.height - location_height
  383.     else
  384.       Graphics.height - location_height - fitting_height(1)
  385.     end
  386.   end
  387.   if BM::MENU::ACTOR_OPTIONS[:style] == 1 #traditional
  388.     #--------------------------------------------------------------------------
  389.     # * alias: Draw Item
  390.     #--------------------------------------------------------------------------
  391.     alias :bm_menu_wmsdi :draw_item
  392.     def draw_item(index)
  393.       actor = $game_party.members[index]
  394.       rect = item_rect(index)
  395.       rect2 = Rect.new(rect.x + 108 + 120, rect.y + line_height, item_width, item_height - line_height)
  396.       contents.clear_rect(rect2)
  397.       contents.fill_rect(rect.x,rect.y,rect.width,rect.height+spacing, standby_color(actor)) unless battle_party?(actor)
  398.       color = Color.new(0, 0, 0, 128)
  399.       contents.fill_rect(rect2, color) if BM::MENU::ACTOR_OPTIONS[:hpmp_box]
  400.       bm_menu_wmsdi(index)  
  401.       dy = rect.y
  402.       if BM::MENU::ACTOR_OPTIONS[:show_char]
  403.         dy = rect.y + @walk*5 if index == @index && self.active && BM::MENU::ACTOR_OPTIONS[:ani_sel_char]
  404.         draw_actor_graphic(actor, rect.x + 16, dy + item_height, battle_party?(actor))
  405.       end
  406.     end
  407.     #--------------------------------------------------------------------------
  408.     # overwrite method: draw_actor_simple_status
  409.     #--------------------------------------------------------------------------
  410.     def draw_actor_simple_status(actor, dx, dy)
  411.       dy -= line_height/2
  412.       draw_actor_name(actor, dx, dy)
  413.       dw = contents.width - dx - 124
  414.       draw_actor_class(actor, dx + 120, dy, dw)
  415.       h = item_height/3 - 2
  416.       draw_actor_icons(actor, dx, dy + h * 2)
  417.       contents.font.size = BM::MENU::ACTOR_OPTIONS[:hp_fontsize]
  418.       draw_actor_level(actor, dx, dy + h * 1)
  419.       draw_actor_hp(actor, dx + 120, dy + h * 1, dw)
  420.       if BM::MENU::ACTOR_OPTIONS[:show_tp]
  421.         draw_actor_mp(actor, dx + 120, dy + h * 2, dw/2)
  422.         draw_actor_tp(actor, dx + 120 + dw/2, dy + h * 2, dw/2)
  423.       else
  424.         draw_actor_mp(actor, dx + 120, dy + h * 2, dw)
  425.       end
  426.     end
  427.    
  428.   elsif BM::MENU::ACTOR_OPTIONS[:style] == 0 #column based
  429.   include Horizontal_Fix
  430.   #--------------------------------------------------------------------------
  431.   # * Get Digit Count
  432.   #--------------------------------------------------------------------------
  433.   def col_max; return member_size; end
  434.   #--------------------------------------------------------------------------
  435.   # * Overwrite: Get Spacing for Items Arranged Side by Side
  436.   #--------------------------------------------------------------------------
  437.   def spacing; BM::MENU::OPTIONS[:spacing]; end
  438.   #--------------------------------------------------------------------------
  439.   # new method: member_size
  440.   #--------------------------------------------------------------------------
  441.   def member_size
  442.     ms = $game_party.max_battle_members    
  443.     minw = (Graphics.width - 160 - standard_padding * 2 + spacing) / 5 - spacing
  444.     loop do
  445.       maxw = (width - standard_padding * 2 + spacing) / ms - spacing
  446.       if maxw >= minw; return ms; end
  447.       ms -= 1
  448.     end
  449.     return ms
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # * Overwrite: Get Item Height
  453.   #--------------------------------------------------------------------------
  454.   def item_height; (height - standard_padding * 2); end
  455.   #--------------------------------------------------------------------------
  456.   # * Set Top Col
  457.   #--------------------------------------------------------------------------
  458.   def top_col=(col)
  459.     col = 0 if col < 0
  460.     @member_count = $game_party.members.count
  461.     col = col_max + @member_count if col > col_max + @member_count
  462.     self.ox = col * (item_width + spacing)
  463.   end  
  464.   #--------------------------------------------------------------------------
  465.   # * Overwrite: Draw Item
  466.   #--------------------------------------------------------------------------
  467.   def draw_item(index)
  468.     reset_font_settings
  469.     actor = $game_party.members[index]
  470.     rect = item_rect(index)
  471.     draw_item_background(index)
  472.     rect_main = Rect.new(rect.x+2, rect.y-2, item_width-4, item_height-2)
  473.     py = contents.height
  474.     contents.fill_rect(rect.x,rect.y,rect.width+spacing,rect.height, standby_color(actor)) unless battle_party?(actor)
  475.     dy = rect_main.y
  476.     dy = rect_main.y + @walk*5 if index == @index && self.active && BM::MENU::ACTOR_OPTIONS[:ani_sel_face]
  477.     py = contents.height + @walk*5 if index == @index && self.active && BM::MENU::ACTOR_OPTIONS[:ani_sel_face]
  478.     if Object.portrait_exist?("#{actor.face_name}-#{actor.face_index}") && BM::MENU::ACTOR_OPTIONS[:use_bust]
  479.       draw_actor_portrait(actor, rect.x, py - BM::MENU::ACTOR_OPTIONS[:bust_offset_y], battle_party?(actor))
  480.     else
  481.       draw_actor_face(actor, rect.x, dy + line_height*3, battle_party?(actor))
  482.     end
  483.     d2y = rect_main.y + item_height
  484.     rect2 = Rect.new(rect.x-spacing, d2y - line_height*3, item_width+spacing, line_height*3)
  485.     contents.clear_rect(rect2)
  486.     color = Color.new(0, 0, 0, 128)
  487.     contents.fill_rect(rect2, color) if BM::MENU::ACTOR_OPTIONS[:hpmp_box]
  488.     draw_actor_simple_status(actor, rect_main.x, rect_main.y, rect_main.width)
  489.     d2y = d2y + @walk*5 if index == @index && self.active && BM::MENU::ACTOR_OPTIONS[:ani_sel_char]
  490.     draw_actor_graphic(actor, rect.x + 16, d2y - line_height*3, battle_party?(actor)) if BM::MENU::ACTOR_OPTIONS[:show_char]
  491.   end
  492.   #--------------------------------------------------------------------------
  493.   # * Overwrite: Draw Simple Status
  494.   #--------------------------------------------------------------------------
  495.   def draw_actor_simple_status(actor, x, y, width = item_width)
  496.     draw_actor_name(actor, x, y)
  497.     contents.font.size = BM::MENU::ACTOR_OPTIONS[:hp_fontsize]
  498.     draw_actor_level(actor, x + 4, y + line_height * 2 - 4, width - 4)
  499.     if $imported[:bm_align]
  500.       draw_actor_align_gauge(actor, x + 4, y + line_height * 3, width - 4)
  501.     end
  502.     draw_actor_class(actor, x, y + line_height - 4)    
  503.     dy = item_height - line_height*4 - 6
  504.     draw_actor_icons(actor, x + item_width - 24, dy + line_height * 0, 150)
  505.     contents.font.size = BM::MENU::ACTOR_OPTIONS[:hp_fontsize]
  506.     draw_actor_hp(actor, x + 4, dy + line_height*1, width - 4)
  507.     draw_actor_mp(actor, x + 4, dy + line_height*2, width - 4)
  508.     draw_actor_tp(actor, x + 4, dy + line_height*3, width - 4) if BM::MENU::ACTOR_OPTIONS[:show_tp]
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # * Overwrite: draw_face
  512.   #--------------------------------------------------------------------------
  513.   def draw_face(face_name, face_index, x, y, enabled = true)
  514.     bitmap = Cache.face(face_name)
  515.     width = [item_width,96].min
  516.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, width, 96)
  517.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  518.     bitmap.dispose
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # * Draw State and Buff/Debuff Icons
  522.   #--------------------------------------------------------------------------
  523.   def draw_actor_icons(actor, x, y, height = 130)
  524.     icons = (actor.state_icons + actor.buff_icons)[0, height / 24]
  525.     icons.each_with_index {|n, i| draw_icon(n, x, y - 24 * i) }
  526.   end
  527.   #--------------------------------------------------------------------------
  528.   # * New Method: face_background
  529.   #--------------------------------------------------------------------------
  530.   def face_background(actor, x, y, width = 96, height = 96)
  531.     width = [item_width - 4,96].min
  532.     contents.fill_rect(x, y, width, height, standby_color(actor))
  533.   end
  534.   #--------------------------------------------------------------------------
  535.   # * Overwrite: Draw Portrait Graphic
  536.   #--------------------------------------------------------------------------
  537.   def draw_portrait(portrait_name, x, y, enabled = true)
  538.     bitmap = Cache.portrait(portrait_name)
  539.     width = [item_width,bitmap.width].min
  540.     height = BM::MENU::ACTOR_OPTIONS[:bust_height]
  541.     rect = Rect.new(bitmap.width/2 - width/2, 0, width, height)
  542.     contents.blt(x, y-rect.height, bitmap, rect, enabled ? 255 : translucent_alpha)
  543.     bitmap.dispose
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # * Overwrite: Draw Name
  547.   #--------------------------------------------------------------------------
  548.   def draw_actor_name(actor, x, y)
  549.     contents.font.bold = true
  550.     contents.font.color = hp_color(actor)
  551.     contents.draw_text(x, y, item_width, line_height, actor.name,1)
  552.     contents.font.color = normal_color
  553.     contents.font.bold = false
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # * Overwrite: Draw Class
  557.   #--------------------------------------------------------------------------
  558.   def draw_actor_class(actor, x, y ,width = item_width)
  559.     contents.font.italic = true
  560.     contents.font.color = normal_color
  561.     unless $imported["YEA-ClassSystem"]
  562.       text = actor.class.name
  563.     else
  564.       if actor.subclass.nil?
  565.         text = actor.class.name
  566.       else
  567.         fmt = YEA::CLASS_SYSTEM::SUBCLASS_TEXT
  568.         text = sprintf(fmt, actor.class.name, actor.subclass.name)
  569.       end
  570.       text = sprintf("%s %s",text, actor.class_level(actor.class_id))
  571.     end
  572.     contents.draw_text(x, y, width, line_height, text ,1)
  573.     contents.font.italic = false
  574.   end
  575.   #--------------------------------------------------------------------------
  576.   # * Overwrite: Draw actor level
  577.   #--------------------------------------------------------------------------
  578.   def draw_actor_level(actor, x, y, width = item_width)
  579.     draw_gauge(x, y, width, exp_rate(actor), exp_gauge1, exp_gauge2)
  580.     change_color(system_color)
  581.     draw_text(x + 10, y - 6, 32, line_height, Vocab::level)
  582.     change_color(normal_color)
  583.     draw_text(x, y - 6, width - 10, line_height, actor.level.group, 2)
  584.   end
  585.  
  586. end
  587. end
  588. #==============================================================================
  589. # ** Window_Location
  590. #==============================================================================
  591. class Window_location < Window_Base
  592.   #--------------------------------------------------------------------------
  593.   # * Object Initialization
  594.   #--------------------------------------------------------------------------
  595.   def initialize(x, y)
  596.     super(x, y, Graphics.width, window_height)
  597.     refresh
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   def window_height
  601.     i = 0
  602.     i += 1 if BM::MENU::LOCATION_WINDOW_OPTIONS[:location]
  603.     i += 1 if BM::MENU::LOCATION_WINDOW_OPTIONS[:time]
  604.     i += 1 if hm_time
  605.     return fitting_height(i) if i != 0
  606.     return 0
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # * Refresh
  610.   #--------------------------------------------------------------------------
  611.   def refresh
  612.     contents.clear
  613.     index = 0
  614.     for type in [:location, :time, :hm_time]
  615.       index = draw_item(type, index)
  616.     end
  617.   end
  618.   #--------------------------------------------------------------------------
  619.   # * draw item
  620.   #--------------------------------------------------------------------------
  621.   def draw_item(type, index)
  622.     sw = self.width - 32
  623.     dy = line_height * index
  624.     text3 = " "
  625.     case type
  626.     when :location
  627.       return index unless BM::MENU::LOCATION_WINDOW_OPTIONS[:location]
  628.       text1 = "Location :"; text2 = location?
  629.       @location_index = index
  630.     when :time
  631.       return index unless BM::MENU::LOCATION_WINDOW_OPTIONS[:time]
  632.       text1 = "Time :"; text2 = game_time
  633.       @time_index = index
  634.     when :hm_time
  635.       return index unless hm_time
  636.       text1 = "Date :"; text2 = date?
  637.       text3 = " - (PAUSED) - "
  638.       @hm_time_index = index
  639.     else; return index
  640.     end
  641.     cx = contents.text_size(text1).width
  642.     change_color(system_color)
  643.     draw_text(4, dy, sw, line_height, text1)
  644.     change_color(normal_color)
  645.     draw_text(4 + cx, dy, sw, line_height, text3)
  646.     draw_text(0, dy, sw, line_height, text2, 2)
  647.     return index + 1
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # * location
  651.   #--------------------------------------------------------------------------
  652.   def location?
  653.     return " " if $game_map.display_name.empty?
  654.     return $game_map.display_name
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # * date
  658.   #--------------------------------------------------------------------------
  659.   def date?
  660.     date = HM_SEL.day_of_week? + ' ' + HM_SEL.month? + ' ' + HM_SEL.day_of_month?
  661.     year = HM_SEL.year?
  662.     time = HM_SEL.current_time? + HM_SEL.am_pm?
  663.     return sprintf("%s, %d, %s", date, year, time)
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   def hm_time
  667.     return true if BM::MENU::LOCATION_WINDOW_OPTIONS[:hm_time] && BM::SELCHAR_CALENDER
  668.     return false
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # update
  672.   #--------------------------------------------------------------------------
  673.   def update
  674.     super
  675.     return unless BM::MENU::LOCATION_WINDOW_OPTIONS[:time] or hm_time
  676.     refresh
  677.   end
  678. end
  679. #===============================================================================
  680. # ** Window_MultiVariableWindow
  681. #===============================================================================
  682. class Window_MultiVariableWindow < Window_Selectable
  683.   #--------------------------------------------------------------------------
  684.   # * initialize
  685.   #--------------------------------------------------------------------------
  686.   def initialize
  687.     if BM::MENU::VARIABLE_OPTIONS[:style] == 0
  688.       dh = 32 + 24 * BM::MENU::VARIABLES_SHOWN.size
  689.       dw = 160
  690.     else
  691.       dh = fitting_height(1)
  692.       dw = Graphics.width
  693.     end
  694.     dy = Graphics.height - dh
  695.     super(0, dy, dw, dh)
  696.     @data = []
  697.     refresh
  698.   end  
  699.   #--------------------------------------------------------------------------
  700.   # * Get Number of Items
  701.   #--------------------------------------------------------------------------
  702.   def item_max
  703.     @data ? @data.size : 1
  704.   end
  705.   #--------------------------------------------------------------------------
  706.   # * Create Item List
  707.   #--------------------------------------------------------------------------
  708.   def make_item_list
  709.     for i in BM::MENU::VARIABLES_SHOWN
  710.       next unless BM::MENU::VARIABLES_HASH.include?(i)
  711.       @time_index = @data.size if i == -1
  712.       @data.push(i)
  713.     end
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   if BM::MENU::VARIABLE_OPTIONS[:style] != 0
  717.     include Horizontal_Fix
  718.   end
  719.   #--------------------------------------------------------------------------
  720.   # * refresh
  721.   #--------------------------------------------------------------------------
  722.   def refresh
  723.     make_item_list
  724.     super
  725.   end  
  726.   #--------------------------------------------------------------------------
  727.   # * draw_item
  728.   #--------------------------------------------------------------------------
  729.   def draw_item(index)
  730.     item = @data[index]
  731.     if item
  732.       rect = item_rect(index)
  733.       contents.clear_rect(rect)
  734.       value = item_type(item)
  735.       if BM::MENU::VARIABLE_OPTIONS[:icons]    
  736.         contents.draw_text(rect.x, rect.y, rect.width - 32, rect.height, value[0], 2)
  737.         draw_icon(value[1], rect.x + rect.width - 24, rect.y)
  738.       else
  739.         cx = contents.text_size(value[2]).width
  740.         contents.font.color = normal_color
  741.         contents.draw_text(rect.x, rect.y, rect.width - cx - 2, rect.height, value[0], 2)
  742.         contents.font.color = system_color
  743.         contents.draw_text(rect, value[2], 2)
  744.       end
  745.     end  
  746.   end    
  747.   #--------------------------------------------------------------------------
  748.   # * item_type
  749.   #--------------------------------------------------------------------------
  750.   def item_type(index)
  751.     case index
  752.     when -2 # Draw Steps
  753.       value = $game_party.steps.group
  754.       icon = Icon.steps
  755.       text = BM::MENU::VARIABLES_HASH[index][1]
  756.     when -1 # Draw Time
  757.       value = game_time
  758.       icon = Icon.time
  759.       text = BM::MENU::VARIABLES_HASH[index][1]  
  760.     when 0 # Draw Gold
  761.       value = $game_party.gold.group
  762.       icon = Icon.currency
  763.       text = Vocab.currency_unit
  764.     else # Draw Variables
  765.       value = $game_variables[index]
  766.       icon = Icon.variable(index)
  767.       text = BM::MENU::VARIABLES_HASH[index][1]
  768.     end
  769.     return [value, icon, text]
  770.   end
  771.   #--------------------------------------------------------------------------
  772.   # update
  773.   #--------------------------------------------------------------------------
  774.   def update
  775.     super
  776.     return unless BM::MENU::VARIABLES_SHOWN.include?(-1)
  777.     if game_time != (Graphics.frame_count / Graphics.frame_rate)
  778.       draw_item(@time_index)
  779.     end
  780.   end
  781. end
  782. #==============================================================================
  783. # ** Window_FileStatus
  784. #==============================================================================
  785. class Window_FileStatus < Window_Base
  786.   #--------------------------------------------------------------------------
  787.   # * Alias: Initialize
  788.   #--------------------------------------------------------------------------
  789.   alias :bm_menu_init :initialize
  790.   def initialize(*args, &block)
  791.     @walk = 0
  792.     @step = 0  # 0 is left, 1 is right
  793.     @animtime = 0
  794.     @e_images = {}
  795.     bm_menu_init(*args, &block)
  796.   end
  797.   #--------------------------------------------------------------------------
  798.   # * Alias: update
  799.   #--------------------------------------------------------------------------
  800.   alias :bm_menu_up :update
  801.   def update
  802.     super
  803.     if BM::MENU::OPTIONS[:animated]
  804.       ani_motion
  805.     else
  806.       bm_menu_up
  807.     end
  808.   end
  809. end
  810. #===============================================================================
  811. # ** Scene_MenuBase
  812. #===============================================================================
  813. class Scene_MenuBase < Scene_Base
  814.   include PARTICLE_EX if BM::MENU::PARTICLE_OPTIONS[:show] && BM::MENU::PARTICLE_OPTIONS[:name] == ""
  815.   #--------------------------------------------------------------------------
  816.   # * Create Background Image
  817.   #--------------------------------------------------------------------------
  818.   alias :bm_menu_cb :create_background
  819.   def create_background
  820.     return bm_menu_cb unless custom_bg?
  821.     custom_background
  822.   end
  823.   #--------------------------------------------------------------------------
  824.   def custom_bg?
  825.     return false if BM::MENU::BG_OPTIONS[:bg_image] == ""
  826.     return false unless BM::MENU::BG_OPTIONS[:show_bg_img]
  827.     return true
  828.   end
  829.   #--------------------------------------------------------------------------
  830.   def custom_background
  831.     @background_sprite = Plane.new
  832.     @background_sprite.bitmap = Cache.system(BM::MENU::BG_OPTIONS[:bg_image])
  833.     @background_sprite.opacity = BM::MENU::BG_OPTIONS[:bg_opacity]
  834.   end
  835.   #--------------------------------------------------------------------------
  836.   # * Update_Background_Image
  837.   #--------------------------------------------------------------------------
  838.   alias :bm_menu_u :update
  839.   def update
  840.     bm_menu_u
  841.     update_background if custom_bg?
  842.   end
  843.   #--------------------------------------------------------------------------
  844.   def update_background
  845.     return if BM::MENU::BG_OPTIONS[:bg_scroll_x] == 0 && BM::MENU::BG_OPTIONS[:bg_scroll_y] == 0
  846.     @background_sprite.ox += BM::MENU::BG_OPTIONS[:bg_scroll_x]
  847.     @background_sprite.oy += BM::MENU::BG_OPTIONS[:bg_scroll_y]
  848.   end
  849. end
  850. #===============================================================================
  851. # ** Scene_Menu
  852. #===============================================================================
  853. class Scene_Menu < Scene_MenuBase
  854.   #--------------------------------------------------------------------------
  855.   # * Alias: start
  856.   #--------------------------------------------------------------------------
  857.   alias :bm_menu_start :start
  858.   def start
  859.     create_location_window
  860.     bm_menu_start
  861.     @command_window.height = Graphics.height - location_height - @gold_window.height
  862.     relocate_windows
  863.     play_menu_bgm unless $game_system.menu_music_disabled
  864.     bm_win_opacity
  865.   end
  866.   #--------------------------------------------------------------------------
  867.   def bm_win_opacity
  868.     @command_window.opacity = BM::MENU::BG_OPTIONS[:win_opacity] unless @command_window.nil?
  869.     @location_window.opacity = BM::MENU::BG_OPTIONS[:win_opacity] unless @location_window.nil?
  870.     @gold_window.opacity = BM::MENU::BG_OPTIONS[:win_opacity] unless @gold_window.nil?
  871.     @status_window.opacity = BM::MENU::BG_OPTIONS[:win_opacity] unless @status_window.nil?
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   def location_height
  875.     return 0 unless BM::MENU::LOCATION_WINDOW_OPTIONS[:show]
  876.     return @location_window.height
  877.   end
  878.   #--------------------------------------------------------------------------
  879.   def location_y
  880.     return 0 unless BM::MENU::LOCATION_WINDOW_OPTIONS[:show]
  881.     return @location_window.y
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # * New Method: relocate windows
  885.   #--------------------------------------------------------------------------
  886.   def relocate_windows
  887.     @command_window.y = location_height
  888.     #:style => 1, #goes opposite location window (horizontal)
  889.     #:style => 2, #goes right below location window (horizontal)
  890.     #:style => 3, #goes right above location window (horizontal)
  891.     if BM::MENU::OPTIONS[:right_side]
  892.       @command_window.x = Graphics.width - @command_window.width
  893.       @gold_window.x = Graphics.width - @gold_window.width
  894.       @status_window.x = 0
  895.     end
  896.    
  897.     if BM::MENU::LOCATION_WINDOW_OPTIONS[:bottom]
  898.       @location_window.y = Graphics.height - location_height if BM::MENU::LOCATION_WINDOW_OPTIONS[:show]
  899.       @command_window.y = 0
  900.       @gold_window.y = @command_window.height
  901.       @status_window.y = 0
  902.     end
  903.    
  904.     if BM::MENU::VARIABLE_OPTIONS[:style] == 1 && !BM::MENU::LOCATION_WINDOW_OPTIONS[:bottom]
  905.       @gold_window.y = Graphics.height - @gold_window.height
  906.     elsif BM::MENU::VARIABLE_OPTIONS[:style] == 2 && !BM::MENU::LOCATION_WINDOW_OPTIONS[:bottom]
  907.       @gold_window.y = location_y + location_height
  908.       @command_window.y += @gold_window.height
  909.       @status_window.y = @command_window.y
  910.     elsif BM::MENU::VARIABLE_OPTIONS[:style] == 3 && !BM::MENU::LOCATION_WINDOW_OPTIONS[:bottom]
  911.       @location_window.y = @gold_window.height if BM::MENU::LOCATION_WINDOW_OPTIONS[:show]
  912.       @gold_window.y = 0
  913.       @command_window.y += @gold_window.height
  914.       @status_window.y = @command_window.y
  915.     end
  916.    
  917.     if BM::MENU::VARIABLE_OPTIONS[:style] == 1 && BM::MENU::LOCATION_WINDOW_OPTIONS[:bottom]
  918.       @gold_window.y = 0
  919.       @command_window.y += @gold_window.height
  920.       @status_window.y = @command_window.y
  921.     elsif BM::MENU::VARIABLE_OPTIONS[:style] == 2 && BM::MENU::LOCATION_WINDOW_OPTIONS[:bottom]
  922.       @location_window.y -= @gold_window.height if BM::MENU::LOCATION_WINDOW_OPTIONS[:show]
  923.       @gold_window.y = location_y + location_height
  924.     elsif BM::MENU::VARIABLE_OPTIONS[:style] == 3 && BM::MENU::LOCATION_WINDOW_OPTIONS[:bottom]
  925.       @gold_window.y = location_y - @gold_window.height
  926.     end
  927.   end
  928.   #--------------------------------------------------------------------------
  929.   # * Overwrite: Create Status Window
  930.   #--------------------------------------------------------------------------
  931.   def create_status_window
  932.     @status_window = Window_MenuStatus2.new(@command_window.width, location_height)
  933.   end
  934.   #--------------------------------------------------------------------------
  935.   # * New Method: Create Location Window
  936.   #--------------------------------------------------------------------------
  937.   def create_location_window
  938.     return unless BM::MENU::LOCATION_WINDOW_OPTIONS[:show]
  939.     @location_window = Window_location.new(0, 0)
  940.   end
  941.   #--------------------------------------------------------------------------
  942.   # * Alias: [Skill], [Equipment] and [Status] Commands
  943.   #--------------------------------------------------------------------------
  944.   alias :bm_menu_cp :command_personal
  945.   def command_personal
  946.     if $game_party.members.size < 2 && BM::MENU::OPTIONS[:actor_skip]
  947.       on_personal_ok
  948.     else
  949.       bm_menu_cp
  950.     end
  951.   end
  952.   #--------------------------------------------------------------------------
  953.   # * Alias: Create Gold Window
  954.   #--------------------------------------------------------------------------
  955.   alias :bm_menu_cgw :create_gold_window
  956.   def create_gold_window
  957.     if BM::MENU::VARIABLE_OPTIONS[:use_window]
  958.       @gold_window = Window_MultiVariableWindow.new
  959.     else
  960.       bm_menu_cgw
  961.     end
  962.   end
  963.   #--------------------------------------------------------------------------
  964.   # * New Method: play menu bgm
  965.   #--------------------------------------------------------------------------
  966.   def play_menu_bgm
  967.     return if $game_system.menu_music_disabled
  968.     $game_temp.menu_bgm.play if $game_temp.menu_bgm
  969.     $game_temp.menu_bgs.play if $game_temp.menu_bgs
  970.   end
  971.   #--------------------------------------------------------------------------
  972.   # * Alias: pre terminate
  973.   #--------------------------------------------------------------------------
  974.   alias :bm_menu_pt :pre_terminate
  975.   def pre_terminate
  976.     bm_menu_pt
  977.     return if $game_system.menu_music_disabled
  978.     $game_temp.replay_map_music if SceneManager.scene_is?(Scene_Map)
  979.   end
  980. end
  981. #===============================================================================
  982. # ** Scene_Map
  983. #===============================================================================
  984. class Scene_Map < Scene_Base
  985.   #--------------------------------------------------------------------------
  986.   # * Overwrite: Determine if Menu is Called due to Cancel Button
  987.   #--------------------------------------------------------------------------
  988.   def update_call_menu
  989.     if $game_system.menu_disabled || $game_map.interpreter.running?
  990.       @menu_calling = false
  991.     else
  992.       @menu_calling ||= Input.trigger?(BM::MENU::OPTIONS[:button])
  993.       call_menu if @menu_calling && !$game_player.moving?
  994.     end
  995.   end
  996.   #--------------------------------------------------------------------------
  997.   # * Alias: call menu
  998.   #--------------------------------------------------------------------------
  999.   alias :bm_menu_cm :call_menu
  1000.   def call_menu
  1001.     if !$game_system.menu_music_disabled
  1002.       $game_temp.map_bgm = RPG::BGM.last
  1003.       $game_temp.map_bgs = RPG::BGS.last
  1004.     end
  1005.     bm_menu_cm
  1006.   end
  1007. end
  1008. #==============================================================================
  1009. # ** Scene_ItemBase
  1010. #==============================================================================
  1011. class Scene_ItemBase < Scene_MenuBase
  1012.   alias :bm_cce :check_common_event
  1013.   def check_common_event
  1014.     bm_cce
  1015.     return if $game_system.menu_music_disabled
  1016.     $game_temp.replay_map_music if $game_temp.common_event_reserved?
  1017.   end
  1018.   #--------------------------------------------------------------------------
  1019.   # * Create Actor Window
  1020.   #--------------------------------------------------------------------------
  1021.   alias :bmcm_caw :create_actor_window
  1022.   def create_actor_window
  1023.     bmcm_caw    
  1024.     @actor_window.visible = false
  1025.   end
  1026. end
  1027.  
  1028. #==============================================================================
  1029. # ** Scene_Load
  1030. #------------------------------------------------------------------------------
  1031. #  This class performs load screen processing.
  1032. #==============================================================================
  1033. class Scene_Load < Scene_File
  1034.   #--------------------------------------------------------------------------
  1035.   # * Processing When Load Is Successful
  1036.   #--------------------------------------------------------------------------
  1037.   alias :bmcm_ols :on_load_success
  1038.   def on_load_success
  1039.     bmcm_ols
  1040.     $game_map.autoplay
  1041.   end
  1042. end
  1043. #===============================================================================
  1044. #
  1045. # END OF FILE
  1046. #
  1047. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement