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

Backwards-compatible BoxPokémon Refactor #3438

Merged
merged 9 commits into from
Dec 27, 2023
30 changes: 30 additions & 0 deletions asm/macros/event.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2025,3 +2025,33 @@
callnative CreateTrainerPartyForPlayer
trainerbattle_no_intro \trainer2, NULL
.endm

@ Sets VAR_RESULT to TRUE if stat can be hyper trained, or to
@ FALSE otherwise.
.macro canhypertrain stat:req, slot:req
callnative CanHyperTrain
.byte \stat
.2byte \slot
.endm

@ Hyper Trains a stat.
.macro hypertrain stat:req, slot:req
callnative HyperTrain
.byte \stat
.2byte \slot
.endm

@ Sets VAR_RESULT to TRUE if the Pokemon has the Gigantamax Factor,
@ or to FALSE otherwise.
.macro hasgigantamaxfactor slot:req
callnative HasGigantamaxFactor
.2byte \slot
.endm

@ Toggles the Gigantamax Factor for a Pokemon.
@ Fails for Melmetal (vanilla behavior).
@ Sets VAR_RESULT to TRUE if it succeeds, and FALSE otherwise.
.macro togglegigantamaxfactor slot:req
callnative ToggleGigantamaxFactor
.2byte \slot
.endm
4 changes: 2 additions & 2 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct ResourceFlags
struct DisableStruct
{
u32 transformedMonPersonality;
u32 transformedMonOtId;
bool8 transformedMonShininess;
u16 disabledMove;
u16 encoredMove;
u8 protectUses:4;
Expand Down Expand Up @@ -1066,7 +1066,7 @@ extern u8 gBattlerStatusSummaryTaskId[MAX_BATTLERS_COUNT];
extern u8 gBattlerInMenuId;
extern bool8 gDoingBattleAnim;
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
extern u32 gTransformedOtIds[MAX_BATTLERS_COUNT];
extern bool8 gTransformedShininess[MAX_BATTLERS_COUNT];
extern u8 gPlayerDpadHoldFrames;
extern struct BattleSpriteData *gBattleSpritesDataPtr;
extern struct MonSpritesGfx *gMonSpritesGfxPtr;
Expand Down
2 changes: 1 addition & 1 deletion include/battle_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union Aff
bool8 RunAffineAnimFromTaskData(struct Task *task);
void AnimThrowProjectile(struct Sprite *sprite);
void GetBgDataForTransform(struct BattleAnimBgData *dest, u8 battlerId);
u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId);
u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, bool8 isShiny, u32 battlerId);
void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite);
void Trade_MoveSelectedMonToTarget(struct Sprite *sprite);
void DestroyAnimVisualTaskAndDisableBlend(u8 taskId);
Expand Down
1 change: 1 addition & 0 deletions include/config/overworld.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// PC settings
#define OW_PC_PRESS_B GEN_LATEST // In Gen4, pressing B when holding a Pokémon is equivalent to placing it. In Gen3, it gives the "You're holding a Pokémon!" error.
#define OW_PC_JAPAN_WALDA_ICONS TRUE // In the US release of Emerald, the Cross, Bolt, and Plusle icons for Walda's wallpapers were left blank from the Japan release. Setting this to TRUE will restore them.
#define OW_PC_HEAL GEN_LATEST // In Gen8+, Pokémon are not healed when deposited in the PC.

// Out-of-battle Ability effects
#define OW_SYNCHRONIZE_NATURE GEN_LATEST // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same Nature, as opposed to 50% previously. Stationary Pokémon are excluded in Gen3. In Gen6, all No Eggs Discovered gift Pokémon will have the same Nature, while in Gen7 all gift Pokémon will, regardless of Egg Group - In Gen 8, no gift Pokémon are affected. In Gen9, this ability has no out-of-battle effect.
Expand Down
1 change: 1 addition & 0 deletions include/config/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs.
#define P_EV_CAP GEN_LATEST // Since Gen 6, the max EVs per stat is 252 instead of 255.
#define P_CATCH_CURVE GEN_LATEST // Since Gen 6, the capture rate curve was changed to make pokeballs more effective on lower level pokemon
#define P_SHOW_TERA_TYPE GEN_LATEST // Since Gen 9, the Tera Type is shown on the summary screen.

// Flag settings
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
Expand Down
5 changes: 4 additions & 1 deletion include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@
#define B_OUTCOME_LINK_BATTLE_RAN (1 << 7) // 128

// Non-volatile status conditions
// These persist remain outside of battle and after switching out
// These remain outside of battle and after switching out.
// If a new STATUS1 is added here, it should also be added to
// sCompressedStatuses in src/pokemon.c or else it will be lost outside
// of battle.
#define STATUS1_NONE 0
#define STATUS1_SLEEP (1 << 0 | 1 << 1 | 1 << 2) // First 3 bits (Number of turns to sleep)
#define STATUS1_SLEEP_TURN(num) ((num) << 0) // Just for readability (or if rearranging statuses)
Expand Down
2 changes: 2 additions & 0 deletions include/constants/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#define VERSION_PLATINUM 12
#define VERSION_GAMECUBE 15

#define NUM_VERSIONS 15

#define LANGUAGE_JAPANESE 1
#define LANGUAGE_ENGLISH 2
#define LANGUAGE_FRENCH 3
Expand Down
2 changes: 2 additions & 0 deletions include/constants/moves.h
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,8 @@

#define MOVES_COUNT_DYNAMAX (LAST_MAX_MOVE + 1)

#define MOVES_COUNT_ALL MOVES_COUNT_DYNAMAX

// Used for checks for moves affected by Disable, Mimic, etc.
#define MOVE_UNAVAILABLE 0xFFFF

Expand Down
2 changes: 2 additions & 0 deletions include/constants/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
#define MIN_LEVEL 1
#define MAX_LEVEL 100

#define MAX_DYNAMAX_LEVEL 10

#define OT_ID_PLAYER_ID 0
#define OT_ID_PRESET 1
#define OT_ID_RANDOM_NO_SHINY 2
Expand Down
6 changes: 5 additions & 1 deletion include/contest.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ struct ContestPokemon
u8 sheen;
u8 highestRank;
bool8 gameCleared;
u8 unused[10];
u8 isShiny:1;
u8 unused1:7;
u8 unused2[9];
u32 personality;
u32 otId;
};
Expand All @@ -125,6 +127,8 @@ struct ContestMoveAnimData
u16 species;
u16 targetSpecies;
bool8 hasTargetAnim:1;
u8 isShiny:1;
u8 targetIsShiny:1;
u8 contestant;
u32 personality;
u32 otId;
Expand Down
2 changes: 2 additions & 0 deletions include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ struct TrainerMon
u8 nature : 5;
bool8 gender : 2;
bool8 isShiny : 1;
u8 dynamaxLevel : 4;
bool8 gigantamaxFactor : 1;
};

#define TRAINER_PARTY(partyArray) partyArray, .partySize = ARRAY_COUNT(partyArray)
Expand Down
7 changes: 4 additions & 3 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
#define CAT(a, b) CAT_(a, b)
#define CAT_(a, b) a ## b

#define STR(a) STR_(a)
#define STR_(a) #a
#define STR(...) STR_(__VA_ARGS__)
#define STR_(...) #__VA_ARGS__

// Converts a string to a compound literal, essentially making it a pointer to const u8
#define COMPOUND_STRING(str) (const u8[]) _(str)
Expand Down Expand Up @@ -738,7 +738,8 @@ struct ContestWinner
u8 contestCategory;
u8 monName[POKEMON_NAME_LENGTH + 1];
u8 trainerName[PLAYER_NAME_LENGTH + 1];
u8 contestRank;
u8 contestRank:7;
bool8 isShiny:1;
//u8 padding;
};

Expand Down
2 changes: 2 additions & 0 deletions include/item_use.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ void ItemUseOutOfBattle_WailmerPail(u8);
void ItemUseOutOfBattle_Medicine(u8);
void ItemUseOutOfBattle_AbilityCapsule(u8);
void ItemUseOutOfBattle_AbilityPatch(u8);
void ItemUseOutOfBattle_Mint(u8);
void ItemUseOutOfBattle_ResetEVs(u8);
void ItemUseOutOfBattle_ReduceEV(u8);
void ItemUseOutOfBattle_SacredAsh(u8);
void ItemUseOutOfBattle_PPRecovery(u8);
void ItemUseOutOfBattle_PPUp(u8);
void ItemUseOutOfBattle_RareCandy(u8);
void ItemUseOutOfBattle_DynamaxCandy(u8);
void ItemUseOutOfBattle_TMHM(u8);
void ItemUseOutOfBattle_Repel(u8);
void ItemUseOutOfBattle_Lure(u8);
Expand Down
2 changes: 2 additions & 0 deletions include/party_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ void ItemUseCB_BattleChooseMove(u8 taskId, TaskFunc task);
void ItemUseCB_Medicine(u8 taskId, TaskFunc task);
void ItemUseCB_AbilityCapsule(u8 taskId, TaskFunc task);
void ItemUseCB_AbilityPatch(u8 taskId, TaskFunc task);
void ItemUseCB_Mint(u8 taskId, TaskFunc task);
void ItemUseCB_ResetEVs(u8 taskId, TaskFunc task);
void ItemUseCB_ReduceEV(u8 taskId, TaskFunc task);
void ItemUseCB_PPRecovery(u8 taskId, TaskFunc task);
Expand All @@ -62,6 +63,7 @@ bool8 MonKnowsMove(struct Pokemon *mon, u16 move);
bool8 BoxMonKnowsMove(struct BoxPokemon *boxMon, u16 move);
void ItemUseCB_TMHM(u8 taskId, TaskFunc task);
void ItemUseCB_RareCandy(u8 taskId, TaskFunc task);
void ItemUseCB_DynamaxCandy(u8 taskId, TaskFunc task);
void ItemUseCB_SacredAsh(u8 taskId, TaskFunc task);
void ItemUseCB_EvolutionStone(u8 taskId, TaskFunc task);
void ItemUseCB_FormChange(u8 taskId, TaskFunc task);
Expand Down
2 changes: 1 addition & 1 deletion include/pokedex.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum
void ResetPokedex(void);
u16 GetNationalPokedexCount(u8);
u16 GetHoennPokedexCount(u8);
u8 DisplayCaughtMonDexPage(u16 species, u32 otId, u32 personality);
u8 DisplayCaughtMonDexPage(u16 species, bool32 isShiny, u32 personality);
s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId);
u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16);
bool16 HasAllHoennMons(void);
Expand Down
Loading
Loading