diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-07-31 13:30:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-31 13:30:40 -0400 |
commit | 3e60a7840653e50845abf10bb02cd1b519dcd80f (patch) | |
tree | cb4a0d227a238ebdeb3b6cb9fdb92781bcc4f5e7 /src/player_pc.c | |
parent | 602855ea99d8015ef5b7709f6fb1e9fd167239e2 (diff) | |
parent | d391486247cc9f29d85787d6711f7cb993cf6585 (diff) |
Merge branch 'master' into doc-frontierpass2
Diffstat (limited to 'src/player_pc.c')
-rw-r--r-- | src/player_pc.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/src/player_pc.c b/src/player_pc.c index a06aad60e..f44a111b3 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -112,14 +112,14 @@ static void CopyItemName_PlayerPC(u8 *string, u16 itemId); static void sub_816BC14(void); static void sub_816BFE0(u8 y, u8, u8 speed); static void sub_816BCC4(u8); -static void sub_816C690(u8); +static void UpdateSwapLinePos(u8); static void sub_816C4FC(u8 taskId); static void sub_816C0C8(void); static void sub_816C060(u16 itemId); static void sub_816BEF0(s32 id); static void sub_816B4DC(u8 taskId); static void ItemStorage_MoveCursor(s32 id, bool8 b, struct ListMenu * thisMenu); -static void fish4_goto_x5_or_x6(u8 windowId, s32 id, u8 yOffset); +static void fish4_goto_x5_or_x6(u8 windowId, u32 id, u8 yOffset); // EWRAM static EWRAM_DATA const u8 *gPcItemMenuOptionOrder = NULL; @@ -558,8 +558,8 @@ static void ItemStorage_WithdrawToss_Helper(u8 taskId, bool8 toss) ItemStorage_SetItemAndMailCount(taskId); sub_816BC14(); FreeAndReserveObjectSpritePalettes(); - LoadListMenuArrowsGfx(); - sub_8122344(gUnknown_0203BCC4->spriteIds, 7); + LoadListMenuSwapLineGfx(); + CreateSwapLineSprites(gUnknown_0203BCC4->spriteIds, 7); ClearDialogWindowAndFrame(0,0); gTasks[taskId].func = ItemStorage_ProcessWithdrawTossInput; } @@ -943,7 +943,7 @@ static void ItemStorage_MoveCursor(s32 id, bool8 b, struct ListMenu *thisMenu) if (gUnknown_0203BCC4->unk666 == 0xFF) { sub_816C0C8(); - if (id != -2) + if (id != LIST_CANCEL) sub_816C060(gSaveBlock1Ptr->pcItems[id].itemId); else sub_816C060(ITEMPC_GO_BACK_TO_PREV); @@ -951,9 +951,9 @@ static void ItemStorage_MoveCursor(s32 id, bool8 b, struct ListMenu *thisMenu) } } -static void fish4_goto_x5_or_x6(u8 windowId, s32 id, u8 yOffset) +static void fish4_goto_x5_or_x6(u8 windowId, u32 id, u8 yOffset) { - if (id != -2) + if (id != LIST_CANCEL) { if (gUnknown_0203BCC4->unk666 != 0xFF) { @@ -1024,8 +1024,8 @@ static void sub_816C060(u16 itemId) { *spriteIdLoc = spriteId; gSprites[spriteId].oam.priority = 0; - gSprites[spriteId].pos2.x = 24; - gSprites[spriteId].pos2.y = 80; + gSprites[spriteId].x2 = 24; + gSprites[spriteId].y2 = 80; } } } @@ -1186,7 +1186,7 @@ static void ItemStorage_GoBackToPlayerPCMenu(u8 taskId) sub_816C0C8(); ItemStorage_RemoveScrollIndicator(); DestroyListMenuTask(data[5], NULL, NULL); - sub_81223B0(gUnknown_0203BCC4->spriteIds, 7); + DestroySwapLineSprites(gUnknown_0203BCC4->spriteIds, 7); sub_816BC58(); gTasks[taskId].func = ItemStorage_GoBackToPlayerPCMenu_InitStorage; } @@ -1199,7 +1199,7 @@ static void ItemStorage_ItemSwapChoosePrompt(u8 taskId) ListMenuSetUnkIndicatorsStructField(data[5], 16, 1); gUnknown_0203BCC4->unk666 = (playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos); sub_816BFB8(data[5], 0, 0); - sub_816C690(gUnknown_0203BCC4->unk666); + UpdateSwapLinePos(gUnknown_0203BCC4->unk666); CopyItemName(gSaveBlock1Ptr->pcItems[gUnknown_0203BCC4->unk666].itemId, gStringVar1); ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_SWITCH_WHICH_ITEM)); gTasks[taskId].func = sub_816C4FC; @@ -1219,8 +1219,8 @@ static void sub_816C4FC(u8 taskId) } id = ListMenu_ProcessInput(data[5]); ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); - sub_81223FC(gUnknown_0203BCC4->spriteIds, 7, 0); - sub_816C690(playerPCItemPageInfo.cursorPos); + SetSwapLineSpritesInvisibility(gUnknown_0203BCC4->spriteIds, 7, FALSE); + UpdateSwapLinePos(playerPCItemPageInfo.cursorPos); switch(id) { case LIST_NOTHING_CHOSEN: @@ -1245,7 +1245,6 @@ static void ItemStorage_DoItemSwap(u8 taskId, bool8 a) { s16 *data; u16 b; - u8 c; data = gTasks[taskId].data; b = (playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos); @@ -1253,31 +1252,27 @@ static void ItemStorage_DoItemSwap(u8 taskId, bool8 a) DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); if (!a) { - c = gUnknown_0203BCC4->unk666; - if (c != b) + if (gUnknown_0203BCC4->unk666 != b) { - if (c != b - 1) + if (gUnknown_0203BCC4->unk666 != b - 1) { - MoveItemSlotInList(gSaveBlock1Ptr->pcItems, c, b); + MoveItemSlotInList(gSaveBlock1Ptr->pcItems, gUnknown_0203BCC4->unk666, b); ItemStorage_RefreshListMenu(); } } - else - goto LABEL_SKIP_CURSOR_DECREMENT; } if (gUnknown_0203BCC4->unk666 < b) playerPCItemPageInfo.cursorPos--; - LABEL_SKIP_CURSOR_DECREMENT: - sub_81223FC(gUnknown_0203BCC4->spriteIds, 7, 1); + SetSwapLineSpritesInvisibility(gUnknown_0203BCC4->spriteIds, 7, TRUE); gUnknown_0203BCC4->unk666 = 0xFF; data[5] = ListMenuInit(&gMultiuseListMenuTemplate, playerPCItemPageInfo.itemsAbove, playerPCItemPageInfo.cursorPos); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = ItemStorage_ProcessInput; } -static void sub_816C690(u8 a) +static void UpdateSwapLinePos(u8 y) { - sub_8122448(gUnknown_0203BCC4->spriteIds, 7, 128, ((a+1) * 16)); + UpdateSwapLineSpritesPos(gUnknown_0203BCC4->spriteIds, 7, 128, ((y+1) * 16)); } static void sub_816C6BC(u8 windowId, u16 value, u32 mode, u8 x, u8 y, u8 n) |