function Window_Custom() {
this.initialize.apply(this, arguments);
}
Window_Custom.prototype = Object.create(Window_Base.prototype);
Window_Custom.prototype.constructor = Window_Custom;
Window_Custom.prototype.initialize = function(x, y, width) {
this._actor = $gameParty.menuActor();
var width = this.windowWidth();
var height = this.windowHeight();
var x = 145;
var y = 195;
this._x = x;
this._y = y;
this._updateCounter = 0;
this._step = 0;
this._characterName = this._actor.characterName;
this._characterIndex = this._actor.characterIndex;
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.drawActorCharacter(this._actor, x - 112, y - 140);
};
Window_Custom.prototype.update = function() {
this._updateCounter += 1;
if (this._updateCounter >= 25) {
this._step += 1;
if (this._step === 3) {this._step = -1};
this.refresh();
this._updateCounter = 0;
}
};
Window_Custom.prototype.refresh = function() {
if (this.contents) {
this.contents.clear();
this.drawActorCharacter(this._actor, this._x - 112, this._y - 140);
}
};
Window_Custom.prototype.windowWidth = function() {
return 150;
};
Window_Custom.prototype.windowHeight = function() {
return 155;
};
Window_Custom.prototype.drawActorCharacter = function(actor, x, y) {
if (this._step === 2) {var step = 0} else {var step = this._step};
this.drawStepCharacter(actor.characterName(), actor.characterIndex(), x, y, step);
};
Window_Custom.prototype.drawStepCharacter = function(characterName, characterIndex, x, y, step) {
var bitmap = ImageManager.loadCharacter(characterName);
var big = ImageManager.isBigCharacter(characterName);
var pw = bitmap.width / (big ? 3 : 12);
var ph = bitmap.height / (big ? 4 : 8);
var n = characterIndex;
var sx = (step * 48) + ((n % 4 * 3 + 1) * pw);
var sy = (Math.floor(n / 4) * 4) * ph;
var dw = 2 * pw;
var sh = 2 * ph;
this.contents.blt(bitmap, sx, sy, pw, ph, x - pw / 2, y - ph, dw, sh);
};