Advertisement
LiTTleDRAgo

[RGSS] Drago - Scene Menu

Mar 21st, 2013
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 21.43 KB | None | 0 0
  1. #==============================================================================
  2. # ** DRG - Scene Menu
  3. # Version : 1.20
  4. # Author : LiTTleDRAgo
  5. #==============================================================================
  6.  
  7. module LiTTleDRAgo
  8.  
  9.   VX = defined?(Window_ActorCommand)
  10.  
  11.   SCENE_MENU = { # VX Version
  12.   # index => [Menu Name,   Menu Scene, Scene Args, Condition],
  13.       0 => ['Inventory' , Scene_Item ,   false, '$game_actors[1].hp >= 0'],
  14.       1 => ['Skill'     , Scene_Skill,   :actor],
  15.       2 => ['Equip'     , Scene_Equip,   :actor],
  16.       3 => ['Status'    , Scene_Status,  :actor],
  17.       4 => ['Save'      , Scene_File,    [true,false,false], '!$game_system.save_disabled'],
  18.       5 => ['End'       , Scene_End  ],
  19.       }
  20.      
  21.   SCENE_MENU = { # XP Version
  22.   # index => [Menu Name,   Menu Scene, Scene Args, Condition],
  23.       0 => ['Inventory' , Scene_Item ,   false, '$game_actors[1].hp >= 0'],
  24.       1 => ['Skill'     , Scene_Skill,   :actor],
  25.       2 => ['Equip'     , Scene_Equip,   :actor],
  26.       3 => ['Status'    , Scene_Status,  :actor],
  27.       4 => ['Save'      , Scene_Save,    false, '!$game_system.save_disabled'],
  28.       5 => ['End'       , Scene_End  ],
  29.       } if !VX
  30.   # Menu Name  = Name of the menu
  31.   # Menu Scene = Scene of the menu
  32.   # Scene Args = Args required in the menu
  33.   #              false/nil = no args
  34.   #              :actor    = select actor
  35.   #              [] (Array)= use all in the inside of the array as args
  36.   # Condition  = menu can be used as long as the condition is fulfilled
  37.  
  38.      
  39.   # Image related (in folder Graphics/Windowskins)    
  40.   LAYOUT_IMAGES  = 'Menu Layout'
  41.   HEADER_FOOTER  = 'Menu Header Footer'
  42.   SIDE_IMAGES    = 'Menu Chains'
  43.   BACK_IMAGES    = 'Mn_Back'
  44.   BAR_IMAGES     = 'HP Bar'
  45.   HP_METER_IMAGE = 'HP Meter'
  46.   SP_METER_IMAGE = 'SP Meter'
  47.   NUMBER_IMAGE   = 'Menu Number'
  48.   # Transition (in folder Graphics/Transition)  
  49.   TRANSITION     = '015-Diamond01'
  50.  
  51.  
  52. end
  53.  
  54. #==============================================================================
  55. # ** Scene_Menu
  56. #------------------------------------------------------------------------------
  57. #  This class performs menu screen processing.
  58. #==============================================================================
  59. class Scene_Menu
  60.   #--------------------------------------------------------------------------
  61.   # * Constants
  62.   #--------------------------------------------------------------------------
  63.   VX = LiTTleDRAgo::VX
  64.   #--------------------------------------------------------------------------
  65.   # * main
  66.   #--------------------------------------------------------------------------
  67.   def main
  68.     create_arrow
  69.     create_layout
  70.     create_menu
  71.     create_player
  72.     create_spriteset
  73.     create_transition
  74.     update_premenu
  75.     update while $scene == self
  76.     dispose_premenu
  77.     dispose_freeze
  78.     dispose
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # * create_transition
  82.   #--------------------------------------------------------------------------
  83.   def create_transition
  84.     file = "Graphics/Transitions/#{LiTTleDRAgo::TRANSITION}"
  85.     if FileTest.exist?("#{file}.png") || FileTest.exist?("#{file}.jpg")
  86.       Graphics.transition(20,"#{file}")
  87.     else
  88.       Graphics.transition(20)
  89.     end
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # * Frame Update
  93.   #--------------------------------------------------------------------------
  94.   def update
  95.     update_grafis
  96.     update_index
  97.     update_arrow
  98.     update_player
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # * update_grafis
  102.   #--------------------------------------------------------------------------
  103.   def update_grafis()  [Graphics,Input].each {|s| s.update} end
  104.   #--------------------------------------------------------------------------
  105.   # * Cache
  106.   #--------------------------------------------------------------------------
  107.   def cache()       VX ? Cache : RPG::Cache end
  108.   def windowskin(f) cache.load_bitmap('Graphics/Windowskins/', f) end    
  109.   def actors()      VX ? $game_party.members : $game_party.actors end
  110.   #--------------------------------------------------------------------------
  111.   # * Create Layout
  112.   #--------------------------------------------------------------------------
  113.   def create_layout
  114.     @sprite_layout = []
  115.     if $image_drg_menu.nil?
  116.       $image_drg_menu = [lay = windowskin(LiTTleDRAgo::SIDE_IMAGES),
  117.                 fog = windowskin(LiTTleDRAgo::BACK_IMAGES),
  118.                 bef = windowskin(LiTTleDRAgo::LAYOUT_IMAGES),
  119.                 cla = windowskin(LiTTleDRAgo::HEADER_FOOTER),
  120.                 ri = cla.clone, copy = lay.clone]
  121.       (0...lay.height).each {|i| (0...lay.width).each {|j|
  122.             lay.set_pixel(lay.width-j-1,lay.height-i-1,copy.get_pixel(j,i))} }
  123.       (0...cla.height).each {|i| (0...cla.width).each {|j|
  124.             cla.set_pixel(cla.width-j-1,cla.height-i-1,ri.get_pixel(j,i))} }
  125.     end
  126.     map = load_data("Data/MapInfos.rxdata")[$game_map.map_id].name if !VX
  127.     map = load_data("Data/MapInfos.rvdata")[$game_map.map_id].name if VX
  128.     @sprite_layout[0] = Plane.new
  129.     @sprite_layout[1] = Plane.new
  130.     @sprite_layout[2] = Plane.new
  131.     @sprite_layout[3] = Plane.new
  132.     @sprite_layout[4] = Sprite.new
  133.     @sprite_layout[5] = Sprite.new
  134.     @sprite_layout[0].bitmap = Bitmap.new(*@resolution)
  135.     @sprite_layout[1].bitmap = Bitmap.new(*@resolution)
  136.     @sprite_layout[3].bitmap = Bitmap.new(*@resolution)
  137.     @sprite_layout[4].bitmap = Bitmap.new(*@resolution)
  138.     @sprite_layout[5].bitmap = Bitmap.new(*@resolution)
  139.     r = [@sprite_layout[0].bitmap.rect,$image_drg_menu[5].dup.rect]
  140.     @sprite_layout[0].bitmap.stretch_blt(r[0],$image_drg_menu[5].dup,r[1])
  141.     @sprite_layout[1].bitmap.stretch_blt(r[0],$image_drg_menu[0].dup,r[1])
  142.     @sprite_layout[2].bitmap = $image_drg_menu[1].dup
  143.     @sprite_layout[3].bitmap.stretch_blt(r[0],$image_drg_menu[2].dup,r[1])
  144.     @sprite_layout[4].bitmap.stretch_blt(r[0],$image_drg_menu[3].dup,r[1])
  145.     @sprite_layout[5].bitmap.stretch_blt(r[0],$image_drg_menu[4].dup,r[1])
  146.     @sprite_layout[2].opacity = 70
  147.     @sprite_layout[3].opacity = 250
  148.     @sprite_layout[4].y -= 50
  149.     @sprite_layout[5].y += 50
  150.     s = @sprite_layout[4].bitmap
  151.     s.font.italic = true
  152.     s.font.bold = true
  153.     s.font.size = 22-4
  154.     draw_hemming_text(s,377-(45),0,254,36,'Location :') if VX
  155.     draw_hemming_text(s,377-(0),0,254,36,'Location :') if !VX
  156.     s.font.size = 20-4
  157.     s.draw_text((377+92)-(38),2,254,36,"#{map}")   if VX
  158.     s.draw_text((377+92)-(0),2,254,36,"#{map}")   if !VX
  159.     s = @sprite_layout[5].bitmap
  160.     s.font.italic = true
  161.     s.font.bold = true
  162.     s.font.size = 22-4
  163.     draw_hemming_text(s,9,@resolution[1]-30,254,36,'Gold :')
  164.     s.font.size = 20-4
  165.     s.draw_text(9+60,@resolution[1]-29,204,36,"#{$game_party.gold}")
  166.     @sprite_layout.each_with_index {|s,i| s.z = 5-i}
  167.     @sprite_layout[3].z = 4
  168.     @sprite_layout[4].z = 10
  169.     @sprite_layout[5].z = 10
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● update_sprite_layout
  173.   #--------------------------------------------------------------------------
  174.   def update_sprite_layout
  175.     update_layout_position
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # * Create Arrow
  179.   #--------------------------------------------------------------------------
  180.   def create_arrow
  181.     @resolution = VX ? [Graphics.width,Graphics.height] : [640,480]  
  182.     @sprite_arrow = Sprite.new
  183.     if $arrow_drg_menu.nil?
  184.       bit = $game_system.windowskin_name                   if !VX
  185.       bit = [windowskin(bit),Rect.new(160,96,32,32)]       if !VX
  186.       bit = [Cache.system("Window"),Rect.new(96,80,16,16)] if VX
  187.       @sprite_arrow.bitmap = Bitmap.new(32, 32)
  188.       @sprite_arrow.bitmap.stretch_blt(@sprite_arrow.bitmap.rect,bit[0],bit[1])
  189.       bit = @sprite_arrow.bitmap
  190.       copy = bit.clone
  191.       (0...bit.height).each{|i|(0...bit.width).each{|j|
  192.           bit.set_pixel(bit.width-i-1,j,copy.get_pixel(j,i))}}
  193.       $arrow_drg_menu = bit.dup
  194.     else
  195.       @sprite_arrow.bitmap = $arrow_drg_menu.dup
  196.     end
  197.     @sprite_arrow.mirror = true if VX
  198.     @sprite_arrow.x -= 100
  199.     @sprite_arrow.z = 7
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # * Create Spriteset
  203.   #--------------------------------------------------------------------------
  204.   def create_spriteset
  205.     @spriteset = Spriteset_Map.new if !VX
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # * Create Menu
  209.   #--------------------------------------------------------------------------
  210.   def create_menu
  211.     @sprite_menu = []
  212.     @index = 0
  213.     @menu = LiTTleDRAgo::SCENE_MENU
  214.     @menu.each {|a| b = @menu[@index]
  215.        @sprite_menu[@index] = Window_Base.new(-200-50*@index,(48*@index)+5,160,48)
  216.        @sprite_menu[@index].contents = Bitmap.new(160-32,16)
  217.        @sprite_menu[@index].back_opacity = 180
  218.        @sprite_menu[@index].contents.font.size = 18
  219.        @sprite_menu[@index].contents.font.bold = true
  220.        @sprite_menu[@index].contents.font.color =
  221.        @sprite_menu[@index].disabled_color if (b[3] && !condition_eval(b[3]))||
  222.                                       (b[2] && actors.size == 0)
  223.        @sprite_menu[@index].contents.draw_text(0,0,160-32,16,b[0],1)
  224.        @sprite_menu[@index].z = 6
  225.        @index += 1}
  226.     @index = 0
  227.     @column_max = 1
  228.     @item_max =  @sprite_menu.size
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # * Create Player
  232.   #--------------------------------------------------------------------------
  233.   def create_player
  234.     @sprite_player = []
  235.     actors.each_with_index {|a,i|
  236.       @sprite_player[i] = Window_Base.new(400+240+(30*i),(80*i)+80,240,80)if !VX
  237.       @sprite_player[i] = Window_Base.new(280+240+(30*i),(80*i)+80,240,80)if VX
  238.       @sprite_player[i].contents = Bitmap.new(240-32,80-32)
  239.       @sprite_player[i].back_opacity = 180
  240.       @sprite_player[i].z = 6
  241.       face = windowskin("Hud_Face#{a.id}") rescue '3x234572se3'
  242.       if face == '3x234572se3'
  243.         @sprite_player[i].instance_variable_set(:@placeholderface,true)
  244.         face = sprite_character(a)
  245.       end
  246.       x = 60
  247.       @sprite_player[i].instance_variable_set(:@placeholderx, x)
  248.       @sprite_player[i].contents.font.size = 18
  249.       @sprite_player[i].contents.font.bold = true
  250.       @sprite_player[i].contents.draw_text(x,0-10+16*0,100,32,a.name)
  251.       bitmaphp = create_hp_bar(a,0)
  252.       bitmapsp = create_hp_bar(a,1)
  253.       numberhp = create_hp_number(a,0)
  254.       numbersp = create_hp_number(a,1)
  255.       @sprite_player[i].contents.blt(5,2,face,face.rect)
  256.       @sprite_player[i].contents.blt(x,2+16*1,bitmaphp,bitmaphp.rect)
  257.       @sprite_player[i].contents.blt(x,11,numberhp,numberhp.rect)
  258.       @sprite_player[i].contents.blt(x,2+16*2,bitmapsp,bitmapsp.rect)
  259.       @sprite_player[i].contents.blt(x,27,numbersp,numbersp.rect)      }
  260.     @index_player = 0
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # * Update Player
  264.   #--------------------------------------------------------------------------
  265.   def update_player
  266.     @sprite_player.each_with_index {|s,i| a = actors[i]
  267.       bitmaphp = create_hp_bar(a,0)
  268.       bitmapsp = create_hp_bar(a,1)
  269.       numberhp = create_hp_number(a,0)
  270.       numbersp = create_hp_number(a,1)
  271.       x = s.instance_variable_get(:@placeholderx) || 0
  272.       s.contents.blt(x,2+16*1,bitmaphp,bitmaphp.rect)
  273.       s.contents.blt(x,11,numberhp,numberhp.rect)
  274.       s.contents.blt(x,2+16*2,bitmapsp,bitmapsp.rect)
  275.       s.contents.blt(x,27,numbersp,numbersp.rect)
  276.       if s.instance_variable_get(:@placeholderface) #&& !VX
  277.         face = sprite_character(a)
  278.         s.contents.blt(5,2,face,face.rect)
  279.       end }
  280.     @timer = (@timer||0) + 1
  281.     if !@timer || @timer % 8 == 0
  282.       @pattern = (@pattern||0) + 1
  283.       @pattern = 0 if @pattern >= 4
  284.     end
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # * Create HP Bar
  288.   #--------------------------------------------------------------------------
  289.   def create_hp_bar(a,type=0)  
  290.     @flow = (@flow||0) + 1
  291.     hpbar = windowskin(LiTTleDRAgo::BAR_IMAGES)
  292.     hpmet = type == 0 ? windowskin(LiTTleDRAgo::HP_METER_IMAGE) :  
  293.                         windowskin(LiTTleDRAgo::SP_METER_IMAGE)
  294.     sp = VX ? a.mp/a.maxmp : a.sp/a.maxsp
  295.     hprect = type == 0 ? Rect.new(@flow,0,hpbar.width*a.hp/a.maxhp,hpbar.height) :
  296.                          Rect.new(@flow,0,hpbar.width*sp,hpbar.height)  
  297.     @flow = 0 if @flow >= hprect.width*1.65
  298.     bit = Bitmap.new(hpbar.width, hpbar.height)
  299.     bit.blt(0,0,hpbar,hpbar.rect)
  300.     bit.blt(3,2,hpmet,hprect)
  301.     bitmaphp = Bitmap.new(100, hpbar.height)
  302.     bitmaphp.stretch_blt(bitmaphp.rect, bit, bit.rect)
  303.     return bitmaphp
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # * Create HP Number  
  307.   #--------------------------------------------------------------------------  
  308.   def create_hp_number(actor,type=0)
  309.     number_image = windowskin(LiTTleDRAgo::NUMBER_IMAGE)
  310.     hp_number = Bitmap.new(number_image.width,number_image.height)
  311.     im_cw = hp_number.width / 10
  312.     im_ch = hp_number.height / 2    
  313.     hp_src_rect = Rect.new(im_cw,0, im_cw, im_ch)
  314.     sp = VX ? [actor.mp,actor.maxmp] : [actor.sp,actor.maxsp]
  315.     hp_number_text = type == 0 ? actor.hp.abs.to_s.split(//)  :
  316.                                  sp[0].abs.to_s.split(//)
  317.     lowhp2 = type == 0 ? actor.maxhp * 30 / 100 : sp[1] * 30 / 100
  318.     hp_health = hp_number_text.join.to_i < lowhp2 ? im_ch : 0
  319.     (0..hp_number_text.size-1).each {|r|        
  320.       hp_src_rect = Rect.new(im_cw*hp_number_text[r].to_i,hp_health,im_cw,im_ch)
  321.       hp_number.blt(20 +((im_cw-7)*r), 0, number_image, hp_src_rect) }
  322.     return hp_number
  323.   end  
  324.   #--------------------------------------------------------------------------
  325.   # ● sprite_character
  326.   #--------------------------------------------------------------------------
  327.   def sprite_character(actor)
  328.     if VX
  329.       bit = cache.character(actor.character_name)  
  330.       sign = actor.character_name[/^[\!\$]./]
  331.       if sign != nil and sign.include?('$')
  332.         cw = [bit.width / 3,bit.height / 4]
  333.       else
  334.         cw = [bit.width / 12,bit.height / 8]
  335.       end
  336.       index = actor.character_index
  337.       pattern = (@pattern||0) < 3 ? (@pattern||0) : 1
  338.       sx = [(index % 4 * 3 + pattern) * cw[0],
  339.         (index / 4 * 4 + (2 - 2) / 2) * cw[1]]
  340.       rect = Rect.new(sx[0], sx[1], cw[0], cw[1])
  341.       bitmap = Bitmap.new(*cw)
  342.       bitmap.blt(0,0,bit,rect)
  343.       return bitmap
  344.     end
  345.     bit = cache.character(actor.character_name,0) if !VX
  346.     cw = [bit.width / 4, bit.height / 4]
  347.     sx = [(@pattern||0) * cw[0], (2 - 2) / 2 * cw[1]]
  348.     rect = Rect.new(sx[0], sx[1], cw[0], cw[1])
  349.     bitmap = Bitmap.new(*cw)
  350.     bitmap.blt(0,0,bit,rect)
  351.     return bitmap
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● Draw Hemming Text
  355.   #--------------------------------------------------------------------------
  356.   def draw_hemming_text(obj, x, y, w, h, text, align = 0)
  357.     original_color = obj.font.color.dup
  358.     obj.font.color = Color.new(0,0,0,255)
  359.     obj.draw_text(x  , y  , w, h, text.to_s, align)
  360.     obj.draw_text(x  , y+2, w, h, text.to_s, align)
  361.     obj.draw_text(x+2, y+2, w, h, text.to_s, align)
  362.     obj.draw_text(x+2, y  , w, h, text.to_s, align)
  363.     obj.font.color = original_color
  364.     obj.draw_text(x+1, y+1, w, h, text.to_s, align)
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● update_premenu
  368.   #--------------------------------------------------------------------------
  369.   def update_premenu
  370.     while @sprite_menu[-1].x < 50 && @sprite_arrow.x < 5
  371.       @sprite_menu.each {|s| s.x = [s.x+40,50].min }
  372.       @sprite_player.each {|s| s.x = [s.x-30,400].max } if !VX
  373.       @sprite_player.each {|s| s.x = [s.x-30,280].max } if VX
  374.       @sprite_arrow.x = [@sprite_arrow.x+3,5].min
  375.       @sprite_arrow.y = 16
  376.       update_layout_position
  377.       update_grafis
  378.     end
  379.     update_arrow
  380.     while @sprite_layout[4].y != 0
  381.       update_layout_position
  382.       update_grafis
  383.       @sprite_layout[4].y = [@sprite_layout[4].y+1,0].min
  384.       @sprite_layout[5].y = [@sprite_layout[5].y-1,0].max
  385.     end
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # ● dispose_premenu
  389.   #--------------------------------------------------------------------------
  390.   def dispose_premenu
  391.     while @sprite_menu[-1].x > -200
  392.       @sprite_menu.each_with_index {|s,i| s.x = s.x-(40+i*10) }
  393.       @sprite_player.each {|s| s.x = s.x+40 }
  394.       @sprite_layout[4].y -= 5
  395.       @sprite_layout[5].y += 5
  396.       @sprite_arrow.x -= 15
  397.       update_layout_position
  398.       update_grafis
  399.     end
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # ● dispose_freeze
  403.   #--------------------------------------------------------------------------
  404.   def dispose_freeze
  405.     Graphics.freeze
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● Frame Dispose
  409.   #--------------------------------------------------------------------------
  410.   def dispose
  411.     @all_sprite = [@sprite_arrow,@sprite_menu,@sprite_player,@spriteset,@sprite_layout]
  412.     @all_sprite.flatten.compact.each {|s|s.dispose}
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● update_arrow
  416.   #--------------------------------------------------------------------------
  417.   def update_arrow
  418.     if !@status_active
  419.       @sprite_arrow.x = [@sprite_arrow.x-10, 5].max
  420.       @sprite_arrow.y = @sprite_menu[@index].y + 10
  421.       @sprite_menu.each {|s| s.y -= 10} if @sprite_arrow.y > @resolution[1]-(40+34)
  422.       @sprite_menu.each {|s| s.y += 10} if @sprite_arrow.y < 0+10
  423.     else
  424.       @sprite_arrow.x = [@sprite_arrow.x+10,@sprite_player[@index_player].x-40].min
  425.       @sprite_arrow.y = @sprite_player[@index_player].y + 15
  426.       @sprite_player.each {|s| s.y -= 10} if @sprite_arrow.y > @resolution[1]-60
  427.       @sprite_player.each {|s| s.y += 10} if @sprite_arrow.y < 0+(10+34)
  428.     end
  429.     update_sprite_layout
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ● update_layout_position
  433.   #--------------------------------------------------------------------------
  434.   def update_layout_position
  435.     @sprite_layout[0].oy += 1
  436.     @sprite_layout[1].oy -= 1
  437.     @sprite_layout[2].ox += 1
  438.     @sprite_layout[2].oy += 1
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● condition_eval
  442.   #--------------------------------------------------------------------------
  443.   def condition_eval(ev='')
  444.     return true if ev.nil?
  445.     return ev if !ev.is_a?(String)
  446.     return eval (ev)
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # ● se_play
  450.   #--------------------------------------------------------------------------
  451.   def se_play(type)
  452.     a = [$game_system,$data_system]
  453.     case type
  454.     when :cursor   : VX ? Sound.play_cursor   : a[0].se_play(a[1].cursor_se)
  455.     when :decision : VX ? Sound.play_decision : a[0].se_play(a[1].decision_se)
  456.     when :cancel   : VX ? Sound.play_cancel   : a[0].se_play(a[1].cancel_se)
  457.     when :buzzer   : VX ? Sound.play_buzzer   : a[0].se_play(a[1].buzzer_se)
  458.     end
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # ● update_index
  462.   #--------------------------------------------------------------------------
  463.   def update_index
  464.     if Input.repeat?(Input::DOWN)
  465.       if (@column_max == 1 && Input.trigger?(Input::DOWN)) ||
  466.           @index < @item_max - @column_max
  467.         se_play(:cursor)
  468.         !@status_active ? @index = (@index + @column_max) % @item_max :
  469.             @index_player = (@index_player + @column_max) % @item_max
  470.       end
  471.       return
  472.     end
  473.     if Input.repeat?(Input::UP)
  474.       if (@column_max == 1 && Input.trigger?(Input::UP)) ||
  475.           @index >= @column_max
  476.         se_play(:cursor)
  477.         !@status_active ? @index = (@index - @column_max) % @item_max :
  478.             @index_player = (@index_player - @column_max) % @item_max
  479.       end
  480.       return
  481.     end
  482.     if Input.trigger?(Input::B)
  483.       se_play(:cancel)
  484.       if !@status_active
  485.         $scene = Scene_Map.new
  486.       else
  487.         @status_active = false
  488.         @item_max = @sprite_menu.size
  489.       end
  490.     end
  491.     if Input.trigger?(Input::C)
  492.       if !condition_eval(@menu[@index][3]) ||
  493.         (@menu[@index][2] && @sprite_player.size == 0)
  494.         return se_play(:buzzer)
  495.       end
  496.       if !@status_active
  497.         if !@menu[@index][2] || @sprite_player.size == 1
  498.           se_play(:decision)
  499.           $scene = @menu[@index][1].new
  500.         elsif @menu[@index][2] == :actor
  501.           se_play(:decision)
  502.           @status_active = true
  503.           @item_max = @sprite_player.size
  504.         elsif @menu[@index][2].is_a?(Array)
  505.           se_play(:decision)
  506.           $scene = @menu[@index][1].new(*@menu[@index][2])
  507.         end
  508.       else
  509.         se_play(:decision)
  510.         @status_active = false
  511.         @sprite_arrow.opacity = 0
  512.         $scene = @menu[@index][1].new(@index_player)
  513.       end
  514.     end
  515.   end
  516. end
  517.  
  518. $drago_simple_cms = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement