Advertisement
CompanionWulf

Title Screen Add-On Plugin 1.6 [2.5] (RMMV 1.3)

Nov 14th, 2015
1,578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=======================================================================
  2. // Title Screen Add-On Plugin (RMMV v1.3) v1.6 [Formerly 2.5]
  3. //=======================================================================
  4. // * The Title Screen Add-On plugin was originally written specifically
  5. //   for  "The  Adventures  of Tryggr",  but it  comprised many  of the
  6. //   pluginlets I wrote for RMMV after its initial release.
  7. //
  8. //   This plugin was going to be released after the game's release, but
  9. //   I decided not to do that.  The original version of this plugin was
  10. //   heavily modified  for the game, with several  settings overwritten
  11. //   for its purposes too.
  12. //
  13. //   With the public release,  everything has been  properly organized,
  14. //   aliased and referenced.  Since its release, the plugin has evolved
  15. //   into something beyond its original purposes.
  16. //
  17. //
  18. //       * © 2015-2016, Companion Wulf
  19. //
  20. //========================================================================
  21. // CW_TitleScreenAddon.js
  22. //=======================================================================
  23.  
  24. var Imported = Imported || {}; Imported.CW_TitleScreenAddon = true;
  25. var CWT = CWT || {};
  26.  
  27. CWT.TitleScreenAddon = {
  28.     Version:    1.6,
  29.     Build:      28.16,
  30.     Copyright:  '© 2015-2016, Companion Wulf',
  31.     MVBuild:    1.3,
  32.     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.)'
  33. };
  34.  
  35.  
  36. /*:
  37.  @plugindesc Adds elements (including animation) to the Title Screen.
  38.  @author Companion Wulf
  39.  
  40.  @param--+ Pretitle Movie +--
  41.  @desc
  42.  
  43.  @param Pretitle Movie Toggle
  44.  @desc Toggles pretitle movie On/Off.
  45.  @default On
  46.  
  47.  @param Movie Name
  48.  @desc The name of the movie for the pretitle.
  49.  @default PretitleMovie
  50.  
  51.  @param
  52.  @desc
  53.  @param --+ Main Title +--
  54.  @desc
  55.  
  56.  @param Title Font Size
  57.  @desc The size of the game title font.
  58.  @default 60
  59.  
  60.  @param Title Font Color
  61.  @desc The color of the title font.
  62.  @default White
  63.  
  64.  @param Title Outline Color
  65.  @desc The outline color of the title.
  66.  @default Red
  67.  
  68.  
  69.  @param
  70.  @desc
  71.  @param --+ Header Subtitle +--
  72.  @desc
  73.  
  74.  @param Toggle Header Subtitle
  75.  @desc Show/hide the header subtitle.
  76.  @default On
  77.  
  78.  @param Header Subtitle
  79.  @desc The subtitle to appear above the game's main title.
  80.  @default RPG Maker Times Presents
  81.  
  82.  @param
  83.  @desc
  84.  @param --+ Footer Subtitle +--
  85.  @desc
  86.  
  87.  @param Toggle Footer Subtitle
  88.  @desc The subtitle to appear below the game's main title.
  89.  @default On
  90.  
  91.  @param Footer Subtitle
  92.  @desc The below the game's main title.
  93.  @default An RPG Maker MV Game
  94.  
  95.  @param
  96.  @desc
  97.  @param --+ Subtitle Settings +--
  98.  @desc
  99.  
  100.  @param Subtitle Font
  101.  @desc The subtitle font.
  102.  @default GameFont
  103.  
  104.  @param Subtitle Font Size
  105.  @desc The subtitle font size.
  106.  @default 38
  107.  
  108.  @param Subtitle Color
  109.  @desc The color of the subtitle text.
  110.  @default Yellow
  111.  
  112.  @param Subtitle Outline Color
  113.  @desc The outline color for the subtitle text.
  114.  @default Red
  115.  
  116.  @param
  117.  @desc
  118.  @param --+ Menu Settings +--
  119.  @desc
  120.  
  121.  @param Menu X Offset
  122.  @desc Sets the X coordinate offset for the menu.
  123.  @default 0
  124.  
  125.  @param Menu Y Offset
  126.  @desc Sets the Y coordinate offset for the menu.
  127.  @default 0
  128.  
  129.  @param Menu Background Opacity
  130.  @desc Sets the menu background opacity. 0 = Normal; 1 = Dim; 2 = Transparent.
  131.  @default 0
  132.  
  133.  @param
  134.  @desc
  135.  @param --+ Weather Effects +--
  136.  @desc
  137.  
  138.  @param Weather Effect
  139.  @desc The type of weather effect (-1 = No weather; 0 = Rain; 1 = Storm; 2 = Snow; 3 = Ash; 4 = Blood).
  140.  @default 0
  141.  
  142.  @param Weather Power
  143.  @desc The power of the weather effect.
  144.  @default 21
  145.  
  146.  @param Weather Sound
  147.  @desc Accompanying sounds for the Weather Effect.
  148.  @default On
  149.  
  150.  @param Weather Sound Effect
  151.  @desc Sounds for Rain, Storm or Snow.
  152.  @default Storm1
  153.  
  154.  @param Weather SE Volume
  155.  @desc The volume of the weather SE.
  156.  @default 40
  157.  
  158.  @param Weather SE Pitch
  159.  @desc Setting for the weather SE pitch.
  160.  @default 0
  161.  
  162.  @param Weather SE Pan
  163.  @desc The weather SE's pan effect.
  164.  @default 0
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  @param
  175.  @desc
  176.  @param --+ Website Command +--
  177.  @desc
  178.  
  179.  @param Show Website Command
  180.  @desc Show/hide Website command in menu (On/Off).
  181.  @default On
  182.  
  183.  @param Website Command Text
  184.  @desc The text for command to show website.
  185.  @default Website
  186.  
  187.  @param Website
  188.  @desc The URL for your website.
  189.  @default http://blog.rpgmakertimes.info
  190.  
  191.  @param Website Display Method
  192.  @desc Choose to display in a Window or Browser.
  193.  @default Window
  194.  
  195.  @param
  196.  @desc
  197.  @param --+ Exit Command +--
  198.  @desc
  199.  
  200.  @param Show Exit Command
  201.  @desc Show/hide Exit command in menu.
  202.  @default On
  203.  
  204.  @param Exit Command Text
  205.  @desc The text for the command to Exit.
  206.  @default Exit
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213. @help
  214.  ==============================================================
  215.   * Title Screen Add-On v1.5 [Formerly 2.7] - MV v1.3
  216.  ==============================================================
  217.  The Title Screen Add-On plugin has quite a number of settings.
  218.  Many of these were separate plugins, but they were merged into
  219.  a single plugin to make it easier to use and maintain.
  220.  
  221.  ==============================================================
  222.   * Pretitle Movie *
  223.  ==============================================================
  224.  These settings are for the pretitle movie, which will play before
  225.  the main Title Screen.
  226.  
  227.  --------------------------------------------------------------
  228.   Pretitle Movie Toggle
  229.  --------------------------------------------------------------
  230.  You can show/hide the Pretitle Movie Toggle by setting the parameter
  231.  to either ON or OFF. You can also set this to TRUE or FALSE if you
  232.  prefer. (The case is not important.)
  233.  
  234.  --------------------------------------------------------------
  235.   Movie Name
  236.  --------------------------------------------------------------
  237.  Put the movie you'd like to use for the pretitle in your project's
  238.  "movies" folder. (This will need to be done manually, as there is
  239.  no option in v1.3's Resource Manager to import movies.)
  240.  
  241.  In the Movie Name parameter put the name of your movie. There is no
  242.  need to add the extension, as it will automatically detect it depending
  243.  on the renderer being used.
  244.  
  245.  For movies, you should use .webm for Windows/Mac/HTM5 or .mp4 for
  246.  mobile devices, depending which one you intend on using for your
  247.  purpose, but include both versions just in case.
  248.  
  249.  
  250.  ==============================================================
  251.   * Main Title *
  252.  ==============================================================
  253.  These settings affect the main game title, overriding the defaults.
  254.  
  255.  --------------------------------------------------------------
  256.   Colors
  257.  --------------------------------------------------------------
  258.  All colors can be words or HTML colors (including the # suffix). For
  259.  example, you could use 'yellow' or '#ffff00'.
  260.  
  261.  --------------------------------------------------------------
  262.   Title Font Size
  263.  --------------------------------------------------------------
  264.  This changes the size of the game title. Recommended size is in
  265.  between 60 and 120, depending on the length of your title.
  266.  
  267.  --------------------------------------------------------------
  268.   Title Font Color
  269.  --------------------------------------------------------------
  270.  This is obviously the colour of the main game title.
  271.  
  272.  
  273.  ==============================================================
  274.   * Header/Footer Subtitles *
  275.  ==============================================================
  276.  These settings add text above/below the main game title respectively.
  277.  Both can be toggled ON or OFF. Alternatively, you can use TRUE or FALSE
  278.  if you prefer.
  279.  
  280.  You can change the font, font size, colour and outline colour to your
  281.  preferences here.
  282.  
  283.  Recommended font size is in between 30 and 40.
  284.  
  285.  
  286.  ==============================================================
  287.   * Menu Settings *
  288.  ==============================================================
  289.  These settings change the menu position and appearance.
  290.  
  291.  --------------------------------------------------------------
  292.   Menu X and Y Offsets
  293.  --------------------------------------------------------------
  294.  The Menu X and Y Ofsets reposition the title menu. Positive numbers
  295.  add to the current position and negative numbers subtract from it.
  296.  
  297.  As an example, if the "Menu X  Offset" is set to -260, the command
  298.  window will be moved left almost to the edge of the screen.
  299.  
  300.  --------------------------------------------------------------
  301.   Menu Background Opacity
  302.  --------------------------------------------------------------
  303.  This enables changing the opacity of the command window in much the
  304.  same way that messages can be displayed.
  305.  
  306.  You can set this to 0 (Normal), 1 (Dim) or 2 (Transparent).
  307.  
  308.  
  309.  ==============================================================
  310.   * Weather Effects *
  311.  ==============================================================
  312.  This allows weather effects on the Title Screen.
  313.  
  314.  To turn the weather effect off, set this value to -1.
  315.  
  316.  0 = Rain
  317.  1 = Storm
  318.  2 = Snow
  319.  3 = Ash
  320.  4 = Blood
  321.  
  322.  Note: If you set the Weather Power too high, it will result in a higher dim
  323.  effect. E.g. Setting the Weather Effect to 2 (for Snow) and the Weather Power
  324.  to 40+ will result in a "white out".
  325.  
  326.  --------------------------------------------------------------
  327.   Weather Sound Effects
  328.  --------------------------------------------------------------
  329.  These add some sound effects to the title weather.
  330.  
  331.  Turn Weather Sounds ON or OFF (or TRUE or FALSE) according to your preference.
  332.  
  333.  Place all weather sound effects in the "audio/bgs" folder so they can loop
  334.  properly. And then set the Weather Sound Effect to the sound you'd like
  335.  accompanying your Weather Effect.
  336.  
  337.  You can also change its volume, pitch and pan settings.
  338.  
  339.  Note: If Weather Effects is turned Off (the value is set to -1), these sound
  340.  effects will also be turned off.
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  ==============================================================
  350.   * Menu Commands *
  351.  ==============================================================
  352.  These commands add some additional commands to the main menu.
  353.  
  354.  --------------------------------------------------------------
  355.   Show Website Command
  356.  --------------------------------------------------------------
  357.  You can toggle the Website command ON or OFF (or use TRUE or FALSE),
  358.  depending on whether or not you'd like it as a menu command, or if
  359.  you're using another plugin, such as my "Social Media Buttons" plugin
  360.  (formerly "Social Media Buttons/In-Game Website") or Yanfly's
  361.  "External Links" plugin.
  362.  
  363.  --------------------------------------------------------------
  364.   Website Command Text
  365.  --------------------------------------------------------------
  366.  This is the text for the command. If you want to link to your Twitter
  367.  account, for example, you can change it here and put your Twitter URL
  368.  in the "Website" setting; it'll still function the same.
  369.  
  370.  --------------------------------------------------------------
  371.   Website
  372.  --------------------------------------------------------------
  373.  Put the FULL website URL here. This will open in a new window or
  374.  browser tab, depending on the "Display Method" setting.
  375.  
  376.  --------------------------------------------------------------
  377.   Display Method
  378.  --------------------------------------------------------------
  379.  Select whether you'd like to open the "Website" link in an in-game
  380.  Window or in the default Browser.
  381.  
  382.  --------------------------------------------------------------
  383.   Show Exit Command
  384.  --------------------------------------------------------------
  385.  You can toggle the Exit command ON/OFF (or TRUE/FALSE).
  386.  
  387.  Note: This is only really useful for playing in a window (not in
  388.  a browser). If using a browser, it's recommended this is set to
  389.  OFF or FALSE.
  390.  
  391.  --------------------------------------------------------------
  392.   Exit Command Text
  393.  --------------------------------------------------------------
  394.  Choose the text for the Exit Command.
  395.  
  396.  
  397.  ==============================================================
  398.   * Plugin Commands *
  399.  ==============================================================
  400.  There are no plugin commands.
  401.  
  402.  
  403.  ==============================================================
  404.   * Version Compatibility *
  405.  ==============================================================
  406.  Version 1.5 (formerly 2.7) is designed for use with MV v1.3, so
  407.  it may not be compatible with previous versions.
  408.  
  409.  
  410.  ==============================================================
  411.   * Terms & Conditions of Use *
  412.  ==============================================================
  413.  This plugin is free to use under CC BY-NC 4.0, useable in non-commercial
  414.  projects only. Please refer to the RPG Maker Times blogsite for other
  415.  details, including commercial use.
  416.  
  417.  For all Terms of Use, visit: http://wp.me/P2Vm8L-1z4
  418.  
  419.  Credit "Companion Wulf" or "RPG Maker Times" if using this plugin in
  420.  your projects.
  421.  
  422. */
  423.  
  424.  
  425. // ** PLUGIN MANAGER **
  426. (function($) {
  427.     // ** Parameters **//
  428.     CWT.parameters = $.parameters('CW_TitleScreenAddon');
  429.  
  430.     // * Pretitle
  431.     CWT.pretitleToggle = String(CWT.parameters['Pretitle Movie Toggle'] || 'on');
  432.     CWT.movieName = String(CWT.parameters['Movie Name'] || 'PretitleMovie');
  433.  
  434.     // * Title
  435.     CWT.titleFontSize = Number(CWT.parameters['Title Font Size'] || 60);
  436.     CWT.titleFontColor = String(CWT.parameters['Title Font Color'] || 'white');
  437.     CWT.titleOutlineColor = String(CWT.parameters['Title Outline Color'] || 'red');
  438.     CWT.titleOutlineWidth = Number(CWT.parameters['Title Outline Width'] || 2);
  439.     CWT.titleEffects = String(CWT.parameters['Title Effects'] || 'normal');
  440.  
  441.     // * Subtitles
  442.     CWT.toggleHeaderSubtitle = String(CWT.parameters['Toggle Header Subtitle'] || 'on');
  443.     CWT.headerSubtitle = String(CWT.parameters['Header Subtitle']);
  444.     CWT.toggleFooterSubtitle = String(CWT.parameters['Toggle Footer Subtitle']);
  445.     CWT.footerSubtitle = String(CWT.parameters['Footer Subtitle']);
  446.     CWT.subtitleFont = String(CWT.parameters['Subtitle Font']);
  447.     CWT.subtitleFontSize = Number(CWT.parameters['Subtitle Font Size'] || 38);
  448.     CWT.subtitleFontColor = String(CWT.parameters['Subtitle Color'] || 'yellow');
  449.  
  450.     // * Menu
  451.     CWT.menuOffsetX = Number(CWT.parameters['Menu X Offset'] || 0);
  452.     CWT.menuOffsetY = Number(CWT.parameters['Menu Y Offset'] || 0);
  453.     CWT.menuBgType = Number(CWT.parameters['Menu Background Opacity'] || 0);
  454.  
  455.     // * Weather Effects
  456.     CWT.weatherEffect = Number(CWT.parameters['Weather Effect'] || 0);
  457.     CWT.weatherPower = Number(CWT.parameters['Weather Power'] || 21);
  458.     CWT.weatherSounds = String(CWT.parameters['Weather Sound'] || 'On');
  459.     CWT.weatherBgs = String(CWT.parameters['Weather Sound Effect'] || 'Storm1');
  460.     CWT.weatherBgsVol = Number(CWT.parameters['Weather SE Volume'] || 40);
  461.     CWT.weatherBgsPitch = Number(CWT.parameters['Weather SE Pitch'] || 0);
  462.     CWT.weatherBgsPan = Number (CWT.parameters['Weather SE Pan'] || 0);
  463.  
  464.     // * Scrolling Images
  465.  
  466.  
  467.     // * Commands
  468.     CWT.websiteCommandToggle = String(CWT.parameters['Show Website Command'] || 'on');
  469.     CWT.websiteCommandText = String(CWT.parameters['Website Command Text'] || 'Website');
  470.     CWT.websiteUrl = String(CWT.parameters['Website']);
  471.     CWT.websiteDisplayMethod = String(CWT.parameters['Website Display Method' || 'Window']);
  472.     CWT.exitCommandToggle = String(CWT.parameters['Show Exit Command'] || 'on');
  473.     CWT.exitCommandText = String(CWT.parameters['Exit Command Text'] || 'Exit');
  474.  
  475.     CWT.videoFinished = false;
  476. })(PluginManager);
  477.  
  478.  
  479.  // ** SCENE BOOT **
  480. (function($) {
  481.     var CW_alias__Scene_Boot_start_video_Tsa = $.prototype.start;
  482.     $.prototype.start = function() {
  483.         //if (CWT.TitleScreenAddon.MVBuild < 1.3) alert(CWT.TitleScreenAddon.Error);
  484.         toggle = CWT.pretitleToggle.toLowerCase();
  485.         if (toggle === 'on' || toggle === 'true') {
  486.             AudioManager.saveBgm($dataSystem.titleBgm);
  487.             var type = SceneManager.preferableRendererType();
  488.             type === 'canvas' ? ext = 'mp4' : ext = 'webm';
  489.             Graphics.playVideo('movies/'+CWT.movieName+'.'+ext);
  490.         };    
  491.         CW_alias__Scene_Boot_start_video_Tsa.call(this);
  492.     };
  493.  
  494.     // * Doesn't seem to work aliased, so overwritten.
  495.     Graphics._updateVisibility = function(videoVisible) {
  496.         this._video.style.opacity = videoVisible ? 1 : 0;
  497.         this._canvas.style.opacity = videoVisible ? 0 : 1;
  498.  
  499.         if (videoVisible) {
  500.             AudioManager.stopAll();
  501.         } else {
  502.             AudioManager.replayBgm($dataSystem.titleBgm);
  503.             CWT.videoFinished = true;
  504.         }
  505.     };
  506. })(Scene_Boot);
  507.  
  508. // ** SCENE TITLE **
  509. (function($) {
  510.     $.prototype.drawGameTitle = function () {
  511.         var x = 0, y = 180, maxWidth = Graphics.width - x * 2;
  512.         var text = $dataSystem.gameTitle;
  513.         this._gameTitleSprite.bitmap.fontSize = CWT.titleFontSize;
  514.         this._gameTitleSprite.bitmap.fontColor = CWT.titleFontColor;
  515.         this._gameTitleSprite.bitmap.outlineColor = CWT.titleOutlineColor;
  516.         this._gameTitleSprite.bitmap.drawText(text, x, y, maxWidth, 48, 'center');
  517.     };
  518.  
  519.     CWT.CW_alias__Scene_Title_createForeground_Tsa =
  520.         $.prototype.createForeground;
  521.     $.prototype.createForeground = function() {
  522.         CWT.CW_alias__Scene_Title_createForeground_Tsa.call(this);
  523.         var _header = CWT.toggleHeaderSubtitle.toLowerCase(), _footer = CWT.toggleFooterSubtitle.toLowerCase();
  524.         this._gameHeaderSprite = new Sprite(new Bitmap(Graphics.boxWidth, Graphics.boxHeight));
  525.         this._gameFooterSprite = new Sprite(new Bitmap(Graphics.boxWidth, Graphics.boxHeight));
  526.  
  527.         if (_header === 'on' || _header === 'true') this.addChild(this._gameHeaderSprite);
  528.         if (_footer === 'on' || _footer === 'true') this.addChild(this._gameFooterSprite);
  529.         this.drawGameSubtitles();
  530.     };
  531.  
  532.     CWT.CW_alias__Scene_Title_createBackground_Tsa = $.prototype.createBackground;
  533.     $.prototype.createBackground = function() {
  534.         CWT.CW_alias__Scene_Title_createBackground_Tsa.call(this);     
  535.         this.createWeather();
  536.     };
  537.  
  538.     $.prototype.drawGameSubtitles = function() {
  539.         // ## Compact to array for each variable/process to save repetition ##
  540.         var x1 = 0, y1 = 130, maxWidthH = Graphics.width - x1 * 2;
  541.         var x2 = 0, y2 = 230, maxWidthF = Graphics.width - x2 * 2;
  542.  
  543.         this._gameHeaderSprite.bitmap.fontFace = CWT.subtitleFont;
  544.         this._gameHeaderSprite.bitmap.fontSize = CWT.subtitleFontSize;
  545.         this._gameHeaderSprite.bitmap.textColor = CWT.subtitleFontColor;
  546.         this._gameHeaderSprite.bitmap.outlineColor = CWT.subtitleOutlineColor;
  547.         this._gameHeaderSprite.bitmap.titleOutlineWidth = CWT.subtitleOutlineWidth;
  548.  
  549.         this._gameFooterSprite.bitmap.fontFace = CWT.subtitleFont;
  550.         this._gameFooterSprite.bitmap.fontSize = CWT.subtitleFontSize;
  551.         this._gameFooterSprite.bitmap.textColor = CWT.subtitleFontColor;
  552.         this._gameFooterSprite.bitmap.outlineColor = CWT.subtitleOutlineColor;
  553.         this._gameFooterSprite.bitmap.titleOutlineWidth = CWT.subtitleOutlineWidth;
  554.  
  555.         this._gameHeaderSprite.bitmap.drawText(CWT.headerSubtitle, x1, y1, maxWidthH, 48, 'center');
  556.         this._gameFooterSprite.bitmap.drawText(CWT.footerSubtitle, x2, y2, maxWidthF, 48, 'center');
  557.     };
  558.  
  559.     $.prototype.createWeather = function() {
  560.         this._weather = new Weather();
  561.         if (CWT.weatherEffect != -1) this.addChild(this._weather);
  562.     };
  563.    
  564.     $.prototype.updateWeather = function() {
  565.         var _weatherSE = CWT.weatherSounds.toLowerCase();
  566.         switch (CWT.weatherEffect) {
  567.             // ## Add lightning effects if 'storm' is selected. ##
  568.             case -1: this._weather.type = 'none'; break;
  569.             case 0: this._weather.type = 'rain'; break;
  570.             case 1: this._weather.type = 'storm'; break;
  571.             case 2: this._weather.type = 'snow'; break;
  572.             case 3: this._weather.type = 'ash'; break;
  573.             case 4: this._weather.type = 'blood'; break;
  574.             default: this._weather.type = 'rain'; break;
  575.         };
  576.        
  577.         this._weather.power = CWT.weatherPower;
  578.  
  579.         this._weather.origin.x = 0;
  580.         this._weather.origin.y = 0;
  581.        
  582.         if (CWT.weatherEffect != -1 &&  (_weatherSE === 'on' || _weatherSE === 'true')) this.updateBgs(CWT.weatherBgs);
  583.     };
  584.    
  585.  
  586.     $.prototype.updateBgs = function() {
  587.         var _pretitleToggle = CWT.pretitleToggle.toLowerCase();
  588.         // ## Fix error message if 'se' doesn't exist and use default. ##
  589.         var se = { name: CWT.weatherBgs, volume: CWT.weatherBgsVol, pitch: CWT.weatherBgsPitch, pan: CWT.weatherBgsPan };
  590.         if ((_pretitleToggle === 'on' || _pretitleToggle === 'true') && !CWT.videoFinished) {
  591.             return;
  592.         } else {
  593.             AudioManager.playBgs(se);
  594.         }
  595.     };
  596.  
  597.     CWT.CW_alias__Scene_Title_update = $.prototype.update;
  598.     $.prototype.update = function() {
  599.         CWT.CW_alias__Scene_Title_update.call(this);
  600.         this.updateWeather();
  601.     };
  602.  
  603.     CWT.CW_alias__Scene_Title_createCommandWindow_Tsa = $.prototype.createCommandWindow;
  604.     $.prototype.createCommandWindow = function() {
  605.         CWT.CW_alias__Scene_Title_createCommandWindow_Tsa.call(this);
  606.         this._commandWindow.setHandler('weburl', this.commandWebsite.bind(this));
  607.         this._commandWindow.setHandler('exit', this.commandExit.bind(this));
  608.     };
  609.  
  610.     $.prototype.commandWebsite = function() {
  611.         this._commandWindow.activate();
  612.         var uri = CWT.websiteUrl;
  613.         switch (CWT.websiteDisplayMethod.toLowerCase()) {
  614.             case 'window':
  615.                 window.open(uri); break;
  616.             case 'browser':
  617.                 var gui = require('nw.gui'); gui.Shell.openExternal(uri); break;
  618.         }
  619.     };
  620.  
  621.     $.prototype.commandExit = function() { SceneManager.exit(); };
  622. })(Scene_Title);
  623.  
  624.  
  625. // ** WINDOW TITLE COMMAND
  626. (function($) {
  627.     CWT.CW_alias__Window_TItleCommand_UpdatePlacement_Tsa = $.prototype.updatePlacement;
  628.     $.prototype.updatePlacement = function() {
  629.         CWT.CW_alias__Window_TItleCommand_UpdatePlacement_Tsa.call(this);
  630.         this.x += CWT.menuOffsetX, this.y += CWT.menuOffsetY;
  631.         this.setBackgroundType(CWT.menuBgType);
  632.     };
  633.  
  634.     CWT.CW_alias__Scene_Title_makeCommandList = $.prototype.makeCommandList;
  635.     $.prototype.makeCommandList = function() {
  636.         CWT.CW_alias__Scene_Title_makeCommandList.call(this);
  637.         var _urlCommandToggle = CWT.websiteCommandToggle.toLowerCase(), _exitCommandToggle = CWT.exitCommandToggle.toLowerCase();
  638.         if (_urlCommandToggle === 'on' || _urlCommandToggle === 'true') this.addCommand(CWT.websiteCommandText, 'weburl');
  639.         if (_exitCommandToggle === 'on' || _exitCommandToggle === 'true') this.addCommand(CWT.exitCommandText, 'exit');
  640.     };
  641. })(Window_TitleCommand)
  642.  
  643.  
  644. // ** WEATHER **
  645. CWT.CW_alias__Weather_createBitmaps = Weather.prototype._createBitmaps;
  646. Weather.prototype._createBitmaps = function() {
  647.     CWT.CW_alias__Weather_createBitmaps.call(this);
  648.     this._ashBitmap = new Bitmap(12, 12);
  649.     this._ashBitmap.drawCircle(2, 2, 2, 'gray');
  650.     this._bloodBitmap = new Bitmap(12, 12);
  651.     this._bloodBitmap.drawCircle(6, 4, 3, 'red');
  652. };
  653.  
  654. Weather.prototype._updateSprite = function(sprite) {
  655.     switch (this.type) {
  656.     case 'rain':
  657.         this._updateRainSprite(sprite);
  658.         break;
  659.     case 'storm':
  660.         this._updateStormSprite(sprite);
  661.         break;
  662.     case 'snow':
  663.         this._updateSnowSprite(sprite);
  664.         break;
  665.     case 'ash':
  666.         this._updateAshSprite(sprite);
  667.         break;
  668.     case 'blood':
  669.         this._updateBloodSprite(sprite);
  670.         break;
  671.     }
  672.     if (sprite.opacity < 40) {
  673.         this._rebornSprite(sprite);
  674.     }
  675. };
  676.  
  677. Weather.prototype._updateAshSprite = function(sprite) {
  678.     sprite.bitmap = this._ashBitmap;
  679.     sprite.rotation = Math.PI / 6;
  680.     sprite.ax += 6 * Math.sin(sprite.rotation);
  681.     sprite.ay += 4 * Math.cos(sprite.rotation);
  682.     sprite.opacity -= 2;
  683. };
  684.  
  685. Weather.prototype._updateBloodSprite = function(sprite) {
  686.     sprite.bitmap = this._bloodBitmap;
  687.     sprite.rotation = Math.PI / 6;
  688.     sprite.ax -= 6 * Math.tan(sprite.rotation);
  689.     sprite.ay += 6 * Math.cos(sprite.rotation);
  690.     sprite.opacity -= 3;
  691. };
  692.  
  693. Weather.prototype._createDimmer = function() {
  694.     var _weatherEffect = CWT.weatherEffect;
  695.     this._dimmerSprite = new ScreenSprite();
  696.     if (_weatherEffect === 4) {
  697.         this._dimmerSprite.setColor(80, 10, 10);
  698.     } else {
  699.         this._dimmerSprite.setColor(80, 80, 80);
  700.     }
  701.     this.addChild(this._dimmerSprite);
  702. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement