Advertisement
diamondandplatinum3

Sound Test Scene ~ Customisable Version ~ RGSS3

Sep 30th, 2013
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 74.25 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Sound Test Scene ~ Customisable Version
  3. #             Version: 1.0
  4. #             Author: DiamondandPlatinum3
  5. #             Date: June 18, 2013
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #  Description:
  8. #
  9. #    This script creates a new scene in your game which allows you to listen to
  10. #    music that is played throughout your game. It also allows for some
  11. #    customisation to be made when playing a sound, such as modifying Volume,
  12. #    Pitch and/or Position.
  13. #    Music can also be locked until a certain Event Switch is turned on.
  14. #
  15. #    It also allows you to have categories for your Sound Files and individual
  16. #    album art for each audio file.
  17. #
  18. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  19. #------------------------------------------------------------------------------
  20. #  Instructions:
  21. #  
  22. #  ~  You can load the SoundTestScene at anytime by inputting the following in
  23. #     a script call:
  24. #                       SceneManager.call(Scene_SoundTest)
  25. #
  26. #
  27. #  ~  Go into the Script and Modify the Editable Region as Needed
  28. #
  29. #
  30. #  ~  Be sure your Album Art Images are placed in the approriate folder.
  31. #
  32. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. module DiamondandPlatinum3
  34.   module SoundTestScene
  35.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  36.     #                                                        -=
  37.     #                 Editable Region        ////            ==
  38.     #                                                        =-
  39.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40.      
  41.     # Text to be Displayed when Selecting a Category
  42.     CategorySelectHelpWindowTextLine1   = "Select a Category"
  43.     CategorySelectHelpWindowTextLine2   = "Press 'Esc or X' to Exit"
  44.    
  45.     # Text to be displayed on the help window when Selecting a Sound
  46.     SoundSelectHelpWindowTextLine1      = "Select a Sound"
  47.     SoundSelectHelpWindowTextLine2      = "Press 'Esc or X' to Exit"
  48.    
  49.     # Text to be displayed on the help window when Hovering over the 'Play Sound' Option
  50.     PlaySoundOptionHelpWindowTextLine1  = "Select To Play Sound"
  51.     PlaySoundOptionHelpWindowTextLine2  = "(Default Settings)"
  52.    
  53.     # Text to be displayed on the help window when Hovering over the 'Volume' Option
  54.     VolumeOptionHelpWindowTextLine1     = "Select To Play Sound"
  55.     VolumeOptionHelpWindowTextLine2     = "(At Specific Volume)"
  56.    
  57.     # Text to be displayed on the help window when Hovering over the 'Pitch' Option
  58.     PitchOptionHelpWindowTextLine1      = "Select To Play Sound"
  59.     PitchOptionHelpWindowTextLine2      = "(At Specific Pitch)"
  60.    
  61.     # Text to be displayed on the help window when Hovering over the 'Position' Option
  62.     PositionOptionHelpWindowTextLine1   = "Select To Play Sound At Specific Position"
  63.     PositionOptionHelpWindowTextLine2   = "(Only works for WAV & OGG Files)"
  64.    
  65.     # Text to be displayed on the help window when inputting a value in the NuberInput Window
  66.     NumberInputHelpWindowTextLine1      = "Input A Value"
  67.     NumberInputHelpWindowTextLine2      = ""
  68.    
  69.    
  70.    
  71.     # Where Will the Script Find the Album Art Associated with the Music?
  72.     AlbumArtFolder                      = "Graphics/Pictures/"
  73.    
  74.    
  75.     # Filename of Background Image to be Displayed if no Album Art is provided
  76.     # If You do not want a default image, leave an empty string ( "" )
  77.     DefaultBackgroundSpriteFilename     = "SoundTest_BackgroundImage"
  78.    
  79.    
  80.    
  81.     # Position only works with Wav|Ogg files, if you're lacking these filetypes,
  82.     # then the Position command is pretty awkward, you can disable it here.
  83.     EnablePositionCommand               = true
  84.    
  85.    
  86.     # If Enabled, Windows will animate into the scene when entered (either via
  87.     #  transparency or by flying in).
  88.     # If Disabled, all windows will be there from the get-go
  89.     EnableIntroAnimation                = true
  90.    
  91.    
  92.    
  93.     # If Enabled, The SoundTestScene will be available to select in the Main Menu
  94.     EnableMenuOption                    = true
  95.    
  96.     # The Text that is displayed for the Option in the Menu
  97.     MenuCommandText                     = "Sound Test"
  98.    
  99.     # If Menu Enabled, this Switch (when activated) will allow the user to select
  100.     # the SoundTestScene. If not activated, no access will be granted to the scene
  101.     # via menu.
  102.     #
  103.     # If Set to Zero, the SoundTestScene will always be available via menu.
  104.     EnableSwitchID                      = 0
  105.    
  106.    
  107.    
  108.     # How Many Category Commands can be on one line? Modify this if you find
  109.     # your text being cut off.
  110.     MaxCategoryHorizontalCommands       = 3
  111.    
  112.    
  113.     # Categories of Music to be used in the Scene, add as many as you'd like
  114.     Music_Categories =
  115.     [
  116.    
  117.       "Battle Themes",
  118.       "Event Themes",
  119.       "Town Themes",
  120.       "Overworld Themes",
  121.      
  122.     ]
  123.    
  124.    
  125.     #--------------------------------------
  126.     Sounds = { # <=   Do Not Touch
  127.     #--------------------------------------
  128.    
  129.    
  130.     # Exact Filename of BGM you want to Have in the Scene
  131.       "Airship" =>
  132.       {
  133.         :display_name       =>  "Airship Theme",              # Display Name of Sound
  134.         :default_volume     =>  100,                          # Deault Volume
  135.         :default_pitch      =>  100,                          # Default Pitch
  136.         :conditional_switch =>  0,                            # Conditional Switch (Must be on before sound will be available, unless event switch is Zero)
  137.         :category           =>  "Overworld Themes",           # Which Category will this Sound Appear in?
  138.         :info_line1         =>  "Author: Enterbrain",         # Info Line1, can be anything you want to say about the Individual Sound
  139.         :info_line2         =>  "Used As: Airship Theme",     # Info Line2, can be anything you want to say about the Individual Sound
  140.         :info_line3         =>  "",                           # Info Line3, can be anything you want to say about the Individual Sound
  141.         :info_line4         =>  "From: RPG Maker VX Ace RTP", # Info Line4, can be anything you want to say about the Individual Sound
  142.         :album_art_filename =>  "Skit_Background_Image",                           # Filename for Custom Album Art, If no custom album art, leave as empty string ( "" )
  143.       },
  144.      
  145.      
  146.       # Rinse, Repeat. Keep Doing this until all your desired SoundFiles are Available to be played
  147.       "Battle1" =>
  148.       {
  149.         :display_name       => "Battle Theme 1",    
  150.         :default_volume     =>  100,                
  151.         :default_pitch      =>  100,                
  152.         :conditional_switch =>  0,                  
  153.         :category           =>  "Battle Themes",
  154.         :info_line1         =>  "Author: Enterbrain",                
  155.         :info_line2         =>  "Used As: Normal Battle Theme",                
  156.         :info_line3         =>  "",                
  157.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  158.         :album_art_filename =>  "",
  159.       },
  160.      
  161.      
  162.       "Battle2" =>
  163.       {
  164.         :display_name       => "Battle Theme 2",    
  165.         :default_volume     =>  100,                
  166.         :default_pitch      =>  100,                
  167.         :conditional_switch =>  0,                  
  168.         :category           =>  "Battle Themes",
  169.         :info_line1         =>  "Author: Enterbrain",                
  170.         :info_line2         =>  "Used As: Normal Battle Theme",                
  171.         :info_line3         =>  "",                
  172.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  173.         :album_art_filename =>  "Emily4.jpg",
  174.       },
  175.      
  176.      
  177.       "Battle3" =>
  178.       {
  179.         :display_name       => "Battle Theme 3",    
  180.         :default_volume     =>  100,                
  181.         :default_pitch      =>  100,                
  182.         :conditional_switch =>  0,                  
  183.         :category           =>  "Battle Themes",
  184.         :info_line1         =>  "Author: Enterbrain",                
  185.         :info_line2         =>  "Used As: Mini-Boss Battle Theme",                
  186.         :info_line3         =>  "",                
  187.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  188.         :album_art_filename =>  "",
  189.       },
  190.      
  191.      
  192.       "Battle4" =>
  193.       {
  194.         :display_name       => "Battle Theme 4",    
  195.         :default_volume     =>  100,                
  196.         :default_pitch      =>  100,                
  197.         :conditional_switch =>  0,                  
  198.         :category           =>  "Battle Themes",
  199.         :info_line1         =>  "Author: Enterbrain",                
  200.         :info_line2         =>  "Used As: Normal Battle Theme",                
  201.         :info_line3         =>  "",                
  202.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  203.         :album_art_filename =>  "",
  204.       },
  205.      
  206.      
  207.       "Battle5" =>
  208.       {
  209.         :display_name       => "Battle Theme 5",    
  210.         :default_volume     =>  100,                
  211.         :default_pitch      =>  100,                
  212.         :conditional_switch =>  0,                  
  213.         :category           =>  "Battle Themes",
  214.         :info_line1         =>  "Author: Enterbrain",                
  215.         :info_line2         =>  "Used As: Normal Battle Theme",                
  216.         :info_line3         =>  "",                
  217.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  218.         :album_art_filename =>  "",
  219.       },
  220.      
  221.      
  222.       "Battle6" =>
  223.       {
  224.         :display_name       => "Battle Theme 6",    
  225.         :default_volume     =>  100,                
  226.         :default_pitch      =>  100,                
  227.         :conditional_switch =>  0,                  
  228.         :category           =>  "Battle Themes",
  229.         :info_line1         =>  "Author: Enterbrain",                
  230.         :info_line2         =>  "Used As: Normal Battle Theme",                
  231.         :info_line3         =>  "",                
  232.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  233.         :album_art_filename =>  "",
  234.       },
  235.      
  236.      
  237.       "Battle7" =>
  238.       {
  239.         :display_name       => "Battle Theme 7",    
  240.         :default_volume     =>  100,                
  241.         :default_pitch      =>  100,                
  242.         :conditional_switch =>  0,                  
  243.         :category           =>  "Battle Themes",
  244.         :info_line1         =>  "Author: Enterbrain",                
  245.         :info_line2         =>  "Used As: Normal Battle Theme",                
  246.         :info_line3         =>  "",                
  247.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  248.         :album_art_filename =>  "",
  249.       },
  250.      
  251.      
  252.       "Battle8" =>
  253.       {
  254.         :display_name       => "Battle Theme 8",    
  255.         :default_volume     =>  100,                
  256.         :default_pitch      =>  100,                
  257.         :conditional_switch =>  0,                  
  258.         :category           =>  "Battle Themes",
  259.         :info_line1         =>  "Author: Enterbrain",                
  260.         :info_line2         =>  "Used As: Boss Battle Theme",                
  261.         :info_line3         =>  "",                
  262.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  263.         :album_art_filename =>  "",
  264.       },
  265.      
  266.      
  267.       "Battle9" =>
  268.       {
  269.         :display_name       => "Battle Theme 9",    
  270.         :default_volume     =>  100,                
  271.         :default_pitch      =>  100,                
  272.         :conditional_switch =>  0,                  
  273.         :category           =>  "Battle Themes",
  274.         :info_line1         =>  "Author: Enterbrain",                
  275.         :info_line2         =>  "Used As: Final Boss Battle Theme",                
  276.         :info_line3         =>  "",                
  277.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  278.         :album_art_filename =>  "",
  279.       },
  280.      
  281.      
  282.       "Dungeon1" =>
  283.       {
  284.         :display_name       => "Dungeon Theme 1",    
  285.         :default_volume     =>  100,                
  286.         :default_pitch      =>  100,                
  287.         :conditional_switch =>  0,                  
  288.         :category           =>  "Dungeon Themes",
  289.         :info_line1         =>  "Author: Enterbrain",                
  290.         :info_line2         =>  "Used As: BootCamp Cave Theme",                
  291.         :info_line3         =>  "",                
  292.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  293.         :album_art_filename =>  "",
  294.       },
  295.      
  296.      
  297.       "Dungeon2" =>
  298.       {
  299.         :display_name       => "Dungeon Theme 2",    
  300.         :default_volume     =>  100,                
  301.         :default_pitch      =>  100,                
  302.         :conditional_switch =>  0,                  
  303.         :category           =>  "Dungeon Themes",
  304.         :info_line1         =>  "Author: Enterbrain",                
  305.         :info_line2         =>  "Used As: Heavy Rain Theme",                
  306.         :info_line3         =>  "",                
  307.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  308.         :album_art_filename =>  "",
  309.       },
  310.      
  311.      
  312.       "Dungeon3" =>
  313.       {
  314.         :display_name       => "Dungeon Theme 3",    
  315.         :default_volume     =>  100,                
  316.         :default_pitch      =>  100,                
  317.         :conditional_switch =>  0,                  
  318.         :category           =>  "Dungeon Themes",
  319.         :info_line1         =>  "Author: Enterbrain",                
  320.         :info_line2         =>  "Used As: Underground Base Theme",                
  321.         :info_line3         =>  "",                
  322.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  323.         :album_art_filename =>  "",
  324.       },
  325.      
  326.      
  327.       "Dungeon4" =>
  328.       {
  329.         :display_name       => "Dungeon Theme 4",    
  330.         :default_volume     =>  100,                
  331.         :default_pitch      =>  100,                
  332.         :conditional_switch =>  0,                  
  333.         :category           =>  "Dungeon Themes",
  334.         :info_line1         =>  "Author: Enterbrain",                
  335.         :info_line2         =>  "Used As: Thought Before War Theme",                
  336.         :info_line3         =>  "",                
  337.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  338.         :album_art_filename =>  "",
  339.       },
  340.      
  341.      
  342.       "Dungeon5" =>
  343.       {
  344.         :display_name       => "Dungeon Theme 5",    
  345.         :default_volume     =>  100,                
  346.         :default_pitch      =>  100,                
  347.         :conditional_switch =>  0,                  
  348.         :category           =>  "Dungeon Themes",
  349.         :info_line1         =>  "Author: Enterbrain",                
  350.         :info_line2         =>  "Used As: Magical Cavern Theme",                
  351.         :info_line3         =>  "",                
  352.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  353.         :album_art_filename =>  "",
  354.       },
  355.      
  356.      
  357.       "Dungeon6" =>
  358.       {
  359.         :display_name       => "Dungeon Theme 6",    
  360.         :default_volume     =>  100,                
  361.         :default_pitch      =>  100,                
  362.         :conditional_switch =>  0,                  
  363.         :category           =>  "Dungeon Themes",
  364.         :info_line1         =>  "Author: Enterbrain",                
  365.         :info_line2         =>  "Used As: Following a Trail Theme",                
  366.         :info_line3         =>  "",                
  367.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  368.         :album_art_filename =>  "",
  369.       },
  370.      
  371.      
  372.       "Dungeon7" =>
  373.       {
  374.         :display_name       => "Dungeon Theme 7",    
  375.         :default_volume     =>  100,                
  376.         :default_pitch      =>  100,                
  377.         :conditional_switch =>  0,                  
  378.         :category           =>  "Dungeon Themes",
  379.         :info_line1         =>  "Author: Enterbrain",                
  380.         :info_line2         =>  "Used As: Climbing the Heavens Theme",                
  381.         :info_line3         =>  "",                
  382.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  383.         :album_art_filename =>  "",
  384.       },
  385.      
  386.      
  387.       "Dungeon8" =>
  388.       {
  389.         :display_name       => "Dungeon Theme 8",    
  390.         :default_volume     =>  100,                
  391.         :default_pitch      =>  100,                
  392.         :conditional_switch =>  0,                  
  393.         :category           =>  "Dungeon Themes",
  394.         :info_line1         =>  "Author: Enterbrain",                
  395.         :info_line2         =>  "Used As: Descending to the Ground Theme",                
  396.         :info_line3         =>  "",                
  397.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  398.         :album_art_filename =>  "",
  399.       },
  400.      
  401.      
  402.       "Dungeon9" =>
  403.       {
  404.         :display_name       => "Dungeon Theme 9",    
  405.         :default_volume     =>  100,                
  406.         :default_pitch      =>  100,                
  407.         :conditional_switch =>  0,                  
  408.         :category           =>  "Dungeon Themes",
  409.         :info_line1         =>  "Author: Enterbrain",                
  410.         :info_line2         =>  "Used As: Last Dungeon Theme",                
  411.         :info_line3         =>  "",                
  412.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  413.         :album_art_filename =>  "",
  414.       },
  415.      
  416.      
  417.       "Field1" =>
  418.       {
  419.         :display_name       => "Field Map Theme 1",    
  420.         :default_volume     =>  100,                
  421.         :default_pitch      =>  100,                
  422.         :conditional_switch =>  0,                  
  423.         :category           =>  "Overworld Themes",
  424.         :info_line1         =>  "Author: Enterbrain",                
  425.         :info_line2         =>  "Used As: Starting Your Journey Theme",                
  426.         :info_line3         =>  "",                
  427.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  428.         :album_art_filename =>  "",
  429.       },
  430.      
  431.      
  432.       "Field2" =>
  433.       {
  434.         :display_name       => "Field Map Theme 2",    
  435.         :default_volume     =>  100,                
  436.         :default_pitch      =>  100,                
  437.         :conditional_switch =>  0,                  
  438.         :category           =>  "Overworld Themes",
  439.         :info_line1         =>  "Author: Enterbrain",                
  440.         :info_line2         =>  "Used As: World Map Theme",                
  441.         :info_line3         =>  "",                
  442.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  443.         :album_art_filename =>  "",
  444.       },
  445.      
  446.      
  447.       "Field3" =>
  448.       {
  449.         :display_name       => "Field Map Theme 3",    
  450.         :default_volume     =>  100,                
  451.         :default_pitch      =>  100,                
  452.         :conditional_switch =>  0,                  
  453.         :category           =>  "Overworld Themes",
  454.         :info_line1         =>  "Author: Enterbrain",                
  455.         :info_line2         =>  "Used As: The Heroes of this Tale Theme",                
  456.         :info_line3         =>  "",                
  457.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  458.         :album_art_filename =>  "",
  459.       },
  460.      
  461.      
  462.       "Field4" =>
  463.       {
  464.         :display_name       => "Field Map Theme 4",    
  465.         :default_volume     =>  100,                
  466.         :default_pitch      =>  100,                
  467.         :conditional_switch =>  0,                  
  468.         :category           =>  "Overworld Themes",
  469.         :info_line1         =>  "Author: Enterbrain",                
  470.         :info_line2         =>  "Used As: A World in Chaos Theme",                
  471.         :info_line3         =>  "",                
  472.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  473.         :album_art_filename =>  "",
  474.       },
  475.      
  476.      
  477.       "Scene1" =>
  478.       {
  479.         :display_name       => "Custom Scene Theme 1",    
  480.         :default_volume     =>  100,                
  481.         :default_pitch      =>  100,                
  482.         :conditional_switch =>  0,                  
  483.         :category           =>  "Event Themes",
  484.         :info_line1         =>  "Author: Enterbrain",                
  485.         :info_line2         =>  "Used As: In Danger Theme",                
  486.         :info_line3         =>  "",                
  487.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  488.         :album_art_filename =>  "",
  489.       },
  490.      
  491.      
  492.       "Scene2" =>
  493.       {
  494.         :display_name       => "Custom Scene Theme 2",    
  495.         :default_volume     =>  100,                
  496.         :default_pitch      =>  100,                
  497.         :conditional_switch =>  0,                  
  498.         :category           =>  "Event Themes",
  499.         :info_line1         =>  "Author: Enterbrain",                
  500.         :info_line2         =>  "Used As: Villain Appears Theme",                
  501.         :info_line3         =>  "",                
  502.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  503.         :album_art_filename =>  "",
  504.       },
  505.      
  506.      
  507.       "Scene3" =>
  508.       {
  509.         :display_name       => "Custom Scene Theme 3",    
  510.         :default_volume     =>  100,                
  511.         :default_pitch      =>  100,                
  512.         :conditional_switch =>  0,                  
  513.         :category           =>  "Event Themes",
  514.         :info_line1         =>  "Author: Enterbrain",                
  515.         :info_line2         =>  "Used As: Villain Two Appears Theme",                
  516.         :info_line3         =>  "",                
  517.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  518.         :album_art_filename =>  "",
  519.       },
  520.      
  521.      
  522.       "Scene4" =>
  523.       {
  524.         :display_name       => "Custom Scene Theme 4",    
  525.         :default_volume     =>  100,                
  526.         :default_pitch      =>  100,                
  527.         :conditional_switch =>  0,                  
  528.         :category           =>  "Event Themes",
  529.         :info_line1         =>  "Author: Enterbrain",                
  530.         :info_line2         =>  "Used As: Found a New Friend Theme",                
  531.         :info_line3         =>  "",                
  532.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  533.         :album_art_filename =>  "",
  534.       },
  535.      
  536.      
  537.       "Scene5" =>
  538.       {
  539.         :display_name       => "Custom Scene Theme 5",    
  540.         :default_volume     =>  100,                
  541.         :default_pitch      =>  100,                
  542.         :conditional_switch =>  0,                  
  543.         :category           =>  "Event Themes",
  544.         :info_line1         =>  "Author: Enterbrain",                
  545.         :info_line2         =>  "Used As: HeartWarming Discussion Theme",                
  546.         :info_line3         =>  "",                
  547.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  548.         :album_art_filename =>  "",
  549.       },
  550.      
  551.      
  552.       "Scene6" =>
  553.       {
  554.         :display_name       => "Custom Scene Theme 6",    
  555.         :default_volume     =>  100,                
  556.         :default_pitch      =>  100,                
  557.         :conditional_switch =>  0,                  
  558.         :category           =>  "Event Themes",
  559.         :info_line1         =>  "Author: Enterbrain",                
  560.         :info_line2         =>  "Used As: Happiness Theme",                
  561.         :info_line3         =>  "",                
  562.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  563.         :album_art_filename =>  "",
  564.       },
  565.      
  566.      
  567.       "Ship" =>
  568.       {
  569.         :display_name       => "Ship Theme",    
  570.         :default_volume     =>  100,                
  571.         :default_pitch      =>  100,                
  572.         :conditional_switch =>  0,                  
  573.         :category           =>  "Overworld Themes",
  574.         :info_line1         =>  "Author: Enterbrain",                
  575.         :info_line2         =>  "Used As: Riding in a Ship Theme",                
  576.         :info_line3         =>  "",                
  577.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  578.         :album_art_filename =>  "",
  579.       },
  580.      
  581.      
  582.       "Theme1" =>
  583.       {
  584.         :display_name       => "Custom Theme 1",    
  585.         :default_volume     =>  100,                
  586.         :default_pitch      =>  100,                
  587.         :conditional_switch =>  0,                  
  588.         :category           =>  "Event Themes",
  589.         :info_line1         =>  "Author: Enterbrain",                
  590.         :info_line2         =>  "Used As: We are a Team Theme",                
  591.         :info_line3         =>  "",                
  592.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  593.         :album_art_filename =>  "",
  594.       },
  595.      
  596.      
  597.       "Theme2" =>
  598.       {
  599.         :display_name       => "Custom Theme 2",    
  600.         :default_volume     =>  100,                
  601.         :default_pitch      =>  100,                
  602.         :conditional_switch =>  0,                  
  603.         :category           =>  "Event Themes",
  604.         :info_line1         =>  "Author: Enterbrain",                
  605.         :info_line2         =>  "Used As: Fallen Heroes Theme",                
  606.         :info_line3         =>  "",                
  607.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  608.         :album_art_filename =>  "",
  609.       },
  610.      
  611.      
  612.       "Theme3" =>
  613.       {
  614.         :display_name       => "Custom Theme 3",    
  615.         :default_volume     =>  100,                
  616.         :default_pitch      =>  100,                
  617.         :conditional_switch =>  0,                  
  618.         :category           =>  "Event Themes",
  619.         :info_line1         =>  "Author: Enterbrain",                
  620.         :info_line2         =>  "Used As: Art Museum Theme",                
  621.         :info_line3         =>  "",                
  622.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  623.         :album_art_filename =>  "",
  624.       },
  625.      
  626.      
  627.       "Theme4" =>
  628.       {
  629.         :display_name       => "Custom Theme 4",    
  630.         :default_volume     =>  100,                
  631.         :default_pitch      =>  100,                
  632.         :conditional_switch =>  0,                  
  633.         :category           =>  "Event Themes",
  634.         :info_line1         =>  "Author: Enterbrain",                
  635.         :info_line2         =>  "Used As: Ending Credits Theme",                
  636.         :info_line3         =>  "",                
  637.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  638.         :album_art_filename =>  "",
  639.       },
  640.      
  641.      
  642.       "Theme5" =>
  643.       {
  644.         :display_name       => "Custom Theme 5",    
  645.         :default_volume     =>  100,                
  646.         :default_pitch      =>  100,                
  647.         :conditional_switch =>  0,                  
  648.         :category           =>  "Event Themes",
  649.         :info_line1         =>  "Author: Enterbrain",                
  650.         :info_line2         =>  "Used As: Supporters Theme",                
  651.         :info_line3         =>  "",                
  652.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  653.         :album_art_filename =>  "",
  654.       },
  655.      
  656.      
  657.       "Town1" =>
  658.       {
  659.         :display_name       => "Town Theme 1",    
  660.         :default_volume     =>  100,                
  661.         :default_pitch      =>  100,                
  662.         :conditional_switch =>  0,                  
  663.         :category           =>  "Town Themes",
  664.         :info_line1         =>  "Author: Enterbrain",                
  665.         :info_line2         =>  "Used As: Hero's Home Town Theme",                
  666.         :info_line3         =>  "",                
  667.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  668.         :album_art_filename =>  "",
  669.       },
  670.      
  671.      
  672.       "Town2" =>
  673.       {
  674.         :display_name       => "Town Theme 2",    
  675.         :default_volume     =>  100,                
  676.         :default_pitch      =>  100,                
  677.         :conditional_switch =>  0,                  
  678.         :category           =>  "Town Themes",
  679.         :info_line1         =>  "Author: Enterbrain",                
  680.         :info_line2         =>  "Used As: Capital City Theme",                
  681.         :info_line3         =>  "",                
  682.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  683.         :album_art_filename =>  "",
  684.       },
  685.      
  686.      
  687.       "Town3" =>
  688.       {
  689.         :display_name       => "Town Theme 3",    
  690.         :default_volume     =>  100,                
  691.         :default_pitch      =>  100,                
  692.         :conditional_switch =>  0,                  
  693.         :category           =>  "Town Themes",
  694.         :info_line1         =>  "Author: Enterbrain",                
  695.         :info_line2         =>  "Used As: Scummy Area of Town Theme",                
  696.         :info_line3         =>  "",                
  697.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  698.         :album_art_filename =>  "",
  699.       },
  700.      
  701.      
  702.       "Town4" =>
  703.       {
  704.         :display_name       => "Town Theme 4",    
  705.         :default_volume     =>  100,                
  706.         :default_pitch      =>  100,                
  707.         :conditional_switch =>  0,                  
  708.         :category           =>  "Town Themes",
  709.         :info_line1         =>  "Author: Enterbrain",                
  710.         :info_line2         =>  "Used As: Elderly Village Theme",                
  711.         :info_line3         =>  "",                
  712.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  713.         :album_art_filename =>  "",
  714.       },
  715.      
  716.      
  717.       "Town5" =>
  718.       {
  719.         :display_name       => "Town Theme 5",    
  720.         :default_volume     =>  100,                
  721.         :default_pitch      =>  100,                
  722.         :conditional_switch =>  0,                  
  723.         :category           =>  "Town Themes",
  724.         :info_line1         =>  "Author: Enterbrain",                
  725.         :info_line2         =>  "Used As: Peaceful Village Theme",                
  726.         :info_line3         =>  "",                
  727.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  728.         :album_art_filename =>  "",
  729.       },
  730.      
  731.      
  732.       "Town6" =>
  733.       {
  734.         :display_name       => "Town Theme 6",    
  735.         :default_volume     =>  100,                
  736.         :default_pitch      =>  100,                
  737.         :conditional_switch =>  0,                  
  738.         :category           =>  "Town Themes",
  739.         :info_line1         =>  "Author: Enterbrain",                
  740.         :info_line2         =>  "Used As: A Town for Adventurer's Theme",                
  741.         :info_line3         =>  "",                
  742.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  743.         :album_art_filename =>  "",
  744.       },
  745.      
  746.      
  747.       "Town7" =>
  748.       {
  749.         :display_name       => "Town Theme 7",    
  750.         :default_volume     =>  100,                
  751.         :default_pitch      =>  100,                
  752.         :conditional_switch =>  0,                  
  753.         :category           =>  "Town Themes",
  754.         :info_line1         =>  "Author: Enterbrain",                
  755.         :info_line2         =>  "Used As: Mermaid Village Theme",                
  756.         :info_line3         =>  "",                
  757.         :info_line4         =>  "From: RPG Maker VX Ace RTP",
  758.         :album_art_filename =>  "",
  759.       },
  760.      
  761.      
  762.      
  763.     # If you want to add more Sounds, you may do so above this Line, just
  764.     # copy-paste the above format and change things as needed.
  765.     #///////////////////////
  766.    
  767.    
  768.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  769.     #                                           \/
  770.     #               End of Editable Region      /\
  771.     #                                           \/
  772.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  773.     #---------------------------------------------------------
  774.     # No touchie past here unless you know what you are
  775.     # doing. Failure to heed this warning could cause your
  776.     # computer to yell and scream at you.
  777.     #
  778.     # Edit at your own risk.
  779.     #--------------------------------------------------------
  780.     }
  781.    
  782.    
  783.    
  784.    
  785.    
  786.    
  787.    
  788.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  789.     # * New Method: Perform Temporary Compatibility Resolution
  790.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  791.     def self.perform_temporary_compatibility_resolution()
  792.     end
  793.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  794.     # * New Method: Revert Temporary Compatibility Resolution
  795.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  796.     def self.revert_temporary_compatibility_resolution()
  797.     end
  798.   end
  799. end
  800.  
  801.  
  802.  
  803.  
  804. #==============================================================================
  805. # ** SoundTestSound
  806. #------------------------------------------------------------------------------
  807. #  This is a class which hold Individual Sound Information for Play
  808. #==============================================================================
  809.  
  810. class SoundTestSound
  811.   include DiamondandPlatinum3::SoundTestScene
  812.   #--------------------------------------------------------------------------
  813.   # * Public Instance Variables
  814.   #--------------------------------------------------------------------------
  815.   attr_accessor :filename
  816.   attr_accessor :name
  817.   attr_accessor :volume
  818.   attr_accessor :pitch
  819.   attr_accessor :position
  820.   attr_accessor :default_volume
  821.   attr_accessor :default_pitch
  822.   #--------------------------------------------------------------------------
  823.   # * Intialize
  824.   #--------------------------------------------------------------------------
  825.   def initialize( filename, name, volume, pitch )
  826.     @filename       = filename
  827.     @name           = name
  828.     @volume         = volume
  829.     @pitch          = pitch  
  830.     @position       = 0
  831.     @default_volume = volume
  832.     @default_pitch  = pitch
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # * Play Sound
  836.   #--------------------------------------------------------------------------
  837.   def play()
  838.     RPG::BGM.stop()
  839.     RPG::BGM.new( @filename, volume, pitch ).play
  840.   end
  841.   #--------------------------------------------------------------------------
  842.   # * Play Sound at Position
  843.   #--------------------------------------------------------------------------
  844.   def play_at_position( position )
  845.     @position = position
  846.     RPG::BGM.stop()
  847.     RPG::BGM.new( @filename, volume, pitch ).play( position )
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # * Play Sound ( Default )
  851.   #--------------------------------------------------------------------------
  852.   def default_play()
  853.     RPG::BGM.stop()
  854.     RPG::BGM.new( @filename, @default_volume, @default_pitch ).play
  855.   end
  856. end
  857.  
  858.  
  859.  
  860.  
  861.  
  862. #==============================================================================
  863. # ** Scene_SoundTest
  864. #------------------------------------------------------------------------------
  865. #  This Clas Holds the Scene Information for the SoundTest
  866. #==============================================================================
  867.  
  868. class Scene_SoundTest < Scene_Base
  869.   include DiamondandPlatinum3::SoundTestScene
  870.   #--------------------------------------------------------------------------
  871.   # * Start Processing
  872.   #--------------------------------------------------------------------------
  873.   def start
  874.     super()
  875.     DiamondandPlatinum3::SoundTestScene::perform_temporary_compatibility_resolution()
  876.    
  877.     create_soundtestfiles_hash()
  878.     if is_valid_scene?()
  879.       save_current_bgm()
  880.       create_album_art_hash()
  881.       create_command_windows()
  882.       create_help_window()
  883.       create_soundinfo_window()
  884.       create_numberinput_window()
  885.       set_input_variables()
  886.       setup_scene_intro_animation()   if EnableIntroAnimation
  887.     else
  888.       msgbox_p("There are no Sounds to listen to")
  889.       return_scene()
  890.     end
  891.    
  892.     # Current Selected Sound
  893.     @current_sound_symbol = nil
  894.   end
  895.   #--------------------------------------------------------------------------
  896.   # * Post-Start Processing
  897.   #--------------------------------------------------------------------------
  898.   def post_start
  899.     if is_valid_scene?()
  900.       super()
  901.       animate_intro_scene()   if EnableIntroAnimation
  902.     end
  903.   end  
  904.   #--------------------------------------------------------------------------
  905.   # * Frame Update
  906.   #--------------------------------------------------------------------------
  907.   def update
  908.     super()
  909.    
  910.     @sound_select_cmmdwindows[get_category()].update()
  911.    
  912.     update_sounds_visibility()
  913.     update_window_info_text()
  914.     update_album_art_image()
  915.     update_help_text()
  916.     update_scene_changes()
  917.     update_user_input()
  918.   end
  919.   #--------------------------------------------------------------------------
  920.   # * Pre-Termination Processing
  921.   #--------------------------------------------------------------------------
  922.   def pre_terminate
  923.     super()
  924.    
  925.     @current_map_bgm.replay() unless @current_map_bgm.nil?
  926.   end
  927.   #--------------------------------------------------------------------------
  928.   # * Termination Processing
  929.   #--------------------------------------------------------------------------
  930.   def terminate
  931.     @soundcategory_commandwindow.dispose()  unless @soundcategory_commandwindow.nil?  || @soundcategory_commandwindow.disposed?
  932.     @sound_play_cmmdwindow.dispose()        unless @sound_play_cmmdwindow.nil?        || @sound_play_cmmdwindow.disposed?
  933.     @help_window.dispose()                  unless @help_window.nil?                  || @help_window.disposed?
  934.     @sound_info_window.dispose()            unless @sound_info_window.nil?            || @sound_info_window.disposed?
  935.     @numberinput_window.dispose()           unless @numberinput_window.nil?           || @numberinput_window.disposed?
  936.    
  937.     unless @sound_select_cmmdwindows.nil?
  938.       @sound_select_cmmdwindows.each_key do |category|
  939.         @sound_select_cmmdwindows[category].dispose() unless @sound_select_cmmdwindows[category].disposed?
  940.       end
  941.       @sound_select_cmmdwindows.clear()
  942.     end
  943.    
  944.     unless @album_art_hash.nil?
  945.       @album_art_hash.each_key do |key|
  946.         if @album_art_hash[key].is_a?(Sprite) && !@album_art_hash[key].disposed?
  947.           @album_art_hash[key].bitmap.dispose()
  948.           @album_art_hash[key].dispose()
  949.         end
  950.       end
  951.       @album_art_hash.clear()
  952.     end
  953.    
  954.     super()
  955.     DiamondandPlatinum3::SoundTestScene::revert_temporary_compatibility_resolution()
  956.   end  
  957.   #--------------------------------------------------------------------------
  958.   # * Create SoundTest Files Hash
  959.   #--------------------------------------------------------------------------
  960.   def create_soundtestfiles_hash()
  961.     @soundfiles_hash = {}
  962.     Sounds.each_key do |key|
  963.       if Sounds[key][:conditional_switch] < 1 || $game_switches[Sounds[key][:conditional_switch]]
  964.         category  = check_if_valid_category(Sounds[key][:category]) ? Sounds[key][:category] : "Unaffiliated"
  965.         name      = Sounds[key][:display_name]      
  966.         volume    = Sounds[key][:default_volume]
  967.         pitch     = Sounds[key][:default_pitch]
  968.         (@soundfiles_hash[category] ||= {})[ key ] = SoundTestSound.new( key, name, volume, pitch )
  969.       end
  970.     end
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # * Save Current BGM
  974.   #--------------------------------------------------------------------------
  975.   def save_current_bgm()
  976.     # Get Current BGM
  977.     @current_map_bgm = RPG::BGM.last
  978.     RPG::BGM.stop()
  979.   end
  980.   #--------------------------------------------------------------------------
  981.   # * Create Album Art Sprites
  982.   #--------------------------------------------------------------------------
  983.   def create_album_art_hash()
  984.     @album_art_hash = { :current_image_name => "", }
  985.    
  986.     if !DefaultBackgroundSpriteFilename.nil? && DefaultBackgroundSpriteFilename != ""
  987.       @album_art_hash[DefaultBackgroundSpriteFilename] = create_background_sprite(DefaultBackgroundSpriteFilename)
  988.       @album_art_hash[DefaultBackgroundSpriteFilename].visible = true
  989.       @album_art_hash[:current_image_name] = DefaultBackgroundSpriteFilename
  990.     end
  991.   end
  992.   #--------------------------------------------------------------------------
  993.   # * Create Background Sprite
  994.   #--------------------------------------------------------------------------
  995.   def create_background_sprite(filename)
  996.     image         = Sprite.new()
  997.     image.bitmap  = Bitmap.new(AlbumArtFolder + filename)
  998.     image.x       = 0
  999.     image.y       = 0
  1000.     image.z       = 1
  1001.     image.zoom_x  = (Graphics.width.to_f / image.bitmap.width)
  1002.     image.zoom_y  = (Graphics.height.to_f / image.bitmap.height)
  1003.     image.visible = false
  1004.     return image
  1005.   end
  1006.   #--------------------------------------------------------------------------
  1007.   # * Create Command Windows
  1008.   #--------------------------------------------------------------------------
  1009.   def create_command_windows()
  1010.     # Setting Up Command Window for the Sound Category
  1011.     @soundcategory_commandwindow = Window_SoundTest_SoundCategoryCommand.new(0, 72)
  1012.     command_window_ypos = (@soundcategory_commandwindow.y + @soundcategory_commandwindow.height)
  1013.     set_soundcategorycommandwindow_handlers()
  1014.    
  1015.     # Setting Up Command Windows for Sounds
  1016.     @sound_select_cmmdwindows = { }
  1017.     Music_Categories.each do |category|
  1018.       if !@soundfiles_hash[category].nil?
  1019.         cmmdwindow = Window_SoundTest_SoundCommand.new(0, command_window_ypos, category)
  1020.         cmmdwindow.height = Graphics.height - command_window_ypos
  1021.         cmmdwindow.visible = false
  1022.         @sound_select_cmmdwindows[category] = cmmdwindow
  1023.       end
  1024.     end
  1025.     if !@soundfiles_hash["Unaffiliated"].nil?
  1026.       cmmdwindow = Window_SoundTest_SoundCommand.new(0, command_window_ypos, "Unaffiliated")
  1027.       cmmdwindow.height = Graphics.height - command_window_ypos
  1028.       cmmdwindow.visible = false
  1029.       @sound_select_cmmdwindows["Unaffiliated"] = cmmdwindow
  1030.     end
  1031.    
  1032.     @sound_select_cmmdwindows[get_first_category()].visible = true
  1033.     set_soundcommand_window_handlers()
  1034.    
  1035.     @sound_select_cmmdwindows.each_key do |category|
  1036.       @sound_select_cmmdwindows[category].deactivate()
  1037.     end
  1038.    
  1039.     # Setting Up Command Window for Play Sound
  1040.     @sound_play_cmmdwindow = Window_SoundTest_PlayCommand.new(Graphics.width * 0.5, command_window_ypos)
  1041.     @sound_play_cmmdwindow.deactivate()
  1042.     set_soundplay_window_handlers()
  1043.   end
  1044.   #--------------------------------------------------------------------------
  1045.   # * Set Sound Category Command Handlers
  1046.   #--------------------------------------------------------------------------
  1047.   def set_soundcategorycommandwindow_handlers()
  1048.     Music_Categories.each do |category|
  1049.       @soundcategory_commandwindow.set_handler(category.to_sym, method(:deactivate_soundcategory_window))
  1050.     end
  1051.     if !@soundfiles_hash["Unaffiliated"].nil?
  1052.       @soundcategory_commandwindow.set_handler("Unaffiliated".to_sym, method(:deactivate_soundcategory_window))
  1053.     end
  1054.   end
  1055.   #--------------------------------------------------------------------------
  1056.   # * Set Command Handlers
  1057.   #--------------------------------------------------------------------------
  1058.   def set_soundcommand_window_handlers
  1059.     @soundfiles_hash.each_key do |category|
  1060.       @soundfiles_hash[category].each_key do |key_name|
  1061.         @sound_select_cmmdwindows[category].set_handler(key_name.to_sym, method(:deactivate_soundcommand_window))
  1062.       end
  1063.     end
  1064.   end
  1065.   #--------------------------------------------------------------------------
  1066.   # * Set SoundPlay Handlers
  1067.   #--------------------------------------------------------------------------
  1068.   def set_soundplay_window_handlers
  1069.     @sound_play_cmmdwindow.set_handler(:play_sound, method(:playsound_command))
  1070.     @sound_play_cmmdwindow.set_handler(:volume,     method(:playsound_at_volume))
  1071.     @sound_play_cmmdwindow.set_handler(:pitch,      method(:playsound_at_pitch))
  1072.     @sound_play_cmmdwindow.set_handler(:position,   method(:playsound_at_position)) if EnablePositionCommand
  1073.   end
  1074.   #--------------------------------------------------------------------------
  1075.   # * Create Help Window
  1076.   #--------------------------------------------------------------------------
  1077.   def create_help_window()
  1078.     # Setting up Help Window
  1079.     @help_window = Window_Help.new()
  1080.     @help_window.set_text(CategorySelectHelpWindowTextLine1 + "\n" + CategorySelectHelpWindowTextLine2)
  1081.   end
  1082.   #--------------------------------------------------------------------------
  1083.   # * Create SoundInfo Window
  1084.   #--------------------------------------------------------------------------
  1085.   def create_soundinfo_window()
  1086.     # Setting up Sound Info Window
  1087.     @sound_info_window_defaultY = @sound_play_cmmdwindow.y + @sound_play_cmmdwindow.height
  1088.     @sound_info_window          = Window_SoundInfo.new()
  1089.     @sound_info_window.x        = Graphics.width * 0.5
  1090.     @sound_info_window.y        = @sound_info_window_defaultY
  1091.   end
  1092.   #--------------------------------------------------------------------------
  1093.   # * Create NumberInput Window
  1094.   #--------------------------------------------------------------------------
  1095.   def create_numberinput_window()
  1096.     # Setting Up Number Input
  1097.     @numberinput_window = Window_SoundTest_NumberInput.new()
  1098.     @numberinput_window.z = 200
  1099.   end
  1100.   #--------------------------------------------------------------------------
  1101.   # * Set Input Variables
  1102.   #--------------------------------------------------------------------------
  1103.   def set_input_variables()
  1104.     @user_currently_inputting_value     = false
  1105.     @currently_entering_volume_value    = false
  1106.     @currently_entering_pitch_value     = false
  1107.     @currently_entering_position_value  = false
  1108.   end
  1109.   #--------------------------------------------------------------------------
  1110.   # * Setup Scene Intro Animation
  1111.   #--------------------------------------------------------------------------
  1112.   def setup_scene_intro_animation()
  1113.     @background_image.opacity                           = 0     unless @background_image.nil?
  1114.     @soundcategory_commandwindow.opacity                = 0
  1115.     @sound_select_cmmdwindows[get_first_category()].x  -= 500
  1116.     @sound_play_cmmdwindow.x                           += 600
  1117.     @help_window.y                                     -= 400
  1118.     @sound_info_window.y                               += 300
  1119.   end
  1120.   #--------------------------------------------------------------------------
  1121.   # * Animate Intro Sequence
  1122.   #--------------------------------------------------------------------------
  1123.   def animate_intro_scene()
  1124.     while( true )
  1125.       bool1 = animate_sceneintro_background_image()
  1126.       bool2 = animate_sceneintro_soundcategorycmmdwindow()
  1127.       bool3 = animate_sceneintro_soundselectcmmdwindow()
  1128.       bool4 = animate_sceneintro_soundplaycmmdwindow()
  1129.       bool5 = animate_sceneintro_helpwindow()
  1130.       bool6 = animate_sceneintro_soundinfowindow()
  1131.       Graphics.update()
  1132.       break if bool1 && bool2 && bool3 && bool4 && bool5 && bool6
  1133.     end
  1134.   end
  1135.   #--------------------------------------------------------------------------
  1136.   # * Animate BackgroundImage Opacity for Intro Sequence
  1137.   #--------------------------------------------------------------------------
  1138.   def animate_sceneintro_background_image()
  1139.     return true if @background_image.nil?
  1140.     return true if @background_image.opacity == 255
  1141.     @background_image.opacity += 5
  1142.     return @background_image.opacity == 255
  1143.   end
  1144.   #--------------------------------------------------------------------------
  1145.   # * Animate SoundCategoryCommand Window for Intro Sequence
  1146.   #--------------------------------------------------------------------------
  1147.   def animate_sceneintro_soundcategorycmmdwindow()
  1148.     return true if @soundcategory_commandwindow.opacity == 255
  1149.     @soundcategory_commandwindow.opacity += 4
  1150.     return @soundcategory_commandwindow.opacity == 255
  1151.   end
  1152.   #--------------------------------------------------------------------------
  1153.   # * Animate SoundSelectCommand Window for Intro Sequence
  1154.   #--------------------------------------------------------------------------
  1155.   def animate_sceneintro_soundselectcmmdwindow()
  1156.     return true if @sound_select_cmmdwindows[get_first_category()].x == 0
  1157.     @sound_select_cmmdwindows[get_first_category()].x += 20
  1158.     return @sound_select_cmmdwindows[get_first_category()].x == 0
  1159.   end
  1160.   #--------------------------------------------------------------------------
  1161.   # * Animate SoundPlayCommand Window for Intro Sequence
  1162.   #--------------------------------------------------------------------------
  1163.   def animate_sceneintro_soundplaycmmdwindow()
  1164.     return true if @sound_play_cmmdwindow.x == (Graphics.width * 0.5)
  1165.     @sound_play_cmmdwindow.x -= 20
  1166.     return @sound_play_cmmdwindow.x == (Graphics.width * 0.5)
  1167.   end
  1168.   #--------------------------------------------------------------------------
  1169.   # * Animate Help Window for Intro Sequence
  1170.   #--------------------------------------------------------------------------
  1171.   def animate_sceneintro_helpwindow()
  1172.     return true if @help_window.y == 0
  1173.     @help_window.y += 10
  1174.     return @help_window.y == 0
  1175.   end
  1176.   #--------------------------------------------------------------------------
  1177.   # * Animate Sound Info Window
  1178.   #--------------------------------------------------------------------------
  1179.   def animate_sceneintro_soundinfowindow()
  1180.     return true if @sound_info_window.y == @sound_info_window_defaultY
  1181.     @sound_info_window.y -= 6
  1182.     return @sound_info_window.y == @sound_info_window_defaultY
  1183.   end
  1184.   #--------------------------------------------------------------------------
  1185.   # * Deactivate Sound Command Windows
  1186.   #--------------------------------------------------------------------------
  1187.   def deactivate_soundcommand_windows()
  1188.     @sound_select_cmmdwindows[get_category()].deactivate()
  1189.     @sound_play_cmmdwindow.deactivate()
  1190.     @soundcategory_commandwindow.deactivate()
  1191.   end
  1192.   #--------------------------------------------------------------------------
  1193.   # * Deactivate Sound Category Command Window
  1194.   #--------------------------------------------------------------------------
  1195.   def deactivate_soundcategory_window()
  1196.     @sound_select_cmmdwindows[get_category()].activate()
  1197.     @soundcategory_commandwindow.deactivate()
  1198.   end
  1199.   #--------------------------------------------------------------------------
  1200.   # * Deactivate Sound Command Window
  1201.   #--------------------------------------------------------------------------
  1202.   def deactivate_soundcommand_window(activate_play_window = true)
  1203.     @sound_select_cmmdwindows[get_category()].deactivate()
  1204.     if activate_play_window
  1205.       @sound_play_cmmdwindow.activate()
  1206.     else
  1207.       @soundcategory_commandwindow.activate()
  1208.     end
  1209.   end
  1210.   #--------------------------------------------------------------------------
  1211.   # * Deactivate SoundSelect Command Window
  1212.   #--------------------------------------------------------------------------
  1213.   def deactivate_soundselectcommand_window()
  1214.     @sound_select_cmmdwindows[get_category()].activate()
  1215.     @sound_play_cmmdwindow.deactivate()
  1216.   end
  1217.   #--------------------------------------------------------------------------
  1218.   # * Deactivate SoundPlay Command Window
  1219.   #--------------------------------------------------------------------------
  1220.   def deactivate_soundplaycommand_window()
  1221.     @sound_select_cmmdwindows[get_category()].activate()
  1222.     @sound_play_cmmdwindow.deactivate()
  1223.   end
  1224.   #--------------------------------------------------------------------------
  1225.   # * Update Sounds Command Visibility
  1226.   #--------------------------------------------------------------------------
  1227.   def update_sounds_visibility()
  1228.     @sound_select_cmmdwindows.each_key do |category|
  1229.       @sound_select_cmmdwindows[category].visible = (category == get_category())
  1230.     end
  1231.   end
  1232.   #--------------------------------------------------------------------------
  1233.   # * Update Info Window Text
  1234.   #--------------------------------------------------------------------------
  1235.   def update_window_info_text()
  1236.     if @current_sound_symbol != @sound_select_cmmdwindows[get_category()].current_symbol
  1237.       @current_sound_symbol = @sound_select_cmmdwindows[get_category()].current_symbol      
  1238.    
  1239.       text  = Sounds[@current_sound_symbol.to_s][:info_line1].gsub("\n", "") + "\n"
  1240.       text += Sounds[@current_sound_symbol.to_s][:info_line2].gsub("\n", "") + "\n"
  1241.       text += Sounds[@current_sound_symbol.to_s][:info_line3].gsub("\n", "") + "\n"
  1242.       text += Sounds[@current_sound_symbol.to_s][:info_line4].gsub("\n", "")
  1243.       @sound_info_window.draw_text_soundinfo(text)
  1244.     end
  1245.   end
  1246.   #--------------------------------------------------------------------------
  1247.   # * Update Album Art Image
  1248.   #--------------------------------------------------------------------------
  1249.   def update_album_art_image()
  1250.     if @soundcategory_commandwindow.active
  1251.       return if @album_art_hash[:current_image_name] == DefaultBackgroundSpriteFilename
  1252.       unless @album_art_hash[DefaultBackgroundSpriteFilename].nil?
  1253.         @album_art_hash[@album_art_hash[:current_image_name]].visible = false
  1254.         @album_art_hash[:current_image_name] = DefaultBackgroundSpriteFilename
  1255.         @album_art_hash[DefaultBackgroundSpriteFilename].visible = true
  1256.       end
  1257.      
  1258.     else
  1259.       filename = Sounds[@current_sound_symbol.to_s][:album_art_filename]
  1260.       if filename != @album_art_hash[:current_image_name]
  1261.         filename = DefaultBackgroundSpriteFilename if filename == ""
  1262.         return if filename == "" || filename == @album_art_hash[:current_image_name]
  1263.         @album_art_hash[@album_art_hash[:current_image_name]].visible = false if @album_art_hash[@album_art_hash[:current_image_name]] != ""
  1264.         @album_art_hash[:current_image_name] = filename
  1265.         if @album_art_hash[filename].nil?
  1266.           @album_art_hash[filename] = create_background_sprite(filename)
  1267.         end
  1268.         @album_art_hash[filename].visible = true
  1269.       end
  1270.     end
  1271.   end
  1272.   #--------------------------------------------------------------------------
  1273.   # * Update Help Text
  1274.   #--------------------------------------------------------------------------
  1275.   def update_help_text()
  1276.     # If SoundCategory Command Window is Active
  1277.     if @soundcategory_commandwindow.active
  1278.       @help_window.set_text(CategorySelectHelpWindowTextLine1 + "\n" + CategorySelectHelpWindowTextLine2)
  1279.     # If SoundSelect Command Window is Active
  1280.     elsif @sound_select_cmmdwindows[get_category()].active
  1281.       @help_window.set_text(SoundSelectHelpWindowTextLine1 + "\n" + SoundSelectHelpWindowTextLine2)
  1282.     # If NumberInput Window is Active
  1283.     elsif @numberinput_window.active
  1284.       @help_window.set_text(NumberInputHelpWindowTextLine1 + "\n" + NumberInputHelpWindowTextLine2)
  1285.      # If Hovering Over PlaySound
  1286.     elsif @sound_play_cmmdwindow.current_symbol == :play_sound
  1287.       @help_window.set_text(PlaySoundOptionHelpWindowTextLine1 + "\n" + PlaySoundOptionHelpWindowTextLine2)
  1288.      # If Hovering Over Volume Input
  1289.     elsif @sound_play_cmmdwindow.current_symbol == :volume
  1290.       @help_window.set_text(VolumeOptionHelpWindowTextLine1 + "\n" + VolumeOptionHelpWindowTextLine2)
  1291.      # If Hovering Over Pitch Input
  1292.     elsif @sound_play_cmmdwindow.current_symbol == :pitch
  1293.       @help_window.set_text(PitchOptionHelpWindowTextLine1 + "\n" + PitchOptionHelpWindowTextLine2)
  1294.      # If Hovering Over Position Input
  1295.     else
  1296.       @help_window.set_text(PositionOptionHelpWindowTextLine1 + "\n" + PositionOptionHelpWindowTextLine2)
  1297.     end
  1298.   end
  1299.   #--------------------------------------------------------------------------
  1300.   # * Update Scene Changes
  1301.   #--------------------------------------------------------------------------
  1302.   def update_scene_changes()
  1303.     if Input.trigger?(:B)
  1304.       Sound.play_cancel()
  1305.       return_scene()                          if @soundcategory_commandwindow.active()
  1306.       deactivate_soundcommand_window(false)   if @sound_select_cmmdwindows[get_category()].active
  1307.       deactivate_soundplaycommand_window()    if @sound_play_cmmdwindow.active
  1308.     end
  1309.   end
  1310.   #--------------------------------------------------------------------------
  1311.   # * Update User Input
  1312.   #--------------------------------------------------------------------------
  1313.   def update_user_input()
  1314.     if @user_currently_inputting_value && @numberinput_window.completed
  1315.       receive_volume_value()    if @currently_entering_volume_value
  1316.       receive_pitch_value()     if @currently_entering_pitch_value
  1317.       receive_position_value()  if @currently_entering_position_value  
  1318.     end
  1319.   end
  1320.   #--------------------------------------------------------------------------
  1321.   # * Play Sound Command
  1322.   #--------------------------------------------------------------------------
  1323.   def playsound_command()
  1324.     @soundfiles_hash[get_category()][@current_sound_symbol.to_s].default_play()    
  1325.     @sound_play_cmmdwindow.activate()
  1326.   end
  1327.   #--------------------------------------------------------------------------
  1328.   # * Play Sound 'At Volume' Command
  1329.   #--------------------------------------------------------------------------
  1330.   def playsound_at_volume()
  1331.     deactivate_soundcommand_windows()
  1332.     @user_currently_inputting_value = true
  1333.     @currently_entering_volume_value = true
  1334.     number = @soundfiles_hash[get_category()][@current_sound_symbol.to_s].volume
  1335.     @numberinput_window.start( number, 3 )
  1336.   end
  1337.   #--------------------------------------------------------------------------
  1338.   # * Play Sound 'At Pitch' Command
  1339.   #--------------------------------------------------------------------------
  1340.   def playsound_at_pitch()
  1341.     deactivate_soundcommand_windows()
  1342.     @user_currently_inputting_value = true
  1343.     @currently_entering_pitch_value = true
  1344.     number = @soundfiles_hash[get_category()][@current_sound_symbol.to_s].pitch
  1345.     @numberinput_window.start( number, 3 )
  1346.   end
  1347.   #--------------------------------------------------------------------------
  1348.   # * Play Sound 'At Position' Command
  1349.   #--------------------------------------------------------------------------
  1350.   def playsound_at_position()
  1351.     @currently_entering_position_value = true
  1352.     @user_currently_inputting_value = true
  1353.     deactivate_soundcommand_windows()
  1354.     number = @soundfiles_hash[get_category()][@current_sound_symbol.to_s].position
  1355.     @numberinput_window.start( number, 9 )
  1356.   end
  1357.   #--------------------------------------------------------------------------
  1358.   # * Receive Volume Value
  1359.   #--------------------------------------------------------------------------
  1360.   def receive_volume_value()
  1361.     if @numberinput_window.processed_ok
  1362.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].volume = @numberinput_window.result
  1363.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].play()
  1364.     end
  1365.     @sound_play_cmmdwindow.activate()
  1366.     set_input_variables()
  1367.   end
  1368.   #--------------------------------------------------------------------------
  1369.   # * Receive Pitch Value
  1370.   #--------------------------------------------------------------------------
  1371.   def receive_pitch_value()
  1372.     if @numberinput_window.processed_ok
  1373.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].pitch = @numberinput_window.result
  1374.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].play()
  1375.     end
  1376.     @sound_play_cmmdwindow.activate()
  1377.     set_input_variables()
  1378.   end
  1379.   #--------------------------------------------------------------------------
  1380.   # * Receive Position Value
  1381.   #--------------------------------------------------------------------------
  1382.   def receive_position_value()
  1383.     if @numberinput_window.processed_ok
  1384.       @soundfiles_hash[get_category()][@current_sound_symbol.to_s].play_at_position( @numberinput_window.result )
  1385.     end
  1386.     @sound_play_cmmdwindow.activate()
  1387.     set_input_variables()
  1388.   end
  1389.   #--------------------------------------------------------------------------
  1390.   # * Check if Valid Category
  1391.   #--------------------------------------------------------------------------
  1392.   def check_if_valid_category(category)
  1393.     return Music_Categories.include?(category)
  1394.   end
  1395.   #--------------------------------------------------------------------------
  1396.   # * Get Current Category Text
  1397.   #--------------------------------------------------------------------------
  1398.   def get_category()
  1399.     return @soundcategory_commandwindow.current_symbol.to_s
  1400.   end
  1401.   #--------------------------------------------------------------------------
  1402.   # * Get First Category Text
  1403.   #--------------------------------------------------------------------------
  1404.   def get_first_category()
  1405.     return @soundcategory_commandwindow.get_first_command_name
  1406.   end
  1407.   #--------------------------------------------------------------------------
  1408.   # * Is Valid Scene?
  1409.   #--------------------------------------------------------------------------
  1410.   def is_valid_scene?()
  1411.     return !@soundfiles_hash.empty?
  1412.   end
  1413. end
  1414.  
  1415.  
  1416. if DiamondandPlatinum3::SoundTestScene::EnableMenuOption
  1417.   #==============================================================================
  1418.   # ** Window_MenuCommand
  1419.   #------------------------------------------------------------------------------
  1420.   #  This command window appears on the menu screen.
  1421.   #==============================================================================
  1422.    
  1423.   class Window_MenuCommand < Window_Command
  1424.     #--------------------------------------------------------------------------
  1425.     # * Add Exit Game to Command List
  1426.     #--------------------------------------------------------------------------
  1427.     alias dp3_soundtestscene_windowmenucommd_addgameendcmmd_ofa     add_game_end_command
  1428.     #--------------------------------------------------------------------------
  1429.     def add_game_end_command
  1430.       enabled = (DiamondandPlatinum3::SoundTestScene::EnableSwitchID > 0) ? $game_switches[DiamondandPlatinum3::SoundTestScene::EnableSwitchID] : true
  1431.       add_command(DiamondandPlatinum3::SoundTestScene::MenuCommandText, :dp3_sound_test, enabled)
  1432.      
  1433.       dp3_soundtestscene_windowmenucommd_addgameendcmmd_ofa() # Call Original Method
  1434.     end
  1435.   end
  1436.    
  1437.    
  1438.    
  1439.   #==============================================================================
  1440.   # ** Scene_Menu
  1441.   #------------------------------------------------------------------------------
  1442.   #  This class performs the menu screen processing.
  1443.   #==============================================================================
  1444.    
  1445.   class Scene_Menu < Scene_MenuBase
  1446.     #--------------------------------------------------------------------------
  1447.     # * Create Command Window
  1448.     #--------------------------------------------------------------------------
  1449.     alias dp3_soundtestscene_scenemenu_creatcmmdwind_ofa      create_command_window
  1450.     #--------------------------------------------------------------------------
  1451.     def create_command_window
  1452.       dp3_soundtestscene_scenemenu_creatcmmdwind_ofa() # Call original Method  
  1453.       @command_window.set_handler(:dp3_sound_test,    method(:command_soundtest))
  1454.     end
  1455.     #--------------------------------------------------------------------------
  1456.     # * Command Sound Test
  1457.     #--------------------------------------------------------------------------
  1458.     def command_soundtest
  1459.       SceneManager.call(Scene_SoundTest)
  1460.     end
  1461.   end
  1462.  
  1463. end
  1464.  
  1465.  
  1466.  
  1467. #==============================================================================
  1468. # ** SoundCategory_Command
  1469. #------------------------------------------------------------------------------
  1470. # The Command Window that is used when selecting a sound category
  1471. #==============================================================================
  1472.  
  1473. class Window_SoundTest_SoundCategoryCommand < Window_Command
  1474.   #--------------------------------------------------------------------------
  1475.   # * Get Window Width
  1476.   #--------------------------------------------------------------------------
  1477.   def window_width
  1478.     return Graphics.width
  1479.   end
  1480.   #--------------------------------------------------------------------------
  1481.   # * Get Digit Count
  1482.   #--------------------------------------------------------------------------
  1483.   def col_max
  1484.     return DiamondandPlatinum3::SoundTestScene::MaxCategoryHorizontalCommands
  1485.   end
  1486.   #--------------------------------------------------------------------------
  1487.   # * Get Number of Lines to Show
  1488.   #--------------------------------------------------------------------------
  1489.   def visible_line_number
  1490.     return (SceneManager.scene.instance_variable_get('@soundfiles_hash').size.to_f / col_max).ceil
  1491.   end
  1492.   #--------------------------------------------------------------------------
  1493.   # * Get Spacing for Items Arranged Side by Side
  1494.   #--------------------------------------------------------------------------
  1495.   def spacing
  1496.     return 4
  1497.   end
  1498.   #--------------------------------------------------------------------------
  1499.   # * Get First Command Name
  1500.   #--------------------------------------------------------------------------
  1501.   def get_first_command_name()
  1502.     return @list[0][:name]
  1503.   end
  1504.   #--------------------------------------------------------------------------
  1505.   # * Make Command List
  1506.   #--------------------------------------------------------------------------
  1507.   def make_command_list
  1508.     soundfiles_hash = SceneManager.scene.instance_variable_get('@soundfiles_hash')
  1509.     DiamondandPlatinum3::SoundTestScene::Music_Categories.each do |category|    
  1510.       add_command(category, category.to_sym) if !soundfiles_hash[category].nil?
  1511.     end
  1512.     command = "Unaffiliated"
  1513.     add_command(command, command.to_sym) if !soundfiles_hash[command].nil?
  1514.   end  
  1515. end
  1516.  
  1517.  
  1518. #==============================================================================
  1519. # ** SoundTest_Command
  1520. #------------------------------------------------------------------------------
  1521. # The Command Window that is used when selecting a sound
  1522. #==============================================================================
  1523.  
  1524. class Window_SoundTest_SoundCommand < Window_Command
  1525.   #--------------------------------------------------------------------------
  1526.   # * Initialize
  1527.   #--------------------------------------------------------------------------
  1528.   attr_reader :category
  1529.   def initialize(*args, a_category)
  1530.     @category = a_category
  1531.     super(*args)
  1532.   end
  1533.   #--------------------------------------------------------------------------
  1534.   # * Get Window Width
  1535.   #--------------------------------------------------------------------------
  1536.   def window_width
  1537.     return Graphics.width * 0.5
  1538.   end
  1539.   #--------------------------------------------------------------------------
  1540.   # * Make Command List
  1541.   #--------------------------------------------------------------------------
  1542.   def make_command_list
  1543.     sounds_hash = SceneManager.scene.instance_variable_get('@soundfiles_hash')
  1544.     sounds_hash[@category].each_key do |key_name|    
  1545.       add_command(sounds_hash[@category][key_name].name, key_name.to_sym)
  1546.     end
  1547.   end  
  1548. end
  1549.  
  1550.  
  1551. #==============================================================================
  1552. # ** PlaySound_Command
  1553. #------------------------------------------------------------------------------
  1554. # The Command Window that is used for playing a sound
  1555. #==============================================================================
  1556.  
  1557. class Window_SoundTest_PlayCommand < Window_Command
  1558.   #--------------------------------------------------------------------------
  1559.   # * Get Window Width
  1560.   #--------------------------------------------------------------------------
  1561.   def window_width
  1562.     return Graphics.width * 0.5
  1563.   end
  1564.   #--------------------------------------------------------------------------
  1565.   # * Make Command List
  1566.   #--------------------------------------------------------------------------
  1567.   def make_command_list
  1568.     add_command("Play Sound", :play_sound)
  1569.     add_command("Volume",     :volume)
  1570.     add_command("Pitch",      :pitch)
  1571.     add_command("Position",   :position) if DiamondandPlatinum3::SoundTestScene::EnablePositionCommand
  1572.   end  
  1573. end
  1574.  
  1575.  
  1576.  
  1577.  
  1578. #==============================================================================
  1579. # ** Window_SoundInfo
  1580. #------------------------------------------------------------------------------
  1581. #  This message window is used to display Sound Information
  1582. #==============================================================================
  1583.  
  1584. class Window_SoundInfo < Window_Base
  1585.   #--------------------------------------------------------------------------
  1586.   # * Object Initialization
  1587.   #--------------------------------------------------------------------------
  1588.   def initialize
  1589.     super(0, 0, window_width, window_height)
  1590.     self.z = 200
  1591.   end
  1592.   #--------------------------------------------------------------------------
  1593.   # * Set Font
  1594.   #--------------------------------------------------------------------------
  1595.   def set_font
  1596.     contents.font.size = 18
  1597.   end
  1598.   #--------------------------------------------------------------------------
  1599.   # * Get Window Width
  1600.   #--------------------------------------------------------------------------
  1601.   def window_width
  1602.     return Graphics.width * 0.5
  1603.   end
  1604.   #--------------------------------------------------------------------------
  1605.   # * Get Window Height
  1606.   #--------------------------------------------------------------------------
  1607.   def window_height
  1608.     return Graphics.height - SceneManager.scene.instance_variable_get('@sound_info_window_defaultY')
  1609.   end  
  1610.   #--------------------------------------------------------------------------
  1611.   # * Draw Text
  1612.   #--------------------------------------------------------------------------
  1613.   def draw_text_soundinfo(text)
  1614.     contents.clear
  1615.     set_font()
  1616.     draw_text_ex(0, 0, word_wrapping(text))
  1617.   end  
  1618.   #--------------------------------------------------------------------------
  1619.   # * Draw Text with Control Characters
  1620.   #--------------------------------------------------------------------------
  1621.   def draw_text_ex(x, y, text)
  1622.     text = convert_escape_characters(text)
  1623.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  1624.     until text.empty?
  1625.       c = text.slice!(0, 1)
  1626.       if c == "\n"
  1627.         pos[:x] = pos[:new_x]
  1628.         pos[:y] += pos[:height]
  1629.         pos[:height] = calc_line_height(text)
  1630.       else
  1631.         text_width = text_size(c).width
  1632.         draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c)
  1633.         pos[:x] += text_width
  1634.       end
  1635.     end
  1636.   end
  1637.   #--------------------------------------------------------------------------
  1638.   # * Word Wrapping
  1639.   #--------------------------------------------------------------------------
  1640.   def word_wrapping(text, pos = 0)
  1641.    
  1642.     # Current Text Position
  1643.     current_text_position = 0    
  1644.    
  1645.     for i in 0..(text.length - 1)
  1646.       if text[i] == "\n"
  1647.         current_text_position = 0
  1648.         next
  1649.       end
  1650.      
  1651.       # Current Position += character width
  1652.       current_text_position += contents.text_size(text[i]).width
  1653.      
  1654.       # If Current Position > Window Width
  1655.       if (pos + current_text_position) >= (contents.width)
  1656.         # Then Format the Sentence to fit Line
  1657.         current_element = i
  1658.         while(text[current_element] != " ")
  1659.           break if current_element == 0
  1660.           current_element -= 1
  1661.         end
  1662.        
  1663.         temp_text = ""
  1664.         for j in 0..(text.length - 1)
  1665.           temp_text += text[j]
  1666.           temp_text += "\n" if j == current_element
  1667.         end
  1668.         text = temp_text
  1669.         i = current_element
  1670.         current_text_position = 0
  1671.       end
  1672.     end
  1673.     return text
  1674.   end
  1675. end
  1676.  
  1677.  
  1678.  
  1679. #==============================================================================
  1680. # ** Window_NumberInput
  1681. #------------------------------------------------------------------------------
  1682. #  This window is used for the event command [Input Number].
  1683. #==============================================================================
  1684.  
  1685. class Window_SoundTest_NumberInput < Window_NumberInput
  1686.   #--------------------------------------------------------------------------
  1687.   # * Public Instance Variables
  1688.   #--------------------------------------------------------------------------
  1689.   attr_reader :result       # The Result of User Input
  1690.   attr_reader :completed    # User Finished Input Processing?
  1691.   attr_reader :processed_ok # User Did not Cancel User Input?
  1692.   #--------------------------------------------------------------------------
  1693.   # * Initialize
  1694.   #--------------------------------------------------------------------------
  1695.   def initialize()
  1696.     super( self )
  1697.     @result       = 0
  1698.     @completed    = true
  1699.     @processed_ok = false
  1700.   end
  1701.   #--------------------------------------------------------------------------
  1702.   # * Start Input Processing
  1703.   #--------------------------------------------------------------------------
  1704.   def start( number, digits )
  1705.     @digits_max = digits
  1706.     @number = number
  1707.     @index = 0
  1708.     @completed = false
  1709.     update_placement
  1710.     create_contents
  1711.     refresh
  1712.     open
  1713.     activate
  1714.   end
  1715.   #--------------------------------------------------------------------------
  1716.   # * Update Window Position
  1717.   #--------------------------------------------------------------------------
  1718.   def update_placement
  1719.     self.width = @digits_max * 20 + padding * 2
  1720.     self.height = fitting_height(1)
  1721.     self.x = (Graphics.width - width) * 0.5
  1722.     self.y = 192
  1723.   end
  1724.   #--------------------------------------------------------------------------
  1725.   # * Processing When OK Button Is Pressed
  1726.   #--------------------------------------------------------------------------
  1727.   def process_ok
  1728.     Sound.play_ok
  1729.     @result = @number
  1730.     @completed = true
  1731.     @processed_ok = true
  1732.     deactivate
  1733.     close
  1734.   end
  1735.   #--------------------------------------------------------------------------
  1736.   # * Processing When Cancel Button Is Pressed
  1737.   #--------------------------------------------------------------------------
  1738.   def process_cancel
  1739.     Sound.play_cancel
  1740.     @completed    = true
  1741.     @processed_ok = false
  1742.     deactivate
  1743.     close
  1744.   end
  1745. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement