Don't scale objects if they already fit into the slot.

This commit is contained in:
Steve 2018-03-03 16:05:04 +00:00
parent fca87f6575
commit 8bbdeb9407
1 changed files with 9 additions and 5 deletions

View File

@ -212,14 +212,18 @@ static void drawInventory(void)
if (world.bob->items[i] != NULL) if (world.bob->items[i] != NULL)
{ {
r = getCurrentFrame(world.bob->items[i]->sprite[0]); r = getCurrentFrame(world.bob->items[i]->sprite[0]);
w = r->w; w = r->w;
h = r->h; h = r->h;
if (w > 40 || h > 40)
{
d = 40; d = 40;
d /= (w > h) ? w : h; d /= (w > h) ? w : h;
w *= d; w *= d;
h *= d; h *= d;
}
blitRectScaled(atlasTexture->texture, x + mid, y + mid, w, h, r, 1); blitRectScaled(atlasTexture->texture, x + mid, y + mid, w, h, r, 1);
} }