Merge branch 'master' into doc-itemmenu2

This commit is contained in:
GriffinR 2021-08-11 19:01:47 -04:00 committed by GitHub
commit 80348e7188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 1124 additions and 1024 deletions

View File

@ -19,6 +19,7 @@ jobs:
uses: actions/checkout@master
- name: Checkout syms
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@master
with:
path: symbols
@ -52,7 +53,7 @@ jobs:
run: make -j${nproc} all
- name: Webhook
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
env:
CALCROM_DISCORD_WEBHOOK_USERNAME: OK
CALCROM_DISCORD_WEBHOOK_AVATAR_URL: https://i.imgur.com/38BQHdd.png
@ -63,7 +64,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
run: |
cp -v *.sym symbols/
export GITHUB_COMMIT_MSG="$( git log --format=%s ${GITHUB_SHA} )"
echo "SYMBOLS_COMMIT_MSG=$( git log --format=%s ${GITHUB_SHA} )" >> $GITHUB_ENV
- name: Update symfiles
if: ${{ github.event_name == 'push' }}
@ -72,4 +73,4 @@ jobs:
branch: symbols
cwd: "./symbols"
add: "*.sym"
message: $GITHUB_COMMIT_MSG
message: ${{ env.SYMBOLS_COMMIT_MSG }}

View File

@ -11,6 +11,7 @@ LilycoveCity_DepartmentStore_3F_EventScript_ClerkLeft::
release
end
.align 2
LilycoveCity_DepartmentStore_3F_Pokemart_Vitamins:
.2byte ITEM_PROTEIN
.2byte ITEM_CALCIUM

View File

@ -194,7 +194,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "0x0",
"flag": "FLAG_HIDE_LITTLE_ROOT_TOWN_PLAYERS_BEDROOM_MOM"
"flag": "FLAG_HIDE_LITTLEROOT_TOWN_PLAYERS_BEDROOM_MOM"
},
{
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",

View File

@ -194,7 +194,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "0x0",
"flag": "FLAG_HIDE_LITTLE_ROOT_TOWN_PLAYERS_BEDROOM_MOM"
"flag": "FLAG_HIDE_LITTLEROOT_TOWN_PLAYERS_BEDROOM_MOM"
},
{
"graphics_id": "OBJ_EVENT_GFX_PICHU_DOLL",

View File

@ -12,6 +12,7 @@ OldaleTown_Mart_EventScript_Clerk::
release
end
.align 2
OldaleTown_Mart_Pokemart_Basic:
.2byte ITEM_POTION
.2byte ITEM_ANTIDOTE

View File

@ -16,6 +16,7 @@ RustboroCity_Mart_EventScript_PokemartBasic::
release
end
.align 2
RustboroCity_Mart_Pokemart_Basic:
.2byte ITEM_POKE_BALL
.2byte ITEM_POTION

View File

@ -147,6 +147,7 @@ SlateportCity_EventScript_EnergyGuru::
release
end
.align 2
SlateportCity_Pokemart_EnergyGuru:
.2byte ITEM_PROTEIN
.2byte ITEM_IRON
@ -543,6 +544,7 @@ SlateportCity_EventScript_DecorClerk::
release
end
.align 2
SlateportCity_PokemartDecor:
.2byte DECOR_RED_BRICK
.2byte DECOR_BLUE_BRICK

View File

@ -11,6 +11,7 @@ SlateportCity_Mart_EventScript_Clerk::
release
end
.align 2
SlateportCity_Mart_Pokemart:
.2byte ITEM_POKE_BALL
.2byte ITEM_GREAT_BALL

View File

@ -11,6 +11,7 @@ SootopolisCity_Mart_EventScript_Clerk::
release
end
.align 2
SootopolisCity_Mart_Pokemart:
.2byte ITEM_ULTRA_BALL
.2byte ITEM_HYPER_POTION

View File

@ -209,7 +209,7 @@ EventScript_ResetAllMapFlags::
setflag FLAG_HIDE_SLATEPORT_MUSEUM_POPULATION
setflag FLAG_HIDE_BATTLE_TOWER_OPPONENT
setflag FLAG_HIDE_LITTLEROOT_TOWN_MOM_OUTSIDE
setflag FLAG_HIDE_LITTLE_ROOT_TOWN_PLAYERS_BEDROOM_MOM
setflag FLAG_HIDE_LITTLEROOT_TOWN_PLAYERS_BEDROOM_MOM
setflag FLAG_HIDE_LITTLEROOT_TOWN_RIVAL
setflag FLAG_HIDE_LITTLEROOT_TOWN_BIRCH
setflag FLAG_HIDE_WEATHER_INSTITUTE_1F_WORKERS

View File

@ -12,6 +12,8 @@
ptr = NULL; \
}
#define TRY_FREE_AND_SET_NULL(ptr) if (ptr != NULL) FREE_AND_SET_NULL(ptr)
extern u8 gHeap[];
void *Alloc(u32 size);

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -799,7 +799,7 @@
#define FLAG_HIDE_LITTLEROOT_TOWN_PLAYERS_HOUSE_VIGOROTH_1 0x2F2
#define FLAG_HIDE_LITTLEROOT_TOWN_PLAYERS_HOUSE_VIGOROTH_2 0x2F3
#define FLAG_HIDE_MOSSDEEP_CITY_SPACE_CENTER_1F_TEAM_MAGMA 0x2F4
#define FLAG_HIDE_LITTLE_ROOT_TOWN_PLAYERS_BEDROOM_MOM 0x2F5
#define FLAG_HIDE_LITTLEROOT_TOWN_PLAYERS_BEDROOM_MOM 0x2F5
#define FLAG_HIDE_LITTLEROOT_TOWN_BRENDANS_HOUSE_MOM 0x2F6
#define FLAG_HIDE_LITTLEROOT_TOWN_MAYS_HOUSE_MOM 0x2F7
#define FLAG_HIDE_LITTLEROOT_TOWN_BRENDANS_HOUSE_RIVAL_BEDROOM 0x2F8

View File

@ -4955,13 +4955,13 @@ extern const u32 gKantoTrainerCardFrontLink_Tilemap[];
extern const u32 gHoennTrainerCardBg_Tilemap[];
// Frontier Pass
extern const u32 gUnknown_08DE08C8[];
extern const u32 gUnknown_08DE2084[];
extern const u32 gUnknown_08DE3350[];
extern const u32 gUnknown_08DE3374[];
extern const u32 gUnknown_08DE3060[];
extern const u32 gFrontierPassBg_Gfx[];
extern const u32 gFrontierPassBg_Tilemap[];
extern const u16 gFrontierPassBg_Pal[][16];
extern const u32 gFrontierPassMapAndCard_Gfx[];
extern const u32 gFrontierPassCancelButton_Tilemap[];
extern const u32 gFrontierPassCancelButtonHighlighted_Tilemap[];
extern const u32 gFrontierPassMedals_Gfx[];
extern const u16 gUnknown_08DE07C8[][16];
extern const u16 gFrontierPassCursor_Pal[];
extern const u16 gFrontierPassMedalsGold_Pal[];
extern const u16 gFrontierPassMedalsSilver_Pal[];

View File

@ -32,8 +32,8 @@ bool8 IsHoldingItemAllowed(u16 itemId);
bool8 IsWritingMailAllowed(u16 itemId);
bool8 MenuHelpers_LinkSomething(void);
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 SetItemListPerPageCount(struct ItemSlot *slots, u8 slotsCount, u8 *pageItems, u8 *totalItems, u8 maxPerPage);
void SetCursorWithinListBounds(u16 *scrollOffset, u16 *cursorPos, u8 maxShownItems, u8 totalItems);
void SetCursorScrollWithinListBounds(u16 *scrollOffset, u16 *cursorPos, u8 shownItems, u8 totalItems, u8 maxShownItems);
void LoadListMenuSwapLineGfx(void);
void CreateSwapLineSprites(u8 *spriteIds, u8 count);

View File

@ -15,6 +15,14 @@
#define MAX_CONDITION_SPARKLES 10
// Window IDs for the Player PC Mailbox
enum {
MAILBOXWIN_TITLE,
MAILBOXWIN_LIST,
MAILBOXWIN_OPTIONS,
MAILBOXWIN_COUNT
};
struct UnknownSubStruct_81D1ED4
{
u16 unk0;
@ -35,12 +43,12 @@ struct ConditionGraph
/*0x355*/ u8 state;
};
bool8 sub_81D1C44(u8 count);
u8 sub_81D1C84(u8 a0);
u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page);
void sub_81D1E90(struct PlayerPCItemPageStruct *page);
void sub_81D1EC0(void);
void sub_81D1D04(u8 a0);
bool8 MailboxMenu_Alloc(u8 count);
u8 MailboxMenu_AddWindow(u8 windowIdx);
u8 MailboxMenu_CreateList(struct PlayerPCItemPageStruct *page);
void MailboxMenu_AddScrollArrows(struct PlayerPCItemPageStruct *page);
void MailboxMenu_Free(void);
void MailboxMenu_RemoveWindow(u8 windowIdx);
void InitConditionGraphData(struct ConditionGraph *graph);
void sub_81D2108(struct ConditionGraph *graph);
void SetConditionGraphIOWindows(u8 bg);

View File

@ -3,69 +3,6 @@
#include "menu.h"
// local task defines
#define PAGE_INDEX data[0]
#define ITEMS_ABOVE_TOP data[1]
#define NUM_ITEMS data[1]
#define NUM_QUANTITY_ROLLER data[3]
#define NUM_PAGE_ITEMS data[4]
// not used
#define CURRENT_ITEM_STORAGE_MENU data[3]
// not used
#define SWAP_ITEM_INDEX data[8]
#define SWITCH_MODE_ACTIVE data[9]
// this is potentially an ewram access occuring in high ewram. TODO: investigate this further.
#define NEW_GAME_PC_ITEMS(i, type) ((u16)((u16 *)gNewGamePCItems + type)[i * 2])
// defined and used in the above macro
enum
{
PC_ITEM_ID,
PC_QUANTITY
};
// player PC menu options
enum
{
PLAYERPC_MENU_ITEMSTORAGE,
PLAYERPC_MENU_MAILBOX,
PLAYERPC_MENU_DECORATION,
PLAYERPC_MENU_TURNOFF
};
// item storage menus
enum
{
ITEMPC_MENU_WITHDRAW,
ITEMPC_MENU_DEPOSIT,
ITEMPC_MENU_TOSS,
ITEMPC_MENU_EXIT
};
// mailbox mail options
enum
{
MAILBOX_READ,
MAILBOX_MOVE_TO_BAG,
MAILBOX_GIVE,
MAILBOX_CANCEL,
};
// special item description handlers
enum
{
ITEMPC_SWITCH_WHICH_ITEM = 0xFFF7,
ITEMPC_OKAY_TO_THROW_AWAY,
ITEMPC_TOO_IMPORTANT,
ITEMPC_NO_MORE_ROOM,
ITEMPC_THREW_AWAY_ITEM,
ITEMPC_HOW_MANY_TO_TOSS,
ITEMPC_WITHDREW_THING,
ITEMPC_HOW_MANY_TO_WITHDRAW,
ITEMPC_GO_BACK_TO_PREV
};
struct PlayerPCItemPageStruct
{
u16 cursorPos;
@ -76,16 +13,12 @@ struct PlayerPCItemPageStruct
u8 scrollIndicatorTaskId;
};
// Exported type declarations
extern struct PlayerPCItemPageStruct gPlayerPCItemPageInfo;
// Exported RAM declarations
extern struct PlayerPCItemPageStruct playerPCItemPageInfo;
// Exported ROM declarations
extern const struct MenuAction gMailboxMailOptions[];
void ReshowPlayerPC(u8 taskId);
void sub_816B31C(void);
void CB2_PlayerPCExitBagMenu(void);
void Mailbox_ReturnToMailListAfterDeposit(void);
void NewGameInitPCItems(void);

View File

@ -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

View File

@ -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");

View File

@ -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)

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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)

View File

@ -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);

File diff suppressed because it is too large Load Diff

View File

@ -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();

View File

@ -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;
}