Guest User

Untitled

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