From 367b12801e32e5a8b1dbc258030b98643e755cbf Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Fri, 2 Sep 2022 12:33:42 +0200 Subject: [PATCH] changed debug_config.h to overworld_config.h, changed no bag use and no catching flags to battle_config.h, removed TX reference (big sad) --- include/constants/battle_config.h | 2 ++ include/constants/debug_config.h | 15 ------------ include/constants/global.h | 2 +- include/constants/overworld_config.h | 14 ++++++++++++ include/debug.h | 2 +- src/battle_main.c | 4 +--- src/debug.c | 34 ++++++++++++++-------------- src/event_object_movement.c | 4 ++-- src/field_control_avatar.c | 8 +++---- src/item_use.c | 4 +--- src/pokemon_storage_system.c | 4 ++-- src/start_menu.c | 4 ++-- src/trainer_see.c | 4 ++-- 13 files changed, 49 insertions(+), 52 deletions(-) delete mode 100644 include/constants/debug_config.h create mode 100644 include/constants/overworld_config.h diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 89134daf9..a5db36e19 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -138,6 +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. // 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/debug_config.h b/include/constants/debug_config.h deleted file mode 100644 index 847288d64..000000000 --- a/include/constants/debug_config.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef GUARD_CONSTANTS_DEBUG_CONFIG_H -#define GUARD_CONSTANTS_DEBUG_CONFIG_H - -#define TX_DEBUG_SYSTEM TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by pressing R plus START. -#define TX_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 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_DEBUG_CONFIG_H diff --git a/include/constants/global.h b/include/constants/global.h index b80bcd402..07ed19020 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -2,7 +2,7 @@ #define GUARD_CONSTANTS_GLOBAL_H #include "constants/battle_config.h" -#include "constants/debug_config.h" +#include "constants/overworld_config.h" // Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen. // In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen. diff --git a/include/constants/overworld_config.h b/include/constants/overworld_config.h new file mode 100644 index 000000000..3e57066f5 --- /dev/null +++ b/include/constants/overworld_config.h @@ -0,0 +1,14 @@ +#ifndef GUARD_CONSTANTS_OVERWORLD_CONFIG_H +#define GUARD_CONSTANTS_OVERWORLD_CONFIG_H + +// Debug options +#define DEBUG_SYSTEM_ENABLE TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by pressing R plus START. +#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. + +#endif // GUARD_CONSTANTS_OVERWORLD_CONFIG_H diff --git a/include/debug.h b/include/debug.h index c5bdc224c..f56efbde3 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,7 +1,7 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H -#include "constants/debug_config.h" +#include "constants/overworld_config.h" void Debug_ShowMainMenu(void); diff --git a/src/battle_main.c b/src/battle_main.c index 052b61163..39deaca27 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4001,8 +4001,7 @@ static void HandleTurnActionSelectionState(void) } break; case B_ACTION_USE_ITEM: - #if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_BAG_USE)) + if (FlagGet(B_FLAG_NO_BAG_USE)) { RecordedBattle_ClearBattlerAction(gActiveBattler, 1); gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; @@ -4011,7 +4010,6 @@ static void HandleTurnActionSelectionState(void) *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; return; } - #endif if ((gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER_NO_PYRAMID diff --git a/src/debug.c b/src/debug.c index 283361b38..2883beb79 100644 --- a/src/debug.c +++ b/src/debug.c @@ -55,7 +55,7 @@ #include "constants/songs.h" #include "constants/species.h" -#if TX_DEBUG_SYSTEM == TRUE +#if DEBUG_SYSTEM_ENABLE == TRUE // ******************************* // Enums enum { // Main @@ -1447,56 +1447,56 @@ static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) } static void DebugAction_Flags_CollisionOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_COLLISION)) + if(FlagGet(DEBUG_FLAG_NO_COLLISION)) { - FlagClear(TX_DEBUG_FLAG_NO_COLLISION); + FlagClear(DEBUG_FLAG_NO_COLLISION); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_COLLISION); + FlagSet(DEBUG_FLAG_NO_COLLISION); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_EncounterOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_ENCOUNTER)) + if(FlagGet(DEBUG_FLAG_NO_ENCOUNTER)) { - FlagClear(TX_DEBUG_FLAG_NO_ENCOUNTER); + FlagClear(DEBUG_FLAG_NO_ENCOUNTER); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_ENCOUNTER); + FlagSet(DEBUG_FLAG_NO_ENCOUNTER); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_TRAINER_SEE)) + if(FlagGet(DEBUG_FLAG_NO_TRAINER_SEE)) { - FlagClear(TX_DEBUG_FLAG_NO_TRAINER_SEE); + FlagClear(DEBUG_FLAG_NO_TRAINER_SEE); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_TRAINER_SEE); + FlagSet(DEBUG_FLAG_NO_TRAINER_SEE); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_BagUseOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_BAG_USE)) + if(FlagGet(B_FLAG_NO_BAG_USE)) { - FlagClear(TX_DEBUG_FLAG_NO_BAG_USE); + FlagClear(B_FLAG_NO_BAG_USE); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_BAG_USE); + FlagSet(B_FLAG_NO_BAG_USE); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_CatchingOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_CATCHING)) + if(FlagGet(B_FLAG_NO_CATCHING)) { - FlagClear(TX_DEBUG_FLAG_NO_CATCHING); + FlagClear(B_FLAG_NO_CATCHING); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_CATCHING); + FlagSet(B_FLAG_NO_CATCHING); PlaySE(SE_PC_LOGIN); } } @@ -2723,7 +2723,7 @@ static void Task_WaitFadeAccessPC(u8 taskId) if (!gPaletteFade.active) { DestroyTask(taskId); - FlagSet(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU); + FlagSet(DEBUG_FLAG_PC_FROM_DEBUG_MENU); EnterPokeStorage(2); } } diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 9765febbf..2c5418da4 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4630,8 +4630,8 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; -#if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_COLLISION)) +#if DEBUG_SYSTEM_ENABLE == TRUE + if (FlagGet(DEBUG_FLAG_NO_COLLISION)) return COLLISION_NONE; #endif diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 2b86bf2cf..76503a85a 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -131,7 +131,7 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; -#if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE +#if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == FALSE if ((heldKeys & R_BUTTON) && input->pressedStartButton) { input->input_field_1_2 = TRUE; @@ -197,7 +197,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; -#if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE +#if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == FALSE if (input->input_field_1_2) { PlaySE(SE_WIN_OPEN); @@ -686,8 +686,8 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { -#if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_ENCOUNTER)) +#if DEBUG_SYSTEM_ENABLE == TRUE + if (FlagGet(DEBUG_FLAG_NO_ENCOUNTER)) return FALSE; #endif diff --git a/src/item_use.c b/src/item_use.c index ea2bea0fe..a0b4233ff 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -982,14 +982,12 @@ static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThe static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p"); void ItemUseInBattle_PokeBall(u8 taskId) { -#if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_CATCHING)) + if (FlagGet(B_FLAG_NO_CATCHING)) { static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); return; } -#endif switch (GetBallThrowableState()) { diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 437458d75..d3fe3caa2 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1669,7 +1669,7 @@ static void FieldTask_ReturnToPcMenu(void) MainCallback vblankCb = gMain.vblankCallback; SetVBlankCallback(NULL); - if (!FlagGet(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU)) + if (!FlagGet(DEBUG_FLAG_PC_FROM_DEBUG_MENU)) { taskId = CreateTask(Task_PCMainMenu, 80); gTasks[taskId].tState = 0; @@ -1678,7 +1678,7 @@ static void FieldTask_ReturnToPcMenu(void) } else { - FlagClear(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU); + FlagClear(DEBUG_FLAG_PC_FROM_DEBUG_MENU); ScriptContext_Enable(); } SetVBlankCallback(vblankCb); diff --git a/src/start_menu.c b/src/start_menu.c index 9f84df16a..0f7c0cb69 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -286,7 +286,7 @@ static void BuildStartMenuActions(void) } else { - #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == TRUE + #if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == TRUE BuildDebugStartMenu(); #else BuildNormalStartMenu(); @@ -760,7 +760,7 @@ static bool8 StartMenuDebugCallback(void) RemoveExtraStartMenuWindows(); HideStartMenuDebug(); // Hide start menu without enabling movement -#if TX_DEBUG_SYSTEM == TRUE +#if DEBUG_SYSTEM_ENABLE == TRUE Debug_ShowMainMenu(); #endif diff --git a/src/trainer_see.c b/src/trainer_see.c index 73b4395d4..d44e5e46f 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -193,8 +193,8 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; -#if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_TRAINER_SEE)) +#if DEBUG_SYSTEM_ENABLE == TRUE + if (FlagGet(DEBUG_FLAG_NO_TRAINER_SEE)) return FALSE; #endif