Advertisement
MakerSystems

RPG Maker VX Ace - Cutscene Skip

May 22nd, 2015
1,804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.11 KB | None | 0 0
  1. %Q(
  2. ╔════╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═════╗
  3. ║ ╔══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╗ ║
  4. ╠─╣ Cutscene Skip ╠─╣
  5. ╠─╣ by RPG Maker Source. ╠─╣
  6. ╠─╣ www.rpgmakersource.com ╠─╣
  7. ║ ╚══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╝ ║
  8. ╠════╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═════╣
  9. ║ ┌────┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴─────┐ ║
  10. ╠─┤ Version 1.1.0 23/05/15 DD/MM/YY ├─╣
  11. ║ └────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┘ ║
  12. ╠══════╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══════╣
  13. ║ ║
  14. ║ This work is protected by the following license: ║
  15. ║ ╔══════════════════════════════════════════════════════════════════╗ ║
  16. ║ │ │ ║
  17. ║ │ Copyright © 2014 Maker Systems. │ ║
  18. ║ │ │ ║
  19. ║ │ This software is provided 'as-is', without any kind of │ ║
  20. ║ │ warranty. Under no circumstances will the author be held │ ║
  21. ║ │ liable for any damages arising from the use of this software. │ ║
  22. ║ │ │ ║
  23. ║ │ Permission is granted to anyone to use this software on their │ ║
  24. ║ │ free or commercial games made with a legal copy of RPG Maker │ ║
  25. ║ │ VX Ace, as long as Maker Systems - RPG Maker Source is │ ║
  26. ║ │ credited within the game. │ ║
  27. ║ │ │ ║
  28. ║ │ Selling this code or any portions of it 'as-is' or as part of │ ║
  29. ║ │ another code, is not allowed. │ ║
  30. ║ │ │ ║
  31. ║ │ The original header, which includes this copyright notice, │ ║
  32. ║ │ must not be edited or removed from any verbatim copy of the │ ║
  33. ║ │ sotware nor from any edited version. │ ║
  34. ║ │ │ ║
  35. ║ ╚══════════════════════════════════════════════════════════════════╝ ║
  36. ║ ║
  37. ║ ║
  38. ╠══════════════════════════════════════════════════════════════════════════════╣
  39. ║ 1. VERSION HISTORY. ▼ ║
  40. ╠══════════════════════════════════════════════════════════════════════════════╣
  41. ║ ║
  42. ║ • Version 1.0.0, 18/03/15 - (DD/MM/YY). ║
  43. ║ ║
  44. ║ • Version 1.1.0, 23/05/15 - (DD/MM/YY). ║
  45. ║ - Added missing condition to deactivate the prompt while skipping. ║
  46. ║ - Improved skipping-times. ║
  47. ║ - Added ability to ignore BGM and BGS processing (individually). ║
  48. ║ ║
  49. ╠══════════════════════════════════════════════════════════════════════════════╣
  50. ╠══════════════════════════════════════════════════════════════════════════════╣
  51. ║ 2. USER MANUAL. ▼ ║
  52. ╠══════════════════════════════════════════════════════════════════════════════╣
  53. ║ ║
  54. ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
  55. ║ │ ■ Introduction. │ ║
  56. ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
  57. ║ ║
  58. ║ Hello there! This script is "plug and play", you can simply insert it into ║
  59. ║ your project and it will perform flawlessly. ║
  60. ║ ║
  61. ║ Do you know what lots of games made in RPG Maker are missing? We know. ║
  62. ║ Something that could really improve the gameplay experience and comfort ║
  63. ║ your players. ║
  64. ║ What would that be? Two things mainly; a way two pause cutscenes and the ║
  65. ║ ability to skip them at will! ║
  66. ║ ║
  67. ║ And you know what's better? We specifically designed this system so you ║
  68. ║ can easily add it to any existing game with minimal effort, no matter the ║
  69. ║ development stage! ║
  70. ║ ║
  71. ║ That's right, and you know what's even better? Everything gets executed ║
  72. ║ properly. Event commands and their results are not changed, your game ║
  73. ║ will be exactly the same, except that now it will allow your players to ║
  74. ║ pause or skip any cutscene that you mark as skip-able. ║
  75. ║ ║
  76. ║ Everything is executed exactly as if the cutscene were never skipped. ║
  77. ║ ║
  78. ║ We hope you enjoy it. ║
  79. ║ ║
  80. ║ Thanks for choosing our products. ║
  81. ║ ║
  82. ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
  83. ║ │ ■ Configuration. │ ║
  84. ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
  85. ║ ║
  86. ║ "How do I change the prompt style?" ║
  87. ║ Right click anywhere in the script editor and select "Find" (or CTRL + F) ║
  88. ║ search for "PROMPT_STYLE" (without quotation marks). ║
  89. ║ ║
  90. ║ You will see something like "PROMPT_STYLE = :special" ║
  91. ║ ║
  92. ║ Choose between :normal, :special and :none. ║
  93. ║ :normal uses a window (with the current windowskin), :special uses an ║
  94. ║ elegant text-only look, and :none will skip the cutscene directly without ║
  95. ║ prompting the player about it. ║
  96. ║ ║
  97. ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
  98. ║ │ ■ Feature Documentation. │ ║
  99. ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
  100. ║ ║
  101. ║ This script is very, very easy to use. You only need to tell it where the ║
  102. ║ cutscene starts and where the cutscene ends. That's it. ║
  103. ║ To indicate the beginning of a cutscene, add a Label (event command) with, ║
  104. ║ by default, 'CUTSCENE START' (without quotation marks). ║
  105. ║ To indicate the end of a cutscene, add a Label (event command) with, by ║
  106. ║ default, 'CUTSCENE END' (without quotation marks). ║
  107. ║ ║
  108. ║ While the events command between those labels are being executed, the ║
  109. ║ player will be able to press B (ESC and X in the keyboard) to skip the ║
  110. ║ cutscene. Keep in mind the system will still execute every command, but ║
  111. ║ in almost the blink of an eye and while the screen is faded to ║
  112. ║ black. It's like magic. ║
  113. ║ ║
  114. ║ There is a built-in way of knowing if the player skipped the last cutscene. ║
  115. ║ You can use $game_temp.ms_cutscene_skipped in a conditional branch (and ║
  116. ║ in your scripts, of course) to know if the last cutscene was skipped. ║
  117. ║ ║
  118. ║ If your cutscene doesn't play any BGM or BGS and you want to avoid ║
  119. ║ replaying the last one, you could use the following commands before the ║
  120. ║ cutscene begins: ║
  121. ║ ║
  122. ║ $game_temp.ms_cutscene_ignore_bgm = true ║
  123. ║ $game_temp.ms_cutscene_ignore_bgs = true ║
  124. ║ ║
  125. ║ You can use both or just one, depending on the cutscene and your needs. ║
  126. ║ Remember, those commands are only useful if you're not currently playing ║
  127. ║ a BGM or BGS and your cutscene doesn't play one either. ║
  128. ║ ║
  129. ╠══════════════════════════════════════════════════════════════════════════════╣
  130. ╠══════════════════════════════════════════════════════════════════════════════╣
  131. ║ 3. NOTES. ▼ ║
  132. ╠══════════════════════════════════════════════════════════════════════════════╣
  133. ║ ║
  134. ║ This script REQUIRES "Audio Fade In" (also by us) to work. ║
  135. ║ ║
  136. ║ The skipped cutscene can continue in another page of the same event, as ║
  137. ║ long as the page execution comes right after the execution of the page ║
  138. ║ that started the skipping. ║
  139. ║ ║
  140. ║ Message-related event commands like Show Message and Show Choices are NOT ║
  141. ║ executed, for obvious reasons. ║
  142. ║ ║
  143. ║ Have fun and enjoy! ║
  144. ║ ║
  145. ╠══════════════════════════════════════════════════════════════════════════════╣
  146. ╠══════════════════════════════════════════════════════════════════════════════╣
  147. ║ 4. CONTACT. ▼ ║
  148. ╠══════════════════════════════════════════════════════════════════════════════╣
  149. ║ ║
  150. ║ Keep in touch with us and be the first to know about new releases: ║
  151. ║ ║
  152. ║ www.rpgmakersource.com ║
  153. ║ www.facebook.com/RPGMakerSource ║
  154. ║ www.twitter.com/RPGMakerSource ║
  155. ║ www.youtube.com/user/RPGMakerSource ║
  156. ║ ║
  157. ║ Get involved! Have an idea for a system? Let us know. ║
  158. ║ ║
  159. ║ Spread the word and help us reach more people so we can continue creating ║
  160. ║ awesome resources for you! ║
  161. ║ ║
  162. ╚══════════════════════════════════════════════════════════════════════════════╝)
  163.  
  164. #==============================================================================
  165. # ** Maker Systems
  166. #------------------------------------------------------------------------------
  167. # Module for our Systems.
  168. #==============================================================================
  169.  
  170. module MakerSystems
  171.  
  172. #==============================================================================
  173. # ** Cutscene Skip
  174. #------------------------------------------------------------------------------
  175. # Contains configurable values for the system.
  176. #==============================================================================
  177.  
  178. module CutsceneSkip
  179.  
  180. #------------------------------------------------------------------------
  181. # * Label text to indicate beginning of cutscene.
  182. #------------------------------------------------------------------------
  183. SKIP_FROM_LABEL = 'CUTSCENE START'
  184.  
  185. #------------------------------------------------------------------------
  186. # * Label text to indicate end of cutscene.
  187. #------------------------------------------------------------------------
  188. SKIP_TO_LABEL = 'CUTSCENE END'
  189.  
  190. #------------------------------------------------------------------------
  191. # * Prompt Style.
  192. #------------------------------------------------------------------------
  193. # :special, :normal, :none
  194. #------------------------------------------------------------------------
  195. PROMPT_STYLE = :special
  196.  
  197. #------------------------------------------------------------------------
  198. # * Frames for Audio Fade Out.
  199. #------------------------------------------------------------------------
  200. AUDIO_FADE_OUT_FRAMES = 240
  201.  
  202. #------------------------------------------------------------------------
  203. # * Frames for Audio Fade In.
  204. #------------------------------------------------------------------------
  205. AUDIO_FADE_IN_FRAMES = 120
  206.  
  207. #------------------------------------------------------------------------
  208. # * :special Font Name.
  209. #------------------------------------------------------------------------
  210. SPECIAL_FONT_NAME = 'VL Gothic'
  211.  
  212. #------------------------------------------------------------------------
  213. # * :special Font Color.
  214. #------------------------------------------------------------------------
  215. SPECIAL_FONT_COLOR = '255 255 255 255'
  216.  
  217. #------------------------------------------------------------------------
  218. # * :special Font Size.
  219. #------------------------------------------------------------------------
  220. SPECIAL_FONT_SIZE = 44
  221.  
  222. #------------------------------------------------------------------------
  223. # * :normal Font Name.
  224. #------------------------------------------------------------------------
  225. NORMAL_FONT_NAME = 'VL Gothic'
  226.  
  227. #------------------------------------------------------------------------
  228. # * :normal Font Color.
  229. #------------------------------------------------------------------------
  230. NORMAL_FONT_COLOR = '255 255 255 255'
  231.  
  232. #------------------------------------------------------------------------
  233. # * :normal Font Size.
  234. #------------------------------------------------------------------------
  235. NORMAL_FONT_SIZE = 22
  236.  
  237. #------------------------------------------------------------------------
  238. # * Commands to Skip.
  239. #------------------------------------------------------------------------
  240. # This are the command codes that will be skipped (not executed at all).
  241. #------------------------------------------------------------------------
  242. SKIP = [101, 102, 103, 104, 105, 261]
  243.  
  244. end
  245.  
  246. end
  247.  
  248. #==============================================================================
  249. # ** Graphics
  250. #------------------------------------------------------------------------------
  251. # The module that carries out graphics processing.
  252. #==============================================================================
  253.  
  254. module Graphics
  255.  
  256. class << self
  257.  
  258. #------------------------------------------------------------------------
  259. # * Alias Update. [NEW]
  260. #------------------------------------------------------------------------
  261. alias_method(:original_update, :update)
  262.  
  263. #------------------------------------------------------------------------
  264. # * Update. [MOD]
  265. #------------------------------------------------------------------------
  266. def update
  267. # Don't draw while skipping a cutscene.
  268. original_update unless $game_temp.ms_cutscene_skip
  269. end
  270.  
  271. end
  272.  
  273. end
  274.  
  275. #==============================================================================
  276. # ** Audio
  277. #------------------------------------------------------------------------------
  278. # The module that carries out music and sound processing.
  279. #==============================================================================
  280.  
  281. module Audio
  282.  
  283. class << self
  284.  
  285. #------------------------------------------------------------------------
  286. # * Clear SE and ME cache. [NEW]
  287. #------------------------------------------------------------------------
  288. def ms_cutscene_skip_clear
  289. @now_se = nil
  290. @now_me = nil
  291. end
  292.  
  293. end
  294.  
  295. end
  296.  
  297. #==============================================================================
  298. # ** Game_Temp
  299. #------------------------------------------------------------------------------
  300. # This class handles temporary data that is not included with save data.
  301. # The instance of this class is referenced by $game_temp.
  302. #==============================================================================
  303.  
  304. class Game_Temp
  305.  
  306. #--------------------------------------------------------------------------
  307. # * Public Instance Variables. [NEW]
  308. #--------------------------------------------------------------------------
  309. attr_accessor :ms_cutscene_skip, :ms_cutscene_skipped,
  310. :ms_cutscene_ignore_bgm, :ms_cutscene_ignore_bgs
  311.  
  312. end
  313.  
  314. #==============================================================================
  315. # ** Game_CharacterBase
  316. #------------------------------------------------------------------------------
  317. # This base class handles characters. It retains basic information, such as
  318. # coordinates and graphics, shared by all characters.
  319. #==============================================================================
  320.  
  321. class Game_CharacterBase
  322.  
  323. #--------------------------------------------------------------------------
  324. # * Alias Real Move Speed. [NEW]
  325. #--------------------------------------------------------------------------
  326. alias_method(:ms_ctuscene_skip_original_real_move_speed, :real_move_speed)
  327.  
  328. #--------------------------------------------------------------------------
  329. # * Real Move Speed. [REP]
  330. #--------------------------------------------------------------------------
  331. def real_move_speed
  332. $game_temp.ms_cutscene_skip ? 99 : ms_ctuscene_skip_original_real_move_speed
  333. end
  334.  
  335. end
  336.  
  337. #==============================================================================
  338. # ** Game_Interpreter
  339. #------------------------------------------------------------------------------
  340. # An interpreter for executing event commands. This class is used within the
  341. # Game_Map, Game_Troop, and Game_Event classes.
  342. #==============================================================================
  343.  
  344. class Game_Interpreter
  345.  
  346. #--------------------------------------------------------------------------
  347. # * Alias Command 118 (Label). [NEW]
  348. #--------------------------------------------------------------------------
  349. alias_method(:ms_cutscene_skip_original_command_118, :command_118)
  350.  
  351. #--------------------------------------------------------------------------
  352. # * Command 118 (Label). [MOD]
  353. #--------------------------------------------------------------------------
  354. def command_118
  355. # Original method.
  356. ms_cutscene_skip_original_command_118
  357. # If Cutscene Start Label.
  358. if @params[0] == MakerSystems::CutsceneSkip::SKIP_FROM_LABEL
  359. # Mark event command sequence as cutscene.
  360. @ms_cutscene = true
  361. # This cutscene is not yet skipped.
  362. $game_temp.ms_cutscene_skipped = false
  363. # If Cutscene End Label.
  364. elsif @params[0] == MakerSystems::CutsceneSkip::SKIP_TO_LABEL
  365. # If cutscene has been skipped.
  366. if $game_temp.ms_cutscene_skip
  367. unless $game_temp.ms_cutscene_ignore_bgm
  368. # Restore BGM volume.
  369. Audio.bgm_volume = @ms_cutscene_last_bgm_volume
  370. # Fade in BGM.
  371. Audio.bgm_fadein(MakerSystems::CutsceneSkip::AUDIO_FADE_IN_FRAMES)
  372. # Replay BGM.
  373. @ms_cutscene_bgm.replay
  374. end
  375. unless $game_temp.ms_cutscene_ignore_bgs
  376. # Restore BGS volume.
  377. Audio.bgs_volume = @ms_cutscene_last_bgs_volume
  378. # Fade in BGS.
  379. Audio.bgs_fadein(MakerSystems::CutsceneSkip::AUDIO_FADE_IN_FRAMES)
  380. # Replay BGS.
  381. @ms_cutscene_bgs.replay
  382. end
  383. # Restore SE and ME volume.
  384. Audio.se_volume = @ms_cutscene_last_se_volume
  385. Audio.me_volume = @ms_cutscene_last_me_volume
  386. # Fade in ME.
  387. Audio.me_fadein(MakerSystems::CutsceneSkip::AUDIO_FADE_IN_FRAMES)
  388. # No longer skipping.
  389. $game_temp.ms_cutscene_skip = false
  390. # No longer cutscene.
  391. @ms_cutscene = false
  392. # Fade in screen.
  393. Graphics.fadein(40)
  394. end
  395. # Release saved BGM and BGS.
  396. @ms_cutscene_bgm = nil
  397. @ms_cutscene_bgs = nil
  398. $game_temp.ms_cutscene_ignore_bgm = nil
  399. $game_temp.ms_cutscene_ignore_bgs = nil
  400. end
  401. end
  402.  
  403. #--------------------------------------------------------------------------
  404. # * Alias Update. [NEW]
  405. #--------------------------------------------------------------------------
  406. alias_method(:ms_cutscene_skip_original_update, :update)
  407.  
  408. #--------------------------------------------------------------------------
  409. # * Update. [MOD]
  410. #--------------------------------------------------------------------------
  411. def update
  412. # Marked as cutscene?
  413. if @ms_cutscene
  414. # Pressed Cancel Button?
  415. if Input.trigger?(:B) && !$game_temp.ms_cutscene_skip
  416. # Save current BGM and BGS.
  417. @ms_cutscene_bgm = RPG::BGM.last unless $game_temp.ms_cutscene_ignore_bgm
  418. @ms_cutscene_bgs = RPG::BGS.last unless $game_temp.ms_cutscene_ignore_bgs
  419. # Fade out audio.
  420. RPG::BGM.fade(MakerSystems::CutsceneSkip::AUDIO_FADE_OUT_FRAMES)
  421. RPG::BGS.fade(MakerSystems::CutsceneSkip::AUDIO_FADE_OUT_FRAMES)
  422. RPG::ME.fade(MakerSystems::CutsceneSkip::AUDIO_FADE_OUT_FRAMES)
  423. # If cutscene should be skipped.
  424. if ms_cutscene_skip?
  425. # Clear SE and ME cache.
  426. Audio.ms_cutscene_skip_clear
  427. # Clear messages.
  428. $game_message.clear
  429. # Fade out screen.
  430. Graphics.fadeout(20)
  431. # Save current volume for each Audio channel.
  432. @ms_cutscene_last_bgm_volume = Audio.bgm_volume
  433. @ms_cutscene_last_bgs_volume = Audio.bgs_volume
  434. @ms_cutscene_last_me_volume = Audio.me_volume
  435. @ms_cutscene_last_se_volume = Audio.se_volume
  436. # This whill prevent awful things from happening.
  437. Audio.se_volume = 0
  438. Audio.me_volume = 0
  439. Audio.bgm_volume = 0 unless $game_temp.ms_cutscene_ignore_bgm
  440. Audio.bgs_volume = 0 unless $game_temp.ms_cutscene_ignore_bgs
  441. # Reset message window.
  442. SceneManager.scene.message_window.dispose
  443. SceneManager.scene.message_window = Window_Message.new
  444. # Cutscene is being skipped, mark it as skipped too.
  445. $game_temp.ms_cutscene_skip = true
  446. $game_temp.ms_cutscene_skipped = true
  447. else
  448. # Replay BGM and BGS.
  449. @ms_cutscene_bgm.replay unless $game_temp.ms_cutscene_ignore_bgm
  450. @ms_cutscene_bgs.replay unless $game_temp.ms_cutscene_ignore_bgs
  451. end
  452. end
  453. end
  454. # Original method.
  455. ms_cutscene_skip_original_update
  456. end
  457.  
  458. #--------------------------------------------------------------------------
  459. # * Skip Cutscene? [NEW]
  460. #--------------------------------------------------------------------------
  461. def ms_cutscene_skip?
  462. true
  463. end
  464.  
  465. #--------------------------------------------------------------------------
  466. # * Alias Execute Command. [NEW]
  467. #--------------------------------------------------------------------------
  468. alias_method(:ms_skip_cutscene_original_execute_command, :execute_command)
  469.  
  470. #--------------------------------------------------------------------------
  471. # * Execute Command. [MOD]
  472. #--------------------------------------------------------------------------
  473. def execute_command
  474. # Skipping a cutscene?
  475. if $game_temp.ms_cutscene_skip
  476. # Update current BGM and current BGS.
  477. unless $game_temp.ms_cutscene_ignore_bgm
  478. @ms_cutscene_bgm = RPG::BGM.last if @ms_cutscene_bgm != RPG::BGM.last
  479. end
  480. unless $game_temp.ms_cutscene_ignore_bgs
  481. @ms_cutscene_bgs = RPG::BGS.last if @ms_cutscene_bgs != RPG::BGS.last
  482. end
  483. # Don't execute command if code is blacklisted.
  484. return if MakerSystems::CutsceneSkip::SKIP.include?(@list[@index].code)
  485. end
  486. # Original method.
  487. ms_skip_cutscene_original_execute_command
  488. end
  489.  
  490. end
  491.  
  492. #==============================================================================
  493. # ** Scene_Map
  494. #------------------------------------------------------------------------------
  495. # This class performs the map screen processing.
  496. #==============================================================================
  497.  
  498. class Scene_Map
  499.  
  500. #--------------------------------------------------------------------------
  501. # * Public Instance Variables. [NEW]
  502. #--------------------------------------------------------------------------
  503. attr_accessor :message_window
  504.  
  505. end
  506.  
  507. if MakerSystems::CutsceneSkip::PROMPT_STYLE == :special
  508.  
  509. #==============================================================================
  510. # ** Maker Systems
  511. #------------------------------------------------------------------------------
  512. # Module for our Systems.
  513. #==============================================================================
  514.  
  515. module MakerSystems
  516.  
  517. #============================================================================
  518. # ** Cutscene Skip
  519. #----------------------------------------------------------------------------
  520. # Contains Prompt class.
  521. #============================================================================
  522.  
  523. module CutsceneSkip
  524.  
  525. #==========================================================================
  526. # ** Prompt
  527. #--------------------------------------------------------------------------
  528. # Used to prompt the player and to pause the cutscene.
  529. #==========================================================================
  530.  
  531. class Prompt
  532.  
  533. #----------------------------------------------------------------------
  534. # * Initialize.
  535. #----------------------------------------------------------------------
  536. def initialize
  537. color = MakerSystems::CutsceneSkip::SPECIAL_FONT_COLOR
  538. if color.include?('#')
  539. color = color.delete!('#').scan(/../).map { |c| c.to_i(16) }
  540. else
  541. color = color.split(' ').map { |c| c.to_i }
  542. end
  543. color = Color.new(*color)
  544. Graphics.freeze
  545. @sprite = Sprite.new
  546. @sprite.z = 9999999
  547. @sprite.bitmap = Graphics.snap_to_bitmap
  548. @sprite.color = Color.new(0, 0, 0, 200)
  549. @sprite.bitmap.blur
  550. Graphics.transition(20)
  551. helper = Bitmap.new(32, 32)
  552. helper.font.name = MakerSystems::CutsceneSkip::SPECIAL_FONT_NAME
  553. helper.font.size = MakerSystems::CutsceneSkip::SPECIAL_FONT_SIZE
  554. helper.font.color = color
  555. rect1 = helper.text_size('Skip Scene?')
  556. Graphics.freeze
  557. @sprite_question = Sprite.new
  558. @sprite_question.z = @sprite.z + 1
  559. @sprite_question.bitmap = Bitmap.new(rect1.width, rect1.height * 4)
  560. @sprite_question.bitmap.font = helper.font
  561. @sprite_question.bitmap.draw_text(rect1, 'Skip Scene?', 1)
  562. @sprite_question.bitmap.font.size = 22
  563. @sprite_question.bitmap.font.color.alpha = 64
  564. @sprite_question.bitmap.draw_text(
  565. 0,
  566. rect1.height,
  567. rect1.width / 2,
  568. rect1.height,
  569. 'Yes',
  570. 1
  571. )
  572. @sprite_question.bitmap.draw_text(
  573. rect1.width / 2,
  574. rect1.height,
  575. rect1.width / 2,
  576. rect1.height,
  577. 'No',
  578. 1
  579. )
  580.  
  581. @sprite_question.x = (Graphics.width - rect1.width) / 2
  582. @sprite_question.y = (Graphics.height - rect1.height * 4) / 2
  583. yes_bitmap = Bitmap.new(rect1.width, rect1.height * 4)
  584. yes_bitmap.font.size = 22
  585. yes_bitmap.draw_text(
  586. 0,
  587. rect1.height,
  588. rect1.width / 2,
  589. rect1.height,
  590. 'Yes',
  591. 1
  592. )
  593. no_bitmap = Bitmap.new(rect1.width, rect1.height * 4)
  594. no_bitmap.font.size = 22
  595. no_bitmap.draw_text(
  596. rect1.width / 2,
  597. rect1.height,
  598. rect1.width / 2,
  599. rect1.height,
  600. 'No',
  601. 1
  602. )
  603.  
  604. @sprite_yes = Sprite.new
  605. @sprite_yes.z = @sprite_question.z + 1
  606. @sprite_no = Sprite.new
  607. @sprite_no.z = @sprite_question.z + 1
  608. @sprite_yes.bitmap = yes_bitmap
  609. @sprite_yes.bitmap.clear_rect(rect1)
  610. @sprite_yes.opacity = 0
  611. @sprite_yes.x = @sprite_question.x
  612. @sprite_yes.y = @sprite_question.y
  613. no_rect = helper.text_size('No')
  614. @sprite_no.bitmap = no_bitmap
  615. @sprite_no.x = @sprite_question.x
  616. @sprite_no.y = @sprite_question.y
  617. @index = 1
  618. @stage = 0
  619. Graphics.transition(20)
  620. helper.dispose
  621. end
  622.  
  623. #----------------------------------------------------------------------
  624. # * Dispose.
  625. #----------------------------------------------------------------------
  626. def dispose(skip)
  627. Graphics.freeze unless skip
  628. @sprite_no.bitmap.dispose
  629. @sprite_no.dispose
  630. @sprite_yes.bitmap.dispose
  631. @sprite_yes.dispose
  632. @sprite_question.bitmap.dispose
  633. @sprite_question.dispose
  634. Graphics.transition(20) unless skip
  635. Graphics.freeze unless skip
  636. @sprite.bitmap.dispose
  637. @sprite.dispose
  638. Graphics.transition(20) unless skip
  639. end
  640.  
  641. #----------------------------------------------------------------------
  642. # * Update.
  643. #----------------------------------------------------------------------
  644. def update
  645. # Cursor update.
  646. if @index == 1
  647. selected = @sprite_no
  648. disabled = @sprite_yes
  649. elsif @index == 0
  650. selected = @sprite_yes
  651. disabled = @sprite_no
  652. end
  653. if @stage == 0
  654. selected.opacity -= 8
  655. @stage = 1 if selected.opacity == 0
  656. elsif @stage == 1
  657. selected.opacity += 8
  658. @stage = 0 if selected.opacity == 255
  659. end
  660. disabled.opacity -= 12
  661. # Input update.
  662. if Input.trigger?(:LEFT) || Input.trigger?(:RIGHT)
  663. Sound.play_cursor
  664. @index = @index == 0 ? 1 : 0
  665. end
  666. end
  667.  
  668. #----------------------------------------------------------------------
  669. # * Done?
  670. #----------------------------------------------------------------------
  671. def done?
  672. Input.trigger?(:C) || Input.trigger?(:B)
  673. end
  674.  
  675. #----------------------------------------------------------------------
  676. # * Skip?
  677. #----------------------------------------------------------------------
  678. def skip?
  679. @index == 0 && Input.trigger?(:C)
  680. end
  681.  
  682. end
  683.  
  684. end
  685.  
  686. end
  687.  
  688. #==============================================================================
  689. # ** Game_Interpreter
  690. #------------------------------------------------------------------------------
  691. # An interpreter for executing event commands. This class is used within the
  692. # Game_Map, Game_Troop, and Game_Event classes.
  693. #==============================================================================
  694.  
  695. class Game_Interpreter
  696.  
  697. #--------------------------------------------------------------------------
  698. # * Skip Cutscene? [NEW]
  699. #--------------------------------------------------------------------------
  700. def ms_cutscene_skip?
  701. prompt = MakerSystems::CutsceneSkip::Prompt.new
  702. loop do
  703. Graphics.update
  704. Input.update
  705. prompt.update
  706. if prompt.done?
  707. result = prompt.skip?
  708. Graphics.fadeout(40) if result
  709. prompt.dispose(result)
  710. return result
  711. end
  712. end
  713. end
  714.  
  715. end
  716.  
  717. elsif MakerSystems::CutsceneSkip::PROMPT_STYLE == :normal
  718.  
  719. #==============================================================================
  720. # ** Maker Systems
  721. #------------------------------------------------------------------------------
  722. # Module for our Systems.
  723. #==============================================================================
  724.  
  725. module MakerSystems
  726.  
  727. #==============================================================================
  728. # ** Cutscene Skip
  729. #------------------------------------------------------------------------------
  730. # Contains Prompt class.
  731. #==============================================================================
  732.  
  733. module CutsceneSkip
  734.  
  735. #==========================================================================
  736. # ** Prompt
  737. #--------------------------------------------------------------------------
  738. # Used to prompt the player and to pause the cutscene.
  739. #==========================================================================
  740.  
  741. class Prompt < Window_Command
  742.  
  743. #----------------------------------------------------------------------
  744. # * Initialize.
  745. #----------------------------------------------------------------------
  746. def initialize
  747. super(
  748. (Graphics.width - window_width) / 2,
  749. (Graphics.height - window_height) / 2
  750. )
  751. self.openness = 0
  752. self.index = 1
  753. open
  754. set_handler(:ok, method(:on_ok))
  755. set_handler(:cancel, method(:on_cancel))
  756. @done = false
  757. end
  758.  
  759. #----------------------------------------------------------------------
  760. # * Make Command List.
  761. #----------------------------------------------------------------------
  762. def make_command_list
  763. add_command('Yes', :ok)
  764. add_command('No', :cancel)
  765. end
  766.  
  767. #----------------------------------------------------------------------
  768. # * Window Width.
  769. #----------------------------------------------------------------------
  770. def window_width
  771. 192
  772. end
  773.  
  774. #----------------------------------------------------------------------
  775. # * Visible Line Number.
  776. #----------------------------------------------------------------------
  777. def visible_line_number
  778. 2
  779. end
  780.  
  781. #----------------------------------------------------------------------
  782. # * Window Height.
  783. #----------------------------------------------------------------------
  784. def window_height
  785. super + standard_padding / 2
  786. end
  787.  
  788. #----------------------------------------------------------------------
  789. # * On Okay.
  790. #----------------------------------------------------------------------
  791. def on_ok
  792. @done = true
  793. @skip = true
  794. end
  795.  
  796. #----------------------------------------------------------------------
  797. # * On Cancel.
  798. #----------------------------------------------------------------------
  799. def on_cancel
  800. @done = true
  801. end
  802.  
  803. #----------------------------------------------------------------------
  804. # * Column Max.
  805. #----------------------------------------------------------------------
  806. def col_max
  807. 2
  808. end
  809.  
  810. #----------------------------------------------------------------------
  811. # * Alignment.
  812. #----------------------------------------------------------------------
  813. def alignment
  814. 1
  815. end
  816.  
  817. #----------------------------------------------------------------------
  818. # * Item Rect.
  819. #----------------------------------------------------------------------
  820. def item_rect(index)
  821. rect = super(index)
  822. rect.y += contents.font.size
  823. rect
  824. end
  825.  
  826. #----------------------------------------------------------------------
  827. # * Refresh.
  828. #----------------------------------------------------------------------
  829. def refresh
  830. super
  831. color = MakerSystems::CutsceneSkip::SPECIAL_FONT_COLOR
  832. if color.include?('#')
  833. color = color.delete!('#').scan(/../).map { |c| c.to_i(16) }
  834. else
  835. color = color.split(' ').map { |c| c.to_i }
  836. end
  837. color = Color.new(*color)
  838. change_color(color)
  839. draw_text(0, 0, contents_width, line_height, "Skip Scene?", 1)
  840. end
  841.  
  842. #----------------------------------------------------------------------
  843. # * Done?
  844. #----------------------------------------------------------------------
  845. def done?
  846. @done
  847. end
  848.  
  849. #----------------------------------------------------------------------
  850. # * Skip?
  851. #----------------------------------------------------------------------
  852. def skip?
  853. @skip
  854. end
  855.  
  856. end
  857.  
  858. end
  859.  
  860. end
  861.  
  862. #==============================================================================
  863. # ** Game_Interpreter
  864. #------------------------------------------------------------------------------
  865. # An interpreter for executing event commands. This class is used within the
  866. # Game_Map, Game_Troop, and Game_Event classes.
  867. #==============================================================================
  868.  
  869. class Game_Interpreter
  870.  
  871. #--------------------------------------------------------------------------
  872. # * Skip Cutscene? [NEW]
  873. #--------------------------------------------------------------------------
  874. def ms_cutscene_skip?
  875. Graphics.freeze
  876. sprite = Sprite.new
  877. sprite.z = 9999999
  878. sprite.bitmap = Graphics.snap_to_bitmap
  879. sprite.color = Color.new(0, 0, 0, 200)
  880. sprite.bitmap.blur
  881. prompt = MakerSystems::CutsceneSkip::Prompt.new
  882. prompt.z = sprite.z + 1
  883. Graphics.transition(20)
  884. loop do
  885. Graphics.update
  886. Input.update
  887. prompt.update
  888. if prompt.done?
  889. result = prompt.skip?
  890. prompt.close
  891. until prompt.close?
  892. prompt.update
  893. Graphics.update
  894. end
  895. if result
  896. Graphics.fadeout(40)
  897. sprite.dispose
  898. prompt.dispose
  899. else
  900. Graphics.freeze
  901. sprite.dispose
  902. prompt.dispose
  903. Graphics.transition(20)
  904. end
  905. return result
  906. end
  907. end
  908. end
  909.  
  910. end
  911.  
  912. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement