Advertisement
F117Landers

(SSMS) Mouse 3

Jul 9th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 32.40 KB | None | 0 0
  1. WORLD_MAP_ID = 1
  2.  
  3. #==============================================================================
  4. # ** Game_Map
  5. #==============================================================================
  6.  
  7. class Game_Map  
  8.     #--------------------------------------------------------------------------  
  9.     # * Event At  
  10.     #--------------------------------------------------------------------------  
  11.     def event_at(x, y)    
  12.         for event in @events.values        
  13.             return event if event.x == x && event.y == y    
  14.         end    
  15.         return nil  
  16.     end    
  17.    
  18.     #--------------------------------------------------------------------------  
  19.     # * Events At (returns multiple events at the same position in an array)  
  20.     #--------------------------------------------------------------------------  
  21.     def events_at(x, y)    
  22.         eventarray = []    
  23.         for event in @events.values      
  24.             eventarray.push event if event.x == x && event.y == y    
  25.         end    
  26.         return eventarray if eventarray.size > 0    
  27.         return nil  
  28.     end
  29.  
  30. end
  31.  
  32. #==============================================================================
  33. # ** Game_Event
  34. #==============================================================================
  35.  
  36. class Game_Event  
  37.     #--------------------------------------------------------------------------  
  38.     # * Public Instance Variables  
  39.     #--------------------------------------------------------------------------  
  40.     attr_reader   :erased                  # trigger  
  41.     attr_accessor :mouse_autostart         # mouse autostart boolean  
  42.     attr_accessor :mouse_cursor_icon       # mouse cursor icon  
  43.     attr_accessor :mouse_cursor_desc       # mouse cursor desc  
  44.     attr_reader   :name                    # name of event  
  45.     #--------------------------------------------------------------------------  
  46.     # * Alias Listings  
  47.     #--------------------------------------------------------------------------  
  48.     alias_method :sephlamchop_mousesys_gmevt_refresh, :refresh  
  49.     #--------------------------------------------------------------------------  
  50.     # * Start Event  
  51.     #--------------------------------------------------------------------------  
  52.     def start    
  53.         # If list of event commands is not empty    
  54.         if @list && @list.size > 1      
  55.             @starting = true    
  56.         end  
  57.     end    
  58.    
  59.     #--------------------------------------------------------------------------  
  60.     # * Refresh  
  61.     #--------------------------------------------------------------------------    
  62.     def refresh    
  63.         # Original Refresh    
  64.         sephlamchop_mousesys_gmevt_refresh    
  65.         # Click triggers event for action button, player or event touch    
  66.         @mouse_autostart   = [0, 1, 2].include?(@trigger)    
  67.         @mouse_cursor_icon = MouseCursor::Event_Cursor    
  68.         @mouse_cursor_desc = nil    
  69.         # Return if Erased or Nil List    
  70.         #return if @erased || @list.nil?      
  71.        
  72.     end
  73. end
  74.  
  75. #==============================================================================
  76. # ** Game_Character
  77. #==============================================================================
  78. class Game_Character    
  79.    
  80.     def passable?(x, y, d, step = 999, tx = nil, ty = nil)        
  81.        
  82.         # Get new coordinates    
  83.         new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)    
  84.         new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)        
  85.        
  86.         # If coordinates are outside of map    
  87.         unless $game_map.valid?(new_x, new_y)      
  88.             return false    
  89.         end        
  90.        
  91.         # If through is ON    
  92.         if @through      
  93.             return true    
  94.         end        
  95.        
  96.         # Able to leave current tile in desired direction?    
  97.         # SHAZ: for counter, must be old, counter, new, in a straight line    
  98.         unless $game_map.passable?(x, y, d, self) || (step == 2 && $game_map.event_at(x, y)) ||      
  99.             (step == 3 && $game_map.counter?(x, y) && tx != nil && ty != nil &&      
  100.             new_x - x == x - tx && new_y - y == y - ty)      
  101.             return false    
  102.         end        
  103.        
  104.         # Able to enter adjoining tile in current direction?    
  105.         unless $game_map.passable?(new_x, new_y, 10 - d) ||      
  106.             (step == 2 && $game_map.counter?(new_x, new_y))      
  107.             return false    
  108.         end    
  109.        
  110.         # SHAZ - ignore events sitting on a counter next to the destination    
  111.         if step != 2 || !$game_map.counter?(new_x, new_y)                
  112.             # Loop all events      
  113.             for event in $game_map.events.values        
  114.                 # If event coordinates are consistent with move destination        
  115.                 if event.x == new_x and event.y == new_y          
  116.                     @state = true          
  117.                     # If through is OFF          
  118.                     unless event.through            
  119.                         # If self is event            
  120.                         if self != $game_player              
  121.                             return false            
  122.                         end            
  123.                         # With self as the player and partner graphic as character            
  124.                         if event.character_name != ""              
  125.                             return false            
  126.                         end          
  127.                     end        
  128.                 end      
  129.             end    
  130.         end        
  131.        
  132.         # If on world map, don't allow to go through events.  Otherwise,    
  133.         # the event will be triggered while the PC is walking    
  134.         if $game_map.map_id == WORLD_MAP_ID && @state == false      
  135.             return false    
  136.         end          
  137.        
  138.         # If player coordinates are consistent with move destination    
  139.         if $game_player.x == new_x && $game_player.y == new_y && self != $game_player      
  140.             # If through is OFF      
  141.             unless $game_player.through        
  142.                 # If your own graphic is the character        
  143.                 if @character_name != ""          
  144.                     return false        
  145.                 end      
  146.             end    
  147.         end    
  148.        
  149.         return true      
  150.  
  151.     end
  152. end
  153.  
  154. #==============================================================================
  155. # ** Game_Player
  156. #==============================================================================
  157.  
  158. class Game_Player < Game_Character  
  159.     #--------------------------------------------------------------------------  
  160.     # * Alias Listings  
  161.     #--------------------------------------------------------------------------  
  162.     alias_method :sephlamchop_mousesys_gmplyr_update, :update  
  163.     #--------------------------------------------------------------------------  
  164.     # * Frame Update  
  165.     #--------------------------------------------------------------------------  
  166.     def update    
  167.         # Unless Interpreter Running, Forcing a Route or Message Showing    
  168.         unless $game_system.map_interpreter.running? or          
  169.                 @move_route_forcing or $game_temp.message_window_showing                
  170.        
  171.             # Find Path If Mouse Triggered      
  172.             if Mouse.trigger?(0) && Mouse.grid != nil        
  173.            
  174.                 # Check if mouse is over HUD on map        
  175.                 screen_x,screen_y = Mouse.pos                
  176.            
  177.                 # Gets Mouse X & Y        
  178.                 mx, my = *Mouse.grid                
  179.            
  180.                 # Turn Character in direction        
  181.                 newd_x = (@x - mx).abs        
  182.                 newd_y = (@y - my).abs                
  183.            
  184.                 if @x > mx            
  185.                     turn_left if newd_x >= newd_y        
  186.                 elsif @x < mx            
  187.                     turn_right if newd_x >= newd_y        
  188.                 end                      
  189.            
  190.                 if @y > my            
  191.                     turn_up if newd_x < newd_y        
  192.                 elsif @y < my            
  193.                     turn_down if newd_x < newd_y        
  194.                 end        
  195.            
  196.                 # Run Pathfinding        
  197.                 find_path(mx, my, false)                
  198.            
  199.                 # Gets Event        
  200.                 @eventarray = @runpath ? $game_map.events_at(mx, my) : nil        
  201.                 # If Event At Grid Location        
  202.                 unless @eventarray.nil?          
  203.                     @eventarray.each do |event|            
  204.                         # If Event Autostart            
  205.                         if !event.mouse_autostart              
  206.                             @eventarray.delete(event)            
  207.                         end          
  208.                     end          
  209.                     @eventarray = nil if @eventarray.size == 0        
  210.                 end              
  211.            
  212.             end    
  213.         end        
  214.    
  215.         if @move_route_forcing      
  216.             clear_path      
  217.             @eventarray = nil    
  218.         end        
  219.    
  220.         # Original Update    
  221.         sephlamchop_mousesys_gmplyr_update    
  222.         # If Non-nil Event Autostarter    
  223.         if @eventarray != nil && !moving? &&      
  224.             (!@ovrdest || @map.nil? || @map[@x,@y] == 1)      
  225.             # Gets Event      
  226.             @eventarray.each do |event|              
  227.            
  228.                 # If Event Within Range        
  229.                 if event and (@x == event.x or @y == event.y)          
  230.                     # SHAZ - trigger event when:          
  231.                     # - Action button and standing on or beside, or with a counter between          
  232.                     # - player/event touch and standing as close as possible (on, if possible)          
  233.                     distance = Math.hypot(@x - event.x, @y - event.y)          
  234.                     dir = @x < event.x ? 6 : @x > event.x ? 4 : @y < event.y ? 2 : @y > event.y ? 8 : 0          
  235.                     if (event.trigger == 0 and (distance < 2 or (distance == 2 and            
  236.                         $game_map.counter?((@x+event.x)/2, (@y+event.y)/2)))) or            
  237.                         ([1,2].include?(event.trigger) and ((distance == 0 and            
  238.                         $game_player.passable?(@x, @y, dir)) or (distance == 1 and            
  239.                         !$game_player.passable?(@x, @y, dir))))            
  240.                         # Turn toward Event            
  241.                         if @x == event.x              
  242.                             turn_up if @y > event.y              
  243.                             turn_down if @y < event.y            
  244.                         else              
  245.                             turn_left if @x > event.x              
  246.                             turn_right if @x < event.x            
  247.                         end            
  248.                         # Start Event            
  249.                         clear_path            
  250.                         event.start            
  251.                         @eventarray.delete(event)            
  252.                         @eventarray = nil if @eventarray.size == 0          
  253.                     end        
  254.                 end            
  255.            
  256.             end          
  257.         end  
  258.    
  259.     end    
  260.    
  261.     def passable?(x1, y1, d, step = 999, tx = nil, ty = nil)    
  262.         super  
  263.     end  
  264.  
  265. end
  266.  
  267. #==============================================================================
  268. # ** Mouse Selectable Windows
  269. #------------------------------------------------------------------------------
  270. # SephirothSpawn
  271. # Version 2.1
  272. #==============================================================================
  273. #==============================================================================
  274. # ** Window_Base
  275. #==============================================================================
  276.  
  277. class Window_Base  
  278.     #--------------------------------------------------------------------------  
  279.     # * Frame Update : Mouse Cursor - Item  
  280.     #--------------------------------------------------------------------------  
  281.     def update_mouse_cursors_item(item, cursor, show)    
  282.         # Return if not Active    
  283.         return unless self.active    
  284.         # Return if nil Position    
  285.         return if Mouse.position.nil?    
  286.         # Gets Mouse Position    
  287.         mx, my = Mouse.position    
  288.         # Gets Cursor Position    
  289.         cr = self.cursor_rect    
  290.         cx, cy = cr.x + self.x + 16, cr.y + self.y + 16    
  291.         cw, ch = cr.width, cr.height    
  292.         # If Not on Item    
  293.         if mx.between?(self.x, self.x + self.width) == false ||      
  294.             my.between?(self.y, self.y + self.height) == false || item.nil? ||      
  295.             @item_max == 0 || mx.between?(cx, cx + cw) == false ||      
  296.             my.between?(cy, cy + ch) == false      
  297.             # Clear Mouse Index      
  298.             @mouse_index = nil      
  299.             # Set Mouse to Default Cursor      
  300.             $mouse_sprite.set_bitmap(MouseCursor::Default_Cursor)      
  301.             return    
  302.         end    
  303.         # If Index is different than mouse index and window active    
  304.         if @mouse_index != @index      
  305.             # Reset Index      
  306.             @mouse_index = @index      
  307.             # set to item icon if cursor is true      
  308.             cursor = item.icon_name if cursor      
  309.             # Set Bitmap      
  310.             $mouse_sprite.set_bitmap(cursor)    
  311.         end  
  312.     end  
  313.    
  314. end
  315.  
  316. class Window_Selectable  
  317.     #--------------------------------------------------------------------------  
  318.     # * Default Settings  
  319.     #--------------------------------------------------------------------------  
  320.     Default_Mouse_Selectable = true  
  321.     Default_Window_Padding   = 16  
  322.     #--------------------------------------------------------------------------  
  323.     # * Public Instance Variables  
  324.     #--------------------------------------------------------------------------  
  325.     attr_accessor :mouse_selectable  
  326.     attr_accessor :window_padding  
  327.     #--------------------------------------------------------------------------  
  328.     # * Alias Listings  
  329.     #--------------------------------------------------------------------------  
  330.     alias_method :seph_mouseselectable_wndslct_init,   :initialize  
  331.     alias_method :seph_mouseselectable_wndslct_update, :update  
  332.     #--------------------------------------------------------------------------  
  333.     # * Object Initialization  
  334.     #--------------------------------------------------------------------------  
  335.     def initialize(x, y, width, height)    
  336.         # Original Initialization    
  337.         seph_mouseselectable_wndslct_init(x, y, width, height)    
  338.         # Set Mouse Selectable Flag    
  339.         @mouse_selectable = Default_Mouse_Selectable    
  340.         @window_padding   = Default_Window_Padding  
  341.     end  
  342.     #--------------------------------------------------------------------------  
  343.     # * Frame Update  
  344.     #--------------------------------------------------------------------------  
  345.     def update        
  346.         # agf = hide mouse    
  347.         if $mouse_sprite.visible == true        
  348.        
  349.         # If Mouse Selectable, Active, at Least 1 Item and Non-negitive index    
  350.         if self.mouse_selectable && self.active && @item_max > 0 && @index >= 0      
  351.             # Gets Mouse Position      
  352.             mouse_x, mouse_y = *Mouse.position            
  353.            
  354.             # If Mouse Within Window            
  355.             if mouse_x.between? (self.x, self.x + self.width) &&        
  356.                 mouse_y.between? (self.y, self.y + self.height)        
  357.                 # Calculates Mouse X and Y Position Within Window        
  358.                 mouse_x -= self.x; mouse_y -= self.y        
  359.                 # Subtracts Window Padding        
  360.                 mouse_x -= @window_padding; mouse_y -= @window_padding        
  361.                 # Subtracts Mouse Oh        
  362.                 mouse_y -= self.mouse_oh        
  363.                 # Gets Cursor Width        
  364.                 cursor_width = (self.width / @column_max - 32)        
  365.                 # Passes Through Item Max        
  366.                 for i in 0...@item_max          
  367.                     # Calculates Index Position          
  368.                     x = i % @column_max * (cursor_width + 32)          
  369.                     y = i / @column_max * self.oh - self.oy          
  370.                     # If Mouse Between Rect          
  371.                     if mouse_x.between?(x, x + cursor_width) &&              
  372.                         mouse_y.between?(y, y + self.oh)            
  373.                         # Set Index            
  374.                         prev_index = @index            
  375.                         @index = i            
  376.                         if prev_index != @index              
  377.                             $game_system.se_play($data_system.cursor_se)            
  378.                         end            
  379.                         break          
  380.                     end        
  381.                 end      
  382.             end    
  383.         end        
  384.  
  385.         end        
  386.    
  387.         # Original Update    
  388.         seph_mouseselectable_wndslct_update  
  389.     end  
  390.     #--------------------------------------------------------------------------  
  391.     # * Oh  
  392.     #--------------------------------------------------------------------------  
  393.     def oh    
  394.         return 32  
  395.     end  
  396.     #--------------------------------------------------------------------------  
  397.     # * Mouse Oh  
  398.     #--------------------------------------------------------------------------  
  399.     def mouse_oh    
  400.         return 0  
  401.     end    
  402.    
  403. end
  404.  
  405.  
  406. #=====================================================================
  407. #F117Landers note: This is the break between script 3 parts 1 and 2
  408. #=====================================================================
  409.  
  410.  
  411. #==============================================================================
  412. # ** Window_MenuStatus
  413. #==============================================================================
  414. class Window_MenuStatus < Window_Selectable  
  415.     #--------------------------------------------------------------------------  
  416.     # * Oh  
  417.     #--------------------------------------------------------------------------  
  418.     def oh    
  419.         return 60  
  420.     end
  421. end
  422.  
  423. #==============================================================================
  424. # ** Window_Target
  425. #==============================================================================
  426. class Window_Target < Window_Selectable  
  427.     #--------------------------------------------------------------------------  
  428.     # * Oh  
  429.     #--------------------------------------------------------------------------  
  430.     def oh    
  431.         return 105  
  432.     end
  433. end
  434.  
  435. #==============================================================================
  436. # ** Window_BattleReserve
  437. #==============================================================================
  438. class Window_BattleReserve < Window_Selectable  
  439.     #--------------------------------------------------------------------------  
  440.     # * Oh  
  441.     #--------------------------------------------------------------------------  
  442.     def oh    
  443.         return 105  
  444.     end
  445. end
  446.  
  447. #==============================================================================
  448. # ** Window_EquipRight
  449. #==============================================================================
  450. class Window_EquipRight < Window_Selectable  
  451.     #--------------------------------------------------------------------------  
  452.     # * Oh  
  453.     #--------------------------------------------------------------------------  
  454.     def oh    
  455.         return 50  
  456.     end    
  457.     #--------------------------------------------------------------------------  
  458.     # * Mouse Oh  
  459.     #--------------------------------------------------------------------------  
  460.     def mouse_oh    
  461.         return 140  
  462.     end    
  463. end
  464.  
  465. #==============================================================================
  466. # ** Window_Message
  467. #==============================================================================
  468. class Window_Message < Window_Selectable  
  469.     #--------------------------------------------------------------------------  
  470.     # * Mouse Oh  
  471.     #--------------------------------------------------------------------------  
  472.     def mouse_oh    
  473.         return $game_temp.choice_start * 32  
  474.     end
  475. end
  476.  
  477. #==============================================================================
  478. # ** Window_Party
  479. #==============================================================================
  480. class Window_Party < Window_Selectable  
  481.     #--------------------------------------------------------------------------  
  482.     # * Oh  
  483.     #--------------------------------------------------------------------------  
  484.     def oh    
  485.         return 52  
  486.     end
  487. end
  488.  
  489. #==============================================================================
  490. # ** Window_Menu
  491. #==============================================================================
  492. class Window_Menu < Window_Selectable  
  493.     #--------------------------------------------------------------------------  
  494.     # * Oh  
  495.     #--------------------------------------------------------------------------  
  496.     def oh    
  497.         return 35  
  498.     end
  499. end
  500.  
  501. #==============================================================================
  502. # ** Window_ActorCommand
  503. #==============================================================================
  504. class Window_ActorCommand < Window_Selectable  
  505.     #--------------------------------------------------------------------------  
  506.     # * Update  
  507.     #--------------------------------------------------------------------------  
  508.     def update    
  509.         if $mouse_sprite.visible            
  510.            
  511.             # if Mouse sleectable, active, at least 1 item and non-negative index      
  512.             if self.mouse_selectable && self.active && @item_max > 0 && @index >= 0        
  513.                 # Get / check mouse position        
  514.                 mouse_x, mouse_y = *Mouse.position                
  515.                
  516.                 if mouse_x.between?(self.x, self.x + self.width) &&          
  517.                     mouse_y.between?(self.y, self.y + self.height)                    
  518.                        
  519.                     # Calculates mouse position within window          
  520.                     mouse_x -= self.x          
  521.                     mouse_y -= self.y                    
  522.                        
  523.                     # Subtracts widnow padding and overhead          
  524.                     mouse_x -= @window_padding          
  525.                     mouse_y -= @window_padding - self.mouse_oh                    
  526.                        
  527.                     # Look through all items          
  528.                     for i in 0...@item_max            
  529.                         ix,iy = @positions[i]            
  530.                         if mouse_x.between?(ix, ix + 32) && mouse_y.between?(iy, iy + self.oh)              
  531.                             if i != @index                
  532.                                 $game_system.se_play($data_system.cursor_se)              
  533.                             end              
  534.                             @index = i              
  535.                             break            
  536.                         end          
  537.                     end        
  538.                 end      
  539.             end    
  540.         end        
  541.        
  542.         super  
  543.     end    
  544.    
  545.     #--------------------------------------------------------------------------  
  546.     # * Oh  
  547.     #--------------------------------------------------------------------------  
  548.     def oh    
  549.         return 32    
  550.     end
  551. end
  552.  
  553. #==============================================================================
  554. # ** Window_NameInput
  555. #==============================================================================
  556. class Window_NameInput < Window_Base  
  557.     #--------------------------------------------------------------------------  
  558.     # * Default Settings  
  559.     #--------------------------------------------------------------------------  
  560.     Default_Mouse_Selectable = true  
  561.     Default_Window_Padding = 16  
  562.     #--------------------------------------------------------------------------  
  563.     # * Public Instance Variables  
  564.     #--------------------------------------------------------------------------  
  565.     attr_accessor :mouse_selectable  
  566.     attr_accessor :window_padding  
  567.     #--------------------------------------------------------------------------  
  568.     # * Alias Listings  
  569.     #--------------------------------------------------------------------------  
  570.     alias_method :shaz_mouseselectable_wndslct_init,   :initialize  
  571.     alias_method :shaz_mouseselectable_wndslct_update, :update  
  572.     #--------------------------------------------------------------------------  
  573.     # ● Initialize the Name Input window  
  574.     #--------------------------------------------------------------------------  
  575.     def initialize    
  576.         # Original Initialization    
  577.         shaz_mouseselectable_wndslct_init    
  578.         # Set Mouse Selectable Flag    
  579.         @mouse_selectable = Default_Mouse_Selectable    
  580.         @window_padding = Default_Window_Padding  
  581.     end  
  582.    
  583.     #--------------------------------------------------------------------------  
  584.     # * Frame Update  
  585.     #--------------------------------------------------------------------------  
  586.    
  587.     def update        
  588.         # if mouse selectable, visible, active, and non-negative index    
  589.         if $mouse_sprite.visible && self.mouse_selectable && self.active &&      
  590.             @index >= 0            
  591.            
  592.             # Get mouse position      
  593.             mouse_x, mouse_y = *Mouse.position            
  594.            
  595.             # If mouse within window      
  596.             if mouse_x.between? (self.x, self.x + self.width) &&        
  597.                 mouse_y.between? (self.y, self.y + self.height)                
  598.                
  599.                 # Calculates mouse X and Y positions within window        
  600.                 mouse_x -= self.x; mouse_y -= self.y                
  601.                
  602.                 # Subtracts window padding        
  603.                 mouse_x -= @window_padding; mouse_y -= @window_padding                
  604.                
  605.                 # Subtracts mouse oh        
  606.                 mouse_y -= self.mouse_oh                
  607.                
  608.                 # Gets cursor width        
  609.                 cursor_width = 28                
  610.                
  611.                 # If not Submit button, pass through all items        
  612.                 if mouse_x.between?(428, 428+48) && mouse_y.between?(9*32, 9*32+32)          
  613.                     $game_system.se_play($data_system.cursor_se) if @index != 180          
  614.                     @index = 180        
  615.                 else          
  616.                     for i in 0..90                          
  617.                        
  618.                         # Calculate index position            
  619.                         x = 140 + i / 5 / 9 * 180 + i % 5 * 32            
  620.                         y = i / 5 % 9 * 32                        
  621.                        
  622.                         # If mouse between rect            
  623.                         if mouse_x.between?(x, x + cursor_width) &&              
  624.                             mouse_y.between?(y, y + self.oh)              
  625.                             # set index              
  626.                             prev_index = @index              
  627.                             @index = i              
  628.                             if prev_index != @index                
  629.                                 $game_system.se_play($data_system.cursor_se)              
  630.                             end              
  631.                             break            
  632.                         end          
  633.                     end        
  634.                 end      
  635.             end    
  636.         end        
  637.        
  638.         # Original update    
  639.         shaz_mouseselectable_wndslct_update  
  640.     end    
  641.    
  642.     #--------------------------------------------------------------------------  
  643.     # * Oh  
  644.     #--------------------------------------------------------------------------    
  645.     def oh    
  646.         return 32  
  647.     end    
  648.    
  649.     #--------------------------------------------------------------------------  
  650.     # * Mouse Oh  
  651.     #--------------------------------------------------------------------------    
  652.     def mouse_oh    
  653.         return 0  
  654.     end  
  655. end
  656.  
  657. #==============================================================================
  658. # ** Scene_File
  659. #==============================================================================
  660. class Scene_File  
  661.     #--------------------------------------------------------------------------  
  662.     # * Alias Listings  
  663.     #--------------------------------------------------------------------------  
  664.     alias_method :sephlamchop_mousesys_scnfl_update, :update  
  665.     #--------------------------------------------------------------------------  
  666.     # * Frame Update  
  667.     #--------------------------------------------------------------------------  
  668.     def update        
  669.        
  670.         # agf = hide mouse    
  671.         if $mouse_sprite.visible == true            
  672.        
  673.         # If Mouse Position isn't Nil    
  674.         if Mouse.pos != nil            
  675.            
  676.             # Gets Mouse Position      
  677.             x, y = Mouse.pos      
  678.             y = y + 32            
  679.            
  680.             # Pass Through Savefile Windows      
  681.             for i in 0...@savefile_windows.size                
  682.                
  683.                 # Gets Window        
  684.                 w = @savefile_windows[i]                
  685.                
  686.                 # Don't allow user to select autosave slot in Load Menu        
  687.                 if @autosave_slot == false          
  688.                     i = 1 if i == 0        
  689.                 end                
  690.                
  691.                 # If Within Window Range        
  692.                 if x.between?(w.x, w.x + w.width) &&          
  693.                     y.between?(w.y, w.y + w.height) && w.active                                
  694.                     prev_index = @file_index                    
  695.                    
  696.                     # Set File Index          
  697.                     @file_index = i                    
  698.                    
  699.                     # Turns Window On          
  700.                     w.selected = true                    
  701.                    
  702.                     # Play SE          
  703.                     if prev_index != @file_index            
  704.                         $game_system.se_play($data_system.cursor_se)          
  705.                     end                              
  706.                    
  707.                     # Unhighlight remaining windows          
  708.                     for j in 0...@savefile_windows.size            
  709.                         if j != i              
  710.                             @savefile_windows[j].selected = false            
  711.                         end          
  712.                     end                  
  713.                    
  714.                     # Don't select autosave slot in Load Menu          
  715.                     if @autosave_slot == false            
  716.                         @savefile_windows[0].selected = false if i == 1          
  717.                     end                    
  718.                    
  719.                     # Break Main Loop          
  720.                     break                    
  721.                 end      
  722.             end    
  723.         end      
  724.        
  725.         end      
  726.        
  727.         # Original Update    
  728.         sephlamchop_mousesys_scnfl_update  
  729.     end
  730. end
  731.  
  732. #==============================================================================
  733. # ** Game_Battler
  734. #==============================================================================
  735. class Game_Battler  
  736.     #--------------------------------------------------------------------------  
  737.     # * Battler Width  
  738.     #--------------------------------------------------------------------------  
  739.     def battler_width    
  740.         return RPG::Cache.battler(@battler_name, @battler_hue).width  
  741.     end  
  742.     #--------------------------------------------------------------------------  
  743.     # * Battler Height  
  744.     #--------------------------------------------------------------------------  
  745.     def battler_height    
  746.         return RPG::Cache.battler(@battler_name, @battler_hue).height  
  747.     end
  748. end
  749.  
  750. #==============================================================================
  751. # ** Arrow_Enemy
  752. #==============================================================================
  753. class Arrow_Enemy < Arrow_Base  
  754.     #--------------------------------------------------------------------------  
  755.     # * Alias Listings  
  756.     #--------------------------------------------------------------------------  
  757.     alias_method :seph_mouseselectablewindows_arrenmy_update, :update  
  758.     #--------------------------------------------------------------------------  
  759.     # * Frame Update  
  760.     #--------------------------------------------------------------------------  
  761.     def update    
  762.         # Original Update    
  763.         seph_mouseselectablewindows_arrenmy_update        
  764.        
  765.         if $mouse_sprite.visible == true      
  766.             # Return if Nil Mouse Position      
  767.             return if Mouse.position.nil?      
  768.             # Gets Mouse Position      
  769.             mx, my = *Mouse.position      
  770.             # Pass Through Enemies      
  771.             $game_troop.enemies.each do |enemy|        
  772.                 # Skip if Non-Existing Enemy        
  773.                 next unless enemy.exist?        
  774.                 # Gets Paddings        
  775.                 w, h = enemy.battler_width / 2, enemy.battler_height        
  776.                 # If Within Mouse Padding Range        
  777.                 if mx.between?(enemy.screen_x - w, enemy.screen_x + w) &&          
  778.                     my.between?(enemy.screen_y - h, enemy.screen_y + 10)          
  779.                     # Set Index          
  780.                     @index = $game_troop.enemies.index(enemy)          
  781.                     # Set mouse cursor to bitmap          
  782.                     $mouse_sprite.set_bitmap(MouseCursor::Enemy_Cursor)          
  783.                     return          
  784.                     # break        
  785.                 end      
  786.             end          
  787.            
  788.             # Set Mouse to Default Cursor      
  789.             $mouse_sprite.set_bitmap(MouseCursor::Default_Cursor)    
  790.         end      
  791.        
  792.     end
  793. end
  794.  
  795. #==============================================================================
  796. # ** Arrow_Actor
  797. #==============================================================================
  798. class Arrow_Actor < Arrow_Base  
  799.     #--------------------------------------------------------------------------  
  800.     # * Alias Listings  
  801.     #--------------------------------------------------------------------------  
  802.     alias_method :seph_mouseselectablewindows_arractr_update, :update  
  803.     #--------------------------------------------------------------------------  
  804.     # * Frame Update  
  805.     #--------------------------------------------------------------------------  
  806.     def update    
  807.         # Original Update    
  808.         seph_mouseselectablewindows_arractr_update    
  809.         # Return if Nil Mouse Position    
  810.         return if Mouse.position.nil?    
  811.         # Gets Mouse Position    
  812.         mx, my = *Mouse.position    
  813.         # Pass Through Actors    
  814.         $game_party.actors.each do |actor|      
  815.             # Gets Paddings      
  816.             w, h = actor.battler_width / 2, actor.battler_height      
  817.             # If Within Mouse Padding Range      
  818.             if mx.between?(actor.screen_x - w, actor.screen_x + w) &&        
  819.                 my.between?(actor.screen_y - h, actor.screen_y + 10)        
  820.                 # Set Index        
  821.                 @index = $game_party.actors.index(actor)      
  822.             end    
  823.         end  
  824.     end
  825. end
  826.  
  827. #==============================================================================
  828. # ** Scene_Map
  829. #==============================================================================
  830. class Scene_Map  
  831.     #--------------------------------------------------------------------------  
  832.     # * Alias Listings  
  833.     #--------------------------------------------------------------------------  
  834.     alias_method :sephlamchop_mousesys_scnmap_update, :update  
  835.     #--------------------------------------------------------------------------  
  836.     # * Frame Update  
  837.     #--------------------------------------------------------------------------  
  838.     def update    
  839.         # Unless Message Showing    
  840.         unless $game_temp.message_text      
  841.             # Update Event Cursors      
  842.             $mouse_sprite.update_event_cursors    
  843.         end    
  844.         # Original Update    
  845.         sephlamchop_mousesys_scnmap_update  
  846.     end
  847. end
  848.  
  849. #==============================================================================
  850. # ** Interpreter
  851. #==============================================================================
  852. class Interpreter  
  853.     #--------------------------------------------------------------------------  
  854.     # * Alias Listings  
  855.     #--------------------------------------------------------------------------  
  856.     alias_method :shaz_mousesys_intrprtr_command_101, :command_101  
  857.     #--------------------------------------------------------------------------  
  858.     # * Show Text  
  859.     #--------------------------------------------------------------------------  
  860.     def command_101    
  861.         # return mouse sprite to default cursor    
  862.         $mouse_sprite.set_bitmap(MouseCursor::Default_Cursor)    
  863.         # original command_101    
  864.         shaz_mousesys_intrprtr_command_101  
  865.     end
  866. end
  867.  
  868. $mouse_sprite = Sprite_Mouse.new
  869.  
  870. # game mouse is visible, system mouse is hidden
  871. $mouse_sprite.visible = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement