Added documentation on resetting battle flags and vars

Added Overworld_ResetBattleFlagsAndVars to Overworld_ResetStateAfterWhiteOut
This commit is contained in:
PSF 2023-03-28 15:50:58 -07:00
parent dd99cb6da8
commit 686d42709a
2 changed files with 20 additions and 3 deletions

View File

@ -143,6 +143,7 @@
// Flag settings
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
// Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature.
// Once these features are turned on within the game, they will remain on until they are explcitily turned off or until the player whites out. This can be turned off by disabling Overworld_ResetBattleFlagsAndVars.
#define B_FLAG_INVERSE_BATTLE 0 // If this flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water.
#define B_FLAG_FORCE_DOUBLE_WILD 0 // If this flag is set, all land and surfing wild battles will be double battles.
#define B_SMART_WILD_AI_FLAG 0 // If not 0, you can set this flag in a script to enable smart wild pokemon
@ -152,6 +153,7 @@
// Var Settings
// To use the following features in scripting, replace the 0s with the var ID you're assigning it to.
// Eg: Replace with VAR_UNUSED_0x40F7 so you can use VAR_TERRAIN for that feature.
// Once these features are turned on within the game, they will remain on until they are explcitily turned off or until the player whites out. This can be turned off by disabling Overworld_ResetBattleFlagsAndVars.
#define VAR_TERRAIN 0 // If this var has a value, assigning a STATUS_FIELD_xx_TERRAIN to it before battle causes the battle to start with that terrain active
#define B_VAR_WILD_AI_FLAGS 0 // If not 0, you can use this var to add to default wild AI flags. NOT usable with flags above (1 << 15)

View File

@ -401,6 +401,23 @@ void Overworld_ResetStateAfterDigEscRope(void)
FlagClear(FLAG_SYS_USE_FLASH);
}
void Overworld_ResetBattleFlagsAndVars(void)
{
#if VAR_TERRAIN != 0
VarSet(VAR_TERRAIN, 0);
#endif
#if B_VAR_WILD_AI_FLAGS != 0
VarSet(B_VAR_WILD_AI_FLAGS,0);
#endif
FlagClear(B_FLAG_INVERSE_BATTLE);
FlagClear(B_FLAG_FORCE_DOUBLE_WILD);
FlagClear(B_SMART_WILD_AI_FLAG);
FlagClear(B_FLAG_NO_BAG_USE);
FlagClear(B_FLAG_NO_CATCHING);
}
static void Overworld_ResetStateAfterWhiteOut(void)
{
ResetInitialPlayerAvatarState();
@ -409,9 +426,7 @@ static void Overworld_ResetStateAfterWhiteOut(void)
FlagClear(FLAG_SYS_SAFARI_MODE);
FlagClear(FLAG_SYS_USE_STRENGTH);
FlagClear(FLAG_SYS_USE_FLASH);
#if VAR_TERRAIN != 0
VarSet(VAR_TERRAIN, 0);
#endif
Overworld_ResetBattleFlagsAndVars();
// If you were defeated by Kyogre/Groudon and the step counter has
// maxed out, end the abnormal weather.
if (VarGet(VAR_SHOULD_END_ABNORMAL_WEATHER) == 1)