Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 99.13 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # Stormtronics CMS by Blizzard
  3. # Version: 5.51b - Hybrid Edition
  4. # Type: Enhanced Custom Menu System
  5. # Date v5.0: 27.8.2007
  6. # Date v5.0b: 12.9.2007
  7. # Date v5.1b: 28.1.2008
  8. # Date v5.2b: 29.1.2008
  9. # Date v5.3b: 23.7.2008
  10. # Date v5.31b: 20.8.2008
  11. # Date v5.32b: 21.8.2008
  12. # Date v5.33b: 15.11.2008
  13. # Date v5.34b: 8.4.2009
  14. # Date v5.35b: 9.4.2009
  15. # Date v5.36b: 6.5.2009
  16. # Date v5.37b: 20.5.2009
  17. # Date v5.38b: 31.5.2009
  18. # Date v5.39b: 24.6.2009
  19. # Date v5.5b: 24.5.2012
  20. # Date v5.51b: 30.7.2012
  21. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  22. #
  23. # This work is protected by the following license:
  24. # #----------------------------------------------------------------------------
  25. # #
  26. # # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
  27. # # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
  28. # #
  29. # # You are free:
  30. # #
  31. # # to Share - to copy, distribute and transmit the work
  32. # # to Remix - to adapt the work
  33. # #
  34. # # Under the following conditions:
  35. # #
  36. # # Attribution. You must attribute the work in the manner specified by the
  37. # # author or licensor (but not in any way that suggests that they endorse you
  38. # # or your use of the work).
  39. # #
  40. # # Noncommercial. You may not use this work for commercial purposes.
  41. # #
  42. # # Share alike. If you alter, transform, or build upon this work, you may
  43. # # distribute the resulting work only under the same or similar license to
  44. # # this one.
  45. # #
  46. # # - For any reuse or distribution, you must make clear to others the license
  47. # # terms of this work. The best way to do this is with a link to this web
  48. # # page.
  49. # #
  50. # # - Any of the above conditions can be waived if you get permission from the
  51. # # copyright holder.
  52. # #
  53. # # - Nothing in this license impairs or restricts the author's moral rights.
  54. # #
  55. # #----------------------------------------------------------------------------
  56. #
  57. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  58. #
  59. # Compatibility:
  60. #
  61. # 97% compatible with SDK v1.x. 80% compatible with SDK v2.x. Glitchs with
  62. # Fukuyama's Caterpillar script (but not with mine). Designed only for 8
  63. # elements. WILL corrupt old savegames.
  64. #
  65. #
  66. # Features:
  67. #
  68. # - completely animated and graphically optimized (lag-free)
  69. # - own set of windowskins, fonts and icons for every status change and
  70. # element
  71. # - saves all changed options together with the savefile
  72. # - menu commands "Item", "Equipment", "Skill", "Equip", "Status", "Options",
  73. # "Save", "Load", "Exit"
  74. # - Item submenu: "Items", "Sort" (by quantity or by alphabet), "Quest Items"
  75. # - Equipment submenu shows information about equippable items for the chosen
  76. # character, switch the character with LEFT and RIGHT
  77. # - Skill submenu shows available skills for use for the chosen character,
  78. # switch character with L and R, menu status window in background shows the
  79. # chosen character
  80. # - Equip submenu shows complete information about Status resistance/attack,
  81. # Element resistance/attack and complete character stat changing (has
  82. # even "max HP" and "max SP" available if you are using "Weapon/Armor HP/SP
  83. # Plus")
  84. # - Status screen with overall information about character status
  85. # - Options submenu with "BGM Volume", "SFX Volume", "Battle BGM",
  86. # "Battle Cam" (if using KGC's Pseudo 3D Battle Camera with my add-on for
  87. # disabling), "Bar Style", "Bar Opacity" (if you are using Gradient Bar
  88. # Styler), "Font" and "Windowskin" (both with preview)
  89. # - Standard Save, Load and Exit commands
  90. # - uses "Ultimate Font Override", so the font changes will affect RPG Maker
  91. # XP versions 1.00, 1.01, 1.02 and 1.03 (including Dyna Edition and
  92. # Postality Knights Edition Enhanced) and the font even gets saved with the
  93. # savedata
  94. #
  95. # new in Hybrid Edition:
  96. # - supports either windowskin background or custom images:
  97. # >>> All Stormtronics CMS Editions in one! <<<
  98. # - compatible with all my scripts (even DREAM v4.0)
  99. # - draws SR in the menu if CLRS was detected
  100. # - supports any number of party members
  101. # - removed some special add-ons, please get Tons of Add-ons if you want to
  102. # continue using them, ST CMS will recognize Tons v4.98b and higher
  103. # - more than 1500 code lines less than Nemesis Edition and almost 2000
  104. # code lines less than Metal-Plate Edition
  105. # - removes options from Options menu that are not / cannot being used at all
  106. # - possibility to use a different equip system
  107. # - doesn't need skin icons anymore, the icon is drawn from the skin directly
  108. # - improved windowskins from "Lexima Legends™ IV - Chaos Project"
  109. #
  110. #
  111. # Instructions:
  112. #
  113. # Copy your character faces into a the folder called "Characters". The
  114. # facesets MUST have the same names as the character spritesets with a _face
  115. # added at the end. Also copy the windowskins and the icons. Don't forget to
  116. # include the font files used by the game in your game folder. Also change
  117. # the variable ID in the conditional branches if you use another variable
  118. # than 49.
  119. #
  120. #
  121. # Configuration:
  122. #
  123. # CAM_AVAILABLE - set to true if you use KGC 3DPBC
  124. # FACESETS - set to true if you want to use facesets
  125. # BGM_Variable - ID number of the variable for the Battle BGM
  126. # changer
  127. # BGM_Lock - ID number of the switch used to temporarily
  128. # disable the option of changing the Battle BGM, for
  129. # that, just turn the switch on and off to disable
  130. # and enable this option
  131. # WEAPONS_AND_ARMORS - set to false to not show weapons and armors in the
  132. # Item screen
  133. # QUEST_ITEMS - add any item IDs that are supposed to be quest
  134. # items, so the CMS can separate them
  135. # BATTLE_BGMS - add any battle BGMs you are using
  136. # CMS_SKINS - add any skin name you are using
  137. # CMS_FONTS - add any font name you are using, be sure to
  138. # include the font install files in your game
  139. # release as some people may not have those fonts
  140. # installed
  141. # SAVE_NAME - name of your savefiles (usually "Save")
  142. # SAVE_EXTENSION - extension of your savefiles (usually "rxdata")
  143. # SAVE_FILES_NUMBER - number of savefiles you are using (usually 4)
  144. # MAP_BACKGROUND - set to true to show map as background, otherwise
  145. # if BlizzCFG::CMS_EDITION is not nil or false the
  146. # "CMSFullscreen" image will be displayed
  147. # CUSTOM_ITEM_SCENE - set this to true if you want to use a different
  148. # equip scene and make this CMS compatible even with
  149. # exotic Item Systems
  150. # CUSTOM_EQUIPMENT_SCENE - set this to true if you want to use a different
  151. # equip scene and make this CMS compatible even with
  152. # exotic Equipment Systems, change only if you have
  153. # another Equipment Scene script ready
  154. # CUSTOM_EQUIP_SCENE - set this to true if you want to use a different
  155. # equip scene and make this CMS compatible even with
  156. # exotic Equipment Systems
  157. # CUSTOM_SKILL_SCENE - set this to true if you want to use a different
  158. # skill scene and make this CMS compatible even with
  159. # exotic Skill Systems
  160. # CUSTOM_STATUS_SCENE - set this to true if you want to use a different
  161. # status scene
  162. # CUSTOM_OPTIONS_SCENE - set this to true if you want to use a different
  163. # options scene, change only if you have another
  164. # Options Scene script ready
  165. # CUSTOM_END_SCENE - set this to true if you want to use a different
  166. # end scene
  167. # FONT_BACKGROUND_FIX - set this to true if you want dark font colors to
  168. # be used in the menu, this comes in handy when the
  169. # custom background images you use are bright
  170. # WIN_MIRRORED - flips horizontally all window positions
  171. # CMS_EDITION - set this to false or nil if you want to use
  172. # Nemesis Edition, set to folder name where in the
  173. # Pictures/CMS the images should be loaded from if
  174. # you want to use custom images as background
  175. # STCMS_DUMMY_ELEMENTS - include EVERY dummy element ID that is used by
  176. # other scripts
  177. # STCMS_DUMMY_STATES - include EVERY dummy status effect ID that you use
  178. #
  179. # The syntax $game_system.get_cam can be used by an event (Call script
  180. # command) to restore the user's setting of the KGC 3DPBC if a forced cam
  181. # control was initiated during an event.
  182. #
  183. # You can use $game_system.reset_battle_bgm to reset the battle BGM to the
  184. # player's menu setting if you have changed it for i.e. a boss fight via
  185. # event.
  186. #
  187. #
  188. # FAQ:
  189. #
  190. # - Problem:
  191. # I get an error that some icons can't be found. how do I solve this?
  192. #
  193. # - Solution:
  194. # Copy the icons from the demo or download them and place the into the Icons
  195. # folder into another folder called "CMS". Done.
  196. #
  197. # - Problem:
  198. # I still get an error.
  199. #
  200. # - Solution:
  201. # Rename the icons. If your elements were renamed and don't have the standard
  202. # names, your icons need to be renamed as well. Same goes for status effects.
  203. # Also be sure to add new icons with new names if you have more than the
  204. # basic 8 elements and/or more than the basic 16 status effects in your
  205. # database.
  206. #
  207. # - Question:
  208. # Can I use my own skins, icons, fonts, battle BGMs, etc...?
  209. #
  210. # - Answer:
  211. # Of course. Only be sure to change the appropriate options in the script and
  212. # to use the appropriate names, so everything can function normally after
  213. # that.
  214. #
  215. # - Question:
  216. # Can this CMS be connected with other scripts? If yes, how and how much work
  217. # is it?
  218. #
  219. # - Answer:
  220. # Yes, it can. A little bit of scripting and enhancing the functions of the
  221. # CMS are needed if it is going to be connected with other scripts. How much
  222. # of additional work it can cause only depends how big the script merge is. A
  223. # simple changing of the battle menu to display status effects in icons
  224. # should take between 15~30 minutes of scripting and testing. Adding another
  225. # option into the Options menu should also take only 15~30 minutes of
  226. # scripting and testing. Even adding an entire series of new windows or
  227. # implementing another Scene into the menu also won't take more than 30
  228. # minutes, because the menu itself works with the "sub-scene" system, saving
  229. # this way RAM and CPU.
  230. #
  231. # - Question:
  232. # What is the "sub-scene" system? Also I have tried other animated CMS-es.
  233. # Why is this one so lag-free?
  234. #
  235. # - Answer:
  236. # It is lag-free just because of the "sub-scene" system. This system is also
  237. # used in the "Scene_Battle". It only creates windows and handels them when
  238. # they are needed or used, otherwise they get disposed or not created at all.
  239. # In this script this method is being used to a possible maximum.
  240. #
  241. # - Question:
  242. # Is this for real? This CMS doesn't even have 3000 lines of code!
  243. #
  244. # - Answer:
  245. # Actually not even 2500 if you don't count the instructions.
  246. #
  247. # - Question:
  248. # How is such a large collection of features possible with so relatively few
  249. # lines of code?!
  250. #
  251. # - Answer:
  252. # Smart coding. =P
  253. #
  254. #
  255. # Additional scripts/snipplets/add-ons:
  256. #
  257. # - Ultimate Font Override v1.0b (by Blizzard)
  258. # - BGM/SFX Volume Control with volume correction v1.0b (by Blizzard)
  259. # - Map Name/Location v1.0b (by Blizzard)
  260. # - Elemental Vulnerability Graph v1.0b (by Blizzard)
  261. # - Battle BGM control v2.0b (by Blizzard)
  262. # - Options control layout and funcionality v4.0b (by Blizzard)
  263. # - CMS layout/funcionality v5.0b (by Blizzard)
  264. # - optimized code and delagged by "sub-scene" window handling (by Blizzard)
  265. #
  266. # If you experience the "Stack level too deep" error, you may already have
  267. # one of the scripts listed above and it conflicts with itself, because of
  268. # aliased recursive calling. Try removing script by script and testing
  269. # everything. Don't forget to backup you Scripts.rxdata before doing so.
  270. # Scripts.rxdata is a file that contains your current scripts and is located
  271. # in the Data folder of your game folder.
  272. #
  273. #
  274. # If you find any bugs, please report them here:
  275. # http://forum.chaos-project.com
  276. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  277.  
  278. #==============================================================================
  279. # module BlizzCFG
  280. #==============================================================================
  281.  
  282. module BlizzCFG
  283.  
  284. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  285. # START Configuration
  286. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  287. # basic config
  288. CAM_AVAILABLE = false
  289. FACESETS = false
  290. BGM_Variable = 49
  291. BGM_Lock = 49
  292. WEAPONS_AND_ARMORS = true
  293. QUEST_ITEMS = [23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
  294. # custom game configs
  295. BATTLE_BGMS = [
  296. # ['BGM_NAME', VOLUME, PITCH, 'DISPLAY_NAME']
  297. ['001-Battle01', 100, 100, 'BGM 1'],
  298. ['002-Battle02', 100, 100, 'BGM 2'],
  299. ['003-Battle03', 100, 100, 'BGM 3'],
  300. ['004-Battle04', 100, 100, 'BGM 4']]
  301. CMS_SKINS = ['Original', 'Heavy Gold', 'Hell Breath', 'Liquid Water',
  302. 'Violent Violet', 'Ice Cool', 'Fatal Venom', 'Perfect Chaos',
  303. 'Blizzard Master']
  304. CMS_FONTS = ['Arial', 'Future', 'Comic Sans MS', 'Brush Script', 'Tahoma',
  305. 'Times New Roman']
  306. # save file options
  307. SAVE_NAME = 'Save'
  308. SAVE_EXTENSION = 'rxdata'
  309. SAVE_FILES_NUMBER = 4
  310. # extra options
  311. MAP_BACKGROUND = true
  312. CUSTOM_ITEM_SCENE = false
  313. CUSTOM_EQUIPMENT_SCENE = false
  314. CUSTOM_EQUIP_SCENE = false
  315. CUSTOM_SKILL_SCENE = false
  316. CUSTOM_STATUS_SCENE = false
  317. CUSTOM_OPTIONS_SCENE = false
  318. CUSTOM_END_SCENE = false
  319. FONT_BACKGROUND_FIX = false
  320. WIN_MIRRORED = false
  321. CMS_EDITION = false # 'Metal-Plate'
  322. STCMS_DUMMY_ELEMENTS = [9, 10, 11, 12, 13, 14, 15, 16]
  323. STCMS_DUMMY_STATES = []
  324. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  325. # END Configuration
  326. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  327. # change only if changed in the 3DPBC script
  328. CAM_Variable = 25 if CAM_AVAILABLE
  329.  
  330. # you can't touch this
  331. if $DUMMY_ELEMENTS == nil
  332. $DUMMY_ELEMENTS = STCMS_DUMMY_ELEMENTS.clone
  333. else
  334. $DUMMY_ELEMENTS |= STCMS_DUMMY_ELEMENTS
  335. end
  336. STCMS_DUMMY_ELEMENTS = nil
  337. if $DUMMY_STATES == nil
  338. $DUMMY_STATES = STCMS_DUMMY_STATES.clone
  339. else
  340. $DUMMY_STATES |= STCMS_DUMMY_STATES
  341. end
  342. STCMS_DUMMY_STATES = nil
  343.  
  344. end
  345.  
  346. # for compatibility
  347. $stormtronics_cms = 5.51
  348.  
  349. #==============================================================================
  350. # Game_System
  351. #==============================================================================
  352.  
  353. class Game_System
  354.  
  355. attr_accessor :bgm_volume
  356. attr_accessor :sfx_volume
  357. attr_accessor :cam
  358. attr_reader :fontname
  359. attr_reader :fontsize
  360.  
  361. alias init_storm_cms_later initialize
  362. def initialize
  363. init_storm_cms_later
  364. @bgm_volume = @sfx_volume = 100
  365. @cam = 0
  366. if $tons_version != nil
  367. if $tons_version >= 6.03 && !@BARS
  368. @bar_style, @bar_opacity = 0, 255
  369. end
  370. if $tons_version < 1.6
  371. self.fontname = 'Arial'
  372. self.fontsize = 16#24
  373. end
  374. else
  375. self.fontname = 'Arial'
  376. self.fontsize = 16#24
  377. end
  378. end
  379.  
  380. def fontname=(name)
  381. Font.default_name = $defaultfonttype = $fontface = @fontname = name
  382. end
  383.  
  384. def fontsize=(size)
  385. Font.default_size = $defaultfontsize = $fontsize = @fontsize = size
  386. end
  387.  
  388. def get_cam
  389. $game_variables[BlizzCFG::CAM_Variable] = @cam
  390. return true
  391. end
  392.  
  393. def reset_battle_bgm
  394. bgm = BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]]
  395. $game_system.battle_bgm = RPG::AudioFile.new(bgm[0], bgm[1], bgm[2])
  396. return true
  397. end
  398.  
  399. if $dream_music
  400. def bgm_play(bgm)
  401. @playing_bgm = bgm
  402. if bgm != nil && bgm.name != ''
  403. vol = correction(@bgm_volume)
  404. dream_ed = bgm.clone
  405. dream_ed.volume = dream_ed.volume * vol / 100
  406. DREAM.play_encrypted_audio('Audio/BGM/', dream_ed, 0)
  407. else
  408. Audio.bgm_stop
  409. end
  410. Graphics.frame_reset
  411. end
  412.  
  413. def bgs_play(bgs)
  414. @playing_bgs = bgs
  415. if bgs != nil && bgs.name != ''
  416. vol = correction(@sfx_volume)
  417. dream_ed = bgs.clone
  418. dream_ed.volume = dream_ed.volume * vol / 100
  419. DREAM.play_encrypted_audio('Audio/BGS/', dream_ed, 1)
  420. else
  421. Audio.bgs_stop
  422. end
  423. Graphics.frame_reset
  424. end
  425.  
  426. def me_play(me)
  427. if me != nil && me.name != ''
  428. vol = correction(@bgm_volume)
  429. dream_ed = me.clone
  430. dream_ed.volume = dream_ed.volume * vol / 100
  431. DREAM.play_encrypted_audio('Audio/ME/', dream_ed, 2)
  432. else
  433. Audio.me_stop
  434. end
  435. Graphics.frame_reset
  436. end
  437.  
  438. def se_play(se)
  439. if se != nil && se.name != ''
  440. vol = correction(@sfx_volume)
  441. dream_ed = se.clone
  442. dream_ed.volume = dream_ed.volume * vol / 100
  443. DREAM.play_encrypted_audio('Audio/SE/', dream_ed, 3)
  444. end
  445. end
  446. else
  447. def bgm_play(bgm)
  448. @playing_bgm = bgm
  449. if bgm != nil && bgm.name != ''
  450. vol = correction(@bgm_volume)
  451. Audio.bgm_play('Audio/BGM/' + bgm.name , bgm.volume * vol / 100, bgm.pitch)
  452. else
  453. Audio.bgm_stop
  454. end
  455. Graphics.frame_reset
  456. end
  457.  
  458. def bgs_play(bgs)
  459. @playing_bgs = bgs
  460. if bgs != nil && bgs.name != ''
  461. vol = correction(@sfx_volume)
  462. Audio.bgs_play('Audio/BGS/' + bgs.name, bgs.volume * vol / 100, bgs.pitch)
  463. else
  464. Audio.bgs_stop
  465. end
  466. Graphics.frame_reset
  467. end
  468.  
  469. def me_play(me)
  470. if me != nil && me.name != ''
  471. vol = correction(@bgm_volume)
  472. Audio.me_play('Audio/ME/' + me.name, me.volume * vol / 100, me.pitch)
  473. else
  474. Audio.me_stop
  475. end
  476. Graphics.frame_reset
  477. end
  478.  
  479. def se_play(se)
  480. if se != nil && se.name != ''
  481. vol = correction(@sfx_volume)
  482. Audio.se_play('Audio/SE/' + se.name, se.volume * vol / 100, se.pitch)
  483. end
  484. end
  485. end
  486.  
  487. def correction(volume)
  488. case volume
  489. when 100 then return 100
  490. when 95 then return 97
  491. when 90 then return 95
  492. when 85 then return 92
  493. when 80 then return 90
  494. when 75 then return 87
  495. when 70 then return 85
  496. when 65 then return 82
  497. when 60 then return 80
  498. when 55 then return 77
  499. when 50 then return 75
  500. when 45 then return 72
  501. when 40 then return 70
  502. when 35 then return 65
  503. when 30 then return 60
  504. when 25 then return 55
  505. when 20 then return 50
  506. when 15 then return 40
  507. when 10 then return 35
  508. when 5 then return 25
  509. end
  510. return 0
  511. end
  512.  
  513. end
  514.  
  515. #==============================================================================
  516. # Game_Actor
  517. #==============================================================================
  518.  
  519. class Game_Actor < Game_Battler
  520.  
  521. def now_exp
  522. return (@exp-@exp_list[@level])
  523. end
  524.  
  525. def next_exp
  526. return (@exp_list[@level+1] > 0 ? @exp_list[@level+1]-@exp_list[@level] : 0)
  527. end
  528.  
  529. def test_equip(equip_type, id)
  530. case equip_type
  531. when 0 then old_id, @weapon_id = @weapon_id, id
  532. when 1 then old_id, @armor1_id = @armor1_id, id
  533. when 2 then old_id, @armor2_id = @armor2_id, id
  534. when 3 then old_id, @armor3_id = @armor3_id, id
  535. when 4 then old_id, @armor4_id = @armor4_id, id
  536. end
  537. tested = [self.maxhp, self.maxsp, self.atk, self.pdef, self.mdef, self.str,
  538. self.dex, self.agi, self.int, self.eva]
  539. case equip_type
  540. when 0 then @weapon_id = old_id
  541. when 1 then @armor1_id = old_id
  542. when 2 then @armor2_id = old_id
  543. when 3 then @armor3_id = old_id
  544. when 4 then @armor4_id = old_id
  545. end
  546. return tested
  547. end
  548.  
  549. end
  550.  
  551. #==============================================================================
  552. # Scene_Title
  553. #==============================================================================
  554.  
  555. class Scene_Title
  556.  
  557. alias main_storm_cms_later main
  558. def main
  559. $map_infos = load_data('Data/MapInfos.rxdata')
  560. $map_infos.keys.each {|key| $map_infos[key] = $map_infos[key].name}
  561. main_storm_cms_later
  562. end
  563.  
  564. end
  565.  
  566. #==============================================================================
  567. # Game_Map
  568. #==============================================================================
  569.  
  570. class Game_Map
  571.  
  572. def name
  573. return $map_infos[@map_id]
  574. end
  575.  
  576. end
  577.  
  578. #==============================================================================
  579. # Bitmap
  580. #==============================================================================
  581.  
  582. class Bitmap
  583.  
  584. if $tons_version == nil || $tons_version < 3.71
  585. alias init_ultimate_font_override_later initialize
  586. def initialize(w, h = nil)
  587. if w.is_a?(Numeric) && h.is_a?(Numeric)
  588. init_ultimate_font_override_later(w, h)
  589. else
  590. init_ultimate_font_override_later(w)
  591. end
  592. if $game_system != nil && $game_system.fontname != nil &&
  593. !$scene.is_a?(Scene_Title)
  594. self.font.name = $game_system.fontname
  595. self.font.size = $game_system.fontsize
  596. else
  597. self.font.name = Font.default_name
  598. self.font.size = Font.default_size
  599. end
  600. end
  601.  
  602. def gradient_bar(x, y, w, color1, color2, color3, rate, flag = false)
  603. offset = 5
  604. x += offset
  605. y += 26
  606. (0...offset+3).each {|i| fill_rect(x-i, y+i-2, w+3, 1, Color.new(0, 0, 0))}
  607. (0...offset+1).each {|i| fill_rect(x-i, y+i-1, w+1, 1, Color.new(255, 255, 255))}
  608. (0...w+offset).each {|i|
  609. red = color3.red * i / (w + offset)
  610. green = color3.green * i / (w + offset)
  611. blue = color3.blue * i / (w + offset)
  612. oy = i < offset ? offset-i : 0
  613. off = i < offset ? i : i > w ? w+offset-i : offset
  614. fill_rect(x+i-offset+1, y+oy-1, 1, off, Color.new(red, green, blue))}
  615. if (w*rate).to_i >= offset
  616. (0...(w*rate).to_i+offset).each {|i|
  617. red = color1.red + (color2.red-color1.red)*i/((w+offset)*rate)
  618. green = color1.green + (color2.green-color1.green)*i/((w+offset)*rate)
  619. blue = color1.blue + (color2.blue-color1.blue)*i/((w+offset)*rate)
  620. oy = i < offset ? offset-i : 0
  621. off = i < offset ? i : i > w*rate ? (w*rate).to_i+offset-i : offset
  622. fill_rect(x+i-offset+1, y+oy-1, 1, off, Color.new(red, green, blue))}
  623. else
  624. (0...(w*rate).to_i).each {|i| (0...offset-1).each {|j|
  625. red = color1.red + (color2.red-color1.red) * i / (w * rate)
  626. green = color1.green + (color2.green-color1.green) * i / (w * rate)
  627. blue = color1.blue + (color2.blue-color1.blue) * i / (w * rate)
  628. set_pixel(x+i-j+1, y+j-1, Color.new(red, green, blue))}}
  629. end
  630. end
  631. end
  632.  
  633. def draw_element_graph(x_plus, y_plus, rad, color, limit = -1)
  634. (-rad-1...0).each {|r| (r...0).each {|x|
  635. color.alpha = 255 * (rad+1.0-r.abs)/(rad+1)
  636. y = (r.abs * Math.sin(Math.acos(x/r.to_f))).to_i
  637. h = y * 2
  638. case limit
  639. when 1, 8 then h = (y < x.abs ? 0 : y - x.abs)
  640. when 2, 7 then y > x.abs ? h = y = x.abs : h = y
  641. when 3, 6
  642. y > x.abs ? h = y = x.abs : h = y
  643. y = 0 if y > 0
  644. when 4, 5 then h, y = (y < x.abs ? 0 : y - x.abs), -x.abs
  645. end
  646. if limit < 5
  647. fill_rect(rad*2-x + x_plus, rad-y + y_plus, 1, h, color)
  648. else
  649. fill_rect(rad*2+x+1 + x_plus, rad-y + y_plus, 1, h, color)
  650. end}}
  651. end
  652.  
  653. end
  654.  
  655. #==============================================================================
  656. # Window_Base
  657. #==============================================================================
  658.  
  659. class Window_Base < Window
  660.  
  661. alias st_cms_hybrid_hack_init initialize
  662. def initialize(xx, yy, w, h)
  663. st_cms_hybrid_hack_init(xx, yy, w, h)
  664. if BlizzCFG::CMS_EDITION && @background != nil
  665. @backsprite = Sprite.new
  666. @backsprite.bitmap = RPG::Cache.picture("CMS/#{BlizzCFG::CMS_EDITION}/#{@background}")
  667. self.opacity, @backsprite.x, @backsprite.y = 0, self.x, self.y
  668. end
  669. end
  670.  
  671. alias st_cms_hybrid_hack_x_ x=
  672. def x=(xx)
  673. st_cms_hybrid_hack_x_($scene.is_a?(Scene_Menu) && BlizzCFG::WIN_MIRRORED ? 640-width-xx : xx)
  674. @backsprite.x = xx unless @backsprite == nil || @backsprite.disposed?
  675. end
  676.  
  677. alias st_cms_hybrid_hack_y_ y=
  678. def y=(yy)
  679. st_cms_hybrid_hack_y_(yy)
  680. @backsprite.y = yy unless @backsprite == nil || @backsprite.disposed?
  681. end
  682.  
  683. alias st_cms_hybrid_hack_x x
  684. def x
  685. xx = st_cms_hybrid_hack_x
  686. return ($scene.is_a?(Scene_Menu) && BlizzCFG::WIN_MIRRORED ? 640-width-xx : xx)
  687. end
  688.  
  689. alias st_cms_hybrid_hack_z z=
  690. def z=(z)
  691. st_cms_hybrid_hack_z(z)
  692. @backsprite.z = z unless @backsprite == nil || @backsprite.disposed?
  693. end
  694.  
  695. alias st_cms_hybrid_hack_width width=
  696. def width=(w)
  697. self.x += w-width if $scene.is_a?(Scene_Menu) && BlizzCFG::WIN_MIRRORED
  698. st_cms_hybrid_hack_width(w)
  699. end
  700.  
  701. alias st_cms_hybrid_hack_visible visible=
  702. def visible=(expr)
  703. st_cms_hybrid_hack_visible(expr)
  704. @backsprite.visible = expr unless @backsprite == nil || @backsprite.disposed?
  705. end
  706.  
  707. alias disp_sprite_later dispose
  708. def dispose
  709. @backsprite.dispose unless @backsprite == nil || @backsprite.disposed?
  710. disp_sprite_later
  711. end
  712.  
  713. alias st_cms_hybrid_hack_normal_color normal_color
  714. def normal_color
  715. if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
  716. return Color.new(0, 0, 0)
  717. else
  718. return st_cms_hybrid_hack_normal_color
  719. end
  720. end
  721.  
  722. alias st_cms_hybrid_hack_system_color system_color
  723. def system_color
  724. if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
  725. return Color.new(160, 0, 255)
  726. else
  727. return st_cms_hybrid_hack_system_color
  728. end
  729. end
  730.  
  731. alias st_cms_hybrid_hack_disabled_color disabled_color
  732. def disabled_color
  733. if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
  734. return Color.new(96, 96, 96)
  735. else
  736. return st_cms_hybrid_hack_disabled_color
  737. end
  738. end
  739.  
  740. alias st_cms_hybrid_hack_crisis_color crisis_color
  741. def crisis_color
  742. if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
  743. return Color.new(192, 192, 0)
  744. else
  745. return st_cms_hybrid_hack_crisis_color
  746. end
  747. end
  748.  
  749. alias draw_actor_graphic_st_cms_later draw_actor_graphic
  750. def draw_actor_graphic(actor, x, y)
  751. if actor != nil && actor.character_name != ''
  752. if self.is_a?(Window_CMSMenuStatus) && BlizzCFG::FACESETS
  753. bitmap = RPG::Cache.character("#{actor.character_name}_face", actor.character_hue)
  754. x -= bitmap.width / 2
  755. y -= bitmap.height
  756. draw_actor_face_st_cms(actor, x, y)
  757. else
  758. draw_actor_graphic_st_cms_later(actor, x, y)
  759. end
  760. end
  761. end
  762.  
  763. def draw_actor_face_st_cms(actor, x, y)
  764. if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
  765. hue = 0
  766. else
  767. hue = (FACE_HUE ? actor.character_hue : 0)
  768. end
  769. bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
  770. src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  771. self.contents.blt(x, y, bitmap, src_rect)
  772. end
  773.  
  774. def draw_actor_battler(actor, x, y)
  775. if actor != nil && actor.battler_name != ''
  776. bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
  777. cw = bitmap.width
  778. ch = bitmap.height
  779. src_rect = Rect.new(0, 0, cw,ch)
  780. self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  781. end
  782. end
  783.  
  784. def draw_actor_exp(actor, x, y, width = 144)
  785. self.contents.font.color = system_color
  786. self.contents.draw_text(x, y, 48, 32, 'EXP')
  787. if actor.exp_s.to_i > 999999
  788. w = self.contents.text_size('999999').width
  789. else
  790. w = self.contents.text_size(actor.exp_s).width
  791. end
  792. if actor.next_exp_s.to_i > 999999
  793. w2 = self.contents.text_size('999999').width
  794. else
  795. w2 = self.contents.text_size(actor.next_exp_s).width
  796. end
  797. self.contents.font.color = normal_color
  798. self.contents.draw_text(x + 108 - w2, y, w2, 32, actor.exp_s, 2)
  799. self.contents.draw_text(x + 108, y, 12, 32, '/', 1)
  800. self.contents.draw_text(x + 120, y, w2, 32, actor.next_exp_s)
  801. end
  802.  
  803. def draw_actor_exp_alt(actor, x, y)
  804. self.contents.font.color = system_color
  805. self.contents.draw_text(x, y, 64, 32, 'next')
  806. self.contents.font.color = normal_color
  807. self.contents.draw_text(x + 56, y, 84, 32, actor.next_rest_exp_s, 2)
  808. end
  809.  
  810. def draw_actor_name2(actor, x, y, w, a)
  811. self.contents.font.color = normal_color
  812. self.contents.draw_text(x, y, w, 32, actor.name, a)
  813. end
  814.  
  815. def up_color
  816. return Color.new(0, 255, 0)
  817. end
  818.  
  819. def down_color
  820. return Color.new(255, 0, 0)
  821. end
  822.  
  823. alias draw_actor_parameter_st_cms_later draw_actor_parameter
  824. def draw_actor_parameter(actor, x, y, type)
  825. if type == 7
  826. self.contents.font.color = system_color
  827. self.contents.draw_text(x, y, 120, 32, 'Evasion')
  828. self.contents.font.color = normal_color
  829. self.contents.draw_text(x + 120, y, 36, 32, actor.eva.to_s, 2)
  830. else
  831. draw_actor_parameter_st_cms_later(actor, x, y, type)
  832. end
  833. end
  834.  
  835. def draw_actor_element_vulnerability(actor, x, y, rad = 60)
  836. colors = []
  837. (1..8).each {|i|
  838. rate = actor.element_rate(i)
  839. if rate < 0
  840. colors.push(Color.new(0, 255 * (100-rate.abs) / 200, 255))
  841. elsif rate == 0
  842. colors.push(Color.new(0, 128, 255))
  843. elsif rate <= 50
  844. colors.push(Color.new(0, 255 * (rate+50) / 100, 255 * (50-rate) / 50))
  845. elsif rate <= 100
  846. colors.push(Color.new(255 * (rate-50) / 50 , 255, 0))
  847. elsif rate <= 200
  848. colors.push(Color.new(255, 255 * (200-rate) / 100, 0))
  849. else
  850. colors.push(normal_color)
  851. end}
  852. (1..8).each {|i|
  853. self.contents.draw_element_graph(x + 16, y + 32, rad, colors[i-1], i)}
  854. save_color = self.contents.font.color.clone
  855. (1..8).each {|i|
  856. str1 = $data_system.elements[i]
  857. str2 = "#{actor.element_rate(i)}%"
  858. w1 = self.contents.text_size(str1).width
  859. w2 = self.contents.text_size(str2).width
  860. case i
  861. when 1 then x2, y2, x3, y3 = x+152, y+20, x+168, y+4
  862. when 2 then x2, y2, x3, y3 = x+176, y+56, x+192, y+40
  863. when 3 then x2, y2, x3, y3 = x+176, y+92, x+192, y+108
  864. when 4 then x2, y2, x3, y3 = x+152, y+128, x+168, y+144
  865. when 5 then x2, y2, x3, y3 = x+120-w1, y+128, x+104-w2, y+144
  866. when 6 then x2, y2, x3, y3 = x+96-w1, y+92, x+80-w2, y+108
  867. when 7 then x2, y2, x3, y3 = x+96-w1, y+56, x+80-w2, y+40
  868. when 8 then x2, y2, x3, y3 = x+120-w1, y+20, x+104-w2, y+4
  869. end
  870. self.contents.font.color = save_color
  871. self.contents.draw_text(x2, y2, w1, 32, str1)
  872. self.contents.font.color = colors[i-1]
  873. self.contents.draw_text(x3, y3, w2, 32, str2)}
  874. self.contents.font.color = save_color
  875. end
  876.  
  877. if $Blizz_Art
  878. alias draw_actor_exp_blizzart_later draw_actor_exp
  879. def draw_actor_exp(actor, x, y, w = 148)
  880. if $game_system.BARS
  881. w -= 12
  882. rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
  883. if rate < 0.5
  884. color1 = Color.new(20 * rate, 60, 80, 192)
  885. color2 = Color.new(60 * rate, 180, 240, 192)
  886. elsif rate >= 0.5
  887. color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
  888. color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
  889. end
  890. color3 = Color.new(80, 80, 80, 192)
  891. self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
  892. end
  893. draw_actor_exp_blizzart_later(actor, x, y)
  894. end
  895.  
  896. alias draw_actor_exp_new2 draw_actor_exp_alt
  897. def draw_actor_exp_alt(actor, x, y, w = 148)
  898. w -= 12
  899. rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
  900. if rate < 0.5
  901. color1 = Color.new(20 * rate, 60, 80)
  902. color2 = Color.new(60 * rate, 180, 240)
  903. elsif rate >= 0.5
  904. color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80)
  905. color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240)
  906. end
  907. color3 = Color.new(80, 80, 80, 192)
  908. self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
  909. draw_actor_exp_new2(actor, x, y)
  910. end
  911. end
  912.  
  913. end
  914.  
  915. #==============================================================================
  916. # Window_CMSCommand
  917. #==============================================================================
  918.  
  919. class Window_CMSCommand < Window_Command
  920.  
  921. attr_reader :continue
  922.  
  923. def initialize(index, continue)
  924. @background = 'CMSCommand'
  925. commands = [$data_system.words.item, 'Equipment', $data_system.words.equip,
  926. $data_system.words.skill, 'Status', 'Options', 'Save', 'Load', 'Exit']
  927. super(180, commands)
  928. @continue, self.index, self.x, self.y, self.z = continue, index, 972, 0, 999
  929. end
  930.  
  931. def draw_item(i, color)
  932. self.contents.fill_rect(0, i*32, 148, 32, Color.new(0, 0, 0, 0))
  933. bitmap = RPG::Cache.icon("CMS/commandmenu#{i}")
  934. opacity = (color == normal_color ? 255 : 128)
  935. self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
  936. self.contents.font.color = color
  937. self.contents.draw_text(32, i*32, 148, 32, @commands[i])
  938. end
  939.  
  940. end
  941.  
  942. #==============================================================================
  943. # Window_CMSChooseItem
  944. #==============================================================================
  945.  
  946. class Window_CMSChooseItem < Window_Selectable
  947.  
  948. def initialize
  949. @background = 'CMSHelp'
  950. super(0, -576, 640, 64)
  951. @commands = ['Items', 'Sort', 'Quest Items']
  952. @item_max = @column_max = @commands.size
  953. self.contents = Bitmap.new(width - 32, 32)
  954. refresh
  955. self.active, self.z, self.index = true, 2900, 0
  956. end
  957.  
  958. def refresh
  959. self.contents.clear
  960. (0...@item_max).each {|i| draw_item(i, normal_color)}
  961. end
  962.  
  963. def draw_item(i, color)
  964. self.contents.font.color = color
  965. self.contents.fill_rect(8 + 212*i, 0, 164, 32, Color.new(0, 0, 0, 0))
  966. self.contents.draw_text(8 + 212*i, 0, 164, 32, @commands[i], 1)
  967. end
  968.  
  969. end
  970.  
  971. #==============================================================================
  972. # Window_CMSOptions
  973. #==============================================================================
  974.  
  975. class Window_CMSOptions < Window_Selectable
  976.  
  977. attr_accessor :current_font
  978. attr_reader :current_skin
  979. attr_reader :skin_name
  980. attr_reader :font_name
  981.  
  982. def initialize
  983. @background = 'CMSFullscreen'
  984. super(0, 512, 640, 480)
  985. @commands = ['BGM Volume', 'SFX Volume', 'Battle BGM']
  986. @commands.push('Battle Cam') if BlizzCFG::CAM_AVAILABLE
  987. #@commands.push('Bar Style', 'Bar Opacity') if $Blizz_Art
  988. #@commands.push('Font', 'Windowskin')
  989. #get_skin_and_font
  990. self.contents = Bitmap.new(width - 32, height - 32)
  991. self.z, self.index = 2999, 0
  992. @item_max = @commands.size
  993. refresh
  994. end
  995.  
  996. def get_option
  997. return @commands[index]
  998. end
  999.  
  1000. def refresh
  1001. self.contents.clear
  1002. self.contents.font.name = $game_system.fontname
  1003. (0...@item_max).each {|i|
  1004. self.contents.font.color = normal_color
  1005. self.contents.fill_rect(24, 16 + i*36, 192, 32, Color.new(0, 0, 0, 0))
  1006. self.contents.draw_text(24, 16 + i*36, 192, 32, @commands[i])
  1007. draw_arrows(288, 4 + i*36)
  1008. case @commands[i]
  1009. when 'BGM Volume' then draw_volume(288, 4 + i*36)
  1010. when 'SFX Volume' then draw_volume(288, 4 + i*36, true)
  1011. when 'Battle BGM' then draw_battle_bgm(288, 4 + i*36)
  1012. when 'Battle Cam' then draw_battle_cam(288, 4 + i*36)
  1013. #when 'Bar Style' then draw_style(288, 4 + i*36)
  1014. #when 'Bar Opacity' then draw_opacity(288, 4 + i*36)
  1015. #when 'Font' then draw_font(288, 4 + i*36)
  1016. #when 'Windowskin' then draw_skin(288, 4 + i*36)
  1017. end}
  1018. end
  1019.  
  1020. def draw_arrows(x, y)
  1021. self.contents.draw_text(x - 32, y + 13, 32, 32, '<<')
  1022. self.contents.draw_text(x + 249, y + 13, 32, 32, '>>')
  1023. end
  1024.  
  1025. def draw_volume(x, y, mode = false, width = 224)
  1026. volume = (mode ? $game_system.sfx_volume.to_f : $game_system.bgm_volume.to_f)
  1027. vol = volume.to_f / 100
  1028. color1 = Color.new(20, 40, 80, 192)
  1029. color2 = Color.new(60, 120, 240, 192)
  1030. color3 = Color.new(0, 0, 80, 192)
  1031. old, $game_system.bar_opacity = $game_system.bar_opacity, 255 if $Blizz_Art
  1032. self.contents.gradient_bar(x, y, width, color1, color2, color3, vol, true)
  1033. $game_system.bar_opacity = old if $Blizz_Art
  1034. end
  1035.  
  1036. def draw_style(x, y, width = 224)
  1037. color1 = Color.new(80, 80, 0, 192)
  1038. color2 = Color.new(240, 240, 0, 192)
  1039. self.contents.gradient_bar(x + 32, y, width - 64, color1, color2, color1, 1, true)
  1040. end
  1041.  
  1042. def draw_battle_bgm(x, y, width = 224)
  1043. bgm = BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]][3]
  1044. if $game_switches[BlizzCFG::BGM_Lock] || BlizzCFG::BATTLE_BGMS.size <= 1
  1045. self.contents.font.color = Color.new(0, 0, 0, 255)
  1046. self.contents.draw_text(x+1, y + 13+1, 224, 32, bgm, 1)
  1047. self.contents.font.color = disabled_color
  1048. else
  1049. self.contents.font.color = normal_color
  1050. end
  1051. self.contents.draw_text(x, y + 13, 224, 32, bgm, 1)
  1052. end
  1053.  
  1054. def draw_battle_cam(x, y, width = 224)
  1055. cam = ($game_variables[BlizzCFG::CAM_Variable] == 0 ? 'ON' : 'OFF')
  1056. self.contents.draw_text(x, y + 13, 224, 32, cam, 1)
  1057. end
  1058.  
  1059. def draw_opacity(x, y, width = 224)
  1060. alpha = case $game_system.bar_opacity
  1061. when 0 then 'No Bar'
  1062. when 1..85 then 'Light'
  1063. when 86..170 then 'Medium'
  1064. when 171..254 then 'Hard'
  1065. when 255 then 'Full'
  1066. end
  1067. self.contents.draw_text(x, y + 13, 224, 32, alpha, 1)
  1068. end
  1069. =begin
  1070. def draw_font(x, y, width = 224)
  1071. @font_name = BlizzCFG::CMS_FONTS[@current_font]
  1072. self.contents.font.name = @font_name
  1073. self.contents.draw_text(x, y + 13, 224, 32, @font_name, 1)
  1074. self.contents.font.name = $game_system.fontname
  1075. end
  1076. =end
  1077. =begin
  1078. def draw_skin(x, y, width = 224)
  1079. @skin_name = BlizzCFG::CMS_SKINS[self.current_skin]
  1080. self.contents.draw_text(x, y + 13, 224, 32, @skin_name, 1)
  1081. self.contents.fill_rect(x + 48, y +428, 128, 128, Color.new(0, 0, 0, 0))
  1082. bitmap = RPG::Cache.windowskin(@skin_name)
  1083. self.contents.blt(x + 50, y + 50, bitmap, Rect.new(2, 2, 124, 124))
  1084. self.contents.blt(x + 48, y + 48, bitmap, Rect.new(128, 0, 16, 16))
  1085. self.contents.blt(x + 160, y + 48, bitmap, Rect.new(176, 0, 16, 16))
  1086. self.contents.blt(x + 48, y + 160, bitmap, Rect.new(128, 48, 16, 16))
  1087. self.contents.blt(x + 160, y + 160, bitmap, Rect.new(176, 48, 16, 16))
  1088. (2..4).each {|i|
  1089. self.contents.blt(x+i*32, y+48, bitmap, Rect.new(144, 0, 32, 16))}
  1090. (2..4).each {|i|
  1091. self.contents.blt(x+i*32, y+160, bitmap, Rect.new(144, 48, 32, 16))}
  1092. (2..4).each {|i|
  1093. self.contents.blt(x+48, y+i*32, bitmap, Rect.new(128, 16, 16, 32))}
  1094. (2..4).each {|i|
  1095. self.contents.blt(x+160, y+i*32, bitmap, Rect.new(176, 16, 16, 32))}
  1096. end
  1097. =end
  1098. =begin
  1099. def current_skin
  1100. return (@current_skin == nil ? 0 : @current_skin)
  1101. end
  1102.  
  1103. def current_skin=(val)
  1104. @current_skin = (val.is_a?(Numeric) ? val : 0)
  1105. end
  1106.  
  1107. def get_skin_and_font
  1108. @font_name = $game_system.fontname
  1109. @current_font = BlizzCFG::CMS_FONTS.index(@font_name)
  1110. @skin_name = $game_system.windowskin_name
  1111. self.current_skin = BlizzCFG::CMS_SKINS.index(@skin_name)
  1112. end
  1113. =end
  1114. def update_cursor_rect
  1115. if self.index < 0
  1116. self.cursor_rect.empty
  1117. else
  1118. self.cursor_rect.set(16, @index*36 + 16, 128, 32)
  1119. end
  1120. end
  1121.  
  1122. end
  1123.  
  1124. #==============================================================================
  1125. # Window_CMSTarget
  1126. #==============================================================================
  1127.  
  1128. class Window_CMSTarget < Window_Base
  1129.  
  1130. attr_reader :index
  1131. attr_reader :actor
  1132. attr_reader :dir
  1133.  
  1134. def initialize(actor, mode = false)
  1135. @background = 'CMSTarget'
  1136. super(-304, 64, 256, 104)
  1137. self.contents = Bitmap.new(width - 32, height - 32)
  1138. @actor, @item_max = actor, 1
  1139. self.y += actor.index*104 unless mode
  1140. self.z = 3999
  1141. self.index = -1
  1142. refresh
  1143. end
  1144.  
  1145. def index=(i)
  1146. @index = i
  1147. update_cursor_rect
  1148. end
  1149.  
  1150. def refresh
  1151. self.contents.clear
  1152. draw_actor_name(@actor, 4, -4)
  1153. draw_actor_state(@actor, 100, -4, 112)
  1154. draw_actor_hp(@actor, 44, 16)
  1155. draw_actor_sp(@actor, 44, 38)
  1156. end
  1157.  
  1158. def update_actor(actor)
  1159. @actor = actor
  1160. refresh
  1161. end
  1162.  
  1163. def dir=(val)
  1164. self.y -= val*40
  1165. @dir = val
  1166. end
  1167.  
  1168. def update(i = @actor.index - 1)
  1169. unless self.index == -2
  1170. if @actor.index == i
  1171. self.index = 0 if self.index == -1
  1172. else
  1173. self.index = -1 if self.index == 0
  1174. end
  1175. end
  1176. self.y = 64+@actor.index*104 unless self.active
  1177. @dir = 0 if (self.y-64) / 104 * 104 == self.y-64
  1178. super()
  1179. update_cursor_rect
  1180. end
  1181.  
  1182. def update_cursor_rect
  1183. if !self.active || self.index == -1
  1184. self.cursor_rect.empty
  1185. elsif self.index >= 0
  1186. self.cursor_rect.set(x + GameGuy::X_OFFSET, (@index + 1) * 32 + GameGuy::Y_OFFSET - 30, 32, 32) #0, @index * 96, 224, 72) # self.cursor_rect.set(0, @index * 96, 224, 72)
  1187. elsif self.index == -2
  1188. self.cursor_rect.set(x + GameGuy::X_OFFSET, (@index + 1) * 32 + GameGuy::Y_OFFSET - 30, 32, 32) #(0, 0, 224, 72) self.cursor_rect.set(0, 0, 224, 72) #(0, 0, 224, 72)
  1189. end
  1190. end
  1191.  
  1192. end
  1193.  
  1194. #==============================================================================
  1195. # Window_Help
  1196. #==============================================================================
  1197.  
  1198. class Window_Help < Window_Base
  1199.  
  1200. alias init_storm_cms_later initialize
  1201. def initialize
  1202. @background = 'CMSHelp' if $scene.is_a?(Scene_Menu)
  1203. init_storm_cms_later
  1204. refresh
  1205. end
  1206.  
  1207. def refresh
  1208. self.contents.font.name = $game_system.fontname
  1209. end
  1210.  
  1211. end
  1212.  
  1213. #==============================================================================
  1214. # Window_CMSItem
  1215. #==============================================================================
  1216.  
  1217. class Window_CMSItem < Window_Selectable
  1218.  
  1219. def initialize
  1220. @background = 'CMSItem'
  1221. super(256, -512, 384, 416)
  1222. self.active, self.visible, self.z, self.index = false, false, 2999, -1
  1223. refresh
  1224. end
  1225.  
  1226. def data
  1227. return @data[self.index]
  1228. end
  1229.  
  1230. def draw_item(i)
  1231. number = case @data[i]
  1232. when RPG::Item then $game_party.item_number(@data[i].id)
  1233. when RPG::Weapon then $game_party.weapon_number(@data[i].id)
  1234. when RPG::Armor then $game_party.armor_number(@data[i].id)
  1235. end
  1236. if @data[i].is_a?(RPG::Item) && $game_party.item_can_use?(@data[i].id) ||
  1237. @mode == nil
  1238. self.contents.font.color = normal_color
  1239. else
  1240. self.contents.font.color = disabled_color
  1241. end
  1242. self.contents.fill_rect(4, i*32, 352, 32, Color.new(0, 0, 0, 0))
  1243. bitmap = RPG::Cache.icon(@data[i].icon_name)
  1244. opacity = self.contents.font.color == normal_color ? 255 : 128
  1245. self.contents.blt(4, i*32 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1246. self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
  1247. self.contents.draw_text(308, i*32, 16, 32, ':', 1)
  1248. self.contents.draw_text(324, i*32, 24, 32, number.to_s, 2)
  1249. end
  1250.  
  1251. def update_help
  1252. @help_window.set_text(data == nil ? '' : data.description)
  1253. end
  1254.  
  1255. end
  1256.  
  1257. #==============================================================================
  1258. # Window_NormalItem
  1259. #==============================================================================
  1260.  
  1261. class Window_NormalItem < Window_CMSItem
  1262.  
  1263. attr_accessor :mode
  1264.  
  1265. def initialize
  1266. @mode = 0
  1267. super
  1268. self.visible = true
  1269. end
  1270.  
  1271. def refresh
  1272. if self.contents != nil
  1273. self.contents.dispose
  1274. self.contents = nil
  1275. end
  1276. data1, data2, data3 = [], [], []
  1277. (1...$data_items.size).each {|i|
  1278. if $game_party.item_number(i) > 0 && !BlizzCFG::QUEST_ITEMS.include?(i)
  1279. data1.push($data_items[i])
  1280. end}
  1281. if BlizzCFG::WEAPONS_AND_ARMORS
  1282. (1...$data_weapons.size).each {|i|
  1283. data2.push($data_weapons[i]) if $game_party.weapon_number(i) > 0}
  1284. (1...$data_armors.size).each {|i|
  1285. data3.push($data_armors[i]) if $game_party.armor_number(i) > 0}
  1286. end
  1287. if [1, 2].include?(@mode)
  1288. data1.sort! {|a, b|
  1289. $game_party.item_number(a.id) <=> $game_party.item_number(b.id)}
  1290. data2.sort! {|a, b|
  1291. $game_party.weapon_number(a.id) <=> $game_party.weapon_number(b.id)}
  1292. data3.sort! {|a, b|
  1293. $game_party.armor_number(a.id) <=> $game_party.armor_number(b.id)}
  1294. [data1, data2, data3].each {|ary| ary.reverse!} if @mode == 2
  1295. elsif [3, 4].include?(@mode)
  1296. [data1, data2, data3].each {|ary| ary.sort! {|a, b| a.name <=> b.name}}
  1297. [data1, data2, data3].each {|ary| ary.reverse!} if @mode == 4
  1298. end
  1299. @data = data1 + data2 + data3
  1300. @item_max = @data.size
  1301. self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
  1302. (0...@item_max).each {|i| draw_item(i)}
  1303. end
  1304.  
  1305. end
  1306.  
  1307. #==============================================================================
  1308. # Window_QuestItem
  1309. #==============================================================================
  1310.  
  1311. class Window_QuestItem < Window_CMSItem
  1312.  
  1313. def refresh
  1314. if self.contents != nil
  1315. self.contents.dispose
  1316. self.contents = nil
  1317. end
  1318. @data = []
  1319. (1...$data_items.size).each {|i|
  1320. if $game_party.item_number(i) > 0 && BlizzCFG::QUEST_ITEMS.include?(i)
  1321. @data.push($data_items[i])
  1322. end}
  1323. @item_max = @data.size
  1324. self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
  1325. (0...@item_max).each {|i| draw_item(i)}
  1326. end
  1327.  
  1328. end
  1329.  
  1330. #==============================================================================
  1331. # Window_EquipmentItem
  1332. #==============================================================================
  1333.  
  1334. class Window_EquipmentItem < Window_CMSItem
  1335.  
  1336. attr_accessor :item_max
  1337.  
  1338. def initialize(actor)
  1339. @actor = actor
  1340. super()
  1341. self.x, self.y, self.z, self.index = 256, -548, 2999, 0
  1342. self.active = self.visible = true
  1343. end
  1344.  
  1345. def update_actor(actor)
  1346. @actor = actor
  1347. refresh
  1348. end
  1349.  
  1350. def refresh
  1351. if self.contents != nil
  1352. self.contents.dispose
  1353. self.contents = nil
  1354. end
  1355. @data = []
  1356. (1...$data_weapons.size).each {|i|
  1357. @data.push($data_weapons[i]) if $game_party.weapon_number(i) > 0}
  1358. (1...$data_armors.size).each {|i|
  1359. @data.push($data_armors[i]) if $game_party.armor_number(i) > 0}
  1360. @item_max = @data.size
  1361. self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
  1362. (0...@item_max).each {|i| draw_item(i)}
  1363. end
  1364.  
  1365. def draw_item(i)
  1366. case @data[i]
  1367. when RPG::Weapon
  1368. if @actor.equippable?($data_weapons[@data[i].id])
  1369. self.contents.font.color = normal_color
  1370. else
  1371. self.contents.font.color = disabled_color
  1372. end
  1373. number = $game_party.weapon_number(@data[i].id)
  1374. when RPG::Armor
  1375. if @actor.equippable?($data_armors[@data[i].id])
  1376. self.contents.font.color = normal_color
  1377. else
  1378. self.contents.font.color = disabled_color
  1379. end
  1380. number = $game_party.armor_number(@data[i].id)
  1381. end
  1382. self.contents.fill_rect(4, i*32, 352, 32, Color.new(0, 0, 0, 0))
  1383. bitmap = RPG::Cache.icon(@data[i].icon_name)
  1384. opacity = self.contents.font.color == normal_color ? 255 : 128
  1385. self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1386. self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
  1387. self.contents.draw_text(308, i*32, 16, 32, ':', 1)
  1388. self.contents.draw_text(324, i*32, 24, 32, number.to_s, 2)
  1389. end
  1390.  
  1391. end
  1392.  
  1393. #==============================================================================
  1394. # Window_CMSSkill
  1395. #==============================================================================
  1396.  
  1397. class Window_CMSSkill < Window_CMSItem
  1398.  
  1399. def initialize(actor)
  1400. @actor = actor
  1401. super()
  1402. self.x, self.y, self.z, self.index = -512, 64, 2999, 0
  1403. self.active = self.visible = true
  1404. end
  1405.  
  1406. def update_actor(actor)
  1407. @actor = actor
  1408. refresh
  1409. end
  1410.  
  1411. def refresh
  1412. if self.contents != nil
  1413. self.contents.dispose
  1414. self.contents = nil
  1415. end
  1416. @data = []
  1417. @actor.skills.each {|id| @data.push($data_skills[id])}
  1418. @item_max = @data.size
  1419. self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
  1420. (0...@item_max).each {|i| draw_item(i)}
  1421. end
  1422.  
  1423. def draw_item(i)
  1424. self.contents.fill_rect(4, i*32, 352, 32, Color.new(0, 0, 0, 0))
  1425. if @actor.skill_can_use?(@data[i].id)
  1426. self.contents.font.color = normal_color
  1427. else
  1428. self.contents.font.color = disabled_color
  1429. end
  1430. bitmap = RPG::Cache.icon(@data[i].icon_name)
  1431. opacity = self.contents.font.color == normal_color ? 255 : 128
  1432. self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1433. text = @data[i].name
  1434. tons = ($tons_version != nil ? $tons_version : 0)
  1435. if tons >= 4.0 && TONS_OF_ADDONS::EQUAP_SKILLS && DISPLAY_AP_REQ
  1436. aps = BlizzCFG.maxap(@data[i].id)
  1437. if aps > 0
  1438. text += " (#{@actor.ap(@data[i].id)}/#{aps})"
  1439. elsif DISPLAY_AP_ZERO
  1440. text += ' (0/0)'
  1441. end
  1442. end
  1443. self.contents.draw_text(32, i*32, 204, 32, text)
  1444. if @data[i].sp_cost > 0
  1445. sp_cost = @data[i].sp_cost
  1446. if tons >= 6.54 && $game_system.SP_COST_MOD
  1447. sp_cost = BlizzCFG.get_cost_mod(@actor.states, sp_cost)
  1448. end
  1449. self.contents.draw_text(292, i*32, 48, 32, sp_cost.to_s, 2)
  1450. end
  1451. end
  1452.  
  1453. end
  1454.  
  1455. #==============================================================================
  1456. # Window_CMSEquipLeft
  1457. #==============================================================================
  1458.  
  1459. class Window_CMSEquipLeft < Window_Base
  1460.  
  1461. attr_accessor :mode
  1462. attr_accessor :current
  1463. attr_accessor :changed
  1464.  
  1465. def initialize(actor)
  1466. @background = 'CMSEquipLeft'
  1467. super(640, 64, 288, 416)
  1468. self.contents = Bitmap.new(width - 32, height - 32)
  1469. @current = @changed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  1470. @elements, @states, @actor, @mode, self.z = [], [], actor, 0, 2999
  1471. refresh
  1472. end
  1473.  
  1474. def update_actor(actor)
  1475. @actor = actor
  1476. refresh
  1477. end
  1478.  
  1479. def draw_actor_hp(actor, x, y, width = 144)
  1480. self.contents.font.color = system_color
  1481. self.contents.draw_text(x, y, 96, 32, "max #{$data_system.words.hp}")
  1482. self.contents.font.color = normal_color
  1483. self.contents.draw_text(x + 108, y, 48, 32, actor.maxhp.to_s, 2)
  1484. end
  1485.  
  1486. def draw_actor_sp(actor, x, y, width = 144)
  1487. self.contents.font.color = system_color
  1488. self.contents.draw_text(x, y, 96, 32, "max #{$data_system.words.sp}")
  1489. self.contents.font.color = normal_color
  1490. self.contents.draw_text(x + 108, y, 48, 32, actor.maxsp.to_s, 2)
  1491. end
  1492.  
  1493. def element_states_refresh
  1494. self.contents.fill_rect(4, 276, 256, 108, Color.new(0, 0, 0, 0))
  1495. if @mode == 0
  1496. self.contents.font.color = up_color
  1497. self.contents.draw_text(4, 276, 200, 32, 'Elemental attack:')
  1498. self.contents.draw_text(4, 324, 200, 32, 'Status attack:')
  1499. elsif @mode == 1
  1500. self.contents.font.color = up_color
  1501. self.contents.draw_text(4, 276, 200, 32, 'Elemental resistance:')
  1502. self.contents.draw_text(4, 324, 200, 32, 'Status resistance:')
  1503. end
  1504. self.contents.font.color = normal_color
  1505. draw_elements(4, 300)
  1506. draw_states(4, 348)
  1507. end
  1508.  
  1509. def refresh
  1510. self.contents.clear
  1511. draw_actor_name(@actor, 4, 0)
  1512. draw_actor_level(@actor, 180, 0)
  1513. draw_actor_hp(@actor, 4, 28)
  1514. draw_actor_sp(@actor, 4, 52)
  1515. (0..7).each {|i| draw_actor_parameter(@actor, 4, 76 + i*24, i)}
  1516. element_states_refresh
  1517. @current.each_index {|i|
  1518. val = @current[i] - @changed[i]
  1519. if val != 0
  1520. self.contents.font.color = system_color
  1521. self.contents.draw_text(162, 28+i*24, 40, 32, '»»', 1)
  1522. self.contents.font.color = (val > 0 ? down_color : up_color)
  1523. self.contents.draw_text(204, 28+i*24, 48, 32, @changed[i].abs.to_s, 2)
  1524. end}
  1525. end
  1526.  
  1527. def set_new_parameters(elements, states)
  1528. @elements, @states = elements - $DUMMY_ELEMENTS, states - $DUMMY_STATES
  1529. refresh
  1530. end
  1531.  
  1532. def draw_elements(x, y)
  1533. @elements.each_index {|i|
  1534. icon = RPG::Cache.icon("CMS/elm_#{$data_system.elements[@elements[i]].downcase}")
  1535. self.contents.blt(x + i*28, y + 4, icon, Rect.new(0, 0, 24, 24))}
  1536. end
  1537.  
  1538. def draw_states(x, y)
  1539. @states.each_index {|i|
  1540. icon = RPG::Cache.icon("CMS/stat_#{$data_states[@states[i]].name.downcase}")
  1541. self.contents.blt(x + i*28, y + 4, icon, Rect.new(0, 0, 24, 24))}
  1542. end
  1543.  
  1544. end
  1545.  
  1546. #==============================================================================
  1547. # Window_CMSEquipRight
  1548. #==============================================================================
  1549.  
  1550. class Window_CMSEquipRight < Window_Selectable
  1551.  
  1552. def initialize(actor)
  1553. @background = 'CMSEquipRight'
  1554. super(928, 64, 352, 192)
  1555. self.contents = Bitmap.new(width - 32, height - 32)
  1556. @actor, self.active, self.z, self.index = actor, true, 2999, 0
  1557. refresh
  1558. end
  1559.  
  1560. def data
  1561. return @data[self.index]
  1562. end
  1563.  
  1564. def update_actor(actor)
  1565. @actor = actor
  1566. refresh
  1567. end
  1568.  
  1569. def refresh
  1570. self.contents.clear
  1571. @data = []
  1572. @data.push($data_weapons[@actor.weapon_id])
  1573. @data.push($data_armors[@actor.armor1_id])
  1574. @data.push($data_armors[@actor.armor2_id])
  1575. @data.push($data_armors[@actor.armor3_id])
  1576. @data.push($data_armors[@actor.armor4_id])
  1577. @item_max = @data.size
  1578. self.contents.font.color = system_color
  1579. self.contents.draw_text(4, 32 * 0, 120, 32, $data_system.words.weapon)
  1580. self.contents.draw_text(4, 32 * 1, 120, 32, $data_system.words.armor1)
  1581. self.contents.draw_text(4, 32 * 2, 120, 32, $data_system.words.armor2)
  1582. self.contents.draw_text(4, 32 * 3, 120, 32, $data_system.words.armor3)
  1583. self.contents.draw_text(4, 32 * 4, 120, 32, $data_system.words.armor4)
  1584. (0...5).each {|i| draw_item_name(@data[i], 120, 32 * i)}
  1585. end
  1586.  
  1587. def update_help
  1588. @help_window.set_text(data == nil ? '' : data.description)
  1589. end
  1590.  
  1591. end
  1592.  
  1593. #==============================================================================
  1594. # Window_CMSEquipItem
  1595. #==============================================================================
  1596.  
  1597. class Window_CMSEquipItem < Window_Selectable
  1598.  
  1599. def initialize(actor, equip_type)
  1600. @background = 'CMSEquipItem'
  1601. super(928, 256, 352, 224)
  1602. self.active = self.visible = false
  1603. @actor, @equip_type, self.z, self.index = actor, equip_type, 3000, -1
  1604. refresh
  1605. end
  1606.  
  1607. def data
  1608. return @data[self.index]
  1609. end
  1610.  
  1611. def update_actor(actor, equip_type)
  1612. @actor = actor
  1613. @equip_type = equip_type
  1614. refresh
  1615. end
  1616.  
  1617. def refresh
  1618. if self.contents != nil
  1619. self.contents.dispose
  1620. self.contents = nil
  1621. end
  1622. @data = []
  1623. if @equip_type == 0
  1624. weapon_set = $data_classes[@actor.class_id].weapon_set
  1625. (1...$data_weapons.size).each {|i|
  1626. if $game_party.weapon_number(i) > 0
  1627. id = i
  1628. if $charlie_fleed_enhanced_equipment &&
  1629. i > $game_party.max_database_weapon_id
  1630. id = $data_weapons[i].ref_id
  1631. end
  1632. @data.push($data_weapons[i]) if weapon_set.include?(id)
  1633. end}
  1634. else
  1635. armor_set = $data_classes[@actor.class_id].armor_set
  1636. (1...$data_armors.size).each {|i|
  1637. if $data_armors[i].kind == @equip_type - 1 &&
  1638. $game_party.armor_number(i) > 0
  1639. id = i
  1640. if $charlie_fleed_enhanced_equipment &&
  1641. i > $game_party.max_database_armor_id
  1642. id = $data_armors[i].ref_id
  1643. end
  1644. @data.push($data_armors[i]) if armor_set.include?(id)
  1645. end}
  1646. end
  1647. #===========================================
  1648. @data.push(nil)
  1649. @item_max = @data.size
  1650. self.contents = Bitmap.new(width - 32, @item_max * 32)
  1651. (0...@item_max-1).each {|i| draw_item(i)}
  1652. self.contents.font.color = system_color
  1653. self.contents.draw_text(4, (@item_max-1)*32, 100, 32, '[Unequip]')
  1654. end
  1655.  
  1656. def draw_item(i)
  1657. number = case @data[i]
  1658. when RPG::Weapon then $game_party.weapon_number(@data[i].id)
  1659. when RPG::Armor then $game_party.armor_number(@data[i].id)
  1660. end
  1661. self.contents.font.color = normal_color
  1662. bitmap = RPG::Cache.icon(@data[i].icon_name)
  1663. self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24))
  1664. self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
  1665. self.contents.draw_text(212, i*32, 16, 32, ':', 1)
  1666. self.contents.draw_text(228, i*32, 24, 32, number.to_s, 2)
  1667. end
  1668.  
  1669. def update_help
  1670. @help_window.set_text(data == nil ? '' : data.description)
  1671. end
  1672.  
  1673. end
  1674.  
  1675. #==============================================================================
  1676. # Window_CMSStatus
  1677. #==============================================================================
  1678.  
  1679. class Window_CMSStatus < Window_Base
  1680.  
  1681. def initialize(actor)
  1682. @background = 'CMSFullscreen'
  1683. super(0, 512, 640, 480)
  1684. self.contents = Bitmap.new(width - 32, height - 32)
  1685. @actor, self.active, self.z = actor, true, 2999
  1686. refresh
  1687. end
  1688.  
  1689. def refresh
  1690. self.contents.clear
  1691. self.contents.font.color = normal_color
  1692. self.contents.draw_text(224, 0, 120, 32, @actor.name, 1)
  1693. draw_actor_battler(@actor, 284, 232)
  1694. draw_actor_class(@actor, 400, 32)
  1695. draw_actor_level(@actor, 400, 0)
  1696. draw_actor_state(@actor, 400, 64, 168)
  1697. draw_actor_hp(@actor, 400, 92, 172)
  1698. draw_actor_sp(@actor, 400, 122, 172)
  1699. if $crls
  1700. if BlizzCFG::DRAW_SR_BAR
  1701. draw_actor_sr_with_bar(@actor, 400, 152, 172)
  1702. else
  1703. draw_actor_sr(@actor, 400, 152, 172)
  1704. end
  1705. draw_actor_exp(@actor, 400, 182, 172)
  1706. else
  1707. draw_actor_exp(@actor, 400, 152, 172)
  1708. end
  1709. (0..7).each {|i| draw_actor_parameter(@actor, 4, i*28, i)}
  1710. self.contents.font.color = system_color
  1711. w = self.contents.text_size('Elemental Vulnerability').width
  1712. self.contents.draw_text(365, 244, w, 32, 'Elemental Vulnerability')
  1713. self.contents.font.size -= 4
  1714. draw_actor_element_vulnerability(@actor, 320, 268)
  1715. self.contents.font.size += 4
  1716. self.contents.font.color = system_color
  1717. self.contents.draw_text(84, 244, 96, 32, 'Equipment')
  1718. self.contents.draw_text(4, 276, 96, 32, $data_system.words.weapon)
  1719. self.contents.draw_text(4, 308, 96, 32, $data_system.words.armor1)
  1720. self.contents.draw_text(4, 340, 96, 32, $data_system.words.armor2)
  1721. self.contents.draw_text(4, 372, 96, 32, $data_system.words.armor3)
  1722. self.contents.draw_text(4, 404, 96, 32, $data_system.words.armor4)
  1723. equips = [$data_weapons[@actor.weapon_id], $data_armors[@actor.armor1_id],
  1724. $data_armors[@actor.armor2_id], $data_armors[@actor.armor3_id],
  1725. $data_armors[@actor.armor4_id]]
  1726. equips.each_index {|i|
  1727. if @actor.equippable?(equips[i])
  1728. draw_item_name(equips[i], 108, 276 + i*32)
  1729. else
  1730. self.contents.font.color = (i == 0 ? knockout_color : crisis_color)
  1731. self.contents.draw_text(108, 276 + i*32, 192, 32, 'Nothing equipped')
  1732. end}
  1733. end
  1734.  
  1735. def update_actor(actor)
  1736. @actor = actor
  1737. refresh
  1738. end
  1739.  
  1740. end
  1741.  
  1742. #==============================================================================
  1743. # Window_CMSSortCommand
  1744. #==============================================================================
  1745.  
  1746. class Window_CMSSortCommand < Window_Command
  1747.  
  1748. def initialize
  1749. @background = 'CMSMini'
  1750. super(180, ['Standard', 'by quantity', 'by alphabet'])
  1751. self.x, self.y, self.z = 224, -128, 9999
  1752. end
  1753.  
  1754. end
  1755.  
  1756. #==============================================================================
  1757. # Window_CMSEndCommand
  1758. #==============================================================================
  1759.  
  1760. class Window_CMSEndCommand < Window_Command
  1761.  
  1762. def initialize
  1763. @background = 'CMSMini'
  1764. super(180, ['Back to game', 'Back to title', 'Exit game'])
  1765. self.x, self.y, self.z = 460, 524, 3999
  1766. end
  1767.  
  1768. end
  1769.  
  1770. #==============================================================================
  1771. # Window_CMSInfo
  1772. #==============================================================================
  1773.  
  1774. class Window_CMSInfo < Window_Base
  1775.  
  1776. def initialize
  1777. @background = 'CMSInfo'
  1778. super(0, 0, 180, 160)
  1779. self.contents = Bitmap.new(width - 32, height - 32)
  1780. self.active, self.x, self.y, self.z = false, 460, 832, 1999
  1781. refresh
  1782. end
  1783.  
  1784. def refresh
  1785. self.contents.clear
  1786. self.contents.font.name = $game_system.fontname
  1787. @double_sec = Graphics.frame_count * 2 / Graphics.frame_rate
  1788. total_sec = @double_sec / 2
  1789. hour, min, sec = total_sec / 60 / 60, total_sec / 60 % 60, total_sec % 60
  1790. if @double_sec % 2 == 1
  1791. text = sprintf('%02d %02d %02d', hour, min, sec)
  1792. else
  1793. text = sprintf('%02d:%02d:%02d', hour, min, sec)
  1794. end
  1795. self.contents.font.color = system_color
  1796. cx = contents.text_size($data_system.words.gold).width
  1797. self.contents.draw_text(148-cx, 32, cx, 32, $data_system.words.gold, 2)
  1798. self.contents.draw_text(0, 64, 148, 32, 'Location:')
  1799. self.contents.font.color = normal_color
  1800. self.contents.draw_text(0, 0, 148, 32, text, 1)
  1801. self.contents.draw_text(0, 32, 144-cx, 32, $game_party.gold.to_s, 2)
  1802. self.contents.draw_text(0, 96, 148, 32, $game_map.name, 2)
  1803. end
  1804.  
  1805. def update
  1806. super
  1807. refresh if Graphics.frame_count * 2 / Graphics.frame_rate != @double_sec
  1808. end
  1809.  
  1810. end
  1811.  
  1812. #==============================================================================
  1813. # Window_CMSMenuStatus
  1814. #==============================================================================
  1815.  
  1816. class Window_CMSMenuStatus < Window_Base
  1817.  
  1818. attr_reader :index
  1819. attr_reader :actor
  1820. attr_reader :dir
  1821.  
  1822. def initialize(actor)
  1823. @background = 'CMSMenuStatus'
  1824. super(0, 0, 460, 120)
  1825. self.contents = Bitmap.new(width - 32, height - 32)
  1826. @actor = actor
  1827. @dir = 0
  1828. refresh
  1829. self.active = false
  1830. self.index = -1
  1831. self.x, self.y, self.z = -512, @actor.index * 120, 999
  1832. end
  1833.  
  1834. def index=(i)
  1835. @index = i
  1836. update_cursor_rect
  1837. end
  1838.  
  1839. def refresh
  1840. self.contents.clear
  1841. self.contents.font.name = $game_system.fontname
  1842. self.contents.font.color = normal_color
  1843. draw_actor_graphic(@actor, 56, 80)
  1844. draw_actor_name2(@actor, 8, 0, 88, 1)
  1845. draw_actor_level(@actor, 104, 0)
  1846. draw_actor_state(@actor, 168, 0, 252)
  1847. draw_actor_hp(@actor, 104, 28)
  1848. draw_actor_sp(@actor, 272, 28)
  1849. draw_actor_exp_alt(@actor, 272, 56)
  1850. if $crls
  1851. if BlizzCFG::DRAW_SR_BAR
  1852. draw_actor_sr_with_bar(@actor, 104, 56)
  1853. else
  1854. draw_actor_sr(@actor, 104, 56)
  1855. end
  1856. end
  1857. end
  1858.  
  1859. def dir=(val)
  1860. self.y -= val*56
  1861. @dir = val
  1862. end
  1863.  
  1864. def update(i = @actor.index - 1)
  1865. if @actor.index == i
  1866. self.index = 0 if self.index == -1
  1867. else
  1868. self.index = -1 if self.index == 0
  1869. end
  1870. self.y = @actor.index*120 unless self.active
  1871. @dir = 0 if self.y / 120 * 120 == self.y
  1872. super()
  1873. end
  1874.  
  1875. def update_cursor_rect
  1876. if @index < 0
  1877. self.cursor_rect.empty
  1878. else
  1879. self.cursor_rect.set(0, 0, width - 32, height - 32)
  1880. end
  1881. end
  1882.  
  1883. end
  1884.  
  1885. #==============================================================================
  1886. # Scene_Menu
  1887. #==============================================================================
  1888.  
  1889. class Scene_Menu
  1890.  
  1891. def initialize(menu_index = 0)
  1892. @menu_index = menu_index
  1893. @actor_index = @target_index = -1
  1894. @viewport1 = Viewport.new(0, 0, 640, 480)
  1895. @moved = false
  1896. end
  1897.  
  1898. def main
  1899. if BlizzCFG::MAP_BACKGROUND
  1900. @spriteset = Spriteset_Map.new
  1901. elsif BlizzCFG::CMS_EDITION
  1902. @spriteset = Sprite.new
  1903. @spriteset.bitmap = RPG::Cache.picture("CMS/#{BlizzCFG::CMS_EDITION}/CMSFullscreen")
  1904. end
  1905. continue = ((1..BlizzCFG::SAVE_FILES_NUMBER).any? {|i|
  1906. FileTest.exist?("#{BlizzCFG::SAVE_NAME}#{i}.#{BlizzCFG::SAVE_EXTENSION}")})
  1907. @command_window = Window_CMSCommand.new(@menu_index, continue)
  1908. (0...5).each {|i| @command_window.disable_item(i)} if $game_party.actors.size == 0
  1909. @command_window.disable_item(6) if $game_system.save_disabled
  1910. @command_window.disable_item(7) unless @command_window.continue
  1911. @info_window = Window_CMSInfo.new
  1912. @status_windows, @target_windows = [], []
  1913. $game_party.actors.each {|actor|
  1914. @status_windows.push(Window_CMSMenuStatus.new(actor))}
  1915. @help_window = Window_Help.new
  1916. @help_window.x, @help_window.y, @help_window.z = 0, -368, 9999
  1917. Graphics.transition
  1918. loop do
  1919. Graphics.update
  1920. Input.update
  1921. update
  1922. break if @scene != nil || $scene != self
  1923. end
  1924. loop do
  1925. Graphics.update
  1926. (@status_windows + [@command_window, @info_window]).each {|win| win.update}
  1927. move_win_outro
  1928. break if @status_windows[0].x <= - 512
  1929. end
  1930. Graphics.freeze
  1931. (@status_windows + @target_windows + [@command_window, @info_window,
  1932. @help_window, @spriteset]).each {|obj| obj.dispose if obj != nil}
  1933. del_sort if @sort_window != nil
  1934. del_status if @playerstatus_window != nil
  1935. del_equip if @left_window != nil
  1936. del_skill if @skill_window != nil
  1937. del_end if @end_window != nil
  1938. del_items if @item_choose_window != nil
  1939. del_equipment if @equips_window != nil
  1940. del_options if @options_window != nil
  1941. if @scene.is_a?(Scene_Title)
  1942. Graphics.transition(25)
  1943. Graphics.freeze
  1944. end
  1945. $scene = @scene
  1946. end
  1947.  
  1948. def equip_refresh
  1949. if @item_window.active
  1950. item = @item_window.data
  1951. last_hp, last_sp = @actor.hp, @actor.sp
  1952. @left_window.current = [@actor.maxhp, @actor.maxsp, @actor.atk,
  1953. @actor.pdef, @actor.mdef, @actor.str, @actor.dex, @actor.agi,
  1954. @actor.int, @actor.eva]
  1955. @left_window.changed = @actor.test_equip(@right_window.index, item == nil ? 0 : item.id)
  1956. @actor.hp, @actor.sp = last_hp, last_sp
  1957. else
  1958. item = @right_window.data
  1959. @left_window.current = @left_window.changed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  1960. end
  1961. elements = (item.is_a?(RPG::Weapon) ? item.element_set :
  1962. (item.is_a?(RPG::Armor) ? item.guard_element_set : []))
  1963. states = (item.is_a?(RPG::Weapon) ? item.plus_state_set :
  1964. (item.is_a?(RPG::Armor) ? item.guard_state_set : []))
  1965. @left_window.set_new_parameters(elements, states)
  1966. @left_window.refresh
  1967. end
  1968.  
  1969. def element_states_refresh
  1970. item = @right_window.data
  1971. elements = (item.is_a?(RPG::Weapon) ? item.element_set :
  1972. (item.is_a?(RPG::Armor) ? item.guard_element_set : []))
  1973. states = (item.is_a?(RPG::Weapon) ? item.plus_state_set :
  1974. (item.is_a?(RPG::Armor) ? item.guard_state_set : []))
  1975. @left_window.set_new_parameters(elements, states)
  1976. @left_window.element_states_refresh
  1977. end
  1978.  
  1979. def del_sort
  1980. @sort_window.dispose
  1981. @sort_window = nil
  1982. end
  1983.  
  1984. def del_status
  1985. @playerstatus_window.dispose
  1986. @playerstatus_window = nil
  1987. end
  1988.  
  1989. def del_equip
  1990. @left_window.dispose
  1991. @right_window.dispose
  1992. @item_windows.each {|win| win.dispose}
  1993. @left_window = @right_window = @item_window = @item_windows = nil
  1994. end
  1995.  
  1996. def del_skill
  1997. @skill_window.dispose
  1998. @skill_window = nil
  1999. end
  2000.  
  2001. def del_target
  2002. @target_windows.each {|win| win.dispose}
  2003. @target_windows = []
  2004. end
  2005.  
  2006. def del_end
  2007. @end_window.dispose
  2008. @end_window = nil
  2009. end
  2010.  
  2011. def del_items
  2012. @items_window1.dispose
  2013. @items_window1 = nil
  2014. @items_window2.dispose
  2015. @items_window2 = nil
  2016. @item_choose_window.dispose
  2017. @item_choose_window = nil
  2018. end
  2019.  
  2020. def del_equipment
  2021. @equips_window.dispose
  2022. @equips_window = nil
  2023. del_target
  2024. end
  2025.  
  2026. def del_options
  2027. @options_window.dispose
  2028. @options_window = nil
  2029. end
  2030.  
  2031. def update
  2032. @status_windows.each {|win| win.update(@actor_index)}
  2033. @target_windows.each {|win| win.update(@target_index)}
  2034. @info_window.update
  2035. unless @status_windows[0].x < 0 || @status_windows[0].dir != 0 ||
  2036. @target_windows[0] != nil && @target_windows[0].dir != 0
  2037. @command_window.update
  2038. [@help_window, @equips_window, @item_choose_window, @sort_window,
  2039. @skill_window, @left_window, @right_window, @playerstatus_window,
  2040. @options_window, @end_window].each {|win| win.update if win != nil}
  2041. end
  2042. move_win_main if @status_windows[0].x < 0
  2043. move_win_selection if @status_windows[0].dir != 0
  2044. move_win_targeting if @target_windows[0] != nil && @target_windows[0].dir != 0
  2045. move_win_status if @playerstatus_window != nil && @playerstatus_window.y > 0
  2046. move_win_equip if @left_window != nil && @left_window.x > 0
  2047. move_win_skill if @skill_window != nil && @skill_window.x < 256
  2048. move_win_target if @target_windows[0] != nil && @target_windows[0].x < 0
  2049. move_win_items if @item_choose_window != nil && @item_choose_window.y < 0
  2050. move_win_sort if @sort_window != nil && @sort_window.y < 64
  2051. move_win_equipment if @equips_window != nil && @equips_window.y < 64
  2052. move_win_options if @options_window != nil && @options_window.y > 0
  2053. move_win_end if @end_window != nil && @end_window.y > 336
  2054. if @moved
  2055. @moved = false
  2056. return
  2057. end
  2058. if @equips_window != nil
  2059. update_equipment
  2060. elsif @command_window.active
  2061. update_command
  2062. elsif @status_windows[0].active
  2063. update_status
  2064. elsif @item_choose_window != nil
  2065. if @item_choose_window.active
  2066. items_refresh
  2067. update_items_choose
  2068. elsif @sort_window != nil && @sort_window.active
  2069. update_sort
  2070. elsif @items_window1 != nil && @items_window1.active
  2071. @items_window1.update
  2072. update_item
  2073. elsif @items_window2 != nil && @items_window2.active
  2074. @items_window2.update
  2075. update_item
  2076. elsif @target_windows[0] != nil && @target_windows[0].active
  2077. update_item_target
  2078. end
  2079. elsif @skill_window != nil && @skill_window.active
  2080. update_skill
  2081. elsif @target_windows[0] != nil && @target_windows[0].active
  2082. update_skill_target
  2083. elsif @right_window != nil
  2084. if @right_window.active
  2085. update_right_equip
  2086. elsif @item_window != nil && @item_window.active
  2087. @item_window.update
  2088. update_eitem
  2089. end
  2090. elsif @playerstatus_window != nil && @playerstatus_window.active
  2091. update_playerstatus
  2092. elsif @options_window != nil && @options_window.active
  2093. update_options
  2094. elsif @end_window != nil
  2095. update_end
  2096. end
  2097. end
  2098.  
  2099. def move_windows(wins, border, mdiff, lead, xy, acc = false)
  2100. if acc
  2101. diff = [[((xy ? lead.x : lead.y)-border).abs, mdiff].min, 1].max
  2102. else
  2103. diff = [[((xy ? lead.x : lead.y)-border).abs/2, mdiff].min, 1].max
  2104. end
  2105. wins[0].each {|win| win.x += diff if win != nil}
  2106. wins[1].each {|win| win.x -= diff if win != nil}
  2107. wins[2].each {|win| win.y += diff if win != nil}
  2108. wins[3].each {|win| win.y -= diff if win != nil}
  2109. @moved = true
  2110. end
  2111.  
  2112. def move_win_main
  2113. lead = @status_windows[0]
  2114. x_plus = @status_windows
  2115. x_minus = [@command_window]
  2116. y_minus = [@info_window]
  2117. move_windows([x_plus, x_minus, [], y_minus], 0, 128, lead, true)
  2118. end
  2119.  
  2120. def move_win_outro
  2121. @flag = true
  2122. lead = @status_windows[0]
  2123. x_plus = [@command_window]
  2124. x_minus = @status_windows + @target_windows + [@skill_window, @help_window]
  2125. y_plus = [@info_window]
  2126. y_minus = [@item_choose_window, @items_window1, @items_window2, @help_window]
  2127. move_windows([x_plus, x_minus, y_plus, y_minus], 0, 128, lead, true, true)
  2128. end
  2129.  
  2130. def move_win_selection(lead = @status_windows[@actor_index])
  2131. if lead.dir == 1
  2132. move_windows([[], [], [], @status_windows], 360, 32, lead, false)
  2133. else
  2134. move_windows([[], [], @status_windows, []], 0, 32, lead, false)
  2135. end
  2136. end
  2137.  
  2138. def move_win_targeting(lead = @target_windows[@target_index])
  2139. if lead.dir == 1
  2140. move_windows([[], [], [], @target_windows], 376, 32, lead, false)
  2141. else
  2142. move_windows([[], [], @target_windows, []], 64, 32, lead, false)
  2143. end
  2144. end
  2145.  
  2146. def move_win_sort(win = @sort_window)
  2147. move_windows([[], [], [win], []], 64, 32, win, false)
  2148. end
  2149.  
  2150. def move_win_status(win = @playerstatus_window)
  2151. move_windows([[], [], [], [win]], 0, 64, win, false)
  2152. end
  2153.  
  2154. def move_win_equip(win = @left_window)
  2155. x_minus = [@left_window, @right_window, @help_window] + @item_windows
  2156. move_windows([[], x_minus, [], []], 0, 64, win, true)
  2157. end
  2158.  
  2159. def move_win_skill(win = @skill_window)
  2160. x_plus = [@skill_window, @help_window]
  2161. move_windows([x_plus, [], [], []], 256, 64, win, true)
  2162. end
  2163.  
  2164. def move_win_target(win = @target_windows[0])
  2165. move_windows([@target_windows, [], [], []], 0, 32, win, true)
  2166. end
  2167.  
  2168. def move_win_items(win = @item_choose_window)
  2169. y_plus = [@item_choose_window, @items_window1, @items_window2, @help_window]
  2170. move_windows([[], [], y_plus, []], 0, 64, win, false)
  2171. end
  2172.  
  2173. def move_win_equipment(win = @equips_window)
  2174. y_plus = [@equips_window, @help_window]
  2175. move_windows([[], [], y_plus, []], 64, 64, win, false)
  2176. end
  2177.  
  2178. def move_win_options(win = @options_window)
  2179. move_windows([[], [], [], [win]], 0, 64, win, false)
  2180. end
  2181.  
  2182. def move_win_end(win = @end_window)
  2183. move_windows([[], [], [], [win]], 336, 64, win, false)
  2184. end
  2185.  
  2186. def update_command
  2187. if Input.trigger?(Input::B)
  2188. $game_system.se_play($data_system.cancel_se)
  2189. @scene = Scene_Map.new
  2190. elsif Input.trigger?(Input::C)
  2191. if $game_party.actors.size == 0 && @command_window.index < 5
  2192. $game_system.se_play($data_system.buzzer_se)
  2193. return
  2194. end
  2195. case @command_window.index
  2196. when 0
  2197. $game_system.se_play($data_system.decision_se)
  2198. if BlizzCFG::CUSTOM_ITEM_SCENE
  2199. @scene = Scene_Item.new
  2200. else
  2201. @item_choose_window = Window_CMSChooseItem.new
  2202. @items_window1 = Window_NormalItem.new
  2203. @items_window2 = Window_QuestItem.new
  2204. @items_window1.help_window = @items_window2.help_window = @help_window
  2205. @command_window.active = false
  2206. @help_window.x, @help_window.y = 0, -576
  2207. @help_window.set_text('')
  2208. @help_window.visible = false
  2209. items_refresh
  2210. end
  2211. when 1,3,4 #1..4
  2212. $game_system.se_play($data_system.decision_se)
  2213. @command_window.active = false
  2214. @status_windows.each {|win| win.active = true}
  2215. @actor_index = 0
  2216. when 2
  2217. $game_system.se_play($data_system.decision_se)
  2218. @command_window.active = false
  2219. @actor = $game_party.actors[0]
  2220. @left_window = Window_CMSEquipLeft.new(@actor)
  2221. @right_window = Window_CMSEquipRight.new(@actor)
  2222. @right_window.help_window = @help_window
  2223. @item_windows = []
  2224. (0..4).each {|i| win = Window_CMSEquipItem.new(@actor, 4-i)
  2225. win.help_window = @help_window
  2226. @item_windows.unshift(win)}
  2227. @item_windows[0].visible = @help_window.visible = true
  2228. @help_window.x, @help_window.y = 640, 0
  2229. @status_windows.each {|win| win.active = false}
  2230. when 5
  2231. $game_system.se_play($data_system.decision_se)
  2232. if BlizzCFG::CUSTOM_OPTIONS_SCENE
  2233. @scene = Scene_Options.new
  2234. else
  2235. @options_window = Window_CMSOptions.new
  2236. @command_window.active = false
  2237. end
  2238. when 6
  2239. if $game_system.save_disabled
  2240. $game_system.se_play($data_system.buzzer_se)
  2241. else
  2242. $game_system.se_play($data_system.decision_se)
  2243. @scene = Scene_CMSSave.new
  2244. Graphics.transition(0)
  2245. end
  2246. when 7
  2247. if @command_window.continue
  2248. $game_system.se_play($data_system.decision_se)
  2249. @scene = Scene_CMSLoad.new
  2250. Graphics.transition(0)
  2251. else
  2252. $game_system.se_play($data_system.buzzer_se)
  2253. end
  2254. when 8
  2255. $game_system.se_play($data_system.decision_se)
  2256. if BlizzCFG::CUSTOM_END_SCENE
  2257. @scene = Scene_End.new
  2258. else
  2259. @command_window.active = false
  2260. @end_window = Window_CMSEndCommand.new
  2261. end
  2262. end
  2263. end
  2264. end
  2265.  
  2266. def update_status
  2267. @actor = $game_party.actors[@actor_index]
  2268. if Input.trigger?(Input::B)
  2269. $game_system.se_play($data_system.cancel_se)
  2270. @status_windows.each {|win| win.active, win.index = false, -1}
  2271. @actor_index = -1
  2272. @command_window.active = true
  2273. elsif Input.trigger?(Input::C)
  2274. case @command_window.index
  2275. when 1
  2276. $game_system.se_play($data_system.decision_se)
  2277. if BlizzCFG::CUSTOM_EQUIPMENT_SCENE
  2278. @scene = Scene_Equipment.new(@actor_index)
  2279. else
  2280. @equips_window = Window_EquipmentItem.new(@actor)
  2281. @equips_window.help_window = @help_window
  2282. @target_windows.push(Window_CMSTarget.new(@actor, true))
  2283. @status_windows.each {|win| win.active = false}
  2284. @help_window.visible = true
  2285. @help_window.x, @help_window.y = 0, -612
  2286. end
  2287. when 2
  2288. $game_system.se_play($data_system.decision_se)
  2289. if BlizzCFG::CUSTOM_EQUIP_SCENE
  2290. @scene = Scene_Equip.new(@actor_index)
  2291. else
  2292. @left_window = Window_CMSEquipLeft.new(@actor)
  2293. @right_window = Window_CMSEquipRight.new(@actor)
  2294. @right_window.help_window = @help_window
  2295. @item_windows = []
  2296. (0..4).each {|i| win = Window_CMSEquipItem.new(@actor, 4-i)
  2297. win.help_window = @help_window
  2298. @item_windows.unshift(win)}
  2299. @item_windows[0].visible = @help_window.visible = true
  2300. @help_window.x, @help_window.y = 640, 0
  2301. @status_windows.each {|win| win.active = false}
  2302. end
  2303. when 3
  2304. if @actor.restriction >= 2
  2305. $game_system.se_play($data_system.buzzer_se)
  2306. else
  2307. $game_system.se_play($data_system.decision_se)
  2308. if BlizzCFG::CUSTOM_SKILL_SCENE
  2309. @scene = Scene_Skill.new(@actor_index)
  2310. else
  2311. @skill_window = Window_CMSSkill.new(@actor)
  2312. @skill_window.help_window = @help_window
  2313. @help_window.visible = true
  2314. @help_window.x, @help_window.y = -768, 0
  2315. @status_windows.each {|win| win.active = false}
  2316. end
  2317. end
  2318. when 4
  2319. $game_system.se_play($data_system.decision_se)
  2320. if BlizzCFG::CUSTOM_STATUS_SCENE
  2321. @scene = Scene_Status.new(@actor_index)
  2322. else
  2323. @playerstatus_window = Window_CMSStatus.new(@actor)
  2324. @status_windows.each {|win| win.active = false}
  2325. end
  2326. end
  2327. elsif Input.repeat?(Input::DOWN)
  2328. $game_system.se_play($data_system.cursor_se)
  2329. @actor_index = (@actor_index+1) % $game_party.actors.size
  2330. if @status_windows[@actor_index].y < 0
  2331. @status_windows.each {|win| win.y += ($game_party.actors.size-4)*120}
  2332. elsif @status_windows[@actor_index].y >= 480
  2333. @status_windows.each {|win| win.dir = 1}
  2334. end
  2335. elsif Input.repeat?(Input::UP)
  2336. $game_system.se_play($data_system.cursor_se)
  2337. @actor_index += $game_party.actors.size-1
  2338. @actor_index %= $game_party.actors.size
  2339. if @status_windows[@actor_index].y < 0
  2340. @status_windows.each {|win| win.dir = -1}
  2341. elsif @status_windows[@actor_index].y >= 480
  2342. @status_windows.each {|win| win.y -= ($game_party.actors.size-4)*120}
  2343. end
  2344. end
  2345. end
  2346.  
  2347. def update_items_choose
  2348. if Input.trigger?(Input::B)
  2349. del_items
  2350. $game_system.se_play($data_system.cancel_se)
  2351. @command_window.active, @help_window.x, @help_window.y = true, 0, -612
  2352. elsif Input.trigger?(Input::C)
  2353. items_refresh
  2354. @item_choose_window.active = false
  2355. $game_system.se_play($data_system.decision_se)
  2356. case @item_choose_window.index
  2357. when 0
  2358. @items_window1.active = @help_window.visible = true
  2359. @items_window1.index = 0
  2360. when 1 then @sort_window = Window_CMSSortCommand.new
  2361. when 2
  2362. @items_window2.active = @help_window.visible = true
  2363. @items_window2.index = 0
  2364. end
  2365. end
  2366. end
  2367.  
  2368. def update_sort
  2369. if Input.trigger?(Input::B)
  2370. del_sort
  2371. @item_choose_window.active = true
  2372. $game_system.se_play($data_system.cancel_se)
  2373. elsif Input.trigger?(Input::C)
  2374. $game_system.se_play($data_system.decision_se)
  2375. @items_window1.mode = case @sort_window.index
  2376. when 0 then @sort_window.index
  2377. when 1 then @items_window1.mode == 1 ? 2 : 1
  2378. when 2 then @items_window1.mode == 3 ? 4 : 3
  2379. end
  2380. @items_window1.refresh
  2381. end
  2382. end
  2383.  
  2384. def items_refresh
  2385. index = @item_choose_window.index
  2386. @items_window1.visible = [0, 1].include?(index)
  2387. @items_window2.visible = (index == 2)
  2388. end
  2389.  
  2390. def update_equipment
  2391. if Input.trigger?(Input::B)
  2392. del_equipment
  2393. $game_system.se_play($data_system.cancel_se)
  2394. @actor_index = -1
  2395. @command_window.active = true
  2396. @help_window.visible = false
  2397. @help_window.x, @help_window.y = 0, -612
  2398. elsif Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT)
  2399. $game_system.se_play($data_system.cursor_se)
  2400. if Input.trigger?(Input::RIGHT)
  2401. @actor_index = (@actor_index+1) % $game_party.actors.size
  2402. elsif Input.trigger?(Input::LEFT)
  2403. @actor_index += $game_party.actors.size-1
  2404. @actor_index %= $game_party.actors.size
  2405. end
  2406. @target_windows[0].update_actor($game_party.actors[@actor_index])
  2407. @equips_window.update_actor($game_party.actors[@actor_index])
  2408. unless @equips_window.item_max > @equips_window.index
  2409. @equips_window.index = 0
  2410. end
  2411. end
  2412. end
  2413.  
  2414. def update_item
  2415. if Input.trigger?(Input::B)
  2416. $game_system.se_play($data_system.cancel_se)
  2417. @item_choose_window.active = true
  2418. @help_window.set_text('')
  2419. @items_window1.active = @items_window2.active = @help_window.visible = false
  2420. @items_window1.index = @items_window2.index = -1
  2421. elsif Input.trigger?(Input::C)
  2422. win = (@item_choose_window.index == 0 ? @items_window1 : @items_window2)
  2423. @item = win.data
  2424. unless @item.is_a?(RPG::Item) && $game_party.item_can_use?(@item.id)
  2425. $game_system.se_play($data_system.buzzer_se)
  2426. return
  2427. end
  2428. $game_party.actors.each_index {|i|
  2429. @target_windows.push(Window_CMSTarget.new($game_party.actors[i]))}
  2430. @target_index = 0
  2431. $game_system.se_play($data_system.decision_se)
  2432. if @item.scope.between?(3, 6)
  2433. win.active = false
  2434. @target_windows.each {|win| win.active = true}
  2435. if [4, 6].include?(@item.scope)
  2436. @target_windows.each {|win| win.index = -2}
  2437. else
  2438. @target_windows[@target_index].index = 0
  2439. end
  2440. elsif @item.common_event_id > 0
  2441. $game_temp.common_event_id = @item.common_event_id
  2442. $game_system.se_play(@item.menu_se)
  2443. if @item.consumable
  2444. $game_party.lose_item(@item.id, 1)
  2445. win.draw_item(win.index)
  2446. end
  2447. (@status_windows + @target_windows).each {|win| win.refresh}
  2448. @scene = Scene_Map.new
  2449. elsif @skill.scope == 7
  2450. $game_system.se_play($data_system.buzzer_se)
  2451. end
  2452. end
  2453. end
  2454.  
  2455. def update_item_target
  2456. if Input.trigger?(Input::B)
  2457. del_target
  2458. $game_system.se_play($data_system.cancel_se)
  2459. @target_index = -1
  2460. @items_window1.refresh unless $game_party.item_can_use?(@item.id)
  2461. @items_window1.active = true
  2462. elsif Input.trigger?(Input::C)
  2463. if $game_party.item_number(@item.id) == 0
  2464. $game_system.se_play($data_system.buzzer_se)
  2465. return
  2466. end
  2467. if @target_windows[0].index == -2
  2468. used = false
  2469. $game_party.actors.each {|actor| used |= actor.item_effect(@item)}
  2470. elsif @target_index >= 0
  2471. used = $game_party.actors[@target_index].item_effect(@item)
  2472. end
  2473. if used
  2474. $game_system.se_play(@item.menu_se)
  2475. if @item.consumable
  2476. $game_party.lose_item(@item.id, 1)
  2477. @items_window1.draw_item(@items_window1.index)
  2478. end
  2479. (@status_windows + @target_windows).each {|win| win.refresh}
  2480. if $game_party.all_dead?
  2481. @scene = Scene_Gameover.new
  2482. elsif @item.common_event_id > 0
  2483. $game_temp.common_event_id = @item.common_event_id
  2484. @scene = Scene_Map.new
  2485. end
  2486. else
  2487. $game_system.se_play($data_system.buzzer_se)
  2488. end
  2489. else
  2490. update_target
  2491. end
  2492. end
  2493.  
  2494. def update_target
  2495. return if @target_windows[0] == nil || @target_windows[0].index == -2
  2496. if Input.repeat?(Input::DOWN)
  2497. $game_system.se_play($data_system.cursor_se)
  2498. @target_index = (@target_index+1) % $game_party.actors.size
  2499. if @target_windows[@target_index].y < 64
  2500. @target_windows.each {|win| win.y += ($game_party.actors.size-4)*104}
  2501. elsif @target_windows[@target_index].y >= 480
  2502. @target_windows.each {|win| win.dir = 1}
  2503. end
  2504. elsif Input.repeat?(Input::UP)
  2505. $game_system.se_play($data_system.cursor_se)
  2506. @target_index += $game_party.actors.size-1
  2507. @target_index %= $game_party.actors.size
  2508. if @target_windows[@target_index].y < 64
  2509. @target_windows.each {|win| win.dir = -1}
  2510. elsif @target_windows[@target_index].y >= 480
  2511. @target_windows.each {|win| win.y -= ($game_party.actors.size-4)*104}
  2512. end
  2513. end
  2514. end
  2515.  
  2516. def update_skill
  2517. if Input.trigger?(Input::B)
  2518. del_skill
  2519. $game_system.se_play($data_system.cancel_se)
  2520. @help_window.x, @help_window.y = 0, -768
  2521. @help_window.visible = false
  2522. @command_window.active = true
  2523. @actor_index = @target_index = -1
  2524. elsif Input.trigger?(Input::C)
  2525. @skill = @skill_window.data
  2526. if @skill == nil || !@actor.skill_can_use?(@skill.id)
  2527. $game_system.se_play($data_system.buzzer_se)
  2528. return
  2529. end
  2530. $game_party.actors.each_index {|i|
  2531. @target_windows.push(Window_CMSTarget.new($game_party.actors[i]))}
  2532. @target_index = 0
  2533. $game_system.se_play($data_system.decision_se)
  2534. if @skill.scope.between?(3, 6)
  2535. @skill_window.active = false
  2536. @target_windows.each {|win| win.visible = win.active = true}
  2537. if [4, 6].include?(@skill.scope)
  2538. @target_windows.each {|win| win.index = -2}
  2539. else
  2540. @target_windows[@target_index].index = 0
  2541. end
  2542. elsif @skill.common_event_id > 0
  2543. $game_temp.common_event_id = @skill.common_event_id
  2544. $game_system.se_play(@skill.menu_se)
  2545. @actor.sp -= @skill.sp_cost
  2546. (@status_windows + @target_windows).each {|win| win.refresh}
  2547. @skill_window.refresh
  2548. @scene = Scene_Map.new
  2549. elsif @skill.scope == 7
  2550. $game_system.se_play($data_system.buzzer_se)
  2551. end
  2552. elsif Input.trigger?(Input::R) || Input.trigger?(Input::L)
  2553. $game_system.se_play($data_system.cursor_se)
  2554. if Input.trigger?(Input::R)
  2555. @actor_index = (@actor_index+1) % $game_party.actors.size
  2556. elsif Input.trigger?(Input::L)
  2557. @actor_index += $game_party.actors.size-1
  2558. @actor_index %= $game_party.actors.size
  2559. end
  2560. @actor = $game_party.actors[@actor_index]
  2561. @skill_window.update_actor(@actor)
  2562. @skill_window.index = 0
  2563. end
  2564. end
  2565.  
  2566. def update_skill_target
  2567. if Input.trigger?(Input::B)
  2568. del_target
  2569. $game_system.se_play($data_system.cancel_se)
  2570. @skill_window.active = true
  2571. @target_index = -1
  2572. elsif Input.trigger?(Input::C)
  2573. unless @actor.skill_can_use?(@skill.id)
  2574. $game_system.se_play($data_system.buzzer_se)
  2575. return
  2576. end
  2577. if @target_windows[0].index == -2
  2578. used = false
  2579. $game_party.actors.each {|actor| used |= actor.skill_effect(@actor, @skill)}
  2580. else
  2581. used = $game_party.actors[@target_index].skill_effect(@actor, @skill)
  2582. end
  2583. if used
  2584. $game_system.se_play(@skill.menu_se)
  2585. @actor.sp -= @skill.sp_cost
  2586. (@status_windows + @target_windows).each {|win| win.refresh}
  2587. @skill_window.refresh
  2588. if $game_party.all_dead?
  2589. @scene = Scene_Gameover.new
  2590. elsif @skill.common_event_id > 0
  2591. $game_temp.common_event_id = @skill.common_event_id
  2592. @scene = Scene_Map.new
  2593. end
  2594. else
  2595. $game_system.se_play($data_system.buzzer_se)
  2596. end
  2597. else
  2598. update_target
  2599. end
  2600. end
  2601.  
  2602. def update_right_equip
  2603. @item_windows.each_index {|i|
  2604. @item_windows[i].visible = (@right_window.index == i)}
  2605. @item_window = @item_windows[@right_window.index]
  2606. newmode = [@right_window.index, 1].min
  2607. if newmode != @left_window.mode
  2608. @left_window.mode = newmode
  2609. @left_window.refresh
  2610. end
  2611. if Input.trigger?(Input::B)
  2612. del_equip
  2613. $game_system.se_play($data_system.cancel_se)
  2614. @help_window.x, @help_window.y = 660, 0
  2615. @command_window.active = true
  2616. @actor_index = -1
  2617. elsif Input.trigger?(Input::C)
  2618. if @actor.equip_fix?(@right_window.index)
  2619. $game_system.se_play($data_system.buzzer_se)
  2620. #=============================
  2621. #elsif Input.trigger?(Input::C)
  2622. #if @actor.equip_fix?(@right_window.index)
  2623. #$game_system.se_play($data_system.buzzer_se)
  2624. else
  2625. $game_system.se_play($data_system.decision_se)
  2626. @right_window.active = false
  2627. @item_window.active, @item_window.index = true, 0
  2628. equip_refresh
  2629. end
  2630. elsif false #Input.trigger?(Input::R) || Input.trigger?(Input::L)
  2631. $game_system.se_play($data_system.cursor_se)
  2632. if Input.trigger?(Input::R)
  2633. @actor_index = (@actor_index+1) % $game_party.actors.size
  2634. elsif Input.trigger?(Input::L)
  2635. @actor_index += $game_party.actors.size-1
  2636. @actor_index %= $game_party.actors.size
  2637. end
  2638. @actor = $game_party.actors[@actor_index]
  2639. @right_window.update_actor(@actor)
  2640. @left_window.update_actor(@actor)
  2641. @item_windows.each_index {|i| @item_windows[i].update_actor(@actor, i)}
  2642. elsif Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
  2643. element_states_refresh
  2644. end
  2645. end
  2646.  
  2647. def update_eitem
  2648. if Input.trigger?(Input::B)
  2649. $game_system.se_play($data_system.cancel_se)
  2650. @right_window.active = true
  2651. @item_window.active, @item_window.index = false, -1
  2652. equip_refresh
  2653. elsif Input.trigger?(Input::C)
  2654. $game_system.se_play($data_system.equip_se)
  2655. item = @item_window.data
  2656. @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  2657. @right_window.active = true
  2658. @item_window.active, @item_window.index = false, -1
  2659. @right_window.refresh
  2660. @item_window.refresh
  2661. (@item_windows + @status_windows).each {|win| win.refresh}
  2662. equip_refresh
  2663. elsif Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN) ||
  2664. Input.repeat?(Input::R) || Input.repeat?(Input::L)
  2665. equip_refresh
  2666. end
  2667. end
  2668.  
  2669. def update_playerstatus
  2670. if Input.trigger?(Input::B)
  2671. $game_system.se_play($data_system.cancel_se)
  2672. @command_window.active = true
  2673. @actor_index = -1
  2674. del_status
  2675. elsif Input.trigger?(Input::R) || Input.trigger?(Input::RIGHT) ||
  2676. Input.trigger?(Input::L) || Input.trigger?(Input::LEFT)
  2677. $game_system.se_play($data_system.cursor_se)
  2678. if Input.trigger?(Input::R) || Input.trigger?(Input::RIGHT)
  2679. @actor_index = (@actor_index+1) % $game_party.actors.size
  2680. elsif Input.trigger?(Input::L) || Input.trigger?(Input::LEFT)
  2681. @actor_index += $game_party.actors.size-1
  2682. @actor_index %= $game_party.actors.size
  2683. end
  2684. @actor = $game_party.actors[@actor_index]
  2685. @playerstatus_window.update_actor(@actor)
  2686. end
  2687. end
  2688.  
  2689. def update_options
  2690. if Input.trigger?(Input::B)
  2691. del_options
  2692. $game_system.se_play($data_system.cancel_se)
  2693. @command_window.active = true
  2694. return
  2695. end
  2696. case @options_window.get_option
  2697. when 'BGM Volume'
  2698. if Input.repeat?(Input::RIGHT)
  2699. $game_system.bgm_volume += 5
  2700. $game_system.bgm_volume = 100 if $game_system.bgm_volume > 100
  2701. $game_system.bgm_play($game_system.bgm_memorize)
  2702. @options_window.refresh
  2703. elsif Input.repeat?(Input::LEFT)
  2704. $game_system.bgm_volume -= 5
  2705. $game_system.bgm_volume = 0 if $game_system.bgm_volume < 0
  2706. $game_system.bgm_play($game_system.bgm_memorize)
  2707. @options_window.refresh
  2708. end
  2709. when 'SFX Volume'
  2710. if Input.repeat?(Input::RIGHT)
  2711. $game_system.sfx_volume += 5
  2712. if $game_system.sfx_volume > 100
  2713. $game_system.sfx_volume = 100
  2714. else
  2715. $game_system.se_play($data_system.cursor_se)
  2716. end
  2717. @options_window.refresh
  2718. elsif Input.repeat?(Input::LEFT)
  2719. $game_system.sfx_volume -= 5
  2720. $game_system.sfx_volume = 0 if $game_system.sfx_volume < 0
  2721. $game_system.se_play($data_system.cursor_se)
  2722. @options_window.refresh
  2723. end
  2724. when 'Battle BGM'
  2725. if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT) ||
  2726. Input.repeat?(Input::C)
  2727. if $game_switches[BlizzCFG::BGM_Lock] || BlizzCFG::BATTLE_BGMS.size <= 1
  2728. $game_system.se_play($data_system.buzzer_se)
  2729. else
  2730. $game_system.se_play($data_system.decision_se)
  2731. ind = $game_variables[BlizzCFG::BGM_Variable]
  2732. if Input.repeat?(Input::RIGHT) || Input.repeat?(Input::C)
  2733. ind = (ind+1) % BlizzCFG::BATTLE_BGMS.size
  2734. elsif Input.repeat?(Input::LEFT)
  2735. ind = (ind+BlizzCFG::BATTLE_BGMS.size-1) % BlizzCFG::BATTLE_BGMS.size
  2736. end
  2737. $game_variables[BlizzCFG::BGM_Variable] = ind
  2738. $game_system.reset_battle_bgm
  2739. @options_window.refresh
  2740. end
  2741. end
  2742. when 'Battle Cam'
  2743. if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT) ||
  2744. Input.repeat?(Input::C)
  2745. if BlizzCFG::CAM_AVAILABLE
  2746. $game_system.se_play($data_system.decision_se)
  2747. $game_system.cam = ($game_system.cam+1) % 2
  2748. $game_system.get_cam
  2749. @options_window.refresh
  2750. else
  2751. $game_system.se_play($data_system.buzzer_se)
  2752. end
  2753. end
  2754. when 'Bar Style'
  2755. if Input.repeat?(Input::RIGHT)
  2756. if $game_system.bar_opacity == 0
  2757. $game_system.se_play($data_system.buzzer_se)
  2758. else
  2759. $game_system.bar_style = ($game_system.bar_style + 1) % 7
  2760. $game_system.se_play($data_system.decision_se)
  2761. @options_window.refresh
  2762. @status_windows.each {|win| win.refresh}
  2763. end
  2764. elsif Input.repeat?(Input::LEFT)
  2765. if $game_system.bar_opacity == 0
  2766. $game_system.se_play($data_system.buzzer_se)
  2767. else
  2768. $game_system.bar_style = ($game_system.bar_style + 6) % 7
  2769. $game_system.se_play($data_system.decision_se)
  2770. @options_window.refresh
  2771. @status_windows.each {|win| win.refresh}
  2772. end
  2773. end
  2774. when 'Bar Opacity'
  2775. if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)
  2776. $game_system.se_play($data_system.decision_se)
  2777. $game_system.bar_opacity += (Input.repeat?(Input::RIGHT) ? 64 : -64)
  2778. @options_window.refresh
  2779. @status_windows.each {|win| win.refresh}
  2780. end
  2781. when 'Font'
  2782. if Input.repeat?(Input::RIGHT)
  2783. $game_system.se_play($data_system.decision_se)
  2784. @options_window.current_font += 1
  2785. @options_window.current_font %= BlizzCFG::CMS_FONTS.size
  2786. @options_window.refresh
  2787. elsif Input.repeat?(Input::LEFT)
  2788. $game_system.se_play($data_system.decision_se)
  2789. @options_window.current_font += BlizzCFG::CMS_FONTS.size - 1
  2790. @options_window.current_font %= BlizzCFG::CMS_FONTS.size
  2791. @options_window.refresh
  2792. elsif Input.repeat?(Input::C)
  2793. $game_system.se_play($data_system.decision_se)
  2794. $game_system.fontname = @options_window.font_name
  2795. @command_window.refresh
  2796. @info_window.refresh
  2797. @status_windows.each {|win| win.refresh}
  2798. @help_window.refresh
  2799. @options_window.refresh
  2800. (0...5).each {|i| @command_window.disable_item(i)} if $game_party.actors.size == 0
  2801. @command_window.disable_item(6) if $game_system.save_disabled
  2802. @command_window.disable_item(7) unless @command_window.continue
  2803. end
  2804. when 'Windowskin'
  2805. if Input.repeat?(Input::RIGHT)
  2806. $game_system.se_play($data_system.decision_se)
  2807. @options_window.current_skin += 1
  2808. @options_window.current_skin %= BlizzCFG::CMS_SKINS.size
  2809. @options_window.refresh
  2810. elsif Input.repeat?(Input::LEFT)
  2811. $game_system.se_play($data_system.decision_se)
  2812. @options_window.current_skin += BlizzCFG::CMS_SKINS.size - 1
  2813. @options_window.current_skin %= BlizzCFG::CMS_SKINS.size
  2814. @options_window.refresh
  2815. elsif Input.repeat?(Input::C)
  2816. $game_system.se_play($data_system.decision_se)
  2817. $game_system.windowskin_name = @options_window.skin_name
  2818. end
  2819. end
  2820. end
  2821.  
  2822. def update_end
  2823. if Input.trigger?(Input::B) || Input.trigger?(Input::C) &&
  2824. @end_window.index == 0
  2825. $game_system.se_play($data_system.cancel_se)
  2826. @command_window.active = true
  2827. del_end
  2828. elsif Input.trigger?(Input::C)
  2829. Graphics.freeze
  2830. $game_system.se_play($data_system.decision_se)
  2831. Audio.bgm_fade(800)
  2832. Audio.bgs_fade(800)
  2833. Audio.me_fade(800)
  2834. @end_window.index == 1 ? @scene = Scene_Title.new : $scene = nil
  2835. del_end
  2836. end
  2837. end
  2838.  
  2839. end
  2840.  
  2841. #==============================================================================
  2842. # Scene_CMSSave
  2843. #==============================================================================
  2844.  
  2845. class Scene_CMSSave < Scene_Save
  2846.  
  2847. def on_cancel
  2848. $game_system.se_play($data_system.cancel_se)
  2849. $scene = Scene_Menu.new(6)
  2850. end
  2851.  
  2852. end
  2853.  
  2854. #==============================================================================
  2855. # Scene_CMSLoad
  2856. #==============================================================================
  2857.  
  2858. class Scene_CMSLoad < Scene_Load
  2859.  
  2860. def on_cancel
  2861. $game_system.se_play($data_system.cancel_se)
  2862. $scene = Scene_Menu.new(7)
  2863. end
  2864.  
  2865. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement