Debug Menu improvements (#2814)

This commit is contained in:
Eduardo Quezada D'Ottone 2023-03-09 08:23:58 -03:00 committed by GitHub
commit aedf18fea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 24 deletions

View File

@ -41,19 +41,32 @@ Debug_CheatStart::
release release
end end
Debug_FlagsNotSetMessage:: Debug_FlagsNotSetOverworldConfigMessage::
lockall lockall
message Debug_FlagsNotSetMessage_Text message Debug_FlagsNotSetOverworldConfigMessage_Text
waitmessage waitmessage
waitbuttonpress waitbuttonpress
releaseall releaseall
end end
Debug_FlagsNotSetMessage_Text: Debug_FlagsNotSetOverworldConfigMessage_Text:
.string "Feature unavailable!\n" .string "Feature unavailable!\n"
.string "Please define a usable flag in:\l" .string "Please define a usable flag in:\l"
.string "'include/config/overworld.h'!$" .string "'include/config/overworld.h'!$"
Debug_FlagsNotSetBattleConfigMessage::
lockall
message Debug_FlagsNotSetBattleConfigMessage_Text
waitmessage
waitbuttonpress
releaseall
end
Debug_FlagsNotSetBattleConfigMessage_Text:
.string "Feature unavailable!\n"
.string "Please define a usable flag in:\l"
.string "'include/config/battle.h'!$"
Debug_Script_1:: Debug_Script_1::
end end

View File

@ -2,16 +2,11 @@
#define GUARD_CONFIG_DEBUG_H #define GUARD_CONFIG_DEBUG_H
// Overworld Debug // Overworld Debug
#define DEBUG_OVERWORLD_MENU TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default. #define DEBUG_OVERWORLD_MENU TRUE // Enables an overworld debug menu to change flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default.
#define DEBUG_OVERWORLD_HELD_KEYS (R_BUTTON) // The keys required to be held to open the debug menu. #define DEBUG_OVERWORLD_HELD_KEYS (R_BUTTON) // The keys required to be held to open the debug menu.
#define DEBUG_OVERWORLD_TRIGGER_EVENT pressedStartButton // The event that opens the menu when holding the key(s) defined in DEBUG_OVERWORLD_HELD_KEYS. #define DEBUG_OVERWORLD_TRIGGER_EVENT pressedStartButton // The event that opens the menu when holding the key(s) defined in DEBUG_OVERWORLD_HELD_KEYS.
#define DEBUG_OVERWORLD_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex). #define DEBUG_OVERWORLD_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex).
// Debug Flags
// To use the following debug features, replace the 0s with the flag ID you're assigning it to.
// Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature.
#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.
// Battle Debug Menu // Battle Debug Menu
#define DEBUG_BATTLE_MENU TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. #define DEBUG_BATTLE_MENU TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button.

View File

@ -9,5 +9,6 @@
// Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. // Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature.
#define OW_FLAG_NO_ENCOUNTER 0 // If this flag is set, wild encounters will be disabled. #define OW_FLAG_NO_ENCOUNTER 0 // If this flag is set, wild encounters will be disabled.
#define OW_FLAG_NO_TRAINER_SEE 0 // If this flag is set, trainers will not battle the player unless they're talked to. #define OW_FLAG_NO_TRAINER_SEE 0 // If this flag is set, trainers will not battle the player unless they're talked to.
#define OW_FLAG_NO_COLLISION 0 // If this flag is set, the player will be able to walk over tiles with collision. Mainly intended for debugging purposes.
#endif // GUARD_CONFIG_OVERWORLD_H #endif // GUARD_CONFIG_OVERWORLD_H

View File

@ -85,6 +85,7 @@ enum { // Util
DEBUG_UTIL_MENU_ITEM_TRAINER_NAME, DEBUG_UTIL_MENU_ITEM_TRAINER_NAME,
DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER,
DEBUG_UTIL_MENU_ITEM_TRAINER_ID, DEBUG_UTIL_MENU_ITEM_TRAINER_ID,
DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES,
}; };
enum { // Scripts enum { // Scripts
DEBUG_UTIL_MENU_ITEM_SCRIPT_1, DEBUG_UTIL_MENU_ITEM_SCRIPT_1,
@ -224,6 +225,7 @@ static void DebugAction_Util_WatchCredits(u8 taskId);
static void DebugAction_Util_Trainer_Name(u8 taskId); static void DebugAction_Util_Trainer_Name(u8 taskId);
static void DebugAction_Util_Trainer_Gender(u8 taskId); static void DebugAction_Util_Trainer_Gender(u8 taskId);
static void DebugAction_Util_Trainer_Id(u8 taskId); static void DebugAction_Util_Trainer_Id(u8 taskId);
static void DebugAction_Util_Clear_Boxes(u8 taskId);
static void DebugAction_Flags_Flags(u8 taskId); static void DebugAction_Flags_Flags(u8 taskId);
static void DebugAction_Flags_FlagsSelect(u8 taskId); static void DebugAction_Flags_FlagsSelect(u8 taskId);
@ -275,7 +277,8 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId);
static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)); static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8));
static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate); static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate);
extern u8 Debug_FlagsNotSetMessage[]; extern u8 Debug_FlagsNotSetOverworldConfigMessage[];
extern u8 Debug_FlagsNotSetBattleConfigMessage[];
extern u8 Debug_Script_1[]; extern u8 Debug_Script_1[];
extern u8 Debug_Script_2[]; extern u8 Debug_Script_2[];
extern u8 Debug_Script_3[]; extern u8 Debug_Script_3[];
@ -329,6 +332,7 @@ static const u8 sDebugText_Util_WatchCredits[] = _("Watch Credits");
static const u8 sDebugText_Util_Trainer_Name[] = _("Trainer name"); static const u8 sDebugText_Util_Trainer_Name[] = _("Trainer name");
static const u8 sDebugText_Util_Trainer_Gender[] = _("Toggle T. Gender"); static const u8 sDebugText_Util_Trainer_Gender[] = _("Toggle T. Gender");
static const u8 sDebugText_Util_Trainer_Id[] = _("New Trainer Id"); static const u8 sDebugText_Util_Trainer_Id[] = _("New Trainer Id");
static const u8 sDebugText_Util_Clear_Boxes[] = _("Clear Storage Boxes");
// Flags Menu // Flags Menu
static const u8 sDebugText_Flags_Flags[] = _("Set Flag XXXX"); static const u8 sDebugText_Flags_Flags[] = _("Set Flag XXXX");
static const u8 sDebugText_Flags_SetPokedexFlags[] = _("All Pokédex Flags"); static const u8 sDebugText_Flags_SetPokedexFlags[] = _("All Pokédex Flags");
@ -450,6 +454,7 @@ static const struct ListMenuItem sDebugMenu_Items_Utilities[] =
[DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = {sDebugText_Util_Trainer_Name, DEBUG_UTIL_MENU_ITEM_TRAINER_NAME}, [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = {sDebugText_Util_Trainer_Name, DEBUG_UTIL_MENU_ITEM_TRAINER_NAME},
[DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = {sDebugText_Util_Trainer_Gender, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER}, [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = {sDebugText_Util_Trainer_Gender, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER},
[DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = {sDebugText_Util_Trainer_Id, DEBUG_UTIL_MENU_ITEM_TRAINER_ID}, [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = {sDebugText_Util_Trainer_Id, DEBUG_UTIL_MENU_ITEM_TRAINER_ID},
[DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = {sDebugText_Util_Clear_Boxes, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES},
}; };
static const struct ListMenuItem sDebugMenu_Items_Scripts[] = static const struct ListMenuItem sDebugMenu_Items_Scripts[] =
{ {
@ -529,6 +534,7 @@ static void (*const sDebugMenu_Actions_Utilities[])(u8) =
[DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = DebugAction_Util_Trainer_Name, [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = DebugAction_Util_Trainer_Name,
[DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = DebugAction_Util_Trainer_Gender, [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = DebugAction_Util_Trainer_Gender,
[DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = DebugAction_Util_Trainer_Id, [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = DebugAction_Util_Trainer_Id,
[DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = DebugAction_Util_Clear_Boxes,
}; };
static void (*const sDebugMenu_Actions_Scripts[])(u8) = static void (*const sDebugMenu_Actions_Scripts[])(u8) =
{ {
@ -1315,6 +1321,12 @@ static void DebugAction_Util_Trainer_Id(u8 taskId)
Debug_DestroyMenu_Full(taskId); Debug_DestroyMenu_Full(taskId);
ScriptContext_Enable(); ScriptContext_Enable();
} }
static void DebugAction_Util_Clear_Boxes(u8 taskId)
{
ResetPokemonStorageSystem();
Debug_DestroyMenu_Full(taskId);
ScriptContext_Enable();
}
// ******************************* // *******************************
// Actions Scripts // Actions Scripts
@ -1556,16 +1568,16 @@ static void DebugAction_Flags_ToggleFrontierPass(u8 taskId)
} }
static void DebugAction_Flags_CollisionOnOff(u8 taskId) static void DebugAction_Flags_CollisionOnOff(u8 taskId)
{ {
#if DEBUG_FLAG_NO_COLLISION == 0 #if OW_FLAG_NO_COLLISION == 0
Debug_DestroyMenu_Full(taskId); Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls(); LockPlayerFieldControls();
ScriptContext_SetupScript(Debug_FlagsNotSetMessage); ScriptContext_SetupScript(Debug_FlagsNotSetOverworldConfigMessage);
#else #else
if (FlagGet(DEBUG_FLAG_NO_COLLISION)) if (FlagGet(OW_FLAG_NO_COLLISION))
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
else else
PlaySE(SE_PC_LOGIN); PlaySE(SE_PC_LOGIN);
FlagToggle(DEBUG_FLAG_NO_COLLISION); FlagToggle(OW_FLAG_NO_COLLISION);
#endif #endif
} }
static void DebugAction_Flags_EncounterOnOff(u8 taskId) static void DebugAction_Flags_EncounterOnOff(u8 taskId)
@ -1573,7 +1585,7 @@ static void DebugAction_Flags_EncounterOnOff(u8 taskId)
#if OW_FLAG_NO_ENCOUNTER == 0 #if OW_FLAG_NO_ENCOUNTER == 0
Debug_DestroyMenu_Full(taskId); Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls(); LockPlayerFieldControls();
ScriptContext_SetupScript(Debug_FlagsNotSetMessage); ScriptContext_SetupScript(Debug_FlagsNotSetOverworldConfigMessage);
#else #else
if (FlagGet(OW_FLAG_NO_ENCOUNTER)) if (FlagGet(OW_FLAG_NO_ENCOUNTER))
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
@ -1587,7 +1599,7 @@ static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId)
#if OW_FLAG_NO_TRAINER_SEE == 0 #if OW_FLAG_NO_TRAINER_SEE == 0
Debug_DestroyMenu_Full(taskId); Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls(); LockPlayerFieldControls();
ScriptContext_SetupScript(Debug_FlagsNotSetMessage); ScriptContext_SetupScript(Debug_FlagsNotSetOverworldConfigMessage);
#else #else
if (FlagGet(OW_FLAG_NO_TRAINER_SEE)) if (FlagGet(OW_FLAG_NO_TRAINER_SEE))
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
@ -1601,7 +1613,7 @@ static void DebugAction_Flags_BagUseOnOff(u8 taskId)
#if B_FLAG_NO_BAG_USE == 0 #if B_FLAG_NO_BAG_USE == 0
Debug_DestroyMenu_Full(taskId); Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls(); LockPlayerFieldControls();
ScriptContext_SetupScript(Debug_FlagsNotSetMessage); ScriptContext_SetupScript(Debug_FlagsNotSetBattleConfigMessage);
#else #else
if (FlagGet(B_FLAG_NO_BAG_USE)) if (FlagGet(B_FLAG_NO_BAG_USE))
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
@ -1612,10 +1624,10 @@ static void DebugAction_Flags_BagUseOnOff(u8 taskId)
} }
static void DebugAction_Flags_CatchingOnOff(u8 taskId) static void DebugAction_Flags_CatchingOnOff(u8 taskId)
{ {
#if B_FLAG_NO_CATCHING_USE == 0 #if B_FLAG_NO_CATCHING == 0
Debug_DestroyMenu_Full(taskId); Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls(); LockPlayerFieldControls();
ScriptContext_SetupScript(Debug_FlagsNotSetMessage); ScriptContext_SetupScript(Debug_FlagsNotSetBattleConfigMessage);
#else #else
if (FlagGet(B_FLAG_NO_CATCHING)) if (FlagGet(B_FLAG_NO_CATCHING))
PlaySE(SE_PC_OFF); PlaySE(SE_PC_OFF);
@ -2181,7 +2193,7 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId)
{ {
PlaySE(MUS_LEVEL_UP); PlaySE(MUS_LEVEL_UP);
ScriptGiveMon(sDebugMonData->mon_speciesId, gTasks[taskId].data[3], ITEM_NONE, 0,0,0); ScriptGiveMon(sDebugMonData->mon_speciesId, gTasks[taskId].data[3], ITEM_NONE, 0,0,0);
//Set flag for user convenience // Set flag for user convenience
FlagSet(FLAG_SYS_POKEMON_GET); FlagSet(FLAG_SYS_POKEMON_GET);
Free(sDebugMonData); //Frees EWRAM of MonData Struct Free(sDebugMonData); //Frees EWRAM of MonData Struct
DebugAction_DestroyExtraWindow(taskId); DebugAction_DestroyExtraWindow(taskId);
@ -2737,7 +2749,7 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu
break; break;
} }
//Set flag for user convenience // Set flag for user convenience
FlagSet(FLAG_SYS_POKEMON_GET); FlagSet(FLAG_SYS_POKEMON_GET);
Free(sDebugMonData); //Frees EWRAM of MonData Struct Free(sDebugMonData); //Frees EWRAM of MonData Struct
@ -2769,11 +2781,12 @@ static void DebugAction_Give_FillPC(u8 taskId) //Credit: Sierraffinity
int boxId, boxPosition; int boxId, boxPosition;
u32 personality; u32 personality;
struct BoxPokemon boxMon; struct BoxPokemon boxMon;
u16 species = SPECIES_BULBASAUR;
personality = Random32(); personality = Random32();
CreateBoxMon(&boxMon, CreateBoxMon(&boxMon,
SPECIES_DEOXYS, species,
100, 100,
32, 32,
personality, personality,
@ -2788,9 +2801,16 @@ static void DebugAction_Give_FillPC(u8 taskId) //Credit: Sierraffinity
if (!GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES)) if (!GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES))
{ {
gPokemonStoragePtr->boxes[boxId][boxPosition] = boxMon; gPokemonStoragePtr->boxes[boxId][boxPosition] = boxMon;
SetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SPECIES, &species);
GetSetPokedexFlag(species, FLAG_SET_SEEN);
GetSetPokedexFlag(species, FLAG_SET_CAUGHT);
species++;
} }
} }
} }
// Set flag for user convenience
FlagSet(FLAG_SYS_POKEMON_GET);
} }
static void DebugAction_Give_CHEAT(u8 taskId) static void DebugAction_Give_CHEAT(u8 taskId)

View File

@ -4654,8 +4654,8 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir)
{ {
u8 direction = dir; u8 direction = dir;
#if DEBUG_FLAG_NO_COLLISION != 0 #if OW_FLAG_NO_COLLISION != 0
if (FlagGet(DEBUG_FLAG_NO_COLLISION)) if (FlagGet(OW_FLAG_NO_COLLISION))
return COLLISION_NONE; return COLLISION_NONE;
#endif #endif