// DarkPlasma_FixChoiceListPosition 1.0.0 // Copyright (c) 2024 DarkPlasma // This software is released under the MIT license. // http://opensource.org/licenses/mit-license.php /** * 2024/09/15 1.0.0 公開 */ /*: @target MZ @url https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release @plugindesc Fix the display position of the options @author DarkPlasma @license MIT @help English Help Translator: munokura This is an unofficial English translation of the plugin help, created to support global RPG Maker users. Feedback is welcome to improve translation quality (see: https://github.com/munokura/DarkPlasma-MZ-Plugins ). Original plugin by DarkPlasma. Please check the latest official version at: https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release ----- Version: 1.0.0 Fixes the display position of the options using a plugin command. Information about the position fixation is included in the save data. About the Y Coordinate Type The Y coordinate of the options is normally determined based on the position of the message window. To fix the options to a position corresponding to the top, middle, or bottom of the message window, select Top, Middle, or Bottom. @command fixChoiceListPosition @text Fixed position of options @desc Fix the display position of the options. @arg xPositionType @text X coordinate type @desc Specifies the type of X coordinate. @type select @default 4 @option left @value 0 @option Medium @value 1 @option right @value 2 @option Numerical specification @value 3 @option Not fixed @value 4 @arg x @text X coordinate @desc Specifies the X coordinate. This is only valid when the X coordinate type is specified as a number. @type number @default 0 @arg yPositionType @text Y coordinate type @desc Specifies the type of Y coordinate: Top, Middle, or Bottom, which represents the location of the message window. @type select @default 2 @option above @value 0 @option Medium @value 1 @option under @value 2 @option Numerical specification @value 3 @option Not fixed @value 4 @arg y @text Y coordinate @desc Specifies the Y coordinate. This is only valid when the Y coordinate type is specified as a number. @type number @default 0 @command unfixChoiceListPosition @text Unlocking the position of options @desc Unlocks the position of the options. */ /*:ja @plugindesc 選択肢の表示位置を固定する @author DarkPlasma @license MIT @target MZ @url https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release @command fixChoiceListPosition @text 選択肢の位置固定 @desc 選択肢の表示位置を固定します。 @arg xPositionType @desc X座標のタイプを指定します。 @text X座標タイプ @type select @option 左 @value 0 @option 中 @value 1 @option 右 @value 2 @option 数値指定 @value 3 @option 固定しない @value 4 @default 4 @arg x @desc X座標を指定します。X座標タイプが数値指定の場合のみ有効です。 @text X座標 @type number @default 0 @arg yPositionType @desc Y座標のタイプを指定します。上 中 下はメッセージウィンドウの位置を表します。 @text Y座標タイプ @type select @option 上 @value 0 @option 中 @value 1 @option 下 @value 2 @option 数値指定 @value 3 @option 固定しない @value 4 @default 2 @arg y @desc Y座標を指定します。Y座標タイプが数値指定の場合のみ有効です。 @text Y座標 @type number @default 0 @command unfixChoiceListPosition @text 選択肢の位置固定解除 @desc 選択肢の位置固定を解除します。 @help version: 1.0.0 プラグインコマンドによって選択肢の表示位置を固定します。 位置固定に関する情報はセーブデータに含まれます。 Y座標タイプについて 本来、選択肢はメッセージウィンドウの位置に応じてY座標が決まります。 メッセージウィンドウの位置 上 中 下に対応する位置に固定する場合に、 上 中 下を選んでください。 */ (() => { 'use strict'; function parseArgs_fixChoiceListPosition(args) { return { xPositionType: Number(args.xPositionType || 4), x: Number(args.x || 0), yPositionType: Number(args.yPositionType || 2), y: Number(args.y || 0), }; } const command_fixChoiceListPosition = 'fixChoiceListPosition'; const command_unfixChoiceListPosition = 'unfixChoiceListPosition'; const pluginName = document.currentScript.src.replace(/^.*\/(.*).js$/, function () { return arguments[1]; }); const POSITION_TYPE_NUMBER = 3; const NO_FIX = 4; PluginManager.registerCommand(pluginName, command_fixChoiceListPosition, function (args) { const parsedArgs = parseArgs_fixChoiceListPosition(args); $gameSystem.fixChoiceListPosition( parsedArgs.xPositionType, parsedArgs.yPositionType, parsedArgs.xPositionType === POSITION_TYPE_NUMBER ? parsedArgs.x : undefined, parsedArgs.yPositionType === POSITION_TYPE_NUMBER ? parsedArgs.y : undefined, ); }); PluginManager.registerCommand(pluginName, command_unfixChoiceListPosition, function () { $gameSystem.unfixChoiceListPosition(); }); function Game_System_FixChoiceListPositionMixIn(gameSystem) { const _initialize = gameSystem.initialize; gameSystem.initialize = function () { _initialize.call(this); this._choiceListPosition = { isXFixed: false, isYFixed: false, xPositionType: 0, yPositionType: 0, x: undefined, y: undefined, }; }; gameSystem.fixChoiceListPosition = function (xPositionType, yPositionType, x, y) { this._choiceListPosition.xPositionType = xPositionType; this._choiceListPosition.yPositionType = yPositionType; this._choiceListPosition.x = x; this._choiceListPosition.y = y; this._choiceListPosition.isXFixed = xPositionType !== NO_FIX; this._choiceListPosition.isYFixed = yPositionType !== NO_FIX; }; gameSystem.unfixChoiceListPosition = function () { this._choiceListPosition.isXFixed = false; this._choiceListPosition.isYFixed = false; }; gameSystem.isChoiceListPositionFixed = function () { return { x: this._choiceListPosition.isXFixed, y: this._choiceListPosition.isYFixed, }; }; gameSystem.choiceListPositionType = function () { return { x: this._choiceListPosition.xPositionType, y: this._choiceListPosition.yPositionType, }; }; gameSystem.choiceListPosition = function () { return { x: this._choiceListPosition.x, y: this._choiceListPosition.y, }; }; } Game_System_FixChoiceListPositionMixIn(Game_System.prototype); function Game_Message_FixChoiceListPositionMixIn(gameMessage) { const _choicePositionType = gameMessage.choicePositionType; gameMessage.choicePositionType = function () { if ($gameSystem.isChoiceListPositionFixed().x) { return $gameSystem.choiceListPositionType().x; } return _choicePositionType.call(this); }; } Game_Message_FixChoiceListPositionMixIn(Game_Message.prototype); function Window_ChoiceList_FixPositionMixIn(windowChoiceList) { const _windowX = windowChoiceList.windowX; windowChoiceList.windowX = function () { if ( $gameSystem.isChoiceListPositionFixed().x && $gameSystem.choiceListPositionType().x === POSITION_TYPE_NUMBER ) { return $gameSystem.choiceListPosition().x; } return _windowX.call(this); }; const _windowY = windowChoiceList.windowY; windowChoiceList.windowY = function () { if ($gameSystem.isChoiceListPositionFixed().y) { const positionType = $gameSystem.choiceListPositionType().y; if (positionType === POSITION_TYPE_NUMBER) { return $gameSystem.choiceListPosition().y; } const messageY = (positionType * (Graphics.boxHeight - this._messageWindow.height)) / 2; if (messageY >= Graphics.boxHeight / 2) { return messageY - this.windowHeight(); } else { return messageY + this._messageWindow.height; } } return _windowY.call(this); }; } Window_ChoiceList_FixPositionMixIn(Window_ChoiceList.prototype); })();