From cd5f997ee30b001c58be5b8e098769d60b88f313 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 21 Jul 2023 07:06:05 -0300 Subject: [PATCH] Added a debug feature to hatch eggs (#3155) --- data/scripts/debug.inc | 31 +++++++++++++++++++++++++++++++ src/debug.c | 10 ++++++++++ 2 files changed, 41 insertions(+) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index d7f486907..64b7e1dd0 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -112,4 +112,35 @@ Debug_SaveBlock2Size:: Debug_PokemonStorageSize:: .string "{PKMN}Storage size: {STR_VAR_1}/{STR_VAR_2}.$" +Debug_HatchAnEgg:: + lockall + getpartysize + goto_if_eq VAR_RESULT, 0, Debug_HatchAnEgg_NoPokemon + special ChoosePartyMon + waitstate + goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_HatchAnEgg_End + specialvar VAR_RESULT, ScriptGetPartyMonSpecies + goto_if_ne VAR_RESULT, SPECIES_EGG, DebugScript_HatchAnEgg_CantForceHatch + special EggHatch + waitstate +Debug_HatchAnEgg_End:: + releaseall + end + +Debug_HatchAnEgg_NoPokemon:: + msgbox DebugScript_HatchAnEgg_Text_EmptyParty, MSGBOX_DEFAULT + releaseall + end + +DebugScript_HatchAnEgg_CantForceHatch:: + msgbox DebugScript_HatchAnEgg_Text_NotAnEgg, MSGBOX_DEFAULT + releaseall + end + +DebugScript_HatchAnEgg_Text_EmptyParty:: + .string "You have no Pokémon nor Eggs.$" + +DebugScript_HatchAnEgg_Text_NotAnEgg:: + .string "That's not a Pokémon Egg.$" + .endif diff --git a/src/debug.c b/src/debug.c index 58f136492..a46122bab 100644 --- a/src/debug.c +++ b/src/debug.c @@ -91,6 +91,7 @@ enum { // Util DEBUG_UTIL_MENU_ITEM_TRAINER_ID, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES, DEBUG_UTIL_MENU_ITEM_CHEAT, + DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG, }; enum { // Scripts DEBUG_UTIL_MENU_ITEM_SCRIPT_1, @@ -314,6 +315,7 @@ static void DebugAction_Util_Trainer_Gender(u8 taskId); static void DebugAction_Util_Trainer_Id(u8 taskId); static void DebugAction_Util_Clear_Boxes(u8 taskId); static void DebugAction_Util_CheatStart(u8 taskId); +static void DebugAction_Util_HatchAnEgg(u8 taskId); static void DebugAction_FlagsVars_Flags(u8 taskId); static void DebugAction_FlagsVars_FlagsSelect(u8 taskId); @@ -383,6 +385,7 @@ extern u8 Debug_Script_8[]; extern u8 Debug_ShowFieldMessageStringVar4[]; extern u8 Debug_CheatStart[]; +extern u8 Debug_HatchAnEgg[]; extern u8 PlayersHouse_2F_EventScript_SetWallClock[]; extern u8 PlayersHouse_2F_EventScript_CheckWallClock[]; extern u8 Debug_CheckSaveBlock[]; @@ -438,6 +441,7 @@ 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_Clear_Boxes[] = _("Clear Storage Boxes"); static const u8 sDebugText_Util_CheatStart[] = _("CHEAT Start"); +static const u8 sDebugText_Util_HatchAnEgg[] = _("Hatch an Egg"); // Flags/Vars Menu static const u8 sDebugText_FlagsVars_Flags[] = _("Set Flag XYZ…{CLEAR_TO 110}{RIGHT_ARROW}"); static const u8 sDebugText_FlagsVars_Flag[] = _("Flag: {STR_VAR_1}{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}\n{STR_VAR_3}"); @@ -599,6 +603,7 @@ static const struct ListMenuItem sDebugMenu_Items_Utilities[] = [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}, [DEBUG_UTIL_MENU_ITEM_CHEAT] = {sDebugText_Util_CheatStart, DEBUG_UTIL_MENU_ITEM_CHEAT}, + [DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = {sDebugText_Util_HatchAnEgg, DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG}, }; static const struct ListMenuItem sDebugMenu_Items_Scripts[] = { @@ -731,6 +736,7 @@ static void (*const sDebugMenu_Actions_Utilities[])(u8) = [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = DebugAction_Util_Trainer_Id, [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = DebugAction_Util_Clear_Boxes, [DEBUG_UTIL_MENU_ITEM_CHEAT] = DebugAction_Util_CheatStart, + [DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = DebugAction_Util_HatchAnEgg, }; static void (*const sDebugMenu_Actions_Scripts[])(u8) = { @@ -1980,6 +1986,10 @@ static void DebugAction_Util_CheatStart(u8 taskId) { Debug_DestroyMenu_Full_Script(taskId, Debug_CheatStart); } +static void DebugAction_Util_HatchAnEgg(u8 taskId) +{ + Debug_DestroyMenu_Full_Script(taskId, Debug_HatchAnEgg); +} // ******************************* // Actions Scripts