Document pokeblock menu

This commit is contained in:
GriffinR 2021-04-11 16:23:10 -04:00
parent 09a9efd5c5
commit c786a9b20c
11 changed files with 351 additions and 324 deletions

View file

@ -14,9 +14,9 @@ void ShakeBagSprite(void);
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection);
void AddBagItemIconSprite(u16 itemId, u8 id);
void RemoveBagItemIconSprite(u8 id);
void sub_80D4FAC(void);
void sub_80D4FC8(u8 arg0);
void sub_80D4FEC(u8 arg0);
void CreateItemMenuSwapLine(void);
void SetItemMenuSwapLineInvisibility(bool8 invisible);
void UpdateItemMenuSwapLinePos(u8 y);
u8 CreateBerryTagSprite(u8 id, s16 x, s16 y);
void FreeBerryTagSpritePalette(void);
u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine);

View file

@ -35,10 +35,10 @@ bool8 MenuHelpers_CallLinkSomething(void);
void sub_812220C(struct ItemSlot *slots, u8 count, u8 *arg2, u8 *usedSlotsCount, u8 maxUsedSlotsCount);
void sub_812225C(u16 *scrollOffset, u16 *cursorPos, u8 maxShownItems, u8 numItems);
void sub_8122298(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3, u8 arg4);
void LoadListMenuArrowsGfx(void);
void sub_8122344(u8 *spriteIds, u8 count);
void sub_81223B0(u8 *spriteIds, u8 count);
void sub_81223FC(u8 *spriteIds, u8 count, bool8 invisible);
void sub_8122448(u8 *spriteIds, u8 count, s16 x, u16 y);
void LoadListMenuSwapLineGfx(void);
void CreateSwapLineSprites(u8 *spriteIds, u8 count);
void DestroySwapLineSprites(u8 *spriteIds, u8 count);
void SetSwapLineSpritesInvisibility(u8 *spriteIds, u8 count, bool8 invisible);
void UpdateSwapLineSpritesPos(u8 *spriteIds, u8 count, s16 x, u16 y);
#endif //GUARD_MENU_HELPERS_H

View file

@ -4,8 +4,7 @@
#include "constants/berry.h"
#include "constants/pokemon.h"
#define GFX_TAG_POKEBLOCK 14818
#define GFX_TAG_POKEBLOCK_CASE 14800
#define TAG_POKEBLOCK 14818
enum
{

View file

@ -63,7 +63,7 @@ static void sub_81C56F8(void);
static void sub_81C5A20(void);
static void sub_81C6BD8(void);
static void sub_81C6EF4(void);
static void sub_81C700C(void);
static void CreateSwapLine(void);
static void sub_81C6E98(void);
static void sub_81C6F20(void);
static void sub_81C6404(void);
@ -84,8 +84,8 @@ static void sub_81C5F08(u8 windowId, u8 horizontalCount, u8 verticalCount);
static bool8 IsValidMenuAction(s8 arg0);
static void sub_81C6DAC(u8 taskId, const struct YesNoFuncTable *yesNoTable);
static void sub_81C6CEC(u8 windowId);
static void sub_81C704C(u8 y);
static void sub_81C7028(bool8 invisible);
static void UpdateSwapLinePos(u8 y);
static void SetSwapLineInvisibility(bool8 invisible);
static void sub_81C6F68(struct Sprite *sprite);
static void BagAction_UseOnField(u8 taskId);
static void BagAction_Toss(u8 taskId);
@ -489,7 +489,7 @@ static bool8 sub_81C5078(void)
gMain.state++;
break;
case 14:
sub_81C700C();
CreateSwapLine();
gMain.state++;
break;
case 15:
@ -555,7 +555,7 @@ static bool8 sub_81C5238(void)
gPyramidBagResources->state++;
break;
default:
LoadListMenuArrowsGfx();
LoadListMenuSwapLineGfx();
gPyramidBagResources->state = 0;
return TRUE;
}
@ -1268,7 +1268,7 @@ static void Task_BeginItemSwap(u8 taskId)
FillWindowPixelBuffer(1, PIXEL_FILL(0));
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
sub_81C5A98(data[0], 1);
sub_81C704C(data[1]);
UpdateSwapLinePos(data[1]);
gTasks[taskId].func = Task_ItemSwapHandleInput;
}
@ -1287,8 +1287,8 @@ static void Task_ItemSwapHandleInput(u8 taskId)
{
s32 id = ListMenu_ProcessInput(data[0]);
ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition);
sub_81C7028(FALSE);
sub_81C704C(gPyramidBagCursorData.cursorPosition);
SetSwapLineInvisibility(FALSE);
UpdateSwapLinePos(gPyramidBagCursorData.cursorPosition);
switch (id)
{
case LIST_NOTHING_CHOSEN:
@ -1324,7 +1324,7 @@ static void PerformItemSwap(u8 taskId)
{
MovePyramidBagItemSlotInList(data[1], var);
gPyramidBagResources->unk814 = 0xFF;
sub_81C7028(TRUE);
SetSwapLineInvisibility(TRUE);
DestroyListMenuTask(data[0], scrollOffset, selectedRow);
if (data[1] < var)
gPyramidBagCursorData.cursorPosition--;
@ -1341,7 +1341,7 @@ static void sub_81C6A14(u8 taskId)
u16 *selectedRow = &gPyramidBagCursorData.cursorPosition;
gPyramidBagResources->unk814 = 0xFF;
sub_81C7028(TRUE);
SetSwapLineInvisibility(TRUE);
DestroyListMenuTask(data[0], scrollOffset, selectedRow);
if (data[1] < *scrollOffset + *selectedRow)
gPyramidBagCursorData.cursorPosition--;
@ -1545,17 +1545,17 @@ static void sub_81C6FF8(u8 itemSpriteArrayId)
sub_81C6E38(itemSpriteArrayId + 1);
}
static void sub_81C700C(void)
static void CreateSwapLine(void)
{
sub_8122344(&gPyramidBagResources->itemsSpriteIds[3], 8);
CreateSwapLineSprites(&gPyramidBagResources->itemsSpriteIds[3], 8);
}
static void sub_81C7028(bool8 invisible)
static void SetSwapLineInvisibility(bool8 invisible)
{
sub_81223FC(&gPyramidBagResources->itemsSpriteIds[3], 8, invisible);
SetSwapLineSpritesInvisibility(&gPyramidBagResources->itemsSpriteIds[3], 8, invisible);
}
static void sub_81C704C(u8 y)
static void UpdateSwapLinePos(u8 y)
{
sub_8122448(&gPyramidBagResources->itemsSpriteIds[3], 8 | 0x80, 120, (y + 1) * 16);
UpdateSwapLineSpritesPos(&gPyramidBagResources->itemsSpriteIds[3], 8 | 0x80, 120, (y + 1) * 16);
}

View file

@ -707,7 +707,7 @@ bool8 SetupBagMenu(void)
gMain.state++;
break;
case 16:
sub_80D4FAC();
CreateItemMenuSwapLine();
gMain.state++;
break;
case 17:
@ -787,7 +787,7 @@ bool8 LoadBagMenu_Graphics(void)
gBagMenu->graphicsLoadState++;
break;
default:
LoadListMenuArrowsGfx();
LoadListMenuSwapLineGfx();
gBagMenu->graphicsLoadState = 0;
return TRUE;
}
@ -1373,7 +1373,7 @@ void BagMenu_SwapItems(u8 taskId)
StringExpandPlaceholders(gStringVar4, gText_MoveVar1Where);
FillWindowPixelBuffer(1, PIXEL_FILL(0));
BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
sub_80D4FEC(data[1]);
UpdateItemMenuSwapLinePos(data[1]);
BagDestroyPocketSwitchArrowPair();
BagMenu_PrintCursor_(data[0], 2);
gTasks[taskId].func = Task_HandleSwappingItemsInput;
@ -1396,8 +1396,8 @@ static void Task_HandleSwappingItemsInput(u8 taskId)
{
input = ListMenu_ProcessInput(data[0]);
ListMenuGetScrollAndRow(data[0], &gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket], &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]);
sub_80D4FC8(0);
sub_80D4FEC(gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]);
SetItemMenuSwapLineInvisibility(FALSE);
UpdateItemMenuSwapLinePos(gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]);
switch (input)
{
case LIST_NOTHING_CHOSEN:
@ -1435,7 +1435,7 @@ void sub_81AC498(u8 taskId)
gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]--;
LoadBagItemListBuffers(gBagPositionStruct.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
sub_80D4FC8(1);
SetItemMenuSwapLineInvisibility(TRUE);
CreatePocketSwitchArrowPair();
gTasks[taskId].func = Task_BagMenu_HandleInput;
}
@ -1453,7 +1453,7 @@ void sub_81AC590(u8 taskId)
gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]--;
LoadBagItemListBuffers(gBagPositionStruct.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
sub_80D4FC8(1);
SetItemMenuSwapLineInvisibility(TRUE);
CreatePocketSwitchArrowPair();
gTasks[taskId].func = Task_BagMenu_HandleInput;
}

View file

@ -537,19 +537,19 @@ void RemoveBagItemIconSprite(u8 id)
RemoveBagSprite(id + 2);
}
void sub_80D4FAC(void)
void CreateItemMenuSwapLine(void)
{
sub_8122344(&gBagMenu->spriteId[4], 8);
CreateSwapLineSprites(&gBagMenu->spriteId[4], 8);
}
void sub_80D4FC8(u8 arg0)
void SetItemMenuSwapLineInvisibility(bool8 invisible)
{
sub_81223FC(&gBagMenu->spriteId[4], 8, arg0);
SetSwapLineSpritesInvisibility(&gBagMenu->spriteId[4], 8, invisible);
}
void sub_80D4FEC(u8 arg0)
void UpdateItemMenuSwapLinePos(u8 y)
{
sub_8122448(&gBagMenu->spriteId[4], 136, 120, (arg0 + 1) * 16);
UpdateSwapLineSpritesPos(&gBagMenu->spriteId[4], 136, 120, (y + 1) * 16);
}
static void sub_80D5018(void *mem0, void *mem1)

View file

@ -805,7 +805,7 @@ void Script_BufferContestLadyCategoryAndMonName(void)
void OpenPokeblockCaseForContestLady(void)
{
OpenPokeblockCase(3, CB2_ReturnToField);
OpenPokeblockCase(PBLOCK_CASE_GIVE, CB2_ReturnToField);
}
void SetContestLadyGivenPokeblock(void)

View file

@ -18,19 +18,17 @@
#include "constants/items.h"
#include "constants/maps.h"
// this file's functions
#define TAG_SWAP_LINE 109
static void Task_ContinueTaskAfterMessagePrints(u8 taskId);
static void Task_CallYesOrNoCallback(u8 taskId);
// EWRAM vars
EWRAM_DATA static struct YesNoFuncTable gUnknown_0203A138 = {0};
EWRAM_DATA static u8 gUnknown_0203A140 = 0;
// IWRAM bss vars
static TaskFunc gUnknown_0300117C;
// const rom data
static const struct OamData sOamData_859F4E8 =
static const struct OamData sOamData_SwapLine =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -47,47 +45,47 @@ static const struct OamData sOamData_859F4E8 =
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_859F4F0[] =
static const union AnimCmd sAnim_SwapLine_RightArrow[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_859F4F8[] =
static const union AnimCmd sAnim_SwapLine_Line[] =
{
ANIMCMD_FRAME(4, 0),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_859F500[] =
static const union AnimCmd sAnim_SwapLine_LeftArrow[] =
{
ANIMCMD_FRAME(0, 0, 1, 0),
ANIMCMD_FRAME(0, 0, .hFlip = TRUE),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_859F508[] =
static const union AnimCmd *const sAnims_SwapLine[] =
{
sSpriteAnim_859F4F0,
sSpriteAnim_859F4F8,
sSpriteAnim_859F500
sAnim_SwapLine_RightArrow,
sAnim_SwapLine_Line,
sAnim_SwapLine_LeftArrow
};
static const struct CompressedSpriteSheet gUnknown_0859F514 =
static const struct CompressedSpriteSheet sSpriteSheet_SwapLine =
{
gBagSwapLineGfx, 0x100, 109
gBagSwapLineGfx, 0x100, TAG_SWAP_LINE
};
static const struct CompressedSpritePalette gUnknown_0859F51C =
static const struct CompressedSpritePalette sSpritePalette_SwapLine =
{
gBagSwapLinePal, 109
gBagSwapLinePal, TAG_SWAP_LINE
};
static const struct SpriteTemplate gUnknown_0859F524 =
static const struct SpriteTemplate sSpriteTemplate_SwapLine =
{
.tileTag = 109,
.paletteTag = 109,
.oam = &sOamData_859F4E8,
.anims = sSpriteAnimTable_859F508,
.tileTag = TAG_SWAP_LINE,
.paletteTag = TAG_SWAP_LINE,
.oam = &sOamData_SwapLine,
.anims = sAnims_SwapLine,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
@ -390,19 +388,19 @@ void sub_8122298(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3, u8 arg4)
}
}
void LoadListMenuArrowsGfx(void)
void LoadListMenuSwapLineGfx(void)
{
LoadCompressedSpriteSheet(&gUnknown_0859F514);
LoadCompressedSpritePalette(&gUnknown_0859F51C);
LoadCompressedSpriteSheet(&sSpriteSheet_SwapLine);
LoadCompressedSpritePalette(&sSpritePalette_SwapLine);
}
void sub_8122344(u8 *spriteIds, u8 count)
void CreateSwapLineSprites(u8 *spriteIds, u8 count)
{
u8 i;
for (i = 0; i < count; i++)
{
spriteIds[i] = CreateSprite(&gUnknown_0859F524, i * 16, 0, 0);
spriteIds[i] = CreateSprite(&sSpriteTemplate_SwapLine, i * 16, 0, 0);
if (i != 0)
StartSpriteAnim(&gSprites[spriteIds[i]], 1);
@ -410,7 +408,7 @@ void sub_8122344(u8 *spriteIds, u8 count)
}
}
void sub_81223B0(u8 *spriteIds, u8 count)
void DestroySwapLineSprites(u8 *spriteIds, u8 count)
{
u8 i;
@ -423,17 +421,15 @@ void sub_81223B0(u8 *spriteIds, u8 count)
}
}
void sub_81223FC(u8 *spriteIds, u8 count, bool8 invisible)
void SetSwapLineSpritesInvisibility(u8 *spriteIds, u8 count, bool8 invisible)
{
u8 i;
for (i = 0; i < count; i++)
{
gSprites[spriteIds[i]].invisible = invisible;
}
}
void sub_8122448(u8 *spriteIds, u8 count, s16 x, u16 y)
void UpdateSwapLineSpritesPos(u8 *spriteIds, u8 count, s16 x, u16 y)
{
u8 i;
bool8 unknownBit = count & 0x80;

View file

@ -112,7 +112,7 @@ 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);
@ -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;
}
@ -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:
@ -1268,16 +1268,16 @@ static void ItemStorage_DoItemSwap(u8 taskId, bool8 a)
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)

File diff suppressed because it is too large Load diff

View file

@ -498,13 +498,13 @@ static const union AffineAnimCmd *const sThrownPokeblockAffineAnimTable[] =
static const struct CompressedSpriteSheet sPokeblock_SpriteSheet =
{
gPokeblock_Gfx, 0x20, GFX_TAG_POKEBLOCK
gPokeblock_Gfx, 0x20, TAG_POKEBLOCK
};
static const struct SpriteTemplate sThrownPokeblockSpriteTemplate =
{
.tileTag = GFX_TAG_POKEBLOCK,
.paletteTag = GFX_TAG_POKEBLOCK,
.tileTag = TAG_POKEBLOCK,
.paletteTag = TAG_POKEBLOCK,
.oam = &sThrownPokeblockOamData,
.anims = sThrownPokeblockAnimTable,
.images = NULL,
@ -711,7 +711,7 @@ static void SetPokeblockSpritePal(u8 pokeblockCaseId)
{
u8 colorId = GetPokeblockData(&gSaveBlock1Ptr->pokeblocks[pokeblockCaseId], PBLOCK_COLOR);
sPokeblockSpritePal.data = sPokeblocksPals[colorId - 1];
sPokeblockSpritePal.tag = GFX_TAG_POKEBLOCK;
sPokeblockSpritePal.tag = TAG_POKEBLOCK;
}
// defines for task data fields