/*=============================================================================
* CallMenu.js
*=============================================================================*/
/*:=============================================================================
* @plugindesc v1.1 Call menu during messages\choices on map by pressing one of the standart menu keys ESC, X, Insert, NUM 0.
* @author Krimer
*
@Help
* If you want call menu during choices just disallow cancel in choice command.
* Place this plugin below non-standart message systems or choice windows in
* plugin manager for compatibility.
* =============================================================================*/
/*=============================================================================*/
/* Alias */
var _DataManager_makeSaveContents_Alias = DataManager.makeSaveContents;
DataManager.makeSaveContents = function() {
var contents = _DataManager_makeSaveContents_Alias.call(this);
contents.message = $gameMessage;
return contents;
};
/* Alias */
var _DataManager_extractSaveContents_Alias = DataManager.extractSaveContents;
DataManager.extractSaveContents = function(contents) {
_DataManager_extractSaveContents_Alias.call(this, contents);
$gameMessage = contents.message;
};
/* Alias */
var _Scene_Map_update_Alias = Scene_Map.prototype.update;
Scene_Map.prototype.update = function() {
_Scene_Map_update_Alias.call(this);
if (Input.isTriggered('escape') && $gameMessage.isBusy()) {
this.callMenu();
}
};
/* OVERWRITE */
Window_Message.prototype.isTriggered = function() {
return (Input.isRepeated('ok') || TouchInput.isRepeated());
};
/* OVERWRITE */
Window_ChoiceList.prototype.updatePlacement = function() {
var positionType = $gameMessage.choicePositionType();
var messageY = this._messageWindow.y;
this.height = this.windowHeight();
switch (positionType) {
case 0:
this.x = 0;
break;
case 1:
this.x = (Graphics.boxWidth - this.width) / 2;
break;
case 2:
this.x = Graphics.boxWidth - this.width;
break;
}
if (messageY >= Graphics.boxHeight / 2) {
this.y = messageY - this.height;
} else {
this.y = messageY + this._messageWindow.height;
}
};
/* OVERWRITE */
Window_ChoiceList.prototype.windowWidth = function() {
return Graphics.boxWidth;
};
/* OVERWRITE */
Window_ChoiceList.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);
this.drawTextEx(this.commandName(index), rect.x, rect.y);
this.width = this.maxChoiceWidth() + this.padding * 2;
this.updatePlacement();
};
/* NEW */
Game_Interpreter.prototype.previousInterpreterCommand = function(){
this._index -= 1;
};
/* NEW */
Game_Interpreter.prototype.previousEventCode = function(){
return this._list[this._index-1].code;
};
/* NEW */
Game_Interpreter.prototype.currentEventIndex = function(){
return this._index;
};
/* Alias */
var _Scene_Save_onSavefileOk_Alias = Scene_Save.prototype.onSavefileOk;
Scene_Save.prototype.onSavefileOk = function() {
if ($gameMessage.choices().length != 0 && $gameMap._interpreter._waitMode == "message"){
$gameMessage.clear();
interpreter = $gameMap._interpreter;
if (interpreter.previousEventCode() == 102){
for (;
😉 {
interpreter.previousInterpreterCommand();
if (interpreter.currentEventIndex() != 0){
if (interpreter.previousEventCode() != 401 && interpreter.previousEventCode() != 101) break;
if (interpreter.nextEventCode() == 101) break;
} else {
break;
}
};
};
};
_Scene_Save_onSavefileOk_Alias.call(this);
};
/* End of File */
/*=============================================================================*/