sleeping-princess-in-the-attic/data/Override.tjs
2024-04-17 02:37:35 -05:00

120 lines
3.6 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//プラグインやクラス継承
Plugins.link("plugin/ExtKAGParser.dll");
Plugins.link("plugin/windowEx.dll");
KAGLoadScript("APimage.tjs");
//見つからないときのエラー出さないプラグイン 体験版だとわたしの見落としがあるので
Scripts.execStorage("ignoreMissing.tjs");
//変数宣言
var lCanWarp=0;//utl_Scriptにて判定される、ワープ可能かどうか 怖いので
var lCanQuickLoadFlag=0;//ついでにクイックロード判定も追加
var lCanQuickLoadEnabled=0;//ついでにクイックロード判定も追加
var lExitDialogVisibled=0;
var lVisWindow = false;//ウィンドウ表示中、trueになる
// マウス移動時にフックを入れる
function KAGWindow_onMouseMove(x, y, shift) {
if (isMain && fullScreen) {
// フルスクリーンで動的メニュー表示対応
if (y < 4) { // [XXX]どの程度の上部位置でメニューバーを出すか判定(適当に調整のこと)
if (!menu.visible) menu.visible = true;
} else {
if ( menu.visible) menu.visible = false;
}
}
return onMouseMove_orig(...);
}
// メソッド差し替え
&KAGWindow.onMouseMove_orig = &KAGWindow.onMouseMove;
&KAGWindow.onMouseMove = KAGWindow_onMouseMove incontextof null;
// フルスクリーン変更時にフックを入れる
property KAGWindow_fullScreen {
getter {
return fullScreen_orig;
}
setter(v) {
var old = fullScreen_orig; // 古いfullScreen状態
var restore;
if (isMain) {
if (v && !old) {
var iw = innerWidth, ih = innerHeight; // サイズを覚えておく
// ウィンドウ→フルスクリーンで状態を記録しメニュー表示を消す
this.__window_restore = [ menu.visible, iw, ih ];
menu.visible = false;
setInnerSize(iw, ih); // [XXX] menu.visibleを変更した直後のウィンドウサイズがおかしいので再設定する
} else if (!v && old) {
// フルスクリーン→ウィンドウでmenu.visibleを復帰する
restore = typeof this.__window_restore != "undefined" ? __window_restore : void;
menu.visible = restore[0] if (restore);
}
}
fullScreen_orig = v; // 更新する
if (restore) setInnerSize(restore[1], restore[2]); // [XXX]フルスクリーン前のサイズを復帰させる
}
}
// プロパティ差し替え
&KAGWindow.fullScreen_orig = &KAGWindow.fullScreen;
&KAGWindow.fullScreen = &KAGWindow_fullScreen incontextof null;
// メニューの選択時にフックを入れる
function KAGMenuItem_onClick() {
var r = onClick_orig();
// フルスクリーン中であればメニューバーを消す
if (isvalid this && owner && isvalid owner && typeof owner.isMain != "undefined" && owner.isMain && owner.fullScreen) {
owner.menu.visible = false;
}
return r;
}
// メソッド差し替え
&KAGMenuItem.onClick_orig = &KAGMenuItem.onClick;
&KAGMenuItem.onClick = KAGMenuItem_onClick incontextof null;
//ゲームエンジンのバグ修正 極稀にintrandomにバグが発生するとの事。たしかに原因不明のエラーが一度だけ出た
// 0以上1未満の乱数を返す(Math.RandomGeneratorを使うように修正)
Math.random = function() {
if (Math.random.staticGenerator === void) {
Math.setSeed();
}
return Math.random.staticGenerator.random();
};
Math.random.staticGenerator = void;
// Math.randomのシードを設定
Math.setSeed = function(seed) {
if (seed === void) seed = System.getTickCount();
if (Math.random.staticGenerator === void) {
Math.random.staticGenerator = new Math.RandomGenerator(seed);
} else {
Math.random.staticGenerator.randomize(seed);
}
};