Advertisement
roninator2

Galv Character Effects patch for VE Multi Frames & Diagonal Movmenet, also Khas Awesome Lights

Dec 7th, 2024
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.82 KB | None | 0 0
  1. #=============================================================================
  2. #
  3. #  Compatibility Patch for Galv's Character Effects and
  4. #    Victor Sant's Multiframes and Diagonal Movement
  5. #       also appears to work for Khas Awesome lights - Roninator2
  6. #  Version 0.1 (28th June, 2018)
  7. #  By Another Fen <forums.rpgmakerweb.com>
  8. #
  9. #  (Consists in large parts of code copied from the aforementioned scripts)
  10. #
  11. # Contents: ------------------------------------------------------------------
  12. #  This Script modifies the Sprite part of Galv's Character Effects to make
  13. #  them compatible to Victor Sant's Multiframes and Diagonal Movement.
  14. #
  15. # Usage: ---------------------------------------------------------------------
  16. #  Requires Victor Sant's Multiframes (1.03) and Diagonal Movement (1.09)
  17. #  Should be placed below Galv's Character Effects (2.1).
  18. #  
  19. #=============================================================================
  20.  
  21. #=============================================================================
  22. #  Sprite_Character
  23. #=============================================================================
  24. class Sprite_Character
  25.  
  26.   #---------------------------------------------------------------------------
  27.   # Sprite_Character#update_src_rect  (Modified)
  28.   #   Extracted character index. Includes Multiframes / Diagonal Movement.
  29.   #---------------------------------------------------------------------------
  30.   def update_src_rect
  31.     if @tile_id == 0
  32.       index = character_index
  33.       sx = (index % 4 * horizontal_frames + pattern_index) * @cw
  34.       sy = (index / 4 * vertical_frames + direction_index) * @ch
  35.       self.src_rect.set(sx, sy, @cw, @ch)
  36.     end
  37.   end
  38.  
  39.   #---------------------------------------------------------------------------
  40.   # Sprite_Character#character_index
  41.   #   Displayed character set index.
  42.   #---------------------------------------------------------------------------
  43.   def character_index
  44.     @character.character_index
  45.   end
  46.  
  47.   #---------------------------------------------------------------------------
  48.   # Sprite_Character#horizontal_frames
  49.   #   Number of horizontal frames per character set
  50.   #---------------------------------------------------------------------------
  51.   def horizontal_frames
  52.     @character_name[/\[F(\d+)\]/i] ? @character.frames : 3
  53.   end
  54.  
  55.   #---------------------------------------------------------------------------
  56.   # Sprite_Character#vertical_frames
  57.   #   Number of vertical frames per character set
  58.   #---------------------------------------------------------------------------
  59.   def vertical_frames
  60.     4
  61.   end
  62.  
  63.   #---------------------------------------------------------------------------
  64.   # Sprite_Character#pattern_index
  65.   #   Displayed character pattern index
  66.   #---------------------------------------------------------------------------
  67.   def pattern_index
  68.     pattern = @character.pattern
  69.     return (pattern < 3 || @character_name[/\[F(\d+)\]/i]) ? pattern : 1
  70.   end
  71.  
  72.   #---------------------------------------------------------------------------
  73.   # Sprite_Character#direction_index
  74.   #   Displayed character direction index
  75.   #---------------------------------------------------------------------------
  76.   def direction_index
  77.     if @character.diagonal?
  78.       return { 1 => 0, 7 => 1, 3 => 2, 9 => 3 }[@diagonal]
  79.     else
  80.       return (@character.direction - 2) / 2
  81.     end
  82.   end
  83.  
  84.   #---------------------------------------------------------------------------
  85.   # Sprite_Character#extended_bitmap_name
  86.   #   Extended alternate bitmap names for subclasses (see Diagonal Movement)
  87.   #---------------------------------------------------------------------------
  88.   def extended_bitmap_name(name)
  89.     extended_name = name + ($imported[:ve_visual_equip] ? "" : diagonal_sufix)
  90.     return character_exist?(extended_name) ? extended_name : name
  91.   end
  92. end
  93.  
  94.  
  95. #=============================================================================
  96. #  Sprite_Reflect
  97. #=============================================================================
  98. class Sprite_Reflect
  99.  
  100.   #---------------------------------------------------------------------------
  101.   # Sprite_Reflect#set_character_bitmap  (Modified)
  102.   #   Moved changes to other methods designated by the VE Basic Module.
  103.   #---------------------------------------------------------------------------
  104.   def set_character_bitmap
  105.     super
  106.   end
  107.  
  108.   #---------------------------------------------------------------------------
  109.   # Sprite_Reflect#set_bitmap_name  (Overridden)
  110.   #   See Sprite_Reflect#set_character_bitmap
  111.   #---------------------------------------------------------------------------
  112.     def set_bitmap_name
  113.     reflect = @character.reflect_sprite
  114.     return (reflect) ? extended_bitmap_name(reflect[0]) : super
  115.   end
  116.  
  117.   #---------------------------------------------------------------------------
  118.   # Sprite_Reflect#set_bitmap_position  (Overridden)
  119.   #   See Sprite_Reflect#set_character_bitmap
  120.   #---------------------------------------------------------------------------
  121.   def set_bitmap_position
  122.     self.mirror = true
  123.     self.angle = 180
  124.     self.opacity = 220
  125.     self.z = Galv_CEffects::REFLECT_Z
  126.     self.wave_amp = $game_map.reflect_options[0]
  127.     super
  128.   end
  129.  
  130.   #---------------------------------------------------------------------------
  131.   # Sprite_Reflect#character_index  (Overridden)
  132.   #   Specify reflection character index
  133.   #---------------------------------------------------------------------------
  134.   def character_index
  135.     @character.reflect_sprite ? @character.reflect_sprite[1] : super
  136.   end
  137. end
  138.  
  139.  
  140. #=============================================================================
  141. #  Sprite_Mirror
  142. #=============================================================================
  143. class Sprite_Mirror
  144.  
  145.   #---------------------------------------------------------------------------
  146.   # Sprite_Mirror#set_character_bitmap  (Modified)
  147.   #   Move changes to methods designated by the VE basic module
  148.   #---------------------------------------------------------------------------
  149.   def set_character_bitmap
  150.     super
  151.   end
  152.  
  153.   #---------------------------------------------------------------------------
  154.   # Sprite_Mirror#set_bitmap_name  (Overridden)
  155.   #   See Sprite_Mirror#set_character_bitmap
  156.   #---------------------------------------------------------------------------
  157.   def set_bitmap_name
  158.     reflect = @character.reflect_sprite
  159.     return (reflect) ? extended_bitmap_name(reflect[0]) : super
  160.   end
  161.  
  162.   #---------------------------------------------------------------------------
  163.   # Sprite_Mirror#set_bitmap_position  (Overridden)
  164.   #   See Sprite_Mirror#set_character_bitmap
  165.   #---------------------------------------------------------------------------
  166.   def set_bitmap_position
  167.     self.mirror = true
  168.     self.opacity = 255
  169.     self.z = Galv_CEffects::REFLECT_Z
  170.     super
  171.   end
  172.  
  173.   #---------------------------------------------------------------------------
  174.   # Sprite_Mirror#character_index  (Overridden)
  175.   #   Specify reflection character index
  176.   #---------------------------------------------------------------------------
  177.   def character_index
  178.     @character.reflect_sprite ? @character.reflect_sprite[1] : super
  179.   end
  180.  
  181.   #---------------------------------------------------------------------------
  182.   # Sprite_Mirror#direction_index  (Overridden)
  183.   #   Mirror direction
  184.   #---------------------------------------------------------------------------
  185.   def direction_index
  186.     return vertical_frames - 1 - super
  187.   end
  188. end
  189.  
  190.  
  191. #=============================================================================
  192. #  Sprite_Shadow
  193. #=============================================================================
  194. class Sprite_Shadow < Sprite_Character
  195.  
  196.   #---------------------------------------------------------------------------
  197.   # Sprite_Shadow#set_character_bitmap  (Modified)
  198.   #   Move changes to methods designated by the VE basic module
  199.   #---------------------------------------------------------------------------
  200.   def set_character_bitmap
  201.     super
  202.   end
  203.  
  204.   #---------------------------------------------------------------------------
  205.   # Sprite_Shadow#set_bitmap_position  (Overridden)
  206.   #   See Sprite_Mirror#set_character_bitmap
  207.   #---------------------------------------------------------------------------
  208.   def set_bitmap_position
  209.     self.color = Color.new(0, 0, 0, 255)
  210.     self.z = Galv_CEffects::SHADOW_Z
  211.     self.wave_amp = 1 if $game_map.shadow_options[2]
  212.     self.wave_speed = 1000
  213.     super
  214.   end
  215. end
  216. class Sprite_Shadow
  217.  
  218.   #---------------------------------------------------------------------------
  219.   # Sprite_Shadow#blend_update  (Overridden)
  220.   #   Remove the color change introduced by Vlue's Eventing Fine Tuning
  221.   #---------------------------------------------------------------------------
  222.   def blend_update
  223.   end
  224. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement