Merge branch 'master' into doc-itemmenu2
This commit is contained in:
@@ -862,7 +862,7 @@ static void InitDecorationItemsMenuLimits(void)
|
||||
|
||||
static void InitDecorationItemsMenuScrollAndCursor(void)
|
||||
{
|
||||
sub_812225C(&sDecorationsScrollOffset, &sDecorationsCursorPos, sDecorationItemsMenu->maxShownItems, sDecorationItemsMenu->numMenuItems);
|
||||
SetCursorWithinListBounds(&sDecorationsScrollOffset, &sDecorationsCursorPos, sDecorationItemsMenu->maxShownItems, sDecorationItemsMenu->numMenuItems);
|
||||
}
|
||||
|
||||
static void InitDecorationItemsMenuScrollAndCursor2(void)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1533,14 +1533,12 @@ const u32 gTitleScreenPressStartGfx[] = INCBIN_U32("graphics/title_screen/press_
|
||||
|
||||
const u32 gUnknown_08DE0644[] = INCBIN_U32("graphics/title_screen/title_screen2.bin.lz");
|
||||
|
||||
// more trainer card stuff
|
||||
|
||||
const u16 gUnknown_08DE07C8[][16] = INCBIN_U16("graphics/frontier_pass/tiles.gbapal");// size in LoadPalette calls is reported as 0xD0 << 1, which is 0x1A0, but palette is only 0x100 bytes long so it loads garbage as well
|
||||
const u32 gUnknown_08DE08C8[] = INCBIN_U32("graphics/frontier_pass/tiles.4bpp.lz");
|
||||
const u32 gUnknown_08DE2084[] = INCBIN_U32("graphics/frontier_pass/tiles2.8bpp.lz");
|
||||
const u32 gUnknown_08DE3060[] = INCBIN_U32("graphics/frontier_pass/tiles.bin.lz");
|
||||
const u16 gUnknown_08DE3350[] = INCBIN_U16("graphics/frontier_pass/tilemap1.bin");
|
||||
const u16 gUnknown_08DE3374[] = INCBIN_U16("graphics/frontier_pass/tilemap2.bin");
|
||||
const u16 gFrontierPassBg_Pal[][16] = INCBIN_U16("graphics/frontier_pass/bg.gbapal");// size in LoadPalette calls is reported as 0xD0 << 1, which is 0x1A0, but palette is only 0x100 bytes long so it loads garbage as well
|
||||
const u32 gFrontierPassBg_Gfx[] = INCBIN_U32("graphics/frontier_pass/bg.4bpp.lz");
|
||||
const u32 gFrontierPassMapAndCard_Gfx[] = INCBIN_U32("graphics/frontier_pass/map_and_card.8bpp.lz");
|
||||
const u32 gFrontierPassBg_Tilemap[] = INCBIN_U32("graphics/frontier_pass/bg.bin.lz");
|
||||
const u16 gFrontierPassCancelButton_Tilemap[] = INCBIN_U16("graphics/frontier_pass/cancel.bin");
|
||||
const u16 gFrontierPassCancelButtonHighlighted_Tilemap[] = INCBIN_U16("graphics/frontier_pass/cancel_highlighted.bin");
|
||||
|
||||
// Berry Crush
|
||||
const u16 gBerryCrush_Crusher_Pal[] = INCBIN_U16("graphics/berry_crush/crusher.gbapal");
|
||||
|
||||
@@ -34,11 +34,11 @@ int GetStringWidthDifference(int fontId, const u8 *str, int totalWidth, int lett
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetMaxWidthInMenuTable(const struct MenuAction *str, int arg1)
|
||||
int GetMaxWidthInMenuTable(const struct MenuAction *str, int numActions)
|
||||
{
|
||||
int i, var;
|
||||
|
||||
for (var = 0, i = 0; i < arg1; i++)
|
||||
for (var = 0, i = 0; i < numActions; i++)
|
||||
{
|
||||
int stringWidth = GetStringWidth(1, str[i].text, 0);
|
||||
if (stringWidth > var)
|
||||
|
||||
@@ -590,7 +590,7 @@ void CB2_GoToSellMenu(void)
|
||||
|
||||
void CB2_GoToItemDepositMenu(void)
|
||||
{
|
||||
GoToBagMenu(ITEMMENULOCATION_ITEMPC, POCKETS_COUNT, sub_816B31C);
|
||||
GoToBagMenu(ITEMMENULOCATION_ITEMPC, POCKETS_COUNT, CB2_PlayerPCExitBagMenu);
|
||||
}
|
||||
|
||||
void ApprenticeOpenBagMenu(void)
|
||||
@@ -1138,7 +1138,7 @@ static void UpdatePocketItemLists(void)
|
||||
|
||||
void UpdatePocketListPosition(u8 pocketId)
|
||||
{
|
||||
sub_812225C(&gBagPosition.scrollPosition[pocketId], &gBagPosition.cursorPosition[pocketId], gBagMenu->numShownItems[pocketId], gBagMenu->numItemStacks[pocketId]);
|
||||
SetCursorWithinListBounds(&gBagPosition.scrollPosition[pocketId], &gBagPosition.cursorPosition[pocketId], gBagMenu->numShownItems[pocketId], gBagMenu->numItemStacks[pocketId]);
|
||||
}
|
||||
|
||||
static void InitPocketListPositions(void)
|
||||
|
||||
@@ -325,36 +325,38 @@ bool8 MenuHelpers_CallLinkSomething(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_812220C(struct ItemSlot *slots, u8 count, u8 *arg2, u8 *usedSlotsCount, u8 maxUsedSlotsCount)
|
||||
void SetItemListPerPageCount(struct ItemSlot *slots, u8 slotsCount, u8 *pageItems, u8 *totalItems, u8 maxPerPage)
|
||||
{
|
||||
u16 i;
|
||||
struct ItemSlot *slots_ = slots;
|
||||
|
||||
(*usedSlotsCount) = 0;
|
||||
for (i = 0; i < count; i++)
|
||||
// Count the number of non-empty item slots
|
||||
*totalItems = 0;
|
||||
for (i = 0; i < slotsCount; i++)
|
||||
{
|
||||
if (slots_[i].itemId != ITEM_NONE)
|
||||
(*usedSlotsCount)++;
|
||||
(*totalItems)++;
|
||||
}
|
||||
(*totalItems)++; // + 1 for 'Cancel'
|
||||
|
||||
(*usedSlotsCount)++;
|
||||
if ((*usedSlotsCount) > maxUsedSlotsCount)
|
||||
*arg2 = maxUsedSlotsCount;
|
||||
// Set number of items per page
|
||||
if (*totalItems > maxPerPage)
|
||||
*pageItems = maxPerPage;
|
||||
else
|
||||
*arg2 = (*usedSlotsCount);
|
||||
*pageItems = *totalItems;
|
||||
}
|
||||
|
||||
void sub_812225C(u16 *scrollOffset, u16 *cursorPos, u8 maxShownItems, u8 numItems)
|
||||
void SetCursorWithinListBounds(u16 *scrollOffset, u16 *cursorPos, u8 maxShownItems, u8 totalItems)
|
||||
{
|
||||
if (*scrollOffset != 0 && *scrollOffset + maxShownItems > numItems)
|
||||
*scrollOffset = numItems - maxShownItems;
|
||||
if (*scrollOffset != 0 && *scrollOffset + maxShownItems > totalItems)
|
||||
*scrollOffset = totalItems - maxShownItems;
|
||||
|
||||
if (*scrollOffset + *cursorPos >= numItems)
|
||||
if (*scrollOffset + *cursorPos >= totalItems)
|
||||
{
|
||||
if (numItems == 0)
|
||||
if (totalItems == 0)
|
||||
*cursorPos = 0;
|
||||
else
|
||||
*cursorPos = numItems - 1;
|
||||
*cursorPos = totalItems - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
|
||||
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
|
||||
|
||||
EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0};
|
||||
EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL;
|
||||
EWRAM_DATA static u8 sMailboxWindowIds[MAILBOXWIN_COUNT] = {0};
|
||||
EWRAM_DATA static struct ListMenuItem *sMailboxList = NULL;
|
||||
|
||||
static void sub_81D1E7C(s32 itemIndex, bool8 onInit, struct ListMenu *list);
|
||||
static void MailboxMenu_MoveCursorFunc(s32 itemIndex, bool8 onInit, struct ListMenu *list);
|
||||
static void sub_81D24A4(struct ConditionGraph *a0);
|
||||
static void sub_81D2634(struct ConditionGraph *a0);
|
||||
static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list);
|
||||
@@ -40,33 +40,33 @@ static void SetNextConditionSparkle(struct Sprite *sprite);
|
||||
static void SpriteCB_ConditionSparkle(struct Sprite *sprite);
|
||||
static void ShowAllConditionSparkles(struct Sprite *sprite);
|
||||
|
||||
static const struct WindowTemplate sUnknown_086253E8[] =
|
||||
static const struct WindowTemplate sWindowTemplates_MailboxMenu[MAILBOXWIN_COUNT] =
|
||||
{
|
||||
{
|
||||
[MAILBOXWIN_TITLE] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 1,
|
||||
.width = 8,
|
||||
.height = 2,
|
||||
.paletteNum = 0xF,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 0x8
|
||||
},
|
||||
{
|
||||
[MAILBOXWIN_LIST] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 21,
|
||||
.tilemapTop = 1,
|
||||
.width = 8,
|
||||
.height = 18,
|
||||
.paletteNum = 0xF,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 0x18
|
||||
},
|
||||
{
|
||||
[MAILBOXWIN_OPTIONS] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 1,
|
||||
.width = 11,
|
||||
.height = 8,
|
||||
.paletteNum = 0xF,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 0x18
|
||||
}
|
||||
};
|
||||
@@ -207,53 +207,55 @@ static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate =
|
||||
.cursorKind = 0
|
||||
};
|
||||
|
||||
bool8 sub_81D1C44(u8 count)
|
||||
bool8 MailboxMenu_Alloc(u8 count)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
sUnknown_0203CF4C = Alloc(count * sizeof(*sUnknown_0203CF4C) + sizeof(*sUnknown_0203CF4C));
|
||||
if (sUnknown_0203CF4C == NULL)
|
||||
// + 1 to count for 'Cancel'
|
||||
sMailboxList = Alloc((count + 1) * sizeof(*sMailboxList));
|
||||
if (sMailboxList == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sUnknown_0203CF48); i++)
|
||||
sUnknown_0203CF48[i] = WINDOW_NONE;
|
||||
for (i = 0; i < ARRAY_COUNT(sMailboxWindowIds); i++)
|
||||
sMailboxWindowIds[i] = WINDOW_NONE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u8 sub_81D1C84(u8 a0)
|
||||
u8 MailboxMenu_AddWindow(u8 windowIdx)
|
||||
{
|
||||
if (sUnknown_0203CF48[a0] == WINDOW_NONE)
|
||||
if (sMailboxWindowIds[windowIdx] == WINDOW_NONE)
|
||||
{
|
||||
if (a0 == 2)
|
||||
if (windowIdx == MAILBOXWIN_OPTIONS)
|
||||
{
|
||||
struct WindowTemplate template = sUnknown_086253E8[2];
|
||||
struct WindowTemplate template = sWindowTemplates_MailboxMenu[windowIdx];
|
||||
template.width = GetMaxWidthInMenuTable(&gMailboxMailOptions[0], 4);
|
||||
sUnknown_0203CF48[2] = AddWindow(&template);
|
||||
sMailboxWindowIds[windowIdx] = AddWindow(&template);
|
||||
}
|
||||
else
|
||||
else // MAILBOXWIN_TITLE or MAILBOXWIN_LIST
|
||||
{
|
||||
sUnknown_0203CF48[a0] = AddWindow(&sUnknown_086253E8[a0]);
|
||||
sMailboxWindowIds[windowIdx] = AddWindow(&sWindowTemplates_MailboxMenu[windowIdx]);
|
||||
}
|
||||
SetStandardWindowBorderStyle(sUnknown_0203CF48[a0], 0);
|
||||
SetStandardWindowBorderStyle(sMailboxWindowIds[windowIdx], 0);
|
||||
}
|
||||
return sUnknown_0203CF48[a0];
|
||||
return sMailboxWindowIds[windowIdx];
|
||||
}
|
||||
|
||||
void sub_81D1D04(u8 a0)
|
||||
void MailboxMenu_RemoveWindow(u8 windowIdx)
|
||||
{
|
||||
ClearStdWindowAndFrameToTransparent(sUnknown_0203CF48[a0], 0);
|
||||
ClearWindowTilemap(sUnknown_0203CF48[a0]);
|
||||
RemoveWindow(sUnknown_0203CF48[a0]);
|
||||
sUnknown_0203CF48[a0] = WINDOW_NONE;
|
||||
ClearStdWindowAndFrameToTransparent(sMailboxWindowIds[windowIdx], 0);
|
||||
ClearWindowTilemap(sMailboxWindowIds[windowIdx]);
|
||||
RemoveWindow(sMailboxWindowIds[windowIdx]);
|
||||
sMailboxWindowIds[windowIdx] = WINDOW_NONE;
|
||||
}
|
||||
|
||||
static u8 sub_81D1D34(u8 a0)
|
||||
// Unused
|
||||
static u8 MailboxMenu_GetWindowId(u8 windowIdx)
|
||||
{
|
||||
return sUnknown_0203CF48[a0];
|
||||
return sMailboxWindowIds[windowIdx];
|
||||
}
|
||||
|
||||
static void sub_81D1D44(u8 windowId, u32 itemId, u8 y)
|
||||
static void MailboxMenu_ItemPrintFunc(u8 windowId, u32 itemId, u8 y)
|
||||
{
|
||||
u8 buffer[30];
|
||||
u16 length;
|
||||
@@ -269,21 +271,21 @@ static void sub_81D1D44(u8 windowId, u32 itemId, u8 y)
|
||||
AddTextPrinterParameterized4(windowId, 1, 8, y, 0, 0, sPlayerNameTextColors, -1, buffer);
|
||||
}
|
||||
|
||||
u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page)
|
||||
u8 MailboxMenu_CreateList(struct PlayerPCItemPageStruct *page)
|
||||
{
|
||||
u16 i;
|
||||
for (i = 0; i < page->count; i++)
|
||||
{
|
||||
sUnknown_0203CF4C[i].name = sEmptyItemName;
|
||||
sUnknown_0203CF4C[i].id = i;
|
||||
sMailboxList[i].name = sEmptyItemName;
|
||||
sMailboxList[i].id = i;
|
||||
}
|
||||
|
||||
sUnknown_0203CF4C[i].name = gText_Cancel2;
|
||||
sUnknown_0203CF4C[i].id = LIST_CANCEL;
|
||||
sMailboxList[i].name = gText_Cancel2;
|
||||
sMailboxList[i].id = LIST_CANCEL;
|
||||
|
||||
gMultiuseListMenuTemplate.items = sUnknown_0203CF4C;
|
||||
gMultiuseListMenuTemplate.items = sMailboxList;
|
||||
gMultiuseListMenuTemplate.totalItems = page->count + 1;
|
||||
gMultiuseListMenuTemplate.windowId = sUnknown_0203CF48[1];
|
||||
gMultiuseListMenuTemplate.windowId = sMailboxWindowIds[MAILBOXWIN_LIST];
|
||||
gMultiuseListMenuTemplate.header_X = 0;
|
||||
gMultiuseListMenuTemplate.item_X = 8;
|
||||
gMultiuseListMenuTemplate.cursor_X = 0;
|
||||
@@ -292,8 +294,8 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page)
|
||||
gMultiuseListMenuTemplate.cursorPal = 2;
|
||||
gMultiuseListMenuTemplate.fillValue = 1;
|
||||
gMultiuseListMenuTemplate.cursorShadowPal = 3;
|
||||
gMultiuseListMenuTemplate.moveCursorFunc = sub_81D1E7C;
|
||||
gMultiuseListMenuTemplate.itemPrintFunc = sub_81D1D44;
|
||||
gMultiuseListMenuTemplate.moveCursorFunc = MailboxMenu_MoveCursorFunc;
|
||||
gMultiuseListMenuTemplate.itemPrintFunc = MailboxMenu_ItemPrintFunc;
|
||||
gMultiuseListMenuTemplate.fontId = 1;
|
||||
gMultiuseListMenuTemplate.cursorKind = 0;
|
||||
gMultiuseListMenuTemplate.lettersSpacing = 0;
|
||||
@@ -302,20 +304,20 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page)
|
||||
return ListMenuInit(&gMultiuseListMenuTemplate, page->itemsAbove, page->cursorPos);
|
||||
}
|
||||
|
||||
static void sub_81D1E7C(s32 itemIndex, bool8 onInit, struct ListMenu *list)
|
||||
static void MailboxMenu_MoveCursorFunc(s32 itemIndex, bool8 onInit, struct ListMenu *list)
|
||||
{
|
||||
if (onInit != TRUE)
|
||||
PlaySE(SE_SELECT);
|
||||
}
|
||||
|
||||
void sub_81D1E90(struct PlayerPCItemPageStruct *page)
|
||||
void MailboxMenu_AddScrollArrows(struct PlayerPCItemPageStruct *page)
|
||||
{
|
||||
page->scrollIndicatorTaskId = AddScrollIndicatorArrowPairParameterized(2, 0xC8, 12, 0x94, page->count - page->pageItems + 1, 0x6E, 0x6E, &page->itemsAbove);
|
||||
}
|
||||
|
||||
void sub_81D1EC0(void)
|
||||
void MailboxMenu_Free(void)
|
||||
{
|
||||
Free(sUnknown_0203CF4C);
|
||||
Free(sMailboxList);
|
||||
}
|
||||
|
||||
void InitConditionGraphData(struct ConditionGraph *graph)
|
||||
|
||||
@@ -5471,7 +5471,7 @@ static void TryGiveMailToSelectedMon(u8 taskId)
|
||||
struct MailStruct *mail;
|
||||
|
||||
gPartyMenuUseExitCallback = FALSE;
|
||||
mail = &gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos];
|
||||
mail = &gSaveBlock1Ptr->mail[gPlayerPCItemPageInfo.itemsAbove + PARTY_SIZE + gPlayerPCItemPageInfo.cursorPos];
|
||||
if (GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE)
|
||||
{
|
||||
DisplayPartyMenuMessage(gText_PkmnHoldingItemCantHoldMail, TRUE);
|
||||
|
||||
1177
src/player_pc.c
1177
src/player_pc.c
File diff suppressed because it is too large
Load Diff
@@ -48,6 +48,12 @@
|
||||
|
||||
#define FLYDESTICON_RED_OUTLINE 6
|
||||
|
||||
enum {
|
||||
TAG_CURSOR,
|
||||
TAG_PLAYER_ICON,
|
||||
TAG_FLY_ICON,
|
||||
};
|
||||
|
||||
// Static type declarations
|
||||
|
||||
struct MultiNameFlyDest
|
||||
@@ -237,13 +243,13 @@ static const union AnimCmd *const sRegionMapCursorAnimTable[] =
|
||||
static const struct SpritePalette sRegionMapCursorSpritePalette =
|
||||
{
|
||||
.data = sRegionMapCursorPal,
|
||||
.tag = 0
|
||||
.tag = TAG_CURSOR
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sRegionMapCursorSpriteTemplate =
|
||||
{
|
||||
.tileTag = 0,
|
||||
.paletteTag = 0,
|
||||
.tileTag = TAG_CURSOR,
|
||||
.paletteTag = TAG_CURSOR,
|
||||
.oam = &sRegionMapCursorOam,
|
||||
.anims = sRegionMapCursorAnimTable,
|
||||
.images = NULL,
|
||||
@@ -419,7 +425,7 @@ static const struct WindowTemplate sFlyMapWindowTemplates[] =
|
||||
static const struct SpritePalette sFlyTargetIconsSpritePalette =
|
||||
{
|
||||
.data = sFlyTargetIcons_Pal,
|
||||
.tag = 2
|
||||
.tag = TAG_FLY_ICON
|
||||
};
|
||||
|
||||
static const u16 sRedOutlineFlyDestinations[][2] =
|
||||
@@ -497,8 +503,8 @@ static const union AnimCmd *const sFlyDestIcon_Anims[] =
|
||||
|
||||
static const struct SpriteTemplate sFlyDestIconSpriteTemplate =
|
||||
{
|
||||
.tileTag = 2,
|
||||
.paletteTag = 2,
|
||||
.tileTag = TAG_FLY_ICON,
|
||||
.paletteTag = TAG_FLY_ICON,
|
||||
.oam = &sFlyDestIcon_OamData,
|
||||
.anims = sFlyDestIcon_Anims,
|
||||
.images = NULL,
|
||||
@@ -1692,8 +1698,8 @@ void CB2_OpenFlyMap(void)
|
||||
break;
|
||||
case 4:
|
||||
InitRegionMap(&sFlyMap->regionMap, FALSE);
|
||||
CreateRegionMapCursor(0, 0);
|
||||
CreateRegionMapPlayerIcon(1, 1);
|
||||
CreateRegionMapCursor(TAG_CURSOR, TAG_CURSOR);
|
||||
CreateRegionMapPlayerIcon(TAG_PLAYER_ICON, TAG_PLAYER_ICON);
|
||||
sFlyMap->mapSecId = sFlyMap->regionMap.mapSecId;
|
||||
StringFill(sFlyMap->nameBuffer, CHAR_SPACE, MAP_NAME_LENGTH);
|
||||
sDrawFlyDestTextWindow = TRUE;
|
||||
@@ -1827,7 +1833,7 @@ static void LoadFlyDestIcons(void)
|
||||
LZ77UnCompWram(sFlyTargetIcons_Gfx, sFlyMap->tileBuffer);
|
||||
sheet.data = sFlyMap->tileBuffer;
|
||||
sheet.size = sizeof(sFlyMap->tileBuffer);
|
||||
sheet.tag = 2;
|
||||
sheet.tag = TAG_FLY_ICON;
|
||||
LoadSpriteSheet(&sheet);
|
||||
LoadSpritePalette(&sFlyTargetIconsSpritePalette);
|
||||
CreateFlyDestIcons();
|
||||
|
||||
@@ -1074,7 +1074,7 @@ void DeleteRegistry_Yes_Callback(u8 taskId)
|
||||
DestroyListMenuTask(tListTaskId, &tScrollOffset, &tSelectedRow);
|
||||
gSaveBlock1Ptr->secretBases[tSelectedBaseId].registryStatus = UNREGISTERED;
|
||||
BuildRegistryMenuItems(taskId);
|
||||
sub_812225C(&tScrollOffset, &tSelectedRow, tMaxShownItems, tNumBases);
|
||||
SetCursorWithinListBounds(&tScrollOffset, &tSelectedRow, tMaxShownItems, tNumBases);
|
||||
FinalizeRegistryMenu(taskId);
|
||||
gTasks[taskId].func = HandleRegistryMenuInput;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user