From 6456009a44cd8721a74acbf434da2e3a136da858 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 26 Sep 2020 00:51:02 +0200 Subject: [PATCH 01/37] Implementation if Pyredrid and AsparagusEduardo debug menu plus huge rewrite and tons of additions V2: Fly, Warp, Flags, Vars, give items, give pkm 2 versions Improved cheats, reworked the vars system vars function now starts at VARS_START and end VARS_END Figured out how to display FieldMessages, reimplemented CheckSafeBlock, cleanup DebugAction_DestroyExtraWindow instead of multiple, renamed text variables cleanup + pokemon simple give pokemon complex nearly done Complex pkm works, items now with icons if statement cleanup alter build tools to include maps per map group Warp functionallity added hex value to flags and vars cleanup Credits --- .gitignore | 1 + Makefile | 6 + data/event_scripts.s | 2 + data/scripts/debug.inc | 60 + include/constants/flags.h | 12 +- include/constants/map_groups.h | 2 + include/debug.h | 8 + include/event_data.h | 2 + ld_script.txt | 2 + src/battle_main.c | 2 +- src/debug.c | 2008 ++++++++++++++++++++++++++++++++ src/event_data.c | 16 + src/event_object_movement.c | 6 + src/field_control_avatar.c | 44 +- src/item_use.c | 6 +- src/new_game.c | 2 +- src/trainer_see.c | 5 + tools/mapjson/mapjson.cpp | 14 +- 18 files changed, 2187 insertions(+), 11 deletions(-) create mode 100644 data/scripts/debug.inc create mode 100644 include/debug.h create mode 100644 src/debug.c diff --git a/.gitignore b/.gitignore index ebf507247b..4a446ae79a 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ porymap.project.cfg .vscode/ *.a .fuse_hidden* +mgba.sh diff --git a/Makefile b/Makefile index 99a93718bd..68e9603e69 100644 --- a/Makefile +++ b/Makefile @@ -248,6 +248,12 @@ ifeq ($(DINFO),1) override CFLAGS += -g endif +# DebugMenu +ifeq ($(DDEBUG),1) +override ASFLAGS += --defsym DEBUG=1 +override CPPFLAGS += -D DEBUG=1 +endif + $(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep) @$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i @$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s diff --git a/data/event_scripts.s b/data/event_scripts.s index 8039be6876..2159c939b5 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -576,6 +576,8 @@ gStdScripts_End:: @ 81DC2CC .include "data/scripts/new_game.inc" .include "data/scripts/hall_of_fame.inc" + .include "data/scripts/debug.inc" + EventScript_WhiteOut:: @ 8271857 call EverGrandeCity_HallOfFame_EventScript_ResetEliteFour goto EventScript_ResetMrBriney diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc new file mode 100644 index 0000000000..9d46ea5fff --- /dev/null +++ b/data/scripts/debug.inc @@ -0,0 +1,60 @@ +Debug_ShowFieldMessageStringVar4:: + special ShowFieldMessageStringVar4 + waitmessage + waitbuttonpress + releaseall + end + +Debug_CheckWeekDay_Text: + .string "Aaaaah, yes!\l" + .string "{STR_VAR_1}s are made for dads!\l" + .string "And dad's car!$" + +Debug_CheatStart:: + lockall + setflag FLAG_SYS_POKEMON_GET + setflag FLAG_RESCUED_BIRCH + setflag FLAG_HIDE_ROUTE_101_BIRCH_ZIGZAGOON_BATTLE + clearflag FLAG_HIDE_LITTLEROOT_TOWN_BIRCHS_LAB_BIRCH + setflag FLAG_HIDE_ROUTE_101_BIRCH_STARTERS_BAG + setvar VAR_BIRCH_LAB_STATE, 2 + setvar VAR_ROUTE101_STATE, 3 + givemon SPECIES_TREECKO, 20, ITEM_NONE + givemon SPECIES_TORCHIC, 20, ITEM_NONE + givemon SPECIES_MUDKIP, 20, ITEM_NONE + setflag FLAG_SYS_POKEDEX_GET + special SetUnlockedPokedexFlags + setflag FLAG_RECEIVED_POKEDEX_FROM_BIRCH + setvar VAR_CABLE_CLUB_TUTORIAL_STATE, 1 + @ setflag FLAG_SYS_NATIONAL_DEX + @ special EnableNationalPokedex + setflag FLAG_RECEIVED_RUNNING_SHOES + setflag FLAG_SYS_B_DASH + setvar VAR_LITTLEROOT_TOWN_STATE, 4 @ 4: Received Running Shoes + setvar VAR_LITTLEROOT_INTRO_STATE, 7 @ 7: Told to go meet rival + setvar VAR_LITTLEROOT_HOUSES_STATE_BRENDAN, 2 @ 2: Met Rival's Mom (and is corresponding gender) + setvar VAR_LITTLEROOT_HOUSES_STATE_MAY, 2 @ 2: Met Rival's Mom (and is corresponding gender) + setvar VAR_LITTLEROOT_RIVAL_STATE, 4 @ 4: Received Pokedex + setflag FLAG_RECEIVED_BIKE + giveitem ITEM_ACRO_BIKE + setvar VAR_BRINEY_HOUSE_STATE, 1 + setvar VAR_ROUTE116_STATE, 2 + setflag FLAG_HIDE_ROUTE_116_MR_BRINEY + clearflag FLAG_HIDE_BRINEYS_HOUSE_MR_BRINEY + clearflag FLAG_HIDE_BRINEYS_HOUSE_PEEKO + @ additem ITEM_MAX_REPEL, 10 + @ giveitem ITEM_EON_TICKET + @ setflag FLAG_SYS_HAS_EON_TICKET + @ setvar VAR_DISTRIBUTE_EON_TICKET, 0 + @ giveitem ITEM_MYSTIC_TICKET + @ setflag FLAG_ENABLE_SHIP_NAVEL_ROCK + @ setflag FLAG_RECEIVED_MYSTIC_TICKET + @ giveitem ITEM_AURORA_TICKET + @ setflag FLAG_ENABLE_SHIP_BIRTH_ISLAND + @ setflag FLAG_RECEIVED_AURORA_TICKET + @ setflag FLAG_BADGE06_GET @ Badge for flying filed move + @ setweather WEATHER_VOLCANIC_ASH + @ doweather + closemessage + release + end diff --git a/include/constants/flags.h b/include/constants/flags.h index a562b0670e..a3e6584def 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -40,12 +40,12 @@ #define FLAG_TEMP_1E (TEMP_FLAGS_START + 0x1E) #define FLAG_TEMP_1F (TEMP_FLAGS_START + 0x1F) #define TEMP_FLAGS_END FLAG_TEMP_1F - -#define FLAG_UNUSED_0x020 0x20 // Unused Flag -#define FLAG_UNUSED_0x021 0x21 // Unused Flag -#define FLAG_UNUSED_0x022 0x22 // Unused Flag -#define FLAG_UNUSED_0x023 0x23 // Unused Flag -#define FLAG_UNUSED_0x024 0x24 // Unused Flag + +#define FLAG_SYS_NO_COLLISION 0x20 // Unused Flag //DEBUG +#define FLAG_SYS_NO_ENCOUNTER 0x21 // Unused Flag //DEBUG +#define FLAG_SYS_NO_TRAINER_SEE 0x22 // Unused Flag //DEBUG +#define FLAG_SYS_NO_BAG_USE 0x23 // Unused Flag //DEBUG +#define FLAG_SYS_NO_CATCHING 0x24 // Unused Flag //DEBUG #define FLAG_UNUSED_0x025 0x25 // Unused Flag #define FLAG_UNUSED_0x026 0x26 // Unused Flag #define FLAG_UNUSED_0x027 0x27 // Unused Flag diff --git a/include/constants/map_groups.h b/include/constants/map_groups.h index 69355635b3..c5334bf6c5 100755 --- a/include/constants/map_groups.h +++ b/include/constants/map_groups.h @@ -593,4 +593,6 @@ #define MAP_GROUPS_COUNT 34 +// static const u8 MAP_GROUP_COUNT[] = {57, 5, 5, 6, 7, 8, 9, 7, 7, 14, 8, 17, 10, 23, 13, 15, 15, 2, 2, 2, 3, 1, 1, 1, 108, 61, 89, 2, 1, 13, 1, 1, 3, 1, 0}; + #endif // GUARD_CONSTANTS_MAP_GROUPS_H diff --git a/include/debug.h b/include/debug.h new file mode 100644 index 0000000000..0d78632e63 --- /dev/null +++ b/include/debug.h @@ -0,0 +1,8 @@ +#ifndef GUARD_DEBUG_H +#define GUARD_DEBUG_H + +#if DEBUG +void Debug_ShowMainMenu(void); +#endif + +#endif // GUARD_DEBUG_H \ No newline at end of file diff --git a/include/event_data.h b/include/event_data.h index 8b4510e39b..e4792c7f63 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -20,10 +20,12 @@ void EnableResetRTC(void); bool32 CanResetRTC(void); u16 *GetVarPointer(u16 id); u16 VarGet(u16 id); +u16 VarGetIfExist(u16 id); bool8 VarSet(u16 id, u16 value); u8 VarGetObjectEventGraphicsId(u8 id); u8 *GetFlagPointer(u16 id); u8 FlagSet(u16 id); +u8 FlagToggle(u16 id); u8 FlagClear(u16 id); bool8 FlagGet(u16 id); diff --git a/ld_script.txt b/ld_script.txt index 0b8702d966..dee404843e 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -99,6 +99,7 @@ SECTIONS { src/random.o(.text); src/util.o(.text); src/daycare.o(.text); + src/debug.o(.text); src/egg_hatch.o(.text); src/battle_interface.o(.text); src/battle_anim_smokescreen.o(.text); @@ -482,6 +483,7 @@ SECTIONS { src/trig.o(.rodata); src/util.o(.rodata); src/daycare.o(.rodata); + src/debug.o(.rodata); src/egg_hatch.o(.rodata); src/battle_gfx_sfx_util.o(.rodata); src/battle_interface.o(.rodata); diff --git a/src/battle_main.c b/src/battle_main.c index 193fffaf22..0574bae0b7 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4259,7 +4259,7 @@ static void HandleTurnActionSelectionState(void) } break; case B_ACTION_USE_ITEM: - if (gBattleTypeFlags & (BATTLE_TYPE_LINK + if (FlagGet(FLAG_SYS_NO_BAG_USE) || gBattleTypeFlags & (BATTLE_TYPE_LINK //DEBUG | BATTLE_TYPE_FRONTIER_NO_PYRAMID | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000)) diff --git a/src/debug.c b/src/debug.c new file mode 100644 index 0000000000..84388b34f4 --- /dev/null +++ b/src/debug.c @@ -0,0 +1,2008 @@ +#if DEBUG +//CREDITS +//TheXaman: https://github.com/TheXaman/pokeemerald/tree/tx_debug_system +//CODE USED FROM: +//ketsuban: https://github.com/pret/pokeemerald/wiki/Add-a-debug-menu +//Pyredrid: https://github.com/Pyredrid/pokeemerald/tree/debugmenu +//AsparagusEduardo: https://github.com/AsparagusEduardo/pokeemerald/tree/InfusedEmerald_v2 +//Ghoulslash: https://github.com/ghoulslash/pokeemerald +#include "debug.h" +#include "global.h" +#include "data.h" +#include "event_data.h" +#include "event_object_movement.h" +#include "event_scripts.h" +#include "field_message_box.h" +#include "field_screen_effect.h" +#include "international_string_util.h" +#include "item.h" +#include "item_icon.h" +#include "list_menu.h" +#include "main.h" +#include "map_name_popup.h" +#include "menu.h" +#include "overworld.h" +#include "pokedex.h" +#include "pokemon.h" +#include "pokemon_icon.h" +#include "pokemon_storage_system.h" +#include "random.h" +#include "region_map.h" +#include "script.h" +#include "script_pokemon_util.h" +#include "sound.h" +#include "strings.h" +#include "string_util.h" +#include "task.h" +#include "pokemon_summary_screen.h" +#include "constants/abilities.h" +#include "constants/flags.h" +#include "constants/items.h" +#include "constants/map_groups.h" +#include "constants/songs.h" +#include "constants/species.h" + +// Constants +#define DEBUG_MAIN_MENU_WIDTH 13 +#define DEBUG_MAIN_MENU_HEIGHT 8 + +#define DEBUG_NUMBER_DISPLAY_WIDTH 10 +#define DEBUG_NUMBER_DISPLAY_HEIGHT 4 + +#define DEBUG_NUMBER_DIGITS_FLAGS 4 +#define DEBUG_NUMBER_DIGITS_VARIABLES 5 +#define DEBUG_NUMBER_DIGITS_VARIABLE_VALUE 5 +#define DEBUG_NUMBER_DIGITS_ITEMS 4 +#define DEBUG_NUMBER_DIGITS_ITEM_QUANTITY 2 + +#define DEBUG_NUMBER_ICON_X 210 +#define DEBUG_NUMBER_ICON_Y 50 + +// Define functions +static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate); +void Debug_ShowMainMenu(void); +static void Debug_DestroyMenu(u8); +static void DebugAction_Cancel(u8); +static void DebugAction_DestroyExtraWindow(u8 taskId); + +static void DebugAction_OpenUtilitiesMenu(u8); +static void DebugAction_OpenFlagsMenu(u8); +static void DebugAction_OpenVariablesMenu(u8); +static void DebugAction_OpenGiveMenu(u8); +static void DebugTask_HandleMenuInput_Main(u8); +static void DebugTask_HandleMenuInput_Utilities(u8); +static void DebugTask_HandleMenuInput_Flags(u8); +static void DebugTask_HandleMenuInput_Vars(u8); +static void DebugTask_HandleMenuInput_Give(u8); + +static void DebugAction_Util_HealParty(u8 taskId); +static void DebugAction_Util_Fly(u8 taskId); +static void DebugAction_Util_Warp_Warp(u8 taskId); +static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId); +static void DebugAction_Util_Warp_SelectMap(u8 taskId); +static void DebugAction_Util_Warp_SelectWarp(u8 taskId); +static void DebugAction_Util_CheckSaveBlock(u8); +static void DebugAction_Util_CheckWallClock(u8); +static void DebugAction_Util_SetWallClock(u8); +static void DebugAction_Util_CheckWeekDay(u8); + +static void DebugAction_Flags_Flags(u8 taskId); +static void DebugAction_Flags_FlagsSelect(u8 taskId); + +static void DebugAction_Flags_SetPokedexFlags(u8); +static void DebugAction_Flags_SwitchDex(u8); +static void DebugAction_Flags_SwitchNatDex(u8); +static void DebugAction_Flags_SwitchPokeNav(u8); +static void DebugAction_Flags_ToggleFlyFlags(u8); +static void DebugAction_Flags_ToggleBadgeFlags(u8); +static void DebugAction_Flags_CollisionOnOff(u8); +static void DebugAction_Flags_EncounterOnOff(u8); +static void DebugAction_Flags_TrainerSeeOnOff(u8); +static void DebugAction_Flags_BagUseOnOff(u8); +static void DebugAction_Flags_CatchingOnOff(u8); + +static void DebugAction_Vars_Vars(u8 taskId); +static void DebugAction_Vars_Select(u8 taskId); +static void DebugAction_Vars_SetValue(u8 taskId); + +static void DebugAction_Give_Item(u8 taskId); +static void DebugAction_Give_Item_SelectId(u8 taskId); +static void DebugAction_Give_Item_SelectQuantity(u8 taskId); +static void DebugAction_Give_PokemonSimple(u8 taskId); +static void DebugAction_Give_PokemonComplex(u8 taskId); +static void DebugAction_Give_Pokemon_SelectId(u8 taskId); +static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId); +static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId); +static void DebugAction_Give_Pokemon_SelectNature(u8 taskId); +static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId); +static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId); +static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId); +static void DebugAction_Give_CHEAT(u8 taskId); +static void DebugAction_AccessPC(u8 taskId); + +static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)); +static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate); + +extern u8 Debug_ShowFieldMessageStringVar4[]; +extern u8 Debug_CheatStart[]; +extern u8 PlayersHouse_2F_EventScript_SetWallClock[]; +extern u8 PlayersHouse_2F_EventScript_CheckWallClock[]; +#define ABILITY_NAME_LENGTH 12 +extern const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1]; + +// ******************************* +// Enums +enum { // Main + DEBUG_MENU_ITEM_UTILITIES, + DEBUG_MENU_ITEM_FLAGS, + DEBUG_MENU_ITEM_VARS, + DEBUG_MENU_ITEM_GIVE, + DEBUG_MENU_ITEM_CANCEL +}; +enum { // Util + DEBUG_UTIL_MENU_ITEM_HEAL_PARTY, + DEBUG_UTIL_MENU_ITEM_FLY, + DEBUG_UTIL_MENU_ITEM_WARP, + DEBUG_UTIL_MENU_ITEM_SAVEBLOCK, + DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK, + DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK, + DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY, +}; +enum { // Flags + DEBUG_FLAG_MENU_ITEM_FLAGS, + DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS, + DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF, + DEBUG_FLAG_MENU_ITEM_NATDEXONOFF, + DEBUG_FLAG_MENU_ITEM_POKENAVONOFF, + DEBUG_FLAG_MENU_ITEM_FLYANYWHERE, + DEBUG_FLAG_MENU_ITEM_GETALLBADGES, + DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF, + DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF, + DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF, + DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF, + DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF, +}; +enum { // Vars + DEBUG_VARS_MENU_ITEM_VARS, +}; +enum { // Give + DEBUG_GIVE_MENU_ITEM_ITEM, + DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE, + DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX, + DEBUG_GIVE_MENU_ITEM_CHEAT, + //DEBUG_MENU_ITEM_ACCESS_PC, +}; + +// ******************************* +//Maps per map group COPY FROM /include/constants/map_groups.h + static const u8 MAP_GROUP_COUNT[] = {57, 5, 5, 6, 7, 8, 9, 7, 7, 14, 8, 17, 10, 23, 13, 15, 15, 2, 2, 2, 3, 1, 1, 1, 108, 61, 89, 2, 1, 13, 1, 1, 3, 1, 0}; + +// Text +// Main Menu +static const u8 gDebugText_Utilities[] = _("Utilities"); +static const u8 gDebugText_Flags[] = _("Flags"); +static const u8 gDebugText_Vars[] = _("Variables"); +static const u8 gDebugText_Give[] = _("Give X"); +static const u8 gDebugText_Cancel[] = _("Cancel"); +// Util Menu +static const u8 gDebugText_Util_HealParty[] = _("Heal Party"); +static const u8 gDebugText_Util_Fly[] = _("Fly to map"); +static const u8 gDebugText_Util_WarpToMap[] = _("Warp to map warp"); +static const u8 gDebugText_Util_WarpToMap_SelectMapGroup[] =_("Group: {STR_VAR_1} \n \n\n{STR_VAR_3} "); +static const u8 gDebugText_Util_WarpToMap_SelectMap[] = _("Map: {STR_VAR_1} \nMapSec: \n{STR_VAR_2} \n{STR_VAR_3} "); +static const u8 gDebugText_Util_WarpToMap_SelectWarp[] = _("Warp: \n{STR_VAR_1} \n \n{STR_VAR_3} "); +static const u8 gDebugText_Util_WarpToMap_SelMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); +static const u8 gDebugText_Util_SaveBlockSpace[] = _("SaveBlock Space"); +static const u8 gDebugText_Util_CheckWallClock[] = _("Check Wall Clock"); +static const u8 gDebugText_Util_SetWallClock[] = _("Set Wall Clock"); +static const u8 gDebugText_Util_CheckWeekDay[] = _("Check Week Day"); +// Flags Menu +static const u8 gDebugText_Flags_Flags[] = _("Set Flag XXXX"); +static const u8 gDebugText_Flags_SetPokedexFlags[] = _("All Pokédex Flags"); +static const u8 gDebugText_Flags_SwitchDex[] = _("Pokédex ON/OFF"); +static const u8 gDebugText_Flags_SwitchNationalDex[] = _("NatDex ON/OFF"); +static const u8 gDebugText_Flags_SwitchPokeNav[] = _("PokéNav ON/OFF"); +static const u8 gDebugText_Flags_ToggleFlyFlags[] = _("Fly Flags ON/OFF"); +static const u8 gDebugText_Flags_ToggleAllBadges[] = _("All badges ON/OFF"); +static const u8 gDebugText_Flags_SwitchCollision[] = _("Collision ON/OFF"); +static const u8 gDebugText_Flags_SwitchEncounter[] = _("Encounter ON/OFF"); +static const u8 gDebugText_Flags_SwitchTrainerSee[] = _("TrainerSee ON/OFF"); +static const u8 gDebugText_Flags_SwitchBagUse[] = _("BagUse ON/OFF"); +static const u8 gDebugText_Flags_SwitchCatching[] = _("Catching ON/OFF"); +static const u8 gDebugText_Flag[] = _("Flag: {STR_VAR_1} \n{STR_VAR_2} \n{STR_VAR_3}"); +static const u8 gDebugText_FlagHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); +static const u8 gDebugText_FlagSet[] = _("TRUE"); +static const u8 gDebugText_FlagUnset[] = _("FALSE"); +// Variables Menu +static const u8 gDebugText_Vars_Vars[] = _("Set Vars XXXX"); +static const u8 gDebugText_VariableHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); +static const u8 gDebugText_Variable[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); +static const u8 gDebugText_VariableValueSet[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); +// Give Menu +static const u8 gDebugText_Give_GiveItem[] = _("Give item XXXX"); +static const u8 gDebugText_ItemQuantity[] = _("Quantity: \n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_ItemID[] = _("Item ID: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_Give_GivePokemonSimple[] = _("Pkm (ID,lvl)"); +static const u8 gDebugText_Give_GivePokemonComplex[] = _("Pkm (ID,lvl,shi,nat,ab,IVs)"); +static const u8 gDebugText_PokemonID[] = _("ID: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_PokemonLevel[] = _("Level: \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonShiny[] = _("Shiny: \n {STR_VAR_2} \n \n "); +static const u8 gDebugText_PokemonNature[] = _("ID: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonAbility[] = _("ID: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonIVs[] = _("All IVs: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT start"); +// static const u8 gDebugText_Give_AccessPC[] = _("Access PC"); +// static const u8 gDebugText_Give_GiveAllTMs[] = _("Give All TMs"); + +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 s32 sPowersOfTen[] = +{ + 1, + 10, + 100, + 1000, + 10000, + 100000, + 1000000, + 10000000, + 100000000, + 1000000000, +}; + +// ******************************* +// List Menu Items +static const struct ListMenuItem sDebugMenu_Items_Main[] = +{ + [DEBUG_MENU_ITEM_UTILITIES] = {gDebugText_Utilities, DEBUG_MENU_ITEM_UTILITIES}, + [DEBUG_MENU_ITEM_FLAGS] = {gDebugText_Flags, DEBUG_MENU_ITEM_FLAGS}, + [DEBUG_MENU_ITEM_VARS] = {gDebugText_Vars, DEBUG_MENU_ITEM_VARS}, + [DEBUG_MENU_ITEM_GIVE] = {gDebugText_Give, DEBUG_MENU_ITEM_GIVE}, + [DEBUG_MENU_ITEM_CANCEL] = {gDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL} +}; +static const struct ListMenuItem sDebugMenu_Items_Utilities[] = +{ + [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = {gDebugText_Util_HealParty, DEBUG_UTIL_MENU_ITEM_HEAL_PARTY}, + [DEBUG_UTIL_MENU_ITEM_FLY] = {gDebugText_Util_Fly, DEBUG_UTIL_MENU_ITEM_FLY}, + [DEBUG_UTIL_MENU_ITEM_WARP] = {gDebugText_Util_WarpToMap, DEBUG_UTIL_MENU_ITEM_WARP}, + [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = {gDebugText_Util_SaveBlockSpace, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK}, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {gDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {gDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY] = {gDebugText_Util_CheckWeekDay, DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY}, +}; +static const struct ListMenuItem sDebugMenu_Items_Flags[] = +{ + [DEBUG_FLAG_MENU_ITEM_FLAGS] = {gDebugText_Flags_Flags, DEBUG_FLAG_MENU_ITEM_FLAGS}, + [DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS] = {gDebugText_Flags_SetPokedexFlags, DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS}, + [DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF] = {gDebugText_Flags_SwitchDex, DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF}, + [DEBUG_FLAG_MENU_ITEM_NATDEXONOFF] = {gDebugText_Flags_SwitchNationalDex, DEBUG_FLAG_MENU_ITEM_NATDEXONOFF}, + [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF] = {gDebugText_Flags_SwitchPokeNav, DEBUG_FLAG_MENU_ITEM_POKENAVONOFF}, + [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE] = {gDebugText_Flags_ToggleFlyFlags, DEBUG_FLAG_MENU_ITEM_FLYANYWHERE}, + [DEBUG_FLAG_MENU_ITEM_GETALLBADGES] = {gDebugText_Flags_ToggleAllBadges, DEBUG_FLAG_MENU_ITEM_GETALLBADGES}, + [DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF] = {gDebugText_Flags_SwitchCollision, DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF}, + [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF] = {gDebugText_Flags_SwitchEncounter, DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF}, + [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF]= {gDebugText_Flags_SwitchTrainerSee, DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF}, + [DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF] = {gDebugText_Flags_SwitchBagUse, DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF}, + [DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF] = {gDebugText_Flags_SwitchCatching, DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF}, +}; +static const struct ListMenuItem sDebugMenu_Items_Vars[] = +{ + [DEBUG_VARS_MENU_ITEM_VARS] = {gDebugText_Vars_Vars, DEBUG_FLAG_MENU_ITEM_FLAGS}, +}; +static const struct ListMenuItem sDebugMenu_Items_Give[] = +{ + [DEBUG_GIVE_MENU_ITEM_ITEM] = {gDebugText_Give_GiveItem, DEBUG_GIVE_MENU_ITEM_ITEM}, + [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = {gDebugText_Give_GivePokemonSimple, DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE}, + [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = {gDebugText_Give_GivePokemonComplex, DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX}, + [DEBUG_GIVE_MENU_ITEM_CHEAT] = {gDebugText_Give_GiveCHEAT, DEBUG_GIVE_MENU_ITEM_CHEAT}, + //[DEBUG_MENU_ITEM_GIVE_ALLTMS] = {gDebugText_GiveAllTMs, DEBUG_MENU_ITEM_GIVE_ALLTMS}, + //[DEBUG_MENU_ITEM_ACCESS_PC] = {gDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, +}; + +// ******************************* +// Menu Actions +static void (*const sDebugMenu_Actions_Main[])(u8) = +{ + [DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu, + [DEBUG_MENU_ITEM_FLAGS] = DebugAction_OpenFlagsMenu, + [DEBUG_MENU_ITEM_VARS] = DebugAction_OpenVariablesMenu, + [DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu, + [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_SAVEBLOCK] = DebugAction_Util_CheckSaveBlock, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, + [DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY] = DebugAction_Util_CheckWeekDay, +}; +static void (*const sDebugMenu_Actions_Flags[])(u8) = +{ + [DEBUG_FLAG_MENU_ITEM_FLAGS] = DebugAction_Flags_Flags, + [DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS] = DebugAction_Flags_SetPokedexFlags, + [DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF] = DebugAction_Flags_SwitchDex, + [DEBUG_FLAG_MENU_ITEM_NATDEXONOFF] = DebugAction_Flags_SwitchNatDex, + [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF] = DebugAction_Flags_SwitchPokeNav, + [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE] = DebugAction_Flags_ToggleFlyFlags, + [DEBUG_FLAG_MENU_ITEM_GETALLBADGES] = DebugAction_Flags_ToggleBadgeFlags, + [DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF] = DebugAction_Flags_CollisionOnOff, + [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF] = DebugAction_Flags_EncounterOnOff, + [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF]= DebugAction_Flags_TrainerSeeOnOff, + [DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF] = DebugAction_Flags_BagUseOnOff, + [DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF] = DebugAction_Flags_CatchingOnOff, +}; +static void (*const sDebugMenu_Actions_Vars[])(u8) = +{ + [DEBUG_VARS_MENU_ITEM_VARS] = DebugAction_Vars_Vars, +}; +static void (*const sDebugMenu_Actions_Give[])(u8) = +{ + [DEBUG_GIVE_MENU_ITEM_ITEM] = DebugAction_Give_Item, + [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = DebugAction_Give_PokemonSimple, + [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = DebugAction_Give_PokemonComplex, + [DEBUG_GIVE_MENU_ITEM_CHEAT] = DebugAction_Give_CHEAT, + //[DEBUG_MENU_ITEM_GIVE_ALLTMS] = DebugAction_GiveAllTMs, + //[DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, +}; + + +// ******************************* +// Windows +static const struct WindowTemplate sDebugMenuWindowTemplate = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = DEBUG_MAIN_MENU_WIDTH, + .height = 2 * DEBUG_MAIN_MENU_HEIGHT, + .paletteNum = 15, + .baseBlock = 1, +}; +static const struct WindowTemplate sDebugNumberDisplayWindowTemplate = +{ + .bg = 0, + .tilemapLeft = 6 + DEBUG_MAIN_MENU_WIDTH, + .tilemapTop = 1, + .width = DEBUG_NUMBER_DISPLAY_WIDTH, + .height = 2 * DEBUG_NUMBER_DISPLAY_HEIGHT, + .paletteNum = 15, + .baseBlock = 1, +}; + +// ******************************* +// List Menu Templates +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Main = +{ + .items = sDebugMenu_Items_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_Flags = +{ + .items = sDebugMenu_Items_Flags, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Flags), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Vars = +{ + .items = sDebugMenu_Items_Vars, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Vars), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Give = +{ + .items = sDebugMenu_Items_Give, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Give), +}; + + +// ******************************* +// Functions universal +void Debug_ShowMainMenu(void) +{ + Debug_ShowMenu(DebugTask_HandleMenuInput_Main, sDebugMenu_ListTemplate_Main); +} +static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate) +{ + struct ListMenuTemplate menuTemplate; + u8 windowId; + u8 menuTaskId; + u8 inputTaskId; + + // create window + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugMenuWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + // create list menu + menuTemplate = LMtemplate; + menuTemplate.maxShowed = DEBUG_MAIN_MENU_HEIGHT; + menuTemplate.windowId = windowId; + menuTemplate.header_X = 0; + menuTemplate.item_X = 8; + menuTemplate.cursor_X = 0; + menuTemplate.upText_Y = 1; + menuTemplate.cursorPal = 2; + menuTemplate.fillValue = 1; + menuTemplate.cursorShadowPal = 3; + menuTemplate.lettersSpacing = 1; + menuTemplate.itemVerticalPadding = 0; + menuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL; + menuTemplate.fontId = 1; + menuTemplate.cursorKind = 0; + menuTaskId = ListMenuInit(&menuTemplate, 0, 0); + + // draw everything + CopyWindowToVram(windowId, 3); + + // create input handler task + inputTaskId = CreateTask(HandleInput, 3); + gTasks[inputTaskId].data[0] = menuTaskId; + gTasks[inputTaskId].data[1] = windowId; +} +static void Debug_DestroyMenu(u8 taskId) +{ + DestroyListMenuTask(gTasks[taskId].data[0], NULL, NULL); + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + DestroyTask(taskId); +} +static void DebugAction_Cancel(u8 taskId) +{ + Debug_DestroyMenu(taskId); + EnableBothScriptContexts(); +} +static void DebugAction_DestroyExtraWindow(u8 taskId) +{ + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + ClearStdWindowAndFrame(gTasks[taskId].data[2], TRUE); + RemoveWindow(gTasks[taskId].data[2]); + + DestroyTask(taskId); + EnableBothScriptContexts(); +} + + +// ******************************* +// Handle Inputs +static void DebugTask_HandleMenuInput_Main(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Main[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + EnableBothScriptContexts(); + } +} +static void DebugTask_HandleMenuInput_Utilities(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Utilities[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} +static void DebugTask_HandleMenuInput_Flags(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Flags[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} +static void DebugTask_HandleMenuInput_Vars(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Vars[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} +static void DebugTask_HandleMenuInput_Give(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Give[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} + +// ******************************* +// Open sub-menus +static void DebugAction_OpenUtilitiesMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Utilities, sDebugMenu_ListTemplate_Utilities); +} +static void DebugAction_OpenFlagsMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Flags, sDebugMenu_ListTemplate_Flags); +} +static void DebugAction_OpenVariablesMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Vars, sDebugMenu_ListTemplate_Vars); +} +static void DebugAction_OpenGiveMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give); +} + + +// ******************************* +// Actions Utilities +static void DebugAction_Util_HealParty(u8 taskId) +{ + PlaySE(SE_USE_ITEM); + HealPlayerParty(); + Debug_DestroyMenu(taskId); +} +static void DebugAction_Util_Fly(u8 taskId) +{ + 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); + Debug_DestroyMenu(taskId); + SetMainCallback2(CB2_OpenFlyMap); +} + +static void DebugAction_Util_Warp_Warp(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUPS_COUNT-1, STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar1, gDebugText_Util_WarpToMap_SelMax); + StringCopy(gStringVar3, gText_DigitIndicator[0]); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectMapGroup); + AddTextPrinterParameterized(windowId, 1, 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 +} +static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + if(gMain.newKeys & 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; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 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); + StringExpandPlaceholders(gStringVar1, gDebugText_Util_WarpToMap_SelMax); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectMapGroup); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[5] = gTasks[taskId].data[3]; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]]-1, STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar1, gDebugText_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]]); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectMap); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Util_Warp_SelectMap; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + 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 + + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + if(gMain.newKeys & 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; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 1; + } + + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]]-1, STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar1, gDebugText_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]]); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectMap); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[6] = gTasks[taskId].data[3]; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectWarp); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + gTasks[taskId].func = DebugAction_Util_Warp_SelectWarp; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Util_Warp_SelectWarp(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > 10) + gTasks[taskId].data[3] = 10; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar4, gDebugText_Util_WarpToMap_SelectWarp); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[7] = gTasks[taskId].data[3]; + //WARP + SetWarpDestinationToMapWarp(gTasks[taskId].data[5], gTasks[taskId].data[6], gTasks[taskId].data[7]); //If not warp with the number available -> center of map + DoWarp(); + ResetInitialPlayerAvatarState(); + DebugAction_DestroyExtraWindow(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} + +static void DebugAction_Util_CheckSaveBlock(u8 taskId) +{ + static const u8 gDebugText_SaveBlockSize[] = _("SaveBlock1 is {STR_VAR_1} bytes long.\nMax size is 15872 bytes.\pSaveBlock2 is {STR_VAR_2} bytes long.\nMax size is 3968 bytes.\pPokemonStorage is {STR_VAR_3} bytes long.\nMax size is 35712 bytes."); + + ConvertIntToDecimalStringN(gStringVar1, sizeof(struct SaveBlock1), STR_CONV_MODE_LEFT_ALIGN, 6); + ConvertIntToDecimalStringN(gStringVar2, sizeof(struct SaveBlock2), STR_CONV_MODE_LEFT_ALIGN, 6); + ConvertIntToDecimalStringN(gStringVar3, sizeof(struct PokemonStorage), STR_CONV_MODE_LEFT_ALIGN, 6); + StringExpandPlaceholders(gStringVar4, gDebugText_SaveBlockSize); + + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_ShowFieldMessageStringVar4); +} +static void DebugAction_Util_CheckWallClock(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(PlayersHouse_2F_EventScript_CheckWallClock); +} +static void DebugAction_Util_SetWallClock(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(PlayersHouse_2F_EventScript_SetWallClock); +} +static void DebugAction_Util_CheckWeekDay(u8 taskId) +{ + //StringCopy(gStringVar4, GetDayOfWeekString(gLocalTime.dayOfWeek)); + Debug_DestroyMenu(taskId); + //ScriptContext2_Enable(); + //ScriptContext1_SetupScript(Debug_ShowFieldMessageStringVar4); + EnableBothScriptContexts(); +} + + +// ******************************* +// Actions Flags +static void DebugAction_Flags_Flags(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial Flag + ConvertIntToDecimalStringN(gStringVar1, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); + ConvertIntToHexStringN(gStringVar2, 0, STR_CONV_MODE_LEFT_ALIGN, 3); + StringExpandPlaceholders(gStringVar1, gDebugText_FlagHex); + if(FlagGet(0) == TRUE) + StringCopyPadded(gStringVar2, gDebugText_FlagSet, CHAR_SPACE, 15); + else + StringCopyPadded(gStringVar2, gDebugText_FlagUnset, CHAR_SPACE, 15); + StringCopy(gStringVar3, gText_DigitIndicator[0]); + StringExpandPlaceholders(gStringVar4, gDebugText_Flag); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Flags_FlagsSelect; + gTasks[taskId].data[2] = windowId; + gTasks[taskId].data[3] = 0; //Current Flag + gTasks[taskId].data[4] = 0; //Digit Selected +} +static void DebugAction_Flags_FlagsSelect(u8 taskId) +{ + if (gMain.newKeys & A_BUTTON) + FlagToggle(gTasks[taskId].data[3]); + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + return; + } + + if(gMain.newKeys & 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; + } + } + if(gMain.newKeys & DPAD_DOWN) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0){ + gTasks[taskId].data[3] = 0; + } + } + if(gMain.newKeys & DPAD_LEFT) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[4] -= 1; + if(gTasks[taskId].data[4] < 0) + { + gTasks[taskId].data[4] = 0; + } + } + if(gMain.newKeys & 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; + } + } + + if (gMain.newKeys & DPAD_ANY || gMain.newKeys & 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); + StringExpandPlaceholders(gStringVar1, gDebugText_FlagHex); + if(FlagGet(gTasks[taskId].data[3]) == TRUE) + StringCopyPadded(gStringVar2, gDebugText_FlagSet, CHAR_SPACE, 15); + else + StringCopyPadded(gStringVar2, gDebugText_FlagUnset, CHAR_SPACE, 15); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringExpandPlaceholders(gStringVar4, gDebugText_Flag); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } +} + +static void DebugAction_Flags_SetPokedexFlags(u8 taskId) +{ + u16 i; + for (i = 0; i < NATIONAL_DEX_COUNT; i++) + { + GetSetPokedexFlag(i + 1, FLAG_SET_CAUGHT); + GetSetPokedexFlag(i + 1, FLAG_SET_SEEN); + } + Debug_DestroyMenu(taskId); + EnableBothScriptContexts(); +} +static void DebugAction_Flags_SwitchDex(u8 taskId) +{ + if(FlagGet(FLAG_SYS_POKEDEX_GET)) + { + FlagClear(FLAG_SYS_POKEDEX_GET); + PlaySE(SE_PC_OFF); + }else{ + FlagSet(FLAG_SYS_POKEDEX_GET); + PlaySE(SE_PC_LOGIN); + } +} +static void DebugAction_Flags_SwitchNatDex(u8 taskId) +{ + if(IsNationalPokedexEnabled()) + { + DisableNationalPokedex(); + PlaySE(SE_PC_OFF); + }else{ + EnableNationalPokedex(); + PlaySE(SE_PC_LOGIN); + } +} +static void DebugAction_Flags_SwitchPokeNav(u8 taskId) +{ + if(FlagGet(FLAG_SYS_POKENAV_GET)) + { + FlagClear(FLAG_SYS_POKENAV_GET); + PlaySE(SE_PC_OFF); + }else{ + FlagSet(FLAG_SYS_POKENAV_GET); + PlaySE(SE_PC_LOGIN); + } +} +static void DebugAction_Flags_ToggleFlyFlags(u8 taskId) +{ + // Sound effect + if(FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + 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_Flags_ToggleBadgeFlags(u8 taskId) +{ + // Sound effect + if(FlagGet(FLAG_BADGE08_GET)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_BADGE01_GET); + FlagToggle(FLAG_BADGE02_GET); + FlagToggle(FLAG_BADGE03_GET); + FlagToggle(FLAG_BADGE04_GET); + FlagToggle(FLAG_BADGE05_GET); + FlagToggle(FLAG_BADGE06_GET); + FlagToggle(FLAG_BADGE07_GET); + FlagToggle(FLAG_BADGE08_GET); +} +static void DebugAction_Flags_CollisionOnOff(u8 taskId) +{ + if(FlagGet(FLAG_SYS_NO_COLLISION)) + { + FlagClear(FLAG_SYS_NO_COLLISION); + PlaySE(SE_PC_OFF); + }else{ + FlagSet(FLAG_SYS_NO_COLLISION); + PlaySE(SE_PC_LOGIN); + } +} +static void DebugAction_Flags_EncounterOnOff(u8 taskId) +{ + if(FlagGet(FLAG_SYS_NO_ENCOUNTER)) + { + FlagClear(FLAG_SYS_NO_ENCOUNTER); + PlaySE(SE_PC_OFF); + }else{ + FlagSet(FLAG_SYS_NO_ENCOUNTER); + PlaySE(SE_PC_LOGIN); + } +} +static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) +{ + if(FlagGet(FLAG_SYS_NO_TRAINER_SEE)) + { + FlagClear(FLAG_SYS_NO_TRAINER_SEE); + PlaySE(SE_PC_OFF); + }else{ + FlagSet(FLAG_SYS_NO_TRAINER_SEE); + PlaySE(SE_PC_LOGIN); + } +} +static void DebugAction_Flags_BagUseOnOff(u8 taskId) +{ + if(FlagGet(FLAG_SYS_NO_BAG_USE)) + { + FlagClear(FLAG_SYS_NO_BAG_USE); + PlaySE(SE_PC_OFF); + }else{ + FlagSet(FLAG_SYS_NO_BAG_USE); + PlaySE(SE_PC_LOGIN); + } +} +static void DebugAction_Flags_CatchingOnOff(u8 taskId) +{ + if(FlagGet(FLAG_SYS_NO_CATCHING)) + { + FlagClear(FLAG_SYS_NO_CATCHING); + PlaySE(SE_PC_OFF); + }else{ + FlagSet(FLAG_SYS_NO_CATCHING); + PlaySE(SE_PC_LOGIN); + } +} + +// ******************************* +// Actions Variables +static void DebugAction_Vars_Vars(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial Variable + 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, gDebugText_VariableHex); + ConvertIntToDecimalStringN(gStringVar3, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar2, gText_DigitIndicator[0]); + StringExpandPlaceholders(gStringVar4, gDebugText_Variable); + AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Vars_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 +} + +static void DebugAction_Vars_Select(u8 taskId) +{ + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > VARS_END){ + gTasks[taskId].data[3] = VARS_END; + } + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < VARS_START){ + gTasks[taskId].data[3] = VARS_START; + } + } + if(gMain.newKeys & DPAD_LEFT) + { + gTasks[taskId].data[4] -= 1; + if(gTasks[taskId].data[4] < 0) + { + gTasks[taskId].data[4] = 0; + } + } + if(gMain.newKeys & 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; + } + } + + if (gMain.newKeys & 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); + StringExpandPlaceholders(gStringVar1, gDebugText_VariableHex); + if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value, if 65535 the value hasnt been set + gTasks[taskId].data[5] = 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 + + //Combine str's to full window string + StringExpandPlaceholders(gStringVar4, gDebugText_Variable); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[4] = 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); + StringExpandPlaceholders(gStringVar1, gDebugText_VariableHex); + if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value if 65535 the value hasnt been set + gTasks[taskId].data[5] = 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); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit + StringExpandPlaceholders(gStringVar4, gDebugText_VariableValueSet); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].data[6] = gTasks[taskId].data[5]; //New value selector + gTasks[taskId].func = DebugAction_Vars_SetValue; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + return; + } +} +static void DebugAction_Vars_SetValue(u8 taskId) +{ + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[6] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[6] >= 100){ + gTasks[taskId].data[6] = 99; + } + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[6] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[6] < 0){ + gTasks[taskId].data[6] = 0; + } + } + if(gMain.newKeys & DPAD_LEFT) + { + gTasks[taskId].data[4] -= 1; + if(gTasks[taskId].data[4] < 0) + { + gTasks[taskId].data[4] = 0; + } + } + if(gMain.newKeys & DPAD_RIGHT) + { + gTasks[taskId].data[4] += 1; + if(gTasks[taskId].data[4] > 2) + { + gTasks[taskId].data[4] = 2; + } + } + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + VarSet(gTasks[taskId].data[3], gTasks[taskId].data[5]); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + return; + } + + if (gMain.newKeys & DPAD_ANY || gMain.newKeys & A_BUTTON) + { + 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); + StringExpandPlaceholders(gStringVar1, gDebugText_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 + StringExpandPlaceholders(gStringVar4, gDebugText_VariableValueSet); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } +} + + +// ******************************* +// Actions Give +#define ITEM_TAG 0xFDF3 +static void DebugAction_Give_Item(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + 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, gDebugText_ItemID); + AddTextPrinterParameterized(windowId, 1, 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]].pos2.x = DEBUG_NUMBER_ICON_X+10; + gSprites[gTasks[taskId].data[6]].pos2.y = DEBUG_NUMBER_ICON_Y+10; + gSprites[gTasks[taskId].data[6]].oam.priority = 0; +} +static void DebugAction_Give_Item_SelectId(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & 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; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + CopyItemName(gTasks[taskId].data[3], gStringVar1); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringExpandPlaceholders(gStringVar4, gDebugText_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]].pos2.x = DEBUG_NUMBER_ICON_X+10; + gSprites[gTasks[taskId].data[6]].pos2.y = DEBUG_NUMBER_ICON_Y+10; + gSprites[gTasks[taskId].data[6]].oam.priority = 0; + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[5] = gTasks[taskId].data[3]; + gTasks[taskId].data[3] = 1; + gTasks[taskId].data[4] = 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); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_ItemQuantity); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Item_SelectQuantity; + } + else if (gMain.newKeys & 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 + + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Item_SelectQuantity(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] >= 100) + gTasks[taskId].data[3] = 99; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 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); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_ItemQuantity); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & 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 + + PlaySE(MUS_OBTAIN_ITEM); + AddBagItem(gTasks[taskId].data[5], gTasks[taskId].data[3]); + DebugAction_DestroyExtraWindow(taskId); + } + else if (gMain.newKeys & 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 + + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} + +//Pokemon +static void DebugAction_Give_PokemonSimple(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + StringCopy(gStringVar2, gText_DigitIndicator[0]); + ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopy(gStringVar1, gSpeciesNames[1]); //CopyItemName(1, gStringVar1); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonID); + AddTextPrinterParameterized(windowId, 1, 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; //Species ID + gTasks[taskId].data[6] = CreateMonIcon(1, SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite + gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID + LoadMonIconPalettes(); + gTasks[taskId].data[7] = 0; //Simple 0 or complex 1 + gTasks[taskId].data[8] = 0; //Level + gTasks[taskId].data[9] = 0; //Shiny: no 0, yes 1 + gTasks[taskId].data[10] = 0; //Nature ID + gTasks[taskId].data[11] = 0; //Ability + gTasks[taskId].data[12] = 0; //IVs +} +static void DebugAction_Give_PokemonComplex(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + StringCopy(gStringVar2, gText_DigitIndicator[0]); + ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopy(gStringVar1, gSpeciesNames[1]); //CopyItemName(1, gStringVar1); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonID); + AddTextPrinterParameterized(windowId, 1, 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; //Species ID + gTasks[taskId].data[6] = CreateMonIcon(1, SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite + gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID + LoadMonIconPalettes(); + gTasks[taskId].data[7] = 1; //Simple 0 or complex 1 + gTasks[taskId].data[8] = 0; //Level + gTasks[taskId].data[9] = 0; //Shiny: no 0, yes 1 + gTasks[taskId].data[10] = 0; //Nature ID + gTasks[taskId].data[11] = 0; //Ability + gTasks[taskId].data[12] = 0; //IVs +} + +static void DebugAction_Give_Pokemon_SelectId(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > SPECIES_CELEBI && gTasks[taskId].data[3] < SPECIES_TREECKO) + gTasks[taskId].data[3] = SPECIES_TREECKO; + if(gTasks[taskId].data[3] >= NUM_SPECIES - 1) + gTasks[taskId].data[3] = NUM_SPECIES - 2; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < SPECIES_TREECKO && gTasks[taskId].data[3] > SPECIES_CELEBI) + gTasks[taskId].data[3] = SPECIES_CELEBI; + if(gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar1, gSpeciesNames[gTasks[taskId].data[3]]); //CopyItemName(gTasks[taskId].data[3], gStringVar1); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonID); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create new pokemon sprite + gSprites[gTasks[taskId].data[6]].oam.priority = 0; + //LoadMonIconPalettes(); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[5] = gTasks[taskId].data[3]; //Species ID + gTasks[taskId].data[3] = 1; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonLevel); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectLevel; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > 100) + gTasks[taskId].data[3] = 100; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonLevel); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite + if (gTasks[taskId].data[7] == 0) + { + PlaySE(MUS_LEVEL_UP); + ScriptGiveMon(gTasks[taskId].data[5], gTasks[taskId].data[3], ITEM_NONE, 0,0,0); + DebugAction_DestroyExtraWindow(taskId); + }else{ + gTasks[taskId].data[8] = gTasks[taskId].data[3]; //Level + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, gDebugText_FlagUnset, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonShiny); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectShiny; + } + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite + DebugAction_DestroyExtraWindow(taskId); + } +} +//If complex +static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > 1) + gTasks[taskId].data[3] = 1; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + + if(gTasks[taskId].data[3] == 1) + StringCopyPadded(gStringVar2, gDebugText_FlagSet, CHAR_SPACE, 15); + else + StringCopyPadded(gStringVar2, gDebugText_FlagUnset, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonShiny); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[9] = gTasks[taskId].data[3]; //isShiny + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + //("ID: {STR_VAR_3}\nNature: {STR_VAR_1}\n\n{STR_VAR_2}"); + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar1, gNatureNamePointers[0]); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonNature); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectNature; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & 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; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar1, gNatureNamePointers[gTasks[taskId].data[3]]); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonNature); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[10] = gTasks[taskId].data[3]; //Nature + gTasks[taskId].data[3] = 1; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar1, gAbilityNames[gTasks[taskId].data[3]]); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectAbility; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > ABILITIES_COUNT-1) + gTasks[taskId].data[3] = ABILITIES_COUNT-1; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringCopy(gStringVar1, gAbilityNames[gTasks[taskId].data[3]]); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[11] = gTasks[taskId].data[3]; //Ability + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIVs); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > 31) + gTasks[taskId].data[3] = 31; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < 2) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIVs); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + gTasks[taskId].data[12] = gTasks[taskId].data[3]; //IVs + + PlaySE(MUS_LEVEL_UP); + gTasks[taskId].func = DebugAction_Give_Pokemon_ComplexCreateMon; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://github.com/ghoulslash/pokeemerald/tree/custom-givemon +{ + u16 nationalDexNum; + int sentToPc; + struct Pokemon mon; + u8 i; + u16 species = gTasks[taskId].data[5]; //species ID + u8 level = gTasks[taskId].data[8]; //Level + u8 isShiny = gTasks[taskId].data[9]; //Shiny: no 0, yes 1 + u8 nature = gTasks[taskId].data[10]; //Nature ID + u8 abilityNum = gTasks[taskId].data[11]; //Ability ID + u8 iv_val = gTasks[taskId].data[12]; //IVs + + if (nature == NUM_NATURES || nature == 0xFF) + nature = Random() % NUM_NATURES; + + if (isShiny == 1) + { + u32 personality; + u32 otid = gSaveBlock2Ptr->playerTrainerId[0] + | (gSaveBlock2Ptr->playerTrainerId[1] << 8) + | (gSaveBlock2Ptr->playerTrainerId[2] << 16) + | (gSaveBlock2Ptr->playerTrainerId[3] << 24); + + do + { + personality = Random32(); + personality = ((((Random() % 8) ^ (HIHALF(otid) ^ LOHALF(otid))) ^ LOHALF(personality)) << 16) | LOHALF(personality); + } while (nature != GetNatureFromPersonality(personality)); + + CreateMon(&mon, species, level, 32, 1, personality, OT_ID_PRESET, otid); + } + else + CreateMonWithNature(&mon, species, level, 32, nature); + + for (i = 0; i < NUM_STATS; i++) + { + // ev + // if (evs[i] != 0xFF && evTotal < 510) + // { + // // only up to 510 evs + // if ((evTotal + evs[i]) > 510) + // evs[i] = (510 - evTotal); + + // evTotal += evs[i]; + // SetMonData(&mon, MON_DATA_HP_EV + i, &evs[i]); + // } + + // iv + if (iv_val != 32 && iv_val != 0xFF) + SetMonData(&mon, MON_DATA_HP_IV + i, &iv_val); + } + CalculateMonStats(&mon); + + // for (i = 0; i < MAX_MON_MOVES; i++) + // { + // if (moves[i] == 0 || moves[i] == 0xFF || moves[i] > MOVES_COUNT) + // continue; + + // SetMonMoveSlot(&mon, moves[i], i); + // } + + //ability + if (abilityNum == 0xFF || GetAbilityBySpecies(species, abilityNum) == 0) + { + do { + abilityNum = Random() % 3; // includes hidden abilities + } while (GetAbilityBySpecies(species, abilityNum) == 0); + } + + SetMonData(&mon, MON_DATA_ABILITY_NUM, &abilityNum); + + //ball + // if (ball <= POKEBALL_COUNT) + // SetMonData(&mon, MON_DATA_POKEBALL, &ball); + + //item + // heldItem[0] = item; + // heldItem[1] = item >> 8; + // SetMonData(&mon, MON_DATA_HELD_ITEM, heldItem); + + // give player the mon + //sentToPc = GiveMonToPlayer(&mon); + SetMonData(&mon, MON_DATA_OT_NAME, gSaveBlock2Ptr->playerName); + SetMonData(&mon, MON_DATA_OT_GENDER, &gSaveBlock2Ptr->playerGender); + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_NONE) + break; + } + + if (i >= PARTY_SIZE) + sentToPc = SendMonToPC(&mon); + else + { + sentToPc = MON_GIVEN_TO_PARTY; + CopyMon(&gPlayerParty[i], &mon, sizeof(mon)); + gPlayerPartyCount = i + 1; + } + + nationalDexNum = SpeciesToNationalPokedexNum(species); + switch(sentToPc) + { + case MON_GIVEN_TO_PARTY: + case MON_GIVEN_TO_PC: + GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN); + GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT); + break; + case MON_CANT_GIVE: + break; + } + + DebugAction_DestroyExtraWindow(taskId); //return sentToPc; +} + +static void DebugAction_Give_CHEAT(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_CheatStart); +} + +// static void DebugAction_AccessPC(u8 taskId) +// { +// Debug_DestroyMenu(taskId); +// PlaySE(SE_PC_ON); +// ScriptContext1_SetupScript(EventScript_PC); +// } + + + + + +// Additional functions +/* +static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput, LMtemplate); +} +static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = HandleInput[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + EnableBothScriptContexts(); + } +} +*/ + + +#endif diff --git a/src/event_data.c b/src/event_data.c index 2bde09012d..96156d8a65 100644 --- a/src/event_data.c +++ b/src/event_data.c @@ -184,6 +184,14 @@ u16 VarGet(u16 id) return *ptr; } +u16 VarGetIfExist(u16 id) +{ + u16 *ptr = GetVarPointer(id); + if (!ptr) + return 65535; + return *ptr; +} + bool8 VarSet(u16 id, u16 value) { u16 *ptr = GetVarPointer(id); @@ -216,6 +224,14 @@ u8 FlagSet(u16 id) return 0; } +u8 FlagToggle(u16 id) +{ + u8 *ptr = GetFlagPointer(id); + if (ptr) + *ptr ^= 1 << (id & 7); + return 0; +} + u8 FlagClear(u16 id) { u8 *ptr = GetFlagPointer(id); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 72de880c85..e09379d0ce 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4723,6 +4723,12 @@ static u8 GetCollisionInDirection(struct ObjectEvent *objectEvent, u8 direction) u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; + +#if DEBUG //DEBUG + if (FlagGet(FLAG_SYS_NO_COLLISION)) + return COLLISION_NONE; +#endif // + if (IsCoordOutsideObjectEventMovementRange(objectEvent, x, y)) return COLLISION_OUTSIDE_RANGE; else if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(objectEvent, x, y, direction)) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index fab14c5776..c586656fb1 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -3,6 +3,7 @@ #include "bike.h" #include "coord_event_weather.h" #include "daycare.h" +#include "debug.h" #include "faraway_island.h" #include "event_data.h" #include "event_object_movement.h" @@ -130,6 +131,35 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) input->dpadDirection = DIR_WEST; else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; + + + //DEBUG + if (heldKeys & R_BUTTON) + { + if(input->pressedSelectButton) + { + input->input_field_1_0 = TRUE; + input->pressedSelectButton = FALSE; + }else if(input->pressedStartButton) + { + input->input_field_1_2 = TRUE; + input->pressedStartButton = FALSE; + } + } + if (heldKeys & L_BUTTON) + { + if(input->pressedSelectButton) + { + input->input_field_1_1 = TRUE; + input->pressedSelectButton = FALSE; + }else if(input->pressedStartButton) + { + input->input_field_1_3 = TRUE; + input->pressedStartButton = FALSE; + } + } + // + } int ProcessPlayerFieldInput(struct FieldInput *input) @@ -189,6 +219,15 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; +#if DEBUG + if (input->input_field_1_2) + { + PlaySE(SE_WIN_OPEN); + Debug_ShowMainMenu(); + return TRUE; + } +#endif + return FALSE; } @@ -668,6 +707,9 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { + if (FlagGet(FLAG_SYS_NO_ENCOUNTER)) //DEBUG + return FALSE;// + if (sWildEncounterImmunitySteps < 4) { sWildEncounterImmunitySteps++; @@ -683,7 +725,7 @@ static bool8 CheckStandardWildEncounter(u16 metatileBehavior) } sPreviousPlayerMetatileBehavior = metatileBehavior; - return FALSE; + return FALSE; } static bool8 TryArrowWarp(struct MapPosition *position, u16 metatileBehavior, u8 direction) diff --git a/src/item_use.c b/src/item_use.c index f9d1ff824b..64e0eac0a8 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -938,7 +938,11 @@ void ItemUseOutOfBattle_EvolutionStone(u8 taskId) void ItemUseInBattle_PokeBall(u8 taskId) { - if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? + if (FlagGet(FLAG_SYS_NO_CATCHING)){ //DEBUG + static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); + DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, BagMenu_InitListsMenu); + } // + else if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? { RemoveBagItem(gSpecialVar_ItemId, 1); if (!InBattlePyramid()) diff --git a/src/new_game.c b/src/new_game.c index 55a568132e..7fee212fbe 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -94,7 +94,7 @@ static void InitPlayerTrainerId(void) // L=A isnt set here for some reason. static void SetDefaultOptions(void) { - gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_MID; + gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_FAST; gSaveBlock2Ptr->optionsWindowFrameType = 0; gSaveBlock2Ptr->optionsSound = OPTIONS_SOUND_MONO; gSaveBlock2Ptr->optionsBattleStyle = OPTIONS_BATTLE_STYLE_SHIFT; diff --git a/src/trainer_see.c b/src/trainer_see.c index c37f372627..d5b25b0c59 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -177,6 +177,11 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; +#if DEBUG //DEBUG + if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) + return FALSE; +#endif // + gNoOfApproachingTrainers = 0; gApproachingTrainerId = 0; diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 5e246ff249..47cc52cee9 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -393,11 +393,14 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n//\n\n"; int group_num = 0; + vector map_count_vec; //DEBUG for (auto &group : groups_data["group_order"].array_items()) { text << "// Map Group " << group_num << "\n"; vector map_ids; - size_t max_length = 0; + + size_t max_length = 0; //DEBUG + int map_count = 0; //DEBUG for (auto &map_name : groups_data[group.string_value()].array_items()) { string header_filepath = file_dir + map_name.string_value() + dir_separator + "map.json"; @@ -406,6 +409,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { map_ids.push_back(map_data["id"]); if (map_data["id"].string_value().length() > max_length) max_length = map_data["id"].string_value().length(); + map_count++; //DEBUG } int map_id_num = 0; @@ -416,9 +420,17 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { text << "\n"; group_num++; + map_count_vec.push_back(map_count); //DEBUG } text << "#define MAP_GROUPS_COUNT " << group_num << "\n\n"; + + text << "// static const u8 MAP_GROUP_COUNT[] = {"; //DEBUG + for(int i=0; i Date: Wed, 21 Oct 2020 19:36:08 +0200 Subject: [PATCH 02/37] removed ability --- src/debug.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/debug.c b/src/debug.c index 84388b34f4..644e1aed8d 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1733,14 +1733,21 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) gTasks[taskId].data[3] = 1; gTasks[taskId].data[4] = 0; + // StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + // ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + // StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + // StringCopy(gStringVar1, gAbilityNames[gTasks[taskId].data[3]]); + // StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); + // AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + // gTasks[taskId].func = DebugAction_Give_Pokemon_SelectAbility; StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringCopy(gStringVar1, gAbilityNames[gTasks[taskId].data[3]]); - StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIVs); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); - gTasks[taskId].func = DebugAction_Give_Pokemon_SelectAbility; + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; } else if (gMain.newKeys & B_BUTTON) { From 698886463162622c8d522716f4c87c9712cf0e47 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 26 Oct 2020 21:12:18 +0100 Subject: [PATCH 03/37] Fixed the wrong palettes for the mon icons with the help of Nadia and ghoulslash --- src/debug.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/debug.c b/src/debug.c index 84388b34f4..457c284248 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1505,9 +1505,10 @@ static void DebugAction_Give_PokemonComplex(u8 taskId) gTasks[taskId].data[3] = 1; //Current ID gTasks[taskId].data[4] = 0; //Digit Selected gTasks[taskId].data[5] = 1; //Species ID - gTasks[taskId].data[6] = CreateMonIcon(1, SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite + 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, TRUE); //Create pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID - LoadMonIconPalettes(); gTasks[taskId].data[7] = 1; //Simple 0 or complex 1 gTasks[taskId].data[8] = 0; //Level gTasks[taskId].data[9] = 0; //Shiny: no 0, yes 1 @@ -1557,9 +1558,10 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) AddTextPrinterParameterized(gTasks[taskId].data[2], 1, 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, TRUE); //Create new pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; - //LoadMonIconPalettes(); } if (gMain.newKeys & A_BUTTON) @@ -1579,6 +1581,7 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); + FreeMonIconPalettes(); FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite DebugAction_DestroyExtraWindow(taskId); } @@ -1621,6 +1624,7 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) if (gMain.newKeys & A_BUTTON) { + FreeMonIconPalettes(); FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite if (gTasks[taskId].data[7] == 0) { @@ -1644,6 +1648,7 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); + FreeMonIconPalettes(); FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite DebugAction_DestroyExtraWindow(taskId); } From d380932e46a5d694747c646d98924a257c055c22 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Tue, 27 Oct 2020 09:07:06 +0100 Subject: [PATCH 04/37] Fixed forgotten PokemonSimple, thx to AsparagusEduardo --- src/debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/debug.c b/src/debug.c index 4f589cc97d..4a246052b0 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1467,9 +1467,10 @@ static void DebugAction_Give_PokemonSimple(u8 taskId) gTasks[taskId].data[3] = 1; //Current ID gTasks[taskId].data[4] = 0; //Digit Selected gTasks[taskId].data[5] = 1; //Species ID - gTasks[taskId].data[6] = CreateMonIcon(1, SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite + 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, TRUE); //Create pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID - LoadMonIconPalettes(); gTasks[taskId].data[7] = 0; //Simple 0 or complex 1 gTasks[taskId].data[8] = 0; //Level gTasks[taskId].data[9] = 0; //Shiny: no 0, yes 1 From 6422164d31549eacdd5873baa4227a5211b0a44a Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 16 Nov 2020 10:32:17 +0100 Subject: [PATCH 05/37] Added moves, trainer edits and fixed abilities, now only possible ones including hidden when using PE Give all TMs, watch credits, change trainer name/gender/id implemented moves --- include/main_menu.h | 1 + src/debug.c | 327 +++++++++++++++++++++++++++++++++++--------- src/main_menu.c | 4 +- 3 files changed, 265 insertions(+), 67 deletions(-) diff --git a/include/main_menu.h b/include/main_menu.h index 1944f4ecc5..790c9d10ec 100644 --- a/include/main_menu.h +++ b/include/main_menu.h @@ -3,5 +3,6 @@ void CB2_InitMainMenu(void); void CreateYesNoMenuParameterized(u8 a, u8 b, u16 c, u16 d, u8 e, u8 f); +void NewGameBirchSpeech_SetDefaultPlayerName(u8); #endif // GUARD_MAIN_MENU_H diff --git a/src/debug.c b/src/debug.c index 4a246052b0..dc884b77fb 100644 --- a/src/debug.c +++ b/src/debug.c @@ -6,8 +6,8 @@ //Pyredrid: https://github.com/Pyredrid/pokeemerald/tree/debugmenu //AsparagusEduardo: https://github.com/AsparagusEduardo/pokeemerald/tree/InfusedEmerald_v2 //Ghoulslash: https://github.com/ghoulslash/pokeemerald -#include "debug.h" #include "global.h" +#include "credits.h" #include "data.h" #include "event_data.h" #include "event_object_movement.h" @@ -19,8 +19,11 @@ #include "item_icon.h" #include "list_menu.h" #include "main.h" +#include "main_menu.h" #include "map_name_popup.h" #include "menu.h" +#include "naming_screen.h" +#include "new_game.h" #include "overworld.h" #include "pokedex.h" #include "pokemon.h" @@ -85,6 +88,10 @@ static void DebugAction_Util_CheckSaveBlock(u8); static void DebugAction_Util_CheckWallClock(u8); static void DebugAction_Util_SetWallClock(u8); static void DebugAction_Util_CheckWeekDay(u8); +static void DebugAction_Util_WatchCredits(u8); +static void DebugAction_Util_Trainer_Name(u8); +static void DebugAction_Util_Trainer_Gender(u8); +static void DebugAction_Util_Trainer_Id(u8); static void DebugAction_Flags_Flags(u8 taskId); static void DebugAction_Flags_FlagsSelect(u8 taskId); @@ -108,6 +115,7 @@ static void DebugAction_Vars_SetValue(u8 taskId); static void DebugAction_Give_Item(u8 taskId); static void DebugAction_Give_Item_SelectId(u8 taskId); static void DebugAction_Give_Item_SelectQuantity(u8 taskId); +static void DebugAction_Give_AllTMs(u8 taskId); static void DebugAction_Give_PokemonSimple(u8 taskId); static void DebugAction_Give_PokemonComplex(u8 taskId); static void DebugAction_Give_Pokemon_SelectId(u8 taskId); @@ -117,6 +125,7 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId); static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId); static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId); static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId); +static void DebugAction_Give_Pokemon_Move(u8 taskId); static void DebugAction_Give_CHEAT(u8 taskId); static void DebugAction_AccessPC(u8 taskId); @@ -147,6 +156,10 @@ enum { // Util DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK, DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY, + DEBUG_UTIL_MENU_ITEM_WATCHCREDITS, + DEBUG_UTIL_MENU_ITEM_TRAINER_NAME, + DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, + DEBUG_UTIL_MENU_ITEM_TRAINER_ID, }; enum { // Flags DEBUG_FLAG_MENU_ITEM_FLAGS, @@ -163,10 +176,11 @@ enum { // Flags DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF, }; enum { // Vars - DEBUG_VARS_MENU_ITEM_VARS, + DEBUG_VARS_MENU_ITEM_VARS, }; enum { // Give DEBUG_GIVE_MENU_ITEM_ITEM, + DEBUG_MENU_ITEM_GIVE_ALLTMS, DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE, DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX, DEBUG_GIVE_MENU_ITEM_CHEAT, @@ -196,6 +210,10 @@ static const u8 gDebugText_Util_SaveBlockSpace[] = _("SaveBlock Space") static const u8 gDebugText_Util_CheckWallClock[] = _("Check Wall Clock"); static const u8 gDebugText_Util_SetWallClock[] = _("Set Wall Clock"); static const u8 gDebugText_Util_CheckWeekDay[] = _("Check Week Day"); +static const u8 gDebugText_Util_WatchCredits[] = _("Watch Credits"); +static const u8 gDebugText_Util_Trainer_Name[] = _("Trainer name"); +static const u8 gDebugText_Util_Trainer_Gender[] = _("Toggle T. Gender"); +static const u8 gDebugText_Util_Trainer_Id[] = _("New Trainer Id"); // Flags Menu static const u8 gDebugText_Flags_Flags[] = _("Set Flag XXXX"); static const u8 gDebugText_Flags_SetPokedexFlags[] = _("All Pokédex Flags"); @@ -219,20 +237,24 @@ static const u8 gDebugText_VariableHex[] = _("{STR_VAR_1} \n static const u8 gDebugText_Variable[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); static const u8 gDebugText_VariableValueSet[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); // Give Menu -static const u8 gDebugText_Give_GiveItem[] = _("Give item XXXX"); -static const u8 gDebugText_ItemQuantity[] = _("Quantity: \n{STR_VAR_1} \n\n{STR_VAR_2}"); -static const u8 gDebugText_ItemID[] = _("Item ID: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); -static const u8 gDebugText_Give_GivePokemonSimple[] = _("Pkm (ID,lvl)"); -static const u8 gDebugText_Give_GivePokemonComplex[] = _("Pkm (ID,lvl,shi,nat,ab,IVs)"); -static const u8 gDebugText_PokemonID[] = _("ID: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); -static const u8 gDebugText_PokemonLevel[] = _("Level: \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 gDebugText_PokemonShiny[] = _("Shiny: \n {STR_VAR_2} \n \n "); -static const u8 gDebugText_PokemonNature[] = _("ID: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 gDebugText_PokemonAbility[] = _("ID: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 gDebugText_PokemonIVs[] = _("All IVs: \n {STR_VAR_3} \n \n{STR_VAR_2} "); -static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT start"); +static const u8 gDebugText_Give_GiveItem[] = _("Give item XXXX"); +static const u8 gDebugText_ItemQuantity[] = _("Quantity: \n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_ItemID[] = _("Item Id: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_Give_AllTMs[] = _("Give all TMs"); +static const u8 gDebugText_Give_GivePokemonSimple[] = _("Pkm(lvl)"); +static const u8 gDebugText_Give_GivePokemonComplex[] = _("Pkm(l,s,n,a,IV,mov)"); +static const u8 gDebugText_PokemonID[] = _("Species: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_PokemonLevel[] = _("Level: \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonShiny[] = _("Shiny: \n {STR_VAR_2} \n \n "); +static const u8 gDebugText_PokemonNature[] = _("NatureId: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonAbility[] = _("AbilityNum: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonIVs[] = _("All IVs: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonMove_0[] = _("Move 0: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonMove_1[] = _("Move 1: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonMove_2[] = _("Move 2: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_PokemonMove_3[] = _("Move 3: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); +static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT start"); // static const u8 gDebugText_Give_AccessPC[] = _("Access PC"); -// static const u8 gDebugText_Give_GiveAllTMs[] = _("Give All TMs"); static const u8 digitInidicator_1[] = _("{LEFT_ARROW}+1{RIGHT_ARROW} "); static const u8 digitInidicator_10[] = _("{LEFT_ARROW}+10{RIGHT_ARROW} "); @@ -286,6 +308,10 @@ static const struct ListMenuItem sDebugMenu_Items_Utilities[] = [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {gDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {gDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, [DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY] = {gDebugText_Util_CheckWeekDay, DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY}, + [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = {gDebugText_Util_WatchCredits, DEBUG_UTIL_MENU_ITEM_WATCHCREDITS}, + [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = {gDebugText_Util_Trainer_Name, DEBUG_UTIL_MENU_ITEM_TRAINER_NAME}, + [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = {gDebugText_Util_Trainer_Gender, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER}, + [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = {gDebugText_Util_Trainer_Id, DEBUG_UTIL_MENU_ITEM_TRAINER_ID}, }; static const struct ListMenuItem sDebugMenu_Items_Flags[] = { @@ -309,10 +335,10 @@ static const struct ListMenuItem sDebugMenu_Items_Vars[] = static const struct ListMenuItem sDebugMenu_Items_Give[] = { [DEBUG_GIVE_MENU_ITEM_ITEM] = {gDebugText_Give_GiveItem, DEBUG_GIVE_MENU_ITEM_ITEM}, + [DEBUG_MENU_ITEM_GIVE_ALLTMS] = {gDebugText_Give_AllTMs, DEBUG_MENU_ITEM_GIVE_ALLTMS}, [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = {gDebugText_Give_GivePokemonSimple, DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE}, [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = {gDebugText_Give_GivePokemonComplex, DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX}, [DEBUG_GIVE_MENU_ITEM_CHEAT] = {gDebugText_Give_GiveCHEAT, DEBUG_GIVE_MENU_ITEM_CHEAT}, - //[DEBUG_MENU_ITEM_GIVE_ALLTMS] = {gDebugText_GiveAllTMs, DEBUG_MENU_ITEM_GIVE_ALLTMS}, //[DEBUG_MENU_ITEM_ACCESS_PC] = {gDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, }; @@ -335,6 +361,10 @@ static void (*const sDebugMenu_Actions_Utilities[])(u8) = [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, [DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY] = DebugAction_Util_CheckWeekDay, + [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, }; static void (*const sDebugMenu_Actions_Flags[])(u8) = { @@ -358,10 +388,10 @@ static void (*const sDebugMenu_Actions_Vars[])(u8) = static void (*const sDebugMenu_Actions_Give[])(u8) = { [DEBUG_GIVE_MENU_ITEM_ITEM] = DebugAction_Give_Item, + [DEBUG_MENU_ITEM_GIVE_ALLTMS] = DebugAction_Give_AllTMs, [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = DebugAction_Give_PokemonSimple, [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = DebugAction_Give_PokemonComplex, [DEBUG_GIVE_MENU_ITEM_CHEAT] = DebugAction_Give_CHEAT, - //[DEBUG_MENU_ITEM_GIVE_ALLTMS] = DebugAction_GiveAllTMs, //[DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, }; @@ -860,7 +890,33 @@ static void DebugAction_Util_CheckWeekDay(u8 taskId) //ScriptContext1_SetupScript(Debug_ShowFieldMessageStringVar4); EnableBothScriptContexts(); } - +static void DebugAction_Util_WatchCredits(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + Debug_DestroyMenu(taskId); + SetMainCallback2(CB2_StartCreditsSequence); +} +static void DebugAction_Util_Trainer_Name(u8 taskId) +{ + NewGameBirchSpeech_SetDefaultPlayerName(Random() % 20); + DoNamingScreen(0, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_ReturnToFieldContinueScript); +} +static void DebugAction_Util_Trainer_Gender(u8 taskId) +{ + if(gSaveBlock2Ptr->playerGender == 0) // 0 Male, 1 Female + gSaveBlock2Ptr->playerGender = 1; + else + gSaveBlock2Ptr->playerGender = 0; + Debug_DestroyMenu(taskId); + EnableBothScriptContexts(); +} +static void DebugAction_Util_Trainer_Id(u8 taskId) +{ + u32 trainerId = (Random() << 0x10) | GetGeneratedTrainerIdLower(); + SetTrainerId(trainerId, gSaveBlock2Ptr->playerTrainerId); + Debug_DestroyMenu(taskId); + EnableBothScriptContexts(); +} // ******************************* // Actions Flags @@ -1438,6 +1494,16 @@ static void DebugAction_Give_Item_SelectQuantity(u8 taskId) } } +//TMs +static void DebugAction_Give_AllTMs(u8 taskId) +{ + u16 i; + PlayFanfare(MUS_OBTAIN_TMHM); + for (i = ITEM_TM01; i <= ITEM_TM50; i++) + if(!CheckBagHasItem(i, 1)) + AddBagItem(i, 1); +} + //Pokemon static void DebugAction_Give_PokemonSimple(u8 taskId) { @@ -1471,12 +1537,7 @@ static void DebugAction_Give_PokemonSimple(u8 taskId) 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, TRUE); //Create pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID - gTasks[taskId].data[7] = 0; //Simple 0 or complex 1 - gTasks[taskId].data[8] = 0; //Level - gTasks[taskId].data[9] = 0; //Shiny: no 0, yes 1 - gTasks[taskId].data[10] = 0; //Nature ID - gTasks[taskId].data[11] = 0; //Ability - gTasks[taskId].data[12] = 0; //IVs + gTasks[taskId].data[7] = 1; //Level } static void DebugAction_Give_PokemonComplex(u8 taskId) { @@ -1510,12 +1571,12 @@ static void DebugAction_Give_PokemonComplex(u8 taskId) 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, TRUE); //Create pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID - gTasks[taskId].data[7] = 1; //Simple 0 or complex 1 - gTasks[taskId].data[8] = 0; //Level - gTasks[taskId].data[9] = 0; //Shiny: no 0, yes 1 - gTasks[taskId].data[10] = 0; //Nature ID - gTasks[taskId].data[11] = 0; //Ability - gTasks[taskId].data[12] = 0; //IVs + gTasks[taskId].data[7] = 0; //Level + gTasks[taskId].data[8] = 0; //Shiny: no 0, yes 1 + gTasks[taskId].data[9] = 0; //Nature ID + gTasks[taskId].data[10] = 0; //Ability + gTasks[taskId].data[11] = 0; //IVs + gTasks[taskId].data[12] = 0; //Move 0 } static void DebugAction_Give_Pokemon_SelectId(u8 taskId) @@ -1627,13 +1688,13 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) { FreeMonIconPalettes(); FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite - if (gTasks[taskId].data[7] == 0) + if (gTasks[taskId].data[7] == 1) { PlaySE(MUS_LEVEL_UP); ScriptGiveMon(gTasks[taskId].data[5], gTasks[taskId].data[3], ITEM_NONE, 0,0,0); DebugAction_DestroyExtraWindow(taskId); }else{ - gTasks[taskId].data[8] = gTasks[taskId].data[3]; //Level + gTasks[taskId].data[7] = gTasks[taskId].data[3]; //Level gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; @@ -1686,7 +1747,7 @@ static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) if (gMain.newKeys & A_BUTTON) { - gTasks[taskId].data[9] = gTasks[taskId].data[3]; //isShiny + gTasks[taskId].data[8] = gTasks[taskId].data[3]; //isShiny gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; @@ -1735,25 +1796,21 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) if (gMain.newKeys & A_BUTTON) { - gTasks[taskId].data[10] = gTasks[taskId].data[3]; //Nature - gTasks[taskId].data[3] = 1; + u8 abilityId; + gTasks[taskId].data[9] = gTasks[taskId].data[3]; //NatureId + gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; - // StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - // ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); - // StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - // StringCopy(gStringVar1, gAbilityNames[gTasks[taskId].data[3]]); - // StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); - // AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); - // gTasks[taskId].func = DebugAction_Give_Pokemon_SelectAbility; StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIVs); + abilityId = GetAbilityBySpecies(gTasks[taskId].data[5], 0); + StringCopy(gStringVar1, gAbilityNames[abilityId]); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); - gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; + gTasks[taskId].func = DebugAction_Give_Pokemon_SelectAbility; } else if (gMain.newKeys & B_BUTTON) { @@ -1763,6 +1820,14 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) } static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) { + u8 abilityId; + u8 abilityCount = 0; + if (gBaseStats[gTasks[taskId].data[5]].abilities[1] != ABILITY_NONE) + abilityCount++; + #ifdef POKEMON_EXPANSION + if (gBaseStats[gTasks[taskId].data[5]].abilityHidden != ABILITY_NONE) + abilityCount++; + #endif if (gMain.newKeys & DPAD_ANY) { PlaySE(SE_SELECT); @@ -1770,27 +1835,28 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) if(gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > ABILITIES_COUNT-1) - gTasks[taskId].data[3] = ABILITIES_COUNT-1; + if(gTasks[taskId].data[3] > abilityCount) + gTasks[taskId].data[3] = abilityCount; } if(gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 1) - gTasks[taskId].data[3] = 1; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; } + abilityId = GetAbilityBySpecies(gTasks[taskId].data[5], gTasks[taskId].data[3]); StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringCopy(gStringVar1, gAbilityNames[gTasks[taskId].data[3]]); + StringCopy(gStringVar1, gAbilityNames[abilityId]); StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); } if (gMain.newKeys & A_BUTTON) { - gTasks[taskId].data[11] = gTasks[taskId].data[3]; //Ability + gTasks[taskId].data[10] = gTasks[taskId].data[3]; //AbilityNum gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; @@ -1846,10 +1912,131 @@ static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) if (gMain.newKeys & A_BUTTON) { - gTasks[taskId].data[12] = gTasks[taskId].data[3]; //IVs + gTasks[taskId].data[11] = gTasks[taskId].data[3]; //IVs + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_Move; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + } +} +static void DebugAction_Give_Pokemon_Move(u8 taskId) +{ + u8 j; + for(j=12; j<15; j++) + { + if (gTasks[taskId].data[j] == 0) + break; + } + + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > MOVES_COUNT) + gTasks[taskId].data[3] = MOVES_COUNT; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 0) + gTasks[taskId].data[3] = 0; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < 3) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + switch (j) + { + case 12: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); + break; + case 13: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_1); + break; + case 14: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_2); + break; + case 15: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_3); + break; + } + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + + if (gTasks[taskId].data[3] == 0) + j = 15; + else + gTasks[taskId].data[j] = gTasks[taskId].data[3]; //Move ID + + + // If last move or selected MOVE_NONE make mon, else ask for next move + if (j < 15) + { + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + switch (j+1) + { + case 12: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); + break; + case 13: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_1); + break; + case 14: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_2); + break; + case 15: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_3); + break; + } + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_Move; + } + else + { + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + + PlaySE(MUS_LEVEL_UP); + gTasks[taskId].func = DebugAction_Give_Pokemon_ComplexCreateMon; + } + - PlaySE(MUS_LEVEL_UP); - gTasks[taskId].func = DebugAction_Give_Pokemon_ComplexCreateMon; } else if (gMain.newKeys & B_BUTTON) { @@ -1863,16 +2050,23 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu int sentToPc; struct Pokemon mon; u8 i; + u16 moves[4]; u16 species = gTasks[taskId].data[5]; //species ID - u8 level = gTasks[taskId].data[8]; //Level - u8 isShiny = gTasks[taskId].data[9]; //Shiny: no 0, yes 1 - u8 nature = gTasks[taskId].data[10]; //Nature ID - u8 abilityNum = gTasks[taskId].data[11]; //Ability ID - u8 iv_val = gTasks[taskId].data[12]; //IVs + u8 level = gTasks[taskId].data[7]; //Level + u8 isShiny = gTasks[taskId].data[8]; //Shiny: no 0, yes 1 + u8 nature = gTasks[taskId].data[9]; //Nature ID + u8 abilityNum = gTasks[taskId].data[10]; //Ability ID + u8 iv_val = gTasks[taskId].data[11]; //IVs + moves[0] = gTasks[taskId].data[12]; //Move 0 + moves[1] = gTasks[taskId].data[13]; //Move 1 + moves[2] = gTasks[taskId].data[14]; //Move 2 + moves[3] = gTasks[taskId].data[15]; //Move 3 + //Nature if (nature == NUM_NATURES || nature == 0xFF) nature = Random() % NUM_NATURES; + //Shinyness if (isShiny == 1) { u32 personality; @@ -1892,6 +2086,7 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu else CreateMonWithNature(&mon, species, level, 32, nature); + //EVs/IVs for (i = 0; i < NUM_STATS; i++) { // ev @@ -1911,15 +2106,16 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu } CalculateMonStats(&mon); - // for (i = 0; i < MAX_MON_MOVES; i++) - // { - // if (moves[i] == 0 || moves[i] == 0xFF || moves[i] > MOVES_COUNT) - // continue; + //Moves + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (moves[i] == 0 || moves[i] == 0xFF || moves[i] > MOVES_COUNT) + continue; - // SetMonMoveSlot(&mon, moves[i], i); - // } + SetMonMoveSlot(&mon, moves[i], i); + } - //ability + //Ability if (abilityNum == 0xFF || GetAbilityBySpecies(species, abilityNum) == 0) { do { @@ -1957,6 +2153,7 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu gPlayerPartyCount = i + 1; } + //Pokedex entry nationalDexNum = SpeciesToNationalPokedexNum(species); switch(sentToPc) { diff --git a/src/main_menu.c b/src/main_menu.c index e8403cdb17..78d3fbeb00 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -13,6 +13,7 @@ #include "international_string_util.h" #include "link.h" #include "main.h" +#include "main_menu.h" #include "menu.h" #include "list_menu.h" #include "mystery_event_menu.h" @@ -228,7 +229,6 @@ static void Task_NewGameBirchSpeech_WaitForWhatsYourNameToPrint(u8); static void Task_NewGameBirchSpeech_WaitPressBeforeNameChoice(u8); static void Task_NewGameBirchSpeech_StartNamingScreen(u8); static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void); -static void NewGameBirchSpeech_SetDefaultPlayerName(u8); static void Task_NewGameBirchSpeech_CreateNameYesNo(u8); static void Task_NewGameBirchSpeech_ProcessNameYesNoMenu(u8); void CreateYesNoMenuParameterized(u8, u8, u16, u16, u8, u8); @@ -2110,7 +2110,7 @@ static s8 NewGameBirchSpeech_ProcessGenderMenuInput(void) return Menu_ProcessInputNoWrap(); } -static void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId) +void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId) { const u8* name; u8 i; From 549381f336a8053149f13b50944ce858b031873d Mon Sep 17 00:00:00 2001 From: ExpoSeed <43502820+ExpoSeed@users.noreply.github.com> Date: Tue, 17 Nov 2020 02:44:30 -0600 Subject: [PATCH 06/37] Add debug makefile targets (#2) Thanks to Expo --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 52000c570a..cee566d78d 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ MAKEFLAGS += --no-print-directory # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern +.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern debug modern_debug infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) @@ -339,3 +339,7 @@ berry_fix: libagbsyscall: @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) + +debug: ; @$(MAKE) DDEBUG=1 DINFO=1 + +modern_debug: ; @$(MAKE) MODERN=1 DDEBUG=1 DINFO=1 From 174867c612f80e3bb07291c4d5bdca682a144336 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Fri, 27 Nov 2020 21:12:35 +0100 Subject: [PATCH 07/37] added individual IVs and reworked how data is stored to a struct --- src/debug.c | 450 ++++++++++++++++++++++++++++++++++---------------- sym_ewram.txt | 1 + 2 files changed, 306 insertions(+), 145 deletions(-) diff --git a/src/debug.c b/src/debug.c index dc884b77fb..f83acb7735 100644 --- a/src/debug.c +++ b/src/debug.c @@ -20,6 +20,7 @@ #include "list_menu.h" #include "main.h" #include "main_menu.h" +#include "malloc.h" #include "map_name_popup.h" #include "menu.h" #include "naming_screen.h" @@ -45,6 +46,57 @@ #include "constants/songs.h" #include "constants/species.h" + +// ******************************* +// Enums +enum { // Main + DEBUG_MENU_ITEM_UTILITIES, + DEBUG_MENU_ITEM_FLAGS, + DEBUG_MENU_ITEM_VARS, + DEBUG_MENU_ITEM_GIVE, + DEBUG_MENU_ITEM_CANCEL +}; +enum { // Util + DEBUG_UTIL_MENU_ITEM_HEAL_PARTY, + DEBUG_UTIL_MENU_ITEM_FLY, + DEBUG_UTIL_MENU_ITEM_WARP, + DEBUG_UTIL_MENU_ITEM_SAVEBLOCK, + DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK, + DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK, + DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY, + DEBUG_UTIL_MENU_ITEM_WATCHCREDITS, + DEBUG_UTIL_MENU_ITEM_TRAINER_NAME, + DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, + DEBUG_UTIL_MENU_ITEM_TRAINER_ID, +}; +enum { // Flags + DEBUG_FLAG_MENU_ITEM_FLAGS, + DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS, + DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF, + DEBUG_FLAG_MENU_ITEM_NATDEXONOFF, + DEBUG_FLAG_MENU_ITEM_POKENAVONOFF, + DEBUG_FLAG_MENU_ITEM_FLYANYWHERE, + DEBUG_FLAG_MENU_ITEM_GETALLBADGES, + DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF, + DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF, + DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF, + DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF, + DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF, +}; +enum { // Vars + DEBUG_VARS_MENU_ITEM_VARS, +}; +enum { // Give + DEBUG_GIVE_MENU_ITEM_ITEM, + DEBUG_MENU_ITEM_GIVE_ALLTMS, + DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE, + DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX, + DEBUG_GIVE_MENU_ITEM_CHEAT, + //DEBUG_MENU_ITEM_ACCESS_PC, +}; + + +// ******************************* // Constants #define DEBUG_MAIN_MENU_WIDTH 13 #define DEBUG_MAIN_MENU_HEIGHT 8 @@ -61,6 +113,32 @@ #define DEBUG_NUMBER_ICON_X 210 #define DEBUG_NUMBER_ICON_Y 50 +// EWRAM +static EWRAM_DATA struct DebugMonData *sDebugMonData = NULL; + + +// ******************************* +struct DebugMonData +{ + u16 mon_speciesId; + u8 mon_level; + u8 isShiny; + u16 mon_natureId; + u16 mon_abilityNum; + u8 mon_iv_hp; + u8 mon_iv_atk; + u8 mon_iv_def; + u8 mon_iv_speed; + u8 mon_iv_satk; + u8 mon_iv_sdef; + u16 mon_move_0; + u16 mon_move_1; + u16 mon_move_2; + u16 mon_move_3; +}; + + +// ******************************* // Define functions static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate); void Debug_ShowMainMenu(void); @@ -139,53 +217,6 @@ extern u8 PlayersHouse_2F_EventScript_CheckWallClock[]; #define ABILITY_NAME_LENGTH 12 extern const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1]; -// ******************************* -// Enums -enum { // Main - DEBUG_MENU_ITEM_UTILITIES, - DEBUG_MENU_ITEM_FLAGS, - DEBUG_MENU_ITEM_VARS, - DEBUG_MENU_ITEM_GIVE, - DEBUG_MENU_ITEM_CANCEL -}; -enum { // Util - DEBUG_UTIL_MENU_ITEM_HEAL_PARTY, - DEBUG_UTIL_MENU_ITEM_FLY, - DEBUG_UTIL_MENU_ITEM_WARP, - DEBUG_UTIL_MENU_ITEM_SAVEBLOCK, - DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK, - DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK, - DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY, - DEBUG_UTIL_MENU_ITEM_WATCHCREDITS, - DEBUG_UTIL_MENU_ITEM_TRAINER_NAME, - DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, - DEBUG_UTIL_MENU_ITEM_TRAINER_ID, -}; -enum { // Flags - DEBUG_FLAG_MENU_ITEM_FLAGS, - DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS, - DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF, - DEBUG_FLAG_MENU_ITEM_NATDEXONOFF, - DEBUG_FLAG_MENU_ITEM_POKENAVONOFF, - DEBUG_FLAG_MENU_ITEM_FLYANYWHERE, - DEBUG_FLAG_MENU_ITEM_GETALLBADGES, - DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF, - DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF, - DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF, - DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF, - DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF, -}; -enum { // Vars - DEBUG_VARS_MENU_ITEM_VARS, -}; -enum { // Give - DEBUG_GIVE_MENU_ITEM_ITEM, - DEBUG_MENU_ITEM_GIVE_ALLTMS, - DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE, - DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX, - DEBUG_GIVE_MENU_ITEM_CHEAT, - //DEBUG_MENU_ITEM_ACCESS_PC, -}; // ******************************* //Maps per map group COPY FROM /include/constants/map_groups.h @@ -249,6 +280,12 @@ static const u8 gDebugText_PokemonShiny[] = _("Shiny: static const u8 gDebugText_PokemonNature[] = _("NatureId: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); static const u8 gDebugText_PokemonAbility[] = _("AbilityNum: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); static const u8 gDebugText_PokemonIVs[] = _("All IVs: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_0[] = _("IV HP: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_1[] = _("IV Attack: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_2[] = _("IV Defense: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_3[] = _("IV Speed: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_4[] = _("IV Sp. Attack: \n {STR_VAR_3} \n \n{STR_VAR_2} "); +static const u8 gDebugText_PokemonIV_5[] = _("IV Sp. Defense: \n {STR_VAR_3} \n \n{STR_VAR_2} "); static const u8 gDebugText_PokemonMove_0[] = _("Move 0: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); static const u8 gDebugText_PokemonMove_1[] = _("Move 1: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); static const u8 gDebugText_PokemonMove_2[] = _("Move 2: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); @@ -1505,10 +1542,29 @@ static void DebugAction_Give_AllTMs(u8 taskId) } //Pokemon +static void ResetMonDataStruct(struct DebugMonData *sDebugMonData) +{ + sDebugMonData->mon_speciesId = 1; + sDebugMonData->mon_level = 1; + sDebugMonData->isShiny = 0; + sDebugMonData->mon_natureId = 0; + sDebugMonData->mon_abilityNum = 0; + sDebugMonData->mon_iv_hp = 0; + sDebugMonData->mon_iv_atk = 0; + sDebugMonData->mon_iv_def = 0; + sDebugMonData->mon_iv_speed = 0; + sDebugMonData->mon_iv_satk = 0; + sDebugMonData->mon_iv_sdef = 0; +} static void DebugAction_Give_PokemonSimple(u8 taskId) { u8 windowId; + //Mon data struct + sDebugMonData = AllocZeroed(sizeof(struct DebugMonData)); + ResetMonDataStruct(sDebugMonData); + + //Window initialization ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); RemoveWindow(gTasks[taskId].data[1]); @@ -1522,27 +1578,31 @@ static void DebugAction_Give_PokemonSimple(u8 taskId) //Display initial ID StringCopy(gStringVar2, gText_DigitIndicator[0]); ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 3); - StringCopy(gStringVar1, gSpeciesNames[1]); //CopyItemName(1, gStringVar1); + StringCopy(gStringVar1, gSpeciesNames[1]); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, gDebugText_PokemonID); AddTextPrinterParameterized(windowId, 1, 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] = 1; //Species ID - FreeMonIconPalettes(); //Free space for new pallete + 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, TRUE); //Create pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID - gTasks[taskId].data[7] = 1; //Level } static void DebugAction_Give_PokemonComplex(u8 taskId) { u8 windowId; + //Mon data struct + sDebugMonData = AllocZeroed(sizeof(struct DebugMonData)); + ResetMonDataStruct(sDebugMonData); + + //Window initialization ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); RemoveWindow(gTasks[taskId].data[1]); @@ -1555,8 +1615,8 @@ static void DebugAction_Give_PokemonComplex(u8 taskId) //Display initial ID StringCopy(gStringVar2, gText_DigitIndicator[0]); - ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 3); - StringCopy(gStringVar1, gSpeciesNames[1]); //CopyItemName(1, gStringVar1); + ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 4); + StringCopy(gStringVar1, gSpeciesNames[1]); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, gDebugText_PokemonID); AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); @@ -1566,17 +1626,12 @@ static void DebugAction_Give_PokemonComplex(u8 taskId) gTasks[taskId].data[2] = windowId; gTasks[taskId].data[3] = 1; //Current ID gTasks[taskId].data[4] = 0; //Digit Selected - gTasks[taskId].data[5] = 1; //Species ID - FreeMonIconPalettes(); //Free space for new palletes + 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, TRUE); //Create pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID - gTasks[taskId].data[7] = 0; //Level - gTasks[taskId].data[8] = 0; //Shiny: no 0, yes 1 - gTasks[taskId].data[9] = 0; //Nature ID - gTasks[taskId].data[10] = 0; //Ability - gTasks[taskId].data[11] = 0; //IVs - gTasks[taskId].data[12] = 0; //Move 0 + gTasks[taskId].data[7] = 0; //iterator } static void DebugAction_Give_Pokemon_SelectId(u8 taskId) @@ -1615,7 +1670,7 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); StringCopy(gStringVar1, gSpeciesNames[gTasks[taskId].data[3]]); //CopyItemName(gTasks[taskId].data[3], gStringVar1); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 4); StringExpandPlaceholders(gStringVar4, gDebugText_PokemonID); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); @@ -1628,7 +1683,7 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) if (gMain.newKeys & A_BUTTON) { - gTasks[taskId].data[5] = gTasks[taskId].data[3]; //Species ID + sDebugMonData->mon_speciesId = gTasks[taskId].data[3]; //Species ID gTasks[taskId].data[3] = 1; gTasks[taskId].data[4] = 0; @@ -1643,6 +1698,7 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct FreeMonIconPalettes(); FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite DebugAction_DestroyExtraWindow(taskId); @@ -1688,13 +1744,16 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) { FreeMonIconPalettes(); FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite - if (gTasks[taskId].data[7] == 1) + if (gTasks[taskId].data[5] == 0) { PlaySE(MUS_LEVEL_UP); - ScriptGiveMon(gTasks[taskId].data[5], gTasks[taskId].data[3], ITEM_NONE, 0,0,0); + ScriptGiveMon(sDebugMonData->mon_speciesId, gTasks[taskId].data[3], ITEM_NONE, 0,0,0); + Free(sDebugMonData); //Frees EWRAM of MonData Struct DebugAction_DestroyExtraWindow(taskId); - }else{ - gTasks[taskId].data[7] = gTasks[taskId].data[3]; //Level + } + else + { + sDebugMonData->mon_level = gTasks[taskId].data[3]; //Level gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; @@ -1710,6 +1769,7 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct FreeMonIconPalettes(); FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite DebugAction_DestroyExtraWindow(taskId); @@ -1747,11 +1807,10 @@ static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) if (gMain.newKeys & A_BUTTON) { - gTasks[taskId].data[8] = gTasks[taskId].data[3]; //isShiny + sDebugMonData->isShiny = gTasks[taskId].data[3]; //isShiny gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; - //("ID: {STR_VAR_3}\nNature: {STR_VAR_1}\n\n{STR_VAR_2}"); StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); @@ -1764,6 +1823,7 @@ static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct DebugAction_DestroyExtraWindow(taskId); } } @@ -1797,15 +1857,14 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) if (gMain.newKeys & A_BUTTON) { u8 abilityId; - gTasks[taskId].data[9] = gTasks[taskId].data[3]; //NatureId + sDebugMonData->mon_natureId = gTasks[taskId].data[3]; //NatureId gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - abilityId = GetAbilityBySpecies(gTasks[taskId].data[5], 0); + abilityId = GetAbilityBySpecies(sDebugMonData->mon_speciesId, 0); StringCopy(gStringVar1, gAbilityNames[abilityId]); StringExpandPlaceholders(gStringVar4, gDebugText_PokemonAbility); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); @@ -1815,6 +1874,7 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct DebugAction_DestroyExtraWindow(taskId); } } @@ -1822,10 +1882,10 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) { u8 abilityId; u8 abilityCount = 0; - if (gBaseStats[gTasks[taskId].data[5]].abilities[1] != ABILITY_NONE) + if (gBaseStats[sDebugMonData->mon_speciesId].abilities[1] != ABILITY_NONE) abilityCount++; #ifdef POKEMON_EXPANSION - if (gBaseStats[gTasks[taskId].data[5]].abilityHidden != ABILITY_NONE) + if (gBaseStats[sDebugMonData->mon_speciesId].abilityHidden != ABILITY_NONE) abilityCount++; #endif if (gMain.newKeys & DPAD_ANY) @@ -1845,7 +1905,7 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) gTasks[taskId].data[3] = 0; } - abilityId = GetAbilityBySpecies(gTasks[taskId].data[5], gTasks[taskId].data[3]); + abilityId = GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3]); StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); @@ -1856,14 +1916,14 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) if (gMain.newKeys & A_BUTTON) { - gTasks[taskId].data[10] = gTasks[taskId].data[3]; //AbilityNum + sDebugMonData->mon_abilityNum = gTasks[taskId].data[3]; //AbilityNum gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIVs); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_0); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; @@ -1871,6 +1931,7 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct DebugAction_DestroyExtraWindow(taskId); } } @@ -1906,40 +1967,115 @@ static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIVs); + switch (gTasks[taskId].data[7]) + { + case 0: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_0); + break; + case 1: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_1); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_2); + break; + case 3: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_3); + break; + case 4: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_4); + break; + case 5: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_5); + break; + } AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); } + //If A or B button if (gMain.newKeys & A_BUTTON) { - gTasks[taskId].data[11] = gTasks[taskId].data[3]; //IVs - gTasks[taskId].data[3] = 0; - gTasks[taskId].data[4] = 0; + switch (gTasks[taskId].data[7]) + { + case 0: + sDebugMonData->mon_iv_hp = gTasks[taskId].data[3]; + break; + case 1: + sDebugMonData->mon_iv_atk = gTasks[taskId].data[3]; + break; + case 2: + sDebugMonData->mon_iv_def = gTasks[taskId].data[3]; + break; + case 3: + sDebugMonData->mon_iv_speed = gTasks[taskId].data[3]; + break; + case 4: + sDebugMonData->mon_iv_satk = gTasks[taskId].data[3]; + break; + case 5: + sDebugMonData->mon_iv_sdef = gTasks[taskId].data[3]; + break; + } - StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); - StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); - ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); - StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + //Check if all IVs set + if (gTasks[taskId].data[7] != 5) + { + gTasks[taskId].data[7] += 1; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; - gTasks[taskId].func = DebugAction_Give_Pokemon_Move; + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); + StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); + switch (gTasks[taskId].data[7]) + { + case 0: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_0); + break; + case 1: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_1); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_2); + break; + case 3: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_3); + break; + case 4: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_4); + break; + case 5: + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonIV_5); + break; + } + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, 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 + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); + StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); + StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + + gTasks[taskId].func = DebugAction_Give_Pokemon_Move; + } } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct DebugAction_DestroyExtraWindow(taskId); } } static void DebugAction_Give_Pokemon_Move(u8 taskId) { - u8 j; - for(j=12; j<15; j++) - { - if (gTasks[taskId].data[j] == 0) - break; - } - if (gMain.newKeys & DPAD_ANY) { PlaySE(SE_SELECT); @@ -1971,18 +2107,18 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); - switch (j) + switch (gTasks[taskId].data[7]) { - case 12: + case 0: StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); break; - case 13: + case 1: StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_1); break; - case 14: + case 2: StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_2); break; - case 15: + case 3: StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_3); break; } @@ -1991,16 +2127,31 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) if (gMain.newKeys & A_BUTTON) { - + //If MOVE_NONE selected, stop asking for additional moves if (gTasks[taskId].data[3] == 0) - j = 15; - else - gTasks[taskId].data[j] = gTasks[taskId].data[3]; //Move ID + gTasks[taskId].data[7] = 4; - - // If last move or selected MOVE_NONE make mon, else ask for next move - if (j < 15) + //Set current value + switch (gTasks[taskId].data[7]) { + case 0: + sDebugMonData->mon_move_0 = gTasks[taskId].data[3]; + break; + case 1: + sDebugMonData->mon_move_1 = gTasks[taskId].data[3]; + break; + case 2: + sDebugMonData->mon_move_2 = gTasks[taskId].data[3]; + break; + case 3: + sDebugMonData->mon_move_3 = gTasks[taskId].data[3]; + break; + } + + //If NOT last move or selected MOVE_NONE ask for next move, else make mon + if (gTasks[taskId].data[7] < 3) + { + gTasks[taskId].data[7] += 1; gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; @@ -2008,18 +2159,18 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3); - switch (j+1) + switch (gTasks[taskId].data[7]) { - case 12: + case 0: StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_0); break; - case 13: + case 1: StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_1); break; - case 14: + case 2: StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_2); break; - case 15: + case 3: StringExpandPlaceholders(gStringVar4, gDebugText_PokemonMove_3); break; } @@ -2035,12 +2186,11 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) PlaySE(MUS_LEVEL_UP); gTasks[taskId].func = DebugAction_Give_Pokemon_ComplexCreateMon; } - - } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); + Free(sDebugMonData); //Frees EWRAM of MonData Struct DebugAction_DestroyExtraWindow(taskId); } } @@ -2051,16 +2201,24 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu struct Pokemon mon; u8 i; u16 moves[4]; - u16 species = gTasks[taskId].data[5]; //species ID - u8 level = gTasks[taskId].data[7]; //Level - u8 isShiny = gTasks[taskId].data[8]; //Shiny: no 0, yes 1 - u8 nature = gTasks[taskId].data[9]; //Nature ID - u8 abilityNum = gTasks[taskId].data[10]; //Ability ID - u8 iv_val = gTasks[taskId].data[11]; //IVs - moves[0] = gTasks[taskId].data[12]; //Move 0 - moves[1] = gTasks[taskId].data[13]; //Move 1 - moves[2] = gTasks[taskId].data[14]; //Move 2 - moves[3] = gTasks[taskId].data[15]; //Move 3 + u8 IVs[6]; + u8 iv_val; + u16 species = sDebugMonData->mon_speciesId; + u8 level = sDebugMonData->mon_level; + u8 isShiny = sDebugMonData->isShiny; //Shiny: no 0, yes 1 + u8 nature = sDebugMonData->mon_natureId; + u8 abilityNum = sDebugMonData->mon_abilityNum; + moves[0] = sDebugMonData->mon_move_0; + moves[1] = sDebugMonData->mon_move_1; + moves[2] = sDebugMonData->mon_move_2; + moves[3] = sDebugMonData->mon_move_3; + IVs[0] = sDebugMonData->mon_iv_hp; + IVs[1] = sDebugMonData->mon_iv_atk; + IVs[2] = sDebugMonData->mon_iv_def; + IVs[3] = sDebugMonData->mon_iv_speed; + IVs[4] = sDebugMonData->mon_iv_satk; + IVs[5] = sDebugMonData->mon_iv_sdef; + //Nature if (nature == NUM_NATURES || nature == 0xFF) @@ -2068,21 +2226,21 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu //Shinyness if (isShiny == 1) + { + u32 personality; + u32 otid = gSaveBlock2Ptr->playerTrainerId[0] + | (gSaveBlock2Ptr->playerTrainerId[1] << 8) + | (gSaveBlock2Ptr->playerTrainerId[2] << 16) + | (gSaveBlock2Ptr->playerTrainerId[3] << 24); + + do { - u32 personality; - u32 otid = gSaveBlock2Ptr->playerTrainerId[0] - | (gSaveBlock2Ptr->playerTrainerId[1] << 8) - | (gSaveBlock2Ptr->playerTrainerId[2] << 16) - | (gSaveBlock2Ptr->playerTrainerId[3] << 24); + personality = Random32(); + personality = ((((Random() % 8) ^ (HIHALF(otid) ^ LOHALF(otid))) ^ LOHALF(personality)) << 16) | LOHALF(personality); + } while (nature != GetNatureFromPersonality(personality)); - do - { - personality = Random32(); - personality = ((((Random() % 8) ^ (HIHALF(otid) ^ LOHALF(otid))) ^ LOHALF(personality)) << 16) | LOHALF(personality); - } while (nature != GetNatureFromPersonality(personality)); - - CreateMon(&mon, species, level, 32, 1, personality, OT_ID_PRESET, otid); - } + CreateMon(&mon, species, level, 32, 1, personality, OT_ID_PRESET, otid); + } else CreateMonWithNature(&mon, species, level, 32, nature); @@ -2101,6 +2259,7 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu // } // iv + iv_val = IVs[i]; if (iv_val != 32 && iv_val != 0xFF) SetMonData(&mon, MON_DATA_HP_IV + i, &iv_val); } @@ -2157,15 +2316,16 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu nationalDexNum = SpeciesToNationalPokedexNum(species); switch(sentToPc) { - case MON_GIVEN_TO_PARTY: - case MON_GIVEN_TO_PC: - GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN); - GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT); - break; - case MON_CANT_GIVE: - break; + case MON_GIVEN_TO_PARTY: + case MON_GIVEN_TO_PC: + GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN); + GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT); + break; + case MON_CANT_GIVE: + break; } + Free(sDebugMonData); //Frees EWRAM of MonData Struct DebugAction_DestroyExtraWindow(taskId); //return sentToPc; } diff --git a/sym_ewram.txt b/sym_ewram.txt index 88c4461cb0..fb9765b20d 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -148,3 +148,4 @@ .include "src/faraway_island.o" .include "src/trainer_hill.o" .include "src/rayquaza_scene.o" + .include "src/debug.o" From 5bb92efa5b0d80341c9c6d56867b88864f1bd191 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 28 Nov 2020 00:51:38 +0100 Subject: [PATCH 08/37] now closes debug windows after giving all TMs --- src/debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/debug.c b/src/debug.c index f83acb7735..c4d5b1ecf9 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1539,6 +1539,8 @@ static void DebugAction_Give_AllTMs(u8 taskId) for (i = ITEM_TM01; i <= ITEM_TM50; i++) if(!CheckBagHasItem(i, 1)) AddBagItem(i, 1); + Debug_DestroyMenu(taskId); + EnableBothScriptContexts(); } //Pokemon From edc476f863fedf9ec43d9005a08edf3e0e61e3c2 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 30 Nov 2020 11:29:13 +0100 Subject: [PATCH 09/37] fixed heal party bug, thanks to jaizu for poitning it out --- src/debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index c4d5b1ecf9..e0db6988ef 100644 --- a/src/debug.c +++ b/src/debug.c @@ -683,6 +683,7 @@ static void DebugAction_Util_HealParty(u8 taskId) { PlaySE(SE_USE_ITEM); HealPlayerParty(); + EnableBothScriptContexts(); Debug_DestroyMenu(taskId); } static void DebugAction_Util_Fly(u8 taskId) @@ -944,8 +945,8 @@ static void DebugAction_Util_Trainer_Gender(u8 taskId) gSaveBlock2Ptr->playerGender = 1; else gSaveBlock2Ptr->playerGender = 0; - Debug_DestroyMenu(taskId); EnableBothScriptContexts(); + Debug_DestroyMenu(taskId); } static void DebugAction_Util_Trainer_Id(u8 taskId) { From c15138fdbbf7dca956ad0a0b6ef3be1fd17ca515 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Fri, 29 Jan 2021 11:39:09 +0100 Subject: [PATCH 10/37] Fixed problems with changed Deoxys handling in RHH's pokeexpansion, thanks to "Subzero Eclipse" for pointing it out --- src/debug.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/debug.c b/src/debug.c index e0db6988ef..f1672632d4 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1594,7 +1594,12 @@ static void DebugAction_Give_PokemonSimple(u8 taskId) 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, TRUE); //Create pokemon sprite + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite + #endif gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID } static void DebugAction_Give_PokemonComplex(u8 taskId) @@ -1632,7 +1637,12 @@ static void DebugAction_Give_PokemonComplex(u8 taskId) 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, TRUE); //Create pokemon sprite + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite + #endif gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID gTasks[taskId].data[7] = 0; //iterator } @@ -1680,7 +1690,12 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) 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, TRUE); //Create new pokemon sprite + #ifndef POKEMON_EXPANSION + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite + #endif + #ifdef POKEMON_EXPANSION + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite + #endif gSprites[gTasks[taskId].data[6]].oam.priority = 0; } From 27a99323da2b5e0767f1c2b1a7777cb6d4d60dd4 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 4 Feb 2021 16:33:01 +0100 Subject: [PATCH 11/37] WIP reset makefile to new default --- Makefile | 54 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index cee566d78d..98da1e17a1 100644 --- a/Makefile +++ b/Makefile @@ -63,13 +63,13 @@ ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN) ifeq ($(MODERN),0) CC1 := tools/agbcc/bin/agbcc$(EXE) -override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm +override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -g ROM := pokeemerald.gba OBJ_DIR := build/emerald LIBPATH := -L ../../tools/agbcc/lib else CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet -override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mcpu=arm7tdmi -fno-toplevel-reorder -Wno-pointer-to-int-cast +override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -g ROM := pokeemerald_modern.gba OBJ_DIR := build/modern LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))" @@ -111,7 +111,7 @@ MAKEFLAGS += --no-print-directory # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern debug modern_debug +.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) @@ -136,6 +136,9 @@ C_ASM_OBJS := $(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o,$(C_ASM_SRCS)) ASM_SRCS := $(wildcard $(ASM_SUBDIR)/*.s) ASM_OBJS := $(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o,$(ASM_SRCS)) +# get all the data/*.s files EXCEPT the ones with specific rules +REGULAR_DATA_ASM_SRCS := $(filter-out $(DATA_ASM_SUBDIR)/maps.s $(DATA_ASM_SUBDIR)/map_events.s, $(wildcard $(DATA_ASM_SUBDIR)/*.s)) + DATA_ASM_SRCS := $(wildcard $(DATA_ASM_SUBDIR)/*.s) DATA_ASM_OBJS := $(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o,$(DATA_ASM_SRCS)) @@ -178,7 +181,7 @@ mostlyclean: tidy rm -f $(SAMPLE_SUBDIR)/*.bin rm -f $(CRY_SUBDIR)/*.bin rm -f $(MID_SUBDIR)/*.s - find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + + find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} + @@ -248,12 +251,6 @@ ifeq ($(DINFO),1) override CFLAGS += -g endif -# DebugMenu -ifeq ($(DDEBUG),1) -override ASFLAGS += --defsym DEBUG=1 -override CPPFLAGS += -D DEBUG=1 -endif - $(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep) @$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i @$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s @@ -281,23 +278,32 @@ endif $(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s $$(c_asm_dep) $(AS) $(ASFLAGS) -o $@ $< -ifeq ($(NODEP),1) -$(ASM_BUILDDIR)/%.o: asm_dep := -else -$(ASM_BUILDDIR)/%.o: asm_dep = $(shell $(SCANINC) -I "" $(ASM_SUBDIR)/$*.s) -endif +# The dep rules have to be explicit or else missing files won't be reported. +# As a side effect, they're evaluated immediately instead of when the rule is invoked. +# It doesn't look like $(shell) can be deferred so there might not be a better way. -$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s $$(asm_dep) + +ifeq ($(NODEP),1) +$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s $(AS) $(ASFLAGS) -o $@ $< - -ifeq ($(NODEP),1) -$(DATA_ASM_BUILDDIR)/%.o: data_dep := else -$(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $(DATA_ASM_SUBDIR)/$*.s) +define ASM_DEP +$1: $2 $$(shell $(SCANINC) -I include -I "" $2) + $$(AS) $$(ASFLAGS) -o $$@ $$< +endef +$(foreach src, $(ASM_SRCS), $(eval $(call ASM_DEP,$(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o, $(src)),$(src)))) endif -$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s $$(data_dep) +ifeq ($(NODEP),1) +$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s $(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@ +else +define DATA_ASM_DEP +$1: $2 $$(shell $(SCANINC) -I include -I "" $2) + $$(PREPROC) $$< charmap.txt | $$(CPP) -I include | $$(AS) $$(ASFLAGS) -o $$@ +endef +$(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call DATA_ASM_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src)))) +endif $(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s $(AS) $(ASFLAGS) -I sound -o $@ $< @@ -338,8 +344,4 @@ berry_fix: @$(MAKE) -C berry_fix COMPARE=$(COMPARE) TOOLCHAIN=$(TOOLCHAIN) libagbsyscall: - @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) - -debug: ; @$(MAKE) DDEBUG=1 DINFO=1 - -modern_debug: ; @$(MAKE) MODERN=1 DDEBUG=1 DINFO=1 + @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) \ No newline at end of file From 965bcfa29d2ea0fea3e181253eb241fa70744f3b Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 4 Feb 2021 18:04:00 +0100 Subject: [PATCH 12/37] Added newest Makefile and fixed making from clean --- Makefile | 16 +++++++++++++--- include/debug.h | 2 +- src/debug.c | 2 +- src/event_object_movement.c | 2 +- src/field_control_avatar.c | 2 +- src/trainer_see.c | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 98da1e17a1..7ea5bdb926 100644 --- a/Makefile +++ b/Makefile @@ -111,13 +111,13 @@ MAKEFLAGS += --no-print-directory # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern +.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern debugging debugging_modern infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) # Build tools when building the rom # Disable dependency scanning for clean/tidy/tools -ifeq (,$(filter-out all rom compare modern berry_fix libagbsyscall,$(MAKECMDGOALS))) +ifeq (,$(filter-out all rom compare modern debugging debugging_modern berry_fix libagbsyscall,$(MAKECMDGOALS))) $(call infoshell, $(MAKE) tools) else NODEP := 1 @@ -251,6 +251,12 @@ ifeq ($(DINFO),1) override CFLAGS += -g endif +# Debug menu +ifeq ($(DDEBUGGING),1) +override ASFLAGS += --defsym DEBUGGING=1 +override CPPFLAGS += -D DEBUGGING=1 +endif + $(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep) @$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i @$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s @@ -344,4 +350,8 @@ berry_fix: @$(MAKE) -C berry_fix COMPARE=$(COMPARE) TOOLCHAIN=$(TOOLCHAIN) libagbsyscall: - @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) \ No newline at end of file + @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) + +# Debug menu +debugging: ; @$(MAKE) DDEBUGGING=1 DINFO=1 +debugging_modern: ; @$(MAKE) MODERN=1 DDEBUGGING=1 DINFO=1 diff --git a/include/debug.h b/include/debug.h index 0d78632e63..4c9c3fffcb 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,7 +1,7 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H -#if DEBUG +#if DEBUGGING void Debug_ShowMainMenu(void); #endif diff --git a/src/debug.c b/src/debug.c index f1672632d4..ec5a4f81ac 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,4 +1,4 @@ -#if DEBUG +#if DEBUGGING //CREDITS //TheXaman: https://github.com/TheXaman/pokeemerald/tree/tx_debug_system //CODE USED FROM: diff --git a/src/event_object_movement.c b/src/event_object_movement.c index ba90eca7e0..de17be1254 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4724,7 +4724,7 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; -#if DEBUG //DEBUG +#if DEBUGGING //DEBUG if (FlagGet(FLAG_SYS_NO_COLLISION)) return COLLISION_NONE; #endif // diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index c586656fb1..fa607cd42e 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -219,7 +219,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; -#if DEBUG +#if DEBUGGING if (input->input_field_1_2) { PlaySE(SE_WIN_OPEN); diff --git a/src/trainer_see.c b/src/trainer_see.c index d5b25b0c59..83783469c1 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -177,7 +177,7 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; -#if DEBUG //DEBUG +#if DEBUGGING //DEBUG if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) return FALSE; #endif // From 40ebd6608497dfcfc5b57e226a94afac661b20bf Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 25 Mar 2021 10:21:27 +0100 Subject: [PATCH 13/37] Fixed setting vars not working, thanks to AmbientDinosaur and BSBob for reaching out --- src/debug.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/debug.c b/src/debug.c index ec5a4f81ac..df05735744 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1310,9 +1310,12 @@ static void DebugAction_Vars_SetValue(u8 taskId) { if(gMain.newKeys & DPAD_UP) { - gTasks[taskId].data[6] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[6] >= 100){ - gTasks[taskId].data[6] = 99; + if (gTasks[taskId].data[6] + sPowersOfTen[gTasks[taskId].data[4]] <= 32000) + gTasks[taskId].data[6] += sPowersOfTen[gTasks[taskId].data[4]]; + else + gTasks[taskId].data[6] = 32000-1; + if(gTasks[taskId].data[6] >= 32000){ + gTasks[taskId].data[6] = 32000-1; } } if(gMain.newKeys & DPAD_DOWN) @@ -1333,16 +1336,16 @@ static void DebugAction_Vars_SetValue(u8 taskId) if(gMain.newKeys & DPAD_RIGHT) { gTasks[taskId].data[4] += 1; - if(gTasks[taskId].data[4] > 2) + if(gTasks[taskId].data[4] > 4) { - gTasks[taskId].data[4] = 2; + gTasks[taskId].data[4] = 4; } } if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - VarSet(gTasks[taskId].data[3], gTasks[taskId].data[5]); + VarSet(gTasks[taskId].data[3], gTasks[taskId].data[6]); } else if (gMain.newKeys & B_BUTTON) { From c8c81e41560d88ff80f15fe6712c13798ae6bfb4 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Fri, 7 May 2021 10:31:59 +0200 Subject: [PATCH 14/37] Fixed "new trainer id" option, thanks to Lunos and Deokishisu --- src/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index df05735744..29a0d06d68 100644 --- a/src/debug.c +++ b/src/debug.c @@ -950,7 +950,7 @@ static void DebugAction_Util_Trainer_Gender(u8 taskId) } static void DebugAction_Util_Trainer_Id(u8 taskId) { - u32 trainerId = (Random() << 0x10) | GetGeneratedTrainerIdLower(); + u32 trainerId = ((Random() << 16) | Random()); SetTrainerId(trainerId, gSaveBlock2Ptr->playerTrainerId); Debug_DestroyMenu(taskId); EnableBothScriptContexts(); From 19cf846ba9e29f1b9a8ec9159ff732321155a763 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Fri, 7 May 2021 11:44:03 +0200 Subject: [PATCH 15/37] Added: Toggle running shoes, Poison all mons, Max money, Max coins, Trigger daycare egg, Fill PC CREDITS: @Sierraffinity --- src/debug.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index 29a0d06d68..173711a113 100644 --- a/src/debug.c +++ b/src/debug.c @@ -7,8 +7,11 @@ //AsparagusEduardo: https://github.com/AsparagusEduardo/pokeemerald/tree/InfusedEmerald_v2 //Ghoulslash: https://github.com/ghoulslash/pokeemerald #include "global.h" +#include "battle.h" +#include "coins.h" #include "credits.h" #include "data.h" +#include "daycare.h" #include "event_data.h" #include "event_object_movement.h" #include "event_scripts.h" @@ -23,6 +26,7 @@ #include "malloc.h" #include "map_name_popup.h" #include "menu.h" +#include "money.h" #include "naming_screen.h" #include "new_game.h" #include "overworld.h" @@ -60,6 +64,8 @@ enum { // Util DEBUG_UTIL_MENU_ITEM_HEAL_PARTY, DEBUG_UTIL_MENU_ITEM_FLY, DEBUG_UTIL_MENU_ITEM_WARP, + DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES, + DEBUG_UTIL_MENU_ITEM_POISON_MONS, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK, @@ -91,6 +97,10 @@ enum { // Give DEBUG_MENU_ITEM_GIVE_ALLTMS, DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE, DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX, + DEBUG_GIVE_MENU_ITEM_MAX_MONEY, + DEBUG_GIVE_MENU_ITEM_MAX_COINS, + DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG, + DEBUG_GIVE_MENU_ITEM_FILL_PC, DEBUG_GIVE_MENU_ITEM_CHEAT, //DEBUG_MENU_ITEM_ACCESS_PC, }; @@ -162,6 +172,8 @@ static void DebugAction_Util_Warp_Warp(u8 taskId); static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId); static void DebugAction_Util_Warp_SelectMap(u8 taskId); static void DebugAction_Util_Warp_SelectWarp(u8 taskId); +static void DebugAction_Util_RunningShoes(u8 taskId); +static void DebugAction_Util_PoisonMons(u8 taskId); static void DebugAction_Util_CheckSaveBlock(u8); static void DebugAction_Util_CheckWallClock(u8); static void DebugAction_Util_SetWallClock(u8); @@ -204,6 +216,10 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId); static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId); static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId); static void DebugAction_Give_Pokemon_Move(u8 taskId); +static void DebugAction_Give_MaxMoney(u8 taskId); +static void DebugAction_Give_MaxCoins(u8 taskId); +static void DebugAction_Give_DayCareEgg(u8 taskId); +static void DebugAction_Give_FillPC(u8 taskId); static void DebugAction_Give_CHEAT(u8 taskId); static void DebugAction_AccessPC(u8 taskId); @@ -237,6 +253,8 @@ static const u8 gDebugText_Util_WarpToMap_SelectMapGroup[] =_("Group: {STR_VAR_1 static const u8 gDebugText_Util_WarpToMap_SelectMap[] = _("Map: {STR_VAR_1} \nMapSec: \n{STR_VAR_2} \n{STR_VAR_3} "); static const u8 gDebugText_Util_WarpToMap_SelectWarp[] = _("Warp: \n{STR_VAR_1} \n \n{STR_VAR_3} "); static const u8 gDebugText_Util_WarpToMap_SelMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); +static const u8 gDebugText_Util_RunningShoes[] = _("Toggle Running Shoes"); +static const u8 gDebugText_Util_PoisonMons[] = _("Poison all mons"); static const u8 gDebugText_Util_SaveBlockSpace[] = _("SaveBlock Space"); static const u8 gDebugText_Util_CheckWallClock[] = _("Check Wall Clock"); static const u8 gDebugText_Util_SetWallClock[] = _("Set Wall Clock"); @@ -290,7 +308,11 @@ static const u8 gDebugText_PokemonMove_0[] = _("Move 0: {STR_VAR_3} static const u8 gDebugText_PokemonMove_1[] = _("Move 1: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); static const u8 gDebugText_PokemonMove_2[] = _("Move 2: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); static const u8 gDebugText_PokemonMove_3[] = _("Move 3: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT start"); +static const u8 gDebugText_Give_MaxMoney[] = _("Max Money"); +static const u8 gDebugText_Give_MaxCoins[] = _("Max Coins"); +static const u8 gDebugText_Give_DaycareEgg[] = _("Daycare Egg"); +static const u8 gDebugText_Give_FillPc[] = _("Fill Pc"); +static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT Start"); // static const u8 gDebugText_Give_AccessPC[] = _("Access PC"); static const u8 digitInidicator_1[] = _("{LEFT_ARROW}+1{RIGHT_ARROW} "); @@ -341,6 +363,8 @@ static const struct ListMenuItem sDebugMenu_Items_Utilities[] = [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = {gDebugText_Util_HealParty, DEBUG_UTIL_MENU_ITEM_HEAL_PARTY}, [DEBUG_UTIL_MENU_ITEM_FLY] = {gDebugText_Util_Fly, DEBUG_UTIL_MENU_ITEM_FLY}, [DEBUG_UTIL_MENU_ITEM_WARP] = {gDebugText_Util_WarpToMap, DEBUG_UTIL_MENU_ITEM_WARP}, + [DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES] = {gDebugText_Util_RunningShoes, DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES}, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = {gDebugText_Util_PoisonMons, DEBUG_UTIL_MENU_ITEM_POISON_MONS}, [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = {gDebugText_Util_SaveBlockSpace, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK}, [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {gDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {gDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, @@ -375,6 +399,10 @@ static const struct ListMenuItem sDebugMenu_Items_Give[] = [DEBUG_MENU_ITEM_GIVE_ALLTMS] = {gDebugText_Give_AllTMs, DEBUG_MENU_ITEM_GIVE_ALLTMS}, [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = {gDebugText_Give_GivePokemonSimple, DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE}, [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = {gDebugText_Give_GivePokemonComplex, DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX}, + [DEBUG_GIVE_MENU_ITEM_MAX_MONEY] = {gDebugText_Give_MaxMoney, DEBUG_GIVE_MENU_ITEM_MAX_MONEY}, + [DEBUG_GIVE_MENU_ITEM_MAX_COINS] = {gDebugText_Give_MaxCoins, DEBUG_GIVE_MENU_ITEM_MAX_COINS}, + [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = {gDebugText_Give_DaycareEgg, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG}, + [DEBUG_GIVE_MENU_ITEM_FILL_PC] = {gDebugText_Give_FillPc, DEBUG_GIVE_MENU_ITEM_FILL_PC}, [DEBUG_GIVE_MENU_ITEM_CHEAT] = {gDebugText_Give_GiveCHEAT, DEBUG_GIVE_MENU_ITEM_CHEAT}, //[DEBUG_MENU_ITEM_ACCESS_PC] = {gDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, }; @@ -394,6 +422,8 @@ 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_RUNNING_SHOES] = DebugAction_Util_RunningShoes, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = DebugAction_Util_PoisonMons, [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = DebugAction_Util_CheckSaveBlock, [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, @@ -428,6 +458,10 @@ static void (*const sDebugMenu_Actions_Give[])(u8) = [DEBUG_MENU_ITEM_GIVE_ALLTMS] = DebugAction_Give_AllTMs, [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = DebugAction_Give_PokemonSimple, [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = DebugAction_Give_PokemonComplex, + [DEBUG_GIVE_MENU_ITEM_MAX_MONEY] = DebugAction_Give_MaxMoney, + [DEBUG_GIVE_MENU_ITEM_MAX_COINS] = DebugAction_Give_MaxCoins, + [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = DebugAction_Give_DayCareEgg, + [DEBUG_GIVE_MENU_ITEM_FILL_PC] = DebugAction_Give_FillPC, [DEBUG_GIVE_MENU_ITEM_CHEAT] = DebugAction_Give_CHEAT, //[DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, }; @@ -895,6 +929,36 @@ static void DebugAction_Util_Warp_SelectWarp(u8 taskId) } } +static void DebugAction_Util_RunningShoes(u8 taskId) +{ + if (FlagGet(FLAG_SYS_B_DASH)) + { + FlagClear(FLAG_SYS_B_DASH); + PlaySE(SE_PC_OFF); + } + else + { + FlagSet(FLAG_SYS_B_DASH); + PlaySE(SE_PC_LOGIN); + } +} + +static void DebugAction_Util_PoisonMons(u8 taskId) +{ + int i; + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, 0) + && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_NONE + && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_EGG) + { + u32 curStatus = STATUS1_POISON; + SetMonData(&gPlayerParty[i], MON_DATA_STATUS, &curStatus); + } + } + PlaySE(SE_FIELD_POISON); +} + static void DebugAction_Util_CheckSaveBlock(u8 taskId) { static const u8 gDebugText_SaveBlockSize[] = _("SaveBlock1 is {STR_VAR_1} bytes long.\nMax size is 15872 bytes.\pSaveBlock2 is {STR_VAR_2} bytes long.\nMax size is 3968 bytes.\pPokemonStorage is {STR_VAR_3} bytes long.\nMax size is 35712 bytes."); @@ -2350,6 +2414,50 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu DebugAction_DestroyExtraWindow(taskId); //return sentToPc; } +static void DebugAction_Give_MaxMoney(u8 taskId) +{ + SetMoney(&gSaveBlock1Ptr->money, 999999); +} + +static void DebugAction_Give_MaxCoins(u8 taskId) +{ + SetCoins(9999); +} + +static void DebugAction_Give_DayCareEgg(u8 taskId) +{ + TriggerPendingDaycareEgg(); +} + +static void DebugAction_Give_FillPC(u8 taskId) //Credit: Sierraffinity +{ + int boxId, boxPosition; + u32 personality; + struct BoxPokemon boxMon; + + personality = Random32(); + + CreateBoxMon(&boxMon, + SPECIES_DEOXYS, + 100, + 32, + personality, + 0, + OT_ID_PLAYER_ID, + 0); + + for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++) + { + for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++) + { + if (!GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES)) + { + gPokemonStoragePtr->boxes[boxId][boxPosition] = boxMon; + } + } + } +} + static void DebugAction_Give_CHEAT(u8 taskId) { Debug_DestroyMenu(taskId); From 822a6c42608248a4a71199fe94c8d984edc6584b Mon Sep 17 00:00:00 2001 From: TheXaman Date: Fri, 7 May 2021 11:52:51 +0200 Subject: [PATCH 16/37] Formatting --- src/debug.c | 90 ++++++++++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/debug.c b/src/debug.c index 173711a113..28402da5d6 100644 --- a/src/debug.c +++ b/src/debug.c @@ -93,8 +93,8 @@ enum { // Vars DEBUG_VARS_MENU_ITEM_VARS, }; enum { // Give - DEBUG_GIVE_MENU_ITEM_ITEM, - DEBUG_MENU_ITEM_GIVE_ALLTMS, + DEBUG_GIVE_MENU_ITEM_ITEM_X, + DEBUG_GIVE_MENU_ITEM_ALLTMS, DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE, DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX, DEBUG_GIVE_MENU_ITEM_MAX_MONEY, @@ -264,27 +264,27 @@ static const u8 gDebugText_Util_Trainer_Name[] = _("Trainer name"); static const u8 gDebugText_Util_Trainer_Gender[] = _("Toggle T. Gender"); static const u8 gDebugText_Util_Trainer_Id[] = _("New Trainer Id"); // Flags Menu -static const u8 gDebugText_Flags_Flags[] = _("Set Flag XXXX"); -static const u8 gDebugText_Flags_SetPokedexFlags[] = _("All Pokédex Flags"); -static const u8 gDebugText_Flags_SwitchDex[] = _("Pokédex ON/OFF"); -static const u8 gDebugText_Flags_SwitchNationalDex[] = _("NatDex ON/OFF"); -static const u8 gDebugText_Flags_SwitchPokeNav[] = _("PokéNav ON/OFF"); -static const u8 gDebugText_Flags_ToggleFlyFlags[] = _("Fly Flags ON/OFF"); -static const u8 gDebugText_Flags_ToggleAllBadges[] = _("All badges ON/OFF"); -static const u8 gDebugText_Flags_SwitchCollision[] = _("Collision ON/OFF"); -static const u8 gDebugText_Flags_SwitchEncounter[] = _("Encounter ON/OFF"); -static const u8 gDebugText_Flags_SwitchTrainerSee[] = _("TrainerSee ON/OFF"); -static const u8 gDebugText_Flags_SwitchBagUse[] = _("BagUse ON/OFF"); -static const u8 gDebugText_Flags_SwitchCatching[] = _("Catching ON/OFF"); -static const u8 gDebugText_Flag[] = _("Flag: {STR_VAR_1} \n{STR_VAR_2} \n{STR_VAR_3}"); -static const u8 gDebugText_FlagHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); -static const u8 gDebugText_FlagSet[] = _("TRUE"); -static const u8 gDebugText_FlagUnset[] = _("FALSE"); +static const u8 gDebugText_Flags_Flags[] = _("Set Flag XXXX"); +static const u8 gDebugText_Flags_SetPokedexFlags[] = _("All Pokédex Flags"); +static const u8 gDebugText_Flags_SwitchDex[] = _("Pokédex ON/OFF"); +static const u8 gDebugText_Flags_SwitchNationalDex[] = _("NatDex ON/OFF"); +static const u8 gDebugText_Flags_SwitchPokeNav[] = _("PokéNav ON/OFF"); +static const u8 gDebugText_Flags_ToggleFlyFlags[] = _("Fly Flags ON/OFF"); +static const u8 gDebugText_Flags_ToggleAllBadges[] = _("All badges ON/OFF"); +static const u8 gDebugText_Flags_SwitchCollision[] = _("Collision ON/OFF"); +static const u8 gDebugText_Flags_SwitchEncounter[] = _("Encounter ON/OFF"); +static const u8 gDebugText_Flags_SwitchTrainerSee[] = _("TrainerSee ON/OFF"); +static const u8 gDebugText_Flags_SwitchBagUse[] = _("BagUse ON/OFF"); +static const u8 gDebugText_Flags_SwitchCatching[] = _("Catching ON/OFF"); +static const u8 gDebugText_Flags_Flag[] = _("Flag: {STR_VAR_1} \n{STR_VAR_2} \n{STR_VAR_3}"); +static const u8 gDebugText_Flags_FlagHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); +static const u8 gDebugText_Flags_FlagSet[] = _("TRUE"); +static const u8 gDebugText_Flags_FlagUnset[] = _("FALSE"); // Variables Menu -static const u8 gDebugText_Vars_Vars[] = _("Set Vars XXXX"); -static const u8 gDebugText_VariableHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); -static const u8 gDebugText_Variable[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); -static const u8 gDebugText_VariableValueSet[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); +static const u8 gDebugText_Vars_Vars[] = _("Set Vars XXXX"); +static const u8 gDebugText_Vars_VariableHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); +static const u8 gDebugText_Vars_Variable[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); +static const u8 gDebugText_Vars_VariableValueSet[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); // Give Menu static const u8 gDebugText_Give_GiveItem[] = _("Give item XXXX"); static const u8 gDebugText_ItemQuantity[] = _("Quantity: \n{STR_VAR_1} \n\n{STR_VAR_2}"); @@ -395,8 +395,8 @@ static const struct ListMenuItem sDebugMenu_Items_Vars[] = }; static const struct ListMenuItem sDebugMenu_Items_Give[] = { - [DEBUG_GIVE_MENU_ITEM_ITEM] = {gDebugText_Give_GiveItem, DEBUG_GIVE_MENU_ITEM_ITEM}, - [DEBUG_MENU_ITEM_GIVE_ALLTMS] = {gDebugText_Give_AllTMs, DEBUG_MENU_ITEM_GIVE_ALLTMS}, + [DEBUG_GIVE_MENU_ITEM_ITEM_X] = {gDebugText_Give_GiveItem, DEBUG_GIVE_MENU_ITEM_ITEM_X}, + [DEBUG_GIVE_MENU_ITEM_ALLTMS] = {gDebugText_Give_AllTMs, DEBUG_GIVE_MENU_ITEM_ALLTMS}, [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = {gDebugText_Give_GivePokemonSimple, DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE}, [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = {gDebugText_Give_GivePokemonComplex, DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX}, [DEBUG_GIVE_MENU_ITEM_MAX_MONEY] = {gDebugText_Give_MaxMoney, DEBUG_GIVE_MENU_ITEM_MAX_MONEY}, @@ -454,8 +454,8 @@ static void (*const sDebugMenu_Actions_Vars[])(u8) = }; static void (*const sDebugMenu_Actions_Give[])(u8) = { - [DEBUG_GIVE_MENU_ITEM_ITEM] = DebugAction_Give_Item, - [DEBUG_MENU_ITEM_GIVE_ALLTMS] = DebugAction_Give_AllTMs, + [DEBUG_GIVE_MENU_ITEM_ITEM_X] = DebugAction_Give_Item, + [DEBUG_GIVE_MENU_ITEM_ALLTMS] = DebugAction_Give_AllTMs, [DEBUG_GIVE_MENU_ITEM_POKEMON_SIMPLE] = DebugAction_Give_PokemonSimple, [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = DebugAction_Give_PokemonComplex, [DEBUG_GIVE_MENU_ITEM_MAX_MONEY] = DebugAction_Give_MaxMoney, @@ -1039,13 +1039,13 @@ static void DebugAction_Flags_Flags(u8 taskId) //Display initial Flag ConvertIntToDecimalStringN(gStringVar1, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); ConvertIntToHexStringN(gStringVar2, 0, STR_CONV_MODE_LEFT_ALIGN, 3); - StringExpandPlaceholders(gStringVar1, gDebugText_FlagHex); + StringExpandPlaceholders(gStringVar1, gDebugText_Flags_FlagHex); if(FlagGet(0) == TRUE) - StringCopyPadded(gStringVar2, gDebugText_FlagSet, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagSet, CHAR_SPACE, 15); else - StringCopyPadded(gStringVar2, gDebugText_FlagUnset, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); StringCopy(gStringVar3, gText_DigitIndicator[0]); - StringExpandPlaceholders(gStringVar4, gDebugText_Flag); + StringExpandPlaceholders(gStringVar4, gDebugText_Flags_Flag); AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Flags_FlagsSelect; @@ -1103,13 +1103,13 @@ static void DebugAction_Flags_FlagsSelect(u8 taskId) { 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); - StringExpandPlaceholders(gStringVar1, gDebugText_FlagHex); + StringExpandPlaceholders(gStringVar1, gDebugText_Flags_FlagHex); if(FlagGet(gTasks[taskId].data[3]) == TRUE) - StringCopyPadded(gStringVar2, gDebugText_FlagSet, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagSet, CHAR_SPACE, 15); else - StringCopyPadded(gStringVar2, gDebugText_FlagUnset, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringExpandPlaceholders(gStringVar4, gDebugText_Flag); + StringExpandPlaceholders(gStringVar4, gDebugText_Flags_Flag); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); } } @@ -1275,11 +1275,11 @@ static void DebugAction_Vars_Vars(u8 taskId) //Display initial Variable 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, gDebugText_VariableHex); + StringExpandPlaceholders(gStringVar1, gDebugText_Vars_VariableHex); ConvertIntToDecimalStringN(gStringVar3, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringCopy(gStringVar2, gText_DigitIndicator[0]); - StringExpandPlaceholders(gStringVar4, gDebugText_Variable); + StringExpandPlaceholders(gStringVar4, gDebugText_Vars_Variable); AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].func = DebugAction_Vars_Select; @@ -1328,7 +1328,7 @@ static void DebugAction_Vars_Select(u8 taskId) 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); - StringExpandPlaceholders(gStringVar1, gDebugText_VariableHex); + StringExpandPlaceholders(gStringVar1, gDebugText_Vars_VariableHex); if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value, if 65535 the value hasnt been set gTasks[taskId].data[5] = 0; else @@ -1337,7 +1337,7 @@ static void DebugAction_Vars_Select(u8 taskId) StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit //Combine str's to full window string - StringExpandPlaceholders(gStringVar4, gDebugText_Variable); + StringExpandPlaceholders(gStringVar4, gDebugText_Vars_Variable); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); } @@ -1349,7 +1349,7 @@ static void DebugAction_Vars_Select(u8 taskId) 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); - StringExpandPlaceholders(gStringVar1, gDebugText_VariableHex); + StringExpandPlaceholders(gStringVar1, gDebugText_Vars_VariableHex); if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value if 65535 the value hasnt been set gTasks[taskId].data[5] = 0; else @@ -1357,7 +1357,7 @@ static void DebugAction_Vars_Select(u8 taskId) ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[5], 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 - StringExpandPlaceholders(gStringVar4, gDebugText_VariableValueSet); + StringExpandPlaceholders(gStringVar4, gDebugText_Vars_VariableValueSet); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].data[6] = gTasks[taskId].data[5]; //New value selector @@ -1424,12 +1424,12 @@ static void DebugAction_Vars_SetValue(u8 taskId) 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); - StringExpandPlaceholders(gStringVar1, gDebugText_VariableHex); + StringExpandPlaceholders(gStringVar1, gDebugText_Vars_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 - StringExpandPlaceholders(gStringVar4, gDebugText_VariableValueSet); + StringExpandPlaceholders(gStringVar4, gDebugText_Vars_VariableValueSet); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); } } @@ -1844,7 +1844,7 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringCopyPadded(gStringVar2, gDebugText_FlagUnset, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, gDebugText_PokemonShiny); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); @@ -1881,9 +1881,9 @@ static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) } if(gTasks[taskId].data[3] == 1) - StringCopyPadded(gStringVar2, gDebugText_FlagSet, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagSet, CHAR_SPACE, 15); else - StringCopyPadded(gStringVar2, gDebugText_FlagUnset, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, gDebugText_PokemonShiny); From c92c3456b1a6fee9d298c903927bc5aa80dcfa44 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Mon, 24 May 2021 10:19:22 +0200 Subject: [PATCH 17/37] Fixed bug not beeing able to select last species, thanks to Lunos for finding it --- src/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug.c b/src/debug.c index 28402da5d6..36102339e1 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1725,8 +1725,8 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; if(gTasks[taskId].data[3] > SPECIES_CELEBI && gTasks[taskId].data[3] < SPECIES_TREECKO) gTasks[taskId].data[3] = SPECIES_TREECKO; - if(gTasks[taskId].data[3] >= NUM_SPECIES - 1) - gTasks[taskId].data[3] = NUM_SPECIES - 2; + if(gTasks[taskId].data[3] >= NUM_SPECIES) + gTasks[taskId].data[3] = NUM_SPECIES - 1; } if(gMain.newKeys & DPAD_DOWN) { From 4e98c268c1ba507bbcd18eddf153bab47bb9abdf Mon Sep 17 00:00:00 2001 From: Jaizu Date: Wed, 9 Jun 2021 23:07:05 +0200 Subject: [PATCH 18/37] Small change to hidden ability (#3) --- src/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index 36102339e1..c6bc23fb34 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1970,7 +1970,7 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) if (gBaseStats[sDebugMonData->mon_speciesId].abilities[1] != ABILITY_NONE) abilityCount++; #ifdef POKEMON_EXPANSION - if (gBaseStats[sDebugMonData->mon_speciesId].abilityHidden != ABILITY_NONE) + if (gBaseStats[sDebugMonData->mon_speciesId].abilities[2] != ABILITY_NONE) abilityCount++; #endif if (gMain.newKeys & DPAD_ANY) From 20ca83bb2001f6ef0188392b0c5b557479a8fba1 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sun, 20 Jun 2021 15:48:44 +0200 Subject: [PATCH 19/37] Added menu to run custom scripts easily, credit: @Jaizu --- data/scripts/debug.inc | 24 +++++++ src/debug.c | 146 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index 9d46ea5fff..70401564e9 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -58,3 +58,27 @@ Debug_CheatStart:: closemessage release end + +Debug_Script_1:: + end + +Debug_Script_2:: + end + +Debug_Script_3:: + end + +Debug_Script_4:: + end + +Debug_Script_5:: + end + +Debug_Script_6:: + end + +Debug_Script_7:: + end + +Debug_Script_8:: + end diff --git a/src/debug.c b/src/debug.c index c6bc23fb34..2de9d8f904 100644 --- a/src/debug.c +++ b/src/debug.c @@ -6,6 +6,7 @@ //Pyredrid: https://github.com/Pyredrid/pokeemerald/tree/debugmenu //AsparagusEduardo: https://github.com/AsparagusEduardo/pokeemerald/tree/InfusedEmerald_v2 //Ghoulslash: https://github.com/ghoulslash/pokeemerald +//Jaizu: https://hastebin.com/raw/rikegejore #include "global.h" #include "battle.h" #include "coins.h" @@ -55,6 +56,7 @@ // Enums enum { // Main DEBUG_MENU_ITEM_UTILITIES, + DEBUG_MENU_ITEM_SCRIPTS, DEBUG_MENU_ITEM_FLAGS, DEBUG_MENU_ITEM_VARS, DEBUG_MENU_ITEM_GIVE, @@ -75,6 +77,16 @@ enum { // Util DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, DEBUG_UTIL_MENU_ITEM_TRAINER_ID, }; +enum { + DEBUG_UTIL_MENU_ITEM_SCRIPT_1, + DEBUG_UTIL_MENU_ITEM_SCRIPT_2, + DEBUG_UTIL_MENU_ITEM_SCRIPT_3, + DEBUG_UTIL_MENU_ITEM_SCRIPT_4, + DEBUG_UTIL_MENU_ITEM_SCRIPT_5, + DEBUG_UTIL_MENU_ITEM_SCRIPT_6, + DEBUG_UTIL_MENU_ITEM_SCRIPT_7, + DEBUG_UTIL_MENU_ITEM_SCRIPT_8, +}; enum { // Flags DEBUG_FLAG_MENU_ITEM_FLAGS, DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS, @@ -156,12 +168,23 @@ static void Debug_DestroyMenu(u8); static void DebugAction_Cancel(u8); static void DebugAction_DestroyExtraWindow(u8 taskId); +static void DebugAction_Util_Script_1(u8); +static void DebugAction_Util_Script_2(u8); +static void DebugAction_Util_Script_3(u8); +static void DebugAction_Util_Script_4(u8); +static void DebugAction_Util_Script_5(u8); +static void DebugAction_Util_Script_6(u8); +static void DebugAction_Util_Script_7(u8); +static void DebugAction_Util_Script_8(u8); + static void DebugAction_OpenUtilitiesMenu(u8); +static void DebugAction_OpenScriptsMenu(u8); static void DebugAction_OpenFlagsMenu(u8); static void DebugAction_OpenVariablesMenu(u8); static void DebugAction_OpenGiveMenu(u8); static void DebugTask_HandleMenuInput_Main(u8); static void DebugTask_HandleMenuInput_Utilities(u8); +static void DebugTask_HandleMenuInput_Scripts(u8); static void DebugTask_HandleMenuInput_Flags(u8); static void DebugTask_HandleMenuInput_Vars(u8); static void DebugTask_HandleMenuInput_Give(u8); @@ -226,6 +249,15 @@ static void DebugAction_AccessPC(u8 taskId); static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)); static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate); +extern u8 Debug_Script_1[]; +extern u8 Debug_Script_2[]; +extern u8 Debug_Script_3[]; +extern u8 Debug_Script_4[]; +extern u8 Debug_Script_5[]; +extern u8 Debug_Script_6[]; +extern u8 Debug_Script_7[]; +extern u8 Debug_Script_8[]; + extern u8 Debug_ShowFieldMessageStringVar4[]; extern u8 Debug_CheatStart[]; extern u8 PlayersHouse_2F_EventScript_SetWallClock[]; @@ -241,10 +273,20 @@ extern const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1]; // Text // Main Menu static const u8 gDebugText_Utilities[] = _("Utilities"); +static const u8 gDebugText_Scripts[] = _("Scripts"); static const u8 gDebugText_Flags[] = _("Flags"); static const u8 gDebugText_Vars[] = _("Variables"); static const u8 gDebugText_Give[] = _("Give X"); static const u8 gDebugText_Cancel[] = _("Cancel"); +// Script menu +static const u8 gDebugText_Util_Script_1[] = _("Script 1"); +static const u8 gDebugText_Util_Script_2[] = _("Script 2"); +static const u8 gDebugText_Util_Script_3[] = _("Script 3"); +static const u8 gDebugText_Util_Script_4[] = _("Script 4"); +static const u8 gDebugText_Util_Script_5[] = _("Script 5"); +static const u8 gDebugText_Util_Script_6[] = _("Script 6"); +static const u8 gDebugText_Util_Script_7[] = _("Script 7"); +static const u8 gDebugText_Util_Script_8[] = _("Script 8"); // Util Menu static const u8 gDebugText_Util_HealParty[] = _("Heal Party"); static const u8 gDebugText_Util_Fly[] = _("Fly to map"); @@ -353,6 +395,7 @@ static const s32 sPowersOfTen[] = static const struct ListMenuItem sDebugMenu_Items_Main[] = { [DEBUG_MENU_ITEM_UTILITIES] = {gDebugText_Utilities, DEBUG_MENU_ITEM_UTILITIES}, + [DEBUG_MENU_ITEM_SCRIPTS] = {gDebugText_Scripts, DEBUG_MENU_ITEM_SCRIPTS}, [DEBUG_MENU_ITEM_FLAGS] = {gDebugText_Flags, DEBUG_MENU_ITEM_FLAGS}, [DEBUG_MENU_ITEM_VARS] = {gDebugText_Vars, DEBUG_MENU_ITEM_VARS}, [DEBUG_MENU_ITEM_GIVE] = {gDebugText_Give, DEBUG_MENU_ITEM_GIVE}, @@ -374,6 +417,17 @@ static const struct ListMenuItem sDebugMenu_Items_Utilities[] = [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = {gDebugText_Util_Trainer_Gender, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER}, [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = {gDebugText_Util_Trainer_Id, DEBUG_UTIL_MENU_ITEM_TRAINER_ID}, }; +static const struct ListMenuItem sDebugMenu_Items_Scripts[] = +{ + [DEBUG_UTIL_MENU_ITEM_SCRIPT_1] = {gDebugText_Util_Script_1, DEBUG_UTIL_MENU_ITEM_SCRIPT_1}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_2] = {gDebugText_Util_Script_2, DEBUG_UTIL_MENU_ITEM_SCRIPT_2}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_3] = {gDebugText_Util_Script_3, DEBUG_UTIL_MENU_ITEM_SCRIPT_3}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_4] = {gDebugText_Util_Script_4, DEBUG_UTIL_MENU_ITEM_SCRIPT_4}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_5] = {gDebugText_Util_Script_5, DEBUG_UTIL_MENU_ITEM_SCRIPT_5}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_6] = {gDebugText_Util_Script_6, DEBUG_UTIL_MENU_ITEM_SCRIPT_6}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_7] = {gDebugText_Util_Script_7, DEBUG_UTIL_MENU_ITEM_SCRIPT_7}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_8] = {gDebugText_Util_Script_8, DEBUG_UTIL_MENU_ITEM_SCRIPT_8}, +}; static const struct ListMenuItem sDebugMenu_Items_Flags[] = { [DEBUG_FLAG_MENU_ITEM_FLAGS] = {gDebugText_Flags_Flags, DEBUG_FLAG_MENU_ITEM_FLAGS}, @@ -412,6 +466,7 @@ static const struct ListMenuItem sDebugMenu_Items_Give[] = static void (*const sDebugMenu_Actions_Main[])(u8) = { [DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu, + [DEBUG_MENU_ITEM_SCRIPTS] = DebugAction_OpenScriptsMenu, [DEBUG_MENU_ITEM_FLAGS] = DebugAction_OpenFlagsMenu, [DEBUG_MENU_ITEM_VARS] = DebugAction_OpenVariablesMenu, [DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu, @@ -433,6 +488,17 @@ static void (*const sDebugMenu_Actions_Utilities[])(u8) = [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = DebugAction_Util_Trainer_Gender, [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = DebugAction_Util_Trainer_Id, }; +static void (*const sDebugMenu_Actions_Scripts[])(u8) = +{ + [DEBUG_UTIL_MENU_ITEM_SCRIPT_1] = DebugAction_Util_Script_1, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_2] = DebugAction_Util_Script_2, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_3] = DebugAction_Util_Script_3, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_4] = DebugAction_Util_Script_4, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_5] = DebugAction_Util_Script_5, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_6] = DebugAction_Util_Script_6, + [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_FLAG_MENU_ITEM_FLAGS] = DebugAction_Flags_Flags, @@ -504,6 +570,12 @@ static const struct ListMenuTemplate sDebugMenu_ListTemplate_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_Flags = { .items = sDebugMenu_Items_Flags, @@ -632,6 +704,24 @@ static void DebugTask_HandleMenuInput_Utilities(u8 taskId) Debug_ShowMainMenu(); } } +static void DebugTask_HandleMenuInput_Scripts(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Scripts[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} static void DebugTask_HandleMenuInput_Flags(u8 taskId) { void (*func)(u8); @@ -694,6 +784,11 @@ 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_OpenFlagsMenu(u8 taskId) { Debug_DestroyMenu(taskId); @@ -1020,6 +1115,57 @@ static void DebugAction_Util_Trainer_Id(u8 taskId) EnableBothScriptContexts(); } +// ******************************* +// Actions Scripts +static void DebugAction_Util_Script_1(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_Script_1); +} +static void DebugAction_Util_Script_2(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_Script_2); +} +static void DebugAction_Util_Script_3(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_Script_3); +} +static void DebugAction_Util_Script_4(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_Script_4); +} +static void DebugAction_Util_Script_5(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_Script_5); +} +static void DebugAction_Util_Script_6(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_Script_6); +} +static void DebugAction_Util_Script_7(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_Script_7); +} +static void DebugAction_Util_Script_8(u8 taskId) +{ + Debug_DestroyMenu(taskId); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Debug_Script_8); +} + // ******************************* // Actions Flags static void DebugAction_Flags_Flags(u8 taskId) From 9708ee074427de0160084c6d8ca7eabca501fc69 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sun, 20 Jun 2021 16:57:34 +0200 Subject: [PATCH 20/37] fixed credit link --- src/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index 2de9d8f904..abd3c4d455 100644 --- a/src/debug.c +++ b/src/debug.c @@ -6,7 +6,7 @@ //Pyredrid: https://github.com/Pyredrid/pokeemerald/tree/debugmenu //AsparagusEduardo: https://github.com/AsparagusEduardo/pokeemerald/tree/InfusedEmerald_v2 //Ghoulslash: https://github.com/ghoulslash/pokeemerald -//Jaizu: https://hastebin.com/raw/rikegejore +//Jaizu: https://jaizu.moe/ #include "global.h" #include "battle.h" #include "coins.h" From defd7d9e07a22ee1cc1fb69216aaf4c886dd1267 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Tue, 22 Jun 2021 12:38:00 +0200 Subject: [PATCH 21/37] Added Sound menu for SE and MUS --- include/constants/songs.h | 3 + src/debug.c | 214 +++++++++++++++++++++++++++++++++++++- 2 files changed, 216 insertions(+), 1 deletion(-) diff --git a/include/constants/songs.h b/include/constants/songs.h index a78ee6fafe..8067557449 100644 --- a/include/constants/songs.h +++ b/include/constants/songs.h @@ -276,8 +276,10 @@ #define SE_PIKE_CURTAIN_CLOSE 267 // SE_CURTAIN #define SE_PIKE_CURTAIN_OPEN 268 // SE_CURTAIN1 #define SE_SUDOWOODO_SHAKE 269 // SE_USSOKI +#define END_SE SE_SUDOWOODO_SHAKE // Music +#define START_MUS 350 #define MUS_LITTLEROOT_TEST 350 // MUS_TETSUJI #define MUS_GSC_ROUTE38 351 // MUS_FIELD13 #define MUS_CAUGHT 352 // MUS_KACHI22 @@ -488,6 +490,7 @@ #define MUS_RG_TRAINER_TOWER 556 // MUS_RG_T_TOWER #define MUS_RG_SLOW_PALLET 557 // MUS_RG_SLOWMASARA #define MUS_RG_TEACHY_TV_MENU 558 // MUS_RG_TVNOIZE +#define END_MUS MUS_RG_TEACHY_TV_MENU #define PH_TRAP_BLEND 559 #define PH_TRAP_HELD 560 diff --git a/src/debug.c b/src/debug.c index abd3c4d455..0bd9c7cbbd 100644 --- a/src/debug.c +++ b/src/debug.c @@ -60,6 +60,7 @@ enum { // Main DEBUG_MENU_ITEM_FLAGS, DEBUG_MENU_ITEM_VARS, DEBUG_MENU_ITEM_GIVE, + DEBUG_MENU_ITEM_SOUND, DEBUG_MENU_ITEM_CANCEL }; enum { // Util @@ -77,7 +78,7 @@ enum { // Util DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, DEBUG_UTIL_MENU_ITEM_TRAINER_ID, }; -enum { +enum { // Scripts DEBUG_UTIL_MENU_ITEM_SCRIPT_1, DEBUG_UTIL_MENU_ITEM_SCRIPT_2, DEBUG_UTIL_MENU_ITEM_SCRIPT_3, @@ -116,6 +117,10 @@ enum { // Give DEBUG_GIVE_MENU_ITEM_CHEAT, //DEBUG_MENU_ITEM_ACCESS_PC, }; +enum { //Sound + DEBUG_SOUND_MENU_ITEM_SE, + DEBUG_SOUND_MENU_ITEM_MUS, +}; // ******************************* @@ -182,12 +187,14 @@ static void DebugAction_OpenScriptsMenu(u8); static void DebugAction_OpenFlagsMenu(u8); static void DebugAction_OpenVariablesMenu(u8); static void DebugAction_OpenGiveMenu(u8); +static void DebugAction_OpenSoundMenu(u8); static void DebugTask_HandleMenuInput_Main(u8); static void DebugTask_HandleMenuInput_Utilities(u8); static void DebugTask_HandleMenuInput_Scripts(u8); static void DebugTask_HandleMenuInput_Flags(u8); static void DebugTask_HandleMenuInput_Vars(u8); static void DebugTask_HandleMenuInput_Give(u8); +static void DebugTask_HandleMenuInput_Sound(u8); static void DebugAction_Util_HealParty(u8 taskId); static void DebugAction_Util_Fly(u8 taskId); @@ -246,6 +253,11 @@ static void DebugAction_Give_FillPC(u8 taskId); static void DebugAction_Give_CHEAT(u8 taskId); static void DebugAction_AccessPC(u8 taskId); +static void DebugAction_Sound_SE(u8 taskId); +static void DebugAction_Sound_SE_SelectId(u8 taskId); +static void DebugAction_Sound_MUS(u8 taskId); +static void DebugAction_Sound_MUS_SelectId(u8 taskId); + static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)); static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate); @@ -277,6 +289,7 @@ static const u8 gDebugText_Scripts[] = _("Scripts"); static const u8 gDebugText_Flags[] = _("Flags"); static const u8 gDebugText_Vars[] = _("Variables"); static const u8 gDebugText_Give[] = _("Give X"); +static const u8 gDebugText_Sound[] = _("Sound"); static const u8 gDebugText_Cancel[] = _("Cancel"); // Script menu static const u8 gDebugText_Util_Script_1[] = _("Script 1"); @@ -356,6 +369,12 @@ static const u8 gDebugText_Give_DaycareEgg[] = _("Daycare Egg"); static const u8 gDebugText_Give_FillPc[] = _("Fill Pc"); static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT Start"); // static const u8 gDebugText_Give_AccessPC[] = _("Access PC"); +// Sound Mneu +static const u8 gDebugText_Sound_SE[] = _("Effects"); +static const u8 gDebugText_Sound_SE_ID[] = _("Sound Id: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_Sound_MUS[] = _("Music"); +static const u8 gDebugText_Sound_MUS_ID[] = _("Music Id: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_Sound_Empty[] = _(""); static const u8 digitInidicator_1[] = _("{LEFT_ARROW}+1{RIGHT_ARROW} "); static const u8 digitInidicator_10[] = _("{LEFT_ARROW}+10{RIGHT_ARROW} "); @@ -399,6 +418,7 @@ static const struct ListMenuItem sDebugMenu_Items_Main[] = [DEBUG_MENU_ITEM_FLAGS] = {gDebugText_Flags, DEBUG_MENU_ITEM_FLAGS}, [DEBUG_MENU_ITEM_VARS] = {gDebugText_Vars, DEBUG_MENU_ITEM_VARS}, [DEBUG_MENU_ITEM_GIVE] = {gDebugText_Give, DEBUG_MENU_ITEM_GIVE}, + [DEBUG_MENU_ITEM_SOUND] = {gDebugText_Sound, DEBUG_MENU_ITEM_SOUND}, [DEBUG_MENU_ITEM_CANCEL] = {gDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL} }; static const struct ListMenuItem sDebugMenu_Items_Utilities[] = @@ -460,6 +480,11 @@ static const struct ListMenuItem sDebugMenu_Items_Give[] = [DEBUG_GIVE_MENU_ITEM_CHEAT] = {gDebugText_Give_GiveCHEAT, DEBUG_GIVE_MENU_ITEM_CHEAT}, //[DEBUG_MENU_ITEM_ACCESS_PC] = {gDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, }; +static const struct ListMenuItem sDebugMenu_Items_Sound[] = +{ + [DEBUG_SOUND_MENU_ITEM_SE] = {gDebugText_Sound_SE, DEBUG_SOUND_MENU_ITEM_SE}, + [DEBUG_SOUND_MENU_ITEM_MUS] = {gDebugText_Sound_MUS, DEBUG_SOUND_MENU_ITEM_MUS}, +}; // ******************************* // Menu Actions @@ -470,6 +495,7 @@ static void (*const sDebugMenu_Actions_Main[])(u8) = [DEBUG_MENU_ITEM_FLAGS] = DebugAction_OpenFlagsMenu, [DEBUG_MENU_ITEM_VARS] = DebugAction_OpenVariablesMenu, [DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu, + [DEBUG_MENU_ITEM_SOUND] = DebugAction_OpenSoundMenu, [DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel }; static void (*const sDebugMenu_Actions_Utilities[])(u8) = @@ -531,6 +557,11 @@ static void (*const sDebugMenu_Actions_Give[])(u8) = [DEBUG_GIVE_MENU_ITEM_CHEAT] = DebugAction_Give_CHEAT, //[DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, }; +static void (*const sDebugMenu_Actions_Sound[])(u8) = +{ + [DEBUG_SOUND_MENU_ITEM_SE] = DebugAction_Sound_SE, + [DEBUG_SOUND_MENU_ITEM_MUS] = DebugAction_Sound_MUS, +}; // ******************************* @@ -594,6 +625,12 @@ static const struct ListMenuTemplate sDebugMenu_ListTemplate_Give = .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Give), }; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Sound = +{ + .items = sDebugMenu_Items_Sound, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Sound), +}; // ******************************* @@ -776,6 +813,24 @@ static void DebugTask_HandleMenuInput_Give(u8 taskId) Debug_ShowMainMenu(); } } +static void DebugTask_HandleMenuInput_Sound(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_Sound[input]) != NULL) + func(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ShowMainMenu(); + } +} // ******************************* // Open sub-menus @@ -804,6 +859,11 @@ static void DebugAction_OpenGiveMenu(u8 taskId) Debug_DestroyMenu(taskId); Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give); } +static void DebugAction_OpenSoundMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Sound, sDebugMenu_ListTemplate_Sound); +} // ******************************* @@ -2619,8 +2679,160 @@ static void DebugAction_Give_CHEAT(u8 taskId) // } +// ******************************* +// Sound Scripts +static void DebugAction_Sound_SE(u8 taskId) +{ + u8 windowId; + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + StringCopy(gStringVar2, gText_DigitIndicator[0]); + ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringCopyPadded(gStringVar1, gDebugText_Sound_Empty, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_Sound_SE_ID); + AddTextPrinterParameterized(windowId, 1, 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 +} +static void DebugAction_Sound_SE_SelectId(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > END_SE) + gTasks[taskId].data[3] = END_SE; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < 1) + gTasks[taskId].data[3] = 1; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopyPadded(gStringVar1, gDebugText_Sound_Empty, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringExpandPlaceholders(gStringVar4, gDebugText_Sound_SE_ID); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(gTasks[taskId].data[3]); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + MapMusicMain(); + DebugAction_DestroyExtraWindow(taskId); + } +} + +static void DebugAction_Sound_MUS(u8 taskId) +{ + u8 windowId; + + ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); + RemoveWindow(gTasks[taskId].data[1]); + + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + DrawStdWindowFrame(windowId, FALSE); + + CopyWindowToVram(windowId, 3); + + //Display initial ID + StringCopy(gStringVar2, gText_DigitIndicator[0]); + ConvertIntToDecimalStringN(gStringVar3, START_MUS, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringCopyPadded(gStringVar1, gDebugText_Sound_Empty, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar4, gDebugText_Sound_MUS_ID); + AddTextPrinterParameterized(windowId, 1, 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 +} +static void DebugAction_Sound_MUS_SelectId(u8 taskId) +{ + if (gMain.newKeys & DPAD_ANY) + { + PlaySE(SE_SELECT); + + if(gMain.newKeys & DPAD_UP) + { + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] > END_MUS) + gTasks[taskId].data[3] = END_MUS; + } + if(gMain.newKeys & DPAD_DOWN) + { + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if(gTasks[taskId].data[3] < START_MUS) + gTasks[taskId].data[3] = START_MUS; + } + if(gMain.newKeys & DPAD_LEFT) + { + if(gTasks[taskId].data[4] > 0) + gTasks[taskId].data[4] -= 1; + } + if(gMain.newKeys & DPAD_RIGHT) + { + if(gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1) + gTasks[taskId].data[4] += 1; + } + + StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringCopyPadded(gStringVar1, gDebugText_Sound_Empty, CHAR_SPACE, 15); + ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); + StringExpandPlaceholders(gStringVar4, gDebugText_Sound_MUS_ID); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } + + if (gMain.newKeys & A_BUTTON) + { + StopMapMusic(); + PlayNewMapMusic(gTasks[taskId].data[3]); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + MapMusicMain(); + DebugAction_DestroyExtraWindow(taskId); + } +} // Additional functions /* From 81d7986d34992e8f26166e14da7da69c7e2f03ee Mon Sep 17 00:00:00 2001 From: TheXaman Date: Tue, 22 Jun 2021 15:57:02 +0200 Subject: [PATCH 22/37] added SE and MUS names --- src/debug.c | 776 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 768 insertions(+), 8 deletions(-) diff --git a/src/debug.c b/src/debug.c index 0bd9c7cbbd..49bef794f7 100644 --- a/src/debug.c +++ b/src/debug.c @@ -130,6 +130,8 @@ enum { //Sound #define DEBUG_NUMBER_DISPLAY_WIDTH 10 #define DEBUG_NUMBER_DISPLAY_HEIGHT 4 +#define DEBUG_NUMBER_DISPLAY_SOUND_WIDTH 20 +#define DEBUG_NUMBER_DISPLAY_SOUND_HEIGHT 6 #define DEBUG_NUMBER_DIGITS_FLAGS 4 #define DEBUG_NUMBER_DIGITS_VARIABLES 5 @@ -371,9 +373,9 @@ static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT Start"); // static const u8 gDebugText_Give_AccessPC[] = _("Access PC"); // Sound Mneu static const u8 gDebugText_Sound_SE[] = _("Effects"); -static const u8 gDebugText_Sound_SE_ID[] = _("Sound Id: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_Sound_SE_ID[] = _("Sound Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); static const u8 gDebugText_Sound_MUS[] = _("Music"); -static const u8 gDebugText_Sound_MUS_ID[] = _("Music Id: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); +static const u8 gDebugText_Sound_MUS_ID[] = _("Music Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); static const u8 gDebugText_Sound_Empty[] = _(""); static const u8 digitInidicator_1[] = _("{LEFT_ARROW}+1{RIGHT_ARROW} "); @@ -586,6 +588,16 @@ static const struct WindowTemplate sDebugNumberDisplayWindowTemplate = .paletteNum = 15, .baseBlock = 1, }; +static const struct WindowTemplate sDebugNumberDisplayLargeWindowTemplate = +{ + .bg = 0, + .tilemapLeft = 30 - DEBUG_NUMBER_DISPLAY_SOUND_WIDTH -1, + .tilemapTop = 1, + .width = DEBUG_NUMBER_DISPLAY_SOUND_WIDTH, + .height = DEBUG_NUMBER_DISPLAY_SOUND_HEIGHT, + .paletteNum = 15, + .baseBlock = 1, +}; // ******************************* // List Menu Templates @@ -2681,6 +2693,8 @@ static void DebugAction_Give_CHEAT(u8 taskId) // ******************************* // Sound Scripts +static const u8 *const gBGMNames[]; +static const u8 *const gSENames[]; static void DebugAction_Sound_SE(u8 taskId) { u8 windowId; @@ -2690,7 +2704,7 @@ static void DebugAction_Sound_SE(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + windowId = AddWindow(&sDebugNumberDisplayLargeWindowTemplate); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -2698,7 +2712,7 @@ static void DebugAction_Sound_SE(u8 taskId) //Display initial ID StringCopy(gStringVar2, gText_DigitIndicator[0]); ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); - StringCopyPadded(gStringVar1, gDebugText_Sound_Empty, CHAR_SPACE, 15); + StringCopyPadded(gStringVar1, gSENames[0], CHAR_SPACE, 35); StringExpandPlaceholders(gStringVar4, gDebugText_Sound_SE_ID); AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); @@ -2739,7 +2753,7 @@ static void DebugAction_Sound_SE_SelectId(u8 taskId) } StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopyPadded(gStringVar1, gDebugText_Sound_Empty, CHAR_SPACE, 15); + StringCopyPadded(gStringVar1, gSENames[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, gDebugText_Sound_SE_ID); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); @@ -2766,7 +2780,7 @@ static void DebugAction_Sound_MUS(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + windowId = AddWindow(&sDebugNumberDisplayLargeWindowTemplate); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -2774,7 +2788,7 @@ static void DebugAction_Sound_MUS(u8 taskId) //Display initial ID StringCopy(gStringVar2, gText_DigitIndicator[0]); ConvertIntToDecimalStringN(gStringVar3, START_MUS, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); - StringCopyPadded(gStringVar1, gDebugText_Sound_Empty, CHAR_SPACE, 15); + StringCopyPadded(gStringVar1, gBGMNames[0], CHAR_SPACE, 35); StringExpandPlaceholders(gStringVar4, gDebugText_Sound_MUS_ID); AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); @@ -2815,7 +2829,7 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId) } StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopyPadded(gStringVar1, gDebugText_Sound_Empty, CHAR_SPACE, 15); + StringCopyPadded(gStringVar1, gBGMNames[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, gDebugText_Sound_MUS_ID); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); @@ -2834,6 +2848,752 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId) } } +#define SOUND_LIST_BGM \ + X(MUS_LITTLEROOT_TEST, "MUS-LITTLEROOT-TEST") \ + X(MUS_GSC_ROUTE38, "MUS-GSC-ROUTE38") \ + X(MUS_CAUGHT, "MUS-CAUGHT") \ + X(MUS_VICTORY_WILD, "MUS-VICTORY-WILD") \ + X(MUS_VICTORY_GYM_LEADER, "MUS-VICTORY-GYM-LEADER") \ + X(MUS_VICTORY_LEAGUE, "MUS-VICTORY-LEAGUE") \ + X(MUS_C_COMM_CENTER, "MUS-C-COMM-CENTER") \ + X(MUS_GSC_PEWTER, "MUS-GSC-PEWTER") \ + X(MUS_C_VS_LEGEND_BEAST, "MUS-C-VS-LEGEND-BEAST") \ + X(MUS_ROUTE101, "MUS-ROUTE101") \ + X(MUS_ROUTE110, "MUS-ROUTE110") \ + X(MUS_ROUTE120, "MUS-ROUTE120") \ + X(MUS_PETALBURG, "MUS-PETALBURG") \ + X(MUS_OLDALE, "MUS-OLDALE") \ + X(MUS_GYM, "MUS-GYM") \ + X(MUS_SURF, "MUS-SURF") \ + X(MUS_PETALBURG_WOODS, "MUS-PETALBURG-WOODS") \ + X(MUS_LEVEL_UP, "MUS-LEVEL-UP") \ + X(MUS_HEAL, "MUS-HEAL") \ + X(MUS_OBTAIN_BADGE, "MUS-OBTAIN-BADGE") \ + X(MUS_OBTAIN_ITEM, "MUS-OBTAIN-ITEM") \ + X(MUS_EVOLVED, "MUS-EVOLVED") \ + X(MUS_OBTAIN_TMHM, "MUS-OBTAIN-TMHM") \ + X(MUS_LILYCOVE_MUSEUM, "MUS-LILYCOVE-MUSEUM") \ + X(MUS_ROUTE122, "MUS-ROUTE122") \ + X(MUS_OCEANIC_MUSEUM, "MUS-OCEANIC-MUSEUM") \ + X(MUS_EVOLUTION_INTRO, "MUS-EVOLUTION-INTRO") \ + X(MUS_EVOLUTION, "MUS-EVOLUTION") \ + X(MUS_MOVE_DELETED, "MUS-MOVE-DELETED") \ + X(MUS_ENCOUNTER_GIRL, "MUS-ENCOUNTER-GIRL") \ + X(MUS_ENCOUNTER_MALE, "MUS-ENCOUNTER-MALE") \ + X(MUS_ABANDONED_SHIP, "MUS-ABANDONED-SHIP") \ + X(MUS_FORTREE, "MUS-FORTREE") \ + X(MUS_BIRCH_LAB, "MUS-BIRCH-LAB") \ + X(MUS_B_TOWER_RS, "MUS-B-TOWER-RS") \ + X(MUS_ENCOUNTER_SWIMMER, "MUS-ENCOUNTER-SWIMMER") \ + X(MUS_CAVE_OF_ORIGIN, "MUS-CAVE-OF-ORIGIN") \ + X(MUS_OBTAIN_BERRY, "MUS-OBTAIN-BERRY") \ + X(MUS_AWAKEN_LEGEND, "MUS-AWAKEN-LEGEND") \ + X(MUS_SLOTS_JACKPOT, "MUS-SLOTS-JACKPOT") \ + X(MUS_SLOTS_WIN, "MUS-SLOTS-WIN") \ + X(MUS_TOO_BAD, "MUS-TOO-BAD") \ + X(MUS_ROULETTE, "MUS-ROULETTE") \ + X(MUS_LINK_CONTEST_P1, "MUS-LINK-CONTEST-P1") \ + X(MUS_LINK_CONTEST_P2, "MUS-LINK-CONTEST-P2") \ + X(MUS_LINK_CONTEST_P3, "MUS-LINK-CONTEST-P3") \ + X(MUS_LINK_CONTEST_P4, "MUS-LINK-CONTEST-P4") \ + X(MUS_ENCOUNTER_RICH, "MUS-ENCOUNTER-RICH") \ + X(MUS_VERDANTURF, "MUS-VERDANTURF") \ + X(MUS_RUSTBORO, "MUS-RUSTBORO") \ + X(MUS_POKE_CENTER, "MUS-POKE-CENTER") \ + X(MUS_ROUTE104, "MUS-ROUTE104") \ + X(MUS_ROUTE119, "MUS-ROUTE119") \ + X(MUS_CYCLING, "MUS-CYCLING") \ + X(MUS_POKE_MART, "MUS-POKE-MART") \ + X(MUS_LITTLEROOT, "MUS-LITTLEROOT") \ + X(MUS_MT_CHIMNEY, "MUS-MT-CHIMNEY") \ + X(MUS_ENCOUNTER_FEMALE, "MUS-ENCOUNTER-FEMALE") \ + X(MUS_LILYCOVE, "MUS-LILYCOVE") \ + X(MUS_ROUTE111, "MUS-ROUTE111") \ + X(MUS_HELP, "MUS-HELP") \ + X(MUS_UNDERWATER, "MUS-UNDERWATER") \ + X(MUS_VICTORY_TRAINER, "MUS-VICTORY-TRAINER") \ + X(MUS_TITLE, "MUS-TITLE") \ + X(MUS_INTRO, "MUS-INTRO") \ + X(MUS_ENCOUNTER_MAY, "MUS-ENCOUNTER-MAY") \ + X(MUS_ENCOUNTER_INTENSE, "MUS-ENCOUNTER-INTENSE") \ + X(MUS_ENCOUNTER_COOL, "MUS-ENCOUNTER-COOL") \ + X(MUS_ROUTE113, "MUS-ROUTE113") \ + X(MUS_ENCOUNTER_AQUA, "MUS-ENCOUNTER-AQUA") \ + X(MUS_FOLLOW_ME, "MUS-FOLLOW-ME") \ + X(MUS_ENCOUNTER_BRENDAN, "MUS-ENCOUNTER-BRENDAN") \ + X(MUS_EVER_GRANDE, "MUS-EVER-GRANDE") \ + X(MUS_ENCOUNTER_SUSPICIOUS, "MUS-ENCOUNTER-SUSPICIOUS") \ + X(MUS_VICTORY_AQUA_MAGMA, "MUS-VICTORY-AQUA-MAGMA") \ + X(MUS_CABLE_CAR, "MUS-CABLE-CAR") \ + X(MUS_GAME_CORNER, "MUS-GAME-CORNER") \ + X(MUS_DEWFORD, "MUS-DEWFORD") \ + X(MUS_SAFARI_ZONE, "MUS-SAFARI-ZONE") \ + X(MUS_VICTORY_ROAD, "MUS-VICTORY-ROAD") \ + X(MUS_AQUA_MAGMA_HIDEOUT, "MUS-AQUA-MAGMA-HIDEOUT") \ + X(MUS_SAILING, "MUS-SAILING") \ + X(MUS_MT_PYRE, "MUS-MT-PYRE") \ + X(MUS_SLATEPORT, "MUS-SLATEPORT") \ + X(MUS_MT_PYRE_EXTERIOR, "MUS-MT-PYRE-EXTERIOR") \ + X(MUS_SCHOOL, "MUS-SCHOOL") \ + X(MUS_HALL_OF_FAME, "MUS-HALL-OF-FAME") \ + X(MUS_FALLARBOR, "MUS-FALLARBOR") \ + X(MUS_SEALED_CHAMBER, "MUS-SEALED-CHAMBER") \ + X(MUS_CONTEST_WINNER, "MUS-CONTEST-WINNER") \ + X(MUS_CONTEST, "MUS-CONTEST") \ + X(MUS_ENCOUNTER_MAGMA, "MUS-ENCOUNTER-MAGMA") \ + X(MUS_INTRO_BATTLE, "MUS-INTRO-BATTLE") \ + X(MUS_WEATHER_KYOGRE, "MUS-WEATHER-KYOGRE") \ + X(MUS_WEATHER_GROUDON, "MUS-WEATHER-GROUDON") \ + X(MUS_SOOTOPOLIS, "MUS-SOOTOPOLIS") \ + X(MUS_CONTEST_RESULTS, "MUS-CONTEST-RESULTS") \ + X(MUS_HALL_OF_FAME_ROOM, "MUS-HALL-OF-FAME-ROOM") \ + X(MUS_TRICK_HOUSE, "MUS-TRICK-HOUSE") \ + X(MUS_ENCOUNTER_TWINS, "MUS-ENCOUNTER-TWINS") \ + X(MUS_ENCOUNTER_ELITE_FOUR, "MUS-ENCOUNTER-ELITE-FOUR") \ + X(MUS_ENCOUNTER_HIKER, "MUS-ENCOUNTER-HIKER") \ + X(MUS_CONTEST_LOBBY, "MUS-CONTEST-LOBBY") \ + X(MUS_ENCOUNTER_INTERVIEWER, "MUS-ENCOUNTER-INTERVIEWER") \ + X(MUS_ENCOUNTER_CHAMPION, "MUS-ENCOUNTER-CHAMPION") \ + X(MUS_CREDITS, "MUS-CREDITS") \ + X(MUS_END, "MUS-END") \ + X(MUS_B_FRONTIER, "MUS-B-FRONTIER") \ + X(MUS_B_ARENA, "MUS-B-ARENA") \ + X(MUS_OBTAIN_B_POINTS, "MUS-OBTAIN-B-POINTS") \ + X(MUS_REGISTER_MATCH_CALL, "MUS-REGISTER-MATCH-CALL") \ + X(MUS_B_PYRAMID, "MUS-B-PYRAMID") \ + X(MUS_B_PYRAMID_TOP, "MUS-B-PYRAMID-TOP") \ + X(MUS_B_PALACE, "MUS-B-PALACE") \ + X(MUS_RAYQUAZA_APPEARS, "MUS-RAYQUAZA-APPEARS") \ + X(MUS_B_TOWER, "MUS-B-TOWER") \ + X(MUS_OBTAIN_SYMBOL, "MUS-OBTAIN-SYMBOL") \ + X(MUS_B_DOME, "MUS-B-DOME") \ + X(MUS_B_PIKE, "MUS-B-PIKE") \ + X(MUS_B_FACTORY, "MUS-B-FACTORY") \ + X(MUS_VS_RAYQUAZA, "MUS-VS-RAYQUAZA") \ + X(MUS_VS_FRONTIER_BRAIN, "MUS-VS-FRONTIER-BRAIN") \ + X(MUS_VS_MEW, "MUS-VS-MEW") \ + X(MUS_B_DOME_LOBBY, "MUS-B-DOME-LOBBY") \ + X(MUS_VS_WILD, "MUS-VS-WILD") \ + X(MUS_VS_AQUA_MAGMA, "MUS-VS-AQUA-MAGMA") \ + X(MUS_VS_TRAINER, "MUS-VS-TRAINER") \ + X(MUS_VS_GYM_LEADER, "MUS-VS-GYM-LEADER") \ + X(MUS_VS_CHAMPION, "MUS-VS-CHAMPION") \ + X(MUS_VS_REGI, "MUS-VS-REGI") \ + X(MUS_VS_KYOGRE_GROUDON, "MUS-VS-KYOGRE-GROUDON") \ + X(MUS_VS_RIVAL, "MUS-VS-RIVAL") \ + X(MUS_VS_ELITE_FOUR, "MUS-VS-ELITE-FOUR") \ + X(MUS_VS_AQUA_MAGMA_LEADER, "MUS-VS-AQUA-MAGMA-LEADER") \ + X(MUS_RG_FOLLOW_ME, "MUS-RG-FOLLOW-ME") \ + X(MUS_RG_GAME_CORNER, "MUS-RG-GAME-CORNER") \ + X(MUS_RG_ROCKET_HIDEOUT, "MUS-RG-ROCKET-HIDEOUT") \ + X(MUS_RG_GYM, "MUS-RG-GYM") \ + X(MUS_RG_JIGGLYPUFF, "MUS-RG-JIGGLYPUFF") \ + X(MUS_RG_INTRO_FIGHT, "MUS-RG-INTRO-FIGHT") \ + X(MUS_RG_TITLE, "MUS-RG-TITLE") \ + X(MUS_RG_CINNABAR, "MUS-RG-CINNABAR") \ + X(MUS_RG_LAVENDER, "MUS-RG-LAVENDER") \ + X(MUS_RG_HEAL, "MUS-RG-HEAL") \ + X(MUS_RG_CYCLING, "MUS-RG-CYCLING") \ + X(MUS_RG_ENCOUNTER_ROCKET, "MUS-RG-ENCOUNTER-ROCKET") \ + X(MUS_RG_ENCOUNTER_GIRL, "MUS-RG-ENCOUNTER-GIRL") \ + X(MUS_RG_ENCOUNTER_BOY, "MUS-RG-ENCOUNTER-BOY") \ + X(MUS_RG_HALL_OF_FAME, "MUS-RG-HALL-OF-FAME") \ + X(MUS_RG_VIRIDIAN_FOREST, "MUS-RG-VIRIDIAN-FOREST") \ + X(MUS_RG_MT_MOON, "MUS-RG-MT-MOON") \ + X(MUS_RG_POKE_MANSION, "MUS-RG-POKE-MANSION") \ + X(MUS_RG_CREDITS, "MUS-RG-CREDITS") \ + X(MUS_RG_ROUTE1, "MUS-RG-ROUTE1") \ + X(MUS_RG_ROUTE24, "MUS-RG-ROUTE24") \ + X(MUS_RG_ROUTE3, "MUS-RG-ROUTE3") \ + X(MUS_RG_ROUTE11, "MUS-RG-ROUTE11") \ + X(MUS_RG_VICTORY_ROAD, "MUS-RG-VICTORY-ROAD") \ + X(MUS_RG_VS_GYM_LEADER, "MUS-RG-VS-GYM-LEADER") \ + X(MUS_RG_VS_TRAINER, "MUS-RG-VS-TRAINER") \ + X(MUS_RG_VS_WILD, "MUS-RG-VS-WILD") \ + X(MUS_RG_VS_CHAMPION, "MUS-RG-VS-CHAMPION") \ + X(MUS_RG_PALLET, "MUS-RG-PALLET") \ + X(MUS_RG_OAK_LAB, "MUS-RG-OAK-LAB") \ + X(MUS_RG_OAK, "MUS-RG-OAK") \ + X(MUS_RG_POKE_CENTER, "MUS-RG-POKE-CENTER") \ + X(MUS_RG_SS_ANNE, "MUS-RG-SS-ANNE") \ + X(MUS_RG_SURF, "MUS-RG-SURF") \ + X(MUS_RG_POKE_TOWER, "MUS-RG-POKE-TOWER") \ + X(MUS_RG_SILPH, "MUS-RG-SILPH") \ + X(MUS_RG_FUCHSIA, "MUS-RG-FUCHSIA") \ + X(MUS_RG_CELADON, "MUS-RG-CELADON") \ + X(MUS_RG_VICTORY_TRAINER, "MUS-RG-VICTORY-TRAINER") \ + X(MUS_RG_VICTORY_WILD, "MUS-RG-VICTORY-WILD") \ + X(MUS_RG_VICTORY_GYM_LEADER, "MUS-RG-VICTORY-GYM-LEADER") \ + X(MUS_RG_VERMILLION, "MUS-RG-VERMILLION") \ + X(MUS_RG_PEWTER, "MUS-RG-PEWTER") \ + X(MUS_RG_ENCOUNTER_RIVAL, "MUS-RG-ENCOUNTER-RIVAL") \ + X(MUS_RG_RIVAL_EXIT, "MUS-RG-RIVAL-EXIT") \ + X(MUS_RG_DEX_RATING, "MUS-RG-DEX-RATING") \ + X(MUS_RG_OBTAIN_KEY_ITEM, "MUS-RG-OBTAIN-KEY-ITEM") \ + X(MUS_RG_CAUGHT_INTRO, "MUS-RG-CAUGHT-INTRO") \ + X(MUS_RG_PHOTO, "MUS-RG-PHOTO") \ + X(MUS_RG_GAME_FREAK, "MUS-RG-GAME-FREAK") \ + X(MUS_RG_CAUGHT, "MUS-RG-CAUGHT") \ + X(MUS_RG_NEW_GAME_INSTRUCT, "MUS-RG-NEW-GAME-INSTRUCT") \ + X(MUS_RG_NEW_GAME_INTRO, "MUS-RG-NEW-GAME-INTRO") \ + X(MUS_RG_NEW_GAME_EXIT, "MUS-RG-NEW-GAME-EXIT") \ + X(MUS_RG_POKE_JUMP, "MUS-RG-POKE-JUMP") \ + X(MUS_RG_UNION_ROOM, "MUS-RG-UNION-ROOM") \ + X(MUS_RG_NET_CENTER, "MUS-RG-NET-CENTER") \ + X(MUS_RG_MYSTERY_GIFT, "MUS-RG-MYSTERY-GIFT") \ + X(MUS_RG_BERRY_PICK, "MUS-RG-BERRY-PICK") \ + X(MUS_RG_SEVII_CAVE, "MUS-RG-SEVII-CAVE") \ + X(MUS_RG_TEACHY_TV_SHOW, "MUS-RG-TEACHY-TV-SHOW") \ + X(MUS_RG_SEVII_ROUTE, "MUS-RG-SEVII-ROUTE") \ + X(MUS_RG_SEVII_DUNGEON, "MUS-RG-SEVII-DUNGEON") \ + X(MUS_RG_SEVII_123, "MUS-RG-SEVII-123") \ + X(MUS_RG_SEVII_45, "MUS-RG-SEVII-45") \ + X(MUS_RG_SEVII_67, "MUS-RG-SEVII-67") \ + X(MUS_RG_POKE_FLUTE, "MUS-RG-POKE-FLUTE") \ + X(MUS_RG_VS_DEOXYS, "MUS-RG-VS-DEOXYS") \ + X(MUS_RG_VS_MEWTWO, "MUS-RG-VS-MEWTWO") \ + X(MUS_RG_VS_LEGEND, "MUS-RG-VS-LEGEND") \ + X(MUS_RG_ENCOUNTER_GYM_LEADER, "MUS-RG-ENCOUNTER-GYM-LEADER") \ + X(MUS_RG_ENCOUNTER_DEOXYS, "MUS-RG-ENCOUNTER-DEOXYS") \ + X(MUS_RG_TRAINER_TOWER, "MUS-RG-TRAINER-TOWER") \ + X(MUS_RG_SLOW_PALLET, "MUS-RG-SLOW-PALLET") \ + X(MUS_RG_TEACHY_TV_MENU, "MUS-RG-TEACHY-TV-MENU") \ + X(DP_SEQ_TITLE00 , "DP-SEQ-TITLE00") \ + X(DP_SEQ_TITLE01 , "DP-SEQ-TITLE01") \ + X(DP_SEQ_OPENING , "DP-SEQ-OPENING") \ + X(DP_SEQ_TV_HOUSOU , "DP-SEQ-TV-HOUSOU") \ + X(DP_SEQ_TV_END , "DP-SEQ-TV-END") \ + X(DP_SEQ_TOWN01_D , "DP-SEQ-TOWN01-D") \ + X(DP_SEQ_TOWN01_N , "DP-SEQ-TOWN01-N") \ + X(DP_SEQ_THE_RIV , "DP-SEQ-THE-RIV") \ + X(DP_SEQ_ROAD_A_D , "DP-SEQ-ROAD-A-D") \ + X(DP_SEQ_ROAD_A_N , "DP-SEQ-ROAD-A-N") \ + X(DP_SEQ_D_LAKE , "DP-SEQ-D-LAKE") \ + X(DP_SEQ_THE_EVENT01, "DP-SEQ-THE-EVENT01") \ + X(DP_SEQ_BA_POKE , "DP-SEQ-BA-POKE") \ + X(DP_SEQ_WINPOKE , "DP-SEQ-WINPOKE") \ + X(DP_SEQ_THE_GIRL , "DP-SEQ-THE-GIRL") \ + X(DP_SEQ_THE_BOY , "DP-SEQ-THE-BOY") \ + X(DP_SEQ_FANFA4 , "DP-SEQ-FANFA4") \ + X(DP_SEQ_TOWN02_D , "DP-SEQ-TOWN02-D") \ + X(DP_SEQ_TOWN02_N , "DP-SEQ-TOWN02-N") \ + X(DP_SEQ_KENKYUJO , "DP-SEQ-KENKYUJO") \ + X(DP_SEQ_TSURETEKE , "DP-SEQ-TSURETEKE") \ + X(DP_SEQ_PC_01 , "DP-SEQ-PC-01") \ + X(DP_SEQ_PC_02 , "DP-SEQ-PC-02") \ + X(DP_SEQ_ASA , "DP-SEQ-ASA") \ + X(DP_SEQ_EYE_BOY , "DP-SEQ-EYE-BOY") \ + X(DP_SEQ_EYE_GIRL , "DP-SEQ-EYE-GIRL") \ + X(DP_SEQ_BA_TRAIN , "DP-SEQ-BA-TRAIN") \ + X(DP_SEQ_WINTRAIN , "DP-SEQ-WINTRAIN") \ + X(DP_SEQ_CITY01_D , "DP-SEQ-CITY01-D") \ + X(DP_SEQ_CITY01_N , "DP-SEQ-CITY01-N") \ + X(DP_SEQ_FANFA3 , "DP-SEQ-FANFA3") \ + X(DP_SEQ_FS , "DP-SEQ-FS") \ + X(DP_SEQ_ROAD_B_D , "DP-SEQ-ROAD-B-D") \ + X(DP_SEQ_ROAD_B_N , "DP-SEQ-ROAD-B-N") \ + X(DP_SEQ_BA_RIVAL , "DP-SEQ-BA-RIVAL") \ + X(DP_SEQ_D_05 , "DP-SEQ-D-05") \ + X(DP_SEQ_WAZA , "DP-SEQ-WAZA") \ + X(DP_SEQ_CITY03_D , "DP-SEQ-CITY03-D") \ + X(DP_SEQ_CITY03_N , "DP-SEQ-CITY03-N") \ + X(DP_SEQ_D_04 , "DP-SEQ-D-04") \ + X(DP_SEQ_GYM , "DP-SEQ-GYM") \ + X(DP_SEQ_BA_GYM , "DP-SEQ-BA-GYM") \ + X(DP_SEQ_WINTGYM , "DP-SEQ-WINTGYM") \ + X(DP_SEQ_BADGE , "DP-SEQ-BADGE") \ + X(DP_SEQ_EYE_KID , "DP-SEQ-EYE-KID") \ + X(DP_SEQ_FANFA1 , "DP-SEQ-FANFA1") \ + X(DP_SEQ_TOWN03_D , "DP-SEQ-TOWN03-D") \ + X(DP_SEQ_TOWN03_N , "DP-SEQ-TOWN03-N") \ + X(DP_SEQ_KINOMI , "DP-SEQ-KINOMI") \ + X(DP_SEQ_ROAD_C_D , "DP-SEQ-ROAD-C-D") \ + X(DP_SEQ_ROAD_C_N , "DP-SEQ-ROAD-C-N") \ + X(DP_SEQ_EYE_GINGA , "DP-SEQ-EYE-GINGA") \ + X(DP_SEQ_BA_GINGA , "DP-SEQ-BA-GINGA") \ + X(DP_SEQ_D_02 , "DP-SEQ-D-02") \ + X(DP_SEQ_GONIN , "DP-SEQ-GONIN") \ + X(DP_SEQ_CITY04_D , "DP-SEQ-CITY04-D") \ + X(DP_SEQ_CITY04_N , "DP-SEQ-CITY04-N") \ + X(DP_SEQ_D_GINLOBBY , "DP-SEQ-D-GINLOBBY") \ + X(DP_SEQ_BA_GINGA3 , "DP-SEQ-BA-GINGA3") \ + X(DP_SEQ_WINGINGA , "DP-SEQ-WINGINGA") \ + X(DP_SEQ_SHINKA , "DP-SEQ-SHINKA") \ + X(DP_SEQ_FANFA5 , "DP-SEQ-FANFA5") \ + X(DP_SEQ_BICYCLE , "DP-SEQ-BICYCLE") \ + X(DP_SEQ_EYE_SPORT , "DP-SEQ-EYE-SPORT") \ + X(DP_SEQ_ROAD_D_D , "DP-SEQ-ROAD-D-D") \ + X(DP_SEQ_ROAD_D_N , "DP-SEQ-ROAD-D-N") \ + X(DP_SEQ_CITY05_D , "DP-SEQ-CITY05-D") \ + X(DP_SEQ_CITY05_N , "DP-SEQ-CITY05-N") \ + X(DP_SEQ_ROAD_E_D , "DP-SEQ-ROAD-E-D") \ + X(DP_SEQ_ROAD_E_N , "DP-SEQ-ROAD-E-N") \ + X(DP_SEQ_EYE_MOUNT , "DP-SEQ-EYE-MOUNT") \ + X(DP_SEQ_TOWN04_D , "DP-SEQ-TOWN04-D") \ + X(DP_SEQ_TOWN04_N , "DP-SEQ-TOWN04-N") \ + X(DP_SEQ_POCKETCH , "DP-SEQ-POCKETCH") \ + X(DP_SEQ_ROAD_F_D , "DP-SEQ-ROAD-F-D") \ + X(DP_SEQ_ROAD_F_N , "DP-SEQ-ROAD-F-N") \ + X(DP_SEQ_CITY07_D , "DP-SEQ-CITY07-D") \ + X(DP_SEQ_CITY07_N , "DP-SEQ-CITY07-N") \ + X(DP_SEQ_TOWN07_D , "DP-SEQ-TOWN07-D") \ + X(DP_SEQ_TOWN07_N , "DP-SEQ-TOWN07-N") \ + X(DP_SEQ_CITY02_D , "DP-SEQ-CITY02-D") \ + X(DP_SEQ_CITY02_N , "DP-SEQ-CITY02-N") \ + X(DP_SEQ_ROAD_SNOW_D , "DP-SEQ-ROAD-SNOW-D") \ + X(DP_SEQ_ROAD_SNOW_N , "DP-SEQ-ROAD-SNOW-N") \ + X(DP_SEQ_CITY09_D , "DP-SEQ-CITY09-D") \ + X(DP_SEQ_CITY09_N , "DP-SEQ-CITY09-N") \ + X(DP_SEQ_D_AGITO , "DP-SEQ-D-AGITO") \ + X(DP_SEQ_BA_AGAKI , "DP-SEQ-BA-AGAKI") \ + X(DP_SEQ_THE_EVENT04 , "DP-SEQ-THE-EVENT04") \ + X(DP_SEQ_D_MOUNT1 , "DP-SEQ-D-MOUNT1") \ + X(DP_SEQ_D_MOUNT2 , "DP-SEQ-D-MOUNT2") \ + X(DP_SEQ_THE_EVENT02 , "DP-SEQ-THE-EVENT02") \ + X(DP_SEQ_THE_EVENT03 , "DP-SEQ-THE-EVENT03") \ + X(DP_SEQ_BA_DPOKE2 , "DP-SEQ-BA-DPOKE2") \ + X(DP_SEQ_CITY08_D , "DP-SEQ-CITY08-D") \ + X(DP_SEQ_CITY08_N , "DP-SEQ-CITY08-N") \ + X(DP_SEQ_D_01 , "DP-SEQ-D-01") \ + X(DP_SEQ_EYE_ELITE , "DP-SEQ-EYE-ELITE") \ + X(DP_SEQ_CITY10_D , "DP-SEQ-CITY10-D") \ + X(DP_SEQ_CITY10_N , "DP-SEQ-CITY10-N") \ + X(DP_SEQ_CITY11_D , "DP-SEQ-CITY11-D") \ + X(DP_SEQ_CITY11_N , "DP-SEQ-CITY11-N") \ + X(DP_SEQ_TOWN06_D , "DP-SEQ-TOWN06-D") \ + X(DP_SEQ_TOWN06_N , "DP-SEQ-TOWN06-N") \ + X(DP_SEQ_ROAD_BZA_D , "DP-SEQ-ROAD-BZA-D") \ + X(DP_SEQ_ROAD_BZA_N , "DP-SEQ-ROAD-BZA-N") \ + X(DP_SEQ_WIFILOBBY , "DP-SEQ-WIFILOBBY") \ + X(DP_SEQ_BLD_TV , "DP-SEQ-BLD-TV") \ + X(DP_SEQ_BLD_BLD_GTC , "DP-SEQ-BLD-BLD-GTC") \ + X(DP_SEQ_NAMINORI , "DP-SEQ-NAMINORI") \ + X(DP_SEQ_WASURE , "DP-SEQ-WASURE") \ + X(DP_SEQ_EYE_FIGHT , "DP-SEQ-EYE-FIGHT") \ + X(DP_SEQ_EYE_ENKA , "DP-SEQ-EYE-ENKA") \ + X(DP_SEQ_TANKOU , "DP-SEQ-TANKOU") \ + X(DP_SEQ_HATANIGE , "DP-SEQ-HATANIGE") \ + X(DP_SEQ_EYE_LADY , "DP-SEQ-EYE-LADY") \ + X(DP_SEQ_D_03 , "DP-SEQ-D-03") \ + X(DP_SEQ_D_SAFARI , "DP-SEQ-D-SAFARI") \ + X(DP_SEQ_EYE_MYS , "DP-SEQ-EYE-MYS") \ + X(DP_SEQ_BLD_GAME , "DP-SEQ-BLD-GAME") \ + X(DP_SEQ_SLOT_ATARI , "DP-SEQ-SLOT-ATARI") \ + X(DP_SEQ_SLOT_OOATARI , "DP-SEQ-SLOT-OOATARI") \ + X(DP_SEQ_EYE_RICH , "DP-SEQ-EYE-RICH") \ + X(DP_SEQ_D_RYAYHY , "DP-SEQ-D-RYAYHY") \ + X(DP_SEQ_BA_DPOKE1 , "DP-SEQ-BA-DPOKE1") \ + X(DP_SEQ_KUSAGASA , "DP-SEQ-KUSAGASA") \ + X(DP_SEQ_EYE_FUN , "DP-SEQ-EYE-FUN") \ + X(DP_SEQ_D_KOUEN , "DP-SEQ-D-KOUEN") \ + X(DP_SEQ_ACCE , "DP-SEQ-ACCE") \ + X(DP_SEQ_BLD_CON , "DP-SEQ-BLD-CON") \ + X(DP_SEQ_KINOMI1 , "DP-SEQ-KINOMI1") \ + X(DP_SEQ_CON_TEST , "DP-SEQ-CON-TEST") \ + X(DP_SEQ_CO_DRESS , "DP-SEQ-CO-DRESS") \ + X(DP_SEQ_CO_KASHI , "DP-SEQ-CO-KASHI") \ + X(DP_SEQ_CO_TAKUMA , "DP-SEQ-CO-TAKUMA") \ + X(DP_SEQ_CO_KEKKA , "DP-SEQ-CO-KEKKA") \ + X(DP_SEQ_CO_FANFA , "DP-SEQ-CO-FANFA") \ + X(DP_SEQ_BF_TOWWER , "DP-SEQ-BF-TOWWER") \ + X(DP_SEQ_D_06 , "DP-SEQ-D-06") \ + X(DP_SEQ_BA_SECRET2 , "DP-SEQ-BA-SECRET2") \ + X(DP_SEQ_PRESENT , "DP-SEQ-PRESENT") \ + X(DP_SEQ_D_LEAGUE , "DP-SEQ-D-LEAGUE") \ + X(DP_SEQ_EYE_TENNO , "DP-SEQ-EYE-TENNO") \ + X(DP_SEQ_BA_TENNO , "DP-SEQ-BA-TENNO") \ + X(DP_SEQ_WINTENNO , "DP-SEQ-WINTENNO") \ + X(DP_SEQ_EYE_CHAMP , "DP-SEQ-EYE-CHAMP") \ + X(DP_SEQ_BA_CHANP , "DP-SEQ-BA-CHANP") \ + X(DP_SEQ_WINCHAMP , "DP-SEQ-WINCHAMP") \ + X(DP_SEQ_BLD_DENDO , "DP-SEQ-BLD-DENDO") \ + X(DP_SEQ_BLD_EV_DENDO2 , "DP-SEQ-BLD-EV-DENDO2") \ + X(DP_SEQ_BLD_ENDING , "DP-SEQ-BLD-ENDING") \ + X(DP_SEQ_FUE , "DP-SEQ-FUE") \ + X(DP_SEQ_AUS , "DP-SEQ-AUS") \ + X(DP_SEQ_BA_SECRET1 , "DP-SEQ-BA-SECRET1") \ + X(PL_SEQ_TITLE00 , "PL-SEQ-TITLE00") \ + X(PL_SEQ_TITLE01 , "PL-SEQ-TITLE01") \ + X(PL_SEQ_TV_HOUSOU , "PL-SEQ-TV-HOUSOU") \ + X(PL_SEQ_TV_END , "PL-SEQ-TV-END") \ + X(PL_SEQ_PL_HANDSOME , "PL-SEQ-PL-HANDSOME") \ + X(PL_SEQ_PL_WIFITOWER , "PL-SEQ-PL-WIFITOWER") \ + X(PL_SEQ_PL_WIFIUNION , "PL-SEQ-PL-WIFIUNION") \ + X(PL_SEQ_PL_WIFIGAME , "PL-SEQ-PL-WIFIGAME") \ + X(PL_SEQ_PL_WINMINI2 , "PL-SEQ-PL-WINMINI2") \ + X(PL_SEQ_PL_WIFIPARADE , "PL-SEQ-PL-WIFIPARADE") \ + X(PL_SEQ_PL_EV_GIRA , "PL-SEQ-PL-EV-GIRA") \ + X(PL_SEQ_PL_EV_GIRA2 , "PL-SEQ-PL-EV-GIRA2") \ + X(PL_SEQ_PL_D_GIRATINA , "PL-SEQ-PL-D-GIRATINA") \ + X(PL_SEQ_PL_BA_GIRA , "PL-SEQ-PL-BA-GIRA") \ + X(PL_SEQ_PL_GURUGURU , "PL-SEQ-PL-GURUGURU") \ + X(PL_SEQ_PL_PTHAIFU , "PL-SEQ-PL-PTHAIFU") \ + X(PL_SEQ_PL_MTKAWA , "PL-SEQ-PL-MTKAWA") \ + X(PL_SEQ_PL_MTKAKKO , "PL-SEQ-PL-MTKAKKO") \ + X(PL_SEQ_PL_MTTAKMA , "PL-SEQ-PL-MTTAKMA") \ + X(PL_SEQ_PL_MTUTSUK , "PL-SEQ-PL-MTUTSUK") \ + X(PL_SEQ_PL_MTKASHI , "PL-SEQ-PL-MTKASHI") \ + X(PL_SEQ_PL_TOWN02 , "PL-SEQ-PL-TOWN02") \ + X(PL_SEQ_PL_AUDIO , "PL-SEQ-PL-AUDIO") \ + X(PL_SEQ_CITY11_D , "PL-SEQ-CITY11-D") \ + X(PL_SEQ_PL_BF_ROULETTE , "PL-SEQ-PL-BF-ROULETTE") \ + X(PL_SEQ_PL_DON2 , "PL-SEQ-PL-DON2") \ + X(PL_SEQ_PL_BF_STAGE , "PL-SEQ-PL-BF-STAGE") \ + X(PL_SEQ_PL_BF_FACTORY , "PL-SEQ-PL-BF-FACTORY") \ + X(PL_SEQ_PL_BF_CASTLE , "PL-SEQ-PL-BF-CASTLE") \ + X(PL_SEQ_PL_FRO , "PL-SEQ-PL-FRO") \ + X(PL_SEQ_PL_POINTGET3 , "PL-SEQ-PL-POINTGET3") \ + X(PL_SEQ_PL_BA_BRAIN , "PL-SEQ-PL-BA-BRAIN") \ + X(PL_SEQ_PL_WINBRAIN , "PL-SEQ-PL-WINBRAIN") \ + X(PL_SEQ_PL_BA_REGI , "PL-SEQ-PL-BA-REGI") \ + X(PH_TRAP_BLEND, "PH-TRAP-BLEND") \ + X(PH_TRAP_HELD, "PH-TRAP-HELD") \ + X(PH_TRAP_SOLO, "PH-TRAP-SOLO") \ + X(PH_FACE_BLEND, "PH-FACE-BLEND") \ + X(PH_FACE_HELD, "PH-FACE-HELD") \ + X(PH_FACE_SOLO, "PH-FACE-SOLO") \ + X(PH_CLOTH_BLEND, "PH-CLOTH-BLEND") \ + X(PH_CLOTH_HELD, "PH-CLOTH-HELD") \ + X(PH_CLOTH_SOLO, "PH-CLOTH-SOLO") \ + X(PH_DRESS_BLEND, "PH-DRESS-BLEND") \ + X(PH_DRESS_HELD, "PH-DRESS-HELD") \ + X(PH_DRESS_SOLO, "PH-DRESS-SOLO") \ + X(PH_FLEECE_BLEND, "PH-FLEECE-BLEND") \ + X(PH_FLEECE_HELD, "PH-FLEECE-HELD") \ + X(PH_FLEECE_SOLO, "PH-FLEECE-SOLO") \ + X(PH_KIT_BLEND, "PH-KIT-BLEND") \ + X(PH_KIT_HELD, "PH-KIT-HELD") \ + X(PH_KIT_SOLO, "PH-KIT-SOLO") \ + X(PH_PRICE_BLEND, "PH-PRICE-BLEND") \ + X(PH_PRICE_HELD, "PH-PRICE-HELD") \ + X(PH_PRICE_SOLO, "PH-PRICE-SOLO") \ + X(PH_LOT_BLEND, "PH-LOT-BLEND") \ + X(PH_LOT_HELD, "PH-LOT-HELD") \ + X(PH_LOT_SOLO, "PH-LOT-SOLO") \ + X(PH_GOAT_BLEND, "PH-GOAT-BLEND") \ + X(PH_GOAT_HELD, "PH-GOAT-HELD") \ + X(PH_GOAT_SOLO, "PH-GOAT-SOLO") \ + X(PH_THOUGHT_BLEND, "PH-THOUGHT-BLEND") \ + X(PH_THOUGHT_HELD, "PH-THOUGHT-HELD") \ + X(PH_THOUGHT_SOLO, "PH-THOUGHT-SOLO") \ + X(PH_CHOICE_BLEND, "PH-CHOICE-BLEND") \ + X(PH_CHOICE_HELD, "PH-CHOICE-HELD") \ + X(PH_CHOICE_SOLO, "PH-CHOICE-SOLO") \ + X(PH_MOUTH_BLEND, "PH-MOUTH-BLEND") \ + X(PH_MOUTH_HELD, "PH-MOUTH-HELD") \ + X(PH_MOUTH_SOLO, "PH-MOUTH-SOLO") \ + X(PH_FOOT_BLEND, "PH-FOOT-BLEND") \ + X(PH_FOOT_HELD, "PH-FOOT-HELD") \ + X(PH_FOOT_SOLO, "PH-FOOT-SOLO") \ + X(PH_GOOSE_BLEND, "PH-GOOSE-BLEND") \ + X(PH_GOOSE_HELD, "PH-GOOSE-HELD") \ + X(PH_GOOSE_SOLO, "PH-GOOSE-SOLO") \ + X(PH_STRUT_BLEND, "PH-STRUT-BLEND") \ + X(PH_STRUT_HELD, "PH-STRUT-HELD") \ + X(PH_STRUT_SOLO, "PH-STRUT-SOLO") \ + X(PH_CURE_BLEND, "PH-CURE-BLEND") \ + X(PH_CURE_HELD, "PH-CURE-HELD") \ + X(PH_CURE_SOLO, "PH-CURE-SOLO") \ + X(PH_NURSE_BLEND, "PH-NURSE-BLEND") \ + X(PH_NURSE_HELD, "PH-NURSE-HELD") \ + X(PH_NURSE_SOLO, "PH-NURSE-SOLO") \ + +#define SOUND_LIST_SE \ + X(SE_USE_ITEM, "SE-USE-ITEM") \ + X(SE_PC_LOGIN, "SE-PC-LOGIN") \ + X(SE_PC_OFF, "SE-PC-OFF") \ + X(SE_PC_ON, "SE-PC-ON") \ + X(SE_SELECT, "SE-SELECT") \ + X(SE_WIN_OPEN, "SE-WIN-OPEN") \ + X(SE_WALL_HIT, "SE-WALL-HIT") \ + X(SE_DOOR, "SE-DOOR") \ + X(SE_EXIT, "SE-EXIT") \ + X(SE_LEDGE, "SE-LEDGE") \ + X(SE_BIKE_BELL, "SE-BIKE-BELL") \ + X(SE_NOT_EFFECTIVE, "SE-NOT-EFFECTIVE") \ + X(SE_EFFECTIVE, "SE-EFFECTIVE") \ + X(SE_SUPER_EFFECTIVE, "SE-SUPER-EFFECTIVE") \ + X(SE_BALL_OPEN, "SE-BALL-OPEN") \ + X(SE_FAINT, "SE-FAINT") \ + X(SE_FLEE, "SE-FLEE") \ + X(SE_SLIDING_DOOR, "SE-SLIDING-DOOR") \ + X(SE_SHIP, "SE-SHIP") \ + X(SE_BANG, "SE-BANG") \ + X(SE_PIN, "SE-PIN") \ + X(SE_BOO, "SE-BOO") \ + X(SE_BALL, "SE-BALL") \ + X(SE_CONTEST_PLACE, "SE-CONTEST-PLACE") \ + X(SE_A, "SE-A") \ + X(SE_I, "SE-I") \ + X(SE_U, "SE-U") \ + X(SE_E, "SE-E") \ + X(SE_O, "SE-O") \ + X(SE_N, "SE-N") \ + X(SE_SUCCESS, "SE-SUCCESS") \ + X(SE_FAILURE, "SE-FAILURE") \ + X(SE_EXP, "SE-EXP") \ + X(SE_BIKE_HOP, "SE-BIKE-HOP") \ + X(SE_SWITCH, "SE-SWITCH") \ + X(SE_CLICK, "SE-CLICK") \ + X(SE_FU_ZAKU, "SE-FU-ZAKU") \ + X(SE_CONTEST_CONDITION_LOSE, "SE-CONTEST-CONDITION-LOSE") \ + X(SE_LAVARIDGE_FALL_WARP, "SE-LAVARIDGE-FALL-WARP") \ + X(SE_ICE_STAIRS, "SE-ICE-STAIRS") \ + X(SE_ICE_BREAK, "SE-ICE-BREAK") \ + X(SE_ICE_CRACK, "SE-ICE-CRACK") \ + X(SE_FALL, "SE-FALL") \ + X(SE_UNLOCK, "SE-UNLOCK") \ + X(SE_WARP_IN, "SE-WARP-IN") \ + X(SE_WARP_OUT, "SE-WARP-OUT") \ + X(SE_REPEL, "SE-REPEL") \ + X(SE_ROTATING_GATE, "SE-ROTATING-GATE") \ + X(SE_TRUCK_MOVE, "SE-TRUCK-MOVE") \ + X(SE_TRUCK_STOP, "SE-TRUCK-STOP") \ + X(SE_TRUCK_UNLOAD, "SE-TRUCK-UNLOAD") \ + X(SE_TRUCK_DOOR, "SE-TRUCK-DOOR") \ + X(SE_BERRY_BLENDER, "SE-BERRY-BLENDER") \ + X(SE_CARD, "SE-CARD") \ + X(SE_SAVE, "SE-SAVE") \ + X(SE_BALL_BOUNCE_1, "SE-BALL-BOUNCE-1") \ + X(SE_BALL_BOUNCE_2, "SE-BALL-BOUNCE-2") \ + X(SE_BALL_BOUNCE_3, "SE-BALL-BOUNCE-3") \ + X(SE_BALL_BOUNCE_4, "SE-BALL-BOUNCE-4") \ + X(SE_BALL_TRADE, "SE-BALL-TRADE") \ + X(SE_BALL_THROW, "SE-BALL-THROW") \ + X(SE_NOTE_C, "SE-NOTE-C") \ + X(SE_NOTE_D, "SE-NOTE-D") \ + X(SE_NOTE_E, "SE-NOTE-E") \ + X(SE_NOTE_F, "SE-NOTE-F") \ + X(SE_NOTE_G, "SE-NOTE-G") \ + X(SE_NOTE_A, "SE-NOTE-A") \ + X(SE_NOTE_B, "SE-NOTE-B") \ + X(SE_NOTE_C_HIGH, "SE-NOTE-C-HIGH") \ + X(SE_PUDDLE, "SE-PUDDLE") \ + X(SE_BRIDGE_WALK, "SE-BRIDGE-WALK") \ + X(SE_ITEMFINDER, "SE-ITEMFINDER") \ + X(SE_DING_DONG, "SE-DING-DONG") \ + X(SE_BALLOON_RED, "SE-BALLOON-RED") \ + X(SE_BALLOON_BLUE, "SE-BALLOON-BLUE") \ + X(SE_BALLOON_YELLOW, "SE-BALLOON-YELLOW") \ + X(SE_BREAKABLE_DOOR, "SE-BREAKABLE-DOOR") \ + X(SE_MUD_BALL, "SE-MUD-BALL") \ + X(SE_FIELD_POISON, "SE-FIELD-POISON") \ + X(SE_ESCALATOR, "SE-ESCALATOR") \ + X(SE_THUNDERSTORM, "SE-THUNDERSTORM") \ + X(SE_THUNDERSTORM_STOP, "SE-THUNDERSTORM-STOP") \ + X(SE_DOWNPOUR, "SE-DOWNPOUR") \ + X(SE_DOWNPOUR_STOP, "SE-DOWNPOUR-STOP") \ + X(SE_RAIN, "SE-RAIN") \ + X(SE_RAIN_STOP, "SE-RAIN-STOP") \ + X(SE_THUNDER, "SE-THUNDER") \ + X(SE_THUNDER2, "SE-THUNDER2") \ + X(SE_ELEVATOR, "SE-ELEVATOR") \ + X(SE_LOW_HEALTH, "SE-LOW-HEALTH") \ + X(SE_EXP_MAX, "SE-EXP-MAX") \ + X(SE_ROULETTE_BALL, "SE-ROULETTE-BALL") \ + X(SE_ROULETTE_BALL2, "SE-ROULETTE-BALL2") \ + X(SE_TAILLOW_WING_FLAP, "SE-TAILLOW-WING-FLAP") \ + X(SE_SHOP, "SE-SHOP") \ + X(SE_CONTEST_HEART, "SE-CONTEST-HEART") \ + X(SE_CONTEST_CURTAIN_RISE, "SE-CONTEST-CURTAIN-RISE") \ + X(SE_CONTEST_CURTAIN_FALL, "SE-CONTEST-CURTAIN-FALL") \ + X(SE_CONTEST_ICON_CHANGE, "SE-CONTEST-ICON-CHANGE") \ + X(SE_CONTEST_ICON_CLEAR, "SE-CONTEST-ICON-CLEAR") \ + X(SE_CONTEST_MONS_TURN, "SE-CONTEST-MONS-TURN") \ + X(SE_SHINY, "SE-SHINY") \ + X(SE_INTRO_BLAST, "SE-INTRO-BLAST") \ + X(SE_MUGSHOT, "SE-MUGSHOT") \ + X(SE_APPLAUSE, "SE-APPLAUSE") \ + X(SE_VEND, "SE-VEND") \ + X(SE_ORB, "SE-ORB") \ + X(SE_DEX_SCROLL, "SE-DEX-SCROLL") \ + X(SE_DEX_PAGE, "SE-DEX-PAGE") \ + X(SE_POKENAV_ON, "SE-POKENAV-ON") \ + X(SE_POKENAV_OFF, "SE-POKENAV-OFF") \ + X(SE_DEX_SEARCH, "SE-DEX-SEARCH") \ + X(SE_EGG_HATCH, "SE-EGG-HATCH") \ + X(SE_BALL_TRAY_ENTER, "SE-BALL-TRAY-ENTER") \ + X(SE_BALL_TRAY_BALL, "SE-BALL-TRAY-BALL") \ + X(SE_BALL_TRAY_EXIT, "SE-BALL-TRAY-EXIT") \ + X(SE_GLASS_FLUTE, "SE-GLASS-FLUTE") \ + X(SE_M_THUNDERBOLT, "SE-M-THUNDERBOLT") \ + X(SE_M_THUNDERBOLT2, "SE-M-THUNDERBOLT2") \ + X(SE_M_HARDEN, "SE-M-HARDEN") \ + X(SE_M_NIGHTMARE, "SE-M-NIGHTMARE") \ + X(SE_M_VITAL_THROW, "SE-M-VITAL-THROW") \ + X(SE_M_VITAL_THROW2, "SE-M-VITAL-THROW2") \ + X(SE_M_BUBBLE, "SE-M-BUBBLE") \ + X(SE_M_BUBBLE2, "SE-M-BUBBLE2") \ + X(SE_M_BUBBLE3, "SE-M-BUBBLE3") \ + X(SE_M_RAIN_DANCE, "SE-M-RAIN-DANCE") \ + X(SE_M_CUT, "SE-M-CUT") \ + X(SE_M_STRING_SHOT, "SE-M-STRING-SHOT") \ + X(SE_M_STRING_SHOT2, "SE-M-STRING-SHOT2") \ + X(SE_M_ROCK_THROW, "SE-M-ROCK-THROW") \ + X(SE_M_GUST, "SE-M-GUST") \ + X(SE_M_GUST2, "SE-M-GUST2") \ + X(SE_M_DOUBLE_SLAP, "SE-M-DOUBLE-SLAP") \ + X(SE_M_DOUBLE_TEAM, "SE-M-DOUBLE-TEAM") \ + X(SE_M_RAZOR_WIND, "SE-M-RAZOR-WIND") \ + X(SE_M_ICY_WIND, "SE-M-ICY-WIND") \ + X(SE_M_THUNDER_WAVE, "SE-M-THUNDER-WAVE") \ + X(SE_M_COMET_PUNCH, "SE-M-COMET-PUNCH") \ + X(SE_M_MEGA_KICK, "SE-M-MEGA-KICK") \ + X(SE_M_MEGA_KICK2, "SE-M-MEGA-KICK2") \ + X(SE_M_CRABHAMMER, "SE-M-CRABHAMMER") \ + X(SE_M_JUMP_KICK, "SE-M-JUMP-KICK") \ + X(SE_M_FLAME_WHEEL, "SE-M-FLAME-WHEEL") \ + X(SE_M_FLAME_WHEEL2, "SE-M-FLAME-WHEEL2") \ + X(SE_M_FLAMETHROWER, "SE-M-FLAMETHROWER") \ + X(SE_M_FIRE_PUNCH, "SE-M-FIRE-PUNCH") \ + X(SE_M_TOXIC, "SE-M-TOXIC") \ + X(SE_M_SACRED_FIRE, "SE-M-SACRED-FIRE") \ + X(SE_M_SACRED_FIRE2, "SE-M-SACRED-FIRE2") \ + X(SE_M_EMBER, "SE-M-EMBER") \ + X(SE_M_TAKE_DOWN, "SE-M-TAKE-DOWN") \ + X(SE_M_BLIZZARD, "SE-M-BLIZZARD") \ + X(SE_M_BLIZZARD2, "SE-M-BLIZZARD2") \ + X(SE_M_SCRATCH, "SE-M-SCRATCH") \ + X(SE_M_VICEGRIP, "SE-M-VICEGRIP") \ + X(SE_M_WING_ATTACK, "SE-M-WING-ATTACK") \ + X(SE_M_FLY, "SE-M-FLY") \ + X(SE_M_SAND_ATTACK, "SE-M-SAND-ATTACK") \ + X(SE_M_RAZOR_WIND2, "SE-M-RAZOR-WIND2") \ + X(SE_M_BITE, "SE-M-BITE") \ + X(SE_M_HEADBUTT, "SE-M-HEADBUTT") \ + X(SE_M_SURF, "SE-M-SURF") \ + X(SE_M_HYDRO_PUMP, "SE-M-HYDRO-PUMP") \ + X(SE_M_WHIRLPOOL, "SE-M-WHIRLPOOL") \ + X(SE_M_HORN_ATTACK, "SE-M-HORN-ATTACK") \ + X(SE_M_TAIL_WHIP, "SE-M-TAIL-WHIP") \ + X(SE_M_MIST, "SE-M-MIST") \ + X(SE_M_POISON_POWDER, "SE-M-POISON-POWDER") \ + X(SE_M_BIND, "SE-M-BIND") \ + X(SE_M_DRAGON_RAGE, "SE-M-DRAGON-RAGE") \ + X(SE_M_SING, "SE-M-SING") \ + X(SE_M_PERISH_SONG, "SE-M-PERISH-SONG") \ + X(SE_M_PAY_DAY, "SE-M-PAY-DAY") \ + X(SE_M_DIG, "SE-M-DIG") \ + X(SE_M_DIZZY_PUNCH, "SE-M-DIZZY-PUNCH") \ + X(SE_M_SELF_DESTRUCT, "SE-M-SELF-DESTRUCT") \ + X(SE_M_EXPLOSION, "SE-M-EXPLOSION") \ + X(SE_M_ABSORB_2, "SE-M-ABSORB-2") \ + X(SE_M_ABSORB, "SE-M-ABSORB") \ + X(SE_M_SCREECH, "SE-M-SCREECH") \ + X(SE_M_BUBBLE_BEAM, "SE-M-BUBBLE-BEAM") \ + X(SE_M_BUBBLE_BEAM2, "SE-M-BUBBLE-BEAM2") \ + X(SE_M_SUPERSONIC, "SE-M-SUPERSONIC") \ + X(SE_M_BELLY_DRUM, "SE-M-BELLY-DRUM") \ + X(SE_M_METRONOME, "SE-M-METRONOME") \ + X(SE_M_BONEMERANG, "SE-M-BONEMERANG") \ + X(SE_M_LICK, "SE-M-LICK") \ + X(SE_M_PSYBEAM, "SE-M-PSYBEAM") \ + X(SE_M_FAINT_ATTACK, "SE-M-FAINT-ATTACK") \ + X(SE_M_SWORDS_DANCE, "SE-M-SWORDS-DANCE") \ + X(SE_M_LEER, "SE-M-LEER") \ + X(SE_M_SWAGGER, "SE-M-SWAGGER") \ + X(SE_M_SWAGGER2, "SE-M-SWAGGER2") \ + X(SE_M_HEAL_BELL, "SE-M-HEAL-BELL") \ + X(SE_M_CONFUSE_RAY, "SE-M-CONFUSE-RAY") \ + X(SE_M_SNORE, "SE-M-SNORE") \ + X(SE_M_BRICK_BREAK, "SE-M-BRICK-BREAK") \ + X(SE_M_GIGA_DRAIN, "SE-M-GIGA-DRAIN") \ + X(SE_M_PSYBEAM2, "SE-M-PSYBEAM2") \ + X(SE_M_SOLAR_BEAM, "SE-M-SOLAR-BEAM") \ + X(SE_M_PETAL_DANCE, "SE-M-PETAL-DANCE") \ + X(SE_M_TELEPORT, "SE-M-TELEPORT") \ + X(SE_M_MINIMIZE, "SE-M-MINIMIZE") \ + X(SE_M_SKETCH, "SE-M-SKETCH") \ + X(SE_M_SWIFT, "SE-M-SWIFT") \ + X(SE_M_REFLECT, "SE-M-REFLECT") \ + X(SE_M_BARRIER, "SE-M-BARRIER") \ + X(SE_M_DETECT, "SE-M-DETECT") \ + X(SE_M_LOCK_ON, "SE-M-LOCK-ON") \ + X(SE_M_MOONLIGHT, "SE-M-MOONLIGHT") \ + X(SE_M_CHARM, "SE-M-CHARM") \ + X(SE_M_CHARGE, "SE-M-CHARGE") \ + X(SE_M_STRENGTH, "SE-M-STRENGTH") \ + X(SE_M_HYPER_BEAM, "SE-M-HYPER-BEAM") \ + X(SE_M_WATERFALL, "SE-M-WATERFALL") \ + X(SE_M_REVERSAL, "SE-M-REVERSAL") \ + X(SE_M_ACID_ARMOR, "SE-M-ACID-ARMOR") \ + X(SE_M_SANDSTORM, "SE-M-SANDSTORM") \ + X(SE_M_TRI_ATTACK, "SE-M-TRI-ATTACK") \ + X(SE_M_TRI_ATTACK2, "SE-M-TRI-ATTACK2") \ + X(SE_M_ENCORE, "SE-M-ENCORE") \ + X(SE_M_ENCORE2, "SE-M-ENCORE2") \ + X(SE_M_BATON_PASS, "SE-M-BATON-PASS") \ + X(SE_M_MILK_DRINK, "SE-M-MILK-DRINK") \ + X(SE_M_ATTRACT, "SE-M-ATTRACT") \ + X(SE_M_ATTRACT2, "SE-M-ATTRACT2") \ + X(SE_M_MORNING_SUN, "SE-M-MORNING-SUN") \ + X(SE_M_FLATTER, "SE-M-FLATTER") \ + X(SE_M_SAND_TOMB, "SE-M-SAND-TOMB") \ + X(SE_M_GRASSWHISTLE, "SE-M-GRASSWHISTLE") \ + X(SE_M_SPIT_UP, "SE-M-SPIT-UP") \ + X(SE_M_DIVE, "SE-M-DIVE") \ + X(SE_M_EARTHQUAKE, "SE-M-EARTHQUAKE") \ + X(SE_M_TWISTER, "SE-M-TWISTER") \ + X(SE_M_SWEET_SCENT, "SE-M-SWEET-SCENT") \ + X(SE_M_YAWN, "SE-M-YAWN") \ + X(SE_M_SKY_UPPERCUT, "SE-M-SKY-UPPERCUT") \ + X(SE_M_STAT_INCREASE, "SE-M-STAT-INCREASE") \ + X(SE_M_HEAT_WAVE, "SE-M-HEAT-WAVE") \ + X(SE_M_UPROAR, "SE-M-UPROAR") \ + X(SE_M_HAIL, "SE-M-HAIL") \ + X(SE_M_COSMIC_POWER, "SE-M-COSMIC-POWER") \ + X(SE_M_TEETER_DANCE, "SE-M-TEETER-DANCE") \ + X(SE_M_STAT_DECREASE, "SE-M-STAT-DECREASE") \ + X(SE_M_HAZE, "SE-M-HAZE") \ + X(SE_M_HYPER_BEAM2, "SE-M-HYPER-BEAM2") \ + X(SE_RG_DOOR, "SE-RG-DOOR") \ + X(SE_RG_CARD_FLIP, "SE-RG-CARD-FLIP") \ + X(SE_RG_CARD_FLIPPING, "SE-RG-CARD-FLIPPING") \ + X(SE_RG_CARD_OPEN, "SE-RG-CARD-OPEN") \ + X(SE_RG_BAG_CURSOR, "SE-RG-BAG-CURSOR") \ + X(SE_RG_BAG_POCKET, "SE-RG-BAG-POCKET") \ + X(SE_RG_BALL_CLICK, "SE-RG-BALL-CLICK") \ + X(SE_RG_SHOP, "SE-RG-SHOP") \ + X(SE_RG_SS_ANNE_HORN, "SE-RG-SS-ANNE-HORN") \ + X(SE_RG_HELP_OPEN, "SE-RG-HELP-OPEN") \ + X(SE_RG_HELP_CLOSE, "SE-RG-HELP-CLOSE") \ + X(SE_RG_HELP_ERROR, "SE-RG-HELP-ERROR") \ + X(SE_RG_DEOXYS_MOVE, "SE-RG-DEOXYS-MOVE") \ + X(SE_RG_POKE_JUMP_SUCCESS, "SE-RG-POKE-JUMP-SUCCESS") \ + X(SE_RG_POKE_JUMP_FAILURE, "SE-RG-POKE-JUMP-FAILURE") \ + X(SE_PHONE_CALL, "SE-PHONE-CALL") \ + X(SE_PHONE_CLICK, "SE-PHONE-CLICK") \ + X(SE_ARENA_TIMEUP1, "SE-ARENA-TIMEUP1") \ + X(SE_ARENA_TIMEUP2, "SE-ARENA-TIMEUP2") \ + X(SE_PIKE_CURTAIN_CLOSE, "SE-PIKE-CURTAIN-CLOSE") \ + X(SE_PIKE_CURTAIN_OPEN, "SE-PIKE-CURTAIN-OPEN") \ + X(SE_SUDOWOODO_SHAKE, "SE-SUDOWOODO-SHAKE") \ + +// Create BGM list +#define X(songId, name) static const u8 sBGMName_##songId[] = _(name); +SOUND_LIST_BGM +#undef X + +#define X(songId, name) sBGMName_##songId, +static const u8 *const gBGMNames[] = +{ +SOUND_LIST_BGM +}; +#undef X + +// Create SE list +#define X(songId, name) static const u8 sSEName_##songId[] = _(name); +SOUND_LIST_SE +#undef X + +#define X(songId, name) sSEName_##songId, +static const u8 *const gSENames[] = +{ +SOUND_LIST_SE +}; +#undef X + + // Additional functions /* static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate) From 010c1b5d824cf03d7a6410886388522be36f1b7d Mon Sep 17 00:00:00 2001 From: TheXaman Date: Tue, 22 Jun 2021 18:29:04 +0200 Subject: [PATCH 23/37] fixed some songs not properly stopping and overlapping others, thanks to @Lunos for reporting --- src/debug.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/debug.c b/src/debug.c index 49bef794f7..abed662460 100644 --- a/src/debug.c +++ b/src/debug.c @@ -22,6 +22,7 @@ #include "item.h" #include "item_icon.h" #include "list_menu.h" +#include "m4a.h" #include "main.h" #include "main_menu.h" #include "malloc.h" @@ -2720,8 +2721,9 @@ static void DebugAction_Sound_SE(u8 taskId) 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[3] = 1; //Current ID + gTasks[taskId].data[4] = 0; //Digit Selected + gTasks[taskId].data[5] = gTasks[taskId].data[3]; //Last song played (for stopping) } static void DebugAction_Sound_SE_SelectId(u8 taskId) { @@ -2761,12 +2763,14 @@ static void DebugAction_Sound_SE_SelectId(u8 taskId) if (gMain.newKeys & A_BUTTON) { - PlaySE(gTasks[taskId].data[3]); + m4aSongNumStop(gTasks[taskId].data[5]); + gTasks[taskId].data[5] = gTasks[taskId].data[3]; + m4aSongNumStart(gTasks[taskId].data[3]); } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); - MapMusicMain(); + m4aSongNumStop(gTasks[taskId].data[5]); DebugAction_DestroyExtraWindow(taskId); } } @@ -2796,8 +2800,9 @@ static void DebugAction_Sound_MUS(u8 taskId) 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[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) } static void DebugAction_Sound_MUS_SelectId(u8 taskId) { @@ -2837,13 +2842,14 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId) if (gMain.newKeys & A_BUTTON) { - StopMapMusic(); - PlayNewMapMusic(gTasks[taskId].data[3]); + m4aSongNumStop(gTasks[taskId].data[5]); + gTasks[taskId].data[5] = gTasks[taskId].data[3]; + m4aSongNumStart(gTasks[taskId].data[3]); } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); - MapMusicMain(); + // m4aSongNumStop(gTasks[taskId].data[5]); //Uncomment if music should stop after leaving menu DebugAction_DestroyExtraWindow(taskId); } } From 45012a66d74e8c475e08b04054ed26517c4ab8eb Mon Sep 17 00:00:00 2001 From: TheXaman Date: Tue, 22 Jun 2021 19:04:39 +0200 Subject: [PATCH 24/37] fixes PlaySE overwriting some "music tracks" like MUS_MOVE_DELETED --- src/debug.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/debug.c b/src/debug.c index abed662460..7fbeec4d84 100644 --- a/src/debug.c +++ b/src/debug.c @@ -2729,8 +2729,6 @@ static void DebugAction_Sound_SE_SelectId(u8 taskId) { if (gMain.newKeys & DPAD_ANY) { - PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; @@ -2808,8 +2806,6 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId) { if (gMain.newKeys & DPAD_ANY) { - PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; From a663742ebaefe364bd3b909ef27c2e82fff41423 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Wed, 30 Jun 2021 10:44:09 +0200 Subject: [PATCH 25/37] fixed a bug not showing hidden abilities (POKEMON_EXPANSION) if the second ability was ABILITY_NONE, thanks to Syreldar --- src/debug.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/debug.c b/src/debug.c index 7fbeec4d84..8cb5ddbaca 100644 --- a/src/debug.c +++ b/src/debug.c @@ -2185,13 +2185,12 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) { u8 abilityId; - u8 abilityCount = 0; - if (gBaseStats[sDebugMonData->mon_speciesId].abilities[1] != ABILITY_NONE) - abilityCount++; + u8 abilityCount = 2 - 1; //-1 for proper iteration + u8 i = 0; #ifdef POKEMON_EXPANSION - if (gBaseStats[sDebugMonData->mon_speciesId].abilities[2] != ABILITY_NONE) - abilityCount++; + abilityCount = NUM_ABILITY_SLOTS - 1; #endif + if (gMain.newKeys & DPAD_ANY) { PlaySE(SE_SELECT); @@ -2209,7 +2208,11 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) gTasks[taskId].data[3] = 0; } - abilityId = GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3]); + while (GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3] - i) == ABILITY_NONE) + { + 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); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); @@ -2220,7 +2223,7 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) if (gMain.newKeys & A_BUTTON) { - sDebugMonData->mon_abilityNum = gTasks[taskId].data[3]; //AbilityNum + sDebugMonData->mon_abilityNum = gTasks[taskId].data[3] - i; //AbilityNum gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; From af355fcb1211b0fb3eebdd852e04aacf361f5d3c Mon Sep 17 00:00:00 2001 From: TheXaman Date: Fri, 2 Jul 2021 11:49:32 +0200 Subject: [PATCH 26/37] added Debug to StartMenu via DEBUG_MENU option --- include/debug.h | 2 ++ src/field_control_avatar.c | 6 ++-- src/start_menu.c | 69 +++++++++++++++++++++++++++++++++++--- 3 files changed, 69 insertions(+), 8 deletions(-) diff --git a/include/debug.h b/include/debug.h index 4c9c3fffcb..864176e4f3 100644 --- a/include/debug.h +++ b/include/debug.h @@ -5,4 +5,6 @@ void Debug_ShowMainMenu(void); #endif +#define DEBUG_MENU FALSE + #endif // GUARD_DEBUG_H \ No newline at end of file diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index fa607cd42e..916287b0b7 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -132,7 +132,7 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; - +#if DEBUGGING && !DEBUG_MENU //DEBUG if (heldKeys & R_BUTTON) { @@ -158,7 +158,7 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) input->pressedStartButton = FALSE; } } - // +#endif } @@ -219,7 +219,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; -#if DEBUGGING +#if DEBUGGING && !DEBUG_MENU if (input->input_field_1_2) { PlaySE(SE_WIN_OPEN); diff --git a/src/start_menu.c b/src/start_menu.c index fa51766e8e..b765761513 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -3,6 +3,7 @@ #include "battle_pyramid.h" #include "battle_pyramid_bag.h" #include "bg.h" +#include "debug.h" #include "event_data.h" #include "event_object_movement.h" #include "event_object_lock.h" @@ -61,7 +62,8 @@ enum MENU_ACTION_PLAYER_LINK, MENU_ACTION_REST_FRONTIER, MENU_ACTION_RETIRE_FRONTIER, - MENU_ACTION_PYRAMID_BAG + MENU_ACTION_PYRAMID_BAG, + MENU_ACTION_DEBUG, }; // Save status @@ -102,6 +104,7 @@ static bool8 StartMenuSafariZoneRetireCallback(void); static bool8 StartMenuLinkModePlayerNameCallback(void); static bool8 StartMenuBattlePyramidRetireCallback(void); static bool8 StartMenuBattlePyramidBagCallback(void); +static bool8 StartMenuDebugCallback(void); // Menu callbacks static bool8 SaveStartCallback(void); @@ -153,6 +156,8 @@ static const u8* const sPyramindFloorNames[] = static const struct WindowTemplate sPyramidFloorWindowTemplate_2 = {0, 1, 1, 0xA, 4, 0xF, 8}; static const struct WindowTemplate sPyramidFloorWindowTemplate_1 = {0, 1, 1, 0xC, 4, 0xF, 8}; +static const u8 gText_MenuDebug[] = _("DEBUG"); + static const struct MenuAction sStartMenuItems[] = { {gText_MenuPokedex, {.u8_void = StartMenuPokedexCallback}}, @@ -167,7 +172,8 @@ static const struct MenuAction sStartMenuItems[] = {gText_MenuPlayer, {.u8_void = StartMenuLinkModePlayerNameCallback}}, {gText_MenuRest, {.u8_void = StartMenuSaveCallback}}, {gText_MenuRetire, {.u8_void = StartMenuBattlePyramidRetireCallback}}, - {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}} + {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}}, + {gText_MenuDebug, {.u8_void = StartMenuDebugCallback}}, }; static const struct BgTemplate sUnknown_085105A8[] = @@ -195,6 +201,7 @@ static const struct WindowTemplate sSaveInfoWindowTemplate = {0, 1, 1, 0xE, 0xA, static void BuildStartMenuActions(void); static void AddStartMenuAction(u8 action); static void BuildNormalStartMenu(void); +static void BuildDebugStartMenu(void); static void BuildSafariZoneStartMenu(void); static void BuildLinkModeStartMenu(void); static void BuildUnionRoomStartMenu(void); @@ -223,6 +230,7 @@ static void CB2_SaveAfterLinkBattle(void); static void ShowSaveInfoWindow(void); static void RemoveSaveInfoWindow(void); static void HideStartMenuWindow(void); +static void HideStartMenuDebug(void); void SetDexPokemonPokenavFlags(void) // unused { @@ -259,10 +267,17 @@ static void BuildStartMenuActions(void) { BuildMultiPartnerRoomStartMenu(); } + #if DEBUGGING && DEBUG_MENU + else + { + BuildDebugStartMenu(); + } + #else else - { - BuildNormalStartMenu(); - } + { + BuildNormalStartMenu(); + } + #endif } static void AddStartMenuAction(u8 action) @@ -294,6 +309,30 @@ static void BuildNormalStartMenu(void) AddStartMenuAction(MENU_ACTION_EXIT); } +static void BuildDebugStartMenu(void) +{ + if (FlagGet(FLAG_SYS_POKEDEX_GET) == TRUE) + { + AddStartMenuAction(MENU_ACTION_POKEDEX); + } + if (FlagGet(FLAG_SYS_POKEMON_GET) == TRUE) + { + AddStartMenuAction(MENU_ACTION_POKEMON); + } + + AddStartMenuAction(MENU_ACTION_BAG); + + if (FlagGet(FLAG_SYS_POKENAV_GET) == TRUE) + { + AddStartMenuAction(MENU_ACTION_POKENAV); + } + + AddStartMenuAction(MENU_ACTION_PLAYER); + AddStartMenuAction(MENU_ACTION_SAVE); + AddStartMenuAction(MENU_ACTION_OPTION); + AddStartMenuAction(MENU_ACTION_DEBUG); +} + static void BuildSafariZoneStartMenu(void) { AddStartMenuAction(MENU_ACTION_RETIRE_SAFARI); @@ -575,6 +614,7 @@ static bool8 HandleStartMenuInput(void) if (gMenuCallback != StartMenuSaveCallback && gMenuCallback != StartMenuExitCallback + && gMenuCallback != StartMenuDebugCallback && gMenuCallback != StartMenuSafariZoneRetireCallback && gMenuCallback != StartMenuBattlePyramidRetireCallback) { @@ -710,6 +750,18 @@ static bool8 StartMenuExitCallback(void) return TRUE; } +static bool8 StartMenuDebugCallback(void) +{ + RemoveExtraStartMenuWindows(); + HideStartMenuDebug(); // Hide start menu without enabling movement + + #if DEBUGGING + Debug_ShowMainMenu(); + #endif + + return TRUE; +} + static bool8 StartMenuSafariZoneRetireCallback(void) { RemoveExtraStartMenuWindows(); @@ -719,6 +771,13 @@ static bool8 StartMenuSafariZoneRetireCallback(void) return TRUE; } +static void HideStartMenuDebug(void) +{ + PlaySE(SE_SELECT); + ClearStdWindowAndFrame(GetStartMenuWindowId(), TRUE); + RemoveStartMenuWindow(); +} + static bool8 StartMenuLinkModePlayerNameCallback(void) { if (!gPaletteFade.active) From 5104293344cb469379dae051eb92d007f6fc7c5d Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Thu, 18 Nov 2021 15:09:06 +0100 Subject: [PATCH 27/37] Changed to TX_DEBUGGING define instead of makefile DEBUGGING option --- Makefile | 54 +++++++++------------------- include/debug.h | 9 ++--- src/debug.c | 3 -- src/event_object_movement.c | 8 ++--- src/field_control_avatar.c | 71 ++++++++++++++++++++----------------- src/start_menu.c | 14 +++++--- src/trainer_see.c | 8 ++--- 7 files changed, 76 insertions(+), 91 deletions(-) diff --git a/Makefile b/Makefile index 7ea5bdb926..ca282d07e6 100644 --- a/Makefile +++ b/Makefile @@ -63,13 +63,13 @@ ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN) ifeq ($(MODERN),0) CC1 := tools/agbcc/bin/agbcc$(EXE) -override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -g +override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm ROM := pokeemerald.gba OBJ_DIR := build/emerald LIBPATH := -L ../../tools/agbcc/lib else CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet -override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -g +override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mcpu=arm7tdmi -fno-toplevel-reorder -Wno-pointer-to-int-cast ROM := pokeemerald_modern.gba OBJ_DIR := build/modern LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))" @@ -111,13 +111,13 @@ MAKEFLAGS += --no-print-directory # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern debugging debugging_modern +.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) # Build tools when building the rom # Disable dependency scanning for clean/tidy/tools -ifeq (,$(filter-out all rom compare modern debugging debugging_modern berry_fix libagbsyscall,$(MAKECMDGOALS))) +ifeq (,$(filter-out all rom compare modern berry_fix libagbsyscall,$(MAKECMDGOALS))) $(call infoshell, $(MAKE) tools) else NODEP := 1 @@ -136,9 +136,6 @@ C_ASM_OBJS := $(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o,$(C_ASM_SRCS)) ASM_SRCS := $(wildcard $(ASM_SUBDIR)/*.s) ASM_OBJS := $(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o,$(ASM_SRCS)) -# get all the data/*.s files EXCEPT the ones with specific rules -REGULAR_DATA_ASM_SRCS := $(filter-out $(DATA_ASM_SUBDIR)/maps.s $(DATA_ASM_SUBDIR)/map_events.s, $(wildcard $(DATA_ASM_SUBDIR)/*.s)) - DATA_ASM_SRCS := $(wildcard $(DATA_ASM_SUBDIR)/*.s) DATA_ASM_OBJS := $(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o,$(DATA_ASM_SRCS)) @@ -181,7 +178,7 @@ mostlyclean: tidy rm -f $(SAMPLE_SUBDIR)/*.bin rm -f $(CRY_SUBDIR)/*.bin rm -f $(MID_SUBDIR)/*.s - find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + + find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} + @@ -251,12 +248,6 @@ ifeq ($(DINFO),1) override CFLAGS += -g endif -# Debug menu -ifeq ($(DDEBUGGING),1) -override ASFLAGS += --defsym DEBUGGING=1 -override CPPFLAGS += -D DEBUGGING=1 -endif - $(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep) @$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i @$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s @@ -284,33 +275,24 @@ endif $(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s $$(c_asm_dep) $(AS) $(ASFLAGS) -o $@ $< -# The dep rules have to be explicit or else missing files won't be reported. -# As a side effect, they're evaluated immediately instead of when the rule is invoked. -# It doesn't look like $(shell) can be deferred so there might not be a better way. - - ifeq ($(NODEP),1) -$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s +$(ASM_BUILDDIR)/%.o: asm_dep := +else +$(ASM_BUILDDIR)/%.o: asm_dep = $(shell $(SCANINC) -I "" $(ASM_SUBDIR)/$*.s) +endif + +$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s $$(asm_dep) $(AS) $(ASFLAGS) -o $@ $< -else -define ASM_DEP -$1: $2 $$(shell $(SCANINC) -I include -I "" $2) - $$(AS) $$(ASFLAGS) -o $$@ $$< -endef -$(foreach src, $(ASM_SRCS), $(eval $(call ASM_DEP,$(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o, $(src)),$(src)))) -endif ifeq ($(NODEP),1) -$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s - $(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@ +$(DATA_ASM_BUILDDIR)/%.o: data_dep := else -define DATA_ASM_DEP -$1: $2 $$(shell $(SCANINC) -I include -I "" $2) - $$(PREPROC) $$< charmap.txt | $$(CPP) -I include | $$(AS) $$(ASFLAGS) -o $$@ -endef -$(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call DATA_ASM_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src)))) +$(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $(DATA_ASM_SUBDIR)/$*.s) endif +$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s $$(data_dep) + $(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@ + $(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s $(AS) $(ASFLAGS) -I sound -o $@ $< @@ -351,7 +333,3 @@ berry_fix: libagbsyscall: @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) - -# Debug menu -debugging: ; @$(MAKE) DDEBUGGING=1 DINFO=1 -debugging_modern: ; @$(MAKE) MODERN=1 DDEBUGGING=1 DINFO=1 diff --git a/include/debug.h b/include/debug.h index 864176e4f3..1014690a5a 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,10 +1,11 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H -#if DEBUGGING -void Debug_ShowMainMenu(void); -#endif +#define TX_DEBUGGING +#define TX_DEBUG_MENU_OPTION FALSE + + +void Debug_ShowMainMenu(void); -#define DEBUG_MENU FALSE #endif // GUARD_DEBUG_H \ No newline at end of file diff --git a/src/debug.c b/src/debug.c index 8cb5ddbaca..ae3ff02e0b 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,4 +1,3 @@ -#if DEBUGGING //CREDITS //TheXaman: https://github.com/TheXaman/pokeemerald/tree/tx_debug_system //CODE USED FROM: @@ -3626,5 +3625,3 @@ static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)) } */ - -#endif diff --git a/src/event_object_movement.c b/src/event_object_movement.c index de17be1254..44686fefe7 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4724,10 +4724,10 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; -#if DEBUGGING //DEBUG - if (FlagGet(FLAG_SYS_NO_COLLISION)) - return COLLISION_NONE; -#endif // + #ifdef TX_DEBUGGING //DEBUG + if (FlagGet(FLAG_SYS_NO_COLLISION)) + return COLLISION_NONE; + #endif // if (IsCoordOutsideObjectEventMovementRange(objectEvent, x, y)) return COLLISION_OUTSIDE_RANGE; diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 916287b0b7..3089c13671 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -132,34 +132,36 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; -#if DEBUGGING && !DEBUG_MENU //DEBUG - if (heldKeys & R_BUTTON) - { - if(input->pressedSelectButton) + #ifdef TX_DEBUGGING + if (!TX_DEBUG_MENU_OPTION) { - input->input_field_1_0 = TRUE; - input->pressedSelectButton = FALSE; - }else if(input->pressedStartButton) - { - input->input_field_1_2 = TRUE; - input->pressedStartButton = FALSE; + if (heldKeys & R_BUTTON) + { + if(input->pressedSelectButton) + { + input->input_field_1_0 = TRUE; + input->pressedSelectButton = FALSE; + }else if(input->pressedStartButton) + { + input->input_field_1_2 = TRUE; + input->pressedStartButton = FALSE; + } + } + if (heldKeys & L_BUTTON) + { + if(input->pressedSelectButton) + { + input->input_field_1_1 = TRUE; + input->pressedSelectButton = FALSE; + }else if(input->pressedStartButton) + { + input->input_field_1_3 = TRUE; + input->pressedStartButton = FALSE; + } + } } - } - if (heldKeys & L_BUTTON) - { - if(input->pressedSelectButton) - { - input->input_field_1_1 = TRUE; - input->pressedSelectButton = FALSE; - }else if(input->pressedStartButton) - { - input->input_field_1_3 = TRUE; - input->pressedStartButton = FALSE; - } - } -#endif - + #endif } int ProcessPlayerFieldInput(struct FieldInput *input) @@ -219,14 +221,17 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; -#if DEBUGGING && !DEBUG_MENU - if (input->input_field_1_2) - { - PlaySE(SE_WIN_OPEN); - Debug_ShowMainMenu(); - return TRUE; - } -#endif + #ifdef TX_DEBUGGING + if (!TX_DEBUG_MENU_OPTION) + { + if (input->input_field_1_2) + { + PlaySE(SE_WIN_OPEN); + Debug_ShowMainMenu(); + return TRUE; + } + } + #endif return FALSE; } diff --git a/src/start_menu.c b/src/start_menu.c index b765761513..75bdc618a0 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -267,16 +267,20 @@ static void BuildStartMenuActions(void) { BuildMultiPartnerRoomStartMenu(); } - #if DEBUGGING && DEBUG_MENU - else + #ifdef TX_DEBUGGING + if (TX_DEBUG_MENU_OPTION) { BuildDebugStartMenu(); } - #else - else + else { BuildNormalStartMenu(); } + #else + else + { + BuildNormalStartMenu(); + } #endif } @@ -755,7 +759,7 @@ static bool8 StartMenuDebugCallback(void) RemoveExtraStartMenuWindows(); HideStartMenuDebug(); // Hide start menu without enabling movement - #if DEBUGGING + #ifdef TX_DEBUGGING Debug_ShowMainMenu(); #endif diff --git a/src/trainer_see.c b/src/trainer_see.c index 83783469c1..4ca19cd7f0 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -177,10 +177,10 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; -#if DEBUGGING //DEBUG - if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) - return FALSE; -#endif // + #ifdef TX_DEBUGGING //DEBUG + if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) + return FALSE; + #endif // gNoOfApproachingTrainers = 0; gApproachingTrainerId = 0; From 578056000725b370e57bee22de8967ed658ec66d Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 28 Nov 2021 20:28:54 +0100 Subject: [PATCH 28/37] fixed some bugs, thanks to cbt --- include/pokemon.h | 1 + src/debug.c | 8 ++++---- src/event_object_movement.c | 1 + src/item_use.c | 2 +- src/pokemon.c | 3 +-- src/trainer_see.c | 1 + 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 315416c383..f3f7586888 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -348,6 +348,7 @@ void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg); void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg); void CopyMon(void *dest, void *src, size_t size); u8 GiveMonToPlayer(struct Pokemon *mon); +u8 SendMonToPC(struct Pokemon* mon); u8 CalculatePlayerPartyCount(void); u8 CalculateEnemyPartyCount(void); u8 GetMonsStateToDoubles(void); diff --git a/src/debug.c b/src/debug.c index ae3ff02e0b..ec8c1251ff 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1683,8 +1683,8 @@ static void DebugAction_Give_Item(u8 taskId) 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]].pos2.x = DEBUG_NUMBER_ICON_X+10; - gSprites[gTasks[taskId].data[6]].pos2.y = DEBUG_NUMBER_ICON_Y+10; + 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; } static void DebugAction_Give_Item_SelectId(u8 taskId) @@ -1728,8 +1728,8 @@ static void DebugAction_Give_Item_SelectId(u8 taskId) 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]].pos2.x = DEBUG_NUMBER_ICON_X+10; - gSprites[gTasks[taskId].data[6]].pos2.y = DEBUG_NUMBER_ICON_Y+10; + 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; } diff --git a/src/event_object_movement.c b/src/event_object_movement.c index a782872d69..054f1d233d 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -2,6 +2,7 @@ #include "malloc.h" #include "battle_pyramid.h" #include "berry.h" +#include "debug.h" #include "decoration.h" #include "event_data.h" #include "event_object_movement.h" diff --git a/src/item_use.c b/src/item_use.c index b875b19103..de14e3ab9e 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -943,7 +943,7 @@ void ItemUseInBattle_PokeBall(u8 taskId) { if (FlagGet(FLAG_SYS_NO_CATCHING)){ //DEBUG static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); - DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, BagMenu_InitListsMenu); + DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); } // else if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? { diff --git a/src/pokemon.c b/src/pokemon.c index 1607e1a40f..0cbb127a6d 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -61,7 +61,6 @@ static void Task_PlayMapChosenOrBattleBGM(u8 taskId); static bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId); static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static bool8 ShouldSkipFriendshipChange(void); -static u8 SendMonToPC(struct Pokemon* mon); EWRAM_DATA static u8 sLearningMoveTableID = 0; EWRAM_DATA u8 gPlayerPartyCount = 0; @@ -4385,7 +4384,7 @@ u8 GiveMonToPlayer(struct Pokemon *mon) return MON_GIVEN_TO_PARTY; } -static u8 SendMonToPC(struct Pokemon* mon) +u8 SendMonToPC(struct Pokemon* mon) { s32 boxNo, boxPos; diff --git a/src/trainer_see.c b/src/trainer_see.c index b3f4a77bd0..dfc898cf76 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -1,5 +1,6 @@ #include "global.h" #include "battle_setup.h" +#include "debug.h" #include "event_data.h" #include "event_object_movement.h" #include "field_effect.h" From df8dfd9a6520828488e9a7da972bf65b04110daa Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sun, 28 Nov 2021 20:53:23 +0100 Subject: [PATCH 29/37] added #ifdef TX_DEBUGGING for wild encounter, bag use and catching flags --- src/battle_main.c | 9 +++++++++ src/field_control_avatar.c | 2 ++ src/item_use.c | 10 +++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index 944efd1639..133daa1963 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -15,6 +15,7 @@ #include "berry.h" #include "bg.h" #include "data.h" +#include "debug.h" #include "decompress.h" #include "dma3.h" #include "event_data.h" @@ -4187,11 +4188,19 @@ static void HandleTurnActionSelectionState(void) } break; case B_ACTION_USE_ITEM: + #ifdef TX_DEBUGGING if (FlagGet(FLAG_SYS_NO_BAG_USE) || gBattleTypeFlags & (BATTLE_TYPE_LINK //DEBUG | BATTLE_TYPE_FRONTIER_NO_PYRAMID | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK)) { + #else + if (gBattleTypeFlags & (BATTLE_TYPE_LINK //DEBUG + | BATTLE_TYPE_FRONTIER_NO_PYRAMID + | BATTLE_TYPE_EREADER_TRAINER + | BATTLE_TYPE_RECORDED_LINK)) + { + #endif RecordedBattle_ClearBattlerAction(gActiveBattler, 1); gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 1e25f89b33..1916d60ff2 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -713,8 +713,10 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { + #ifdef TX_DEBUGGING if (FlagGet(FLAG_SYS_NO_ENCOUNTER)) //DEBUG return FALSE;// + #endif if (sWildEncounterImmunitySteps < 4) { diff --git a/src/item_use.c b/src/item_use.c index de14e3ab9e..6e33dad33e 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -8,6 +8,7 @@ #include "bike.h" #include "coins.h" #include "data.h" +#include "debug.h" #include "event_data.h" #include "event_object_lock.h" #include "event_object_movement.h" @@ -941,11 +942,14 @@ void ItemUseOutOfBattle_EvolutionStone(u8 taskId) void ItemUseInBattle_PokeBall(u8 taskId) { + #ifdef TX_DEBUGGING if (FlagGet(FLAG_SYS_NO_CATCHING)){ //DEBUG static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); - DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); - } // - else if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? + DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); + return; + } + #endif + if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? { RemoveBagItem(gSpecialVar_ItemId, 1); if (!InBattlePyramid()) From 224b9a15493c6c734425980cca26289e34409d71 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 21 Feb 2022 20:29:46 -0300 Subject: [PATCH 30/37] Fixed softlock when pressing the start button while in link room --- src/start_menu.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/start_menu.c b/src/start_menu.c index 71fb78f68d..a9ecb2c47b 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -283,21 +283,17 @@ static void BuildStartMenuActions(void) { BuildMultiPartnerRoomStartMenu(); } - #ifdef TX_DEBUGGING - if (TX_DEBUG_MENU_OPTION) - { - BuildDebugStartMenu(); - } - else - { - BuildNormalStartMenu(); - } - #else - else - { - BuildNormalStartMenu(); - } - #endif +#if defined(TX_DEBUGGING) && TX_DEBUG_MENU_OPTION + else + { + BuildDebugStartMenu(); + } +#else + else + { + BuildNormalStartMenu(); + } +#endif } static void AddStartMenuAction(u8 action) From e0885523981048f0f97ec5f1c413e0481f73c189 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 7 Mar 2022 21:17:31 -0300 Subject: [PATCH 31/37] Fixed going out of bounds when choosing a move for detailed Give Mon --- src/debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/debug.c b/src/debug.c index ec8c1251ff..255ac335fd 100644 --- a/src/debug.c +++ b/src/debug.c @@ -2389,8 +2389,8 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) if(gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > MOVES_COUNT) - gTasks[taskId].data[3] = MOVES_COUNT; + if(gTasks[taskId].data[3] >= MOVES_COUNT) + gTasks[taskId].data[3] = MOVES_COUNT - 1; } if(gMain.newKeys & DPAD_DOWN) { @@ -2574,7 +2574,7 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu //Moves for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] == 0 || moves[i] == 0xFF || moves[i] > MOVES_COUNT) + if (moves[i] == 0 || moves[i] == 0xFF || moves[i] >= MOVES_COUNT) continue; SetMonMoveSlot(&mon, moves[i], i); From 315813d186733b2cf8784d9270e4300213b00757 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 16 Mar 2022 10:38:07 -0300 Subject: [PATCH 32/37] Update debug.c --- src/debug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/debug.c b/src/debug.c index 255ac335fd..9fa7d73213 100644 --- a/src/debug.c +++ b/src/debug.c @@ -276,7 +276,11 @@ extern u8 Debug_ShowFieldMessageStringVar4[]; extern u8 Debug_CheatStart[]; extern u8 PlayersHouse_2F_EventScript_SetWallClock[]; extern u8 PlayersHouse_2F_EventScript_CheckWallClock[]; +#ifdef BATTLE_ENGINE +#define ABILITY_NAME_LENGTH 16 +#else #define ABILITY_NAME_LENGTH 12 +#endif extern const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1]; From 0036a4dc36c766fd3de8ea6484cc46679548b0a6 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Fri, 18 Mar 2022 13:30:08 -0400 Subject: [PATCH 33/37] pc acccess --- include/constants/flags.h | 2 +- include/pokemon_storage_system.h | 2 ++ src/debug.c | 33 ++++++++++++++++++++++---------- src/pokemon_storage_system.c | 15 +++++++++------ 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/include/constants/flags.h b/include/constants/flags.h index 4d5a7c1166..cab8b51e5f 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -46,7 +46,7 @@ #define FLAG_SYS_NO_TRAINER_SEE 0x22 // Unused Flag //DEBUG #define FLAG_SYS_NO_BAG_USE 0x23 // Unused Flag //DEBUG #define FLAG_SYS_NO_CATCHING 0x24 // Unused Flag //DEBUG -#define FLAG_UNUSED_0x025 0x25 // Unused Flag +#define FLAG_SYS_PC_FROM_DEBUG_MENU 0x25 // Unused Flag //DEBUG #define FLAG_UNUSED_0x026 0x26 // Unused Flag #define FLAG_UNUSED_0x027 0x27 // Unused Flag #define FLAG_UNUSED_0x028 0x28 // Unused Flag diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index b7fca23311..a4575ac9ab 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -72,4 +72,6 @@ u8 *GetWaldaPhrasePtr(void); void SetWaldaPhrase(const u8 *src); bool32 IsWaldaPhraseEmpty(void); +void EnterPokeStorage(u8 boxOption); + #endif // GUARD_POKEMON_STORAGE_SYSTEM_H diff --git a/src/debug.c b/src/debug.c index 9fa7d73213..0e464fa8b9 100644 --- a/src/debug.c +++ b/src/debug.c @@ -31,6 +31,7 @@ #include "naming_screen.h" #include "new_game.h" #include "overworld.h" +#include "palette.h" #include "pokedex.h" #include "pokemon.h" #include "pokemon_icon.h" @@ -48,6 +49,7 @@ #include "constants/flags.h" #include "constants/items.h" #include "constants/map_groups.h" +#include "constants/rgb.h" #include "constants/songs.h" #include "constants/species.h" @@ -61,6 +63,7 @@ enum { // Main DEBUG_MENU_ITEM_VARS, DEBUG_MENU_ITEM_GIVE, DEBUG_MENU_ITEM_SOUND, + DEBUG_MENU_ITEM_ACCESS_PC, DEBUG_MENU_ITEM_CANCEL }; enum { // Util @@ -115,7 +118,6 @@ enum { // Give DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG, DEBUG_GIVE_MENU_ITEM_FILL_PC, DEBUG_GIVE_MENU_ITEM_CHEAT, - //DEBUG_MENU_ITEM_ACCESS_PC, }; enum { //Sound DEBUG_SOUND_MENU_ITEM_SE, @@ -374,7 +376,7 @@ static const u8 gDebugText_Give_MaxCoins[] = _("Max Coins"); static const u8 gDebugText_Give_DaycareEgg[] = _("Daycare Egg"); static const u8 gDebugText_Give_FillPc[] = _("Fill Pc"); static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT Start"); -// static const u8 gDebugText_Give_AccessPC[] = _("Access PC"); +static const u8 gDebugText_AccessPC[] = _("Access PC"); // Sound Mneu static const u8 gDebugText_Sound_SE[] = _("Effects"); static const u8 gDebugText_Sound_SE_ID[] = _("Sound Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); @@ -425,6 +427,7 @@ static const struct ListMenuItem sDebugMenu_Items_Main[] = [DEBUG_MENU_ITEM_VARS] = {gDebugText_Vars, DEBUG_MENU_ITEM_VARS}, [DEBUG_MENU_ITEM_GIVE] = {gDebugText_Give, DEBUG_MENU_ITEM_GIVE}, [DEBUG_MENU_ITEM_SOUND] = {gDebugText_Sound, DEBUG_MENU_ITEM_SOUND}, + [DEBUG_MENU_ITEM_ACCESS_PC] = {gDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, [DEBUG_MENU_ITEM_CANCEL] = {gDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL} }; static const struct ListMenuItem sDebugMenu_Items_Utilities[] = @@ -484,7 +487,6 @@ static const struct ListMenuItem sDebugMenu_Items_Give[] = [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = {gDebugText_Give_DaycareEgg, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG}, [DEBUG_GIVE_MENU_ITEM_FILL_PC] = {gDebugText_Give_FillPc, DEBUG_GIVE_MENU_ITEM_FILL_PC}, [DEBUG_GIVE_MENU_ITEM_CHEAT] = {gDebugText_Give_GiveCHEAT, DEBUG_GIVE_MENU_ITEM_CHEAT}, - //[DEBUG_MENU_ITEM_ACCESS_PC] = {gDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, }; static const struct ListMenuItem sDebugMenu_Items_Sound[] = { @@ -502,6 +504,7 @@ static void (*const sDebugMenu_Actions_Main[])(u8) = [DEBUG_MENU_ITEM_VARS] = DebugAction_OpenVariablesMenu, [DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu, [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) = @@ -561,7 +564,6 @@ static void (*const sDebugMenu_Actions_Give[])(u8) = [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = DebugAction_Give_DayCareEgg, [DEBUG_GIVE_MENU_ITEM_FILL_PC] = DebugAction_Give_FillPC, [DEBUG_GIVE_MENU_ITEM_CHEAT] = DebugAction_Give_CHEAT, - //[DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, }; static void (*const sDebugMenu_Actions_Sound[])(u8) = { @@ -2690,12 +2692,23 @@ static void DebugAction_Give_CHEAT(u8 taskId) ScriptContext1_SetupScript(Debug_CheatStart); } -// static void DebugAction_AccessPC(u8 taskId) -// { -// Debug_DestroyMenu(taskId); -// PlaySE(SE_PC_ON); -// ScriptContext1_SetupScript(EventScript_PC); -// } +static void Task_WaitFadeAccessPC(u8 taskId) +{ + if (!gPaletteFade.active) + { + DestroyTask(taskId); + FlagSet(FLAG_SYS_PC_FROM_DEBUG_MENU); + EnterPokeStorage(2); + } +} + +static void DebugAction_AccessPC(u8 taskId) +{ + Debug_DestroyMenu(taskId); + CleanupOverworldWindowsAndTilemaps(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + CreateTask(Task_WaitFadeAccessPC, 0); +} // ******************************* diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index f18dc68d13..62966e8e09 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -571,7 +571,6 @@ EWRAM_DATA static u8 sMovingMonOrigBoxPos = 0; EWRAM_DATA static bool8 sAutoActionOn = 0; // Main tasks -static void EnterPokeStorage(u8); static void Task_InitPokeStorage(u8); static void Task_PlaceMon(u8); static void Task_ChangeScreen(u8); @@ -1676,10 +1675,14 @@ static void FieldTask_ReturnToPcMenu(void) MainCallback vblankCb = gMain.vblankCallback; SetVBlankCallback(NULL); - taskId = CreateTask(Task_PCMainMenu, 80); - gTasks[taskId].tState = 0; - gTasks[taskId].tSelectedOption = sPreviousBoxOption; - Task_PCMainMenu(taskId); + if (!FlagGet(FLAG_SYS_PC_FROM_DEBUG_MENU)) { + taskId = CreateTask(Task_PCMainMenu, 80); + gTasks[taskId].tState = 0; + gTasks[taskId].tSelectedOption = sPreviousBoxOption; + Task_PCMainMenu(taskId); + } else { + FlagClear(FLAG_SYS_PC_FROM_DEBUG_MENU); + } SetVBlankCallback(vblankCb); FadeInFromBlack(); } @@ -2009,7 +2012,7 @@ static void CB2_PokeStorage(void) BuildOamBuffer(); } -static void EnterPokeStorage(u8 boxOption) +void EnterPokeStorage(u8 boxOption) { ResetTasks(); sCurrentBoxOption = boxOption; From 192969c492d4df5be40f9b1860f9e9f22e89011e Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Fri, 18 Mar 2022 20:47:12 +0100 Subject: [PATCH 34/37] small fix --- src/pokemon_storage_system.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 62966e8e09..4ead75965e 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1682,6 +1682,7 @@ static void FieldTask_ReturnToPcMenu(void) Task_PCMainMenu(taskId); } else { FlagClear(FLAG_SYS_PC_FROM_DEBUG_MENU); + EnableBothScriptContexts(); } SetVBlankCallback(vblankCb); FadeInFromBlack(); From cbe8f3000104a841132dbb61f7109ea6bd9d76b2 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Sat, 21 May 2022 12:54:02 +0200 Subject: [PATCH 35/37] added FLAG_ADVENTURE_STARTED to cheat start --- data/scripts/debug.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index 70401564e9..4ced7d9716 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -15,6 +15,7 @@ Debug_CheatStart:: setflag FLAG_SYS_POKEMON_GET setflag FLAG_RESCUED_BIRCH setflag FLAG_HIDE_ROUTE_101_BIRCH_ZIGZAGOON_BATTLE + setflag FLAG_ADVENTURE_STARTED clearflag FLAG_HIDE_LITTLEROOT_TOWN_BIRCHS_LAB_BIRCH setflag FLAG_HIDE_ROUTE_101_BIRCH_STARTERS_BAG setvar VAR_BIRCH_LAB_STATE, 2 From 94183b45c7c0acdf61233c284de5a143f30533ae Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 29 Aug 2022 14:48:40 +0200 Subject: [PATCH 36/37] Added options for ttoggling battle frontier pass and giving max BPs --- src/debug.c | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/src/debug.c b/src/debug.c index 0e464fa8b9..69b346fb86 100644 --- a/src/debug.c +++ b/src/debug.c @@ -46,6 +46,7 @@ #include "task.h" #include "pokemon_summary_screen.h" #include "constants/abilities.h" +#include "constants/battle_frontier.h" #include "constants/flags.h" #include "constants/items.h" #include "constants/map_groups.h" @@ -99,6 +100,7 @@ enum { // Flags DEBUG_FLAG_MENU_ITEM_POKENAVONOFF, DEBUG_FLAG_MENU_ITEM_FLYANYWHERE, DEBUG_FLAG_MENU_ITEM_GETALLBADGES, + DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS, DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF, DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF, DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF, @@ -115,6 +117,7 @@ enum { // Give DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX, DEBUG_GIVE_MENU_ITEM_MAX_MONEY, DEBUG_GIVE_MENU_ITEM_MAX_COINS, + DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG, DEBUG_GIVE_MENU_ITEM_FILL_PC, DEBUG_GIVE_MENU_ITEM_CHEAT, @@ -127,7 +130,7 @@ enum { //Sound // ******************************* // Constants -#define DEBUG_MAIN_MENU_WIDTH 13 +#define DEBUG_MAIN_MENU_WIDTH 15 #define DEBUG_MAIN_MENU_HEIGHT 8 #define DEBUG_NUMBER_DISPLAY_WIDTH 10 @@ -220,17 +223,18 @@ static void DebugAction_Util_Trainer_Id(u8); static void DebugAction_Flags_Flags(u8 taskId); static void DebugAction_Flags_FlagsSelect(u8 taskId); -static void DebugAction_Flags_SetPokedexFlags(u8); -static void DebugAction_Flags_SwitchDex(u8); -static void DebugAction_Flags_SwitchNatDex(u8); -static void DebugAction_Flags_SwitchPokeNav(u8); -static void DebugAction_Flags_ToggleFlyFlags(u8); -static void DebugAction_Flags_ToggleBadgeFlags(u8); -static void DebugAction_Flags_CollisionOnOff(u8); -static void DebugAction_Flags_EncounterOnOff(u8); -static void DebugAction_Flags_TrainerSeeOnOff(u8); -static void DebugAction_Flags_BagUseOnOff(u8); -static void DebugAction_Flags_CatchingOnOff(u8); +static void DebugAction_Flags_SetPokedexFlags(u8 taskId); +static void DebugAction_Flags_SwitchDex(u8 taskId); +static void DebugAction_Flags_SwitchNatDex(u8 taskId); +static void DebugAction_Flags_SwitchPokeNav(u8 taskId); +static void DebugAction_Flags_ToggleFlyFlags(u8 taskId); +static void DebugAction_Flags_ToggleBadgeFlags(u8 taskId); +static void DebugAction_Flags_ToggleFrontierPass(u8 taskId); +static void DebugAction_Flags_CollisionOnOff(u8 taskId); +static void DebugAction_Flags_EncounterOnOff(u8 taskId); +static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId); +static void DebugAction_Flags_BagUseOnOff(u8 taskId); +static void DebugAction_Flags_CatchingOnOff(u8 taskId); static void DebugAction_Vars_Vars(u8 taskId); static void DebugAction_Vars_Select(u8 taskId); @@ -252,6 +256,7 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId); static void DebugAction_Give_Pokemon_Move(u8 taskId); static void DebugAction_Give_MaxMoney(u8 taskId); static void DebugAction_Give_MaxCoins(u8 taskId); +static void DebugAction_Give_MaxBattlePoints(u8 taskId); static void DebugAction_Give_DayCareEgg(u8 taskId); static void DebugAction_Give_FillPC(u8 taskId); static void DebugAction_Give_CHEAT(u8 taskId); @@ -288,7 +293,7 @@ extern const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1]; // ******************************* //Maps per map group COPY FROM /include/constants/map_groups.h - static const u8 MAP_GROUP_COUNT[] = {57, 5, 5, 6, 7, 8, 9, 7, 7, 14, 8, 17, 10, 23, 13, 15, 15, 2, 2, 2, 3, 1, 1, 1, 108, 61, 89, 2, 1, 13, 1, 1, 3, 1, 0}; +static const u8 MAP_GROUP_COUNT[] = {57, 5, 5, 6, 7, 8, 9, 7, 7, 14, 8, 17, 10, 23, 13, 15, 15, 2, 2, 2, 3, 1, 1, 1, 108, 61, 89, 2, 1, 13, 1, 1, 3, 1, 0}; // Text // Main Menu @@ -334,6 +339,7 @@ static const u8 gDebugText_Flags_SwitchNationalDex[] = _("NatDex ON/OFF"); static const u8 gDebugText_Flags_SwitchPokeNav[] = _("PokéNav ON/OFF"); static const u8 gDebugText_Flags_ToggleFlyFlags[] = _("Fly Flags ON/OFF"); static const u8 gDebugText_Flags_ToggleAllBadges[] = _("All badges ON/OFF"); +static const u8 gDebugText_Flags_ToggleFrontierPass[] = _("Frontier Pass ON/OFF"); static const u8 gDebugText_Flags_SwitchCollision[] = _("Collision ON/OFF"); static const u8 gDebugText_Flags_SwitchEncounter[] = _("Encounter ON/OFF"); static const u8 gDebugText_Flags_SwitchTrainerSee[] = _("TrainerSee ON/OFF"); @@ -373,6 +379,7 @@ static const u8 gDebugText_PokemonMove_2[] = _("Move 2: {STR_VAR_3} static const u8 gDebugText_PokemonMove_3[] = _("Move 3: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); static const u8 gDebugText_Give_MaxMoney[] = _("Max Money"); static const u8 gDebugText_Give_MaxCoins[] = _("Max Coins"); +static const u8 gDebugText_Give_BattlePoints[] = _("Max Battle Points"); static const u8 gDebugText_Give_DaycareEgg[] = _("Daycare Egg"); static const u8 gDebugText_Give_FillPc[] = _("Fill Pc"); static const u8 gDebugText_Give_GiveCHEAT[] = _("CHEAT Start"); @@ -466,6 +473,7 @@ static const struct ListMenuItem sDebugMenu_Items_Flags[] = [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF] = {gDebugText_Flags_SwitchPokeNav, DEBUG_FLAG_MENU_ITEM_POKENAVONOFF}, [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE] = {gDebugText_Flags_ToggleFlyFlags, DEBUG_FLAG_MENU_ITEM_FLYANYWHERE}, [DEBUG_FLAG_MENU_ITEM_GETALLBADGES] = {gDebugText_Flags_ToggleAllBadges, DEBUG_FLAG_MENU_ITEM_GETALLBADGES}, + [DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS] = {gDebugText_Flags_ToggleFrontierPass, DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS}, [DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF] = {gDebugText_Flags_SwitchCollision, DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF}, [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF] = {gDebugText_Flags_SwitchEncounter, DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF}, [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF]= {gDebugText_Flags_SwitchTrainerSee, DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF}, @@ -484,6 +492,7 @@ static const struct ListMenuItem sDebugMenu_Items_Give[] = [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = {gDebugText_Give_GivePokemonComplex, DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX}, [DEBUG_GIVE_MENU_ITEM_MAX_MONEY] = {gDebugText_Give_MaxMoney, DEBUG_GIVE_MENU_ITEM_MAX_MONEY}, [DEBUG_GIVE_MENU_ITEM_MAX_COINS] = {gDebugText_Give_MaxCoins, DEBUG_GIVE_MENU_ITEM_MAX_COINS}, + [DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS]= {gDebugText_Give_BattlePoints, DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS}, [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = {gDebugText_Give_DaycareEgg, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG}, [DEBUG_GIVE_MENU_ITEM_FILL_PC] = {gDebugText_Give_FillPc, DEBUG_GIVE_MENU_ITEM_FILL_PC}, [DEBUG_GIVE_MENU_ITEM_CHEAT] = {gDebugText_Give_GiveCHEAT, DEBUG_GIVE_MENU_ITEM_CHEAT}, @@ -543,6 +552,7 @@ static void (*const sDebugMenu_Actions_Flags[])(u8) = [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF] = DebugAction_Flags_SwitchPokeNav, [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE] = DebugAction_Flags_ToggleFlyFlags, [DEBUG_FLAG_MENU_ITEM_GETALLBADGES] = DebugAction_Flags_ToggleBadgeFlags, + [DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS] = DebugAction_Flags_ToggleFrontierPass, [DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF] = DebugAction_Flags_CollisionOnOff, [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF] = DebugAction_Flags_EncounterOnOff, [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF]= DebugAction_Flags_TrainerSeeOnOff, @@ -561,6 +571,7 @@ static void (*const sDebugMenu_Actions_Give[])(u8) = [DEBUG_GIVE_MENU_ITEM_POKEMON_COMPLEX] = DebugAction_Give_PokemonComplex, [DEBUG_GIVE_MENU_ITEM_MAX_MONEY] = DebugAction_Give_MaxMoney, [DEBUG_GIVE_MENU_ITEM_MAX_COINS] = DebugAction_Give_MaxCoins, + [DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS]= DebugAction_Give_MaxBattlePoints, [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = DebugAction_Give_DayCareEgg, [DEBUG_GIVE_MENU_ITEM_FILL_PC] = DebugAction_Give_FillPC, [DEBUG_GIVE_MENU_ITEM_CHEAT] = DebugAction_Give_CHEAT, @@ -1424,6 +1435,15 @@ static void DebugAction_Flags_ToggleBadgeFlags(u8 taskId) FlagToggle(FLAG_BADGE07_GET); FlagToggle(FLAG_BADGE08_GET); } +static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) +{ + // Sound effect + if(FlagGet(FLAG_SYS_FRONTIER_PASS)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_SYS_FRONTIER_PASS); +} static void DebugAction_Flags_CollisionOnOff(u8 taskId) { if(FlagGet(FLAG_SYS_NO_COLLISION)) @@ -2651,6 +2671,11 @@ static void DebugAction_Give_MaxCoins(u8 taskId) SetCoins(9999); } +static void DebugAction_Give_MaxBattlePoints(u8 taskId) +{ + gSaveBlock2Ptr->frontier.battlePoints = MAX_BATTLE_FRONTIER_POINTS; +} + static void DebugAction_Give_DayCareEgg(u8 taskId) { TriggerPendingDaycareEgg(); From 006d28fd699dd0acc9f6b0c5263aad754a3cc890 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 29 Aug 2022 14:51:40 +0200 Subject: [PATCH 37/37] tiny fix for wrong "give pokemon" window --- src/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index 69b346fb86..53f86bb7b1 100644 --- a/src/debug.c +++ b/src/debug.c @@ -598,7 +598,7 @@ static const struct WindowTemplate sDebugMenuWindowTemplate = static const struct WindowTemplate sDebugNumberDisplayWindowTemplate = { .bg = 0, - .tilemapLeft = 6 + DEBUG_MAIN_MENU_WIDTH, + .tilemapLeft = 4 + DEBUG_MAIN_MENU_WIDTH, .tilemapTop = 1, .width = DEBUG_NUMBER_DISPLAY_WIDTH, .height = 2 * DEBUG_NUMBER_DISPLAY_HEIGHT,