/*============================================================================= MovieCustomize.js ---------------------------------------------------------------------------- (C)2024 Triacontane This software is released under the MIT License. http://opensource.org/licenses/mit-license.php ---------------------------------------------------------------------------- Version 1.1.0 2024/11/13 ムービー再生時の音量を変数で制御できる機能を追加 1.0.0 2024/11/04 初版 ---------------------------------------------------------------------------- [Blog] : https://triacontane.blogspot.jp/ [Twitter]: https://twitter.com/triacontane/ [GitHub] : https://github.com/triacontane/ =============================================================================*/ /*: @target MZ @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/MovieCustomize.js @plugindesc Movie playback customization plug-in @author Triacontane @license MIT License @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/triacontane-MZ-plugins ). Original plugin by Triacontane. Please check the latest official version at: https://triacontane.blogspot.com ----- MovieCustomize.js Adjusts the position and size of the video played by the "Play Movie" event command. You can also change the forced black background during movie playback. No advanced features are planned for this plugin. For more advanced adjustments, consider the "Video Picture Display Plugin." This plugin requires the base plugin "PluginCommonBase.js." "PluginCommonBase.js" is located in the following folder under the RPG Maker MZ installation folder: dlc/BasicResources/plugins/official Terms of Use: You may modify and redistribute this plugin without permission, and there are no restrictions on its use (commercial, R18+, etc.). This plugin is now yours. @param noHideScreen @text Don't cover the screen @desc Keeps the original screen visible when playing a movie. This prevents the background from being forced to black. @type boolean @default false @param volumeVariable @text Volume Variable ID @desc This variable controls the volume of the movie when it is played. The valid range of this variable is from 0 to 100. @type variable @default 0 @command SET_RECT @text Movie display position setting @desc Set the display position of the movie. @arg x @text X coordinate @desc The X coordinate of the movie. @type number @default 0 @arg y @text Y coordinate @desc The Y coordinate of the movie. @type number @default 0 @arg width @text Width @desc The width of the movie. @type number @default 816 @arg height @text height @desc The height of the movie. @type number @default 624 */ /*:ja @plugindesc ムービー再生カスタマイズプラグイン @target MZ @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/MovieCustomize.js @base PluginCommonBase @orderAfter PluginCommonBase @author トリアコンタン @param noHideScreen @text 画面を隠さない @desc ムービー再生時に元の画面を表示したままにします。背景が強制的に黒背景になることを防げます。 @default false @type boolean @param volumeVariable @text 音量変数ID @desc ムービー再生時の音量を制御する変数です。変数の値の範囲有効は0から100です。 @default 0 @type variable @command SET_RECT @text ムービー表示位置設定 @desc ムービーの表示位置を設定します。 @arg x @text X座標 @desc ムービーのX座標です。 @default 0 @type number @arg y @text Y座標 @desc ムービーのY座標です。 @default 0 @type number @arg width @text 横幅 @desc ムービーの横幅です。 @default 816 @type number @arg height @text 高さ @desc ムービーの高さです。 @default 624 @type number @help MovieCustomize.js イベントコマンド「ムービーの再生」で再生される動画の位置やサイズを調整します。 また、ムービー再生時に背景が強制的に黒背景になる仕様を変更できます。 本プラグインに対して高度な機能追加の予定はありません。 より高度な調整が必要な場合「動画のピクチャ表示プラグイン」も検討できます。 このプラグインの利用にはベースプラグイン『PluginCommonBase.js』が必要です。 『PluginCommonBase.js』は、RPGツクールMZのインストールフォルダ配下の 以下のフォルダに格納されています。 dlc/BasicResources/plugins/official 利用規約: 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) についても制限はありません。 このプラグインはもうあなたのものです。 */ (() => { 'use strict'; const script = document.currentScript; const param = PluginManagerEx.createParameter(script); PluginManagerEx.registerCommand(script, 'SET_RECT', args => { $gameScreen.setMovieRect(args.x, args.y, args.width, args.height); }); Game_Screen.prototype.setMovieRect = function(x, y, width, height) { this._movieRect = new Rectangle(x, y, width, height); Graphics._updateVideo(); }; Game_Screen.prototype.getMovieRect = function() { return this._movieRect; }; const _Graphics__updateVideo = Graphics._updateVideo; Graphics._updateVideo = function() { const rect = $gameScreen?.getMovieRect(); if (rect) { const x = rect.x * this._realScale; const y = rect.y * this._realScale; const width = rect.width * this._realScale; const height = rect.height * this._realScale; Video.setRect(x, y, width, height); } else { _Graphics__updateVideo.apply(this, arguments); } }; Video.setRect = function(x, y, width, height) { if (this._element) { this._element.style.left = x + "px"; this._element.style.top = y + "px"; this._element.style.width = width + "px"; this._element.style.height = height + "px"; } }; const _Video__updateVisibility = Video._updateVisibility; Video._updateVisibility = function(videoVisible) { _Video__updateVisibility.apply(this, arguments); if (param.noHideScreen) { Graphics.showScreen(); } }; const _Video_play = Video.play; Video.play = function(src) { _Video_play.apply(this, arguments); if (param.volumeVariable) { const volume = $gameVariables.value(param.volumeVariable); this.setVolume(volume.clamp(0, 100) / 100); } }; })();