SHARE
TWEET

[RMXP] ScreenTest 2.0

ForeverZer0 May 21st, 2011 175 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  2. # Zer0 ScreenTest
  3. # Author: ForeverZer0
  4. # Version: 2.1
  5. # Date: 10.3.2010
  6. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  7. # Version History
  8. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  9. #   v.1.0 (3.20.2010)
  10. #     - Original write and release
  11. #
  12. #   v.1.1 (3.31.2010)
  13. #     - Added extra feature if using Zer0 Advanced Weather System
  14. #
  15. #   v.1.2. (5.14.2010)
  16. #     - Improved coding. Shortened.
  17. #
  18. #   v.2.0 (10.3.2010)
  19. #     - Totally re-written. Code has been vastly improved.
  20. #     - No need to configure any filenames anymore. Searches through the game
  21. #       folders and RTPs (even custom ones) and adds all the images for each.        
  22. #     - Improved look/layout.
  23. #     - Added "Hide" button to make windows invisible while held to better
  24. #       view the effect you are testing.
  25. #     - Configurable call button to bring up the menu.
  26. #     - Compatible with Zer0 Advanced Weather 2.0 (not available at release)
  27. #     - Added the following features to test:
  28. #        - Test animations on the map. (All)
  29. #        - Test pictures on the map. (All)
  30. #        - Blend type for fog
  31. #        - Duration for screen shakes and weather.
  32. #
  33. #   v.2.1 (2.13.2011)
  34. #     - Fixed a bug that would prevent the fog scroll values from going below 100. (Thanks Taiine)
  35. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  36. #
  37. # Compatibility:
  38. #   - No known script compatibility issues.
  39. #
  40. # Explanation:
  41. #   Basically just a Debug Menu for screen effects. Allows player to change/test
  42. #   an assortment of different screen effects in real-time to help find one that
  43. #   looks good.
  44. #
  45. # Features:
  46. #   - All of effects below can be altered while test playing:
  47. #     - Change the screen tone (R, G, B, Gr)
  48. #     - Change weather (Type, Power, Duration, Variation)
  49. #     - Test screen shakes (Power, Speed, Duration)
  50. #     - Change fog (Type, Opacity, Blend-Type, Zoom, Hue, Scroll)
  51. #     - Change panorama (Name, Hue)
  52. #     - Test animations (Name, X, Y)
  53. #     - Test pictures (Name, X, Y, Opacity, Zoom, Blend Type, Angle)
  54. #
  55. # Instructions:
  56. #  - Place script above Main and below other default scripts.
  57. #  - During test play, press F8 (default) to bring up the menu.
  58. #
  59. # Notes:
  60. #  - None of the changes will be saved, this is merely a tool to help make
  61. #    life easier when trying to find a good screen effect.
  62. #
  63. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  64.  
  65. #===============================================================================
  66. # ** Scene_ScreenTest
  67. #===============================================================================
  68.  
  69. class Scene_ScreenTest
  70. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  71. #                         BEGIN CONFIGURATION
  72. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  73.  
  74.   WEATHER_TYPES = 32
  75.   # Number of weather types used in your game. If using Zer0 Advanced Weather
  76.   # version 2.0 or higher, you do not need to configure this.
  77.  
  78.   WINDOW = ['Candara', 20, 160] # [FONTNAME, FONTSIZE, OPACITY]
  79.   # Settings for the window. Purely aesthetic. No one else should ever see it.
  80.  
  81.   CALL_BUTTON = Input::F8
  82.   # Button used to call scene from Scene_Map.
  83.  
  84.   HIDE_BUTTON = Input::SHIFT
  85.   # Button used to hide the windows. Windows will not be visible while held.
  86.  
  87. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  88. #                         END CONFIGURATION
  89. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  90.  
  91.   def main
  92.     # Make map sprite.
  93.     @map = Spriteset_Map.new
  94.     # Set current screen tone.
  95.     @tone = [$game_screen.tone.red, $game_screen.tone.green,
  96.       $game_screen.tone.blue, $game_screen.tone.gray]
  97.     # Set current weather type, power, and duration.
  98.     @weather = [$game_screen.weather_type, $game_screen.weather_max, 0]
  99.     # Set name, hue, opacity, zoom, blend type, sx, and sy of current fog.
  100.     @fog = [$game_map.fog_name, $game_map.fog_hue, $game_map.fog_opacity,
  101.       $game_map.fog_zoom, $game_map.fog_blend_type, $game_map.fog_sx, $game_map.fog_sy]
  102.     # Set name and hue of current panorama.
  103.     @panorama = [$game_map.panorama_name, $game_map.panorama_hue]
  104.     # Set shake.
  105.     @shake = [0, 0, 0]
  106.     # Set animation.
  107.     @animation = ['None', 0, 0]
  108.     # Set picture.
  109.     @picture = ['None', 0, 0, 255, 1.0, 0, 0]
  110.     # Find all filenames of panoramas, fogs, and pictures in the game.
  111.     find_graphics
  112.     # Create the main window.
  113.     commands = %w{ Tone Weather Fog Panorama Shake Animation Picture }
  114.     @main_window = Window_Command.new(128, commands)
  115.     # Set strings for the menu options.
  116.     @commands = [
  117.       ['Red', 'Green', 'Blue', 'Gray'],
  118.       ['Type', 'Power', 'Duration'],
  119.       ['Name', 'Hue', 'Opacity', 'Zoom', 'Blend Type', 'Scroll-X', 'Scroll-Y'],
  120.       ['Name', 'Hue'],
  121.       ['Power', 'Speed', 'Duration'],
  122.       ['Name', 'Map-X', 'Map-Y', 'Play Animation'],
  123.       ['Name', 'X', 'Y', 'Opacity', 'Zoom', 'Blend Type', 'Angle']
  124.     ]
  125.     # Check for variable used in Zer0 Advanced Weather and MAWS.
  126.     if defined?($game_screen.weather_variation)
  127.       @weather.push($game_screen.weather_variation)
  128.       @commands[1].push('Variation')
  129.     end
  130.     # Create window array. Holds all created windows for easy handling.
  131.     @windows = [@main_window]
  132.     # Set font name, font size, and opacity of main window.
  133.     set_window_info(@main_window)
  134.     # Transition graphics and begin main loop.
  135.     Graphics.transition
  136.     loop { Graphics.update; Input.update; update; break if $scene != self }
  137.     # Dispose of the sprites.
  138.     (@windows + [@map]).each {|sprite| sprite.dispose }
  139.   end
  140. #-------------------------------------------------------------------------------
  141.   def update
  142.    
  143.     if Input.trigger?(Input::Z)
  144.       p 'Fogs', "", @fogs, '',
  145.       'Panoramas', "", @panoramas, '',
  146.       'Pictures', "Index: #{@pic_index}", @pictures
  147.     end
  148.     # Update window and map sprites.
  149.     (@windows + [@map, $game_screen, $game_map]).each {|object| object.update }
  150.     # Check for input.
  151.     if Input.trigger?(Input::B)
  152.       # Play cancel SE
  153.       $game_system.se_play($data_system.cancel_se)
  154.       if @main_window.active
  155.         # Return to map if main window is active.
  156.         $scene = Scene_Map.new
  157.       else
  158.         # Else find active window, deactivate it, and return to main window.
  159.         active_window = @windows.find {|window| window.active }
  160.         active_window.active = active_window.visible = false
  161.         @main_window.active = true
  162.       end
  163.       return
  164.     elsif Input.trigger?(Input::LEFT) || Input.repeat?(Input::LEFT)
  165.       $game_system.se_play($data_system.cursor_se)
  166.       @value = Input.trigger?(Input::LEFT) ? -1 : -5
  167.     elsif Input.trigger?(Input::RIGHT) || Input.repeat?(Input::RIGHT)
  168.       $game_system.se_play($data_system.cursor_se)
  169.       @value = Input.trigger?(Input::RIGHT) ? 1 : 5
  170.     elsif Input.press?(HIDE_BUTTON)
  171.       memory = @windows.collect {|window| window.visible }
  172.       @windows.each {|window| window.visible = false }
  173.       while Input.press?(HIDE_BUTTON)
  174.         Graphics.update; Input.update; update
  175.       end
  176.       @windows.each_index {|i| @windows[i].visible = memory[i] }
  177.     end
  178.     # Branch update method by what window is active.
  179.     if @main_window.active
  180.       update_main
  181.     elsif @tone_window != nil && @tone_window.active
  182.       update_tone
  183.     elsif @weather_window != nil && @weather_window.active
  184.       update_weather
  185.     elsif @fog_window != nil && @fog_window.active
  186.       update_fog
  187.     elsif @panorama_window != nil && @panorama_window.active
  188.       update_panorama
  189.     elsif @shake_window != nil && @shake_window.active
  190.       update_shake
  191.     elsif @animation_window != nil && @animation_window.active
  192.       update_animation
  193.     elsif @picture_window != nil && @picture_window.active
  194.       update_picture
  195.     end
  196.     # Reset @value variable at end of every update
  197.     @value = nil
  198.   end
  199. #-------------------------------------------------------------------------------
  200.   def update_main
  201.     if Input.trigger?(Input::C)
  202.       # Play SE and deactivate main window.
  203.       $game_system.se_play($data_system.decision_se)
  204.       @main_window.active = false      
  205.       # Branch by main window index, creating new windows when needed.
  206.       case @main_window.index
  207.       when 0 # Tone
  208.         if @tone_window == nil
  209.           @tone_window = Window_Command.new(160, @commands[0])
  210.           set_window_info(@tone_window)
  211.           @windows.push(@tone_window)
  212.         end
  213.         @tone_window.active = @tone_window.visible = true
  214.       when 1 # Weather
  215.         if @weather_window == nil
  216.           @weather_window = Window_Command.new(160, @commands[1])
  217.           set_window_info(@weather_window)
  218.           @windows.push(@weather_window)
  219.           @weather_index = @weather[0]
  220.           # Create an array of possible weather types.
  221.           if $zer0_adv_weather != nil && $zer0_adv_weather >= 2.0
  222.             @weather_types = $weather_cache.bitmaps.keys.sort
  223.           else
  224.             @weather_types = []
  225.             (0..WEATHER_TYPES).each {|i| @weather_types.push(i) }
  226.           end
  227.         end
  228.         @weather_window.active = @weather_window.visible = true
  229.       when 2 # Fog
  230.         if @fog_window == nil
  231.           @fog[0] = 'None' if @fog[0] == ''
  232.           @fog_index = @fogs.index(@fog[0])
  233.           @fog_window = Window_Command.new(256, @commands[2])
  234.           set_window_info(@fog_window)
  235.           @windows.push(@fog_window)
  236.         end
  237.         @fog_window.active = @fog_window.visible = true
  238.       when 3 # Panorama
  239.         if @panorama_window == nil
  240.           @panorama[0] = 'None' if @fog[0] == ''
  241.           @panorama_index = @panoramas.index(@panorama[0])
  242.           @panorama_window = Window_Command.new(256, @commands[3])
  243.           set_window_info(@panorama_window)
  244.           @windows.push(@panorama_window)
  245.         end
  246.         @panorama_window.active = @panorama_window.visible = true
  247.       when 4 # Shake
  248.         if @shake_window == nil
  249.           @shake_window = Window_Command.new(160, @commands[4])
  250.           set_window_info(@shake_window)
  251.           @windows.push(@shake_window)
  252.         end
  253.         @shake_window.active = @shake_window.visible = true
  254.       when 5 # Animation
  255.         if @animation_window == nil
  256.           @animation_index = 0
  257.           @animation_window = Window_Command.new(256, @commands[5])
  258.           set_window_info(@animation_window)
  259.           @windows.push(@animation_window)
  260.         end
  261.         @animation_window.active = @animation_window.visible = true
  262.       when 6 # Picture
  263.         if @picture_window == nil
  264.           @pic_index = 0
  265.           @picture_window = Window_Command.new(256, @commands[6])
  266.           set_window_info(@picture_window)
  267.           @windows.push(@picture_window)
  268.         end
  269.         @picture_window.active = @picture_window.visible = true
  270.       end
  271.       # Set value to nil and refresh the activated window
  272.       @value = nil
  273.       refresh_window
  274.     end
  275.   end
  276. #-------------------------------------------------------------------------------
  277.   def refresh_window
  278.     # Refresh active window.
  279.     case @main_window.index
  280.     when 0 # Tone
  281.       @tone_window.contents.clear
  282.       @tone.each_index {|i|
  283.         @tone_window.contents.draw_text(4, i*32, 128, 32, @commands[0][i])
  284.         @tone_window.contents.draw_text(-4, i*32, 128, 32, @tone[i].to_i.to_s, 2) \
  285.       }
  286.     when 1 # Weather
  287.       @weather_window.contents.clear
  288.       @weather.each_index {|i|
  289.         @weather_window.contents.draw_text(4, i*32, 128, 32, @commands[1][i])
  290.         @weather_window.contents.draw_text(-4, i*32, 128, 32, @weather[i].to_i.to_s, 2)
  291.       }
  292.     when 2 # Fog
  293.       @fog_window.contents.clear
  294.       @fog.each_index {|i|
  295.         @fog_window.contents.draw_text(4, i*32, 224, 32, @commands[2][i])
  296.         @fog_window.contents.draw_text(-4, i*32, 224, 32, @fog[i].to_s, 2)
  297.       }
  298.     when 3 # Panorama
  299.       @panorama_window.contents.clear
  300.       @panorama.each_index {|i|
  301.         @panorama_window.contents.draw_text(4, i*32, 224, 32, @commands[3][i])
  302.         @panorama_window.contents.draw_text(-4, i*32, 224, 32, @panorama[i].to_s, 2)
  303.       }
  304.     when 4 # Shake
  305.       @shake_window.contents.clear
  306.       @shake.each_index {|i|
  307.         @shake_window.contents.draw_text(4, i*32, 128, 32, @commands[4][i])
  308.         @shake_window.contents.draw_text(-4, i*32, 128, 32, @shake[i].to_s, 2)
  309.       }
  310.     when 5 # Animation
  311.       @animation_window.contents.clear
  312.       @commands[5].each_index {|i|
  313.         @animation_window.contents.draw_text(4, i*32, 224, 32, @commands[5][i])
  314.         @animation_window.contents.draw_text(-4, i*32, 224, 32, @animation[i].to_s, 2)
  315.       }
  316.     when 6 # Picture
  317.       @picture_window.contents.clear
  318.       @picture.each_index {|i|
  319.         @picture_window.contents.draw_text(4, i*32, 224, 32, @commands[6][i])
  320.         @picture_window.contents.draw_text(-4, i*32, 224, 32, @picture[i].to_s, 2)
  321.       }
  322.     end
  323.   end
  324. #-------------------------------------------------------------------------------
  325.   def update_tone
  326.     if @value != nil
  327.       index = @tone_window.index
  328.       @tone[index] += @value
  329.       if index == 3
  330.         @tone[index] %= 256
  331.       else
  332.         @tone[index] = 255 if @tone[index] < -255
  333.         @tone[index] = -255 if @tone[index] > 255
  334.       end
  335.       tone = Tone.new(@tone[0], @tone[1], @tone[2], @tone[3])
  336.       @tone[3] = 0 if @tone[3] < 0
  337.       $game_screen.start_tone_change(tone, 0)
  338.       refresh_window
  339.     end
  340.   end
  341. #-------------------------------------------------------------------------------
  342.   def update_weather
  343.     if @value != nil
  344.       index = @weather_window.index
  345.       case index
  346.       when 0
  347.         @weather_index = (@weather_index + @value) % @weather_types.size
  348.         @weather[0] = @weather_types[@weather_index]
  349.       when 1
  350.         @weather[1] = (@weather[1] + @value) % 51
  351.       when 2, 3
  352.         @weather[index] = (@weather[index] + @value) % 1000
  353.       end
  354.       # Apply weather effect to screen.
  355.       if @weather.size == 4
  356.         $game_screen.weather(@weather[0], @weather[1], @weather[2], @weather[3])
  357.       else
  358.         $game_screen.weather(@weather[0], @weather[1], @weather[2])
  359.       end
  360.       refresh_window
  361.     end
  362.   end
  363. #-------------------------------------------------------------------------------
  364.   def update_fog
  365.     if @value != nil
  366.       index = @fog_window.index
  367.       if index == 0
  368.         @fog_index = (@fog_index + @value) % @fogs.size
  369.         @fog[0] = @fogs[@fog_index]
  370.       else
  371.         @fog[index] += @value
  372.       end
  373.       @fog[1] %= 360
  374.       @fog [2] %= 256
  375.       @fog[3] = [[@fog[3], 100].max, 800].min
  376.       @fog[4] %= 3
  377.       $game_map.fog_name = @fog[0] == 'None' ? '' : @fog[0]
  378.       $game_map.fog_opacity, $game_map.fog_zoom = @fog[2], @fog[3]
  379.       $game_map.fog_blend_type, $game_map.fog_hue = @fog[4], @fog[1]
  380.       $game_map.fog_sx, $game_map.fog_sy = @fog[5], @fog[6]
  381.       refresh_window
  382.     end
  383.   end
  384. #-------------------------------------------------------------------------------
  385.   def update_panorama
  386.     if @value != nil
  387.       if @panorama_window.index == 0
  388.         @panorama_index = (@value + @panorama_index) % @panoramas.size
  389.         @panorama[0] = @panoramas[@panorama_index]
  390.       else
  391.         @panorama[1] += @value
  392.       end
  393.       @panorama[1] %= 360
  394.       $game_map.panorama_name = @panorama[0] == 'None' ? '' : @panorama[0]
  395.       $game_map.panorama_hue = @panorama[1]
  396.       refresh_window
  397.     end
  398.   end
  399. #-------------------------------------------------------------------------------
  400.   def update_shake
  401.     if @value != nil
  402.       $game_system.se_play($data_system.cursor_se)
  403.       index = @shake_window.index
  404.       @shake[index] += @value
  405.       [0, 1].each {|i| @shake[i] %= 30 }
  406.       @shake[2] %= 1000
  407.       $game_screen.start_shake(@shake[0], @shake[1], @shake[2])
  408.       refresh_window
  409.     end
  410.   end
  411. #-------------------------------------------------------------------------------
  412.   def update_animation
  413.     if Input.trigger?(Input::C) && @animation_window.index == 3
  414.       animation = $data_animations[@animation_index]
  415.       return if animation == nil
  416.       @map.make_animation(@animation_index, @animation[1], @animation[2])
  417.     end
  418.     if @value != nil
  419.       case @animation_window.index
  420.       when 0
  421.         @animation_index = (@animation_index + @value) % $data_animations.size
  422.         if $data_animations[@animation_index] == nil
  423.           @animation[0] = 'None'
  424.         else
  425.           name = $data_animations[@animation_index].name
  426.           @animation[0] = name == '' ? "(#{@animation_index})" : name
  427.         end
  428.       when 1
  429.         @animation[1] = (@animation[1] + @value) % $game_map.width
  430.       when 2
  431.         @animation[2] = (@animation[2] + @value) % $game_map.height
  432.       end
  433.       refresh_window
  434.     end
  435.   end
  436. #-------------------------------------------------------------------------------
  437.   def update_picture
  438.     if @value != nil
  439.       index = @picture_window.index
  440.       if index == 0
  441.         @pic_index = (@pic_index + @value) % @pictures.size
  442.       elsif index == 4
  443.         @picture[4] += (@value / 10.0)
  444.       else
  445.         @picture[index] += @value
  446.       end
  447.       @picture[0] = @pic_index == 0 ? 'None' : @pictures[@pic_index]
  448.       @picture[3] %= 256
  449.       @picture[4] = [[@picture[4], 1.0].max, 10.0].min
  450.       @picture[5] %= 3
  451.       @picture[6] %= 360
  452.       # Draw sprite.
  453.       @map.make_picture(@picture)
  454.       refresh_window
  455.     end
  456.   end
  457. #-------------------------------------------------------------------------------
  458.   def set_window_info(window)
  459.     # Set the configured look to all the windows as they are made.
  460.     window.contents.font.name = WINDOW[0]
  461.     window.contents.font.size = WINDOW[1]
  462.     window.back_opacity = WINDOW[2]
  463.     window.x = window == @main_window ? 0 : 128
  464.     window.refresh
  465.   end
  466. #-------------------------------------------------------------------------------
  467.   def find_graphics
  468.     # Search "Fogs", "Panoramas", and "Pictures" folder for files.
  469.     @fogs = Dir.entries('Graphics/Fogs')
  470.     @panoramas = Dir.entries('Graphics/Panoramas')
  471.     @pictures = Dir.entries('Graphics/Pictures')
  472.     # Add all files from RTP into their respective arrays.
  473.     rtp_paths.each {|path|
  474.       @fogs += Dir.entries(path + '\Graphics\Fogs')
  475.       @panoramas += Dir.entries(path + '\Graphics\Panoramas')
  476.     }
  477.     # Iterate through combined folders, and omit all non-image files.
  478.     [@fogs, @panoramas, @pictures].each {|folder|
  479.       folder.collect! {|file|
  480.        if ['.png', '.jpg'].include?(File.extname(file))
  481.          # Remove file extension.
  482.          file.gsub!(/.png|.jpg/) {''}
  483.        end
  484.       }
  485.       # Remove nil elements and add 'None' string to each array.
  486.       folder.unshift('None').compact!
  487.     }
  488.   end
  489. #-------------------------------------------------------------------------------
  490.   def rtp_paths    
  491.     paths = []
  492.     [1, 2, 3].each {|id|
  493.       paths.push(RGSSGetPathWithRTP.call(RGSSGetRTPPath.call(id))) }
  494.     return paths.find_all {|path| path != '' }
  495.   end
  496. #-------------------------------------------------------------------------------
  497. end
  498.  
  499.   # DO NOT edit any of these lines. They are used to gather the RTP data.
  500.  
  501.   # Get the dll used for the game.
  502.   GPPSA = Win32API.new('kernel32', 'GetPrivateProfileStringA', 'PPPPLP', 'L')
  503.   dll = "\0" * 255
  504.   GPPSA.call('Game', 'Library', '', dll, 255, '.\\Game.ini')
  505.   dll.delete!("\0")
  506.   # Set constants to call path with.
  507.   RGSSGetRTPPath = Win32API.new(dll, 'RGSSGetRTPPath', 'L', 'L')
  508.   RGSSGetPathWithRTP = Win32API.new(dll, 'RGSSGetPathWithRTP', 'L', 'P')
  509.  
  510. #===============================================================================
  511. # ** Scene_Map
  512. #===============================================================================
  513.  
  514. class Scene_Map
  515.  
  516.   # Add call button to Scene_Map
  517.   alias zer0_screentest_map_upd update
  518.   def update
  519.     zer0_screentest_map_upd
  520.     if $DEBUG && Input.trigger?(Scene_ScreenTest::CALL_BUTTON)
  521.       $scene = Scene_ScreenTest.new
  522.     end
  523.   end
  524. end
  525.  
  526. #===============================================================================
  527. # ** Spriteset_Map
  528. #===============================================================================
  529.  
  530. class Spriteset_Map
  531.  
  532.   # Creates an event on the fly, plays the animation, then disposes it.
  533.   def make_animation(animation_id, x, y)
  534.     event = Game_Event.new($game_map.map_id, RPG::Event.new(x, y))
  535.     event.animation_id = animation_id
  536.     sprite = Sprite_Character.new(@viewport1, event)
  537.     # Loop Graphics and sprite update as long as animation is occurring.
  538.     while sprite.effect?
  539.       sprite.update
  540.       Graphics.update
  541.     end
  542.     sprite.dispose
  543.   end
  544.  
  545.   def make_picture(data)
  546.     # Create sprite if it does not exist.
  547.     if @pic == nil
  548.       @pic = Sprite.new(@viewport2)
  549.       # Add to picture array, so it automatically updates and disposes.
  550.       @picture_sprites.push(@pic)
  551.     end
  552.     # Clear bitmap and end method if no bitmap is defined.
  553.     if data[0] == 'None'
  554.       @pic.bitmap.clear if @pic.bitmap != nil
  555.       return
  556.     end
  557.     # Set the configured data to the picture.
  558.     @pic.bitmap = RPG::Cache.picture(data[0]).clone
  559.     @pic.x, @pic.y, @pic.opacity, @pic.angle = data[1], data[2], data[3], data[6]
  560.     @pic.zoom_x, @pic.zoom_y, @pic.blend_type = data[4], data[4], data[5]
  561.   end
  562. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top