/*:
 * @target MZ
 * @plugindesc Core script changes
 * @help blah
 */

Scene_Menu.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createCommandWindow();
    //this.createGoldWindow();
    //this.createStatusWindow();
};

Scene_Menu.prototype.start = function() {
    Scene_MenuBase.prototype.start.call(this);
    //this._statusWindow.refresh();
};

Window_ScrollText.prototype.scrollSpeed = function() {
    let speed = $gameMessage.scrollSpeed() / 5;
    if (this.isFastForward()) {
        speed *= this.fastForwardRate();
    }
    return speed;
};

Scene_Menu.prototype.commandWindowRect = function() {
    const ww = 120;
    const wh = 96;
    const wx = 96;
    const wy = 68;
    return new Rectangle(wx, wy, ww, wh);
};

Window_Base.prototype.lineHeight = function() {
    return 16;
};

Scene_Options.prototype.optionsWindowRect = function() {
    const n = Math.min(this.maxCommands(), this.maxVisibleCommands());
    const ww = 240;
    const wh = this.calcWindowHeight(n, true);
    const wx = (Graphics.boxWidth - ww) / 2;
    const wy = (Graphics.boxHeight - wh) / 2;
    return new Rectangle(wx, wy, ww, wh);
};

Window_Message.prototype.terminateMessage = function() {
    this.close();
    //this._goldWindow.close();
    $gameMessage.clear();
};

Window_NameEdit.prototype.faceWidth = function() {
    return 144;
};

Window_Message.prototype.newLineX = function(textState) {
    const faceExists = $gameMessage.faceName() !== "";
    const faceWidth = ImageManager.faceWidth;
    const spacing = 20;
    const margin = faceExists ? 75 : 4;
    return textState.rtl ? this.innerWidth - margin : margin;
};

Window_Message.prototype.drawMessageFace = function() {
    const faceName = $gameMessage.faceName();
    const faceIndex = $gameMessage.faceIndex();
    const rtl = $gameMessage.isRTL();
    const width = ImageManager.faceWidth;
    const height = this.innerHeight;
    const x = rtl ? this.innerWidth - width - 12 : 4;
    this.drawFace(faceName, faceIndex, 0, 0, width, height);
};

Window_Options.prototype.addGeneralOptions = function() {
    this.addCommand(TextManager.alwaysDash, "alwaysDash");
    //this.addCommand(TextManager.commandRemember, "commandRemember");
    //this.addCommand(TextManager.touchUI, "touchUI");
};

Window_ChoiceList.prototype.windowY = function() {
    return 35;
};

Window_NumberInput.prototype.buttonY = function() {
    return -20;
};