let BugFix_NUpdateSc = Game_Interpreter.prototype.NUpdateSc;
const SW_戦闘中 = 551;
Game_Interpreter.prototype.NUpdateSc = function () {
    BugFix_NUpdateSc.call(this);
    L2DVoiceSeFlg = true; 
    if ($gameSystem.SetAdSys == undefined) $gameSystem.SetAdSys = [];
    if ($gameSystem.AdSysCT == undefined) $gameSystem.AdSysCT = [];
    if (battleflg && !$gameSwitches.value(SW_戦闘中)) $gameSwitches.setValue(SW_戦闘中 , true);
    if (!battleflg && $gameSwitches.value(SW_戦闘中)) $gameSwitches.setValue(SW_戦闘中 , false);
};
(function () {
    'use strict';
    let _Sprite__renderCanvas = Sprite.prototype._renderCanvas;
    Sprite.prototype._renderCanvas = function (renderer) {
        _Sprite__renderCanvas.apply(this, arguments);
        if (this.isExistLoadingBitmap()) {
            this._renderCanvas_PIXI(renderer);
        }
    };
    let _Sprite__renderWebGL = Sprite.prototype._renderWebGL;
    Sprite.prototype._renderWebGL = function (renderer) {
        _Sprite__renderWebGL.apply(this, arguments);
        if (this.isExistLoadingBitmap()) {
            if (this._isPicture) {
                this._speedUpCustomBlendModes(renderer);
                renderer.setObjectRenderer(renderer.plugins.picture);
                if (!this.isVideoPicture || !this.isVideoPicture()) {
                    renderer.plugins.picture.render(this);
                }
            } else {
                renderer.setObjectRenderer(renderer.plugins.sprite);
                renderer.plugins.sprite.render(this);
            }
        }
    };
    Sprite.prototype.isExistLoadingBitmap = function () {
        return this.bitmap && !this.bitmap.isReady();
    };
})();
let FastUpdateFlg = false;
Scene_Map.prototype.updateMainMultiply = function () {
    this.updateMain();
    if (!battleflg) {
        if (this.isFastForward()) {
            FastUpdateFlg = true;
            this.updateMain();
            FastUpdateFlg = false;
        }
    }
};
Scene_Map.prototype.isFastForward = function () {
    if (isFastOff) return false;
    if (!battleflg) {
        return ($gameMap.isEventRunning() && !SceneManager.isSceneChanging() &&
            (Input.isLongPressed('ok') || TouchInput.isLongPressed() || Input.isPressed('control')));
    } else {
        return ($gameMap.isEventRunning() && !SceneManager.isSceneChanging() &&
            (Input.isLongPressed('ok') || TouchInput.isLongPressed()));
    }
};
let _TextLoadFlg = false;
let _LoadTxtArr = ["GameFont", "Makinas", "Digit"];
let _TextLoad = Game_Interpreter.prototype.NUpdateSc;
Game_Interpreter.prototype.NUpdateSc = function () {
    _TextLoad.call(this);
    if (!_TextLoadFlg) {
        for (let i = 0; i <= _LoadTxtArr.length - 1; i++) {
            D_Text_Cng_font = _LoadTxtArr[i]; 
            this.SpriteStr(PVS_MaxPicNo - 1 - i, "_fonts_", 20, -100, -100, 255);
            D_Text_Cng_font = ""; 
        }
        _TextLoadFlg = true;
        console.log("初期テキストロード完了");
    }
}
let command136_FalseFlg = false;
Game_Interpreter.prototype.command136 = function () {
    // if (Live2DJsonLoading) return false;
    // if (L2D_NowLoadMdlName != "") return false;
    return true; 
};
Game_Interpreter.prototype.command355_Check = function () {
    if (L2D_NowLoadMdlName != "") {
        return true; 
    }
    return false; 
};
let MapCngAutoPlayBGMOFF = false;
let AutoSave待機Flame = -1;
let AutoSave_SetUpdate = Game_Interpreter.prototype.NUpdateSc;
Game_Interpreter.prototype.NUpdateSc = function () {
    AutoSave_SetUpdate.call(this);
    if (AutoSave待機Flame > 0) {
        AutoSave待機Flame--;
        if (AutoSave待機Flame == 0) this.NAutoDataSave(); 
    }
}
var SyogoGetFlame = 5;
let CheckActor99Name = function () {
    let actor99 = $gameActors.actor(99);
    if (actor99 && actor99._name === 0) {
        actor99._name = "ハイランダー隊員";
    }
}
