Merge pull request #1731 from GriffinRichards/missing-tag

Move party menu data constants
This commit is contained in:
GriffinR 2022-08-20 22:43:52 -04:00 committed by GitHub
commit 81ef818f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 109 additions and 96 deletions

View File

@ -1,9 +1,3 @@
enum {
TAG_POKEBALL = 1200,
TAG_POKEBALL_SMALL,
TAG_STATUS_ICONS,
};
static const struct BgTemplate sPartyMenuBgTemplates[] =
{
{
@ -35,12 +29,6 @@ static const struct BgTemplate sPartyMenuBgTemplates[] =
},
};
enum
{
PARTY_BOX_LEFT_COLUMN,
PARTY_BOX_RIGHT_COLUMN
};
static const struct PartyMenuBoxInfoRects sPartyBoxInfoRects[] =
{
[PARTY_BOX_LEFT_COLUMN] =
@ -663,51 +651,6 @@ static const u16 sUnusedData[] =
0x0121, 0x013b, 0x000f, 0x0013, 0x0039, 0x0046, 0x0094, 0x00f9, 0x007f, 0x0123,
};
enum
{
MENU_SUMMARY,
MENU_SWITCH,
MENU_CANCEL1,
MENU_ITEM,
MENU_GIVE,
MENU_TAKE_ITEM,
MENU_MAIL,
MENU_TAKE_MAIL,
MENU_READ,
MENU_CANCEL2,
MENU_SHIFT,
MENU_SEND_OUT,
MENU_ENTER,
MENU_NO_ENTRY,
MENU_STORE,
MENU_REGISTER,
MENU_TRADE1,
MENU_TRADE2,
MENU_TOSS,
MENU_FIELD_MOVES,
};
enum
{
FIELD_MOVE_CUT,
FIELD_MOVE_FLASH,
FIELD_MOVE_ROCK_SMASH,
FIELD_MOVE_STRENGTH,
FIELD_MOVE_SURF,
FIELD_MOVE_FLY,
FIELD_MOVE_DIVE,
FIELD_MOVE_WATERFALL,
FIELD_MOVE_TELEPORT,
FIELD_MOVE_DIG,
FIELD_MOVE_SECRET_POWER,
FIELD_MOVE_MILK_DRINK,
FIELD_MOVE_SOFT_BOILED,
FIELD_MOVE_SWEET_SCENT,
};
// What a weird choice of table termination;
#define FIELD_MOVE_TERMINATOR MOVE_SWORDS_DANCE
struct
{
const u8 *text;
@ -763,25 +706,6 @@ static const u8 sPartyMenuAction_TradeSummaryCancel1[] = {MENU_TRADE1, MENU_SUMM
static const u8 sPartyMenuAction_TradeSummaryCancel2[] = {MENU_TRADE2, MENU_SUMMARY, MENU_CANCEL1};
static const u8 sPartyMenuAction_TakeItemTossCancel[] = {MENU_TAKE_ITEM, MENU_TOSS, MENU_CANCEL1};
// IDs for the action lists that appear when a party mon is selected
enum
{
ACTIONS_NONE,
ACTIONS_SWITCH,
ACTIONS_SHIFT,
ACTIONS_SEND_OUT,
ACTIONS_ENTER,
ACTIONS_NO_ENTRY,
ACTIONS_STORE,
ACTIONS_SUMMARY_ONLY,
ACTIONS_ITEM,
ACTIONS_MAIL,
ACTIONS_REGISTER,
ACTIONS_TRADE,
ACTIONS_SPIN_TRADE,
ACTIONS_TAKEITEM_TOSS
};
static const u8 *const sPartyMenuActions[] =
{
[ACTIONS_NONE] = NULL,
@ -818,17 +742,32 @@ static const u8 sPartyMenuActionCounts[] =
[ACTIONS_TAKEITEM_TOSS] = ARRAY_COUNT(sPartyMenuAction_TakeItemTossCancel)
};
static const u16 sFieldMoves[] =
static const u16 sFieldMoves[FIELD_MOVES_COUNT + 1] =
{
MOVE_CUT, MOVE_FLASH, MOVE_ROCK_SMASH, MOVE_STRENGTH, MOVE_SURF, MOVE_FLY, MOVE_DIVE, MOVE_WATERFALL, MOVE_TELEPORT,
MOVE_DIG, MOVE_SECRET_POWER, MOVE_MILK_DRINK, MOVE_SOFT_BOILED, MOVE_SWEET_SCENT, FIELD_MOVE_TERMINATOR
[FIELD_MOVE_CUT] = MOVE_CUT,
[FIELD_MOVE_FLASH] = MOVE_FLASH,
[FIELD_MOVE_ROCK_SMASH] = MOVE_ROCK_SMASH,
[FIELD_MOVE_STRENGTH] = MOVE_STRENGTH,
[FIELD_MOVE_SURF] = MOVE_SURF,
[FIELD_MOVE_FLY] = MOVE_FLY,
[FIELD_MOVE_DIVE] = MOVE_DIVE,
[FIELD_MOVE_WATERFALL] = MOVE_WATERFALL,
[FIELD_MOVE_TELEPORT] = MOVE_TELEPORT,
[FIELD_MOVE_DIG] = MOVE_DIG,
[FIELD_MOVE_SECRET_POWER] = MOVE_SECRET_POWER,
[FIELD_MOVE_MILK_DRINK] = MOVE_MILK_DRINK,
[FIELD_MOVE_SOFT_BOILED] = MOVE_SOFT_BOILED,
[FIELD_MOVE_SWEET_SCENT] = MOVE_SWEET_SCENT,
// NOTE: This value is used as the terminal value for the table. There's no reason to do this, as the size of the table is known.
// Whichever move shares this value (MOVE_SWORDS_DANCE by default) if present will be treated as the end of the array rather than a field move.
[FIELD_MOVES_COUNT] = FIELD_MOVES_COUNT
};
struct
{
bool8 (*fieldMoveFunc)(void);
u8 msgId;
} static const sFieldMoveCursorCallbacks[] =
} static const sFieldMoveCursorCallbacks[FIELD_MOVES_COUNT] =
{
[FIELD_MOVE_CUT] = {SetUpFieldMove_Cut, PARTY_MSG_NOTHING_TO_CUT},
[FIELD_MOVE_FLASH] = {SetUpFieldMove_Flash, PARTY_MSG_CANT_USE_HERE},
@ -899,23 +838,23 @@ static const union AnimCmd *const sSpriteAnimTable_HeldItem[] =
static const struct SpriteSheet sSpriteSheet_HeldItem =
{
sHeldItemGfx, sizeof(sHeldItemGfx), 0xd750
.data = sHeldItemGfx, .size = sizeof(sHeldItemGfx), .tag = TAG_HELD_ITEM
};
static const struct SpritePalette sSpritePalette_HeldItem =
{
sHeldItemPalette, 0xd750
.data = sHeldItemPalette, .tag = TAG_HELD_ITEM
};
static const struct SpriteTemplate sSpriteTemplate_HeldItem =
{
0xd750,
0xd750,
&sOamData_HeldItem,
sSpriteAnimTable_HeldItem,
NULL,
gDummySpriteAffineAnimTable,
SpriteCallbackDummy
.tileTag = TAG_HELD_ITEM,
.paletteTag = TAG_HELD_ITEM,
.oam = &sOamData_HeldItem,
.anims = sSpriteAnimTable_HeldItem,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct OamData sOamData_MenuPokeball =

View File

@ -73,6 +73,80 @@
#include "constants/rgb.h"
#include "constants/songs.h"
enum {
MENU_SUMMARY,
MENU_SWITCH,
MENU_CANCEL1,
MENU_ITEM,
MENU_GIVE,
MENU_TAKE_ITEM,
MENU_MAIL,
MENU_TAKE_MAIL,
MENU_READ,
MENU_CANCEL2,
MENU_SHIFT,
MENU_SEND_OUT,
MENU_ENTER,
MENU_NO_ENTRY,
MENU_STORE,
MENU_REGISTER,
MENU_TRADE1,
MENU_TRADE2,
MENU_TOSS,
MENU_FIELD_MOVES
};
// IDs for the action lists that appear when a party mon is selected
enum {
ACTIONS_NONE,
ACTIONS_SWITCH,
ACTIONS_SHIFT,
ACTIONS_SEND_OUT,
ACTIONS_ENTER,
ACTIONS_NO_ENTRY,
ACTIONS_STORE,
ACTIONS_SUMMARY_ONLY,
ACTIONS_ITEM,
ACTIONS_MAIL,
ACTIONS_REGISTER,
ACTIONS_TRADE,
ACTIONS_SPIN_TRADE,
ACTIONS_TAKEITEM_TOSS,
};
// In CursorCb_FieldMove, field moves <= FIELD_MOVE_WATERFALL are assumed to line up with the badge flags.
// Badge flag names are commented here for people searching for references to remove the badge requirement.
enum {
FIELD_MOVE_CUT, // FLAG_BADGE01_GET
FIELD_MOVE_FLASH, // FLAG_BADGE02_GET
FIELD_MOVE_ROCK_SMASH, // FLAG_BADGE03_GET
FIELD_MOVE_STRENGTH, // FLAG_BADGE04_GET
FIELD_MOVE_SURF, // FLAG_BADGE05_GET
FIELD_MOVE_FLY, // FLAG_BADGE06_GET
FIELD_MOVE_DIVE, // FLAG_BADGE07_GET
FIELD_MOVE_WATERFALL, // FLAG_BADGE08_GET
FIELD_MOVE_TELEPORT,
FIELD_MOVE_DIG,
FIELD_MOVE_SECRET_POWER,
FIELD_MOVE_MILK_DRINK,
FIELD_MOVE_SOFT_BOILED,
FIELD_MOVE_SWEET_SCENT,
FIELD_MOVES_COUNT
};
enum {
PARTY_BOX_LEFT_COLUMN,
PARTY_BOX_RIGHT_COLUMN,
};
enum {
TAG_POKEBALL = 1200,
TAG_POKEBALL_SMALL,
TAG_STATUS_ICONS,
};
#define TAG_HELD_ITEM 55120
#define PARTY_PAL_SELECTED (1 << 0)
#define PARTY_PAL_FAINTED (1 << 1)
#define PARTY_PAL_TO_SWITCH (1 << 2)
@ -1186,13 +1260,13 @@ void Task_HandleChooseMonInput(u8 taskId)
switch (PartyMenuButtonHandler(slotPtr))
{
case 1: // Selected mon
case A_BUTTON: // Selected mon
HandleChooseMonSelection(taskId, slotPtr);
break;
case 2: // Selected Cancel
case B_BUTTON: // Selected Cancel / pressed B
HandleChooseMonCancel(taskId, slotPtr);
break;
case 8: // Start button
case START_BUTTON:
if (sPartyMenuInternal->chooseHalf)
{
PlaySE(SE_SELECT);
@ -1409,7 +1483,7 @@ static u16 PartyMenuButtonHandler(s8 *slotPtr)
}
if (JOY_NEW(START_BUTTON))
return 8;
return START_BUTTON;
if (movementDir)
{
@ -1418,8 +1492,8 @@ static u16 PartyMenuButtonHandler(s8 *slotPtr)
}
// Pressed Cancel
if ((JOY_NEW(A_BUTTON)) && *slotPtr == PARTY_SIZE + 1)
return 2;
if (JOY_NEW(A_BUTTON) && *slotPtr == PARTY_SIZE + 1)
return B_BUTTON;
return JOY_NEW(A_BUTTON | B_BUTTON);
}
@ -2536,7 +2610,7 @@ static void SetPartyMonFieldSelectionActions(struct Pokemon *mons, u8 slotId)
// Add field moves to action list
for (i = 0; i < MAX_MON_MOVES; i++)
{
for (j = 0; sFieldMoves[j] != FIELD_MOVE_TERMINATOR; j++)
for (j = 0; sFieldMoves[j] != FIELD_MOVES_COUNT; j++)
{
if (GetMonData(&mons[slotId], i + MON_DATA_MOVE1) == sFieldMoves[j])
{