diff --git a/include/debug.h b/include/debug.h index 1014690a5..9aec5c262 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,8 +1,8 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H -#define TX_DEBUGGING -#define TX_DEBUG_MENU_OPTION FALSE +#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). void Debug_ShowMainMenu(void); diff --git a/src/battle_main.c b/src/battle_main.c index e8688b067..029578ceb 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4001,21 +4001,25 @@ static void HandleTurnActionSelectionState(void) } break; case B_ACTION_USE_ITEM: - #ifdef TX_DEBUGGING - if (FlagGet(FLAG_SYS_NO_BAG_USE) || (gBattleTypeFlags & (BATTLE_TYPE_LINK //DEBUG + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_BAG_USE)) + { + RecordedBattle_ClearBattlerAction(gActiveBattler, 1); + gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; + gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; + *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; + *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; + return; + } + #endif + + if ((gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER_NO_PYRAMID | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK)) // Or if currently held by Sky Drop || gStatuses3[gActiveBattler] & STATUS3_SKY_DROPPED) { - #else //DEBUG - if (gBattleTypeFlags & (BATTLE_TYPE_LINK - | BATTLE_TYPE_FRONTIER_NO_PYRAMID - | BATTLE_TYPE_EREADER_TRAINER - | BATTLE_TYPE_RECORDED_LINK)) - { - #endif RecordedBattle_ClearBattlerAction(gActiveBattler, 1); gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 49bfce3c2..c5663461a 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4630,9 +4630,9 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; - #ifdef TX_DEBUGGING //DEBUG - if (FlagGet(FLAG_SYS_NO_COLLISION)) - return COLLISION_NONE; + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_COLLISION)) + return COLLISION_NONE; #endif // if (IsCoordOutsideObjectEventMovementRange(objectEvent, x, y)) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 3edfe2f16..121a10670 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -131,34 +131,30 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; - //DEBUG - #ifdef TX_DEBUGGING - if (!TX_DEBUG_MENU_OPTION) + #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE + if (heldKeys & R_BUTTON) + { + if(input->pressedSelectButton) { - if (heldKeys & R_BUTTON) - { - if(input->pressedSelectButton) - { - input->input_field_1_0 = TRUE; - input->pressedSelectButton = FALSE; - }else if(input->pressedStartButton) - { - input->input_field_1_2 = TRUE; - input->pressedStartButton = FALSE; - } - } - if (heldKeys & L_BUTTON) - { - if(input->pressedSelectButton) - { - input->input_field_1_1 = TRUE; - input->pressedSelectButton = FALSE; - }else if(input->pressedStartButton) - { - input->input_field_1_3 = TRUE; - input->pressedStartButton = FALSE; - } - } + input->input_field_1_0 = TRUE; + input->pressedSelectButton = FALSE; + }else if(input->pressedStartButton) + { + input->input_field_1_2 = TRUE; + input->pressedStartButton = FALSE; + } + } + if (heldKeys & L_BUTTON) + { + if(input->pressedSelectButton) + { + input->input_field_1_1 = TRUE; + input->pressedSelectButton = FALSE; + }else if(input->pressedStartButton) + { + input->input_field_1_3 = TRUE; + input->pressedStartButton = FALSE; + } } #endif } @@ -220,16 +216,13 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; - #ifdef TX_DEBUGGING - if (!TX_DEBUG_MENU_OPTION) - { - if (input->input_field_1_2) - { - PlaySE(SE_WIN_OPEN); - Debug_ShowMainMenu(); - return TRUE; - } - } + #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE + if (input->input_field_1_2) + { + PlaySE(SE_WIN_OPEN); + Debug_ShowMainMenu(); + return TRUE; + } #endif return FALSE; @@ -712,9 +705,9 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { - #ifdef TX_DEBUGGING - if (FlagGet(FLAG_SYS_NO_ENCOUNTER)) //DEBUG - return FALSE;// + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_ENCOUNTER)) + return FALSE; #endif if (sWildEncounterImmunitySteps < 4) diff --git a/src/item_use.c b/src/item_use.c index e9d03cabf..537e78789 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -982,8 +982,8 @@ 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) { - #ifdef TX_DEBUGGING - if (FlagGet(FLAG_SYS_NO_CATCHING)){ //DEBUG + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_CATCHING)){ static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); return; diff --git a/src/start_menu.c b/src/start_menu.c index ccaff2e3a..f4c0112b2 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -284,17 +284,17 @@ static void BuildStartMenuActions(void) { BuildMultiPartnerRoomStartMenu(); } -#if defined(TX_DEBUGGING) && TX_DEBUG_MENU_OPTION + #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == TRUE else { BuildDebugStartMenu(); } -#else + #else else { BuildNormalStartMenu(); } -#endif + #endif } static void AddStartMenuAction(u8 action) @@ -772,8 +772,8 @@ static bool8 StartMenuDebugCallback(void) RemoveExtraStartMenuWindows(); HideStartMenuDebug(); // Hide start menu without enabling movement - #ifdef TX_DEBUGGING - Debug_ShowMainMenu(); + #if TX_DEBUG_SYSTEM == TRUE + Debug_ShowMainMenu(); #endif return TRUE; diff --git a/src/trainer_see.c b/src/trainer_see.c index bb2c41161..81b040a3b 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -193,10 +193,10 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; - #ifdef TX_DEBUGGING //DEBUG - if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) - return FALSE; - #endif // + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) + return FALSE; + #endif gNoOfApproachingTrainers = 0; gApproachingTrainerId = 0;