CyberForte

DoW Game Options

Oct 10th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 44.68 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Yanfly Engine Melody - System Game Options
  4. # Last Date Updated: 2010.06.12
  5. # Level: Normal
  6. #
  7. # System Game Options replaces the "Game End" scene found in the default RPG
  8. # Maker VX with a system options menu. In this menu, the player can readjust
  9. # sound volumes, automatic dashing, and more. This changes one of the unused
  10. # game end scene into something a whole lot more useful.
  11. #
  12. #===============================================================================
  13. # Updates
  14. # -----------------------------------------------------------------------------
  15. # o 2010.06.12 - Bugfix for disposing the skins window.
  16. # o 2010.05.14 - Finished Script.
  17. # o 2010.05.12 - Started Script.
  18. #===============================================================================
  19. # Instructions
  20. # -----------------------------------------------------------------------------
  21. # To install this script, open up your script editor and copy/paste this script
  22. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  23. #
  24. # 1. Scroll down, adjust the various Switches and Variable values to something
  25. #    empty or predetermined.
  26. # 2. Make a "Windows" folder in your project's "Graphics" folder. Insert the
  27. #    window skins you want to use there and adjust the WINDOW_HASH accordingly.
  28. #
  29. #===============================================================================
  30. # Compatibility
  31. # -----------------------------------------------------------------------------
  32. # - Replaces ALL of Scene_End. Expect no functionality with any scripts that
  33. #   will also replace Scene_End.
  34. # - This script is made to be specifically compatible with Battle Engine Melody.
  35. #===============================================================================
  36.  
  37. $imported = {} if $imported == nil
  38. $imported["SystemGameOptions"] = true
  39.  
  40. module YEM
  41.   module SYSTEM
  42.    
  43.     # This replaces the Game End title with the following text. And although
  44.     # script itself doesn't provide the icon, any script that may potentially
  45.     # link towards the System menu will reveal the System icon below.
  46.     TITLE = "System"
  47.     ICON  = 134
  48.    
  49.     #===========================================================================
  50.     # Game System Commands
  51.     # --------------------------------------------------------------------------
  52.     # The following adjusts the order at which you would like the menu system
  53.     # commands to appear. Here is the reference table to their command ID's.
  54.     #      :blank        - Blank Item.
  55.     #      :volume_bgm   - Adjusts BGM volume.
  56.     #      :volume_bgs   - Adjusts BGS volume.
  57.     #      :volume_sfx   - Adjusts SFX volume.
  58.     #      :animations   - Turns on/off battle animations.
  59.     #      :autocursor   - Requires BEM. Memorized cursor position.
  60.     #      :skill_help   - Requires BEM. Display skill help.
  61.     #      :next_actor   - Requires BEM. Automatic Next Actor.
  62.     #      :atb_active   - Requires BEM. Sets ATB type.
  63.     #      :atb_speed    - Requires BEM. Sets ATB speed.
  64.     #      :auto_dash    - Controls if need to hold down dash button to run.
  65.     #      :instant_text - Whether or not text appears instantly in messages.
  66.     #      :windowskin   - Changes the windowskin.
  67.     #      :return_title - Return back to the title screen.
  68.     #      :return_menu  - Return back to the menu screen.
  69.     #===========================================================================
  70.    
  71.     # This array modifies the order your system menu options appear in from
  72.     # top to bottom. Rearrange them as you see fit or remove them if desired.
  73.     COMMANDS =[
  74.       :windowskin,   # Adjusts window skins.
  75.       :skill_help,   # Requires BEM. Shows skill help.
  76.       :atb_active,   # Requires BEM. Sets ATB type.
  77.       :atb_speeds,   # Requires BEM. Sets ATB speed.
  78.       :animations,   # Turns on/off battle animations.
  79.       :autocursor,   # Requires BEM. Memory cursor.
  80.       :next_actor,   # Requires BEM. Automatic Next Actor.
  81.       :bgm_volume,   # Adjusts BGM volume.
  82.       :bgs_volume,   # Adjusts BGS volume.
  83.       :sfx_volume,   # Adjusts SFX volume.
  84.       :auto_dash,    # Controls need to hold down dash button to run.
  85.       :instant_text, # Makes text appear instantly.
  86.       :blank,        # A blank space.
  87.       :return_title, # Return to the title screen.
  88.       :return_menu,  # Return back to the main menu.
  89.     ] # Do not remove this.
  90.    
  91.     # The following hash determines what variables and switches are used to
  92.     # adjust the system options menu. It's very important that you bind the
  93.     # values to the proper variables and switches in order for your game to
  94.     # run properly. In addition to adjusting the switches, you also apply
  95.     # text descriptions of each of the items here, too.
  96.      OPTIONS ={
  97.     # Option => Value
  98.       :bgm_variable  => 61,  # Variable used to adjust BGM volume.
  99.       :bgm_mute_sw   => 18,  # Switch used to mute/unmute the BGM.
  100.         :bgm_volume  => "BGM Volume",
  101.         :bgm_des     => "Adjusts BGM volume. Z to Mute and Unmute.",
  102.       :bgs_variable  => 62,  # Variable used to adjust BGS volume.
  103.       :bgs_mute_sw   => 19,  # Switch used to mute/unmute the BGS.
  104.         :bgs_volume  => "BGS Volume",
  105.         :bgs_des     => "Adjusts BGS volume. Z to Mute and Unmute.",
  106.       :sfx_variable  => 63,  # Variable used to adjust SFX volume.
  107.       :sfx_mute_sw   => 20,  # Switch used to mute/unmute the SFX.
  108.         :sfx_volume  => "SFX Volume",
  109.         :sfx_des     => "Adjusts SFX volume. Z to Mute and Unmute.",
  110.         :mute        => "Mute",
  111.         :audio       => "Audio %d%%",
  112.       :atb_avariable => 64,  # Variable used for ATB Active Type.
  113.         :atb_aname   => "ActiveType",
  114.         :wait_0      => "Full",
  115.         :wait_0_des  => "ATB Gauge does not stop with battle menus open.",
  116.         :wait_1      => "Semi",
  117.         :wait_1_des  => "ATB Gauge stops during target selection.",
  118.         :wait_2      => "Stop",
  119.         :wait_2_des  => "ATB Gauge stops with battle menus open.",
  120.         :wait_3      => "Wait",
  121.         :wait_3_des  => "ATB Gauge stops with any member ready for action.",
  122.       :atb_svariable => 65,  # Variable used for ATB Speeds.
  123.         :atb_sname   => "Turn Speed",
  124.         :atb_s_des   => "Adjusts battle speed. Higher values are faster.",
  125.       :animation_sw  => 11,  # Switch used to display/hide animations.
  126.         :animations  => "Animations",
  127.         :ani_des     => "Enables/Disables battle animations.",
  128.         :ani_show    => "Show",
  129.         :ani_hide    => "Hide",
  130.       :autocursor_sw => 12,  # Switch used for autocursors.
  131.         :autocursor  => "AutoCursor",
  132.         :curmem_des  => "Enables/Disables cursor memory for actions.",
  133.         :curmem_on   => "Memory",
  134.         :curmem_off  => "Reset",
  135.       :next_actor_sw => 13,  # Switch used for automatic next actor.
  136.         :next_actor  => "Next Actor",
  137.         :next_des    => "Move to next actor after selecting commands",
  138.         :next_on     => "Auto",
  139.         :next_off    => "Manual",
  140.       :skill_help_sw => 14,  # Switch used to enable skill help.
  141.         :skill_help  => "Skill Help",
  142.         :help_des    => "Display skill descriptions during battle phase.",
  143.         :help_on     => "Enabled",
  144.         :help_off    => "Disable",
  145.       :auto_dash_sw  => 15,  # Switch used to enable auto-dashing.
  146.         :auto_dash   => "Auto-Dash",
  147.         :dash_des    => "Automatically dash without holding the run button.",
  148.         :dash_on     => "Dash",
  149.         :dash_off    => "Walk",
  150.       :inst_text_sw  => 16,  # Switch used to control instant text.
  151.         :instant_text => "Instant Text",
  152.         :inst_des    => "Text appears all at once instead of one by one.",
  153.         :inst_on     => "Instant",
  154.         :inst_off    => "Normal",
  155.       :return_title  => "Return to Title",
  156.         :retitle_des => "Return back to the title screen.",
  157.       :return_menu   => "Return to Main Menu",
  158.         :remenu_des  => "Return back to the main menu.",
  159.       :window_var    => 66,  # Variable used to change windowskins.
  160.         :windowskin  => "Windowskin",
  161.         :wind_des    => "Changes the windowskin used for the game.",
  162.     } # Do not remove this.
  163.    
  164.     # This sets the default fonts used for your windows. Note that in this
  165.     # array, if a player doesn't have the font in front, it'll use the next one
  166.     # onward until the player does have that font installed.
  167.     DEFAULT = ["UmePlus Gothic", "Verdana", "Arial", "Courier New"]
  168.     WRITING = ["Comic Sans MS", "Lucida Handwriting", "Arial"]
  169.    
  170.     # The following adjusts the window skins used for your game. Match the
  171.     # Window skins with the names accordingly. Within the windowskin hash,
  172.     # the following settings are adjusted as such:
  173.     #     Name - File Name
  174.     #     Opac - Back Opacity
  175.     #     Bold - Bold font?
  176.     #   Italic - Italic font?
  177.     #   Shadow - Use shadows?
  178.     #     Size - Font Size
  179.     #     Font - Font Set
  180.     DEFAULT_SKIN_VALUE  = 14
  181.     WINDOW_HASH ={
  182.     # Window ID => [      Name, Opac,  Bold, Italic, Shadow, Size,    Font],
  183.               1 => [     "Red",  200, false,  false,   true,   20, DEFAULT],
  184.               2 => [  "Orange",  200, false,  false,   true,   20, DEFAULT],
  185.               3 => [  "Yellow",  200, false,  false,   true,   20, DEFAULT],
  186.               4 => [   "Green",  200, false,  false,   true,   20, DEFAULT],
  187.               5 => [    "Cyan",  200, false,  false,   true,   20, DEFAULT],
  188.               6 => [    "Navy",  200, false,  false,   true,   20, DEFAULT],
  189.               7 => [    "Blue",  200, false,  false,   true,   20, DEFAULT],
  190.               8 => [  "Violet",  200, false,  false,   true,   20, DEFAULT],
  191.               9 => [  "Purple",  200, false,  false,   true,   20, DEFAULT],
  192.              10 => [    "Pink",  200, false,  false,   true,   20, DEFAULT],
  193.              11 => [    "Grey",  200, false,  false,   true,   20, DEFAULT],
  194.              12 => [   "Black",  200, false,  false,   true,   20, DEFAULT],
  195.              13 => [   "White",  255, false,  false,  false,   20, DEFAULT],
  196.              14 => [ "Default",  255, false,  false,  false,   20, DEFAULT],
  197.     } # Do not remove this.
  198.    
  199.   end # SYSTEM
  200. end # YEM
  201.  
  202. #===============================================================================
  203. # Editting anything past this point may potentially result in causing computer
  204. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  205. # Therefore, edit at your own risk.
  206. #===============================================================================
  207.  
  208. #===============================================================================
  209. # Vocab
  210. #===============================================================================
  211.  
  212. module Vocab
  213.  
  214.   #--------------------------------------------------------------------------
  215.   # overwrite method: self.game_end
  216.   #--------------------------------------------------------------------------
  217.   def self.game_end
  218.     return YEM::SYSTEM::TITLE
  219.   end
  220.  
  221. end # Vocab
  222.  
  223. #===============================================================================
  224. # module Icon
  225. #===============================================================================
  226.  
  227. module Icon
  228.  
  229.   #--------------------------------------------------------------------------
  230.   # new method: self.system
  231.   #--------------------------------------------------------------------------
  232.   def self.system
  233.     return YEM::SYSTEM::ICON
  234.   end
  235.  
  236. end # Icon
  237.  
  238. #===============================================================================
  239. # module Cache
  240. #===============================================================================
  241.  
  242. module Cache
  243.  
  244.   #--------------------------------------------------------------------------
  245.   # new method: self.windows
  246.   #--------------------------------------------------------------------------
  247.   def self.windows(filename); load_bitmap("Graphics/Windows/", filename); end
  248.  
  249. end # Cache
  250. YEM::SYSTEM::WINDOWSKIN_VARIABLE = YEM::SYSTEM::OPTIONS[:window_var]
  251. #===============================================================================
  252. # RPG::BGM
  253. #===============================================================================
  254. unless $imported["BattleEngineMelody"]
  255. module RPG
  256. class BGM < AudioFile
  257.  
  258.   #--------------------------------------------------------------------------
  259.   # overwrite method: play
  260.   #--------------------------------------------------------------------------
  261.   def play
  262.     if @name.empty?
  263.       Audio.bgm_stop
  264.       @@last = BGM.new
  265.     else
  266.       vol = @volume
  267.       if $game_variables != nil
  268.         options = YEM::SYSTEM::OPTIONS
  269.         vol = vol * $game_variables[options[:bgm_variable]] / 100
  270.         vol = [[vol, 0].max, 100].min
  271.         vol = 0 if $game_switches[options[:bgm_mute_sw]]
  272.       end
  273.       Audio.bgm_play("Audio/BGM/" + @name, vol, @pitch)
  274.       @@last = self
  275.     end
  276.   end
  277.  
  278. end # BGM
  279. class ME < AudioFile
  280.  
  281.   #--------------------------------------------------------------------------
  282.   # overwrite method: play
  283.   #--------------------------------------------------------------------------
  284.   def play
  285.     if @name.empty?
  286.       Audio.me_stop
  287.     else
  288.       vol = @volume
  289.       if $game_variables != nil
  290.         options = YEM::SYSTEM::OPTIONS
  291.         vol = vol * $game_variables[options[:bgm_variable]] / 100
  292.         vol = [[vol, 0].max, 100].min
  293.         vol = 0 if $game_switches[options[:bgm_mute_sw]]
  294.       end
  295.       Audio.me_play("Audio/ME/" + @name, vol, @pitch)
  296.     end
  297.   end
  298.  
  299. end # ME
  300. class BGS < AudioFile
  301.  
  302.   #--------------------------------------------------------------------------
  303.   # overwrite method: play
  304.   #--------------------------------------------------------------------------
  305.   def play
  306.     if @name.empty?
  307.       Audio.bgs_stop
  308.       @@last = BGS.new
  309.     else
  310.       vol = @volume
  311.       if $game_variables != nil
  312.         options = YEM::SYSTEM::OPTIONS
  313.         vol = vol * $game_variables[options[:bgs_variable]] / 100
  314.         vol = [[vol, 0].max, 100].min
  315.         vol = 0 if $game_switches[options[:bgs_mute_sw]]
  316.       end
  317.       Audio.bgs_play("Audio/BGS/" + @name, vol, @pitch)
  318.       @@last = self
  319.     end
  320.   end
  321.  
  322. end # BGS
  323. class SE < AudioFile
  324.  
  325.   #--------------------------------------------------------------------------
  326.   # overwrite method: play
  327.   #--------------------------------------------------------------------------
  328.   def play
  329.     unless @name.empty?
  330.       vol = @volume
  331.       if $game_variables != nil
  332.         options = YEM::SYSTEM::OPTIONS
  333.         vol = vol * $game_variables[options[:sfx_variable]] / 100
  334.         vol = [[vol, 0].max, 100].min
  335.         vol = 0 if $game_switches[options[:sfx_mute_sw]]
  336.       end
  337.       Audio.se_play("Audio/SE/" + @name, vol, @pitch)
  338.     end
  339.   end
  340.  
  341. end # SE
  342. end # RPG
  343. end # $imported["BattleEngineMelody"]
  344. #===============================================================================
  345. # Game_System
  346. #===============================================================================
  347.  
  348. class Game_System
  349.  
  350.   #--------------------------------------------------------------------------
  351.   # new method: create_system_options
  352.   #--------------------------------------------------------------------------
  353.   def create_system_options
  354.     return if @created_system_options
  355.     @created_system_options = true
  356.     options = YEM::SYSTEM::OPTIONS
  357.     $game_variables[options[:bgm_variable]] = 100
  358.     $game_variables[options[:bgs_variable]] = 100
  359.     $game_variables[options[:sfx_variable]] = 100
  360.     $game_switches[options[:bgm_mute_sw]] = false
  361.     $game_switches[options[:bgs_mute_sw]] = false
  362.     $game_switches[options[:sfx_mute_sw]] = false
  363.     $game_switches[options[:animation_sw]] = true
  364.     $game_switches[options[:autocursor_sw]] = true
  365.     $game_switches[options[:next_actor_sw]] = true
  366.     $game_switches[options[:skill_help_sw]] = false
  367.     $game_switches[options[:auto_dash_sw]] = false
  368.     $game_switches[options[:inst_text_sw]] = false
  369.     $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE] =
  370.       YEM::SYSTEM::DEFAULT_SKIN_VALUE
  371.   end
  372.  
  373. end # Game_System
  374.  
  375. #===============================================================================
  376. # Game_Player
  377. #===============================================================================
  378.  
  379. class Game_Player < Game_Character
  380.  
  381.   #--------------------------------------------------------------------------
  382.   # alias method: dash?
  383.   #--------------------------------------------------------------------------
  384.   alias dash_sgo dash? unless $@
  385.   def dash?
  386.     if $game_switches[YEM::SYSTEM::OPTIONS[:auto_dash_sw]]
  387.       return false if @move_route_forcing
  388.       return false if $game_map.disable_dash?
  389.       return false if in_vehicle?
  390.       return false if Input.press?(Input::A)
  391.       return true
  392.     else
  393.       return dash_sgo
  394.     end
  395.   end
  396.  
  397. end # Game_Player
  398.  
  399. #===============================================================================
  400. # Window
  401. #===============================================================================
  402.  
  403. class Window
  404.  
  405.   #--------------------------------------------------------------------------
  406.   # update windowskin
  407.   #--------------------------------------------------------------------------
  408.   def update_windowskin
  409.     return if $game_variables == nil
  410.     variable = YEM::SYSTEM::WINDOWSKIN_VARIABLE
  411.     if $game_variables[variable] == 0
  412.       $game_variables[variable] = YEM::SYSTEM::DEFAULT_SKIN_VALUE
  413.     elsif !YEM::SYSTEM::WINDOW_HASH.include?($game_variables[variable])
  414.       $game_variables[variable] = YEM::SYSTEM::DEFAULT_SKIN_VALUE
  415.     end
  416.     skin = YEM::SYSTEM::WINDOW_HASH[$game_variables[variable]]
  417.     change_settings(skin)
  418.   end
  419.  
  420.   #--------------------------------------------------------------------------
  421.   # change_settings
  422.   #--------------------------------------------------------------------------
  423.   def change_settings(skin)
  424.     self.windowskin = Cache.windows(skin[0])
  425.     self.back_opacity = skin[1]
  426.     self.contents.font.bold = Font.default_bold = skin[2]
  427.     self.contents.font.italic = Font.default_italic = skin[3]
  428.     self.contents.font.shadow = Font.default_shadow = skin[4]
  429.     self.contents.font.size = Font.default_size = skin[5]
  430.     self.contents.font.name = Font.default_name = skin[6]
  431.     self.contents.font.color = normal_color
  432.   end
  433.  
  434. end # Window
  435.  
  436. #===============================================================================
  437. # Window_Base
  438. #===============================================================================
  439.  
  440. class Window_Base < Window
  441.  
  442.   #--------------------------------------------------------------------------
  443.   # alias method: initialize
  444.   #--------------------------------------------------------------------------
  445.   alias initialize_window_sgo initialize unless $@
  446.   def initialize(x, y, width, height)
  447.     initialize_window_sgo(x, y, width, height)
  448.     self.update_windowskin
  449.   end
  450.  
  451.   #--------------------------------------------------------------------------
  452.   # alias method: create_contents
  453.   #--------------------------------------------------------------------------
  454.   alias create_contents_base_sgo create_contents unless $@
  455.   def create_contents
  456.     create_contents_base_sgo
  457.     self.contents.font.color = normal_color
  458.   end
  459.  
  460. end # Window_Base
  461.  
  462. #===============================================================================
  463. # Window_Selectable
  464. #===============================================================================
  465.  
  466. class Window_Selectable < Window_Base
  467.  
  468.   #--------------------------------------------------------------------------
  469.   # alias method: create_contents
  470.   #--------------------------------------------------------------------------
  471.   alias create_contents_selectable_sgo create_contents unless $@
  472.   def create_contents
  473.     create_contents_selectable_sgo
  474.     self.contents.font.color = normal_color
  475.   end
  476.  
  477. end # Window_Selectable
  478.  
  479. #===============================================================================
  480. # Window_SaveFile
  481. #===============================================================================
  482.  
  483. class Window_SaveFile < Window_Base
  484.  
  485.   #--------------------------------------------------------------------------
  486.   # alias method: refresh
  487.   #--------------------------------------------------------------------------
  488.   alias refresh_savefile_mso refresh unless $@
  489.   def refresh
  490.     if @file_exist
  491.       n = @game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE]
  492.       if n == 0 or !YEM::SYSTEM::WINDOW_HASH.include?(n)
  493.         n = YEM::SYSTEM::DEFAULT_SKIN_VALUE
  494.       end
  495.       skin = YEM::SYSTEM::WINDOW_HASH[n]
  496.       change_settings(skin)
  497.     end
  498.     refresh_savefile_mso
  499.   end
  500.  
  501. end # Window_SaveFile
  502.  
  503. #===============================================================================
  504. # Window_Message
  505. #===============================================================================
  506.  
  507. class Window_Message < Window_Selectable
  508.  
  509.   #--------------------------------------------------------------------------
  510.   # alias method: update_show_fast
  511.   #--------------------------------------------------------------------------
  512.   alias update_show_fast_sgo update_show_fast unless $@
  513.   def update_show_fast
  514.     if $game_switches[YEM::SYSTEM::OPTIONS[:inst_text_sw]]
  515.       if self.pause or self.openness < 255
  516.         @show_fast = false
  517.       else
  518.         @show_fast = true
  519.       end
  520.       if @show_fast and @wait_count > 0
  521.         @wait_count -= 1
  522.       end
  523.     else
  524.       update_show_fast_sgo
  525.     end
  526.   end
  527.  
  528.   #--------------------------------------------------------------------------
  529.   # alias method: new_page
  530.   #--------------------------------------------------------------------------
  531.   alias new_page_sgo new_page unless $@
  532.   def new_page
  533.     self.update_windowskin
  534.     new_page_sgo
  535.   end
  536.  
  537. end # Window_Message
  538.  
  539. #===============================================================================
  540. # Window_SystemOptions
  541. #===============================================================================
  542.  
  543. class Window_SystemOptions < Window_Selectable
  544.  
  545.   #--------------------------------------------------------------------------
  546.   # initialize
  547.   #--------------------------------------------------------------------------
  548.   def initialize(help_window)
  549.     dy = help_window.height
  550.     dh = Graphics.height - dy
  551.     super(0, dy, Graphics.width, dh)
  552.     self.index = 0
  553.     refresh
  554.     @help_window = help_window
  555.     update_help
  556.   end
  557.  
  558.   #--------------------------------------------------------------------------
  559.   # item
  560.   #--------------------------------------------------------------------------
  561.   def item; return @data[self.index]; end
  562.  
  563.   #--------------------------------------------------------------------------
  564.   # refresh
  565.   #--------------------------------------------------------------------------
  566.   def refresh
  567.     @data = []
  568.     for command in YEM::SYSTEM::COMMANDS
  569.       case command
  570.       when :windowskin, :animations, :bgm_volume, :sfx_volume, :bgs_volume,
  571.       :auto_dash, :instant_text, :blank, :return_title, :return_menu
  572.       when :skill_help, :atb_active, :atb_speeds, :autocursor, :next_actor
  573.         next unless $imported["BattleEngineMelody"]
  574.         if [:atb_active, :atb_speeds].include?(command)
  575.           type = $game_variables[YEM::BATTLE_ENGINE::BATTLE_TYPE_VARIABLE]
  576.           next unless type == 2
  577.         end
  578.       else; next
  579.       end
  580.       @data.push(command)
  581.     end
  582.     @item_max = @data.size
  583.     create_contents
  584.     for i in 0...@item_max; draw_item(i); end
  585.   end
  586.  
  587.   #--------------------------------------------------------------------------
  588.   # draw_item
  589.   #--------------------------------------------------------------------------
  590.   def draw_item(index)
  591.     rect = item_rect(index)
  592.     self.contents.clear_rect(rect)
  593.     obj = @data[index]
  594.     return if obj == nil
  595.     case obj
  596.     when :windowskin
  597.       draw_window_item(obj, rect.clone)
  598.     when :bgm_volume, :sfx_volume, :bgs_volume
  599.       draw_volume_item(obj, rect.clone)
  600.     when :animations, :autocursor, :next_actor, :skill_help,
  601.     :auto_dash, :instant_text
  602.       draw_switch_item(obj, rect.clone)
  603.     when :atb_active, :atb_speeds
  604.       draw_atb_item(obj, rect.clone)
  605.     when :return_title, :return_menu
  606.       draw_solo_item(obj, rect.clone)
  607.     end
  608.   end
  609.  
  610.   #--------------------------------------------------------------------------
  611.   # draw_window_item
  612.   #--------------------------------------------------------------------------
  613.   def draw_window_item(obj, rect)
  614.     title = YEM::SYSTEM::OPTIONS[:windowskin]
  615.     self.contents.font.color = normal_color
  616.     self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1)
  617.     dx = rect.x + rect.width/2
  618.     skin_id = $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE]
  619.     skin_name = YEM::SYSTEM::WINDOW_HASH[skin_id][0]
  620.     dx = rect.x + rect.width/2
  621.     self.contents.draw_text(dx, rect.y, rect.width/2, WLH, skin_name, 1)
  622.   end
  623.  
  624.   #--------------------------------------------------------------------------
  625.   # draw_volume_item
  626.   #--------------------------------------------------------------------------
  627.   def draw_volume_item(obj, rect)
  628.     options = YEM::SYSTEM::OPTIONS
  629.     case obj
  630.     when :bgm_volume
  631.       title = options[:bgm_volume]
  632.       value = $game_variables[options[:bgm_variable]]
  633.       mute  = $game_switches[options[:bgm_mute_sw]]
  634.     when :bgs_volume
  635.       title = options[:bgs_volume]
  636.       value = $game_variables[options[:bgs_variable]]
  637.       mute  = $game_switches[options[:bgs_mute_sw]]
  638.     when :sfx_volume
  639.       title = options[:sfx_volume]
  640.       value = $game_variables[options[:sfx_variable]]
  641.       mute  = $game_switches[options[:sfx_mute_sw]]
  642.     else; return
  643.     end
  644.     value = sprintf(options[:audio], value)
  645.     self.contents.font.color = normal_color
  646.     self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1)
  647.     self.contents.font.color.alpha = mute ? 128 : 255
  648.     dx = rect.x + rect.width/2
  649.     self.contents.draw_text(dx, rect.y, rect.width/4, WLH, value, 1)
  650.     self.contents.font.color.alpha = mute ? 255 : 128
  651.     dx = rect.x + rect.width*3/4
  652.     self.contents.draw_text(dx, rect.y, rect.width/4, WLH, options[:mute], 1)
  653.   end
  654.  
  655.   #--------------------------------------------------------------------------
  656.   # draw_switch_item
  657.   #--------------------------------------------------------------------------
  658.   def draw_switch_item(obj, rect)
  659.     options = YEM::SYSTEM::OPTIONS
  660.     title = options[obj]
  661.     case obj
  662.     when :animations
  663.       name1 = options[:ani_show]
  664.       name2 = options[:ani_hide]
  665.       toggle = $game_switches[options[:animation_sw]]
  666.     when :autocursor
  667.       name1 = options[:curmem_on]
  668.       name2 = options[:curmem_off]
  669.       toggle = $game_switches[options[:autocursor_sw]]
  670.     when :next_actor
  671.       name1 = options[:next_on]
  672.       name2 = options[:next_off]
  673.       toggle = $game_switches[options[:next_actor_sw]]
  674.     when :skill_help
  675.       name1 = options[:help_on]
  676.       name2 = options[:help_off]
  677.       toggle = $game_switches[options[:skill_help_sw]]
  678.     when :cinematics
  679.       name1 = options[:cinem_on]
  680.       name2 = options[:cinem_off]
  681.       toggle = $game_switches[options[:cinematics_sw]]
  682.     when :auto_dash
  683.       name1 = options[:dash_on]
  684.       name2 = options[:dash_off]
  685.       toggle = $game_switches[options[:auto_dash_sw]]
  686.     when :instant_text
  687.       name1 = options[:inst_on]
  688.       name2 = options[:inst_off]
  689.       toggle = $game_switches[options[:inst_text_sw]]
  690.     else; return
  691.     end
  692.     self.contents.font.color = normal_color
  693.     self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1)
  694.     self.contents.font.color.alpha = toggle ? 255 : 128
  695.     dx = rect.x + rect.width/2
  696.     self.contents.draw_text(dx, rect.y, rect.width/4, WLH, name1, 1)
  697.     self.contents.font.color.alpha = toggle ? 128 : 255
  698.     dx = rect.x + rect.width*3/4
  699.     self.contents.draw_text(dx, rect.y, rect.width/4, WLH, name2, 1)
  700.   end
  701.  
  702.   #--------------------------------------------------------------------------
  703.   # draw_atb_item
  704.   #--------------------------------------------------------------------------
  705.   def draw_atb_item(obj, rect)
  706.     options = YEM::SYSTEM::OPTIONS
  707.     case obj
  708.     when :atb_active
  709.       title = options[:atb_aname]
  710.       value = $game_variables[options[:atb_avariable]]
  711.       #---
  712.       self.contents.font.color = normal_color
  713.       name1 = options[:wait_0]
  714.       dx = rect.x + rect.width/2
  715.       self.contents.font.color.alpha = (value == 0) ? 255 : 128
  716.       self.contents.draw_text(dx, rect.y, rect.width/8, WLH, name1, 1)
  717.       name2 = options[:wait_1]
  718.       dx = rect.x + rect.width*5/8
  719.       self.contents.font.color.alpha = (value == 1) ? 255 : 128
  720.       self.contents.draw_text(dx, rect.y, rect.width/8, WLH, name2, 1)
  721.       name3 = options[:wait_2]
  722.       dx = rect.x + rect.width*6/8
  723.       self.contents.font.color.alpha = (value == 2) ? 255 : 128
  724.       self.contents.draw_text(dx, rect.y, rect.width/8, WLH, name3, 1)
  725.       name4 = options[:wait_3]
  726.       dx = rect.x + rect.width*7/8
  727.       self.contents.font.color.alpha = (value == 3) ? 255 : 128
  728.       self.contents.draw_text(dx, rect.y, rect.width/8, WLH, name4, 1)
  729.       #---
  730.     when :atb_speeds
  731.       title = options[:atb_sname]
  732.       value = $game_variables[options[:atb_svariable]] - 1
  733.       #---
  734.       for i in 0...10
  735.         self.contents.font.color = normal_color
  736.         name = (i + 1).to_s
  737.         dx = rect.x + rect.width * (10 + i)/20
  738.         self.contents.font.color.alpha = (value == i) ? 255 : 128
  739.         self.contents.draw_text(dx, rect.y, rect.width/20, WLH, name, 1)
  740.       end
  741.       #---
  742.     else; return
  743.     end
  744.     self.contents.font.color = normal_color
  745.     self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1)
  746.   end
  747.  
  748.   #--------------------------------------------------------------------------
  749.   # draw_solo_item
  750.   #--------------------------------------------------------------------------
  751.   def draw_solo_item(obj, rect)
  752.     options = YEM::SYSTEM::OPTIONS
  753.     case obj
  754.     when :return_title, :return_menu
  755.       text = options[obj]
  756.     else; return
  757.     end
  758.     self.contents.font.color = normal_color
  759.     self.contents.draw_text(rect.x, rect.y, rect.width, WLH, text, 1)
  760.   end
  761.  
  762.   #--------------------------------------------------------------------------
  763.   # update
  764.   #--------------------------------------------------------------------------
  765.   def update
  766.     super
  767.     if Input.trigger?(Input::C)
  768.       input_case_c
  769.     elsif Input.repeat?(Input::LEFT)
  770.       input_case_left
  771.     elsif Input.repeat?(Input::RIGHT)
  772.       input_case_right
  773.     end
  774.   end
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # input_case_c
  778.   #--------------------------------------------------------------------------
  779.   def input_case_c
  780.     options = YEM::SYSTEM::OPTIONS
  781.     case item
  782.     when :windowskin
  783.       Sound.play_decision
  784.       $scene.open_skins_window
  785.       return
  786.     when :bgm_volume; switch = options[:bgm_mute_sw]
  787.     when :bgs_volume; switch = options[:bgs_mute_sw]
  788.     when :sfx_volume; switch = options[:sfx_mute_sw]
  789.     when :animations; switch = options[:animation_sw]
  790.     when :autocursor; switch = options[:autocursor_sw]
  791.     when :next_actor; switch = options[:next_actor_sw]
  792.     when :skill_help; switch = options[:skill_help_sw]
  793.     when :cinematics; switch = options[:cinematics_sw]
  794.     when :auto_dash;  switch = options[:auto_dash_sw]
  795.     when :instant_text; switch = options[:inst_text_sw]
  796.     when :return_title
  797.       $scene.command_to_title
  798.       return
  799.     when :return_menu
  800.       Sound.play_decision
  801.       $scene.return_scene
  802.       return
  803.     else; return
  804.     end
  805.     $game_switches[switch] = !$game_switches[switch]
  806.     Sound.play_decision
  807.     RPG::BGM::last.play if item == :bgm_volume
  808.     RPG::BGS::last.play if item == :bgs_volume
  809.     draw_item(self.index)
  810.   end
  811.  
  812.   #--------------------------------------------------------------------------
  813.   # input_case_left
  814.   #--------------------------------------------------------------------------
  815.   def input_case_left
  816.     options = YEM::SYSTEM::OPTIONS
  817.     ignore = false
  818.     case item
  819.     when :bgm_volume, :bgs_volume, :sfx_volume
  820.       value = Input.press?(Input::SHIFT) ? 10 : 1
  821.       case item
  822.       when :bgm_volume; variable = options[:bgm_variable]
  823.       when :bgs_volume; variable = options[:bgs_variable]
  824.       when :sfx_volume; variable = options[:sfx_variable]
  825.       end
  826.       return if $game_variables[variable] == 0
  827.       $game_variables[variable] -= value
  828.       $game_variables[variable] = [$game_variables[variable], 0].max
  829.       ignore = true
  830.     when :atb_active
  831.       variable = options[:atb_avariable]
  832.       return if $game_variables[variable] == 0
  833.       $game_variables[variable] -= 1
  834.       $game_variables[variable] = [$game_variables[variable], 0].max
  835.       ignore = true
  836.     when :atb_speeds
  837.       variable = options[:atb_svariable]
  838.       return if $game_variables[variable] == 1
  839.       $game_variables[variable] -= 1
  840.       $game_variables[variable] = [$game_variables[variable], 1].max
  841.       ignore = true
  842.     when :animations; switch = options[:animation_sw]
  843.     when :autocursor; switch = options[:autocursor_sw]
  844.     when :next_actor; switch = options[:next_actor_sw]
  845.     when :skill_help; switch = options[:skill_help_sw]
  846.     when :cinematics; switch = options[:cinematics_sw]
  847.     when :auto_dash;  switch = options[:auto_dash_sw]
  848.     when :instant_text; switch = options[:inst_text_sw]
  849.     else; return
  850.     end
  851.     unless ignore
  852.       return if $game_switches[switch]
  853.       $game_switches[switch] = true
  854.     end
  855.     Sound.play_cursor
  856.     RPG::BGM::last.play if item == :bgm_volume
  857.     RPG::BGS::last.play if item == :bgs_volume
  858.     draw_item(self.index)
  859.   end
  860.  
  861.   #--------------------------------------------------------------------------
  862.   # input_case_right
  863.   #--------------------------------------------------------------------------
  864.   def input_case_right
  865.     options = YEM::SYSTEM::OPTIONS
  866.     ignore = false
  867.     case item
  868.     when :bgm_volume, :bgs_volume, :sfx_volume
  869.       value = Input.press?(Input::SHIFT) ? 10 : 1
  870.       case item
  871.       when :bgm_volume; variable = options[:bgm_variable]
  872.       when :bgs_volume; variable = options[:bgs_variable]
  873.       when :sfx_volume; variable = options[:sfx_variable]
  874.       end
  875.       return if $game_variables[variable] == 100
  876.       $game_variables[variable] += value
  877.       $game_variables[variable] = [$game_variables[variable], 100].min
  878.       ignore = true
  879.     when :atb_active
  880.       variable = options[:atb_avariable]
  881.       return if $game_variables[variable] == 3
  882.       $game_variables[variable] += 1
  883.       $game_variables[variable] = [$game_variables[variable], 3].min
  884.       ignore = true
  885.     when :atb_speeds
  886.       variable = options[:atb_svariable]
  887.       return if $game_variables[variable] == 10
  888.       $game_variables[variable] += 1
  889.       $game_variables[variable] = [$game_variables[variable], 10].min
  890.       ignore = true
  891.     when :animations; switch = options[:animation_sw]
  892.     when :autocursor; switch = options[:autocursor_sw]
  893.     when :next_actor; switch = options[:next_actor_sw]
  894.     when :skill_help; switch = options[:skill_help_sw]
  895.     when :cinematics; switch = options[:cinematics_sw]
  896.     when :auto_dash;  switch = options[:auto_dash_sw]
  897.     when :instant_text; switch = options[:inst_text_sw]
  898.     else; return
  899.     end
  900.     unless ignore
  901.       return if !$game_switches[switch]
  902.       $game_switches[switch] = false
  903.     end
  904.     Sound.play_cursor
  905.     RPG::BGM::last.play if item == :bgm_volume
  906.     RPG::BGS::last.play if item == :bgs_volume
  907.     draw_item(self.index)
  908.   end
  909.  
  910.   #--------------------------------------------------------------------------
  911.   # update_help
  912.   #--------------------------------------------------------------------------
  913.   def update_help
  914.     case item
  915.     when :bgm_volume; type = :bgm_des
  916.     when :bgs_volume; type = :bgs_des
  917.     when :sfx_volume; type = :sfx_des
  918.     when :animations; type = :ani_des
  919.     when :autocursor; type = :curmem_des
  920.     when :next_actor; type = :next_des
  921.     when :skill_help; type = :help_des
  922.     when :cinematics; type = :cinem_des
  923.     when :windowskin; type = :wind_des
  924.     when :auto_dash;  type = :dash_des
  925.     when :instant_text; type = :inst_des
  926.     when :return_title; type = :retitle_des
  927.     when :return_menu;  type = :remenu_des
  928.     when :atb_active
  929.       case $game_variables[YEM::SYSTEM::OPTIONS[:atb_avariable]]
  930.       when 0; type = :wait_0_des
  931.       when 1; type = :wait_1_des
  932.       when 2; type = :wait_2_des
  933.       when 3: type = :wait_3_des
  934.       end
  935.     when :atb_speeds; type = :atb_s_des
  936.     else; type = nil
  937.     end
  938.     text = YEM::SYSTEM::OPTIONS[type].to_s
  939.     @help_window.set_text(text, 1)
  940.   end
  941.  
  942. end # Window_SystemOptions
  943.  
  944. #===============================================================================
  945. # Window_Skins
  946. #===============================================================================
  947.  
  948. class Window_Skins < Window_Selectable
  949.  
  950.   #--------------------------------------------------------------------------
  951.   # initialize
  952.   #--------------------------------------------------------------------------
  953.   def initialize
  954.     dx = Graphics.width/4
  955.     dw = Graphics.width/2
  956.     dh = Graphics.height - 112
  957.     super(dx, 56, dw, dh)
  958.     @column_max = 1
  959.     self.index = 0
  960.     self.back_opacity = 255
  961.     self.openness = 0
  962.     self.active = false
  963.     refresh
  964.   end
  965.  
  966.   #--------------------------------------------------------------------------
  967.   # refresh
  968.   #--------------------------------------------------------------------------
  969.   def refresh
  970.     @data = []
  971.     variable = $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE]
  972.     hash = YEM::SYSTEM::WINDOW_HASH.sort{ |a,b| a[0] <=> b[0] }
  973.     for key in hash
  974.       @data.push(key[0])
  975.       self.index = key[0] - 1 if key[0] == $game_variables[variable]
  976.     end
  977.     @item_max = @data.size
  978.     create_contents
  979.     for i in 0...@item_max
  980.       draw_item(i)
  981.     end
  982.   end
  983.  
  984.   #--------------------------------------------------------------------------
  985.   # draw_item
  986.   #--------------------------------------------------------------------------
  987.   def draw_item(index)
  988.     rect = item_rect(index)
  989.     self.contents.clear_rect(rect)
  990.     rect.width -= 4
  991.     text = YEM::SYSTEM::WINDOW_HASH[@data[index]][0]
  992.     self.contents.draw_text(rect, text, 1)
  993.   end
  994.  
  995. end # Window_Skins
  996.  
  997. #===============================================================================
  998. # Scene_Title
  999. #===============================================================================
  1000.  
  1001. class Scene_Title < Scene_Base
  1002.  
  1003.   #--------------------------------------------------------------------------
  1004.   # alias method: create_game_objects
  1005.   #--------------------------------------------------------------------------
  1006.   alias create_game_objects_sgo create_game_objects unless $@
  1007.   def create_game_objects
  1008.     create_game_objects_sgo
  1009.     $game_system.create_system_options
  1010.   end
  1011.  
  1012. end # Scene_Title
  1013.  
  1014. #===============================================================================
  1015. # Scene_Map
  1016. #===============================================================================
  1017.  
  1018. class Scene_Map < Scene_Base
  1019.  
  1020.   #--------------------------------------------------------------------------
  1021.   # alias method: start
  1022.   #--------------------------------------------------------------------------
  1023.   alias start_sgo start unless $@
  1024.   def start
  1025.     $game_system.create_system_options
  1026.     start_sgo
  1027.   end
  1028.  
  1029. end # Scene_Map
  1030.  
  1031. #===============================================================================
  1032. # Scene_Battle
  1033. #===============================================================================
  1034.  
  1035. class Scene_Battle < Scene_Base
  1036.  
  1037.   #--------------------------------------------------------------------------
  1038.   # alias method: display_normal_animation
  1039.   #--------------------------------------------------------------------------
  1040.   unless $imported["BattleEngineMelody"]
  1041.   alias display_normal_animation_sgo display_normal_animation unless $@
  1042.   def display_normal_animation(targets, animation_id, mirror = false)
  1043.     return if $game_switches[YEM::SYSTEM::OPTIONS[:animation_sw]]
  1044.     display_normal_animation_sgo(targets, animation_id, mirror)
  1045.   end
  1046.   end # $imported["BattleEngineMelody"]
  1047.  
  1048. end # Scene_Battle
  1049.  
  1050. #===============================================================================
  1051. # Scene_End
  1052. #===============================================================================
  1053.  
  1054. class Scene_End < Scene_Base
  1055.  
  1056.   #--------------------------------------------------------------------------
  1057.   # public instance variables
  1058.   #--------------------------------------------------------------------------
  1059.   attr_accessor :window_var
  1060.  
  1061.   #--------------------------------------------------------------------------
  1062.   # overwrite method: start
  1063.   #--------------------------------------------------------------------------
  1064.   def start
  1065.     super
  1066.     create_menu_background
  1067.     @window_var = YEM::SYSTEM::WINDOWSKIN_VARIABLE
  1068.     @help_window = Window_Help.new
  1069.     @options_window = Window_SystemOptions.new(@help_window)
  1070.     @skins_window = Window_Skins.new
  1071.   end
  1072.  
  1073.   #--------------------------------------------------------------------------
  1074.   # overwrite method: post_start
  1075.   #--------------------------------------------------------------------------
  1076.   def post_start; super; end
  1077.  
  1078.   #--------------------------------------------------------------------------
  1079.   # overwrite method: pre_terminate
  1080.   #--------------------------------------------------------------------------
  1081.   def pre_terminate; super; end
  1082.    
  1083.   #--------------------------------------------------------------------------
  1084.   # overwrite method: close_command_window
  1085.   #--------------------------------------------------------------------------
  1086.   def close_command_window; end
  1087.  
  1088.   #--------------------------------------------------------------------------
  1089.   # overwrite method: terminate
  1090.   #--------------------------------------------------------------------------
  1091.   def terminate
  1092.     super
  1093.     @help_window.dispose
  1094.     @options_window.dispose
  1095.     @skins_window.dispose
  1096.     dispose_menu_background
  1097.   end
  1098.  
  1099.   #--------------------------------------------------------------------------
  1100.   # overwrite method: update
  1101.   #--------------------------------------------------------------------------
  1102.   def update
  1103.     super
  1104.     @help_window.update
  1105.     @skins_window.update
  1106.     update_menu_background
  1107.     if @options_window.active
  1108.       update_options_window
  1109.     elsif @skins_window.active
  1110.       update_skins_window
  1111.     end
  1112.   end
  1113.  
  1114.   #--------------------------------------------------------------------------
  1115.   # new method: update_options_window
  1116.   #--------------------------------------------------------------------------
  1117.   def update_options_window
  1118.     @options_window.update
  1119.     if Input.trigger?(Input::B)
  1120.       Sound.play_cancel
  1121.       return_scene
  1122.     end
  1123.   end
  1124.  
  1125.   #--------------------------------------------------------------------------
  1126.   # new method: open_skins_window
  1127.   #--------------------------------------------------------------------------
  1128.   def open_skins_window
  1129.     @skins_window.open
  1130.     @skins_window.index = $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE] - 1
  1131.     @skins_window.active = true
  1132.     @options_window.active = false
  1133.   end
  1134.  
  1135.   #--------------------------------------------------------------------------
  1136.   # new method: update_skins_window
  1137.   #--------------------------------------------------------------------------
  1138.   def update_skins_window
  1139.     if @last_index != @skins_window.index
  1140.       @last_index = @skins_window.index
  1141.       update_skins
  1142.     end
  1143.     if Input.trigger?(Input::B)
  1144.       Sound.play_cancel
  1145.       @skins_window.close
  1146.       @skins_window.active = false
  1147.       @options_window.active = true
  1148.     elsif Input.trigger?(Input::C)
  1149.       Sound.play_decision
  1150.       @skins_window.close
  1151.       @skins_window.active = false
  1152.       @options_window.active = true
  1153.     end
  1154.   end
  1155.  
  1156.   #--------------------------------------------------------------------------
  1157.   # new method: update_skins
  1158.   #--------------------------------------------------------------------------
  1159.   def update_skins
  1160.     $game_variables[@window_var] = @skins_window.index + 1
  1161.     @options_window.update_windowskin
  1162.     @options_window.refresh
  1163.     @help_window.update_windowskin
  1164.     @help_window.set_text("")
  1165.     @options_window.update_help
  1166.     @skins_window.update_windowskin
  1167.     @skins_window.back_opacity = 255
  1168.     @skins_window.refresh
  1169.     @options_window.draw_item(@options_window.index)
  1170.   end
  1171.  
  1172. end # Scene_End
  1173.  
  1174. #===============================================================================
  1175. #
  1176. # END OF FILE
  1177. #
  1178. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment