Advertisement
Kakakadafi

Options menu!

Oct 18th, 2017
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 20.27 KB | None | 0 0
  1. #Basic Options Menu v1.4
  2. #----------#
  3. #Features: Provides a simple option menu for the player to do optiony stuff...
  4. #           Like volume effects for all, bgm, and se's. Fancy!
  5. #        
  6. #          Also additional options if you have Basic Window Resizer,
  7. #           Basic Message SE, and Basic Autosave.
  8. #
  9. #Usage:    Plug and play unless you want a bit more. Customization below.
  10. #
  11. #----------#
  12. #-- Script by: V.M of D.T Modified by Yin
  13. #
  14. #- Questions or comments can be:
  15. #    posted on the thread for the script
  16. #    given by email: sumptuaryspade@live.ca
  17. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  18. #   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
  19. #
  20. #- Free to use in any project with credit given, donations always welcome!
  21.  
  22. #This lets you set the order of the windows via an array
  23. WINDOW_ORDER = [:input, :master, :bgm, :se, :resolution, :message_se]
  24. #Basic options are:
  25. #  :master - Master Volume               :bgm     - Background Music Volume
  26. #  :se     - Sound Effect Volume         :switch  - Allow the player to turn on/off a switch or global variable
  27. #
  28. #-- Additional Options are:
  29. #  :resolution     -   If you have Basic Window Resizer installed
  30. #  :message_se     -   If you have Basic Message SE installed
  31. #  :autosave       -   If you have Basic Autosave installed
  32.  
  33. #These are all the strings for the help window and headers:
  34. module OPT_STR
  35.   #When the command window is selected
  36.   COMMAND_HELP       = "Confirm and exit or simply exit"
  37.   #Details for :master
  38.   MASTER_VOLUME      = "Master Volume"
  39.   MASTER_VOLUME_HELP = "Set the volume of all sound"
  40.   #Details for :bgm
  41.   BGM_VOLUME         = "BGM Volume"
  42.   BGM_VOLUME_HELP    = "Set the volume of music"
  43.   #Details for :se
  44.   SE_VOLUME          = "SE Volume"
  45.   SE_VOLUME_HELP     = "Set the volume of sound effects"
  46.   #Details for :resolution
  47.   RESOLUTION         = "Resolution"
  48.   RESOLUTION_HELP    = "Change the resolution of the game window"
  49.   #Details for :autosave
  50.   AUTOSAVE           = "Autosave"
  51.   AUTOSAVE_HELP      = "Enable/Disable autosaving"
  52.   #Details for :message
  53.   MESSAGE_SE         = "Message SE"
  54.   MESSAGE_SE_HELP    = "Enable/Disable the message sound effect"
  55.   #Details for :input
  56.   INPUT              = "Controller Configuration"
  57.   INPUT_HELP         = "Change button configuration for controller"
  58.   #Details for :switch
  59.   SWITCH_DETAIL      = "$game_switches[5]"
  60.   SWITCH             = "Header"
  61.   SWITCH_HELP        = "Help Message"
  62.   SWITCH_COMMAND     = ["On","Off"]
  63. end
  64.  
  65. class Scene_Options < Scene_MenuBase
  66.   def start
  67.     super
  68.     $game_options.memorize_options
  69.     create_base_windows
  70.     @current_index = 1
  71.     @window_index = []
  72.     @size = 0
  73.     WINDOW_ORDER.each do |symbol|
  74.       create_resolution_window if symbol == :resolution
  75.       create_input_window      if symbol == :input
  76.       create_autosave_window   if symbol == :autosave
  77.       create_master_window     if symbol == :master
  78.       create_bgm_window        if symbol == :bgm
  79.       create_se_window         if symbol == :se
  80.       create_message_se_window if symbol == :message_se
  81.       create_window_switch     if symbol == :switch
  82.     end
  83.     create_command_window
  84.     @index = 0
  85.     @old_index = @index
  86.     activate_window(0)
  87.   end
  88.   def create_base_windows
  89.     @help_window = Window_Help.new(1)
  90.     @help_window.set_text("Options")
  91.     @back_window = Window_Options.new
  92.     @back_window.height = (WINDOW_ORDER.size + 1)* 48 + 24
  93.     @back_window.create_contents
  94.   end
  95.   def create_command_window
  96.     @window_command = Window_OCommand.new(48+24 * @current_index)
  97.     @window_command.set_handler(:ok, method(:command_ok))
  98.     @window_index.push(:command)
  99.     @back_window.draw_line(24 * (@current_index - 1))
  100.   end
  101.   def create_resolution_window
  102.     @window_resolution = Window_OR.new(48+24 * @current_index)
  103.     @window_resolution.set_handler(:ok, method(:resolution_ok))
  104.     @back_window.add_text(24 * (@current_index - 1),OPT_STR::RESOLUTION)
  105.     @current_index += 2
  106.     @size += 1
  107.     @window_index.push(:resolution)
  108.   end
  109.   def create_input_window
  110.     @window_input = Window_OI.new(48+24 * @current_index)
  111.     @window_input.set_handler(:ok, method(:input_ok))
  112.     @back_window.add_text(24 * (@current_index - 1),OPT_STR::INPUT)
  113.     @current_index += 2
  114.     @size += 1
  115.     @window_index.push(:input)
  116.   end
  117.   def create_autosave_window
  118.     if Module.const_defined?(:AUTOSAVE_FILE_NAME)
  119.       @window_autosave = Window_OAS.new(48+24 * @current_index)
  120.       @window_autosave.set_handler(:ok, method(:autosave_ok))
  121.       @back_window.add_text(24 * (@current_index - 1),OPT_STR::AUTOSAVE)
  122.       @current_index += 2
  123.       @size += 1
  124.       @window_index.push(:autosave)
  125.     end
  126.   end
  127.   def create_master_window
  128.     @window_masterbar = Window_OBar.new(48+24 * @current_index)
  129.     @back_window.add_text(24 * (@current_index - 1),OPT_STR::MASTER_VOLUME)
  130.     @current_index += 2
  131.     @size += 1
  132.     @window_masterbar.refresh($game_options.master_volume)
  133.     @window_index.push(:master)
  134.   end
  135.   def create_bgm_window
  136.     @window_bgmbar = Window_OBar.new(48+24 * @current_index)
  137.     @back_window.add_text(24 * (@current_index - 1),OPT_STR::BGM_VOLUME)
  138.     @current_index += 2
  139.     @size += 1
  140.     @window_bgmbar.refresh($game_options.bgm_volume)
  141.     @window_index.push(:bgm)
  142.   end
  143.   def create_se_window
  144.     @window_sebar = Window_OBar.new(48+24*@current_index)
  145.     @back_window.add_text(24 * (@current_index - 1),OPT_STR::SE_VOLUME)
  146.     @current_index += 2
  147.     @size += 1
  148.     @window_sebar.refresh($game_options.se_volume)
  149.     @window_index.push(:se)
  150.   end
  151.   def create_message_se_window
  152.     if Window_Message.const_defined?(:DEFAULT_SE_FREQ)
  153.       @window_message = Window_OMSE.new(48+24 * @current_index)
  154.       @window_message.set_handler(:ok, method(:message_ok))
  155.       @back_window.add_text(24 * (@current_index - 1),OPT_STR::MESSAGE_SE)
  156.       @current_index += 2
  157.       @size += 1
  158.       @window_index.push(:message)
  159.     end
  160.   end
  161.   def create_window_switch
  162.     @window_switch = Window_OSW.new(48+24 * @current_index)
  163.     @window_switch.set_handler(:ok, method(:switch_ok))
  164.     @back_window.add_text(24 * (@current_index - 1),OPT_STR::SWITCH)
  165.     @current_index += 2
  166.     @size += 1
  167.     @window_index.push(:switch)
  168.   end
  169.   def activate_window(index)
  170.     case @window_index[index]
  171.     when :resolution
  172.       @window_resolution.select(0)
  173.       @window_resolution.activate
  174.       @help_window.set_text(OPT_STR::RESOLUTION_HELP)
  175.     when :input
  176.       @window_input.select(0)
  177.       @window_input.activate
  178.       @help_window.set_text(OPT_STR::INPUT_HELP)
  179.     when :autosave
  180.       @window_autosave.select(0)
  181.       @window_autosave.activate
  182.       @help_window.set_text(OPT_STR::AUTOSAVE_HELP)
  183.     when :master
  184.       @window_masterbar.select(0)
  185.       @window_masterbar.activate
  186.       @help_window.set_text(OPT_STR::MASTER_VOLUME_HELP)
  187.     when :bgm
  188.       @window_bgmbar.select(0)
  189.       @window_bgmbar.activate
  190.       @help_window.set_text(OPT_STR::BGM_VOLUME_HELP)
  191.     when :se
  192.       @window_sebar.select(0)
  193.       @window_sebar.activate
  194.       @help_window.set_text(OPT_STR::SE_VOLUME_HELP)
  195.     when :message
  196.       @window_message.select(0)
  197.       @window_message.activate
  198.       @help_window.set_text(OPT_STR::MESSAGE_SE_HELP)
  199.     when :command
  200.       @window_command.select(0)
  201.       @window_command.activate
  202.       @help_window.set_text(OPT_STR::COMMAND_HELP)
  203.     when :switch
  204.       @window_switch.select(0)
  205.       @window_switch.activate
  206.       @help_window.set_text(OPT_STR::SWITCH_HELP)
  207.     end
  208.   end
  209.   def deactivate_window(index)
  210.     case @window_index[index]
  211.     when :resolution
  212.       @window_resolution.select(-1)
  213.       @window_resolution.deactivate
  214.     when :input
  215.       @window_input.select(-1)
  216.       @window_input.deactivate
  217.     when :autosave
  218.       @window_autosave.select(-1)
  219.       @window_autosave.deactivate
  220.     when :master
  221.       @window_masterbar.select(-1)
  222.       @window_masterbar.deactivate
  223.     when :bgm
  224.       @window_bgmbar.select(-1)
  225.       @window_bgmbar.deactivate
  226.     when :se
  227.       @window_sebar.select(-1)
  228.       @window_sebar.deactivate
  229.     when :message
  230.       @window_message.select(-1)
  231.       @window_message.deactivate
  232.     when :command
  233.       @window_command.select(-1)
  234.       @window_command.deactivate
  235.     when :switch
  236.       @window_switch.select(-1)
  237.       @window_switch.deactivate
  238.     end
  239.   end
  240.   def update
  241.     super
  242.     update_input
  243.     update_index
  244.   end
  245.   def update_input
  246.     if Input.trigger?(:UP)
  247.       @index -= 1
  248.       @index = @size if @index < 0
  249.     elsif Input.trigger?(:DOWN)
  250.       @index += 1
  251.       @index = 0 if @index > @size
  252.     elsif Input.repeat?(:LEFT)
  253.       change_volume(@index, -0.01)
  254.     elsif Input.repeat?(:RIGHT)
  255.       change_volume(@index, 0.01)
  256.     elsif Input.trigger?(:B)
  257.       @index = @size
  258.     end
  259.   end
  260.   def update_index
  261.     return if @index == @old_index
  262.     deactivate_window(@old_index)
  263.     activate_window(@index)
  264.     Sound.play_cursor
  265.     @old_index = @index
  266.   end
  267.   def change_volume(index, value)
  268.     return unless audio_index(index)
  269.     $game_options.set_volume(:master, value) if @window_index[index] == :master
  270.     $game_options.set_volume(:bgm, value) if @window_index[index] == :bgm
  271.     $game_options.set_volume(:se, value) if @window_index[index] == :se
  272.     @window_masterbar.refresh($game_options.master_volume)
  273.     @window_bgmbar.refresh($game_options.bgm_volume)
  274.     @window_sebar.refresh($game_options.se_volume)
  275.     Sound.play_cursor
  276.     $game_map.autoplay if $game_map && $game_map.map_id > 0
  277.   end
  278.   def audio_index(index)
  279.     return true if @window_index[index] == :master
  280.     return true if @window_index[index] == :bgm
  281.     return true if @window_index[index] == :se
  282.     return false
  283.   end
  284.   def resolution_ok
  285.     case @window_resolution.index
  286.     when 0
  287.       Graphics.windowed_mode && Graphics.ratio = 1
  288.     when 1
  289.       Graphics.windowed_mode && Graphics.ratio = 2
  290.     when 2
  291.       Graphics.fullscreen_mode && Graphics.ratio = 2
  292.     end
  293.     @window_resolution.refresh
  294.     @window_resolution.activate
  295.   end
  296.   def autosave_ok
  297.     $game_options.auto_save = true if @window_autosave.index == 0
  298.     $game_options.auto_save = false if @window_autosave.index == 1
  299.     @window_autosave.refresh
  300.     @window_autosave.activate
  301.   end
  302.   def message_ok
  303.     $game_options.message_se = true if @window_message.index == 0
  304.     $game_options.message_se = false if @window_message.index == 1
  305.     @window_message.refresh
  306.     @window_message.activate
  307.   end
  308.   def switch_ok
  309.     eval(OPT_STR::SWITCH_DETAIL + " = true") if @window_switch.index == 0
  310.     eval(OPT_STR::SWITCH_DETAIL + " = false") if @window_switch.index == 1
  311.     @window_switch.refresh
  312.     @window_switch.activate
  313.   end
  314.   def command_ok
  315.     case @window_command.index
  316.     when 0
  317.       $game_options.save_options
  318.       $game_options.clear_memorize
  319.       return_scene
  320.     when 1
  321.       $game_options.copy_memorize
  322.       $game_options.clear_memorize
  323.       return_scene
  324.     end
  325.   end
  326.   def input_ok
  327.     SceneManager.call(Scene_ButtonConfig)
  328.   end
  329. end
  330.  
  331. class Window_Options < Window_Base
  332.   def initialize
  333.     super((Graphics.width / 2) / 2,48,(Graphics.width / 2),416-48)
  334.     self.contents.font.color = Color.new(150,100,255,200)
  335.   end
  336.   def add_text(y,string)
  337.     draw_text(15,y,(Graphics.width / 2) - 24,24,string)
  338.   end
  339.   def draw_line(y)
  340.     contents.fill_rect(15,y+12,544-24,1,Color.new(75,75,75))
  341.   end
  342. end
  343.  
  344. class Window_OR < Window_Selectable
  345.   TEXT = ["Normal","Large","Full"]
  346.   def initialize(y)
  347.     super((Graphics.width / 2) / 2,y,(Graphics.width / 2),48)
  348.     refresh
  349.     self.opacity = 0
  350.   end
  351.   def spacing; return 0; end
  352.   def item_width; self.contents.width / 3; end
  353.   def item_max; return 3; end
  354.   def col_max; return item_max; end
  355.   def row_max; return 1; end
  356.   def draw_item(index)
  357.     rect = item_rect(index)
  358.     change_color(normal_color, index == $game_options.resolution_index)
  359.     draw_text(rect, TEXT[index],1)
  360.   end
  361. end
  362.  
  363. class Window_OI < Window_Selectable
  364.   def initialize(y)
  365.     super(24 + (Graphics.width / 2) / 2,y,(Graphics.width / 2) - 48,48)
  366.     refresh
  367.     self.opacity = 0
  368.   end
  369.   def item_max; return 1; end
  370.   def col_max; return item_max; end
  371.   def row_max; return 1; end
  372.   def draw_item(index)
  373.     rect = item_rect(index)
  374.     change_color(normal_color)
  375.     draw_text(rect, "Change Button Configuration",1)
  376.   end
  377. end
  378.  
  379. class Window_OAS < Window_Selectable
  380.   def initialize(y)
  381.     super(24 + (Graphics.width / 2) / 2,y,(Graphics.width / 2) - 48,48)
  382.     refresh
  383.     self.opacity = 0
  384.   end
  385.   def item_width; return 118; end
  386.   def item_max; return 2; end
  387.   def col_max; return item_max; end
  388.   def row_max; return 1; end
  389.   def draw_item(index)
  390.     rect = item_rect(index)
  391.     $game_options.auto_save ? id = 0 : id = 1
  392.     change_color(normal_color, id == index)
  393.     draw_text(rect, ["Yes","No"][index],1)
  394.   end
  395. end
  396.  
  397. class Window_OSW < Window_Selectable
  398.   def initialize(y)
  399.     super((Graphics.width / 2) / 2,y,(Graphics.width / 2),48)
  400.     refresh
  401.     self.opacity = 0
  402.   end
  403.   def item_max; return 2; end
  404.   def col_max; return item_max; end
  405.   def row_max; return 1; end
  406.   def draw_item(index)
  407.     rect = item_rect(index)
  408.     eval(OPT_STR::SWITCH_DETAIL) ? id = 0 : id = 1
  409.     change_color(normal_color, id == index)
  410.     draw_text(rect, [OPT_STR::SWITCH_COMMAND[0],OPT_STR::SWITCH_COMMAND[1]][index],1)
  411.   end
  412. end
  413.  
  414. class Window_OCommand < Window_Selectable
  415.   def initialize(y)
  416.     super((Graphics.width / 2) / 2,y,(Graphics.width / 2),48)
  417.     refresh
  418.     self.opacity = 0
  419.   end
  420.   def item_max; return 2; end
  421.   def col_max; return item_max; end
  422.   def row_max; return 1; end
  423.   def draw_item(index)
  424.     rect = item_rect(index)
  425.     draw_text(rect, ["Ok","Cancel"][index],1)
  426.   end
  427. end
  428.  
  429. class Window_OMSE < Window_Selectable
  430.   def initialize(y)
  431.     super((Graphics.width / 2) / 2,y,(Graphics.width / 2),48)
  432.     self.y = y
  433.     refresh
  434.     self.opacity = 0
  435.   end
  436.   def item_max; return 2; end
  437.   def col_max; return item_max; end
  438.   def row_max; return 1; end
  439.  
  440.   def draw_item(index)
  441.     rect = item_rect(index)
  442.     $game_options.message_se ? id = 0 : id = 1
  443.     change_color(normal_color, id == index)
  444.     draw_text(rect, ["Yes","No"][index],1)
  445.   end
  446. end
  447.  
  448. class Window_OBar < Window_Selectable
  449.   def initialize(y)
  450.     super(24 + (Graphics.width / 2) / 2,y,(Graphics.width / 2) - 48,48)
  451.     self.opacity = 0
  452.   end
  453.   def item_width; return contents.width; end
  454.   def item_max; return 1; end
  455.   def col_max; return item_max; end
  456.   def row_max; return 1; end
  457.   def refresh(temp_value)
  458.     contents.clear
  459.     temp_value *= 50
  460.     temp_value.to_i.times do |i|
  461.       rect = Rect.new(4+i*4,6,2,8)
  462.       contents.fill_rect(rect, Color.new(75,100,255))
  463.     end
  464.     (100-temp_value).to_i.times do |i|
  465.       rect = Rect.new(396-i*4,6,2,8)
  466.       contents.fill_rect(rect, Color.new(0,0,0))
  467.     end
  468.     draw_text(0,0,contents.width,24,(temp_value * 2).to_i.to_s + "%",2)
  469.   end
  470.   def update_mouse
  471.   end
  472. end
  473.  
  474. class Game_Options
  475.   attr_accessor  :fullscreen
  476.   attr_accessor  :resolution
  477.   attr_accessor  :master_volume
  478.   attr_accessor  :bgm_volume
  479.   attr_accessor  :se_volume
  480.   attr_accessor  :auto_save
  481.   attr_accessor  :message_se
  482.   attr_accessor  :game_controls
  483.   def default_options
  484.     @fullscreen = false
  485.     @resolution = [544,416]
  486.     @master_volume = 1.0
  487.     @bgm_volume = 1.0
  488.     @se_volume = 1.0
  489.     @auto_save = true
  490.     @message_se = true
  491.     @game_controls = {
  492.         :keyboard => {
  493.             :Confirm        => :_z,
  494.             :Cancel         => :_x,
  495.             :Dash           => :_shift,
  496.             :Attack         => :_a,
  497.             :Skill          => :_d,
  498.             :Page_Up        => :_q,
  499.             :Page_Down      => :_w
  500.  
  501.         },
  502.         :controller => {
  503.             :Confirm        => :A,
  504.             :Cancel         => :Y,
  505.             :Dash           => :R2,
  506.             :Attack         => :X,
  507.             :Skill          => :B,
  508.             :Page_Up        => :R1,
  509.             :Page_Down      => :L1
  510.         }
  511.     }
  512.     save_options
  513.   end
  514.   def load_options
  515.     if FileTest.exist?("System/Options.dt")
  516.       File.open("System/Options.dt", "rb") do |file|
  517.         $game_options = Marshal.load(file)
  518.       end
  519.     else
  520.       default_options
  521.     end
  522.     reset_screen
  523.   end
  524.   def reset_screen
  525.     if Module.const_defined?(:Window_Resize)
  526.       if $game_options.fullscreen
  527.         Window_Resize.f
  528.       else
  529.         Window_Resize.r($game_options.resolution[0],$game_options.resolution[1])
  530.       end
  531.     end
  532.   end
  533.   def save_options
  534.     File.open("System/Options.dt", "wb") do |file|
  535.       Marshal.dump($game_options, file)
  536.     end
  537.   end
  538.   def memorize_options
  539.     @old_options = Marshal.load(Marshal.dump($game_options))
  540.   end
  541.   def copy_memorize
  542.     $game_options = Marshal.load(Marshal.dump(@old_options))
  543.     reset_screen
  544.   end
  545.   def clear_memorize
  546.     @old_options = nil
  547.   end
  548.   def resolution_index
  549.     return 2 if Graphics.fullscreen?
  550.     return 1 if !Graphics.fullscreen? && Graphics.ratio == 0
  551.     return 0
  552.   end
  553.   def set_resolution(w,h)
  554.     @resolution = [w,h]
  555.     @fullscreen = false
  556.     Window_Resize.window
  557.     15.times {|i| Graphics.update }
  558.     Window_Resize.r(@resolution[0],@resolution[1])
  559.   end
  560.   def set_fullscreen
  561.     @fullscreen = true
  562.     Window_Resize.f
  563.   end
  564.   def set_volume(symbol, value)
  565.     case symbol
  566.     when :master
  567.       @master_volume += value
  568.       @master_volume = [[@master_volume, 1].min, 0].max
  569.     when :bgm
  570.       @bgm_volume += value
  571.       @bgm_volume = [[@bgm_volume, 1].min, 0].max
  572.     when :se
  573.       @se_volume += value
  574.       @se_volume = [[@se_volume, 1].min, 0].max
  575.     end
  576.   end
  577.   def preset_volume(symbol, value)
  578.     if symbol == :master
  579.       @master_volume = value
  580.       @master_volume = [[@master_volume, 1].min, 0].max
  581.     end
  582.     if symbol == :bgm
  583.       @bgm_volume = value
  584.       @bgm_volume = [[@bgm_volume, 1].min, 0].max
  585.     end
  586.     if symbol == :se
  587.       @se_volume = value
  588.       @se_volume = [[@se_volume, 1].min, 0].max
  589.     end
  590.   end
  591. end
  592.  
  593. class RPG::BGM < RPG::AudioFile
  594.   def play(pos = 0)
  595.     if @name.empty?
  596.       Audio.bgm_stop
  597.       @@last = RPG::BGM.new
  598.     else
  599.       if $game_options
  600.         volume = @volume * $game_options.master_volume
  601.         volume *= $game_options.bgm_volume
  602.       else
  603.         volume = @volume
  604.       end
  605.       Audio.bgm_play('Audio/BGM/' + @name, volume.to_i, @pitch, pos)
  606.       @@last = self.clone
  607.     end
  608.   end
  609. end
  610.  
  611. class RPG::BGS < RPG::AudioFile
  612.   def play(pos = 0)
  613.     if @name.empty?
  614.       Audio.bgs_stop
  615.       @@last = RPG::BGS.new
  616.     else
  617.       if $game_options
  618.         volume = @volume * $game_options.master_volume
  619.         volume *= $game_options.bgm_volume
  620.       else
  621.         volume = @volume
  622.       end
  623.       Audio.bgs_play('Audio/BGS/' + @name, volume.to_i, @pitch, pos)
  624.       @@last = self.clone
  625.     end
  626.   end
  627. end
  628.  
  629. class RPG::ME < RPG::AudioFile
  630.   def play
  631.     if @name.empty?
  632.       Audio.me_stop
  633.     else
  634.       if $game_options
  635.         volume = @volume * $game_options.master_volume
  636.         volume *= $game_options.se_volume
  637.       else
  638.         volume = @volume
  639.       end
  640.       Audio.me_play('Audio/ME/' + @name, volume.to_i, @pitch)
  641.     end
  642.   end
  643. end
  644.  
  645. class RPG::SE < RPG::AudioFile
  646.   def play
  647.     unless @name.empty?
  648.       if $game_options
  649.         volume = @volume * $game_options.master_volume
  650.         volume *= $game_options.se_volume
  651.       else
  652.         volume = @volume
  653.       end
  654.       Audio.se_play('Audio/SE/' + @name, volume.to_i, @pitch)
  655.     end
  656.   end
  657. end
  658.  
  659. module SceneManager
  660.   def self.run
  661.     DataManager.init
  662.     Audio.setup_midi if use_midi?
  663.     $game_options = Game_Options.new
  664.     $game_options.load_options
  665.     @scene = first_scene_class.new
  666.     @scene.main while @scene
  667.   end
  668. end
  669.  
  670. class Window_MenuCommand < Window_Command
  671.   alias options_aoc add_original_commands
  672.   def add_original_commands
  673.     options_aoc
  674.     add_command("Options", :options)
  675.   end
  676. end
  677.  
  678. class Scene_Menu < Scene_MenuBase
  679.   alias options_create_command_window create_command_window
  680.   def create_command_window
  681.     options_create_command_window
  682.     @command_window.set_handler(:options,   method(:command_options))
  683.   end
  684.   def command_options
  685.     SceneManager.call(Scene_Options)
  686.   end
  687. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement