RMMV JavaScript Unofficial Bugfix Snippets

I found a bug where if you play a video the event doesn't wait for it to end to continue his instructions. This is due to the fact that the code checks if a video is playing after launching it to know if it ended, but the video takes up a few cicles to start so the code thinks it finished playing the cicle after it was launched.


Here is the link to my fix wait for video end fix


Also i put it in the master plugin list but if this will be fixed in the source code i guess it should be deleted, let me know
Spoiler: Function
Code:
/**
* Changes the color tone of the entire bitmap.
*
* @method adjustTone
* @param {Number} r The red strength in the range (-255, 255)
* @param {Number} g The green strength in the range (-255, 255)
* @param {Number} b The blue strength in the range (-255, 255)
*/
Bitmap.prototype.adjustTone = function(r, g, b) {
    if ((r || g || b) && this.width > 0 && this.height > 0) {
        var context = this._context;
        var imageData = context.getImageData(0, 0, this.width, this.height);
        var pixels = imageData.data;
        for (var i = 0; i < pixels.length; i += 4) {
            pixels[i + 0] += r;
            pixels[i + 1] += g;
            pixels[i + 2] += b;
        }
        context.putImageData(imageData, 0, 0);
        this._setDirty();
    }
};

The function will not work if r, g, b are equal to 0

How can I restore a normal tone?
To those who use Mog_TimeSystem with Mog_TimeSystem_HUD plugin and want to display 01:00 pm instead of 13:00
maybe this code i add will help you.
open your Mog_TimeSystem_Hud.js and search the "SpriteTimeEngine.prototype.refresh_timer"
copy this code then replace it.

Code:
SpriteTimeEngine.prototype.refresh_timer = function() {
var x = this.width - 130;
var y = 26;
var pmTime = "PM";
var amTime = "AM";
this._timer_old = $gameSystem.minute();
this._timer.bitmap.clear();
var text = $gameSystem.hour_pm().padZero(2) + ":" + $gameSystem.minute().padZero(2)
this._timer.bitmap.drawText(text,0,0,120,32,"center")
if ($gameSystem.hour()>=12 )
this._timer.bitmap.drawText(pmTime,0,0,107,32,"right")
else{
this._timer.bitmap.drawText(amTime,0,0,107,32,"right")
}
};

hope it help guys,
credits: Moghunter
for a wonderful script.

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-javascript-unofficial-bugfix-snippets.46351/