Advertisement
ezmash

Save Screen Tint (MV)

Jan 27th, 2018
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Save Screen Tint (Shaz_SaveScreenTint.js)
  3. // by Shaz
  4. // Last Updated: 2018.01.28
  5. //=============================================================================
  6.  
  7. /*:
  8.  * @plugindesc Allows you to save and later restore the screen tint
  9.  * @author Shaz
  10.  *
  11.  * @help
  12.  * This plugin allows you to save the current screen tint and later restore it.
  13.  * Useful if you call a common event that changes the tint from a number of
  14.  * maps that could have different tints, and need to be able to change it back
  15.  * again afterwards.
  16.  *
  17.  *
  18.  * Plugin Commands:
  19.  * ----------------
  20.  *
  21.  * SaveScreenTint - will save the current screen tint
  22.  *
  23.  * RestoreScreenTint seconds wait - will restore the last-saved screen tint
  24.  *                   seconds can be a formula to be evaluated - do not include
  25.  *                   any spaces.  If omitted, defaults to immediate.
  26.  *                   wait must be true or false.  If omitted, defaults to false.
  27.  *
  28.  */
  29.  
  30. var Imported = Imported || {};
  31. Imported.Shaz_SaveScreenTint = true;
  32.  
  33. var Shaz = Shaz || {};
  34. Shaz.SST = Shaz.SST || {};
  35. Shaz.SST.Version = 1.00;
  36.  
  37. (function() {
  38.     var _Shaz_Game_System_initialize = Game_System.prototype.initialize;
  39.     Game_System.prototype.initialize = function() {
  40.         _Shaz_Game_System_initialize.call(this);
  41.         this._savedScreenTint = null;
  42.     };
  43.  
  44.     Game_System.prototype.saveScreenTint = function(tint) {
  45.         this._savedScreenTint = tint.clone();
  46.     };
  47.  
  48.     Game_System.prototype.savedScreenTint = function() {
  49.         return this._savedScreenTint;
  50.     };
  51.  
  52.     var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  53.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  54.         switch(command.toUpperCase()) {
  55.             case 'SAVESCREENTINT':
  56.                 $gameSystem.saveScreenTint($gameScreen.tone());
  57.                 break;
  58.             case 'RESTORESCREENTINT':
  59.                 var duration = (args[0] ? eval(args[0]) : 0) * 60;
  60.                 var wait = args[1] ? eval(args[1]) : false;
  61.                 if ($gameSystem.savedScreenTint()) {
  62.                     $gameScreen.startTint($gameSystem.savedScreenTint(), duration);
  63.                     if (wait) {
  64.                         this.wait(duration);
  65.                     }
  66.                 }
  67.                 break;
  68.             default:
  69.                 _Game_Interpreter_pluginCommand.call(this, command, args);
  70.         }
  71.     };
  72. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement