I just want to draw Icons in different sizes, therefore I've copied the code of Window_Base.prototype.drawIcon into the following function and added width/height parameters:
JavaScript:
Window_Base.prototype.drawSizedIcon = function(iconIndex, x, y, width, height)
{
const bitmap = ImageManager.loadSystem("IconSet");
const sw = ImageManager.iconWidth;
const sh = ImageManager.iconHeight;
const sx = (iconIndex % 16) *sw;
const sy = Math.floor(iconIndex / 16) * sh;
this.contents.blt(bitmap, sx, sy, sw, sh, x, y, width, height);
}
But for some reason this did not look like I've expected.
To better tell you what I mean take a look at the completely simplified IconSet I've uploaded here. I've surrounded Icon 17 with a red square 34 by 34 pixel, while Icons are 32 by 32 pixel.
Icon 17 starts at 17 % 16 = 1 * 32 = 32 and Math.floor(17 / 16) = 1 * 32 = 32, but the start of the red square is at Pixel (31, 31), yet if I modify Window_BattleStatus.prototype.refresh in the following way and start battle test I can see the red square:
JavaScript:
_refreshStatusWindow = Window_BattleStatus.prototype.refresh;
Window_BattleStatus.prototype.refresh = function()
{
_refreshStatusWindow.call(this);
const item2 = this.itemRect(2);
const startX = item2.x;
const colSpacing = this.colSpacing();
const remainingWidth = this.innerWidth - colSpacing - startX;
const height = item2.height / 3;
const gaugeWidth = (remainingWidth - colSpacing) / 2;
const iconSize = Math.floor(height);
this.contents.fontSize = iconSize;
const startX2 = startX + remainingWidth / 2 + colSpacing / 2;
this.drawSizedIcon(17, startX2, item2.y, iconSize, iconSize);
this.drawText("x " + $gameParty.gold(), startX2 + iconSize + 2, item2.y + 10, gaugeWidth - height, 'left');
this.resetFontSettings();
}
Protected download
Why? What did I do wrong? I don't want to see the sorroundings of the icons next to the icon I want to draw in larger size.
Additional Hint:
I've deactived all plugins except the one that contains my two modified functions I've posted here and it still looks like this.