Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. # animation huge swap scriplet
  2. # goes below ANIMATIONS in the battle system section
  3.  
  4. HUGE_FILENAMES_PARSE = ["1zelos", "1champion_blue", "1zweihander_blue", "1diana", "1champion_blue", "1hussar_blue", "0phases", "1scout_blue", "1valkyrie_blue", "1knight_blue"]
  5. # all these filenames will be swapped for their _huge counterparts on animations
  6.  
  7.  
  8. class RPG::Animation
  9.  
  10. alias animation1_name_unswapped animation1_name
  11. alias animation2_name_unswapped animation2_name
  12. def animation1_name
  13. parse_animation_name unless @animation_name_parsed
  14. animation1_name_unswapped
  15. end
  16.  
  17. def animation2_name
  18. parse_animation_name unless @animation_name_parsed
  19. animation2_name_unswapped
  20. end
  21.  
  22. def parse_animation_name
  23. @animation_name_parsed = true
  24. #p @animation1_name
  25. if HUGE_FILENAMES_PARSE.include?(@animation1_name)
  26. @animation1_name << "_huge"
  27. end
  28. if HUGE_FILENAMES_PARSE.include?(@animation2_name)
  29. @animation2_name << "_huge"
  30. end
  31. end
  32.  
  33. end
  34.  
  35. class Sprite_Base
  36.  
  37. def animation_set_sprites(frame)
  38. cell_data = frame.cell_data
  39. @ani_sprites.each_with_index do |sprite, i|
  40. next unless sprite
  41. pattern = cell_data[i, 0]
  42. if !pattern || pattern < 0
  43. sprite.visible = false
  44. next
  45. end
  46. sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  47. frame_width = get_frame_width(sprite)
  48. p frame_width
  49. sprite.visible = true
  50. sprite.src_rect.set(pattern % 5 * frame_width,
  51. pattern % 100 / 5 * frame_width, frame_width, frame_width)
  52. if @ani_mirror
  53. sprite.x = @ani_ox - cell_data[i, 1]
  54. sprite.y = @ani_oy + cell_data[i, 2]
  55. sprite.angle = (360 - cell_data[i, 4])
  56. sprite.mirror = (cell_data[i, 5] == 0)
  57. else
  58. sprite.x = @ani_ox + cell_data[i, 1]
  59. sprite.y = @ani_oy + cell_data[i, 2]
  60. sprite.angle = cell_data[i, 4]
  61. sprite.mirror = (cell_data[i, 5] == 1)
  62. end
  63. sprite.z = self.z + 300 + i
  64. sprite.ox = frame_width / 2
  65. sprite.oy = frame_width / 2
  66. sprite.zoom_x = cell_data[i, 3] / 100.0
  67. sprite.zoom_y = cell_data[i, 3] / 100.0
  68. sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  69. sprite.blend_type = cell_data[i, 7]
  70. end
  71. end
  72.  
  73. def get_frame_width(sprite)
  74. if sprite.bitmap && !sprite.bitmap.disposed?
  75. sprite.bitmap.width / 5
  76. else
  77. 192
  78. end
  79. end
  80. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement