-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmumaaku-NovelMessage.js
155 lines (140 loc) · 5.55 KB
/
mumaaku-NovelMessage.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
//=============================================================================
// mumaaku-NovelMessage.js
//=============================================================================
/*:ja
* @plugindesc 全画面型のメッセージウィンドウです。
* @target MZ
* @author 夢魔渥
*
* @param Switch ID
* @desc ノベルモードにするためのスイッチのIDです。
* @default 1
* @type number
* @min 1
*
* @help
* ノベルモードにて改ページをするには、制御文字「\F」を使用してください。
*
* このプラグインには、プラグインコマンドはありません。
* Yoji Ojimaさま、 神無月サスケさま、DarkPlasmaさま、ありがとうございます!
*/
(function() {
var parameters = PluginManager.parameters('mumaaku-NovelMessage');
var switchId = Number(parameters['Switch ID'] || 1);
function isNovelMode() {
return $gameSwitches.value(switchId);
};
var _Window_Message_initMembers = Window_Message.prototype.initMembers;
Window_Message.prototype.initMembers = function() {
_Window_Message_initMembers.call(this);
this._novelLineY = 0;
this._novelNewPage = true;
};
var _Window_Message_updatePlacement =
Window_Message.prototype.updatePlacement;
Window_Message.prototype.updatePlacement = function() {
if (isNovelMode()) {
this.width = 816;
this.height = 624;
this.x = (Graphics.boxWidth - this.width) / 2;
}
else{
// this.x = (Graphics.boxWidth - this.width) / 2;
this.height = 170;
this.y = (this._positionType * (Graphics.boxHeight - this.height)) / 2;
}
_Window_Message_updatePlacement.call(this);
if (isNovelMode()) {
this.move(0, 0, Graphics.boxWidth, Graphics.boxHeight);
}
if (this.contents.height !== this.contentsHeight()) {
this.contents.resize(this.contentsWidth(), this.contentsHeight());
}
};
var _Window_Message_updateBackground =
Window_Message.prototype.updateBackground;
Window_Message.prototype.updateBackground = function() {
_Window_Message_updateBackground.call(this);
if (isNovelMode()) {
this.setBackgroundType($gameMessage.background());
}
};
var _Window_Message_onEndOfText = Window_Message.prototype.onEndOfText;
Window_Message.prototype.onEndOfText = function() {
if (isNovelMode()) {
this.processNewLine(this._textState);
}
_Window_Message_onEndOfText.call(this);
};
var _Window_Message_startMessage = Window_Message.prototype.startMessage;
Window_Message.prototype.startMessage = function() {
_Window_Message_startMessage.call(this);
if (isNovelMode()) {
this._textState.y = this._novelLineY;
}
};
var _Window_Message_newPage = Window_Message.prototype.newPage;
Window_Message.prototype.newPage = function(textState) {
if (!isNovelMode() || this._novelNewPage) {
_Window_Message_newPage.call(this, textState);
this._novelLineY = 0;
this._novelNewPage = false;
}
if (isNovelMode()) {
textState.x = textState.startX;
textState.y = this._novelLineY;
textState.height = this.calcTextHeight(textState);
this._lineShowFast = false;
this._pauseSkip = false;
if (this.needsNewPage(textState)) {
this.contents.clear();
textState.x = textState.startX;
textState.y = 0;
this._novelNewPage = true;
this.startPause();
}
}
};
var _Window_Message_processNewLine = Window_Message.prototype.processNewLine;
Window_Message.prototype.processNewLine = function(textState) {
_Window_Message_processNewLine.call(this, textState);
if (isNovelMode()) {
this._novelLineY = this._textState.y;
}
};
var _Window_Message_processEscapeCharacter =
Window_Message.prototype.processEscapeCharacter;
Window_Message.prototype.processEscapeCharacter = function(code, textState) {
if (isNovelMode() && code === 'F') {
textState.y = this.contents.height;
this._novelNewPage = true;
return;
}
_Window_Message_processEscapeCharacter.call(this, code, textState);
};
var _Window_ChoiceList_updatePlacement =
Window_ChoiceList.prototype.updatePlacement;
Window_ChoiceList.prototype.updatePlacement = function() {
_Window_ChoiceList_updatePlacement.call(this);
if (isNovelMode()) {
this.y = Graphics.boxHeight - this.height - 8;
}
};
var _Window_NumberInput_updatePlacement =
Window_NumberInput.prototype.updatePlacement;
Window_NumberInput.prototype.updatePlacement = function() {
_Window_NumberInput_updatePlacement.call(this);
if (isNovelMode()) {
this.y = Graphics.boxHeight - this.height - 8;
}
};
var _Window_NumberInput_buttonY =
Window_NumberInput.prototype.buttonY;
Window_NumberInput.prototype.buttonY = function() {
if (isNovelMode()) {
return 0 - this._buttons[0].height - 8;
} else {
return _Window_NumberInput_buttonY.call(this);
}
};
})();