Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=======================================================================
- // Title Screen Add-On Plugin (RMMV v1.3) v1.6 [Formerly 2.5]
- //=======================================================================
- // * The Title Screen Add-On plugin was originally written specifically
- // for "The Adventures of Tryggr", but it comprised many of the
- // pluginlets I wrote for RMMV after its initial release.
- //
- // This plugin was going to be released after the game's release, but
- // I decided not to do that. The original version of this plugin was
- // heavily modified for the game, with several settings overwritten
- // for its purposes too.
- //
- // With the public release, everything has been properly organized,
- // aliased and referenced. Since its release, the plugin has evolved
- // into something beyond its original purposes.
- //
- //
- // * © 2015-2016, Companion Wulf
- //
- //========================================================================
- // CW_TitleScreenAddon.js
- //=======================================================================
- var Imported = Imported || {}; Imported.CW_TitleScreenAddon = true;
- var CWT = CWT || {};
- CWT.TitleScreenAddon = {
- Version: 1.6,
- Build: 28.16,
- Copyright: '© 2015-2016, Companion Wulf',
- MVBuild: 1.3,
- Error: 'This plugin is compatible with RMMV version 1.3. You appear to have an older version, so errors may occur. Please update your copy of RMMV (see the Help files for details.)'
- };
- /*:
- @plugindesc Adds elements (including animation) to the Title Screen.
- @author Companion Wulf
- @param--+ Pretitle Movie +--
- @desc
- @param Pretitle Movie Toggle
- @desc Toggles pretitle movie On/Off.
- @default On
- @param Movie Name
- @desc The name of the movie for the pretitle.
- @default PretitleMovie
- @param
- @desc
- @param --+ Main Title +--
- @desc
- @param Title Font Size
- @desc The size of the game title font.
- @default 60
- @param Title Font Color
- @desc The color of the title font.
- @default White
- @param Title Outline Color
- @desc The outline color of the title.
- @default Red
- @param
- @desc
- @param --+ Header Subtitle +--
- @desc
- @param Toggle Header Subtitle
- @desc Show/hide the header subtitle.
- @default On
- @param Header Subtitle
- @desc The subtitle to appear above the game's main title.
- @default RPG Maker Times Presents
- @param
- @desc
- @param --+ Footer Subtitle +--
- @desc
- @param Toggle Footer Subtitle
- @desc The subtitle to appear below the game's main title.
- @default On
- @param Footer Subtitle
- @desc The below the game's main title.
- @default An RPG Maker MV Game
- @param
- @desc
- @param --+ Subtitle Settings +--
- @desc
- @param Subtitle Font
- @desc The subtitle font.
- @default GameFont
- @param Subtitle Font Size
- @desc The subtitle font size.
- @default 38
- @param Subtitle Color
- @desc The color of the subtitle text.
- @default Yellow
- @param Subtitle Outline Color
- @desc The outline color for the subtitle text.
- @default Red
- @param
- @desc
- @param --+ Menu Settings +--
- @desc
- @param Menu X Offset
- @desc Sets the X coordinate offset for the menu.
- @default 0
- @param Menu Y Offset
- @desc Sets the Y coordinate offset for the menu.
- @default 0
- @param Menu Background Opacity
- @desc Sets the menu background opacity. 0 = Normal; 1 = Dim; 2 = Transparent.
- @default 0
- @param
- @desc
- @param --+ Weather Effects +--
- @desc
- @param Weather Effect
- @desc The type of weather effect (-1 = No weather; 0 = Rain; 1 = Storm; 2 = Snow; 3 = Ash; 4 = Blood).
- @default 0
- @param Weather Power
- @desc The power of the weather effect.
- @default 21
- @param Weather Sound
- @desc Accompanying sounds for the Weather Effect.
- @default On
- @param Weather Sound Effect
- @desc Sounds for Rain, Storm or Snow.
- @default Storm1
- @param Weather SE Volume
- @desc The volume of the weather SE.
- @default 40
- @param Weather SE Pitch
- @desc Setting for the weather SE pitch.
- @default 0
- @param Weather SE Pan
- @desc The weather SE's pan effect.
- @default 0
- @param
- @desc
- @param --+ Website Command +--
- @desc
- @param Show Website Command
- @desc Show/hide Website command in menu (On/Off).
- @default On
- @param Website Command Text
- @desc The text for command to show website.
- @default Website
- @param Website
- @desc The URL for your website.
- @default http://blog.rpgmakertimes.info
- @param Website Display Method
- @desc Choose to display in a Window or Browser.
- @default Window
- @param
- @desc
- @param --+ Exit Command +--
- @desc
- @param Show Exit Command
- @desc Show/hide Exit command in menu.
- @default On
- @param Exit Command Text
- @desc The text for the command to Exit.
- @default Exit
- @help
- ==============================================================
- * Title Screen Add-On v1.5 [Formerly 2.7] - MV v1.3
- ==============================================================
- The Title Screen Add-On plugin has quite a number of settings.
- Many of these were separate plugins, but they were merged into
- a single plugin to make it easier to use and maintain.
- ==============================================================
- * Pretitle Movie *
- ==============================================================
- These settings are for the pretitle movie, which will play before
- the main Title Screen.
- --------------------------------------------------------------
- Pretitle Movie Toggle
- --------------------------------------------------------------
- You can show/hide the Pretitle Movie Toggle by setting the parameter
- to either ON or OFF. You can also set this to TRUE or FALSE if you
- prefer. (The case is not important.)
- --------------------------------------------------------------
- Movie Name
- --------------------------------------------------------------
- Put the movie you'd like to use for the pretitle in your project's
- "movies" folder. (This will need to be done manually, as there is
- no option in v1.3's Resource Manager to import movies.)
- In the Movie Name parameter put the name of your movie. There is no
- need to add the extension, as it will automatically detect it depending
- on the renderer being used.
- For movies, you should use .webm for Windows/Mac/HTM5 or .mp4 for
- mobile devices, depending which one you intend on using for your
- purpose, but include both versions just in case.
- ==============================================================
- * Main Title *
- ==============================================================
- These settings affect the main game title, overriding the defaults.
- --------------------------------------------------------------
- Colors
- --------------------------------------------------------------
- All colors can be words or HTML colors (including the # suffix). For
- example, you could use 'yellow' or '#ffff00'.
- --------------------------------------------------------------
- Title Font Size
- --------------------------------------------------------------
- This changes the size of the game title. Recommended size is in
- between 60 and 120, depending on the length of your title.
- --------------------------------------------------------------
- Title Font Color
- --------------------------------------------------------------
- This is obviously the colour of the main game title.
- ==============================================================
- * Header/Footer Subtitles *
- ==============================================================
- These settings add text above/below the main game title respectively.
- Both can be toggled ON or OFF. Alternatively, you can use TRUE or FALSE
- if you prefer.
- You can change the font, font size, colour and outline colour to your
- preferences here.
- Recommended font size is in between 30 and 40.
- ==============================================================
- * Menu Settings *
- ==============================================================
- These settings change the menu position and appearance.
- --------------------------------------------------------------
- Menu X and Y Offsets
- --------------------------------------------------------------
- The Menu X and Y Ofsets reposition the title menu. Positive numbers
- add to the current position and negative numbers subtract from it.
- As an example, if the "Menu X Offset" is set to -260, the command
- window will be moved left almost to the edge of the screen.
- --------------------------------------------------------------
- Menu Background Opacity
- --------------------------------------------------------------
- This enables changing the opacity of the command window in much the
- same way that messages can be displayed.
- You can set this to 0 (Normal), 1 (Dim) or 2 (Transparent).
- ==============================================================
- * Weather Effects *
- ==============================================================
- This allows weather effects on the Title Screen.
- To turn the weather effect off, set this value to -1.
- 0 = Rain
- 1 = Storm
- 2 = Snow
- 3 = Ash
- 4 = Blood
- Note: If you set the Weather Power too high, it will result in a higher dim
- effect. E.g. Setting the Weather Effect to 2 (for Snow) and the Weather Power
- to 40+ will result in a "white out".
- --------------------------------------------------------------
- Weather Sound Effects
- --------------------------------------------------------------
- These add some sound effects to the title weather.
- Turn Weather Sounds ON or OFF (or TRUE or FALSE) according to your preference.
- Place all weather sound effects in the "audio/bgs" folder so they can loop
- properly. And then set the Weather Sound Effect to the sound you'd like
- accompanying your Weather Effect.
- You can also change its volume, pitch and pan settings.
- Note: If Weather Effects is turned Off (the value is set to -1), these sound
- effects will also be turned off.
- ==============================================================
- * Menu Commands *
- ==============================================================
- These commands add some additional commands to the main menu.
- --------------------------------------------------------------
- Show Website Command
- --------------------------------------------------------------
- You can toggle the Website command ON or OFF (or use TRUE or FALSE),
- depending on whether or not you'd like it as a menu command, or if
- you're using another plugin, such as my "Social Media Buttons" plugin
- (formerly "Social Media Buttons/In-Game Website") or Yanfly's
- "External Links" plugin.
- --------------------------------------------------------------
- Website Command Text
- --------------------------------------------------------------
- This is the text for the command. If you want to link to your Twitter
- account, for example, you can change it here and put your Twitter URL
- in the "Website" setting; it'll still function the same.
- --------------------------------------------------------------
- Website
- --------------------------------------------------------------
- Put the FULL website URL here. This will open in a new window or
- browser tab, depending on the "Display Method" setting.
- --------------------------------------------------------------
- Display Method
- --------------------------------------------------------------
- Select whether you'd like to open the "Website" link in an in-game
- Window or in the default Browser.
- --------------------------------------------------------------
- Show Exit Command
- --------------------------------------------------------------
- You can toggle the Exit command ON/OFF (or TRUE/FALSE).
- Note: This is only really useful for playing in a window (not in
- a browser). If using a browser, it's recommended this is set to
- OFF or FALSE.
- --------------------------------------------------------------
- Exit Command Text
- --------------------------------------------------------------
- Choose the text for the Exit Command.
- ==============================================================
- * Plugin Commands *
- ==============================================================
- There are no plugin commands.
- ==============================================================
- * Version Compatibility *
- ==============================================================
- Version 1.5 (formerly 2.7) is designed for use with MV v1.3, so
- it may not be compatible with previous versions.
- ==============================================================
- * Terms & Conditions of Use *
- ==============================================================
- This plugin is free to use under CC BY-NC 4.0, useable in non-commercial
- projects only. Please refer to the RPG Maker Times blogsite for other
- details, including commercial use.
- For all Terms of Use, visit: http://wp.me/P2Vm8L-1z4
- Credit "Companion Wulf" or "RPG Maker Times" if using this plugin in
- your projects.
- */
- // ** PLUGIN MANAGER **
- (function($) {
- // ** Parameters **//
- CWT.parameters = $.parameters('CW_TitleScreenAddon');
- // * Pretitle
- CWT.pretitleToggle = String(CWT.parameters['Pretitle Movie Toggle'] || 'on');
- CWT.movieName = String(CWT.parameters['Movie Name'] || 'PretitleMovie');
- // * Title
- CWT.titleFontSize = Number(CWT.parameters['Title Font Size'] || 60);
- CWT.titleFontColor = String(CWT.parameters['Title Font Color'] || 'white');
- CWT.titleOutlineColor = String(CWT.parameters['Title Outline Color'] || 'red');
- CWT.titleOutlineWidth = Number(CWT.parameters['Title Outline Width'] || 2);
- CWT.titleEffects = String(CWT.parameters['Title Effects'] || 'normal');
- // * Subtitles
- CWT.toggleHeaderSubtitle = String(CWT.parameters['Toggle Header Subtitle'] || 'on');
- CWT.headerSubtitle = String(CWT.parameters['Header Subtitle']);
- CWT.toggleFooterSubtitle = String(CWT.parameters['Toggle Footer Subtitle']);
- CWT.footerSubtitle = String(CWT.parameters['Footer Subtitle']);
- CWT.subtitleFont = String(CWT.parameters['Subtitle Font']);
- CWT.subtitleFontSize = Number(CWT.parameters['Subtitle Font Size'] || 38);
- CWT.subtitleFontColor = String(CWT.parameters['Subtitle Color'] || 'yellow');
- // * Menu
- CWT.menuOffsetX = Number(CWT.parameters['Menu X Offset'] || 0);
- CWT.menuOffsetY = Number(CWT.parameters['Menu Y Offset'] || 0);
- CWT.menuBgType = Number(CWT.parameters['Menu Background Opacity'] || 0);
- // * Weather Effects
- CWT.weatherEffect = Number(CWT.parameters['Weather Effect'] || 0);
- CWT.weatherPower = Number(CWT.parameters['Weather Power'] || 21);
- CWT.weatherSounds = String(CWT.parameters['Weather Sound'] || 'On');
- CWT.weatherBgs = String(CWT.parameters['Weather Sound Effect'] || 'Storm1');
- CWT.weatherBgsVol = Number(CWT.parameters['Weather SE Volume'] || 40);
- CWT.weatherBgsPitch = Number(CWT.parameters['Weather SE Pitch'] || 0);
- CWT.weatherBgsPan = Number (CWT.parameters['Weather SE Pan'] || 0);
- // * Scrolling Images
- // * Commands
- CWT.websiteCommandToggle = String(CWT.parameters['Show Website Command'] || 'on');
- CWT.websiteCommandText = String(CWT.parameters['Website Command Text'] || 'Website');
- CWT.websiteUrl = String(CWT.parameters['Website']);
- CWT.websiteDisplayMethod = String(CWT.parameters['Website Display Method' || 'Window']);
- CWT.exitCommandToggle = String(CWT.parameters['Show Exit Command'] || 'on');
- CWT.exitCommandText = String(CWT.parameters['Exit Command Text'] || 'Exit');
- CWT.videoFinished = false;
- })(PluginManager);
- // ** SCENE BOOT **
- (function($) {
- var CW_alias__Scene_Boot_start_video_Tsa = $.prototype.start;
- $.prototype.start = function() {
- //if (CWT.TitleScreenAddon.MVBuild < 1.3) alert(CWT.TitleScreenAddon.Error);
- toggle = CWT.pretitleToggle.toLowerCase();
- if (toggle === 'on' || toggle === 'true') {
- AudioManager.saveBgm($dataSystem.titleBgm);
- var type = SceneManager.preferableRendererType();
- type === 'canvas' ? ext = 'mp4' : ext = 'webm';
- Graphics.playVideo('movies/'+CWT.movieName+'.'+ext);
- };
- CW_alias__Scene_Boot_start_video_Tsa.call(this);
- };
- // * Doesn't seem to work aliased, so overwritten.
- Graphics._updateVisibility = function(videoVisible) {
- this._video.style.opacity = videoVisible ? 1 : 0;
- this._canvas.style.opacity = videoVisible ? 0 : 1;
- if (videoVisible) {
- AudioManager.stopAll();
- } else {
- AudioManager.replayBgm($dataSystem.titleBgm);
- CWT.videoFinished = true;
- }
- };
- })(Scene_Boot);
- // ** SCENE TITLE **
- (function($) {
- $.prototype.drawGameTitle = function () {
- var x = 0, y = 180, maxWidth = Graphics.width - x * 2;
- var text = $dataSystem.gameTitle;
- this._gameTitleSprite.bitmap.fontSize = CWT.titleFontSize;
- this._gameTitleSprite.bitmap.fontColor = CWT.titleFontColor;
- this._gameTitleSprite.bitmap.outlineColor = CWT.titleOutlineColor;
- this._gameTitleSprite.bitmap.drawText(text, x, y, maxWidth, 48, 'center');
- };
- CWT.CW_alias__Scene_Title_createForeground_Tsa =
- $.prototype.createForeground;
- $.prototype.createForeground = function() {
- CWT.CW_alias__Scene_Title_createForeground_Tsa.call(this);
- var _header = CWT.toggleHeaderSubtitle.toLowerCase(), _footer = CWT.toggleFooterSubtitle.toLowerCase();
- this._gameHeaderSprite = new Sprite(new Bitmap(Graphics.boxWidth, Graphics.boxHeight));
- this._gameFooterSprite = new Sprite(new Bitmap(Graphics.boxWidth, Graphics.boxHeight));
- if (_header === 'on' || _header === 'true') this.addChild(this._gameHeaderSprite);
- if (_footer === 'on' || _footer === 'true') this.addChild(this._gameFooterSprite);
- this.drawGameSubtitles();
- };
- CWT.CW_alias__Scene_Title_createBackground_Tsa = $.prototype.createBackground;
- $.prototype.createBackground = function() {
- CWT.CW_alias__Scene_Title_createBackground_Tsa.call(this);
- this.createWeather();
- };
- $.prototype.drawGameSubtitles = function() {
- // ## Compact to array for each variable/process to save repetition ##
- var x1 = 0, y1 = 130, maxWidthH = Graphics.width - x1 * 2;
- var x2 = 0, y2 = 230, maxWidthF = Graphics.width - x2 * 2;
- this._gameHeaderSprite.bitmap.fontFace = CWT.subtitleFont;
- this._gameHeaderSprite.bitmap.fontSize = CWT.subtitleFontSize;
- this._gameHeaderSprite.bitmap.textColor = CWT.subtitleFontColor;
- this._gameHeaderSprite.bitmap.outlineColor = CWT.subtitleOutlineColor;
- this._gameHeaderSprite.bitmap.titleOutlineWidth = CWT.subtitleOutlineWidth;
- this._gameFooterSprite.bitmap.fontFace = CWT.subtitleFont;
- this._gameFooterSprite.bitmap.fontSize = CWT.subtitleFontSize;
- this._gameFooterSprite.bitmap.textColor = CWT.subtitleFontColor;
- this._gameFooterSprite.bitmap.outlineColor = CWT.subtitleOutlineColor;
- this._gameFooterSprite.bitmap.titleOutlineWidth = CWT.subtitleOutlineWidth;
- this._gameHeaderSprite.bitmap.drawText(CWT.headerSubtitle, x1, y1, maxWidthH, 48, 'center');
- this._gameFooterSprite.bitmap.drawText(CWT.footerSubtitle, x2, y2, maxWidthF, 48, 'center');
- };
- $.prototype.createWeather = function() {
- this._weather = new Weather();
- if (CWT.weatherEffect != -1) this.addChild(this._weather);
- };
- $.prototype.updateWeather = function() {
- var _weatherSE = CWT.weatherSounds.toLowerCase();
- switch (CWT.weatherEffect) {
- // ## Add lightning effects if 'storm' is selected. ##
- case -1: this._weather.type = 'none'; break;
- case 0: this._weather.type = 'rain'; break;
- case 1: this._weather.type = 'storm'; break;
- case 2: this._weather.type = 'snow'; break;
- case 3: this._weather.type = 'ash'; break;
- case 4: this._weather.type = 'blood'; break;
- default: this._weather.type = 'rain'; break;
- };
- this._weather.power = CWT.weatherPower;
- this._weather.origin.x = 0;
- this._weather.origin.y = 0;
- if (CWT.weatherEffect != -1 && (_weatherSE === 'on' || _weatherSE === 'true')) this.updateBgs(CWT.weatherBgs);
- };
- $.prototype.updateBgs = function() {
- var _pretitleToggle = CWT.pretitleToggle.toLowerCase();
- // ## Fix error message if 'se' doesn't exist and use default. ##
- var se = { name: CWT.weatherBgs, volume: CWT.weatherBgsVol, pitch: CWT.weatherBgsPitch, pan: CWT.weatherBgsPan };
- if ((_pretitleToggle === 'on' || _pretitleToggle === 'true') && !CWT.videoFinished) {
- return;
- } else {
- AudioManager.playBgs(se);
- }
- };
- CWT.CW_alias__Scene_Title_update = $.prototype.update;
- $.prototype.update = function() {
- CWT.CW_alias__Scene_Title_update.call(this);
- this.updateWeather();
- };
- CWT.CW_alias__Scene_Title_createCommandWindow_Tsa = $.prototype.createCommandWindow;
- $.prototype.createCommandWindow = function() {
- CWT.CW_alias__Scene_Title_createCommandWindow_Tsa.call(this);
- this._commandWindow.setHandler('weburl', this.commandWebsite.bind(this));
- this._commandWindow.setHandler('exit', this.commandExit.bind(this));
- };
- $.prototype.commandWebsite = function() {
- this._commandWindow.activate();
- var uri = CWT.websiteUrl;
- switch (CWT.websiteDisplayMethod.toLowerCase()) {
- case 'window':
- window.open(uri); break;
- case 'browser':
- var gui = require('nw.gui'); gui.Shell.openExternal(uri); break;
- }
- };
- $.prototype.commandExit = function() { SceneManager.exit(); };
- })(Scene_Title);
- // ** WINDOW TITLE COMMAND
- (function($) {
- CWT.CW_alias__Window_TItleCommand_UpdatePlacement_Tsa = $.prototype.updatePlacement;
- $.prototype.updatePlacement = function() {
- CWT.CW_alias__Window_TItleCommand_UpdatePlacement_Tsa.call(this);
- this.x += CWT.menuOffsetX, this.y += CWT.menuOffsetY;
- this.setBackgroundType(CWT.menuBgType);
- };
- CWT.CW_alias__Scene_Title_makeCommandList = $.prototype.makeCommandList;
- $.prototype.makeCommandList = function() {
- CWT.CW_alias__Scene_Title_makeCommandList.call(this);
- var _urlCommandToggle = CWT.websiteCommandToggle.toLowerCase(), _exitCommandToggle = CWT.exitCommandToggle.toLowerCase();
- if (_urlCommandToggle === 'on' || _urlCommandToggle === 'true') this.addCommand(CWT.websiteCommandText, 'weburl');
- if (_exitCommandToggle === 'on' || _exitCommandToggle === 'true') this.addCommand(CWT.exitCommandText, 'exit');
- };
- })(Window_TitleCommand)
- // ** WEATHER **
- CWT.CW_alias__Weather_createBitmaps = Weather.prototype._createBitmaps;
- Weather.prototype._createBitmaps = function() {
- CWT.CW_alias__Weather_createBitmaps.call(this);
- this._ashBitmap = new Bitmap(12, 12);
- this._ashBitmap.drawCircle(2, 2, 2, 'gray');
- this._bloodBitmap = new Bitmap(12, 12);
- this._bloodBitmap.drawCircle(6, 4, 3, 'red');
- };
- Weather.prototype._updateSprite = function(sprite) {
- switch (this.type) {
- case 'rain':
- this._updateRainSprite(sprite);
- break;
- case 'storm':
- this._updateStormSprite(sprite);
- break;
- case 'snow':
- this._updateSnowSprite(sprite);
- break;
- case 'ash':
- this._updateAshSprite(sprite);
- break;
- case 'blood':
- this._updateBloodSprite(sprite);
- break;
- }
- if (sprite.opacity < 40) {
- this._rebornSprite(sprite);
- }
- };
- Weather.prototype._updateAshSprite = function(sprite) {
- sprite.bitmap = this._ashBitmap;
- sprite.rotation = Math.PI / 6;
- sprite.ax += 6 * Math.sin(sprite.rotation);
- sprite.ay += 4 * Math.cos(sprite.rotation);
- sprite.opacity -= 2;
- };
- Weather.prototype._updateBloodSprite = function(sprite) {
- sprite.bitmap = this._bloodBitmap;
- sprite.rotation = Math.PI / 6;
- sprite.ax -= 6 * Math.tan(sprite.rotation);
- sprite.ay += 6 * Math.cos(sprite.rotation);
- sprite.opacity -= 3;
- };
- Weather.prototype._createDimmer = function() {
- var _weatherEffect = CWT.weatherEffect;
- this._dimmerSprite = new ScreenSprite();
- if (_weatherEffect === 4) {
- this._dimmerSprite.setColor(80, 10, 10);
- } else {
- this._dimmerSprite.setColor(80, 80, 80);
- }
- this.addChild(this._dimmerSprite);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement