Advertisement
Rafael_Sol_Maker

RSM's SCENE SLIDESHOW ACE (2Kx LOGO) BETA

Jul 12th, 2017
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.19 KB | None | 0 0
  1. #===============================================================================
  2. #                 RSM's SCENE SLIDESHOW ACE (2Kx LOGO) BETA
  3. #-------------------------------------------------------------------------------
  4. # Description:  Enables the addition of a slideshow of images that can also be
  5. #               used as a logo before the title screen, like the one in
  6. #               RPG Maker 2000/2003. You can also select a background music and
  7. #               use as a scene in the map using the specific command.
  8. #-------------------------------------------------------------------------------
  9. # ATTENTION! This is a BETA version, there is still a issue with the music
  10. # if you try to run it. Still needs polishment and proper documentation.
  11. # Please be patient. Thanks!
  12. #
  13. # How to Use:
  14. #   All images goes into the folder 'Graphics/Slideshow/';
  15. #   To use it in-game, use the following command in 'Call Script':
  16. #
  17. #      show_slideshow(['img1','img2',..., 'imgN'], <'music'>, <wait_time>,
  18. #                   <fadein_time>, <fadeout_time>, <next_scene>, <skippable>
  19. #
  20. # OBS.: ['img1','img2'] -> Put all your image names between quotes, all inside
  21. #       the brackets, separated
  22. #       <'music'> is the filename of the music you wanto to play.
  23. #       <wait_time> is given in seconds;
  24. #       <fade_in_time>, <fade_out_time> are given in frames
  25. #       (roughly 60 are equal to 1 second);
  26. #       Parameters between <> are are optional.
  27. #       (BETTER DESCRIPTION AND INSTRUCTIONS TO COME)
  28. #-------------------------------------------------------------------------------
  29. # Special Thanks: PRCoders
  30. #-------------------------------------------------------------------------------
  31. #===============================================================================
  32.  
  33. #===============================================================================
  34. # UPDATES
  35. #-------------------------------------------------------------------------------
  36. # VX SCENE INTRO -> SCENE SLIDESHOW ACE (conversion from RGSS2 to RGSS3)
  37. # * Large structural change, to fit the new SceneManager and DataManager.
  38. #-------------------------------------------------------------------------------
  39. #===============================================================================
  40.  
  41. #==============================================================================
  42. # ** Cache
  43. #------------------------------------------------------------------------------
  44. module Configurables
  45.   module Slideshow
  46.     Show_Before_Title_Screen = true
  47.     Default_Pictures = ['Splashscreen']
  48.     Default_Music = 'Theme2'
  49.   end
  50. end
  51. #==============================================================================
  52. # ** Cache
  53. #------------------------------------------------------------------------------
  54. module Cache
  55.   def self.slideshows(filename)
  56.     load_bitmap('Graphics/Slideshows/', filename)
  57.   end
  58. end
  59. #==============================================================================
  60. # ** DataManager
  61. #------------------------------------------------------------------------------
  62. module DataManager
  63.  
  64.   class << self
  65.     alias rsm_sldshw_ace_create_game_objects create_game_objects
  66.   end
  67.   def self.create_game_objects
  68.       rsm_sldshw_ace_create_game_objects
  69.       $game_slideshow = Game_Slideshow.new
  70.   end
  71. end
  72. #==============================================================================
  73. # ** SceneManager
  74. #------------------------------------------------------------------------------
  75. module SceneManager
  76. include Configurables::Slideshow
  77.   def self.first_scene_class
  78.     $BTEST ? Scene_Battle :
  79.      (Show_Before_Title_Screen ? Scene_Slideshow : Scene_Title)
  80.   end
  81. end
  82. #==============================================================================
  83. # ** Game_Slideshow
  84. #------------------------------------------------------------------------------
  85. class Game_Slideshow
  86.   include Configurables::Slideshow
  87.   attr_accessor :pictures
  88.   attr_accessor :music
  89.   attr_accessor :wait_time
  90.   attr_accessor :fade_in_time
  91.   attr_accessor :fade_out_time
  92.   attr_accessor :allow_skipping
  93.   attr_accessor :next_scene
  94.   #--------------------------------------------------------------------------
  95.   # *
  96.   #--------------------------------------------------------------------------
  97.   def initialize
  98.     # Setup for first time use (default values, used in splascreen)
  99.     setup(Default_Pictures, Default_Music, 4, 60, 60, :scene_title, true)
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # *
  103.   #--------------------------------------------------------------------------
  104.   def setup(pictures, music, wait_time, fade_in_time, fade_out_time,
  105.       next_scene, allow_skipping)
  106.     @pictures = pictures
  107.     @music = music
  108.     @wait_time = wait_time
  109.     @fade_in_time = fade_in_time
  110.     @fade_out_time = fade_out_time
  111.     @next_scene = next_scene
  112.     @allow_skipping = allow_skipping
  113.   end
  114. end
  115. #==============================================================================
  116. # ** Game_Interpreter
  117. #------------------------------------------------------------------------------
  118. class Game_Interpreter
  119.   def play_slideshow(pictures, music, wait = 4, fade_in = 60,  fade_out = 60,
  120.       next_scene = :scene_map, skippable = true)
  121.     $game_slideshow.setup(pictures, music, wait, fade_in, fade_out,
  122.       next_scene, skippable)
  123.     SceneManager.goto(Scene_Slideshow)
  124.   end
  125. end
  126. #==============================================================================
  127. # ** Scene_Slideshow
  128. #------------------------------------------------------------------------------
  129. class Scene_Slideshow < Scene_Base
  130.   #--------------------------------------------------------------------------
  131.   # * Preparing the backstage of the scene
  132.   #--------------------------------------------------------------------------
  133.   def auto_setup
  134.     @pictures = $game_slideshow.pictures
  135.     @music = $game_slideshow.music
  136.     @wait_time = $game_slideshow.wait_time
  137.     @fade_in_time = $game_slideshow.fade_in_time
  138.     @fade_out_time = $game_slideshow.fade_out_time
  139.     @allow_skipping = $game_slideshow.allow_skipping
  140.     @next_scene = $game_slideshow.next_scene
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # * Main processing
  144.   #--------------------------------------------------------------------------
  145.   def start
  146.     super
  147.     @time_count = Graphics.frame_count
  148.     auto_setup
  149.     play_music
  150.     prepare_fadein
  151.     create_pictures
  152.     execute_fadein
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # * Terminating the process
  156.   #--------------------------------------------------------------------------
  157.   def terminate
  158.     super
  159.     dispose_pictures
  160.     replay_last_music
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # * Screen update
  164.   #--------------------------------------------------------------------------
  165.   def update
  166.     super
  167.     next_scene if Input.trigger?(:A)||Input.trigger?(:B)||
  168.       Input.trigger?(:X)||Input.trigger?(:Y)|| wait(@wait_time)
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # * Execution of the transition
  172.   #--------------------------------------------------------------------------
  173.   def perform_transition
  174.     Graphics.transition(@fade_in_time)
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # *
  178.   #--------------------------------------------------------------------------
  179.   def wait(time)
  180.     Graphics.frame_count >= @time_count + (time * Graphics.frame_rate)
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # * Playing the music
  184.   #--------------------------------------------------------------------------
  185.   def play_music
  186.     unless @music.nil?
  187.       RPG::BGM.stop
  188.       RPG::BGS.stop
  189.       Audio.bgm_play ('Audio/BGM/' + @music)
  190.     end
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # *
  194.   #--------------------------------------------------------------------------
  195.   def replay_last_music
  196.     unless @music.nil?
  197.       RPG::BGM.last.play
  198.       RPG::BGS.last.play
  199.     end
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # *
  203.   #--------------------------------------------------------------------------
  204.   def fade_out_music
  205.     unless @music.nil?
  206.       time = @fade_out_time * 33.33
  207.       ME.fade(time)
  208.       SE.stop
  209.       Audio.bgm_fade(time)
  210.       Audio.bgs_fade(time)
  211.     end
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # * Fade out and freezing the screen
  215.   #--------------------------------------------------------------------------
  216.   def prepare_fadein
  217.     Graphics.fadeout(0)
  218.     Graphics.freeze
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # * Creation of the background
  222.   #--------------------------------------------------------------------------
  223.   def execute_fadein
  224.     Graphics.fadein(@fade_in_time)
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # *
  228.   #--------------------------------------------------------------------------
  229.   def create_pictures
  230.     @sprite = Sprite.new
  231.     @sprite.bitmap = Cache.slideshows(@pictures[0])
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # * Disposing of the background
  235.   #--------------------------------------------------------------------------
  236.   def dispose_pictures
  237.     @sprite.bitmap.dispose
  238.     @sprite.dispose
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # * Transition for the next scene
  242.   #--------------------------------------------------------------------------
  243.   def next_scene
  244.     fadeout_all
  245.     case @next_scene
  246.     when :scene_title
  247.       SceneManager.goto(Scene_Title)
  248.     when :scene_map
  249.       SceneManager.goto(Scene_Map)
  250.     end
  251.   end
  252. end
  253. #-------------------------------------------------------------------------------
  254. # * THE END - That's all, folks!
  255. #-------------------------------------------------------------------------------
  256. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement