Advertisement
Kakakadafi

[Overwrite] GamePad Extender

Oct 20th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 28.65 KB | None | 0 0
  1. #==============================================================================
  2. # Gamepad Extender Game Adapter
  3. # by Jono99
  4. #------------------------------------------------------------------------------
  5. # This allows the game commands to be handled in a way more friendly to controller
  6. # input. Based off Gamepad Extender by Lone Wolf and requires Gamepad Extender
  7. # in order to function.
  8. # Link to download Gamepad Extender: http://forums.rpgmakerweb.com/index.php?/topic/1284-gamepad-extender-v11-2202015/
  9. #------------------------------------------------------------------------------
  10. # Changelog
  11. # 1.0.0: Initial release
  12. # 1.0.1: Fixed bug where the save menu would not accept input from the analogue stick and the dpad's input would be duplicated (only occured when MenuInput was set to 2)
  13. # 1.0.2: Removed checks to see if values in GEGAOptions are acceptable values (they caused a problem where the script would not run in StartForPause was set to false)
  14. #==============================================================================
  15. module GEGAOptions
  16.   # Use the Start button instead of the B button to pause the game
  17.   StartForPause = true
  18.  
  19.   # Determine what input device is used for the menus.
  20.   # 0 for just the dpad
  21.   # 1 for just the left analogue stick
  22.   # 2 for both
  23.   MenuInput = 2
  24.  
  25.   # Determine what input device is used for moving around the map.
  26.   # 0 for just the dpad
  27.   # 1 for just the left analogue stick
  28.   # 2 for both
  29.   MoveInput = 2
  30. end
  31.  
  32. #==============================================================================
  33. # DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING!
  34. #==============================================================================
  35. if defined?(WolfPad) == nil
  36.   msgbox("WARNING: GamePad Extender is either missing or executes sometime after this. To avoid issues, GE Game Adapter will not execute!")
  37. else
  38.   module WolfPad
  39.     def self.dird4(p_i = 0)
  40.       if press?(:UP, p_i)
  41.        8
  42.       elsif press?(:RIGHT, p_i)
  43.        6
  44.       elsif press?(:LEFT, p_i)
  45.        4
  46.       elsif press?(:DOWN, p_i)
  47.        2
  48.       else
  49.        0
  50.       end
  51.     end
  52.     def self.dird8(p_i = 0)
  53.       if press?(:UP, p_i) and press?(:LEFT, p_i)
  54.        7
  55.       elsif press?(:UP, p_i) and press?(:RIGHT, p_i)
  56.        9
  57.       elsif press?(:DOWN, p_i) and press?(:LEFT, p_i)
  58.        1
  59.       elsif press?(:DOWN, p_i) and press?(:RIGHT, p_i)
  60.        3
  61.      else
  62.        dird4(p_i)
  63.       end
  64.     end
  65.   end
  66.    
  67. class Game_Player < Game_Character
  68.   # Update input for bringing up the quick tool menu
  69.   def update_quick_tool_button
  70.       if Input.trigger?(QUICK_TOOL_SELECT::QUICK_TOOL_SELECT_BUTTON)
  71.          return unless can_use_quick_tool_button?        
  72.          SceneManager.call(Scene_Quick_Skill_Tool)
  73.       end
  74.   end
  75.   # Update input for picking up objects
  76.   def update_pickup_command
  77.       if Input.trigger?(PadConfig.confirm)
  78.          throw_event if can_check_throw_event?
  79.          check_event_pickup([0,1,2]) if can_check_pickup_event?
  80.       end
  81.   end
  82.    
  83.   # Update input for backdash
  84.   def update_backdash_button # And front dash!
  85.     backdash_distance = 2 # Also used as frontdash distance
  86.     if @backdash_cooldown # Also used as frontdash cooldown
  87.       @backdash_cooldown -= 1
  88.       return if @backdash_cooldown > 0
  89.     end
  90.     if Input.trigger?(PadConfig.dash)
  91.       if backstep_accessories_equipped?
  92.         @backdash_cooldown = 27
  93.         # YIN
  94.         pose_suffix = Kadafi::DashBackSuffix
  95.         make_pose(pose_suffix, @backdash_cooldown - 12)
  96.         image_only_on_dash(true)
  97.         Audio.se_play('Audio/ME/dash', 80, 150)
  98.         d = 10 - direction
  99.         a = 0
  100.         if @diagonal_direction != 0
  101.           backdash_distance = (backdash_distance * OrangeMovement::Tile_Sections/Math.sqrt(2)).to_i/OrangeMovement::Tile_Sections
  102.         end
  103.         backdash_distance.times do
  104.           OrangeMovement::Tile_Sections.times do
  105.             if @diagonal_direction != 0
  106.               case @diagonal_direction
  107.                 when 1
  108.                   if (diagonal_passable?(@x+a, @y-a, 6, 8) && diagonal_passable?(@x+(a*2), @y-(a*2), 6, 8))
  109.                     a += (my_step_size * 2)
  110.                   elsif diagonal_passable?(@x+a, @y-a, 6, 8)
  111.                     a += my_step_size
  112.                   end
  113.                 when 3
  114.                   if (diagonal_passable?(@x-a, @y-a, 4, 8) && diagonal_passable?(@x-(a*2), @y-(a*2), 4, 8))
  115.                     a += (my_step_size * 2)
  116.                   elsif diagonal_passable?(@x-a, @y-a, 4, 8)
  117.                     a += my_step_size
  118.                   end
  119.                 when 7
  120.                   if (diagonal_passable?(@x+a, @y+a, 6, 2) && diagonal_passable?(@x+(a*2), @y+(a*2), 6, 2))
  121.                     a += (my_step_size * 2)
  122.                   elsif diagonal_passable?(@x+a, @y+a, 6, 2)
  123.                     a += my_step_size
  124.                   end
  125.                 when 9
  126.                   if (diagonal_passable?(@x-a, @y+a, 4, 2) && diagonal_passable?(@x-(a*2), @y+(a*2), 4, 2))
  127.                     a += (my_step_size * 2)
  128.                   elsif diagonal_passable?(@x-a, @y+a, 4, 2)
  129.                     a += my_step_size
  130.                   end
  131.               end
  132.             else
  133.               case @direction
  134.                 when 2; a += my_step_size if passable?(@x, @y-a, d)
  135.                 when 4; a += my_step_size if passable?(@x+a, @y, d)
  136.                 when 6; a += my_step_size if passable?(@x-a, @y, d)
  137.                 when 8; a += my_step_size if passable?(@x, @y+a, d)
  138.               end
  139.             end  
  140.           end
  141.         end
  142.         if @diagonal_direction != 0
  143.           case @diagonal_direction
  144.             when 1
  145.               @x += a
  146.               @y -= a
  147.             when 3
  148.               @x -= a
  149.               @y -= a
  150.             when 7
  151.               @x += a
  152.               @y += a
  153.             when 9      
  154.               @x -= a
  155.               @y += a
  156.           end
  157.         else
  158.           case @direction
  159.             when 2
  160.               @x += 0
  161.               @y -= a
  162.             when 8
  163.               @x += 0
  164.               @y += a
  165.             when 4
  166.               @x += a
  167.               @y += 0
  168.             when 6
  169.               @x -= a
  170.               @y += 0
  171.           end
  172.         end              
  173.         @jump_peak = 3 + a.abs - @move_speed
  174.   #~       p @jump_peak
  175.         @jump_count = @jump_peak * 3.9
  176.         @stop_count = 0
  177.         straighten
  178.        
  179.       # Front Dash
  180.       elsif forwardstep_accessories_equipped?
  181.         @backdash_cooldown = 27
  182.         # YIN
  183.         pose_suffix = Kadafi::DashForwardSuffix
  184.         make_pose(pose_suffix, @backdash_cooldown - 12)
  185.         image_only_on_dash(true)
  186.         Audio.se_play('Audio/ME/dash', 80, 150)
  187.         d = direction
  188.         a = 0
  189.         if @diagonal_direction != 0
  190.           backdash_distance = (backdash_distance * OrangeMovement::Tile_Sections/Math.sqrt(2)).to_i/OrangeMovement::Tile_Sections
  191.         end
  192.         backdash_distance.times do
  193.           OrangeMovement::Tile_Sections.times do
  194.             if @diagonal_direction != 0
  195.               case @diagonal_direction
  196.                 when 1
  197.                   if (diagonal_passable?(@x-a, @y+a, 6, 8) && diagonal_passable?(@x-(a*2), @y+(a*2), 6, 8))
  198.                     a += (my_step_size * 2)
  199.                   elsif diagonal_passable?(@x-a, @y+a, 6, 8)
  200.                     a += my_step_size
  201.                   end
  202.                 when 3
  203.                   if (diagonal_passable?(@x+a, @y+a, 4, 8) && diagonal_passable?(@x+(a*2), @y+(a*2), 4, 8))
  204.                     a += (my_step_size * 2)
  205.                   elsif diagonal_passable?(@x+a, @y+a, 4, 8)
  206.                     a += my_step_size
  207.                   end
  208.                 when 7
  209.                   if (diagonal_passable?(@x-a, @y-a, 6, 2) && diagonal_passable?(@x-(a*2), @y-(a*2), 6, 2))
  210.                     a += (my_step_size * 2)
  211.                   elsif diagonal_passable?(@x-a, @y-a, 6, 2)
  212.                     a += my_step_size
  213.                   end
  214.                 when 9
  215.                   if (diagonal_passable?(@x+a, @y-a, 4, 2) && diagonal_passable?(@x+(a*2), @y-(a*2), 4, 2))
  216.                     a += (my_step_size * 2)
  217.                   elsif diagonal_passable?(@x+a, @y-a, 4, 2)
  218.                     a += my_step_size
  219.                   end
  220.               end
  221.             else
  222.               case @direction
  223.                 when 2; a += my_step_size if passable?(@x, @y+a, d)
  224.                 when 4; a += my_step_size if passable?(@x-a, @y, d)
  225.                 when 6; a += my_step_size if passable?(@x+a, @y, d)
  226.                 when 8; a += my_step_size if passable?(@x, @y-a, d)
  227.               end
  228.             end  
  229.           end
  230.         end
  231.         if @diagonal_direction != 0
  232.           case @diagonal_direction
  233.             when 1
  234.               @x -= a
  235.               @y += a
  236.             when 3
  237.               @x += a
  238.               @y += a
  239.             when 7
  240.               @x -= a
  241.               @y -= a
  242.             when 9      
  243.               @x += a
  244.               @y -= a
  245.           end
  246.         else
  247.           case @direction
  248.             when 2
  249.               @x += 0
  250.               @y += a
  251.             when 8
  252.               @x += 0
  253.               @y -= a
  254.             when 4
  255.               @x -= a
  256.               @y += 0
  257.             when 6
  258.               @x += a
  259.               @y += 0
  260.           end
  261.         end              
  262.         @jump_peak = 3 + a.abs - @move_speed
  263.         @jump_count = @jump_peak * 3.9
  264.         @stop_count = 0
  265.         straighten
  266.       end
  267.     end  
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # * Processing When Not Moving
  271.   #     last_moving : Was it moving previously?
  272.   #--------------------------------------------------------------------------
  273.   def update_nonmoving(last_moving)
  274.     return if $game_map.interpreter.running?
  275.     if last_moving
  276.       $game_party.on_player_walk
  277.       return if check_touch_event
  278.     end
  279.     if movable? && Input.trigger?(PadConfig.confirm)
  280.       return if get_on_off_vehicle
  281.       return if check_action_event
  282.     end
  283.     update_encounter if last_moving
  284.   end
  285.    
  286.   # YIN XAS and other stuff that requires input
  287.   alias input_dash? dash?
  288.   def dash?
  289.     if rush_accessories_equipped? && Input.press?(PadConfig.dash)
  290.       return true if @rush_delay > Kadafi::RushDelay
  291.       return false if @rush_delay == 0
  292.     end
  293.     return input_dash?
  294.   end
  295.      
  296. #~   def update_charge_button
  297. #~     return unless can_charge_command?
  298. #~     if Input.press?(PadConfig.attack) and ENABLE_ACTION_1_BUTTON
  299. #~         update_charge_effect(0)
  300. #~         reset_charge_temp if Input.press?(PadConfig.attack2) and ENABLE_ACTION_2_BUTTON
  301. #~     elsif Input.press?(PadConfig.attack2)
  302. #~         update_charge_effect(1)
  303. #~         reset_charge_temp if Input.press?(PadConfig.attack)
  304. #~     else
  305. #~         if self.battler.x_charge_action[2] >= self.battler.x_charge_action[1]
  306. #~           self.shoot(self.battler.x_charge_action[0])
  307. #~         end
  308. #~       reset_charge_temp
  309. #~     end
  310. #~   end
  311.  
  312.   def update_change_leader_button
  313.     if Input.trigger?(PadConfig.page_down)
  314.         return unless can_use_change_leader_command?
  315.         change_leader    
  316.     end
  317.   end
  318.  
  319.   def update_action_1_button
  320.     if Input.trigger?(PadConfig.attack)
  321.         type = 0
  322.         return unless can_use_weapon_command?
  323.         return if execute_combo?(type)
  324.         check_equipped_action(type)
  325.         action_id = self.battler.x_action1_id
  326.         return if action_id == 0
  327.         return if state_seal_command?(type)
  328.         self.shoot(action_id)
  329.     end  
  330.   end
  331.  
  332. #~   def update_action_2_button
  333. #~     if Input.trigger?(PadConfig.attack2)
  334. #~         if self.battler.equips[1].is_a?(RPG::Weapon)
  335. #~           type = 1
  336. #~           return unless can_use_weapon_command?
  337. #~           return if execute_combo?(type)
  338. #~           check_equipped_action(type)
  339. #~           action_id = self.battler.x_action2_id
  340. #~           return if action_id == 0
  341. #~           return if state_seal_command?(type)            
  342. #~           self.shoot(action_id)
  343. #~           return
  344. #~         end  
  345. #~     end        
  346. #~     update_shield_button
  347. #~   end
  348.  
  349. #~   def update_shield_button
  350. #~     if Input.press?(PadConfig.attack2)
  351. #~       if can_use_shield_command?
  352. #~         unless self.battler.shield  
  353. #~           shield = self.battler.equips[1]
  354. #~           if shield.note =~ /<Action>/
  355. #~             if shield.note =~ /<Pose = (\w+)>/
  356. #~               make_pose($1.to_s, 2)
  357. #~             end
  358. #~           else  
  359. #~             self.battler.shield = false
  360. #~             return
  361. #~           end
  362. #~         end
  363. #~         self.x_pose_duration = 2
  364. #~         self.battler.shield = true
  365. #~         update_shield_diretion_button
  366. #~       else
  367. #~         self.battler.shield = false
  368. #~       end
  369. #~     else  
  370. #~       self.battler.shield = false
  371. #~     end      
  372. #~   end
  373.  
  374.   def update_skill_button
  375.     if Input.press?(PadConfig.skill)
  376.       type = 2
  377.       return unless can_use_skill_command?
  378.       return if execute_combo?(type)
  379.       check_equipped_action(type)
  380.       action_id = self.battler.skill_id
  381.       return if action_id == 0
  382.       return if state_seal_command?(type)        
  383.       self.shoot(action_id)
  384.     elsif Input.press?(PadConfig.skill2)
  385.       type = 2
  386.       return unless can_use_skill_command?
  387.       return if execute_combo?(type)
  388.       check_equipped_action(type)
  389.       action_id = self.battler.skill2_id
  390.       return if action_id == 0
  391.       return if state_seal_command?(type)        
  392.       self.shoot(action_id)
  393.     end  
  394.   end
  395.  
  396. #~   def update_item_button
  397. #~     if (Input.press?(PadConfig.skill) && Input.trigger?(PadConfig.attack2))
  398. #~       type = 3        
  399. #~       return unless can_use_item_command?
  400. #~       return if execute_combo?(type)
  401. #~       check_equipped_action(type)
  402. #~       action_id = self.battler.x_item_id
  403. #~       return if action_id == 0
  404. #~       return if state_seal_command?(type)        
  405. #~       self.shoot(action_id)
  406. #~     end  
  407. #~   end
  408.  
  409.   def can_dash?
  410.     return false if @backdash_cooldown
  411.     return false unless XAS_BUTTON::ENABLE_DASH_BUTTON
  412.     return false if self.battler.shield
  413.     return true if Input.press?(PadConfig.dash)
  414.     @dash_active = false
  415.     return false
  416.   end
  417. end
  418.      
  419. class Window_Selectable
  420.   #--------------------------------------------------------------------------
  421.   # * Cursor Movement Processing
  422.   #--------------------------------------------------------------------------
  423.   def process_cursor_move
  424.     return unless cursor_movable?
  425.     last_index = @index
  426.     if WolfPad.plugged_in?
  427.       gega_process_cursor_move_input(:UP, :DOWN, :LEFT, :RIGHT) if GEGAOptions::MenuInput == 0 || GEGAOptions::MenuInput == 2
  428.       gega_process_cursor_move_input(:L_UP, :L_DOWN, :L_LEFT, :L_RIGHT) if GEGAOptions::MenuInput > 0
  429.     else
  430.       gega_process_cursor_move_input(:UP, :DOWN, :LEFT, :RIGHT)
  431.     end
  432.     cursor_pagedown   if !handle?(:pagedown) && Input.trigger?(PadConfig.page_down)
  433.     cursor_pageup     if !handle?(:pageup)   && Input.trigger?(PadConfig.page_up)
  434.     Sound.play_cursor if @index != last_index
  435.   end
  436. #~   def gega_process_cursor_move_input(up, down, left, right)
  437. #~     if PadConfig.move_down && PadConfig.move_down != :_down
  438. #~       cursor_down (Input.trigger?(PadConfig.move_down)) if Input.repeat?(PadConfig.move_down)
  439. #~     else
  440. #~       cursor_down (Input.trigger?(down)) if Input.repeat?(down)
  441. #~     end
  442. #~     if PadConfig.move_up && PadConfig.move_up != :_up
  443. #~       cursor_up   (Input.trigger?(PadConfig.move_up))    if Input.repeat?(PadConfig.move_up)
  444. #~     else
  445. #~       cursor_up   (Input.trigger?(up))    if Input.repeat?(up)
  446. #~     end
  447. #~     if PadConfig.move_right && PadConfig.move_right != :_right
  448. #~       cursor_right(Input.trigger?(PadConfig.move_right)) if Input.repeat?(PadConfig.move_right)
  449. #~     else
  450. #~       cursor_right(Input.trigger?(right)) if Input.repeat?(right)
  451. #~     end
  452. #~     if PadConfig.move_left && PadConfig.move_left != :_left
  453. #~       cursor_left(Input.trigger?(PadConfig.move_left)) if Input.repeat?(PadConfig.move_left)
  454. #~     else
  455. #~       cursor_left (Input.trigger?(left))  if Input.repeat?(left)
  456. #~     end
  457. #~   end
  458.   def gega_process_cursor_move_input(up, down, left, right)
  459.     pad_down = PadConfig.move_down && PadConfig.move_down != :_down
  460.     if Input.repeat?(down) || Input.repeat?(pad_down ? PadConfig.move_down : down)
  461.       cursor_down(Input.trigger?(down) || Input.trigger?(pad_down ? PadConfig.move_down : down))
  462.     end
  463.     pad_up = PadConfig.move_up && PadConfig.move_up != :_up
  464.     if Input.repeat?(up) || Input.repeat?(pad_up ? PadConfig.move_up : up)
  465.       cursor_up(Input.trigger?(up) || Input.trigger?(pad_up ? PadConfig.move_up : up))
  466.     end
  467.     pad_right = PadConfig.move_right && PadConfig.move_right != :_right
  468.     if Input.repeat?(right) || Input.repeat?(pad_right ? PadConfig.move_right : right)
  469.       cursor_right(Input.trigger?(right) || Input.trigger?(pad_right ? PadConfig.move_right : right))
  470.     end
  471.     pad_left = PadConfig.move_left && PadConfig.move_left != :_left
  472.     if Input.repeat?(left) || Input.repeat?(pad_left ? PadConfig.move_left : left)
  473.       cursor_left(Input.trigger?(left) || Input.trigger?(pad_left ? PadConfig.move_left : left))
  474.     end
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # * Handling Processing for OK and Cancel Etc.
  478.   #--------------------------------------------------------------------------
  479.   def process_handling
  480.     return unless open? && active
  481.     return process_ok       if ok_enabled?        && Input.trigger?(PadConfig.confirm)
  482.     return process_cancel   if cancel_enabled?    && Input.trigger?(PadConfig.cancel)
  483.     return process_pagedown if handle?(:pagedown) && Input.trigger?(PadConfig.page_down)
  484.     return process_pageup   if handle?(:pageup)   && Input.trigger?(PadConfig.page_up)
  485.   end
  486. end
  487.  
  488. class Window_ShopNumber
  489.     #--------------------------------------------------------------------------
  490.     # * Update Quantity
  491.     #--------------------------------------------------------------------------
  492.     def update_number
  493.       if WolfPad.plugged_in?
  494.         gega_update_number_input(:RIGHT, :LEFT, :UP, :DOWN) if GEGAOptions::MenuInput == 0 || GEGAOptions::MenuInput == 2
  495.         gega_update_number_input(:L_RIGHT, :L_LEFT, :L_UP, :L_DOWN) if GEGAOptions::MenuInput > 0
  496.       else
  497.         gega_update_number_input(:RIGHT, :LEFT, :UP, :DOWN)
  498.       end
  499.     end
  500.   end
  501.   def gega_update_number_input(right, left, up, down)
  502.     change_number(1)   if Input.repeat?(right)
  503.     change_number(-1)  if Input.repeat?(left)
  504.     change_number(10)  if Input.repeat?(up)
  505.     change_number(-10) if Input.repeat?(down)
  506.   end
  507.   class Window_NameInput
  508.     #--------------------------------------------------------------------------
  509.     # * Handling Processing for OK and Cancel Etc.
  510.     #--------------------------------------------------------------------------
  511.     def process_handling
  512.       return unless open? && active
  513.       process_jump if Input.trigger?(:_shift) && WolfPad.plugged_in? == false
  514.       process_back if Input.repeat?(PadConfig.cancel)
  515.       process_ok   if Input.trigger?(PadConfig.confirm)
  516.     end
  517.   end
  518.   class Window_NumberInput
  519.     #--------------------------------------------------------------------------
  520.     # * Cursor Movement Processing
  521.     #--------------------------------------------------------------------------
  522.     def process_cursor_move
  523.       return unless active
  524.       last_index = @index
  525.       if WolfPad.plugged_in?
  526.         gega_process_cursor_move_input(:LEFT, :RIGHT) if GEGAOptions::MenuInput == 0 || GEGAOptions::MenuInput == 2
  527.         gega_process_cursor_move_input(:L_LEFT, :L_RIGHT) if GEGAOptions::MenuInput > 0
  528.       else
  529.         gega_process_cursor_move_input(:LEFT, :RIGHT)
  530.       end
  531.       Sound.play_cursor if @index != last_index
  532.     end
  533. #~     def gega_process_cursor_move_input(left, right)
  534. #~       if PadConfig.move_right && PadConfig.move_right != :_right
  535. #~         cursor_right(Input.trigger?(PadConfig.move_right)) if Input.repeat?(PadConfig.move_right)
  536. #~       else
  537. #~         cursor_right(Input.trigger?(right)) if Input.repeat?(right)
  538. #~       end
  539. #~       if PadConfig.move_left && PadConfig.move_left != :_left
  540. #~         cursor_left(Input.trigger?(PadConfig.move_left)) if Input.repeat?(PadConfig.move_left)
  541. #~       else
  542. #~         cursor_left (Input.trigger?(left))  if Input.repeat?(left)
  543. #~       end
  544. #~     end
  545.   def gega_process_cursor_move_input(left, right)
  546.     pad_right = PadConfig.move_right && PadConfig.move_right != :_right
  547.     if Input.repeat?(right) || Input.repeat?(pad_right ? PadConfig.move_right : right)
  548.       cursor_right(Input.trigger?(right) || Input.trigger?(pad_right ? PadConfig.move_right : right))
  549.     end
  550.     pad_left = PadConfig.move_left && PadConfig.move_left != :_left
  551.     if Input.repeat?(left) || Input.repeat?(pad_left ? PadConfig.move_left : left)
  552.       cursor_left(Input.trigger?(left) || Input.trigger?(pad_left ? PadConfig.move_left : left))
  553.     end
  554.   end
  555.     #--------------------------------------------------------------------------
  556.     # * Change Processing for Digits
  557.     #--------------------------------------------------------------------------
  558.     def process_digit_change
  559.       return unless active
  560.       if WolfPad.plugged_in?
  561.         gega_process_digit_change_input(:UP, :DOWN) if GEGAOptions::MenuInput == 0 || GEGAOptions::MenuInput == 2
  562.         gega_process_digit_change_input(:L_UP, :L_DOWN) if GEGAOptions::MenuInput > 0
  563.       else
  564.         gega_process_digit_change_input(:UP, :DOWN)
  565.       end
  566.     end
  567.     def gega_process_digit_change_input(up, down)
  568.       if Input.repeat?(up) || Input.repeat?(down)
  569.         Sound.play_cursor
  570.         place = 10 ** (@digits_max - 1 - @index)
  571.         n = @number / place % 10
  572.         @number -= n * place
  573.         n = (n + 1) % 10 if Input.repeat?(up)
  574.         n = (n + 9) % 10 if Input.repeat?(down)
  575.         @number += n * place
  576.         refresh
  577.       end
  578.     end
  579.     #--------------------------------------------------------------------------
  580.     # * Handling Processing for OK and Cancel
  581.     #--------------------------------------------------------------------------
  582.     def process_handling
  583.       return unless active
  584.       return process_ok     if Input.trigger?(PadConfig.confirm)
  585.       return process_cancel if Input.trigger?(PadConfig.cancel)
  586.     end
  587.   end
  588.   class Window_Message
  589.     #--------------------------------------------------------------------------
  590.     # * Update Fast Forward Flag
  591.     #--------------------------------------------------------------------------
  592.     def update_show_fast
  593.       @show_fast = true if Input.trigger?(PadConfig.confirm)
  594.     end
  595.     #--------------------------------------------------------------------------
  596.     # * Input Pause Processing
  597.     #--------------------------------------------------------------------------
  598.     def input_pause
  599.       self.pause = true
  600.       wait(10)
  601.       Fiber.yield until Input.trigger?(PadConfig.cancel) || Input.trigger?(PadConfig.confirm)
  602.       Input.update
  603.       self.pause = false
  604.     end
  605.   end
  606.   class Window_ScrollText
  607.     #--------------------------------------------------------------------------
  608.     # * Determine if Fast Forward
  609.     #--------------------------------------------------------------------------
  610.     def show_fast?
  611.       !$game_message.scroll_no_fast && (Input.press?(PadConfig.dash) || Input.press?(PadConfig.confirm))
  612.     end
  613.   end
  614.   class Scene_Map
  615.     #--------------------------------------------------------------------------
  616.     # * Determine if Menu is Called due to Cancel Button
  617.     #--------------------------------------------------------------------------
  618.     def update_call_menu
  619.       if $game_system.menu_disabled || $game_map.interpreter.running?
  620.         @menu_calling = false
  621.       else
  622.         @menu_calling ||= Input.trigger?(PadConfig.cancel)
  623.         call_menu if @menu_calling && !$game_player.moving?
  624.       end
  625.     end
  626.   end
  627.   class Scene_File
  628.     #--------------------------------------------------------------------------
  629.     # * Update Save File Selection
  630.     #--------------------------------------------------------------------------
  631.     def update_savefile_selection
  632.       return on_savefile_ok     if Input.trigger?(PadConfig.confirm)
  633.       return on_savefile_cancel if Input.trigger?(PadConfig.cancel)
  634.       update_cursor
  635.     end
  636.     #--------------------------------------------------------------------------
  637.     # * Update Cursor
  638.     #--------------------------------------------------------------------------
  639.     def update_cursor
  640.       last_index = @index
  641.       if WolfPad.plugged_in?
  642.         gega_update_cursor_input(:UP, :DOWN) if GEGAOptions::MenuInput == 0 || GEGAOptions::MenuInput == 2
  643.         gega_update_cursor_input(:L_UP, :L_DOWN) if GEGAOptions::MenuInput > 0
  644.       else
  645.         gega_update_cursor_input(:UP, :DOWN)
  646.       end
  647.       cursor_pagedown   if Input.trigger?(PadConfig.page_down)
  648.       cursor_pageup     if Input.trigger?(PadConfig.page_up)
  649.       if @index != last_index
  650.         Sound.play_cursor
  651.         @savefile_windows[last_index].selected = false
  652.         @savefile_windows[@index].selected = true
  653.       end
  654.     end
  655.   end
  656.   def gega_update_cursor_input(up, down)
  657.     cursor_down (Input.trigger?(down))  if Input.repeat?(down)
  658.     cursor_up   (Input.trigger?(up))    if Input.repeat?(up)
  659.   end
  660.  
  661.   class Scene_Gameover
  662.     #--------------------------------------------------------------------------
  663.     # * Frame Update
  664.     #--------------------------------------------------------------------------
  665.     def update
  666.       super
  667.       goto_title if Input.trigger?(PadConfig.confirm)
  668.     end
  669.   end
  670.  
  671.   class Scene_Target_Select
  672.     def update_targe_select
  673.       if Input.trigger?(PadConfig.cancel)
  674.          cancel_select
  675.       elsif Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)  
  676.          @target_index += 1
  677.          select_target(0)
  678.          Sound.play_cursor
  679.       elsif Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
  680.          @target_index -= 1
  681.          select_target(1)
  682.          Sound.play_cursor
  683.       elsif Input.trigger?(PadConfig.confirm)
  684.          Sound.play_ok
  685.          SceneManager.call(Scene_Map)
  686.       end
  687.     end
  688.   end
  689. end
  690.  
  691. #~ class Scene_Quick_Skill_Tool
  692. #~   def update_skill_selection
  693. #~       if Input.trigger?(PadConfig.cancel)
  694. #~          Sound.play_cancel
  695. #~          SceneManager.call(Scene_Map)
  696. #~       elsif Input.trigger?(PadConfig.page_down) or Input.trigger?(PadConfig.page_up)
  697. #~          Sound.play_cursor
  698. #~          SceneManager.call(Scene_Quick_Item_Tool)
  699. #~       elsif Input.trigger?(PadConfig.confirm)
  700. #~          @skill = @skill_window.skill
  701. #~          return if @skill == nil
  702. #~          @actor.skill_id = @skill.id
  703. #~          Sound.play_equip    
  704. #~       end
  705. #~   end
  706. #~ end
  707.  
  708. #~ class Scene_Quick_Item_Tool < Scene_Base
  709. #~   def update_item_selection
  710. #~       if Input.trigger?(PadConfig.cancel)
  711. #~          Sound.play_cancel
  712. #~          SceneManager.call(Scene_Map)
  713. #~          return
  714. #~       elsif Input.trigger?(PadConfig.page_down) or Input.trigger?(PadConfig.page_up)
  715. #~          Sound.play_cursor
  716. #~          SceneManager.call(Scene_Quick_Skill_Tool)
  717. #~          return
  718. #~       elsif Input.trigger?(PadConfig.attack2)  
  719. #~             @item = @item_window.item
  720. #~             return if @item == nil
  721. #~             if @item.is_a?(RPG::Weapon)
  722. #~                if @actor.dual_wield?
  723. #~                   @actor.change_equip(1, @item)
  724. #~                else
  725. #~                   @actor.change_equip(0, @item)
  726. #~                end
  727. #~              elsif @item.is_a?(RPG::Armor)
  728. #~                    @actor.change_equip(1, @item)
  729. #~              elsif @item.is_a?(RPG::Item)  
  730. #~                    @actor.item_id = @item.id
  731. #~              end
  732. #~              Sound.play_equip
  733. #~             return
  734. #~       elsif Input.trigger?(PadConfig.confirm)
  735. #~          @item = @item_window.item
  736. #~          return if @item == nil
  737. #~          case @item
  738. #~               when RPG::Item
  739. #~                 @actor.item_id = @item.id
  740. #~               when RPG::Weapon
  741. #~                 @actor.change_equip(0, @item)                
  742. #~               when RPG::Armor
  743. #~                 @actor.change_equip(1, @item)
  744. #~           end        
  745. #~          Sound.play_equip
  746. #~          @item_window.refresh
  747. #~          return
  748. #~       end
  749. #~   end
  750. #~ end
  751.  
  752. class M_logo
  753.   def update_skip_logo
  754.       return if !SKIP_BUTTON
  755.       return if @logo_data[1] > @logos.size
  756.       if Input.press?(PadConfig.confirm) or Input.press?(PadConfig.cancel)
  757.       @logo_data[0] = @logo_data[2] + 10 ; @logo_data[1] = @logos.size + 1
  758.       end
  759.   end
  760.  
  761.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement