diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index e174343f22..fe86197c8c 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -38,10 +38,22 @@ Debug_CheatStart:: setflag FLAG_HIDE_ROUTE_116_MR_BRINEY clearflag FLAG_HIDE_BRINEYS_HOUSE_MR_BRINEY clearflag FLAG_HIDE_BRINEYS_HOUSE_PEEKO - closemessage release end +Debug_FlagsNotSetMessage:: + lockall + message Debug_FlagsNotSetMessage_Text + waitmessage + waitbuttonpress + releaseall + end + +Debug_FlagsNotSetMessage_Text: + .string "Feature unavailable!\n" + .string "Please define a usable flag in:\l" + .string "'include/constants/debug{UNDERSCORE}config.h'!$" + Debug_Script_1:: end diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index a5db36e19b..ad7775b673 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -138,8 +138,8 @@ #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 -#define B_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 B_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 B_FLAG_NO_BAG_USE 0 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used. +#define B_FLAG_NO_CATCHING 0 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used. // Var Settings // To use the following features in scripting, replace the 0s with the var ID you're assigning it to. diff --git a/include/constants/flags.h b/include/constants/flags.h index ac8de43dc4..8fbc246300 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -41,12 +41,12 @@ #define FLAG_TEMP_1F (TEMP_FLAGS_START + 0x1F) #define TEMP_FLAGS_END FLAG_TEMP_1F -#define FLAG_UNUSED_0x020 0x20 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x021 0x21 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x022 0x22 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x023 0x23 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x024 0x24 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x025 0x25 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" +#define FLAG_UNUSED_0x020 0x20 // Unused Flag +#define FLAG_UNUSED_0x021 0x21 // Unused Flag +#define FLAG_UNUSED_0x022 0x22 // Unused Flag +#define FLAG_UNUSED_0x023 0x23 // Unused Flag +#define FLAG_UNUSED_0x024 0x24 // Unused Flag +#define FLAG_UNUSED_0x025 0x25 // Unused Flag #define FLAG_UNUSED_0x026 0x26 // Unused Flag #define FLAG_UNUSED_0x027 0x27 // Unused Flag #define FLAG_UNUSED_0x028 0x28 // Unused Flag diff --git a/include/constants/overworld_config.h b/include/constants/overworld_config.h index 3e57066f5f..6d094d60f5 100644 --- a/include/constants/overworld_config.h +++ b/include/constants/overworld_config.h @@ -6,9 +6,9 @@ #define DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (replaces the exit entry). // Replace the used flags with others or disable with a 0 -#define 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 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 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 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. +#define DEBUG_FLAG_NO_COLLISION 0 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. +#define DEBUG_FLAG_NO_ENCOUNTER 0 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used. +#define DEBUG_FLAG_NO_TRAINER_SEE 0 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used. +#define DEBUG_FLAG_PC_FROM_DEBUG_MENU 0 // If this flag is set, the debug function in debug menu to access the player PC works. #endif // GUARD_CONSTANTS_OVERWORLD_CONFIG_H diff --git a/src/debug.c b/src/debug.c index 2883beb797..81e30cff01 100644 --- a/src/debug.c +++ b/src/debug.c @@ -271,6 +271,7 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId); static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)); static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate); +extern u8 Debug_FlagsNotSetMessage[]; extern u8 Debug_Script_1[]; extern u8 Debug_Script_2[]; extern u8 Debug_Script_3[]; @@ -1447,6 +1448,11 @@ static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) } static void DebugAction_Flags_CollisionOnOff(u8 taskId) { +#if DEBUG_FLAG_NO_COLLISION == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(DEBUG_FLAG_NO_COLLISION)) { FlagClear(DEBUG_FLAG_NO_COLLISION); @@ -1455,9 +1461,15 @@ static void DebugAction_Flags_CollisionOnOff(u8 taskId) FlagSet(DEBUG_FLAG_NO_COLLISION); PlaySE(SE_PC_LOGIN); } +#endif } static void DebugAction_Flags_EncounterOnOff(u8 taskId) { +#if DEBUG_FLAG_NO_ENCOUNTER == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(DEBUG_FLAG_NO_ENCOUNTER)) { FlagClear(DEBUG_FLAG_NO_ENCOUNTER); @@ -1466,9 +1478,15 @@ static void DebugAction_Flags_EncounterOnOff(u8 taskId) FlagSet(DEBUG_FLAG_NO_ENCOUNTER); PlaySE(SE_PC_LOGIN); } +#endif } static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) { +#if DEBUG_FLAG_NO_TRAINER_SEE == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(DEBUG_FLAG_NO_TRAINER_SEE)) { FlagClear(DEBUG_FLAG_NO_TRAINER_SEE); @@ -1477,9 +1495,15 @@ static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) FlagSet(DEBUG_FLAG_NO_TRAINER_SEE); PlaySE(SE_PC_LOGIN); } +#endif } static void DebugAction_Flags_BagUseOnOff(u8 taskId) { +#if B_FLAG_NO_BAG_USE == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(B_FLAG_NO_BAG_USE)) { FlagClear(B_FLAG_NO_BAG_USE); @@ -1488,9 +1512,15 @@ static void DebugAction_Flags_BagUseOnOff(u8 taskId) FlagSet(B_FLAG_NO_BAG_USE); PlaySE(SE_PC_LOGIN); } +#endif } static void DebugAction_Flags_CatchingOnOff(u8 taskId) { +#if B_FLAG_NO_CATCHING_USE == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(B_FLAG_NO_CATCHING)) { FlagClear(B_FLAG_NO_CATCHING); @@ -1499,6 +1529,7 @@ static void DebugAction_Flags_CatchingOnOff(u8 taskId) FlagSet(B_FLAG_NO_CATCHING); PlaySE(SE_PC_LOGIN); } +#endif } // *******************************