From 2f4203bc4c3f5b4113ff80663bd8c9ef395c8815 Mon Sep 17 00:00:00 2001 From: Frank DeBlasio <35279583+fdeblasio@users.noreply.github.com> Date: Tue, 12 Mar 2024 06:57:38 -0400 Subject: [PATCH] Consolidate type properties (#4185) * Moved gTypeNames into gTypes * Added invalid move text to struct * Added max move to struct * Added icon palette to struct * Added macros for invalid and max moves * Swapped palette and max move order * Renamed invalid to generic * Renamed invalid to generic in struct definition * Added zMoves and items to type struct * Addressed comments * Incorporated newer comments * Updated comment format --- include/battle_main.h | 2 +- include/data.h | 16 ++ src/battle_controller_player.c | 2 +- src/battle_debug.c | 2 +- src/battle_dynamax.c | 29 +--- src/battle_main.c | 303 ++++++++++++++++++++++++++++++--- src/battle_message.c | 33 +--- src/battle_z_move.c | 2 +- src/data/union_room.h | 36 ++-- src/menu_specialized.c | 2 +- src/pokedex.c | 36 ++-- src/pokedex_plus_hgss.c | 78 ++++----- src/pokemon_summary_screen.c | 36 ++-- src/union_room.c | 4 +- 14 files changed, 388 insertions(+), 193 deletions(-) diff --git a/include/battle_main.h b/include/battle_main.h index c1394db60c..9469e63efe 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -76,7 +76,7 @@ extern struct MultiPartnerMenuPokemon gMultiPartnerParty[MULTI_PARTY_SIZE]; extern const struct SpriteTemplate gUnusedBattleInitSprite; extern const struct OamData gOamData_BattleSpriteOpponentSide; extern const struct OamData gOamData_BattleSpritePlayerSide; -extern const u8 gTypeNames[NUMBER_OF_MON_TYPES][TYPE_NAME_LENGTH + 1]; +extern const struct TypeInfo gTypesInfo[NUMBER_OF_MON_TYPES]; extern const u8 gStatusConditionString_PoisonJpn[8]; extern const u8 gStatusConditionString_SleepJpn[8]; diff --git a/include/data.h b/include/data.h index 28faf0716a..df11e48a10 100644 --- a/include/data.h +++ b/include/data.h @@ -99,6 +99,22 @@ struct TrainerClass u16 ball; }; +struct TypeInfo +{ + u8 name[TYPE_NAME_LENGTH + 1]; + u8 generic[17]; + u8 palette; + //u16 zMove; + u16 maxMove; + //u16 enhanceItem; + //u16 berry; + //u16 gem; + //u16 plate; + //u16 memory; + //u16 zCrystal; + //u16 teraShard; +}; + extern const u16 gMinigameDigits_Pal[]; extern const u32 gMinigameDigits_Gfx[]; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index f1bdbdc668..c9778f898e 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1755,7 +1755,7 @@ static void MoveSelectionDisplayMoveType(u32 battler) else type = gMovesInfo[moveInfo->moves[gMoveSelectionCursor[battler]]].type; - StringCopy(txtPtr, gTypeNames[type]); + StringCopy(txtPtr, gTypesInfo[type].name); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE); } diff --git a/src/battle_debug.c b/src/battle_debug.c index cdda88e236..4e9d5ecf29 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -1480,7 +1480,7 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data) { u8 *types = &gBattleMons[data->battlerId].type1; - PadString(gTypeNames[types[i]], text); + PadString(gTypesInfo[types[i]].name, text); printer.currentY = printer.y = (i * yMultiplier) + sSecondaryListTemplate.upText_Y; AddTextPrinter(&printer, 0, NULL); } diff --git a/src/battle_dynamax.c b/src/battle_dynamax.c index 0357e27d1e..7286045684 100644 --- a/src/battle_dynamax.c +++ b/src/battle_dynamax.c @@ -24,29 +24,6 @@ static u8 GetMaxPowerTier(u16 move); -// Constant Data -static const u16 sMaxMoveTable[NUMBER_OF_MON_TYPES] = -{ - [TYPE_NORMAL] = MOVE_MAX_STRIKE, - [TYPE_FIGHTING] = MOVE_MAX_KNUCKLE, - [TYPE_FLYING] = MOVE_MAX_AIRSTREAM, - [TYPE_POISON] = MOVE_MAX_OOZE, - [TYPE_GROUND] = MOVE_MAX_QUAKE, - [TYPE_ROCK] = MOVE_MAX_ROCKFALL, - [TYPE_BUG] = MOVE_MAX_FLUTTERBY, - [TYPE_GHOST] = MOVE_MAX_PHANTASM, - [TYPE_STEEL] = MOVE_MAX_STEELSPIKE, - [TYPE_FIRE] = MOVE_MAX_FLARE, - [TYPE_WATER] = MOVE_MAX_GEYSER, - [TYPE_GRASS] = MOVE_MAX_OVERGROWTH, - [TYPE_ELECTRIC] = MOVE_MAX_LIGHTNING, - [TYPE_PSYCHIC] = MOVE_MAX_MINDSTORM, - [TYPE_ICE] = MOVE_MAX_HAILSTORM, - [TYPE_DRAGON] = MOVE_MAX_WYRMWIND, - [TYPE_DARK] = MOVE_MAX_DARKNESS, - [TYPE_FAIRY] = MOVE_MAX_STARFALL, -}; - struct GMaxMove { u16 species; @@ -305,9 +282,9 @@ static u16 GetTypeBasedMaxMove(u16 battlerId, u16 type) } // Regular Max Move - if (sMaxMoveTable[type] == MOVE_NONE) // failsafe - return sMaxMoveTable[0]; - return sMaxMoveTable[type]; + if (gTypesInfo[type].maxMove == MOVE_NONE) // failsafe + return gTypesInfo[0].maxMove; + return gTypesInfo[type].maxMove; } // Returns the appropriate Max Move or G-Max Move for a battler to use. diff --git a/src/battle_main.c b/src/battle_main.c index f0075340ea..782016ee40 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -295,27 +295,290 @@ const struct OamData gOamData_BattleSpritePlayerSide = static const s8 sCenterToCornerVecXs[8] ={-32, -16, -16, -32, -32}; -const u8 gTypeNames[NUMBER_OF_MON_TYPES][TYPE_NAME_LENGTH + 1] = +// .generic is large enough that the text for TYPE_ELECTRIC will exceed TEXT_BUFF_ARRAY_COUNT. +const struct TypeInfo gTypesInfo[NUMBER_OF_MON_TYPES] = { - [TYPE_NORMAL] = _("Normal"), - [TYPE_FIGHTING] = _("Fight"), - [TYPE_FLYING] = _("Flying"), - [TYPE_POISON] = _("Poison"), - [TYPE_GROUND] = _("Ground"), - [TYPE_ROCK] = _("Rock"), - [TYPE_BUG] = _("Bug"), - [TYPE_GHOST] = _("Ghost"), - [TYPE_STEEL] = _("Steel"), - [TYPE_MYSTERY] = _("???"), - [TYPE_FIRE] = _("Fire"), - [TYPE_WATER] = _("Water"), - [TYPE_GRASS] = _("Grass"), - [TYPE_ELECTRIC] = _("Electr"), - [TYPE_PSYCHIC] = _("Psychc"), - [TYPE_ICE] = _("Ice"), - [TYPE_DRAGON] = _("Dragon"), - [TYPE_DARK] = _("Dark"), - [TYPE_FAIRY] = _("Fairy"), + [TYPE_NORMAL] = + { + .name = _("Normal"), + .generic = _("a NORMAL move"), + .palette = 13, + //.zMove = MOVE_BREAKNECK_BLITZ, + .maxMove = MOVE_MAX_STRIKE, + //.enhanceItem = ITEM_SILK_SCARF, + //.berry = ITEM_CHILAN_BERRY, + //.gem = ITEM_NORMAL_GEM, + //.zCrystal = ITEM_NORMALIUM_Z, + //.teraShard = ITEM_NORMAL_TERA_SHARD, + }, + [TYPE_FIGHTING] = + { + .name = _("Fight"), + .generic = _("a FIGHTING move"), + .palette = 13, + //.zMove = MOVE_ALL_OUT_PUMMELING, + .maxMove = MOVE_MAX_KNUCKLE, + //.enhanceItem = ITEM_BLACK_BELT, + //.berry = ITEM_CHOPLE_BERRY, + //.gem = ITEM_FIGHTING_GEM, + //.zCrystal = ITEM_FIGHTINIUM_Z, + //.plate= ITEM_FIST_PLATE, + //.memory = ITEM_FIGHTING_MEMORY, + //.teraShard = ITEM_FIGHTING_TERA_SHARD, + }, + [TYPE_FLYING] = + { + .name = _("Flying"), + .generic = _("a FLYING move"), + .palette = 14, + //.zMove = MOVE_SUPERSONIC_SKYSTRIKE, + .maxMove = MOVE_MAX_AIRSTREAM, + //.enhanceItem = ITEM_SHARP_BEAK, + //.berry = ITEM_COBA_BERRY, + //.gem = ITEM_FLYING_GEM, + //.zCrystal = ITEM_FLYINIUM_Z, + //.plate= ITEM_SKY_PLATE, + //.memory = ITEM_FLYING_MEMORY, + //.teraShard = ITEM_FLYING_TERA_SHARD, + }, + [TYPE_POISON] = + { + .name = _("Poison"), + .generic = _("a POISON move"), + .palette = 14, + //.zMove = MOVE_ACID_DOWNPOUR, + .maxMove = MOVE_MAX_OOZE, + //.enhanceItem = ITEM_POISON_BARB, + //.berry = ITEM_KEBIA_BERRY, + //.gem = ITEM_POISON_GEM, + //.zCrystal = ITEM_POISONIUM_Z, + //.plate= ITEM_TOXIC_PLATE, + //.memory = ITEM_POISON_MEMORY, + //.teraShard = ITEM_POISON_TERA_SHARD, + }, + [TYPE_GROUND] = + { + .name = _("Ground"), + .generic = _("a GROUND move"), + .palette = 13, + //.zMove = MOVE_TECTONIC_RAGE, + .maxMove = MOVE_MAX_QUAKE, + //.enhanceItem = ITEM_SOFT_SAND, + //.berry = ITEM_SHUCA_BERRY, + //.gem = ITEM_GROUND_GEM, + //.zCrystal = ITEM_GROUNDIUM_Z, + //.plate= ITEM_EARTH_PLATE, + //.memory = ITEM_GROUND_MEMORY, + //.teraShard = ITEM_GROUND_TERA_SHARD, + }, + [TYPE_ROCK] = + { + .name = _("Rock"), + .generic = _("a ROCK move"), + .palette = 13, + //.zMove = MOVE_CONTINENTAL_CRUSH, + .maxMove = MOVE_MAX_ROCKFALL, + //.enhanceItem = ITEM_HARD_STONE, + //.berry = ITEM_CHARTI_BERRY, + //.gem = ITEM_ROCK_GEM, + //.zCrystal = ITEM_ROCKIUM_Z, + //.plate= ITEM_STONE_PLATE, + //.memory = ITEM_ROCK_MEMORY, + //.teraShard = ITEM_ROCK_TERA_SHARD, + }, + [TYPE_BUG] = + { + .name = _("Bug"), + .generic = _("a BUG move"), + .palette = 15, + //.zMove = MOVE_SAVAGE_SPIN_OUT, + .maxMove = MOVE_MAX_FLUTTERBY, + //.enhanceItem = ITEM_SILVER_POWDER, + //.berry = ITEM_TANGA_BERRY, + //.gem = ITEM_BUG_GEM, + //.zCrystal = ITEM_BUGINIUM_Z, + //.plate= ITEM_INSECT_PLATE, + //.memory = ITEM_BUG_MEMORY, + //.teraShard = ITEM_BUG_TERA_SHARD, + }, + [TYPE_GHOST] = + { + .name = _("Ghost"), + .generic = _("a GHOST move"), + .palette = 14, + //.zMove = MOVE_NEVER_ENDING_NIGHTMARE, + .maxMove = MOVE_MAX_PHANTASM, + //.enhanceItem = ITEM_SPELL_TAG, + //.berry = ITEM_KASIB_BERRY, + //.gem = ITEM_GHOST_GEM, + //.zCrystal = ITEM_GHOSTIUM_Z, + //.plate= ITEM_SPOOKY_PLATE, + //.memory = ITEM_GHOST_MEMORY, + //.teraShard = ITEM_GHOST_TERA_SHARD, + }, + [TYPE_STEEL] = + { + .name = _("Steel"), + .generic = _("a STEEL move"), + .palette = 13, + //.zMove = MOVE_CORKSCREW_CRASH, + .maxMove = MOVE_MAX_STEELSPIKE, + //.enhanceItem = ITEM_METAL_COAT, + //.berry = ITEM_BABIRI_BERRY, + //.gem = ITEM_STEEL_GEM, + //.zCrystal = ITEM_STEELIUM_Z, + //.plate= ITEM_IRON_PLATE, + //.memory = ITEM_STEEL_MEMORY, + //.teraShard = ITEM_STEEL_TERA_SHARD, + }, + [TYPE_MYSTERY] = + { + .name = _("???"), + .generic = _("a ??? move"), + .palette = 15, + }, + [TYPE_FIRE] = + { + .name = _("Fire"), + .generic = _("a FIRE move"), + .palette = 13, + //.zMove = MOVE_INFERNO_OVERDRIVE, + .maxMove = MOVE_MAX_FLARE, + //.enhanceItem = ITEM_CHARCOAL, + //.berry = ITEM_OCCA_BERRY, + //.gem = ITEM_FIRE_GEM, + //.zCrystal = ITEM_FIRIUM_Z, + //.plate= ITEM_FLAME_PLATE, + //.memory = ITEM_FIRE_MEMORY, + //.teraShard = ITEM_FIRE_TERA_SHARD, + }, + [TYPE_WATER] = + { + .name = _("Water"), + .generic = _("a WATER move"), + .palette = 14, + //.zMove = MOVE_HYDRO_VORTEX, + .maxMove = MOVE_MAX_GEYSER, + //.enhanceItem = ITEM_MYSTIC_WATER, + //.berry = ITEM_PASSHO_BERRY, + //.gem = ITEM_WATER_GEM, + //.zCrystal = ITEM_WATERIUM_Z, + //.plate= ITEM_SPLASH_PLATE, + //.memory = ITEM_WATER_MEMORY, + //.teraShard = ITEM_WATER_TERA_SHARD, + }, + [TYPE_GRASS] = + { + .name = _("Grass"), + .generic = _("a GRASS move"), + .palette = 15, + //.zMove = MOVE_BLOOM_DOOM, + .maxMove = MOVE_MAX_OVERGROWTH, + //.enhanceItem = ITEM_MIRACLE_SEED, + //.berry = ITEM_RINDO_BERRY, + //.gem = ITEM_GRASS_GEM, + //.zCrystal = ITEM_GRASSIUM_Z, + //.plate= ITEM_MEADOW_PLATE, + //.memory = ITEM_GRASS_MEMORY, + //.teraShard = ITEM_GRASS_TERA_SHARD, + }, + [TYPE_ELECTRIC] = + { + .name = _("Electr"), + .generic = _("an ELECTRIC move"), + .palette = 13, + //.zMove = MOVE_GIGAVOLT_HAVOC, + .maxMove = MOVE_MAX_LIGHTNING, + //.enhanceItem = ITEM_MAGNET, + //.berry = ITEM_WACAN_BERRY, + //.gem = ITEM_ELECTRIC_GEM, + //.zCrystal = ITEM_ELECTRIUM_Z, + //.plate= ITEM_ZAP_PLATE, + //.memory = ITEM_ELECTRIC_MEMORY, + //.teraShard = ITEM_ELECTRIC_TERA_SHARD, + }, + [TYPE_PSYCHIC] = + { + .name = _("Psychc"), + .generic = _("a PSYCHIC move"), + .palette = 14, + //.zMove = MOVE_SHATTERED_PSYCHE, + .maxMove = MOVE_MAX_MINDSTORM, + //.enhanceItem = ITEM_TWISTED_SPOON, + //.berry = ITEM_PAYAPA_BERRY, + //.gem = ITEM_PSYCHIC_GEM, + //.zCrystal = ITEM_PSYCHIUM_Z, + //.plate= ITEM_MIND_PLATE, + //.memory = ITEM_PSYCHIC_MEMORY, + //.teraShard = ITEM_PSYCHIC_TERA_SHARD, + }, + [TYPE_ICE] = + { + .name = _("Ice"), + .generic = _("an ICE move"), + .palette = 14, + //.zMove = MOVE_SUBZERO_SLAMMER, + .maxMove = MOVE_MAX_HAILSTORM, + //.enhanceItem = ITEM_NEVER_MELT_ICE, + //.berry = ITEM_YACHE_BERRY, + //.gem = ITEM_ICE_GEM, + //.zCrystal = ITEM_ICIUM_Z, + //.plate= ITEM_ICICLE_PLATE, + //.memory = ITEM_ICE_MEMORY, + //.teraShard = ITEM_ICE_TERA_SHARD, + }, + [TYPE_DRAGON] = + { + .name = _("Dragon"), + .generic = _("a DRAGON move"), + .palette = 15, + //.zMove = MOVE_DEVASTATING_DRAKE, + .maxMove = MOVE_MAX_WYRMWIND, + //.enhanceItem = ITEM_DRAGON_FANG, + //.berry = ITEM_HABAN_BERRY, + //.gem = ITEM_DRAGON_GEM, + //.zCrystal = ITEM_DRAGONIUM_Z, + //.plate= ITEM_DRACO_PLATE, + //.memory = ITEM_DRAGON_MEMORY, + //.teraShard = ITEM_DRAGON_TERA_SHARD, + }, + [TYPE_DARK] = + { + .name = _("Dark"), + .generic = _("a DARK move"), + .palette = 13, + //.zMove = MOVE_BLACK_HOLE_ECLIPSE, + .maxMove = MOVE_MAX_DARKNESS, + //.enhanceItem = ITEM_BLACK_GLASSES, + //.berry = ITEM_COLBUR_BERRY, + //.gem = ITEM_DARK_GEM, + //.zCrystal = ITEM_DARKINIUM_Z, + //.plate= ITEM_DREAD_PLATE, + //.memory = ITEM_DARK_MEMORY, + //.teraShard = ITEM_DARK_TERA_SHARD, + }, + [TYPE_FAIRY] = + { + .name = _("Fairy"), + .generic = _("a FAIRY move"), + .palette = 14, + //.zMove = MOVE_TWINKLE_TACKLE, + .maxMove = MOVE_MAX_STARFALL, + //.enhanceItem = ITEM_FAIRY_FEATHER, + //.berry = ITEM_ROSELI_BERRY, + //.gem = ITEM_FAIRY_GEM, + //.zCrystal = ITEM_FAIRIUM_Z, + //.plate= ITEM_PIXIE_PLATE, + //.memory = ITEM_FAIRY_MEMORY, + //.teraShard = ITEM_FAIRY_TERA_SHARD, + }, + /* + [TYPE_STELLAR] = + { + .name = _("Stellar"), + .teraShard = ITEM_STELLAR_TERA_SHARD, + }, + */ }; // extra args are money and ball diff --git a/src/battle_message.c b/src/battle_message.c index 580e21d00d..3ad1dc409b 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2098,31 +2098,6 @@ const u8 gText_Draw[] = _("{HIGHLIGHT TRANSPARENT}Draw"); static const u8 sText_SpaceIs[] = _(" is"); static const u8 sText_ApostropheS[] = _("'s"); -// For displaying names of invalid moves. -// This is large enough that the text for TYPE_ELECTRIC will exceed TEXT_BUFF_ARRAY_COUNT. -static const u8 sATypeMove_Table[NUMBER_OF_MON_TYPES][17] = -{ - [TYPE_NORMAL] = _("a NORMAL move"), - [TYPE_FIGHTING] = _("a FIGHTING move"), - [TYPE_FLYING] = _("a FLYING move"), - [TYPE_POISON] = _("a POISON move"), - [TYPE_GROUND] = _("a GROUND move"), - [TYPE_ROCK] = _("a ROCK move"), - [TYPE_BUG] = _("a BUG move"), - [TYPE_GHOST] = _("a GHOST move"), - [TYPE_STEEL] = _("a STEEL move"), - [TYPE_MYSTERY] = _("a ??? move"), - [TYPE_FIRE] = _("a FIRE move"), - [TYPE_WATER] = _("a WATER move"), - [TYPE_GRASS] = _("a GRASS move"), - [TYPE_ELECTRIC] = _("an ELECTRIC move"), - [TYPE_PSYCHIC] = _("a PSYCHIC move"), - [TYPE_ICE] = _("an ICE move"), - [TYPE_DRAGON] = _("a DRAGON move"), - [TYPE_DARK] = _("a DARK move"), - [TYPE_FAIRY] = _("a FAIRY move"), -}; - const u8 gText_BattleTourney[] = _("BATTLE TOURNEY"); static const u8 sText_Round1[] = _("Round 1"); static const u8 sText_Round2[] = _("Round 2"); @@ -2940,7 +2915,7 @@ void BufferStringBattle(u16 stringID, u32 battler) if (gBattleMsgDataPtr->currentMove >= MOVES_COUNT && !IsZMove(gBattleMsgDataPtr->currentMove) && !IsMaxMove(gBattleMsgDataPtr->currentMove)) - StringCopy(gBattleTextBuff3, sATypeMove_Table[*(&gBattleStruct->stringMoveType)]); + StringCopy(gBattleTextBuff3, gTypesInfo[*(&gBattleStruct->stringMoveType)].generic); else StringCopy(gBattleTextBuff3, GetMoveName(gBattleMsgDataPtr->currentMove)); stringPtr = sText_AttackerUsedX; @@ -3370,7 +3345,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) if (gBattleMsgDataPtr->currentMove >= MOVES_COUNT && !IsZMove(gBattleMsgDataPtr->currentMove) && !IsMaxMove(gBattleMsgDataPtr->currentMove)) - toCpy = sATypeMove_Table[gBattleStruct->stringMoveType]; + toCpy = gTypesInfo[gBattleStruct->stringMoveType].generic; else toCpy = GetMoveName(gBattleMsgDataPtr->currentMove); break; @@ -3378,7 +3353,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) if (gBattleMsgDataPtr->originallyUsedMove >= MOVES_COUNT && !IsZMove(gBattleMsgDataPtr->currentMove) && !IsMaxMove(gBattleMsgDataPtr->currentMove)) - toCpy = sATypeMove_Table[gBattleStruct->stringMoveType]; + toCpy = gTypesInfo[gBattleStruct->stringMoveType].generic; else toCpy = GetMoveName(gBattleMsgDataPtr->originallyUsedMove); break; @@ -3762,7 +3737,7 @@ void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst) srcID += 3; break; case B_BUFF_TYPE: // type name - StringAppend(dst, gTypeNames[src[srcID + 1]]); + StringAppend(dst, gTypesInfo[src[srcID + 1]].name); srcID += 2; break; case B_BUFF_MON_NICK_WITH_PREFIX: // poke nick with prefix diff --git a/src/battle_z_move.c b/src/battle_z_move.c index b2377bffd4..f0d2938b8e 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -553,7 +553,7 @@ static void ZMoveSelectionDisplayMoveType(u16 zMove, u32 battler) *(txtPtr)++ = EXT_CTRL_CODE_FONT; *(txtPtr)++ = FONT_NORMAL; - StringCopy(txtPtr, gTypeNames[zMoveType]); + StringCopy(txtPtr, gTypesInfo[zMoveType].name); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE); } diff --git a/src/data/union_room.h b/src/data/union_room.h index f32910388b..89b57c3d39 100644 --- a/src/data/union_room.h +++ b/src/data/union_room.h @@ -868,24 +868,24 @@ static const struct WindowTemplate sWindowTemplate_TradingBoardRequestType = { }; static const struct ListMenuItem sTradingBoardTypes[NUMBER_OF_MON_TYPES] = { - { gTypeNames[TYPE_NORMAL], TYPE_NORMAL }, - { gTypeNames[TYPE_FIRE], TYPE_FIRE }, - { gTypeNames[TYPE_WATER], TYPE_WATER }, - { gTypeNames[TYPE_ELECTRIC], TYPE_ELECTRIC }, - { gTypeNames[TYPE_GRASS], TYPE_GRASS }, - { gTypeNames[TYPE_ICE], TYPE_ICE }, - { gTypeNames[TYPE_GROUND], TYPE_GROUND }, - { gTypeNames[TYPE_ROCK], TYPE_ROCK }, - { gTypeNames[TYPE_FLYING], TYPE_FLYING }, - { gTypeNames[TYPE_PSYCHIC], TYPE_PSYCHIC }, - { gTypeNames[TYPE_FIGHTING], TYPE_FIGHTING }, - { gTypeNames[TYPE_POISON], TYPE_POISON }, - { gTypeNames[TYPE_BUG], TYPE_BUG }, - { gTypeNames[TYPE_GHOST], TYPE_GHOST }, - { gTypeNames[TYPE_DRAGON], TYPE_DRAGON }, - { gTypeNames[TYPE_STEEL], TYPE_STEEL }, - { gTypeNames[TYPE_DARK], TYPE_DARK }, - { gTypeNames[TYPE_FAIRY], TYPE_FAIRY }, + { gTypesInfo[TYPE_NORMAL].name, TYPE_NORMAL }, + { gTypesInfo[TYPE_FIRE].name, TYPE_FIRE }, + { gTypesInfo[TYPE_WATER].name, TYPE_WATER }, + { gTypesInfo[TYPE_ELECTRIC].name, TYPE_ELECTRIC }, + { gTypesInfo[TYPE_GRASS].name, TYPE_GRASS }, + { gTypesInfo[TYPE_ICE].name, TYPE_ICE }, + { gTypesInfo[TYPE_GROUND].name, TYPE_GROUND }, + { gTypesInfo[TYPE_ROCK].name, TYPE_ROCK }, + { gTypesInfo[TYPE_FLYING].name, TYPE_FLYING }, + { gTypesInfo[TYPE_PSYCHIC].name, TYPE_PSYCHIC }, + { gTypesInfo[TYPE_FIGHTING].name, TYPE_FIGHTING }, + { gTypesInfo[TYPE_POISON].name, TYPE_POISON }, + { gTypesInfo[TYPE_BUG].name, TYPE_BUG }, + { gTypesInfo[TYPE_GHOST].name, TYPE_GHOST }, + { gTypesInfo[TYPE_DRAGON].name, TYPE_DRAGON }, + { gTypesInfo[TYPE_STEEL].name, TYPE_STEEL }, + { gTypesInfo[TYPE_DARK].name, TYPE_DARK }, + { gTypesInfo[TYPE_FAIRY].name, TYPE_FAIRY }, { sText_Exit, NUMBER_OF_MON_TYPES } }; diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 85d78abc1c..fcb65d9ae7 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -777,7 +777,7 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove) return; } move = &gMovesInfo[chosenMove]; - str = gTypeNames[move->type]; + str = gTypesInfo[move->type].name; AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, 4, 25, TEXT_SKIP_DRAW, NULL); x = 4 + GetStringWidth(FONT_NORMAL, gText_MoveRelearnerPP, 0); diff --git a/src/pokedex.c b/src/pokedex.c index 74a95aa1d7..8a559602dd 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1390,24 +1390,24 @@ static const struct SearchOptionText sDexSearchColorOptions[] = static const struct SearchOptionText sDexSearchTypeOptions[NUMBER_OF_MON_TYPES + 1] = // + 2 for "None" and terminator, - 1 for Mystery { {gText_DexEmptyString, gText_DexSearchTypeNone}, - {gText_DexEmptyString, gTypeNames[TYPE_NORMAL]}, - {gText_DexEmptyString, gTypeNames[TYPE_FIGHTING]}, - {gText_DexEmptyString, gTypeNames[TYPE_FLYING]}, - {gText_DexEmptyString, gTypeNames[TYPE_POISON]}, - {gText_DexEmptyString, gTypeNames[TYPE_GROUND]}, - {gText_DexEmptyString, gTypeNames[TYPE_ROCK]}, - {gText_DexEmptyString, gTypeNames[TYPE_BUG]}, - {gText_DexEmptyString, gTypeNames[TYPE_GHOST]}, - {gText_DexEmptyString, gTypeNames[TYPE_STEEL]}, - {gText_DexEmptyString, gTypeNames[TYPE_FIRE]}, - {gText_DexEmptyString, gTypeNames[TYPE_WATER]}, - {gText_DexEmptyString, gTypeNames[TYPE_GRASS]}, - {gText_DexEmptyString, gTypeNames[TYPE_ELECTRIC]}, - {gText_DexEmptyString, gTypeNames[TYPE_PSYCHIC]}, - {gText_DexEmptyString, gTypeNames[TYPE_ICE]}, - {gText_DexEmptyString, gTypeNames[TYPE_DRAGON]}, - {gText_DexEmptyString, gTypeNames[TYPE_DARK]}, - {gText_DexEmptyString, gTypeNames[TYPE_FAIRY]}, + {gText_DexEmptyString, gTypesInfo[TYPE_NORMAL].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_FIGHTING].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_FLYING].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_POISON].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_GROUND].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_ROCK].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_BUG].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_GHOST].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_STEEL].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_FIRE].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_WATER].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_GRASS].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_ELECTRIC].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_PSYCHIC].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_ICE].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_DRAGON].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_DARK].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_FAIRY].name}, {}, }; diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index 4910fe6e66..9d4dc13d87 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -1953,24 +1953,24 @@ static const struct SearchOptionText sDexSearchColorOptions[] = static const struct SearchOptionText sDexSearchTypeOptions[NUMBER_OF_MON_TYPES + 1] = // + 2 for "None" and terminator, - 1 for Mystery { {gText_DexEmptyString, gText_DexSearchTypeNone}, - {gText_DexEmptyString, gTypeNames[TYPE_NORMAL]}, - {gText_DexEmptyString, gTypeNames[TYPE_FIGHTING]}, - {gText_DexEmptyString, gTypeNames[TYPE_FLYING]}, - {gText_DexEmptyString, gTypeNames[TYPE_POISON]}, - {gText_DexEmptyString, gTypeNames[TYPE_GROUND]}, - {gText_DexEmptyString, gTypeNames[TYPE_ROCK]}, - {gText_DexEmptyString, gTypeNames[TYPE_BUG]}, - {gText_DexEmptyString, gTypeNames[TYPE_GHOST]}, - {gText_DexEmptyString, gTypeNames[TYPE_STEEL]}, - {gText_DexEmptyString, gTypeNames[TYPE_FIRE]}, - {gText_DexEmptyString, gTypeNames[TYPE_WATER]}, - {gText_DexEmptyString, gTypeNames[TYPE_GRASS]}, - {gText_DexEmptyString, gTypeNames[TYPE_ELECTRIC]}, - {gText_DexEmptyString, gTypeNames[TYPE_PSYCHIC]}, - {gText_DexEmptyString, gTypeNames[TYPE_ICE]}, - {gText_DexEmptyString, gTypeNames[TYPE_DRAGON]}, - {gText_DexEmptyString, gTypeNames[TYPE_DARK]}, - {gText_DexEmptyString, gTypeNames[TYPE_FAIRY]}, + {gText_DexEmptyString, gTypesInfo[TYPE_NORMAL].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_FIGHTING].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_FLYING].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_POISON].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_GROUND].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_ROCK].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_BUG].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_GHOST].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_STEEL].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_FIRE].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_WATER].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_GRASS].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_ELECTRIC].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_PSYCHIC].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_ICE].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_DRAGON].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_DARK].name}, + {gText_DexEmptyString, gTypesInfo[TYPE_FAIRY].name}, {}, }; @@ -4364,36 +4364,13 @@ static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible) { gSprites[sPokedexView->typeIconSpriteIds[spriteArrayId]].invisible = invisible; } -// different from pokemon_summary_screen -#define TYPE_ICON_PAL_NUM_0 13 -#define TYPE_ICON_PAL_NUM_1 14 -#define TYPE_ICON_PAL_NUM_2 15 -static const u8 sMoveTypeToOamPaletteNum[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT] = +static const u8 sContestCategoryToOamPaletteNum[CONTEST_CATEGORIES_COUNT] = { - [TYPE_NORMAL] = TYPE_ICON_PAL_NUM_0, - [TYPE_FIGHTING] = TYPE_ICON_PAL_NUM_0, - [TYPE_FLYING] = TYPE_ICON_PAL_NUM_1, - [TYPE_POISON] = TYPE_ICON_PAL_NUM_1, - [TYPE_GROUND] = TYPE_ICON_PAL_NUM_0, - [TYPE_ROCK] = TYPE_ICON_PAL_NUM_0, - [TYPE_BUG] = TYPE_ICON_PAL_NUM_2, - [TYPE_GHOST] = TYPE_ICON_PAL_NUM_1, - [TYPE_STEEL] = TYPE_ICON_PAL_NUM_0, - [TYPE_MYSTERY] = TYPE_ICON_PAL_NUM_2, - [TYPE_FIRE] = TYPE_ICON_PAL_NUM_0, - [TYPE_WATER] = TYPE_ICON_PAL_NUM_1, - [TYPE_GRASS] = TYPE_ICON_PAL_NUM_2, - [TYPE_ELECTRIC] = TYPE_ICON_PAL_NUM_0, - [TYPE_PSYCHIC] = TYPE_ICON_PAL_NUM_1, - [TYPE_ICE] = TYPE_ICON_PAL_NUM_1, - [TYPE_DRAGON] = TYPE_ICON_PAL_NUM_2, - [TYPE_DARK] = TYPE_ICON_PAL_NUM_0, - [TYPE_FAIRY] = TYPE_ICON_PAL_NUM_1, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_COOL] = TYPE_ICON_PAL_NUM_0, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_BEAUTY] = TYPE_ICON_PAL_NUM_1, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_CUTE] = TYPE_ICON_PAL_NUM_1, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_SMART] = TYPE_ICON_PAL_NUM_2, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_TOUGH] = TYPE_ICON_PAL_NUM_0, + [CONTEST_CATEGORY_COOL] = 13, + [CONTEST_CATEGORY_BEAUTY] = 14, + [CONTEST_CATEGORY_CUTE] = 14, + [CONTEST_CATEGORY_SMART] = 15, + [CONTEST_CATEGORY_TOUGH] = 13, }; static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) { @@ -4401,7 +4378,10 @@ static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) sprite = &gSprites[sPokedexView->typeIconSpriteIds[spriteArrayId]]; StartSpriteAnim(sprite, typeId); - sprite->oam.paletteNum = sMoveTypeToOamPaletteNum[typeId]; + if (typeId < NUMBER_OF_MON_TYPES) + sprite->oam.paletteNum = gTypesInfo[typeId].palette; + else + sprite->oam.paletteNum = sContestCategoryToOamPaletteNum[typeId - NUMBER_OF_MON_TYPES]; sprite->x = x + 16; sprite->y = y + 8; SetSpriteInvisibility(spriteArrayId, FALSE); @@ -6583,7 +6563,7 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, StringExpandPlaceholders(gStringVar4, sText_EVO_MOVE ); break; case EVO_FRIENDSHIP_MOVE_TYPE: - StringCopy(gStringVar2, gTypeNames[evolutions[i].param]); + StringCopy(gStringVar2, gTypesInfo[evolutions[i].param].name); StringExpandPlaceholders(gStringVar4, sText_EVO_FRIENDSHIP_MOVE_TYPE ); break; case EVO_MAPSEC: diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e3850e6b4e..f5c2e7f6b7 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -954,32 +954,13 @@ const struct SpriteTemplate gSpriteTemplate_MoveTypes = .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -static const u8 sMoveTypeToOamPaletteNum[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT] = +static const u8 sContestCategoryToOamPaletteNum[CONTEST_CATEGORIES_COUNT] = { - [TYPE_NORMAL] = 13, - [TYPE_FIGHTING] = 13, - [TYPE_FLYING] = 14, - [TYPE_POISON] = 14, - [TYPE_GROUND] = 13, - [TYPE_ROCK] = 13, - [TYPE_BUG] = 15, - [TYPE_GHOST] = 14, - [TYPE_STEEL] = 13, - [TYPE_MYSTERY] = 15, - [TYPE_FIRE] = 13, - [TYPE_WATER] = 14, - [TYPE_GRASS] = 15, - [TYPE_ELECTRIC] = 13, - [TYPE_PSYCHIC] = 14, - [TYPE_ICE] = 14, - [TYPE_DRAGON] = 15, - [TYPE_DARK] = 13, - [TYPE_FAIRY] = 14, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_COOL] = 13, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_BEAUTY] = 14, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_CUTE] = 14, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_SMART] = 15, - [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_TOUGH] = 13, + [CONTEST_CATEGORY_COOL] = 13, + [CONTEST_CATEGORY_BEAUTY] = 14, + [CONTEST_CATEGORY_CUTE] = 14, + [CONTEST_CATEGORY_SMART] = 15, + [CONTEST_CATEGORY_TOUGH] = 13, }; static const struct OamData sOamData_MoveSelector = { @@ -3919,7 +3900,10 @@ void SetTypeSpritePosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) { struct Sprite *sprite = &gSprites[sMonSummaryScreen->spriteIds[spriteArrayId]]; StartSpriteAnim(sprite, typeId); - sprite->oam.paletteNum = sMoveTypeToOamPaletteNum[typeId]; + if (typeId < NUMBER_OF_MON_TYPES) + sprite->oam.paletteNum = gTypesInfo[typeId].palette; + else + sprite->oam.paletteNum = sContestCategoryToOamPaletteNum[typeId - NUMBER_OF_MON_TYPES]; sprite->x = x + 16; sprite->y = y + 8; SetSpriteInvisibility(spriteArrayId, FALSE); diff --git a/src/union_room.c b/src/union_room.c index d71d3edad1..f4ee01d1b4 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -3184,12 +3184,12 @@ static void Task_RunUnionRoom(u8 taskId) break; case UR_TRADE_NOTYPE: CopyAndTranslatePlayerName(gStringVar1, &uroom->playerList->players[input]); - StringCopy(gStringVar2, gTypeNames[uroom->playerList->players[input].rfu.data.tradeType]); + StringCopy(gStringVar2, gTypesInfo[uroom->playerList->players[input].rfu.data.tradeType].name); ScheduleFieldMessageWithFollowupState(UR_STATE_TRADING_BOARD_LOAD, sText_DontHaveTypeTrainerWants); break; case UR_TRADE_NOEGG: CopyAndTranslatePlayerName(gStringVar1, &uroom->playerList->players[input]); - StringCopy(gStringVar2, gTypeNames[uroom->playerList->players[input].rfu.data.tradeType]); + StringCopy(gStringVar2, gTypesInfo[uroom->playerList->players[input].rfu.data.tradeType].name); ScheduleFieldMessageWithFollowupState(UR_STATE_TRADING_BOARD_LOAD, sText_DontHaveEggTrainerWants); break; }