From d8259e3b9b2d29d688ee1550db21d9033283a114 Mon Sep 17 00:00:00 2001 From: Salted <44394537+xian18@users.noreply.github.com> Date: Sat, 17 Sep 2022 22:52:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=BC=BA=E5=B0=91=E5=A4=A7?= =?UTF-8?q?=E5=8F=B7=E8=84=B8=E5=9B=BE=E6=97=B6=E8=87=AA=E5=8A=A8=E5=9B=9E?= =?UTF-8?q?=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme.md | 1 + data/LargeFace.json | 1 + data/Test_LargeFace.json | 1 + img/{pictures => faces/large}/主角团_1.png | Bin img/{pictures => faces/large}/主角团_2.png | Bin img/{pictures => faces/large}/主角团_3.png | Bin img/{pictures => faces/large}/主角团_4.png | Bin img/{pictures => faces/large}/主角团_5.png | Bin img/{pictures => faces/large}/主角团_6.png | Bin img/{pictures => faces/large}/主角团_7.png | Bin img/{pictures => faces/large}/主角团_8.png | Bin img/{pictures => faces/large}/莎奇拉_1.png | Bin img/{pictures => faces/large}/配角团_1.png | Bin img/{pictures => faces/large}/配角团_2.png | Bin img/{pictures => faces/large}/配角团_3.png | Bin img/{pictures => faces/large}/配角团_4.png | Bin img/{pictures => faces/large}/配角团_5.png | Bin js/plugins/GALV_MessageBusts.js | 622 ++++++++++++--------- js/plugins/SF_MessageBusts.js | 46 -- js/plugins/SF_StatesOverride.js | 0 js/plugins/SF_TestPlugins.js | 18 +- 21 files changed, 373 insertions(+), 316 deletions(-) create mode 100644 data/LargeFace.json create mode 100644 data/Test_LargeFace.json rename img/{pictures => faces/large}/主角团_1.png (100%) rename img/{pictures => faces/large}/主角团_2.png (100%) rename img/{pictures => faces/large}/主角团_3.png (100%) rename img/{pictures => faces/large}/主角团_4.png (100%) rename img/{pictures => faces/large}/主角团_5.png (100%) rename img/{pictures => faces/large}/主角团_6.png (100%) rename img/{pictures => faces/large}/主角团_7.png (100%) rename img/{pictures => faces/large}/主角团_8.png (100%) rename img/{pictures => faces/large}/莎奇拉_1.png (100%) rename img/{pictures => faces/large}/配角团_1.png (100%) rename img/{pictures => faces/large}/配角团_2.png (100%) rename img/{pictures => faces/large}/配角团_3.png (100%) rename img/{pictures => faces/large}/配角团_4.png (100%) rename img/{pictures => faces/large}/配角团_5.png (100%) delete mode 100644 js/plugins/SF_MessageBusts.js create mode 100644 js/plugins/SF_StatesOverride.js diff --git a/Readme.md b/Readme.md index 27596cd..0318156 100644 --- a/Readme.md +++ b/Readme.md @@ -21,6 +21,7 @@ ## 更新记录 +- **2022/9/17**;**咸鱼**;修改了 Galv_MessageBusts 支持了预先扫描文件来获取相关信息 - **2022/9/17**;**咸鱼**;添加了普攻替换插件 - **2022/9/7**;**面具**;数值整理,素材整理,添加怪物 - **2022/8/30**;**不明枪兵**;更新海上的剧情 diff --git a/data/LargeFace.json b/data/LargeFace.json new file mode 100644 index 0000000..fdc5f8d --- /dev/null +++ b/data/LargeFace.json @@ -0,0 +1 @@ +{"主角团":{"1":{"FileName":"主角团_1","@c":3},"3":{"FileName":"主角团_3","@c":4},"5":{"FileName":"主角团_5","@c":5},"7":{"FileName":"主角团_7","@c":6},"@c":2},"莎奇拉":{"1":{"FileName":"莎奇拉_1","@c":8},"@c":7},"配角团":{"2":{"FileName":"配角团_2","@c":10},"4":{"FileName":"配角团_4","@c":11},"@c":9},"@c":1} \ No newline at end of file diff --git a/data/Test_LargeFace.json b/data/Test_LargeFace.json new file mode 100644 index 0000000..fdc5f8d --- /dev/null +++ b/data/Test_LargeFace.json @@ -0,0 +1 @@ +{"主角团":{"1":{"FileName":"主角团_1","@c":3},"3":{"FileName":"主角团_3","@c":4},"5":{"FileName":"主角团_5","@c":5},"7":{"FileName":"主角团_7","@c":6},"@c":2},"莎奇拉":{"1":{"FileName":"莎奇拉_1","@c":8},"@c":7},"配角团":{"2":{"FileName":"配角团_2","@c":10},"4":{"FileName":"配角团_4","@c":11},"@c":9},"@c":1} \ No newline at end of file diff --git a/img/pictures/主角团_1.png b/img/faces/large/主角团_1.png similarity index 100% rename from img/pictures/主角团_1.png rename to img/faces/large/主角团_1.png diff --git a/img/pictures/主角团_2.png b/img/faces/large/主角团_2.png similarity index 100% rename from img/pictures/主角团_2.png rename to img/faces/large/主角团_2.png diff --git a/img/pictures/主角团_3.png b/img/faces/large/主角团_3.png similarity index 100% rename from img/pictures/主角团_3.png rename to img/faces/large/主角团_3.png diff --git a/img/pictures/主角团_4.png b/img/faces/large/主角团_4.png similarity index 100% rename from img/pictures/主角团_4.png rename to img/faces/large/主角团_4.png diff --git a/img/pictures/主角团_5.png b/img/faces/large/主角团_5.png similarity index 100% rename from img/pictures/主角团_5.png rename to img/faces/large/主角团_5.png diff --git a/img/pictures/主角团_6.png b/img/faces/large/主角团_6.png similarity index 100% rename from img/pictures/主角团_6.png rename to img/faces/large/主角团_6.png diff --git a/img/pictures/主角团_7.png b/img/faces/large/主角团_7.png similarity index 100% rename from img/pictures/主角团_7.png rename to img/faces/large/主角团_7.png diff --git a/img/pictures/主角团_8.png b/img/faces/large/主角团_8.png similarity index 100% rename from img/pictures/主角团_8.png rename to img/faces/large/主角团_8.png diff --git a/img/pictures/莎奇拉_1.png b/img/faces/large/莎奇拉_1.png similarity index 100% rename from img/pictures/莎奇拉_1.png rename to img/faces/large/莎奇拉_1.png diff --git a/img/pictures/配角团_1.png b/img/faces/large/配角团_1.png similarity index 100% rename from img/pictures/配角团_1.png rename to img/faces/large/配角团_1.png diff --git a/img/pictures/配角团_2.png b/img/faces/large/配角团_2.png similarity index 100% rename from img/pictures/配角团_2.png rename to img/faces/large/配角团_2.png diff --git a/img/pictures/配角团_3.png b/img/faces/large/配角团_3.png similarity index 100% rename from img/pictures/配角团_3.png rename to img/faces/large/配角团_3.png diff --git a/img/pictures/配角团_4.png b/img/faces/large/配角团_4.png similarity index 100% rename from img/pictures/配角团_4.png rename to img/faces/large/配角团_4.png diff --git a/img/pictures/配角团_5.png b/img/faces/large/配角团_5.png similarity index 100% rename from img/pictures/配角团_5.png rename to img/faces/large/配角团_5.png diff --git a/js/plugins/GALV_MessageBusts.js b/js/plugins/GALV_MessageBusts.js index 945a43b..aa86d4a 100644 --- a/js/plugins/GALV_MessageBusts.js +++ b/js/plugins/GALV_MessageBusts.js @@ -35,16 +35,16 @@ var Imported = Imported || {}; Imported.Galv_MessageBusts = true; -var Galv = Galv || {}; // Galv's main object -Galv.pCmd = Galv.pCmd || {}; // Plugin Command manager -Galv.MB = Galv.MB || {}; // Galv's stuff +var Galv = Galv || {}; // Galv's main object +Galv.pCmd = Galv.pCmd || {}; // Plugin Command manager +Galv.MB = Galv.MB || {}; // Galv's stuff -Galv.Mstyle = Galv.Mstyle || {}; // compatibility +Galv.Mstyle = Galv.Mstyle || {}; // compatibility //----------------------------------------------------------------------------- /*: * @plugindesc (v.2.6) Displays a bust image instead of selected face image - * + * * @author Galv - galvs-scripts.com * * @param Bust Priority @@ -64,6 +64,12 @@ Galv.Mstyle = Galv.Mstyle || {}; // compatibility * @default * * @help + * + * 修改说明: + * 1. 文件夹路径替换为 img/face/large,图片名称不变 + * 2. 预先生成文件相关信息,依赖于 SF_Core.js + * 3. 支持没有图片时自动加载在对话时选择的图片 + * * Galv's Message Busts * ---------------------------------------------------------------------------- * This plugin displays a bust image from /img/pictures/ folder based on the @@ -82,7 +88,7 @@ Galv.Mstyle = Galv.Mstyle || {}; // compatibility * Make sure to add 'wait' between messages with different character's busts * for better looking transitions. * Use the 'Plugin' event command to change bust settings. These settings will - * be in effect until changed, so they can be used for multiple messages. + * be in effect until changed, so they can be used for multiple messages. * * NOTE: You will need to find your own bust images to use. I can not help * you with that. The images in the demo are for demo purposes only. @@ -113,7 +119,7 @@ Galv.Mstyle = Galv.Mstyle || {}; // compatibility * // MIRROR = TRUE or FALSE * BUST STATUS // STATUS = TRUE or FALSE * - * + * * ---------------------------------------------------------------------------- * Examples: * BUST LEFT FALSE // Bust will appear on the left and not mirrored. @@ -138,184 +144,270 @@ Galv.Mstyle = Galv.Mstyle || {}; // compatibility * ---------------------------------------------------------------------------- */ - //----------------------------------------------------------------------------- // CODE STUFFS //----------------------------------------------------------------------------- -(function() { - - Galv.MB.prio = Number(PluginManager.parameters('Galv_MessageBusts')["Bust Priority"]); - Galv.MB.pos = Number(PluginManager.parameters('Galv_MessageBusts')["Bust Position"]); - Galv.MB.w = Number(PluginManager.parameters('Galv_MessageBusts')["Text X Offset"]); - Galv.MB.f = PluginManager.parameters('Galv_MessageBusts')["Filename Append"]; - - Galv.MB.msgWindow = null; - -if (Galv.MB.prio == 1 && Galv.MB.pos == 0) { - // Fix - Galv.MB.prio = 0; -}; - -// GALV'S PLUGIN MANAGEMENT. INCLUDED IN ALL GALV PLUGINS THAT HAVE PLUGIN COMMAND CALLS, BUT ONLY RUN ONCE. -if (!Galv.aliased) { - var Galv_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; - Game_Interpreter.prototype.pluginCommand = function(command, args) { - if (Galv.pCmd[command]) { - Galv.pCmd[command](args); - return; - }; - Galv_Game_Interpreter_pluginCommand.call(this, command, args); - }; - Galv.aliased = true; // Don't keep aliasing for other Galv scripts. -}; - -// Direct to Plugin Object -Galv.pCmd.BUST = function(arguments) { - Galv.MB.bustPos(arguments); -}; -// END GALV'S PLUGIN MANAGEMENT - -Galv.MB.bustPos = function(pos) { - if (pos[0] === "TRUE") { - return $gameSystem.bustDisable = false; - } else if (pos[0] === "FALSE") { - return $gameSystem.bustDisable = true; - }; - - $gameSystem.bustPos = 0 - if (pos[0] === "LEFT") { - $gameSystem.bustPos = 0; - } else if (pos[0] === "RIGHT") { - $gameSystem.bustPos = 1; - }; - if (pos[1] === "TRUE") { - $gameSystem.bustMirror = true; - } else if (pos[1] === "FALSE") { - $gameSystem.bustMirror = false; - }; -}; - - - -// ---------------- WINDOW MESSAGE - -Galv.MB.Game_Message_setFaceImage = Game_Message.prototype.setFaceImage; -Game_Message.prototype.setFaceImage = function(faceName, faceIndex) { - switch (faceName) { - case 'PartyLeader': - var faceName = $gameParty.leader().faceName(); - break; - case 'PartyMember': - if ($gameParty.members()[faceIndex]) { - var faceName = $gameParty.members()[faceIndex].faceName(); - var faceIndex = $gameParty.members()[faceIndex].faceIndex(); - } else { - var faceName = ""; - }; - break; - }; - Galv.MB.Game_Message_setFaceImage.call(this,faceName,faceIndex); -}; - - -// WINDOW MESSAGE START MESSAGE - MOD -Galv.MB.Window_Message_startMessage = Window_Message.prototype.startMessage; -Window_Message.prototype.startMessage = function() { - Galv.MB.msgWindow = this; - $gameSystem.bustPos = $gameSystem.bustPos || 0; - $gameMessage.bustOffset = $gameMessage.bustOffset || Galv.MB.w; - Galv.MB.Window_Message_startMessage.call(this); - Galv.MB.msgWindow.tempPosType = this._positionType; -}; - - -Galv.MB.Window_Message_processEscapeCharacter = Window_Message.prototype.processEscapeCharacter; -Window_Message.prototype.processEscapeCharacter = function(code, textState) { - switch (code) { - case 'BST': - this.obtainSpecialParam(textState); - break; +(function () { + Galv.MB.prio = Number( + PluginManager.parameters("Galv_MessageBusts")["Bust Priority"] + ); + Galv.MB.pos = Number( + PluginManager.parameters("Galv_MessageBusts")["Bust Position"] + ); + Galv.MB.w = Number( + PluginManager.parameters("Galv_MessageBusts")["Text X Offset"] + ); + Galv.MB.f = + PluginManager.parameters("Galv_MessageBusts")["Filename Append"]; + + Galv.MB.msgWindow = null; + + if (Galv.MB.prio == 1 && Galv.MB.pos == 0) { + // Fix + Galv.MB.prio = 0; } - Galv.MB.Window_Message_processEscapeCharacter.call(this, code, textState); -}; + // GALV'S PLUGIN MANAGEMENT. INCLUDED IN ALL GALV PLUGINS THAT HAVE PLUGIN COMMAND CALLS, BUT ONLY RUN ONCE. + if (!Galv.aliased) { + var Galv_Game_Interpreter_pluginCommand = + Game_Interpreter.prototype.pluginCommand; + Game_Interpreter.prototype.pluginCommand = function (command, args) { + if (Galv.pCmd[command]) { + Galv.pCmd[command](args); + return; + } + Galv_Game_Interpreter_pluginCommand.call(this, command, args); + }; + Galv.aliased = true; // Don't keep aliasing for other Galv scripts. + } -Window_Message.prototype.obtainSpecialParam = function(textState) { - var arr = /^\[(.*)]/.exec(textState.text.slice(textState.index)); - if (arr) { - textState.index += arr[0].length; - var txt = arr[0].slice(1).slice(0, - 1); - var array = txt.split(","); - $gameMessage.setFaceImage(array[1] || $gameMessage._faceName,Number(array[0] - 1)); + // Direct to Plugin Object + Galv.pCmd.BUST = function (arguments) { + Galv.MB.bustPos(arguments); + }; + // END GALV'S PLUGIN MANAGEMENT + + Galv.MB.bustPos = function (pos) { + if (pos[0] === "TRUE") { + return ($gameSystem.bustDisable = false); + } else if (pos[0] === "FALSE") { + return ($gameSystem.bustDisable = true); + } + + $gameSystem.bustPos = 0; + if (pos[0] === "LEFT") { + $gameSystem.bustPos = 0; + } else if (pos[0] === "RIGHT") { + $gameSystem.bustPos = 1; + } + if (pos[1] === "TRUE") { + $gameSystem.bustMirror = true; + } else if (pos[1] === "FALSE") { + $gameSystem.bustMirror = false; + } + }; + + // ---------------- WINDOW MESSAGE + + Galv.MB.Game_Message_setFaceImage = Game_Message.prototype.setFaceImage; + Game_Message.prototype.setFaceImage = function (faceName, faceIndex) { + switch (faceName) { + case "PartyLeader": + var faceName = $gameParty.leader().faceName(); + break; + case "PartyMember": + if ($gameParty.members()[faceIndex]) { + var faceName = $gameParty.members()[faceIndex].faceName(); + var faceIndex = $gameParty.members()[faceIndex].faceIndex(); + } else { + var faceName = ""; + } + break; + } + Galv.MB.Game_Message_setFaceImage.call(this, faceName, faceIndex); + }; + + // WINDOW MESSAGE START MESSAGE - MOD + Galv.MB.Window_Message_startMessage = Window_Message.prototype.startMessage; + Window_Message.prototype.startMessage = function () { + Galv.MB.msgWindow = this; + $gameSystem.bustPos = $gameSystem.bustPos || 0; + $gameMessage.bustOffset = $gameMessage.bustOffset || Galv.MB.w; + Galv.MB.Window_Message_startMessage.call(this); + Galv.MB.msgWindow.tempPosType = this._positionType; + }; + + Galv.MB.Window_Message_processEscapeCharacter = + Window_Message.prototype.processEscapeCharacter; + Window_Message.prototype.processEscapeCharacter = function ( + code, + textState + ) { + switch (code) { + case "BST": + this.obtainSpecialParam(textState); + break; + } + Galv.MB.Window_Message_processEscapeCharacter.call( + this, + code, + textState + ); + }; + + Window_Message.prototype.obtainSpecialParam = function (textState) { + var arr = /^\[(.*)]/.exec(textState.text.slice(textState.index)); + if (arr) { + textState.index += arr[0].length; + var txt = arr[0].slice(1).slice(0, -1); + var array = txt.split(","); + $gameMessage.setFaceImage( + array[1] || $gameMessage._faceName, + Number(array[0] - 1) + ); + } else { + return ""; + } + }; + + Galv.MB.Window_Message_drawMessageFace = + Window_Message.prototype.drawMessageFace; + Window_Message.prototype.drawMessageFace = function () { + if (!$gameSystem.bustDisable) return; + Galv.MB.Window_Message_drawMessageFace.call(this); + }; + + // ---------------- SPRITESET MAP + + if (Galv.MB.prio == 0) { + // UNDER MESSAGE + Galv.MB.Spriteset_Map_createUpperLayer = + Spriteset_Base.prototype.createUpperLayer; + Spriteset_Base.prototype.createUpperLayer = function () { + Galv.MB.Spriteset_Map_createUpperLayer.call(this); + this.createBusts(); + }; + + // SPRITESET MAP CREATE MSG BG + Spriteset_Base.prototype.createBusts = function () { + // Create bust image + if (this._msgBustSprite) return; + this._msgBustSprite = new Sprite_GalvBust(); + this.addChild(this._msgBustSprite); + }; + + Galv.MB.Window_Message_newLineX = Window_Message.prototype.newLineX; + Window_Message.prototype.newLineX = function () { + if ($gameSystem.bustDisable) { + return Galv.MB.Window_Message_newLineX.call(this); + } else { + return 0; + } + }; } else { - return ''; + // OVER MESSAGE + + // Add to window_message as child instead, so it displays above + Galv.MB.Window_Message_createSubWindows = + Window_Message.prototype.createSubWindows; + Window_Message.prototype.createSubWindows = function () { + Galv.MB.Window_Message_createSubWindows.call(this); + if (this._msgBustSprite) return; + this._msgBustSprite = new Sprite_GalvBust(); + this.addChild(this._msgBustSprite); + }; + + Galv.MB.Window_Message_newLineX = Window_Message.prototype.newLineX; + Window_Message.prototype.newLineX = function () { + if ($gameSystem.bustDisable) { + return Galv.MB.Window_Message_newLineX.call(this); + } else if ( + $gameMessage.faceName() && + Galv.MB.prio == 1 && + $gameMessage._positionType == 2 && + $gameSystem.bustPos == 0 + ) { + return $gameMessage.bustOffset; + } else { + return 0; + } + }; } -}; - - -Galv.MB.Window_Message_drawMessageFace = Window_Message.prototype.drawMessageFace; -Window_Message.prototype.drawMessageFace = function() { - if (!$gameSystem.bustDisable) return; - Galv.MB.Window_Message_drawMessageFace.call(this); -}; - -// ---------------- SPRITESET MAP - -if (Galv.MB.prio == 0) { -// UNDER MESSAGE - Galv.MB.Spriteset_Map_createUpperLayer = Spriteset_Base.prototype.createUpperLayer; - Spriteset_Base.prototype.createUpperLayer = function() { - Galv.MB.Spriteset_Map_createUpperLayer.call(this); - this.createBusts(); - }; - - // SPRITESET MAP CREATE MSG BG - Spriteset_Base.prototype.createBusts = function() { - // Create bust image - if (this._msgBustSprite) return; - this._msgBustSprite = new Sprite_GalvBust(); - this.addChild(this._msgBustSprite); - }; - - Galv.MB.Window_Message_newLineX = Window_Message.prototype.newLineX; - Window_Message.prototype.newLineX = function() { - if ($gameSystem.bustDisable) { - return Galv.MB.Window_Message_newLineX.call(this); - } else { - return 0; - }; - }; - -} else { -// OVER MESSAGE - - // Add to window_message as child instead, so it displays above - Galv.MB.Window_Message_createSubWindows = Window_Message.prototype.createSubWindows; - Window_Message.prototype.createSubWindows = function() { - Galv.MB.Window_Message_createSubWindows.call(this); - if (this._msgBustSprite) return; - this._msgBustSprite = new Sprite_GalvBust(); - this.addChild(this._msgBustSprite); - }; - - - Galv.MB.Window_Message_newLineX = Window_Message.prototype.newLineX; - Window_Message.prototype.newLineX = function() { - if ($gameSystem.bustDisable) { - return Galv.MB.Window_Message_newLineX.call(this); - } else if ($gameMessage.faceName() && Galv.MB.prio == 1 && $gameMessage._positionType == 2 && $gameSystem.bustPos == 0) { - return $gameMessage.bustOffset; - } else { - return 0; - }; - }; -}; + // changed by Salted Fish start + Galv.MB.LargeFaceFolder = "img/faces/large"; + Galv.MB.LargeFaceDataFile = "data/LargeFace.json"; + Galv.MB.LargeFaceTestDataFile = "data/Test_LargeFace.json"; + /** + * LargeFace.json example + * + * { + * "FaceName":{ + * "FaceIndex":{ + * "FileName":"文件名,不包含后缀。" + * } + * } + * } + */ + //============================================================================= + // DataManager + //============================================================================= + + DataManager._databaseFiles.push({ + name: "$dataLargeFace", + src: "LargeFace.json", + }); + + // scan face image to data file + if (SF_Plugins.Core.Utils.isPC() && Utils.isOptionValid("test")) { + (function () { + var files = FileUtils.list("img/faces/large"); + var regex = new RegExp(/^(.+)_(\d+)\.png$/gm); + var result = {}; + files.forEach((name) => { + var m = regex.exec(name); + if (m) { + result[m[1]] = result[m[1]] || {}; + result[m[1]][m[2]] = { FileName: `${m[1]}_${m[2]}` }; + } + }); + FileUtils.writeTextFile( + Galv.MB.LargeFaceDataFile, + JsonEx.stringify(result) + ); + FileUtils.writeTextFile( + Galv.MB.LargeFaceTestDataFile, + JsonEx.stringify(result) + ); + })(); + } + Object.defineProperties(Game_System.prototype, { + bustDisable: { + set: function (value) { + this._bustDisable = value; + }, + get: function () { + return !( + !this._bustDisable && + !!$dataLargeFace && + !!$dataLargeFace[$gameMessage.faceName()] && + !!$dataLargeFace[$gameMessage.faceName()][ + $gameMessage.faceIndex() + ] + ); + }, + }, + }); + + ImageManager.loadLargeFace = function (filename, hue) { + return this.loadBitmap("img/faces/large/", filename, hue, true); + }; + + // changed by Salted Fish end })(); - // ---------------- SPRITE GALVMSGBG - NEW function Sprite_GalvBust() { @@ -325,102 +417,116 @@ function Sprite_GalvBust() { Sprite_GalvBust.prototype = Object.create(Sprite.prototype); Sprite_GalvBust.prototype.constructor = Sprite_GalvBust; -Sprite_GalvBust.prototype.initialize = function() { +Sprite_GalvBust.prototype.initialize = function () { Sprite.prototype.initialize.call(this); - this.name = ""; - this.opacity = 0; + this.name = ""; + this.opacity = 0; this.update(); }; -Sprite_GalvBust.prototype.update = function() { +Sprite_GalvBust.prototype.update = function () { Sprite.prototype.update.call(this); if (Galv.MB.msgWindow) this.controlBitmap(); }; -Sprite_GalvBust.prototype.loadBitmap = function() { - var name = $gameMessage.faceName() + "_" + ($gameMessage.faceIndex() + 1); - if ($gameSystem.bustDisable) { - var img = ImageManager.loadPicture(''); - } else { - var img = ImageManager.loadPicture(name + Galv.MB.f); - }; - if (img.isReady()) { - if (this.bitmap) { - //this._destroyCachedSprite(); - this.bitmap = null; - }; - this.bitmap = img; - this.name = name; - this.hasBust = true; - }; +Sprite_GalvBust.prototype.loadBitmap = function () { + var name = $gameMessage.faceName() + "_" + ($gameMessage.faceIndex() + 1); + if ($gameSystem.bustDisable) { + var img = ImageManager.loadLargeFace(""); + } else { + var img = ImageManager.loadLargeFace(name + Galv.MB.f); + } + if (img.isReady()) { + if (this.bitmap) { + //this._destroyCachedSprite(); + this.bitmap = null; + } + this.bitmap = img; + this.name = name; + this.hasBust = true; + } }; -Sprite_GalvBust.prototype.controlBitmap = function() { - if ($gameMessage.faceName() && this.name !== $gameMessage.faceName() + "_" + ($gameMessage.faceIndex() + 1)) { - this.loadBitmap(); // If image changed, reload bitmap - }; - - if (Galv.MB.msgWindow.openness <= 0 || !this.hasBust || $gameSystem.bustDisable) { - this.opacity = 0; - this.name = ""; - this.hasBust = false; - return; - }; - - if ($gameSystem.bustMirror) { - this.scale.x = -1; - var offset = this.bitmap.width; - } else { - this.scale.x = 1; - var offset = 0; - }; - - this.opacity = $gameMessage.faceName() ? Galv.MB.msgWindow._openness : this.opacity - 32; - - // Control image position - switch (Galv.MB.msgWindow.tempPosType) { - case 0: - this.y = this.baseY(); - break; - case 1: - //top and middle - this.y = this.baseY() - Galv.MB.msgWindow.y; - break; - case 2: - //bottom - if (Galv.MB.prio == 1) { - this.y = Galv.MB.msgWindow.height - this.bitmap.height; - } else if (Galv.MB.pos === 1) { - this.y = this.baseY(); - } else { - this.y = this.baseY() - Galv.MB.msgWindow.height; - }; - break; - }; - - if ($gameSystem.bustPos == 1) { - // if on the right - if (Galv.MB.prio == 1) { - this.x = Galv.MB.msgWindow.width - this.bitmap.width + offset; - } else { - this.x = Galv.MB.msgWindow.x + Galv.MB.msgWindow.width - this.bitmap.width + offset; - }; - } else { - // else on the left - if (Galv.MB.prio == 1) { - this.x = 0 + offset; - } else { - this.x = Galv.MB.msgWindow.x + offset; - }; - }; -}; +Sprite_GalvBust.prototype.controlBitmap = function () { + if ( + $gameMessage.faceName() && + this.name !== + $gameMessage.faceName() + "_" + ($gameMessage.faceIndex() + 1) + ) { + this.loadBitmap(); // If image changed, reload bitmap + } -Sprite_GalvBust.prototype.baseY = function() { - if (Galv.Mstyle.target) { - return Galv.MB.msgWindow.y + Galv.MB.msgWindow.height - this.bitmap.height; - } else { - return Graphics.boxHeight - this.bitmap.height + 20; - }; -}; + if ( + Galv.MB.msgWindow.openness <= 0 || + !this.hasBust || + $gameSystem.bustDisable + ) { + this.opacity = 0; + this.name = ""; + this.hasBust = false; + return; + } + if ($gameSystem.bustMirror) { + this.scale.x = -1; + var offset = this.bitmap.width; + } else { + this.scale.x = 1; + var offset = 0; + } + + this.opacity = $gameMessage.faceName() + ? Galv.MB.msgWindow._openness + : this.opacity - 32; + + // Control image position + switch (Galv.MB.msgWindow.tempPosType) { + case 0: + this.y = this.baseY(); + break; + case 1: + //top and middle + this.y = this.baseY() - Galv.MB.msgWindow.y; + break; + case 2: + //bottom + if (Galv.MB.prio == 1) { + this.y = Galv.MB.msgWindow.height - this.bitmap.height; + } else if (Galv.MB.pos === 1) { + this.y = this.baseY(); + } else { + this.y = this.baseY() - Galv.MB.msgWindow.height; + } + break; + } + if ($gameSystem.bustPos == 1) { + // if on the right + if (Galv.MB.prio == 1) { + this.x = Galv.MB.msgWindow.width - this.bitmap.width + offset; + } else { + this.x = + Galv.MB.msgWindow.x + + Galv.MB.msgWindow.width - + this.bitmap.width + + offset; + } + } else { + // else on the left + if (Galv.MB.prio == 1) { + this.x = 0 + offset; + } else { + this.x = Galv.MB.msgWindow.x + offset; + } + } +}; + +Sprite_GalvBust.prototype.baseY = function () { + if (Galv.Mstyle.target) { + return ( + Galv.MB.msgWindow.y + Galv.MB.msgWindow.height - this.bitmap.height + ); + } else { + return Graphics.boxHeight - this.bitmap.height + 20; + } +}; diff --git a/js/plugins/SF_MessageBusts.js b/js/plugins/SF_MessageBusts.js deleted file mode 100644 index b54b170..0000000 --- a/js/plugins/SF_MessageBusts.js +++ /dev/null @@ -1,46 +0,0 @@ -//============================================================================= -// Salted Fish Plugins - Message Busts -// SF_MessageBusts.js -//============================================================================= -"use strict"; -var Imported = Imported || {}; -Imported.SF_MessageBusts = true; - -var SF_Plugins = SF_Plugins || {}; - -//============================================================================= -/*: - * - * @plugindesc Message Busts - * @author Salted Fish - * - * @help - * 基于 Galv_MessageBusts.js 插件编写。 - * - * 尝试在“显示文本”时自动展示大号脸图(如果文件存在的话),否则展示原本的图片。 - * - * 将对应的图片放在 - * img/faces/large 文件夹下。 - * - * 命名方式为: - * {图片名称}_编号.png - * - * 举例:如果在“显示文本”的命令中选择脸图的文件为"Actor1"的第二个图, - * 那么这个插件就会使用 img/faces/large/Actor1_2.png 这张图片作为大号的脸图。 - * 如果不存在,则会使用默认的脸图。 - * - * @requiredAssets data/FaceLarge.json - * @param ScanFiles - * @text 启动时生成数据文件 - * @desc 扫描本地文件夹,生成对应的json文件,只对在nwjs中运行的时候生效。 - * @type boolean - * @on 生成 - * @off 不生成 - * - */ - -let SF_MessageBusts = {}; -SF_Plugins.SF_MessageBusts = SF_MessageBusts; - -SF_MessageBusts.Parameters = PluginManager.parameters('SF_MessageBusts'); -SF_MessageBusts.ScanFiles = SF_MessageBusts.Parameters['ScanFiles'].lower() \ No newline at end of file diff --git a/js/plugins/SF_StatesOverride.js b/js/plugins/SF_StatesOverride.js new file mode 100644 index 0000000..e69de29 diff --git a/js/plugins/SF_TestPlugins.js b/js/plugins/SF_TestPlugins.js index 12153c1..6c6004d 100644 --- a/js/plugins/SF_TestPlugins.js +++ b/js/plugins/SF_TestPlugins.js @@ -1,20 +1,14 @@ //============================================================================= /*: - * @plugindesc Test Plugins - * @author SaltedFish - * - * @param test1 - * @type actor - */ + * @plugindesc Test Plugins,在测试前要禁掉。 + * @author SaltedFish + * + * @param test1 + * @type actor + */ var Imported = Imported || {}; Imported.SF_TestPlugins = true; var SF_Plugins = SF_Plugins || {}; SF_Plugins.SF_TestPlugins = SF_Plugins.SF_TestPlugins || {}; SF_Plugins.SF_TestPlugins.version = 1.0; - -sc = Scene_Title.prototype.create; -Scene_Title.prototype.create = function () { - sc.call(this); - -}