Skip to content

Commit

Permalink
Consolidate type properties (#4185)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
fdeblasio authored Mar 12, 2024
1 parent a741e2e commit 2f4203b
Show file tree
Hide file tree
Showing 14 changed files with 390 additions and 195 deletions.
2 changes: 1 addition & 1 deletion include/battle_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
16 changes: 16 additions & 0 deletions include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[];

Expand Down
2 changes: 1 addition & 1 deletion src/battle_controller_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/battle_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
29 changes: 3 additions & 26 deletions src/battle_dynamax.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 2f4203b

Please sign in to comment.