-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mihil_tweaks.js
485 lines (466 loc) · 17.7 KB
/
Mihil_tweaks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
//=============================================================================
// Mihil_tweaks.js
//=============================================================================
// Copyright (c) 2018-2019 uta_asakayu
// Released under the MIT license.
// http://opensource.org/licenses/mit-license.php
/*:
* @plugindesc ゲームの快適化や修正など
* @author uta_asakayu
* @Thanks Sigureya, Tsumio, eyn_kenzaki, Plasma
*
* @param ……… Fade …………………………………………
* @default ……………………………………………………………………………………
*
* @param LoadFadeMultiple
* @desc セーブロード時のフェード(暗転)時間を
* 何倍速にするか (1.00でOFF)
* @type number
* @min 0.1
* @max 48
* @decimals 2
* @default 1.00
*
* @param MapFadeMultiple
* @desc マップ移動時のフェード(暗転)時間を
* 何倍速にするか (1.00でOFF)
* @type number
* @min 0.1
* @max 24
* @decimals 2
* @default 1.00
*
* @param DisableTitleFade
* @desc ゲーム開始時タイトル画面を表示するための
* フェードインをなくします。動作高速化
* @type boolean
* @default false
*
* @param DisableNewgameFade
* @desc ニューゲーム選択時の
* フェードアウトをなくします。動作高速化
* @type boolean
* @default false
*
*
* @param ……… Message …………………………………………
* @default ……………………………………………………………………………………
*
* @param DisableMessageInterval
* @desc メッセージの間に挟まる
* 操作を受け付けない時間を減らします(10でOFF)
* @type number
* @min 0
* @max 100
* @default 10
*
* @param WindowShiftSpeed
* @desc ウィンドウの開閉速度を変更します
* 倍率指定(1.00でOFF)
* @type number
* @min 0.1
* @max 8
* @decimals 2
* @default 1.00
*
* @param BaloonAnimationMultiple
* @desc フキダシアイコンの表示速度を変更します
* 倍率指定(1.00でOFF)
* @type number
* @min 0.1
* @max 64
* @decimals 2
* @default 1.00
*
* @param ……… InputTweak …………………………………………
* @default ……………………………………………………………………………………
*
* @param DisableAltkey
* @desc Controlキーと同じ動作に割り当てられている
* Altキーの動作を無効化します。
* @type boolean
* @default false
*
* @param KeyRepeatSpeed
* @desc キー押しっぱなしの時の、連打速度を変更します
* フレーム指定(6でOFF)
* @type number
* @min 1
* @max 60
* @default 6
*
* @param ……… Choice fix …………………………………………
* @default ……………………………………………………………………………………
*
* @param SideCursorCanPageUpDown
* @desc 選択肢の左右キーにページ送り機能を追加します
* @type boolean
* @default false
*
* @param SideCursorCanLoop
* @desc 選択肢の左右キーが最初と最後でループするように
* ページ送り機能がオンの時のみ
* @type boolean
* @default false
*
* @param FixChoiceCursorUp
* @desc 選択肢デフォルトが[なし]の時、
* カーソル上を押すと下から2番目が選択される問題を修正
* @type boolean
* @default false
*
* @param ……… fix …………………………………………
* @default ……………………………………………………………………………………
*
* @param FixGraphicsRender
* @desc たまに音楽だけ鳴って画面が固まる不具合を修正します
* @type boolean
* @default false
*
*
* @help
* ゲームを高速化して快適性を増したり、
* MVのバグを修正したりします。
*
* -------高速化--------
*
* LoadFadeMultiple
* セーブファイルをロードした時の暗転時間を調節できます。
* プラグインパラメータ(LoadFadeMultiple)の数値に合わせて、暗転が速くなります。
* 1倍未満の数値も入れられます。(遅くなります)
* 48以上の値は意味ないかも。
* 1.00以外の数値にすると
* Scene_Load.prototype.onLoadSuccess
* を上書きします。
*
* MapFadeMultiple
* マップを移動した時の暗転時間を調節できます。
* プラグインパラメータ(MapFadeMultiple)の数値に合わせて、暗転が速くなります。
* 1倍未満の数値も入れられます。(遅くなります)
* 24以上の値は意味ないかも。
* 1.00以外の数値にすると
* Scene_Map.prototype.fadeInForTransfer
* Scene_Map.prototype.fadeOutForTransfer
* を上書きします。
*
* DisableTitleFade
* タイトル画面を表示する時の、フェードインをなくします。
* 動作は高速化しますが、演出が犠牲になるかもしれません。
*
* DisableNewgameFade
* ニューゲーム開始時の、フェードアウトをなくします。
* 動作は高速化しますが、演出が犠牲になるかもしれません。
*
*
* DisableMessageInterval
* ツクール標準仕様だと、メッセージウィンドウで文字が表示しきってから、
* 10フレーム操作を受け付けないインターバルがあります。
* このインターバルを数値変更します。
* 値が0だとウェイトなし、
* 10だと無効になります。
*
* WindowShiftSpeed
* ウィンドウを開いたり閉じたりする速度倍率を変更します。
* 8倍速で一瞬で開閉させられます。
*
* BaloonAnimationMultiple
* フキダシアイコンの表示速度を変更します。
* 標準で付与される12フレームのウェイトもカットしました。
* 1.00以外の数値にすると
* Sprite_Balloon.prototype.speed
* Sprite_Balloon.prototype.waitTime
* を上書きします
*
* -------入力の快適化--------
*
* DisableAltkey
* Ctrlキーでメッセージスキップ、
* Altキーをスクリーンショットのホットキーに
* 割り当てている場合などのために、
* Altキーの役割をなくします。
* trueにすると
* Input.keyMapper[18]
* を上書きします。
*
* KeyRepeatSpeed
* ツクールMVは今までのツクールと違い、キーをしばらく押しっぱなしにすると
* 連打する仕様になりました。
* その時の連打速度を変更します。値が小さい方が速いです。
* デフォルトの値である6以外にすると、
* Input.keyRepeatInterval
* TouchInput.keyRepeatInterval
* を上書きします
*
* -------本体の快適化・修正--------
*
* SideCursorCanPageUpDown
* 選択肢を選んでいる時に、
* 左右キーでもページ送りが出来たらと思ったことはありませんか?
* この機能をオンにすると、
* 左右キーにページ送りキーと同じ機能を追加できます。
* trueにすると
* Window_Selectable.prototype.cursorRight
* Window_Selectable.prototype.cursorLeft
* を上書きします。
*
* FixChoiceCursorUp
* 選択肢のデフォルト設定が「なし」の時、
* 選択肢を開いた後に上キーを押すと、
* 最下部ではなく下から2番目の項目が選択される不具合を修正します。
*
* FixGraphicsRender
* ツクールMVの本体バージョンが1.6.1以下、
* かつコミュニティ版コアスクリプトのv1.3bを導入していない場合に
* サウンドだけ鳴り続けて画面が固まってしまう不具合を修正します。
* (つまり、コミュニティ版コアスクリプトのv1.3b以上を導入している方は不要です)
* trueにすると
* Graphics.render
* を上書きします。
*
*
* 共存可能:
* LoadComSim.js ver1.00
* https://tm.lucky-duet.com/viewtopic.php?t=3085
* 選択肢拡張 ver. 3.7
* http://woodpenguin.web.fc2.com/MV_Plugin/MPP_ChoiceEX.html
*
* ※コードレビュー歓迎します。
* Please feel free to throw me Masakari!
*
* Ver2.8.0 SideCursorCanLoopを追加
* Ver2.7.1 MITライセンスを追加
* Ver2.7.0 FixGraphicsRenderを追加
* Ver2.6.2 デフォルトのパラメータを全てOFFの値に設定。
* Ver2.6.1 DisableMessageIntervalを数値変更するように
* Ver2.6.0 KeyRepeatSpeedを追加。Descriptionをカテゴライズ
* Ver2.5.0 Scene_Title.prototype.startの上書きをフックに改善
* DisableNewgameFadeを追加
* Ver2.4.0 BaloonAnimationMultiple(フキダシアイコン表示速度変更)を追加
* Ver2.3.1 レイアウトを調整
* Ver2.3.0 MapFadeMultiple機能追加
* Ver2.2.1 SideCursorCanPageUpDownが常にオンになってしまっていた。
* Ver2.2.0 SideCursorCanPageUpDown(左右キーでページ送り)追加。
* Ver2.1.0 WindowShiftSpeed(ウィンドウの開閉速度変更)追加、LoadFadeMultipleの数値が1.00の時は動作しないように。
* FadeMultiple → LoadFadeMultiple に名前変更。プラグインパラメータを設定し直してください。
* Ver2.0.0 タイトルフェードインなし、メッセージインターバルなし、Altキー無効化、選択肢fix機能追加
* Ver1.0.1 ~~おまけ(タイトル画面の暗転省略)を追加。
* コードを見てコメントアウトを外してください。~~
* Ver1.0.0 配布
*
*/
(function() {
'use strict';
// プラグインパラメータ設定
var createPluginParameter = function(pluginName) {
var paramReplacer = function(key, value) {
if (value === 'null') {
return value;
}
if (value[0] === '"' && value[value.length - 1] === '"') {
return value;
}
try {
return JSON.parse(value);
} catch (e) {
return value;
}
};
var parameter = JSON.parse(JSON.stringify(PluginManager.parameters(pluginName), paramReplacer));
PluginManager.setParameters(pluginName, parameter);
return parameter;
};
var param = createPluginParameter('Mihil_tweaks');
// ロード時のフェードアウト時間調整
if(param.LoadFadeMultiple != 1){
Scene_Load.prototype.fadeOutLoad = function() {
var time = this.slowFadeSpeed() / 60;
time /= param.LoadFadeMultiple
AudioManager.fadeOutBgm(time);
AudioManager.fadeOutBgs(time);
AudioManager.fadeOutMe(time);
this.startFadeOut(this.slowFadeSpeed() / param.LoadFadeMultiple);
};
Scene_Load.prototype.onLoadSuccess = function() {
SoundManager.playLoad();
this.fadeOutLoad();
this.reloadMapIfUpdated();
SceneManager.goto(Scene_Map);
this._loadSuccess = true;
};
}
// マップ移動時のフェード時間変更
if(param.MapFadeMultiple != 1){
Scene_Map.prototype.fadeInForTransfer = function() {
var fadeType = $gamePlayer.fadeType();
switch (fadeType) {
case 0: case 1:
const fadeSpeedMulti = this.fadeSpeed() / param.MapFadeMultiple
this.startFadeIn(fadeSpeedMulti, fadeType === 1);
break;
}
};
Scene_Map.prototype.fadeOutForTransfer = function() {
var fadeType = $gamePlayer.fadeType();
switch (fadeType) {
case 0: case 1:
const fadeSpeedMulti = this.fadeSpeed() / param.MapFadeMultiple
this.startFadeOut(fadeSpeedMulti, fadeType === 1);
break;
}
};
}
// タイトル画面フェードインなし
if(param.DisableTitleFade){
const _Scene_Title_start = Scene_Title.prototype.start
Scene_Title.prototype.start = function() {
_Scene_Title_start.apply(this, arguments)
this._fadeDuration = 1
};
}
// ニューゲームフェードアウトなし
if(param.DisableNewgameFade){
const _Scene_Title_commandNewGame = Scene_Title.prototype.commandNewGame
Scene_Title.prototype.commandNewGame = function() {
_Scene_Title_commandNewGame.apply(this, arguments)
this.startFadeOut(1)
};
}
// メッセージのインターバルをなくす
if(param.DisableMessageInterval != 10){
const _Window_Message_startPause = Window_Message.prototype.startPause
Window_Message.prototype.startPause = function() {
_Window_Message_startPause.call(this)
this.startWait(param.DisableMessageInterval);
};
}
// ウィンドウの開閉速度
if(param.WindowShiftSpeed != 1){
const _Window_Base_updateOpen = Window_Base.prototype.updateOpen
Window_Base.prototype.updateOpen = function() {
_Window_Base_updateOpen.call(this)
if (this._opening) {
this.openness -=32
this.openness += (32*param.WindowShiftSpeed)
}
}
const _Window_Base_updateClose = Window_Base.prototype.updateClose
Window_Base.prototype.updateClose = function() {
_Window_Base_updateClose.call(this)
if (this._closing) {
this.openness += 32;
this.openness -= (32*param.WindowShiftSpeed)
}
};
}
// フキダシアイコンの表示速度
if(param.BaloonAnimationMultiple != 1){
Sprite_Balloon.prototype.speed = function() {
return 8/param.BaloonAnimationMultiple
};
Sprite_Balloon.prototype.waitTime = function() {
return 0
};
/*没
const _Sprite_Balloon_setup = Sprite_Balloon.prototype.setup
Sprite_Balloon.prototype.setup = function(balloonId) {
_Sprite_Balloon_setup.call(this, arguments)
this._duration = 8 * this.speed() / param.BaloonAnimationMultiple + this.waitTime()
};
Sprite_Balloon.prototype.frameIndex = function() {
var index = (this._duration - this.waitTime()) / this.speed() / param.BaloonAnimationMultiple
return 7 - Math.max(Math.floor(index), 0);
};
*/
}
// Altキーを無効化
if(param.DisableAltkey){
Input.keyMapper[18] = '';
}
// キーリピートの速度変更
if(param.KeyRepeatSpeed != 6){
/**
* The interval of the key repeat in frames.
*
* @static
* @property keyRepeatInterval
* @type Number
*/
Input.keyRepeatInterval = param.KeyRepeatSpeed || 6; /**
* The interval of the pseudo key repeat in frames.
*
* @static
* @property keyRepeatInterval
* @type Number
*/
TouchInput.keyRepeatInterval = param.KeyRepeatSpeed || 6;
}
// 選択肢の左右キーにページ送り機能を追加する
if(param.SideCursorCanPageUpDown){
Window_Selectable.prototype.cursorRight = function(wrap) {
var index = this.index();
var maxItems = this.maxItems();
var maxCols = this.maxCols();
console.log(`index=${index}, maxItems=${maxItems}`)
if(maxCols >= 2 && index===maxItems-1 && param.SideCursorCanLoop){
this.select(0);
} else if (maxCols >= 2 && (index < maxItems - 1 || (wrap && this.isHorizontal()))) {
this.select((index + 1) % maxItems);
} else if (maxCols <= 1 && this.topRow() + this.maxPageRows() < this.maxRows()) {
this.setTopRow(this.topRow() + this.maxPageRows());
this.select(Math.min(index + this.maxPageItems(), maxItems - 1));
}
};
Window_Selectable.prototype.cursorLeft = function(wrap) {
var index = this.index();
var maxItems = this.maxItems();
var maxCols = this.maxCols();
if(maxCols >= 2 && index===0 && param.SideCursorCanLoop){
this.select(maxItems-1);
} else if (maxCols >= 2 && (index > 0 || (wrap && this.isHorizontal()))) {
this.select((index - 1 + maxItems) % maxItems);
} else if (maxCols <= 1 && this.topRow() > 0) {
this.setTopRow(this.topRow() - this.maxPageRows());
this.select(Math.max(index - this.maxPageItems(), 0));
}
};
}
// 選択肢の修正
if(param.FixChoiceCursorUp){
var _Window_ChoiceList_cursorUp = Window_ChoiceList.prototype.cursorUp;
Window_ChoiceList.prototype.cursorUp = function (wrap) {
if (this.index() === -1 && $gameMessage.choiceDefaultType() === -1) {
this.select(0);
}
_Window_ChoiceList_cursorUp.call(this, wrap);
};
}
// FixGraphicsRender
if(param.FixGraphicsRender){
/**
* Renders the stage to the game screen.
*
* @static
* @method render
* @param {Stage} stage The stage object to be rendered
*/
Graphics.render = function(stage) {
if (this._skipCount <= 0) {
var startTime = Date.now();
if (stage) {
this._renderer.render(stage);
if (this._renderer.gl && this._renderer.gl.flush) {
this._renderer.gl.flush();
}
}
var endTime = Date.now();
var elapsed = endTime - startTime;
this._skipCount = Math.min(Math.floor(elapsed / 15), this._maxSkip);
this._rendered = true;
} else {
this._skipCount--;
this._rendered = false;
}
this.frameCount++;
};
}
})();