code:
var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap) {
        var CanvasTileRenderer = (function () {
            function CanvasTileRenderer(renderer) {
                this.tileAnim = [0, 0];
                this.dontUseTransform = false;
                this.renderer = renderer;
                this.tileAnim = [0, 0];
            }
            return CanvasTileRenderer;
        }());
        tilemap.CanvasTileRenderer = CanvasTileRenderer;
        PIXI.CanvasRenderer.registerPlugin('tilemap', CanvasTileRenderer);
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap) {
        var CompositeRectTileLayer = (function (_super) {
            __extends(CompositeRectTileLayer, _super);
            function CompositeRectTileLayer(zIndex, bitmaps, useSquare, texPerChild) {
                var _this = _super.call(this) || this;
                _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);
                _this.modificationMarker = 0;
                _this._globalMat = null;
                _this._tempScale = null;
                _this.initialize.apply(_this, arguments);
                return _this;
            }
            CompositeRectTileLayer.prototype.updateTransform = function () {
                _super.prototype.displayObjectUpdateTransform.call(this);
            };
            CompositeRectTileLayer.prototype.initialize = function (zIndex, bitmaps, useSquare, texPerChild) {
                this.z = this.zIndex = zIndex;
                this.useSquare = useSquare;
                this.texPerChild = texPerChild || 16;
                if (bitmaps) {
                    this.setBitmaps(bitmaps);
                }
            };
            CompositeRectTileLayer.prototype.setBitmaps = function (bitmaps) {
                var texPerChild = this.texPerChild;
                var len1 = this.children.length;
                var len2 = Math.ceil(bitmaps.length / texPerChild);
                var i;
                for (i = 0; i < len1; i++) {
                    this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);
                }
                for (i = len1; i < len2; i++) {
                    this.addChild(new tilemap.RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)));
                }
            };
            CompositeRectTileLayer.prototype.clear = function () {
                for (var i = 0; i < this.children.length; i++)
                    this.children[i].clear();
                this.modificationMarker = 0;
            };
            CompositeRectTileLayer.prototype.addRect = function (num, u, v, x, y, tileWidth, tileHeight) {
                if (this.children[num] && this.children[num].textures)
                    this.children[num].addRect(0, u, v, x, y, tileWidth, tileHeight);
            };
            CompositeRectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY) {
                var texture;
                var layer = null, ind = 0;
                var children = this.children;
                if (typeof texture_ === "number") {
                    var childIndex = texture_ / this.texPerChild >> 0;
                    layer = children[childIndex];
                    if (!layer) {
                        layer = children[0];
                        if (!layer) {
                            return false;
                        }
                        ind = 0;
                    }
                    else {
                        ind = texture_ % this.texPerChild;
                    }
                    texture = layer.textures[ind];
                }
                else if (typeof texture_ === "string") {
                    texture = PIXI.Texture.fromImage(texture_);
                }
                else {
                    texture = texture_;
                    for (var i = 0; i < children.length; i++) {
                        var child = children[i];
                        var tex = child.textures;
                        for (var j = 0; j < tex.length; j++) {
                            if (tex[j].baseTexture == texture.baseTexture) {
                                layer = child;
                                ind = j;
                                break;
                            }
                        }
                        if (layer) {
                            break;
                        }
                    }
                    if (!layer) {
                        for (i = 0; i < children.length; i++) {
                            var child = children[i];
                            if (child.textures.length < this.texPerChild) {
                                layer = child;
                                ind = child.textures.length;
                                child.textures.push(texture);
                                break;
                            }
                        }
                        if (!layer) {
                            children.push(layer = new tilemap.RectTileLayer(this.zIndex, texture));
                            ind = 0;
                        }
                    }
                }
                layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.frame.width, texture.frame.height, animX, animY);
                return true;
            };
            ;
            CompositeRectTileLayer.prototype.renderCanvas = function (renderer) {
                if (!renderer.plugins.tilemap.dontUseTransform) {
                    var wt = this.worldTransform;
                    renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
                }
                var layers = this.children;
                for (var i = 0; i < layers.length; i++)
                    layers[i].renderCanvas(renderer);
            };
            ;
            CompositeRectTileLayer.prototype.renderWebGL = function (renderer) {
                var gl = renderer.gl;
                var shader = renderer.plugins.tilemap.getShader(this.useSquare);
                renderer.setObjectRenderer(renderer.plugins.tilemap);
                renderer.bindShader(shader);
                this._globalMat = this._globalMat || new PIXI.Matrix();
                renderer._activeRenderTarget.projectionMatrix.copy(this._globalMat).append(this.worldTransform);
                shader.uniforms.projectionMatrix = this._globalMat.toArray(true);
                shader.uniforms.shadowColor = this.shadowColor;
                if (this.useSquare) {
                    var tempScale = this._tempScale = (this._tempScale || [0, 0]);
                    tempScale[0] = this._globalMat.a >= 0 ? 1 : -1;
                    tempScale[1] = this._globalMat.d < 0 ? 1 : -1;
                    var ps = shader.uniforms.pointScale = tempScale;
                    shader.uniforms.projectionScale = Math.abs(this.worldTransform.a) * renderer.resolution;
                }
                var af = shader.uniforms.animationFrame = renderer.plugins.tilemap.tileAnim;
                var layers = this.children;
                for (var i = 0; i < layers.length; i++)
                    layers[i].renderWebGL(renderer, this.useSquare);
            };
            CompositeRectTileLayer.prototype.isModified = function (anim) {
                var layers = this.children;
                if (this.modificationMarker != layers.length) {
                    return true;
                }
                for (var i = 0; i < layers.length; i++) {
                    var layer = layers[i];
                    if (layer.modificationMarker != layer.pointsBuf.length ||
                        anim && layer.hasAnim) {
                        return true;
                    }
                }
                return false;
            };
            CompositeRectTileLayer.prototype.clearModify = function () {
                var layers = this.children;
                this.modificationMarker = layers.length;
                for (var i = 0; i < layers.length; i++) {
                    var layer = layers[i];
                    layer.modificationMarker = layer.pointsBuf.length;
                }
            };
            return CompositeRectTileLayer;
        }(PIXI.Container));
        tilemap.CompositeRectTileLayer = CompositeRectTileLayer;
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap) {
        var GraphicsLayer = (function (_super) {
            __extends(GraphicsLayer, _super);
            function GraphicsLayer(zIndex) {
                var _this = _super.call(this) || this;
                _this.z = _this.zIndex = zIndex;
                return _this;
            }
            GraphicsLayer.prototype.renderCanvas = function (renderer) {
                var wt = null;
                if (renderer.plugins.tilemap.dontUseTransform) {
                    wt = this.transform.worldTransform;
                    this.transform.worldTransform = PIXI.Matrix.IDENTITY;
                }
                renderer.plugins.graphics.render(this);
                if (renderer.plugins.tilemap.dontUseTransform) {
                    this.transform.worldTransform = wt;
                }
                renderer.context.globalAlpha = 1.0;
            };
            GraphicsLayer.prototype.renderWebGL = function (renderer) {
                if (!this._webGL[renderer.CONTEXT_UID])
                    this.dirty = true;
                _super.prototype.renderWebGL.call(this, renderer);
            };
            GraphicsLayer.prototype.isModified = function (anim) {
                return false;
            };
            GraphicsLayer.prototype.clearModify = function () {
            };
            return GraphicsLayer;
        }(PIXI.Graphics));
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap) {
        var RectTileLayer = (function (_super) {
            __extends(RectTileLayer, _super);
            function RectTileLayer(zIndex, texture) {
                var _this = _super.call(this) || this;
                _this.z = 0;
                _this.zIndex = 0;
                _this.pointsBuf = [];
                _this._tempSize = new Float32Array([0, 0]);
                _this._tempTexSize = 1;
                _this.modificationMarker = 0;
                _this.hasAnim = false;
                _this.vbId = 0;
                _this.vbBuffer = null;
                _this.vbArray = null;
                _this.vbInts = null;
                _this.initialize(zIndex, texture);
                return _this;
            }
            RectTileLayer.prototype.initialize = function (zIndex, textures) {
                if (!textures) {
                    textures = [];
                }
                else if (!(textures instanceof Array) && textures.baseTexture) {
                    textures = [textures];
                }
                this.textures = textures;
                this.z = this.zIndex = zIndex;
                this.visible = false;
            };
            RectTileLayer.prototype.clear = function () {
                this.pointsBuf.length = 0;
                this.modificationMarker = 0;
                this.hasAnim = false;
            };
            RectTileLayer.prototype.renderCanvas = function (renderer) {
                if (this.textures.length === 0)
                    return;
                var points = this.pointsBuf;
                renderer.context.fillStyle = '#000000';
                for (var i = 0, n = points.length; i < n; i += 9) {
                    var x1 = points[i], y1 = points[i + 1];
                    var x2 = points[i + 2], y2 = points[i + 3];
                    var w = points[i + 4];
                    var h = points[i + 5];
                    x1 += points[i + 6] * renderer.plugins.tilemap.tileAnim[0];
                    y1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[1];
                    var textureId = points[i + 8];
                    if (textureId >= 0) {
                        renderer.context.drawImage(this.textures[textureId].baseTexture.source, x1, y1, w, h, x2, y2, w, h);
                    }
                    else {
                        renderer.context.globalAlpha = 0.5;
                        renderer.context.fillRect(x2, y2, w, h);
                        renderer.context.globalAlpha = 1;
                    }
                }
            };
            RectTileLayer.prototype.addRect = function (textureId, u, v, x, y, tileWidth, tileHeight, animX, animY) {
                if (animX === void 0) { animX = 0; }
                if (animY === void 0) { animY = 0; }
                var pb = this.pointsBuf;
                this.hasAnim = this.hasAnim || animX > 0 || animY > 0;
                if (tileWidth == tileHeight) {
                    pb.push(u);
                    pb.push(v);
                    pb.push(x);
                    pb.push(y);
                    pb.push(tileWidth);
                    pb.push(tileHeight);
                    pb.push(animX | 0);
                    pb.push(animY | 0);
                    pb.push(textureId);
                }
                else {
                    var i;
                    if (tileWidth % tileHeight === 0) {
                        for (i = 0; i < tileWidth / tileHeight; i++) {
                            pb.push(u + i * tileHeight);
                            pb.push(v);
                            pb.push(x + i * tileHeight);
                            pb.push(y);
                            pb.push(tileHeight);
                            pb.push(tileHeight);
                            pb.push(animX | 0);
                            pb.push(animY | 0);
                            pb.push(textureId);
                        }
                    }
                    else if (tileHeight % tileWidth === 0) {
                        for (i = 0; i < tileHeight / tileWidth; i++) {
                            pb.push(u);
                            pb.push(v + i * tileWidth);
                            pb.push(x);
                            pb.push(y + i * tileWidth);
                            pb.push(tileWidth);
                            pb.push(tileWidth);
                            pb.push(animX | 0);
                            pb.push(animY | 0);
                            pb.push(textureId);
                        }
                    }
                    else {
                        pb.push(u);
                        pb.push(v);
                        pb.push(x);
                        pb.push(y);
                        pb.push(tileWidth);
                        pb.push(tileHeight);
                        pb.push(animX | 0);
                        pb.push(animY | 0);
                        pb.push(textureId);
                    }
                }
            };
            ;
            RectTileLayer.prototype.renderWebGL = function (renderer, useSquare) {
                if (useSquare === void 0) { useSquare = false; }
                var points = this.pointsBuf;
                if (points.length === 0)
                    return;
                var rectsCount = points.length / 9;
                var tile = renderer.plugins.tilemap;
                var gl = renderer.gl;
                if (!useSquare) {
                    tile.checkIndexBuffer(rectsCount);
                }
                var shader = tile.getShader(useSquare);
                var textures = this.textures;
                if (textures.length === 0)
                    return;
                var len = textures.length;
                if (this._tempTexSize < shader.maxTextures) {
                    this._tempTexSize = shader.maxTextures;
                    this._tempSize = new Float32Array(2 * shader.maxTextures);
                }
                for (var i = 0; i < len; i++) {
                    if (!textures[i] || !textures[i].valid)
                        return;
                    var texture = textures[i].baseTexture;
                }
                tile.bindTextures(renderer, shader, textures);
                var vb = tile.getVb(this.vbId);
                if (!vb) {
                    vb = tile.createVb(useSquare);
                    this.vbId = vb.id;
                    this.vbBuffer = null;
                    this.modificationMarker = 0;
                }
                var vao = vb.vao;
                renderer.bindVao(vao);
                var vertexBuf = vb.vb;
                vertexBuf.bind();
                var vertices = rectsCount * shader.vertPerQuad;
                if (vertices === 0)
                    return;
                if (this.modificationMarker != vertices) {
                    this.modificationMarker = vertices;
                    var vs = shader.stride * vertices;
                    if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {
                        var bk = shader.stride;
                        while (bk < vs) {
                            bk *= 2;
                        }
                        this.vbBuffer = new ArrayBuffer(bk);
                        this.vbArray = new Float32Array(this.vbBuffer);
                        this.vbInts = new Uint32Array(this.vbBuffer);
                        vertexBuf.upload(this.vbBuffer, 0, true);
                    }
                    var arr = this.vbArray, ints = this.vbInts;
                    var sz = 0;
                    var textureId, shiftU, shiftV;
                    if (useSquare) {
                        for (i = 0; i < points.length; i += 9) {
                            textureId = (points[i + 8] >> 2);
                            shiftU = 1024 * (points[i + 8] & 1);
                            shiftV = 1024 * ((points[i + 8] >> 1) & 1);
                            arr[sz++] = points[i + 2];
                            arr[sz++] = points[i + 3];
                            arr[sz++] = points[i + 0] + shiftU;
                            arr[sz++] = points[i + 1] + shiftV;
                            arr[sz++] = points[i + 4];
                            arr[sz++] = points[i + 6];
                            arr[sz++] = points[i + 7];
                            arr[sz++] = textureId;
                        }
                    }
                    else {
                        var tint = -1;
                        for (i = 0; i < points.length; i += 9) {
                            var eps = 0.5;
                            textureId = (points[i + 8] >> 2);
                            shiftU = 1024 * (points[i + 8] & 1);
                            shiftV = 1024 * ((points[i + 8] >> 1) & 1);
                            var x = points[i + 2], y = points[i + 3];
                            var w = points[i + 4], h = points[i + 5];
                            var u = points[i] + shiftU, v = points[i + 1] + shiftV;
                            var animX = points[i + 6], animY = points[i + 7];
                            arr[sz++] = x;
                            arr[sz++] = y;
                            arr[sz++] = u;
                            arr[sz++] = v;
                            arr[sz++] = u + eps;
                            arr[sz++] = v + eps;
                            arr[sz++] = u + w - eps;
                            arr[sz++] = v + h - eps;
                            arr[sz++] = animX;
                            arr[sz++] = animY;
                            arr[sz++] = textureId;
                            arr[sz++] = x + w;
                            arr[sz++] = y;
                            arr[sz++] = u + w;
                            arr[sz++] = v;
                            arr[sz++] = u + eps;
                            arr[sz++] = v + eps;
                            arr[sz++] = u + w - eps;
                            arr[sz++] = v + h - eps;
                            arr[sz++] = animX;
                            arr[sz++] = animY;
                            arr[sz++] = textureId;
                            arr[sz++] = x + w;
                            arr[sz++] = y + h;
                            arr[sz++] = u + w;
                            arr[sz++] = v + h;
                            arr[sz++] = u + eps;
                            arr[sz++] = v + eps;
                            arr[sz++] = u + w - eps;
                            arr[sz++] = v + h - eps;
                            arr[sz++] = animX;
                            arr[sz++] = animY;
                            arr[sz++] = textureId;
                            arr[sz++] = x;
                            arr[sz++] = y + h;
                            arr[sz++] = u;
                            arr[sz++] = v + h;
                            arr[sz++] = u + eps;
                            arr[sz++] = v + eps;
                            arr[sz++] = u + w - eps;
                            arr[sz++] = v + h - eps;
                            arr[sz++] = animX;
                            arr[sz++] = animY;
                            arr[sz++] = textureId;
                        }
                    }
                    vertexBuf.upload(arr, 0, true);
                }
                if (useSquare)
                    gl.drawArrays(gl.POINTS, 0, vertices);
                else
                    gl.drawElements(gl.TRIANGLES, rectsCount * 6, gl.UNSIGNED_SHORT, 0);
            };
            return RectTileLayer;
        }(PIXI.Container));
        tilemap.RectTileLayer = RectTileLayer;
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap) {
        var rectShaderFrag = "varying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n   vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n   float textureId = floor(vTextureId + 0.5);\n\n   vec4 color;\n   %forloop%\n   gl_FragColor = color;\n}";
        var rectShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n   gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n   vec2 anim = aAnim * animationFrame;\n   vTextureCoord = aTextureCoord + anim;\n   vFrame = aFrame + vec4(anim, anim);\n   vTextureId = aTextureId;\n}\n";
        var TilemapShader = (function (_super) {
            __extends(TilemapShader, _super);
            function TilemapShader(gl, maxTextures, shaderVert, shaderFrag) {
                var _this = _super.call(this, gl, shaderVert, shaderFrag) || this;
                _this.maxTextures = 0;
                _this.maxTextures = maxTextures;
                tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures);
                return _this;
            }
            return TilemapShader;
        }(PIXI.Shader));
        tilemap.TilemapShader = TilemapShader;
        var RectTileShader = (function (_super) {
            __extends(RectTileShader, _super);
            function RectTileShader(gl, maxTextures) {
                var _this = _super.call(this, gl, maxTextures, rectShaderVert, tilemap.shaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)) || this;
                _this.vertSize = 11;
                _this.vertPerQuad = 4;
                _this.stride = _this.vertSize * 4;
                tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures);
                return _this;
            }
            RectTileShader.prototype.createVao = function (renderer, vb) {
                var gl = renderer.gl;
                return renderer.createVao()
                    .addIndex(this.indexBuffer)
                    .addAttribute(vb, this.attributes.aVertexPosition, gl.FLOAT, false, this.stride, 0)
                    .addAttribute(vb, this.attributes.aTextureCoord, gl.FLOAT, false, this.stride, 2 * 4)
                    .addAttribute(vb, this.attributes.aFrame, gl.FLOAT, false, this.stride, 4 * 4)
                    .addAttribute(vb, this.attributes.aAnim, gl.FLOAT, false, this.stride, 8 * 4)
                    .addAttribute(vb, this.attributes.aTextureId, gl.FLOAT, false, this.stride, 10 * 4);
            };
            return RectTileShader;
        }(TilemapShader));
        tilemap.RectTileShader = RectTileShader;
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap) {
        var shaderGenerator;
        (function (shaderGenerator) {
            function fillSamplers(shader, maxTextures) {
                var sampleValues = [];
                for (var i = 0; i < maxTextures; i++) {
                    sampleValues[i] = i;
                }
                shader.bind();
                shader.uniforms.uSamplers = sampleValues;
                var samplerSize = [];
                for (i = 0; i < maxTextures; i++) {
                    samplerSize.push(1.0 / 2048);
                    samplerSize.push(1.0 / 2048);
                }
                shader.uniforms.uSamplerSize = samplerSize;
            }
            shaderGenerator.fillSamplers = fillSamplers;
            function generateFragmentSrc(maxTextures, fragmentSrc) {
                return fragmentSrc.replace(/%count%/gi, maxTextures + "")
                    .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));
            }
            shaderGenerator.generateFragmentSrc = generateFragmentSrc;
            function generateSampleSrc(maxTextures) {
                var src = '';
                src += '\n';
                src += '\n';
                src += 'if(vTextureId <= -1.0) {';
                src += '\n\tcolor = shadowColor;';
                src += '\n}';
                for (var i = 0; i < maxTextures; i++) {
                    src += '\nelse ';
                    if (i < maxTextures - 1) {
                        src += 'if(textureId == ' + i + '.0)';
                    }
                    src += '\n{';
                    src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);';
                    src += '\n}';
                }
                src += '\n';
                src += '\n';
                return src;
            }
            shaderGenerator.generateSampleSrc = generateSampleSrc;
        })(shaderGenerator = tilemap.shaderGenerator || (tilemap.shaderGenerator = {}));
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap) {
        var squareShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aAnim;\nattribute float aTextureId;\nattribute float aSize;\n\nuniform mat3 projectionMatrix;\nuniform vec2 samplerSize;\nuniform vec2 animationFrame;\nuniform float projectionScale;\n\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nvoid main(void){\n   gl_Position = vec4((projectionMatrix * vec3(aVertexPosition + aSize * 0.5, 1.0)).xy, 0.0, 1.0);\n   gl_PointSize = aSize * projectionScale;\n   vTextureCoord = aTextureCoord + aAnim * animationFrame;\n   vTextureId = aTextureId;\n   vSize = aSize;\n}\n";
        var squareShaderFrag = "\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\nuniform vec2 pointScale;\n\nvoid main(void){\n   float margin = 0.5 / vSize;\n   vec2 pointCoord = (gl_PointCoord - 0.5) * pointScale + 0.5;\n   vec2 clamped = vec2(clamp(pointCoord.x, margin, 1.0 - margin), clamp(pointCoord.y, margin, 1.0 - margin));\n   vec2 textureCoord = pointCoord * vSize + vTextureCoord;\n   float textureId = vTextureId;\n   vec4 color;\n   %forloop%\n   gl_FragColor = color;\n}\n\n";
        var SquareTileShader = (function (_super) {
            __extends(SquareTileShader, _super);
            function SquareTileShader(gl, maxTextures) {
                var _this = _super.call(this, gl, maxTextures, squareShaderVert, tilemap.shaderGenerator.generateFragmentSrc(maxTextures, squareShaderFrag)) || this;
                _this.vertSize = 8;
                _this.vertPerQuad = 1;
                _this.stride = _this.vertSize * 4;
                _this.maxTextures = maxTextures;
                tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures);
                return _this;
            }
            SquareTileShader.prototype.createVao = function (renderer, vb) {
                var gl = renderer.gl;
                return renderer.createVao()
                    .addIndex(this.indexBuffer)
                    .addAttribute(vb, this.attributes.aVertexPosition, gl.FLOAT, false, this.stride, 0)
                    .addAttribute(vb, this.attributes.aTextureCoord, gl.FLOAT, false, this.stride, 2 * 4)
                    .addAttribute(vb, this.attributes.aSize, gl.FLOAT, false, this.stride, 4 * 4)
                    .addAttribute(vb, this.attributes.aAnim, gl.FLOAT, false, this.stride, 5 * 4)
                    .addAttribute(vb, this.attributes.aTextureId, gl.FLOAT, false, this.stride, 7 * 4);
            };
            ;
            return SquareTileShader;
        }(tilemap.TilemapShader));
        tilemap.SquareTileShader = SquareTileShader;
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap) {
        var glCore = PIXI.glCore;
        function _hackSubImage(tex, sprite, clearBuffer, clearWidth, clearHeight) {
            var gl = tex.gl;
            var baseTex = sprite.texture.baseTexture;
            if (clearBuffer && clearWidth > 0 && clearHeight > 0) {
                gl.texSubImage2D(gl.TEXTURE_2D, 0, sprite.position.x, sprite.position.y, clearWidth, clearHeight, tex.format, tex.type, clearBuffer);
            }
            gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
            gl.texSubImage2D(gl.TEXTURE_2D, 0, sprite.position.x, sprite.position.y, tex.format, tex.type, baseTex.source);
        }
        var TileRenderer = (function (_super) {
            __extends(TileRenderer, _super);
            function TileRenderer(renderer) {
                var _this = _super.call(this, renderer) || this;
                _this.vbs = {};
                _this.indices = new Uint16Array(0);
                _this.lastTimeCheck = 0;
                _this.tileAnim = [0, 0];
                _this.maxTextures = 4;
                _this.texLoc = [];
                return _this;
            }
            TileRenderer.prototype.onContextChange = function () {
                var gl = this.renderer.gl;
                var maxTextures = this.maxTextures;
                this.rectShader = new tilemap.RectTileShader(gl, maxTextures);
                this.squareShader = new tilemap.SquareTileShader(gl, maxTextures);
                this.checkIndexBuffer(2000);
                this.rectShader.indexBuffer = this.indexBuffer;
                this.squareShader.indexBuffer = this.indexBuffer;
                this.vbs = {};
                this.glTextures = [];
                this.boundSprites = [];
                this.initBounds();
            };
            TileRenderer.prototype.initBounds = function () {
                var gl = this.renderer.gl;
                var tempCanvas = document.createElement('canvas');
                tempCanvas.width = 2048;
                tempCanvas.height = 2048;
                for (var i = 0; i < this.maxTextures; i++) {
                    var rt = PIXI.RenderTexture.create(2048, 2048);
                    rt.baseTexture.premultipliedAlpha = true;
                    rt.baseTexture.scaleMode = TileRenderer.SCALE_MODE;
                    rt.baseTexture.wrapMode = PIXI.WRAP_MODES.CLAMP;
                    this.renderer.textureManager.updateTexture(rt);
                    this.glTextures.push(rt);
                    var bs = [];
                    for (var j = 0; j < 4; j++) {
                        var spr = new PIXI.Sprite();
                        spr.position.x = 1024 * (j & 1);
                        spr.position.y = 1024 * (j >> 1);
                        bs.push(spr);
                    }
                    this.boundSprites.push(bs);
                }
            };
            TileRenderer.prototype.bindTextures = function (renderer, shader, textures) {
                var bounds = this.boundSprites;
                var glts = this.glTextures;
                var len = textures.length;
                var maxTextures = this.maxTextures;
                if (len > 4 * maxTextures) {
                    return;
                }
                var doClear = TileRenderer.DO_CLEAR;
                if (doClear && !this._clearBuffer) {
                    this._clearBuffer = new Uint8Array(1024 * 1024 * 4);
                }
                var i;
                for (i = 0; i < len; i++) {
                    var texture = textures[i];
                    if (!texture || !textures[i].valid)
                        continue;
                    var bs = bounds[i >> 2][i & 3];
                    if (!bs.texture ||
                        bs.texture.baseTexture !== texture.baseTexture) {
                        bs.texture = texture;
                        var glt = glts[i >> 2];
                        renderer.bindTexture(glt, 0, true);
                        if (doClear) {
                            _hackSubImage(glt.baseTexture._glTextures[renderer.CONTEXT_UID], bs, this._clearBuffer, 1024, 1024);
                        }
                        else {
                            _hackSubImage(glt.baseTexture._glTextures[renderer.CONTEXT_UID], bs);
                        }
                    }
                }
                this.texLoc.length = 0;
                for (i = 0; i < maxTextures; i++) {
                    this.texLoc.push(renderer.bindTexture(glts[i], i, true));
                }
                shader.uniforms.uSamplers = this.texLoc;
            };
            TileRenderer.prototype.checkLeaks = function () {
                var now = Date.now();
                var old = now - 10000;
                if (this.lastTimeCheck < old ||
                    this.lastTimeCheck > now) {
                    this.lastTimeCheck = now;
                    var vbs = this.vbs;
                    for (var key in vbs) {
                        if (vbs[key].lastTimeAccess < old) {
                            this.removeVb(key);
                        }
                    }
                }
            };
            ;
            TileRenderer.prototype.start = function () {
                this.renderer.state.setBlendMode(PIXI.BLEND_MODES.NORMAL);
            };
            TileRenderer.prototype.getVb = function (id) {
                this.checkLeaks();
                var vb = this.vbs[id];
                if (vb) {
                    vb.lastAccessTime = Date.now();
                    return vb;
                }
                return null;
            };
            TileRenderer.prototype.createVb = function (useSquare) {
                var id = ++TileRenderer.vbAutoincrement;
                var shader = this.getShader(useSquare);
                var gl = this.renderer.gl;
                var vb = PIXI.glCore.GLBuffer.createVertexBuffer(gl, null, gl.STREAM_DRAW);
                var stuff = {
                    id: id,
                    vb: vb,
                    vao: shader.createVao(this.renderer, vb),
                    lastTimeAccess: Date.now(),
                    useSquare: useSquare,
                    shader: shader
                };
                this.vbs[id] = stuff;
                return stuff;
            };
            TileRenderer.prototype.removeVb = function (id) {
                if (this.vbs[id]) {
                    this.vbs[id].vb.destroy();
                    this.vbs[id].vao.destroy();
                    delete this.vbs[id];
                }
            };
            TileRenderer.prototype.checkIndexBuffer = function (size) {
                var totalIndices = size * 6;
                var indices = this.indices;
                if (totalIndices <= indices.length) {
                    return;
                }
                var len = indices.length || totalIndices;
                while (len < totalIndices) {
                    len <<= 1;
                }
                indices = new Uint16Array(len);
                this.indices = indices;
                for (var i = 0, j = 0; i + 5 < indices.length; i += 6, j += 4) {
                    indices[i + 0] = j + 0;
                    indices[i + 1] = j + 1;
                    indices[i + 2] = j + 2;
                    indices[i + 3] = j + 0;
                    indices[i + 4] = j + 2;
                    indices[i + 5] = j + 3;
                }
                if (this.indexBuffer) {
                    this.indexBuffer.upload(indices);
                }
                else {
                    var gl = this.renderer.gl;
                    this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);
                }
            };
            TileRenderer.prototype.getShader = function (useSquare) {
                return useSquare ? this.squareShader : this.rectShader;
            };
            TileRenderer.prototype.destroy = function () {
                _super.prototype.destroy.call(this);
                this.rectShader.destroy();
                this.squareShader.destroy();
                this.rectShader = null;
                this.squareShader = null;
            };
            ;
            return TileRenderer;
        }(PIXI.ObjectRenderer));
        TileRenderer.vbAutoincrement = 0;
        TileRenderer.SCALE_MODE = PIXI.SCALE_MODES.LINEAR;
        TileRenderer.DO_CLEAR = false;
        tilemap.TileRenderer = TileRenderer;
        PIXI.WebGLRenderer.registerPlugin('tilemap', TileRenderer);
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap_1) {
        var ZLayer = (function (_super) {
            __extends(ZLayer, _super);
            function ZLayer(tilemap, zIndex) {
                var _this = _super.call(this) || this;
                _this._lastAnimationFrame = -1;
                _this.tilemap = tilemap;
                _this.z = zIndex;
                return _this;
            }
            ZLayer.prototype.clear = function () {
                var layers = this.children;
                for (var i = 0; i < layers.length; i++)
                    layers[i].clear();
                this._previousLayers = 0;
            };
            ZLayer.prototype.cacheIfDirty = function () {
                var tilemap = this.tilemap;
                var layers = this.children;
                var modified = this._previousLayers != layers.length;
                this._previousLayers = layers.length;
                var buf = this.canvasBuffer;
                var tempRender = this._tempRender;
                if (!buf) {
                    buf = this.canvasBuffer = document.createElement('canvas');
                    tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, { view: buf });
                    tempRender.context = tempRender.rootContext;
                    tempRender.plugins.tilemap.dontUseTransform = true;
                }
                if (buf.width != tilemap._layerWidth ||
                    buf.height != tilemap._layerHeight) {
                    buf.width = tilemap._layerWidth;
                    buf.height = tilemap._layerHeight;
                    modified = true;
                }
                var i;
                if (!modified) {
                    for (i = 0; i < layers.length; i++) {
                        if (layers[i].isModified(this._lastAnimationFrame != tilemap.animationFrame)) {
                            modified = true;
                            break;
                        }
                    }
                }
                this._lastAnimationFrame = tilemap.animationFrame;
                if (modified) {
                    if (tilemap._hackRenderer) {
                        tilemap._hackRenderer(tempRender);
                    }
                    tempRender.context.clearRect(0, 0, buf.width, buf.height);
                    for (i = 0; i < layers.length; i++) {
                        layers[i].clearModify();
                        layers[i].renderCanvas(tempRender);
                    }
                }
                this.layerTransform = this.worldTransform;
                for (i = 0; i < layers.length; i++) {
                    this.layerTransform = layers[i].worldTransform;
                    break;
                }
            };
            ;
            ZLayer.prototype.renderCanvas = function (renderer) {
                this.cacheIfDirty();
                var wt = this.layerTransform;
                renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
                var tilemap = this.tilemap;
                renderer.context.drawImage(this.canvasBuffer, 0, 0);
            };
            ;
            return ZLayer;
        }(PIXI.Container));
        tilemap_1.ZLayer = ZLayer;
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));
//# sourceMappingURL=pixi-tilemap.js.map


code:
//=============================================================================
// AKUNOU_OptionBase.js
// Version: 1.02
// ----------------------------------------------------------------------------
// 河原 つつみ
// 連絡先 ：『アクマの脳髄』http://www.akunou.com/
//=============================================================================

/*:
 * @plugindesc オプション追加用のベーススクリプトです。
 * 入れるだけで若干オプションの操作性が向上したりもします。
 * @author Tsutumi Kawahara
 *
 * @param Window Options Width
 * @desc オプションウィンドウ幅を変更します。
 * 表示名とステータスの表示が被ってしまう場合などに。
 * @default 400
 *
 * @param Window Options Number
 * @desc オプションウィンドウの一画面に表示する項目数。
 * @default 13
 *
 * @help
 * プラグインコマンド:
 *   必要なし
 * プラグイン ON にするだけで適用されるスクリプトです。
 */

(function() {

	var parameters = PluginManager.parameters('AKUNOU_OptionBase');
	var windowOptionsWidth = Number(parameters['Window Options Width']);
	var windowOptionsNumber = Number(parameters['Window Options Number']);

	//-------------------------------------------------------------------------
	// ConfigManager
	//-------------------------------------------------------------------------

	var akunou8_makeData = ConfigManager.makeData;

	ConfigManager.makeData = function() {
		var config = akunou8_makeData.call(this);
		this.makeExtraData(config);
		return config;
	};

	ConfigManager.makeExtraData = function(config) {
		return config;
	};

	//-------------------------------------------------------------------------
	// Window_Options
	//-------------------------------------------------------------------------

	Window_Options.prototype.windowWidth = function() {
		return windowOptionsWidth;
	};

	Window_Options.prototype.windowHeight = function() {
		return this.fittingHeight(Math.min(this.numVisibleRows(), windowOptionsNumber));
	};

    var akunou8_makeCommandList = Window_Options.prototype.makeCommandList;

    Window_Options.prototype.makeCommandList = function() {
		this.addExtraOptions();
		akunou8_makeCommandList.call(this);
    }

	Window_Options.prototype.addExtraOptions = function() {
	};

	Window_Options.prototype.statusText = function(index) {
		var symbol = this.commandSymbol(index);
		var value = this.getConfigValue(symbol);
		if (this.isVolumeSymbol(symbol)) {
			return this.volumeStatusText(value);
		} else if (this.isHexSymbol(symbol)) {
			return value;
		} else if (this.isKeySymbol(symbol)) {
			return this.keyStatusText(symbol, value);
		} else {
			return this.booleanStatusText(value);
		}
	};

	Window_Options.prototype.isHexSymbol = function(symbol) {
		return symbol.contains('Hex');
	};

	Window_Options.prototype.isOpacitySymbol = function(symbol) {
		return symbol.contains('Opacity');
	};

	Window_Options.prototype.isColorSymbol = function(symbol) {
		return symbol.contains('Color');
	};

	Window_Options.prototype.isKeySymbol = function(symbol) {
		return symbol.contains('Key');
	};

	Window_Options.prototype.isDefaultSymbol = function(symbol) {
		return symbol.contains('default');
	};

	Window_Options.prototype.keyStatusText = function(symbol, value) {
		return null;
	};

	Window_Options.prototype.keyLength = function(symbol) {
		return null;
	};

	Window_Options.prototype.processOk = function() {
		var index = this.index();
		var symbol = this.commandSymbol(index);
		var value = this.getConfigValue(symbol);
		var lastValue = value;
		if (this.isDefaultSymbol(symbol)) {
			this.defaultAll();
			SoundManager.playOk();
		} else if (this.isVolumeSymbol(symbol)) {
			value += this.volumeOffset();
			if (lastValue < 100 && value > 100) {
				value = 100;
			}
			if (value > 100) {
				value = 0;
			}
			value = value.clamp(0, 100);
			this.changeValue(symbol, value);
		} else if (this.isOpacitySymbol(symbol)) {
			value += this.opacityOffset();
			if (lastValue < 255 && value > 255) {
				value = 255;
			}
			if (value > 255) {
				value = 0;
			}
			value = value.clamp(0, 255);
			this.changeValue(symbol, value);
		} else if (this.isColorSymbol(symbol)) {
			value += this.colorOffset();
			if (lastValue < 255 && value > 255) {
				value = 255;
			}
			if (value > 255) {
				value = -255;
			}
			value = value.clamp(-255, 255);
			this.changeValue(symbol, value);
		} else if (this.isKeySymbol(symbol)) {
			value += 1;
			if (value > this.keyLength(symbol)) {
				value = 0;
			}
			value = value.clamp(0, this.keyLength(symbol));
			this.changeValue(symbol, value);
		} else {
			this.changeValue(symbol, !value);
		}
	};

	Window_Options.prototype.cursorRight = function(wrap) {
		var index = this.index();
		var symbol = this.commandSymbol(index);
		var value = this.getConfigValue(symbol);
		var lastValue = value;
		if (this.isDefaultSymbol(symbol)) {
		} else if (this.isVolumeSymbol(symbol)) {
			value += this.volumeOffset();
			if (lastValue < 100 && value > 100) {
				value = 100;
			}
			if (wrap && value > 100) {
				value = 0;
			}
			value = value.clamp(0, 100);
			this.changeValue(symbol, value);
		} else if (this.isOpacitySymbol(symbol)) {
			value += this.opacityOffset();
			if (lastValue < 255 && value > 255) {
				value = 255;
			}
			if (wrap && value > 255) {
				value = 0;
			}
			value = value.clamp(0, 255);
			this.changeValue(symbol, value);
		} else if (this.isColorSymbol(symbol)) {
			value += this.colorOffset();
			if (lastValue < 255 && value > 255) {
				value = 255;
			}
			if (wrap && value > 255) {
				value = -255;
			}
			value = value.clamp(-255, 255);
			this.changeValue(symbol, value);
		} else if (this.isKeySymbol(symbol)) {
			value += 1;
			if (wrap && value > this.keyLength(symbol)) {
				value = 0;
			}
			value = value.clamp(0, this.keyLength(symbol));
			this.changeValue(symbol, value);
		} else {
			if (wrap) {
				this.changeValue(symbol, !value);
			} else {
				this.changeValue(symbol, true);
			}
		}
	};

	Window_Options.prototype.cursorLeft = function(wrap) {
		var index = this.index();
		var symbol = this.commandSymbol(index);
		var value = this.getConfigValue(symbol);
		var lastValue = value;
		if (this.isDefaultSymbol(symbol)) {
		} else if (this.isVolumeSymbol(symbol)) {
			value -= this.volumeOffset();
			if (lastValue > 0 && value < 0) {
				value = 0;
			}
			if (wrap && value < 0) {
				value = 100;
			}
			value = value.clamp(0, 100);
			this.changeValue(symbol, value);
		} else if (this.isOpacitySymbol(symbol)) {
			value -= this.opacityOffset();
			if (lastValue > 0 && value < 0) {
				value = 0;
			}
			if (wrap && value < 0) {
				value = 255;
			}
			value = value.clamp(0, 255);
			this.changeValue(symbol, value);
		} else if (this.isColorSymbol(symbol)) {
			value -= this.colorOffset();
			if (lastValue > -255 && value < -255) {
				value = -255;
			}
			if (wrap && value < -255) {
				value = 255;
			}
			value = value.clamp(-255, 255);
			this.changeValue(symbol, value);
		} else if (this.isKeySymbol(symbol)) {
			value -= 1;
			if (wrap && value < 0) {
				value = this.keyLength(symbol);
			}
			value = value.clamp(0, this.keyLength(symbol));
			this.changeValue(symbol, value);
		} else {
			if (wrap) {
				this.changeValue(symbol, !value);
			} else {
				this.changeValue(symbol, false);
			}
		}
	};

})();

repo_name: dazed/translations

license: unknown


code:
//=============================================================================
// AKUNOU_OptionGauge.js
// Version: 1.01
// ----------------------------------------------------------------------------
// 河原 つつみ
// 連絡先 ：『アクマの脳髄』http://www.akunou.com/
//=============================================================================

/*:
 * @plugindesc オプションの数値で表されている一部項目にゲージを描画します。
 * @author Tsutumi Kawahara
 *
 * @param Gauge Color 1
 * @desc ゲージのグラデーションに使われるカラー1。
 * 各数値は R(赤), G(緑), B(青), A(アルファ値) 。
 * @default 255, 204, 32, 255
 *
 * @param Gauge Color 2
 * @desc ゲージのグラデーションに使われるカラー2。
 * 各数値は R(赤), G(緑), B(青), A(アルファ値) 。
 * @default 255, 255, 160, 255
 *
 * @param Gauge Color R 1
 * @desc R値ゲージのグラデーションに使われるカラー1。
 * ウィンドウカラーオプションを使用する場合にのみ必要。
 * @default 255, 96, 96, 255
 *
 * @param Gauge Color R 2
 * @desc R値ゲージのグラデーションに使われるカラー2。
 * ウィンドウカラーオプションを使用する場合にのみ必要。
 * @default 255, 192, 192, 255
 *
 * @param Gauge Color G 1
 * @desc G値ゲージのグラデーションに使われるカラー1。
 * ウィンドウカラーオプションを使用する場合にのみ必要。
 * @default 96, 255, 96, 255
 *
 * @param Gauge Color G 2
 * @desc G値ゲージのグラデーションに使われるカラー2。
 * ウィンドウカラーオプションを使用する場合にのみ必要。
 * @default 192, 255, 192, 255
 *
 * @param Gauge Color B 1
 * @desc B値ゲージのグラデーションに使われるカラー1。
 * ウィンドウカラーオプションを使用する場合にのみ必要。
 * @default 96, 96, 255, 255
 *
 * @param Gauge Color B 2
 * @desc B値ゲージのグラデーションに使われるカラー2。
 * ウィンドウカラーオプションを使用する場合にのみ必要。
 * @default 192, 192, 255, 255
 *
 * @help
 * プラグインコマンド:
 *   必要なし
 * プラグイン ON にするだけで適用されるスクリプトです。
 */

(function() {

	var parameters = PluginManager.parameters('AKUNOU_OptionGauge');
	var gaugeColor1 = 'rgba(' + parameters['Gauge Color 1'] + ')';
	var gaugeColor2 = 'rgba(' + parameters['Gauge Color 2'] + ')';
	var gaugeColorR1 = 'rgba(' + parameters['Gauge Color R 1'] + ')';
	var gaugeColorR2 = 'rgba(' + parameters['Gauge Color R 2'] + ')';
	var gaugeColorG1 = 'rgba(' + parameters['Gauge Color G 1'] + ')';
	var gaugeColorG2 = 'rgba(' + parameters['Gauge Color G 2'] + ')';
	var gaugeColorB1 = 'rgba(' + parameters['Gauge Color B 1'] + ')';
	var gaugeColorB2 = 'rgba(' + parameters['Gauge Color B 2'] + ')';

	//-------------------------------------------------------------------------
	// Window_Options
	//-------------------------------------------------------------------------

	var akunou10_drawItem = Window_Options.prototype.drawItem;

	Window_Options.prototype.drawItem = function(index) {
		var symbol = this.commandSymbol(index);
		if (this.isVolumeSymbol(symbol) || this.isHexSymbol(symbol)) {
			if (this.isVolumeSymbol(symbol)) {
				var max = 100;
			} else if (this.isOpacitySymbol(symbol)) {
				var max = 255;
			} else if (this.isColorSymbol(symbol)) {
				var max = 510;
			}
			var value = this.getConfigValue(symbol);
			var rect = this.itemRectForText(index);
			var statusWidth = this.statusWidth();
			if (this.isColorSymbol(symbol)) {
				if (symbol === 'windowColorRHex') {
					this.drawGauge(rect.width - statusWidth, rect.y, statusWidth, (value + 255) / max, gaugeColorR1, gaugeColorR2);
				} else if (symbol === 'windowColorGHex') {
					this.drawGauge(rect.width - statusWidth, rect.y, statusWidth, (value + 255) / max, gaugeColorG1, gaugeColorG2);
				} else if (symbol === 'windowColorBHex') {
					this.drawGauge(rect.width - statusWidth, rect.y, statusWidth, (value + 255) / max, gaugeColorB1, gaugeColorB2);
				}
			} else {
				this.drawGauge(rect.width - statusWidth, rect.y, statusWidth, value / max, gaugeColor1, gaugeColor2);
			}
		}
		akunou10_drawItem.call(this, index);
	};

})();


code:
"use strict";

//=============================================================================
// Aloe Guvner - Item & Skill Sort Priority
// ALOE_ItemSkillsortPriority.js
//=============================================================================

var Imported = Imported || {};
Imported.ALOE_ItemSkillSortPriority = true;

var ALOE = ALOE || {};
ALOE.Alias = ALOE.Alias || {};

//=============================================================================
/*:
* @plugindesc Allows items, weapons, armors, and skills to appear in an
* order defined by the developer through notetags.
* @author Aloe Guvner
*
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* By default, the items/weapons/armors/skills are sorted by database ID number
* in menu windows, and there is no way to change this order from the editor.
*
* This simple plugin allows the developer to use a notetag in the database
* in order to define a custom order for the items/weapons/armors/skills to
* appear.
*
* ============================================================================
* Instructions
* ============================================================================
*
* The following notetag may be added to the notes on a database entry for
* items/weapons/armors/skills.
*
* <Sort Priority: X>
*
* X --> The sort priority for the item/weapon/armor/skill.
*
* Example:
* <Sort Priority: 2>
*
* If a database entry does not contain this notetag, its sort priority
* is set to the ID# of the entry.
* If a database entry has a defined sort priority that is the same as the
* ID# of an entry without a notetag, the entry with the notetag is
* prioritized.
*
* ============================================================================
* Terms of Use
* ============================================================================
*
* - Free for use in both non-commercial and commercial projects.
* - You are free to edit this plugin as you see fit.
* - Credits are required to: Aloe Guvner
*
*
* ============================================================================
* Changelog
* ============================================================================
*
* Version 1.00:
* - Initial release with support for items, weapons, armors, and skills
*/
//=============================================================================

//=============================================================================
// Notetag Processing
//=============================================================================
// Read the database objects for the <Sort Priority: X> notetag and set a
// sortPriority property.
//=============================================================================

ALOE.notetagsLoaded = false;

ALOE.Alias.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function () {
    if (!ALOE.Alias.DataManager_isDatabaseLoaded.call(this)) return false;
    if (!ALOE.notetagsLoaded) {
        this.sortPriorityNotetag($dataSkills);
        this.sortPriorityNotetag($dataItems);
        this.sortPriorityNotetag($dataWeapons);
        this.sortPriorityNotetag($dataArmors);
        ALOE.notetagsLoaded = true;
    }
    return true;
};

DataManager.sortPriorityNotetag = function (data) {
    var regExp = /<Sort\s*Priority\s*:\s*(\d+)\s*>/i;
    for (var i = 0; i < data.length; i++) {
        if (data[i]) {
            var match = data[i].note.match(regExp);
            data[i].sortPriority = match ? Number(match[1]) : data[i].id + 0.1;
        }
    }
};

//=============================================================================
// Window_SkillList & Window_ItemList
//=============================================================================
// Alias the makeItemList methods to sort the data it is mined and filtered.
//=============================================================================

ALOE.Alias.Window_SkillList_makeItemList = Window_SkillList.prototype.makeItemList;
Window_SkillList.prototype.makeItemList = function () {
    ALOE.Alias.Window_SkillList_makeItemList.call(this);
    this.sortPriorityList();
};

ALOE.Alias.Window_ItemList_makeItemList = Window_ItemList.prototype.makeItemList;
Window_ItemList.prototype.makeItemList = function () {
    ALOE.Alias.Window_ItemList_makeItemList.call(this);
    this.sortPriorityList();
};

//=============================================================================
// Window_Selectable
//=============================================================================
// Method to sort the data objects based on the sortPriority property.
// For an unknown reason, the data used in the equip scene contains a null
// entry at the end of the array, which must be handled separately.
//=============================================================================

Window_Selectable.prototype.sortPriorityList = function () {
    if (this._data) {
        if (this._data[this._data.length - 1] === null) {
            //equip item list
            this._data = this._data.filter(function (a) {
                return a;
            });
            this._data.sort(function (a, b) {
                return a.sortPriority - b.sortPriority;
            });
            this._data.push(null);
        } else {
            //all other item lists
            this._data.sort(function (a, b) {
                return a.sortPriority - b.sortPriority;
            });
        }
    }

};

//=============================================================================
// Apply Sort Priority to Window_EquipItem
//=============================================================================
ALOE.Alias.Window_EquipItem_makeItemList = Window_EquipItem.prototype.makeItemList;
Window_EquipItem.prototype.makeItemList = function () {
    ALOE.Alias.Window_EquipItem_makeItemList.call(this);
    this.sortPriorityList(); // Sort the equipment list by Sort Priority
};


code:
//=============================================================================
// AltMenuScreen.js
//=============================================================================

/*:
 * @plugindesc Alternative menu screen layout.
 * @author Yoji Ojima
 *
 * @help This plugin does not provide plugin commands.
 */

/*:ja
 * @plugindesc メニュー画面のレイアウトを変更します。
 * @author Yoji Ojima
 *
 * @help このプラグインには、プラグインコマンドはありません。
 */

(function() {

    var _Scene_Menu_create = Scene_Menu.prototype.create;
    Scene_Menu.prototype.create = function() {
        _Scene_Menu_create.call(this);
        this._statusWindow.x = 0;
        this._statusWindow.y = this._commandWindow.height;
        this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width;
    };

    Window_MenuCommand.prototype.windowWidth = function() {
        return Graphics.boxWidth;
    };

    Window_MenuCommand.prototype.maxCols = function() {
        return 4;
    };

    Window_MenuCommand.prototype.numVisibleRows = function() {
        return 2;
    };

    Window_MenuStatus.prototype.windowWidth = function() {
        return Graphics.boxWidth;
    };

    Window_MenuStatus.prototype.windowHeight = function() {
        var h1 = this.fittingHeight(1);
        var h2 = this.fittingHeight(2);
        return Graphics.boxHeight - h1 - h2;
    };

    Window_MenuStatus.prototype.maxCols = function() {
        return 4;
    };

    Window_MenuStatus.prototype.numVisibleRows = function() {
        return 1;
    };

    Window_MenuStatus.prototype.drawItemImage = function(index) {
        var actor = $gameParty.members()[index];
        var rect = this.itemRectForText(index);
        var w = Math.min(rect.width, 144);
        var h = Math.min(rect.height, 144);
        var lineHeight = this.lineHeight();
        this.changePaintOpacity(actor.isBattleMember());
        this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2.5, w, h);
        this.changePaintOpacity(true);
    };

    Window_MenuStatus.prototype.drawItemStatus = function(index) {
        var actor = $gameParty.members()[index];
        var rect = this.itemRectForText(index);
        var x = rect.x;
        var y = rect.y;
        var width = rect.width;
        var bottom = y + rect.height;
        var lineHeight = this.lineHeight();
        this.drawActorName(actor, x, y + lineHeight * 0, width);
        this.drawActorLevel(actor, x, y + lineHeight * 1, width);
        this.drawActorClass(actor, x, bottom - lineHeight * 4, width);
        this.drawActorHp(actor, x, bottom - lineHeight * 3, width);
        this.drawActorMp(actor, x, bottom - lineHeight * 2, width);
        this.drawActorIcons(actor, x, bottom - lineHeight * 1, width);
    };

    var _Window_MenuActor_initialize = Window_MenuActor.prototype.initialize;
    Window_MenuActor.prototype.initialize = function() {
        _Window_MenuActor_initialize.call(this);
        this.y = this.fittingHeight(2);
    };

})();


code:
//=============================================================================
// AltSaveScreen.js
//=============================================================================

/*:
 * @plugindesc Alternative save/load screen layout.
 * @author Yoji Ojima
 *
 * @help This plugin does not provide plugin commands.
 */

/*:ja
 * @plugindesc セーブ／ロード画面のレイアウトを変更します。
 * @author Yoji Ojima
 *
 * @help このプラグインには、プラグインコマンドはありません。
 */

(function() {

    var _Scene_File_create = Scene_File.prototype.create;
    Scene_File.prototype.create = function() {
        _Scene_File_create.call(this);
        this._listWindow.height = this._listWindow.fittingHeight(8);
        var x = 0;
        var y = this._listWindow.y + this._listWindow.height;
        var width = Graphics.boxWidth;
        var height = Graphics.boxHeight - y;
        this._statusWindow = new Window_SavefileStatus(x, y, width, height);
        this._statusWindow.setMode(this.mode());
        this._listWindow.statusWindow = this._statusWindow;
        this._listWindow.callUpdateHelp();
        this.addWindow(this._statusWindow);
    };

    var _Scene_File_start = Scene_File.prototype.start;
    Scene_File.prototype.start = function() {
        _Scene_File_start.call(this);
        this._listWindow.ensureCursorVisible();
        this._listWindow.callUpdateHelp();
    };

    Window_SavefileList.prototype.windowWidth = function() {
        return Graphics.boxWidth;
    };

    Window_SavefileList.prototype.maxCols = function() {
        return 4;
    };

    Window_SavefileList.prototype.numVisibleRows = function() {
        return 5;
    };

    Window_SavefileList.prototype.spacing = function() {
        return 8;
    };

    Window_SavefileList.prototype.itemHeight = function() {
        return this.lineHeight() * 2;
    };

    var _Window_SavefileList_callUpdateHelp =
            Window_SavefileList.prototype.callUpdateHelp;
    Window_SavefileList.prototype.callUpdateHelp = function() {
        _Window_SavefileList_callUpdateHelp.call(this);
        if (this.active && this.statusWindow) {
            this.statusWindow.setId(this.index() + 1);
        }
    };

    function Window_SavefileStatus() {
        this.initialize.apply(this, arguments);
    }

    Window_SavefileStatus.prototype = Object.create(Window_Base.prototype);
    Window_SavefileStatus.prototype.constructor = Window_SavefileStatus;

    Window_SavefileStatus.prototype.initialize = function(x, y, width, height) {
        Window_Base.prototype.initialize.call(this, x, y, width, height);
        this._id = 1;
    };

    Window_SavefileStatus.prototype.setMode = function(mode) {
        this._mode = mode;
    };

    Window_SavefileStatus.prototype.setId = function(id) {
        this._id = id;
        this.refresh();
    };

    Window_SavefileStatus.prototype.refresh = function() {
        this.contents.clear();
        var id = this._id;
        var valid = DataManager.isThisGameFile(id);
        var info = DataManager.loadSavefileInfo(id);
        var rect = this.contents.rect;
        this.resetTextColor();
        if (this._mode === 'load') {
            this.changePaintOpacity(valid);
        }
        this.drawFileId(id, rect.x, rect.y);
        if (info) {
            this.changePaintOpacity(valid);
            this.drawContents(info, rect, valid);
            this.changePaintOpacity(true);
        }
    };

    Window_SavefileStatus.prototype.drawFileId = function(id, x, y) {
        this.drawText(TextManager.file + ' ' + id, x, y, 180);
    };

    Window_SavefileStatus.prototype.drawContents = function(info, rect, valid) {
        var bottom = rect.y + rect.height;
        var playtimeY = bottom - this.lineHeight();
        this.drawText(info.title, rect.x + 192, rect.y, rect.width - 192);
        if (valid) {
            this.drawPartyfaces(info, rect.x, bottom - 144);
        }
        this.drawText(info.playtime, rect.x, playtimeY, rect.width, 'right');
    };

    Window_SavefileStatus.prototype.drawPartyfaces = function(info, x, y) {
        if (info && info.faces) {
            for (var i = 0; i < info.faces.length; i++) {
                var data = info.faces[i];
                this.drawFace(data[0], data[1], x + i * 150, y);
            }
        }
    };

})();


code:
//=============================================================================
// AltWindowFramejs
//=============================================================================

/*:
 * @plugindesc Alternative Windowflame.
 * @author KADOKAWA
 *
 * @help This plugin does not provide plugin commands.
 * @requiredAssets img/system/Window_Talk
 * @requiredAssets img/system/Window_Battle
 * @requiredAssets img/system/Window_Status
 * @requiredAssets img/system/Window_Other
 */

/*:ja
 * @plugindesc ウィンドウのフレームを変更します。
 * @author KADOKAWA
 *
 * @help このプラグインには、プラグインコマンドはありません。
 * @requiredAssets img/system/Window_Talk
 * @requiredAssets img/system/Window_Battle
 * @requiredAssets img/system/Window_Status
 * @requiredAssets img/system/Window_Other
 */

 (function() {

    Window_Base.prototype.loadWindowskin = function() {
        this.windowskin = ImageManager.loadSystem('Window_Talk');
        this.windowskin = ImageManager.loadSystem('Window_Battle');
        this.windowskin = ImageManager.loadSystem('Window_Status');
        this.windowskin = ImageManager.loadSystem('Window_Other');
        this.windowskin = ImageManager.loadSystem('Window');
    };

    var _Scene_Title_Create = Scene_Title.prototype.create;
    Scene_Title.prototype.create = function() {
        _Scene_Title_Create.call(this);
        this._commandWindow._windowskin = ImageManager.loadSystem('Window_Other');
        this._commandWindow._refreshAllParts();
    };

    var _Scene_Menu_Create = Scene_Menu.prototype.create;
    Scene_Menu.prototype.create = function() {
        _Scene_Menu_Create.call(this);
        var _image = ImageManager.loadSystem('Window_Status');
        this._statusWindow._windowskin = _image;
        this._commandWindow._windowskin = _image;
        this._goldWindow._windowskin = _image;

        this._statusWindow._refreshAllParts();
        this._commandWindow._refreshAllParts();
        this._goldWindow._refreshAllParts();
    };

    var _Scene_Item_Create = Scene_Item.prototype.create;
    Scene_Item.prototype.create = function() {
        _Scene_Item_Create.call(this);
        var _image = ImageManager.loadSystem('Window_Status');
        this._categoryWindow._windowskin = _image;
        this._itemWindow._windowskin = _image;
        this._helpWindow._windowskin = _image;
        this._actorWindow._windowskin = _image;

        this._categoryWindow._refreshAllParts();
        this._itemWindow._refreshAllParts();
        this._helpWindow._refreshAllParts();
        this._actorWindow._refreshAllParts();
    }

    var _Scene_Skill_Create = Scene_Skill.prototype.create;
    Scene_Skill.prototype.create = function() {
        _Scene_Skill_Create.call(this);
        var _image = ImageManager.loadSystem('Window_Status');
        this._helpWindow._windowskin = _image;
        this._skillTypeWindow._windowskin = _image;
        this._statusWindow._windowskin = _image;
        this._itemWindow._windowskin = _image;
        this._actorWindow._windowskin = _image;

        this._helpWindow._refreshAllParts();
        this._skillTypeWindow._refreshAllParts();
        this._statusWindow._refreshAllParts();
        this._itemWindow._refreshAllParts();
        this._actorWindow._refreshAllParts();
    };

    var _Scene_Equip_Create = Scene_Equip.prototype.create;
    Scene_Equip.prototype.create = function() {
        _Scene_Equip_Create.call(this);
        var _image = ImageManager.loadSystem('Window_Status');
        this._helpWindow._windowskin = _image;
        this._statusWindow._windowskin = _image;
        this._commandWindow._windowskin = _image;
        this._slotWindow._windowskin = _image;
        this._itemWindow._windowskin = _image;

        this._helpWindow._refreshAllParts();
        this._statusWindow._refreshAllParts();
        this._commandWindow._refreshAllParts();
        this._slotWindow._refreshAllParts();
        this._itemWindow._refreshAllParts();
    };

    var _Scene_Status_Create = Scene_Status.prototype.create;
    Scene_Status.prototype.create = function() {
        _Scene_Status_Create.call(this);
        this._statusWindow._windowskin = ImageManager.loadSystem('Window_Status');
        this._statusWindow._refreshAllParts();
    };

    var _Scene_Options_Create = Scene_Options.prototype.create;
    Scene_Options.prototype.create = function() {
        _Scene_Options_Create.call(this);
        this._optionsWindow._windowskin = ImageManager.loadSystem('Window_Status');
        this._optionsWindow._refreshAllParts();
    };

    var _Scene_File_Create = Scene_File.prototype.create;
    Scene_File.prototype.create = function() {
        _Scene_File_Create.call(this);
        var _image = ImageManager.loadSystem('Window_Status');
        this._helpWindow._windowskin = _image;
        this._listWindow._windowskin = _image;

        this._helpWindow._refreshAllParts();
        this._listWindow._refreshAllParts();
    };

    var _Scene_GameEnd_Create = Scene_GameEnd.prototype.create;
    Scene_GameEnd.prototype.create = function() {
        _Scene_GameEnd_Create.call(this);
        this._commandWindow._windowskin = ImageManager.loadSystem('Window_Status');
        this._commandWindow._refreshAllParts();
    };

    var _Scene_Battle_Create = Scene_Battle.prototype.create;
    Scene_Battle.prototype.create = function() {
        _Scene_Battle_Create.call(this);

        var _image = ImageManager.loadSystem('Window_Battle');

        this._logWindow._windowskin          = _image;
        this._statusWindow._windowskin       = _image;
        this._partyCommandWindow._windowskin = _image;
        this._actorCommandWindow._windowskin = _image;
        this._helpWindow._windowskin         = _image;
        this._skillWindow._windowskin        = _image;
        this._itemWindow._windowskin         = _image;
        this._actorWindow._windowskin        = _image;
        this._enemyWindow._windowskin        = _image;
        this._messageWindow._windowskin      = _image;
        this._scrollTextWindow._windowskin   = _image;

        this._logWindow._refreshAllParts();
        this._statusWindow._refreshAllParts();
        this._partyCommandWindow._refreshAllParts();
        this._actorCommandWindow._refreshAllParts();
        this._helpWindow._refreshAllParts();
        this._skillWindow._refreshAllParts();
        this._itemWindow._refreshAllParts();
        this._actorWindow._refreshAllParts();
        this._enemyWindow._refreshAllParts();
        this._messageWindow._refreshAllParts();
        this._scrollTextWindow._refreshAllParts();
    };

    var _Window_Message_Initialize = Window_Message.prototype.initialize;
    Window_Message.prototype.initialize = function() {
        _Window_Message_Initialize.call(this);
        this.windowskin = ImageManager.loadSystem('Window_Talk');
        this._refreshAllParts();
    };

    Window.prototype._refreshFrame = function() {
        var w = this._width;
        var h = this._height;
        var m = 24;
        var bitmap = new Bitmap(w, h);

        this._windowFrameSprite.bitmap = bitmap;
        this._windowFrameSprite.setFrame(0, 0, w, h);

        if (w > 0 && h > 0 && this._windowskin) {
            var skin = this._windowskin;

            // frame
            var p = 96;
            var q = 96;
            bitmap.blt(skin, p+0,   0+0,   m,     m,     0,   0,   m,     m);       // left top corner
            bitmap.blt(skin, p+0,   0+q-m, m,     m,     0,   h-m, m,     m);       // left bottom corner
            bitmap.blt(skin, p+q-m, 0+0,   m,     m,     w-m, 0,   m,     m);       // right top corner
            bitmap.blt(skin, p+q-m, 0+q-m, m,     m,     w-m, h-m, m,     m);       // right bottom corner

            var frameHeight = 48;
            var heightCount = Math.floor((h-frameHeight) / frameHeight);
            var remainder = (h-frameHeight) % frameHeight;
            for(var i = 0; i < heightCount; i++) {
                bitmap.blt(skin, p+0,   0+m, m, p-m*2, 0,   m+frameHeight*i, m, frameHeight);   // left frame
                bitmap.blt(skin, p+q-m, 0+m, m, p-m*2, w-m, m+frameHeight*i, m, frameHeight);   // right frame
            }
            if(remainder != 0) {
                bitmap.blt(skin, p+0,   0+m, m, remainder, 0,   m+frameHeight*heightCount, m, remainder);   // left frame
                bitmap.blt(skin, p+q-m, 0+m, m, remainder, w-m, m+frameHeight*heightCount, m, remainder);   // right frame
            }

            var frameWidth = 48;
            var widthCount = Math.floor((w-frameWidth) / frameWidth);
            remainder = (w-frameWidth) % frameWidth;
            for(var j = 0; j < widthCount; j++) {
                bitmap.blt(skin, p+m,   0+0,   p-m*2, m, m+frameWidth*j, 0,   frameWidth, m); // top frame
                bitmap.blt(skin, p+m,   0+q-m, p-m*2, m, m+frameWidth*j, h-m, frameWidth, m); // bottom frame
            }
            if(remainder != 0) {
                bitmap.blt(skin, p+m,   0+0,   remainder, m, m+frameWidth*widthCount, 0,   remainder, m); // top frame
                bitmap.blt(skin, p+m,   0+q-m, remainder, m, m+frameWidth*widthCount, h-m, remainder, m); // bottom frame
            }

            // corner
            var r = 48;
            var s = 48;
            bitmap.blt(skin, 0,   0+q*4, r, s, 0,   0,   r, s); // left top
            bitmap.blt(skin, r,   0+q*4, r, s, w-r, 0,   r, s); // right top
            bitmap.blt(skin, r*2, 0+q*4, r, s, 0,   h-r, r, s); // left bottom
            bitmap.blt(skin, r*3, 0+q*4, r, s, w-r, h-r, r, s); // right bottom

        }
    };

    Window.prototype._refreshBack = function() {
        var m = this._margin + 6;
        var w = this._width - m * 2;
        var h = this._height - m * 2;
        var bitmap = new Bitmap(w, h);

        this._windowBackSprite.bitmap = bitmap;
        this._windowBackSprite.setFrame(0, 0, w, h);
        this._windowBackSprite.move(m, m);

        if (w > 0 && h > 0 && this._windowskin) {
            var p = 192;
            for (var y = 0; y < h; y += p) {
                for (var x = 0; x < w; x += p) {
                    bitmap.blt(this._windowskin, 0, p, p, p, x, y, p, p);
                }
            }
        }
    };

})();


code:
//=============================================================================
// AnimationFrameRate.js
// by Tsukimi
// Last Updated: 2018.02.11
//=============================================================================

/*:en
 * @plugindesc AnimationFrameRate
 * @author Tsukimi
 *
 * @param framerate:1
 * @desc animation plays 60 animation frame per sec with name start with this symbol
 * @default !
 *
 * @param framerate:2
 * @desc animation plays 30 animation frame per sec with name start with this symbol
 * @default &
 *
 * @param framerate:3
 * @desc animation plays 20 animation frame per sec with name start with this symbol
 * @default $
 *
 * @param framerate:5
 * @desc animation plays 12 animation frame per sec with name start with this symbol
 * @default #
 *
 * @param framerate:6
 * @desc animation plays 10 animation frame per sec with name start with this symbol
 * @default %
 *
 * @help
 * RPG Maker MV plays animation as
 * 4 frame(time)/ 1 animation frame.
 * With this plugin, you can adjust the frame rate of each animation.
 *
 * -----------------
 *
 */
/*:ja
 * @plugindesc アニメフレームレート
 * @author ツキミ
 *
 * @param framerate:1
 * @desc 一秒あたり60フレーム再生したいアニメーションの接頭語
 * @default !
 *
 * @param framerate:2
 * @desc 一秒あたり30フレーム再生したいアニメーションの接頭語
 * @default &
 *
 * @param framerate:3
 * @desc 一秒あたり20フレーム再生したいアニメーションの接頭語
 * @default $
 *
 * @param framerate:5
 * @desc 一秒あたり12フレーム再生したいアニメーションの接頭語
 * @default #
 *
 * @param framerate:6
 * @desc 一秒あたり10フレーム再生したいアニメーションの接頭語
 * @default %
 *
 *
 * @help
 * ツクールMVではデフォルトで、
 * 1アニメーションフレームに 4フレーム（時間）かかりますが、
 * このプラグインを使えば、アニメーション毎のフレームレートが設定できます。
 *
 * (デフォ：一秒あたり15フレーム再生される)
 *
 * -----------------
 *
 */

(function() {
    'use strict';

    var pluginName = 'AnimationFrameRate';
    var getParam = function(paramNames) {
        if (!Array.isArray(paramNames)) paramNames = [paramNames];
        for (var i = 0; i < paramNames.length; i++) {
            var name = PluginManager.parameters(pluginName)[paramNames[i]];
            if (name) return name;
        }
        return "";
    };

    var FR1 = getParam("framerate:1").substr(0, 1);
    var FR2 = getParam("framerate:2").substr(0, 1);
    var FR3 = getParam("framerate:3").substr(0, 1);
    var FR5 = getParam("framerate:5").substr(0, 1);
    var FR6 = getParam("framerate:6").substr(0, 1);

    var _Sprite_Animation_setupRate = Sprite_Animation.prototype.setupRate;
    Sprite_Animation.prototype.setupRate = function() {
        if(!this._animation) {
            _Sprite_Animation_setupRate.apply(this, arguments);
            return;
        }
        var initial = this._animation.name.substr(0,1);
        if(initial === FR1) this._rate = 1;
        else if(initial === FR2) this._rate = 2;
        else if(initial === FR3) this._rate = 3;
        else if(initial === FR5) this._rate = 5;
        else if(initial === FR6) this._rate = 6;
        else _Sprite_Animation_setupRate.apply(this, arguments);
    };

})();