summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcamthesaxman <cameronghall@cox.net>2018-01-07 23:12:24 -0600
committercamthesaxman <cameronghall@cox.net>2018-01-07 23:12:24 -0600
commit0e371dcb1a76859f93b3d4cc1dc5ef48696b98b7 (patch)
tree777308c4d6f3e66b801a6ff7717678d9d6077298
parent961d82002d7d073123f55427219f14335b8bac9c (diff)
fix ItemStorage_DrawItemList
-rw-r--r--src/field/player_pc.c72
1 files changed, 31 insertions, 41 deletions
diff --git a/src/field/player_pc.c b/src/field/player_pc.c
index 78235590a..928cb9689 100644
--- a/src/field/player_pc.c
+++ b/src/field/player_pc.c
@@ -866,58 +866,48 @@ static void ItemStorage_DrawItemList(u8 taskId)
u16 i;
u16 yCoord = 0;
- // r5 is i and is unsigned 16-bit.
-
- for(i = ITEMS_ABOVE_TOP; i < ITEMS_ABOVE_TOP + NUM_PAGE_ITEMS; i++)
+ for (i = ITEMS_ABOVE_TOP; i < ITEMS_ABOVE_TOP + NUM_PAGE_ITEMS; i++)
{
yCoord = (i - ITEMS_ABOVE_TOP) * 2;
- if(i != NUM_ITEMS)
+ if (i == NUM_ITEMS)
+ {
+ sub_8072A18(gOtherText_CancelNoTerminator, 0x80, (yCoord + 2) * 8, 0x68, 1);
+ break;
+ }
+ else
{
tempArg = 0;
- if(SWITCH_MODE_ACTIVE != FALSE && i == SWAP_ITEM_INDEX)
+ if (SWITCH_MODE_ACTIVE != FALSE && i == SWAP_ITEM_INDEX)
tempArg = 1;
- switch(GetPocketByItemId(gSaveBlock1.pcItems[i].itemId) - 1)
+ switch (GetPocketByItemId(gSaveBlock1.pcItems[i].itemId) - 1)
{
- case 0:
- case 1:
- case 3:
- ItemStorage_DrawNormalItemEntry((struct ItemSlot *)&gSaveBlock1.pcItems[i], yCoord + 2, tempArg);
- break;
- case 4:
- ItemStorage_DrawKeyItemEntry((struct ItemSlot *)&gSaveBlock1.pcItems[i], yCoord + 2, tempArg);
- break;
- case 2:
- ItemStorage_DrawTMHMEntry((struct ItemSlot *)&gSaveBlock1.pcItems[i], yCoord + 2, tempArg);
- break;
+ case 0:
+ case 1:
+ case 3:
+ ItemStorage_DrawNormalItemEntry((struct ItemSlot *)&gSaveBlock1.pcItems[i], yCoord + 2, tempArg);
+ break;
+ case 4:
+ ItemStorage_DrawKeyItemEntry((struct ItemSlot *)&gSaveBlock1.pcItems[i], yCoord + 2, tempArg);
+ break;
+ case 2:
+ ItemStorage_DrawTMHMEntry((struct ItemSlot *)&gSaveBlock1.pcItems[i], yCoord + 2, tempArg);
+ break;
}
}
- else
- {
- goto weirdCase; // what???
- }
}
-beforeLabel:
- if(i - ITEMS_ABOVE_TOP < 8)
+ if (i - ITEMS_ABOVE_TOP < 8)
MenuFillWindowRectWithBlankTile(16, yCoord + 4, 0x1C, 0x12);
- switch(ITEMS_ABOVE_TOP)
- {
- default:
+ if (ITEMS_ABOVE_TOP != 0)
CreateVerticalScrollIndicators(0, 0xB8, 8);
- break;
-weirdCase:
- sub_8072A18(gOtherText_CancelNoTerminator, 0x80, (yCoord + 2) * 8, 0x68, 1);
- goto beforeLabel;
- case 0:
+ else
DestroyVerticalScrollIndicator(0);
- break;
- }
- if(ITEMS_ABOVE_TOP + NUM_PAGE_ITEMS <= NUM_ITEMS)
+ if (ITEMS_ABOVE_TOP + NUM_PAGE_ITEMS <= NUM_ITEMS)
CreateVerticalScrollIndicators(1, 0xB8, 0x98);
else
DestroyVerticalScrollIndicator(1);
@@ -1039,7 +1029,7 @@ static void Mailbox_UpdateMailList(void)
}
}
-void Mailbox_DrawMailList(u8 taskId) // taskId is unused
+static void Mailbox_DrawMailList(u8 taskId) // taskId is unused
{
u16 yCoord = 0;
u16 i;
@@ -1048,16 +1038,16 @@ void Mailbox_DrawMailList(u8 taskId) // taskId is unused
{
yCoord = (i - eMailboxInfo.itemsAbove) * 2;
MenuFillWindowRectWithBlankTile(0x15, yCoord + 2, 0x1C, yCoord + 3);
- if (i != eMailboxInfo.count)
+ if (i == eMailboxInfo.count)
{
- StringCopy(gStringVar1, gSaveBlock1.mail[i + 6].playerName);
- SanitizeNameString(gStringVar1);
- MenuPrint(gStringVar1, 0x15, yCoord + 2);
+ MenuPrint(gOtherText_CancelNoTerminator, 0x15, yCoord + 2);
+ break;
}
else
{
- MenuPrint(gOtherText_CancelNoTerminator, 0x15, yCoord + 2);
- break;
+ StringCopy(gStringVar1, gSaveBlock1.mail[i + 6].playerName);
+ SanitizeNameString(gStringVar1);
+ MenuPrint(gStringVar1, 0x15, yCoord + 2);
}
}