Use window constants in party_menu

This commit is contained in:
GriffinR 2022-09-29 12:55:31 -04:00
parent 9f5704b05a
commit 1f225286d5
2 changed files with 43 additions and 39 deletions

View File

@ -122,7 +122,7 @@ static const u8 sFontColorTable[][3] =
static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] = static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
{ {
{ { // Party mon 1
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 3, .tilemapTop = 3,
@ -131,7 +131,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 3, .paletteNum = 3,
.baseBlock = 0x63, .baseBlock = 0x63,
}, },
{ { // Party mon 2
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 1, .tilemapTop = 1,
@ -140,7 +140,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 4, .paletteNum = 4,
.baseBlock = 0xA9, .baseBlock = 0xA9,
}, },
{ { // Party mon 3
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 4, .tilemapTop = 4,
@ -149,7 +149,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 5, .paletteNum = 5,
.baseBlock = 0xDF, .baseBlock = 0xDF,
}, },
{ { // Party mon 4
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 7, .tilemapTop = 7,
@ -158,7 +158,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 6, .paletteNum = 6,
.baseBlock = 0x115, .baseBlock = 0x115,
}, },
{ { // Party mon 5
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 10, .tilemapTop = 10,
@ -167,7 +167,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 7, .paletteNum = 7,
.baseBlock = 0x14B, .baseBlock = 0x14B,
}, },
{ { // Party mon 6
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 13, .tilemapTop = 13,
@ -176,7 +176,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 8, .paletteNum = 8,
.baseBlock = 0x181, .baseBlock = 0x181,
}, },
{ [WIN_MSG] = {
.bg = 2, .bg = 2,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 15, .tilemapTop = 15,
@ -190,7 +190,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] = static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
{ {
{ { // Party mon 1
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 1, .tilemapTop = 1,
@ -199,7 +199,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 3, .paletteNum = 3,
.baseBlock = 0x63, .baseBlock = 0x63,
}, },
{ { // Party mon 2
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 8, .tilemapTop = 8,
@ -208,7 +208,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 4, .paletteNum = 4,
.baseBlock = 0xA9, .baseBlock = 0xA9,
}, },
{ { // Party mon 3
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 1, .tilemapTop = 1,
@ -217,7 +217,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 5, .paletteNum = 5,
.baseBlock = 0xEF, .baseBlock = 0xEF,
}, },
{ { // Party mon 4
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 5, .tilemapTop = 5,
@ -226,7 +226,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 6, .paletteNum = 6,
.baseBlock = 0x125, .baseBlock = 0x125,
}, },
{ { // Party mon 5
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 9, .tilemapTop = 9,
@ -235,7 +235,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 7, .paletteNum = 7,
.baseBlock = 0x15B, .baseBlock = 0x15B,
}, },
{ { // Party mon 6
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 13, .tilemapTop = 13,
@ -244,7 +244,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 8, .paletteNum = 8,
.baseBlock = 0x191, .baseBlock = 0x191,
}, },
{ [WIN_MSG] = {
.bg = 2, .bg = 2,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 15, .tilemapTop = 15,
@ -258,7 +258,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] = static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
{ {
{ { // Party mon 1
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 1, .tilemapTop = 1,
@ -267,7 +267,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 3, .paletteNum = 3,
.baseBlock = 0x63, .baseBlock = 0x63,
}, },
{ { // Party mon 2
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 8, .tilemapTop = 8,
@ -276,7 +276,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 4, .paletteNum = 4,
.baseBlock = 0xA9, .baseBlock = 0xA9,
}, },
{ { // Party mon 3
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 2, .tilemapTop = 2,
@ -285,7 +285,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 5, .paletteNum = 5,
.baseBlock = 0xEF, .baseBlock = 0xEF,
}, },
{ { // Party mon 4
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 5, .tilemapTop = 5,
@ -294,7 +294,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 6, .paletteNum = 6,
.baseBlock = 0x125, .baseBlock = 0x125,
}, },
{ { // Party mon 5
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 9, .tilemapTop = 9,
@ -303,7 +303,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 7, .paletteNum = 7,
.baseBlock = 0x15B, .baseBlock = 0x15B,
}, },
{ { // Party mon 6
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 12, .tilemapTop = 12,
@ -312,7 +312,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 8, .paletteNum = 8,
.baseBlock = 0x191, .baseBlock = 0x191,
}, },
{ [WIN_MSG] = {
.bg = 2, .bg = 2,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 15, .tilemapTop = 15,
@ -326,7 +326,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] = static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
{ {
{ { // Party mon 1
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 2, .tilemapTop = 2,
@ -335,7 +335,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 3, .paletteNum = 3,
.baseBlock = 0x63, .baseBlock = 0x63,
}, },
{ { // Party mon 2
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 3, .tilemapTop = 3,
@ -344,7 +344,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 5, .paletteNum = 5,
.baseBlock = 0xA9, .baseBlock = 0xA9,
}, },
{ { // Party mon 3
.bg = 0, .bg = 0,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 6, .tilemapTop = 6,
@ -353,7 +353,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 6, .paletteNum = 6,
.baseBlock = 0xDF, .baseBlock = 0xDF,
}, },
{ { // Party mon 4
.bg = 2, .bg = 2,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 11, .tilemapTop = 11,
@ -362,7 +362,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 4, .paletteNum = 4,
.baseBlock = 0x115, .baseBlock = 0x115,
}, },
{ { // Party mon 5
.bg = 2, .bg = 2,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 12, .tilemapTop = 12,
@ -371,7 +371,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 7, .paletteNum = 7,
.baseBlock = 0x16B, .baseBlock = 0x16B,
}, },
{ { // Party mon 6
.bg = 2, .bg = 2,
.tilemapLeft = 12, .tilemapLeft = 12,
.tilemapTop = 15, .tilemapTop = 15,

View File

@ -161,14 +161,18 @@ enum {
#define MENU_DIR_RIGHT 2 #define MENU_DIR_RIGHT 2
#define MENU_DIR_LEFT -2 #define MENU_DIR_LEFT -2
enum enum {
{
CAN_LEARN_MOVE, CAN_LEARN_MOVE,
CANNOT_LEARN_MOVE, CANNOT_LEARN_MOVE,
ALREADY_KNOWS_MOVE, ALREADY_KNOWS_MOVE,
CANNOT_LEARN_MOVE_IS_EGG CANNOT_LEARN_MOVE_IS_EGG
}; };
enum {
// Window ids 0-5 are implicitly assigned to each party pokemon in InitPartyMenuBoxes
WIN_MSG = PARTY_SIZE,
};
struct PartyMenuBoxInfoRects struct PartyMenuBoxInfoRects
{ {
void (*blitFunc)(u8, u8, u8, u8, u8, bool8); void (*blitFunc)(u8, u8, u8, u8, u8, bool8);
@ -320,7 +324,7 @@ static void UpdateCurrentPartySelection(s8 *, s8);
static void UpdatePartySelectionSingleLayout(s8 *, s8); static void UpdatePartySelectionSingleLayout(s8 *, s8);
static void UpdatePartySelectionDoubleLayout(s8 *, s8); static void UpdatePartySelectionDoubleLayout(s8 *, s8);
static s8 GetNewSlotDoubleLayout(s8, s8); static s8 GetNewSlotDoubleLayout(s8, s8);
static void PartyMenuPrintText(const u8 *); static void PrintMessage(const u8 *);
static void Task_PrintAndWaitForText(u8); static void Task_PrintAndWaitForText(u8);
static bool16 IsMonAllowedInPokemonJump(struct Pokemon *); static bool16 IsMonAllowedInPokemonJump(struct Pokemon *);
static bool16 IsMonAllowedInDodrioBerryPicking(struct Pokemon *); static bool16 IsMonAllowedInDodrioBerryPicking(struct Pokemon *);
@ -1703,7 +1707,7 @@ u8 DisplayPartyMenuMessage(const u8 *str, bool8 keepOpen)
{ {
u8 taskId; u8 taskId;
PartyMenuPrintText(str); PrintMessage(str);
taskId = CreateTask(Task_PrintAndWaitForText, 1); taskId = CreateTask(Task_PrintAndWaitForText, 1);
gTasks[taskId].tKeepOpen = keepOpen; gTasks[taskId].tKeepOpen = keepOpen;
return taskId; return taskId;
@ -1711,12 +1715,12 @@ u8 DisplayPartyMenuMessage(const u8 *str, bool8 keepOpen)
static void Task_PrintAndWaitForText(u8 taskId) static void Task_PrintAndWaitForText(u8 taskId)
{ {
if (RunTextPrintersRetIsActive(6) != TRUE) if (RunTextPrintersRetIsActive(WIN_MSG) != TRUE)
{ {
if (gTasks[taskId].tKeepOpen == FALSE) if (gTasks[taskId].tKeepOpen == FALSE)
{ {
ClearStdWindowAndFrameToTransparent(6, FALSE); ClearStdWindowAndFrameToTransparent(WIN_MSG, FALSE);
ClearWindowTilemap(6); ClearWindowTilemap(WIN_MSG);
} }
DestroyTask(taskId); DestroyTask(taskId);
} }
@ -1742,8 +1746,8 @@ static void Task_ReturnToChooseMonAfterText(u8 taskId)
{ {
if (IsPartyMenuTextPrinterActive() != TRUE) if (IsPartyMenuTextPrinterActive() != TRUE)
{ {
ClearStdWindowAndFrameToTransparent(6, FALSE); ClearStdWindowAndFrameToTransparent(WIN_MSG, FALSE);
ClearWindowTilemap(6); ClearWindowTilemap(WIN_MSG);
if (MenuHelpers_IsLinkActive() == TRUE) if (MenuHelpers_IsLinkActive() == TRUE)
{ {
gTasks[taskId].func = Task_WaitForLinkAndReturnToChooseMon; gTasks[taskId].func = Task_WaitForLinkAndReturnToChooseMon;
@ -2559,11 +2563,11 @@ static u8 DisplaySelectionWindow(u8 windowType)
return sPartyMenuInternal->windowId[0]; return sPartyMenuInternal->windowId[0];
} }
static void PartyMenuPrintText(const u8 *text) static void PrintMessage(const u8 *text)
{ {
DrawStdFrameWithCustomTileAndPalette(6, FALSE, 0x4F, 13); DrawStdFrameWithCustomTileAndPalette(WIN_MSG, FALSE, 0x4F, 13);
gTextFlags.canABSpeedUpPrint = TRUE; gTextFlags.canABSpeedUpPrint = TRUE;
AddTextPrinterParameterized2(6, FONT_NORMAL, text, GetPlayerTextSpeedDelay(), 0, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY); AddTextPrinterParameterized2(WIN_MSG, FONT_NORMAL, text, GetPlayerTextSpeedDelay(), 0, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
} }
static void PartyMenuDisplayYesNoMenu(void) static void PartyMenuDisplayYesNoMenu(void)