Guest User

Untitled

a guest
Sep 18th, 2014
24
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - System Options v1.00
  4. # -- Last Updated: 2012.01.01
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SystemOptions"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.01 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # This script replaces the "Game End" option in the Main Menu with a "System"
  22. # menu where the player can adjust various settings in the game. Of them, the
  23. # player can change the window colour, the volume for BGM, BGS, SFX, set
  24. # automatic dashing, message text to display instantly, and speed up battles by
  25. # hiding battle animations.
  26. #
  27. #==============================================================================
  28. # ▼ Instructions
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # To install this script, open up your script editor and copy/paste this script
  31. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  32. #
  33. # -----------------------------------------------------------------------------
  34. # Script Calls - These commands are used with script calls.
  35. # -----------------------------------------------------------------------------
  36. # $game_system.volume_change(:bgm, x)
  37. # $game_system.volume_change(:bgs, x)
  38. # $game_system.volume_change(:sfx, x)
  39. # Unlike the previous Yanfly Engines, this version does not bind volume to a
  40. # variable. Use the script call to change the bgm, bgs, or sfx sound rate by
  41. # x increment. Use a negative value to lower the volume.
  42. #
  43. # $game_system.set_autodash(true)
  44. # $game_system.set_autodash(false)
  45. # Turns autodash on (true) or off (false).
  46. #
  47. # $game_system.set_instantmsg(true)
  48. # $game_system.set_instantmsg(false)
  49. # Turns instant messages on (true) or off (false).
  50. #
  51. # $game_system.set_animations(true)
  52. # $game_system.set_animations(false)
  53. # Turns battle animations on (true) or off (false).
  54. #
  55. #==============================================================================
  56. # ▼ Compatibility
  57. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  58. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  59. # it will run with RPG Maker VX without adjusting.
  60. #
  61. #==============================================================================
  62.  
  63. module YEA
  64. module SYSTEM
  65.  
  66. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  67. # - General Setting -
  68. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  69. # These are the general settings that govern the System settings. This will
  70. # change the "Game End" vocab, and disable or enable autodash, instant
  71. # messages, or animations by default.
  72. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73. COMMAND_NAME = "System" # Command name used to replace Game End.
  74. DEFAULT_AUTODASH = false # Enable automatic dashing by default?
  75. DEFAULT_INSTANTMSG = false # Enable instant message text by default?
  76. DEFAULT_ANIMATIONS = true # Enable battle animations by default?
  77.  
  78. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  79. # - General Setting -
  80. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  81. # These are the general settings that govern the System settings. This will
  82. # change the "Game End" vocab, and disable or enable autodash, instant
  83. # messages, or animations by default.
  84. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  85. COMMAND_NAME = "Options" # Command name used to replace Game End.
  86. DEFAULT_AUTODASH = false # Enable automatic dashing by default?
  87. DEFAULT_INSTANTMSG = false # Enable instant message text by default?
  88. DEFAULT_ANIMATIONS = true # Enable battle animations by default?
  89.  
  90. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  91. # - Command Settings -
  92. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  93. # These settings adjust the commands shown in the command list. Add, remove
  94. # or rearrange the commands as you see fit. Here's a list of which commands
  95. # do what:
  96. #
  97. # -------------------------------------------------------------------------
  98. # :command Description
  99. # -------------------------------------------------------------------------
  100. # :blank Inserts an empty blank space.
  101. #
  102. # :window_red Changes the red tone for all windows.
  103. # :window_grn Changes the green tone for all windows.
  104. # :window_blu Changes the blue tone for all windows.
  105. #
  106. # :volume_bgm Changes the BGM volume used.
  107. # :volume_bgs Changes the BGS volume used.
  108. # :volume_sfx Changes the SFX volume used.
  109. #
  110. # :autodash Sets the player to automatically dash.
  111. # :instantmsg Sets message text to appear instantly.
  112. # :animations Enables battle animations or disables them.
  113. #
  114. # :to_title Returns to the title screen.
  115. # :shutdown Shuts down the game.
  116. #
  117. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  118. COMMANDS =[
  119. :window_red, # Changes the red tone for all windows.
  120. :window_grn, # Changes the green tone for all windows.
  121. :window_blu, # Changes the blue tone for all windows.
  122. :volume_bgm, # Changes the BGM volume used.
  123. :volume_bgs, # Changes the BGS volume used.
  124. :volume_sfx, # Changes the SFX volume used.
  125. :blank,
  126. :autodash, # Sets the player to automatically dash.
  127. :instantmsg, # Sets message text to appear instantly.
  128. :animations, # Enables battle animations or disables them.
  129. :switch_1, # Custom Switch 1. Adjust settings below.
  130. :switch_2, # Custom Switch 2. Adjust settings below.
  131. # :variable_1, # Custom Variable 1. Adjust settings below.
  132. # :variable_2, # Custom Variable 2. Adjust settings below.
  133. :fullscreen,
  134. :blank,
  135. :to_title, # Returns to the title screen.
  136. :shutdown, # Shuts down the game.
  137. ] # Do not remove this.
  138.  
  139. #--------------------------------------------------------------------------
  140. # - Custom Switches -
  141. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  142. # If you want your game to have system options other than just the ones
  143. # listed above, you can insert custom switches here to produce such an
  144. # effect. Adjust the settings here as you see fit.
  145. #--------------------------------------------------------------------------
  146. CUSTOM_SWITCHES ={
  147. # -------------------------------------------------------------------------
  148. # :switch => [Switch, Name, Off Text, On Text,
  149. # Help Window Description
  150. # ], # Do not remove this.
  151. # -------------------------------------------------------------------------
  152. :switch_1 => [ 1, "Show Tutorials", "OFF", "ON",
  153. "Display tutorials."
  154. ],
  155. # -------------------------------------------------------------------------
  156. :switch_2 => [ 2, "Show Shotcuts", "OFF", "ON",
  157. "Display shortcuts."
  158. ],
  159. # -------------------------------------------------------------------------
  160. } # Do not remove this.
  161.  
  162. #--------------------------------------------------------------------------
  163. # - Custom Variables -
  164. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  165. # If you want your game to have system options other than just the ones
  166. # listed above, you can insert custom variables here to produce such an
  167. # effect. Adjust the settings here as you see fit.
  168. #--------------------------------------------------------------------------
  169. CUSTOM_VARIABLES ={
  170. # -------------------------------------------------------------------------
  171. # :variable => [Switch, Name, Colour1, Colour2, Min, Max,
  172. # Help Window Description
  173. # ], # Do not remove this.
  174. # -------------------------------------------------------------------------
  175. :variable_1 => [ 1, "Custom Variable 1", 9, 1, -100, 100,
  176. "Help description used for custom variable 1."
  177. ],
  178. # -------------------------------------------------------------------------
  179. :variable_2 => [ 2, "Custom Variable 2", 10, 2, -10, 10,
  180. "Help description used for custom variable 2."
  181. ],
  182. # -------------------------------------------------------------------------
  183. } # Do not remove this.
  184.  
  185. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  186. # - Vocab Settings -
  187. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  188. # This hash adjusts the vocab used for both the commands and the help
  189. # description that appears above the command window. Note that for the
  190. # command help descriptions, you may use text codes. Use \n to linebreak.
  191. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  192. COMMAND_VOCAB ={
  193. # -------------------------------------------------------------------------
  194. # :command => [Command Name, Option1, Option2
  195. # Help Window Description,
  196. # ], # Do not remove this.
  197. # -------------------------------------------------------------------------
  198. :blank => ["", "None", "None",
  199. ""
  200. ], # Do not remove this.
  201. # -------------------------------------------------------------------------
  202. :window_red => ["Window Red", "None", "None",
  203. "Change the red colour tone for windows.\n" +
  204. "Hold SHIFT to change increment by 10."
  205. ], # Do not remove this.
  206. # -------------------------------------------------------------------------
  207. :window_grn => ["Window Green", "None", "None",
  208. "Change the green colour tone for windows.\n" +
  209. "Hold SHIFT to change increment by 10."
  210. ], # Do not remove this.
  211. # -------------------------------------------------------------------------
  212. :window_blu => ["Window Blue", "None", "None",
  213. "Change the blue colour tone for windows.\n" +
  214. "Hold SHIFT to change increment by 10."
  215. ], # Do not remove this.
  216. # -------------------------------------------------------------------------
  217. :volume_bgm => ["BGM Volume", 12, 4, # Options 1 & 2 are Gauge Colours.
  218. "Change the volume used for background music.\n" +
  219. "Hold SHIFT to change increment by 10."
  220. ], # Do not remove this.
  221. # -------------------------------------------------------------------------
  222. :volume_bgs => ["BGS Volume", 13, 5, # Options 1 & 2 are Gauge Colours.
  223. "Change the volume used for background sound.\n" +
  224. "Hold SHIFT to change increment by 10."
  225. ], # Do not remove this.
  226. # -------------------------------------------------------------------------
  227. :volume_sfx => ["SFX Volume", 14, 6, # Options 1 & 2 are Gauge Colours.
  228. "Change the volume used for sound effects.\n" +
  229. "Hold SHIFT to change increment by 10."
  230. ], # Do not remove this.
  231. # -------------------------------------------------------------------------
  232. :autodash => ["Auto-Dash", "Walk", "Dash",
  233. "Automatically dash without holding the run button."
  234. ], # Do not remove this.
  235. # -------------------------------------------------------------------------
  236. :instantmsg => ["Instant Text", "Normal", "Instant",
  237. "Set message text to appear one-by-one or instantly."
  238. ], # Do not remove this.
  239. # -------------------------------------------------------------------------
  240. :animations => ["Battle Animations", "Hide", "Show",
  241. "Hide animations during battle to speed up battles?"
  242. ], # Do not remove this.
  243. # -------------------------------------------------------------------------
  244. :to_title => ["Return to Title Screen", "None", "None",
  245. "Go back to the title screen."
  246. ], # Do not remove this.
  247. # -------------------------------------------------------------------------
  248. :shutdown => ["Shutdown Game", "None", "None",
  249. "Turns off the game."
  250. ], # Do not remove this.
  251. # -------------------------------------------------------------------------
  252. } # Do not remove this.
  253.  
  254. end # SYSTEM
  255. end # YEA
  256.  
  257. #==============================================================================
  258. # ▼ Editting anything past this point may potentially result in causing
  259. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  260. # halitosis so edit at your own risk.
  261. #==============================================================================
  262.  
  263. #==============================================================================
  264. # ■ Vocab
  265. #==============================================================================
  266.  
  267. module Vocab
  268.  
  269. #--------------------------------------------------------------------------
  270. # overwrite method: self.game_end
  271. #--------------------------------------------------------------------------
  272. def self.game_end
  273. return YEA::SYSTEM::COMMAND_NAME
  274. end
  275.  
  276. end # Vocab
  277.  
  278. #==============================================================================
  279. # ■ RPG::BGM
  280. #==============================================================================
  281.  
  282. class RPG::BGM < RPG::AudioFile
  283.  
  284. #--------------------------------------------------------------------------
  285. # overwrite method: play
  286. #--------------------------------------------------------------------------
  287. def play(pos = 0)
  288. if @name.empty?
  289. Audio.bgm_stop
  290. @@last = RPG::BGM.new
  291. else
  292. volume = @volume
  293. volume *= $game_system.volume(:bgm) * 0.01 unless $game_system.nil?
  294. Audio.bgm_play('Audio/BGM/' + @name, volume, @pitch, pos)
  295. @@last = self.clone
  296. end
  297. end
  298.  
  299. end # RPG::BGM
  300.  
  301. #==============================================================================
  302. # ■ RPG::ME
  303. #==============================================================================
  304.  
  305. class RPG::ME < RPG::AudioFile
  306.  
  307. #--------------------------------------------------------------------------
  308. # overwrite method: play
  309. #--------------------------------------------------------------------------
  310. def play
  311. if @name.empty?
  312. Audio.me_stop
  313. else
  314. volume = @volume
  315. volume *= $game_system.volume(:bgm) * 0.01 unless $game_system.nil?
  316. Audio.me_play('Audio/ME/' + @name, volume, @pitch)
  317. end
  318. end
  319.  
  320. end # RPG::ME
  321.  
  322. #==============================================================================
  323. # ■ RPG::BGS
  324. #==============================================================================
  325.  
  326. class RPG::BGS < RPG::AudioFile
  327.  
  328. #--------------------------------------------------------------------------
  329. # overwrite method: play
  330. #--------------------------------------------------------------------------
  331. def play(pos = 0)
  332. if @name.empty?
  333. Audio.bgs_stop
  334. @@last = RPG::BGS.new
  335. else
  336. volume = @volume
  337. volume *= $game_system.volume(:bgs) * 0.01 unless $game_system.nil?
  338. Audio.bgs_play('Audio/BGS/' + @name, volume, @pitch, pos)
  339. @@last = self.clone
  340. end
  341. end
  342.  
  343. end # RPG::BGS
  344.  
  345. #==============================================================================
  346. # ■ RPG::SE
  347. #==============================================================================
  348.  
  349. class RPG::SE < RPG::AudioFile
  350.  
  351. #--------------------------------------------------------------------------
  352. # overwrite method: play
  353. #--------------------------------------------------------------------------
  354. def play
  355. unless @name.empty?
  356. volume = @volume
  357. volume *= $game_system.volume(:sfx) * 0.01 unless $game_system.nil?
  358. Audio.se_play('Audio/SE/' + @name, volume, @pitch)
  359. end
  360. end
  361.  
  362. end # RPG::SE
  363.  
  364. #==============================================================================
  365. # ■ Game_System
  366. #==============================================================================
  367.  
  368. class Game_System
  369.  
  370. #--------------------------------------------------------------------------
  371. # alias method: initialize
  372. #--------------------------------------------------------------------------
  373. alias game_system_initialize_so initialize
  374. def initialize
  375. game_system_initialize_so
  376. init_volume_control
  377. init_autodash
  378. init_instantmsg
  379. init_animations
  380. end
  381.  
  382. #--------------------------------------------------------------------------
  383. # new method: init_volume_control
  384. #--------------------------------------------------------------------------
  385. def init_volume_control
  386. @volume = {}
  387. @volume[:bgm] = 100
  388. @volume[:bgs] = 100
  389. @volume[:sfx] = 100
  390. end
  391.  
  392. #--------------------------------------------------------------------------
  393. # new method: volume
  394. #--------------------------------------------------------------------------
  395. def volume(type)
  396. init_volume_control if @volume.nil?
  397. return [[@volume[type], 0].max, 100].min
  398. end
  399.  
  400. #--------------------------------------------------------------------------
  401. # new method: volume_change
  402. #--------------------------------------------------------------------------
  403. def volume_change(type, increment)
  404. init_volume_control if @volume.nil?
  405. @volume[type] += increment
  406. @volume[type] = [[@volume[type], 0].max, 100].min
  407. end
  408.  
  409. #--------------------------------------------------------------------------
  410. # new method: init_autodash
  411. #--------------------------------------------------------------------------
  412. def init_autodash
  413. @autodash = YEA::SYSTEM::DEFAULT_AUTODASH
  414. end
  415.  
  416. #--------------------------------------------------------------------------
  417. # new method: autodash?
  418. #--------------------------------------------------------------------------
  419. def autodash?
  420. init_autodash if @autodash.nil?
  421. return @autodash
  422. end
  423.  
  424. #--------------------------------------------------------------------------
  425. # new method: set_autodash
  426. #--------------------------------------------------------------------------
  427. def set_autodash(value)
  428. @autodash = value
  429. end
  430.  
  431. #--------------------------------------------------------------------------
  432. # new method: init_instantmsg
  433. #--------------------------------------------------------------------------
  434. def init_instantmsg
  435. @instantmsg = YEA::SYSTEM::DEFAULT_INSTANTMSG
  436. end
  437.  
  438. #--------------------------------------------------------------------------
  439. # new method: instantmsg?
  440. #--------------------------------------------------------------------------
  441. def instantmsg?
  442. init_instantmsg if @instantmsg.nil?
  443. return @instantmsg
  444. end
  445.  
  446. #--------------------------------------------------------------------------
  447. # new method: set_instantmsg
  448. #--------------------------------------------------------------------------
  449. def set_instantmsg(value)
  450. @instantmsg = value
  451. end
  452.  
  453. #--------------------------------------------------------------------------
  454. # new method: init_animations
  455. #--------------------------------------------------------------------------
  456. def init_animations
  457. @animations = YEA::SYSTEM::DEFAULT_ANIMATIONS
  458. end
  459.  
  460. #--------------------------------------------------------------------------
  461. # new method: animations?
  462. #--------------------------------------------------------------------------
  463. def animations?
  464. init_animations if @animations.nil?
  465. return @animations
  466. end
  467.  
  468. #--------------------------------------------------------------------------
  469. # new method: set_animations
  470. #--------------------------------------------------------------------------
  471. def set_animations(value)
  472. @animations = value
  473. end
  474.  
  475. end # Game_System
  476.  
  477. #==============================================================================
  478. # ■ Game_Player
  479. #==============================================================================
  480.  
  481. class Game_Player < Game_Character
  482.  
  483. #--------------------------------------------------------------------------
  484. # alias method: dash?
  485. #--------------------------------------------------------------------------
  486. alias game_player_dash_so dash?
  487. def dash?
  488. if $game_system.autodash?
  489. return false if @move_route_forcing
  490. return false if $game_map.disable_dash?
  491. return false if vehicle
  492. return !Input.press?(:A)
  493. else
  494. return game_player_dash_so
  495. end
  496. end
  497.  
  498. end # Game_Player
  499.  
  500. #==============================================================================
  501. # ■ Scene_Battle
  502. #==============================================================================
  503.  
  504. class Scene_Battle < Scene_Base
  505.  
  506. #--------------------------------------------------------------------------
  507. # alias method: show_fast?
  508. #--------------------------------------------------------------------------
  509. alias scene_battle_show_fast_so show_fast?
  510. def show_fast?
  511. return true unless $game_system.animations?
  512. return scene_battle_show_fast_so
  513. end
  514.  
  515. #--------------------------------------------------------------------------
  516. # alias method: show_normal_animation
  517. #--------------------------------------------------------------------------
  518. alias scene_battle_show_normal_animation_so show_normal_animation
  519. def show_normal_animation(targets, animation_id, mirror = false)
  520. return unless $game_system.animations?
  521. scene_battle_show_normal_animation_so(targets, animation_id, mirror)
  522. end
  523.  
  524. end # Scene_Battle
  525.  
  526. #==============================================================================
  527. # ■ Window_Message
  528. #==============================================================================
  529.  
  530. class Window_Message < Window_Base
  531.  
  532. #--------------------------------------------------------------------------
  533. # alias method: clear_flags
  534. #--------------------------------------------------------------------------
  535. alias window_message_clear_flags_so clear_flags
  536. def clear_flags
  537. window_message_clear_flags_so
  538. @show_fast = true if $game_system.instantmsg?
  539. end
  540.  
  541. end # Window_Message
  542.  
  543. #==============================================================================
  544. # ■ Window_SystemOptions
  545. #==============================================================================
  546.  
  547. class Window_SystemOptions < Window_Command
  548.  
  549. #--------------------------------------------------------------------------
  550. # initialize
  551. #--------------------------------------------------------------------------
  552. def initialize(help_window)
  553. @help_window = help_window
  554. super(0, @help_window.height)
  555. refresh
  556. end
  557.  
  558. #--------------------------------------------------------------------------
  559. # window_width
  560. #--------------------------------------------------------------------------
  561. def window_width; return Graphics.width; end
  562.  
  563. #--------------------------------------------------------------------------
  564. # window_height
  565. #--------------------------------------------------------------------------
  566. def window_height; return Graphics.height - @help_window.height; end
  567.  
  568. #--------------------------------------------------------------------------
  569. # update_help
  570. #--------------------------------------------------------------------------
  571. def update_help
  572. if current_symbol == :custom_switch || current_symbol == :custom_variable
  573. text = @help_descriptions[current_ext]
  574. else
  575. text = @help_descriptions[current_symbol]
  576. end
  577. text = "" if text.nil?
  578. @help_window.set_text(text)
  579. end
  580.  
  581. #--------------------------------------------------------------------------
  582. # ok_enabled?
  583. #--------------------------------------------------------------------------
  584. def ok_enabled?
  585. return true if [:to_title, :shutdown].include?(current_symbol)
  586. return false
  587. end
  588.  
  589. #--------------------------------------------------------------------------
  590. # make_command_list
  591. #--------------------------------------------------------------------------
  592. def make_command_list
  593. @help_descriptions = {}
  594. for command in YEA::SYSTEM::COMMANDS
  595. case command
  596. when :blank
  597. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  598. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  599. when :window_red, :window_grn, :window_blu
  600. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  601. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  602. when :volume_bgm, :volume_bgs, :volume_sfx
  603. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  604. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  605. when :autodash, :instantmsg, :animations
  606. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  607. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  608. when :to_title, :shutdown
  609. add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
  610. @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
  611. else
  612. process_custom_switch(command)
  613. process_custom_variable(command)
  614. end
  615. end
  616. end
  617.  
  618. #--------------------------------------------------------------------------
  619. # process_custom_switch
  620. #--------------------------------------------------------------------------
  621. def process_custom_switch(command)
  622. return unless YEA::SYSTEM::CUSTOM_SWITCHES.include?(command)
  623. name = YEA::SYSTEM::CUSTOM_SWITCHES[command][1]
  624. add_command(name, :custom_switch, true, command)
  625. @help_descriptions[command] = YEA::SYSTEM::CUSTOM_SWITCHES[command][4]
  626. end
  627.  
  628. #--------------------------------------------------------------------------
  629. # process_custom_variable
  630. #--------------------------------------------------------------------------
  631. def process_custom_variable(command)
  632. return unless YEA::SYSTEM::CUSTOM_VARIABLES.include?(command)
  633. name = YEA::SYSTEM::CUSTOM_VARIABLES[command][1]
  634. add_command(name, :custom_variable, true, command)
  635. @help_descriptions[command] = YEA::SYSTEM::CUSTOM_VARIABLES[command][6]
  636. end
  637.  
  638. #--------------------------------------------------------------------------
  639. # draw_item
  640. #--------------------------------------------------------------------------
  641. def draw_item(index)
  642. reset_font_settings
  643. rect = item_rect(index)
  644. contents.clear_rect(rect)
  645. case @list[index][:symbol]
  646. when :window_red, :window_grn, :window_blu
  647. draw_window_tone(rect, index, @list[index][:symbol])
  648. when :volume_bgm, :volume_bgs, :volume_sfx
  649. draw_volume(rect, index, @list[index][:symbol])
  650. when :autodash, :instantmsg, :animations
  651. draw_toggle(rect, index, @list[index][:symbol])
  652. when :to_title, :shutdown
  653. draw_text(item_rect_for_text(index), command_name(index), 1)
  654. when :custom_switch
  655. draw_custom_switch(rect, index, @list[index][:ext])
  656. when :custom_variable
  657. draw_custom_variable(rect, index, @list[index][:ext])
  658. end
  659. end
  660.  
  661. #--------------------------------------------------------------------------
  662. # draw_window_tone
  663. #--------------------------------------------------------------------------
  664. def draw_window_tone(rect, index, symbol)
  665. name = @list[index][:name]
  666. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  667. #---
  668. dx = contents.width / 2
  669. tone = $game_system.window_tone
  670. case symbol
  671. when :window_red
  672. rate = (tone.red + 255.0) / 510.0
  673. colour1 = Color.new(128, 0, 0)
  674. colour2 = Color.new(255, 0, 0)
  675. value = tone.red.to_i
  676. when :window_grn
  677. rate = (tone.green + 255.0) / 510.0
  678. colour1 = Color.new(0, 128, 0)
  679. colour2 = Color.new(0, 255, 0)
  680. value = tone.green.to_i
  681. when :window_blu
  682. rate = (tone.blue + 255.0) / 510.0
  683. colour1 = Color.new(0, 0, 128)
  684. colour2 = Color.new(0, 0, 255)
  685. value = tone.blue.to_i
  686. end
  687. draw_gauge(dx, rect.y, contents.width - dx - 48, rate, colour1, colour2)
  688. draw_text(dx, rect.y, contents.width - dx - 48, line_height, value, 2)
  689. end
  690.  
  691. #--------------------------------------------------------------------------
  692. # draw_volume
  693. #--------------------------------------------------------------------------
  694. def draw_volume(rect, index, symbol)
  695. name = @list[index][:name]
  696. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  697. #---
  698. dx = contents.width / 2
  699. case symbol
  700. when :volume_bgm
  701. rate = $game_system.volume(:bgm)
  702. when :volume_bgs
  703. rate = $game_system.volume(:bgs)
  704. when :volume_sfx
  705. rate = $game_system.volume(:sfx)
  706. end
  707. colour1 = text_color(YEA::SYSTEM::COMMAND_VOCAB[symbol][1])
  708. colour2 = text_color(YEA::SYSTEM::COMMAND_VOCAB[symbol][2])
  709. value = sprintf("%d%%", rate)
  710. rate *= 0.01
  711. draw_gauge(dx, rect.y, contents.width - dx - 48, rate, colour1, colour2)
  712. draw_text(dx, rect.y, contents.width - dx - 48, line_height, value, 2)
  713. end
  714.  
  715. #--------------------------------------------------------------------------
  716. # draw_toggle
  717. #--------------------------------------------------------------------------
  718. def draw_toggle(rect, index, symbol)
  719. name = @list[index][:name]
  720. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  721. #---
  722. dx = contents.width / 2
  723. case symbol
  724. when :autodash
  725. enabled = $game_system.autodash?
  726. when :instantmsg
  727. enabled = $game_system.instantmsg?
  728. when :animations
  729. enabled = $game_system.animations?
  730. end
  731. dx = contents.width/2
  732. change_color(normal_color, !enabled)
  733. option1 = YEA::SYSTEM::COMMAND_VOCAB[symbol][1]
  734. draw_text(dx, rect.y, contents.width/4, line_height, option1, 1)
  735. dx += contents.width/4
  736. change_color(normal_color, enabled)
  737. option2 = YEA::SYSTEM::COMMAND_VOCAB[symbol][2]
  738. draw_text(dx, rect.y, contents.width/4, line_height, option2, 1)
  739. end
  740.  
  741. #--------------------------------------------------------------------------
  742. # cursor_right
  743. #--------------------------------------------------------------------------
  744. def draw_custom_switch(rect, index, ext)
  745. name = @list[index][:name]
  746. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  747. #---
  748. dx = contents.width / 2
  749. enabled = $game_switches[YEA::SYSTEM::CUSTOM_SWITCHES[ext][0]]
  750. dx = contents.width/2
  751. change_color(normal_color, !enabled)
  752. option1 = YEA::SYSTEM::CUSTOM_SWITCHES[ext][2]
  753. draw_text(dx, rect.y, contents.width/4, line_height, option1, 1)
  754. dx += contents.width/4
  755. change_color(normal_color, enabled)
  756. option2 = YEA::SYSTEM::CUSTOM_SWITCHES[ext][3]
  757. draw_text(dx, rect.y, contents.width/4, line_height, option2, 1)
  758. end
  759.  
  760. #--------------------------------------------------------------------------
  761. # draw_custom_variable
  762. #--------------------------------------------------------------------------
  763. def draw_custom_variable(rect, index, ext)
  764. name = @list[index][:name]
  765. draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  766. #---
  767. dx = contents.width / 2
  768. value = $game_variables[YEA::SYSTEM::CUSTOM_VARIABLES[ext][0]]
  769. colour1 = text_color(YEA::SYSTEM::CUSTOM_VARIABLES[ext][2])
  770. colour2 = text_color(YEA::SYSTEM::CUSTOM_VARIABLES[ext][3])
  771. minimum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][4]
  772. maximum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][5]
  773. rate = (value - minimum).to_f / [(maximum - minimum).to_f, 0.01].max
  774. dx = contents.width/2
  775. draw_gauge(dx, rect.y, contents.width - dx - 48, rate, colour1, colour2)
  776. draw_text(dx, rect.y, contents.width - dx - 48, line_height, value, 2)
  777. end
  778.  
  779. #--------------------------------------------------------------------------
  780. # cursor_right
  781. #--------------------------------------------------------------------------
  782. def cursor_right(wrap = false)
  783. cursor_change(:right)
  784. super(wrap)
  785. end
  786.  
  787. #--------------------------------------------------------------------------
  788. # cursor_left
  789. #--------------------------------------------------------------------------
  790. def cursor_left(wrap = false)
  791. cursor_change(:left)
  792. super(wrap)
  793. end
  794.  
  795. #--------------------------------------------------------------------------
  796. # cursor_change
  797. #--------------------------------------------------------------------------
  798. def cursor_change(direction)
  799. case current_symbol
  800. when :window_red, :window_blu, :window_grn
  801. change_window_tone(direction)
  802. when :volume_bgm, :volume_bgs, :volume_sfx
  803. change_volume(direction)
  804. when :autodash, :instantmsg, :animations
  805. change_toggle(direction)
  806. when :custom_switch
  807. change_custom_switch(direction)
  808. when :custom_variable
  809. change_custom_variables(direction)
  810. end
  811. end
  812.  
  813. #--------------------------------------------------------------------------
  814. # change_window_tone
  815. #--------------------------------------------------------------------------
  816. def change_window_tone(direction)
  817. Sound.play_cursor
  818. value = direction == :left ? -1 : 1
  819. value *= 10 if Input.press?(:A)
  820. tone = $game_system.window_tone.clone
  821. case current_symbol
  822. when :window_red; tone.red += value
  823. when :window_grn; tone.green += value
  824. when :window_blu; tone.blue += value
  825. end
  826. $game_system.window_tone = tone
  827. draw_item(index)
  828. end
  829.  
  830. #--------------------------------------------------------------------------
  831. # change_window_tone
  832. #--------------------------------------------------------------------------
  833. def change_volume(direction)
  834. Sound.play_cursor
  835. value = direction == :left ? -1 : 1
  836. value *= 10 if Input.press?(:A)
  837. case current_symbol
  838. when :volume_bgm
  839. $game_system.volume_change(:bgm, value)
  840. RPG::BGM::last.play
  841. when :volume_bgs
  842. $game_system.volume_change(:bgs, value)
  843. RPG::BGS::last.play
  844. when :volume_sfx
  845. $game_system.volume_change(:sfx, value)
  846. end
  847. draw_item(index)
  848. end
  849.  
  850. #--------------------------------------------------------------------------
  851. # change_toggle
  852. #--------------------------------------------------------------------------
  853. def change_toggle(direction)
  854. value = direction == :left ? false : true
  855. case current_symbol
  856. when :autodash
  857. current_case = $game_system.autodash?
  858. $game_system.set_autodash(value)
  859. when :instantmsg
  860. current_case = $game_system.instantmsg?
  861. $game_system.set_instantmsg(value)
  862. when :animations
  863. current_case = $game_system.animations?
  864. $game_system.set_animations(value)
  865. end
  866. Sound.play_cursor if value != current_case
  867. draw_item(index)
  868. end
  869.  
  870. #--------------------------------------------------------------------------
  871. # change_custom_switch
  872. #--------------------------------------------------------------------------
  873. def change_custom_switch(direction)
  874. value = direction == :left ? false : true
  875. ext = current_ext
  876. current_case = $game_switches[YEA::SYSTEM::CUSTOM_SWITCHES[ext][0]]
  877. $game_switches[YEA::SYSTEM::CUSTOM_SWITCHES[ext][0]] = value
  878. Sound.play_cursor if value != current_case
  879. draw_item(index)
  880. end
  881.  
  882. #--------------------------------------------------------------------------
  883. # change_custom_variables
  884. #--------------------------------------------------------------------------
  885. def change_custom_variables(direction)
  886. Sound.play_cursor
  887. value = direction == :left ? -1 : 1
  888. value *= 10 if Input.press?(:A)
  889. ext = current_ext
  890. var = YEA::SYSTEM::CUSTOM_VARIABLES[ext][0]
  891. minimum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][4]
  892. maximum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][5]
  893. $game_variables[var] += value
  894. $game_variables[var] = [[$game_variables[var], minimum].max, maximum].min
  895. draw_item(index)
  896. end
  897.  
  898. end # Window_SystemOptions
  899.  
  900. #==============================================================================
  901. # ■ Scene_Menu
  902. #==============================================================================
  903.  
  904. class Scene_Menu < Scene_MenuBase
  905.  
  906. #--------------------------------------------------------------------------
  907. # overwrite method: command_game_end
  908. #--------------------------------------------------------------------------
  909. def command_game_end
  910. SceneManager.call(Scene_System)
  911. end
  912.  
  913. end # Scene_Menu
  914.  
  915. #==============================================================================
  916. # ■ Scene_System
  917. #==============================================================================
  918.  
  919. class Scene_System < Scene_MenuBase
  920.  
  921. #--------------------------------------------------------------------------
  922. # start
  923. #--------------------------------------------------------------------------
  924. def start
  925. super
  926. create_help_window
  927. create_command_window
  928. end
  929.  
  930. #--------------------------------------------------------------------------
  931. # create_command_window
  932. #--------------------------------------------------------------------------
  933. def create_command_window
  934. @command_window = Window_SystemOptions.new(@help_window)
  935. @command_window.set_handler(:cancel, method(:return_scene))
  936. @command_window.set_handler(:to_title, method(:command_to_title))
  937. @command_window.set_handler(:shutdown, method(:command_shutdown))
  938. end
  939.  
  940. #--------------------------------------------------------------------------
  941. # command_to_title
  942. #--------------------------------------------------------------------------
  943. def command_to_title
  944. fadeout_all
  945. SceneManager.goto(Scene_Title)
  946. end
  947.  
  948. #--------------------------------------------------------------------------
  949. # command_shutdown
  950. #--------------------------------------------------------------------------
  951. def command_shutdown
  952. fadeout_all
  953. SceneManager.exit
  954. end
  955.  
  956. end # Scene_System
  957.  
  958. #==============================================================================
  959. #
  960. # ▼ End of File
  961. #
  962. #==============================================================================
RAW Paste Data