Collab_RPG/src/inventory.c
2024-08-02 12:59:10 +02:00

32 lines
1.1 KiB
C

#include "inventory.h"
#include <gint/display.h>
extern bopti_image_t inventory_img;
extern bopti_image_t items_img;
extern bopti_image_t player_male_inv_img;
extern bopti_image_t player_female_inv_img;
void inventory_draw(Game *game, Inventory *inventory) {
size_t i;
if(inventory->open) {
dimage(0, 0, &inventory_img);
for(i = 0; i < SLOT_NUM; i++) {
dsubimage(SLOT_X + (i % SLOT_COLUMNS) * SLOT_SPACING,
SLOT_Y + (i / SLOT_COLUMNS) * SLOT_SPACING, &items_img,
inventory->slots[i].i * SLOT_W, 0, SLOT_W, SLOT_H,
DIMAGE_NONE);
}
for(i = 0; i < 3; i++) {
dsubimage(SLOT_X_EQUIPPED, SLOT_Y + i * SLOT_SPACING, &items_img,
inventory->equipped[i].i * SLOT_W, 0, SLOT_W, SLOT_H,
DIMAGE_NONE);
}
#if GINT_RENDER_RGB
/* Render the player between the two swords if we are on cg. */
dimage(183, 20,
game->player.is_male ? &player_male_inv_img
: &player_female_inv_img);
#endif
}
}