I'm busting my brain trying to draw the weapon sprite of an equip in a window. What I have:
Spoiler
if (DataManager.isWeapon(equip)) {
this.attackMotion = $dataSystem.attackMotions[equip.wtypeId];
this.wiid = this.attackMotion._weaponImageId;
var pageId = Math.floor((this.wiid - 1) / 12) + 1;
if (pageId >= 1) {
var bitmap = ImageManager.loadSystem('Weapons' + pageId);
} else {
var bitmap = ImageManager.loadSystem('Weapons1');
}
var index = (this.wiid - 1) % 12;
var pw = 96;
var ph = 64;
var sx = (Math.floor(index / 6) * 3) * pw;
var sy = Math.floor(index % 6) * ph;
this.contents.blt(bitmap, sx, sy, pw, ph, 0, 0);
}
this.attackMotion = $dataSystem.attackMotions[equip.wtypeId];
this.wiid = this.attackMotion._weaponImageId;
var pageId = Math.floor((this.wiid - 1) / 12) + 1;
if (pageId >= 1) {
var bitmap = ImageManager.loadSystem('Weapons' + pageId);
} else {
var bitmap = ImageManager.loadSystem('Weapons1');
}
var index = (this.wiid - 1) % 12;
var pw = 96;
var ph = 64;
var sx = (Math.floor(index / 6) * 3) * pw;
var sy = Math.floor(index % 6) * ph;
this.contents.blt(bitmap, sx, sy, pw, ph, 0, 0);
}
When I replace wiid with 2 for example it does work so my problem would be there.
Can somebody help?