Silence warnings

This commit is contained in:
mibi88 2025-07-02 19:48:25 +02:00
parent 5e39e9c8ab
commit 471b35d605
No known key found for this signature in database
2 changed files with 21 additions and 59 deletions

View file

@ -1,41 +0,0 @@
{
"maps": [
{
"fileName": "level0.tmx",
"height": 192,
"width": 384,
"x": 0,
"y": 0
},
{
"fileName": "level1.tmx",
"height": 192,
"width": 384,
"x": 384,
"y": 0
},
{
"fileName": "level2.tmx",
"height": 192,
"width": 384,
"x": 0,
"y": 192
},
{
"fileName": "level3.tmx",
"height": 192,
"width": 384,
"x": 384,
"y": 192
},
{
"fileName": "level4.tmx",
"height": 192,
"width": 384,
"x": 384,
"y": 384
}
],
"onlyShowAdjacentMaps": false,
"type": "world"
}

View file

@ -22,13 +22,13 @@ void inventory_init(Inventory *inventory) {
} }
void inventory_draw(Inventory *inventory, Player *player) { void inventory_draw(Inventory *inventory, Player *player) {
size_t i; char i;
if(inventory->open) { if(inventory->open) {
dimage(0, 0, &inventory_img); dimage(0, 0, &inventory_img);
for(i = 0; i < SLOT_NUM; i++) { for(i = 0; i < SLOT_NUM; i++) {
dsubimage(SLOT_X + (i % SLOT_COLUMNS) * SLOT_SPACING, dsubimage(SLOT_X + (i % SLOT_COLUMNS) * SLOT_SPACING,
SLOT_Y + (i / SLOT_COLUMNS) * SLOT_SPACING, &items_img, SLOT_Y + (i / SLOT_COLUMNS) * SLOT_SPACING, &items_img,
inventory->slots[i].i * SLOT_W, 0, SLOT_W, SLOT_H, inventory->slots[(int)i].i * SLOT_W, 0, SLOT_W, SLOT_H,
DIMAGE_NONE); DIMAGE_NONE);
if(i == inventory->selection) { if(i == inventory->selection) {
dimage(SLOT_X + (i % SLOT_COLUMNS) * SLOT_SPACING, dimage(SLOT_X + (i % SLOT_COLUMNS) * SLOT_SPACING,
@ -43,8 +43,8 @@ void inventory_draw(Inventory *inventory, Player *player) {
} }
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
dsubimage(SLOT_X_EQUIPPED, SLOT_Y + i * SLOT_SPACING, &items_img, dsubimage(SLOT_X_EQUIPPED, SLOT_Y + i * SLOT_SPACING, &items_img,
inventory->equipped[i].i * SLOT_W, 0, SLOT_W, SLOT_H, inventory->equipped[(int)i].i * SLOT_W, 0, SLOT_W,
DIMAGE_NONE); SLOT_H, DIMAGE_NONE);
} }
#if GINT_RENDER_RGB #if GINT_RENDER_RGB
/* Render the player between the two swords if we are on cg. */ /* Render the player between the two swords if we are on cg. */
@ -70,23 +70,26 @@ char inventory_add(Inventory *inventory, Item item) {
void inventory_move_from_selected(Inventory *inventory) { void inventory_move_from_selected(Inventory *inventory) {
if(inventory->selected < 0) if(inventory->selected < 0)
return; return;
Slot current = inventory->slots[inventory->selection]; Slot current = inventory->slots[(int)inventory->selection];
Slot new = inventory->slots[inventory->selected]; Slot new = inventory->slots[(int)inventory->selected];
inventory->slots[inventory->selection] = new; inventory->slots[(int)inventory->selection] = new;
inventory->slots[inventory->selected] = current; inventory->slots[(int)inventory->selected] = current;
} }
void inventory_use(Inventory *inventory, Player *player) { void inventory_use(Inventory *inventory, Player *player) {
Item item = inventory->slots[inventory->selection].i; Item item = inventory->slots[(int)inventory->selection].i;
(void)player;
switch(item_types[item]) { switch(item_types[item]) {
case IT_TALISMAN: case IT_TALISMAN:
inventory->equipped[0] = inventory->slots[inventory->selection]; inventory->equipped[0] = inventory->slots[(int)inventory->selection];
break; break;
case IT_ARMOR: case IT_ARMOR:
inventory->equipped[1] = inventory->slots[inventory->selection]; inventory->equipped[1] = inventory->slots[(int)inventory->selection];
break; break;
case IT_WEAPON: case IT_WEAPON:
inventory->equipped[2] = inventory->slots[inventory->selection]; inventory->equipped[2] = inventory->slots[(int)inventory->selection];
break; break;
case IT_FOOD: case IT_FOOD:
/* TODO */ /* TODO */
@ -94,26 +97,26 @@ void inventory_use(Inventory *inventory, Player *player) {
default: default:
break; break;
} }
inventory->slots[inventory->selection].i = I_NONE; inventory->slots[(int)inventory->selection].i = I_NONE;
inventory->slots[inventory->selection].durability = 255; inventory->slots[(int)inventory->selection].durability = 255;
} }
void inventory_unequip(Inventory *inventory, ItemType type) { void inventory_unequip(Inventory *inventory, ItemType type) {
if(inventory->slots[inventory->selection].i) if(inventory->slots[(int)inventory->selection].i)
return; return;
switch(type) { switch(type) {
case IT_TALISMAN: case IT_TALISMAN:
inventory->slots[inventory->selection] = inventory->equipped[0]; inventory->slots[(int)inventory->selection] = inventory->equipped[0];
inventory->equipped[0].i = I_NONE; inventory->equipped[0].i = I_NONE;
inventory->equipped[0].durability = 255; inventory->equipped[0].durability = 255;
break; break;
case IT_ARMOR: case IT_ARMOR:
inventory->slots[inventory->selection] = inventory->equipped[1]; inventory->slots[(int)inventory->selection] = inventory->equipped[1];
inventory->equipped[1].i = I_NONE; inventory->equipped[1].i = I_NONE;
inventory->equipped[1].durability = 255; inventory->equipped[1].durability = 255;
break; break;
case IT_WEAPON: case IT_WEAPON:
inventory->slots[inventory->selection] = inventory->equipped[2]; inventory->slots[(int)inventory->selection] = inventory->equipped[2];
inventory->equipped[2].i = I_NONE; inventory->equipped[2].i = I_NONE;
inventory->equipped[2].durability = 255; inventory->equipped[2].durability = 255;
break; break;