Advertisement
Astfgl

AnimatedBusts

Jun 3rd, 2017
5,506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Animated busts
  3. // by Astfgl
  4. // Date: 05/06/2017
  5. // Free for commercial and non commercial use, credits required: any of
  6. // Astfgl/Astfgl (Pierre MATEO)/ Pierre MATEO.
  7. // Edits and reposts allowed, as long as it it kept under the same terms of use.
  8. // Do not remove this header, do not claim as your own.
  9. // 03/06/2017 V2 -> Added the possibility to set a frozen image independently from
  10. // the animation, and to remove it.
  11. // 05/06/2017 V3 -> Small revisions, updated documentation.
  12. // 05/06/2017 V4 -> Text codes \fa \ufa \da \sa added.
  13. // 05/06/2017 V5 -> Text code \ca added.
  14. // 06/06/2017 V6 -> Loop interval feature added, Loop number limit added,
  15. // added compatibility to the \ca text code.
  16. // 07/07/2017 V7 -> Compatibility with SRD Camera core, Set frame Rate command
  17. // 05/09/2017 V8 -> Compatibility with slow text
  18. // 26/10/2017 V9 -> "Fixed" saving and loading issue.
  19. // 01/11/2017 V10 -> Fixed crash after erasing pictures.
  20. // 24/01/2018 V11 -> Added set frozen and remove frozen animation features, compatibility with slow text broken
  21. // 18/04/2019 V12 -> pictures should save correctly, even animated
  22. // 19/04/2019 V13 -> added VN like commands
  23. // 20/04/2019 V14 -> added fadein, and move picture relatively commands
  24. // 21/04/2019 V15 -> fixed bitmap not updating when showing another picture
  25. //=============================================================================
  26.  
  27.  
  28. /*:
  29.  * @plugindesc Allows animating pictures
  30.  * @author Astfgl
  31.  * @help
  32.  * ===================================================================
  33.  * Animation setup:
  34.  * ===================================================================
  35.  * First, setup the pictures using the event commands.
  36.  * Then use the following script call:
  37.  * $gameScreen.picture(pictureId).setAnim([array],interval);
  38.  * Replace array by the file names without the extension, surrounded by "" and
  39.  * separated by ",".
  40.  * Ex: ["mouth_closed","mouth_1","mouth_2","mouth_3"]
  41.  * These will be, in order the pictures displayed for the animations.
  42.  * The first picture will be used when the animation is paused.
  43.  *
  44.  * Then replace interval by a number, this will be the number of frames
  45.  * between image changes.
  46.  * Ex: 5
  47.  *
  48.  * Ex: $gameScreen.picture(2).setAnim(["mouth_closed","mouth_1","mouth_2","mouth_3"],5)
  49.  * This will cause the picture to loop between the frames you set in the array
  50.  * until told to stop.
  51.  *
  52.  * ===================================================================
  53.  * Freezing an animation
  54.  * ===================================================================
  55.  * You can tell a picture to stop looping by using:
  56.  * $gameScreen.picture(pictureId).freeze();
  57.  * It will set the picture to the first image in the list and stop it from looping.
  58.  * Notice: when synching the animation to a message, it will freeze and unfreeze the
  59.  * animation automatically when the message pauses. So you have to remove the animation
  60.  * if you don't want it synching with a message, not freeze it.
  61.  * This command is for out of message use.
  62.  *
  63.  * You can tell a picture to begin looping again by using:
  64.  * $gameScreen.picture(pictureId).unfreeze();
  65.  * This will make the picture start looping again, starting at the first frame.
  66.  * Again, same disclaimer as for the freeze command: intended for out of message use.
  67.  *
  68.  * ===================================================================
  69.  * Synchronizing an animation with a message box
  70.  * ===================================================================
  71.  * In order to synch up a picture looping animation to a message window use:
  72.  * $gameMessage.setAnim(pictureId)
  73.  *
  74.  * Ex: $gameMessage.setAnim(2)
  75.  * This will cause the picture to synch up its looping animation with the message
  76.  * window: it will loop while text is writing, stop for pauses and between windows.
  77.  * Using fast forward will make it skip the animation altogether.
  78.  *
  79.  * If you want a picture to no longer synch up with the message window, use:
  80.  * $gameMessage.removeAnim(pictureId)
  81.  *
  82.  * Ex: $gameMessage.removeAnim(2)
  83.  *
  84.  * ===================================================================
  85.  * Frozen or message end picture outside of animation loop
  86.  * ===================================================================
  87.  * By default the plugin will use the first image in the array as the frozen or
  88.  * message end picture. If you would like to define a frozen picture outside of
  89.  * the loop you can use the following command:
  90.  * $gameScreen.picture(pictureId).setFrozenBmp(filename);
  91.  *
  92.  * Ex: $gameScreen.picture(2).setFrozenBmp("mouth_closed")
  93.  *
  94.  * If you would like to remove a frozen picture and start using the first picture
  95.  * of the loop again, use the following command:
  96.  *
  97.  * $gameScreen.picture(pictureId).removeFrozenBmp()
  98.  *
  99.  * Ex: $gameScreen.picture(2).removeFrozenBmp()
  100.  * ===================================================================
  101.  * Wait time in between animation loops:
  102.  * ===================================================================
  103.  * If you want to pause the picture in between loops, use the following:
  104.  * $gameScreen.picture(pictureId).setLoopInterval(number)
  105.  *
  106.  * Ex: $gameScreen.picture(2).setLoopInterval(60)
  107.  * This will make the picture wait 60 frames before each animation loop.
  108.  *
  109.  * If you want to remove the wait between loops, use:
  110.  * $gameScreen.picture(pictureId).removeLoopInterval();
  111.  *
  112.  * Ex: $gameScreen.picture(2).removeLoopInterval();
  113.  *
  114.  * Both of these commands are intended for out of message use.
  115.  *
  116.  * ===================================================================
  117.  * Run animation loop only X times:
  118.  * ===================================================================
  119.  * If you'd like the animation loop to only run on certain amount of
  120.  * times, use:
  121.  * $gameScreen.picture(pictureId).setLoopTimes(number)
  122.  *
  123.  * Ex: $gameScreen.picture(2).setLoopTimes(5)
  124.  * This will cause the picture to loop 5 times and them freeze itself,
  125.  * until the loop times are removed or set again.
  126.  *
  127.  * If you want to remove the limitation, use:
  128.  * $gameScreen.picture(pictureId).removeLoopTimes();
  129.  *
  130.  * Ex: $gameScreen.picture(2).removeLoopTimes();
  131.  *
  132.  * Both of these commands are intended for out of message use.
  133.  *
  134.  *
  135.  * ===================================================================
  136.  * Changing the frame Rate
  137.  * ===================================================================
  138.  * If you'd like to change the frame rate of the picture you can use the
  139.  * following command:
  140.  *
  141.  * $gameScreen.picture(pictureId).setFrameRate(number)
  142.  *
  143.  * Ex: $gameScreen.picture(2).setFrameRate(10)
  144.  * This will set picture 2 framerate to 10.
  145.  *
  146.  * ===================================================================
  147.  * Text codes:
  148.  * ===================================================================
  149.  * This will also add several escape codes to use with message boxes:
  150.  * \fa[pictureId] this will freeze the target picture animation. Again, if the animation
  151.  * is synched it won't have any effect.
  152.  *
  153.  * \ufa[pictureId] this will unfreeze the target picture animation. Just as above,
  154.  * if the animation is synched it won't have any effect.
  155.  *
  156.  * \da[pictureId] this will desynchronise the target picture animation with the
  157.  * message window and automatically freeze it. Unfreeze it after if you'd rather
  158.  * it kept running.
  159.  *
  160.  * \sa[pictureId] this will synchronize the target picture animation with the
  161.  * message window.
  162.  *
  163.  * \ca[variableId] this will create an animation, you must have a picture already shown.
  164.  * First you must setup a variable using the control variable: script command
  165.  * the following way:
  166.  * Control variables: script: [id,[spriteArray],interval,frozenBmp*,loopInterval*,loopTimes*].
  167.  * Replace id by the picture id you want to animate.
  168.  * Replace sprite array by the array of sprite names.
  169.  * Replace interval by a number.
  170.  * frozenBmp can be omitted, if it is present it will set the new animation to use
  171.  * the file name you replace frozenBmp by as its frozen frame.
  172.  * loopInterval can be omitted but you must provide a frozenBmp to be able to use it
  173.  * it will set a wait time between loops, replace it with a number.
  174.  * loopTimes can be omitted but you must provide a  frozenBmp and a loopInterval to
  175.  * be able to use it. Replace it with a number, this will be the number of times the
  176.  * animation will repeat.
  177.  *
  178.  * Ex: Control variables: script:[1,["mouth_closed","mouth_1","mouth_2","mouth_3"],5,"mouth_frozen"];
  179.  * Then in the message use \ca[variableId], replacing variableId by the id of the
  180.  * variable you just used.
  181.  * So if you used variable 1, use \ca[1].
  182.  * This will start the animation on target picture (1 here) using the sprites in the array,
  183.  * and the interval there too, when the message reaches that point.
  184.  * It will also synchronize it automatically.
  185.  *
  186.  * ===================================================================
  187.  * Saving and loading animated pictures
  188.  * ===================================================================
  189.  * As of v12, there should no longer be a bug when saving pictures.
  190.  * This is thanks to user kako05 on rpgmakerweb.com forums who commissionned
  191.  * me for a fix.
  192.  * ===================================================================
  193.  * VN Commands
  194.  * ===================================================================
  195.  * As of V13, several VN like commands have been added to facilitate your life.
  196.  *
  197.  * -------------------------------------------------------------------
  198.  * Light picture:
  199.  * This will set the picture tone to (0,0,0,0), basically fully bright, over
  200.  * the course of 30frames, acting like if the bust was selected.
  201.  *
  202.  * Script call:
  203.  * $gameScreen.picture(id).light(duration)
  204.  * duration is optionnal, if unspecified, will do it over 30 frames.
  205.  *
  206.  * Text code:
  207.  * \LP[pictureId]
  208.  * You can't specifiy a duration if doing it via textcode.
  209.  * -------------------------------------------------------------------
  210.  * Dim picture:
  211.  * This will set the picture tone to (0,0,0,255), basically fully grey, over
  212.  * the course of 30frames, acting like if the bust was unselected.
  213.  *
  214.  * Script call:
  215.  * $gameScreen.picture(id).dim(duration)
  216.  * duration is optionnal, if unspecified, will do it over 30 frames.
  217.  *
  218.  * Text code:
  219.  * \DP[pictureId]
  220.  * You can't specifiy a duration if doing it via textcode.
  221.  * -------------------------------------------------------------------
  222.  * Move picture home:
  223.  * This will set  move the picture to its original coordinates over the
  224.  * course of 30 frames.
  225.  *
  226.  * Script call:
  227.  * $gameScreen.picture(id).moveHome(duration)
  228.  * duration is optionnal, if unspecified, will do it over 30 frames.
  229.  *
  230.  * Text code:
  231.  * \MPH[pictureId]
  232.  * You can't specifiy a duration if doing it via textcode.
  233.  * -------------------------------------------------------------------
  234.  * Fadeout picture:
  235.  * This will move the picture back 20 pixels in either direction,
  236.  * set its tone to grey, and change its opacity to 0 over the course of
  237.  * 30 frames before deleting it, erasing the bust from the screen.
  238.  *
  239.  * Script call:
  240.  * $gameScreen.picture(id).fadeout(duration,direction,distance)
  241.  * duration is optionnal, if unspecified, will do it over 30 frames.
  242.  * direction is optionnal as well, 1 will move the picture left, -1 right.
  243.  * distance is optionnal and is to be given in pixels
  244.  * If you want to specifiy a direction, you must specify a duration.
  245.  * If you want to specify a distance you must specify both other parameters.
  246.  * You can only specify a duration if you want to.
  247.  *
  248.  * Text code:
  249.  * \CPR[pictureId] this will fadeout the picture to the right
  250.  * \CPL[pictureId] this will fadeout the picture to the left
  251.  * You can't specifiy a duration if doing it via textcode.
  252.  * -------------------------------------------------------------------
  253.  * Fadein picture:
  254.  * This will move the picture forward 20 pixels in either direction,
  255.  * set its tone to bright, and change its opacity to 255 over the course of
  256.  * 30 frames, acting as if the picture appeared.
  257.  *
  258.  * Script call:
  259.  * $gameScreen.picture(id).fadein(duration,direction,distance)
  260.  * duration is optionnal, if unspecified, will do it over 30 frames.
  261.  * direction is optionnal as well, 1 will move the picture left, -1 right.
  262.  * distance is optionnal and is to be given in pixels
  263.  * If you want to specify a distance you must specify both other parameters.
  264.  * If you want to specifiy a direction, you must specify a duration.
  265.  * You can only specify a duration if you want to.
  266.  *
  267.  * Text code:
  268.  * \FPR[pictureId] this will fadeout the picture to the right
  269.  * \FPL[pictureId] this will fadeout the picture to the left
  270.  * You can't specifiy a duration if doing it via textcode.
  271.  * -------------------------------------------------------------------
  272.  * Move picture:
  273.  * This will move the picture relatively to its current position.
  274.  *
  275.  * Script call:
  276.  * $gameScreen.picture(id).movePictureRel(x,y,t)
  277.  * x and y are the amount of pixels you want the picture to move
  278.  * t is the duration in frames
  279.  * y and t are optionnal, if omitted the picture won't move on the y
  280.  * axis and the x movement will be done over 30 frames.
  281.  *
  282.  * Text code:
  283.  * \MPR[pictureId,x,y,t]
  284.  */
  285.  
  286.  var Imported = Imported || {};
  287.  (function(){
  288.     Game_Message.prototype.setAnim = function(picId) {
  289.         SceneManager._scene._messageWindow.setAnim(picId);
  290.     }
  291.    
  292.    
  293.     Window_Message.prototype.setAnim = function(picId) {
  294.         this._anim = true;
  295.         if (!this._picIds) {
  296.             this._picIds = [];
  297.         }
  298.         if (!this._picIds.contains(picId)) {
  299.             this._picIds.push(picId);
  300.         }
  301.     }
  302.    
  303.     Game_Message.prototype.removeAnim = function(picId) {
  304.         SceneManager._scene._messageWindow.removeAnim(picId);
  305.     }
  306.    
  307.     Window_Message.prototype.removeAnim = function(picId) {
  308.         if (this._picIds) {
  309.             for (var i = 0; i  < this._picIds.length; i++) {
  310.                 if (this._picIds[i] === picId) {
  311.                     this._picIds.splice(i,1);
  312.                 }
  313.             }
  314.         }
  315.     }
  316.    
  317.     var _Astfgl_newWMU = Window_Message.prototype.update
  318.     Window_Message.prototype.update = function() {
  319.         _Astfgl_newWMU.call(this);
  320.         if (this._anim) {
  321.              if (this._waitCount > 0 || this.pause || !this._textState) {
  322.                 this._picIds.forEach(function(num){
  323.                     $gameScreen.picture(num).freeze();
  324.                 })
  325.              } else {
  326.                 this._picIds.forEach(function(num){
  327.                     $gameScreen.picture(num).unfreeze();
  328.                 })
  329.              }
  330.         }
  331.     }
  332.    
  333.     var _Astfgl_newGPIB = Game_Picture.prototype.initBasic
  334.     Game_Picture.prototype.initBasic = function() {
  335.         this._animated = false;
  336.         this._interval = 0;
  337.         this._timer = 0;
  338.         this._index = 0;
  339.         this._frozen = false;
  340.         this._bmpArray = [];
  341.     }
  342.    
  343.     Game_Picture.prototype.setAnim = function(sprArray,interval) {
  344.         if (!Imported["SumRndmDde Camera Core"]) {
  345.             var spr = SceneManager._scene._spriteset._pictureContainer.children[this.id - 1];
  346.         } else {
  347.             var spr = SceneManager._scene._pictureContainer.children[this.id - 1];
  348.         }
  349.         spr._bmpArray = [];
  350.         this._animated = true;
  351.         this._interval = interval;
  352.         this._bmpArraySave = []
  353.         for (var i = 0; i < sprArray.length; i++) {
  354.             spr._bmpArray.push(ImageManager.loadPicture(sprArray[i]))
  355.             this._bmpArraySave.push(sprArray[i])
  356.         }
  357.     }
  358.    
  359.     Game_Picture.prototype.setFrozenAnim = function(sprArray,interval) {
  360.         if (!Imported["SumRndmDde Camera Core"]) {
  361.             var spr = SceneManager._scene._spriteset._pictureContainer.children[this.id - 1];
  362.         } else {
  363.             var spr = SceneManager._scene._pictureContainer.children[this.id - 1];
  364.         }
  365.         this._Fanimated = true;
  366.         this._Finterval = interval;
  367.         this._Ftimer = 0;
  368.         this._Findex = 0;
  369.         spr._FbmpArray = [];
  370.         this._FbmpArraySave = [];
  371.         for (var i = 0; i < sprArray.length; i++) {
  372.             spr._FbmpArray.push(ImageManager.loadPicture(sprArray[i]))
  373.             this._FbmpArraySave.push(sprArray[i])
  374.         }
  375.     }
  376.    
  377.     Game_Picture.prototype.removeFrozenAnim = function() {
  378.         if (!Imported["SumRndmDde Camera Core"]) {
  379.             var spr = SceneManager._scene._spriteset._pictureContainer.children[this.id - 1];
  380.         } else {
  381.             var spr = SceneManager._scene._pictureContainer.children[this.id - 1];
  382.         }
  383.         delete this._Fanimated
  384.         delete this._Finterval
  385.         delete this._Ftimer
  386.         delete this._Findex
  387.         delete spr._FbmpArray
  388.     }
  389.    
  390.     Game_Picture.prototype.setFrozenBmp = function(path) {
  391.         if (!Imported["SumRndmDde Camera Core"]) {
  392.             var spr = SceneManager._scene._spriteset._pictureContainer.children[this.id - 1];
  393.         } else {
  394.             var spr = SceneManager._scene._pictureContainer.children[this.id - 1];
  395.         }
  396.         spr._frozenBmp = ImageManager.loadPicture(path);
  397.         this._frozenBmpSave = path
  398.     }
  399.    
  400.     Game_Picture.prototype.removeFrozenBmp = function() {
  401.         if (!Imported["SumRndmDde Camera Core"]) {
  402.             var spr = SceneManager._scene._spriteset._pictureContainer.children[this.id - 1];
  403.         } else {
  404.             var spr = SceneManager._scene._pictureContainer.children[this.id - 1];
  405.         }
  406.         delete spr._frozenBmp;
  407.     }
  408.    
  409.     var _Astfgl_newGPU = Game_Picture.prototype.update
  410.     Game_Picture.prototype.update = function() {
  411.         _Astfgl_newGPU.call(this);
  412.         if (this._animated) {
  413.             this.updateAnim();
  414.         }
  415.     }
  416.    
  417.     Game_Picture.prototype.updateAnim = function() {
  418.         if (!Imported["SumRndmDde Camera Core"]) {
  419.             var spr = SceneManager._scene._spriteset._pictureContainer.children[this.id - 1];
  420.         } else {
  421.             var spr = SceneManager._scene._pictureContainer.children[this.id - 1];
  422.         }
  423.         if (this._bmpArraySave && !spr._bmpArray) {
  424.             spr._bmpArray = [];
  425.             for (var i = 0; i < this._bmpArraySave.length; i++) {
  426.                 spr._bmpArray.push(ImageManager.loadPicture(this._bmpArraySave[i]))
  427.             }
  428.         }
  429.         if (this._frozenBmpSave && !spr._frozenBmp) {
  430.             spr._frozenBmp = ImageManager.loadPicture(this._frozenBmpSave)
  431.         }
  432.         if (this._FbmpArraySave && !spr._FbmpArray) {
  433.             spr._FbmpArray = [];
  434.             for (var i = 0; i < this._FbmpArraySave.length; i++) {
  435.                 spr._FbmpArray.push(ImageManager.loadPicture(this._FbmpArraySave[i]))
  436.             }
  437.         }
  438.         if (this._animated) {
  439.             this._timer += 1;
  440.             if (this._timer >= this._interval) {
  441.                 this._timer = 0;
  442.                 this._index += 1;
  443.             }
  444.             if (this._index >= spr._bmpArray.length) {
  445.                 this._index = 0;
  446.                 if (this._loopInterval) {
  447.                     this._loopTime = this._loopInterval;
  448.                 }
  449.                 if (this._loopLimit) {
  450.                     this._loopTimes -= 1;
  451.                 }
  452.             }
  453.             if (this._loopInterval) {
  454.                 if (this._loopTime > 0) {
  455.                     this._loopTime -= 1;
  456.                     this.freeze();
  457.                 }
  458.                 if (this._loopTime <= 0) {
  459.                     this.unfreeze();
  460.                 }
  461.             }
  462.             if (this._loopLimit && this._loopTimes <= 0) {
  463.                 this.freeze();
  464.             }
  465.             if (this._frozen) {
  466.                 this._index = 0;
  467.                 this._timer = 0;
  468.             } else {
  469.                 this._Findex = 0;
  470.                 this._Ftimer = 0;
  471.             }
  472.             if (spr) {
  473.                 spr.updateBitmap(this);
  474.             }
  475.         }
  476.     }
  477.    
  478.     var _Astfgl_aliasSPUB = Sprite_Picture.prototype.updateBitmap
  479.     Sprite_Picture.prototype.updateBitmap = function() {
  480.         if (this._bmpArray) {
  481.             var pic = this.picture();
  482.             if (!pic || !pic._animated) {_Astfgl_aliasSPUB.call(this); return}
  483.             this.bitmap = this._bmpArray[pic._index]
  484.             if (pic._frozen && this._frozenBmp) {
  485.                 this.bitmap = this._frozenBmp;
  486.             } else if (pic._frozen && pic._Fanimated) {
  487.                 pic._Ftimer += 1;
  488.                 if (pic._Ftimer >= pic._Finterval) {
  489.                     pic._Ftimer = 0;
  490.                     pic._Findex += 1;
  491.                 }
  492.                 if (pic._Findex >= this._FbmpArray.length) {
  493.                     pic._Findex = 0;
  494.                 }
  495.                 this.bitmap = this._FbmpArray[this._Findex]
  496.             }
  497.             this.visible = true
  498.         } else {
  499.             _Astfgl_aliasSPUB.call(this)
  500.         }
  501.     }
  502.    
  503.     Game_Picture.prototype.freeze = function() {
  504.         this._frozen = true;
  505.     }
  506.    
  507.     Game_Picture.prototype.unfreeze = function() {
  508.         this._frozen = false;
  509.     }
  510.  
  511.     Game_Picture.prototype.setLoopInterval = function(num) {
  512.         this._loopTime = 0;
  513.         this._loopInterval = num;
  514.     }
  515.    
  516.     Game_Picture.prototype.removeLoopInterval = function() {
  517.         delete this._loopTime;
  518.         delete this._loopInterval;
  519.         this.unfreeze();
  520.     }
  521.    
  522.     Game_Picture.prototype.setLoopTimes = function(num) {
  523.         this._loopLimit = true;
  524.         this._loopTimes = num;
  525.     }
  526.    
  527.     Game_Picture.prototype.removeLoopTimes = function() {
  528.         delete this._loopLimit;
  529.         delete this._loopTimes;
  530.     }
  531.    
  532.     var _Astfgl_newGSSP = Game_Screen.prototype.showPicture
  533.     Game_Screen.prototype.showPicture = function(pictureId, name, origin, x, y,
  534.                                              scaleX, scaleY, opacity, blendMode) {
  535.         _Astfgl_newGSSP.call(this,pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode);
  536.         var realPictureId = this.realPictureId(pictureId);
  537.         this._pictures[realPictureId].id = realPictureId;
  538.         this._pictures[realPictureId]._homeX = x;
  539.         this._pictures[realPictureId]._homeY = y;
  540.         if (!Imported["SumRndmDde Camera Core"]) {
  541.             var spr = SceneManager._scene._spriteset._pictureContainer.children[pictureId - 1];
  542.         } else {
  543.             var spr = SceneManager._scene._pictureContainer.children[pictureId - 1];
  544.         }
  545.         spr.updateBitmap();
  546.     }
  547.    
  548.     var _Astfgl_newGSEP = Game_Screen.prototype.erasePicture
  549.     Game_Screen.prototype.erasePicture = function(id) {
  550.         _Astfgl_newGSEP.call(this,id);
  551.         if (SceneManager._scene._messageWindow) {
  552.             if (SceneManager._scene._messageWindow._anim) {
  553.                 SceneManager._scene._messageWindow._anim = false;
  554.                 for (var i = 0; i < SceneManager._scene._messageWindow._picIds.length; i++) {
  555.                     if (SceneManager._scene._messageWindow._picIds[i] === id) {
  556.                         SceneManager._scene._messageWindow._picIds.splice(i,1);
  557.                     }
  558.                 }
  559.             }
  560.         }
  561.     }
  562.    
  563.     var _Astfgl_newWBCEC = Window_Message.prototype.processEscapeCharacter
  564.     Window_Message.prototype.processEscapeCharacter = function(code, textState) {
  565.         _Astfgl_newWBCEC.call(this,code,textState);
  566.         if (code === 'FA') {
  567.             $gameScreen.picture(Number(this.obtainEscapeParam(textState))).freeze();
  568.         } else if (code === 'UFA') {
  569.             $gameScreen.picture(Number(this.obtainEscapeParam(textState))).unfreeze();
  570.         } else if (code === 'DA') {
  571.             var num = Number(this.obtainEscapeParam(textState));
  572.             $gameScreen.picture(num).freeze();
  573.             this.removeAnim(num);
  574.         } else if (code === 'SA') {
  575.             this.setAnim(Number(this.obtainEscapeParam(textState)));
  576.         } else if (code === 'CA') {
  577.             var array = $gameVariables.value(this.obtainEscapeParam(textState));
  578.             var id = array[0];
  579.             var arr = array[1];
  580.             var num = array[2];
  581.             $gameScreen.picture(id).setAnim(arr,num);
  582.             this.setAnim(id);
  583.             if (array[3]) {
  584.                 $gameScreen.picture(id).setFrozenBmp(array[3]);
  585.             }
  586.             if (array[4]) {
  587.                 $gameScreen.picture(id).setLoopInterval(array[4]);
  588.             }
  589.             if (array[5]) {
  590.                 $gameScreen.picture(id).setLoopTimes(array[5]);
  591.             }
  592.         } else if (code === 'LP') {
  593.             $gameScreen.picture(Number(this.obtainEscapeParam(textState))).light();
  594.         } else if (code === 'DP') {
  595.             $gameScreen.picture(Number(this.obtainEscapeParam(textState))).dim();
  596.         } else if (code === 'MPH') {
  597.             $gameScreen.picture(Number(this.obtainEscapeParam(textState))).moveHome(30);
  598.         } else if (code === 'CPR') {
  599.             $gameScreen.picture(Number(this.obtainEscapeParam(textState))).fadeout(30,-1);
  600.         } else if (code === 'CPL') {
  601.             $gameScreen.picture(Number(this.obtainEscapeParam(textState))).fadeout(30,1);
  602.         } else if (code === 'FPR') {
  603.             $gameScreen.picture(Number(this.obtainEscapeParam(textState))).fadein(30,-1);
  604.         } else if (code === 'FPL') {
  605.             $gameScreen.picture(Number(this.obtainEscapeParam(textState))).fadein(30,1);
  606.         } else if (code === 'MPR') {
  607.             var ar = this.obtainEscapeParamArray(textState);
  608.             $gameScreen.picture(Number(ar[0])).movePictureRel(Number(ar[1]),Number(ar[2]),Number(ar[3]))
  609.         }
  610.     }
  611.    
  612.     Game_Picture.prototype.setFrameRate = function(num) {
  613.         this._interval = num;
  614.     }
  615.    
  616.     Game_Picture.prototype.light = function(t) {
  617.         var t = t || 30;
  618.         this.tint([0,0,0,0],t);
  619.     }
  620.    
  621.     Game_Picture.prototype.dim = function(t) {
  622.         var t = t || 30;
  623.         this.tint([0,0,0,255],t);
  624.     }
  625.    
  626.     Game_Picture.prototype.moveHome = function (t) {
  627.         var t = t || 30;
  628.         this.move(this._origin, this._homeX, this._homeY, this._scaleX, this._scaleY, this._opacity, this._blendMode, t)
  629.     }
  630.    
  631.     Game_Picture.prototype.fadeout = function(t, dir, dist) {
  632.         var t = t || 30;
  633.         var dir = dir || 1;
  634.         var dist = dist || 20;
  635.         this.move(this._origin, this._x - dist * dir, this._y, this._scaleX, this._scaleY, 0, this._blendMode, t)
  636.         this.tint([0,0,0,255],t);
  637.         this._toClear = true;
  638.     }
  639.    
  640.     Game_Picture.prototype.fadein = function(t,dir, dist) {
  641.         var t = t || 30
  642.         var dir = dir || 1;
  643.         var dist = dist || 20;
  644.         this.move(this._origin, this._x - dist * dir, this._y, this._scaleX, this._scaleY, 255, this._blendMode, t)
  645.         this.tint([0,0,0,0],t);
  646.     }
  647.    
  648.     Game_Picture.prototype.movePictureRel = function(x,y,t) {
  649.         var t = t || 30;
  650.         var y = y || 0;
  651.         this.move(this._origin, this._x + x, this._y + y, this._scaleX, this._scaleY, this._opacity, this._blendMode, t)
  652.     }
  653.    
  654.     Window_Base.prototype.obtainEscapeParamArray = function(textState) {
  655.         var arr = /^\[.+\]/.exec(textState.text.slice(textState.index));
  656.         if (arr) {
  657.             textState.index += arr[0].length;
  658.             arr[0] = arr[0].substring(1,arr[0].length-1)
  659.             var list = arr[0].split(",")
  660.             return list;
  661.         } else {
  662.             return '';
  663.         }
  664.     };
  665.    
  666.     var _Astfgl_aliasNewGPUM = Game_Picture.prototype.updateMove
  667.     Game_Picture.prototype.updateMove = function() {
  668.         _Astfgl_aliasNewGPUM.call(this);
  669.         if (this._duration === 0 && this._toClear) {
  670.             $gameScreen.erasePicture(this.id)
  671.         }
  672.     }
  673.  
  674.  })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement