Advertisement
AlliedG

Yanfly System Options

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