Skip to content
Open
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
12 changes: 11 additions & 1 deletion include/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,19 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosit
#define GetMonData(...) CAT(GetMonData, NARG_8(__VA_ARGS__))(__VA_ARGS__)
#define GetBoxMonData(...) CAT(GetBoxMonData, NARG_8(__VA_ARGS__))(__VA_ARGS__)
u32 GetMonData3(struct Pokemon *mon, s32 field, u8 *data);
u32 GetMonData2(struct Pokemon *mon, s32 field);
u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data);

#ifndef UBFIX
u32 GetMonData2(struct Pokemon *mon, s32 field);
u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field);
#else
inline u32 GetMonData2(struct Pokemon *mon, s32 field) {
return GetMonData3(mon, field, NULL);
}
inline u32 GetBoxMonData2(struct BoxPokemon *mon, s32 field) {
return GetBoxMonData3(mon, field, NULL);
}
#endif

void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg);
void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg);
Expand Down
5 changes: 5 additions & 0 deletions src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2967,7 +2967,10 @@ u32 GetMonData3(struct Pokemon *mon, s32 field, u8 *data)
return ret;
}

#ifndef UBFIX
u32 GetMonData2(struct Pokemon *mon, s32 field) __attribute__((alias("GetMonData3")));
#endif


/* GameFreak called GetBoxMonData with either 2 or 3 arguments, for type
* safety we have a GetBoxMonData macro (in include/pokemon.h) which
Expand Down Expand Up @@ -3329,7 +3332,9 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data)
return retVal;
}

#ifndef UBFIX
u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field) __attribute__((alias("GetBoxMonData3")));
#endif

#define SET8(lhs) (lhs) = *data
#define SET16(lhs) (lhs) = data[0] + (data[1] << 8)
Expand Down