generated from nhcarrigan/template
chore: init
This commit is contained in:
128
js/libs/effekseer.min.js
vendored
Normal file
128
js/libs/effekseer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
js/libs/effekseer.wasm
Normal file
BIN
js/libs/effekseer.wasm
Normal file
Binary file not shown.
7
js/libs/localforage.min.js
vendored
Normal file
7
js/libs/localforage.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
js/libs/pako.min.js
vendored
Normal file
1
js/libs/pako.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
41996
js/libs/pixi.js
Normal file
41996
js/libs/pixi.js
Normal file
File diff suppressed because it is too large
Load Diff
6
js/libs/vorbisdecoder.js
Normal file
6
js/libs/vorbisdecoder.js
Normal file
File diff suppressed because one or more lines are too long
161
js/main.js
Normal file
161
js/main.js
Normal file
@@ -0,0 +1,161 @@
|
||||
//=============================================================================
|
||||
// main.js v1.8.1
|
||||
//=============================================================================
|
||||
|
||||
const scriptUrls = [
|
||||
"js/libs/pixi.js",
|
||||
"js/libs/pako.min.js",
|
||||
"js/libs/localforage.min.js",
|
||||
"js/libs/effekseer.min.js",
|
||||
"js/libs/vorbisdecoder.js",
|
||||
"js/rmmz_core.js",
|
||||
"js/rmmz_managers.js",
|
||||
"js/rmmz_objects.js",
|
||||
"js/rmmz_scenes.js",
|
||||
"js/rmmz_sprites.js",
|
||||
"js/rmmz_windows.js",
|
||||
"js/plugins.js"
|
||||
];
|
||||
const effekseerWasmUrl = "js/libs/effekseer.wasm";
|
||||
|
||||
class Main {
|
||||
constructor() {
|
||||
this.xhrSucceeded = false;
|
||||
this.loadCount = 0;
|
||||
this.error = null;
|
||||
}
|
||||
|
||||
run() {
|
||||
this.showLoadingSpinner();
|
||||
this.testXhr();
|
||||
this.hookNwjsClose();
|
||||
this.loadMainScripts();
|
||||
}
|
||||
|
||||
showLoadingSpinner() {
|
||||
const loadingSpinner = document.createElement("div");
|
||||
const loadingSpinnerImage = document.createElement("div");
|
||||
loadingSpinner.id = "loadingSpinner";
|
||||
loadingSpinnerImage.id = "loadingSpinnerImage";
|
||||
loadingSpinner.appendChild(loadingSpinnerImage);
|
||||
document.body.appendChild(loadingSpinner);
|
||||
}
|
||||
|
||||
eraseLoadingSpinner() {
|
||||
const loadingSpinner = document.getElementById("loadingSpinner");
|
||||
if (loadingSpinner) {
|
||||
document.body.removeChild(loadingSpinner);
|
||||
}
|
||||
}
|
||||
|
||||
testXhr() {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", document.currentScript.src);
|
||||
xhr.onload = () => (this.xhrSucceeded = true);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
hookNwjsClose() {
|
||||
// [Note] When closing the window, the NW.js process sometimes does
|
||||
// not terminate properly. This code is a workaround for that.
|
||||
if (typeof nw === "object") {
|
||||
nw.Window.get().on("close", () => nw.App.quit());
|
||||
}
|
||||
}
|
||||
|
||||
loadMainScripts() {
|
||||
for (const url of scriptUrls) {
|
||||
const script = document.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.src = url;
|
||||
script.async = false;
|
||||
script.defer = true;
|
||||
script.onload = this.onScriptLoad.bind(this);
|
||||
script.onerror = this.onScriptError.bind(this);
|
||||
script._url = url;
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
this.numScripts = scriptUrls.length;
|
||||
window.addEventListener("load", this.onWindowLoad.bind(this));
|
||||
window.addEventListener("error", this.onWindowError.bind(this));
|
||||
}
|
||||
|
||||
onScriptLoad() {
|
||||
if (++this.loadCount === this.numScripts) {
|
||||
PluginManager.setup($plugins);
|
||||
}
|
||||
}
|
||||
|
||||
onScriptError(e) {
|
||||
this.printError("Failed to load", e.target._url);
|
||||
}
|
||||
|
||||
printError(name, message) {
|
||||
this.eraseLoadingSpinner();
|
||||
if (!document.getElementById("errorPrinter")) {
|
||||
const errorPrinter = document.createElement("div");
|
||||
errorPrinter.id = "errorPrinter";
|
||||
errorPrinter.innerHTML = this.makeErrorHtml(name, message);
|
||||
document.body.appendChild(errorPrinter);
|
||||
}
|
||||
}
|
||||
|
||||
makeErrorHtml(name, message) {
|
||||
const nameDiv = document.createElement("div");
|
||||
const messageDiv = document.createElement("div");
|
||||
nameDiv.id = "errorName";
|
||||
messageDiv.id = "errorMessage";
|
||||
nameDiv.innerHTML = name;
|
||||
messageDiv.innerHTML = message;
|
||||
return nameDiv.outerHTML + messageDiv.outerHTML;
|
||||
}
|
||||
|
||||
onWindowLoad() {
|
||||
if (!this.xhrSucceeded) {
|
||||
const message = "Your browser does not allow to read local files.";
|
||||
this.printError("Error", message);
|
||||
} else if (this.isPathRandomized()) {
|
||||
const message = "Please move the Game.app to a different folder.";
|
||||
this.printError("Error", message);
|
||||
} else if (this.error) {
|
||||
this.printError(this.error.name, this.error.message);
|
||||
} else {
|
||||
this.initEffekseerRuntime();
|
||||
}
|
||||
}
|
||||
|
||||
onWindowError(event) {
|
||||
if (!this.error) {
|
||||
this.error = event.error;
|
||||
}
|
||||
}
|
||||
|
||||
isPathRandomized() {
|
||||
// [Note] We cannot save the game properly when Gatekeeper Path
|
||||
// Randomization is in effect.
|
||||
return (
|
||||
typeof process === "object" &&
|
||||
process.mainModule.filename.startsWith("/private/var")
|
||||
);
|
||||
}
|
||||
|
||||
initEffekseerRuntime() {
|
||||
const onLoad = this.onEffekseerLoad.bind(this);
|
||||
const onError = this.onEffekseerError.bind(this);
|
||||
effekseer.initRuntime(effekseerWasmUrl, onLoad, onError);
|
||||
}
|
||||
|
||||
onEffekseerLoad() {
|
||||
this.eraseLoadingSpinner();
|
||||
SceneManager.run(Scene_Boot);
|
||||
}
|
||||
|
||||
onEffekseerError() {
|
||||
this.printError("Failed to load", effekseerWasmUrl);
|
||||
}
|
||||
}
|
||||
|
||||
const main = new Main();
|
||||
main.run();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
5
js/plugins.js
Normal file
5
js/plugins.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Generated by RPG Maker.
|
||||
// Do not edit this file directly.
|
||||
var $plugins =
|
||||
[
|
||||
];
|
||||
105
js/plugins/AltMenuScreen.js
Normal file
105
js/plugins/AltMenuScreen.js
Normal file
@@ -0,0 +1,105 @@
|
||||
//=============================================================================
|
||||
// RPG Maker MZ - Alternative Menu Screen
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @target MZ
|
||||
* @plugindesc Alternative menu screen layout.
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help AltMenuScreen.js
|
||||
*
|
||||
* This plugin changes the layout of the menu screen.
|
||||
* It puts the commands on the top and the status on the bottom.
|
||||
*
|
||||
* It does not provide plugin commands.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @target MZ
|
||||
* @plugindesc メニュー画面のレイアウトを変更します。
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help AltMenuScreen.js
|
||||
*
|
||||
* このプラグインは、メニュー画面のレイアウトを変更します。
|
||||
* コマンドを上側に、ステータスを下側に配置します。
|
||||
*
|
||||
* プラグインコマンドはありません。
|
||||
*/
|
||||
|
||||
(() => {
|
||||
Scene_MenuBase.prototype.commandWindowHeight = function() {
|
||||
return this.calcWindowHeight(2, true);
|
||||
};
|
||||
|
||||
Scene_MenuBase.prototype.goldWindowHeight = function() {
|
||||
return this.calcWindowHeight(1, true);
|
||||
};
|
||||
|
||||
Scene_Menu.prototype.commandWindowRect = function() {
|
||||
const ww = Graphics.boxWidth;
|
||||
const wh = this.commandWindowHeight();
|
||||
const wx = 0;
|
||||
const wy = this.mainAreaTop();
|
||||
return new Rectangle(wx, wy, ww, wh);
|
||||
};
|
||||
|
||||
Scene_Menu.prototype.statusWindowRect = function() {
|
||||
const h1 = this.commandWindowHeight();
|
||||
const h2 = this.goldWindowHeight();
|
||||
const ww = Graphics.boxWidth;
|
||||
const wh = this.mainAreaHeight() - h1 - h2;
|
||||
const wx = 0;
|
||||
const wy = this.mainAreaTop() + this.commandWindowHeight();
|
||||
return new Rectangle(wx, wy, ww, wh);
|
||||
};
|
||||
|
||||
Scene_ItemBase.prototype.actorWindowRect = function() {
|
||||
const rect = Scene_Menu.prototype.statusWindowRect();
|
||||
rect.y = this.mainAreaBottom() - rect.height;
|
||||
return rect;
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.maxCols = function() {
|
||||
return 4;
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.numVisibleRows = function() {
|
||||
return 2;
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.maxCols = function() {
|
||||
return 4;
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.numVisibleRows = function() {
|
||||
return 1;
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.drawItemImage = function(index) {
|
||||
const actor = this.actor(index);
|
||||
const rect = this.itemRectWithPadding(index);
|
||||
const w = Math.min(rect.width, 144);
|
||||
const h = Math.min(rect.height, 144);
|
||||
const lineHeight = this.lineHeight();
|
||||
this.changePaintOpacity(actor.isBattleMember());
|
||||
this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2, w, h);
|
||||
this.changePaintOpacity(true);
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.drawItemStatus = function(index) {
|
||||
const actor = this.actor(index);
|
||||
const rect = this.itemRectWithPadding(index);
|
||||
const x = rect.x;
|
||||
const y = rect.y;
|
||||
const width = rect.width;
|
||||
const bottom = y + rect.height;
|
||||
const lineHeight = this.lineHeight();
|
||||
this.drawActorName(actor, x, y + lineHeight * 0, width);
|
||||
this.drawActorLevel(actor, x, y + lineHeight * 1, width);
|
||||
this.drawActorClass(actor, x, bottom - lineHeight * 4, width);
|
||||
this.placeBasicGauges(actor, x, bottom - lineHeight * 3, width);
|
||||
this.drawActorIcons(actor, x, bottom - lineHeight * 1, width);
|
||||
};
|
||||
})();
|
||||
126
js/plugins/AltSaveScreen.js
Normal file
126
js/plugins/AltSaveScreen.js
Normal file
@@ -0,0 +1,126 @@
|
||||
//=============================================================================
|
||||
// RPG Maker MZ - Alternative Save Screen
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @target MZ
|
||||
* @plugindesc Alternative save/load screen layout.
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help AltSaveScreen.js
|
||||
*
|
||||
* This plugin changes the layout of the save/load screen.
|
||||
* It puts the file list on the top and the details on the bottom.
|
||||
*
|
||||
* It does not provide plugin commands.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @target MZ
|
||||
* @plugindesc セーブ/ロード画面のレイアウトを変更します。
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help AltSaveScreen.js
|
||||
*
|
||||
* このプラグインは、セーブ/ロード画面のレイアウトを変更します。
|
||||
* ファイル一覧を上側に、詳細を下側に配置します。
|
||||
*
|
||||
* プラグインコマンドはありません。
|
||||
*/
|
||||
|
||||
(() => {
|
||||
const _Scene_File_create = Scene_File.prototype.create;
|
||||
Scene_File.prototype.create = function() {
|
||||
_Scene_File_create.apply(this, arguments);
|
||||
this._listWindow.height = this._listWindow.fittingHeight(3);
|
||||
const x = 0;
|
||||
const y = this._listWindow.y + this._listWindow.height;
|
||||
const width = Graphics.boxWidth;
|
||||
const height = Graphics.boxHeight - y;
|
||||
const rect = new Rectangle(x, y, width, height);
|
||||
const statusWindow = new Window_SavefileStatus(rect);
|
||||
this._listWindow.mzkp_statusWindow = statusWindow;
|
||||
this.addWindow(statusWindow);
|
||||
};
|
||||
|
||||
const _Scene_File_start = Scene_File.prototype.start;
|
||||
Scene_File.prototype.start = function() {
|
||||
_Scene_File_start.apply(this, arguments);
|
||||
this._listWindow.ensureCursorVisible();
|
||||
this._listWindow.callUpdateHelp();
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.windowWidth = function() {
|
||||
return Graphics.boxWidth;
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.maxCols = function() {
|
||||
return 4;
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.itemHeight = function() {
|
||||
return this.lineHeight() * 2 + 16;
|
||||
};
|
||||
|
||||
const _Window_SavefileList_callUpdateHelp =
|
||||
Window_SavefileList.prototype.callUpdateHelp;
|
||||
Window_SavefileList.prototype.callUpdateHelp = function() {
|
||||
_Window_SavefileList_callUpdateHelp.apply(this, arguments);
|
||||
if (this.active && this.mzkp_statusWindow) {
|
||||
this.mzkp_statusWindow.setSavefileId(this.savefileId());
|
||||
}
|
||||
};
|
||||
|
||||
function Window_SavefileStatus() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_SavefileStatus.prototype = Object.create(Window_Base.prototype);
|
||||
Window_SavefileStatus.prototype.constructor = Window_SavefileStatus;
|
||||
|
||||
Window_SavefileStatus.prototype.initialize = function(rect) {
|
||||
Window_Base.prototype.initialize.call(this, rect);
|
||||
this._savefileId = 1;
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.setSavefileId = function(id) {
|
||||
this._savefileId = id;
|
||||
this.refresh();
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.refresh = function() {
|
||||
const info = DataManager.savefileInfo(this._savefileId);
|
||||
const rect = this.contents.rect;
|
||||
this.contents.clear();
|
||||
this.resetTextColor();
|
||||
this.drawTitle(this._savefileId, rect.x, rect.y);
|
||||
if (info) {
|
||||
this.drawContents(info, rect);
|
||||
}
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.drawTitle = function(savefileId, x, y) {
|
||||
if (savefileId === 0) {
|
||||
this.drawText(TextManager.autosave, x, y, 180);
|
||||
} else {
|
||||
this.drawText(TextManager.file + " " + savefileId, x, y, 180);
|
||||
}
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.drawContents = function(info, rect) {
|
||||
const bottom = rect.y + rect.height;
|
||||
const playtimeY = bottom - this.lineHeight();
|
||||
this.drawText(info.title, rect.x + 192, rect.y, rect.width - 192);
|
||||
this.drawPartyfaces(info.faces, rect.x, bottom - 144);
|
||||
this.drawText(info.playtime, rect.x, playtimeY, rect.width, "right");
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.drawPartyfaces = function(faces, x, y) {
|
||||
if (faces) {
|
||||
for (let i = 0; i < faces.length; i++) {
|
||||
const data = faces[i];
|
||||
this.drawFace(data[0], data[1], x + i * 150, y);
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
106
js/plugins/ButtonPicture.js
Normal file
106
js/plugins/ButtonPicture.js
Normal file
@@ -0,0 +1,106 @@
|
||||
//=============================================================================
|
||||
// RPG Maker MZ - Button Picture
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @target MZ
|
||||
* @plugindesc Makes a picture clickable.
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help ButtonPicture.js
|
||||
*
|
||||
* This plugin provides a command to call a common event when a picture is
|
||||
* clicked.
|
||||
*
|
||||
* Use it in the following procedure.
|
||||
* 1. Execute "Show Picture" to display your button image.
|
||||
* 2. Call the plugin command "Set Button Picture".
|
||||
*
|
||||
* @command set
|
||||
* @text Set Button Picture
|
||||
* @desc Makes the specified picture clickable.
|
||||
*
|
||||
* @arg pictureId
|
||||
* @type number
|
||||
* @min 1
|
||||
* @max 100
|
||||
* @default 1
|
||||
* @text Picture Number
|
||||
* @desc Control number of the picture.
|
||||
*
|
||||
* @arg commonEventId
|
||||
* @type common_event
|
||||
* @default 1
|
||||
* @text Common Event
|
||||
* @desc Common event to call when the picture is clicked.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @target MZ
|
||||
* @plugindesc ピクチャをクリック可能にします。
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help ButtonPicture.js
|
||||
*
|
||||
* このプラグインは、ピクチャのクリック時にコモンイベントを呼び出すコマンドを
|
||||
* 提供します。
|
||||
*
|
||||
* 次の手順で使用してください。
|
||||
* 1. 「ピクチャの表示」を実行して、ボタン画像を表示します。
|
||||
* 2. プラグインコマンド「ボタンピクチャの設定」を呼び出します。
|
||||
*
|
||||
* @command set
|
||||
* @text ボタンピクチャの設定
|
||||
* @desc 指定したピクチャをクリック可能にします。
|
||||
*
|
||||
* @arg pictureId
|
||||
* @type number
|
||||
* @min 1
|
||||
* @max 100
|
||||
* @default 1
|
||||
* @text ピクチャ番号
|
||||
* @desc ピクチャの管理番号です。
|
||||
*
|
||||
* @arg commonEventId
|
||||
* @type common_event
|
||||
* @default 1
|
||||
* @text コモンイベント
|
||||
* @desc ピクチャがクリックされた時に呼び出すコモンイベントです。
|
||||
*/
|
||||
|
||||
(() => {
|
||||
const pluginName = "ButtonPicture";
|
||||
|
||||
PluginManager.registerCommand(pluginName, "set", args => {
|
||||
const pictureId = Number(args.pictureId);
|
||||
const commonEventId = Number(args.commonEventId);
|
||||
const picture = $gameScreen.picture(pictureId);
|
||||
if (picture) {
|
||||
picture.mzkp_commonEventId = commonEventId;
|
||||
}
|
||||
});
|
||||
|
||||
Sprite_Picture.prototype.isClickEnabled = function() {
|
||||
const picture = this.picture();
|
||||
return picture && picture.mzkp_commonEventId && !$gameMessage.isBusy();
|
||||
};
|
||||
|
||||
Sprite_Picture.prototype.onClick = function() {
|
||||
$gameTemp.reserveCommonEvent(this.picture().mzkp_commonEventId);
|
||||
};
|
||||
|
||||
Spriteset_Base.prototype.mzkp_isAnyPicturePressed = function() {
|
||||
return this._pictureContainer.children.some(sprite =>
|
||||
sprite.isPressed()
|
||||
);
|
||||
};
|
||||
|
||||
const _Scene_Map_isAnyButtonPressed =
|
||||
Scene_Map.prototype.isAnyButtonPressed;
|
||||
Scene_Map.prototype.isAnyButtonPressed = function() {
|
||||
return (
|
||||
_Scene_Map_isAnyButtonPressed.apply(this, arguments) ||
|
||||
this._spriteset.mzkp_isAnyPicturePressed()
|
||||
);
|
||||
};
|
||||
})();
|
||||
116
js/plugins/TextPicture.js
Normal file
116
js/plugins/TextPicture.js
Normal file
@@ -0,0 +1,116 @@
|
||||
//=============================================================================
|
||||
// RPG Maker MZ - Text Picture
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @target MZ
|
||||
* @plugindesc Displays text as a picture.
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help TextPicture.js
|
||||
*
|
||||
* This plugin provides a command to show text as a picture.
|
||||
*
|
||||
* Use it in the following procedure.
|
||||
* 1. Call the plugin command "Set Text Picture".
|
||||
* 2. Execute "Show Picture" without specifying an image.
|
||||
*
|
||||
* @command set
|
||||
* @text Set Text Picture
|
||||
* @desc Sets text to display as a picture.
|
||||
* After this, execute "Show Picture" without specifying an image.
|
||||
*
|
||||
* @arg text
|
||||
* @type multiline_string
|
||||
* @text Text
|
||||
* @desc Text to display as a picture.
|
||||
* Control characters are allowed.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @target MZ
|
||||
* @plugindesc テキストをピクチャとして表示します。
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help TextPicture.js
|
||||
*
|
||||
* このプラグインは、テキストをピクチャとして表示するコマンドを提供します。
|
||||
*
|
||||
* 次の手順で使用してください。
|
||||
* 1. プラグインコマンド「テキストピクチャの設定」を呼び出します。
|
||||
* 2. 画像を指定せずに「ピクチャの表示」を実行します。
|
||||
*
|
||||
* @command set
|
||||
* @text テキストピクチャの設定
|
||||
* @desc ピクチャとして表示するテキストを設定します。
|
||||
* この後、画像を指定せずに「ピクチャの表示」を実行してください。
|
||||
*
|
||||
* @arg text
|
||||
* @type multiline_string
|
||||
* @text テキスト
|
||||
* @desc ピクチャとして表示するテキストです。
|
||||
* 制御文字が使用可能です。
|
||||
*/
|
||||
|
||||
(() => {
|
||||
const pluginName = "TextPicture";
|
||||
let textPictureText = "";
|
||||
|
||||
PluginManager.registerCommand(pluginName, "set", args => {
|
||||
textPictureText = String(args.text);
|
||||
});
|
||||
|
||||
const _Game_Picture_show = Game_Picture.prototype.show;
|
||||
Game_Picture.prototype.show = function() {
|
||||
_Game_Picture_show.apply(this, arguments);
|
||||
if (this._name === "" && textPictureText) {
|
||||
this.mzkp_text = textPictureText;
|
||||
this.mzkp_textChanged = true;
|
||||
textPictureText = "";
|
||||
}
|
||||
};
|
||||
|
||||
const _Sprite_Picture_destroy = Sprite_Picture.prototype.destroy;
|
||||
Sprite_Picture.prototype.destroy = function() {
|
||||
destroyTextPictureBitmap(this.bitmap);
|
||||
_Sprite_Picture_destroy.apply(this, arguments);
|
||||
};
|
||||
|
||||
const _Sprite_Picture_updateBitmap = Sprite_Picture.prototype.updateBitmap;
|
||||
Sprite_Picture.prototype.updateBitmap = function() {
|
||||
_Sprite_Picture_updateBitmap.apply(this, arguments);
|
||||
if (this.visible && this._pictureName === "") {
|
||||
const picture = this.picture();
|
||||
const text = picture ? picture.mzkp_text || "" : "";
|
||||
const textChanged = picture && picture.mzkp_textChanged;
|
||||
if (this.mzkp_text !== text || textChanged) {
|
||||
this.mzkp_text = text;
|
||||
destroyTextPictureBitmap(this.bitmap);
|
||||
this.bitmap = createTextPictureBitmap(text);
|
||||
picture.mzkp_textChanged = false;
|
||||
}
|
||||
} else {
|
||||
this.mzkp_text = "";
|
||||
}
|
||||
};
|
||||
|
||||
function createTextPictureBitmap(text) {
|
||||
const tempWindow = new Window_Base(new Rectangle());
|
||||
const size = tempWindow.textSizeEx(text);
|
||||
tempWindow.padding = 0;
|
||||
tempWindow.move(0, 0, size.width, size.height);
|
||||
tempWindow.createContents();
|
||||
tempWindow.drawTextEx(text, 0, 0, 0);
|
||||
const bitmap = tempWindow.contents;
|
||||
tempWindow.contents = null;
|
||||
tempWindow.destroy();
|
||||
bitmap.mzkp_isTextPicture = true;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
function destroyTextPictureBitmap(bitmap) {
|
||||
if (bitmap && bitmap.mzkp_isTextPicture) {
|
||||
bitmap.destroy();
|
||||
}
|
||||
}
|
||||
})();
|
||||
6493
js/rmmz_core.js
Normal file
6493
js/rmmz_core.js
Normal file
File diff suppressed because it is too large
Load Diff
3128
js/rmmz_managers.js
Normal file
3128
js/rmmz_managers.js
Normal file
File diff suppressed because it is too large
Load Diff
11323
js/rmmz_objects.js
Normal file
11323
js/rmmz_objects.js
Normal file
File diff suppressed because it is too large
Load Diff
3692
js/rmmz_scenes.js
Normal file
3692
js/rmmz_scenes.js
Normal file
File diff suppressed because it is too large
Load Diff
3697
js/rmmz_sprites.js
Normal file
3697
js/rmmz_sprites.js
Normal file
File diff suppressed because it is too large
Load Diff
6655
js/rmmz_windows.js
Normal file
6655
js/rmmz_windows.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user