RMMV JavaScript Unofficial Bugfix Snippets

Discussion in 'JS Plugin Releases (RMMV)' started by Shaz, Oct 23, 2015.

  1. orcomarcio

    orcomarcio Veteran Veteran

    Messages:
    94
    Likes Received:
    19
    First Language:
    Italian
    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
     
    #41
  2. DK

    DK Veteran Veteran

    Messages:
    94
    Likes Received:
    87
    Location:
    Russia
    First Language:
    Russian
    Primarily Uses:
    RMMV
    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?
     
    Last edited: Mar 7, 2017
    #42

Share This Page