Fixes
This commit is contained in:
@@ -179,9 +179,9 @@ void renderPlayer(Player *plr) {
|
||||
plr->cursor.heldItemRect.x = plr->cursor.windowX;
|
||||
plr->cursor.heldItemRect.y = plr->cursor.windowY;
|
||||
//itemTex = ItemRegistry[itemIndex].textureOnBelt[plr->cursor.direction];
|
||||
SDL_Rect itemAtlasRect = ItemRegistry[itemIndex].atlasRects[plr->cursor.direction];
|
||||
SDL_Rect itemAtlasRect = ItemRegistry[itemIndex].animation.atlasRects[plr->cursor.direction][(animationStep / ItemRegistry[itemIndex].animation.divisor) % ItemRegistry[itemIndex].animation.frameCount];
|
||||
if (itemAtlasRect.w == 0 || itemAtlasRect.h == 0) {
|
||||
itemAtlasRect = ItemRegistry[itemIndex].atlasRects[ORIENT_LEFT];
|
||||
itemAtlasRect = ItemRegistry[itemIndex].animation.atlasRects[ORIENT_LEFT][(animationStep / ItemRegistry[itemIndex].animation.divisor) % ItemRegistry[itemIndex].animation.frameCount];
|
||||
}
|
||||
if (itemAtlasRect.w != 0 && itemAtlasRect.h != 0) {
|
||||
|
||||
@@ -197,8 +197,10 @@ void renderPlayer(Player *plr) {
|
||||
// }
|
||||
// SDL_RenderCopy(mainRenderer, itemTex, NULL,
|
||||
// &plr->cursor.heldItemRect);
|
||||
char nameItem[80];
|
||||
snprintf(nameItem, 80, "%s\n%s", ItemRegistry[itemIndex].name, OrientStrings[plr->cursor.direction]);
|
||||
SDL_RenderCopy(mainRenderer, atlasTexture, &itemAtlasRect, &plr->cursor.heldItemRect);
|
||||
renderText(mainRenderer, fonts[2], ItemRegistry[itemIndex].name, plr->cursor.heldItemRect.x,
|
||||
renderText(mainRenderer, fonts[2], nameItem, plr->cursor.heldItemRect.x,
|
||||
plr->cursor.heldItemRect.y - (fonts[2].size * 3 / 2));
|
||||
}
|
||||
}
|
||||
@@ -223,9 +225,12 @@ void renderPlayer(Player *plr) {
|
||||
|
||||
SDL_SetTextureBlendMode(atlasTexture, SDL_BLENDMODE_ADD);
|
||||
for (ItemType i = 0; i < ITEMREGISTRY_SIZE; i++) {
|
||||
SDL_Rect itemAtlasRectd = ItemRegistry[i].atlasRects[plr->cursor.direction];
|
||||
if (ItemRegistry[i].name[0] == 0x00) {
|
||||
continue;
|
||||
}
|
||||
SDL_Rect itemAtlasRectd = ItemRegistry[i].animation.atlasRects[plr->cursor.direction][(animationStep / ItemRegistry[i].animation.divisor) % ItemRegistry[i].animation.frameCount];
|
||||
if (itemAtlasRectd.w == 0 || itemAtlasRectd.h == 0) {
|
||||
itemAtlasRectd = ItemRegistry[i].atlasRects[ORIENT_LEFT];
|
||||
itemAtlasRectd = ItemRegistry[i].animation.atlasRects[ORIENT_LEFT][(animationStep / ItemRegistry[i].animation.divisor) % ItemRegistry[i].animation.frameCount];
|
||||
}
|
||||
if (itemAtlasRectd.w != 0 && itemAtlasRectd.h != 0) {
|
||||
// if (plr->inventory.slotCounts[i] <= 0) {
|
||||
|
Reference in New Issue
Block a user