├── LICENSE ├── MultiTweaks.js └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 ScSWinter 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MultiTweaks.js: -------------------------------------------------------------------------------- 1 | /*: 2 | * @target MZ 3 | * @plugindesc [MultiTweaks] [v1.8.0] [General, map, zoom, battle, audio, options...] 4 | * @author ScSWinter (other contributors: Arthran) 5 | * 6 | * @help 7 | * ======================================================= 8 | * Information 9 | * ======================================================= 10 | * This script allows you to incorporate many improvements 11 | * to your game. Most of the options are self-explanatory. 12 | * In this section we will explain these features: 13 | * - Enemies use actor classes (enemy notetag). 14 | * - Map zoom (map notetag and event plugin command). 15 | * 16 | * -------------- Enemies use actor classes -------------- 17 | * When activated the power of the enemies are scaled using 18 | * actor classes. Specify the actor class using in the enemy 19 | * notetag box the notetag 20 | * EnemyRole:X 21 | * where X is the number of the actor class. If it's not 22 | * specified the default enemy stats will be used. Note 23 | * that, in order to allow boss-enemy types, the HP stat 24 | * is always multiplied by 10. 25 | * 26 | * ---------------------- Map zoom ----------------------- 27 | * This script allows you to show maps with a default zoom. 28 | * When activated the zoom of the map changes. Specify the 29 | * map zoom using in the map notetag box the notetag 30 | * Zoom:X 31 | * where X is a number greater than 1. If the notetag is not 32 | * specified the default zoom is the one at the options. 33 | * 34 | * You also have a [plugin command] usable in events to create 35 | * dinamically zoom effects. Note that enter in the menu will 36 | * reset the zoom to the map default one. 37 | * 38 | * Fixes by Arthran: 39 | * I have edited this plugin to fix the camera issue. It 40 | * is no longer necessary to use free camera with the zoom. 41 | * If the "Always Free Camera" option is set to "False", 42 | * then the camera will now behave normally when zoomed. 43 | * I have also fixed some bugs that were causing the camera 44 | * to potentially become increasingly un-centered during 45 | * map transfers. My edit has the same license (MIT) as the 46 | * original, so feel free to do whatever you want with it. 47 | * 48 | * ---- Compatibility with VisuStella Options Script ---- 49 | * If you use VisuMZ Options Script, the options section of 50 | * this script won't work, but it won't interfere with the 51 | * VisuMZ Options Script. All changes to options must be done 52 | * from their script (and, as I know, all can be done). 53 | * 54 | * Optimization game option: If you use VisuMZ Options, you 55 | * need to add the option from their script using the symbol 56 | * optimGame. To do so, you can copy and modify an ON/OFF option. 57 | * 58 | * ======================================================= 59 | * Credits 60 | * ======================================================= 61 | * Please, credit to "ScSWinter" in the credits of your game. 62 | * 63 | * ======================================================= 64 | * License: The MIT License 65 | * ======================================================= 66 | * Copyright 2020 ScSWinter 67 | * This plugin is released under MIT license. 68 | * http://opensource.org/licenses/mit-license.php 69 | * 70 | * 71 | * @param --- General --- 72 | * @desc 73 | * 74 | * @param Start in fullscreen mode 75 | * @type boolean 76 | * @parent --- General --- 77 | * @on Yes 78 | * @off No 79 | * @desc Start in fullscreen mode? Only in nwjs. 80 | * @default true 81 | * 82 | * @param Optimize game 83 | * @type boolean 84 | * @parent --- General --- 85 | * @on Yes 86 | * @off No 87 | * @desc Render only half of computed frames to speedup 88 | * the game with almost no visible drawback. 89 | * @default true 90 | * 91 | * @param Add option (optimGame) 92 | * @type text 93 | * @parent Optimize game 94 | * @desc Leave it blank for not do it. If you use VisuMZ Options, 95 | * you need to add the option from their script. 96 | * @default Improve performance 97 | * 98 | * @param Effekseer frame skip 99 | * @type number 100 | * @parent Optimize game 101 | * @min 2 102 | * @max 999999 103 | * @desc % of frames skipped during Effekseer. 2 half, 3 104 | * one third, etc, 999999 to disable (default 2). 105 | * @default 2 106 | * 107 | * @param Battle frame skip 108 | * @type number 109 | * @parent Optimize game 110 | * @min 2 111 | * @max 999999 112 | * @desc % of frames skipped during Battle. 2 half, 3 113 | * one third, etc, 999999 to disable (default 3). 114 | * @default 3 115 | * 116 | * @param General frame skip 117 | * @type number 118 | * @parent Optimize game 119 | * @min 2 120 | * @max 999999 121 | * @desc % of frames skipped in general. 2 half, 3 122 | * one third, etc, 999999 to disable (default 6). 123 | * @default 6 124 | * 125 | * @param Blink selection effect 126 | * @type boolean 127 | * @parent --- General --- 128 | * @on Yes 129 | * @off No 130 | * @desc Show the blink selection effect? 131 | * @default false 132 | * 133 | * @param Disable F5 and F8 134 | * @type boolean 135 | * @parent --- General --- 136 | * @on Yes 137 | * @off No 138 | * @desc Disable F5 and F8 buttons? 139 | * @default true 140 | * 141 | * @param Disable FastFoward 142 | * @type boolean 143 | * @parent --- General --- 144 | * @on Yes 145 | * @off No 146 | * @desc Disable FastFoward? 147 | * @default true 148 | * 149 | * @param Disable scrollbars 150 | * @type boolean 151 | * @parent --- General --- 152 | * @on Yes 153 | * @off No 154 | * @desc Disable scrollbars? 155 | * @default true 156 | * 157 | * @param Pixel rendering 158 | * @parent --- General --- 159 | * @type boolean 160 | * @on Yes 161 | * @off No 162 | * @desc Render the entire game pixelated? 163 | * @default false 164 | * 165 | * @param Extreme pixel rendering 166 | * @parent Pixel rendering 167 | * @type boolean 168 | * @on Yes 169 | * @off No 170 | * @desc Render pixelated also fonts and windows? 171 | * @default false 172 | * 173 | * @param --- Map --- 174 | * @desc 175 | * 176 | * @param Tilemap animation speed 177 | * @type number 178 | * @parent --- Map --- 179 | * @min 1 180 | * @max 3 181 | * @desc Auto-tiles tilemap animation speed (default 2). 182 | * @default 2 183 | * 184 | * @param Default zoom for maps 185 | * @parent --- Map --- 186 | * @type number 187 | * @min 1.00 188 | * @max 9.00 189 | * @decimals 2 190 | * @desc The default zoom when none is specified as notetag. 191 | * @default 1 192 | * 193 | * @param Fix sprite black lines 194 | * @parent Default zoom for maps 195 | * @type boolean 196 | * @on Yes 197 | * @off No 198 | * @desc Fix sprite black lines? This option will cut the 199 | * sprites one pixel in each side. 200 | * @default true 201 | * 202 | * @param Fix map encounter zoom 203 | * @parent Default zoom for maps 204 | * @type boolean 205 | * @on Yes 206 | * @off No 207 | * @desc Fix map encounter zoom? Deactivate this option if 208 | * you changed the default encounter zoom effect. 209 | * @default true 210 | * 211 | * @param Always free camera 212 | * @type boolean 213 | * @parent --- Map --- 214 | * @on Yes 215 | * @off No 216 | * @desc When activated, the camera will never be blocked by 217 | * the edges of the map (as it works with the zoom on). 218 | * @default false 219 | * 220 | * @command Zoom 221 | * @text Zoom 222 | * @desc Custom. display and vanish without wait. 223 | * 224 | * @arg FramesToZoom 225 | * @text Frames to Zoom 226 | * @desc The number of frames needed to perform the zoom. 227 | * @type number 228 | * @default 1 229 | * @min 1 230 | * @max 300 231 | * 232 | * @arg ZoomValue 233 | * @text Zoom Value 234 | * @desc The zoom value that will be performed. 235 | * @type number 236 | * @min 1.00 237 | * @max 9.00 238 | * @decimals 2 239 | * @default 1.50 240 | * 241 | * @param --- Options --- 242 | * @desc 243 | * 244 | * @param Options ON text 245 | * @type text 246 | * @parent --- Options --- 247 | * @desc Text for ON, shown in options menu. 248 | * If you use VisuMZ Options Script it won't work. 249 | * @default Yes 250 | * 251 | * @param Options OFF text 252 | * @type text 253 | * @parent --- Options --- 254 | * @desc Text for OFF, shown in options menu. 255 | * If you use VisuMZ Options Script it won't work. 256 | * @default No 257 | * 258 | * @param Remove general options 259 | * @type string[] 260 | * @parent --- Options --- 261 | * @desc Remove options from the menu using their symbol. 262 | * If you use VisuMZ Options Script leave it in blank. 263 | * @default ["touchUI"] 264 | * 265 | * @param Default ON options 266 | * @type string[] 267 | * @parent --- Options --- 268 | * @desc Activate by default the options using their symbol. 269 | * If you use VisuMZ Options Script leave it in blank. 270 | * @default ["alwaysDash", "touchUI"] 271 | * 272 | * @param Default OFF options 273 | * @type string[] 274 | * @parent --- Options --- 275 | * @desc Deactivate by default the options using their symbol. 276 | * If you use VisuMZ Options Script leave it in blank. 277 | * @default ["commandRemember"] 278 | * 279 | * @param Add a global volume 280 | * @type boolean 281 | * @parent --- Options --- 282 | * @on Yes 283 | * @off No 284 | * @desc Add a global volume control on the options window. 285 | * If you use VisuMZ Options Script leave it to false. 286 | * @default true 287 | * 288 | * @param Remove secondary volumes 289 | * @type boolean 290 | * @parent Add a global volume 291 | * @on Yes 292 | * @off No 293 | * @desc Remove secondary volume controls from options window. 294 | * If you use VisuMZ Options Script it won't work. 295 | * @default true 296 | * 297 | * @param Use quadratic volume 298 | * @type boolean 299 | * @parent Add a global volume 300 | * @on Yes 301 | * @off No 302 | * @desc Improve perception, when the volume is changed, using 303 | * a quadratic function. 304 | * @default true 305 | * 306 | * @param Global volume name 307 | * @parent Add a global volume 308 | * @desc The name that will have the global menu option. 309 | * @default Volume 310 | * 311 | * @param --- Battle --- 312 | * @desc 313 | * 314 | * @param Weather in battle 315 | * @type boolean 316 | * @parent --- Battle --- 317 | * @on Yes 318 | * @off No 319 | * @desc Show the current weather in battle? 320 | * @default true 321 | * 322 | * @param Auto select targets 323 | * @type boolean 324 | * @parent --- Battle --- 325 | * @on Yes 326 | * @off No 327 | * @desc Auto select targets in battle? Only when 328 | * there is one enemy/actor or target all. 329 | * @default true 330 | * 331 | * @param Heal on level up 332 | * @parent --- Battle --- 333 | * @on Yes 334 | * @off No 335 | * @desc Heal actors on level up? 336 | * @default true 337 | * 338 | * @param Actor battler zoom 339 | * @parent --- Battle --- 340 | * @type number 341 | * @min 1.00 342 | * @max 3.00 343 | * @decimals 2 344 | * @desc The actor battler zoom, if desired. 345 | * @default 1.00 346 | * 347 | * @param Center battler animations 348 | * @parent Actor battler zoom 349 | * @type boolean 350 | * @on Yes 351 | * @off No 352 | * @desc Center animations over the scaled battler? 353 | * @default true 354 | * 355 | * @param Enemies use actor classes 356 | * @type boolean 357 | * @parent --- Battle --- 358 | * @on Yes 359 | * @off No 360 | * @desc Scale the power of the enemies using actor classes? 361 | * @default false 362 | * 363 | * @param Enemy experience 364 | * @type select 365 | * @option Enemy value 366 | * @option Next-level class value 367 | * @option Enemy value x Level 368 | * @parent Enemies use actor classes 369 | * @desc Scale the power of the enemies using actor classes? 370 | * @default Enemy value x Level 371 | * 372 | * @param Gold obtained 373 | * @type select 374 | * @option Enemy value 375 | * @option Next-level class value 376 | * @option Enemy value x Level 377 | * @parent Enemies use actor classes 378 | * @desc Scale the power of the enemies using actor classes? 379 | * @default Enemy value x Level 380 | * 381 | * @param --- Audio --- 382 | * @desc 383 | * 384 | * @param Stop out-focus audio 385 | * @type boolean 386 | * @parent --- Audio --- 387 | * @on Yes 388 | * @off No 389 | * @desc Stop audio when the game is out focus? 390 | * @default true 391 | * 392 | * @param Force map bgm and bgs 393 | * @type struct[] 394 | * @parent --- Audio --- 395 | * @desc Force to play a specified Bgm and Bgs when a 396 | * switch is ON. 397 | * @default [] 398 | * 399 | * @param Cache of used audios 400 | * @type boolean 401 | * @parent --- Audio --- 402 | * @on Yes 403 | * @off No 404 | * @desc Store in cache the recently used audio files? 405 | * Deactivate this if you use MUSH Audio engine. 406 | * @default true 407 | * 408 | * @param BGM cache size 409 | * @type number 410 | * @parent Cache of used audios 411 | * @min 2 412 | * @max 12 413 | * @desc Maximum number of BGM stored (default 7). 414 | * Increase this number reduces lag but increases memory. 415 | * @default 7 416 | * 417 | * @param BGS cache size 418 | * @type number 419 | * @parent Cache of used audios 420 | * @min 2 421 | * @max 12 422 | * @desc Maximum number of BGS stored (default 5). 423 | * Increase this number reduces lag but increases memory. 424 | * @default 5 425 | * 426 | * @param ME cache size 427 | * @type number 428 | * @parent Cache of used audios 429 | * @min 2 430 | * @max 12 431 | * @desc Maximum number of ME stored (default 3). 432 | * Increase this number reduces lag but increases memory. 433 | * @default 3 434 | * 435 | * @param SE cache size 436 | * @type number 437 | * @parent Cache of used audios 438 | * @min 5 439 | * @max 40 440 | * @desc Maximum number of SE stored (default 20). 441 | * Increase this number reduces lag but increases memory. 442 | * @default 20 443 | * 444 | * @param Preemptive event cache 445 | * @type boolean 446 | * @parent Cache of used audios 447 | * @on Yes 448 | * @off No 449 | * @desc Store in cache audios that may be used in events in 450 | * the future? Requires "Yes" in "Cache of used audios". 451 | * @default true 452 | * 453 | * @param Preemptive battle cache 454 | * @type boolean 455 | * @parent Cache of used audios 456 | * @on Yes 457 | * @off No 458 | * @desc Store in cache audios that may be used in battle in 459 | * the future? Requires "Yes" in "Cache of used audios". 460 | * @default true 461 | * 462 | * @param Preemp. boot/map cache 463 | * @type boolean 464 | * @parent Cache of used audios 465 | * @on Yes 466 | * @off No 467 | * @desc Store in cache audios as soon as possible in boot and 468 | * map changes? Requires "Yes" in "Cache of used audios". 469 | * @default true 470 | * 471 | */ 472 | /*~struct~MapSoundForced: 473 | * @param Switch Id 474 | * @type switch 475 | * @desc Mandatory. When this switch is ON, the plugin will force 476 | * all maps to play the Bgm and Bgs specified. 477 | * 478 | * @param Play Bgm 479 | * @type file 480 | * @dir audio/bgm/ 481 | * @require 1 482 | * @desc The Bgm to play when the switch is ON. 483 | * Leave blank to mantain the map Bgm. 484 | * 485 | * @param Play Bgs 486 | * @type file 487 | * @dir audio/bgs/ 488 | * @require 1 489 | * @desc The Bgs to play when the switch is ON. 490 | * Leave blank to mantain the map Bgs. 491 | * 492 | */ 493 | 494 | /*==================================================== 495 | PART: Tweaks Plugin 496 | ====================================================*/ 497 | (function () { 498 | "use strict"; 499 | window.ScSWinter = window.ScSWinter || {}; 500 | if (!("params" in ScSWinter)) { 501 | ScSWinter.params = PluginManager.parameters("MultiTweaks"); 502 | } 503 | 504 | Graphics._defaultStretchMode = function () { 505 | return true; 506 | }; 507 | ScSWinter.Scene_Boot_start_focus = Scene_Boot.prototype.start; 508 | Scene_Boot.prototype.start = function () { 509 | ScSWinter.Scene_Boot_start_focus.call(this); 510 | if (Utils.isNwjs()) { 511 | var win = nw.Window.get(); 512 | win.show(true); 513 | win.focus(); 514 | window.focus(); 515 | } 516 | }; 517 | 518 | ScSWinter.WeatherBattle = ScSWinter.params["Weather in battle"] == "true"; 519 | if (ScSWinter.WeatherBattle) { 520 | ScSWinter.Spriteset_Battle_createLowerLayer = Spriteset_Battle.prototype.createLowerLayer; 521 | Spriteset_Battle.prototype.createLowerLayer = function () { 522 | ScSWinter.Spriteset_Battle_createLowerLayer.call(this); 523 | this._weather = new Weather(); 524 | this.addChild(this._weather); 525 | }; 526 | ScSWinter.Spriteset_Battle_update = Spriteset_Battle.prototype.update; 527 | Spriteset_Battle.prototype.update = function () { 528 | ScSWinter.Spriteset_Battle_update.call(this); 529 | this._weather.power = $gameScreen.weatherPower(); 530 | this._weather.type = $gameScreen.weatherType(); 531 | }; 532 | } 533 | 534 | ScSWinter.BlinkSelection = ScSWinter.params["Blink selection effect"] == "true"; 535 | if (!ScSWinter.BlinkSelection) { 536 | Window.prototype._makeCursorAlpha = function () { 537 | return this.contentsOpacity / 255; 538 | }; 539 | } 540 | 541 | ScSWinter.OptionON = ScSWinter.params["Options ON text"] || "Yes"; 542 | ScSWinter.OptionOFF = ScSWinter.params["Options OFF text"] || "No"; 543 | Window_Options.prototype.booleanStatusText = function (value) { 544 | return value ? ScSWinter.OptionON : ScSWinter.OptionOFF; 545 | }; 546 | 547 | ScSWinter.DisableF58 = ScSWinter.params["Disable F5 and F8"] == "true"; 548 | if (ScSWinter.DisableF58) { 549 | SceneManager.onKeyDown = function (event) {}; 550 | } 551 | 552 | ScSWinter.Graphics_isFullScreen = Graphics._isFullScreen; 553 | Graphics._isFullScreen = function () { 554 | if (Utils.isNwjs()) { 555 | var win = nw.Window.get(); 556 | return win.isFullscreen; 557 | } else { 558 | return ScSWinter.Graphics_isFullScreen.call(this); 559 | } 560 | }; 561 | ScSWinter.Graphics_requestFullScreen = Graphics._requestFullScreen; 562 | Graphics._requestFullScreen = function () { 563 | if (Graphics._isFullScreen()) return; 564 | if (Utils.isNwjs()) { 565 | var win = nw.Window.get(); 566 | win.enterFullscreen(); 567 | } else { 568 | ScSWinter.Graphics_requestFullScreen.call(this); 569 | } 570 | }; 571 | ScSWinter.Graphics_cancelFullScreen = Graphics._cancelFullScreen; 572 | Graphics._cancelFullScreen = function () { 573 | if (Utils.isNwjs()) { 574 | var win = nw.Window.get(); 575 | win.leaveFullscreen(); 576 | } else { 577 | ScSWinter.Graphics_cancelFullScreen.call(this); 578 | } 579 | }; 580 | 581 | ScSWinter.StartFullScreen = ScSWinter.params["Start in fullscreen mode"] == "true"; 582 | if (Utils.isNwjs() && ScSWinter.StartFullScreen) { 583 | ScSWinter.Scene_Boot_start = Scene_Boot.prototype.start; 584 | Scene_Boot.prototype.start = function () { 585 | ScSWinter.Scene_Boot_start.call(this); 586 | Graphics._requestFullScreen(); 587 | }; 588 | } 589 | 590 | try { 591 | ScSWinter.DefaultON = JSON.parse(ScSWinter.params["Default ON options"]) || JSON.parse("[]"); 592 | } catch (e) { 593 | ScSWinter.DefaultON = []; 594 | } 595 | if (ScSWinter.DefaultON.length > 0) { 596 | for (var i = 0; i < ScSWinter.DefaultON.length; i++) { 597 | ConfigManager[ScSWinter.DefaultON[i]] = true; 598 | } 599 | } 600 | 601 | try { 602 | ScSWinter.DefaultOFF = JSON.parse(ScSWinter.params["Default OFF options"]) || JSON.parse("[]"); 603 | } catch (e) { 604 | ScSWinter.DefaultOFF = []; 605 | } 606 | if (ScSWinter.DefaultOFF.length > 0) { 607 | for (var i = 0; i < ScSWinter.DefaultOFF.length; i++) { 608 | ConfigManager[ScSWinter.DefaultOFF[i]] = false; 609 | } 610 | } 611 | 612 | try { 613 | ScSWinter.RemoveOptions = JSON.parse(ScSWinter.params["Remove general options"]) || JSON.parse("[]"); 614 | } catch (e) { 615 | ScSWinter.RemoveOptions = []; 616 | } 617 | if (ScSWinter.RemoveOptions.length > 0) { 618 | ScSWinter.Window_Options_addGeneralOptions = Window_Options.prototype.addGeneralOptions; 619 | Window_Options.prototype.addGeneralOptions = function () { 620 | ScSWinter.Window_Options_addGeneralOptions.call(this); 621 | this._list = this._list.filter(function (item) { 622 | return !ScSWinter.RemoveOptions.includes(item.symbol); 623 | }); 624 | }; 625 | } 626 | 627 | ScSWinter.AutoSelectBattle = ScSWinter.params["Auto select targets"] == "true"; 628 | if (ScSWinter.AutoSelectBattle) { 629 | ScSWinter.Scene_Battle_startEnemySelection = Scene_Battle.prototype.startEnemySelection; 630 | Scene_Battle.prototype.startEnemySelection = function () { 631 | ScSWinter.Scene_Battle_startEnemySelection.call(this); 632 | if (this._enemyWindow.active) { 633 | var action = BattleManager.inputtingAction(); 634 | if (this._enemyWindow.maxItems() == 1 || action.isForAll()) { 635 | this.onEnemyOk(); 636 | } 637 | } 638 | }; 639 | ScSWinter.Scene_Battle_startActorSelection = Scene_Battle.prototype.startActorSelection; 640 | Scene_Battle.prototype.startActorSelection = function () { 641 | ScSWinter.Scene_Battle_startActorSelection.call(this); 642 | if (this._actorWindow.active) { 643 | var action = BattleManager.inputtingAction(); 644 | if (this._actorWindow.maxItems() == 1 || action.isForAll()) { 645 | this.onActorOk(); 646 | } 647 | } 648 | }; 649 | } 650 | 651 | ScSWinter.OptimActive = ScSWinter.params["Optimize game"] == "true"; 652 | if (ScSWinter.OptimActive) { 653 | ScSWinter.OptimOption = ScSWinter.params["Add option (optimGame)"] || ""; 654 | ConfigManager._optimGame = true; 655 | if (ScSWinter.OptimOption.length > 0) { 656 | ScSWinter.Window_Options_addGeneralOptions_2 = Window_Options.prototype.addGeneralOptions; 657 | Window_Options.prototype.addGeneralOptions = function () { 658 | ScSWinter.Window_Options_addGeneralOptions_2.call(this); 659 | this.addCommand(ScSWinter.OptimOption, "optimGame"); 660 | }; 661 | Object.defineProperty(ConfigManager, "optimGame", { 662 | get: function () { 663 | return ConfigManager._optimGame; 664 | }, 665 | set: function (value) { 666 | ConfigManager._optimGame = value; 667 | }, 668 | configurable: true 669 | }); 670 | } 671 | Graphics._skipNorm = parseInt(ScSWinter.params["General frame skip"]) || 6; 672 | Graphics._skipBatt = parseInt(ScSWinter.params["Battle frame skip"]) || 3; 673 | Graphics._skipEffe = parseInt(ScSWinter.params["Effekseer frame skip"]) || 2; 674 | Graphics._throttle = 0; 675 | Graphics._isEffect = false; 676 | Graphics._isBattle = false; 677 | Graphics._isStageX = false; 678 | ScSWinter.Graphics_onTick = Graphics._onTick; 679 | Graphics._onTick = function (deltaTime) { 680 | if (!ConfigManager._optimGame) { 681 | return ScSWinter.Graphics_onTick.call(this, deltaTime); 682 | } 683 | this._fpsCounter.startTick(); 684 | Graphics._isEffect = false; 685 | if (this._tickHandler) { 686 | this._tickHandler(deltaTime); 687 | } 688 | Graphics._isStageX = !!this._app.stage; 689 | if (Graphics._isStageX) { 690 | Graphics._isBattle = "updateBattleProcess" in SceneManager._scene; 691 | Graphics._throttle = 692 | (Graphics._throttle + 1) % 693 | (Graphics._isEffect 694 | ? Graphics._skipEffe 695 | : Graphics._isBattle 696 | ? Graphics._skipBatt 697 | : Graphics._skipNorm); 698 | } 699 | if (this._canRender()) { 700 | this._app.render(); 701 | } 702 | this._fpsCounter.endTick(); 703 | }; 704 | Graphics._canRender = function () { 705 | if (ConfigManager._optimGame) { 706 | return Graphics._isStageX ? Graphics._throttle > 0 : false; 707 | } else { 708 | return !!this._app.stage; 709 | } 710 | }; 711 | ScSWinter.Sprite_Animation_updateMain = Sprite_Animation.prototype.updateMain; 712 | Sprite_Animation.prototype.updateMain = function () { 713 | ScSWinter.Sprite_Animation_updateMain.call(this); 714 | Graphics._isEffect = true; 715 | }; 716 | } 717 | 718 | ScSWinter.DisableFF = ScSWinter.params["Disable FastFoward"] == "true"; 719 | if (ScSWinter.DisableFF) { 720 | Scene_Map.prototype.isFastForward = function () { 721 | return false; 722 | }; 723 | } 724 | 725 | ScSWinter.TilemapSpeed = parseInt(ScSWinter.params["Tilemap animation speed"]); 726 | if (ScSWinter.TilemapSpeed > 1) { 727 | Tilemap.prototype.update = function () { 728 | this.animationCount += ScSWinter.TilemapSpeed; 729 | this.animationFrame = Math.floor(this.animationCount / 30); 730 | for (const child of this.children) { 731 | if (child.update) { 732 | child.update(); 733 | } 734 | } 735 | }; 736 | } 737 | 738 | ScSWinter.FixScrollBars = ScSWinter.params["Disable scrollbars"] == "true"; 739 | if (ScSWinter.FixScrollBars) { 740 | try { 741 | document.documentElement.style.overflowX = "hidden"; 742 | document.documentElement.style.overflowY = "hidden"; 743 | document.body.style.overflowX = "hidden"; 744 | document.body.style.overflowY = "hidden"; 745 | } catch (e) {} 746 | } 747 | 748 | ScSWinter.PixelRendering = ScSWinter.params["Pixel rendering"] == "true"; 749 | ScSWinter.ExtremePixelRendering = ScSWinter.params["Extreme pixel rendering"] == "true"; 750 | ScSWinter.Graphics_updateCanvas = Graphics._updateCanvas; 751 | Graphics._updateCanvas = function () { 752 | ScSWinter.Graphics_updateCanvas.call(this); 753 | if (ScSWinter.PixelRendering) { 754 | if (ScSWinter.ExtremePixelRendering) { 755 | this._canvas.style.imageRendering = "pixelated"; 756 | this._canvas.style.webkitFontSmoothing = "none"; 757 | this._canvas.style.fontSmoothing = "none"; 758 | this._canvas.imageSmoothingEnabled = false; 759 | } 760 | PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; 761 | } else { 762 | this._canvas.style.imageRendering = "auto"; 763 | PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.LINEAR; 764 | this._canvas.imageSmoothingEnabled = true; 765 | } 766 | PIXI.settings.ROUND_PIXELS = ScSWinter.PixelRendering; 767 | }; 768 | ScSWinter.Bitmap_onLoad = Bitmap.prototype._onLoad; 769 | Bitmap.prototype._onLoad = function () { 770 | ScSWinter.Bitmap_onLoad.call(this); 771 | this._smooth = !ScSWinter.PixelRendering; 772 | this._updateScaleMode(); 773 | }; 774 | 775 | ScSWinter.BattlerZoom = parseFloat(ScSWinter.params["Actor battler zoom"]) || 1.0; 776 | ScSWinter.BattlerZoomAnim = ScSWinter.params["Center battler animations"] == "true"; 777 | if (ScSWinter.BattlerZoom > 1.0) { 778 | ScSWinter.Sprite_Actor_initMembers = Sprite_Actor.prototype.initMembers; 779 | Sprite_Actor.prototype.initMembers = function () { 780 | ScSWinter.Sprite_Actor_initMembers.call(this); 781 | this._mainSprite.scale.set(ScSWinter.BattlerZoom, ScSWinter.BattlerZoom); 782 | this._shadowSprite.scale.set(ScSWinter.BattlerZoom, ScSWinter.BattlerZoom); 783 | this._weaponSprite.scale.set(ScSWinter.BattlerZoom, ScSWinter.BattlerZoom); 784 | this._stateSprite.scale.set(ScSWinter.BattlerZoom, ScSWinter.BattlerZoom); 785 | }; 786 | Sprite_Actor.prototype.damageOffsetY = function () { 787 | return -((this.height * ScSWinter.BattlerZoom) / 2) + 48; 788 | }; 789 | Sprite_Enemy.prototype.damageOffsetY = function () { 790 | return -(this.height / 2) + 48; 791 | }; 792 | if (ScSWinter.BattlerZoomAnim) { 793 | ScSWinter.Sprite_Animation_targetSpritePosition = Sprite_Animation.prototype.targetSpritePosition; 794 | Sprite_Animation.prototype.targetSpritePosition = function (sprite) { 795 | if ("setActorHome" in sprite) { 796 | const point = new Point(0, -(sprite.height * ScSWinter.BattlerZoom) / 2); 797 | sprite.updateTransform(); 798 | return sprite.worldTransform.apply(point); 799 | } else { 800 | return ScSWinter.Sprite_Animation_targetSpritePosition.call(this, sprite); 801 | } 802 | }; 803 | } 804 | } 805 | 806 | ScSWinter.HealLevelUp = ScSWinter.params["Heal on level up"] == "true"; 807 | if (ScSWinter.HealLevelUp) { 808 | ScSWinter.Game_Actor_levelUp = Game_Actor.prototype.levelUp; 809 | Game_Actor.prototype.levelUp = function () { 810 | ScSWinter.Game_Actor_levelUp.call(this); 811 | this.recoverAll(); 812 | this.refresh(); 813 | }; 814 | } 815 | })(); 816 | 817 | /*==================================================== 818 | PART: Enemy Class MZ Plugin 819 | ====================================================*/ 820 | (function () { 821 | "use strict"; 822 | window.ScSWinter = window.ScSWinter || {}; 823 | if (!("params" in ScSWinter)) { 824 | ScSWinter.params = PluginManager.parameters("MultiTweaks"); 825 | } 826 | 827 | var s_extractNoteValue = function (notes, ntag) { 828 | var s_tags = notes.split(/[\r\n]+/), 829 | s_val = "0"; 830 | for (var i = 0; i < s_tags.length; i++) { 831 | if (s_tags[i].indexOf(ntag) > -1) { 832 | var id = s_tags[i].split(":"); 833 | s_val = id[1]; 834 | } 835 | } 836 | return s_val; 837 | }; 838 | 839 | ScSWinter.EnemiesClass = ScSWinter.params["Enemies use actor classes"] == "true"; 840 | if (ScSWinter.EnemiesClass) { 841 | var PB_Game_Enemy_setup = Game_Enemy.prototype.setup; 842 | Game_Enemy.prototype.setup = function (enemyId, x, y) { 843 | this.s_bparam = {}; 844 | this.s_enemyId = enemyId; 845 | this.s_roleid = parseInt(s_extractNoteValue($dataEnemies[this.s_enemyId].note, "EnemyRole:")); 846 | this.s_level = $gameParty.highestLevel(); 847 | this.s_calcExpQuant(); 848 | this.s_calcGoldQuant(); 849 | PB_Game_Enemy_setup.call(this, enemyId, x, y); 850 | }; 851 | 852 | var s_fExp = function (level, basis, extra, acc_a, acc_b) { 853 | return Math.round( 854 | (basis * Math.pow(level - 1, 0.9 + acc_a / 250) * level * (level + 1)) / 855 | (6 + Math.pow(level, 2) / 50 / acc_b) + 856 | (level - 1) * extra 857 | ); 858 | }; 859 | 860 | ScSWinter.EnemyExpGained = ScSWinter.params["Enemy experience"]; 861 | Game_Enemy.prototype.s_calcExpQuant = function () { 862 | if (ScSWinter.EnemyExpGained == "Next-level class value" && this.s_roleid > 0) { 863 | var bexp = $dataClasses[this.s_roleid].expParams; 864 | this.s_exp = 865 | s_fExp(this.s_level + 1, bexp[0], bexp[1], bexp[2], bexp[3]) - 866 | s_fExp(this.s_level, bexp[0], bexp[1], bexp[2], bexp[3]); 867 | } else if (ScSWinter.EnemyExpGained == "Enemy value x Level") { 868 | this.s_exp = $dataEnemies[this.s_enemyId].exp * this.s_level; 869 | } else { 870 | this.s_exp = $dataEnemies[this.s_enemyId].exp; 871 | } 872 | }; 873 | 874 | ScSWinter.EnemyGoldGained = ScSWinter.params["Gold obtained"]; 875 | Game_Enemy.prototype.s_calcGoldQuant = function () { 876 | if (ScSWinter.EnemyGoldGained == "Next-level class value" && this.s_roleid > 0) { 877 | var bexp = $dataClasses[this.s_roleid].expParams; 878 | this.s_gold = 879 | s_fExp(this.s_level + 1, bexp[0], bexp[1], bexp[2], bexp[3]) - 880 | s_fExp(this.s_level, bexp[0], bexp[1], bexp[2], bexp[3]); 881 | } else if (ScSWinter.EnemyGoldGained == "Enemy value x Level") { 882 | this.s_gold = $dataEnemies[this.s_enemyId].gold * this.s_level; 883 | } else { 884 | this.s_gold = $dataEnemies[this.s_enemyId].gold; 885 | } 886 | }; 887 | 888 | Game_Enemy.prototype.s_bparamCalc = function (paramId) { 889 | var s_mult = paramId == 0 ? 10 : 1; 890 | if (this.s_roleid > 0 && paramId < $dataClasses[this.s_roleid].params.length) { 891 | this.s_bparam[paramId] = Math.floor($dataClasses[this.s_roleid].params[paramId][this.s_level] * s_mult); 892 | } else { 893 | this.s_bparam[paramId] = Math.floor($dataEnemies[this.s_enemyId].params[paramId]); 894 | } 895 | return this.s_bparam[paramId]; 896 | }; 897 | 898 | Game_Enemy.prototype.paramBase = function (paramId) { 899 | return this.s_bparam[paramId] || this.s_bparamCalc(paramId); 900 | }; 901 | 902 | Game_Enemy.prototype.exp = function () { 903 | return this.s_exp; 904 | }; 905 | 906 | Game_Enemy.prototype.gold = function () { 907 | return this.s_gold; 908 | }; 909 | } 910 | })(); 911 | 912 | /*==================================================== 913 | PART: BetterAudio MV Plugin -> BetterAudio MZ Plugin 914 | ====================================================*/ 915 | (function () { 916 | var BetterAudio = { 917 | outfocus: { bgm: null, bgs: null, sav: false }, 918 | saved: { 919 | bgs: {}, 920 | bgm: {}, 921 | me: {}, 922 | se: {}, 923 | cmax: { bgs: 2, bgm: 2, me: 2, se: 2 }, 924 | tmax: { bgs: 0, bgm: 0, me: 0, se: 0 } 925 | }, 926 | debug: false, 927 | forced: [] 928 | }; 929 | BetterAudio.debug = false; 930 | 931 | BetterAudio.params = PluginManager.parameters("MultiTweaks"); 932 | BetterAudio.params["Stop out-focus audio"] = BetterAudio.params["Stop out-focus audio"] == "true"; 933 | BetterAudio.params["Add a global volume"] = BetterAudio.params["Add a global volume"] == "true"; 934 | BetterAudio.params["Remove secondary volumes"] = BetterAudio.params["Remove secondary volumes"] == "true"; 935 | BetterAudio.params["Use quadratic volume"] = BetterAudio.params["Use quadratic volume"] == "true"; 936 | BetterAudio.params["Global volume name"] = String(BetterAudio.params["Global volume name"]); 937 | BetterAudio.params["Cache of used audios"] = BetterAudio.params["Cache of used audios"] == "true"; 938 | BetterAudio.params["Preemptive event cache"] = BetterAudio.params["Preemptive event cache"] == "true"; 939 | BetterAudio.params["Preemptive battle cache"] = BetterAudio.params["Preemptive battle cache"] == "true"; 940 | BetterAudio.params["Preemp. boot/map cache"] = BetterAudio.params["Preemp. boot/map cache"] == "true"; 941 | BetterAudio.saved.cmax.bgm = parseInt(BetterAudio.params["BGM cache size"]); 942 | BetterAudio.saved.cmax.bgs = parseInt(BetterAudio.params["BGS cache size"]); 943 | BetterAudio.saved.cmax.me = parseInt(BetterAudio.params["ME cache size"]); 944 | BetterAudio.saved.cmax.se = parseInt(BetterAudio.params["SE cache size"]); 945 | try { 946 | BetterAudio.forced = JSON.parse(BetterAudio.params["Force map bgm and bgs"]) || JSON.parse("[]"); 947 | for (var i = 0; i < BetterAudio.forced.length; i++) { 948 | BetterAudio.forced[i] = JSON.parse(BetterAudio.forced[i]); 949 | } 950 | } catch (e) { 951 | BetterAudio.forced = []; 952 | } 953 | 954 | if (BetterAudio.debug) { 955 | BetterAudio.showDebug = function (content) { 956 | console.log("[BetterAudio] " + content); 957 | }; 958 | console.log("=== Updated BetterAudio Object ==="); 959 | console.log(BetterAudio); 960 | console.log("=== ==="); 961 | } else { 962 | BetterAudio.showDebug = function (content) {}; 963 | } 964 | 965 | if (BetterAudio.params["Stop out-focus audio"]) { 966 | if (Utils.isNwjs()) { 967 | WebAudio._shouldMuteOnHide = function () { 968 | return false; 969 | }; 970 | var win = nw.Window.get(); 971 | win.on("focus", function () { 972 | WebAudio._fadeIn(0.3); 973 | }); 974 | win.on("blur", function () { 975 | WebAudio._fadeOut(0.3); 976 | }); 977 | } else { 978 | WebAudio._shouldMuteOnHide = function () { 979 | return true; 980 | }; 981 | WebAudio._onHide = function () { 982 | this._fadeOut(0.3); 983 | }; 984 | WebAudio._onShow = function () { 985 | this._fadeIn(0.3); 986 | }; 987 | } 988 | } else { 989 | WebAudio._shouldMuteOnHide = function () { 990 | return false; 991 | }; 992 | } 993 | 994 | if (BetterAudio.params["Add a global volume"]) { 995 | AudioManager._globalVolume = 100; 996 | Object.defineProperty(AudioManager, "globalVolume", { 997 | get: function () { 998 | return this._globalVolume; 999 | }, 1000 | set: function (value) { 1001 | this._globalVolume = value; 1002 | this.updateBgmParameters(this._currentBgm); 1003 | this.updateBgsParameters(this._currentBgs); 1004 | this.updateMeParameters(this._currentMe); 1005 | }, 1006 | configurable: true 1007 | }); 1008 | 1009 | Object.defineProperty(ConfigManager, "globalVolume", { 1010 | get: function () { 1011 | return AudioManager.globalVolume; 1012 | }, 1013 | set: function (value) { 1014 | AudioManager.globalVolume = value; 1015 | }, 1016 | configurable: true 1017 | }); 1018 | 1019 | BetterAudio.originalMakeData = ConfigManager.makeData; 1020 | ConfigManager.makeData = function () { 1021 | var config = BetterAudio.originalMakeData.call(this); 1022 | config.globalVolume = this.globalVolume; 1023 | return config; 1024 | }; 1025 | 1026 | BetterAudio.originalApplyData = ConfigManager.applyData; 1027 | ConfigManager.applyData = function (config) { 1028 | this.globalVolume = this.readVolume(config, "globalVolume"); 1029 | BetterAudio.originalApplyData.call(this, config); 1030 | }; 1031 | 1032 | AudioManager.updateBufferParameters = function (buffer, configVolume, audio) { 1033 | if (buffer && audio) { 1034 | var globalVolume = this.globalVolume || 0; 1035 | if (BetterAudio.params["Use quadratic volume"]) { 1036 | globalVolume = parseInt((globalVolume * globalVolume) / 100) / 100; 1037 | } else globalVolume = globalVolume / 100; 1038 | BetterAudio.showDebug("Called updateBufferParameters with real global volume of " + globalVolume); 1039 | buffer.volume = (globalVolume * configVolume * (audio.volume || 0)) / 10000; 1040 | buffer.pitch = (audio.pitch || 0) / 100; 1041 | buffer.pan = (audio.pan || 0) / 100; 1042 | } 1043 | }; 1044 | 1045 | Window_Options.prototype.addVolumeOptions = function () { 1046 | this.addCommand(BetterAudio.params["Global volume name"], "globalVolume"); 1047 | if (!BetterAudio.params["Remove secondary volumes"]) { 1048 | this.addCommand(TextManager.bgmVolume, "bgmVolume"); 1049 | this.addCommand(TextManager.bgsVolume, "bgsVolume"); 1050 | this.addCommand(TextManager.meVolume, "meVolume"); 1051 | this.addCommand(TextManager.seVolume, "seVolume"); 1052 | } 1053 | }; 1054 | } 1055 | 1056 | if (BetterAudio.params["Cache of used audios"]) { 1057 | BetterAudio.updateIndexSaved = function (buffer, toItem) { 1058 | var keys = Object.keys(buffer); 1059 | for (var i = 0; i < keys.length; i++) { 1060 | var number = buffer[keys[i]][1]; 1061 | if (number == toItem) { 1062 | buffer[keys[i]][1] = 1; 1063 | } else if (number < toItem) { 1064 | buffer[keys[i]][1] = number + 1; 1065 | } 1066 | } 1067 | }; 1068 | 1069 | BetterAudio.deleteOldSaved = function (buffer, max) { 1070 | var keys = Object.keys(buffer); 1071 | for (var i = 0; i < keys.length; i++) { 1072 | var number = buffer[keys[i]][1]; 1073 | if (number > max) { 1074 | var k = keys[i]; 1075 | if (!buffer[k][0].isPlaying()) buffer[k][0].destroy(); 1076 | delete buffer[k]; 1077 | } 1078 | } 1079 | }; 1080 | 1081 | BetterAudio.restartBufferCount = function () { 1082 | BetterAudio.saved.tmax = { bgs: 0, bgm: 0, me: 0, se: 0 }; 1083 | }; 1084 | 1085 | BetterAudio.addNewToBuffer = function (btype, aname) { 1086 | if (typeof aname === "undefined" || aname === null || aname == "") return; 1087 | if (BetterAudio.saved.tmax[btype] < BetterAudio.saved.cmax[btype]) { 1088 | AudioManager.createBuffer(btype, aname); 1089 | BetterAudio.saved.tmax[btype] += 1; 1090 | } 1091 | }; 1092 | 1093 | AudioManager.originalCreateBuffer = AudioManager.createBuffer; 1094 | AudioManager.createBuffer = function (folder, name) { 1095 | folder = folder.replace("/", "").replace("/", "").replace("/", ""); 1096 | if (name in BetterAudio.saved[folder]) { 1097 | BetterAudio.showDebug("Served " + folder + " cached file: " + name); 1098 | } else { 1099 | BetterAudio.saved[folder][name] = [ 1100 | AudioManager.originalCreateBuffer.call(this, folder + "/", name), 1101 | 999 1102 | ]; 1103 | BetterAudio.showDebug("Cached new " + folder + " file: " + name); 1104 | } 1105 | BetterAudio.updateIndexSaved(BetterAudio.saved[folder], BetterAudio.saved[folder][name][1]); 1106 | BetterAudio.deleteOldSaved(BetterAudio.saved[folder], BetterAudio.saved.cmax[folder]); 1107 | return BetterAudio.saved[folder][name][0]; 1108 | }; 1109 | 1110 | /* Fix cursor sound bug #1 */ 1111 | AudioManager.loadStaticSe = function (se) { 1112 | if (se.name && !this.isStaticSe(se)) { 1113 | const buffer = AudioManager.originalCreateBuffer("se/", se.name); 1114 | this._staticBuffers.push(buffer); 1115 | } 1116 | }; 1117 | 1118 | AudioManager.stopBgm = function () { 1119 | if (this._bgmBuffer) { 1120 | if (!(this._bgmBuffer.name in BetterAudio.saved["bgm"])) this._bgmBuffer.destroy(); 1121 | else this._bgmBuffer.stop(); 1122 | this._bgmBuffer = null; 1123 | this._currentBgm = null; 1124 | } 1125 | }; 1126 | AudioManager.stopBgs = function () { 1127 | if (this._bgsBuffer) { 1128 | if (!(this._bgsBuffer.name in BetterAudio.saved["bgs"])) this._bgsBuffer.destroy(); 1129 | else this._bgsBuffer.stop(); 1130 | this._bgsBuffer = null; 1131 | this._currentBgs = null; 1132 | } 1133 | }; 1134 | AudioManager.stopMe = function () { 1135 | if (this._meBuffer) { 1136 | if (!(this._meBuffer.name in BetterAudio.saved["me"])) this._meBuffer.destroy(); 1137 | else this._meBuffer.stop(); 1138 | this._meBuffer = null; 1139 | if (this._bgmBuffer && this._currentBgm && !this._bgmBuffer.isPlaying()) { 1140 | this._bgmBuffer.play(true, this._currentBgm.pos); 1141 | this._bgmBuffer.fadeIn(this._replayFadeTime); 1142 | } 1143 | } 1144 | }; 1145 | AudioManager.cleanupSe = function () { 1146 | for (const buffer of this._seBuffers) { 1147 | if (!buffer.isPlaying() && !(buffer.name in BetterAudio.saved["se"])) { 1148 | buffer.destroy(); 1149 | } 1150 | } 1151 | this._seBuffers = this._seBuffers.filter((buffer) => buffer.isPlaying()); 1152 | }; 1153 | AudioManager.stopSe = function () { 1154 | for (const buffer of this._seBuffers) { 1155 | if (!(buffer.name in BetterAudio.saved["se"])) buffer.destroy(); 1156 | else buffer.stop(); 1157 | } 1158 | this._seBuffers = []; 1159 | }; 1160 | } 1161 | 1162 | if (BetterAudio.params["Cache of used audios"] && BetterAudio.params["Preemptive event cache"]) { 1163 | BetterAudio.originalSetup = Game_Interpreter.prototype.setup; 1164 | Game_Interpreter.prototype.setup = function (list, eventId) { 1165 | BetterAudio.originalSetup.call(this, list, eventId); 1166 | BetterAudio.showDebug("Analyzing commands of event " + eventId); 1167 | BetterAudio.restartBufferCount(); 1168 | for (var i = 0; i < this._list.length; i++) { 1169 | var com = this._list[i]; 1170 | if (com.code == 241) { 1171 | BetterAudio.showDebug("Detected start bgm in event"); 1172 | BetterAudio.addNewToBuffer("bgm", com.parameters[0].name); 1173 | } else if (com.code == 245) { 1174 | BetterAudio.showDebug("Detected start bgs in event"); 1175 | BetterAudio.addNewToBuffer("bgs", com.parameters[0].name); 1176 | } else if (com.code == 249) { 1177 | BetterAudio.showDebug("Detected play me in event"); 1178 | BetterAudio.addNewToBuffer("me", com.parameters[0].name); 1179 | } else if (com.code == 250) { 1180 | BetterAudio.showDebug("Detected play se in event"); 1181 | BetterAudio.addNewToBuffer("se", com.parameters[0].name); 1182 | } else if (com.code == 301) { 1183 | BetterAudio.showDebug("Detected start battle in event"); 1184 | BetterAudio.addNewToBuffer("bgm", $gameSystem.battleBgm().name); 1185 | BetterAudio.addNewToBuffer("me", $gameSystem.victoryMe().name); 1186 | BetterAudio.addNewToBuffer("me", $gameSystem.defeatMe().name); 1187 | } else if (com.code == 132) { 1188 | BetterAudio.showDebug("Detected change battle BGM"); 1189 | BetterAudio.addNewToBuffer("bgm", com.parameters[0].name); 1190 | } else if (com.code == 133) { 1191 | BetterAudio.showDebug("Detected change victory ME"); 1192 | BetterAudio.addNewToBuffer("me", com.parameters[0].name); 1193 | } 1194 | } 1195 | }; 1196 | } 1197 | 1198 | if (BetterAudio.params["Cache of used audios"] && BetterAudio.params["Preemptive battle cache"]) { 1199 | BetterAudio.preloadAnimation = function (animationId) { 1200 | if (animationId <= 0 || animationId >= $dataAnimations.length) return; 1201 | BetterAudio.showDebug("Try to preload battle animation " + animationId); 1202 | BetterAudio.restartBufferCount(); 1203 | var mytimings = $dataAnimations[animationId].soundTimings; 1204 | for (var i = 0; i < mytimings.length; i++) { 1205 | if (mytimings[i].se) { 1206 | BetterAudio.showDebug("Detected se in battle animation"); 1207 | BetterAudio.addNewToBuffer("se", mytimings[i].se.name); 1208 | } 1209 | } 1210 | }; 1211 | 1212 | BetterAudio.originalStartAction = BattleManager.startAction; 1213 | BattleManager.startAction = function () { 1214 | var skill = this._subject.currentAction().item(); 1215 | BetterAudio.showDebug("Start preload in battle by startAction"); 1216 | BetterAudio.preloadAnimation(skill.animationId); 1217 | BetterAudio.originalStartAction.call(this); 1218 | }; 1219 | 1220 | BetterAudio.originalOnSkillOk = Scene_Battle.prototype.onSkillOk; 1221 | Scene_Battle.prototype.onSkillOk = function () { 1222 | var skill = this._skillWindow.item(); 1223 | BetterAudio.showDebug("Start preload in battle by onSkillOk"); 1224 | BetterAudio.preloadAnimation(skill.animationId); 1225 | BetterAudio.originalOnSkillOk.call(this); 1226 | }; 1227 | 1228 | BetterAudio.originalOnItemOk = Scene_Battle.prototype.onItemOk; 1229 | Scene_Battle.prototype.onItemOk = function () { 1230 | var skill = this._itemWindow.item(); 1231 | BetterAudio.showDebug("Start preload in battle by onItemOk"); 1232 | BetterAudio.preloadAnimation(skill.animationId); 1233 | BetterAudio.originalOnItemOk.call(this); 1234 | }; 1235 | } 1236 | 1237 | if (BetterAudio.forced.length > 0) { 1238 | BetterAudio.forceMapBgmAndBgs = function (object) { 1239 | for (var i = 0; i < BetterAudio.forced.length; i++) { 1240 | var mfe = BetterAudio.forced[i]; 1241 | if ($gameSwitches.value(mfe["Switch Id"]) == true) { 1242 | if (mfe["Play Bgm"] != "") { 1243 | BetterAudio.showDebug("Changed map Bgm to " + mfe["Play Bgm"] + " by " + mfe["Switch Id"]); 1244 | object.autoplayBgm = true; 1245 | object.bgm = { name: mfe["Play Bgm"], pan: 0, pitch: 100, volume: 90 }; 1246 | } 1247 | if (mfe["Play Bgs"] != "") { 1248 | BetterAudio.showDebug("Changed map Bgs to " + mfe["Play Bgs"] + " by " + mfe["Switch Id"]); 1249 | object.autoplayBgs = true; 1250 | object.bgs = { name: mfe["Play Bgs"], pan: 0, pitch: 100, volume: 90 }; 1251 | } 1252 | return true; 1253 | } 1254 | } 1255 | return false; 1256 | }; 1257 | } else { 1258 | BetterAudio.forceMapBgmAndBgs = function (object) {}; 1259 | } 1260 | 1261 | if (BetterAudio.params["Cache of used audios"] && BetterAudio.params["Preemp. boot/map cache"]) { 1262 | BetterAudio.originalDataManagerOnLoad = DataManager.onLoad; 1263 | DataManager.onLoad = function (object) { 1264 | if (object) { 1265 | BetterAudio.restartBufferCount(); 1266 | if (object === $dataMap) { 1267 | BetterAudio.forceMapBgmAndBgs(object); 1268 | if ($gameSystem) { 1269 | BetterAudio.addNewToBuffer("bgm", $gameSystem.battleBgm().name); 1270 | } 1271 | if (object.bgm && object.bgm.name) { 1272 | BetterAudio.showDebug("Detected map changing, so preloading " + object.bgm.name); 1273 | BetterAudio.addNewToBuffer("bgm", object.bgm.name); 1274 | } 1275 | if (object.bgs && object.bgs.name) { 1276 | BetterAudio.showDebug("Detected map changing, so preloading " + object.bgs.name); 1277 | BetterAudio.addNewToBuffer("bgs", object.bgs.name); 1278 | } 1279 | } else if (object === $dataSystem) { 1280 | if (object.titleBgm && object.titleBgm.name) { 1281 | Utils.setEncryptionInfo( 1282 | !!object.hasEncryptedImages, 1283 | !!object.hasEncryptedAudio, 1284 | object.encryptionKey 1285 | ); 1286 | BetterAudio.showDebug("Detected system loading, so preloading " + object.titleBgm.name); 1287 | BetterAudio.addNewToBuffer("bgm", object.titleBgm.name); 1288 | } 1289 | } 1290 | } 1291 | BetterAudio.originalDataManagerOnLoad.call(this, object); 1292 | }; 1293 | } else if (BetterAudio.forced.length > 0) { 1294 | BetterAudio.originalDataManagerOnLoad = DataManager.onLoad; 1295 | DataManager.onLoad = function (object) { 1296 | if (object) { 1297 | if (object === $dataMap) { 1298 | BetterAudio.forceMapBgmAndBgs(object); 1299 | } 1300 | } 1301 | BetterAudio.originalDataManagerOnLoad.call(this, object); 1302 | }; 1303 | } 1304 | })(); 1305 | 1306 | /*==================================================== 1307 | PART: MZ Map Zoom Plugin 1308 | ====================================================*/ 1309 | (function () { 1310 | "use strict"; 1311 | window.ScSWinter = window.ScSWinter || {}; 1312 | if (!("params" in ScSWinter)) { 1313 | ScSWinter.params = PluginManager.parameters("MultiTweaks"); 1314 | } 1315 | var s_extractNoteValue = function (notes, ntag) { 1316 | var s_tags = notes.split(/[\r\n]+/), 1317 | s_val = "0"; 1318 | for (var i = 0; i < s_tags.length; i++) { 1319 | if (s_tags[i].indexOf(ntag) > -1) { 1320 | var id = s_tags[i].split(":"); 1321 | s_val = id[1]; 1322 | } 1323 | } 1324 | return s_val; 1325 | }; 1326 | 1327 | /* Optional fixes */ 1328 | ScSWinter.FixSprites = ScSWinter.params["Fix sprite black lines"] == "true"; 1329 | if (ScSWinter.FixSprites) { 1330 | Sprite_Character.prototype.setFrame = function (x, y, width, height) { 1331 | if ($gameMap._currentZoom > 1.0) { 1332 | width = width == 0 ? 0 : width - 2; 1333 | height = height == 0 ? 0 : height - 2; 1334 | Sprite.prototype.setFrame.call(this, x + 1, y + 1, width, height); 1335 | } else Sprite.prototype.setFrame.call(this, x, y, width, height); 1336 | }; 1337 | } 1338 | ScSWinter.FixEncounter = ScSWinter.params["Fix map encounter zoom"] == "true"; 1339 | if (ScSWinter.FixEncounter) { 1340 | Scene_Map.prototype.updateEncounterEffect = function () { 1341 | if (this._encounterEffectDuration > 0) { 1342 | this._encounterEffectDuration--; 1343 | const speed = this.encounterEffectSpeed(); 1344 | const n = speed - this._encounterEffectDuration; 1345 | const p = n / speed; 1346 | var q = ((p - 1) * 20 * p + 5) * p + 1; 1347 | q = q * $gameMap._currentZoom; 1348 | const zoomX = $gamePlayer.screenX(); 1349 | const zoomY = $gamePlayer.screenY() - 24; 1350 | if (n === 2) { 1351 | $gameScreen.setZoom(zoomX, zoomY, 1); 1352 | this.snapForBattleBackground(); 1353 | this.startFlashForEncounter(speed / 2); 1354 | } 1355 | $gameScreen.setZoom(zoomX, zoomY, q); 1356 | if (n === Math.floor(speed / 6)) { 1357 | this.startFlashForEncounter(speed / 2); 1358 | } 1359 | if (n === Math.floor(speed / 2)) { 1360 | BattleManager.playBattleBgm(); 1361 | this.startFadeOut(this.fadeSpeed()); 1362 | } 1363 | } 1364 | }; 1365 | } 1366 | ScSWinter.FreeCamera = ScSWinter.params["Always free camera"] == "true"; 1367 | 1368 | /* Game_Map */ 1369 | Game_Map.prototype.extraScreenTile = function (zoom) { 1370 | const zoomTileX = Math.round((Graphics.width / (this.tileWidth() * zoom)) * 16) / 16; 1371 | const zoomTileY = Math.round((Graphics.height / (this.tileHeight() * zoom)) * 16) / 16; 1372 | this._extraScreenTileX = (this.screenTileX() - zoomTileX) / 2; 1373 | this._extraScreenTileY = (this.screenTileY() - zoomTileY) / 2; 1374 | this._currentZoom = zoom; 1375 | }; 1376 | Game_Map.prototype.canvasToMapX = function (x) { 1377 | const tileWidth = this.tileWidth() * this._currentZoom; 1378 | const originX = (this._displayX + this._extraScreenTileX) * tileWidth; 1379 | const mapX = Math.floor((originX + x) / tileWidth); 1380 | return this.roundX(mapX); 1381 | }; 1382 | Game_Map.prototype.canvasToMapY = function (y) { 1383 | const tileHeight = this.tileHeight() * this._currentZoom; 1384 | const originY = (this._displayY + this._extraScreenTileY) * tileHeight; 1385 | const mapY = Math.floor((originY + y) / tileHeight); 1386 | return this.roundY(mapY); 1387 | }; 1388 | /* Without a correct initial camera position, this code is not useful. 1389 | It works only when we start in middle of a not-looped map. */ 1390 | Game_Map.prototype.scrollLeft = function (distance) { 1391 | if (this.isLoopHorizontal()) { 1392 | this._displayX += $dataMap.width - distance; 1393 | this._displayX %= $dataMap.width; 1394 | if (this._parallaxLoopX) { 1395 | this._parallaxX -= distance; 1396 | } 1397 | } else if (ScSWinter.FreeCamera) { 1398 | const lastX = this._displayX; 1399 | this._displayX -= distance; 1400 | this._parallaxX += this._displayX - lastX; 1401 | } else if (this.width() + this._extraScreenTileX * 2 >= this.screenTileX()) { 1402 | const lastX = this._displayX; 1403 | this._displayX = Math.max(this._displayX - distance, this._extraScreenTileX * -1); 1404 | this._parallaxX += this._displayX - lastX; 1405 | } 1406 | }; 1407 | Game_Map.prototype.scrollRight = function (distance) { 1408 | if (this.isLoopHorizontal()) { 1409 | this._displayX += distance; 1410 | this._displayX %= $dataMap.width; 1411 | if (this._parallaxLoopX) { 1412 | this._parallaxX += distance; 1413 | } 1414 | } else if (ScSWinter.FreeCamera) { 1415 | const lastX = this._displayX; 1416 | this._displayX += distance; 1417 | this._parallaxX += this._displayX - lastX; 1418 | } else if (this.width() + this._extraScreenTileX * 2 >= this.screenTileX()) { 1419 | const lastX = this._displayX; 1420 | this._displayX = Math.min( 1421 | this._displayX + distance, 1422 | this.width() - this.screenTileX() + this._extraScreenTileX 1423 | ); 1424 | this._parallaxX += this._displayX - lastX; 1425 | } 1426 | }; 1427 | Game_Map.prototype.scrollUp = function (distance) { 1428 | if (this.isLoopVertical()) { 1429 | this._displayY += $dataMap.height - distance; 1430 | this._displayY %= $dataMap.height; 1431 | if (this._parallaxLoopY) { 1432 | this._parallaxY -= distance; 1433 | } 1434 | } else if (ScSWinter.FreeCamera) { 1435 | const lastY = this._displayY; 1436 | this._displayY -= distance; 1437 | this._parallaxY += this._displayY - lastY; 1438 | } else if (this.height() + this._extraScreenTileY * 2 >= this.screenTileY()) { 1439 | const lastY = this._displayY; 1440 | this._displayY = Math.max(this._displayY - distance, this._extraScreenTileY * -1); 1441 | this._parallaxY += this._displayY - lastY; 1442 | } 1443 | }; 1444 | Game_Map.prototype.scrollDown = function (distance) { 1445 | if (this.isLoopVertical()) { 1446 | this._displayY += distance; 1447 | this._displayY %= $dataMap.height; 1448 | if (this._parallaxLoopY) { 1449 | this._parallaxY += distance; 1450 | } 1451 | } else if (ScSWinter.FreeCamera) { 1452 | const lastY = this._displayY; 1453 | this._displayY += distance; 1454 | this._parallaxY += this._displayY - lastY; 1455 | } else if (this.height() + this._extraScreenTileY * 2 >= this.screenTileY()) { 1456 | const lastY = this._displayY; 1457 | this._displayY = Math.min( 1458 | this._displayY + distance, 1459 | this.height() - this.screenTileY() + this._extraScreenTileY 1460 | ); 1461 | this._parallaxY += this._displayY - lastY; 1462 | } 1463 | }; 1464 | Game_Map.prototype.setDisplayPos = function (x, y) { 1465 | if (this.isLoopHorizontal()) { 1466 | this._displayX = x.mod(this.width()); 1467 | this._parallaxX = x; 1468 | } else if (ScSWinter.FreeCamera) { 1469 | this._displayX = x; 1470 | this._parallaxX = x; 1471 | } else { 1472 | const endX = this.width() - this.screenTileX() + this._extraScreenTileX * 2; 1473 | this._displayX = 1474 | endX < 0 1475 | ? endX / 2 - this._extraScreenTileX 1476 | : x.clamp(this._extraScreenTileX * -1, endX - this._extraScreenTileX); 1477 | this._parallaxX = this._displayX; 1478 | } 1479 | if (this.isLoopVertical()) { 1480 | this._displayY = y.mod(this.height()); 1481 | this._parallaxY = y; 1482 | } else if (ScSWinter.FreeCamera) { 1483 | this._displayY = y; 1484 | this._parallaxY = y; 1485 | } else { 1486 | const endY = this.height() - this.screenTileY() + this._extraScreenTileY * 2; 1487 | this._displayY = 1488 | endY < 0 1489 | ? endY / 2 - this._extraScreenTileY 1490 | : y.clamp(this._extraScreenTileY * -1, endY - this._extraScreenTileY); 1491 | this._parallaxY = this._displayY; 1492 | } 1493 | }; 1494 | 1495 | /* Scene_Map */ 1496 | ScSWinter.DefaultZoom = parseFloat(ScSWinter.params["Default zoom for maps"]) || 1.0; 1497 | Scene_Map.prototype.onMapLoaded = function () { 1498 | var s_zoom = parseFloat(s_extractNoteValue($dataMap.note, "Zoom:")) || 0.0; 1499 | if (s_zoom < 0.5) s_zoom = ScSWinter.DefaultZoom; 1500 | if (s_zoom > 1.0) $gameMap.extraScreenTile(s_zoom); 1501 | else $gameMap.extraScreenTile(1); 1502 | if (this._transfer) { 1503 | $gamePlayer.performTransfer(); 1504 | } 1505 | if (s_zoom > 1.0) { 1506 | $gameScreen.setZoom(Graphics.width / 2, Graphics.height / 2, s_zoom); 1507 | } else $gameScreen.clearZoom(); 1508 | this.createDisplayObjects(); 1509 | }; 1510 | 1511 | /* Game_Screen */ 1512 | Game_Screen.prototype.updateZoom = function () { 1513 | if (this._zoomDuration > 0) { 1514 | const d = this._zoomDuration; 1515 | const t = this._zoomScaleTarget; 1516 | this._zoomScale = (this._zoomScale * (d - 1) + t) / d; 1517 | $gameMap.extraScreenTile(this._zoomScale); 1518 | this._zoomDuration--; 1519 | } 1520 | }; 1521 | 1522 | /* PluginManager */ 1523 | PluginManager.registerCommand("MultiTweaks", "Zoom", (args) => { 1524 | const frameToZoom = +args.FramesToZoom; 1525 | const valueZoom = +args.ZoomValue; 1526 | $gameMap.extraScreenTile(valueZoom); 1527 | $gameScreen.startZoom( 1528 | $gamePlayer.screenX(), 1529 | $gamePlayer.screenY() - $gameMap.tileWidth() / 2, 1530 | valueZoom, 1531 | frameToZoom 1532 | ); 1533 | }); 1534 | })(); 1535 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MultiTweaks 2 | Rpg Maker MZ plugin - MultiTweaks: general, map, zoom, battle, enemies, audio, options, efficiency, etc. 3 | * Repository, contributions and download at https://github.com/scswinter/MultiTweaks 4 | 5 | 6 | ## Description 7 | 8 | This script allows you to incorporate some improvements in the game engine (as the needs of my game requires it). Now this script can do the next things: 9 | 10 | ### General 11 | 12 | * Start in fullscreen mode. This plugin rewrites the standard fullscreen to natively perform it in nwjs. 13 | * Show or hide the blink selection effect. 14 | * Render half of computed frames to avoid effekseer lag only when effekseer animation is playing. In other cases will render 2 of 3 frames to get more fluid experience in mid-devices. Now you can configure it from the plugin options! 15 | * Added an in-game option to turno on/off the optimization. 16 | * Disable F5 and F8. 17 | * Disable fastfoward. 18 | * Force disable scrollbars. 19 | * Pixel-rendering, with two levels of pixelating. 20 | 21 | ### Map 22 | 23 | * Define the tilemap animation speed. 24 | * Map zoom. This script allows you to show maps with a default zoom. When activated the zoom of the map changes. Specify the map zoom using in the map notetag box the notetag Zoom:X where X is a decimal number greater than 1. You also have a plugin command usable in events to create dinamically zoom effects. Note that enter in the menu will reset the zoom to the map default one. 25 | * Fix sprite black lines? This option will cut the sprites one pixel in each side. 26 | * Fix map encounter zoom? Deactivate this option if you changed the default encounter zoom effect. 27 | * Always free camera. When activated, the camera will never be blocked by the edges of the map (as it works with the zoom on). 28 | 29 | ### Options (won't work, but not interfere, with VisuMZ Options Plugin) 30 | 31 | * Configure the ON/OFF options text. Remove options and set the default values of them. 32 | * Added a "Global Volume" option to the window options, and the possibility to hide the secondary volume controls. Also, the option can work in a quadratic function, improving the perception of changing volume. 33 | 34 | ### Battle 35 | 36 | * Weather in battle. 37 | * Auto select targets when only are one actor/enemy or when skill/item targets to all. 38 | * Enemies use actor classes (scaling their power and rewards). When activated the power of the enemies are scaled using actor classes. Specify the actor class using in the enemy notetag box the notetag EnemyRole:X where X is the number of the actor class. If it's not specified the default enemy stats will be used. Note that, in order to allow boss-enemy types, the HP stat always is multiplied by 10. 39 | * Actor battler image zoom. You can configure some aspects of this feature. 40 | 41 | ### Audio 42 | 43 | * Stop the audio and music when the game is out focus in all platforms. 44 | * Audio cache system that stores in cache recently used audio files, and also adds the possibility of preemptive cache future-audio files in events, map and battle (skills and items). 45 | * Force to play a specified Bgm and Bgs on all maps when a switch is ON. The list of bgm, bgs and switches can be specify in the parameters of the plugin. 46 | 47 | 48 | ## License 49 | 50 | The MIT License. Credits to ScSWinter. 51 | 52 | 53 | ## Known bugs 54 | 55 | * Now, zoomed maps can only be both-sides looped maps or free-camera no-looped maps. I just don't get with the cámera jumps at the edge of the map, when open a new scene or in map transfers. Any idea? 56 | 57 | 58 | ## Note and Changelog 59 | 60 | Please put in this thread your experience with the plugin, errors that arise or anything else related. 61 | * v1.7.2 Minor fixes. 62 | * v1.7.1 Added option to hide the scrollbars. 63 | * v1.6.7 Revamped pixel option and solved bugs. 64 | * v1.6.1 Added battler zoom options and bugfixes. 65 | * v1.5.3 Multiple audio playing bugfix. 66 | * v1.5.2 Improved optimization and option added. 67 | * v1.4.3 Native fullscreen, zoom fixes and better game optimization. 68 | * v1.3.5 Fixed event zoom command. It works now! 69 | * v1.3.3 Zoom options not readed fixed. 70 | * v1.3.2 Lots of bugfixes. 71 | * v1.3.0 Incorporating the zoom plugin. 72 | * v1.1.0 Performance option. 73 | * v1.0.2 Fix audio replaying bug. 74 | * v1.0.1 Initial public release. 75 | 76 | --------------------------------------------------------------------------------