-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add Ability to Avoid Battle Damage in Debug Menu
voloved edited this page Jan 10, 2023
·
2 revisions
By devolov
Goal: Avoid getting battle damage during debugging. I saw myself wasting time fainting in some of my tests, so I added a toggle to stop getting battle damage.
This addition is built entirely of TheXaman's Debug Menu.
-------------------------- include/constants/flags.h --------------------------
index 282acfcd9..d81570df6 100644
@@ -47,9 +47,9 @@
#define FLAG_SYS_NO_BAG_USE 0x23 // Unused Flag //DEBUG
#define FLAG_SYS_NO_CATCHING 0x24 // Unused Flag //DEBUG
#define FLAG_SYS_PC_FROM_DEBUG_MENU 0x25 // Unused Flag //DEBUG
#define FLAG_SYS_PC_FROM_POKENAV 0x26
-#define FLAG_UNUSED_0x027 0x27 // Unused Flag
+#define FLAG_SYS_NO_BATTLE_DMG 0x27 // Unused Flag //DEBUG
#define FLAG_UNUSED_0x028 0x28 // Unused Flag
#define FLAG_UNUSED_0x029 0x29 // Unused Flag
#define FLAG_UNUSED_0x02A 0x2A // Unused Flag
#define FLAG_UNUSED_0x02B 0x2B // Unused Flag
------------------------- src/battle_script_commands.c -------------------------
index 9b47e5e86..5bcdcef68 100644
@@ -52,8 +52,10 @@
#include "constants/party_menu.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/trainers.h"
+#include "constants/flags.h"
+#include "debug.h"
extern const u8 *const gBattleScriptsForMoveEffects[];
#define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattlerTarget].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED))
@@ -1807,9 +1809,17 @@ static void Cmd_waitanimation(void)
gBattlescriptCurrInstr++;
}
static void Cmd_healthbarupdate(void)
{
+ #if TX_DEBUG_SYSTEM_ENABLE == TRUE
+ u8 side = GetBattlerSide(gBattlerTarget);
+ if (FlagGet(FLAG_SYS_NO_BATTLE_DMG) && side == B_SIDE_PLAYER)
+ {
+ gMoveResultFlags |= MOVE_RESULT_NO_EFFECT;
+ }
+ #endif
+
if (gBattleControllerExecFlags)
return;
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
--------------------------------- src/debug.c ---------------------------------
index 3f0773b6a..b57c2dc68 100644
@@ -111,8 +111,9 @@ enum { // Flags and Vars
DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_RUN_SHOES,
DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_LOCATIONS,
DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BADGES_ALL,
DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS,
+ DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BATTLE_DMG,
DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION,
DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER,
DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_TRAINER_SEE,
DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE,
@@ -330,8 +331,9 @@ static void DebugAction_FlagsVars_SwitchNatDex(u8 taskId);
static void DebugAction_FlagsVars_SwitchPokeNav(u8 taskId);
static void DebugAction_FlagsVars_ToggleFlyFlags(u8 taskId);
static void DebugAction_FlagsVars_ToggleBadgeFlags(u8 taskId);
static void DebugAction_FlagsVars_ToggleFrontierPass(u8 taskId);
+static void DebugAction_FlagsVars_BattleDmgOnOff(u8 taskId);
static void DebugAction_FlagsVars_CollisionOnOff(u8 taskId);
static void DebugAction_FlagsVars_EncounterOnOff(u8 taskId);
static void DebugAction_FlagsVars_TrainerSeeOnOff(u8 taskId);
static void DebugAction_FlagsVars_BagUseOnOff(u8 taskId);
@@ -460,8 +462,9 @@ static const u8 sDebugText_FlagsVars_SwitchPokeNav[] = _("Toggle {STR_V
static const u8 sDebugText_FlagsVars_RunningShoes[] = _("Toggle {STR_VAR_1}Running Shoes");
static const u8 sDebugText_FlagsVars_ToggleFlyFlags[] = _("Toggle {STR_VAR_1}Fly Flags");
static const u8 sDebugText_FlagsVars_ToggleAllBadges[] = _("Toggle {STR_VAR_1}All badges");
static const u8 sDebugText_FlagsVars_ToggleFrontierPass[] = _("Toggle {STR_VAR_1}Frontier Pass");
+static const u8 sDebugText_FlagsVars_BattleDmg[] = _("Toggle {STR_VAR_1}BattleDmg OFF");
static const u8 sDebugText_FlagsVars_SwitchCollision[] = _("Toggle {STR_VAR_1}Collision OFF");
static const u8 sDebugText_FlagsVars_SwitchEncounter[] = _("Toggle {STR_VAR_1}Encounter OFF");
static const u8 sDebugText_FlagsVars_SwitchTrainerSee[] = _("Toggle {STR_VAR_1}TrainerSee OFF");
static const u8 sDebugText_FlagsVars_SwitchBagUse[] = _("Toggle {STR_VAR_1}BagUse OFF");
@@ -640,8 +643,9 @@ static const struct ListMenuItem sDebugMenu_Items_FlagsVars[] =
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_RUN_SHOES] = {sDebugText_FlagsVars_RunningShoes, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_RUN_SHOES},
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_LOCATIONS] = {sDebugText_FlagsVars_ToggleFlyFlags, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_LOCATIONS},
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BADGES_ALL] = {sDebugText_FlagsVars_ToggleAllBadges, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BADGES_ALL},
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS] = {sDebugText_FlagsVars_ToggleFrontierPass, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS},
+ [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BATTLE_DMG] = {sDebugText_FlagsVars_BattleDmg, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BATTLE_DMG},
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION] = {sDebugText_FlagsVars_SwitchCollision, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION},
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER] = {sDebugText_FlagsVars_SwitchEncounter, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER},
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_TRAINER_SEE] = {sDebugText_FlagsVars_SwitchTrainerSee, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_TRAINER_SEE},
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE] = {sDebugText_FlagsVars_SwitchBagUse, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE},
@@ -774,8 +778,9 @@ static void (*const sDebugMenu_Actions_Flags[])(u8) =
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_RUN_SHOES] = DebugAction_FlagsVars_RunningShoes,
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_LOCATIONS] = DebugAction_FlagsVars_ToggleFlyFlags,
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BADGES_ALL] = DebugAction_FlagsVars_ToggleBadgeFlags,
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS] = DebugAction_FlagsVars_ToggleFrontierPass,
+ [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BATTLE_DMG] = DebugAction_FlagsVars_BattleDmgOnOff,
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION] = DebugAction_FlagsVars_CollisionOnOff,
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER] = DebugAction_FlagsVars_EncounterOnOff,
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_TRAINER_SEE] = DebugAction_FlagsVars_TrainerSeeOnOff,
[DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE] = DebugAction_FlagsVars_BagUseOnOff,
@@ -1074,8 +1079,11 @@ static u8 Debug_CheckToggleFlags(u8 id)
break;
case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS:
result = FlagGet(FLAG_SYS_FRONTIER_PASS);
break;
+ case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BATTLE_DMG:
+ result = FlagGet(FLAG_SYS_NO_BATTLE_DMG);
+ break;
case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION:
result = FlagGet(FLAG_SYS_NO_COLLISION);
break;
case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER:
@@ -2442,8 +2450,16 @@ static void DebugAction_FlagsVars_ToggleFrontierPass(u8 taskId)
else
PlaySE(SE_PC_LOGIN);
FlagToggle(FLAG_SYS_FRONTIER_PASS);
}
+static void DebugAction_FlagsVars_BattleDmgOnOff(u8 taskId)
+{
+ if (FlagGet(FLAG_SYS_NO_BATTLE_DMG))
+ PlaySE(SE_PC_OFF);
+ else
+ PlaySE(SE_PC_LOGIN);
+ FlagToggle(FLAG_SYS_NO_BATTLE_DMG);
+}
static void DebugAction_FlagsVars_CollisionOnOff(u8 taskId)
{
if (FlagGet(FLAG_SYS_NO_COLLISION))
PlaySE(SE_PC_OFF);