Changed the way debug flags are handled, now in constants/battle_config.h

This commit is contained in:
TheXaman 2022-08-30 17:41:35 +02:00
parent e09ba650f3
commit 04c40677bd
9 changed files with 38 additions and 30 deletions

View File

@ -194,6 +194,14 @@
#define B_NEW_IMPACT_PALETTE FALSE // If set to TRUE, it updates the basic 'hit' palette. #define B_NEW_IMPACT_PALETTE FALSE // If set to TRUE, it updates the basic 'hit' palette.
#define B_NEW_SURF_PARTICLE_PALETTE FALSE // If set to TRUE, it updates Surf's wave palette. #define B_NEW_SURF_PARTICLE_PALETTE FALSE // If set to TRUE, it updates Surf's wave palette.
// Debugging, Replace the used flags with others or disable with a 0
#define B_ENABLE_DEBUG TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. #define B_ENABLE_DEBUG TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button.
#define TX_DEBUG_FLAG_NO_COLLISION FLAG_UNUSED_0x020 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used.
#define TX_DEBUG_FLAG_NO_ENCOUNTER FLAG_UNUSED_0x021 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used.
#define TX_DEBUG_FLAG_NO_TRAINER_SEE FLAG_UNUSED_0x022 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used.
#define TX_DEBUG_FLAG_NO_BAG_USE FLAG_UNUSED_0x023 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used.
#define TX_DEBUG_FLAG_NO_CATCHING FLAG_UNUSED_0x024 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used.
#define TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU FLAG_UNUSED_0x025 // If this flag is set, the debug function in debug menu to access the player PC works.
#endif // GUARD_CONSTANTS_BATTLE_CONFIG_H #endif // GUARD_CONSTANTS_BATTLE_CONFIG_H

View File

@ -40,13 +40,13 @@
#define FLAG_TEMP_1E (TEMP_FLAGS_START + 0x1E) #define FLAG_TEMP_1E (TEMP_FLAGS_START + 0x1E)
#define FLAG_TEMP_1F (TEMP_FLAGS_START + 0x1F) #define FLAG_TEMP_1F (TEMP_FLAGS_START + 0x1F)
#define TEMP_FLAGS_END FLAG_TEMP_1F #define TEMP_FLAGS_END FLAG_TEMP_1F
#define FLAG_SYS_NO_COLLISION 0x20 // Unused Flag //DEBUG #define FLAG_UNUSED_0x020 0x20 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h"
#define FLAG_SYS_NO_ENCOUNTER 0x21 // Unused Flag //DEBUG #define FLAG_UNUSED_0x021 0x21 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h"
#define FLAG_SYS_NO_TRAINER_SEE 0x22 // Unused Flag //DEBUG #define FLAG_UNUSED_0x022 0x22 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h"
#define FLAG_SYS_NO_BAG_USE 0x23 // Unused Flag //DEBUG #define FLAG_UNUSED_0x023 0x23 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h"
#define FLAG_SYS_NO_CATCHING 0x24 // Unused Flag //DEBUG #define FLAG_UNUSED_0x024 0x24 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h"
#define FLAG_SYS_PC_FROM_DEBUG_MENU 0x25 // Unused Flag //DEBUG #define FLAG_UNUSED_0x025 0x25 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h"
#define FLAG_UNUSED_0x026 0x26 // Unused Flag #define FLAG_UNUSED_0x026 0x26 // Unused Flag
#define FLAG_UNUSED_0x027 0x27 // Unused Flag #define FLAG_UNUSED_0x027 0x27 // Unused Flag
#define FLAG_UNUSED_0x028 0x28 // Unused Flag #define FLAG_UNUSED_0x028 0x28 // Unused Flag

View File

@ -4002,7 +4002,7 @@ static void HandleTurnActionSelectionState(void)
break; break;
case B_ACTION_USE_ITEM: case B_ACTION_USE_ITEM:
#if TX_DEBUG_SYSTEM == TRUE #if TX_DEBUG_SYSTEM == TRUE
if (FlagGet(FLAG_SYS_NO_BAG_USE)) if (FlagGet(TX_DEBUG_FLAG_NO_BAG_USE))
{ {
RecordedBattle_ClearBattlerAction(gActiveBattler, 1); RecordedBattle_ClearBattlerAction(gActiveBattler, 1);
gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed;

View File

@ -1447,56 +1447,56 @@ static void DebugAction_Flags_ToggleFrontierPass(u8 taskId)
} }
static void DebugAction_Flags_CollisionOnOff(u8 taskId) static void DebugAction_Flags_CollisionOnOff(u8 taskId)
{ {
if(FlagGet(FLAG_SYS_NO_COLLISION)) if(FlagGet(TX_DEBUG_FLAG_NO_COLLISION))
{ {
FlagClear(FLAG_SYS_NO_COLLISION); FlagClear(TX_DEBUG_FLAG_NO_COLLISION);
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
}else{ }else{
FlagSet(FLAG_SYS_NO_COLLISION); FlagSet(TX_DEBUG_FLAG_NO_COLLISION);
PlaySE(SE_PC_LOGIN); PlaySE(SE_PC_LOGIN);
} }
} }
static void DebugAction_Flags_EncounterOnOff(u8 taskId) static void DebugAction_Flags_EncounterOnOff(u8 taskId)
{ {
if(FlagGet(FLAG_SYS_NO_ENCOUNTER)) if(FlagGet(TX_DEBUG_FLAG_NO_ENCOUNTER))
{ {
FlagClear(FLAG_SYS_NO_ENCOUNTER); FlagClear(TX_DEBUG_FLAG_NO_ENCOUNTER);
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
}else{ }else{
FlagSet(FLAG_SYS_NO_ENCOUNTER); FlagSet(TX_DEBUG_FLAG_NO_ENCOUNTER);
PlaySE(SE_PC_LOGIN); PlaySE(SE_PC_LOGIN);
} }
} }
static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId)
{ {
if(FlagGet(FLAG_SYS_NO_TRAINER_SEE)) if(FlagGet(TX_DEBUG_FLAG_NO_TRAINER_SEE))
{ {
FlagClear(FLAG_SYS_NO_TRAINER_SEE); FlagClear(TX_DEBUG_FLAG_NO_TRAINER_SEE);
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
}else{ }else{
FlagSet(FLAG_SYS_NO_TRAINER_SEE); FlagSet(TX_DEBUG_FLAG_NO_TRAINER_SEE);
PlaySE(SE_PC_LOGIN); PlaySE(SE_PC_LOGIN);
} }
} }
static void DebugAction_Flags_BagUseOnOff(u8 taskId) static void DebugAction_Flags_BagUseOnOff(u8 taskId)
{ {
if(FlagGet(FLAG_SYS_NO_BAG_USE)) if(FlagGet(TX_DEBUG_FLAG_NO_BAG_USE))
{ {
FlagClear(FLAG_SYS_NO_BAG_USE); FlagClear(TX_DEBUG_FLAG_NO_BAG_USE);
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
}else{ }else{
FlagSet(FLAG_SYS_NO_BAG_USE); FlagSet(TX_DEBUG_FLAG_NO_BAG_USE);
PlaySE(SE_PC_LOGIN); PlaySE(SE_PC_LOGIN);
} }
} }
static void DebugAction_Flags_CatchingOnOff(u8 taskId) static void DebugAction_Flags_CatchingOnOff(u8 taskId)
{ {
if(FlagGet(FLAG_SYS_NO_CATCHING)) if(FlagGet(TX_DEBUG_FLAG_NO_CATCHING))
{ {
FlagClear(FLAG_SYS_NO_CATCHING); FlagClear(TX_DEBUG_FLAG_NO_CATCHING);
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
}else{ }else{
FlagSet(FLAG_SYS_NO_CATCHING); FlagSet(TX_DEBUG_FLAG_NO_CATCHING);
PlaySE(SE_PC_LOGIN); PlaySE(SE_PC_LOGIN);
} }
} }
@ -2723,7 +2723,7 @@ static void Task_WaitFadeAccessPC(u8 taskId)
if (!gPaletteFade.active) if (!gPaletteFade.active)
{ {
DestroyTask(taskId); DestroyTask(taskId);
FlagSet(FLAG_SYS_PC_FROM_DEBUG_MENU); FlagSet(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU);
EnterPokeStorage(2); EnterPokeStorage(2);
} }
} }

View File

@ -4631,7 +4631,7 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir)
u8 direction = dir; u8 direction = dir;
#if TX_DEBUG_SYSTEM == TRUE #if TX_DEBUG_SYSTEM == TRUE
if (FlagGet(FLAG_SYS_NO_COLLISION)) if (FlagGet(TX_DEBUG_FLAG_NO_COLLISION))
return COLLISION_NONE; return COLLISION_NONE;
#endif #endif

View File

@ -708,7 +708,7 @@ void RestartWildEncounterImmunitySteps(void)
static bool8 CheckStandardWildEncounter(u16 metatileBehavior) static bool8 CheckStandardWildEncounter(u16 metatileBehavior)
{ {
#if TX_DEBUG_SYSTEM == TRUE #if TX_DEBUG_SYSTEM == TRUE
if (FlagGet(FLAG_SYS_NO_ENCOUNTER)) if (FlagGet(TX_DEBUG_FLAG_NO_ENCOUNTER))
return FALSE; return FALSE;
#endif #endif

View File

@ -983,7 +983,7 @@ static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a b
void ItemUseInBattle_PokeBall(u8 taskId) void ItemUseInBattle_PokeBall(u8 taskId)
{ {
#if TX_DEBUG_SYSTEM == TRUE #if TX_DEBUG_SYSTEM == TRUE
if (FlagGet(FLAG_SYS_NO_CATCHING)) if (FlagGet(TX_DEBUG_FLAG_NO_CATCHING))
{ {
static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p");
DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage);

View File

@ -1669,7 +1669,7 @@ static void FieldTask_ReturnToPcMenu(void)
MainCallback vblankCb = gMain.vblankCallback; MainCallback vblankCb = gMain.vblankCallback;
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
if (!FlagGet(FLAG_SYS_PC_FROM_DEBUG_MENU)) if (!FlagGet(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU))
{ {
taskId = CreateTask(Task_PCMainMenu, 80); taskId = CreateTask(Task_PCMainMenu, 80);
gTasks[taskId].tState = 0; gTasks[taskId].tState = 0;
@ -1678,7 +1678,7 @@ static void FieldTask_ReturnToPcMenu(void)
} }
else else
{ {
FlagClear(FLAG_SYS_PC_FROM_DEBUG_MENU); FlagClear(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU);
ScriptContext_Enable(); ScriptContext_Enable();
} }
SetVBlankCallback(vblankCb); SetVBlankCallback(vblankCb);

View File

@ -194,7 +194,7 @@ bool8 CheckForTrainersWantingBattle(void)
u8 i; u8 i;
#if TX_DEBUG_SYSTEM == TRUE #if TX_DEBUG_SYSTEM == TRUE
if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) if (FlagGet(TX_DEBUG_FLAG_NO_TRAINER_SEE))
return FALSE; return FALSE;
#endif #endif