Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unwind TRAINER_CLASS macro #5611

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 67 additions & 75 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,83 +304,75 @@ static const s8 sCenterToCornerVecXs[8] ={-32, -16, -16, -32, -32};

#include "data/types_info.h"

// extra args are money and ball
#define TRAINER_CLASS(trainerClass, trainerName, ...) \
[trainerClass] = \
{ \
.name = _(trainerName), \
.money = DEFAULT(5, __VA_ARGS__), \
.ball = DEFAULT_2(ITEM_POKE_BALL, __VA_ARGS__), \
}

// [TRAINER_CLASS_XYZ] = { _("name"), <money=5>, <ball=BALL_POKE> }
const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT] =
{
TRAINER_CLASS(TRAINER_CLASS_PKMN_TRAINER_1, "{PKMN} TRAINER"),
TRAINER_CLASS(TRAINER_CLASS_PKMN_TRAINER_2, "{PKMN} TRAINER"),
TRAINER_CLASS(TRAINER_CLASS_HIKER, "HIKER", 10),
TRAINER_CLASS(TRAINER_CLASS_TEAM_AQUA, "TEAM AQUA"),
TRAINER_CLASS(TRAINER_CLASS_PKMN_BREEDER, "{PKMN} BREEDER", 10, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? BALL_HEAL : BALL_FRIEND),
TRAINER_CLASS(TRAINER_CLASS_COOLTRAINER, "COOLTRAINER", 12, BALL_ULTRA),
TRAINER_CLASS(TRAINER_CLASS_BIRD_KEEPER, "BIRD KEEPER", 8),
TRAINER_CLASS(TRAINER_CLASS_COLLECTOR, "COLLECTOR", 15, BALL_PREMIER),
TRAINER_CLASS(TRAINER_CLASS_SWIMMER_M, "SWIMMER♂", 2, BALL_DIVE),
TRAINER_CLASS(TRAINER_CLASS_TEAM_MAGMA, "TEAM MAGMA"),
TRAINER_CLASS(TRAINER_CLASS_EXPERT, "EXPERT", 10),
TRAINER_CLASS(TRAINER_CLASS_AQUA_ADMIN, "AQUA ADMIN", 10),
TRAINER_CLASS(TRAINER_CLASS_BLACK_BELT, "BLACK BELT", 8, BALL_ULTRA),
TRAINER_CLASS(TRAINER_CLASS_AQUA_LEADER, "AQUA LEADER", 20, BALL_MASTER),
TRAINER_CLASS(TRAINER_CLASS_HEX_MANIAC, "HEX MANIAC", 6),
TRAINER_CLASS(TRAINER_CLASS_AROMA_LADY, "AROMA LADY", 10),
TRAINER_CLASS(TRAINER_CLASS_RUIN_MANIAC, "RUIN MANIAC", 15),
TRAINER_CLASS(TRAINER_CLASS_INTERVIEWER, "INTERVIEWER", 12),
TRAINER_CLASS(TRAINER_CLASS_TUBER_F, "TUBER", 1),
TRAINER_CLASS(TRAINER_CLASS_TUBER_M, "TUBER", 1),
TRAINER_CLASS(TRAINER_CLASS_LADY, "LADY", 50),
TRAINER_CLASS(TRAINER_CLASS_BEAUTY, "BEAUTY", 20),
TRAINER_CLASS(TRAINER_CLASS_RICH_BOY, "RICH BOY", 50),
TRAINER_CLASS(TRAINER_CLASS_POKEMANIAC, "POKéMANIAC", 15),
TRAINER_CLASS(TRAINER_CLASS_GUITARIST, "GUITARIST", 8),
TRAINER_CLASS(TRAINER_CLASS_KINDLER, "KINDLER", 8),
TRAINER_CLASS(TRAINER_CLASS_CAMPER, "CAMPER", 4),
TRAINER_CLASS(TRAINER_CLASS_PICNICKER, "PICNICKER", 4),
TRAINER_CLASS(TRAINER_CLASS_BUG_MANIAC, "BUG MANIAC", 15),
TRAINER_CLASS(TRAINER_CLASS_PSYCHIC, "PSYCHIC", 6),
TRAINER_CLASS(TRAINER_CLASS_GENTLEMAN, "GENTLEMAN", 20, BALL_LUXURY),
TRAINER_CLASS(TRAINER_CLASS_ELITE_FOUR, "ELITE FOUR", 25, BALL_ULTRA),
TRAINER_CLASS(TRAINER_CLASS_LEADER, "LEADER", 25),
TRAINER_CLASS(TRAINER_CLASS_SCHOOL_KID, "SCHOOL KID"),
TRAINER_CLASS(TRAINER_CLASS_SR_AND_JR, "SR. AND JR.", 4),
TRAINER_CLASS(TRAINER_CLASS_WINSTRATE, "WINSTRATE", 10),
TRAINER_CLASS(TRAINER_CLASS_POKEFAN, "POKéFAN", 20),
TRAINER_CLASS(TRAINER_CLASS_YOUNGSTER, "YOUNGSTER", 4),
TRAINER_CLASS(TRAINER_CLASS_CHAMPION, "CHAMPION", 50),
TRAINER_CLASS(TRAINER_CLASS_FISHERMAN, "FISHERMAN", 10, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? BALL_DIVE : BALL_LURE),
TRAINER_CLASS(TRAINER_CLASS_TRIATHLETE, "TRIATHLETE", 10),
TRAINER_CLASS(TRAINER_CLASS_DRAGON_TAMER, "DRAGON TAMER", 12),
TRAINER_CLASS(TRAINER_CLASS_NINJA_BOY, "NINJA BOY", 3),
TRAINER_CLASS(TRAINER_CLASS_BATTLE_GIRL, "BATTLE GIRL", 6),
TRAINER_CLASS(TRAINER_CLASS_PARASOL_LADY, "PARASOL LADY", 10),
TRAINER_CLASS(TRAINER_CLASS_SWIMMER_F, "SWIMMER♀", 2, BALL_DIVE),
TRAINER_CLASS(TRAINER_CLASS_TWINS, "TWINS", 3),
TRAINER_CLASS(TRAINER_CLASS_SAILOR, "SAILOR", 8),
TRAINER_CLASS(TRAINER_CLASS_COOLTRAINER_2, "COOLTRAINER", 5, BALL_ULTRA),
TRAINER_CLASS(TRAINER_CLASS_MAGMA_ADMIN, "MAGMA ADMIN", 10),
TRAINER_CLASS(TRAINER_CLASS_RIVAL, "{PKMN} TRAINER", 15),
TRAINER_CLASS(TRAINER_CLASS_BUG_CATCHER, "BUG CATCHER", 4),
TRAINER_CLASS(TRAINER_CLASS_PKMN_RANGER, "{PKMN} RANGER", 12),
TRAINER_CLASS(TRAINER_CLASS_MAGMA_LEADER, "MAGMA LEADER", 20, BALL_MASTER),
TRAINER_CLASS(TRAINER_CLASS_LASS, "LASS", 4),
TRAINER_CLASS(TRAINER_CLASS_YOUNG_COUPLE, "YOUNG COUPLE", 8),
TRAINER_CLASS(TRAINER_CLASS_OLD_COUPLE, "OLD COUPLE", 10),
TRAINER_CLASS(TRAINER_CLASS_SIS_AND_BRO, "SIS AND BRO", 3),
TRAINER_CLASS(TRAINER_CLASS_SALON_MAIDEN, "SALON MAIDEN"),
TRAINER_CLASS(TRAINER_CLASS_DOME_ACE, "DOME ACE"),
TRAINER_CLASS(TRAINER_CLASS_PALACE_MAVEN, "PALACE MAVEN"),
TRAINER_CLASS(TRAINER_CLASS_ARENA_TYCOON, "ARENA TYCOON"),
TRAINER_CLASS(TRAINER_CLASS_FACTORY_HEAD, "FACTORY HEAD"),
TRAINER_CLASS(TRAINER_CLASS_PIKE_QUEEN, "PIKE QUEEN"),
TRAINER_CLASS(TRAINER_CLASS_PYRAMID_KING, "PYRAMID KING"),
TRAINER_CLASS(TRAINER_CLASS_RS_PROTAG, "{PKMN} TRAINER"),
[TRAINER_CLASS_PKMN_TRAINER_1] = { _("{PKMN} TRAINER") },
[TRAINER_CLASS_PKMN_TRAINER_2] = { _("{PKMN} TRAINER") },
[TRAINER_CLASS_HIKER] = { _("HIKER"), 10 },
[TRAINER_CLASS_TEAM_AQUA] = { _("TEAM AQUA") },
[TRAINER_CLASS_PKMN_BREEDER] = { _("{PKMN} BREEDER"), 10, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? BALL_HEAL : BALL_FRIEND },
[TRAINER_CLASS_COOLTRAINER] = { _("COOLTRAINER"), 12, BALL_ULTRA },
[TRAINER_CLASS_BIRD_KEEPER] = { _("BIRD KEEPER"), 8 },
[TRAINER_CLASS_COLLECTOR] = { _("COLLECTOR"), 15, BALL_PREMIER },
[TRAINER_CLASS_SWIMMER_M] = { _("SWIMMER♂"), 2, BALL_DIVE },
[TRAINER_CLASS_TEAM_MAGMA] = { _("TEAM MAGMA") },
[TRAINER_CLASS_EXPERT] = { _("EXPERT"), 10 },
[TRAINER_CLASS_AQUA_ADMIN] = { _("AQUA ADMIN"), 10 },
[TRAINER_CLASS_BLACK_BELT] = { _("BLACK BELT"), 8, BALL_ULTRA },
[TRAINER_CLASS_AQUA_LEADER] = { _("AQUA LEADER"), 20, BALL_MASTER },
[TRAINER_CLASS_HEX_MANIAC] = { _("HEX MANIAC"), 6 },
[TRAINER_CLASS_AROMA_LADY] = { _("AROMA LADY"), 10 },
[TRAINER_CLASS_RUIN_MANIAC] = { _("RUIN MANIAC"), 15 },
[TRAINER_CLASS_INTERVIEWER] = { _("INTERVIEWER"), 12 },
[TRAINER_CLASS_TUBER_F] = { _("TUBER"), 1 },
[TRAINER_CLASS_TUBER_M] = { _("TUBER"), 1 },
[TRAINER_CLASS_LADY] = { _("LADY"), 50 },
[TRAINER_CLASS_BEAUTY] = { _("BEAUTY"), 20 },
[TRAINER_CLASS_RICH_BOY] = { _("RICH BOY"), 50 },
[TRAINER_CLASS_POKEMANIAC] = { _("POKéMANIAC"), 15 },
[TRAINER_CLASS_GUITARIST] = { _("GUITARIST"), 8 },
[TRAINER_CLASS_KINDLER] = { _("KINDLER"), 8 },
[TRAINER_CLASS_CAMPER] = { _("CAMPER"), 4 },
[TRAINER_CLASS_PICNICKER] = { _("PICNICKER"), 4 },
[TRAINER_CLASS_BUG_MANIAC] = { _("BUG MANIAC"), 15 },
[TRAINER_CLASS_PSYCHIC] = { _("PSYCHIC"), 6 },
[TRAINER_CLASS_GENTLEMAN] = { _("GENTLEMAN"), 20, BALL_LUXURY },
[TRAINER_CLASS_ELITE_FOUR] = { _("ELITE FOUR"), 25, BALL_ULTRA },
[TRAINER_CLASS_LEADER] = { _("LEADER"), 25 },
[TRAINER_CLASS_SCHOOL_KID] = { _("SCHOOL KID") },
[TRAINER_CLASS_SR_AND_JR] = { _("SR. AND JR."), 4 },
[TRAINER_CLASS_WINSTRATE] = { _("WINSTRATE"), 10 },
[TRAINER_CLASS_POKEFAN] = { _("POKéFAN"), 20 },
[TRAINER_CLASS_YOUNGSTER] = { _("YOUNGSTER"), 4 },
[TRAINER_CLASS_CHAMPION] = { _("CHAMPION"), 50 },
[TRAINER_CLASS_FISHERMAN] = { _("FISHERMAN"), 10, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? BALL_DIVE : BALL_LURE },
[TRAINER_CLASS_TRIATHLETE] = { _("TRIATHLETE"), 10 },
[TRAINER_CLASS_DRAGON_TAMER] = { _("DRAGON TAMER"), 12 },
[TRAINER_CLASS_NINJA_BOY] = { _("NINJA BOY"), 3 },
[TRAINER_CLASS_BATTLE_GIRL] = { _("BATTLE GIRL"), 6 },
[TRAINER_CLASS_PARASOL_LADY] = { _("PARASOL LADY"), 10 },
[TRAINER_CLASS_SWIMMER_F] = { _("SWIMMER♀"), 2, BALL_DIVE },
[TRAINER_CLASS_TWINS] = { _("TWINS"), 3 },
[TRAINER_CLASS_SAILOR] = { _("SAILOR"), 8 },
[TRAINER_CLASS_COOLTRAINER_2] = { _("COOLTRAINER"), 5, BALL_ULTRA },
[TRAINER_CLASS_MAGMA_ADMIN] = { _("MAGMA ADMIN"), 10 },
[TRAINER_CLASS_RIVAL] = { _("{PKMN} TRAINER"), 15 },
[TRAINER_CLASS_BUG_CATCHER] = { _("BUG CATCHER"), 4 },
[TRAINER_CLASS_PKMN_RANGER] = { _("{PKMN} RANGER"), 12 },
[TRAINER_CLASS_MAGMA_LEADER] = { _("MAGMA LEADER"), 20, BALL_MASTER },
[TRAINER_CLASS_LASS] = { _("LASS"), 4 },
[TRAINER_CLASS_YOUNG_COUPLE] = { _("YOUNG COUPLE"), 8 },
[TRAINER_CLASS_OLD_COUPLE] = { _("OLD COUPLE"), 10 },
[TRAINER_CLASS_SIS_AND_BRO] = { _("SIS AND BRO"), 3 },
[TRAINER_CLASS_SALON_MAIDEN] = { _("SALON MAIDEN") },
[TRAINER_CLASS_DOME_ACE] = { _("DOME ACE") },
[TRAINER_CLASS_PALACE_MAVEN] = { _("PALACE MAVEN") },
[TRAINER_CLASS_ARENA_TYCOON] = { _("ARENA TYCOON") },
[TRAINER_CLASS_FACTORY_HEAD] = { _("FACTORY HEAD") },
[TRAINER_CLASS_PIKE_QUEEN] = { _("PIKE QUEEN") },
[TRAINER_CLASS_PYRAMID_KING] = { _("PYRAMID KING") },
[TRAINER_CLASS_RS_PROTAG] = { _("{PKMN} TRAINER") },
};

static void (* const sTurnActionsFuncsTable[])(void) =
Expand Down
2 changes: 1 addition & 1 deletion src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -7852,7 +7852,7 @@ static u32 GetTrainerMoneyToGive(u16 trainerId)
if (party == NULL)
return 20;
lastMonLevel = party[GetTrainerPartySizeFromId(trainerId) - 1].lvl;
trainerMoney = gTrainerClasses[GetTrainerClassFromId(trainerId)].money;
trainerMoney = gTrainerClasses[GetTrainerClassFromId(trainerId)].money ?: 5;

if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
moneyReward = 4 * lastMonLevel * gBattleStruct->moneyMultiplier * trainerMoney;
Expand Down
Loading