From a34e0f6f6f9eedb56789b98decb346c53488e07d Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 7 Oct 2023 23:04:36 -0300 Subject: [PATCH 1/3] Debug menu cleanup --- data/scripts/debug.inc | 16 +- src/battle_debug.c | 32 +- src/debug.c | 1746 +++++++++++++++++++++------------------ src/menu.c | 6 +- src/pokedex_plus_hgss.c | 12 +- src/pokemon_debug.c | 6 +- 6 files changed, 978 insertions(+), 840 deletions(-) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index b29291a7f9e2..90ddcf824c90 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -69,28 +69,28 @@ Debug_BoxFilledMessage:: Debug_BoxFilledMessage_Text: .string "Storage boxes filled!$" -Debug_Script_1:: +Debug_EventScript_Script_1:: end -Debug_Script_2:: +Debug_EventScript_Script_2:: end -Debug_Script_3:: +Debug_EventScript_Script_3:: end -Debug_Script_4:: +Debug_EventScript_Script_4:: end -Debug_Script_5:: +Debug_EventScript_Script_5:: end -Debug_Script_6:: +Debug_EventScript_Script_6:: end -Debug_Script_7:: +Debug_EventScript_Script_7:: end -Debug_Script_8:: +Debug_EventScript_Script_8:: end Debug_CheckSaveBlock:: diff --git a/src/battle_debug.c b/src/battle_debug.c index 110a6c11659c..3a335be2c052 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -716,7 +716,7 @@ void CB2_BattleDebugMenu(void) data->currentMainListItemId = 0; data->activeWindow = ACTIVE_WIN_MAIN; data->secondaryListTaskId = 0xFF; - CopyWindowToVram(data->mainListWindowId, 3); + CopyWindowToVram(data->mainListWindowId, COPYWIN_FULL); gMain.state++; break; case 5: @@ -737,7 +737,7 @@ static void PutMovesPointsText(struct BattleDebugMenu *data) { text[0] = CHAR_SPACE; StringCopy(text + 1, gMoveNames[gBattleMons[data->aiBattlerId].moves[i]]); - AddTextPrinterParameterized(data->aiMovesWindowId, 1, text, 0, i * 15, 0, NULL); + AddTextPrinterParameterized(data->aiMovesWindowId, FONT_NORMAL, text, 0, i * 15, 0, NULL); for (count = 0, j = 0; j < MAX_BATTLERS_COUNT; j++) { if (data->spriteIds.aiIconSpriteIds[j] == 0xFF) @@ -746,18 +746,18 @@ static void PutMovesPointsText(struct BattleDebugMenu *data) ConvertIntToDecimalStringN(text, gBattleStruct->aiFinalScore[data->aiBattlerId][battlerDef][i], STR_CONV_MODE_RIGHT_ALIGN, 3); - AddTextPrinterParameterized(data->aiMovesWindowId, 1, text, 83 + count * 54, i * 15, 0, NULL); + AddTextPrinterParameterized(data->aiMovesWindowId, FONT_NORMAL, text, 83 + count * 54, i * 15, 0, NULL); ConvertIntToDecimalStringN(text, AI_DATA->simulatedDmg[data->aiBattlerId][battlerDef][i], STR_CONV_MODE_RIGHT_ALIGN, 3); - AddTextPrinterParameterized(data->aiMovesWindowId, 1, text, 110 + count * 54, i * 15, 0, NULL); + AddTextPrinterParameterized(data->aiMovesWindowId, FONT_NORMAL, text, 110 + count * 54, i * 15, 0, NULL); count++; } } - CopyWindowToVram(data->aiMovesWindowId, 3); + CopyWindowToVram(data->aiMovesWindowId, COPYWIN_FULL); Free(text); } @@ -849,7 +849,7 @@ static void PutAiInfoText(struct BattleDebugMenu *data) // item names for (i = 0; i < ARRAY_COUNT(sAiInfoItemNames); i++) { - AddTextPrinterParameterized(data->aiMovesWindowId, 1, sAiInfoItemNames[i], 3, i * 15, 0, NULL); + AddTextPrinterParameterized(data->aiMovesWindowId, FONT_NORMAL, sAiInfoItemNames[i], 3, i * 15, 0, NULL); } // items info @@ -861,13 +861,13 @@ static void PutAiInfoText(struct BattleDebugMenu *data) u16 holdEffect = AI_DATA->holdEffects[i]; u16 item = AI_DATA->items[i]; u8 x = (i == B_POSITION_PLAYER_LEFT) ? 83 + (i) * 75 : 83 + (i-1) * 75; - AddTextPrinterParameterized(data->aiMovesWindowId, 0, gAbilityNames[ability], x, 0, 0, NULL); - AddTextPrinterParameterized(data->aiMovesWindowId, 0, ItemId_GetName(item), x, 15, 0, NULL); - AddTextPrinterParameterized(data->aiMovesWindowId, 0, GetHoldEffectName(holdEffect), x, 30, 0, NULL); + AddTextPrinterParameterized(data->aiMovesWindowId, FONT_SMALL, gAbilityNames[ability], x, 0, 0, NULL); + AddTextPrinterParameterized(data->aiMovesWindowId, FONT_SMALL, ItemId_GetName(item), x, 15, 0, NULL); + AddTextPrinterParameterized(data->aiMovesWindowId, FONT_SMALL, GetHoldEffectName(holdEffect), x, 30, 0, NULL); } } - CopyWindowToVram(data->aiMovesWindowId, 3); + CopyWindowToVram(data->aiMovesWindowId, COPYWIN_FULL); Free(text); } @@ -914,7 +914,7 @@ static void PutAiPartyText(struct BattleDebugMenu *data) AddTextPrinterParameterized5(data->aiMovesWindowId, FONT_SMALL_NARROW, text, i * 41, 35 + (j + 1) * 15, 0, NULL, 0, 0); } - CopyWindowToVram(data->aiMovesWindowId, 3); + CopyWindowToVram(data->aiMovesWindowId, COPYWIN_FULL); Free(text); } @@ -1177,7 +1177,7 @@ static void Task_DebugMenuProcessInput(u8 taskId) data->currentSecondaryListItemId = listItemId; data->modifyWindowId = AddWindow(&sModifyWindowTemplate); PutWindowTilemap(data->modifyWindowId); - CopyWindowToVram(data->modifyWindowId, 3); + CopyWindowToVram(data->modifyWindowId, COPYWIN_FULL); SetUpModifyArrows(data); PrintDigitChars(data); data->activeWindow = ACTIVE_WIN_MODIFY; @@ -1261,8 +1261,8 @@ static void PrintOnBattlerWindow(u8 windowId, u8 battlerId) StringCopy(&text[4], gBattleMons[battlerId].nickname); FillWindowPixelBuffer(windowId, 0x11); - AddTextPrinterParameterized(windowId, 1, text, 0, 0, 0, NULL); - CopyWindowToVram(windowId, 3); + AddTextPrinterParameterized(windowId, FONT_NORMAL, text, 0, 0, 0, NULL); + CopyWindowToVram(windowId, COPYWIN_FULL); } static void UpdateWindowsOnChangedBattler(struct BattleDebugMenu *data) @@ -1368,7 +1368,7 @@ static void CreateSecondaryListMenu(struct BattleDebugMenu *data) listTemplate.windowId = data->secondaryListWindowId; data->secondaryListTaskId = ListMenuInit(&listTemplate, 0, 0); - CopyWindowToVram(data->secondaryListWindowId, 3); + CopyWindowToVram(data->secondaryListWindowId, COPYWIN_FULL); } static void PadString(const u8 *src, u8 *dst) @@ -1497,7 +1497,7 @@ static void PrintDigitChars(struct BattleDebugMenu *data) text[i] = EOS; - AddTextPrinterParameterized(data->modifyWindowId, 1, text, 3, 0, 0, NULL); + AddTextPrinterParameterized(data->modifyWindowId, FONT_NORMAL, text, 3, 0, 0, NULL); } static const u32 GetBitfieldToAndValue(u32 currBit, u32 bitsCount) diff --git a/src/debug.c b/src/debug.c index f915235d8b64..76329948fcc4 100644 --- a/src/debug.c +++ b/src/debug.c @@ -53,6 +53,7 @@ #include "constants/abilities.h" #include "constants/battle_ai.h" #include "constants/battle_frontier.h" +#include "constants/coins.h" #include "constants/flags.h" #include "constants/items.h" #include "constants/map_groups.h" @@ -64,8 +65,8 @@ #if DEBUG_OVERWORLD_MENU == TRUE // ******************************* -// Enums -enum { // Main +enum DebugMenu +{ DEBUG_MENU_ITEM_UTILITIES, DEBUG_MENU_ITEM_SCRIPTS, DEBUG_MENU_ITEM_FLAGVAR, @@ -74,9 +75,11 @@ enum { // Main DEBUG_MENU_ITEM_FILL, DEBUG_MENU_ITEM_SOUND, DEBUG_MENU_ITEM_ACCESS_PC, - DEBUG_MENU_ITEM_CANCEL + DEBUG_MENU_ITEM_CANCEL, }; -enum { // Util + +enum UtilMenu +{ DEBUG_UTIL_MENU_ITEM_HEAL_PARTY, DEBUG_UTIL_MENU_ITEM_FLY, DEBUG_UTIL_MENU_ITEM_WARP, @@ -86,14 +89,16 @@ enum { // Util DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK, DEBUG_UTIL_MENU_ITEM_WATCHCREDITS, - DEBUG_UTIL_MENU_ITEM_TRAINER_NAME, - DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, - DEBUG_UTIL_MENU_ITEM_TRAINER_ID, + DEBUG_UTIL_MENU_ITEM_PLAYER_NAME, + DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER, + DEBUG_UTIL_MENU_ITEM_PLAYER_ID, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES, DEBUG_UTIL_MENU_ITEM_CHEAT, DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG, }; -enum { // Scripts + +enum ScriptMenu +{ DEBUG_UTIL_MENU_ITEM_SCRIPT_1, DEBUG_UTIL_MENU_ITEM_SCRIPT_2, DEBUG_UTIL_MENU_ITEM_SCRIPT_3, @@ -103,7 +108,9 @@ enum { // Scripts DEBUG_UTIL_MENU_ITEM_SCRIPT_7, DEBUG_UTIL_MENU_ITEM_SCRIPT_8, }; -enum { // Flags and Vars + +enum FlagsVarsMenu +{ DEBUG_FLAGVAR_MENU_ITEM_FLAGS, DEBUG_FLAGVAR_MENU_ITEM_VARS, DEBUG_FLAGVAR_MENU_ITEM_DEXFLAGS_ALL, @@ -121,14 +128,18 @@ enum { // Flags and Vars DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_CATCHING, }; -enum { // Battle 0 Type + +enum BattleType +{ DEBUG_BATTLE_0_MENU_ITEM_WILD, DEBUG_BATTLE_0_MENU_ITEM_WILD_DOUBLE, DEBUG_BATTLE_0_MENU_ITEM_SINGLE, DEBUG_BATTLE_0_MENU_ITEM_DOUBLE, DEBUG_BATTLE_0_MENU_ITEM_MULTI, }; -enum { // Battle 1 AI FLags + +enum BattleAIFlags +{ DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_00, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_01, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_02, @@ -149,7 +160,9 @@ enum { // Battle 1 AI FLags DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_17, DEBUG_BATTLE_1_MENU_ITEM_CONTINUE, }; -enum { // Battle 2 Terrain + +enum BattleTerrain +{ DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_0, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_1, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_2, @@ -161,7 +174,9 @@ enum { // Battle 2 Terrain DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_8, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_9, }; -enum { // Give + +enum GiveMenu +{ DEBUG_GIVE_MENU_ITEM_ITEM_X, DEBUG_GIVE_MENU_ITEM_ALLTMS, DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE, @@ -171,7 +186,9 @@ enum { // Give DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG, }; -enum { // Give Fill + +enum GiveFillMenu +{ DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST, DEBUG_FILL_MENU_ITEM_PC_BOXES_SLOW, DEBUG_FILL_MENU_ITEM_PC_ITEMS, @@ -181,13 +198,17 @@ enum { // Give Fill DEBUG_FILL_MENU_ITEM_POCKET_BERRIES, DEBUG_FILL_MENU_ITEM_POCKET_KEY_ITEMS, }; -enum { //Sound + +enum SoundMenu +{ DEBUG_SOUND_MENU_ITEM_SE, DEBUG_SOUND_MENU_ITEM_MUS, }; // ******************************* // Constants +#define DEBUG_MENU_FONT FONT_NORMAL + #define DEBUG_MENU_WIDTH_MAIN 16 #define DEBUG_MENU_HEIGHT_MAIN 9 @@ -217,11 +238,11 @@ enum { //Sound // ******************************* struct DebugMonData { - u16 mon_speciesId; - u8 mon_level; - u8 isShiny; - u16 mon_natureId; - u16 mon_abilityNum; + u16 species; + u8 level:7; + bool8 isShiny:1; + u8 nature:6; + u8 abilityNum:2; u8 mon_iv_hp; u8 mon_iv_atk; u8 mon_iv_def; @@ -287,6 +308,7 @@ static void DebugAction_OpenGiveMenu(u8 taskId); static void DebugAction_OpenFillMenu(u8 taskId); static void DebugAction_OpenSoundMenu(u8 taskId); static void DebugAction_AccessPC(u8 taskId); + static void DebugTask_HandleMenuInput_Main(u8 taskId); static void DebugTask_HandleMenuInput_Utilities(u8 taskId); static void DebugTask_HandleMenuInput_Scripts(u8 taskId); @@ -310,9 +332,9 @@ static void DebugAction_Util_Weather_SelectId(u8 taskId); static void DebugAction_Util_CheckWallClock(u8 taskId); static void DebugAction_Util_SetWallClock(u8 taskId); static void DebugAction_Util_WatchCredits(u8 taskId); -static void DebugAction_Util_Trainer_Name(u8 taskId); -static void DebugAction_Util_Trainer_Gender(u8 taskId); -static void DebugAction_Util_Trainer_Id(u8 taskId); +static void DebugAction_Util_Player_Name(u8 taskId); +static void DebugAction_Util_Player_Gender(u8 taskId); +static void DebugAction_Util_Player_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); @@ -374,14 +396,14 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId); extern const u8 Debug_FlagsNotSetOverworldConfigMessage[]; extern const u8 Debug_FlagsNotSetBattleConfigMessage[]; -extern const u8 Debug_Script_1[]; -extern const u8 Debug_Script_2[]; -extern const u8 Debug_Script_3[]; -extern const u8 Debug_Script_4[]; -extern const u8 Debug_Script_5[]; -extern const u8 Debug_Script_6[]; -extern const u8 Debug_Script_7[]; -extern const u8 Debug_Script_8[]; +extern const u8 Debug_EventScript_Script_1[]; +extern const u8 Debug_EventScript_Script_2[]; +extern const u8 Debug_EventScript_Script_3[]; +extern const u8 Debug_EventScript_Script_4[]; +extern const u8 Debug_EventScript_Script_5[]; +extern const u8 Debug_EventScript_Script_6[]; +extern const u8 Debug_EventScript_Script_7[]; +extern const u8 Debug_EventScript_Script_8[]; extern const u8 DebugScript_DaycareMonsNotCompatible[]; extern const u8 DebugScript_OneDaycareMons[]; extern const u8 DebugScript_ZeroDaycareMons[]; @@ -425,26 +447,26 @@ static const u8 sDebugText_Util_Script_6[] = _("Script 6"); static const u8 sDebugText_Util_Script_7[] = _("Script 7"); static const u8 sDebugText_Util_Script_8[] = _("Script 8"); // Util Menu -static const u8 sDebugText_Util_HealParty[] = _("Heal Party"); -static const u8 sDebugText_Util_Fly[] = _("Fly to map…{CLEAR_TO 110}{RIGHT_ARROW}"); -static const u8 sDebugText_Util_WarpToMap[] = _("Warp to map warp…{CLEAR_TO 110}{RIGHT_ARROW}"); -static const u8 sDebugText_Util_WarpToMap_SelectMapGroup[] =_("Group: {STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n\n{STR_VAR_3}{CLEAR_TO 90}"); -static const u8 sDebugText_Util_WarpToMap_SelectMap[] = _("Map: {STR_VAR_1}{CLEAR_TO 90}\nMapSec:{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}\n{STR_VAR_3}{CLEAR_TO 90}"); -static const u8 sDebugText_Util_WarpToMap_SelectWarp[] = _("Warp:{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_3}{CLEAR_TO 90}"); -static const u8 sDebugText_Util_WarpToMap_SelMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); -static const u8 sDebugText_Util_PoisonMons[] = _("Poison all mons"); -static const u8 sDebugText_Util_SaveBlockSpace[] = _("SaveBlock Space…{CLEAR_TO 110}{RIGHT_ARROW}"); -static const u8 sDebugText_Util_Weather[] = _("Set weather…{CLEAR_TO 110}{RIGHT_ARROW}"); -static const u8 sDebugText_Util_Weather_ID[] = _("Weather Id: {STR_VAR_3}\n{STR_VAR_1}\n{STR_VAR_2}"); -static const u8 sDebugText_Util_CheckWallClock[] = _("Check Wall Clock…{CLEAR_TO 110}{RIGHT_ARROW}"); -static const u8 sDebugText_Util_SetWallClock[] = _("Set Wall Clock…{CLEAR_TO 110}{RIGHT_ARROW}"); -static const u8 sDebugText_Util_WatchCredits[] = _("Watch Credits…{CLEAR_TO 110}{RIGHT_ARROW}"); -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_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"); +static const u8 sDebugText_Util_HealParty[] = _("Heal Party"); +static const u8 sDebugText_Util_FlyToMap[] = _("Fly to map…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_WarpToMap[] = _("Warp to map warp…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_WarpToMap_SelectMapGroup[] = _("Group: {STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n\n{STR_VAR_3}{CLEAR_TO 90}"); +static const u8 sDebugText_Util_WarpToMap_SelectMap[] = _("Map: {STR_VAR_1}{CLEAR_TO 90}\nMapSec:{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}\n{STR_VAR_3}{CLEAR_TO 90}"); +static const u8 sDebugText_Util_WarpToMap_SelectWarp[] = _("Warp:{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_3}{CLEAR_TO 90}"); +static const u8 sDebugText_Util_WarpToMap_SelMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); +static const u8 sDebugText_Util_PoisonParty[] = _("Poison party"); +static const u8 sDebugText_Util_SaveBlockSpace[] = _("SaveBlock Space…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_Weather[] = _("Set weather…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_Weather_ID[] = _("Weather Id: {STR_VAR_3}\n{STR_VAR_1}\n{STR_VAR_2}"); +static const u8 sDebugText_Util_CheckWallClock[] = _("Check Wall Clock…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_SetWallClock[] = _("Set Wall Clock…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_WatchCredits[] = _("Watch Credits…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_Player_Name[] = _("Player name"); +static const u8 sDebugText_Util_Player_Gender[] = _("Toggle Gender"); +static const u8 sDebugText_Util_Player_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}"); @@ -514,12 +536,12 @@ static const u8 sDebugText_PokemonShiny[] = _("Shiny:{CLEAR_TO 90}\n static const u8 sDebugText_PokemonNature[] = _("NatureId: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); static const u8 sDebugText_PokemonAbility[] = _("AbilityNum: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); static const u8 sDebugText_PokemonIVs[] = _("All IVs:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); -static const u8 sDebugText_PokemonIV_0[] = _("IV HP:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); -static const u8 sDebugText_PokemonIV_1[] = _("IV Attack:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); -static const u8 sDebugText_PokemonIV_2[] = _("IV Defense:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); -static const u8 sDebugText_PokemonIV_3[] = _("IV Speed:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); -static const u8 sDebugText_PokemonIV_4[] = _("IV Sp. Attack:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); -static const u8 sDebugText_PokemonIV_5[] = _("IV Sp. Defense:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_IV_HP[] = _("IV HP:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_IV_Attack[] = _("IV Attack:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_IV_Defense[] = _("IV Defense:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_IV_Speed[] = _("IV Speed:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_IV_SpAttack[] = _("IV Sp. Attack:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_IV_SpDefense[] = _("IV Sp. Defense:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); static const u8 sDebugText_PokemonMove_0[] = _("Move 0: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); static const u8 sDebugText_PokemonMove_1[] = _("Move 1: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); static const u8 sDebugText_PokemonMove_2[] = _("Move 2: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); @@ -529,39 +551,40 @@ static const u8 sDebugText_Give_MaxCoins[] = _("Max Coins"); static const u8 sDebugText_Give_BattlePoints[] = _("Max Battle Points"); static const u8 sDebugText_Give_DaycareEgg[] = _("Daycare Egg"); // Fill Menu -static const u8 sDebugText_Fill_Pc_Fast[] = _("Fill PCBoxes Fast"); -static const u8 sDebugText_Fill_Pc_Slow[] = _("Fill PCBoxes Slow (LAG!)"); -static const u8 sDebugText_Fill_Pc_Items[] = _("Fill PCItems"); -static const u8 sDebugText_Fill_PocketItems[] = _("Fill Pocket Items"); -static const u8 sDebugText_Fill_PocketPokeBalls[] =_("Fill Pocket PokeBalls"); -static const u8 sDebugText_Fill_PocketTMHM[] = _("Fill Pocket TMHM"); -static const u8 sDebugText_Fill_PocketBerries[] = _("Fill Pocket Berries"); -static const u8 sDebugText_Fill_PocketKeyItems[] = _("Fill Pocket KeyItems"); -// Sound Mneu -static const u8 sDebugText_Sound_SE[] = _("Effects…{CLEAR_TO 110}{RIGHT_ARROW}"); -static const u8 sDebugText_Sound_SE_ID[] = _("Sound Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); -static const u8 sDebugText_Sound_MUS[] = _("Music…{CLEAR_TO 110}{RIGHT_ARROW}"); -static const u8 sDebugText_Sound_MUS_ID[] = _("Music Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); - -static const u8 digitInidicator_1[] = _("{LEFT_ARROW}+1{RIGHT_ARROW} "); -static const u8 digitInidicator_10[] = _("{LEFT_ARROW}+10{RIGHT_ARROW} "); -static const u8 digitInidicator_100[] = _("{LEFT_ARROW}+100{RIGHT_ARROW} "); -static const u8 digitInidicator_1000[] = _("{LEFT_ARROW}+1000{RIGHT_ARROW} "); -static const u8 digitInidicator_10000[] = _("{LEFT_ARROW}+10000{RIGHT_ARROW} "); -static const u8 digitInidicator_100000[] = _("{LEFT_ARROW}+100000{RIGHT_ARROW} "); -static const u8 digitInidicator_1000000[] = _("{LEFT_ARROW}+1000000{RIGHT_ARROW} "); -static const u8 digitInidicator_10000000[] = _("{LEFT_ARROW}+10000000{RIGHT_ARROW} "); -const u8 * const gText_DigitIndicator[] = -{ - digitInidicator_1, - digitInidicator_10, - digitInidicator_100, - digitInidicator_1000, - digitInidicator_10000, - digitInidicator_100000, - digitInidicator_1000000, - digitInidicator_10000000 +static const u8 sDebugText_Fill_Pc_Fast[] = _("Fill PCBoxes Fast"); +static const u8 sDebugText_Fill_Pc_Slow[] = _("Fill PCBoxes Slow (LAG!)"); +static const u8 sDebugText_Fill_Pc_Items[] = _("Fill PCItems"); +static const u8 sDebugText_Fill_PocketItems[] = _("Fill Pocket Items"); +static const u8 sDebugText_Fill_PocketPokeBalls[] = _("Fill Pocket PokeBalls"); +static const u8 sDebugText_Fill_PocketTMHM[] = _("Fill Pocket TMHM"); +static const u8 sDebugText_Fill_PocketBerries[] = _("Fill Pocket Berries"); +static const u8 sDebugText_Fill_PocketKeyItems[] = _("Fill Pocket KeyItems"); +// Sound Menu +static const u8 sDebugText_Sound_SFX[] = _("SFX…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Sound_SFX_ID[] = _("SFX Id: {STR_VAR_3} {START_BUTTON} Stop\n{STR_VAR_1} \n{STR_VAR_2}"); +static const u8 sDebugText_Sound_Music[] = _("Music…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Sound_Music_ID[] = _("Music Id: {STR_VAR_3} {START_BUTTON} Stop\n{STR_VAR_1} \n{STR_VAR_2}"); + +static const u8 sDebugText_Digit_1[] = _("{LEFT_ARROW}+1{RIGHT_ARROW} "); +static const u8 sDebugText_Digit_10[] = _("{LEFT_ARROW}+10{RIGHT_ARROW} "); +static const u8 sDebugText_Digit_100[] = _("{LEFT_ARROW}+100{RIGHT_ARROW} "); +static const u8 sDebugText_Digit_1000[] = _("{LEFT_ARROW}+1000{RIGHT_ARROW} "); +static const u8 sDebugText_Digit_10000[] = _("{LEFT_ARROW}+10000{RIGHT_ARROW} "); +static const u8 sDebugText_Digit_100000[] = _("{LEFT_ARROW}+100000{RIGHT_ARROW} "); +static const u8 sDebugText_Digit_1000000[] = _("{LEFT_ARROW}+1000000{RIGHT_ARROW} "); +static const u8 sDebugText_Digit_10000000[] = _("{LEFT_ARROW}+10000000{RIGHT_ARROW} "); +const u8 *const gText_DigitIndicator[] = +{ + sDebugText_Digit_1, + sDebugText_Digit_10, + sDebugText_Digit_100, + sDebugText_Digit_1000, + sDebugText_Digit_10000, + sDebugText_Digit_100000, + sDebugText_Digit_1000000, + sDebugText_Digit_10000000 }; + static const s32 sPowersOfTen[] = { 1, @@ -580,45 +603,48 @@ static const s32 sPowersOfTen[] = // List Menu Items static const struct ListMenuItem sDebugMenu_Items_Main[] = { - [DEBUG_MENU_ITEM_UTILITIES] = {sDebugText_Utilities, DEBUG_MENU_ITEM_UTILITIES}, - [DEBUG_MENU_ITEM_SCRIPTS] = {sDebugText_Scripts, DEBUG_MENU_ITEM_SCRIPTS}, - [DEBUG_MENU_ITEM_FLAGVAR] = {sDebugText_FlagsVars, DEBUG_MENU_ITEM_FLAGVAR}, - //[DEBUG_MENU_ITEM_BATTLE] = {sDebugText_Battle, DEBUG_MENU_ITEM_BATTLE}, - [DEBUG_MENU_ITEM_GIVE] = {sDebugText_Give, DEBUG_MENU_ITEM_GIVE}, - [DEBUG_MENU_ITEM_FILL] = {sDebugText_Fill, DEBUG_MENU_ITEM_FILL}, - [DEBUG_MENU_ITEM_SOUND] = {sDebugText_Sound, DEBUG_MENU_ITEM_SOUND}, - [DEBUG_MENU_ITEM_ACCESS_PC] = {sDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, - [DEBUG_MENU_ITEM_CANCEL] = {sDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL} + [DEBUG_MENU_ITEM_UTILITIES] = {sDebugText_Utilities, DEBUG_MENU_ITEM_UTILITIES}, + [DEBUG_MENU_ITEM_SCRIPTS] = {sDebugText_Scripts, DEBUG_MENU_ITEM_SCRIPTS}, + [DEBUG_MENU_ITEM_FLAGVAR] = {sDebugText_FlagsVars, DEBUG_MENU_ITEM_FLAGVAR}, + //[DEBUG_MENU_ITEM_BATTLE] = {sDebugText_Battle, DEBUG_MENU_ITEM_BATTLE}, + [DEBUG_MENU_ITEM_GIVE] = {sDebugText_Give, DEBUG_MENU_ITEM_GIVE}, + [DEBUG_MENU_ITEM_FILL] = {sDebugText_Fill, DEBUG_MENU_ITEM_FILL}, + [DEBUG_MENU_ITEM_SOUND] = {sDebugText_Sound, DEBUG_MENU_ITEM_SOUND}, + [DEBUG_MENU_ITEM_ACCESS_PC] = {sDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, + [DEBUG_MENU_ITEM_CANCEL] = {sDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL} }; + static const struct ListMenuItem sDebugMenu_Items_Utilities[] = { - [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = {sDebugText_Util_HealParty, DEBUG_UTIL_MENU_ITEM_HEAL_PARTY}, - [DEBUG_UTIL_MENU_ITEM_FLY] = {sDebugText_Util_Fly, DEBUG_UTIL_MENU_ITEM_FLY}, - [DEBUG_UTIL_MENU_ITEM_WARP] = {sDebugText_Util_WarpToMap, DEBUG_UTIL_MENU_ITEM_WARP}, - [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = {sDebugText_Util_PoisonMons, DEBUG_UTIL_MENU_ITEM_POISON_MONS}, - [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = {sDebugText_Util_SaveBlockSpace, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK}, - [DEBUG_UTIL_MENU_ITEM_WEATHER] = {sDebugText_Util_Weather, DEBUG_UTIL_MENU_ITEM_WEATHER}, - [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {sDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, - [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {sDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, - [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = {sDebugText_Util_WatchCredits, DEBUG_UTIL_MENU_ITEM_WATCHCREDITS}, - [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_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}, + [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = {sDebugText_Util_HealParty, DEBUG_UTIL_MENU_ITEM_HEAL_PARTY}, + [DEBUG_UTIL_MENU_ITEM_FLY] = {sDebugText_Util_FlyToMap, DEBUG_UTIL_MENU_ITEM_FLY}, + [DEBUG_UTIL_MENU_ITEM_WARP] = {sDebugText_Util_WarpToMap, DEBUG_UTIL_MENU_ITEM_WARP}, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = {sDebugText_Util_PoisonParty, DEBUG_UTIL_MENU_ITEM_POISON_MONS}, + [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = {sDebugText_Util_SaveBlockSpace, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK}, + [DEBUG_UTIL_MENU_ITEM_WEATHER] = {sDebugText_Util_Weather, DEBUG_UTIL_MENU_ITEM_WEATHER}, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {sDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {sDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = {sDebugText_Util_WatchCredits, DEBUG_UTIL_MENU_ITEM_WATCHCREDITS}, + [DEBUG_UTIL_MENU_ITEM_PLAYER_NAME] = {sDebugText_Util_Player_Name, DEBUG_UTIL_MENU_ITEM_PLAYER_NAME}, + [DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER] = {sDebugText_Util_Player_Gender, DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER}, + [DEBUG_UTIL_MENU_ITEM_PLAYER_ID] = {sDebugText_Util_Player_Id, DEBUG_UTIL_MENU_ITEM_PLAYER_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[] = { - [DEBUG_UTIL_MENU_ITEM_SCRIPT_1] = {sDebugText_Util_Script_1, DEBUG_UTIL_MENU_ITEM_SCRIPT_1}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_2] = {sDebugText_Util_Script_2, DEBUG_UTIL_MENU_ITEM_SCRIPT_2}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_3] = {sDebugText_Util_Script_3, DEBUG_UTIL_MENU_ITEM_SCRIPT_3}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_4] = {sDebugText_Util_Script_4, DEBUG_UTIL_MENU_ITEM_SCRIPT_4}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_5] = {sDebugText_Util_Script_5, DEBUG_UTIL_MENU_ITEM_SCRIPT_5}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_6] = {sDebugText_Util_Script_6, DEBUG_UTIL_MENU_ITEM_SCRIPT_6}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_7] = {sDebugText_Util_Script_7, DEBUG_UTIL_MENU_ITEM_SCRIPT_7}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_8] = {sDebugText_Util_Script_8, DEBUG_UTIL_MENU_ITEM_SCRIPT_8}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_1] = {sDebugText_Util_Script_1, DEBUG_UTIL_MENU_ITEM_SCRIPT_1}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_2] = {sDebugText_Util_Script_2, DEBUG_UTIL_MENU_ITEM_SCRIPT_2}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_3] = {sDebugText_Util_Script_3, DEBUG_UTIL_MENU_ITEM_SCRIPT_3}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_4] = {sDebugText_Util_Script_4, DEBUG_UTIL_MENU_ITEM_SCRIPT_4}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_5] = {sDebugText_Util_Script_5, DEBUG_UTIL_MENU_ITEM_SCRIPT_5}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_6] = {sDebugText_Util_Script_6, DEBUG_UTIL_MENU_ITEM_SCRIPT_6}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_7] = {sDebugText_Util_Script_7, DEBUG_UTIL_MENU_ITEM_SCRIPT_7}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_8] = {sDebugText_Util_Script_8, DEBUG_UTIL_MENU_ITEM_SCRIPT_8}, }; + static const struct ListMenuItem sDebugMenu_Items_FlagsVars[] = { [DEBUG_FLAGVAR_MENU_ITEM_FLAGS] = {sDebugText_FlagsVars_Flags, DEBUG_FLAGVAR_MENU_ITEM_FLAGS}, @@ -638,6 +664,7 @@ static const struct ListMenuItem sDebugMenu_Items_FlagsVars[] = [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE] = {sDebugText_FlagsVars_SwitchBagUse, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE}, [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_CATCHING] = {sDebugText_FlagsVars_SwitchCatching, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_CATCHING}, }; + static const struct ListMenuItem sDebugMenu_Items_Battle_0[] = { [DEBUG_BATTLE_0_MENU_ITEM_WILD] = {sDebugText_Battle_0_Wild, DEBUG_BATTLE_0_MENU_ITEM_WILD}, @@ -646,6 +673,7 @@ static const struct ListMenuItem sDebugMenu_Items_Battle_0[] = [DEBUG_BATTLE_0_MENU_ITEM_DOUBLE] = {sDebugText_Battle_0_Double, DEBUG_BATTLE_0_MENU_ITEM_DOUBLE}, [DEBUG_BATTLE_0_MENU_ITEM_MULTI] = {sDebugText_Battle_0_Mulit, DEBUG_BATTLE_0_MENU_ITEM_MULTI}, }; + static const struct ListMenuItem sDebugMenu_Items_Battle_1[] = { [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_00] = {sDebugText_Battle_1_AIFlag_00, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_00}, @@ -668,6 +696,7 @@ static const struct ListMenuItem sDebugMenu_Items_Battle_1[] = [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_17] = {sDebugText_Battle_1_AIFlag_17, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_17}, [DEBUG_BATTLE_1_MENU_ITEM_CONTINUE] = {sDebugText_Continue, DEBUG_BATTLE_1_MENU_ITEM_CONTINUE}, }; + static const struct ListMenuItem sDebugMenu_Items_Battle_2[] = { [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_0] = {sDebugText_Battle_2_Terrain_0, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_0}, @@ -681,6 +710,7 @@ static const struct ListMenuItem sDebugMenu_Items_Battle_2[] = [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_8] = {sDebugText_Battle_2_Terrain_8, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_8}, [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_9] = {sDebugText_Battle_2_Terrain_9, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_9}, }; + static const struct ListMenuItem sDebugMenu_Items_Give[] = { [DEBUG_GIVE_MENU_ITEM_ITEM_X] = {sDebugText_Give_GiveItem, DEBUG_GIVE_MENU_ITEM_ITEM_X}, @@ -692,6 +722,7 @@ static const struct ListMenuItem sDebugMenu_Items_Give[] = [DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS] = {sDebugText_Give_BattlePoints, DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS}, [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = {sDebugText_Give_DaycareEgg, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG}, }; + static const struct ListMenuItem sDebugMenu_Items_Fill[] = { [DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST] = {sDebugText_Fill_Pc_Fast, DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST}, @@ -703,44 +734,46 @@ static const struct ListMenuItem sDebugMenu_Items_Fill[] = [DEBUG_FILL_MENU_ITEM_POCKET_BERRIES] = {sDebugText_Fill_PocketBerries, DEBUG_FILL_MENU_ITEM_POCKET_BERRIES}, [DEBUG_FILL_MENU_ITEM_POCKET_KEY_ITEMS] = {sDebugText_Fill_PocketKeyItems, DEBUG_FILL_MENU_ITEM_POCKET_KEY_ITEMS}, }; + static const struct ListMenuItem sDebugMenu_Items_Sound[] = { - [DEBUG_SOUND_MENU_ITEM_SE] = {sDebugText_Sound_SE, DEBUG_SOUND_MENU_ITEM_SE}, - [DEBUG_SOUND_MENU_ITEM_MUS] = {sDebugText_Sound_MUS, DEBUG_SOUND_MENU_ITEM_MUS}, + [DEBUG_SOUND_MENU_ITEM_SE] = {sDebugText_Sound_SFX, DEBUG_SOUND_MENU_ITEM_SE}, + [DEBUG_SOUND_MENU_ITEM_MUS] = {sDebugText_Sound_Music, DEBUG_SOUND_MENU_ITEM_MUS}, }; // ******************************* // Menu Actions static void (*const sDebugMenu_Actions_Main[])(u8) = { - [DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu, - [DEBUG_MENU_ITEM_SCRIPTS] = DebugAction_OpenScriptsMenu, - [DEBUG_MENU_ITEM_FLAGVAR] = DebugAction_OpenFlagsVarsMenu, - //[DEBUG_MENU_ITEM_BATTLE] = DebugAction_OpenBattleMenu, - [DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu, - [DEBUG_MENU_ITEM_FILL] = DebugAction_OpenFillMenu, - [DEBUG_MENU_ITEM_SOUND] = DebugAction_OpenSoundMenu, - [DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, - [DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel + [DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu, + [DEBUG_MENU_ITEM_SCRIPTS] = DebugAction_OpenScriptsMenu, + [DEBUG_MENU_ITEM_FLAGVAR] = DebugAction_OpenFlagsVarsMenu, + //[DEBUG_MENU_ITEM_BATTLE] = DebugAction_OpenBattleMenu, + [DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu, + [DEBUG_MENU_ITEM_FILL] = DebugAction_OpenFillMenu, + [DEBUG_MENU_ITEM_SOUND] = DebugAction_OpenSoundMenu, + [DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, + [DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel }; static void (*const sDebugMenu_Actions_Utilities[])(u8) = { - [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = DebugAction_Util_HealParty, - [DEBUG_UTIL_MENU_ITEM_FLY] = DebugAction_Util_Fly, - [DEBUG_UTIL_MENU_ITEM_WARP] = DebugAction_Util_Warp_Warp, - [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = DebugAction_Util_PoisonMons, - [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = DebugAction_Util_CheckSaveBlock, - [DEBUG_UTIL_MENU_ITEM_WEATHER] = DebugAction_Util_Weather, - [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, - [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, - [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = DebugAction_Util_WatchCredits, - [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_ID] = DebugAction_Util_Trainer_Id, + [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = DebugAction_Util_HealParty, + [DEBUG_UTIL_MENU_ITEM_FLY] = DebugAction_Util_Fly, + [DEBUG_UTIL_MENU_ITEM_WARP] = DebugAction_Util_Warp_Warp, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = DebugAction_Util_PoisonMons, + [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = DebugAction_Util_CheckSaveBlock, + [DEBUG_UTIL_MENU_ITEM_WEATHER] = DebugAction_Util_Weather, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, + [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = DebugAction_Util_WatchCredits, + [DEBUG_UTIL_MENU_ITEM_PLAYER_NAME] = DebugAction_Util_Player_Name, + [DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER] = DebugAction_Util_Player_Gender, + [DEBUG_UTIL_MENU_ITEM_PLAYER_ID] = DebugAction_Util_Player_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) = { [DEBUG_UTIL_MENU_ITEM_SCRIPT_1] = DebugAction_Util_Script_1, @@ -752,6 +785,7 @@ static void (*const sDebugMenu_Actions_Scripts[])(u8) = [DEBUG_UTIL_MENU_ITEM_SCRIPT_7] = DebugAction_Util_Script_7, [DEBUG_UTIL_MENU_ITEM_SCRIPT_8] = DebugAction_Util_Script_8, }; + static void (*const sDebugMenu_Actions_Flags[])(u8) = { [DEBUG_FLAGVAR_MENU_ITEM_FLAGS] = DebugAction_FlagsVars_Flags, @@ -782,6 +816,7 @@ static void (*const sDebugMenu_Actions_Give[])(u8) = [DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS] = DebugAction_Give_MaxBattlePoints, [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = DebugAction_Give_DayCareEgg, }; + static void (*const sDebugMenu_Actions_Fill[])(u8) = { [DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST] = DebugAction_Fill_PCBoxes_Fast, @@ -800,7 +835,6 @@ static void (*const sDebugMenu_Actions_Sound[])(u8) = [DEBUG_SOUND_MENU_ITEM_MUS] = DebugAction_Sound_MUS, }; - // ******************************* // Windows static const struct WindowTemplate sDebugMenuWindowTemplateMain = @@ -813,6 +847,7 @@ static const struct WindowTemplate sDebugMenuWindowTemplateMain = .paletteNum = 15, .baseBlock = 1, }; + static const struct WindowTemplate sDebugMenuWindowTemplateExtra = { .bg = 0, @@ -823,6 +858,7 @@ static const struct WindowTemplate sDebugMenuWindowTemplateExtra = .paletteNum = 15, .baseBlock = 1, }; + static const struct WindowTemplate sDebugMenuWindowTemplateWeather = { .bg = 0, @@ -833,6 +869,7 @@ static const struct WindowTemplate sDebugMenuWindowTemplateWeather = .paletteNum = 15, .baseBlock = 1, }; + static const struct WindowTemplate sDebugMenuWindowTemplateSound = { .bg = 0, @@ -843,6 +880,7 @@ static const struct WindowTemplate sDebugMenuWindowTemplateSound = .paletteNum = 15, .baseBlock = 1, }; + static const struct WindowTemplate sDebugMenuWindowTemplateFlagsVars = { .bg = 0, @@ -862,54 +900,63 @@ static const struct ListMenuTemplate sDebugMenu_ListTemplate_Main = .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Main), }; + static const struct ListMenuTemplate sDebugMenu_ListTemplate_Utilities = { .items = sDebugMenu_Items_Utilities, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Utilities), }; + static const struct ListMenuTemplate sDebugMenu_ListTemplate_Scripts = { .items = sDebugMenu_Items_Scripts, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Scripts), }; + static const struct ListMenuTemplate sDebugMenu_ListTemplate_FlagsVars = { .items = sDebugMenu_Items_FlagsVars, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_FlagsVars), }; + static const struct ListMenuTemplate sDebugMenu_ListTemplate_Battle_0 = { .items = sDebugMenu_Items_Battle_0, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Battle_0), }; + static const struct ListMenuTemplate sDebugMenu_ListTemplate_Battle_1 = { .items = sDebugMenu_Items_Battle_1, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Battle_1), }; + static const struct ListMenuTemplate sDebugMenu_ListTemplate_Battle_2 = { .items = sDebugMenu_Items_Battle_2, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Battle_2), }; + static const struct ListMenuTemplate sDebugMenu_ListTemplate_Give = { .items = sDebugMenu_Items_Give, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Give), }; + static const struct ListMenuTemplate sDebugMenu_ListTemplate_Fill = { .items = sDebugMenu_Items_Fill, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Fill), }; + static const struct ListMenuTemplate sDebugMenu_ListTemplate_Sound = { .items = sDebugMenu_Items_Sound, @@ -928,10 +975,18 @@ void Debug_ShowMainMenu(void) Debug_ShowMenu(DebugTask_HandleMenuInput_Main, sDebugMenu_ListTemplate_Main); } + static void Debug_ReShowMainMenu(void) { Debug_ShowMenu(DebugTask_HandleMenuInput_Main, sDebugMenu_ListTemplate_Main); } + +#define tMenuTaskId data[0] +#define tWindowId data[1] +#define tSubWindowId data[2] +#define tInput data[3] +#define tDigit data[4] + static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate) { struct ListMenuTemplate menuTemplate; @@ -959,43 +1014,46 @@ static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMte menuTemplate.lettersSpacing = 1; menuTemplate.itemVerticalPadding = 0; menuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL; - menuTemplate.fontId = 1; + menuTemplate.fontId = DEBUG_MENU_FONT; menuTemplate.cursorKind = 0; menuTaskId = ListMenuInit(&menuTemplate, 0, 0); // create input handler task inputTaskId = CreateTask(HandleInput, 3); - gTasks[inputTaskId].data[0] = menuTaskId; - gTasks[inputTaskId].data[1] = windowId; - gTasks[inputTaskId].data[2] = 0; + gTasks[inputTaskId].tMenuTaskId = menuTaskId; + gTasks[inputTaskId].tWindowId = windowId; + gTasks[inputTaskId].tSubWindowId = 0; Debug_RefreshListMenu(inputTaskId); //Debug_ShowMenuDynamic(inputTaskId); // draw everything - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); } + static void Debug_DestroyMenu(u8 taskId) { - DestroyListMenuTask(gTasks[taskId].data[0], NULL, NULL); - RemoveWindow(gTasks[taskId].data[1]); + DestroyListMenuTask(gTasks[taskId].tMenuTaskId, NULL, NULL); + RemoveWindow(gTasks[taskId].tWindowId); DestroyTask(taskId); } + static void Debug_DestroyMenu_Full(u8 taskId) { - if (gTasks[taskId].data[2] != 0) + if (gTasks[taskId].tSubWindowId != 0) { - ClearStdWindowAndFrame(gTasks[taskId].data[2], FALSE); + ClearStdWindowAndFrame(gTasks[taskId].tSubWindowId, FALSE); DebugAction_DestroyExtraWindow(taskId); } - DestroyListMenuTask(gTasks[taskId].data[0], NULL, NULL); - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + DestroyListMenuTask(gTasks[taskId].tMenuTaskId, NULL, NULL); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); DestroyTask(taskId); UnfreezeObjectEvents(); Free(sDebugMenuListData); Free(sDebugBattleData); } + static void Debug_DestroyMenu_Full_Script(u8 taskId, const u8 *script) { Debug_DestroyMenu_Full(taskId); @@ -1003,20 +1061,22 @@ static void Debug_DestroyMenu_Full_Script(u8 taskId, const u8 *script) FreezeObjectEvents(); ScriptContext_SetupScript(script); } + static void DebugAction_Cancel(u8 taskId) { Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } + static void DebugAction_DestroyExtraWindow(u8 taskId) { - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); - ClearStdWindowAndFrame(gTasks[taskId].data[2], TRUE); - RemoveWindow(gTasks[taskId].data[2]); + ClearStdWindowAndFrame(gTasks[taskId].tSubWindowId, TRUE); + RemoveWindow(gTasks[taskId].tSubWindowId); - DestroyListMenuTask(gTasks[taskId].data[0], NULL, NULL); + DestroyListMenuTask(gTasks[taskId].tMenuTaskId, NULL, NULL); DestroyTask(taskId); ScriptContext_Enable(); UnfreezeObjectEvents(); @@ -1122,7 +1182,7 @@ static void Debug_RefreshListMenu(u8 taskId) u16 i; const u8 sColor_Red[] = _("{COLOR RED}"); const u8 sColor_Green[] = _("{COLOR GREEN}"); - u8 listTaskId = gTasks[taskId].data[0]; + u8 listTaskId = gTasks[taskId].tMenuTaskId; struct ListMenu *list = (void*) gTasks[listTaskId].data; u8 totalItems, flagResult; u8 const * name; @@ -1209,7 +1269,7 @@ static void Debug_RefreshListMenu(u8 taskId) gMultiuseListMenuTemplate.items = sDebugMenuListData->listItems; gMultiuseListMenuTemplate.totalItems = totalItems; gMultiuseListMenuTemplate.maxShowed = DEBUG_MENU_HEIGHT_MAIN; - gMultiuseListMenuTemplate.windowId = gTasks[taskId].data[1]; + gMultiuseListMenuTemplate.windowId = gTasks[taskId].tWindowId; gMultiuseListMenuTemplate.header_X = 0; gMultiuseListMenuTemplate.item_X = 8; gMultiuseListMenuTemplate.cursor_X = 0; @@ -1223,15 +1283,16 @@ static void Debug_RefreshListMenu(u8 taskId) gMultiuseListMenuTemplate.fontId = 1; gMultiuseListMenuTemplate.cursorKind = 0; } + static void Debug_RedrawListMenu(u8 taskId) { - u8 listTaskId = gTasks[taskId].data[0]; + u8 listTaskId = gTasks[taskId].tMenuTaskId; u16 scrollOffset, selectedRow; ListMenuGetScrollAndRow(listTaskId, &scrollOffset, &selectedRow); - DestroyListMenuTask(gTasks[taskId].data[0], &scrollOffset, &selectedRow); + DestroyListMenuTask(gTasks[taskId].tMenuTaskId, &scrollOffset, &selectedRow); Debug_RefreshListMenu(taskId); - gTasks[taskId].data[0] = ListMenuInit(&gMultiuseListMenuTemplate, scrollOffset, selectedRow); + gTasks[taskId].tMenuTaskId = ListMenuInit(&gMultiuseListMenuTemplate, scrollOffset, selectedRow); } @@ -1240,7 +1301,7 @@ static void Debug_RedrawListMenu(u8 taskId) static void DebugTask_HandleMenuInput_Main(u8 taskId) { void (*func)(u8); - u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuTaskId); if (JOY_NEW(A_BUTTON)) { @@ -1255,10 +1316,11 @@ static void DebugTask_HandleMenuInput_Main(u8 taskId) ScriptContext_Enable(); } } + static void DebugTask_HandleMenuInput_Utilities(u8 taskId) { void (*func)(u8); - u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuTaskId); if (JOY_NEW(A_BUTTON)) { @@ -1273,10 +1335,11 @@ static void DebugTask_HandleMenuInput_Utilities(u8 taskId) Debug_ReShowMainMenu(); } } + static void DebugTask_HandleMenuInput_Scripts(u8 taskId) { void (*func)(u8); - u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuTaskId); if (JOY_NEW(A_BUTTON)) { @@ -1291,10 +1354,11 @@ static void DebugTask_HandleMenuInput_Scripts(u8 taskId) Debug_ReShowMainMenu(); } } + static void DebugTask_HandleMenuInput_FlagsVars(u8 taskId) { void (*func)(u8); - u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuTaskId); if (JOY_NEW(A_BUTTON)) { @@ -1304,10 +1368,10 @@ static void DebugTask_HandleMenuInput_FlagsVars(u8 taskId) func(taskId); // Remove TRUE/FALSE window for functions that haven't been assigned flags - if (gTasks[taskId].data[3] == 0xFF) + if (gTasks[taskId].tInput == 0xFF) { - ClearStdWindowAndFrame(gTasks[taskId].data[2], TRUE); - RemoveWindow(gTasks[taskId].data[2]); + ClearStdWindowAndFrame(gTasks[taskId].tSubWindowId, TRUE); + RemoveWindow(gTasks[taskId].tSubWindowId); Free(sDebugMenuListData); } else @@ -1345,16 +1409,17 @@ static void DebugTask_HandleBattleMenuReDraw(u8 taskId) break; } } + static void DebugTask_HandleMenuInput_Battle(u8 taskId) { void (*func)(u8); - u8 listTaskId = gTasks[taskId].data[0]; + u8 listTaskId = gTasks[taskId].tMenuTaskId; u32 input = ListMenu_ProcessInput(listTaskId); u16 idx; ListMenuGetCurrentItemArrayId(listTaskId, &idx); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); @@ -1402,7 +1467,7 @@ static void DebugTask_HandleMenuInput_Battle(u8 taskId) break; } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { switch (sDebugBattleData->submenu) { @@ -1478,7 +1543,7 @@ static void Debug_InitializeBattle(u8 taskId) static void DebugTask_HandleMenuInput_Give(u8 taskId) { void (*func)(u8); - u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuTaskId); if (JOY_NEW(A_BUTTON)) { @@ -1493,28 +1558,30 @@ static void DebugTask_HandleMenuInput_Give(u8 taskId) Debug_ReShowMainMenu(); } } + static void DebugTask_HandleMenuInput_Fill(u8 taskId) { void (*func)(u8); - u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuTaskId); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if ((func = sDebugMenu_Actions_Fill[input]) != NULL) func(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); Debug_DestroyMenu(taskId); Debug_ReShowMainMenu(); } } + static void DebugTask_HandleMenuInput_Sound(u8 taskId) { void (*func)(u8); - u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuTaskId); if (JOY_NEW(A_BUTTON)) { @@ -1537,11 +1604,13 @@ static void DebugAction_OpenUtilitiesMenu(u8 taskId) Debug_DestroyMenu(taskId); Debug_ShowMenu(DebugTask_HandleMenuInput_Utilities, sDebugMenu_ListTemplate_Utilities); } + static void DebugAction_OpenScriptsMenu(u8 taskId) { Debug_DestroyMenu(taskId); Debug_ShowMenu(DebugTask_HandleMenuInput_Scripts, sDebugMenu_ListTemplate_Scripts); } + static void DebugAction_OpenFlagsVarsMenu(u8 taskId) { Debug_DestroyMenu(taskId); @@ -1561,11 +1630,13 @@ static void DebugAction_OpenGiveMenu(u8 taskId) Debug_DestroyMenu(taskId); Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give); } + static void DebugAction_OpenFillMenu(u8 taskId) { Debug_DestroyMenu(taskId); Debug_ShowMenu(DebugTask_HandleMenuInput_Fill, sDebugMenu_ListTemplate_Fill); } + static void DebugAction_OpenSoundMenu(u8 taskId) { Debug_DestroyMenu(taskId); @@ -1581,6 +1652,7 @@ static void DebugAction_Util_HealParty(u8 taskId) ScriptContext_Enable(); Debug_DestroyMenu_Full(taskId); } + static void DebugAction_Util_Fly(u8 taskId) { FlagSet(FLAG_VISITED_LITTLEROOT_TOWN); @@ -1605,35 +1677,42 @@ static void DebugAction_Util_Fly(u8 taskId) SetMainCallback2(CB2_OpenFlyMap); } +#define tMapGroup data[5] +#define tMapNum data[6] +#define tWarp data[7] + +#define LAST_MAP_GROUP (MAP_GROUPS_COUNT - 1) + static void DebugAction_Util_Warp_Warp(u8 taskId) { u8 windowId; - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); - ConvertIntToDecimalStringN(gStringVar2, MAP_GROUPS_COUNT-1, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 3); + ConvertIntToDecimalStringN(gStringVar2, LAST_MAP_GROUP, STR_CONV_MODE_LEADING_ZEROS, 3); StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax); StringCopy(gStringVar3, gText_DigitIndicator[0]); StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectMapGroup); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Util_Warp_SelectMapGroup; - gTasks[taskId].data[2] = windowId; - gTasks[taskId].data[3] = 0; //Current Flag - gTasks[taskId].data[4] = 0; //Digit Selected - gTasks[taskId].data[5] = 0; //Map Group - gTasks[taskId].data[6] = 0; //Map - gTasks[taskId].data[7] = 0; //warp + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; + gTasks[taskId].tMapGroup = 0; + gTasks[taskId].tMapNum = 0; + gTasks[taskId].tWarp = 0; } + static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId) { if (JOY_NEW(DPAD_ANY)) @@ -1641,48 +1720,48 @@ static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId) PlaySE(SE_SELECT); if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > MAP_GROUPS_COUNT - 1) - gTasks[taskId].data[3] = MAP_GROUPS_COUNT - 1; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > LAST_MAP_GROUP) + gTasks[taskId].tInput = LAST_MAP_GROUP; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 0) - gTasks[taskId].data[3] = 0; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 0) + gTasks[taskId].tInput = 0; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < 2) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < 2) + gTasks[taskId].tDigit += 1; } - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); - ConvertIntToDecimalStringN(gStringVar2, MAP_GROUPS_COUNT - 1, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 3); + ConvertIntToDecimalStringN(gStringVar2, LAST_MAP_GROUP, STR_CONV_MODE_LEADING_ZEROS, 3); StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax); - StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].tDigit]); StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectMapGroup); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - gTasks[taskId].data[5] = gTasks[taskId].data[3]; - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + gTasks[taskId].tMapGroup = gTasks[taskId].tInput; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1 >= 100) ? 3 : 2); - ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1 >= 100) ? 3 : 2); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].tMapGroup] - 1 >= 100) ? 3 : 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].tMapGroup] - 1, STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].tMapGroup] - 1 >= 100) ? 3 : 2); StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax); - GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0); - StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].tMapGroup, gTasks[taskId].tInput)->regionMapSectionId, 0); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].tDigit]); StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectMap); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Util_Warp_SelectMap; } @@ -1692,55 +1771,56 @@ static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId) DebugAction_DestroyExtraWindow(taskId); } } + static void DebugAction_Util_Warp_SelectMap(u8 taskId) { - u8 max_value = MAP_GROUP_COUNT[gTasks[taskId].data[5]]; //maps in the selected map group + u8 max_value = MAP_GROUP_COUNT[gTasks[taskId].tMapGroup]; //maps in the selected map group if (JOY_NEW(DPAD_ANY)) { PlaySE(SE_SELECT); if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > max_value - 1) - gTasks[taskId].data[3] = max_value - 1; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > max_value - 1) + gTasks[taskId].tInput = max_value - 1; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 0) - gTasks[taskId].data[3] = 0; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 0) + gTasks[taskId].tInput = 0; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < 2) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < 2) + gTasks[taskId].tDigit += 1; } - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2); - ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].tMapGroup] - 1, STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2); StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax); - GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0); - StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].tMapGroup, gTasks[taskId].tInput)->regionMapSectionId, 0); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].tDigit]); StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectMap); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - gTasks[taskId].data[6] = gTasks[taskId].data[3]; - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + gTasks[taskId].tMapNum = gTasks[taskId].tInput; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; - StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 3); StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectWarp); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Util_Warp_SelectWarp; } else if (JOY_NEW(B_BUTTON)) @@ -1749,6 +1829,7 @@ static void DebugAction_Util_Warp_SelectMap(u8 taskId) DebugAction_DestroyExtraWindow(taskId); } } + static void DebugAction_Util_Warp_SelectWarp(u8 taskId) { if (JOY_NEW(DPAD_ANY)) @@ -1756,29 +1837,28 @@ static void DebugAction_Util_Warp_SelectWarp(u8 taskId) PlaySE(SE_SELECT); if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > 10) - gTasks[taskId].data[3] = 10; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > 10) + gTasks[taskId].tInput = 10; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 0) - gTasks[taskId].data[3] = 0; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 0) + gTasks[taskId].tInput = 0; } - StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 3); StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectWarp); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - gTasks[taskId].data[7] = gTasks[taskId].data[3]; - //WARP + gTasks[taskId].tWarp = gTasks[taskId].tInput; //If there's no warp with the number available, warp to the center of the map. - SetWarpDestinationToMapWarp(gTasks[taskId].data[5], gTasks[taskId].data[6], gTasks[taskId].data[7]); + SetWarpDestinationToMapWarp(gTasks[taskId].tMapGroup, gTasks[taskId].tMapNum, gTasks[taskId].tWarp); DoWarp(); ResetInitialPlayerAvatarState(); DebugAction_DestroyExtraWindow(taskId); @@ -1790,6 +1870,10 @@ static void DebugAction_Util_Warp_SelectWarp(u8 taskId) } } +#undef tMapGroup +#undef tMapNum +#undef tWarp + static void DebugAction_Util_PoisonMons(u8 taskId) { int i; @@ -1832,9 +1916,7 @@ void CheckPokemonStorageSize(struct ScriptContext *ctx) static void DebugAction_Util_CheckSaveBlock(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_CheckSaveBlock); + Debug_DestroyMenu_Full_Script(taskId, Debug_CheckSaveBlock); } static const u8 sWeatherNames[22][24] = { @@ -1857,33 +1939,34 @@ static const u8 sWeatherNames[22][24] = { [WEATHER_ROUTE119_CYCLE] = _("ROUTE119 CYCLE"), [WEATHER_ROUTE123_CYCLE] = _("ROUTE123 CYCLE"), }; -static const u8 sText_WeatherNotDefined[] = _("NOT DEFINED!!!"); +static const u8 sDebugText_WeatherNotDefined[] = _("NOT DEFINED!!!"); static void DebugAction_Util_Weather(u8 taskId) { u8 windowId; - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); windowId = AddWindow(&sDebugMenuWindowTemplateWeather); DrawStdWindowFrame(windowId, FALSE); - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); //Display initial ID StringCopy(gStringVar2, gText_DigitIndicator[0]); ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar1, sWeatherNames[0], CHAR_SPACE, 30); StringExpandPlaceholders(gStringVar4, sDebugText_Util_Weather_ID); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Util_Weather_SelectId; - gTasks[taskId].data[2] = windowId; - gTasks[taskId].data[3] = 0; //Current ID - gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; } + static void DebugAction_Util_Weather_SelectId(u8 taskId) { if (JOY_NEW(DPAD_ANY)) @@ -1892,44 +1975,44 @@ static void DebugAction_Util_Weather_SelectId(u8 taskId) if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > WEATHER_ROUTE123_CYCLE) - gTasks[taskId].data[3] = WEATHER_ROUTE123_CYCLE; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > WEATHER_ROUTE123_CYCLE) + gTasks[taskId].tInput = WEATHER_ROUTE123_CYCLE; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < WEATHER_NONE) - gTasks[taskId].data[3] = WEATHER_NONE; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < WEATHER_NONE) + gTasks[taskId].tInput = WEATHER_NONE; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < 2) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < 2) + gTasks[taskId].tDigit += 1; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 2); - if (gTasks[taskId].data[3] <= 15 || gTasks[taskId].data[3] >= 20) - StringCopyPadded(gStringVar1, sWeatherNames[gTasks[taskId].data[3]], CHAR_SPACE, 30); + if (gTasks[taskId].tInput <= 15 || gTasks[taskId].tInput >= 20) + StringCopyPadded(gStringVar1, sWeatherNames[gTasks[taskId].tInput], CHAR_SPACE, 30); else - StringCopyPadded(gStringVar1, sText_WeatherNotDefined, CHAR_SPACE, 30); + StringCopyPadded(gStringVar1, sDebugText_WeatherNotDefined, CHAR_SPACE, 30); StringExpandPlaceholders(gStringVar4, sDebugText_Util_Weather_ID); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - if (gTasks[taskId].data[3] <= 14 || gTasks[taskId].data[3] >= 20) + if (gTasks[taskId].tInput <= 14 || gTasks[taskId].tInput >= 20) { - gTasks[taskId].data[5] = gTasks[taskId].data[3]; + gTasks[taskId].data[5] = gTasks[taskId].tInput; SetWeather(gTasks[taskId].data[5]); } } @@ -1944,47 +2027,53 @@ static void DebugAction_Util_CheckWallClock(u8 taskId) { Debug_DestroyMenu_Full_Script(taskId, PlayersHouse_2F_EventScript_CheckWallClock); } + static void DebugAction_Util_SetWallClock(u8 taskId) { Debug_DestroyMenu_Full_Script(taskId, PlayersHouse_2F_EventScript_SetWallClock); } + static void DebugAction_Util_WatchCredits(u8 taskId) { - struct Task* task = &gTasks[taskId]; Debug_DestroyMenu_Full(taskId); SetMainCallback2(CB2_StartCreditsSequence); } -static void DebugAction_Util_Trainer_Name(u8 taskId) + +static void DebugAction_Util_Player_Name(u8 taskId) { - NewGameBirchSpeech_SetDefaultPlayerName(Random() % 20); - DoNamingScreen(0, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_ReturnToFieldContinueScript); + DoNamingScreen(NAMING_SCREEN_PLAYER, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_ReturnToFieldContinueScript); } -static void DebugAction_Util_Trainer_Gender(u8 taskId) + +static void DebugAction_Util_Player_Gender(u8 taskId) { - if (gSaveBlock2Ptr->playerGender == 0) // 0 Male, 1 Female - gSaveBlock2Ptr->playerGender = 1; + if (gSaveBlock2Ptr->playerGender == MALE) + gSaveBlock2Ptr->playerGender = FEMALE; else - gSaveBlock2Ptr->playerGender = 0; + gSaveBlock2Ptr->playerGender = MALE; Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } -static void DebugAction_Util_Trainer_Id(u8 taskId) + +static void DebugAction_Util_Player_Id(u8 taskId) { u32 trainerId = ((Random() << 16) | Random()); SetTrainerId(trainerId, gSaveBlock2Ptr->playerTrainerId); Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } + static void DebugAction_Util_Clear_Boxes(u8 taskId) { ResetPokemonStorageSystem(); Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } + 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); @@ -1994,35 +2083,42 @@ static void DebugAction_Util_HatchAnEgg(u8 taskId) // Actions Scripts static void DebugAction_Util_Script_1(u8 taskId) { - Debug_DestroyMenu_Full_Script(taskId, Debug_Script_1); + Debug_DestroyMenu_Full_Script(taskId, Debug_EventScript_Script_1); } + static void DebugAction_Util_Script_2(u8 taskId) { - Debug_DestroyMenu_Full_Script(taskId, Debug_Script_2); + Debug_DestroyMenu_Full_Script(taskId, Debug_EventScript_Script_2); } + static void DebugAction_Util_Script_3(u8 taskId) { - Debug_DestroyMenu_Full_Script(taskId, Debug_Script_3); + Debug_DestroyMenu_Full_Script(taskId, Debug_EventScript_Script_3); } + static void DebugAction_Util_Script_4(u8 taskId) { - Debug_DestroyMenu_Full_Script(taskId, Debug_Script_4); + Debug_DestroyMenu_Full_Script(taskId, Debug_EventScript_Script_4); } + static void DebugAction_Util_Script_5(u8 taskId) { - Debug_DestroyMenu_Full_Script(taskId, Debug_Script_5); + Debug_DestroyMenu_Full_Script(taskId, Debug_EventScript_Script_5); } + static void DebugAction_Util_Script_6(u8 taskId) { - Debug_DestroyMenu_Full_Script(taskId, Debug_Script_6); + Debug_DestroyMenu_Full_Script(taskId, Debug_EventScript_Script_6); } + static void DebugAction_Util_Script_7(u8 taskId) { - Debug_DestroyMenu_Full_Script(taskId, Debug_Script_7); + Debug_DestroyMenu_Full_Script(taskId, Debug_EventScript_Script_7); } + static void DebugAction_Util_Script_8(u8 taskId) { - Debug_DestroyMenu_Full_Script(taskId, Debug_Script_8); + Debug_DestroyMenu_Full_Script(taskId, Debug_EventScript_Script_8); } // ******************************* @@ -2031,17 +2127,17 @@ static void DebugAction_FlagsVars_Flags(u8 taskId) { u8 windowId; - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); - //Display initial Flag + // Display initial flag ConvertIntToDecimalStringN(gStringVar1, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); ConvertIntToHexStringN(gStringVar2, 1, STR_CONV_MODE_LEFT_ALIGN, 3); StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_FlagHex); @@ -2051,17 +2147,20 @@ static void DebugAction_FlagsVars_Flags(u8 taskId) StringCopyPadded(gStringVar2, sDebugText_False, CHAR_SPACE, 15); StringCopy(gStringVar3, gText_DigitIndicator[0]); StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_Flag); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_FlagsVars_FlagsSelect; - gTasks[taskId].data[2] = windowId; - gTasks[taskId].data[3] = FLAG_TEMP_1; //Current Flag - gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tInput = FLAG_TEMP_1; + gTasks[taskId].tDigit = 0; } + static void DebugAction_FlagsVars_FlagsSelect(u8 taskId) { if (JOY_NEW(A_BUTTON)) - FlagToggle(gTasks[taskId].data[3]); + { + FlagToggle(gTasks[taskId].tInput); + } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); @@ -2072,68 +2171,64 @@ static void DebugAction_FlagsVars_FlagsSelect(u8 taskId) if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] >= FLAGS_COUNT){ - gTasks[taskId].data[3] = FLAGS_COUNT - 1; - } + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput >= FLAGS_COUNT) + gTasks[taskId].tInput = FLAGS_COUNT - 1; } if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 1){ - gTasks[taskId].data[3] = 1; - } + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 1) + gTasks[taskId].tInput = 1; } if (JOY_NEW(DPAD_LEFT)) { PlaySE(SE_SELECT); - gTasks[taskId].data[4] -= 1; - if (gTasks[taskId].data[4] < 0) - { - gTasks[taskId].data[4] = 0; - } + gTasks[taskId].tDigit -= 1; + if (gTasks[taskId].tDigit < 0) + gTasks[taskId].tDigit = 0; } if (JOY_NEW(DPAD_RIGHT)) { PlaySE(SE_SELECT); - gTasks[taskId].data[4] += 1; - if (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_FLAGS - 1) - { - gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_FLAGS - 1; - } + gTasks[taskId].tDigit += 1; + if (gTasks[taskId].tDigit > DEBUG_NUMBER_DIGITS_FLAGS - 1) + gTasks[taskId].tDigit = DEBUG_NUMBER_DIGITS_FLAGS - 1; } if (JOY_NEW(DPAD_ANY) || JOY_NEW(A_BUTTON)) { - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); - ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); + ConvertIntToHexStringN(gStringVar2, gTasks[taskId].tInput, STR_CONV_MODE_LEFT_ALIGN, 3); StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_FlagHex); - if (FlagGet(gTasks[taskId].data[3]) == TRUE) + if (FlagGet(gTasks[taskId].tInput) == TRUE) StringCopyPadded(gStringVar2, sDebugText_True, CHAR_SPACE, 15); else StringCopyPadded(gStringVar2, sDebugText_False, CHAR_SPACE, 15); - StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].tDigit]); StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_Flag); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } } +#define tVarValue data[5] + static void DebugAction_FlagsVars_Vars(u8 taskId) { u8 windowId; - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); - //Display initial Variable + // Display initial var ConvertIntToDecimalStringN(gStringVar1, VARS_START, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); ConvertIntToHexStringN(gStringVar2, VARS_START, STR_CONV_MODE_LEFT_ALIGN, 4); StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_VariableHex); @@ -2141,79 +2236,79 @@ static void DebugAction_FlagsVars_Vars(u8 taskId) StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringCopy(gStringVar2, gText_DigitIndicator[0]); StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_Variable); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_FlagsVars_Select; - gTasks[taskId].data[2] = windowId; - gTasks[taskId].data[3] = VARS_START; //Current Variable - gTasks[taskId].data[4] = 0; //Digit Selected - gTasks[taskId].data[5] = 0; //Current Variable VALUE + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tInput = VARS_START; + gTasks[taskId].tDigit = 0; + gTasks[taskId].tVarValue = 0; } static void DebugAction_FlagsVars_Select(u8 taskId) { if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > VARS_END) - gTasks[taskId].data[3] = VARS_END; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > VARS_END) + gTasks[taskId].tInput = VARS_END; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < VARS_START) - gTasks[taskId].data[3] = VARS_START; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < VARS_START) + gTasks[taskId].tInput = VARS_START; } if (JOY_NEW(DPAD_LEFT)) { - gTasks[taskId].data[4] -= 1; - if (gTasks[taskId].data[4] < 0) - gTasks[taskId].data[4] = 0; + gTasks[taskId].tDigit -= 1; + if (gTasks[taskId].tDigit < 0) + gTasks[taskId].tDigit = 0; } if (JOY_NEW(DPAD_RIGHT)) { - gTasks[taskId].data[4] += 1; - if (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_VARIABLES - 1) - gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_VARIABLES - 1; + gTasks[taskId].tDigit += 1; + if (gTasks[taskId].tDigit > DEBUG_NUMBER_DIGITS_VARIABLES - 1) + gTasks[taskId].tDigit = DEBUG_NUMBER_DIGITS_VARIABLES - 1; } if (JOY_NEW(DPAD_ANY)) { PlaySE(SE_SELECT); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); - ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + ConvertIntToHexStringN(gStringVar2, gTasks[taskId].tInput, STR_CONV_MODE_LEFT_ALIGN, 4); StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_VariableHex); - if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value, if 65535 the value hasnt been set - gTasks[taskId].data[5] = 0; + if (VarGetIfExist(gTasks[taskId].tInput) == 0xFFFF) + gTasks[taskId].tVarValue = 0; else - gTasks[taskId].data[5] = VarGet(gTasks[taskId].data[3]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[5], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit + gTasks[taskId].tVarValue = VarGet(gTasks[taskId].tInput); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tVarValue, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); //Combine str's to full window string StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_Variable); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - gTasks[taskId].data[4] = 0; + gTasks[taskId].tDigit = 0; PlaySE(SE_SELECT); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); - ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + ConvertIntToHexStringN(gStringVar2, gTasks[taskId].tInput, STR_CONV_MODE_LEFT_ALIGN, 4); StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_VariableHex); - if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value if 65535 the value hasnt been set - gTasks[taskId].data[5] = 0; + if (VarGetIfExist(gTasks[taskId].tInput) == 0xFFFF) + gTasks[taskId].tVarValue = 0; else - gTasks[taskId].data[5] = VarGet(gTasks[taskId].data[3]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[5], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + gTasks[taskId].tVarValue = VarGet(gTasks[taskId].tInput); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tVarValue, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_VariableValueSet); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].data[6] = gTasks[taskId].data[5]; //New value selector gTasks[taskId].func = DebugAction_FlagsVars_SetValue; @@ -2225,12 +2320,13 @@ static void DebugAction_FlagsVars_Select(u8 taskId) return; } } + static void DebugAction_FlagsVars_SetValue(u8 taskId) { if (JOY_NEW(DPAD_UP)) { - if (gTasks[taskId].data[6] + sPowersOfTen[gTasks[taskId].data[4]] <= 32000) - gTasks[taskId].data[6] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[6] + sPowersOfTen[gTasks[taskId].tDigit] <= 32000) + gTasks[taskId].data[6] += sPowersOfTen[gTasks[taskId].tDigit]; else gTasks[taskId].data[6] = 32000 - 1; @@ -2239,32 +2335,27 @@ static void DebugAction_FlagsVars_SetValue(u8 taskId) } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[6] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[6] < 0){ + gTasks[taskId].data[6] -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].data[6] < 0) gTasks[taskId].data[6] = 0; - } } if (JOY_NEW(DPAD_LEFT)) { - gTasks[taskId].data[4] -= 1; - if (gTasks[taskId].data[4] < 0) - { - gTasks[taskId].data[4] = 0; - } + gTasks[taskId].tDigit -= 1; + if (gTasks[taskId].tDigit < 0) + gTasks[taskId].tDigit = 0; } if (JOY_NEW(DPAD_RIGHT)) { - gTasks[taskId].data[4] += 1; - if (gTasks[taskId].data[4] > 4) - { - gTasks[taskId].data[4] = 4; - } + gTasks[taskId].tDigit += 1; + if (gTasks[taskId].tDigit > 4) + gTasks[taskId].tDigit = 4; } if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); - VarSet(gTasks[taskId].data[3], gTasks[taskId].data[6]); + VarSet(gTasks[taskId].tInput, gTasks[taskId].data[6]); } else if (JOY_NEW(B_BUTTON)) { @@ -2277,18 +2368,20 @@ static void DebugAction_FlagsVars_SetValue(u8 taskId) { PlaySE(SE_SELECT); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); - ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + ConvertIntToHexStringN(gStringVar2, gTasks[taskId].tInput, STR_CONV_MODE_LEFT_ALIGN, 4); StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_VariableHex); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[6], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_VariableValueSet); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } } +#undef tVarValue + static void DebugAction_FlagsVars_PokedexFlags_All(u8 taskId) { u16 i; @@ -2300,6 +2393,7 @@ static void DebugAction_FlagsVars_PokedexFlags_All(u8 taskId) Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } + static void DebugAction_FlagsVars_PokedexFlags_Reset(u8 taskId) { int boxId, boxPosition, partyId; @@ -2336,6 +2430,7 @@ static void DebugAction_FlagsVars_PokedexFlags_Reset(u8 taskId) Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } + static void DebugAction_FlagsVars_SwitchDex(u8 taskId) { if (FlagGet(FLAG_SYS_POKEDEX_GET)) @@ -2344,17 +2439,21 @@ static void DebugAction_FlagsVars_SwitchDex(u8 taskId) PlaySE(SE_PC_LOGIN); FlagToggle(FLAG_SYS_POKEDEX_GET); } + static void DebugAction_FlagsVars_SwitchNatDex(u8 taskId) { if (IsNationalPokedexEnabled()) { DisableNationalPokedex(); PlaySE(SE_PC_OFF); - }else{ + } + else + { EnableNationalPokedex(); PlaySE(SE_PC_LOGIN); } } + static void DebugAction_FlagsVars_SwitchPokeNav(u8 taskId) { if (FlagGet(FLAG_SYS_POKENAV_GET)) @@ -2363,6 +2462,7 @@ static void DebugAction_FlagsVars_SwitchPokeNav(u8 taskId) PlaySE(SE_PC_LOGIN); FlagToggle(FLAG_SYS_POKENAV_GET); } + static void DebugAction_FlagsVars_RunningShoes(u8 taskId) { if (FlagGet(FLAG_SYS_B_DASH)) @@ -2371,59 +2471,36 @@ static void DebugAction_FlagsVars_RunningShoes(u8 taskId) PlaySE(SE_PC_LOGIN); FlagToggle(FLAG_SYS_B_DASH); } + static void DebugAction_FlagsVars_ToggleFlyFlags(u8 taskId) { - // Sound effect if (FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER)) - { PlaySE(SE_PC_OFF); - - FlagClear(FLAG_VISITED_LITTLEROOT_TOWN); - FlagClear(FLAG_VISITED_OLDALE_TOWN); - FlagClear(FLAG_VISITED_DEWFORD_TOWN); - FlagClear(FLAG_VISITED_LAVARIDGE_TOWN); - FlagClear(FLAG_VISITED_FALLARBOR_TOWN); - FlagClear(FLAG_VISITED_VERDANTURF_TOWN); - FlagClear(FLAG_VISITED_PACIFIDLOG_TOWN); - FlagClear(FLAG_VISITED_PETALBURG_CITY); - FlagClear(FLAG_VISITED_SLATEPORT_CITY); - FlagClear(FLAG_VISITED_MAUVILLE_CITY); - FlagClear(FLAG_VISITED_RUSTBORO_CITY); - FlagClear(FLAG_VISITED_FORTREE_CITY); - FlagClear(FLAG_VISITED_LILYCOVE_CITY); - FlagClear(FLAG_VISITED_MOSSDEEP_CITY); - FlagClear(FLAG_VISITED_SOOTOPOLIS_CITY); - FlagClear(FLAG_VISITED_EVER_GRANDE_CITY); - FlagClear(FLAG_LANDMARK_POKEMON_LEAGUE); - FlagClear(FLAG_LANDMARK_BATTLE_FRONTIER); - } else - { PlaySE(SE_PC_LOGIN); - FlagSet(FLAG_VISITED_LITTLEROOT_TOWN); - FlagSet(FLAG_VISITED_OLDALE_TOWN); - FlagSet(FLAG_VISITED_DEWFORD_TOWN); - FlagSet(FLAG_VISITED_LAVARIDGE_TOWN); - FlagSet(FLAG_VISITED_FALLARBOR_TOWN); - FlagSet(FLAG_VISITED_VERDANTURF_TOWN); - FlagSet(FLAG_VISITED_PACIFIDLOG_TOWN); - FlagSet(FLAG_VISITED_PETALBURG_CITY); - FlagSet(FLAG_VISITED_SLATEPORT_CITY); - FlagSet(FLAG_VISITED_MAUVILLE_CITY); - FlagSet(FLAG_VISITED_RUSTBORO_CITY); - FlagSet(FLAG_VISITED_FORTREE_CITY); - FlagSet(FLAG_VISITED_LILYCOVE_CITY); - FlagSet(FLAG_VISITED_MOSSDEEP_CITY); - FlagSet(FLAG_VISITED_SOOTOPOLIS_CITY); - FlagSet(FLAG_VISITED_EVER_GRANDE_CITY); - FlagSet(FLAG_LANDMARK_POKEMON_LEAGUE); - FlagSet(FLAG_LANDMARK_BATTLE_FRONTIER); - } + FlagToggle(FLAG_VISITED_LITTLEROOT_TOWN); + FlagToggle(FLAG_VISITED_OLDALE_TOWN); + FlagToggle(FLAG_VISITED_DEWFORD_TOWN); + FlagToggle(FLAG_VISITED_LAVARIDGE_TOWN); + FlagToggle(FLAG_VISITED_FALLARBOR_TOWN); + FlagToggle(FLAG_VISITED_VERDANTURF_TOWN); + FlagToggle(FLAG_VISITED_PACIFIDLOG_TOWN); + FlagToggle(FLAG_VISITED_PETALBURG_CITY); + FlagToggle(FLAG_VISITED_SLATEPORT_CITY); + FlagToggle(FLAG_VISITED_MAUVILLE_CITY); + FlagToggle(FLAG_VISITED_RUSTBORO_CITY); + FlagToggle(FLAG_VISITED_FORTREE_CITY); + FlagToggle(FLAG_VISITED_LILYCOVE_CITY); + FlagToggle(FLAG_VISITED_MOSSDEEP_CITY); + FlagToggle(FLAG_VISITED_SOOTOPOLIS_CITY); + FlagToggle(FLAG_VISITED_EVER_GRANDE_CITY); + FlagToggle(FLAG_LANDMARK_POKEMON_LEAGUE); + FlagToggle(FLAG_LANDMARK_BATTLE_FRONTIER); } + static void DebugAction_FlagsVars_ToggleBadgeFlags(u8 taskId) { - // Sound effect if (FlagGet(FLAG_BADGE08_GET)) PlaySE(SE_PC_OFF); else @@ -2437,6 +2514,7 @@ static void DebugAction_FlagsVars_ToggleBadgeFlags(u8 taskId) FlagToggle(FLAG_BADGE07_GET); FlagToggle(FLAG_BADGE08_GET); } + static void DebugAction_FlagsVars_ToggleFrontierPass(u8 taskId) { // Sound effect @@ -2446,6 +2524,7 @@ static void DebugAction_FlagsVars_ToggleFrontierPass(u8 taskId) PlaySE(SE_PC_LOGIN); FlagToggle(FLAG_SYS_FRONTIER_PASS); } + static void DebugAction_FlagsVars_CollisionOnOff(u8 taskId) { #if OW_FLAG_NO_COLLISION == 0 @@ -2458,6 +2537,7 @@ static void DebugAction_FlagsVars_CollisionOnOff(u8 taskId) FlagToggle(OW_FLAG_NO_COLLISION); #endif } + static void DebugAction_FlagsVars_EncounterOnOff(u8 taskId) { #if OW_FLAG_NO_ENCOUNTER == 0 @@ -2470,6 +2550,7 @@ static void DebugAction_FlagsVars_EncounterOnOff(u8 taskId) FlagToggle(OW_FLAG_NO_ENCOUNTER); #endif } + static void DebugAction_FlagsVars_TrainerSeeOnOff(u8 taskId) { #if OW_FLAG_NO_TRAINER_SEE == 0 @@ -2482,6 +2563,7 @@ static void DebugAction_FlagsVars_TrainerSeeOnOff(u8 taskId) FlagToggle(OW_FLAG_NO_TRAINER_SEE); #endif } + static void DebugAction_FlagsVars_BagUseOnOff(u8 taskId) { #if B_FLAG_NO_BAG_USE == 0 @@ -2494,6 +2576,7 @@ static void DebugAction_FlagsVars_BagUseOnOff(u8 taskId) FlagToggle(B_FLAG_NO_BAG_USE); #endif } + static void DebugAction_FlagsVars_CatchingOnOff(u8 taskId) { #if B_FLAG_NO_CATCHING == 0 @@ -2510,37 +2593,41 @@ static void DebugAction_FlagsVars_CatchingOnOff(u8 taskId) // ******************************* // Actions Give #define ITEM_TAG 0xFDF3 +#define tItemId data[5] +#define tSpriteId data[6] + static void DebugAction_Give_Item(u8 taskId) { u8 windowId; - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); - //Display initial ID + // Display initial item StringCopy(gStringVar2, gText_DigitIndicator[0]); ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); CopyItemName(1, gStringVar1); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_ItemID); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Item_SelectId; - gTasks[taskId].data[2] = windowId; - gTasks[taskId].data[3] = 1; //Current ID - gTasks[taskId].data[4] = 0; //Digit Selected - gTasks[taskId].data[6] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, gTasks[taskId].data[3]); - gSprites[gTasks[taskId].data[6]].x2 = DEBUG_NUMBER_ICON_X+10; - gSprites[gTasks[taskId].data[6]].y2 = DEBUG_NUMBER_ICON_Y+10; - gSprites[gTasks[taskId].data[6]].oam.priority = 0; + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tInput = 1; + gTasks[taskId].tDigit = 0; + gTasks[taskId].tSpriteId = AddItemIconSprite(ITEM_TAG, ITEM_TAG, gTasks[taskId].tInput); + gSprites[gTasks[taskId].tSpriteId].x2 = DEBUG_NUMBER_ICON_X+10; + gSprites[gTasks[taskId].tSpriteId].y2 = DEBUG_NUMBER_ICON_Y+10; + gSprites[gTasks[taskId].tSpriteId].oam.priority = 0; } + static void DebugAction_Give_Item_SelectId(u8 taskId) { if (JOY_NEW(DPAD_ANY)) @@ -2549,72 +2636,73 @@ static void DebugAction_Give_Item_SelectId(u8 taskId) if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] >= ITEMS_COUNT) - gTasks[taskId].data[3] = ITEMS_COUNT - 1; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput >= ITEMS_COUNT) + gTasks[taskId].tInput = ITEMS_COUNT - 1; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 1) - gTasks[taskId].data[3] = 1; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 1) + gTasks[taskId].tInput = 1; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < DEBUG_NUMBER_DIGITS_ITEMS - 1) + gTasks[taskId].tDigit += 1; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - CopyItemName(gTasks[taskId].data[3], gStringVar1); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + CopyItemName(gTasks[taskId].tInput, gStringVar1); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); StringExpandPlaceholders(gStringVar4, sDebugText_ItemID); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); - - FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon - FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon - DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon - gTasks[taskId].data[6] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, gTasks[taskId].data[3]); - gSprites[gTasks[taskId].data[6]].x2 = DEBUG_NUMBER_ICON_X+10; - gSprites[gTasks[taskId].data[6]].y2 = DEBUG_NUMBER_ICON_Y+10; - gSprites[gTasks[taskId].data[6]].oam.priority = 0; + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); + + FreeSpriteTilesByTag(ITEM_TAG); + FreeSpritePaletteByTag(ITEM_TAG); + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); + DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); + gTasks[taskId].tSpriteId = AddItemIconSprite(ITEM_TAG, ITEM_TAG, gTasks[taskId].tInput); + gSprites[gTasks[taskId].tSpriteId].x2 = DEBUG_NUMBER_ICON_X+10; + gSprites[gTasks[taskId].tSpriteId].y2 = DEBUG_NUMBER_ICON_Y+10; + gSprites[gTasks[taskId].tSpriteId].oam.priority = 0; } if (JOY_NEW(A_BUTTON)) { - gTasks[taskId].data[5] = gTasks[taskId].data[3]; - gTasks[taskId].data[3] = 1; - gTasks[taskId].data[4] = 0; + gTasks[taskId].tItemId = gTasks[taskId].tInput; + gTasks[taskId].tInput = 1; + gTasks[taskId].tDigit = 0; - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEM_QUANTITY); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEM_QUANTITY); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_ItemQuantity); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Item_SelectQuantity; } else if (JOY_NEW(B_BUTTON)) { - FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon - FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon - DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + FreeSpriteTilesByTag(ITEM_TAG); + FreeSpritePaletteByTag(ITEM_TAG); + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); + DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); PlaySE(SE_SELECT); DebugAction_DestroyExtraWindow(taskId); } } + static void DebugAction_Give_Item_SelectQuantity(u8 taskId) { - u32 itemId = gTasks[taskId].data[5]; + u32 itemId = gTasks[taskId].tItemId; if (JOY_NEW(DPAD_ANY)) { @@ -2623,57 +2711,60 @@ static void DebugAction_Give_Item_SelectQuantity(u8 taskId) if (JOY_NEW(DPAD_UP)) { u32 maxCapacity = (ItemId_GetPocket(itemId) - 1 == BERRIES_POCKET) ? MAX_BERRY_CAPACITY : MAX_BAG_ITEM_CAPACITY; - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > maxCapacity) - gTasks[taskId].data[3] = maxCapacity; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > maxCapacity) + gTasks[taskId].tInput = maxCapacity; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 1) - gTasks[taskId].data[3] = 1; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 1) + gTasks[taskId].tInput = 1; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < 2) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < 2) + gTasks[taskId].tDigit += 1; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEM_QUANTITY); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEM_QUANTITY); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_ItemQuantity); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon - FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon - DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + FreeSpriteTilesByTag(ITEM_TAG); + FreeSpritePaletteByTag(ITEM_TAG); + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); + DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); PlaySE(MUS_OBTAIN_ITEM); - AddBagItem(itemId, gTasks[taskId].data[3]); + AddBagItem(itemId, gTasks[taskId].tInput); DebugAction_DestroyExtraWindow(taskId); } else if (JOY_NEW(B_BUTTON)) { - FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon - FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon - DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon + FreeSpriteTilesByTag(ITEM_TAG); + FreeSpritePaletteByTag(ITEM_TAG); + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); + DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); PlaySE(SE_SELECT); DebugAction_DestroyExtraWindow(taskId); } } +#undef tItemId +#undef tSpriteId + //TMs static void DebugAction_Give_AllTMs(u8 taskId) { @@ -2684,6 +2775,7 @@ static void DebugAction_Give_AllTMs(u8 taskId) if (ItemIdToBattleMoveId(i) != MOVE_NONE && !CheckBagHasItem(i, 1)) AddBagItem(i, 1); } + Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } @@ -2691,11 +2783,11 @@ static void DebugAction_Give_AllTMs(u8 taskId) //Pokemon static void ResetMonDataStruct(struct DebugMonData *sDebugMonData) { - sDebugMonData->mon_speciesId = 1; - sDebugMonData->mon_level = 1; + sDebugMonData->species = 1; + sDebugMonData->level = MIN_LEVEL; sDebugMonData->isShiny = 0; - sDebugMonData->mon_natureId = 0; - sDebugMonData->mon_abilityNum = 0; + sDebugMonData->nature = 0; + sDebugMonData->abilityNum = 0; sDebugMonData->mon_iv_hp = 0; sDebugMonData->mon_iv_atk = 0; sDebugMonData->mon_iv_def = 0; @@ -2703,6 +2795,11 @@ static void ResetMonDataStruct(struct DebugMonData *sDebugMonData) sDebugMonData->mon_iv_satk = 0; sDebugMonData->mon_iv_sdef = 0; } + +#define tIsComplex data[5] +#define tSpriteId data[6] +#define tIterator data[7] + static void DebugAction_Give_PokemonSimple(u8 taskId) { u8 windowId; @@ -2712,35 +2809,37 @@ static void DebugAction_Give_PokemonSimple(u8 taskId) ResetMonDataStruct(sDebugMonData); //Window initialization - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); - //Display initial ID + // Display initial Pokémon StringCopy(gStringVar2, gText_DigitIndicator[0]); - ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 3); - StringCopy(gStringVar1, GetSpeciesName(1)); + ConvertIntToDecimalStringN(gStringVar3, sDebugMonData->species, STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopy(gStringVar1, GetSpeciesName(sDebugMonData->species)); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); //Set task data gTasks[taskId].func = DebugAction_Give_Pokemon_SelectId; - gTasks[taskId].data[2] = windowId; - gTasks[taskId].data[3] = 1; //Current ID - gTasks[taskId].data[4] = 0; //Digit Selected - gTasks[taskId].data[5] = 0; //Complex? - FreeMonIconPalettes(); //Free space for new pallete - LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon - gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite - gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tInput = sDebugMonData->species; + gTasks[taskId].tDigit = 0; + gTasks[taskId].tIsComplex = FALSE; + + FreeMonIconPalettes(); + LoadMonIconPalette(gTasks[taskId].tInput); + gTasks[taskId].tSpriteId = CreateMonIcon(gTasks[taskId].tInput, SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); + gSprites[gTasks[taskId].tSpriteId].oam.priority = 0; } + static void DebugAction_Give_PokemonComplex(u8 taskId) { u8 windowId; @@ -2750,34 +2849,35 @@ static void DebugAction_Give_PokemonComplex(u8 taskId) ResetMonDataStruct(sDebugMonData); //Window initialization - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); - //Display initial ID + // Display initial Pokémon StringCopy(gStringVar2, gText_DigitIndicator[0]); - ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 4); - StringCopy(gStringVar1, GetSpeciesName(1)); + ConvertIntToDecimalStringN(gStringVar3, sDebugMonData->species, STR_CONV_MODE_LEADING_ZEROS, 4); + StringCopy(gStringVar1, GetSpeciesName(sDebugMonData->species)); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectId; - gTasks[taskId].data[2] = windowId; - gTasks[taskId].data[3] = 1; //Current ID - gTasks[taskId].data[4] = 0; //Digit Selected - gTasks[taskId].data[5] = 1; //Complex? - FreeMonIconPalettes(); //Free space for new palletes - LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon - gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite - gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID - gTasks[taskId].data[7] = 0; //iterator + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tInput = 1; + gTasks[taskId].tDigit = 0; + gTasks[taskId].tIsComplex = TRUE; + + FreeMonIconPalettes(); + LoadMonIconPalette(gTasks[taskId].tInput); + gTasks[taskId].tSpriteId = CreateMonIcon(gTasks[taskId].tInput, SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); + gSprites[gTasks[taskId].tSpriteId].oam.priority = 0; + gTasks[taskId].tIterator = 0; } static void DebugAction_Give_Pokemon_SelectId(u8 taskId) @@ -2788,64 +2888,65 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] >= NUM_SPECIES) - gTasks[taskId].data[3] = NUM_SPECIES - 1; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput >= NUM_SPECIES) + gTasks[taskId].tInput = NUM_SPECIES - 1; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 1) - gTasks[taskId].data[3] = 1; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 1) + gTasks[taskId].tInput = 1; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < DEBUG_NUMBER_DIGITS_ITEMS - 1) + gTasks[taskId].tDigit += 1; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopy(gStringVar1, GetSpeciesName(gTasks[taskId].data[3])); //CopyItemName(gTasks[taskId].data[3], gStringVar1); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + StringCopy(gStringVar1, GetSpeciesName(gTasks[taskId].tInput)); //CopyItemName(gTasks[taskId].tInput, gStringVar1); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 4); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 4); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); - FreeMonIconPalettes(); //Free space for new pallete - LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon - gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite - gSprites[gTasks[taskId].data[6]].oam.priority = 0; + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].tSpriteId]); + FreeMonIconPalettes(); + LoadMonIconPalette(gTasks[taskId].tInput); + gTasks[taskId].tSpriteId = CreateMonIcon(gTasks[taskId].tInput, SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); + gSprites[gTasks[taskId].tSpriteId].oam.priority = 0; } if (JOY_NEW(A_BUTTON)) { - sDebugMonData->mon_speciesId = gTasks[taskId].data[3]; //Species ID - gTasks[taskId].data[3] = 1; - gTasks[taskId].data[4] = 0; + sDebugMonData->species = gTasks[taskId].tInput; + gTasks[taskId].tInput = 1; + gTasks[taskId].tDigit = 0; - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 3); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonLevel); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectLevel; } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - Free(sDebugMonData); //Frees EWRAM of MonData Struct + Free(sDebugMonData); FreeMonIconPalettes(); - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].tSpriteId]); DebugAction_DestroyExtraWindow(taskId); } } + static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) { if (JOY_NEW(DPAD_ANY)) @@ -2854,58 +2955,58 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > 100) - gTasks[taskId].data[3] = 100; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > 100) + gTasks[taskId].tInput = 100; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 1) - gTasks[taskId].data[3] = 1; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 1) + gTasks[taskId].tInput = 1; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < 2) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < 2) + gTasks[taskId].tDigit += 1; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 3); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonLevel); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { FreeMonIconPalettes(); - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite - if (gTasks[taskId].data[5] == 0) + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].tSpriteId]); + if (gTasks[taskId].tIsComplex == FALSE) { PlaySE(MUS_LEVEL_UP); - ScriptGiveMon(sDebugMonData->mon_speciesId, gTasks[taskId].data[3], ITEM_NONE, 0,0,0); + ScriptGiveMon(sDebugMonData->species, gTasks[taskId].tInput, ITEM_NONE, 0, 0, 0); // Set flag for user convenience FlagSet(FLAG_SYS_POKEMON_GET); - Free(sDebugMonData); //Frees EWRAM of MonData Struct + Free(sDebugMonData); DebugAction_DestroyExtraWindow(taskId); } else { - sDebugMonData->mon_level = gTasks[taskId].data[3]; //Level - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + sDebugMonData->level = gTasks[taskId].tInput; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 0); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringCopyPadded(gStringVar2, sDebugText_False, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonShiny); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectShiny; } @@ -2913,13 +3014,13 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - Free(sDebugMonData); //Frees EWRAM of MonData Struct + Free(sDebugMonData); FreeMonIconPalettes(); - FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].tSpriteId]); DebugAction_DestroyExtraWindow(taskId); } } -//If complex + static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) { if (JOY_NEW(DPAD_ANY)) @@ -2928,49 +3029,50 @@ static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > 1) - gTasks[taskId].data[3] = 1; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > 1) + gTasks[taskId].tInput = 1; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 0) - gTasks[taskId].data[3] = 0; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 0) + gTasks[taskId].tInput = 0; } - if (gTasks[taskId].data[3] == 1) + if (gTasks[taskId].tInput == 1) StringCopyPadded(gStringVar2, sDebugText_True, CHAR_SPACE, 15); else StringCopyPadded(gStringVar2, sDebugText_False, CHAR_SPACE, 15); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 0); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonShiny); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - sDebugMonData->isShiny = gTasks[taskId].data[3]; //isShiny - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + sDebugMonData->isShiny = gTasks[taskId].tInput; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringCopy(gStringVar1, gNatureNamePointers[0]); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonNature); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectNature; } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - Free(sDebugMonData); //Frees EWRAM of MonData Struct + Free(sDebugMonData); DebugAction_DestroyExtraWindow(taskId); } } + static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) { if (JOY_NEW(DPAD_ANY)) @@ -2979,49 +3081,50 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > NUM_NATURES-1) - gTasks[taskId].data[3] = NUM_NATURES-1; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > NUM_NATURES-1) + gTasks[taskId].tInput = NUM_NATURES-1; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 0) - gTasks[taskId].data[3] = 0; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 0) + gTasks[taskId].tInput = 0; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringCopy(gStringVar1, gNatureNamePointers[gTasks[taskId].data[3]]); + StringCopy(gStringVar1, gNatureNamePointers[gTasks[taskId].tInput]); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonNature); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { u8 abilityId; - sDebugMonData->mon_natureId = gTasks[taskId].data[3]; //NatureId - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + sDebugMonData->nature = gTasks[taskId].tInput; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - abilityId = GetAbilityBySpecies(sDebugMonData->mon_speciesId, 0); + abilityId = GetAbilityBySpecies(sDebugMonData->species, 0); StringCopy(gStringVar1, gAbilityNames[abilityId]); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonAbility); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectAbility; } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - Free(sDebugMonData); //Frees EWRAM of MonData Struct + Free(sDebugMonData); DebugAction_DestroyExtraWindow(taskId); } } + static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) { u16 abilityId; @@ -3034,51 +3137,52 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > abilityCount) - gTasks[taskId].data[3] = abilityCount; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > abilityCount) + gTasks[taskId].tInput = abilityCount; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 0) - gTasks[taskId].data[3] = 0; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 0) + gTasks[taskId].tInput = 0; } - while (GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3] - i) == ABILITY_NONE && gTasks[taskId].data[3] - i < NUM_ABILITY_SLOTS) + while (GetAbilityBySpecies(sDebugMonData->species, gTasks[taskId].tInput - i) == ABILITY_NONE && gTasks[taskId].tInput - i < NUM_ABILITY_SLOTS) { i++; } - abilityId = GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3] - i); - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + abilityId = GetAbilityBySpecies(sDebugMonData->species, gTasks[taskId].tInput - i); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringCopy(gStringVar1, gAbilityNames[abilityId]); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonAbility); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - sDebugMonData->mon_abilityNum = gTasks[taskId].data[3] - i; //AbilityNum - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + sDebugMonData->abilityNum = gTasks[taskId].tInput - i; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_0); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + StringExpandPlaceholders(gStringVar4, sDebugText_IV_HP); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - Free(sDebugMonData); //Frees EWRAM of MonData Struct + Free(sDebugMonData); DebugAction_DestroyExtraWindow(taskId); } } + static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) { if (JOY_NEW(DPAD_ANY)) @@ -3087,126 +3191,126 @@ static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > 31) - gTasks[taskId].data[3] = 31; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > 31) + gTasks[taskId].tInput = 31; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 0) - gTasks[taskId].data[3] = 0; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 0) + gTasks[taskId].tInput = 0; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < 2) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < 2) + gTasks[taskId].tDigit += 1; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - switch (gTasks[taskId].data[7]) + switch (gTasks[taskId].tIterator) { - case 0: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_0); + case STAT_HP: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_HP); break; - case 1: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_1); + case STAT_ATK: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_Attack); break; - case 2: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_2); + case STAT_DEF: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_Defense); break; - case 3: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_3); + case STAT_SPEED: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_Speed); break; - case 4: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_4); + case STAT_SPATK: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_SpAttack); break; - case 5: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_5); + case STAT_SPDEF: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_SpDefense); break; } - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } //If A or B button if (JOY_NEW(A_BUTTON)) { - switch (gTasks[taskId].data[7]) + switch (gTasks[taskId].tIterator) { - case 0: - sDebugMonData->mon_iv_hp = gTasks[taskId].data[3]; + case STAT_HP: + sDebugMonData->mon_iv_hp = gTasks[taskId].tInput; break; - case 1: - sDebugMonData->mon_iv_atk = gTasks[taskId].data[3]; + case STAT_ATK: + sDebugMonData->mon_iv_atk = gTasks[taskId].tInput; break; - case 2: - sDebugMonData->mon_iv_def = gTasks[taskId].data[3]; + case STAT_DEF: + sDebugMonData->mon_iv_def = gTasks[taskId].tInput; break; - case 3: - sDebugMonData->mon_iv_speed = gTasks[taskId].data[3]; + case STAT_SPEED: + sDebugMonData->mon_iv_speed = gTasks[taskId].tInput; break; - case 4: - sDebugMonData->mon_iv_satk = gTasks[taskId].data[3]; + case STAT_SPATK: + sDebugMonData->mon_iv_satk = gTasks[taskId].tInput; break; - case 5: - sDebugMonData->mon_iv_sdef = gTasks[taskId].data[3]; + case STAT_SPDEF: + sDebugMonData->mon_iv_sdef = gTasks[taskId].tInput; break; } //Check if all IVs set - if (gTasks[taskId].data[7] != 5) + if (gTasks[taskId].tIterator != NUM_STATS - 1) { - gTasks[taskId].data[7] += 1; - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + gTasks[taskId].tIterator++; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - switch (gTasks[taskId].data[7]) + switch (gTasks[taskId].tIterator) { - case 0: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_0); + case STAT_HP: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_HP); break; - case 1: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_1); + case STAT_ATK: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_Attack); break; - case 2: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_2); + case STAT_DEF: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_Defense); break; - case 3: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_3); + case STAT_SPEED: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_Speed); break; - case 4: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_4); + case STAT_SPATK: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_SpAttack); break; - case 5: - StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_5); + case STAT_SPDEF: + StringExpandPlaceholders(gStringVar4, sDebugText_IV_SpDefense); break; } - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; } else { - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; - gTasks[taskId].data[7] = 0; //Reset iterator + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; + gTasks[taskId].tIterator = 0; - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].tInput]); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 3); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_0); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_Move; } @@ -3214,10 +3318,11 @@ static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - Free(sDebugMonData); //Frees EWRAM of MonData Struct + Free(sDebugMonData); DebugAction_DestroyExtraWindow(taskId); } } + static void DebugAction_Give_Pokemon_Move(u8 taskId) { if (JOY_NEW(DPAD_ANY)) @@ -3226,32 +3331,32 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] >= MOVES_COUNT) - gTasks[taskId].data[3] = MOVES_COUNT - 1; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput >= MOVES_COUNT) + gTasks[taskId].tInput = MOVES_COUNT - 1; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 0) - gTasks[taskId].data[3] = 0; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 0) + gTasks[taskId].tInput = 0; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < 3) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < 3) + gTasks[taskId].tDigit += 1; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].tInput]); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); - switch (gTasks[taskId].data[7]) + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 3); + switch (gTasks[taskId].tIterator) { case 0: StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_0); @@ -3266,44 +3371,44 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_3); break; } - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - //If MOVE_NONE selected, stop asking for additional moves - if (gTasks[taskId].data[3] == 0) - gTasks[taskId].data[7] = 4; + // If MOVE_NONE selected, stop asking for additional moves + if (gTasks[taskId].tInput == MOVE_NONE) + gTasks[taskId].tIterator = 4; //Set current value - switch (gTasks[taskId].data[7]) + switch (gTasks[taskId].tIterator) { case 0: - sDebugMonData->mon_move_0 = gTasks[taskId].data[3]; + sDebugMonData->mon_move_0 = gTasks[taskId].tInput; break; case 1: - sDebugMonData->mon_move_1 = gTasks[taskId].data[3]; + sDebugMonData->mon_move_1 = gTasks[taskId].tInput; break; case 2: - sDebugMonData->mon_move_2 = gTasks[taskId].data[3]; + sDebugMonData->mon_move_2 = gTasks[taskId].tInput; break; case 3: - sDebugMonData->mon_move_3 = gTasks[taskId].data[3]; + sDebugMonData->mon_move_3 = gTasks[taskId].tInput; break; } //If NOT last move or selected MOVE_NONE ask for next move, else make mon - if (gTasks[taskId].data[7] < 3) + if (gTasks[taskId].tIterator < MAX_MON_MOVES - 1) { - gTasks[taskId].data[7] += 1; - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + gTasks[taskId].tIterator++; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].tInput]); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); - switch (gTasks[taskId].data[7]) + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, 3); + switch (gTasks[taskId].tIterator) { case 0: StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_0); @@ -3318,14 +3423,14 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_3); break; } - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_Move; } else { - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + gTasks[taskId].tInput = 0; + gTasks[taskId].tDigit = 0; PlaySE(MUS_LEVEL_UP); gTasks[taskId].func = DebugAction_Give_Pokemon_ComplexCreateMon; @@ -3334,10 +3439,11 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - Free(sDebugMonData); //Frees EWRAM of MonData Struct + Free(sDebugMonData); DebugAction_DestroyExtraWindow(taskId); } } + static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://github.com/ghoulslash/pokeemerald/tree/custom-givemon { u16 nationalDexNum; @@ -3347,11 +3453,11 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu u16 moves[4]; u8 IVs[6]; u8 iv_val; - u16 species = sDebugMonData->mon_speciesId; - u8 level = sDebugMonData->mon_level; + u16 species = sDebugMonData->species; + u8 level = sDebugMonData->level; u8 isShiny = sDebugMonData->isShiny; //Shiny: no 0, yes 1 - u8 nature = sDebugMonData->mon_natureId; - u8 abilityNum = sDebugMonData->mon_abilityNum; + u8 nature = sDebugMonData->nature; + u8 abilityNum = sDebugMonData->abilityNum; moves[0] = sDebugMonData->mon_move_0; moves[1] = sDebugMonData->mon_move_1; moves[2] = sDebugMonData->mon_move_2; @@ -3449,10 +3555,14 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu // Set flag for user convenience FlagSet(FLAG_SYS_POKEMON_GET); - Free(sDebugMonData); //Frees EWRAM of MonData Struct + Free(sDebugMonData); DebugAction_DestroyExtraWindow(taskId); //return sentToPc; } +#undef tIsComplex +#undef tSpriteId +#undef tIterator + static void DebugAction_Give_MaxMoney(u8 taskId) { SetMoney(&gSaveBlock1Ptr->money, MAX_MONEY); @@ -3460,7 +3570,7 @@ static void DebugAction_Give_MaxMoney(u8 taskId) static void DebugAction_Give_MaxCoins(u8 taskId) { - SetCoins(9999); + SetCoins(MAX_COINS); } static void DebugAction_Give_MaxBattlePoints(u8 taskId) @@ -3515,6 +3625,7 @@ static void DebugAction_Fill_PCBoxes_Fast(u8 taskId) //Credit: Sierraffinity Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } + static void DebugAction_Fill_PCBoxes_Slow(u8 taskId) { int boxId, boxPosition; @@ -3546,6 +3657,7 @@ static void DebugAction_Fill_PCBoxes_Slow(u8 taskId) Debug_DestroyMenu_Full_Script(taskId, Debug_BoxFilledMessage); } + static void DebugAction_Fill_PCItemStorage(u8 taskId) { u16 itemId; @@ -3556,6 +3668,7 @@ static void DebugAction_Fill_PCItemStorage(u8 taskId) AddPCItem(itemId, MAX_PC_ITEM_CAPACITY); } } + static void DebugAction_Fill_PocketItems(u8 taskId) { u16 itemId; @@ -3566,6 +3679,7 @@ static void DebugAction_Fill_PocketItems(u8 taskId) AddBagItem(itemId, MAX_BAG_ITEM_CAPACITY); } } + static void DebugAction_Fill_PocketPokeBalls(u8 taskId) { u16 itemId; @@ -3576,6 +3690,7 @@ static void DebugAction_Fill_PocketPokeBalls(u8 taskId) AddBagItem(itemId, MAX_BAG_ITEM_CAPACITY); } } + static void DebugAction_Fill_PocketTMHM(u8 taskId) { u16 itemId; @@ -3586,6 +3701,7 @@ static void DebugAction_Fill_PocketTMHM(u8 taskId) AddBagItem(itemId, 1); } } + static void DebugAction_Fill_PocketBerries(u8 taskId) { u16 itemId; @@ -3596,6 +3712,7 @@ static void DebugAction_Fill_PocketBerries(u8 taskId) AddBagItem(itemId, MAX_BERRY_CAPACITY); } } + static void DebugAction_Fill_PocketKeyItems(u8 taskId) { u16 itemId; @@ -3611,160 +3728,181 @@ static void DebugAction_Fill_PocketKeyItems(u8 taskId) // Actions Sound static const u8 *const sBGMNames[]; static const u8 *const sSENames[]; + +#define tCurrentSong data[5] + static void DebugAction_Sound_SE(u8 taskId) { u8 windowId; - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); windowId = AddWindow(&sDebugMenuWindowTemplateSound); DrawStdWindowFrame(windowId, FALSE); - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); - //Display initial ID + // Display initial sound effect StringCopy(gStringVar2, gText_DigitIndicator[0]); ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); StringCopyPadded(gStringVar1, sSENames[0], CHAR_SPACE, 35); - StringExpandPlaceholders(gStringVar4, sDebugText_Sound_SE_ID); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + StringExpandPlaceholders(gStringVar4, sDebugText_Sound_SFX_ID); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); StopMapMusic(); //Stop map music to better hear sounds gTasks[taskId].func = DebugAction_Sound_SE_SelectId; - gTasks[taskId].data[2] = windowId; - gTasks[taskId].data[3] = 1; //Current ID - gTasks[taskId].data[4] = 0; //Digit Selected - gTasks[taskId].data[5] = gTasks[taskId].data[3]; //Last song played (for stopping) + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tInput = 1; + gTasks[taskId].tDigit = 0; + gTasks[taskId].tCurrentSong = gTasks[taskId].tInput; } + static void DebugAction_Sound_SE_SelectId(u8 taskId) { if (JOY_NEW(DPAD_ANY)) { if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > END_SE) - gTasks[taskId].data[3] = END_SE; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > END_SE) + gTasks[taskId].tInput = END_SE; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 1) - gTasks[taskId].data[3] = 1; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < 1) + gTasks[taskId].tInput = 1; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < DEBUG_NUMBER_DIGITS_ITEMS - 1) + gTasks[taskId].tDigit += 1; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopyPadded(gStringVar1, sSENames[gTasks[taskId].data[3]-1], CHAR_SPACE, 35); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); - StringExpandPlaceholders(gStringVar4, sDebugText_Sound_SE_ID); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + StringCopyPadded(gStringVar1, sSENames[gTasks[taskId].tInput-1], CHAR_SPACE, 35); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringExpandPlaceholders(gStringVar4, sDebugText_Sound_SFX_ID); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - m4aSongNumStop(gTasks[taskId].data[5]); - gTasks[taskId].data[5] = gTasks[taskId].data[3]; - m4aSongNumStart(gTasks[taskId].data[3]); + m4aSongNumStop(gTasks[taskId].tCurrentSong); + gTasks[taskId].tCurrentSong = gTasks[taskId].tInput; + m4aSongNumStart(gTasks[taskId].tInput); } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - m4aSongNumStop(gTasks[taskId].data[5]); + m4aSongNumStop(gTasks[taskId].tCurrentSong); DebugAction_DestroyExtraWindow(taskId); } + else if (JOY_NEW(START_BUTTON)) + { + m4aSongNumStop(gTasks[taskId].tCurrentSong); + } } static void DebugAction_Sound_MUS(u8 taskId) { u8 windowId; - ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); - RemoveWindow(gTasks[taskId].data[1]); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); windowId = AddWindow(&sDebugMenuWindowTemplateSound); DrawStdWindowFrame(windowId, FALSE); - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); - //Display initial ID + // Display initial song StringCopy(gStringVar2, gText_DigitIndicator[0]); ConvertIntToDecimalStringN(gStringVar3, START_MUS, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); StringCopyPadded(gStringVar1, sBGMNames[0], CHAR_SPACE, 35); - StringExpandPlaceholders(gStringVar4, sDebugText_Sound_MUS_ID); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + StringExpandPlaceholders(gStringVar4, sDebugText_Sound_Music_ID); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); StopMapMusic(); //Stop map music to better hear new music gTasks[taskId].func = DebugAction_Sound_MUS_SelectId; - gTasks[taskId].data[2] = windowId; - gTasks[taskId].data[3] = START_MUS; //Current ID - gTasks[taskId].data[4] = 0; //Digit Selected - gTasks[taskId].data[5] = gTasks[taskId].data[3]; //Last song played (for stopping) + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tInput = START_MUS; + gTasks[taskId].tDigit = 0; + gTasks[taskId].tCurrentSong = gTasks[taskId].tInput; } + static void DebugAction_Sound_MUS_SelectId(u8 taskId) { if (JOY_NEW(DPAD_ANY)) { if (JOY_NEW(DPAD_UP)) { - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] > END_MUS) - gTasks[taskId].data[3] = END_MUS; + gTasks[taskId].tInput += sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput > END_MUS) + gTasks[taskId].tInput = END_MUS; } if (JOY_NEW(DPAD_DOWN)) { - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < START_MUS) - gTasks[taskId].data[3] = START_MUS; + gTasks[taskId].tInput -= sPowersOfTen[gTasks[taskId].tDigit]; + if (gTasks[taskId].tInput < START_MUS) + gTasks[taskId].tInput = START_MUS; } if (JOY_NEW(DPAD_LEFT)) { - if (gTasks[taskId].data[4] > 0) - gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].tDigit > 0) + gTasks[taskId].tDigit -= 1; } if (JOY_NEW(DPAD_RIGHT)) { - if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) - gTasks[taskId].data[4] += 1; + if (gTasks[taskId].tDigit < DEBUG_NUMBER_DIGITS_ITEMS - 1) + gTasks[taskId].tDigit += 1; } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopyPadded(gStringVar1, sBGMNames[gTasks[taskId].data[3]-START_MUS], CHAR_SPACE, 35); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); - StringExpandPlaceholders(gStringVar4, sDebugText_Sound_MUS_ID); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].tDigit]); + StringCopyPadded(gStringVar1, sBGMNames[gTasks[taskId].tInput-START_MUS], CHAR_SPACE, 35); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].tInput, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringExpandPlaceholders(gStringVar4, sDebugText_Sound_Music_ID); + AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); } if (JOY_NEW(A_BUTTON)) { - m4aSongNumStop(gTasks[taskId].data[5]); - gTasks[taskId].data[5] = gTasks[taskId].data[3]; - m4aSongNumStart(gTasks[taskId].data[3]); + m4aSongNumStop(gTasks[taskId].tCurrentSong); + gTasks[taskId].tCurrentSong = gTasks[taskId].tInput; + m4aSongNumStart(gTasks[taskId].tInput); } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - // m4aSongNumStop(gTasks[taskId].data[5]); //Uncomment if music should stop after leaving menu + // m4aSongNumStop(gTasks[taskId].tCurrentSong); //Uncomment if music should stop after leaving menu DebugAction_DestroyExtraWindow(taskId); } + else if (JOY_NEW(START_BUTTON)) + { + m4aSongNumStop(gTasks[taskId].tCurrentSong); + } } +#undef tCurrentSong + +#undef tMenuTaskId +#undef tWindowId +#undef tSubWindowId +#undef tInput +#undef tDigit + #define SOUND_LIST_BGM \ X(MUS_LITTLEROOT_TEST) \ X(MUS_GSC_ROUTE38) \ diff --git a/src/menu.c b/src/menu.c index 2d3a8a8b2ff1..71f1f8b8cf7b 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1589,7 +1589,7 @@ void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *menuActi u32 i; for (i = 0; i < itemCount; i++) - AddTextPrinterParameterized(windowId, 1, menuActions[i].text, 8, (i * 16) + 1, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, menuActions[i].text, 8, (i * 16) + 1, TEXT_SKIP_DRAW, NULL); CopyWindowToVram(windowId, COPYWIN_GFX); } @@ -1653,7 +1653,7 @@ void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const for (i = 0; i < rows; i++) { for (j = 0; j < columns; j++) - AddTextPrinterParameterized(windowId, 1, menuActions[(i * columns) + j].text, (optionWidth * j) + 8, (i * 16) + 1, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, menuActions[(i * columns) + j].text, (optionWidth * j) + 8, (i * 16) + 1, TEXT_SKIP_DRAW, NULL); } CopyWindowToVram(windowId, COPYWIN_GFX); } @@ -1987,7 +1987,7 @@ void PrintPlayerNameOnWindow(u8 windowId, const u8 *src, u16 x, u16 y) StringExpandPlaceholders(gStringVar4, src); - AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, TEXT_SKIP_DRAW, 0); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar4, x, y, TEXT_SKIP_DRAW, 0); } static void UNUSED UnusedBlitBitmapRect(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height) diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index 0b2ce43cf1d6..61e35a66f9c6 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -4778,7 +4778,7 @@ static void ResetStatsWindows(void) { FillWindowPixelBuffer(i, PIXEL_FILL(0)); PutWindowTilemap(i); - CopyWindowToVram(i, 3); + CopyWindowToVram(i, COPYWIN_FULL); } } @@ -5939,7 +5939,7 @@ static void EvoFormsPage_PrintNavigationButtons(void) // DrawKeypadIcon(WIN_NAVIGATION_BUTTONS, 10, 5, 0); //(u8 windowId, u8 keypadIconId, u16 x, u16 y) PutWindowTilemap(WIN_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, COPYWIN_FULL); } static void ResetEvoScreenDataStruct(void) @@ -5998,10 +5998,10 @@ static void Task_LoadEvolutionScreen(u8 taskId) LoadTilesetTilemapHGSS(EVO_SCREEN); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); - CopyWindowToVram(WIN_INFO, 3); + CopyWindowToVram(WIN_INFO, COPYWIN_FULL); FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); PutWindowTilemap(WIN_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, COPYWIN_FULL); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(3); @@ -6676,10 +6676,10 @@ static void Task_LoadFormsScreen(u8 taskId) LoadTilesetTilemapHGSS(FORMS_SCREEN); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); PutWindowTilemap(WIN_INFO); - CopyWindowToVram(WIN_INFO, 3); + CopyWindowToVram(WIN_INFO, COPYWIN_FULL); FillWindowPixelBuffer(WIN_NAVIGATION_BUTTONS, PIXEL_FILL(0)); PutWindowTilemap(WIN_NAVIGATION_BUTTONS); - CopyWindowToVram(WIN_NAVIGATION_BUTTONS, 3); + CopyWindowToVram(WIN_NAVIGATION_BUTTONS, COPYWIN_FULL); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(3); diff --git a/src/pokemon_debug.c b/src/pokemon_debug.c index 3c9a562776bf..3e3cdf470d5e 100644 --- a/src/pokemon_debug.c +++ b/src/pokemon_debug.c @@ -434,7 +434,7 @@ static void PrintInstructionsOnWindow(struct PokemonDebugMenu *data) else AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuTwo, x, 0, 0, NULL); } - CopyWindowToVram(WIN_INSTRUCTIONS, 3); + CopyWindowToVram(WIN_INSTRUCTIONS, COPYWIN_FULL); //Bottom left text FillWindowPixelBuffer(WIN_BOTTOM_LEFT, PIXEL_FILL(0)); @@ -496,7 +496,7 @@ static void PrintDigitChars(struct PokemonDebugMenu *data) StringCopy(&text[i], GetSpeciesName(species)); FillWindowPixelBuffer(WIN_NAME_NUMBERS, 0x11); - AddTextPrinterParameterized(WIN_NAME_NUMBERS, 1, text, 6, 0, 0, NULL); + AddTextPrinterParameterized(WIN_NAME_NUMBERS, FONT_NORMAL, text, 6, 0, 0, NULL); } static u32 CharDigitsToValue(u8 *charDigits, u8 maxDigits) @@ -1067,7 +1067,7 @@ static void ResetPokemonDebugWindows(void) { FillWindowPixelBuffer(i, PIXEL_FILL(0)); PutWindowTilemap(i); - CopyWindowToVram(i, 3); + CopyWindowToVram(i, COPYWIN_FULL); } } From 89321bd5e3e404a3039605aea8f5b469816e537a Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 11 Oct 2023 12:36:28 -0300 Subject: [PATCH 2/3] Re-asigned bits --- src/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug.c b/src/debug.c index 76329948fcc4..853556db0bda 100644 --- a/src/debug.c +++ b/src/debug.c @@ -239,9 +239,9 @@ enum SoundMenu struct DebugMonData { u16 species; - u8 level:7; + u8 level; bool8 isShiny:1; - u8 nature:6; + u8 nature:5; u8 abilityNum:2; u8 mon_iv_hp; u8 mon_iv_atk; From fe91f08b2606a0ea8b9ed5487cd65376a05ac4c5 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 30 Oct 2023 08:10:23 -0300 Subject: [PATCH 3/3] Restore comments for now --- src/debug.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/debug.c b/src/debug.c index 31bdd0db45e3..156c2013bacf 100644 --- a/src/debug.c +++ b/src/debug.c @@ -2717,10 +2717,10 @@ static void DebugAction_Give_Item_SelectId(u8 taskId) StringExpandPlaceholders(gStringVar4, sDebugText_ItemID); AddTextPrinterParameterized(gTasks[taskId].tSubWindowId, DEBUG_MENU_FONT, gStringVar4, 1, 1, 0, NULL); - FreeSpriteTilesByTag(ITEM_TAG); - FreeSpritePaletteByTag(ITEM_TAG); - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); - DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); //Destroy item icon gTasks[taskId].tSpriteId = AddItemIconSprite(ITEM_TAG, ITEM_TAG, gTasks[taskId].tInput); gSprites[gTasks[taskId].tSpriteId].x2 = DEBUG_NUMBER_ICON_X+10; gSprites[gTasks[taskId].tSpriteId].y2 = DEBUG_NUMBER_ICON_Y+10; @@ -2743,10 +2743,10 @@ static void DebugAction_Give_Item_SelectId(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { - FreeSpriteTilesByTag(ITEM_TAG); - FreeSpritePaletteByTag(ITEM_TAG); - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); - DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); //Destroy item icon PlaySE(SE_SELECT); DebugAction_DestroyExtraWindow(taskId); @@ -2794,10 +2794,10 @@ static void DebugAction_Give_Item_SelectQuantity(u8 taskId) if (JOY_NEW(A_BUTTON)) { - FreeSpriteTilesByTag(ITEM_TAG); - FreeSpritePaletteByTag(ITEM_TAG); - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); - DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); //Destroy item icon PlaySE(MUS_OBTAIN_ITEM); AddBagItem(itemId, gTasks[taskId].tInput); @@ -2805,10 +2805,10 @@ static void DebugAction_Give_Item_SelectQuantity(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { - FreeSpriteTilesByTag(ITEM_TAG); - FreeSpritePaletteByTag(ITEM_TAG); - FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); - DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); + FreeSpriteTilesByTag(ITEM_TAG); //Destroy item icon + FreeSpritePaletteByTag(ITEM_TAG); //Destroy item icon + FreeSpriteOamMatrix(&gSprites[gTasks[taskId].tSpriteId]); //Destroy item icon + DestroySprite(&gSprites[gTasks[taskId].tSpriteId]); //Destroy item icon PlaySE(SE_SELECT); DebugAction_DestroyExtraWindow(taskId);