From 6456009a44cd8721a74acbf434da2e3a136da858 Mon Sep 17 00:00:00 2001 From: TheXaman Date: Sat, 26 Sep 2020 00:51:02 +0200 Subject: [PATCH 001/115] 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 002/115] 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 003/115] 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 004/115] 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 005/115] 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 006/115] 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 007/115] 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 008/115] 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 009/115] 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 010/115] 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 011/115] 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 012/115] 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 013/115] 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 014/115] 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 015/115] 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 016/115] 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 017/115] 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 018/115] 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 019/115] 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 020/115] 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 021/115] 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 022/115] 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 023/115] 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 024/115] 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 025/115] 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 026/115] 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 027/115] 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 028/115] 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 029/115] 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 030/115] 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 031/115] 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 032/115] 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 033/115] 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 034/115] 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 035/115] 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 d0a2be963068072fbdd59f5608cb39dbb0f32c42 Mon Sep 17 00:00:00 2001 From: Sneed69 Date: Sun, 22 May 2022 01:44:51 +0300 Subject: [PATCH 036/115] weather forms fixes and config --- asm/macros/battle_script.inc | 4 +- data/battle_anim_scripts.s | 12 +-- data/battle_scripts_1.s | 27 ++++--- include/battle_scripts.h | 2 +- include/battle_util.h | 2 +- include/constants/battle_config.h | 1 + include/constants/battle_script_commands.h | 5 +- src/battle_script_commands.c | 40 ++++++++-- src/battle_util.c | 93 ++++++++++++++++++---- 9 files changed, 139 insertions(+), 47 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index b434332054..dc258e9aae 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1186,11 +1186,11 @@ .byte 0xe5 .endm - .macro docastformchangeanimation + .macro doweatherformchangeanimation .byte 0xe6 .endm - .macro trycastformdatachange + .macro tryweatherformdatachange .byte 0xe7 .endm diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index d76aff05a6..098419c008 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -796,7 +796,7 @@ gBattleAnims_StatusConditions:: .align 2 gBattleAnims_General:: - .4byte General_CastformChange @ B_ANIM_CASTFORM_CHANGE + .4byte General_WeatherFormChange @ B_ANIM_CASTFORM_CHANGE .4byte General_StatsChange @ B_ANIM_STATS_CHANGE .4byte General_SubstituteFade @ B_ANIM_SUBSTITUTE_FADE .4byte General_SubstituteAppear @ B_ANIM_SUBSTITUTE_APPEAR @@ -24152,11 +24152,11 @@ Status_Nightmare: Status_Powder: end -General_CastformChange: +General_WeatherFormChange: createvisualtask AnimTask_IsMonInvisible, 2 - jumpreteq TRUE, CastformChangeSkipAnim - goto CastformChangeContinue -CastformChangeContinue: + jumpreteq TRUE, WeatherFormChangeSkipAnim + goto WeatherFormChangeContinue +WeatherFormChangeContinue: monbg ANIM_ATTACKER playsewithpan SE_M_TELEPORT, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_MINIMIZE, SOUND_PAN_ATTACKER, 48 @@ -24164,7 +24164,7 @@ CastformChangeContinue: waitforvisualfinish clearmonbg ANIM_ATTACKER end -CastformChangeSkipAnim: +WeatherFormChangeSkipAnim: createvisualtask AnimTask_CastformGfxDataChange, 2, 1 end diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a9c15040d3..c79ba5e9c2 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6511,11 +6511,9 @@ BattleScript_LearnMoveReturn:: BattleScript_RainContinuesOrEnds:: printfromtable gRainContinuesStringIds waitmessage B_WAIT_TIME_LONG - jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainEnds + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainContinuesOrEndsEnd playanimation BS_ATTACKER, B_ANIM_RAIN_CONTINUES - end2 -BattleScript_RainEnds:: - call BattleScript_WeatherFormChanges +BattleScript_RainContinuesOrEndsEnd:: end2 BattleScript_DamagingWeatherContinues:: @@ -6554,7 +6552,6 @@ BattleScript_DamagingWeatherContinuesEnd:: BattleScript_SandStormHailEnds:: printfromtable gSandStormHailEndStringIds waitmessage B_WAIT_TIME_LONG - call BattleScript_WeatherFormChanges end2 BattleScript_SunlightContinues:: @@ -6566,7 +6563,6 @@ BattleScript_SunlightContinues:: BattleScript_SunlightFaded:: printstring STRINGID_SUNLIGHTFADED waitmessage B_WAIT_TIME_LONG - call BattleScript_WeatherFormChanges end2 BattleScript_OverworldWeatherStarts:: @@ -8167,19 +8163,28 @@ BattleScript_ShedSkinActivates:: BattleScript_WeatherFormChanges:: setbyte sBATTLER, 0 BattleScript_WeatherFormChangesLoop:: - trycastformdatachange + tryweatherformdatachange addbyte sBATTLER, 1 jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_WeatherFormChangesLoop return -BattleScript_CastformChange:: - call BattleScript_DoCastformChange +BattleScript_WeatherFormChange:: + call BattleScript_DoWeatherFormChange end3 -BattleScript_DoCastformChange:: +BattleScript_DoWeatherFormChange:: copybyte gBattlerAbility, sBATTLER + jumpifspecies BS_SCRIPTING, SPECIES_CASTFORM, BattleScript_DoWeatherFormChange_ForecastCheck +BattleScript_DoWeatherFormChange_FlowerGiftCheck: + jumpifability BS_SCRIPTING, ABILITY_FLOWER_GIFT, BattleScript_DoWeatherFormChange_PopUp + goto BattleScript_DoWeatherFormChange_AfterPopUp +BattleScript_DoWeatherFormChange_ForecastCheck: + jumpifability BS_SCRIPTING, ABILITY_FORECAST, BattleScript_DoWeatherFormChange_PopUp + goto BattleScript_DoWeatherFormChange_AfterPopUp +BattleScript_DoWeatherFormChange_PopUp: call BattleScript_AbilityPopUp - docastformchangeanimation +BattleScript_DoWeatherFormChange_AfterPopUp: + doweatherformchangeanimation waitstate printstring STRINGID_PKMNTRANSFORMED waitmessage B_WAIT_TIME_LONG diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 4134a87dcf..d44598789f 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -151,7 +151,7 @@ extern const u8 BattleScript_SandstreamActivates[]; extern const u8 BattleScript_ShedSkinActivates[]; extern const u8 BattleScript_WeatherFormChanges[]; extern const u8 BattleScript_WeatherFormChangesLoop[]; -extern const u8 BattleScript_CastformChange[]; +extern const u8 BattleScript_WeatherFormChange[]; extern const u8 BattleScript_IntimidateActivatesEnd3[]; extern const u8 BattleScript_IntimidateActivates[]; extern const u8 BattleScript_DroughtActivates[]; diff --git a/include/battle_util.h b/include/battle_util.h index f1864f0967..4ebe3c8d4e 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -16,7 +16,7 @@ #define ABILITYEFFECT_MOVE_END_ATTACKER 4 #define ABILITYEFFECT_MOVE_END 5 #define ABILITYEFFECT_IMMUNITY 6 -#define ABILITYEFFECT_FORECAST 7 +#define ABILITYEFFECT_WEATHER_FORM 7 #define ABILITYEFFECT_SYNCHRONIZE 8 #define ABILITYEFFECT_ATK_SYNCHRONIZE 9 #define ABILITYEFFECT_INTIMIDATE1 10 diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 74ac9e1299..e68f40fc54 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -190,6 +190,7 @@ #define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. #define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled. #define B_OBLIVIOUS_TAUNT GEN_7 // In Gen6+, Pokémon with Oblivious can't be taunted. +#define B_WEATHER_FORMS GEN_5 // In Gen5+, Castform and Cherrim revert to their base form upon losing their respective ability. Cherrim needs Flower Gift to swap forms. // Item settings #define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index da44714e21..16d911e6fa 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -310,8 +310,9 @@ #define MOVEEND_PICKPOCKET 27 #define MOVEEND_DANCER 28 #define MOVEEND_EMERGENCY_EXIT 29 -#define MOVEEND_CLEAR_BITS 30 -#define MOVEEND_COUNT 31 +#define MOVEEND_WEATHER_FORM 30 +#define MOVEEND_CLEAR_BITS 31 +#define MOVEEND_COUNT 32 // switch cases #define B_SWITCH_NORMAL 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 15915c71a6..7ba9ad1766 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -537,8 +537,8 @@ static void Cmd_switchoutabilities(void); static void Cmd_jumpifhasnohp(void); static void Cmd_getsecretpowereffect(void); static void Cmd_pickup(void); -static void Cmd_docastformchangeanimation(void); -static void Cmd_trycastformdatachange(void); +static void Cmd_doweatherformchangeanimation(void); +static void Cmd_tryweatherformdatachange(void); static void Cmd_settypebasedhalvers(void); static void Cmd_jumpifsubstituteblocks(void); static void Cmd_tryrecycleitem(void); @@ -796,8 +796,8 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_jumpifhasnohp, //0xE3 Cmd_getsecretpowereffect, //0xE4 Cmd_pickup, //0xE5 - Cmd_docastformchangeanimation, //0xE6 - Cmd_trycastformdatachange, //0xE7 + Cmd_doweatherformchangeanimation, //0xE6 + Cmd_tryweatherformdatachange, //0xE7 Cmd_settypebasedhalvers, //0xE8 Cmd_jumpifsubstituteblocks, //0xE9 Cmd_tryrecycleitem, //0xEA @@ -5601,6 +5601,30 @@ static void Cmd_moveend(void) } gBattleScripting.moveendState++; break; + case MOVEEND_WEATHER_FORM: + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { + switch (gBattleMons[i].species) + { + case SPECIES_CASTFORM: + case SPECIES_CHERRIM: +#ifdef POKEMON_EXPANSION + case SPECIES_CASTFORM_RAINY: + case SPECIES_CASTFORM_SNOWY: + case SPECIES_CASTFORM_SUNNY: + case SPECIES_CHERRIM_SUNSHINE: +#endif + effect = TryWeatherFormChange(i); + if (effect) + { + BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); + gBattleScripting.battler = i; + gBattleStruct->formToChangeInto = effect - 1; + } + } + } + gBattleScripting.moveendState++; + break; case MOVEEND_CLEAR_BITS: // Clear/Set bits for things like using a move for all targets and all hits. if (gSpecialStatuses[gBattlerAttacker].instructedChosenTarget) *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3; @@ -6415,7 +6439,7 @@ static void Cmd_switchineffects(void) || ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gActiveBattler, FALSE) || AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE2, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE2, 0, 0, 0, 0) - || AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0)) + || AbilityBattleEffects(ABILITYEFFECT_WEATHER_FORM, 0, 0, 0, 0)) return; gSideStatuses[GetBattlerSide(gActiveBattler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED); @@ -13267,7 +13291,7 @@ static void Cmd_pickup(void) gBattlescriptCurrInstr++; } -static void Cmd_docastformchangeanimation(void) +static void Cmd_doweatherformchangeanimation(void) { gActiveBattler = gBattleScripting.battler; @@ -13280,7 +13304,7 @@ static void Cmd_docastformchangeanimation(void) gBattlescriptCurrInstr++; } -static void Cmd_trycastformdatachange(void) +static void Cmd_tryweatherformdatachange(void) { u8 form; @@ -13288,7 +13312,7 @@ static void Cmd_trycastformdatachange(void) form = TryWeatherFormChange(gBattleScripting.battler); if (form) { - BattleScriptPushCursorAndCallback(BattleScript_CastformChange); + BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); *(&gBattleStruct->formToChangeInto) = form - 1; } } diff --git a/src/battle_util.c b/src/battle_util.c index d0ff7c5beb..03e6bc2405 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2104,6 +2104,7 @@ enum ENDTURN_ION_DELUGE, ENDTURN_FAIRY_LOCK, ENDTURN_RETALIATE, + ENDTURN_WEATHER_FORM, ENDTURN_FIELD_COUNT, }; @@ -2551,6 +2552,10 @@ u8 DoFieldEndTurnEffects(void) gSideTimers[B_SIDE_OPPONENT].retaliateTimer--; gBattleStruct->turnCountersTracker++; break; + case ENDTURN_WEATHER_FORM: + AbilityBattleEffects(ABILITYEFFECT_WEATHER_FORM, 0, 0, 0, 0); + gBattleStruct->turnCountersTracker++; + break; case ENDTURN_FIELD_COUNT: effect++; break; @@ -3902,21 +3907,49 @@ u8 TryWeatherFormChange(u8 battler) bool32 weatherEffect = WEATHER_HAS_EFFECT; u16 holdEffect = GetBattlerHoldEffect(battler, TRUE); - if (gBattleMons[battler].species == SPECIES_CASTFORM) + switch (gBattleMons[battler].species) { + case SPECIES_CASTFORM: +#ifdef POKEMON_EXPANSION + case SPECIES_CASTFORM_RAINY: + case SPECIES_CASTFORM_SNOWY: + case SPECIES_CASTFORM_SUNNY: +#endif +#if B_WEATHER_FORMS >= GEN_5 + if (gBattleMons[battler].hp == 0) + { + ret = 0; // No change + } + else if (GetBattlerAbility(battler) != ABILITY_FORECAST || !weatherEffect) + { + if (!IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL)) + { + SET_BATTLER_TYPE(battler, TYPE_NORMAL); + ret = CASTFORM_NORMAL + 1; + } + else + { + ret = 0; // No change + } + } +#else if (GetBattlerAbility(battler) != ABILITY_FORECAST || gBattleMons[battler].hp == 0) { ret = 0; // No change } - else if (!weatherEffect && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL)) - { - SET_BATTLER_TYPE(battler, TYPE_NORMAL); - ret = CASTFORM_NORMAL + 1; - } else if (!weatherEffect) { - ret = 0; // No change + if (!IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL)) + { + SET_BATTLER_TYPE(battler, TYPE_NORMAL); + ret = CASTFORM_NORMAL + 1; + } + else + { + ret = 0; // No change + } } +#endif else if (holdEffect == HOLD_EFFECT_UTILITY_UMBRELLA || (!(gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SUN | B_WEATHER_HAIL)) && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))) { SET_BATTLER_TYPE(battler, TYPE_NORMAL); @@ -3937,15 +3970,25 @@ u8 TryWeatherFormChange(u8 battler) SET_BATTLER_TYPE(battler, TYPE_ICE); ret = CASTFORM_ICE + 1; } - } - else if (gBattleMons[battler].species == SPECIES_CHERRIM) - { - if (GetBattlerAbility(battler) != ABILITY_FLOWER_GIFT || gBattleMons[battler].hp == 0) + break; + case SPECIES_CHERRIM: +#ifdef POKEMON_EXPANSION + case SPECIES_CHERRIM_SUNSHINE: +#endif + if (gBattleMons[battler].hp == 0) ret = 0; // No change +#if B_WEATHER_FORMS >= GEN_5 + if (GetBattlerAbility(battler) != ABILITY_FLOWER_GIFT) + if (gBattleMonForms[battler] != 0) + ret = CHERRIM_OVERCAST + 1; + else + ret = 0; // No change +#endif else if (gBattleMonForms[battler] == 0 && weatherEffect && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA && gBattleWeather & B_WEATHER_SUN) ret = CHERRIM_SUNSHINE + 1; else if (gBattleMonForms[battler] != 0 && (!weatherEffect || holdEffect == HOLD_EFFECT_UTILITY_UMBRELLA || !(gBattleWeather & B_WEATHER_SUN))) ret = CHERRIM_OVERCAST + 1; + break; } return ret; @@ -4543,11 +4586,15 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_FORECAST: +#if B_WEATHER_FORMS >= GEN_5 case ABILITY_FLOWER_GIFT: +#else + TRY_WEATHER_FORM: +#endif effect = TryWeatherFormChange(battler); if (effect) { - BattleScriptPushCursorAndCallback(BattleScript_CastformChange); + BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); *(&gBattleStruct->formToChangeInto) = effect - 1; } break; @@ -4623,6 +4670,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; +#if B_WEATHER_FORMS < GEN_5 + default: + if (gBattleMons[battler].species == SPECIES_CHERRIM) + goto TRY_WEATHER_FORM; + break; +#endif } break; case ABILITYEFFECT_ENDTURN: // 1 @@ -5627,20 +5680,28 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } } break; - case ABILITYEFFECT_FORECAST: // 6 + case ABILITYEFFECT_WEATHER_FORM: // 6 for (battler = 0; battler < gBattlersCount; battler++) { - u16 battlerAbility = GetBattlerAbility(battler); - if (battlerAbility == ABILITY_FORECAST || battlerAbility == ABILITY_FLOWER_GIFT) + switch (gBattleMons[battler].species) { + case SPECIES_CASTFORM: + case SPECIES_CHERRIM: +#ifdef POKEMON_EXPANSION + case SPECIES_CASTFORM_RAINY: + case SPECIES_CASTFORM_SNOWY: + case SPECIES_CASTFORM_SUNNY: + case SPECIES_CHERRIM_SUNSHINE: +#endif effect = TryWeatherFormChange(battler); if (effect) { - BattleScriptPushCursorAndCallback(BattleScript_CastformChange); + BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); gBattleScripting.battler = battler; gBattleStruct->formToChangeInto = effect - 1; return effect; } + break; } } break; From cb1c6ffbd20aac331fba8eb27da6937d001a9885 Mon Sep 17 00:00:00 2001 From: sneed Date: Sun, 22 May 2022 03:46:39 +0300 Subject: [PATCH 037/115] comment out placeholders --- src/battle_util.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 03e6bc2405..4db8792364 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3910,11 +3910,10 @@ u8 TryWeatherFormChange(u8 battler) switch (gBattleMons[battler].species) { case SPECIES_CASTFORM: -#ifdef POKEMON_EXPANSION +/* Placeholder case SPECIES_CASTFORM_RAINY: case SPECIES_CASTFORM_SNOWY: - case SPECIES_CASTFORM_SUNNY: -#endif + case SPECIES_CASTFORM_SUNNY:*/ #if B_WEATHER_FORMS >= GEN_5 if (gBattleMons[battler].hp == 0) { @@ -3972,9 +3971,7 @@ u8 TryWeatherFormChange(u8 battler) } break; case SPECIES_CHERRIM: -#ifdef POKEMON_EXPANSION - case SPECIES_CHERRIM_SUNSHINE: -#endif +// case SPECIES_CHERRIM_SUNSHINE: if (gBattleMons[battler].hp == 0) ret = 0; // No change #if B_WEATHER_FORMS >= GEN_5 From fe42eacdf0494637112356294f9af70ba5d8da02 Mon Sep 17 00:00:00 2001 From: sneed Date: Sun, 22 May 2022 05:23:06 +0300 Subject: [PATCH 038/115] tabs over spaces --- data/battle_scripts_1.s | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index c79ba5e9c2..0afe8837a4 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8176,11 +8176,11 @@ BattleScript_DoWeatherFormChange:: copybyte gBattlerAbility, sBATTLER jumpifspecies BS_SCRIPTING, SPECIES_CASTFORM, BattleScript_DoWeatherFormChange_ForecastCheck BattleScript_DoWeatherFormChange_FlowerGiftCheck: - jumpifability BS_SCRIPTING, ABILITY_FLOWER_GIFT, BattleScript_DoWeatherFormChange_PopUp - goto BattleScript_DoWeatherFormChange_AfterPopUp + jumpifability BS_SCRIPTING, ABILITY_FLOWER_GIFT, BattleScript_DoWeatherFormChange_PopUp + goto BattleScript_DoWeatherFormChange_AfterPopUp BattleScript_DoWeatherFormChange_ForecastCheck: - jumpifability BS_SCRIPTING, ABILITY_FORECAST, BattleScript_DoWeatherFormChange_PopUp - goto BattleScript_DoWeatherFormChange_AfterPopUp + jumpifability BS_SCRIPTING, ABILITY_FORECAST, BattleScript_DoWeatherFormChange_PopUp + goto BattleScript_DoWeatherFormChange_AfterPopUp BattleScript_DoWeatherFormChange_PopUp: call BattleScript_AbilityPopUp BattleScript_DoWeatherFormChange_AfterPopUp: From 5b0afffd91cfbb1145163e33ffe729d8a200ad71 Mon Sep 17 00:00:00 2001 From: sneed Date: Sun, 22 May 2022 13:10:51 +0300 Subject: [PATCH 039/115] popup and flower gift description fixes --- data/battle_scripts_1.s | 2 ++ src/data/text/abilities.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 0afe8837a4..ba748258b0 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8174,10 +8174,12 @@ BattleScript_WeatherFormChange:: BattleScript_DoWeatherFormChange:: copybyte gBattlerAbility, sBATTLER +.if B_WEATHER_FORMS >= GEN_5 jumpifspecies BS_SCRIPTING, SPECIES_CASTFORM, BattleScript_DoWeatherFormChange_ForecastCheck BattleScript_DoWeatherFormChange_FlowerGiftCheck: jumpifability BS_SCRIPTING, ABILITY_FLOWER_GIFT, BattleScript_DoWeatherFormChange_PopUp goto BattleScript_DoWeatherFormChange_AfterPopUp +.endif BattleScript_DoWeatherFormChange_ForecastCheck: jumpifability BS_SCRIPTING, ABILITY_FORECAST, BattleScript_DoWeatherFormChange_PopUp goto BattleScript_DoWeatherFormChange_AfterPopUp diff --git a/src/data/text/abilities.h b/src/data/text/abilities.h index cdc3276082..ac11b9de8b 100644 --- a/src/data/text/abilities.h +++ b/src/data/text/abilities.h @@ -119,7 +119,7 @@ static const u8 sHoneyGatherDescription[] = _("May gather Honey."); static const u8 sFriskDescription[] = _("Checks a foe's item."); static const u8 sRecklessDescription[] = _("Boosts moves with recoil."); static const u8 sMultitypeDescription[] = _("Changes type to its Plate."); -static const u8 sFlowerGiftDescription[] = _("Transforms in sunshine."); +static const u8 sFlowerGiftDescription[] = _("Allies power up in sunshine."); static const u8 sBadDreamsDescription[] = _("Damages sleeping Pokémon."); static const u8 sPickpocketDescription[] = _("Steals the foe's held item."); static const u8 sSheerForceDescription[] = _("Trades effects for power."); From 64115a873f0e97d8abe437948f597f90d111394f Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 18 Jul 2022 18:15:44 -0400 Subject: [PATCH 040/115] Comatose prevents Battle Pike's status effects. --- src/battle_pike.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/battle_pike.c b/src/battle_pike.c index 2f36dbc29f..5071350f35 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -813,6 +813,9 @@ static bool8 DoesAbilityPreventStatus(struct Pokemon *mon, u32 status) u16 ability = GetMonAbility(mon); bool8 ret = FALSE; + if (ability == ABILITY_COMATOSE) + return TRUE; + switch (status) { case STATUS1_FREEZE: From 59f89bde9e8ced4c8240bdaded3b938ee1454def Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 18 Aug 2022 14:23:45 -0400 Subject: [PATCH 041/115] Misc cleanup --- gflib/sprite.c | 2 +- include/battle.h | 2 +- src/battle_controller_link_opponent.c | 21 +++++++++------------ src/battle_controller_opponent.c | 6 +++--- src/battle_controller_recorded_opponent.c | 6 +++--- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/gflib/sprite.c b/gflib/sprite.c index 9fc597cc3b..cbcd6fb7c0 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -103,7 +103,7 @@ typedef void (*AffineAnimCmdFunc)(u8 matrixNum, struct Sprite *); #define DUMMY_OAM_DATA \ { \ .y = DISPLAY_HEIGHT, \ - .affineMode = 0, \ + .affineMode = ST_OAM_AFFINE_OFF, \ .objMode = 0, \ .mosaic = FALSE, \ .bpp = 0, \ diff --git a/include/battle.h b/include/battle.h index 0b349e4b69..38c4cd779d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -551,7 +551,7 @@ struct BattleHealthboxInfo u8 specialAnimActive:1; // x40 u8 triedShinyMonAnim:1; u8 finishedShinyMonAnim:1; - u8 field_1_x1E:4; + u8 opponentDrawPartyStatusSummaryDelay:4; u8 bgmRestored:1; u8 waitForCry:1; u8 healthboxSlideInStarted:1; diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index a0756b8cb5..a9629f6622 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -368,16 +368,13 @@ static void TryShinyAnimAfterMonAnim(void) { TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); } - else + else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); - FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - LinkOpponentBufferExecCompleted(); - } + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); + LinkOpponentBufferExecCompleted(); } } } @@ -1758,14 +1755,14 @@ static void LinkOpponentHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E < 2) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E++; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++; return; } else { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0; } } diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index cf155dc764..641cbd0ace 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -1929,14 +1929,14 @@ static void OpponentHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E < 2) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E++; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++; return; } else { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0; } } diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index ebfdbc909c..49538b834e 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1698,14 +1698,14 @@ static void RecordedOpponentHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E < 2) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E++; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++; return; } else { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0; } } From 3bc2cf921c79530862c8c4b2fff0ce7a5bfef4c9 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 8 Aug 2022 10:06:30 -0400 Subject: [PATCH 042/115] Sync src/battle_controllers.c with pokefirered --- include/battle.h | 2 +- include/battle_controllers.h | 14 ---------- include/battle_message.h | 2 +- src/battle_controllers.c | 54 ++++++++++++++++++++++-------------- src/battle_message.c | 4 +-- 5 files changed, 37 insertions(+), 39 deletions(-) diff --git a/include/battle.h b/include/battle.h index 38c4cd779d..0eaa60f30f 100644 --- a/include/battle.h +++ b/include/battle.h @@ -368,7 +368,7 @@ struct BattleStruct u8 faintedActionsState; u8 faintedActionsBattlerId; u16 expValue; - u8 field_52; + u8 scriptPartyIdx; // for printing the nickname u8 sentInPokes; bool8 selectionScriptFinished[MAX_BATTLERS_COUNT]; u8 battlerPartyIndexes[MAX_BATTLERS_COUNT]; diff --git a/include/battle_controllers.h b/include/battle_controllers.h index f6ac07b913..064c080f61 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -202,9 +202,7 @@ void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); // emitters void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck); -void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data); -void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused void BtlController_EmitLoadMonSprite(u8 bufferId); void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit); void BtlController_EmitReturnMonToBall(u8 bufferId, bool8 skipAnim); @@ -212,10 +210,7 @@ void BtlController_EmitDrawTrainerPic(u8 bufferId); void BtlController_EmitTrainerSlide(u8 bufferId); void BtlController_EmitTrainerSlideBack(u8 bufferId); void BtlController_EmitFaintAnimation(u8 bufferId); -void BtlController_EmitPaletteFade(u8 bufferId); // unused -void BtlController_EmitSuccessBallThrowAnim(u8 bufferId); // unused void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId); -void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data); // unused void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit); void BtlController_EmitPrintString(u8 bufferId, u16 stringId); void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId); @@ -224,24 +219,15 @@ void BtlController_EmitYesNoBox(u8 bufferId); void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); void BtlController_EmitChooseItem(u8 bufferId, u8 *battlePartyOrder); void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u8 abilityId, u8 *data); -void BtlController_EmitCmd23(u8 bufferId); // unused void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue); void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints); void BtlController_EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2); void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status); -void BtlController_EmitStatusXor(u8 bufferId, u8 b); // unused void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data); -void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused -void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data); // unused -void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data); // unused void BtlController_EmitTwoReturnValues(u8 bufferId, u8 ret8, u16 ret16); void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battlePartyOrder); void BtlController_EmitOneReturnValue(u8 bufferId, u16 ret); void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret); -void BtlController_EmitClearUnkVar(u8 bufferId); // unused -void BtlController_EmitSetUnkVar(u8 bufferId, u8 b); // unused -void BtlController_EmitClearUnkFlag(u8 bufferId); // unused -void BtlController_EmitToggleUnkFlag(u8 bufferId); // unused void BtlController_EmitHitAnimation(u8 bufferId); void BtlController_EmitCantSwitch(u8 bufferId); void BtlController_EmitPlaySE(u8 bufferId, u16 songId); diff --git a/include/battle_message.h b/include/battle_message.h index cc18a13d22..ed642fb6ec 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -202,7 +202,7 @@ struct BattleMsgData u16 lastItem; u8 lastAbility; u8 scrActive; - u8 unk1605E; + u8 bakScriptPartyIdx; u8 hpScale; u8 itemEffectBattler; u8 moveType; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 42bdba8998..20681b27ce 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -8,7 +8,6 @@ #include "link.h" #include "link_rfu.h" #include "party_menu.h" -#include "pokemon.h" #include "recorded_battle.h" #include "task.h" #include "util.h" @@ -595,7 +594,7 @@ static void SetBattlePartyIds(void) if (GetMonData(&gPlayerParty[j], MON_DATA_HP) != 0 && GetMonData(&gPlayerParty[j], MON_DATA_SPECIES2) != SPECIES_NONE && GetMonData(&gPlayerParty[j], MON_DATA_SPECIES2) != SPECIES_EGG - && GetMonData(&gPlayerParty[j], MON_DATA_IS_EGG) == 0) + && !GetMonData(&gPlayerParty[j], MON_DATA_IS_EGG)) { gBattlerPartyIndexes[i] = j; break; @@ -606,7 +605,7 @@ static void SetBattlePartyIds(void) if (GetMonData(&gEnemyParty[j], MON_DATA_HP) != 0 && GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_NONE && GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_EGG - && GetMonData(&gEnemyParty[j], MON_DATA_IS_EGG) == 0) + && !GetMonData(&gEnemyParty[j], MON_DATA_IS_EGG)) { gBattlerPartyIndexes[i] = j; break; @@ -620,7 +619,7 @@ static void SetBattlePartyIds(void) if (GetMonData(&gPlayerParty[j], MON_DATA_HP) != 0 && GetMonData(&gPlayerParty[j], MON_DATA_SPECIES) != SPECIES_NONE // Probably a typo by Game Freak. The rest use SPECIES2. && GetMonData(&gPlayerParty[j], MON_DATA_SPECIES2) != SPECIES_EGG - && GetMonData(&gPlayerParty[j], MON_DATA_IS_EGG) == 0 + && !GetMonData(&gPlayerParty[j], MON_DATA_IS_EGG) && gBattlerPartyIndexes[i - 2] != j) { gBattlerPartyIndexes[i] = j; @@ -632,7 +631,7 @@ static void SetBattlePartyIds(void) if (GetMonData(&gEnemyParty[j], MON_DATA_HP) != 0 && GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_NONE && GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_EGG - && GetMonData(&gEnemyParty[j], MON_DATA_IS_EGG) == 0 + && !GetMonData(&gEnemyParty[j], MON_DATA_IS_EGG) && gBattlerPartyIndexes[i - 2] != j) { gBattlerPartyIndexes[i] = j; @@ -913,7 +912,8 @@ void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) +// Unused +static void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) { sBattleBuffersTransferData[0] = CONTROLLER_GETRAWMONDATA; sBattleBuffersTransferData[1] = monId; @@ -934,7 +934,8 @@ void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 b PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 3 + bytes); } -void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) +// Unused +static void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) { s32 i; @@ -1007,7 +1008,8 @@ void BtlController_EmitFaintAnimation(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitPaletteFade(u8 bufferId) +// Unused +static void BtlController_EmitPaletteFade(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE; sBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE; @@ -1016,7 +1018,8 @@ void BtlController_EmitPaletteFade(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitSuccessBallThrowAnim(u8 bufferId) +// Unused +static void BtlController_EmitSuccessBallThrowAnim(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM; sBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM; @@ -1032,7 +1035,8 @@ void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } -void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data) +// Unused +static void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data) { s32 i; @@ -1089,7 +1093,7 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID) stringInfo->lastItem = gLastUsedItem; stringInfo->lastAbility = gLastUsedAbility; stringInfo->scrActive = gBattleScripting.battler; - stringInfo->unk1605E = gBattleStruct->field_52; + stringInfo->bakScriptPartyIdx = gBattleStruct->scriptPartyIdx; stringInfo->hpScale = gBattleStruct->hpScale; stringInfo->itemEffectBattler = gPotentialItemEffectBattler; stringInfo->moveType = gBattleMoves[gCurrentMove].type; @@ -1121,7 +1125,7 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID) stringInfo->lastItem = gLastUsedItem; stringInfo->lastAbility = gLastUsedAbility; stringInfo->scrActive = gBattleScripting.battler; - stringInfo->unk1605E = gBattleStruct->field_52; + stringInfo->bakScriptPartyIdx = gBattleStruct->scriptPartyIdx; for (i = 0; i < MAX_BATTLERS_COUNT; i++) stringInfo->abilities[i] = gBattleMons[i].ability; @@ -1191,7 +1195,8 @@ void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u8 abili PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // Only 7 bytes were written. } -void BtlController_EmitCmd23(u8 bufferId) +// Unused +static void BtlController_EmitCmd23(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_23; sBattleBuffersTransferData[1] = CONTROLLER_23; @@ -1245,7 +1250,8 @@ void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 6); } -void BtlController_EmitStatusXor(u8 bufferId, u8 b) +// Unused +static void BtlController_EmitStatusXor(u8 bufferId, u8 b) { sBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR; sBattleBuffersTransferData[1] = b; @@ -1265,7 +1271,8 @@ void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 4); } -void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data) +// Unused +static void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data) { s32 i; @@ -1282,7 +1289,7 @@ void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data } // Unused -void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data) +static void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data) { s32 i; @@ -1297,7 +1304,8 @@ void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, songId + 3); } -void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data) +// Unused +static void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data) { s32 i; @@ -1347,7 +1355,8 @@ void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitClearUnkVar(u8 bufferId) +// Unused +static void BtlController_EmitClearUnkVar(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_CLEARUNKVAR; sBattleBuffersTransferData[1] = CONTROLLER_CLEARUNKVAR; @@ -1356,14 +1365,16 @@ void BtlController_EmitClearUnkVar(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitSetUnkVar(u8 bufferId, u8 b) +// Unused +static void BtlController_EmitSetUnkVar(u8 bufferId, u8 b) { sBattleBuffersTransferData[0] = CONTROLLER_SETUNKVAR; sBattleBuffersTransferData[1] = b; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } -void BtlController_EmitClearUnkFlag(u8 bufferId) +// Unused +static void BtlController_EmitClearUnkFlag(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_CLEARUNKFLAG; sBattleBuffersTransferData[1] = CONTROLLER_CLEARUNKFLAG; @@ -1372,7 +1383,8 @@ void BtlController_EmitClearUnkFlag(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitToggleUnkFlag(u8 bufferId) +// Unused +static void BtlController_EmitToggleUnkFlag(u8 bufferId) { sBattleBuffersTransferData[0] = CONTROLLER_TOGGLEUNKFLAG; sBattleBuffersTransferData[1] = CONTROLLER_TOGGLEUNKFLAG; diff --git a/src/battle_message.c b/src/battle_message.c index 677bb2fe38..99325e9e80 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2063,7 +2063,7 @@ void BufferStringBattle(u16 stringID) gLastUsedItem = gBattleMsgDataPtr->lastItem; gLastUsedAbility = gBattleMsgDataPtr->lastAbility; gBattleScripting.battler = gBattleMsgDataPtr->scrActive; - *(&gBattleStruct->field_52) = gBattleMsgDataPtr->unk1605E; + *(&gBattleStruct->scriptPartyIdx) = gBattleMsgDataPtr->bakScriptPartyIdx; *(&gBattleStruct->hpScale) = gBattleMsgDataPtr->hpScale; gPotentialItemEffectBattler = gBattleMsgDataPtr->itemEffectBattler; *(&gBattleStruct->stringMoveType) = gBattleMsgDataPtr->moveType; @@ -2713,7 +2713,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) } break; case B_TXT_26: // ? - HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler, *(&gBattleStruct->field_52)) + HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler, *(&gBattleStruct->scriptPartyIdx)) break; case B_TXT_PC_CREATOR_NAME: // lanette pc if (FlagGet(FLAG_SYS_PC_LANETTE)) From 11b4958f230bafa46611c7b4f04142d32d54451d Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 19 Aug 2022 19:45:15 -0400 Subject: [PATCH 043/115] Incorporate commented bug fixes in contest AI scripts --- data/contest_ai_scripts.s | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/data/contest_ai_scripts.s b/data/contest_ai_scripts.s index ef4feb25ff..ecd3103ae2 100644 --- a/data/contest_ai_scripts.s +++ b/data/contest_ai_scripts.s @@ -435,11 +435,15 @@ AI_CGM_BetterWhenAudienceExcited: AI_CGM_BetterWhenAudienceExcited_1stUp: @ BUG: Should be if_appeal_num_eq 0 @ 1st up on 1st appeal excitement will always be 0 - if_appeal_num_not_eq 0, AI_CGM_BetterWhenAudienceExcited_Not1stAppeal +.ifdef BUGFIX + if_appeal_num_eq 0, AI_CGM_BetterWhenAudienceExcited_1stAppeal +.else + if_appeal_num_not_eq 0, AI_CGM_BetterWhenAudienceExcited_1stAppeal +.endif if_excitement_eq 4, AI_CGM_BetterWhenAudienceExcited_1AwayFromMax if_excitement_eq 3, AI_CGM_BetterWhenAudienceExcited_2AwayFromMax end -AI_CGM_BetterWhenAudienceExcited_Not1stAppeal: +AI_CGM_BetterWhenAudienceExcited_1stAppeal: if_random_less_than 125, AI_CGM_End score -15 end @@ -542,7 +546,11 @@ AI_CGM_TargetMonWithJudgesAttention: end AI_CGM_TargetMonWithJudgesAttention_CheckMon1: if_cannot_participate MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 +.ifdef BUGFIX + if_not_used_combo_starter MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 +.else if_used_combo_starter MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 +.endif if_random_less_than 125, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 score +2 if_not_completed_combo MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2 @@ -551,7 +559,11 @@ AI_CGM_TargetMonWithJudgesAttention_CheckMon1: AI_CGM_TargetMonWithJudgesAttention_CheckMon2: if_user_order_eq MON_2, AI_CGM_End if_cannot_participate MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 +.ifdef BUGFIX + if_not_used_combo_starter MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 +.else if_used_combo_starter MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 +.endif if_random_less_than 125, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 score +2 if_not_completed_combo MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3 @@ -560,7 +572,11 @@ AI_CGM_TargetMonWithJudgesAttention_CheckMon2: AI_CGM_TargetMonWithJudgesAttention_CheckMon3: if_user_order_eq MON_3, AI_CGM_End if_cannot_participate MON_3, AI_CGM_End +.ifdef BUGFIX + if_not_used_combo_starter MON_3, AI_CGM_End +.else if_used_combo_starter MON_3, AI_CGM_End +.endif if_random_less_than 125, AI_CGM_End score +2 if_not_completed_combo MON_3, AI_CGM_End From 261b0ff118bc24e7d6353180d1bdac3f3942ef48 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 20 Aug 2022 22:58:46 -0400 Subject: [PATCH 044/115] Standardize judgement vs judgment spelling --- ...symbols.png => arena_judgment_symbols.png} | Bin include/battle_message.h | 2 +- include/constants/battle.h | 4 +- include/graphics.h | 4 +- src/battle_arena.c | 66 +++++++++--------- src/battle_bg.c | 4 +- src/battle_message.c | 10 +-- src/battle_script_commands.c | 6 +- src/graphics.c | 4 +- 9 files changed, 50 insertions(+), 50 deletions(-) rename graphics/battle_frontier/{arena_judgement_symbols.png => arena_judgment_symbols.png} (100%) diff --git a/graphics/battle_frontier/arena_judgement_symbols.png b/graphics/battle_frontier/arena_judgment_symbols.png similarity index 100% rename from graphics/battle_frontier/arena_judgement_symbols.png rename to graphics/battle_frontier/arena_judgment_symbols.png diff --git a/include/battle_message.h b/include/battle_message.h index cc18a13d22..1ced84f50a 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -283,7 +283,7 @@ extern const u8 gText_OpponentMon1Name[]; extern const u8 gText_Mind[]; extern const u8 gText_Skill[]; extern const u8 gText_Body[]; -extern const u8 gText_Judgement[]; +extern const u8 gText_Judgment[]; extern const u8 gText_EmptyString3[]; extern const u8 gText_RecordBattleToPass[]; extern const u8 gText_BattleRecordedOnPass[]; diff --git a/include/constants/battle.h b/include/constants/battle.h index 41bdb7a883..3eec42f15c 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -357,8 +357,8 @@ #define ARENA_WIN_MIND 18 #define ARENA_WIN_SKILL 19 #define ARENA_WIN_BODY 20 -#define ARENA_WIN_JUDGEMENT_TITLE 21 -#define ARENA_WIN_JUDGEMENT_TEXT 22 +#define ARENA_WIN_JUDGMENT_TITLE 21 +#define ARENA_WIN_JUDGMENT_TEXT 22 // Flag for BattlePutTextOnWindow. Never set #define B_WIN_COPYTOVRAM (1 << 7) diff --git a/include/graphics.h b/include/graphics.h index 08a2a1c421..8bdc85dc4a 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4138,8 +4138,8 @@ extern const u16 gTilesetAnims_BattleDomePals0_1[]; extern const u16 gTilesetAnims_BattleDomePals0_2[]; extern const u16 gTilesetAnims_BattleDomePals0_3[]; -extern const u32 gBattleArenaJudgementSymbolsGfx[]; -extern const u32 gBattleArenaJudgementSymbolsPalette[]; +extern const u32 gBattleArenaJudgmentSymbolsGfx[]; +extern const u32 gBattleArenaJudgmentSymbolsPalette[]; extern const u32 gBattleWindowTextPalette[]; diff --git a/src/battle_arena.c b/src/battle_arena.c index 79d7d50297..cdd1843d70 100644 --- a/src/battle_arena.c +++ b/src/battle_arena.c @@ -38,9 +38,9 @@ static void BufferArenaOpponentName(void); static void SpriteCB_JudgmentIcon(struct Sprite *sprite); static void ShowJudgmentSprite(u8 x, u8 y, u8 category, u8 battler); -#define JUDGEMENT_STATE_FINISHED 8 +#define JUDGMENT_STATE_FINISHED 8 -#define TAG_JUDGEMENT_ICON 1000 +#define TAG_JUDGMENT_ICON 1000 enum { ANIM_ICON_X, // Player lost @@ -275,7 +275,7 @@ static const s8 sMindRatings[MOVES_COUNT] = [MOVE_PSYCHO_BOOST] = 1, }; -static const struct OamData sOam_JudgementIcon = +static const struct OamData sOam_JudgmentIcon = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -292,52 +292,52 @@ static const struct OamData sOam_JudgementIcon = .affineParam = 0 }; -static const union AnimCmd sAnim_JudgementIcon_X[] = +static const union AnimCmd sAnim_JudgmentIcon_X[] = { ANIMCMD_FRAME(0, 1), ANIMCMD_END }; -static const union AnimCmd sAnim_JudgementIcon_Triangle[] = +static const union AnimCmd sAnim_JudgmentIcon_Triangle[] = { ANIMCMD_FRAME(4, 1), ANIMCMD_END }; -static const union AnimCmd sAnim_JudgementIcon_Circle[] = +static const union AnimCmd sAnim_JudgmentIcon_Circle[] = { ANIMCMD_FRAME(8, 1), ANIMCMD_END }; -static const union AnimCmd sAnim_JudgementIcon_Line[] = +static const union AnimCmd sAnim_JudgmentIcon_Line[] = { ANIMCMD_FRAME(12, 1), ANIMCMD_END }; -static const union AnimCmd *const sAnims_JudgementIcon[] = +static const union AnimCmd *const sAnims_JudgmentIcon[] = { - [ANIM_ICON_X] = sAnim_JudgementIcon_X, - [ANIM_ICON_TRIANGLE] = sAnim_JudgementIcon_Triangle, - [ANIM_ICON_CIRCLE] = sAnim_JudgementIcon_Circle, - [ANIM_ICON_LINE] = sAnim_JudgementIcon_Line, + [ANIM_ICON_X] = sAnim_JudgmentIcon_X, + [ANIM_ICON_TRIANGLE] = sAnim_JudgmentIcon_Triangle, + [ANIM_ICON_CIRCLE] = sAnim_JudgmentIcon_Circle, + [ANIM_ICON_LINE] = sAnim_JudgmentIcon_Line, }; static const struct SpriteTemplate sSpriteTemplate_JudgmentIcon = { - .tileTag = TAG_JUDGEMENT_ICON, + .tileTag = TAG_JUDGMENT_ICON, .paletteTag = TAG_NONE, - .oam = &sOam_JudgementIcon, - .anims = sAnims_JudgementIcon, + .oam = &sOam_JudgmentIcon, + .anims = sAnims_JudgmentIcon, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCB_JudgmentIcon, }; -static const struct CompressedSpriteSheet sBattleArenaJudgementSymbolsSpriteSheet[] = +static const struct CompressedSpriteSheet sBattleArenaJudgmentSymbolsSpriteSheet[] = { - {gBattleArenaJudgementSymbolsGfx, 0x200, TAG_JUDGEMENT_ICON}, + {gBattleArenaJudgmentSymbolsGfx, 0x200, TAG_JUDGMENT_ICON}, {0} }; @@ -389,8 +389,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) case 0: BeginNormalPaletteFade(0x7FFFFF1C, 4, 0, 8, RGB_BLACK); SetGpuReg(REG_OFFSET_WININ, (WININ_WIN0_ALL & ~WININ_WIN0_BG0) | WININ_WIN1_ALL); - LoadCompressedSpriteSheet(sBattleArenaJudgementSymbolsSpriteSheet); - LoadCompressedPalette(gBattleArenaJudgementSymbolsPalette, 0x1F0, 0x20); + LoadCompressedSpriteSheet(sBattleArenaJudgmentSymbolsSpriteSheet); + LoadCompressedPalette(gBattleArenaJudgmentSymbolsPalette, 0x1F0, 0x20); gBattle_WIN0H = 0xFF; gBattle_WIN0V = 0x70; (*state)++; @@ -417,8 +417,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) BattlePutTextOnWindow(gText_Mind, ARENA_WIN_MIND); BattlePutTextOnWindow(gText_Skill, ARENA_WIN_SKILL); BattlePutTextOnWindow(gText_Body, ARENA_WIN_BODY); - BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE); + BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE); (*state)++; } break; @@ -441,8 +441,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) PlaySE(SE_ARENA_TIMEUP1); ShowJudgmentSprite(80, 40, ARENA_CATEGORY_MIND, B_POSITION_PLAYER_LEFT); ShowJudgmentSprite(160, 40, ARENA_CATEGORY_MIND, B_POSITION_OPPONENT_LEFT); - BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE); + BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE); (*state)++; result = ARENA_RESULT_STEP_DONE; break; @@ -450,8 +450,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) PlaySE(SE_ARENA_TIMEUP1); ShowJudgmentSprite(80, 56, ARENA_CATEGORY_SKILL, B_POSITION_PLAYER_LEFT); ShowJudgmentSprite(160, 56, ARENA_CATEGORY_SKILL, B_POSITION_OPPONENT_LEFT); - BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE); + BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE); (*state)++; result = ARENA_RESULT_STEP_DONE; break; @@ -459,8 +459,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) PlaySE(SE_ARENA_TIMEUP1); ShowJudgmentSprite(80, 72, ARENA_CATEGORY_BODY, B_POSITION_PLAYER_LEFT); ShowJudgmentSprite(160, 72, ARENA_CATEGORY_BODY, B_POSITION_OPPONENT_LEFT); - BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE); + BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE); (*state)++; result = ARENA_RESULT_STEP_DONE; break; @@ -482,11 +482,11 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) } (*state)++; break; - case JUDGEMENT_STATE_FINISHED: - // Finishing this state is the indicator to SpriteCB_JudgmentIcon that its safe to destroy the judgement icon sprites + case JUDGMENT_STATE_FINISHED: + // Finishing this state is the indicator to SpriteCB_JudgmentIcon that its safe to destroy the judgment icon sprites (*state)++; break; - case JUDGEMENT_STATE_FINISHED + 1: + case JUDGMENT_STATE_FINISHED + 1: SetGpuReg(REG_OFFSET_WININ, (WININ_WIN0_ALL & ~WININ_WIN0_BG0) | WININ_WIN1_ALL); HandleBattleWindow(5, 0, 24, 13, WINDOW_CLEAR); CopyBgTilemapBufferToVram(0); @@ -494,11 +494,11 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) BeginNormalPaletteFade(0x7FFFFF1C, 4, 8, 0, RGB_BLACK); (*state)++; break; - case JUDGEMENT_STATE_FINISHED + 2: + case JUDGMENT_STATE_FINISHED + 2: if (!gPaletteFade.active) { SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_ALL | WININ_WIN1_ALL); - FreeSpriteTilesByTag(TAG_JUDGEMENT_ICON); + FreeSpriteTilesByTag(TAG_JUDGMENT_ICON); result = ARENA_RESULT_STEP_DONE; (*state)++; } @@ -562,7 +562,7 @@ static void ShowJudgmentSprite(u8 x, u8 y, u8 category, u8 battler) static void SpriteCB_JudgmentIcon(struct Sprite *sprite) { - if (gBattleCommunication[0] > JUDGEMENT_STATE_FINISHED) + if (gBattleCommunication[0] > JUDGMENT_STATE_FINISHED) DestroySprite(sprite); } diff --git a/src/battle_bg.c b/src/battle_bg.c index ace4ea24fa..8bbe18ab28 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -571,7 +571,7 @@ static const struct WindowTemplate sBattleArenaWindowTemplates[] = .paletteNum = 5, .baseBlock = 0x013c, }, - [ARENA_WIN_JUDGEMENT_TITLE] = { + [ARENA_WIN_JUDGMENT_TITLE] = { .bg = 0, .tilemapLeft = 8, .tilemapTop = 11, @@ -580,7 +580,7 @@ static const struct WindowTemplate sBattleArenaWindowTemplates[] = .paletteNum = 5, .baseBlock = 0x0148, }, - [ARENA_WIN_JUDGEMENT_TEXT] = { + [ARENA_WIN_JUDGMENT_TEXT] = { .bg = 0, .tilemapLeft = 2, .tilemapTop = 15, diff --git a/src/battle_message.c b/src/battle_message.c index 677bb2fe38..fa2fedd85b 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1371,7 +1371,7 @@ const u8 gText_OpponentMon1Name[] = _("{B_OPPONENT_MON1_NAME}"); const u8 gText_Mind[] = _("Mind"); const u8 gText_Skill[] = _("Skill"); const u8 gText_Body[] = _("Body"); -const u8 gText_Judgement[] = _("{B_BUFF1}{CLEAR 13}Judgment{CLEAR 13}{B_BUFF2}"); +const u8 gText_Judgment[] = _("{B_BUFF1}{CLEAR 13}Judgment{CLEAR 13}{B_BUFF2}"); static const u8 sText_TwoTrainersSentPkmn[] = _("{B_TRAINER1_CLASS} {B_TRAINER1_NAME} sent\nout {B_OPPONENT_MON1_NAME}!\p{B_TRAINER2_CLASS} {B_TRAINER2_NAME} sent\nout {B_OPPONENT_MON2_NAME}!"); static const u8 sText_Trainer2SentOutPkmn[] = _("{B_TRAINER2_CLASS} {B_TRAINER2_NAME} sent\nout {B_BUFF1}!"); static const u8 sText_TwoTrainersWantToBattle[] = _("{B_TRAINER1_CLASS} {B_TRAINER1_NAME} and\n{B_TRAINER2_CLASS} {B_TRAINER2_NAME}\lwant to battle!\p"); @@ -2020,7 +2020,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = .bgColor = TEXT_DYNAMIC_COLOR_5, .shadowColor = TEXT_DYNAMIC_COLOR_6, }, - [ARENA_WIN_JUDGEMENT_TITLE] = { + [ARENA_WIN_JUDGMENT_TITLE] = { .fillValue = PIXEL_FILL(0xE), .fontId = FONT_NORMAL, .x = -1, @@ -2032,7 +2032,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = .bgColor = TEXT_DYNAMIC_COLOR_5, .shadowColor = TEXT_DYNAMIC_COLOR_6, }, - [ARENA_WIN_JUDGEMENT_TEXT] = { + [ARENA_WIN_JUDGMENT_TEXT] = { .fillValue = PIXEL_FILL(0x1), .fontId = FONT_NORMAL, .x = 0, @@ -3081,7 +3081,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) printerTemplate.x = printerTemplate.currentX = alignX; } - if (windowId == ARENA_WIN_JUDGEMENT_TEXT) + if (windowId == ARENA_WIN_JUDGMENT_TEXT) gTextFlags.useAlternateDownArrow = FALSE; else gTextFlags.useAlternateDownArrow = TRUE; @@ -3091,7 +3091,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) else gTextFlags.autoScroll = FALSE; - if (windowId == B_WIN_MSG || windowId == ARENA_WIN_JUDGEMENT_TEXT) + if (windowId == B_WIN_MSG || windowId == ARENA_WIN_JUDGMENT_TEXT) { if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) speed = 1; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7c009e0775..e4c22000d6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5226,7 +5226,7 @@ static void Cmd_switchineffects(void) else { // There is a hack here to ensure the truant counter will be 0 when the battler's next turn starts. - // The truant counter is not updated in the case where a mon switches in after a lost judgement in the battle arena. + // The truant counter is not updated in the case where a mon switches in after a lost judgment in the battle arena. if (gBattleMons[gActiveBattler].ability == ABILITY_TRUANT && !gDisableStructs[gActiveBattler].truantSwitchInHack) gDisableStructs[gActiveBattler].truantCounter = 1; @@ -6412,10 +6412,10 @@ static void Cmd_various(void) break; case VARIOUS_ARENA_JUDGMENT_STRING: BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]); - BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TEXT); + BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TEXT); break; case VARIOUS_ARENA_WAIT_STRING: - if (IsTextPrinterActive(ARENA_WIN_JUDGEMENT_TEXT)) + if (IsTextPrinterActive(ARENA_WIN_JUDGMENT_TEXT)) return; break; case VARIOUS_WAIT_CRY: diff --git a/src/graphics.c b/src/graphics.c index eb798433df..06007d759b 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -963,8 +963,8 @@ const u32 gDomeTourneyTree_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney. const u32 gDomeTourneyTreeButtons_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.gbapal.lz"); const u32 gDomeTourneyMatchCardBg_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_match_card_bg.gbapal.lz"); -const u32 gBattleArenaJudgementSymbolsGfx[] = INCBIN_U32("graphics/battle_frontier/arena_judgement_symbols.4bpp.lz"); -const u32 gBattleArenaJudgementSymbolsPalette[] = INCBIN_U32("graphics/battle_frontier/arena_judgement_symbols.gbapal.lz"); +const u32 gBattleArenaJudgmentSymbolsGfx[] = INCBIN_U32("graphics/battle_frontier/arena_judgment_symbols.4bpp.lz"); +const u32 gBattleArenaJudgmentSymbolsPalette[] = INCBIN_U32("graphics/battle_frontier/arena_judgment_symbols.gbapal.lz"); const u32 gBattleWindowTextPalette[] = INCBIN_U32("graphics/battle_interface/text.gbapal.lz"); const u16 gPPTextPalette[] = INCBIN_U16("graphics/battle_interface/text_pp.gbapal"); From 1f5adf93c7ffbd2ecd61b9315b5d796581d994d7 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 23 Aug 2022 21:00:08 -0400 Subject: [PATCH 045/115] Cleaned up use of configs be almost exclusively preproc functions --- data/battle_anim_scripts.s | 13 +- include/constants/battle_config.h | 5 +- src/battle_ai_main.c | 45 ++- src/battle_ai_util.c | 89 +++-- src/battle_anim.c | 4 +- src/battle_bg.c | 10 +- src/battle_controller_opponent.c | 4 +- src/battle_controller_player.c | 41 +-- src/battle_interface.c | 8 +- src/battle_main.c | 54 ++- src/battle_pike.c | 6 +- src/battle_script_commands.c | 536 ++++++++++++++++-------------- src/battle_util.c | 443 +++++++++++++----------- src/battle_z_move.c | 11 +- src/data/battle_anim.h | 174 +++++----- src/data/items.h | 128 +------ src/data/text/move_descriptions.h | 67 ++-- src/daycare.c | 12 +- src/evolution_scene.c | 9 +- src/item_use.c | 4 +- src/overworld.c | 6 +- src/pokemon.c | 132 ++++---- src/pokemon_summary_screen.c | 5 +- src/wild_encounter.c | 13 +- 24 files changed, 921 insertions(+), 898 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index dcafffe50c..91173105bf 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -23548,26 +23548,25 @@ Move_SECRET_POWER: jumpargeq 0, BATTLE_TERRAIN_PUDDLE, Move_MUD_SHOT jumpargeq 0, BATTLE_TERRAIN_MARSH, Move_MUD_SHOT jumpargeq 0, BATTLE_TERRAIN_SWAMP, Move_MUD_SHOT -.if B_SECRET_POWER_ANIMATION >= GEN_7 - jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD -.else - jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE -.endif jumpargeq 0, BATTLE_TERRAIN_ICE, Move_ICE_SHARD jumpargeq 0, BATTLE_TERRAIN_VOLCANO, Move_INCINERATE jumpargeq 0, BATTLE_TERRAIN_DISTORTION_WORLD, Move_POUND jumpargeq 0, BATTLE_TERRAIN_SPACE, Move_SWIFT jumpargeq 0, BATTLE_TERRAIN_ULTRA_SPACE, Move_PSYWAVE .if B_SECRET_POWER_ANIMATION >= GEN_7 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_SPIT_UP goto Move_SPIT_UP -.elseif B_SECRET_POWER_ANIMATION == GEN_6 +.elseif B_SECRET_POWER_ANIMATION >= GEN_6 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM goto Move_BODY_SLAM -.elseif B_SECRET_POWER_ANIMATION == GEN_5 || B_SECRET_POWER_ANIMATION == GEN_4 +.elseif B_SECRET_POWER_ANIMATION >= GEN_4 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM goto Move_MUD_SLAP .else + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH goto Move_SLAM .endif diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 5e9984c550..6faff81228 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -77,7 +77,7 @@ // Move stat change settings #define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. -#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. +#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen8+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. #define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage. #define B_CHARGE_SPDEF_RAISE GEN_7 // In Gen5+, Charge raises the user's Special Defense by 1 stage. #define B_MINIMIZE_EVASION GEN_7 // In Gen5+, Minimize raises evasion by 2 stages instead of 1. @@ -117,9 +117,8 @@ #define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. #define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end. #define B_CONFUSE_BERRIES_HEAL GEN_8 // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP. - // Requires using Item Expansion or manually editing the holdEffectParam of Figy, Wiki, Mago, Aguav and Iapapa berries. #define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. -#define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable +#define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before. #define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. #define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. #define B_NET_BALL_MODIFIER GEN_7 // In Gen7+, Net Ball's catch multiplier is x5 instead of x3. diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 732dea7807..dc5fd413d1 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -141,9 +141,11 @@ static u32 GetWildAiFlags(void) flags |= AI_FLAG_PREFER_STRONGEST_MOVE; if (avgLevel >= 80) flags |= AI_FLAG_HP_AWARE; - - if (B_VAR_WILD_AI_FLAGS != 0 && VarGet(B_VAR_WILD_AI_FLAGS) != 0) + +#if B_VAR_WILD_AI_FLAGS != 0 + if (VarGet(B_VAR_WILD_AI_FLAGS) != 0) flags |= VarGet(B_VAR_WILD_AI_FLAGS); +#endif return flags; } @@ -1273,10 +1275,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; case EFFECT_OHKO: - if (B_SHEER_COLD_IMMUNITY >= GEN_7 - && move == MOVE_SHEER_COLD - && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) + #if B_SHEER_COLD_IMMUNITY >= GEN_7 + if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) return 0; + #endif if (!ShouldTryOHKO(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move)) score -= 10; break; @@ -1304,8 +1306,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 8; else if (AI_DATA->hpPercents[battlerAtk] <= 25) score -= 10; - else if (B_SOUND_SUBSTITUTE >= GEN_6 && TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND)) + #if B_SOUND_SUBSTITUTE >= GEN_6 + else if (TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND)) score -= 8; + #endif break; case EFFECT_LEECH_SEED: if (gStatuses3[battlerDef] & STATUS3_LEECHSEED @@ -1317,8 +1321,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_DISABLE: if (gDisableStructs[battlerDef].disableTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB) - && !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB + #endif + && !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first { @@ -1337,8 +1343,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_ENCORE: if (gDisableStructs[battlerDef].encoreTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB) - && !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB + #endif + && !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first { @@ -1570,9 +1578,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; } - - if (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB) + #if B_MENTAL_HERB >= GEN_5 + if (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB) score -= 6; + #endif break; case EFFECT_WILL_O_WISP: if (!AI_CanBurn(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) @@ -3543,7 +3552,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_DISABLE: if (gDisableStructs[battlerDef].disableTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)) // mental herb + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb + #endif + ) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // AI goes first { @@ -3565,7 +3577,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_ENCORE: if (gDisableStructs[battlerDef].encoreTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)) // mental herb + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb + #endif + ) { if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect)) score += 3; @@ -3614,7 +3629,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { bool32 canSteal = FALSE; - #if defined B_TRAINERS_KNOCK_OFF_ITEMS && B_TRAINERS_KNOCK_OFF_ITEMS == TRUE + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE canSteal = TRUE; #endif if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 25c7f3b9d5..2ebd6a8a2d 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -600,21 +600,25 @@ bool32 AtMaxHp(u8 battlerId) bool32 IsBattlerTrapped(u8 battler, bool8 checkSwitch) { u8 holdEffect = AI_DATA->holdEffects[battler]; - if ((B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) - || (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL) - || (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY) - || (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)) - { + +#if B_GHOSTS_ESCAPE >= GEN_6 + if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) return FALSE; - } - else - { - if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED) - || IsAbilityPreventingEscape(battler) - || gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED) - || (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)) - return TRUE; - } +#endif + if (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL) + return FALSE; + else if (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY) + return FALSE; + else if (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) + return FALSE; + else if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) + return TRUE; + else if (gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED)) + return TRUE; + else if (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK) + return TRUE; + else if (IsAbilityPreventingEscape(battler)) + return TRUE; return FALSE; } @@ -647,9 +651,11 @@ bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler) // move checks bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect) { - if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)) - || ability == ABILITY_OVERCOAT - || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES) + if (ability == ABILITY_OVERCOAT + #if B_POWDER_GRASS >= GEN_6 + || IS_BATTLER_OF_TYPE(battler, TYPE_GRASS) + #endif + || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES) return FALSE; return TRUE; } @@ -1415,8 +1421,10 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move) if (AI_DATA->abilities[battlerDef] == ABILITY_NO_GUARD || AI_DATA->abilities[battlerAtk] == ABILITY_NO_GUARD) return TRUE; - if (B_TOXIC_NEVER_MISS >= GEN_6 && gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON)) +#if B_TOXIC_NEVER_MISS >= GEN_6 + if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON)) return TRUE; +#endif // discouraged from hitting if (AI_WeatherHasEffect() && (gBattleWeather & B_WEATHER_SUN) @@ -1426,10 +1434,12 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move) // increased accuracy but don't always hit if ((AI_WeatherHasEffect() && (((gBattleWeather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) - || (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) - || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) - || (gBattleMoves[move].accuracy == 0) - || ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))) + || (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) + || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) + #if B_MINIMIZE_DMG_ACC >= GEN_6 + || ((gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)) + #endif + || (gBattleMoves[move].accuracy == 0)) { return TRUE; } @@ -1461,10 +1471,10 @@ bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbilit else // test the odds { u16 odds = accuracy + (gBattleMons[battlerAtk].level - gBattleMons[battlerDef].level); - #if B_SHEER_COLD_ACC >= GEN_7 - if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) - odds -= 10; - #endif + #if B_SHEER_COLD_ACC >= GEN_7 + if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) + odds -= 10; + #endif if (Random() % 100 + 1 < odds && gBattleMons[battlerAtk].level >= gBattleMons[battlerDef].level) return TRUE; } @@ -2240,10 +2250,15 @@ static u32 GetTrapDamage(u8 battlerId) if (gBattleMons[battlerId].status2 & STATUS2_WRAPPED) { if (holdEffect == HOLD_EFFECT_BINDING_BAND) - damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6) ? 6 : 8; + #if B_BINDING_DAMAGE >= GEN_6 + damage = gBattleMons[battlerId].maxHP / 6; else - damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6) ? 8 : 16; - + damage = gBattleMons[battlerId].maxHP / 8; + #else + damage = gBattleMons[battlerId].maxHP / 8; + else + damage = gBattleMons[battlerId].maxHP / 16; + #endif if (damage == 0) damage = 1; } @@ -2462,14 +2477,22 @@ bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 mo return PIVOT; // Won't get the two turns, pivot if (!IS_MOVE_STATUS(move) && (shouldSwitch - || (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH - || (defAbility == ABILITY_STURDY && B_STURDY >= GEN_5) || defAbility == ABILITY_MULTISCALE || defAbility == ABILITY_SHADOW_SHIELD)))) + || (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH + #if B_STURDY >= GEN_5 + || defAbility == ABILITY_STURDY + #endif + || defAbility == ABILITY_MULTISCALE + || defAbility == ABILITY_SHADOW_SHIELD)))) return PIVOT; // pivot to break sash/sturdy/multiscale } else if (!hasStatBoost) { if (!IS_MOVE_STATUS(move) && (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH - || (defAbility == ABILITY_STURDY && B_STURDY >= GEN_5) || defAbility == ABILITY_MULTISCALE || defAbility == ABILITY_SHADOW_SHIELD))) + #if B_STURDY >= GEN_5 + || (defAbility == ABILITY_STURDY) + #endif + || defAbility == ABILITY_MULTISCALE + || defAbility == ABILITY_SHADOW_SHIELD))) return PIVOT; // pivot to break sash/sturdy/multiscale if (shouldSwitch) @@ -2608,7 +2631,7 @@ bool32 CanKnockOffItem(u8 battler, u16 item) | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_SECRET_BASE - #if defined B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE | BATTLE_TYPE_TRAINER #endif )) && GetBattlerSide(battler) == B_SIDE_PLAYER) diff --git a/src/battle_anim.c b/src/battle_anim.c index e3885ec4eb..c4198dc9e2 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1266,10 +1266,10 @@ static void LoadDefaultBg(void) { if (IsContest()) LoadContestBgAfterMoveAnim(); - #if B_TERRAIN_BG_CHANGE == TRUE +#if B_TERRAIN_BG_CHANGE == TRUE else if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) DrawTerrainTypeBattleBackground(); - #endif +#endif else DrawMainBattleBackground(); } diff --git a/src/battle_bg.c b/src/battle_bg.c index 3965be2eab..faaae248ad 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -870,11 +870,11 @@ void LoadBattleTextboxAndBackground(void) CopyBgTilemapBufferToVram(0); LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40); LoadBattleMenuWindowGfx(); - #if B_TERRAIN_BG_CHANGE == TRUE - DrawTerrainTypeBattleBackground(); - #else - DrawMainBattleBackground(); - #endif +#if B_TERRAIN_BG_CHANGE == TRUE + DrawTerrainTypeBattleBackground(); +#else + DrawMainBattleBackground(); +#endif } static void DrawLinkBattleParticipantPokeballs(u8 taskId, u8 multiplayerId, u8 bgId, u8 destX, u8 destY) diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index a503c1c7aa..6a33953547 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -1618,7 +1618,7 @@ static void OpponentHandleChooseMove(void) target = GetBattlerAtPosition(Random() & 2); } while (!CanTargetBattler(gActiveBattler, target, move)); - #if B_WILD_NATURAL_ENEMIES == TRUE + #if B_WILD_NATURAL_ENEMIES == TRUE // Don't bother to loop through table if the move can't attack ally if (!(gBattleMoves[move].target & MOVE_TARGET_BOTH)) { @@ -1650,7 +1650,7 @@ static void OpponentHandleChooseMove(void) BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8)); } else - #endif + #endif BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8)); } else diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 8195414955..4dad0c4329 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -330,12 +330,14 @@ static void HandleInputChooseAction(void) { SwapHpBarsWithHpText(); } - else if (B_ENABLE_DEBUG && gMain.newKeys & SELECT_BUTTON) +#if B_ENABLE_DEBUG == TRUE + else if (gMain.newKeys & SELECT_BUTTON) { BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_DEBUG, 0); PlayerBufferExecCompleted(); } - #if B_LAST_USED_BALL == TRUE +#endif +#if B_LAST_USED_BALL == TRUE else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall()) { PlaySE(SE_SELECT); @@ -343,7 +345,7 @@ static void HandleInputChooseAction(void) BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_THROW_BALL, 0); PlayerBufferExecCompleted(); } - #endif +#endif } static void UnusedEndBounceEffect(void) @@ -652,26 +654,25 @@ static void HandleInputChooseMove(void) canSelectTarget = 0; } + #if B_SHOW_TARGETS == TRUE // Show all available targets for multi-target moves - if (B_SHOW_TARGETS) + if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS) { - if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS) - { - u32 i = 0; - for (i = 0; i < gBattlersCount; i++) - TryShowAsTarget(i); - - canSelectTarget = 3; - } - else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)) - { - TryShowAsTarget(gMultiUsePlayerCursor); - TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor)); - if (moveTarget & MOVE_TARGET_FOES_AND_ALLY) - TryShowAsTarget(BATTLE_PARTNER(gActiveBattler)); - canSelectTarget = 2; - } + u32 i = 0; + for (i = 0; i < gBattlersCount; i++) + TryShowAsTarget(i); + + canSelectTarget = 3; } + else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)) + { + TryShowAsTarget(gMultiUsePlayerCursor); + TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor)); + if (moveTarget & MOVE_TARGET_FOES_AND_ALLY) + TryShowAsTarget(BATTLE_PARTNER(gActiveBattler)); + canSelectTarget = 2; + } + #endif } switch (canSelectTarget) diff --git a/src/battle_interface.c b/src/battle_interface.c index a504cf1c0e..bdd4b3cd40 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1024,10 +1024,10 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHPBoxes) if (indicatorSpriteId != 0xFF) gSprites[indicatorSpriteId].oam.priority = priority; - #if B_HIDE_HEALTHBOX_IN_ANIMS + #if B_HIDE_HEALTHBOX_IN_ANIMS if (hideHPBoxes && IsBattlerAlive(i)) TryToggleHealboxVisibility(priority, healthboxLeftSpriteId, healthboxRightSpriteId, healthbarSpriteId, indicatorSpriteId); - #endif + #endif } } @@ -3119,10 +3119,11 @@ static void RestoreOverwrittenPixels(u8 *tiles) void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) { +#if B_ABILITY_POP_UP == TRUE const s16 (*coords)[2]; u8 spriteId1, spriteId2, battlerPosition, taskId; - if (!B_ABILITY_POP_UP) + return; if (gBattleScripting.abilityPopupOverwrite != 0) @@ -3189,6 +3190,7 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2); PrintAbilityOnAbilityPopUp(ability, spriteId1, spriteId2); RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32)); +#endif } void UpdateAbilityPopup(u8 battlerId) diff --git a/src/battle_main.c b/src/battle_main.c index e64dab4b10..2056838ccd 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3361,10 +3361,11 @@ static void DoBattleIntro(void) } else // Skip party summary since it is a wild battle. { - if (B_FAST_INTRO) - *state = 7; // Don't wait for sprite, print message at the same time. - else - *state = 6; // Wait for sprite to load. + #if B_FAST_INTRO == TRUE + *state = 7; // Don't wait for sprite, print message at the same time. + #else + *state = 6; // Wait for sprite to load. + #endif } break; case 5: // draw party summary in trainer battles @@ -3433,10 +3434,11 @@ static void DoBattleIntro(void) } else { - if (B_FAST_INTRO) - *state = 15; // Wait for text to be printed. - else - *state = 14; // Wait for text and sprite. + #if B_FAST_INTRO == TRUE + *state = 15; // Wait for text to be printed. + #else + *state = 14; // Wait for text and sprite. + #endif } } break; @@ -3474,9 +3476,11 @@ static void DoBattleIntro(void) BtlController_EmitIntroTrainerBallThrow(BUFFER_A); MarkBattlerForControllerExec(gActiveBattler); } - if (B_FAST_INTRO && !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))) + #if B_FAST_INTRO == TRUE + if (!(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))) *state = 15; // Print at the same time as trainer sends out second mon. else + #endif (*state)++; break; case 14: // wait for opponent 2 send out @@ -3496,13 +3500,14 @@ static void DoBattleIntro(void) gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); // A hack that makes fast intro work in trainer battles too. - if (B_FAST_INTRO - && gBattleTypeFlags & BATTLE_TYPE_TRAINER + #if B_FAST_INTRO == TRUE + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK)) && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_SIDE]].callback == SpriteCallbackDummy) { return; } + #endif PrepareStringBattle(STRINGID_INTROSENDOUT, gActiveBattler); } @@ -4456,7 +4461,11 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId) // paralysis drop if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET) - speed /= (B_PARALYSIS_SPEED >= GEN_7 ? 2 : 4); + #if B_PARALYSIS_SPEED >= GEN_7 + speed /= 2; + #else + speed /= 4; + #endif return speed; } @@ -4481,8 +4490,10 @@ s8 GetMovePriority(u32 battlerId, u16 move) priority = gBattleMoves[move].priority; if (ability == ABILITY_GALE_WINGS - && gBattleMoves[move].type == TYPE_FLYING - && (B_GALE_WINGS <= GEN_6 || BATTLER_MAX_HP(battlerId))) + #if B_GALE_WINGS >= GEN_7 + && BATTLER_MAX_HP(battlerId) + #endif + && gBattleMoves[move].type == TYPE_FLYING) { priority++; } @@ -5125,10 +5136,10 @@ static void HandleEndTurn_FinishBattle(void) RecordedBattle_SetPlaybackFinished(); BeginFastPaletteFade(3); FadeOutMapMusic(5); - #if B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) TryRestoreStolenItems(); - #endif + #endif for (i = 0; i < PARTY_SIZE; i++) { UndoMegaEvolution(i); @@ -5170,7 +5181,10 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void) | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_WALLY_TUTORIAL)) - && (B_EVOLUTION_AFTER_WHITEOUT >= GEN_6 || gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT)) + #if B_EVOLUTION_AFTER_WHITEOUT <= GEN_5 + && (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT) + #endif + ) { gBattleMainFunc = TrySpecialEvolution; } @@ -5455,5 +5469,9 @@ void SetTotemBoost(void) bool32 IsWildMonSmart(void) { - return (B_SMART_WILD_AI_FLAG != 0 && FlagGet(B_SMART_WILD_AI_FLAG)); +#if B_SMART_WILD_AI_FLAG != 0 + return (FlagGet(B_SMART_WILD_AI_FLAG)); +#else + return FALSE; +#endif } diff --git a/src/battle_pike.c b/src/battle_pike.c index 229f6211ba..9a0af69cce 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -856,8 +856,10 @@ static bool8 DoesTypePreventStatus(u16 species, u32 status) break; case STATUS1_PARALYSIS: if (gBaseStats[species].type1 == TYPE_GROUND || gBaseStats[species].type2 == TYPE_GROUND - || (B_PARALYZE_ELECTRIC >= GEN_6 && - (gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC))) + #if B_PARALYZE_ELECTRIC >= GEN_6 + || gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC + #endif + ) ret = TRUE; break; case STATUS1_BURN: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 420d5790ce..ee8b213ec1 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1395,10 +1395,10 @@ static void Cmd_attackcanceler(void) gBattlescriptCurrInstr = BattleScript_MoveEnd; return; } - #if (B_STANCE_CHANGE_FAIL <= GEN_6) +#if B_STANCE_CHANGE_FAIL <= GEN_6 if (TryAegiFormChange()) return; - #endif +#endif if (AtkCanceller_UnableToUseMove()) return; @@ -1430,10 +1430,10 @@ static void Cmd_attackcanceler(void) gMoveResultFlags |= MOVE_RESULT_MISSED; return; } - #if (B_STANCE_CHANGE_FAIL >= GEN_7) +#if B_STANCE_CHANGE_FAIL >= GEN_7 if (TryAegiFormChange()) return; - #endif +#endif gHitMarker &= ~HITMARKER_ALLOW_NO_PP; @@ -1601,13 +1601,13 @@ static bool32 AccuracyCalcHelper(u16 move) JumpIfMoveFailed(7, move); return TRUE; } - else if (B_TOXIC_NEVER_MISS >= GEN_6 - && gBattleMoves[move].effect == EFFECT_TOXIC - && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON)) +#if B_TOXIC_NEVER_MISS >= GEN_6 + else if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON)) { JumpIfMoveFailed(7, move); return TRUE; } +#endif // If the attacker has the ability No Guard and they aren't targeting a Pokemon involved in a Sky Drop with the move Sky Drop, move hits. else if (GetBattlerAbility(gBattlerAttacker) == ABILITY_NO_GUARD && (move != MOVE_SKY_DROP || gBattleStruct->skyDropTargets[gBattlerTarget] == 0xFF)) { @@ -1639,14 +1639,40 @@ static bool32 AccuracyCalcHelper(u16 move) return TRUE; } - if ((WEATHER_HAS_EFFECT && - ((IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) - || ((B_BLIZZARD_HAIL >= GEN_4 && (gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) - || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) - || (gBattleMoves[move].accuracy == 0) - || ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))) + if (WEATHER_HAS_EFFECT) + { + if ((IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))) + { + // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella + JumpIfMoveFailed(7, move); + return TRUE; + } + #if B_BLIZZARD_HAIL >= GEN_4 + else if ((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD) + { + // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella + JumpIfMoveFailed(7, move); + return TRUE; + } + #endif + } + + if (gBattleMoves[move].effect == EFFECT_VITAL_THROW) + { + JumpIfMoveFailed(7, move); + return TRUE; + } + +#if B_MINIMIZE_DMG_ACC >= GEN_6 + if ((gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)) + { + JumpIfMoveFailed(7, move); + return TRUE; + } +#endif + + if (gBattleMoves[move].accuracy == 0) { - // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella JumpIfMoveFailed(7, move); return TRUE; } @@ -2885,7 +2911,11 @@ void SetMoveEffect(bool32 primary, u32 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); if (sStatusFlagsForMoveEffects[gBattleScripting.moveEffect] == STATUS1_SLEEP) - gBattleMons[gEffectBattler].status1 |= (B_SLEEP_TURNS >= GEN_5) ? ((Random() % 3) + 2) : ((Random() % 4) + 3); + #if B_SLEEP_TURNS >= GEN_5 + gBattleMons[gEffectBattler].status1 |= ((Random() % 3) + 2); + #else + gBattleMons[gEffectBattler].status1 |= ((Random() % 4) + 3); + #endif else gBattleMons[gEffectBattler].status1 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]; @@ -2987,7 +3017,11 @@ void SetMoveEffect(bool32 primary, u32 certain) { gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS; gLockedMoves[gEffectBattler] = gCurrentMove; - gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN(B_UPROAR_TURNS >= GEN_5 ? 3 : ((Random() & 3) + 2)); + #if B_UPROAR_TURNS >= GEN_5 + gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN(3); + #else + gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN((Random() & 3) + 2); + #endif BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect]; @@ -3042,9 +3076,15 @@ void SetMoveEffect(bool32 primary, u32 certain) { gBattleMons[gEffectBattler].status2 |= STATUS2_WRAPPED; if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_GRIP_CLAW) - gDisableStructs[gEffectBattler].wrapTurns = (B_BINDING_TURNS >= GEN_5) ? 7 : 5; + #if B_BINDING_TURNS >= GEN_5 + gDisableStructs[gEffectBattler].wrapTurns = 7; else - gDisableStructs[gEffectBattler].wrapTurns = (B_BINDING_TURNS >= GEN_5) ? ((Random() % 2) + 4) : ((Random() % 4) + 2); + gDisableStructs[gEffectBattler].wrapTurns = (Random() % 2) + 4; + #else + gDisableStructs[gEffectBattler].wrapTurns = 5; + else + gDisableStructs[gEffectBattler].wrapTurns = (Random() % 4) + 2; + #endif gBattleStruct->wrappedMove[gEffectBattler] = gCurrentMove; gBattleStruct->wrappedBy[gEffectBattler] = gBattlerAttacker; @@ -3459,8 +3499,11 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr++; break; case MOVE_EFFECT_INCINERATE: - if ((B_INCINERATE_GEMS >= GEN_6 && GetBattlerHoldEffect(gEffectBattler, FALSE) == HOLD_EFFECT_GEMS) - || (gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX)) + if ((gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX) + #if B_INCINERATE_GEMS >= GEN_6 + || (GetBattlerHoldEffect(gEffectBattler, FALSE) == HOLD_EFFECT_GEMS) + #endif + ) { gLastUsedItem = gBattleMons[gEffectBattler].item; gBattleMons[gEffectBattler].item = 0; @@ -4004,13 +4047,20 @@ static void Cmd_getexp(void) gBattleMoveDamage = 0; // only give exp share bonus in later gens if the mon wasn't sent out - if ((holdEffect == HOLD_EFFECT_EXP_SHARE) && ((gBattleMoveDamage == 0) || (B_SPLIT_EXP < GEN_6))) + #if B_SPLIT_EXP < GEN_6 + if (holdEffect == HOLD_EFFECT_EXP_SHARE) gBattleMoveDamage += gExpShareExp; + #else + if (holdEffect == HOLD_EFFECT_EXP_SHARE && gBattleMoveDamage == 0) + gBattleMoveDamage += gExpShareExp; + #endif if (holdEffect == HOLD_EFFECT_LUCKY_EGG) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && B_TRAINER_EXP_MULTIPLIER <= GEN_7) + #if B_TRAINER_EXP_MULTIPLIER <= GEN_7 + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - #if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6) + #endif + #if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6) { // Note: There is an edge case where if a pokemon receives a large amount of exp, it wouldn't be properly calculated // because of multiplying by scaling factor(the value would simply be larger than an u32 can hold). Hence u64 is needed. @@ -4019,7 +4069,7 @@ static void Cmd_getexp(void) value /= sExperienceScalingFactors[gBattleMons[gBattlerFainted].level + GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) + 10]; gBattleMoveDamage = value + 1; } - #endif + #endif if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterMonId])) { @@ -4720,14 +4770,14 @@ static void Cmd_playanimation(void) gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 3); - #if B_TERRAIN_BG_CHANGE == FALSE +#if B_TERRAIN_BG_CHANGE == FALSE if (animId == B_ANIM_RESTORE_BG) { // workaround for .if not working gBattlescriptCurrInstr += 7; return; } - #endif +#endif if (animId == B_ANIM_STATS_CHANGE || animId == B_ANIM_SNATCH_MOVE @@ -5035,7 +5085,11 @@ static void Cmd_moveend(void) i = gBattlerAttacker; gBattlerAttacker = gBattlerTarget; gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable - gBattleScripting.moveEffect = (B_KINGS_SHIELD_LOWER_ATK >= GEN_8) ? MOVE_EFFECT_ATK_MINUS_1 : MOVE_EFFECT_ATK_MINUS_2; + #if B_KINGS_SHIELD_LOWER_ATK >= GEN_8 + gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1; + #else + gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_2; + #endif BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_KingsShieldEffect; effect = 1; @@ -5605,17 +5659,19 @@ static void Cmd_moveend(void) BattleScriptPushCursor(); if (gBattleTypeFlags & BATTLE_TYPE_TRAINER || GetBattlerSide(i) == B_SIDE_PLAYER) { - if (B_ABILITY_POP_UP) - gBattlescriptCurrInstr = BattleScript_EmergencyExit; - else - gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp; + #if B_ABILITY_POP_UP == TRUE + gBattlescriptCurrInstr = BattleScript_EmergencyExit; + #else + gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp; + #endif } else { - if (B_ABILITY_POP_UP) - gBattlescriptCurrInstr = BattleScript_EmergencyExitWild; - else - gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp; + #if B_ABILITY_POP_UP == TRUE + gBattlescriptCurrInstr = BattleScript_EmergencyExitWild; + #else + gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp; + #endif } return; } @@ -5628,12 +5684,12 @@ static void Cmd_moveend(void) if (gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget) *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget & 0x3; - #if B_RAMPAGE_CANCELLING >= GEN_5 + #if B_RAMPAGE_CANCELLING >= GEN_5 if (gBattleMoves[gCurrentMove].effect == EFFECT_RAMPAGE // If we're rampaging && (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) // And it is unusable && (gBattleMons[gBattlerAttacker].status2 & STATUS2_LOCK_CONFUSE) != STATUS2_LOCK_CONFUSE_TURN(1)) // And won't end this turn CancelMultiTurnMoves(gBattlerAttacker); // Cancel it - #endif + #endif gProtectStructs[gBattlerAttacker].usesBouncedMove = FALSE; gProtectStructs[gBattlerAttacker].targetAffected = FALSE; @@ -8361,11 +8417,11 @@ static void Cmd_various(void) && !NoAliveMonsForEitherParty() && CompareStat(gBattlerAttacker, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN)) { - if (B_FELL_STINGER_STAT_RAISE >= GEN_7) - SET_STATCHANGER(STAT_ATK, 3, FALSE); - else - SET_STATCHANGER(STAT_ATK, 2, FALSE); - + #if B_FELL_STINGER_STAT_RAISE >= GEN_7 + SET_STATCHANGER(STAT_ATK, 3, FALSE); + #else + SET_STATCHANGER(STAT_ATK, 2, FALSE); + #endif PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK); BattleScriptPush(gBattlescriptCurrInstr + 3); gBattlescriptCurrInstr = BattleScript_FellStingerRaisesStat; @@ -9944,13 +10000,16 @@ static void Cmd_manipulatedamage(void) gBattleMoveDamage *= -1; break; case DMG_RECOIL_FROM_MISS: + #if B_RECOIL_IF_MISS_DMG >= GEN_5 + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; + #elif B_RECOIL_IF_MISS_DMG == GEN_4 + if ((gBattleMons[gBattlerTarget].maxHP / 2) < gBattleMoveDamage) + gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2; + #else gBattleMoveDamage /= 2; + #endif if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if (B_RECOIL_IF_MISS_DMG >= GEN_5) - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; - if ((B_RECOIL_IF_MISS_DMG <= GEN_4) && ((gBattleMons[gBattlerTarget].maxHP / 2) < gBattleMoveDamage)) - gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2; break; case DMG_DOUBLED: gBattleMoveDamage *= 2; @@ -10569,8 +10628,9 @@ static void Cmd_setmultihitcounter(void) { gMultiHitCounter = 5; } - else if (B_MULTI_HIT_CHANCE >= GEN_5) + else { + #if B_MULTI_HIT_CHANCE >= GEN_5 // 2 and 3 hits: 33.3% // 4 and 5 hits: 16.7% gMultiHitCounter = Random() % 4; @@ -10584,9 +10644,7 @@ static void Cmd_setmultihitcounter(void) } else gMultiHitCounter += 3; - } - else - { + #else // 2 and 3 hits: 37.5% // 4 and 5 hits: 12.5% gMultiHitCounter = Random() % 4; @@ -10594,6 +10652,7 @@ static void Cmd_setmultihitcounter(void) gMultiHitCounter = (Random() % 4) + 2; else gMultiHitCounter += 2; + #endif } } @@ -10987,10 +11046,10 @@ static void Cmd_tryKO(void) else { u16 odds = gBattleMoves[gCurrentMove].accuracy + (gBattleMons[gBattlerAttacker].level - gBattleMons[gBattlerTarget].level); - #if B_SHEER_COLD_ACC >= GEN_7 - if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) - odds -= 10; - #endif + #if B_SHEER_COLD_ACC >= GEN_7 + if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) + odds -= 10; + #endif if (Random() % 100 + 1 < odds && gBattleMons[gBattlerAttacker].level >= gBattleMons[gBattlerTarget].level) lands = TRUE; } @@ -11354,10 +11413,11 @@ static void Cmd_dmgtolevel(void) static void Cmd_psywavedamageeffect(void) { s32 randDamage; - if (B_PSYWAVE_DMG >= GEN_6) - randDamage = (Random() % 101); - else - randDamage = (Random() % 11) * 10; +#if B_PSYWAVE_DMG >= GEN_6 + randDamage = (Random() % 101); +#else + randDamage = (Random() % 11) * 10; +#endif gBattleMoveDamage = gBattleMons[gBattlerAttacker].level * (randDamage + 50) / 100; gBattlescriptCurrInstr++; } @@ -11428,12 +11488,13 @@ static void Cmd_disablelastusedattack(void) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerTarget].moves[i]) gDisableStructs[gBattlerTarget].disabledMove = gBattleMons[gBattlerTarget].moves[i]; - if (B_DISABLE_TURNS == GEN_3) - gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2; - else if (B_DISABLE_TURNS == GEN_4) - gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4; - else - gDisableStructs[gBattlerTarget].disableTimer = 4; + #if B_DISABLE_TURNS == GEN_3 + gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2; + #elif B_DISABLE_TURNS == GEN_4 + gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4; + #else + gDisableStructs[gBattlerTarget].disableTimer = 4; + #endif gDisableStructs[gBattlerTarget].disableTimerStartValue = gDisableStructs[gBattlerTarget].disableTimer; // used to save the random amount of turns? gBattlescriptCurrInstr += 5; } @@ -11711,7 +11772,11 @@ static void Cmd_settailwind(void) { gSideStatuses[side] |= SIDE_STATUS_TAILWIND; gSideTimers[side].tailwindBattlerId = gBattlerAttacker; - gSideTimers[side].tailwindTimer = (B_TAILWIND_TURNS >= GEN_5) ? 4 : 3; + #if B_TAILWIND_TURNS >= GEN_5 + gSideTimers[side].tailwindTimer = 4; + #else + gSideTimers[side].tailwindTimer = 3; + #endif gBattlescriptCurrInstr += 5; } else @@ -12634,7 +12699,7 @@ static void Cmd_tryswapitems(void) | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_RECORDED_LINK - #if B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE | BATTLE_TYPE_TRAINER #endif )))) @@ -12773,14 +12838,14 @@ static void Cmd_trywish(void) break; case 1: // heal effect PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerTarget, gWishFutureKnock.wishPartyId[gBattlerTarget]) - #if B_WISH_HP_SOURCE >= GEN_5 - if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER) - gBattleMoveDamage = max(1, GetMonData(&gPlayerParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); - else - gBattleMoveDamage = max(1, GetMonData(&gEnemyParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); - #else - gBattleMoveDamage = max(1, gBattleMons[gBattlerTarget].maxHP / 2); - #endif + #if B_WISH_HP_SOURCE >= GEN_5 + if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER) + gBattleMoveDamage = max(1, GetMonData(&gPlayerParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); + else + gBattleMoveDamage = max(1, GetMonData(&gEnemyParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); + #else + gBattleMoveDamage = max(1, gBattleMons[gBattlerTarget].maxHP / 2); + #endif gBattleMoveDamage *= -1; if (gBattleMons[gBattlerTarget].hp == gBattleMons[gBattlerTarget].maxHP) @@ -13180,45 +13245,40 @@ u16 GetSecretPowerMoveEffect(void) { switch (gBattleTerrain) { - case BATTLE_TERRAIN_GRASS: - #if B_SECRET_POWER_EFFECT >= GEN_4 - moveEffect = MOVE_EFFECT_SLEEP; - #else - moveEffect = MOVE_EFFECT_POISON; - #endif - break; + #if B_SECRET_POWER_EFFECT >= GEN_6 + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; + #elif B_SECRET_POWER_EFFECT >= GEN_5 + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; + #elif B_SECRET_POWER_EFFECT >= GEN_4 + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_FLINCH; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + #else + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_POISON; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_CONFUSION; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + #endif case BATTLE_TERRAIN_LONG_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; case BATTLE_TERRAIN_SAND: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; - case BATTLE_TERRAIN_UNDERWATER: - #if B_SECRET_POWER_EFFECT >= GEN_6 - moveEffect = MOVE_EFFECT_ATK_MINUS_1; - #else - moveEffect = MOVE_EFFECT_DEF_MINUS_1; - #endif - break; case BATTLE_TERRAIN_WATER: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; - case BATTLE_TERRAIN_POND: - #if B_SECRET_POWER_EFFECT >= GEN_4 - moveEffect = MOVE_EFFECT_ATK_MINUS_1; - #else - moveEffect = MOVE_EFFECT_SPD_MINUS_1; - #endif - break; - case BATTLE_TERRAIN_MOUNTAIN: - #if B_SECRET_POWER_EFFECT >= GEN_5 - moveEffect = MOVE_EFFECT_ACC_MINUS_1; - #elif B_SECRET_POWER_EFFECT == GEN_4 - moveEffect = MOVE_EFFECT_FLINCH; - #else - moveEffect = MOVE_EFFECT_CONFUSION; - #endif - break; case BATTLE_TERRAIN_CAVE: case BATTLE_TERRAIN_BURIAL_GROUND: case BATTLE_TERRAIN_SPACE: @@ -13230,13 +13290,6 @@ u16 GetSecretPowerMoveEffect(void) case BATTLE_TERRAIN_SWAMP: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; - case BATTLE_TERRAIN_PUDDLE: - #if B_SECRET_POWER_EFFECT >= GEN_5 - moveEffect = MOVE_EFFECT_SPD_MINUS_1; - #else - moveEffect = MOVE_EFFECT_ACC_MINUS_1; - #endif - break; case BATTLE_TERRAIN_SNOW: case BATTLE_TERRAIN_ICE: moveEffect = MOVE_EFFECT_FREEZE; @@ -13439,12 +13492,14 @@ bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move) { if (!(gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE)) return FALSE; - else if (gBattleMoves[move].flags & FLAG_SOUND && B_SOUND_SUBSTITUTE >= GEN_6) +#if B_SOUND_SUBSTITUTE >= GEN_6 + else if (gBattleMoves[move].flags & FLAG_SOUND) + return FALSE; +#endif + else if (gBattleMoves[move].flags & FLAG_HIT_IN_SUBSTITUTE) return FALSE; else if (GetBattlerAbility(battlerAtk) == ABILITY_INFILTRATOR) return FALSE; - else if (gBattleMoves[move].flags & FLAG_HIT_IN_SUBSTITUTE) - return FALSE; else return TRUE; } @@ -13576,18 +13631,18 @@ static void Cmd_removelightscreenreflect(void) u8 side; bool32 failed; - #if B_BRICK_BREAK >= GEN_4 - // From Gen 4 onwards, Brick Break can remove screens on the user's side if used on an ally - side = GetBattlerSide(gBattlerTarget); - #else - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; - #endif +#if B_BRICK_BREAK >= GEN_4 +// From Gen 4 onwards, Brick Break can remove screens on the user's side if used on an ally + side = GetBattlerSide(gBattlerTarget); +#else + side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; +#endif - #if B_BRICK_BREAK >= GEN_5 - failed = (gMoveResultFlags & MOVE_RESULT_NO_EFFECT); - #else - failed = FALSE; - #endif +#if B_BRICK_BREAK >= GEN_5 + failed = (gMoveResultFlags & MOVE_RESULT_NO_EFFECT); +#else + failed = FALSE; +#endif if (!failed && (gSideTimers[side].reflectTimer @@ -13673,73 +13728,72 @@ static void Cmd_handleballthrow(void) ballMultiplier = 15; case ITEM_NET_BALL: if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_WATER) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_BUG)) - #if B_NET_BALL_MODIFIER >= GEN_7 - ballMultiplier = 50; - #else - ballMultiplier = 30; - #endif + #if B_NET_BALL_MODIFIER >= GEN_7 + ballMultiplier = 50; + #else + ballMultiplier = 30; + #endif break; case ITEM_DIVE_BALL: + if (GetCurrentMapType() == MAP_TYPE_UNDERWATER #if B_DIVE_BALL_MODIFIER >= GEN_4 - if (GetCurrentMapType() == MAP_TYPE_UNDERWATER || gIsFishingEncounter || gIsSurfingEncounter) - ballMultiplier = 35; - #else - if (GetCurrentMapType() == MAP_TYPE_UNDERWATER) - ballMultiplier = 35; + || gIsFishingEncounter || gIsSurfingEncounter #endif + ) + ballMultiplier = 35; break; case ITEM_NEST_BALL: - #if B_NEST_BALL_MODIFIER >= GEN_6 - //((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise. - if (gBattleMons[gBattlerTarget].level < 30) - ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; - #elif B_NEST_BALL_MODIFIER == GEN_5 - //((41 - Pokémon's level) ÷ 10)×, minimum 1× - if (gBattleMons[gBattlerTarget].level < 31) - ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; - #else - //((40 - Pokémon's level) ÷ 10)×, minimum 1× - if (gBattleMons[gBattlerTarget].level < 40) - { - ballMultiplier = 40 - gBattleMons[gBattlerTarget].level; - if (ballMultiplier <= 9) - ballMultiplier = 10; - } - #endif + #if B_NEST_BALL_MODIFIER >= GEN_6 + //((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise. + if (gBattleMons[gBattlerTarget].level < 30) + ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; + #elif B_NEST_BALL_MODIFIER == GEN_5 + //((41 - Pokémon's level) ÷ 10)×, minimum 1× + if (gBattleMons[gBattlerTarget].level < 31) + ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; + #else + //((40 - Pokémon's level) ÷ 10)×, minimum 1× + if (gBattleMons[gBattlerTarget].level < 40) + { + ballMultiplier = 40 - gBattleMons[gBattlerTarget].level; + if (ballMultiplier <= 9) + ballMultiplier = 10; + } + #endif break; case ITEM_REPEAT_BALL: - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT)) - #if B_REPEAT_BALL_MODIFIER >= GEN_7 - ballMultiplier = 35; - #else - ballMultiplier = 30; - #endif - break; - case ITEM_TIMER_BALL: - #if B_TIMER_BALL_MODIFIER >= GEN_5 - ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10; + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT)) + #if B_REPEAT_BALL_MODIFIER >= GEN_7 + ballMultiplier = 35; #else - ballMultiplier = gBattleResults.battleTurnCounter + 10; + ballMultiplier = 30; #endif + break; + case ITEM_TIMER_BALL: + #if B_TIMER_BALL_MODIFIER >= GEN_5 + ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10; + #else + ballMultiplier = gBattleResults.battleTurnCounter + 10; + #endif if (ballMultiplier > 40) ballMultiplier = 40; break; case ITEM_DUSK_BALL: RtcCalcLocalTime(); if ((gLocalTime.hours >= 20 && gLocalTime.hours <= 3) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND) - #if B_DUSK_BALL_MODIFIER >= GEN_7 - ballMultiplier = 30; - #else - ballMultiplier = 35; - #endif + #if B_DUSK_BALL_MODIFIER >= GEN_7 + ballMultiplier = 30; + #else + ballMultiplier = 35; + #endif break; case ITEM_QUICK_BALL: if (gBattleResults.battleTurnCounter == 0) - #if B_QUICK_BALL_MODIFIER >= GEN_5 - ballMultiplier = 50; - #else - ballMultiplier = 40; - #endif + #if B_QUICK_BALL_MODIFIER >= GEN_5 + ballMultiplier = 50; + #else + ballMultiplier = 40; + #endif break; case ITEM_LEVEL_BALL: if (gBattleMons[gBattlerAttacker].level >= 4 * gBattleMons[gBattlerTarget].level) @@ -13751,11 +13805,11 @@ static void Cmd_handleballthrow(void) break; case ITEM_LURE_BALL: if (gIsFishingEncounter) - #if B_LURE_BALL_MODIFIER >= GEN_7 - ballMultiplier = 50; - #else - ballMultiplier = 30; - #endif + #if B_LURE_BALL_MODIFIER >= GEN_7 + ballMultiplier = 50; + #else + ballMultiplier = 30; + #endif break; case ITEM_MOON_BALL: for (i = 0; i < EVOS_PER_MON; i++) @@ -13781,44 +13835,44 @@ static void Cmd_handleballthrow(void) break; case ITEM_HEAVY_BALL: i = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), 1); - #if B_HEAVY_BALL_MODIFIER >= GEN_7 - if (i < 1000) - ballAddition = -20; - else if (i < 2000) - ballAddition = 0; - else if (i < 3000) - ballAddition = 20; - else - ballAddition = 30; - #elif B_HEAVY_BALL_MODIFIER >= GEN_4 - if (i < 2048) - ballAddition = -20; - else if (i < 3072) - ballAddition = 20; - else if (i < 4096) - ballAddition = 30; - else - ballAddition = 40; - #else - if (i < 1024) - ballAddition = -20; - else if (i < 2048) - ballAddition = 0; - else if (i < 3072) - ballAddition = 20; - else if (i < 4096) - ballAddition = 30; - else - ballAddition = 40; - #endif + #if B_HEAVY_BALL_MODIFIER >= GEN_7 + if (i < 1000) + ballAddition = -20; + else if (i < 2000) + ballAddition = 0; + else if (i < 3000) + ballAddition = 20; + else + ballAddition = 30; + #elif B_HEAVY_BALL_MODIFIER >= GEN_4 + if (i < 2048) + ballAddition = -20; + else if (i < 3072) + ballAddition = 20; + else if (i < 4096) + ballAddition = 30; + else + ballAddition = 40; + #else + if (i < 1024) + ballAddition = -20; + else if (i < 2048) + ballAddition = 0; + else if (i < 3072) + ballAddition = 20; + else if (i < 4096) + ballAddition = 30; + else + ballAddition = 40; + #endif break; case ITEM_DREAM_BALL: - #if B_DREAM_BALL_MODIFIER >= GEN_8 - if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE) - ballMultiplier = 40; - #else - ballMultiplier = 10; - #endif + #if B_DREAM_BALL_MODIFIER >= GEN_8 + if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE) + ballMultiplier = 40; + #else + ballMultiplier = 10; + #endif break; case ITEM_BEAST_BALL: ballMultiplier = 1; @@ -14210,13 +14264,11 @@ static const u16 sTelekinesisBanList[] = { SPECIES_DIGLETT, SPECIES_DUGTRIO, -// #ifdef NEW_POKEMON SPECIES_DIGLETT_ALOLAN, SPECIES_DUGTRIO_ALOLAN, SPECIES_SANDYGAST, SPECIES_PALOSSAND, SPECIES_GENGAR_MEGA, -// #endif }; bool32 IsTelekinesisBannedSpecies(u16 species) @@ -14354,33 +14406,33 @@ static void Cmd_metalburstdamagecalculator(void) static bool32 CriticalCapture(u32 odds) { - #if B_CRITICAL_CAPTURE == TRUE - u32 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); +#if B_CRITICAL_CAPTURE == TRUE + u32 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); - if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650) - odds = 0; - else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650) - odds /= 2; - else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650) - ; // odds = (odds * 100) / 100; - else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650) - odds = (odds * 150) / 100; - else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650) - odds *= 2; - else - odds = (odds * 250) / 100; + if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650) + odds = 0; + else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650) + odds /= 2; + else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650) + ; // odds = (odds * 100) / 100; + else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650) + odds = (odds * 150) / 100; + else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650) + odds *= 2; + else + odds = (odds * 250) / 100; - #ifdef ITEM_CATCHING_CHARM - if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1)) - odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100; - #endif - - odds /= 6; - if ((Random() % 255) < odds) - return TRUE; - - return FALSE; - #else - return FALSE; + #ifdef ITEM_CATCHING_CHARM + if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1)) + odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100; #endif + + odds /= 6; + if ((Random() % 255) < odds) + return TRUE; + + return FALSE; +#else + return FALSE; +#endif } diff --git a/src/battle_util.c b/src/battle_util.c index fd9b699b8e..34999c4edd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -57,6 +57,7 @@ functions instead of at the top of the file with the other declarations. static bool32 TryRemoveScreens(u8 battler); static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId); +static u8 GetFlingPowerFromItemId(u16 itemId); extern const u8 *const gBattleScriptsForMoveEffects[]; extern const u8 *const gBattlescriptsForRunningByItem[]; @@ -2770,8 +2771,11 @@ u8 DoBattlerEndTurnEffects(void) && gBattleMons[gActiveBattler].hp != 0) { MAGIC_GUARD_CHECK; - - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / (B_BURN_DAMAGE >= GEN_7 ? 16 : 8); + #if B_BURN_DAMAGE >= GEN_7 + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + #else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + #endif if (ability == ABILITY_HEATPROOF) { if (gBattleMoveDamage > (gBattleMoveDamage / 2) + 1) // Record ability if the burn takes less damage than it normally would. @@ -2832,9 +2836,15 @@ u8 DoBattlerEndTurnEffects(void) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[gActiveBattler]); gBattlescriptCurrInstr = BattleScript_WrapTurnDmg; if (GetBattlerHoldEffect(gBattleStruct->wrappedBy[gActiveBattler], TRUE) == HOLD_EFFECT_BINDING_BAND) - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / ((B_BINDING_DAMAGE >= GEN_6) ? 6 : 8); + #if B_BINDING_DAMAGE >= GEN_6 + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 6; else - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / ((B_BINDING_DAMAGE >= GEN_6) ? 8 : 16); + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + #else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + #endif if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -3025,7 +3035,11 @@ u8 DoBattlerEndTurnEffects(void) } else { - gBattleMons[gActiveBattler].status1 |= (B_SLEEP_TURNS >= GEN_5) ? ((Random() % 3) + 2) : ((Random() % 4) + 3); + #if B_SLEEP_TURNS >= GEN_5 + gBattleMons[gActiveBattler].status1 |= ((Random() % 3) + 2); + #else + gBattleMons[gActiveBattler].status1 |= ((Random() % 4) + 3); + #endif BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); MarkBattlerForControllerExec(gActiveBattler); BattleScriptExecute(BattleScript_YawnMakesAsleep); @@ -3290,7 +3304,7 @@ bool8 HandleFaintedMonActions(void) gBattleStruct->faintedActionsState = 3; else gBattleStruct->faintedActionsState = 1; - #if B_FAINT_SWITCH_IN >= GEN_4 + #if B_FAINT_SWITCH_IN >= GEN_4 // Don't switch mons until all pokemon performed their actions or the battle's over. if (gBattleOutcome == 0 && !NoAliveMonsForEitherParty() @@ -3299,10 +3313,10 @@ bool8 HandleFaintedMonActions(void) gAbsentBattlerFlags |= gBitTable[gBattlerFainted]; return FALSE; } - #endif + #endif break; case 3: - #if B_FAINT_SWITCH_IN >= GEN_4 + #if B_FAINT_SWITCH_IN >= GEN_4 // Don't switch mons until all pokemon performed their actions or the battle's over. if (gBattleOutcome == 0 && !NoAliveMonsForEitherParty() @@ -3310,7 +3324,7 @@ bool8 HandleFaintedMonActions(void) { return FALSE; } - #endif + #endif gBattleStruct->faintedActionsBattlerId = 0; gBattleStruct->faintedActionsState++; // fall through @@ -3572,7 +3586,12 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleMons[gBattlerAttacker].status2 -= STATUS2_CONFUSION_TURN(1); if (gBattleMons[gBattlerAttacker].status2 & STATUS2_CONFUSION) { - if (Random() % ((B_CONFUSION_SELF_DMG_CHANCE >= GEN_7) ? 3 : 2) == 0) // confusion dmg + // confusion dmg + #if B_CONFUSION_SELF_DMG_CHANCE >= GEN_7 + if (Random() % 3 == 0) + #else + if (Random() % 2 == 0) + #endif { gBattleCommunication[MULTISTRING_CHOOSER] = TRUE; gBattlerTarget = gBattlerAttacker; @@ -3675,8 +3694,11 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_POWDER_MOVE: if ((gBattleMoves[gCurrentMove].flags & FLAG_POWDER) && (gBattlerAttacker != gBattlerTarget)) { - if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS)) - || GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) + #if B_POWDER_GRASS >= GEN_6 + if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS) || GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) + #else + if (GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) + #endif { gBattlerAbility = gBattlerTarget; effect = 1; @@ -4003,19 +4025,20 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) { u16 battlerAbility = GetBattlerAbility(battler); - if (viaAbility && B_ABILITY_WEATHER <= GEN_5 - && !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1])) + if (gBattleWeather & B_WEATHER_PRIMAL_ANY + && battlerAbility != ABILITY_DESOLATE_LAND + && battlerAbility != ABILITY_PRIMORDIAL_SEA + && battlerAbility != ABILITY_DELTA_STREAM) + { + return FALSE; + } +#if B_ABILITY_WEATHER <= GEN_5 + else if (viaAbility && !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1])) { gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]); return TRUE; } - else if (gBattleWeather & B_WEATHER_PRIMAL_ANY - && battlerAbility != ABILITY_DESOLATE_LAND - && battlerAbility != ABILITY_PRIMORDIAL_SEA - && battlerAbility != ABILITY_DELTA_STREAM) - { - return FALSE; - } +#endif else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0]); @@ -4214,7 +4237,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); effect++; } - #if B_THUNDERSTORM_TERRAIN == TRUE + #if B_THUNDERSTORM_TERRAIN == TRUE else if (GetCurrentWeather() == WEATHER_RAIN_THUNDERSTORM && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)) { // overworld weather started rain, so just do electric terrain anim @@ -4223,7 +4246,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); effect++; } - #endif + #endif break; case ABILITYEFFECT_SWITCH_IN_WEATHER: if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) @@ -4745,7 +4768,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (gDisableStructs[battler].isFirstTurn != 2) { u32 validToRaise = 0, validToLower = 0; - u32 statsNum = (B_MOODY_ACC_EVASION != GEN_8) ? NUM_BATTLE_STATS : NUM_STATS; + #if B_MOODY_ACC_EVASION < GEN_8 + u32 statsNum = NUM_BATTLE_STATS; + #else + u32 statsNum = NUM_STATS; + #endif for (i = STAT_ATK; i < statsNum; i++) { @@ -4932,7 +4959,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect = 2, statId = STAT_ATK; break; case ABILITY_FLASH_FIRE: - if (moveType == TYPE_FIRE && !((gBattleMons[battler].status1 & STATUS1_FREEZE) && B_FLASH_FIRE_FROZEN <= GEN_4)) + if (moveType == TYPE_FIRE + #if B_FLASH_FIRE_FROZEN <= GEN_4 + && !(gBattleMons[battler].status1 & STATUS1_FREEZE) + #endif + ) { if (!(gBattleResources->flags->flags[battler] & RESOURCE_FLAG_FLASH_FIRE)) { @@ -5958,15 +5989,15 @@ u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability) u32 IsAbilityPreventingEscape(u32 battlerId) { u32 id; - #if B_GHOSTS_ESCAPE >= GEN_6 - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) - return 0; - #endif - #if B_SHADOW_TAG_ESCAPE >= GEN_4 - if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG) - #else - if (id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) - #endif +#if B_GHOSTS_ESCAPE >= GEN_6 + if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) + return 0; +#endif +#if B_SHADOW_TAG_ESCAPE >= GEN_4 + if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG) +#else + if (id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) +#endif return id; if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_ARENA_TRAP)) && IsBattlerGrounded(battlerId)) return id; @@ -5980,7 +6011,11 @@ bool32 CanBattlerEscape(u32 battlerId) // no ability check { if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_SHED_SHELL) return TRUE; - else if ((B_GHOSTS_ESCAPE >= GEN_6 && !IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) && gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) +#if B_GHOSTS_ESCAPE >= GEN_6 + else if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) + return TRUE; +#endif + else if (gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) return FALSE; else if (gStatuses3[battlerId] & STATUS3_ROOTED) return FALSE; @@ -6078,13 +6113,16 @@ bool32 CanBeBurned(u8 battlerId) bool32 CanBeParalyzed(u8 battlerId) { u16 ability = GetBattlerAbility(battlerId); - if ((B_PARALYZE_ELECTRIC >= GEN_6 && IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC)) - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD - || ability == ABILITY_LIMBER - || ability == ABILITY_COMATOSE - || gBattleMons[battlerId].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + if ( + #if B_PARALYZE_ELECTRIC >= GEN_6 + IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC) || + #endif + gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD + || ability == ABILITY_LIMBER + || ability == ABILITY_COMATOSE + || gBattleMons[battlerId].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battlerId) + || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } @@ -6146,11 +6184,11 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId) static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2) { + if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId) #if B_HEAL_BLOCKING >= GEN_5 - if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) -#else - if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId)) + && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) #endif + ) { PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavorId); @@ -6338,12 +6376,11 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal) { -#if B_HEAL_BLOCKING >= GEN_5 - if (HasEnoughHpToEatBerry(battlerId, 2, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) -#else - if (HasEnoughHpToEatBerry(battlerId, 2, itemId) -#endif - && !(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)) + if (!(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP) + #if B_HEAL_BLOCKING >= GEN_5 + && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + #endif + && HasEnoughHpToEatBerry(battlerId, 2, itemId)) { if (percentHeal) gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1; @@ -6388,46 +6425,46 @@ static bool32 GetMentalHerbEffect(u8 battlerId) StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); ret = TRUE; } - #if B_MENTAL_HERB >= GEN_5 - // Check taunt - if (gDisableStructs[battlerId].tauntTimer != 0) - { - gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); - ret = TRUE; - } - // Check encore - if (gDisableStructs[battlerId].encoreTimer != 0) - { - gDisableStructs[battlerId].encoredMove = 0; - gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED - ret = TRUE; - } - // Check torment - if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) - { - gBattleMons[battlerId].status2 &= ~STATUS2_TORMENT; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT; - ret = TRUE; - } - // Check heal block - if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) - { - gStatuses3[battlerId] &= ~STATUS3_HEAL_BLOCK; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK; - ret = TRUE; - } - // Check disable - if (gDisableStructs[battlerId].disableTimer != 0) - { - gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0; - gDisableStructs[battlerId].disabledMove = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; - ret = TRUE; - } - #endif +#if B_MENTAL_HERB >= GEN_5 + // Check taunt + if (gDisableStructs[battlerId].tauntTimer != 0) + { + gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); + ret = TRUE; + } + // Check encore + if (gDisableStructs[battlerId].encoreTimer != 0) + { + gDisableStructs[battlerId].encoredMove = 0; + gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED + ret = TRUE; + } + // Check torment + if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) + { + gBattleMons[battlerId].status2 &= ~STATUS2_TORMENT; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT; + ret = TRUE; + } + // Check heal block + if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + { + gStatuses3[battlerId] &= ~STATUS3_HEAL_BLOCK; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK; + ret = TRUE; + } + // Check disable + if (gDisableStructs[battlerId].disableTimer != 0) + { + gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0; + gDisableStructs[battlerId].disabledMove = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; + ret = TRUE; + } +#endif return ret; } @@ -6478,48 +6515,39 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) BattleScriptExecute(BattleScript_WhiteHerbEnd2); } break; + #if B_BERRIES_INSTANT >= GEN_4 case HOLD_EFFECT_CONFUSE_SPICY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE); break; case HOLD_EFFECT_CONFUSE_DRY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE); break; case HOLD_EFFECT_CONFUSE_SWEET: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE); break; case HOLD_EFFECT_CONFUSE_BITTER: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE); break; case HOLD_EFFECT_CONFUSE_SOUR: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE); break; case HOLD_EFFECT_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE); break; case HOLD_EFFECT_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE); break; case HOLD_EFFECT_SPEED_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE); break; case HOLD_EFFECT_SP_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE); break; case HOLD_EFFECT_SP_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE); break; case HOLD_EFFECT_CRITICAL_UP: - if (B_BERRIES_INSTANT >= GEN_4 && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battlerId, GetBattlerHoldEffectParam(battlerId), gLastUsedItem)) + if (!(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battlerId, GetBattlerHoldEffectParam(battlerId), gLastUsedItem)) { gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY; BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2); @@ -6527,11 +6555,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_RANDOM_STAT_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE); + effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE); break; case HOLD_EFFECT_CURE_PAR: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS; BattleScriptExecute(BattleScript_BerryCurePrlzEnd2); @@ -6539,7 +6566,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_PSN: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); BattleScriptExecute(BattleScript_BerryCurePsnEnd2); @@ -6547,7 +6574,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_BRN: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_BURN; BattleScriptExecute(BattleScript_BerryCureBrnEnd2); @@ -6555,7 +6582,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_FRZ: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE; BattleScriptExecute(BattleScript_BerryCureFrzEnd2); @@ -6563,7 +6590,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_SLP: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP; gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; @@ -6572,7 +6599,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_STATUS: - if (B_BERRIES_INSTANT >= GEN_4 && (gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) + if ((gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) { i = 0; if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY) @@ -6617,13 +6644,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_RESTORE_HP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE); + effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE); break; case HOLD_EFFECT_RESTORE_PCT_HP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE); + effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE); break; + #endif case HOLD_EFFECT_AIR_BALLOON: effect = ITEM_EFFECT_OTHER; gBattleScripting.battler = battlerId; @@ -6984,62 +7010,52 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) DO_ITEMEFFECT_MOVE_END: switch (battlerHoldEffect) { + #if B_HP_BERRIES >= GEN_4 case HOLD_EFFECT_MICLE_BERRY: - if (B_HP_BERRIES >= GEN_4) - effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE); + effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE); break; case HOLD_EFFECT_RESTORE_HP: - if (B_HP_BERRIES >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE); + effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE); break; + #endif + #if B_BERRIES_INSTANT >= GEN_4 case HOLD_EFFECT_RESTORE_PCT_HP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE); + effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE); break; case HOLD_EFFECT_CONFUSE_SPICY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, FALSE); break; case HOLD_EFFECT_CONFUSE_DRY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, FALSE); break; case HOLD_EFFECT_CONFUSE_SWEET: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, FALSE); break; case HOLD_EFFECT_CONFUSE_BITTER: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, FALSE); break; case HOLD_EFFECT_CONFUSE_SOUR: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, FALSE); break; case HOLD_EFFECT_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, FALSE); break; case HOLD_EFFECT_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, FALSE); break; case HOLD_EFFECT_SPEED_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, FALSE); break; case HOLD_EFFECT_SP_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, FALSE); break; case HOLD_EFFECT_SP_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE); break; case HOLD_EFFECT_RANDOM_STAT_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE); + effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE); break; + #endif case HOLD_EFFECT_CURE_PAR: if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) { @@ -7173,10 +7189,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) switch (atkHoldEffect) { case HOLD_EFFECT_FLINCH: - #if B_SERENE_GRACE_BOOST >= GEN_5 - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE) - atkHoldEffectParam *= 2; - #endif + #if B_SERENE_GRACE_BOOST >= GEN_5 + if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE) + atkHoldEffectParam *= 2; + #endif if (gBattleMoveDamage != 0 // Need to have done damage && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED @@ -7722,9 +7738,12 @@ u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating) gPotentialItemEffectBattler = battlerId; - if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId] != 0 && gBattleMons[battlerId].item) +#if B_ENABLE_DEBUG == TRUE + if (gBattleStruct->debugHoldEffects[battlerId] != 0 && gBattleMons[battlerId].item) return gBattleStruct->debugHoldEffects[battlerId]; - else if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) + else +#endif + if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) return gEnigmaBerries[battlerId].holdEffect; else return ItemId_GetHoldEffect(gBattleMons[battlerId].item); @@ -8058,7 +8077,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) // todo break; case EFFECT_FLING: - basePower = ItemId_GetFlingPower(gBattleMons[battlerAtk].item); + basePower = GetFlingPowerFromItemId(gBattleMons[battlerAtk].item); break; case EFFECT_ERUPTION: basePower = gBattleMons[battlerAtk].hp * basePower / gBattleMons[battlerAtk].maxHP; @@ -8202,7 +8221,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) break; case EFFECT_PAYBACK: if (GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef) - && (gDisableStructs[battlerDef].isFirstTurn != 2 || B_PAYBACK_SWITCH_BOOST < GEN_5)) + #if B_PAYBACK_SWITCH_BOOST >= GEN_5 + && (gDisableStructs[battlerDef].isFirstTurn != 2) + #endif + ) basePower *= 2; break; case EFFECT_BOLT_BEAK: @@ -8488,11 +8510,11 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_SOUL_DEW: - #if B_SOUL_DEW_BOOST >= GEN_7 + #if B_SOUL_DEW_BOOST >= GEN_7 if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && (moveType == TYPE_PSYCHIC || moveType == TYPE_DRAGON)) - #else + #else if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && IS_MOVE_SPECIAL(move)) - #endif + #endif MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_GEMS: @@ -8575,6 +8597,12 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe break; } +#if B_TERRAIN_TYPE_BOOST >= GEN_8 + #define TERRAIN_TYPE_BOOST UQ_4_12(1.3) +#else + #define TERRAIN_TYPE_BOOST UQ_4_12(1.5) +#endif + // various effecs if (gProtectStructs[battlerAtk].helpingHand) MulModifier(&modifier, UQ_4_12(1.5)); @@ -8583,24 +8611,28 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe if (gStatuses3[battlerAtk] & STATUS3_ME_FIRST) MulModifier(&modifier, UQ_4_12(1.5)); if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && moveType == TYPE_GRASS && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); + MulModifier(&modifier, TERRAIN_TYPE_BOOST); if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && moveType == TYPE_DRAGON && IsBattlerGrounded(battlerDef) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) MulModifier(&modifier, UQ_4_12(0.5)); if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && moveType == TYPE_ELECTRIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); + MulModifier(&modifier, TERRAIN_TYPE_BOOST); if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && moveType == TYPE_PSYCHIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); + MulModifier(&modifier, TERRAIN_TYPE_BOOST); #if B_SPORT_TURNS >= GEN_6 - if ((gFieldStatuses & STATUS_FIELD_MUDSPORT && moveType == TYPE_ELECTRIC) - || (gFieldStatuses & STATUS_FIELD_WATERSPORT && moveType == TYPE_FIRE)) - MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5)); + if ((moveType == TYPE_ELECTRIC && gFieldStatuses & STATUS_FIELD_MUDSPORT) + || (moveType == TYPE_FIRE && gFieldStatuses & STATUS_FIELD_WATERSPORT)) #else if ((moveType == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_MUD_SPORT, 0)) - || (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))) - MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5)); + || (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))) + #endif + #if B_SPORT_DMG_REDUCTION >= GEN_5 + MulModifier(&modifier, UQ_4_12(0.23)); + #else + MulModifier(&modifier, UQ_4_12(0.5)); #endif return ApplyModifier(modifier, basePower); } +#undef TERRAIN_TYPE_BOOST static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 isCrit, bool32 updateFlags) { @@ -8976,11 +9008,17 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move // check crit if (isCrit) - dmg = ApplyModifier((B_CRIT_MULTIPLIER >= GEN_6 ? UQ_4_12(1.5) : UQ_4_12(2.0)), dmg); + #if B_CRIT_MULTIPLIER >= GEN_6 + dmg = ApplyModifier(UQ_4_12(1.5), dmg); + #else + dmg = ApplyModifier(UQ_4_12(2.0), dmg); + #endif // check burn if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && IS_MOVE_PHYSICAL(move) - && (gBattleMoves[move].effect != EFFECT_FACADE || B_BURN_FACADE_DMG < GEN_6) + #if B_BURN_FACADE_DMG >= GEN_6 + && gBattleMoves[move].effect != EFFECT_FACADE + #endif && abilityAtk != ABILITY_GUTS) dmg = ApplyModifier(UQ_4_12(0.5), dmg); @@ -9254,14 +9292,18 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat RecordAbilityBattle(battlerDef, ABILITY_LEVITATE); } } - else if (B_SHEER_COLD_IMMUNITY >= GEN_7 && move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) +#if B_SHEER_COLD_IMMUNITY >= GEN_7 + else if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) { modifier = UQ_4_12(0.0); } - else if (B_GLARE_GHOST >= GEN_4 && move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) +#endif +#if B_GLARE_GHOST >= GEN_4 + else if (move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) { modifier = UQ_4_12(1.0); } +#endif // Thousand Arrows ignores type modifiers for flying mons if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING) @@ -9327,10 +9369,11 @@ u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilit u16 GetTypeModifier(u8 atkType, u8 defType) { - if (B_FLAG_INVERSE_BATTLE != 0 && FlagGet(B_FLAG_INVERSE_BATTLE)) +#if B_FLAG_INVERSE_BATTLE != 0 + if (FlagGet(B_FLAG_INVERSE_BATTLE)) return sInverseTypeEffectivenessTable[atkType][defType]; - else - return sTypeEffectivenessTable[atkType][defType]; +#endif + return sTypeEffectivenessTable[atkType][defType]; } s32 GetStealthHazardDamage(u8 hazardType, u8 battlerId) @@ -9476,9 +9519,12 @@ bool32 CanMegaEvolve(u8 battlerId) // Check if there is an entry in the evolution table for regular Mega Evolution. if (GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE) { + #if B_ENABLE_DEBUG == TRUE if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId]) holdEffect = gBattleStruct->debugHoldEffects[battlerId]; - else if (itemId == ITEM_ENIGMA_BERRY_E_READER) + else + #endif + if (itemId == ITEM_ENIGMA_BERRY_E_READER) holdEffect = gEnigmaBerries[battlerId].holdEffect; else holdEffect = ItemId_GetHoldEffect(itemId); @@ -9679,9 +9725,8 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId) bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) { - if (B_BADGE_BOOST != GEN_3) - return FALSE; - else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) +#if B_BADGE_BOOST != GEN_3 + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) return FALSE; else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) return FALSE; @@ -9689,8 +9734,8 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) return FALSE; else if (FlagGet(badgeFlag)) return TRUE; - else - return FALSE; +#endif + return FALSE; } u8 GetBattleMoveSplit(u32 moveId) @@ -9699,12 +9744,17 @@ u8 GetBattleMoveSplit(u32 moveId) return gBattleStruct->zmove.activeSplit; if (gBattleStruct != NULL && gBattleStruct->swapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky return SPLIT_PHYSICAL; - else if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) - return gBattleMoves[moveId].split; + +#if B_PHYSICAL_SPECIAL_SPLIT >= GEN_4 + return gBattleMoves[moveId].split; +#else + if (IS_MOVE_STATUS(moveId)) + return SPLIT_STATUS; else if (gBattleMoves[moveId].type < TYPE_MYSTERY) return SPLIT_PHYSICAL; else return SPLIT_SPECIAL; +#endif } static bool32 TryRemoveScreens(u8 battler) @@ -9781,6 +9831,19 @@ struct Pokemon *GetBattlerPartyData(u8 battlerId) return mon; } +static u8 GetFlingPowerFromItemId(u16 itemId) +{ + if (itemId >= ITEM_TM01 && itemId <= ITEM_HM08) + { + u8 power = gBattleMoves[ItemIdToBattleMoveId(itemId)].power; + if (power > 1) + return power; + return 10; // Status moves and moves with variable power always return 10 power. + } + else + return ItemId_GetFlingPower(itemId); +} + // Make sure the input bank is any bank on the specific mon's side bool32 CanFling(u8 battlerId) { @@ -9793,7 +9856,7 @@ bool32 CanFling(u8 battlerId) #endif || gFieldStatuses & STATUS_FIELD_MAGIC_ROOM || gDisableStructs[battlerId].embargoTimer != 0 - || ItemId_GetFlingPower(item) != 0 + || GetFlingPowerFromItemId(item) != 0 || !CanBattlerGetOrLoseItem(battlerId, item)) return FALSE; @@ -9949,7 +10012,7 @@ bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item) | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_SECRET_BASE - #if B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE | BATTLE_TYPE_TRAINER #endif ))) @@ -9978,14 +10041,14 @@ void TrySaveExchangedItem(u8 battlerId, u16 stolenItem) { // Because BtlController_EmitSetMonData does SetMonData, we need to save the stolen item only if it matches the battler's original // So, if the player steals an item during battle and has it stolen from it, it will not end the battle with it (naturally) - #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE +#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE // If regular trainer battle and mon's original item matches what is being stolen, save it to be restored at end of battle if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && GetBattlerSide(battlerId) == B_SIDE_PLAYER && stolenItem == gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].originalItem) gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].stolen = TRUE; - #endif +#endif } bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes) diff --git a/src/battle_z_move.c b/src/battle_z_move.c index efa1e6e18c..d41e28ac23 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -58,7 +58,6 @@ static u8 GetZMoveScore(u8 battlerAtk, u8 battlerDef, u16 baseMove, u16 zMove); // Const Data static const struct SignatureZMove sSignatureZMoves[] = { -// #ifdef NEW_POKEMON {SPECIES_PIKACHU_COSPLAY, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU_ROCK_STAR, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU_BELLE, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, @@ -95,7 +94,6 @@ static const struct SignatureZMove sSignatureZMoves[] = {SPECIES_TAPU_LELE, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA}, {SPECIES_TAPU_FINI, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA}, {SPECIES_NECROZMA_ULTRA, ITEM_ULTRANECROZIUM_Z, MOVE_PHOTON_GEYSER, MOVE_LIGHT_THAT_BURNS_THE_SKY}, -// #endif {SPECIES_MEW, ITEM_MEWNIUM_Z, MOVE_PSYCHIC, MOVE_GENESIS_SUPERNOVA}, {SPECIES_PIKACHU, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_EEVEE, ITEM_EEVIUM_Z, MOVE_LAST_RESORT, MOVE_EXTREME_EVOBOOST}, @@ -189,10 +187,13 @@ bool32 IsViableZMove(u8 battlerId, u16 move) if (IsPartnerMonFromSameTrainer(battlerId) && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)]))) return FALSE; // Partner has mega evolved or is about to mega evolve } - - if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId]) + +#if B_ENABLE_DEBUG == TRUE + if (gBattleStruct->debugHoldEffects[battlerId]) holdEffect = gBattleStruct->debugHoldEffects[battlerId]; - else if (item == ITEM_ENIGMA_BERRY) + else +#endif + if (item == ITEM_ENIGMA_BERRY) return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect; else holdEffect = ItemId_GetHoldEffect(item); diff --git a/src/data/battle_anim.h b/src/data/battle_anim.h index 62f3802a5c..b8fb8c0378 100644 --- a/src/data/battle_anim.h +++ b/src/data/battle_anim.h @@ -1014,16 +1014,16 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Pencil, 0x0200, ANIM_TAG_PENCIL}, {gBattleAnimSpriteGfx_AirWave, 0x0100, ANIM_TAG_AIR_WAVE}, {gBattleAnimSpriteGfx_Orb, 0x0200, ANIM_TAG_ORB}, - #if B_NEW_SWORD_PARTICLE +#if B_NEW_SWORD_PARTICLE {gBattleAnimSpriteGfx_NewSword, 0x0400, ANIM_TAG_SWORD}, - #else +#else {gBattleAnimSpriteGfx_Sword, 0x0400, ANIM_TAG_SWORD}, - #endif - #if B_NEW_LEECH_SEED_PARTICLE +#endif +#if B_NEW_LEECH_SEED_PARTICLE {gBattleAnimSpriteGfx_NewLeechSeed, 0x0180, ANIM_TAG_SEED}, - #else +#else {gBattleAnimSpriteGfx_Seed, 0x0180, ANIM_TAG_SEED}, - #endif +#endif {gBattleAnimSpriteGfx_Explosion6, 0x0800, ANIM_TAG_EXPLOSION_6}, {gBattleAnimSpriteGfx_PinkOrb, 0x0020, ANIM_TAG_PINK_ORB}, {gBattleAnimSpriteGfx_Gust, 0x0400, ANIM_TAG_GUST}, @@ -1046,11 +1046,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_HitDuplicate, 0x0A00, ANIM_TAG_HIT_DUPLICATE}, {gBattleAnimSpriteGfx_Leer, 0x0A00, ANIM_TAG_LEER}, {gBattleAnimSpriteGfx_BlueBurst, 0x0A00, ANIM_TAG_BLUE_BURST}, - #if B_NEW_EMBER_PARTICLES +#if B_NEW_EMBER_PARTICLES {gBattleAnimSpriteGfx_NewEmbers, 0x0A00, ANIM_TAG_SMALL_EMBER}, - #else +#else {gBattleAnimSpriteGfx_SmallEmber, 0x0A00, ANIM_TAG_SMALL_EMBER}, - #endif +#endif {gBattleAnimSpriteGfx_GraySmoke, 0x0A00, ANIM_TAG_GRAY_SMOKE}, {gBattleAnimSpriteGfx_BlueStar, 0x0E00, ANIM_TAG_BLUE_STAR}, {gBattleAnimSpriteGfx_BubbleBurst, 0x0380, ANIM_TAG_BUBBLE_BURST}, @@ -1079,20 +1079,20 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_RedFist, 0x0200, ANIM_TAG_RED_FIST}, {gBattleAnimSpriteGfx_SlamHit, 0x1000, ANIM_TAG_SLAM_HIT}, {gBattleAnimSpriteGfx_Ring, 0x0180, ANIM_TAG_RING}, - #if NEW_ROCKS_PARTICLE +#if NEW_ROCKS_PARTICLE {gBattleAnimSpriteGfx_NewRocks, 0x0C00, ANIM_TAG_ROCKS}, - #else +#else {gBattleAnimSpriteGfx_Rocks, 0x0C00, ANIM_TAG_ROCKS}, - #endif +#endif {gBattleAnimSpriteGfx_Z, 0x0100, ANIM_TAG_Z}, {gBattleAnimSpriteGfx_YellowUnk2, 0x0040, ANIM_TAG_YELLOW_UNK_2}, {gBattleAnimSpriteGfx_AirSlash, 0x0180, ANIM_TAG_AIR_SLASH}, {gBattleAnimSpriteGfx_SpinningGreenOrbs, 0x0800, ANIM_TAG_SPINNING_GREEN_ORBS}, - #if B_NEW_LEAF_PARTICLE +#if B_NEW_LEAF_PARTICLE {gBattleAnimSpriteGfx_NewLeaf, 0x0480, ANIM_TAG_LEAF}, - #else +#else {gBattleAnimSpriteGfx_Leaf, 0x0480, ANIM_TAG_LEAF}, - #endif +#endif {gBattleAnimSpriteGfx_Finger, 0x0200, ANIM_TAG_FINGER}, {gBattleAnimSpriteGfx_PoisonPowder, 0x0200, ANIM_TAG_POISON_POWDER}, {gBattleAnimSpriteGfx_BrownTriangle, 0x0100, ANIM_TAG_BROWN_TRIANGLE}, @@ -1156,11 +1156,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Shock2, 0x0600, ANIM_TAG_SHOCK_2}, {gBattleAnimSpriteGfx_ClosingEye2, 0x0200, ANIM_TAG_CLOSING_EYE_2}, {gBattleAnimSpriteGfx_MetalBall, 0x0080, ANIM_TAG_METAL_BALL}, - #if NEW_SUBSTITUTE_PARTICLE +#if NEW_SUBSTITUTE_PARTICLE {gBattleAnimSpriteGfx_NewSubstituteFront, 0x0200, ANIM_TAG_MONSTER_DOLL}, - #else +#else {gBattleAnimSpriteGfx_MonsterDoll, 0x0200, ANIM_TAG_MONSTER_DOLL}, - #endif +#endif {gBattleAnimSpriteGfx_Whirlwind, 0x0800, ANIM_TAG_WHIRLWIND}, {gBattleAnimSpriteGfx_Whirlwind2, 0x0080, ANIM_TAG_WHIRLWIND_2}, {gBattleAnimSpriteGfx_Explosion4, 0x0a00, ANIM_TAG_EXPLOSION_4}, @@ -1172,19 +1172,19 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_CircleImpact, 0x0020, ANIM_TAG_CIRCLE_IMPACT}, {gBattleAnimSpriteGfx_Scratch, 0x0a00, ANIM_TAG_SCRATCH}, {gBattleAnimSpriteGfx_Cut, 0x0800, ANIM_TAG_CUT}, - #if B_NEW_TEETH_PARTICLE +#if B_NEW_TEETH_PARTICLE {gBattleAnimSpriteGfx_NewTeeth, 0x0800, ANIM_TAG_SHARP_TEETH}, - #else +#else {gBattleAnimSpriteGfx_SharpTeeth, 0x0800, ANIM_TAG_SHARP_TEETH}, - #endif +#endif {gBattleAnimSpriteGfx_RainbowRings, 0x00c0, ANIM_TAG_RAINBOW_RINGS}, {gBattleAnimSpriteGfx_IceCrystals, 0x01c0, ANIM_TAG_ICE_CRYSTALS}, {gBattleAnimSpriteGfx_IceSpikes, 0x0100, ANIM_TAG_ICE_SPIKES}, - #if B_NEW_HANDS_FEET_PARTICLE +#if B_NEW_HANDS_FEET_PARTICLE {gBattleAnimSpriteGfx_NewHandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET}, - #else +#else {gBattleAnimSpriteGfx_HandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET}, - #endif +#endif {gBattleAnimSpriteGfx_MistCloud, 0x0200, ANIM_TAG_MIST_CLOUD}, {gBattleAnimSpriteGfx_Clamp, 0x0800, ANIM_TAG_CLAMP}, {gBattleAnimSpriteGfx_Bubble, 0x0180, ANIM_TAG_BUBBLE}, @@ -1193,19 +1193,19 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_WaterOrb, 0x0200, ANIM_TAG_WATER_ORB}, {gBattleAnimSpriteGfx_PoisonBubble, 0x0180, ANIM_TAG_POISON_BUBBLE}, {gBattleAnimSpriteGfx_ToxicBubble, 0x0400, ANIM_TAG_TOXIC_BUBBLE}, - #if B_NEW_SPIKES_PARTICLE +#if B_NEW_SPIKES_PARTICLE {gBattleAnimSpriteGfx_NewSpikes, 0x0080, ANIM_TAG_SPIKES}, - #else +#else {gBattleAnimSpriteGfx_Spikes, 0x0080, ANIM_TAG_SPIKES}, - #endif +#endif {gBattleAnimSpriteGfx_HornHit2, 0x0100, ANIM_TAG_HORN_HIT_2}, {gBattleAnimSpriteGfx_AirWave2, 0x0100, ANIM_TAG_AIR_WAVE_2}, {gBattleAnimSpriteGfx_SmallBubbles, 0x0140, ANIM_TAG_SMALL_BUBBLES}, - #if B_NEW_FLY_BUBBLE_PARTICLE +#if B_NEW_FLY_BUBBLE_PARTICLE {gBattleAnimSpriteGfx_NewFly, 0x0800, ANIM_TAG_ROUND_SHADOW}, - #else +#else {gBattleAnimSpriteGfx_RoundShadow, 0x0800, ANIM_TAG_ROUND_SHADOW}, - #endif +#endif {gBattleAnimSpriteGfx_Sunlight, 0x0200, ANIM_TAG_SUNLIGHT}, {gBattleAnimSpriteGfx_Spore, 0x0100, ANIM_TAG_SPORE}, {gBattleAnimSpriteGfx_Flower, 0x00a0, ANIM_TAG_FLOWER}, @@ -1236,11 +1236,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_FocusEnergy, 0x0400, ANIM_TAG_FOCUS_ENERGY}, {gBattleAnimSpriteGfx_SphereToCube, 0x0a00, ANIM_TAG_SPHERE_TO_CUBE}, {gBattleAnimSpriteGfx_Tendrils, 0x1000, ANIM_TAG_TENDRILS}, - #if B_NEW_MEAN_LOOK_PARTICLE +#if B_NEW_MEAN_LOOK_PARTICLE {gBattleAnimSpriteGfx_NewEye, 0x0800, ANIM_TAG_EYE}, - #else +#else {gBattleAnimSpriteGfx_Eye, 0x0800, ANIM_TAG_EYE}, - #endif +#endif {gBattleAnimSpriteGfx_WhiteShadow, 0x0400, ANIM_TAG_WHITE_SHADOW}, {gBattleAnimSpriteGfx_TealAlert, 0x0200, ANIM_TAG_TEAL_ALERT}, {gBattleAnimSpriteGfx_OpeningEye, 0x0800, ANIM_TAG_OPENING_EYE}, @@ -1252,11 +1252,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Spiral, 0x0800, ANIM_TAG_SPIRAL}, {gBattleAnimSpriteGfx_SnoreZ, 0x0200, ANIM_TAG_SNORE_Z}, {gBattleAnimSpriteGfx_Explosion, 0x0800, ANIM_TAG_EXPLOSION}, - #if B_NEW_CURSE_NAIL_PARTICLE +#if B_NEW_CURSE_NAIL_PARTICLE {gBattleAnimSpriteGfx_NewNail, 0x0400, ANIM_TAG_NAIL}, - #else +#else {gBattleAnimSpriteGfx_Nail, 0x0400, ANIM_TAG_NAIL}, - #endif +#endif {gBattleAnimSpriteGfx_GhostlySpirit, 0x0200, ANIM_TAG_GHOSTLY_SPIRIT}, {gBattleAnimSpriteGfx_WarmRock, 0x0a80, ANIM_TAG_WARM_ROCK}, {gBattleAnimSpriteGfx_BreakingEgg, 0x0600, ANIM_TAG_BREAKING_EGG}, @@ -1283,11 +1283,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Roots, 0x0800, ANIM_TAG_ROOTS}, {gBattleAnimSpriteGfx_ItemBag, 0x0200, ANIM_TAG_ITEM_BAG}, {gBattleAnimSpriteGfx_JaggedMusicNote, 0x0400, ANIM_TAG_JAGGED_MUSIC_NOTE}, - #if B_NEW_BATON_PASS_BALL_PARTICLE +#if B_NEW_BATON_PASS_BALL_PARTICLE {gBattleAnimSpriteGfx_NewPokeball, 0x0080, ANIM_TAG_POKEBALL}, - #else +#else {gBattleAnimSpriteGfx_Pokeball, 0x0080, ANIM_TAG_POKEBALL}, - #endif +#endif {gBattleAnimSpriteGfx_Spotlight, 0x0800, ANIM_TAG_SPOTLIGHT}, {gBattleAnimSpriteGfx_LetterZ, 0x0200, ANIM_TAG_LETTER_Z}, {gBattleAnimSpriteGfx_RapidSpin, 0x0300, ANIM_TAG_RAPID_SPIN}, @@ -1302,11 +1302,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_PinkPetal, 0x0080, ANIM_TAG_PINK_PETAL}, {gBattleAnimSpriteGfx_PainSplit, 0x0180, ANIM_TAG_PAIN_SPLIT}, {gBattleAnimSpriteGfx_Confetti, 0x0180, ANIM_TAG_CONFETTI}, - #if B_NEW_MORNING_SUN_STAR_PARTICLE +#if B_NEW_MORNING_SUN_STAR_PARTICLE {gBattleAnimSpriteGfx_NewGreenStar, 0x0200, ANIM_TAG_GREEN_STAR}, - #else +#else {gBattleAnimSpriteGfx_GreenStar, 0x0200, ANIM_TAG_GREEN_STAR}, - #endif +#endif {gBattleAnimSpriteGfx_PinkCloud, 0x0200, ANIM_TAG_PINK_CLOUD}, {gBattleAnimSpriteGfx_SweatDrop, 0x0020, ANIM_TAG_SWEAT_DROP}, {gBattleAnimSpriteGfx_GuardRing, 0x0400, ANIM_TAG_GUARD_RING}, @@ -1461,16 +1461,16 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Pencil, ANIM_TAG_PENCIL}, {gBattleAnimSpritePal_AirWave, ANIM_TAG_AIR_WAVE}, {gBattleAnimSpritePal_Orb, ANIM_TAG_ORB}, - #if B_NEW_SWORD_PARTICLE +#if B_NEW_SWORD_PARTICLE {gBattleAnimSpritePal_NewSword, ANIM_TAG_SWORD}, - #else +#else {gBattleAnimSpritePal_Sword, ANIM_TAG_SWORD}, - #endif - #if B_NEW_LEECH_SEED_PARTICLE +#endif +#if B_NEW_LEECH_SEED_PARTICLE {gBattleAnimSpritePal_NewLeechSeed, ANIM_TAG_SEED}, - #else +#else {gBattleAnimSpritePal_Seed, ANIM_TAG_SEED}, - #endif +#endif {gBattleAnimSpritePal_Explosion6, ANIM_TAG_EXPLOSION_6}, {gBattleAnimSpritePal_PinkOrb, ANIM_TAG_PINK_ORB}, {gBattleAnimSpritePal_Gust, ANIM_TAG_GUST}, @@ -1484,11 +1484,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_BlackSmoke, ANIM_TAG_BLACK_BALL}, {gBattleAnimSpritePal_Conversion, ANIM_TAG_CONVERSION}, {gBattleAnimSpritePal_Glass, ANIM_TAG_GLASS}, - #if B_NEW_HORN_ATTACK_PARTICLE +#if B_NEW_HORN_ATTACK_PARTICLE {gBattleAnimSpritePal_NewHornHit, ANIM_TAG_HORN_HIT}, - #else +#else {gBattleAnimSpritePal_HornHit, ANIM_TAG_HORN_HIT}, - #endif +#endif {gBattleAnimSpritePal_Hit, ANIM_TAG_HIT}, {gBattleAnimSpritePal_Hit2, ANIM_TAG_HIT_2}, {gBattleAnimSpritePal_BlueShards, ANIM_TAG_BLUE_SHARDS}, @@ -1497,11 +1497,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_HitDuplicate, ANIM_TAG_HIT_DUPLICATE}, {gBattleAnimSpritePal_Leer, ANIM_TAG_LEER}, {gBattleAnimSpritePal_BlueBurst, ANIM_TAG_BLUE_BURST}, - #if B_NEW_EMBER_PARTICLES +#if B_NEW_EMBER_PARTICLES {gBattleAnimSpritePal_NewEmbers, ANIM_TAG_SMALL_EMBER}, - #else +#else {gBattleAnimSpritePal_SmallEmber, ANIM_TAG_SMALL_EMBER}, - #endif +#endif {gBattleAnimSpritePal_GraySmoke, ANIM_TAG_GRAY_SMOKE}, {gBattleAnimSpritePal_BlueStar, ANIM_TAG_BLUE_STAR}, {gBattleAnimSpritePal_BubbleBurst, ANIM_TAG_BUBBLE_BURST}, @@ -1530,20 +1530,20 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_HumanoidFoot, ANIM_TAG_RED_FIST}, {gBattleAnimSpritePal_SlamHit, ANIM_TAG_SLAM_HIT}, {gBattleAnimSpritePal_Ring, ANIM_TAG_RING}, - #if NEW_ROCKS_PARTICLE +#if NEW_ROCKS_PARTICLE {gBattleAnimSpritePal_NewRocks, ANIM_TAG_ROCKS}, - #else +#else {gBattleAnimSpritePal_Rocks, ANIM_TAG_ROCKS}, - #endif +#endif {gBattleAnimSpritePal_Z, ANIM_TAG_Z}, {gBattleAnimSpritePal_YellowUnk2, ANIM_TAG_YELLOW_UNK_2}, {gBattleAnimSpritePal_AirSlash, ANIM_TAG_AIR_SLASH}, {gBattleAnimSpritePal_SpinningGreenOrbs, ANIM_TAG_SPINNING_GREEN_ORBS}, - #if B_NEW_LEAF_PARTICLE +#if B_NEW_LEAF_PARTICLE {gBattleAnimSpritePal_NewLeaf, ANIM_TAG_LEAF}, - #else +#else {gBattleAnimSpritePal_Leaf, ANIM_TAG_LEAF}, - #endif +#endif {gBattleAnimSpritePal_Finger, ANIM_TAG_FINGER}, {gBattleAnimSpritePal_PoisonPowder, ANIM_TAG_POISON_POWDER}, {gBattleAnimSpritePal_BrownTriangle, ANIM_TAG_BROWN_TRIANGLE}, @@ -1607,11 +1607,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Shock2, ANIM_TAG_SHOCK_2}, {gBattleAnimSpritePal_ClosingEye2, ANIM_TAG_CLOSING_EYE_2}, {gBattleAnimSpritePal_MetalBall, ANIM_TAG_METAL_BALL}, - #if NEW_SUBSTITUTE_PARTICLE +#if NEW_SUBSTITUTE_PARTICLE {gBattleAnimSpritePal_NewSubstituteFront, ANIM_TAG_MONSTER_DOLL}, - #else +#else {gBattleAnimSpritePal_MonsterDoll, ANIM_TAG_MONSTER_DOLL}, - #endif +#endif {gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND}, {gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND_2}, {gBattleAnimSpritePal_Explosion4, ANIM_TAG_EXPLOSION_4}, @@ -1619,27 +1619,27 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Tongue, ANIM_TAG_TONGUE}, {gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE}, {gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE_2}, - #if B_NEW_IMPACT_PALETTE +#if B_NEW_IMPACT_PALETTE {gBattleAnimSpritePal_NewImpact, ANIM_TAG_IMPACT}, - #else +#else {gBattleAnimSpritePal_Impact, ANIM_TAG_IMPACT}, - #endif +#endif {gBattleAnimSpritePal_CircleImpact, ANIM_TAG_CIRCLE_IMPACT}, {gBattleAnimSpritePal_Impact, ANIM_TAG_SCRATCH}, {gBattleAnimSpritePal_Impact, ANIM_TAG_CUT}, - #if B_NEW_TEETH_PARTICLE +#if B_NEW_TEETH_PARTICLE {gBattleAnimSpritePal_NewTeeth, ANIM_TAG_SHARP_TEETH}, - #else +#else {gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_SHARP_TEETH}, - #endif +#endif {gBattleAnimSpritePal_RainbowRings, ANIM_TAG_RAINBOW_RINGS}, {gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_CRYSTALS}, {gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_SPIKES}, - #if B_NEW_HANDS_FEET_PARTICLE +#if B_NEW_HANDS_FEET_PARTICLE {gBattleAnimSpritePal_NewHandsAndFeet, ANIM_TAG_HANDS_AND_FEET}, - #else +#else {gBattleAnimSpritePal_HandsAndFeet, ANIM_TAG_HANDS_AND_FEET}, - #endif +#endif {gBattleAnimSpritePal_MistCloud, ANIM_TAG_MIST_CLOUD}, {gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_CLAMP}, {gBattleAnimSpritePal_RainDrops, ANIM_TAG_BUBBLE}, @@ -1648,19 +1648,19 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_WaterImpact, ANIM_TAG_WATER_ORB}, {gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_POISON_BUBBLE}, {gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_TOXIC_BUBBLE}, - #if B_NEW_SPIKES_PARTICLE +#if B_NEW_SPIKES_PARTICLE {gBattleAnimSpritePal_NewSpikes, ANIM_TAG_SPIKES}, - #else +#else {gBattleAnimSpritePal_Spikes, ANIM_TAG_SPIKES}, - #endif +#endif {gBattleAnimSpritePal_HornHit2, ANIM_TAG_HORN_HIT_2}, {gBattleAnimSpritePal_AirWave2, ANIM_TAG_AIR_WAVE_2}, {gBattleAnimSpritePal_SmallBubbles, ANIM_TAG_SMALL_BUBBLES}, - #if B_NEW_FLY_BUBBLE_PARTICLE +#if B_NEW_FLY_BUBBLE_PARTICLE {gBattleAnimSpritePal_NewFly, ANIM_TAG_ROUND_SHADOW}, - #else +#else {gBattleAnimSpritePal_RoundShadow, ANIM_TAG_ROUND_SHADOW}, - #endif +#endif {gBattleAnimSpritePal_Sunlight, ANIM_TAG_SUNLIGHT}, {gBattleAnimSpritePal_Spore, ANIM_TAG_SPORE}, {gBattleAnimSpritePal_Flower, ANIM_TAG_FLOWER}, @@ -1691,11 +1691,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_FocusEnergy, ANIM_TAG_FOCUS_ENERGY}, {gBattleAnimSpritePal_SphereToCube, ANIM_TAG_SPHERE_TO_CUBE}, {gBattleAnimSpritePal_Tendrils, ANIM_TAG_TENDRILS}, - #if B_NEW_MEAN_LOOK_PARTICLE +#if B_NEW_MEAN_LOOK_PARTICLE {gBattleAnimSpritePal_NewEye, ANIM_TAG_EYE}, - #else +#else {gBattleAnimSpritePal_Eye, ANIM_TAG_EYE}, - #endif +#endif {gBattleAnimSpritePal_WhiteShadow, ANIM_TAG_WHITE_SHADOW}, {gBattleAnimSpritePal_TealAlert, ANIM_TAG_TEAL_ALERT}, {gBattleAnimSpritePal_OpeningEye, ANIM_TAG_OPENING_EYE}, @@ -1734,11 +1734,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Roots, ANIM_TAG_ROOTS}, {gBattleAnimSpritePal_ItemBag, ANIM_TAG_ITEM_BAG}, {gBattleAnimSpritePal_JaggedMusicNote, ANIM_TAG_JAGGED_MUSIC_NOTE}, - #if B_NEW_BATON_PASS_BALL_PARTICLE +#if B_NEW_BATON_PASS_BALL_PARTICLE {gBattleAnimSpritePal_NewPokeball, ANIM_TAG_POKEBALL}, - #else +#else {gBattleAnimSpritePal_Pokeball, ANIM_TAG_POKEBALL}, - #endif +#endif {gBattleAnimSpritePal_Pokeball, ANIM_TAG_SPOTLIGHT}, {gBattleAnimSpritePal_LetterZ, ANIM_TAG_LETTER_Z}, {gBattleAnimSpritePal_RapidSpin, ANIM_TAG_RAPID_SPIN}, @@ -1753,11 +1753,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_PinkPetal, ANIM_TAG_PINK_PETAL}, {gBattleAnimSpritePal_PainSplit, ANIM_TAG_PAIN_SPLIT}, {gBattleAnimSpritePal_Confetti, ANIM_TAG_CONFETTI}, - #if B_NEW_MORNING_SUN_STAR_PARTICLE +#if B_NEW_MORNING_SUN_STAR_PARTICLE {gBattleAnimSpritePal_NewGreenStar, ANIM_TAG_GREEN_STAR}, - #else +#else {gBattleAnimSpritePal_GreenStar, ANIM_TAG_GREEN_STAR}, - #endif +#endif {gBattleAnimSpritePal_PinkCloud, ANIM_TAG_PINK_CLOUD}, {gBattleAnimSpritePal_SweatDrop, ANIM_TAG_SWEAT_DROP}, {gBattleAnimSpritePal_GuardRing, ANIM_TAG_GUARD_RING}, diff --git a/src/data/items.h b/src/data/items.h index bcb12e6956..3a3980a6bf 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -7794,7 +7794,7 @@ const struct Item gItems[] = .flingPower = 10, }, -// TMs/HMs +// TMs/HMs. They don't have a set flingPower, as that's handled by GetFlingPowerFromItemId. [ITEM_TM01_FOCUS_PUNCH] = { @@ -7805,7 +7805,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 150, }, [ITEM_TM02_DRAGON_CLAW] = @@ -7817,7 +7816,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_TM03_WATER_PULSE] = @@ -7829,7 +7827,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 60, }, [ITEM_TM04_CALM_MIND] = @@ -7841,7 +7838,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM05_ROAR] = @@ -7853,7 +7849,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM06_TOXIC] = @@ -7865,7 +7860,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM07_HAIL] = @@ -7877,7 +7871,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM08_BULK_UP] = @@ -7889,7 +7882,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM09_BULLET_SEED] = @@ -7901,11 +7893,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flingPower = 25, - #else - .flingPower = 10, - #endif }, [ITEM_TM10_HIDDEN_POWER] = @@ -7917,11 +7904,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 60, - #else - .flingPower = 10, - #endif }, [ITEM_TM11_SUNNY_DAY] = @@ -7933,7 +7915,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM12_TAUNT] = @@ -7945,7 +7926,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM13_ICE_BEAM] = @@ -7957,11 +7937,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_TM14_BLIZZARD] = @@ -7973,11 +7948,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 110, - #else - .flingPower = 120, - #endif }, [ITEM_TM15_HYPER_BEAM] = @@ -7989,7 +7959,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 150, }, [ITEM_TM16_LIGHT_SCREEN] = @@ -8001,7 +7970,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM17_PROTECT] = @@ -8013,7 +7981,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM18_RAIN_DANCE] = @@ -8025,7 +7992,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM19_GIGA_DRAIN] = @@ -8037,11 +8003,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flingPower = 75, - #else - .flingPower = 60, - #endif }, [ITEM_TM20_SAFEGUARD] = @@ -8053,7 +8014,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM21_FRUSTRATION] = @@ -8065,7 +8025,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM22_SOLAR_BEAM] = @@ -8077,7 +8036,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 120, }, [ITEM_TM23_IRON_TAIL] = @@ -8089,7 +8047,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 100, }, [ITEM_TM24_THUNDERBOLT] = @@ -8101,11 +8058,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_TM25_THUNDER] = @@ -8117,11 +8069,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 110, - #else - .flingPower = 120, - #endif }, [ITEM_TM26_EARTHQUAKE] = @@ -8133,7 +8080,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 100, }, [ITEM_TM27_RETURN] = @@ -8145,7 +8091,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM28_DIG] = @@ -8157,11 +8102,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 80, - #else - .flingPower = 60, - #endif }, [ITEM_TM29_PSYCHIC] = @@ -8173,7 +8113,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 90, }, [ITEM_TM30_SHADOW_BALL] = @@ -8185,7 +8124,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_TM31_BRICK_BREAK] = @@ -8197,7 +8135,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 75, }, [ITEM_TM32_DOUBLE_TEAM] = @@ -8209,7 +8146,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM33_REFLECT] = @@ -8221,7 +8157,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM34_SHOCK_WAVE] = @@ -8233,7 +8168,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 60, }, [ITEM_TM35_FLAMETHROWER] = @@ -8245,11 +8179,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_TM36_SLUDGE_BOMB] = @@ -8261,7 +8190,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 90, }, [ITEM_TM37_SANDSTORM] = @@ -8273,7 +8201,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM38_FIRE_BLAST] = @@ -8285,11 +8212,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 110, - #else - .flingPower = 120, - #endif }, [ITEM_TM39_ROCK_TOMB] = @@ -8301,11 +8223,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 60, - #else - .flingPower = 50, - #endif }, [ITEM_TM40_AERIAL_ACE] = @@ -8317,7 +8234,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 60, }, [ITEM_TM41_TORMENT] = @@ -8329,7 +8245,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM42_FACADE] = @@ -8341,7 +8256,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM43_SECRET_POWER] = @@ -8353,7 +8267,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 70, }, [ITEM_TM44_REST] = @@ -8365,7 +8278,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM45_ATTRACT] = @@ -8377,7 +8289,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM46_THIEF] = @@ -8389,11 +8300,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 60, - #else - .flingPower = 40, - #endif }, [ITEM_TM47_STEEL_WING] = @@ -8405,7 +8311,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 70, }, [ITEM_TM48_SKILL_SWAP] = @@ -8417,7 +8322,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM49_SNATCH] = @@ -8429,7 +8333,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM50_OVERHEAT] = @@ -8441,11 +8344,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 130, - #else - .flingPower = 140, - #endif }, [ITEM_TM51] = @@ -9008,7 +8906,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 50, }, [ITEM_HM02_FLY] = @@ -9021,11 +8918,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 90, - #else - .flingPower = 70, - #endif }, [ITEM_HM03_SURF] = @@ -9038,11 +8930,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_HM04_STRENGTH] = @@ -9055,7 +8942,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_HM05_FLASH] = @@ -9068,7 +8954,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_HM06_ROCK_SMASH] = @@ -9081,11 +8966,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 20, - #else - .flingPower = 40, - #endif }, [ITEM_HM07_WATERFALL] = @@ -9098,7 +8978,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_HM08_DIVE] = @@ -9111,11 +8990,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 80, - #else - .flingPower = 60, - #endif }, diff --git a/src/data/text/move_descriptions.h b/src/data/text/move_descriptions.h index 5f6bcfb0e4..1739a85571 100644 --- a/src/data/text/move_descriptions.h +++ b/src/data/text/move_descriptions.h @@ -1,3 +1,10 @@ + +#if B_BINDING_TURNS >= GEN_5 +#define BINDING_TURNS "4 or 5" +#else +#define BINDING_TURNS "2 to 5" +#endif + static const u8 sNullDescription[] = _( ""); @@ -79,11 +86,7 @@ static const u8 sFlyDescription[] = _( static const u8 sBindDescription[] = _( "Binds and squeezes the foe\n" -#if B_BINDING_TURNS >= GEN_5 - "for 4 or 5 turns."); -#else - "for 2 to 5 turns."); -#endif + "for "BINDING_TURNS" turns."); static const u8 sSlamDescription[] = _( "Slams the foe with a long\n" @@ -143,11 +146,7 @@ static const u8 sBodySlamDescription[] = _( static const u8 sWrapDescription[] = _( "Wraps and squeezes the foe\n" -#if B_BINDING_TURNS >= GEN_5 - "4 or 5 times with vines, etc."); -#else - "2 to 5 times with vines, etc."); -#endif + BINDING_TURNS" times with vines, etc."); static const u8 sTakeDownDescription[] = _( "A reckless charge attack\n" @@ -339,11 +338,7 @@ static const u8 sDragonRageDescription[] = _( static const u8 sFireSpinDescription[] = _( "Traps the foe in a ring of\n" -#if B_BINDING_TURNS >= GEN_5 - "fire for 4 or 5 turns."); -#else - "fire for 2 to 5 turns."); -#endif + "fire for "BINDING_TURNS" turns."); static const u8 sThunderShockDescription[] = _( "An electrical attack that\n" @@ -523,11 +518,7 @@ static const u8 sWaterfallDescription[] = _( static const u8 sClampDescription[] = _( "Traps and squeezes the\n" -#if B_BINDING_TURNS >= GEN_5 - "foe for 4 or 5 turns."); -#else - "foe for 2 to 5 turns."); -#endif + "foe for "BINDING_TURNS" turns."); static const u8 sSwiftDescription[] = _( "Sprays star-shaped rays\n" @@ -1015,11 +1006,7 @@ static const u8 sRockSmashDescription[] = _( static const u8 sWhirlpoolDescription[] = _( "Traps and hurts the foe in\n" -#if B_BINDING_TURNS >= GEN_5 - "a whirlpool for 4 or 5 turns."); -#else - "a whirlpool for 2 to 5 turns."); -#endif + "a whirlpool for "BINDING_TURNS" turns."); static const u8 sBeatUpDescription[] = _( "Summons party Pokémon to\n" @@ -1030,7 +1017,11 @@ static const u8 sFakeOutDescription[] = _( "that causes flinching."); static const u8 sUproarDescription[] = _( +#if B_UPROAR_TURNS >= GEN_5 "Causes an uproar for 2 to 5\n" +#else + "Causes an uproar for 3\n" +#endif "turns and prevents sleep."); static const u8 sStockpileDescription[] = _( @@ -1331,11 +1322,7 @@ static const u8 sSkyUppercutDescription[] = _( static const u8 sSandTombDescription[] = _( "Traps and hurts the foe in\n" -#if B_BINDING_TURNS >= GEN_5 - "quicksand for 4 or 5 turns."); -#else - "quicksand for 2 to 5 turns."); -#endif + "quicksand for "BINDING_TURNS" turns."); static const u8 sSheerColdDescription[] = _( "A chilling attack that\n" @@ -1839,11 +1826,7 @@ static const u8 sSpacialRendDescription[] = _( static const u8 sMagmaStormDescription[] = _( "Traps the foe in a vortex\n" -#if B_BINDING_TURNS >= GEN_5 - "of fire for 4 or 5 turns."); -#else - "of fire for 2 to 5 turns."); -#endif + "of fire for "BINDING_TURNS" turns."); static const u8 sDarkVoidDescription[] = _( "Drags the foe into total\n" @@ -2395,11 +2378,7 @@ static const u8 sNuzzleDescription[] = _( static const u8 sInfestationDescription[] = _( "The foe is infested and\n" -#if B_BINDING_TURNS >= GEN_5 - "attacked for 4 or 5 turns."); -#else - "attacked for 2 to 5 turns."); -#endif + "attacked for "BINDING_TURNS" turns."); static const u8 sPowerUpPunchDescription[] = _( "A hard punch that raises\n" @@ -2944,11 +2923,7 @@ static const u8 sSurgingStrikesDescription[] = _( static const u8 sThunderCageDescription[] = _( "Traps the foe in a cage of\n" -#if B_BINDING_TURNS >= GEN_5 - "electricity for 4 or 5 turns."); -#else - "electricity for 2 to 5 turns."); -#endif + "electricity for "BINDING_TURNS" turns."); static const u8 sDragonEnergyDescription[] = _( "The higher the user's HP\n" @@ -2981,6 +2956,8 @@ static const u8 sEerieSpellDescription[] = _( static const u8 sNotDoneYetDescription[] = _( "Not done yet."); +#undef BINDING_TURNS + // MOVE_NONE is ignored in this table. Make sure to always subtract 1 before getting the right pointer. const u8 *const gMoveDescriptionPointers[MOVES_COUNT - 1] = { diff --git a/src/daycare.c b/src/daycare.c index d293e51175..5d825c4d69 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -819,12 +819,12 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent eggSpecies = SPECIES_NIDORAN_M; else if (eggSpecies == SPECIES_ILLUMISE && daycare->offspringPersonality & EGG_GENDER_MALE) eggSpecies = SPECIES_VOLBEAT; - #if P_NIDORAN_M_DITTO_BREED >= GEN_5 - else if (eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE)) - eggSpecies = SPECIES_NIDORAN_F; - else if (eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE)) - eggSpecies = SPECIES_ILLUMISE; - #endif +#if P_NIDORAN_M_DITTO_BREED >= GEN_5 + else if (eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE)) + eggSpecies = SPECIES_NIDORAN_F; + else if (eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE)) + eggSpecies = SPECIES_ILLUMISE; +#endif else if (eggSpecies == SPECIES_MANAPHY) eggSpecies = SPECIES_PHIONE; else if (eggSpecies == SPECIES_SINISTEA_ANTIQUE) diff --git a/src/evolution_scene.c b/src/evolution_scene.c index c9c2641c67..91a3122226 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -551,7 +551,10 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon) u32 data = 0; u16 ball = ITEM_POKE_BALL; if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE - && (P_SHEDINJA_BALL == GEN_3 || CheckBagHasItem(ball, 1))) + #if P_SHEDINJA_BALL >= GEN_4 + && (CheckBagHasItem(ball, 1)) + #endif + ) { s32 i; struct Pokemon *shedinja = &gPlayerParty[gPlayerPartyCount]; @@ -563,10 +566,10 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon) SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, &data); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_ENCRYPT_SEPARATOR, &data); - #if P_SHEDINJA_BALL >= GEN_4 + #if P_SHEDINJA_BALL >= GEN_4 SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_POKEBALL, &ball); RemoveBagItem(ball, 1); - #endif + #endif for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + CONTEST_CATEGORIES_COUNT; i++) SetMonData(&gPlayerParty[gPlayerPartyCount], i, &data); diff --git a/src/item_use.c b/src/item_use.c index 7cc4bb32d3..023396ffa2 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -1000,14 +1000,14 @@ void ItemUseInBattle_PokeBall(u8 taskId) else DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage); break; - #if B_SEMI_INVULNERABLE_CATCH >= GEN_4 +#if B_SEMI_INVULNERABLE_CATCH >= GEN_4 case BALL_THROW_UNABLE_SEMI_INVULNERABLE: if (!InBattlePyramid()) DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage); break; - #endif +#endif } } diff --git a/src/overworld.c b/src/overworld.c index 5bf7262dcb..07912e8553 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -409,9 +409,9 @@ static void Overworld_ResetStateAfterWhiteOut(void) FlagClear(FLAG_SYS_SAFARI_MODE); FlagClear(FLAG_SYS_USE_STRENGTH); FlagClear(FLAG_SYS_USE_FLASH); - #if VAR_TERRAIN != 0 - VarSet(VAR_TERRAIN, 0); - #endif +#if VAR_TERRAIN != 0 + VarSet(VAR_TERRAIN, 0); +#endif // If you were defeated by Kyogre/Groudon and the step counter has // maxed out, end the abnormal weather. if (VarGet(VAR_SHOULD_END_ABNORMAL_WEATHER) == 1) diff --git a/src/pokemon.c b/src/pokemon.c index c781a80078..ae5c2f8029 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3334,49 +3334,49 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, iv = (value & (MAX_IV_MASK << 10)) >> 10; SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); - #if P_LEGENDARY_PERFECT_IVS >= GEN_6 - if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST)) + #if P_LEGENDARY_PERFECT_IVS >= GEN_6 + if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST)) + { + iv = MAX_PER_STAT_IVS; + // Initialize a list of IV indices. + for (i = 0; i < NUM_STATS; i++) { - iv = MAX_PER_STAT_IVS; - // Initialize a list of IV indices. - for (i = 0; i < NUM_STATS; i++) - { - availableIVs[i] = i; - } + availableIVs[i] = i; + } - // Select the 3 IVs that will be perfected. - for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) + // Select the 3 IVs that will be perfected. + for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) + { + u8 index = Random() % (NUM_STATS - i); + selectedIvs[i] = availableIVs[index]; + RemoveIVIndexFromList(availableIVs, index); + } + for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) + { + switch (selectedIvs[i]) { - u8 index = Random() % (NUM_STATS - i); - selectedIvs[i] = availableIVs[index]; - RemoveIVIndexFromList(availableIVs, index); - } - for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) - { - switch (selectedIvs[i]) - { - case STAT_HP: - SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv); - break; - case STAT_ATK: - SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv); - break; - case STAT_DEF: - SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv); - break; - case STAT_SPEED: - SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv); - break; - case STAT_SPATK: - SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv); - break; - case STAT_SPDEF: - SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); - break; - } + case STAT_HP: + SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv); + break; + case STAT_ATK: + SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv); + break; + case STAT_DEF: + SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv); + break; + case STAT_SPEED: + SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv); + break; + case STAT_SPATK: + SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv); + break; + case STAT_SPDEF: + SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); + break; } } - #endif + } + #endif } @@ -5470,6 +5470,12 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, } \ } +#if B_X_ITEMS_BUFF >= GEN_7 + #define X_ITEM_STAGES 2 +#else + #define X_ITEM_STAGES 1 +#endif + // Returns TRUE if the item has no effect on the Pokémon, FALSE otherwise bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, bool8 usedByAI) { @@ -5576,10 +5582,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_ATTACK) && gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_ATK] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_ATK] += 1; + gBattleMons[gActiveBattler].statStages[STAT_ATK] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE; retVal = FALSE; @@ -5589,10 +5592,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_DEFENSE) && gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_DEF] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_DEF] += 1; + gBattleMons[gActiveBattler].statStages[STAT_DEF] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE; retVal = FALSE; @@ -5602,10 +5602,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_SPEED) && gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 1; + gBattleMons[gActiveBattler].statStages[STAT_SPEED] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE; retVal = FALSE; @@ -5615,10 +5612,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_SPATK) && gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 1; + gBattleMons[gActiveBattler].statStages[STAT_SPATK] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE; retVal = FALSE; @@ -5628,10 +5622,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_SPDEF) && gBattleMons[gActiveBattler].statStages[STAT_SPDEF] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 1; + gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_SPDEF] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPDEF] = MAX_STAT_STAGE; retVal = FALSE; @@ -5641,10 +5632,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_ACCURACY) && gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_ACC] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_ACC] += 1; + gBattleMons[gActiveBattler].statStages[STAT_ACC] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE; retVal = FALSE; @@ -6204,15 +6192,12 @@ static void BufferStatRoseMessage(s32 statIdx) { gBattlerTarget = gBattlerInMenuId; StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[statIdx]]); - if (B_X_ITEMS_BUFF >= GEN_7) - { - StringCopy(gBattleTextBuff2, gText_StatSharply); - StringAppend(gBattleTextBuff2, gText_StatRose); - } - else - { - StringCopy(gBattleTextBuff2, gText_StatRose); - } +#if B_X_ITEMS_BUFF >= GEN_7 + StringCopy(gBattleTextBuff2, gText_StatSharply); + StringAppend(gBattleTextBuff2, gText_StatRose); +#else + StringCopy(gBattleTextBuff2, gText_StatRose); +#endif BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose); } @@ -6324,7 +6309,10 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s // Prevent evolution with Everstone, unless we're just viewing the party menu with an evolution item if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE && mode != EVO_MODE_ITEM_CHECK - && (P_KADABRA_EVERSTONE < GEN_4 || species != SPECIES_KADABRA)) + #if P_KADABRA_EVERSTONE >= GEN_4 + && species != SPECIES_KADABRA + #endif + ) return SPECIES_NONE; switch (mode) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 2befc159f5..580ca88032 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3735,8 +3735,9 @@ static void PrintMoveDetails(u16 move) { if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) { - if (B_SHOW_SPLIT_ICON == TRUE) - ShowSplitIcon(GetBattleMoveSplit(move)); + #if B_SHOW_SPLIT_ICON == TRUE + ShowSplitIcon(GetBattleMoveSplit(move)); + #endif PrintMovePowerAndAccuracy(move); PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0); } diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 8e197d547e..e49d09f54d 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -367,7 +367,10 @@ static u8 PickWildMonNature(void) // check synchronize for a pokemon with the same ability if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE - && ((B_SYNCHRONIZE_NATURE >= GEN_8) || Random() % 2 == 0)) + #if B_SYNCHRONIZE_NATURE <= GEN_7 + && (Random() % 2 == 0) + #endif + ) { return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % NUM_NATURES; } @@ -1003,11 +1006,13 @@ bool8 TryDoDoubleWildBattle(void) { if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS) return FALSE; - else if (B_FLAG_FORCE_DOUBLE_WILD != 0 && FlagGet(B_FLAG_FORCE_DOUBLE_WILD)) +#if B_FLAG_FORCE_DOUBLE_WILD != 0 + else if (FlagGet(B_FLAG_FORCE_DOUBLE_WILD)) return TRUE; - #if B_DOUBLE_WILD_CHANCE != 0 +#endif +#if B_DOUBLE_WILD_CHANCE != 0 else if ((Random() % 100) + 1 < B_DOUBLE_WILD_CHANCE) return TRUE; - #endif +#endif return FALSE; } From 1d512ed57d8cd198a09e113a7192db6abdef9c2a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 1 Aug 2022 07:39:51 -0300 Subject: [PATCH 046/115] Updated Serene Grace checks in AI_CheckViability --- src/battle_ai_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 732dea7807..59faecd182 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2974,6 +2974,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) u16 predictedMove = AI_DATA->predictedMoves[battlerDef]; bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk); u32 i; + // We only check for moves that have a 20% chance or more for their secondary effect to happen because moves with a smaller chance are rather worthless. We don't want the AI to use those. + bool32 sereneGraceBoost = (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && (gBattleMoves[move].secondaryEffectChance >= 20 && gBattleMoves[move].secondaryEffectChance < 100)); // Targeting partner, check benefits of doing that instead if (IsTargetingPartner(battlerAtk, battlerDef)) @@ -3432,7 +3434,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; break; case EFFECT_CONFUSE_HIT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE) + if (sereneGraceBoost) score++; //fallthrough case EFFECT_CONFUSE: @@ -3451,7 +3453,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SPECIAL_DEFENSE_DOWN_HIT: case EFFECT_ACCURACY_DOWN_HIT: case EFFECT_EVASION_DOWN_HIT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) + if (sereneGraceBoost && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) score += 2; break; case EFFECT_SPEED_DOWN_HIT: @@ -3459,12 +3461,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 2; else if (!AI_RandLessThan(70)) score++; - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) - score++; if (ShouldLowerSpeed(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) { - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) - score += 4; + if (sereneGraceBoost && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) + score += 5; else score += 2; } @@ -3595,7 +3595,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score++; break; case EFFECT_SPEED_UP_HIT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY && !WillAIStrikeFirst()) + if (sereneGraceBoost && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY && !WillAIStrikeFirst()) score += 3; break; case EFFECT_DESTINY_BOND: @@ -3839,7 +3839,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_ATTACK_UP_HIT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE) + if (sereneGraceBoost) IncreaseStatUpScore(battlerAtk, battlerDef, STAT_ATK, &score); break; case EFFECT_FELL_STINGER: From 481210b7f318ee4811a4193216d77c3eefadf848 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 27 Aug 2022 00:54:30 -0400 Subject: [PATCH 047/115] Missing uses of MAX_SPRITES --- src/battle_anim_ice.c | 2 +- src/battle_anim_psychic.c | 2 +- src/intro.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index 6a0ff1154a..c974ecf661 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -1454,7 +1454,7 @@ static void AnimHailBegin(struct Sprite *sprite) sprite->data[3], sprite->data[4], sprite->subpriority); sprite->data[0] = spriteId; - if (spriteId != 64) + if (spriteId != MAX_SPRITES) { gSprites[sprite->data[0]].callback = AnimHailContinue; gSprites[sprite->data[0]].data[6] = sprite->data[6]; diff --git a/src/battle_anim_psychic.c b/src/battle_anim_psychic.c index aebf76cc06..833c46c2f3 100644 --- a/src/battle_anim_psychic.c +++ b/src/battle_anim_psychic.c @@ -918,7 +918,7 @@ static void AnimTask_SkillSwap_Step(u8 taskId) { task->data[1] = 0; spriteId = CreateSprite(&gSkillSwapOrbSpriteTemplate, task->data[11], task->data[12], 0); - if (spriteId != 64) + if (spriteId != MAX_SPRITES) { gSprites[spriteId].data[0] = 16; gSprites[spriteId].data[2] = task->data[13]; diff --git a/src/intro.c b/src/intro.c index 7e9a751690..b067891429 100644 --- a/src/intro.c +++ b/src/intro.c @@ -2933,7 +2933,7 @@ static void SpriteCB_WaterDrop_ReachLeafEnd(struct Sprite *sprite) SetOamMatrix(sprite->data[1], sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); SetOamMatrix(sprite->data[1] + 1, sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); SetOamMatrix(sprite->data[1] + 2, sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); - if (sprite->data[4] != 64) + if (sprite->data[4] != MAX_SPRITES) { u16 sinIdx; sprite->data[4] -= 8; From 6c457f42afb948c3697f03d92ee9042dab8e4b5b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 27 Aug 2022 00:59:12 -0400 Subject: [PATCH 048/115] Corrected uses of GetBattlerSide --- src/battle_anim_bug.c | 6 +++--- src/battle_anim_fire.c | 2 +- src/battle_anim_flying.c | 4 ++-- src/battle_anim_mon_movement.c | 4 ++-- src/battle_anim_mons.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/battle_anim_bug.c b/src/battle_anim_bug.c index 14abc88fb3..377665684a 100644 --- a/src/battle_anim_bug.c +++ b/src/battle_anim_bug.c @@ -203,7 +203,7 @@ static void AnimMegahornHorn(struct Sprite *sprite) gBattleAnimArgs[2] = -gBattleAnimArgs[2]; gBattleAnimArgs[0] = -gBattleAnimArgs[0]; } - else if (!GetBattlerSide(gBattleAnimTarget)) + else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { StartSpriteAffineAnim(sprite, 1); gBattleAnimArgs[1] = -gBattleAnimArgs[1]; @@ -230,7 +230,7 @@ static void AnimLeechLifeNeedle(struct Sprite *sprite) gBattleAnimArgs[0] = -gBattleAnimArgs[0]; StartSpriteAffineAnim(sprite, 2); } - else if (!GetBattlerSide(gBattleAnimTarget)) + else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { gBattleAnimArgs[1] = -gBattleAnimArgs[1]; gBattleAnimArgs[0] = -gBattleAnimArgs[0]; @@ -301,7 +301,7 @@ static void AnimStringWrap(struct Sprite *sprite) sprite->x += gBattleAnimArgs[0]; sprite->y += gBattleAnimArgs[1]; - if (!GetBattlerSide(gBattleAnimTarget)) + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) sprite->y += 8; sprite->callback = AnimStringWrap_Step; diff --git a/src/battle_anim_fire.c b/src/battle_anim_fire.c index 72d802f19a..2ac00f443b 100644 --- a/src/battle_anim_fire.c +++ b/src/battle_anim_fire.c @@ -926,7 +926,7 @@ static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 activeSpritesId u16 y = GetEruptionLaunchRockInitialYPos(spriteId); u16 x = gSprites[spriteId].x; - if(!GetBattlerSide(gBattleAnimAttacker)) + if(GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) { x -= 12; sign = 1; diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 8609a8e172..746e3bdd73 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -910,8 +910,8 @@ static void AnimWhirlwindLine(struct Sprite * sprite) else InitSpritePosToAnimTarget(sprite, FALSE); - if ((gBattleAnimArgs[2] == ANIM_ATTACKER && !GetBattlerSide(gBattleAnimAttacker)) - || (gBattleAnimArgs[2] == ANIM_TARGET && !GetBattlerSide(gBattleAnimTarget))) + if ((gBattleAnimArgs[2] == ANIM_ATTACKER && GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) + || (gBattleAnimArgs[2] == ANIM_TARGET && GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)) { sprite->x += 8; } diff --git a/src/battle_anim_mon_movement.c b/src/battle_anim_mon_movement.c index 09393a2a7b..8a11c2c5b5 100644 --- a/src/battle_anim_mon_movement.c +++ b/src/battle_anim_mon_movement.c @@ -885,11 +885,11 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId) { if (gBattleAnimArgs[2] == ANIM_ATTACKER) { - gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimAttacker); + gTasks[taskId].data[7] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER; } else { - gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimTarget); + gTasks[taskId].data[7] = GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER; } } if (gTasks[taskId].data[7]) diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 4ce33251ac..f8fc5647ea 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -2519,7 +2519,7 @@ void AnimWeatherBallUp(struct Sprite *sprite) { sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); - if (!GetBattlerSide(gBattleAnimAttacker)) + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) sprite->data[0] = 5; else sprite->data[0] = -10; @@ -2545,7 +2545,7 @@ void AnimWeatherBallDown(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[2]; sprite->data[2] = sprite->x + gBattleAnimArgs[4]; sprite->data[4] = sprite->y + gBattleAnimArgs[5]; - if (!GetBattlerSide(gBattleAnimTarget)) + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { x = (u16)gBattleAnimArgs[4] + 30; sprite->x += x; From 15d611ba65eb5f6f7c0fde16ee487f3650bbf017 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 27 Aug 2022 01:26:13 -0400 Subject: [PATCH 049/115] Usage of BATTLE_PARTNER --- include/constants/battle.h | 4 +-- src/battle_ai_script_commands.c | 12 +++---- src/battle_ai_switch_items.c | 10 +++--- src/battle_anim.c | 8 ++--- src/battle_anim_dark.c | 4 +-- src/battle_anim_fire.c | 2 +- src/battle_anim_ghost.c | 2 +- src/battle_anim_psychic.c | 2 +- src/battle_controller_link_partner.c | 12 +++---- src/battle_controller_opponent.c | 40 +++++++++++------------ src/battle_controller_player.c | 40 +++++++++++------------ src/battle_controller_player_partner.c | 20 ++++++------ src/battle_controller_recorded_opponent.c | 34 +++++++++---------- src/battle_controller_recorded_player.c | 30 ++++++++--------- src/battle_controller_wally.c | 22 ++++++------- src/battle_gfx_sfx_util.c | 6 ++-- src/battle_main.c | 8 ++--- src/battle_script_commands.c | 28 ++++++++-------- src/battle_util.c | 12 +++---- 19 files changed, 148 insertions(+), 148 deletions(-) diff --git a/include/constants/battle.h b/include/constants/battle.h index 41bdb7a883..9adeeea916 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -31,8 +31,8 @@ #define B_POSITION_OPPONENT_RIGHT 3 // These macros can be used with either battler ID or positions to get the partner or the opposite mon -#define BATTLE_OPPOSITE(id) ((id) ^ 1) -#define BATTLE_PARTNER(id) ((id) ^ 2) +#define BATTLE_OPPOSITE(id) ((id) ^ BIT_SIDE) +#define BATTLE_PARTNER(id) ((id) ^ BIT_FLANK) #define B_SIDE_PLAYER 0 #define B_SIDE_OPPONENT 1 diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index e9f55bd8bc..93e4768379 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -541,7 +541,7 @@ static u8 ChooseMoveOrAction_Doubles(void) bestMovePointsForTarget[i] = mostViableMovesScores[0]; // Don't use a move against ally if it has less than 100 points. - if (i == (sBattler_AI ^ BIT_FLANK) && bestMovePointsForTarget[i] < 100) + if (i == (BATTLE_PARTNER(sBattler_AI)) && bestMovePointsForTarget[i] < 100) { bestMovePointsForTarget[i] = -1; mostViableMovesScores[0] = mostViableMovesScores[0]; // Needed to match. @@ -1151,9 +1151,9 @@ static u8 BattleAI_GetWantedBattler(u8 wantedBattler) default: return gBattlerTarget; case AI_USER_PARTNER: - return sBattler_AI ^ BIT_FLANK; + return BATTLE_PARTNER(sBattler_AI); case AI_TARGET_PARTNER: - return gBattlerTarget ^ BIT_FLANK; + return BATTLE_PARTNER(gBattlerTarget); } } @@ -1316,7 +1316,7 @@ static void Cmd_count_usable_party_mons(void) { u32 position; battlerOnField1 = gBattlerPartyIndexes[battlerId]; - position = GetBattlerPosition(battlerId) ^ BIT_FLANK; + position = BATTLE_PARTNER(GetBattlerPosition(battlerId)); battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(position)]; } else // In singles there's only one battlerId by side. @@ -1799,7 +1799,7 @@ static void Cmd_if_has_move(void) gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4); break; case AI_USER_PARTNER: - if (gBattleMons[sBattler_AI ^ BIT_FLANK].hp == 0) + if (gBattleMons[BATTLE_PARTNER(sBattler_AI)].hp == 0) { gAIScriptPtr += 8; break; @@ -1808,7 +1808,7 @@ static void Cmd_if_has_move(void) { for (i = 0; i < MAX_MON_MOVES; i++) { - if (gBattleMons[sBattler_AI ^ BIT_FLANK].moves[i] == *movePtr) + if (gBattleMons[BATTLE_PARTNER(sBattler_AI)].moves[i] == *movePtr) break; } } diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 169fa5f4f6..736dfa9d48 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -458,10 +458,10 @@ static bool8 ShouldSwitch(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { battlerIn1 = *activeBattlerPtr; - if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(*activeBattlerPtr) ^ BIT_FLANK)]) + if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(*activeBattlerPtr)))]) battlerIn2 = *activeBattlerPtr; else - battlerIn2 = GetBattlerAtPosition(GetBattlerPosition(*activeBattlerPtr) ^ BIT_FLANK); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(*activeBattlerPtr))); } else { @@ -557,7 +557,7 @@ void AI_TrySwitchOrUseItem(void) else { battlerIn1 = GetBattlerAtPosition(battlerIdentity); - battlerIn2 = GetBattlerAtPosition(battlerIdentity ^ BIT_FLANK); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(battlerIdentity)); } if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) @@ -653,10 +653,10 @@ u8 GetMostSuitableMonToSwitchInto(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { battlerIn1 = gActiveBattler; - if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)]) + if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))]) battlerIn2 = gActiveBattler; else - battlerIn2 = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))); // UB: It considers the opponent only player's side even though it can battle alongside player. opposingBattler = Random() & BIT_FLANK; diff --git a/src/battle_anim.c b/src/battle_anim.c index 375363212b..255028eda3 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -883,7 +883,7 @@ static void Cmd_clearmonbg(void) if (sMonAnimTaskIdArray[0] != TASK_NONE) gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE; if (animBattlerId > 1 && sMonAnimTaskIdArray[1] != TASK_NONE) - gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = FALSE; + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battlerId)]].invisible = FALSE; else animBattlerId = 0; @@ -990,8 +990,8 @@ static void Cmd_clearmonbg_static(void) if (IsBattlerSpriteVisible(battlerId)) gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE; - if (animBattlerId > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK)) - gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = FALSE; + if (animBattlerId > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battlerId))) + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battlerId)]].invisible = FALSE; else animBattlerId = 0; @@ -1017,7 +1017,7 @@ static void Task_ClearMonBgStatic(u8 taskId) if (IsBattlerSpriteVisible(battlerId)) ResetBattleAnimBg(toBG_2); - if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK)) + if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battlerId))) ResetBattleAnimBg(toBG_2 ^ 1); DestroyTask(taskId); diff --git a/src/battle_anim_dark.c b/src/battle_anim_dark.c index 1281ccc8b4..b7b98a3288 100644 --- a/src/battle_anim_dark.c +++ b/src/battle_anim_dark.c @@ -777,8 +777,8 @@ void AnimTask_InitMementoShadow(u8 taskId) if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker))) { - MoveBattlerSpriteToBG(gBattleAnimAttacker ^ 2, toBG2 ^ 1, TRUE); - gSprites[gBattlerSpriteIds[gBattleAnimAttacker ^ 2]].invisible = FALSE; + MoveBattlerSpriteToBG(BATTLE_PARTNER(gBattleAnimAttacker), toBG2 ^ 1, TRUE); + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].invisible = FALSE; } DestroyAnimVisualTask(taskId); diff --git a/src/battle_anim_fire.c b/src/battle_anim_fire.c index 2ac00f443b..fedd4c919f 100644 --- a/src/battle_anim_fire.c +++ b/src/battle_anim_fire.c @@ -1228,7 +1228,7 @@ void AnimTask_MoveHeatWaveTargets(u8 taskId) struct Task *task = &gTasks[taskId]; task->data[12] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1; - task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ BIT_FLANK) + 1; + task->data[13] = IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)) + 1; task->data[14] = GetAnimBattlerSpriteId(ANIM_TARGET); task->data[15] = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER); diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index 819b60969b..792c1ecaf1 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -814,7 +814,7 @@ void AnimTask_DestinyBondWhiteShadow(u8 taskId) for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++) { if (battler != gBattleAnimAttacker - && battler != (gBattleAnimAttacker ^ 2) + && battler != BATTLE_PARTNER(gBattleAnimAttacker) && IsBattlerSpriteVisible(battler)) { spriteId = CreateSprite(&gDestinyBondWhiteShadowSpriteTemplate, baseX, baseY, 55); diff --git a/src/battle_anim_psychic.c b/src/battle_anim_psychic.c index 66b895c4a6..978d14c4cd 100644 --- a/src/battle_anim_psychic.c +++ b/src/battle_anim_psychic.c @@ -570,7 +570,7 @@ static void AnimDefensiveWall_Step5(struct Sprite *sprite) if (IsBattlerSpriteVisible(battler)) ResetBattleAnimBg(toBG2); - battler = battlerCopy ^ 2; + battler = BATTLE_PARTNER(battlerCopy); if (IsBattlerSpriteVisible(battler)) ResetBattleAnimBg(toBG2 ^ var0); } diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index c072ae12ff..5024faaa9d 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -217,7 +217,7 @@ static void Intro_WaitForHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { finished = TRUE; } @@ -236,7 +236,7 @@ static void Intro_WaitForHealthbox(void) static void Intro_ShowHealthbox(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1) @@ -245,10 +245,10 @@ static void Intro_ShowHealthbox(void) if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 641cbd0ace..4c274f17e3 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -234,25 +234,25 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; twoMons = TRUE; } gBattleControllerOpponentHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler]; - gBattleControllerOpponentFlankHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK]; + gBattleControllerOpponentFlankHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)]; if (healthboxAnimDone) { if (twoMons == TRUE) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } @@ -263,8 +263,8 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) { if (GetBattlerPosition(gActiveBattler) == 3) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); @@ -296,20 +296,20 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI) && IsDoubleBattle() - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); StartHealthboxSlideIn(gActiveBattler); @@ -320,7 +320,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) @@ -349,8 +349,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } @@ -360,8 +360,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES)); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index cf74fefbe0..2e1f9417b8 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -950,26 +950,26 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; } // If healthbox and shiny anim are done if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { // Reset shiny anim (even if it didn't occur) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); if (IsDoubleBattle()) - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], BATTLE_PARTNER(gActiveBattler)); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; @@ -987,21 +987,21 @@ static void Intro_TryShinyAnimShowHealthbox(void) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); // Start shiny animation if applicable for 2nd pokemon - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); // Show healthbox after ball anim if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); StartHealthboxSlideIn(gActiveBattler); @@ -1013,7 +1013,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) // Restore bgm after cry has played and healthbox anim is started if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) @@ -1040,8 +1040,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } @@ -1051,7 +1051,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (bgmRestored && battlerAnimsDone) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; @@ -1178,7 +1178,7 @@ static void Task_GiveExpToMon(u8 taskId) gActiveBattler = savedActiveBattler; if (IsDoubleBattle() == TRUE - && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])) + && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])) gTasks[taskId].func = Task_LaunchLvlUpAnim; else gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; @@ -1273,7 +1273,7 @@ static void Task_LaunchLvlUpAnim(u8 taskId) u8 battlerId = gTasks[taskId].tExpTask_battler; u8 monIndex = gTasks[taskId].tExpTask_monId; - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]) + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) battlerId ^= BIT_FLANK; InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP); @@ -1290,8 +1290,8 @@ static void Task_UpdateLvlInHealthbox(u8 taskId) GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value. - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]) - UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL); + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battlerId)], &gPlayerParty[monIndex], HEALTHBOX_ALL); else UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL); diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 3812a8ffee..a77144e297 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -229,7 +229,7 @@ static void Intro_WaitForHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { finished = TRUE; } @@ -248,7 +248,7 @@ static void Intro_WaitForHealthbox(void) static void Intro_ShowHealthbox(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1) @@ -257,10 +257,10 @@ static void Intro_ShowHealthbox(void) if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); @@ -336,7 +336,7 @@ static void Task_GiveExpToMon(u8 taskId) gActiveBattler = savedActiveBank; if (IsDoubleBattle() == TRUE - && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])) + && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])) gTasks[taskId].func = Task_LaunchLvlUpAnim; else gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; @@ -431,7 +431,7 @@ static void Task_LaunchLvlUpAnim(u8 taskId) u8 battlerId = gTasks[taskId].tExpTask_bank; u8 monIndex = gTasks[taskId].tExpTask_monId; - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]) + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) battlerId ^= BIT_FLANK; InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP); @@ -448,8 +448,8 @@ static void Task_UpdateLvlInHealthbox(u8 taskId) GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]) - UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL); + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battlerId)], &gPlayerParty[monIndex], HEALTHBOX_ALL); else UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL); diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 49538b834e..0fb14f20d5 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -226,9 +226,9 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded - && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].animEnded) + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].animEnded) healthboxAnimDone = TRUE; } @@ -238,13 +238,13 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) return; - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) return; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } @@ -263,19 +263,19 @@ static void Intro_TryShinyAnimShowHealthbox(void) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); StartHealthboxSlideIn(gActiveBattler); @@ -286,7 +286,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) @@ -317,8 +317,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } @@ -328,8 +328,8 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES)); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 6200b5ef63..b5f0a465d4 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -215,27 +215,27 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { healthboxAnimDone = TRUE; } } if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); if (IsDoubleBattle()) - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], BATTLE_PARTNER(gActiveBattler)); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; @@ -251,7 +251,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { healthboxAnimDone = TRUE; } @@ -278,21 +278,21 @@ static void Intro_TryShinyAnimShowHealthbox(void) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); } if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); StartHealthboxSlideIn(gActiveBattler); @@ -303,7 +303,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) @@ -327,7 +327,7 @@ static void Intro_TryShinyAnimShowHealthbox(void) && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 8e02831776..f600a46f73 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -289,21 +289,21 @@ static void Intro_TryShinyAnimShowHealthbox(void) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); @@ -324,13 +324,13 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) healthboxAnimDone = TRUE; if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index ca6be9d4e2..f97a460897 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -1060,7 +1060,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId) { if (!gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong) { - if (!gBattleSpritesDataPtr->battlerData[battlerId ^ BIT_FLANK].lowHpSong) + if (!gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battlerId)].lowHpSong) PlaySE(SE_LOW_HEALTH); gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong = 1; } @@ -1073,7 +1073,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId) m4aSongNumStop(SE_LOW_HEALTH); return; } - if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[battlerId ^ BIT_FLANK].lowHpSong) + if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battlerId)].lowHpSong) { m4aSongNumStop(SE_LOW_HEALTH); return; @@ -1087,7 +1087,7 @@ void BattleStopLowHpSound(void) gBattleSpritesDataPtr->battlerData[playerBattler].lowHpSong = 0; if (IsDoubleBattle()) - gBattleSpritesDataPtr->battlerData[playerBattler ^ BIT_FLANK].lowHpSong = 0; + gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(playerBattler)].lowHpSong = 0; m4aSongNumStop(SE_LOW_HEALTH); } diff --git a/src/battle_main.c b/src/battle_main.c index b748fb5b1e..ad4ea88b9e 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4432,7 +4432,7 @@ static void HandleTurnActionSelectionState(void) if (((gBattleTypeFlags & BATTLE_TYPE_MULTI) || !(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) || (position & BIT_FLANK) != B_FLANK_LEFT - || (*(&gBattleStruct->absentBattlerFlags) & gBitTable[GetBattlerAtPosition(position ^ BIT_FLANK)])) + || (*(&gBattleStruct->absentBattlerFlags) & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(position))])) { BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_STOP_BOUNCE, i); } @@ -4545,9 +4545,9 @@ static void UpdateBattlerPartyOrdersOnSwitch(void) *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0); *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleBufferB[gActiveBattler][3]; - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0) >> 4; - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleBufferB[gActiveBattler][3]; + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0) >> 4; + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleBufferB[gActiveBattler][3]; } } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 09535e0794..61dfa4df62 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5087,7 +5087,7 @@ static void Cmd_openpartyscreen(void) *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]); - BtlController_EmitChoosePokemon(BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (gActiveBattler ^ 2)), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); + BtlController_EmitChoosePokemon(BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (BATTLE_PARTNER(gActiveBattler))), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 6; @@ -5164,9 +5164,9 @@ static void Cmd_switchhandleorder(void) *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0); *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleBufferB[gActiveBattler][3]; - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0) >> 4; - *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleBufferB[gActiveBattler][3]; + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0) >> 4; + *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleBufferB[gActiveBattler][3]; } else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) { @@ -7189,7 +7189,7 @@ static void Cmd_forcerandomswitch(void) monsCount = PARTY_SIZE / 2; minNeeded = 1; battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) || (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK)) @@ -7207,7 +7207,7 @@ static void Cmd_forcerandomswitch(void) monsCount = PARTY_SIZE / 2; minNeeded = 1; battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) { @@ -7234,7 +7234,7 @@ static void Cmd_forcerandomswitch(void) minNeeded = 1; } battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { @@ -7243,7 +7243,7 @@ static void Cmd_forcerandomswitch(void) monsCount = PARTY_SIZE; minNeeded = 2; battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else { @@ -7296,7 +7296,7 @@ static void Cmd_forcerandomswitch(void) || (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI)) { SwitchPartyOrderLinkMulti(gBattlerTarget, i, 0); - SwitchPartyOrderLinkMulti(gBattlerTarget ^ BIT_FLANK, i, 1); + SwitchPartyOrderLinkMulti(BATTLE_PARTNER(gBattlerTarget), i, 1); } if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) @@ -7642,7 +7642,7 @@ static void Cmd_updatestatusicon(void) } if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler])) { BtlController_EmitStatusIconUpdate(BUFFER_A, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); @@ -8310,7 +8310,7 @@ static void Cmd_healpartystatus(void) gBattleCommunication[MULTISTRING_CHOOSER] |= B_MSG_BELL_SOUNDPROOF_ATTACKER; } - gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) @@ -8360,7 +8360,7 @@ static void Cmd_healpartystatus(void) gBattleMons[gBattlerAttacker].status1 = 0; gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) { @@ -9068,7 +9068,7 @@ static void Cmd_settaunt(void) static void Cmd_trysethelpinghand(void) { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gBattlerTarget]) @@ -9745,7 +9745,7 @@ static void Cmd_settypetoterrain(void) // Unused static void Cmd_pursuitdoubles(void) { - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); + gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler]) diff --git a/src/battle_util.c b/src/battle_util.c index fd63494dde..f178e03c11 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -200,13 +200,13 @@ void HandleAction_UseMove(void) { if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)) { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } else { gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE); if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } } } @@ -239,7 +239,7 @@ void HandleAction_UseMove(void) if (gAbsentBattlerFlags & gBitTable[gBattlerTarget] && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)) { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } } else @@ -249,13 +249,13 @@ void HandleAction_UseMove(void) { if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)) { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } else { gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE); if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK); + gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } } } @@ -1799,7 +1799,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) BattleScriptExecute(BattleScript_MonTookFutureAttack); if (gWishFutureKnock.futureSightCounter[gActiveBattler] == 0 - && gWishFutureKnock.futureSightCounter[gActiveBattler ^ BIT_FLANK] == 0) + && gWishFutureKnock.futureSightCounter[BATTLE_PARTNER(gActiveBattler)] == 0) { gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)] &= ~SIDE_STATUS_FUTUREATTACK; } From 1f0a952546c29584b17684581de69cea92d8a19b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 27 Aug 2022 01:44:39 -0400 Subject: [PATCH 050/115] Usage of BATTLE_OPPOSITE --- src/battle_ai_script_commands.c | 4 ++-- src/battle_ai_switch_items.c | 4 ++-- src/battle_controller_player.c | 2 +- src/battle_gfx_sfx_util.c | 8 ++++---- src/battle_script_commands.c | 36 ++++++++++++++++----------------- src/battle_util.c | 16 +++++++-------- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 93e4768379..96b2e1184c 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -351,14 +351,14 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves) // Decide a random target battlerId in doubles. if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - gBattlerTarget = (Random() & BIT_FLANK) + (GetBattlerSide(gActiveBattler) ^ BIT_SIDE); + gBattlerTarget = (Random() & BIT_FLANK) + (BATTLE_OPPOSITE(GetBattlerSide(gActiveBattler))); if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) gBattlerTarget ^= BIT_FLANK; } // There's only one choice in single battles. else { - gBattlerTarget = sBattler_AI ^ BIT_SIDE; + gBattlerTarget = BATTLE_OPPOSITE(sBattler_AI); } // Choose proper trainer ai scripts. diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 736dfa9d48..9e314286fc 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -601,7 +601,7 @@ void AI_TrySwitchOrUseItem(void) } } - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, (gActiveBattler ^ BIT_SIDE) << 8); + BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, BATTLE_OPPOSITE(gActiveBattler) << 8); } static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8 *var) @@ -665,7 +665,7 @@ u8 GetMostSuitableMonToSwitchInto(void) } else { - opposingBattler = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_SIDE); + opposingBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler))); battlerIn1 = gActiveBattler; battlerIn2 = gActiveBattler; } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 2e1f9417b8..96a3d6bf01 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -498,7 +498,7 @@ static void HandleInputChooseMove(void) if (moveTarget & MOVE_TARGET_USER) gMultiUsePlayerCursor = gActiveBattler; else - gMultiUsePlayerCursor = GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE); + gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler) & BIT_SIDE)); if (!gBattleBufferA[gActiveBattler][1]) // not a double battle { diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index f97a460897..c2d4fad186 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -254,7 +254,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void) else if (moveTarget == MOVE_TARGET_SELECTED) chosenMoveId |= GetBattlePalaceTarget(); else - chosenMoveId |= (GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE) << 8); + chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler) & BIT_SIDE)) << 8); return chosenMoveId; } @@ -310,7 +310,7 @@ static u16 GetBattlePalaceTarget(void) } if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp) - return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8; + return (BATTLE_OPPOSITE(gActiveBattler & BIT_SIDE) + (Random() & 2)) << 8; switch (gBattlePalaceNatureToMoveTarget[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)]) { @@ -325,11 +325,11 @@ static u16 GetBattlePalaceTarget(void) else return opposing2 << 8; case PALACE_TARGET_RANDOM: - return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8; + return (BATTLE_OPPOSITE(gActiveBattler & BIT_SIDE) + (Random() & 2)) << 8; } } - return (gActiveBattler ^ BIT_SIDE) << 8; + return BATTLE_OPPOSITE(gActiveBattler) << 8; } // Wait for the pokemon to finish appearing out from the pokeball on send out diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 61dfa4df62..22a2f6caf9 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5108,7 +5108,7 @@ static void Cmd_openpartyscreen(void) } else { - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(battlerId) ^ BIT_SIDE); + gActiveBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(battlerId))); if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) gActiveBattler ^= BIT_FLANK; @@ -6233,7 +6233,7 @@ static void Cmd_hpthresholds(void) if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); - opposingBattler = gActiveBattler ^ BIT_SIDE; + opposingBattler = BATTLE_OPPOSITE(gActiveBattler); result = gBattleMons[opposingBattler].hp * 100 / gBattleMons[opposingBattler].maxHP; if (result == 0) @@ -6261,7 +6261,7 @@ static void Cmd_hpthresholds2(void) if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); - opposingBattler = gActiveBattler ^ BIT_SIDE; + opposingBattler = BATTLE_OPPOSITE(gActiveBattler); hpSwitchout = *(gBattleStruct->hpOnSwitchout + GetBattlerSide(opposingBattler)); result = (hpSwitchout - gBattleMons[opposingBattler].hp) * 100 / hpSwitchout; @@ -6299,7 +6299,7 @@ static void Cmd_various(void) break; case VARIOUS_SET_MAGIC_COAT_TARGET: gBattlerAttacker = gBattlerTarget; - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (gSideTimers[side].followmeTimer != 0 && gBattleMons[gSideTimers[side].followmeTarget].hp != 0) gBattlerTarget = gSideTimers[side].followmeTarget; else @@ -8399,7 +8399,7 @@ static void Cmd_cursetarget(void) static void Cmd_trysetspikes(void) { - u8 targetSide = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + u8 targetSide = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (gSideTimers[targetSide].spikesAmount == 3) { @@ -9781,7 +9781,7 @@ static void Cmd_snatchsetbattlers(void) // Brick Break static void Cmd_removelightscreenreflect(void) { - u8 opposingSide = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + u8 opposingSide = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (gSideTimers[opposingSide].reflectTimer || gSideTimers[opposingSide].lightscreenTimer) { @@ -9809,7 +9809,7 @@ static void Cmd_handleballthrow(void) return; gActiveBattler = gBattlerAttacker; - gBattlerTarget = gBattlerAttacker ^ BIT_SIDE; + gBattlerTarget = BATTLE_OPPOSITE(gBattlerAttacker); if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { @@ -9951,18 +9951,18 @@ static void Cmd_handleballthrow(void) static void Cmd_givecaughtmon(void) { - if (GiveMonToPlayer(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]]) != MON_GIVEN_TO_PARTY) + if (GiveMonToPlayer(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]]) != MON_GIVEN_TO_PARTY) { if (!ShouldShowBoxWasFullMessage()) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SENT_SOMEONES_PC; StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); - GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); + GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gStringVar2); } else { StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); // box the mon was sent to - GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); + GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gStringVar2); StringCopy(gStringVar3, GetBoxNamePtr(GetPCBoxToSendMon())); //box the mon was going to be sent to gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SOMEONES_BOX_FULL; } @@ -9972,9 +9972,9 @@ static void Cmd_givecaughtmon(void) gBattleCommunication[MULTISTRING_CHOOSER]++; } - gBattleResults.caughtMonSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_SPECIES, NULL); - GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleResults.caughtMonNick); - gBattleResults.caughtMonBall = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_POKEBALL, NULL); + gBattleResults.caughtMonSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_SPECIES, NULL); + GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gBattleResults.caughtMonNick); + gBattleResults.caughtMonBall = GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_POKEBALL, NULL); gBattlescriptCurrInstr++; } @@ -10162,13 +10162,13 @@ static void Cmd_trygivecaughtmonnick(void) case 2: if (!gPaletteFade.active) { - GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick); + GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick); FreeAllWindowBuffers(); DoNamingScreen(NAMING_SCREEN_CAUGHT_MON, gBattleStruct->caughtMonNick, - GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_SPECIES), - GetMonGender(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]]), - GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_PERSONALITY, NULL), + GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_SPECIES), + GetMonGender(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]]), + GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_PERSONALITY, NULL), BattleMainCB2); gBattleCommunication[MULTIUSE_STATE]++; @@ -10177,7 +10177,7 @@ static void Cmd_trygivecaughtmonnick(void) case 3: if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - SetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick); + SetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } break; diff --git a/src/battle_util.c b/src/battle_util.c index f178e03c11..4315c8a9b5 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -146,7 +146,7 @@ void HandleAction_UseMove(void) } // choose target - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (gSideTimers[side].followmeTimer != 0 && gBattleMoves[gCurrentMove].target == MOVE_TARGET_SELECTED && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gSideTimers[side].followmeTarget) @@ -204,7 +204,7 @@ void HandleAction_UseMove(void) } else { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE); + gBattlerTarget = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker))); if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } @@ -253,7 +253,7 @@ void HandleAction_UseMove(void) } else { - gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE); + gBattlerTarget = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker))); if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget))); } @@ -3001,7 +3001,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (gBattleMons[i].ability == ABILITY_TRACE && (gStatuses3[i] & STATUS3_TRACE)) { u8 target2; - side = (GetBattlerPosition(i) ^ BIT_SIDE) & BIT_SIDE; // side of the opposing pokemon + side = (BATTLE_OPPOSITE(GetBattlerPosition(i))) & BIT_SIDE; // side of the opposing pokemon target1 = GetBattlerAtPosition(side); target2 = GetBattlerAtPosition(side + BIT_FLANK); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) @@ -3820,7 +3820,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget) switch (moveTarget) { case MOVE_TARGET_SELECTED: - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp) targetBattler = gSideTimers[side].followmeTarget; else @@ -3844,12 +3844,12 @@ u8 GetMoveTarget(u16 move, u8 setTarget) case MOVE_TARGET_BOTH: case MOVE_TARGET_FOES_AND_ALLY: case MOVE_TARGET_OPPONENTS_FIELD: - targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE); + targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker) & BIT_SIDE)); if (gAbsentBattlerFlags & gBitTable[targetBattler]) targetBattler ^= BIT_FLANK; break; case MOVE_TARGET_RANDOM: - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; + side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp) targetBattler = gSideTimers[side].followmeTarget; else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM) @@ -3872,7 +3872,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget) targetBattler ^= BIT_FLANK; } else - targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE); + targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker) & BIT_SIDE)); break; case MOVE_TARGET_USER_OR_SELECTED: case MOVE_TARGET_USER: From 866d916f2fb27c16fc064386766f99d5a9f36bf2 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 27 Aug 2022 02:07:58 -0400 Subject: [PATCH 051/115] SpriteTemplate formatting --- src/cable_car.c | 13 +++++++------ src/easy_chat.c | 18 ++++++++++++------ src/field_effect.c | 3 ++- src/mirage_tower.c | 6 ++++-- src/mystery_gift_view.c | 3 ++- src/roulette.c | 4 ++-- src/union_room_chat.c | 15 ++++++++++----- 7 files changed, 39 insertions(+), 23 deletions(-) diff --git a/src/cable_car.c b/src/cable_car.c index 562e9eceb7..dd1da31762 100644 --- a/src/cable_car.c +++ b/src/cable_car.c @@ -202,7 +202,7 @@ static const struct OamData sOam_Cable = .paletteNum = 0, }; -static const struct SpriteTemplate sSpriteTemplate_CableCar[] = +static const struct SpriteTemplate sSpriteTemplates_CableCar[] = { { .tileTag = TAG_CABLE_CAR, @@ -224,7 +224,8 @@ static const struct SpriteTemplate sSpriteTemplate_CableCar[] = }, }; -static const struct SpriteTemplate sSpriteTemplate_Cable = { +static const struct SpriteTemplate sSpriteTemplate_Cable = +{ .tileTag = TAG_CABLE, .paletteTag = TAG_CABLE_CAR, .oam = &sOam_Cable, @@ -836,12 +837,12 @@ static void CreateCableCarSprites(void) gSprites[spriteId].sYPos = 73; } // Create car sprite - spriteId = CreateSprite(&sSpriteTemplate_CableCar[0], 176, 43, 0x67); + spriteId = CreateSprite(&sSpriteTemplates_CableCar[0], 176, 43, 0x67); gSprites[spriteId].x2 = gSprites[spriteId].y2 = 32; gSprites[spriteId].sXPos = 176; gSprites[spriteId].sYPos = 43; // Create door sprite - spriteId = CreateSprite(&sSpriteTemplate_CableCar[1], 200, 99, 0x65); + spriteId = CreateSprite(&sSpriteTemplates_CableCar[1], 200, 99, 0x65); gSprites[spriteId].x2 = 8; gSprites[spriteId].y2 = 4; gSprites[spriteId].sXPos = 200; @@ -864,12 +865,12 @@ static void CreateCableCarSprites(void) gSprites[spriteId].sYPos = 39; } // Create car sprite - spriteId = CreateSprite(&sSpriteTemplate_CableCar[0], 104, 9, 0x67); + spriteId = CreateSprite(&sSpriteTemplates_CableCar[0], 104, 9, 0x67); gSprites[spriteId].x2 = gSprites[spriteId].y2 = 32; gSprites[spriteId].sXPos = 104; gSprites[spriteId].sYPos = 9; // Create door sprite - spriteId = CreateSprite(&sSpriteTemplate_CableCar[1], 128, 65, 0x65); + spriteId = CreateSprite(&sSpriteTemplates_CableCar[1], 128, 65, 0x65); gSprites[spriteId].x2 = 8; gSprites[spriteId].y2 = 4; gSprites[spriteId].sXPos = 128; diff --git a/src/easy_chat.c b/src/easy_chat.c index 91b44fb26b..ebc843b3cc 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -944,7 +944,8 @@ static const struct OamData sOamData_TriangleCursor = { .affineParam = 0, }; -static const struct SpriteTemplate sSpriteTemplate_TriangleCursor = { +static const struct SpriteTemplate sSpriteTemplate_TriangleCursor = +{ .tileTag = PALTAG_TRIANGLE_CURSOR, .paletteTag = GFXTAG_TRIANGLE_CURSOR, .oam = &sOamData_TriangleCursor, @@ -1005,7 +1006,8 @@ static const union AnimCmd *const sAnims_RectangleCursor[] = { [RECTCURSOR_ANIM_ON_LETTER] = sAnim_RectangleCursor_OnLetter, }; -static const struct SpriteTemplate sSpriteTemplate_RectangleCursor = { +static const struct SpriteTemplate sSpriteTemplate_RectangleCursor = +{ .tileTag = GFXTAG_RECTANGLE_CURSOR, .paletteTag = PALTAG_RECTANGLE_CURSOR, .oam = &sOamData_RectangleCursor, @@ -1075,7 +1077,8 @@ static const union AnimCmd *const sAnims_ModeWindow[] = { [MODEWINDOW_ANIM_TRANSITION] = sAnim_ModeWindow_Transition, }; -static const struct SpriteTemplate sSpriteTemplate_ModeWindow = { +static const struct SpriteTemplate sSpriteTemplate_ModeWindow = +{ .tileTag = GFXTAG_MODE_WINDOW, .paletteTag = PALTAG_MISC_UI, .oam = &sOamData_ModeWindow, @@ -1101,7 +1104,8 @@ static const struct OamData sOamData_ButtonWindow = { .affineParam = 0, }; -static const struct SpriteTemplate sSpriteTemplate_ButtonWindow = { +static const struct SpriteTemplate sSpriteTemplate_ButtonWindow = +{ .tileTag = GFXTAG_BUTTON_WINDOW, .paletteTag = PALTAG_MISC_UI, .oam = &sOamData_ButtonWindow, @@ -1159,7 +1163,8 @@ static const union AnimCmd *const sAnims_TwoFrame[] = { sAnim_Frame1, }; -static const struct SpriteTemplate sSpriteTemplate_StartSelectButton = { +static const struct SpriteTemplate sSpriteTemplate_StartSelectButton = +{ .tileTag = GFXTAG_START_SELECT_BUTTONS, .paletteTag = PALTAG_MISC_UI, .oam = &sOamData_StartSelectButton, @@ -1169,7 +1174,8 @@ static const struct SpriteTemplate sSpriteTemplate_StartSelectButton = { .callback = SpriteCallbackDummy, }; -static const struct SpriteTemplate sSpriteTemplate_ScrollIndicator = { +static const struct SpriteTemplate sSpriteTemplate_ScrollIndicator = +{ .tileTag = GFXTAG_SCROLL_INDICATOR, .paletteTag = PALTAG_MISC_UI, .oam = &sOamData_ScrollIndicator, diff --git a/src/field_effect.c b/src/field_effect.c index ba917b5654..1ab45bb25c 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -3766,7 +3766,8 @@ static const union AnimCmd *const sAnims_DeoxysRockFragment[] = { sAnim_RockFragment_BottomRight, }; -static const struct SpriteTemplate sSpriteTemplate_DeoxysRockFragment = { +static const struct SpriteTemplate sSpriteTemplate_DeoxysRockFragment = +{ .tileTag = TAG_NONE, .paletteTag = 4378, .oam = &sOam_8x8, diff --git a/src/mirage_tower.c b/src/mirage_tower.c index 69c2e81540..37096619d3 100644 --- a/src/mirage_tower.c +++ b/src/mirage_tower.c @@ -201,7 +201,8 @@ static const struct OamData sOamData_CeilingCrumbleSmall = .affineParam = 0, }; -static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleSmall = { +static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleSmall = +{ .tileTag = TAG_CEILING_CRUMBLE, .paletteTag = TAG_NONE, .oam = &sOamData_CeilingCrumbleSmall, @@ -239,7 +240,8 @@ static const struct OamData sOamData_CeilingCrumbleLarge = .affineParam = 0, }; -static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleLarge = { +static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleLarge = +{ .tileTag = TAG_CEILING_CRUMBLE, .paletteTag = TAG_NONE, .oam = &sOamData_CeilingCrumbleLarge, diff --git a/src/mystery_gift_view.c b/src/mystery_gift_view.c index ff34c88536..384e8ef74b 100644 --- a/src/mystery_gift_view.c +++ b/src/mystery_gift_view.c @@ -162,7 +162,8 @@ static const struct SpritePalette sSpritePalettes_StampShadow[] = { {sStampShadowPal8, TAG_STAMP_SHADOW} }; -static const struct SpriteTemplate sSpriteTemplate_StampShadow = { +static const struct SpriteTemplate sSpriteTemplate_StampShadow = +{ .tileTag = TAG_STAMP_SHADOW, .paletteTag = TAG_STAMP_SHADOW, .oam = &gOamData_AffineOff_ObjNormal_32x16, diff --git a/src/roulette.c b/src/roulette.c index a8be6ad7ca..52efc8779f 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -2662,7 +2662,7 @@ static const struct SpriteTemplate sSpriteTemplates_ColorHeaders[NUM_BOARD_COLOR } }; -static const struct SpriteTemplate sSpriteTemplate_GridIcons[NUM_BOARD_POKES] = +static const struct SpriteTemplate sSpriteTemplates_GridIcons[NUM_BOARD_POKES] = { { .tileTag = GFXTAG_GRID_ICONS, @@ -3537,7 +3537,7 @@ static void CreateGridSprites(void) u8 y = i * 24; for (j = 0; j < NUM_BOARD_POKES; j++) { - spriteId = sRoulette->spriteIds[(i * NUM_BOARD_POKES) + SPR_GRID_ICONS + j] = CreateSprite(&sSpriteTemplate_GridIcons[j], (j * 24) + 148, y + 92, 30); + spriteId = sRoulette->spriteIds[(i * NUM_BOARD_POKES) + SPR_GRID_ICONS + j] = CreateSprite(&sSpriteTemplates_GridIcons[j], (j * 24) + 148, y + 92, 30); gSprites[spriteId].animPaused = TRUE; y += 24; if (y >= 72) diff --git a/src/union_room_chat.c b/src/union_room_chat.c index f8513b9f46..5c26d1ea36 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -793,7 +793,8 @@ static const union AnimCmd *const sAnims_KeyboardCursor[] = { sAnim_KeyboardCursorWide_Closed }; -static const struct SpriteTemplate sSpriteTemplate_KeyboardCursor = { +static const struct SpriteTemplate sSpriteTemplate_KeyboardCursor = +{ .tileTag = GFXTAG_KEYBOARD_CURSOR, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_KeyboardCursor, @@ -809,7 +810,8 @@ static const struct OamData sOam_TextEntrySprite = { .priority = 2 }; -static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = { +static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = +{ .tileTag = GFXTAG_TEXT_ENTRY_CURSOR, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_TextEntrySprite, @@ -819,7 +821,8 @@ static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = { .callback = SpriteCB_TextEntryCursor }; -static const struct SpriteTemplate sSpriteTemplate_TextEntryArrow = { +static const struct SpriteTemplate sSpriteTemplate_TextEntryArrow = +{ .tileTag = GFXTAG_TEXT_ENTRY_ARROW, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_TextEntrySprite, @@ -868,7 +871,8 @@ static const union AnimCmd *const sAnims_RButtonLabels[] = { sAnim_RegisterIcon }; -static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = { +static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = +{ .tileTag = GFXTAG_RBUTTON_ICON, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_RButtonIcon, @@ -878,7 +882,8 @@ static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = { .callback = SpriteCallbackDummy }; -static const struct SpriteTemplate sSpriteTemplate_RButtonLabels = { +static const struct SpriteTemplate sSpriteTemplate_RButtonLabels = +{ .tileTag = GFXTAG_RBUTTON_LABELS, .paletteTag = PALTAG_INTERFACE, .oam = &sOam_RButtonLabel, From 99fbad92e21003c474b608ba8dc47fe3570184e5 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 27 Aug 2022 02:50:55 -0400 Subject: [PATCH 052/115] IS_BATTLER_OF_TYPE --- src/battle_ai_switch_items.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 9e314286fc..261349dce1 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -446,9 +446,7 @@ static bool8 ShouldSwitch(void) return FALSE; if (ABILITY_ON_FIELD2(ABILITY_MAGNET_PULL)) { - if (gBattleMons[gActiveBattler].type1 == TYPE_STEEL) - return FALSE; - if (gBattleMons[gActiveBattler].type2 == TYPE_STEEL) + if (IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_STEEL)) return FALSE; } if (gBattleTypeFlags & BATTLE_TYPE_ARENA) From 12b32606f5b1a9c764bdfe389c76f0282a471e9e Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 27 Aug 2022 03:05:06 -0400 Subject: [PATCH 053/115] Fixed PokemonSubstruct3 alignment --- include/pokemon.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/pokemon.h b/include/pokemon.h index c05628a598..b6c798acca 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -142,7 +142,7 @@ struct PokemonSubstruct3 /* 0x02 */ u16 metLevel:7; /* 0x02 */ u16 metGame:4; - /* 0x03 */ u16 unused3_3:4; + /* 0x03 */ u16 unused1:4; /* 0x03 */ u16 otGender:1; /* 0x04 */ u32 hpIV:5; @@ -152,6 +152,7 @@ struct PokemonSubstruct3 /* 0x05 */ u32 spAttackIV:5; /* 0x06 */ u32 spDefenseIV:5; /* 0x07 */ u32 isEgg:1; + /* 0x07 */ u32 unused2:1; /* 0x08 */ u32 coolRibbon:3; /* 0x08 */ u32 beautyRibbon:3; From 1c8d3a49225a16ff28b0507f79ee041b9bddbb0f Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 27 Aug 2022 11:19:50 -0400 Subject: [PATCH 054/115] Removed unnecessary parenthesis --- src/battle_ai_script_commands.c | 4 ++-- src/battle_script_commands.c | 2 +- src/battle_util.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 96b2e1184c..1ddcc9805f 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -351,7 +351,7 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves) // Decide a random target battlerId in doubles. if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - gBattlerTarget = (Random() & BIT_FLANK) + (BATTLE_OPPOSITE(GetBattlerSide(gActiveBattler))); + gBattlerTarget = (Random() & BIT_FLANK) + BATTLE_OPPOSITE(GetBattlerSide(gActiveBattler)); if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) gBattlerTarget ^= BIT_FLANK; } @@ -541,7 +541,7 @@ static u8 ChooseMoveOrAction_Doubles(void) bestMovePointsForTarget[i] = mostViableMovesScores[0]; // Don't use a move against ally if it has less than 100 points. - if (i == (BATTLE_PARTNER(sBattler_AI)) && bestMovePointsForTarget[i] < 100) + if (i == BATTLE_PARTNER(sBattler_AI) && bestMovePointsForTarget[i] < 100) { bestMovePointsForTarget[i] = -1; mostViableMovesScores[0] = mostViableMovesScores[0]; // Needed to match. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 22a2f6caf9..a40a4b6f01 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5087,7 +5087,7 @@ static void Cmd_openpartyscreen(void) *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]); - BtlController_EmitChoosePokemon(BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (BATTLE_PARTNER(gActiveBattler))), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); + BtlController_EmitChoosePokemon(BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + BATTLE_PARTNER(gActiveBattler)), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 6; diff --git a/src/battle_util.c b/src/battle_util.c index 4315c8a9b5..9bfeacd2d2 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3001,7 +3001,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (gBattleMons[i].ability == ABILITY_TRACE && (gStatuses3[i] & STATUS3_TRACE)) { u8 target2; - side = (BATTLE_OPPOSITE(GetBattlerPosition(i))) & BIT_SIDE; // side of the opposing pokemon + side = BATTLE_OPPOSITE(GetBattlerPosition(i)) & BIT_SIDE; // side of the opposing pokemon target1 = GetBattlerAtPosition(side); target2 = GetBattlerAtPosition(side + BIT_FLANK); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) 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 055/115] 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 056/115] 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, From bed56390746252537e6cd95cf090ccf2b444bd41 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 29 Aug 2022 19:36:44 +0200 Subject: [PATCH 057/115] Changed preproc defines to TRUE/FALSE, small cleanup --- include/debug.h | 4 +- src/battle_main.c | 22 ++++++----- src/event_object_movement.c | 6 +-- src/field_control_avatar.c | 73 +++++++++++++++++-------------------- src/item_use.c | 4 +- src/start_menu.c | 10 ++--- src/trainer_see.c | 8 ++-- 7 files changed, 62 insertions(+), 65 deletions(-) diff --git a/include/debug.h b/include/debug.h index 1014690a5a..9aec5c2629 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,8 +1,8 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H -#define TX_DEBUGGING -#define TX_DEBUG_MENU_OPTION FALSE +#define TX_DEBUG_SYSTEM TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by pressing R plus START. +#define TX_DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (replaces the exit entry). void Debug_ShowMainMenu(void); diff --git a/src/battle_main.c b/src/battle_main.c index e8688b067a..029578ceb7 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4001,21 +4001,25 @@ 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 + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_BAG_USE)) + { + RecordedBattle_ClearBattlerAction(gActiveBattler, 1); + gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; + gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; + *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; + *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; + return; + } + #endif + + if ((gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER_NO_PYRAMID | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK)) // Or if currently held by Sky Drop || gStatuses3[gActiveBattler] & STATUS3_SKY_DROPPED) { - #else //DEBUG - if (gBattleTypeFlags & (BATTLE_TYPE_LINK - | 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/event_object_movement.c b/src/event_object_movement.c index 49bfce3c2f..c5663461ac 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4630,9 +4630,9 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; - #ifdef TX_DEBUGGING //DEBUG - if (FlagGet(FLAG_SYS_NO_COLLISION)) - return COLLISION_NONE; + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_COLLISION)) + return COLLISION_NONE; #endif // if (IsCoordOutsideObjectEventMovementRange(objectEvent, x, y)) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 3edfe2f169..121a10670b 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -131,34 +131,30 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; - //DEBUG - #ifdef TX_DEBUGGING - if (!TX_DEBUG_MENU_OPTION) + #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE + if (heldKeys & R_BUTTON) + { + if(input->pressedSelectButton) { - 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; - } - } + 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; + } } #endif } @@ -220,16 +216,13 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; - #ifdef TX_DEBUGGING - if (!TX_DEBUG_MENU_OPTION) - { - if (input->input_field_1_2) - { - PlaySE(SE_WIN_OPEN); - Debug_ShowMainMenu(); - return TRUE; - } - } + #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE + if (input->input_field_1_2) + { + PlaySE(SE_WIN_OPEN); + Debug_ShowMainMenu(); + return TRUE; + } #endif return FALSE; @@ -712,9 +705,9 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { - #ifdef TX_DEBUGGING - if (FlagGet(FLAG_SYS_NO_ENCOUNTER)) //DEBUG - return FALSE;// + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_ENCOUNTER)) + return FALSE; #endif if (sWildEncounterImmunitySteps < 4) diff --git a/src/item_use.c b/src/item_use.c index e9d03cabf5..537e787893 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -982,8 +982,8 @@ static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThe static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p"); void ItemUseInBattle_PokeBall(u8 taskId) { - #ifdef TX_DEBUGGING - if (FlagGet(FLAG_SYS_NO_CATCHING)){ //DEBUG + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_CATCHING)){ static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); return; diff --git a/src/start_menu.c b/src/start_menu.c index ccaff2e3a9..f4c0112b27 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -284,17 +284,17 @@ static void BuildStartMenuActions(void) { BuildMultiPartnerRoomStartMenu(); } -#if defined(TX_DEBUGGING) && TX_DEBUG_MENU_OPTION + #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == TRUE else { BuildDebugStartMenu(); } -#else + #else else { BuildNormalStartMenu(); } -#endif + #endif } static void AddStartMenuAction(u8 action) @@ -772,8 +772,8 @@ static bool8 StartMenuDebugCallback(void) RemoveExtraStartMenuWindows(); HideStartMenuDebug(); // Hide start menu without enabling movement - #ifdef TX_DEBUGGING - Debug_ShowMainMenu(); + #if TX_DEBUG_SYSTEM == TRUE + Debug_ShowMainMenu(); #endif return TRUE; diff --git a/src/trainer_see.c b/src/trainer_see.c index bb2c411612..81b040a3b6 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -193,10 +193,10 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; - #ifdef TX_DEBUGGING //DEBUG - if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) - return FALSE; - #endif // + #if TX_DEBUG_SYSTEM == TRUE + if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) + return FALSE; + #endif gNoOfApproachingTrainers = 0; gApproachingTrainerId = 0; From 8cf29336585107a24dcbebbd261e99311ae9c9d9 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 29 Aug 2022 19:46:03 +0200 Subject: [PATCH 058/115] added preproc directive to main debug.c code --- src/debug.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/src/debug.c b/src/debug.c index 55604fc753..b27142abea 100644 --- a/src/debug.c +++ b/src/debug.c @@ -12,6 +12,7 @@ #include "credits.h" #include "data.h" #include "daycare.h" +#include "debug.h" #include "event_data.h" #include "event_object_movement.h" #include "event_scripts.h" @@ -54,7 +55,7 @@ #include "constants/songs.h" #include "constants/species.h" - +#if TX_DEBUG_SYSTEM == TRUE // ******************************* // Enums enum { // Main @@ -3639,31 +3640,4 @@ SOUND_LIST_SE }; #undef X - -// 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); - ScriptContext_Enable(); - } -} -*/ - +#endif \ No newline at end of file From df88317a9890a23521e09632d1fc345b720210d6 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 28 Aug 2022 11:48:39 -0300 Subject: [PATCH 059/115] Introduced FORM_BATTLE form changes For species such as Xerneas and Zacian. --- include/constants/pokemon.h | 2 ++ src/battle_main.c | 14 ++++++++++ src/battle_util.c | 17 +++++++++++- src/data/pokemon/form_change_table_pointers.h | 8 +++++- src/data/pokemon/form_change_tables.h | 26 +++++++++++++++++++ src/pokemon.c | 6 +++-- 6 files changed, 69 insertions(+), 4 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 98075a9425..8e8b31543d 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -324,6 +324,8 @@ #define FORM_WITHDRAW 4 #define FORM_ITEM_HOLD_ABILITY 5 #define FORM_ITEM_USE_TIME 6 +#define FORM_BATTLE_BEGIN 7 +#define FORM_BATTLE_END 8 #define NUM_MALE_LINK_FACILITY_CLASSES 8 #define NUM_FEMALE_LINK_FACILITY_CLASSES 8 diff --git a/src/battle_main.c b/src/battle_main.c index 25a0b06135..f75a7ae80b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -481,6 +481,7 @@ void CB2_InitBattle(void) static void CB2_InitBattleInternal(void) { s32 i; + u16 targetSpecies; SetHBlankCallback(NULL); SetVBlankCallback(NULL); @@ -571,6 +572,19 @@ static void CB2_InitBattleInternal(void) for (i = 0; i < PARTY_SIZE; i++) AdjustFriendship(&gPlayerParty[i], FRIENDSHIP_EVENT_LEAGUE_BATTLE); + // Apply party-wide start-of-battle form changes + for (i = 0; i < PARTY_SIZE; i++) + { + // Player's side + targetSpecies = GetFormChangeTargetSpecies(&gPlayerParty[i], FORM_BATTLE_BEGIN, 0); + if (targetSpecies != SPECIES_NONE) + SetMonData(&gPlayerParty[i], MON_DATA_SPECIES, &targetSpecies); + // Opponent's side + targetSpecies = GetFormChangeTargetSpecies(&gEnemyParty[i], FORM_BATTLE_BEGIN, 0); + if (targetSpecies != SPECIES_NONE) + SetMonData(&gEnemyParty[i], MON_DATA_SPECIES, &targetSpecies); + } + gBattleCommunication[MULTIUSE_STATE] = 0; } diff --git a/src/battle_util.c b/src/battle_util.c index f38d80a69c..dff9d71da5 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -9588,7 +9588,7 @@ void UndoMegaEvolution(u32 monId) void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut) { - u32 i, currSpecies; + u32 i, currSpecies, targetSpecies; struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty; static const u16 species[][3] = { @@ -9622,6 +9622,21 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut) break; } } + if (!isSwitchingOut) + { + // Apply party-wide end-of-battle form changes + for (i = 0; i < PARTY_SIZE; i++) + { + // Player's side + targetSpecies = GetFormChangeTargetSpecies(&gPlayerParty[i], FORM_BATTLE_END, 0); + if (targetSpecies != SPECIES_NONE) + SetMonData(&gPlayerParty[i], MON_DATA_SPECIES, &targetSpecies); + // Opponent's side + targetSpecies = GetFormChangeTargetSpecies(&gEnemyParty[i], FORM_BATTLE_END, 0); + if (targetSpecies != SPECIES_NONE) + SetMonData(&gEnemyParty[i], MON_DATA_SPECIES, &targetSpecies); + } + } } bool32 DoBattlersShareType(u32 battler1, u32 battler2) diff --git a/src/data/pokemon/form_change_table_pointers.h b/src/data/pokemon/form_change_table_pointers.h index 3fdbff7a6e..58a6c899fc 100644 --- a/src/data/pokemon/form_change_table_pointers.h +++ b/src/data/pokemon/form_change_table_pointers.h @@ -31,11 +31,13 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] = [SPECIES_LANDORUS_THERIAN] = sLandorusTherianFormChangeTable, [SPECIES_KELDEO] = sKeldeoFormChangeTable, [SPECIES_KELDEO_RESOLUTE] = sKeldeoResoluteFormChangeTable, - [SPECIES_GENESECT] = sGenesectFormChangeTable, + [SPECIES_GENESECT] = sGenesectFormChangeTable, [SPECIES_GENESECT_DOUSE_DRIVE] = sGenesectFormChangeTable, [SPECIES_GENESECT_SHOCK_DRIVE] = sGenesectFormChangeTable, [SPECIES_GENESECT_BURN_DRIVE] = sGenesectFormChangeTable, [SPECIES_GENESECT_CHILL_DRIVE] = sGenesectFormChangeTable, + [SPECIES_XERNEAS] = sXerneasFormChangeTable, + [SPECIES_XERNEAS_ACTIVE] = sXerneasFormChangeTable, [SPECIES_HOOPA] = sHoopaFormChangeTable, [SPECIES_HOOPA_UNBOUND] = sHoopaUnboundFormChangeTable, [SPECIES_ORICORIO] = sOricorioFormChangeTable, @@ -60,5 +62,9 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] = [SPECIES_SILVALLY_ROCK] = sSilvallyFormChangeTable, [SPECIES_SILVALLY_STEEL] = sSilvallyFormChangeTable, [SPECIES_SILVALLY_WATER] = sSilvallyFormChangeTable, + [SPECIES_ZACIAN] = sZacianFormChangeTable, + [SPECIES_ZACIAN_CROWNED_SWORD] = sZacianFormChangeTable, + [SPECIES_ZAMAZENTA] = sZamazentaFormChangeTable, + [SPECIES_ZAMAZENTA_CROWNED_SHIELD] = sZamazentaFormChangeTable, #endif }; diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index 15cb8cdecd..be76cc9956 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -33,6 +33,14 @@ FORM_ITEM_USE_TIME: param1 = item to use param2 = DAY if form change activates in the daytime NIGHT if form change activates at nighttime + +FORM_BATTLE_BEGIN: + Form change activates when the Pokémon is sent out at the beginning of a battle + param1 = item to hold, optional + +FORM_BATTLE_END: + Form change activates at the end of a battle + param1 = item to hold, optional */ // FORM_MOVE param2 Arguments @@ -185,5 +193,23 @@ static const struct FormChange sSilvallyFormChangeTable[] = { }; #endif +static const struct FormChange sXerneasFormChangeTable[] = { + {FORM_BATTLE_BEGIN, SPECIES_XERNEAS_ACTIVE, ITEM_NONE}, + {FORM_BATTLE_END, SPECIES_XERNEAS, ITEM_NONE}, + {FORM_CHANGE_END}, +}; + +static const struct FormChange sZacianFormChangeTable[] = { + {FORM_BATTLE_BEGIN, SPECIES_ZACIAN_CROWNED_SWORD, ITEM_RUSTED_SWORD}, + {FORM_BATTLE_END, SPECIES_ZACIAN, ITEM_RUSTED_SWORD}, + {FORM_CHANGE_END}, +}; + +static const struct FormChange sZamazentaFormChangeTable[] = { + {FORM_BATTLE_BEGIN, SPECIES_ZAMAZENTA_CROWNED_SHIELD, ITEM_RUSTED_SHIELD}, + {FORM_BATTLE_END, SPECIES_ZAMAZENTA, ITEM_RUSTED_SHIELD}, + {FORM_CHANGE_END}, +}; + #undef WHEN_LEARNED #undef WHEN_FORGOTTEN diff --git a/src/pokemon.c b/src/pokemon.c index 92bd923f08..06e75dbc3b 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8237,13 +8237,13 @@ u8 GetFormIdFromFormSpeciesId(u16 formSpeciesId) return targetFormId; } -u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg) +u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg) { return GetFormChangeTargetSpeciesBoxMon(&mon->box, method, arg); } // Returns SPECIES_NONE if no form change is possible -u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg) +u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg) { u32 i; u16 targetSpecies = SPECIES_NONE; @@ -8264,6 +8264,8 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg switch (method) { case FORM_ITEM_HOLD: + case FORM_BATTLE_BEGIN: + case FORM_BATTLE_END: if (heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) targetSpecies = formChanges[i].targetSpecies; break; From 61c95421eb75a391dfde3e0f6d408e6737ad9b8d Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:01:46 +0200 Subject: [PATCH 060/115] Update src/event_object_movement.c Co-authored-by: LOuroboros --- src/event_object_movement.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index c5663461ac..2c80e79489 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4633,7 +4633,7 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) #if TX_DEBUG_SYSTEM == TRUE if (FlagGet(FLAG_SYS_NO_COLLISION)) return COLLISION_NONE; - #endif // + #endif if (IsCoordOutsideObjectEventMovementRange(objectEvent, x, y)) return COLLISION_OUTSIDE_RANGE; From cc921c62d77182c78ca2117598a7ddb52288f0b7 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:01:59 +0200 Subject: [PATCH 061/115] Update src/field_control_avatar.c Co-authored-by: LOuroboros --- src/field_control_avatar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 121a10670b..9dda48d668 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -134,7 +134,7 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE if (heldKeys & R_BUTTON) { - if(input->pressedSelectButton) + if (input->pressedSelectButton) { input->input_field_1_0 = TRUE; input->pressedSelectButton = FALSE; From 79c4fa560fb3d7ab59060f9bec638bc9238a5ad9 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:03:07 +0200 Subject: [PATCH 062/115] Update src/start_menu.c Co-authored-by: LOuroboros --- src/start_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/start_menu.c b/src/start_menu.c index f4c0112b27..ce9b726a3e 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -174,7 +174,7 @@ static const struct MenuAction sStartMenuItems[] = [MENU_ACTION_REST_FRONTIER] = {gText_MenuRest, {.u8_void = StartMenuSaveCallback}}, [MENU_ACTION_RETIRE_FRONTIER] = {gText_MenuRetire, {.u8_void = StartMenuBattlePyramidRetireCallback}}, [MENU_ACTION_PYRAMID_BAG] = {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}}, - [MENU_ACTION_DEBUG] = {gText_MenuDebug, {.u8_void = StartMenuDebugCallback}}, + [MENU_ACTION_DEBUG] = {gText_MenuDebug, {.u8_void = StartMenuDebugCallback}}, }; static const struct BgTemplate sBgTemplates_LinkBattleSave[] = From 155465a919b644105db742503eb491ae12ea666a Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:03:28 +0200 Subject: [PATCH 063/115] Update src/pokemon_storage_system.c Co-authored-by: LOuroboros --- src/pokemon_storage_system.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index e064be64d3..df822f2458 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1669,12 +1669,15 @@ static void FieldTask_ReturnToPcMenu(void) MainCallback vblankCb = gMain.vblankCallback; SetVBlankCallback(NULL); - if (!FlagGet(FLAG_SYS_PC_FROM_DEBUG_MENU)) { + 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 { + } + else + { FlagClear(FLAG_SYS_PC_FROM_DEBUG_MENU); ScriptContext_Enable(); } From 725a9102ee257700510c756011fdbf38e8c56a4e Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:03:44 +0200 Subject: [PATCH 064/115] Update src/new_game.c Co-authored-by: LOuroboros --- src/new_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/new_game.c b/src/new_game.c index 0280e4c93d..8f8aa9b82b 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -90,7 +90,7 @@ static void InitPlayerTrainerId(void) // L=A isnt set here for some reason. static void SetDefaultOptions(void) { - gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_FAST; + gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_MID; gSaveBlock2Ptr->optionsWindowFrameType = 0; gSaveBlock2Ptr->optionsSound = OPTIONS_SOUND_MONO; gSaveBlock2Ptr->optionsBattleStyle = OPTIONS_BATTLE_STYLE_SHIFT; From 2f61407c7886fbdb0893335100e0df857e718531 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:04:02 +0200 Subject: [PATCH 065/115] Update src/field_control_avatar.c Co-authored-by: LOuroboros --- src/field_control_avatar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 9dda48d668..137fe8980d 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -725,7 +725,7 @@ static bool8 CheckStandardWildEncounter(u16 metatileBehavior) } sPreviousPlayerMetatileBehavior = metatileBehavior; - return FALSE; + return FALSE; } static bool8 TryArrowWarp(struct MapPosition *position, u16 metatileBehavior, u8 direction) From 5fed45e40b3646da5b066d4e2bba07254d3e5d6f Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:04:14 +0200 Subject: [PATCH 066/115] Update src/item_use.c Co-authored-by: LOuroboros --- src/item_use.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/item_use.c b/src/item_use.c index 537e787893..63599d1e21 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -983,7 +983,8 @@ static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a b void ItemUseInBattle_PokeBall(u8 taskId) { #if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(FLAG_SYS_NO_CATCHING)){ + if (FlagGet(FLAG_SYS_NO_CATCHING)) + { static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); return; From d9bd2724525bb2deabd4d7750017a73a6f50e03e Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:08:35 +0200 Subject: [PATCH 067/115] removed the entries ld_script as per pret#1738, added newline to debug.h --- include/debug.h | 2 +- ld_script.txt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/debug.h b/include/debug.h index 9aec5c2629..bfc072ee3b 100644 --- a/include/debug.h +++ b/include/debug.h @@ -8,4 +8,4 @@ void Debug_ShowMainMenu(void); -#endif // GUARD_DEBUG_H \ No newline at end of file +#endif // GUARD_DEBUG_H diff --git a/ld_script.txt b/ld_script.txt index 10de31a99d..da0eb682d3 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -105,7 +105,6 @@ 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); @@ -496,7 +495,6 @@ 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); From e09ba650f375b69d28b971b145d81cdb9721e62e Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:12:23 +0200 Subject: [PATCH 068/115] imrpoved code formatting in field_control_avatar as per suggestion --- src/field_control_avatar.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 137fe8980d..6f5460f589 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -138,7 +138,8 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) { input->input_field_1_0 = TRUE; input->pressedSelectButton = FALSE; - }else if(input->pressedStartButton) + } + else if (input->pressedStartButton) { input->input_field_1_2 = TRUE; input->pressedStartButton = FALSE; @@ -146,16 +147,17 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) } if (heldKeys & L_BUTTON) { - if(input->pressedSelectButton) + if (input->pressedSelectButton) { input->input_field_1_1 = TRUE; input->pressedSelectButton = FALSE; - }else if(input->pressedStartButton) + } + else if (input->pressedStartButton) { input->input_field_1_3 = TRUE; input->pressedStartButton = FALSE; } - } + } #endif } From 04c40677bd54f2fd2421401f1684c51ebabb9cad Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:41:35 +0200 Subject: [PATCH 069/115] Changed the way debug flags are handled, now in constants/battle_config.h --- include/constants/battle_config.h | 8 ++++++++ include/constants/flags.h | 14 +++++++------- src/battle_main.c | 2 +- src/debug.c | 32 +++++++++++++++---------------- src/event_object_movement.c | 2 +- src/field_control_avatar.c | 2 +- src/item_use.c | 2 +- src/pokemon_storage_system.c | 4 ++-- src/trainer_see.c | 2 +- 9 files changed, 38 insertions(+), 30 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 89134daf91..0b610211c5 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -194,6 +194,14 @@ #define B_NEW_IMPACT_PALETTE FALSE // If set to TRUE, it updates the basic 'hit' palette. #define B_NEW_SURF_PARTICLE_PALETTE FALSE // If set to TRUE, it updates Surf's wave palette. +// Debugging, Replace the used flags with others or disable with a 0 #define B_ENABLE_DEBUG TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. +#define TX_DEBUG_FLAG_NO_COLLISION FLAG_UNUSED_0x020 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. +#define TX_DEBUG_FLAG_NO_ENCOUNTER FLAG_UNUSED_0x021 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used. +#define TX_DEBUG_FLAG_NO_TRAINER_SEE FLAG_UNUSED_0x022 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used. +#define TX_DEBUG_FLAG_NO_BAG_USE FLAG_UNUSED_0x023 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used. +#define TX_DEBUG_FLAG_NO_CATCHING FLAG_UNUSED_0x024 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used. +#define TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU FLAG_UNUSED_0x025 // If this flag is set, the debug function in debug menu to access the player PC works. + #endif // GUARD_CONSTANTS_BATTLE_CONFIG_H diff --git a/include/constants/flags.h b/include/constants/flags.h index 9b101c77e4..ac8de43dc4 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -40,13 +40,13 @@ #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_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_SYS_PC_FROM_DEBUG_MENU 0x25 // Unused Flag //DEBUG + +#define FLAG_UNUSED_0x020 0x20 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" +#define FLAG_UNUSED_0x021 0x21 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" +#define FLAG_UNUSED_0x022 0x22 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" +#define FLAG_UNUSED_0x023 0x23 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" +#define FLAG_UNUSED_0x024 0x24 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" +#define FLAG_UNUSED_0x025 0x25 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" #define FLAG_UNUSED_0x026 0x26 // Unused Flag #define FLAG_UNUSED_0x027 0x27 // Unused Flag #define FLAG_UNUSED_0x028 0x28 // Unused Flag diff --git a/src/battle_main.c b/src/battle_main.c index 029578ceb7..20ebc05c61 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4002,7 +4002,7 @@ static void HandleTurnActionSelectionState(void) break; case B_ACTION_USE_ITEM: #if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(FLAG_SYS_NO_BAG_USE)) + if (FlagGet(TX_DEBUG_FLAG_NO_BAG_USE)) { RecordedBattle_ClearBattlerAction(gActiveBattler, 1); gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; diff --git a/src/debug.c b/src/debug.c index b27142abea..283361b389 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1447,56 +1447,56 @@ static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) } static void DebugAction_Flags_CollisionOnOff(u8 taskId) { - if(FlagGet(FLAG_SYS_NO_COLLISION)) + if(FlagGet(TX_DEBUG_FLAG_NO_COLLISION)) { - FlagClear(FLAG_SYS_NO_COLLISION); + FlagClear(TX_DEBUG_FLAG_NO_COLLISION); PlaySE(SE_PC_OFF); }else{ - FlagSet(FLAG_SYS_NO_COLLISION); + FlagSet(TX_DEBUG_FLAG_NO_COLLISION); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_EncounterOnOff(u8 taskId) { - if(FlagGet(FLAG_SYS_NO_ENCOUNTER)) + if(FlagGet(TX_DEBUG_FLAG_NO_ENCOUNTER)) { - FlagClear(FLAG_SYS_NO_ENCOUNTER); + FlagClear(TX_DEBUG_FLAG_NO_ENCOUNTER); PlaySE(SE_PC_OFF); }else{ - FlagSet(FLAG_SYS_NO_ENCOUNTER); + FlagSet(TX_DEBUG_FLAG_NO_ENCOUNTER); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) { - if(FlagGet(FLAG_SYS_NO_TRAINER_SEE)) + if(FlagGet(TX_DEBUG_FLAG_NO_TRAINER_SEE)) { - FlagClear(FLAG_SYS_NO_TRAINER_SEE); + FlagClear(TX_DEBUG_FLAG_NO_TRAINER_SEE); PlaySE(SE_PC_OFF); }else{ - FlagSet(FLAG_SYS_NO_TRAINER_SEE); + FlagSet(TX_DEBUG_FLAG_NO_TRAINER_SEE); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_BagUseOnOff(u8 taskId) { - if(FlagGet(FLAG_SYS_NO_BAG_USE)) + if(FlagGet(TX_DEBUG_FLAG_NO_BAG_USE)) { - FlagClear(FLAG_SYS_NO_BAG_USE); + FlagClear(TX_DEBUG_FLAG_NO_BAG_USE); PlaySE(SE_PC_OFF); }else{ - FlagSet(FLAG_SYS_NO_BAG_USE); + FlagSet(TX_DEBUG_FLAG_NO_BAG_USE); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_CatchingOnOff(u8 taskId) { - if(FlagGet(FLAG_SYS_NO_CATCHING)) + if(FlagGet(TX_DEBUG_FLAG_NO_CATCHING)) { - FlagClear(FLAG_SYS_NO_CATCHING); + FlagClear(TX_DEBUG_FLAG_NO_CATCHING); PlaySE(SE_PC_OFF); }else{ - FlagSet(FLAG_SYS_NO_CATCHING); + FlagSet(TX_DEBUG_FLAG_NO_CATCHING); PlaySE(SE_PC_LOGIN); } } @@ -2723,7 +2723,7 @@ static void Task_WaitFadeAccessPC(u8 taskId) if (!gPaletteFade.active) { DestroyTask(taskId); - FlagSet(FLAG_SYS_PC_FROM_DEBUG_MENU); + FlagSet(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU); EnterPokeStorage(2); } } diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 2c80e79489..fbcb6ed795 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4631,7 +4631,7 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) u8 direction = dir; #if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(FLAG_SYS_NO_COLLISION)) + if (FlagGet(TX_DEBUG_FLAG_NO_COLLISION)) return COLLISION_NONE; #endif diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 6f5460f589..5f8712980f 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -708,7 +708,7 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { #if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(FLAG_SYS_NO_ENCOUNTER)) + if (FlagGet(TX_DEBUG_FLAG_NO_ENCOUNTER)) return FALSE; #endif diff --git a/src/item_use.c b/src/item_use.c index 63599d1e21..5cca3aee3f 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -983,7 +983,7 @@ static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a b void ItemUseInBattle_PokeBall(u8 taskId) { #if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(FLAG_SYS_NO_CATCHING)) + if (FlagGet(TX_DEBUG_FLAG_NO_CATCHING)) { static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index df822f2458..437458d75b 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1669,7 +1669,7 @@ static void FieldTask_ReturnToPcMenu(void) MainCallback vblankCb = gMain.vblankCallback; SetVBlankCallback(NULL); - if (!FlagGet(FLAG_SYS_PC_FROM_DEBUG_MENU)) + if (!FlagGet(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU)) { taskId = CreateTask(Task_PCMainMenu, 80); gTasks[taskId].tState = 0; @@ -1678,7 +1678,7 @@ static void FieldTask_ReturnToPcMenu(void) } else { - FlagClear(FLAG_SYS_PC_FROM_DEBUG_MENU); + FlagClear(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU); ScriptContext_Enable(); } SetVBlankCallback(vblankCb); diff --git a/src/trainer_see.c b/src/trainer_see.c index 81b040a3b6..596b7456d8 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -194,7 +194,7 @@ bool8 CheckForTrainersWantingBattle(void) u8 i; #if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) + if (FlagGet(TX_DEBUG_FLAG_NO_TRAINER_SEE)) return FALSE; #endif From 3debf0442dc88b948899c73a3b98a0d76b1f45f7 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 18:02:23 +0200 Subject: [PATCH 070/115] changed the locations of tx_debug_system related #defines to its own file 'constants/debug_config.h' --- include/constants/battle_config.h | 8 -------- include/constants/debug_config.h | 15 +++++++++++++++ include/constants/global.h | 1 + include/debug.h | 5 +---- 4 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 include/constants/debug_config.h diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 0b610211c5..89134daf91 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -194,14 +194,6 @@ #define B_NEW_IMPACT_PALETTE FALSE // If set to TRUE, it updates the basic 'hit' palette. #define B_NEW_SURF_PARTICLE_PALETTE FALSE // If set to TRUE, it updates Surf's wave palette. -// Debugging, Replace the used flags with others or disable with a 0 #define B_ENABLE_DEBUG TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. -#define TX_DEBUG_FLAG_NO_COLLISION FLAG_UNUSED_0x020 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. -#define TX_DEBUG_FLAG_NO_ENCOUNTER FLAG_UNUSED_0x021 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used. -#define TX_DEBUG_FLAG_NO_TRAINER_SEE FLAG_UNUSED_0x022 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used. -#define TX_DEBUG_FLAG_NO_BAG_USE FLAG_UNUSED_0x023 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used. -#define TX_DEBUG_FLAG_NO_CATCHING FLAG_UNUSED_0x024 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used. -#define TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU FLAG_UNUSED_0x025 // If this flag is set, the debug function in debug menu to access the player PC works. - #endif // GUARD_CONSTANTS_BATTLE_CONFIG_H diff --git a/include/constants/debug_config.h b/include/constants/debug_config.h new file mode 100644 index 0000000000..847288d64e --- /dev/null +++ b/include/constants/debug_config.h @@ -0,0 +1,15 @@ +#ifndef GUARD_CONSTANTS_DEBUG_CONFIG_H +#define GUARD_CONSTANTS_DEBUG_CONFIG_H + +#define TX_DEBUG_SYSTEM TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by pressing R plus START. +#define TX_DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (replaces the exit entry). + +// Replace the used flags with others or disable with a 0 +#define TX_DEBUG_FLAG_NO_COLLISION FLAG_UNUSED_0x020 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. +#define TX_DEBUG_FLAG_NO_ENCOUNTER FLAG_UNUSED_0x021 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used. +#define TX_DEBUG_FLAG_NO_TRAINER_SEE FLAG_UNUSED_0x022 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used. +#define TX_DEBUG_FLAG_NO_BAG_USE FLAG_UNUSED_0x023 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used. +#define TX_DEBUG_FLAG_NO_CATCHING FLAG_UNUSED_0x024 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used. +#define TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU FLAG_UNUSED_0x025 // If this flag is set, the debug function in debug menu to access the player PC works. + +#endif // GUARD_CONSTANTS_DEBUG_CONFIG_H diff --git a/include/constants/global.h b/include/constants/global.h index 2a773dbb95..b80bcd402a 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -2,6 +2,7 @@ #define GUARD_CONSTANTS_GLOBAL_H #include "constants/battle_config.h" +#include "constants/debug_config.h" // Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen. // In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen. diff --git a/include/debug.h b/include/debug.h index bfc072ee3b..c5bdc224cc 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,11 +1,8 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H -#define TX_DEBUG_SYSTEM TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by pressing R plus START. -#define TX_DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (replaces the exit entry). - +#include "constants/debug_config.h" void Debug_ShowMainMenu(void); - #endif // GUARD_DEBUG_H From c13561e5ba4db120578cce0e726b7605f8f3f505 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 30 Aug 2022 18:15:06 +0200 Subject: [PATCH 071/115] simplified filed controls code for debug menu --- src/field_control_avatar.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 5f8712980f..e2bc06e98a 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -132,31 +132,10 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) input->dpadDirection = DIR_EAST; #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE - if (heldKeys & R_BUTTON) + if ((heldKeys & R_BUTTON) && input->pressedStartButton) { - 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; - } + input->input_field_1_2 = TRUE; + input->pressedStartButton = FALSE; } #endif } From e02b33ee112f9f08c0866a27fb8c2ad1e763ad20 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 31 Aug 2022 22:56:39 -0300 Subject: [PATCH 072/115] Automatized the contents of some sideof in src/item.c --- src/item.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/item.c b/src/item.c index 63287693a8..641c1ce618 100644 --- a/src/item.c +++ b/src/item.c @@ -740,11 +740,11 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count) u16 *items = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode]; u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode]; - u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); - memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++) { @@ -792,8 +792,8 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count) if (count == 0) { - memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); Free(newItems); Free(newQuantities); return TRUE; @@ -823,11 +823,11 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count) } else { - u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); - memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++) { @@ -854,8 +854,8 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count) if (count == 0) { - memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); Free(newItems); Free(newQuantities); return TRUE; From ea345f90f5d2e9cb8a63ad12343aeea49e67340c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 31 Aug 2022 23:05:06 -0300 Subject: [PATCH 073/115] Picked the correct pointers for correctness' sake --- src/item.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/item.c b/src/item.c index 641c1ce618..0f5746027b 100644 --- a/src/item.c +++ b/src/item.c @@ -792,8 +792,8 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count) if (count == 0) { - memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); - memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); + memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*items)); + memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*quantities)); Free(newItems); Free(newQuantities); return TRUE; @@ -854,8 +854,8 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count) if (count == 0) { - memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); - memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); + memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*items)); + memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*quantities)); Free(newItems); Free(newQuantities); return TRUE; From 5d346fd9392eb718dce06875a26538691343f582 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 31 Aug 2022 23:49:43 -0300 Subject: [PATCH 074/115] Updated a couple more sizeofs --- src/battle_pyramid_bag.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 9fab996da8..7a4d981f01 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -1404,20 +1404,20 @@ void TryStoreHeldItemsInPyramidBag(void) { u8 i; struct Pokemon *party = gPlayerParty; - u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); u16 heldItem; - memcpy(newItems, gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(newQuantities, gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(newItems, gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(newQuantities, gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); for (i = 0; i < FRONTIER_PARTY_SIZE; i++) { heldItem = GetMonData(&party[i], MON_DATA_HELD_ITEM); if (heldItem != ITEM_NONE && !AddBagItem(heldItem, 1)) { // Cant store party held items in pyramid bag because bag is full - memcpy(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16)); - memcpy(gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8)); + memcpy(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems)); + memcpy(gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); Free(newItems); Free(newQuantities); gSpecialVar_Result = 1; From ad57551db16ae81f2feda9fd96367d821e159b40 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Fri, 2 Sep 2022 12:10:11 +0200 Subject: [PATCH 075/115] removed unnecessary script, cheat start now with national dex, reverted accidental type hin removal, changed indentation --- data/scripts/debug.inc | 24 +++--------------------- include/constants/map_groups.h | 2 -- include/main_menu.h | 2 +- src/battle_main.c | 4 ++-- src/event_object_movement.c | 4 ++-- src/field_control_avatar.c | 12 ++++++------ src/item_use.c | 4 ++-- src/start_menu.c | 26 +++++++------------------- src/trainer_see.c | 4 ++-- 9 files changed, 25 insertions(+), 57 deletions(-) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index 4ced7d9716..e174343f22 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -5,11 +5,6 @@ Debug_ShowFieldMessageStringVar4:: 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 @@ -27,8 +22,8 @@ Debug_CheatStart:: special SetUnlockedPokedexFlags setflag FLAG_RECEIVED_POKEDEX_FROM_BIRCH setvar VAR_CABLE_CLUB_TUTORIAL_STATE, 1 - @ setflag FLAG_SYS_NATIONAL_DEX - @ special EnableNationalPokedex + 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 @@ -37,25 +32,12 @@ Debug_CheatStart:: 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 + additem 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/map_groups.h b/include/constants/map_groups.h index 2e6c781943..eaf40a525d 100755 --- a/include/constants/map_groups.h +++ b/include/constants/map_groups.h @@ -593,6 +593,4 @@ #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/main_menu.h b/include/main_menu.h index 790c9d10ec..81e2d9794b 100644 --- a/include/main_menu.h +++ b/include/main_menu.h @@ -2,7 +2,7 @@ #define GUARD_MAIN_MENU_H void CB2_InitMainMenu(void); -void CreateYesNoMenuParameterized(u8 a, u8 b, u16 c, u16 d, u8 e, u8 f); +void CreateYesNoMenuParameterized(u8 x, u8 y, u16 baseTileNum, u16 baseBlock, u8 yesNoPalNum, u8 winPalNum); void NewGameBirchSpeech_SetDefaultPlayerName(u8); #endif // GUARD_MAIN_MENU_H diff --git a/src/battle_main.c b/src/battle_main.c index 20ebc05c61..052b61163c 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4001,7 +4001,7 @@ static void HandleTurnActionSelectionState(void) } break; case B_ACTION_USE_ITEM: - #if TX_DEBUG_SYSTEM == TRUE + #if TX_DEBUG_SYSTEM == TRUE if (FlagGet(TX_DEBUG_FLAG_NO_BAG_USE)) { RecordedBattle_ClearBattlerAction(gActiveBattler, 1); @@ -4011,7 +4011,7 @@ static void HandleTurnActionSelectionState(void) *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; return; } - #endif + #endif if ((gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER_NO_PYRAMID diff --git a/src/event_object_movement.c b/src/event_object_movement.c index fbcb6ed795..9765febbf4 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4630,10 +4630,10 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; - #if TX_DEBUG_SYSTEM == TRUE +#if TX_DEBUG_SYSTEM == TRUE if (FlagGet(TX_DEBUG_FLAG_NO_COLLISION)) return COLLISION_NONE; - #endif +#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 e2bc06e98a..2b86bf2cf7 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -131,13 +131,13 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; - #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE +#if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE if ((heldKeys & R_BUTTON) && input->pressedStartButton) { input->input_field_1_2 = TRUE; input->pressedStartButton = FALSE; } - #endif +#endif } int ProcessPlayerFieldInput(struct FieldInput *input) @@ -197,14 +197,14 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; - #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE +#if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE if (input->input_field_1_2) { PlaySE(SE_WIN_OPEN); Debug_ShowMainMenu(); return TRUE; } - #endif +#endif return FALSE; } @@ -686,10 +686,10 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { - #if TX_DEBUG_SYSTEM == TRUE +#if TX_DEBUG_SYSTEM == TRUE if (FlagGet(TX_DEBUG_FLAG_NO_ENCOUNTER)) return FALSE; - #endif +#endif if (sWildEncounterImmunitySteps < 4) { diff --git a/src/item_use.c b/src/item_use.c index 5cca3aee3f..ea2bea0fe7 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -982,14 +982,14 @@ static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThe static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p"); void ItemUseInBattle_PokeBall(u8 taskId) { - #if TX_DEBUG_SYSTEM == TRUE +#if TX_DEBUG_SYSTEM == TRUE if (FlagGet(TX_DEBUG_FLAG_NO_CATCHING)) { static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); return; } - #endif +#endif switch (GetBallThrowableState()) { diff --git a/src/start_menu.c b/src/start_menu.c index ce9b726a3e..9f84df16ad 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -174,7 +174,7 @@ static const struct MenuAction sStartMenuItems[] = [MENU_ACTION_REST_FRONTIER] = {gText_MenuRest, {.u8_void = StartMenuSaveCallback}}, [MENU_ACTION_RETIRE_FRONTIER] = {gText_MenuRetire, {.u8_void = StartMenuBattlePyramidRetireCallback}}, [MENU_ACTION_PYRAMID_BAG] = {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}}, - [MENU_ACTION_DEBUG] = {gText_MenuDebug, {.u8_void = StartMenuDebugCallback}}, + [MENU_ACTION_DEBUG] = {gText_MenuDebug, {.u8_void = StartMenuDebugCallback}}, }; static const struct BgTemplate sBgTemplates_LinkBattleSave[] = @@ -284,17 +284,14 @@ static void BuildStartMenuActions(void) { BuildMultiPartnerRoomStartMenu(); } + else + { #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == TRUE - else - { BuildDebugStartMenu(); - } #else - else - { BuildNormalStartMenu(); - } #endif + } } static void AddStartMenuAction(u8 action) @@ -328,26 +325,17 @@ static void BuildNormalStartMenu(void) static void BuildDebugStartMenu(void) { + AddStartMenuAction(MENU_ACTION_DEBUG); 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) @@ -772,11 +760,11 @@ static bool8 StartMenuDebugCallback(void) RemoveExtraStartMenuWindows(); HideStartMenuDebug(); // Hide start menu without enabling movement - #if TX_DEBUG_SYSTEM == TRUE +#if TX_DEBUG_SYSTEM == TRUE Debug_ShowMainMenu(); #endif - return TRUE; +return TRUE; } static bool8 StartMenuSafariZoneRetireCallback(void) diff --git a/src/trainer_see.c b/src/trainer_see.c index 596b7456d8..73b4395d40 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -193,10 +193,10 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; - #if TX_DEBUG_SYSTEM == TRUE +#if TX_DEBUG_SYSTEM == TRUE if (FlagGet(TX_DEBUG_FLAG_NO_TRAINER_SEE)) return FALSE; - #endif +#endif gNoOfApproachingTrainers = 0; gApproachingTrainerId = 0; From 367b12801e32e5a8b1dbc258030b98643e755cbf Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Fri, 2 Sep 2022 12:33:42 +0200 Subject: [PATCH 076/115] changed debug_config.h to overworld_config.h, changed no bag use and no catching flags to battle_config.h, removed TX reference (big sad) --- include/constants/battle_config.h | 2 ++ include/constants/debug_config.h | 15 ------------ include/constants/global.h | 2 +- include/constants/overworld_config.h | 14 ++++++++++++ include/debug.h | 2 +- src/battle_main.c | 4 +--- src/debug.c | 34 ++++++++++++++-------------- src/event_object_movement.c | 4 ++-- src/field_control_avatar.c | 8 +++---- src/item_use.c | 4 +--- src/pokemon_storage_system.c | 4 ++-- src/start_menu.c | 4 ++-- src/trainer_see.c | 4 ++-- 13 files changed, 49 insertions(+), 52 deletions(-) delete mode 100644 include/constants/debug_config.h create mode 100644 include/constants/overworld_config.h diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 89134daf91..a5db36e19b 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -138,6 +138,8 @@ #define B_FLAG_INVERSE_BATTLE 0 // If this flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water. #define B_FLAG_FORCE_DOUBLE_WILD 0 // If this flag is set, all land and surfing wild battles will be double battles. #define B_SMART_WILD_AI_FLAG 0 // If not 0, you can set this flag in a script to enable smart wild pokemon +#define B_FLAG_NO_BAG_USE FLAG_UNUSED_0x023 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used. +#define B_FLAG_NO_CATCHING FLAG_UNUSED_0x024 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used. // Var Settings // To use the following features in scripting, replace the 0s with the var ID you're assigning it to. diff --git a/include/constants/debug_config.h b/include/constants/debug_config.h deleted file mode 100644 index 847288d64e..0000000000 --- a/include/constants/debug_config.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef GUARD_CONSTANTS_DEBUG_CONFIG_H -#define GUARD_CONSTANTS_DEBUG_CONFIG_H - -#define TX_DEBUG_SYSTEM TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by pressing R plus START. -#define TX_DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (replaces the exit entry). - -// Replace the used flags with others or disable with a 0 -#define TX_DEBUG_FLAG_NO_COLLISION FLAG_UNUSED_0x020 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. -#define TX_DEBUG_FLAG_NO_ENCOUNTER FLAG_UNUSED_0x021 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used. -#define TX_DEBUG_FLAG_NO_TRAINER_SEE FLAG_UNUSED_0x022 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used. -#define TX_DEBUG_FLAG_NO_BAG_USE FLAG_UNUSED_0x023 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used. -#define TX_DEBUG_FLAG_NO_CATCHING FLAG_UNUSED_0x024 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used. -#define TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU FLAG_UNUSED_0x025 // If this flag is set, the debug function in debug menu to access the player PC works. - -#endif // GUARD_CONSTANTS_DEBUG_CONFIG_H diff --git a/include/constants/global.h b/include/constants/global.h index b80bcd402a..07ed190208 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -2,7 +2,7 @@ #define GUARD_CONSTANTS_GLOBAL_H #include "constants/battle_config.h" -#include "constants/debug_config.h" +#include "constants/overworld_config.h" // Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen. // In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen. diff --git a/include/constants/overworld_config.h b/include/constants/overworld_config.h new file mode 100644 index 0000000000..3e57066f5f --- /dev/null +++ b/include/constants/overworld_config.h @@ -0,0 +1,14 @@ +#ifndef GUARD_CONSTANTS_OVERWORLD_CONFIG_H +#define GUARD_CONSTANTS_OVERWORLD_CONFIG_H + +// Debug options +#define DEBUG_SYSTEM_ENABLE TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by pressing R plus START. +#define DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (replaces the exit entry). + +// Replace the used flags with others or disable with a 0 +#define DEBUG_FLAG_NO_COLLISION FLAG_UNUSED_0x020 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. +#define DEBUG_FLAG_NO_ENCOUNTER FLAG_UNUSED_0x021 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used. +#define DEBUG_FLAG_NO_TRAINER_SEE FLAG_UNUSED_0x022 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used. +#define DEBUG_FLAG_PC_FROM_DEBUG_MENU FLAG_UNUSED_0x025 // If this flag is set, the debug function in debug menu to access the player PC works. + +#endif // GUARD_CONSTANTS_OVERWORLD_CONFIG_H diff --git a/include/debug.h b/include/debug.h index c5bdc224cc..f56efbde34 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,7 +1,7 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H -#include "constants/debug_config.h" +#include "constants/overworld_config.h" void Debug_ShowMainMenu(void); diff --git a/src/battle_main.c b/src/battle_main.c index 052b61163c..39deaca27f 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4001,8 +4001,7 @@ static void HandleTurnActionSelectionState(void) } break; case B_ACTION_USE_ITEM: - #if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_BAG_USE)) + if (FlagGet(B_FLAG_NO_BAG_USE)) { RecordedBattle_ClearBattlerAction(gActiveBattler, 1); gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; @@ -4011,7 +4010,6 @@ static void HandleTurnActionSelectionState(void) *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; return; } - #endif if ((gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER_NO_PYRAMID diff --git a/src/debug.c b/src/debug.c index 283361b389..2883beb797 100644 --- a/src/debug.c +++ b/src/debug.c @@ -55,7 +55,7 @@ #include "constants/songs.h" #include "constants/species.h" -#if TX_DEBUG_SYSTEM == TRUE +#if DEBUG_SYSTEM_ENABLE == TRUE // ******************************* // Enums enum { // Main @@ -1447,56 +1447,56 @@ static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) } static void DebugAction_Flags_CollisionOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_COLLISION)) + if(FlagGet(DEBUG_FLAG_NO_COLLISION)) { - FlagClear(TX_DEBUG_FLAG_NO_COLLISION); + FlagClear(DEBUG_FLAG_NO_COLLISION); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_COLLISION); + FlagSet(DEBUG_FLAG_NO_COLLISION); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_EncounterOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_ENCOUNTER)) + if(FlagGet(DEBUG_FLAG_NO_ENCOUNTER)) { - FlagClear(TX_DEBUG_FLAG_NO_ENCOUNTER); + FlagClear(DEBUG_FLAG_NO_ENCOUNTER); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_ENCOUNTER); + FlagSet(DEBUG_FLAG_NO_ENCOUNTER); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_TRAINER_SEE)) + if(FlagGet(DEBUG_FLAG_NO_TRAINER_SEE)) { - FlagClear(TX_DEBUG_FLAG_NO_TRAINER_SEE); + FlagClear(DEBUG_FLAG_NO_TRAINER_SEE); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_TRAINER_SEE); + FlagSet(DEBUG_FLAG_NO_TRAINER_SEE); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_BagUseOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_BAG_USE)) + if(FlagGet(B_FLAG_NO_BAG_USE)) { - FlagClear(TX_DEBUG_FLAG_NO_BAG_USE); + FlagClear(B_FLAG_NO_BAG_USE); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_BAG_USE); + FlagSet(B_FLAG_NO_BAG_USE); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_CatchingOnOff(u8 taskId) { - if(FlagGet(TX_DEBUG_FLAG_NO_CATCHING)) + if(FlagGet(B_FLAG_NO_CATCHING)) { - FlagClear(TX_DEBUG_FLAG_NO_CATCHING); + FlagClear(B_FLAG_NO_CATCHING); PlaySE(SE_PC_OFF); }else{ - FlagSet(TX_DEBUG_FLAG_NO_CATCHING); + FlagSet(B_FLAG_NO_CATCHING); PlaySE(SE_PC_LOGIN); } } @@ -2723,7 +2723,7 @@ static void Task_WaitFadeAccessPC(u8 taskId) if (!gPaletteFade.active) { DestroyTask(taskId); - FlagSet(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU); + FlagSet(DEBUG_FLAG_PC_FROM_DEBUG_MENU); EnterPokeStorage(2); } } diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 9765febbf4..2c5418da41 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4630,8 +4630,8 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; -#if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_COLLISION)) +#if DEBUG_SYSTEM_ENABLE == TRUE + if (FlagGet(DEBUG_FLAG_NO_COLLISION)) return COLLISION_NONE; #endif diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 2b86bf2cf7..76503a85a2 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -131,7 +131,7 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; -#if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE +#if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == FALSE if ((heldKeys & R_BUTTON) && input->pressedStartButton) { input->input_field_1_2 = TRUE; @@ -197,7 +197,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; -#if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == FALSE +#if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == FALSE if (input->input_field_1_2) { PlaySE(SE_WIN_OPEN); @@ -686,8 +686,8 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { -#if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_ENCOUNTER)) +#if DEBUG_SYSTEM_ENABLE == TRUE + if (FlagGet(DEBUG_FLAG_NO_ENCOUNTER)) return FALSE; #endif diff --git a/src/item_use.c b/src/item_use.c index ea2bea0fe7..a0b4233fff 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -982,14 +982,12 @@ static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThe static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p"); void ItemUseInBattle_PokeBall(u8 taskId) { -#if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_CATCHING)) + if (FlagGet(B_FLAG_NO_CATCHING)) { static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); return; } -#endif switch (GetBallThrowableState()) { diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 437458d75b..d3fe3caa29 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1669,7 +1669,7 @@ static void FieldTask_ReturnToPcMenu(void) MainCallback vblankCb = gMain.vblankCallback; SetVBlankCallback(NULL); - if (!FlagGet(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU)) + if (!FlagGet(DEBUG_FLAG_PC_FROM_DEBUG_MENU)) { taskId = CreateTask(Task_PCMainMenu, 80); gTasks[taskId].tState = 0; @@ -1678,7 +1678,7 @@ static void FieldTask_ReturnToPcMenu(void) } else { - FlagClear(TX_DEBUG_FLAG_PC_FROM_DEBUG_MENU); + FlagClear(DEBUG_FLAG_PC_FROM_DEBUG_MENU); ScriptContext_Enable(); } SetVBlankCallback(vblankCb); diff --git a/src/start_menu.c b/src/start_menu.c index 9f84df16ad..0f7c0cb697 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -286,7 +286,7 @@ static void BuildStartMenuActions(void) } else { - #if TX_DEBUG_SYSTEM == TRUE && TX_DEBUG_SYSTEM_IN_MENU == TRUE + #if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == TRUE BuildDebugStartMenu(); #else BuildNormalStartMenu(); @@ -760,7 +760,7 @@ static bool8 StartMenuDebugCallback(void) RemoveExtraStartMenuWindows(); HideStartMenuDebug(); // Hide start menu without enabling movement -#if TX_DEBUG_SYSTEM == TRUE +#if DEBUG_SYSTEM_ENABLE == TRUE Debug_ShowMainMenu(); #endif diff --git a/src/trainer_see.c b/src/trainer_see.c index 73b4395d40..d44e5e46fb 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -193,8 +193,8 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; -#if TX_DEBUG_SYSTEM == TRUE - if (FlagGet(TX_DEBUG_FLAG_NO_TRAINER_SEE)) +#if DEBUG_SYSTEM_ENABLE == TRUE + if (FlagGet(DEBUG_FLAG_NO_TRAINER_SEE)) return FALSE; #endif From b4b3e84cbdeb790a982ed97e48a2a7e5f9be4f73 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Fri, 2 Sep 2022 18:39:38 +0200 Subject: [PATCH 077/115] removed default flags and added ingame warning if a function that requires them is used --- data/scripts/debug.inc | 14 ++++++++++++- include/constants/battle_config.h | 4 ++-- include/constants/flags.h | 12 +++++------ include/constants/overworld_config.h | 8 +++---- src/debug.c | 31 ++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 13 deletions(-) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index e174343f22..fe86197c8c 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -38,10 +38,22 @@ Debug_CheatStart:: setflag FLAG_HIDE_ROUTE_116_MR_BRINEY clearflag FLAG_HIDE_BRINEYS_HOUSE_MR_BRINEY clearflag FLAG_HIDE_BRINEYS_HOUSE_PEEKO - closemessage release end +Debug_FlagsNotSetMessage:: + lockall + message Debug_FlagsNotSetMessage_Text + waitmessage + waitbuttonpress + releaseall + end + +Debug_FlagsNotSetMessage_Text: + .string "Feature unavailable!\n" + .string "Please define a usable flag in:\l" + .string "'include/constants/debug{UNDERSCORE}config.h'!$" + Debug_Script_1:: end diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index a5db36e19b..ad7775b673 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -138,8 +138,8 @@ #define B_FLAG_INVERSE_BATTLE 0 // If this flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water. #define B_FLAG_FORCE_DOUBLE_WILD 0 // If this flag is set, all land and surfing wild battles will be double battles. #define B_SMART_WILD_AI_FLAG 0 // If not 0, you can set this flag in a script to enable smart wild pokemon -#define B_FLAG_NO_BAG_USE FLAG_UNUSED_0x023 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used. -#define B_FLAG_NO_CATCHING FLAG_UNUSED_0x024 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used. +#define B_FLAG_NO_BAG_USE 0 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used. +#define B_FLAG_NO_CATCHING 0 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used. // Var Settings // To use the following features in scripting, replace the 0s with the var ID you're assigning it to. diff --git a/include/constants/flags.h b/include/constants/flags.h index ac8de43dc4..8fbc246300 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -41,12 +41,12 @@ #define FLAG_TEMP_1F (TEMP_FLAGS_START + 0x1F) #define TEMP_FLAGS_END FLAG_TEMP_1F -#define FLAG_UNUSED_0x020 0x20 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x021 0x21 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x022 0x22 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x023 0x23 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x024 0x24 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" -#define FLAG_UNUSED_0x025 0x25 // Unused Flag //Used for DEBUG functions, can be changed in "constants/battle_config.h" +#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_UNUSED_0x025 0x25 // Unused Flag #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/constants/overworld_config.h b/include/constants/overworld_config.h index 3e57066f5f..6d094d60f5 100644 --- a/include/constants/overworld_config.h +++ b/include/constants/overworld_config.h @@ -6,9 +6,9 @@ #define DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (replaces the exit entry). // Replace the used flags with others or disable with a 0 -#define DEBUG_FLAG_NO_COLLISION FLAG_UNUSED_0x020 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. -#define DEBUG_FLAG_NO_ENCOUNTER FLAG_UNUSED_0x021 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used. -#define DEBUG_FLAG_NO_TRAINER_SEE FLAG_UNUSED_0x022 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used. -#define DEBUG_FLAG_PC_FROM_DEBUG_MENU FLAG_UNUSED_0x025 // If this flag is set, the debug function in debug menu to access the player PC works. +#define DEBUG_FLAG_NO_COLLISION 0 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. +#define DEBUG_FLAG_NO_ENCOUNTER 0 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used. +#define DEBUG_FLAG_NO_TRAINER_SEE 0 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used. +#define DEBUG_FLAG_PC_FROM_DEBUG_MENU 0 // If this flag is set, the debug function in debug menu to access the player PC works. #endif // GUARD_CONSTANTS_OVERWORLD_CONFIG_H diff --git a/src/debug.c b/src/debug.c index 2883beb797..81e30cff01 100644 --- a/src/debug.c +++ b/src/debug.c @@ -271,6 +271,7 @@ 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); +extern u8 Debug_FlagsNotSetMessage[]; extern u8 Debug_Script_1[]; extern u8 Debug_Script_2[]; extern u8 Debug_Script_3[]; @@ -1447,6 +1448,11 @@ static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) } static void DebugAction_Flags_CollisionOnOff(u8 taskId) { +#if DEBUG_FLAG_NO_COLLISION == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(DEBUG_FLAG_NO_COLLISION)) { FlagClear(DEBUG_FLAG_NO_COLLISION); @@ -1455,9 +1461,15 @@ static void DebugAction_Flags_CollisionOnOff(u8 taskId) FlagSet(DEBUG_FLAG_NO_COLLISION); PlaySE(SE_PC_LOGIN); } +#endif } static void DebugAction_Flags_EncounterOnOff(u8 taskId) { +#if DEBUG_FLAG_NO_ENCOUNTER == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(DEBUG_FLAG_NO_ENCOUNTER)) { FlagClear(DEBUG_FLAG_NO_ENCOUNTER); @@ -1466,9 +1478,15 @@ static void DebugAction_Flags_EncounterOnOff(u8 taskId) FlagSet(DEBUG_FLAG_NO_ENCOUNTER); PlaySE(SE_PC_LOGIN); } +#endif } static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) { +#if DEBUG_FLAG_NO_TRAINER_SEE == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(DEBUG_FLAG_NO_TRAINER_SEE)) { FlagClear(DEBUG_FLAG_NO_TRAINER_SEE); @@ -1477,9 +1495,15 @@ static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) FlagSet(DEBUG_FLAG_NO_TRAINER_SEE); PlaySE(SE_PC_LOGIN); } +#endif } static void DebugAction_Flags_BagUseOnOff(u8 taskId) { +#if B_FLAG_NO_BAG_USE == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(B_FLAG_NO_BAG_USE)) { FlagClear(B_FLAG_NO_BAG_USE); @@ -1488,9 +1512,15 @@ static void DebugAction_Flags_BagUseOnOff(u8 taskId) FlagSet(B_FLAG_NO_BAG_USE); PlaySE(SE_PC_LOGIN); } +#endif } static void DebugAction_Flags_CatchingOnOff(u8 taskId) { +#if B_FLAG_NO_CATCHING_USE == 0 + Debug_DestroyMenu(taskId); + LockPlayerFieldControls(); + ScriptContext_SetupScript(Debug_FlagsNotSetMessage); +#else if(FlagGet(B_FLAG_NO_CATCHING)) { FlagClear(B_FLAG_NO_CATCHING); @@ -1499,6 +1529,7 @@ static void DebugAction_Flags_CatchingOnOff(u8 taskId) FlagSet(B_FLAG_NO_CATCHING); PlaySE(SE_PC_LOGIN); } +#endif } // ******************************* From 13cc640b7841fb0e71ee1225aa64db4114c4ecfd Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Fri, 2 Sep 2022 18:53:51 +0200 Subject: [PATCH 078/115] whitspace changes, removed wrong comment --- src/start_menu.c | 4 ++-- tools/mapjson/mapjson.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/start_menu.c b/src/start_menu.c index 0f7c0cb697..a0cff087cd 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -174,7 +174,7 @@ static const struct MenuAction sStartMenuItems[] = [MENU_ACTION_REST_FRONTIER] = {gText_MenuRest, {.u8_void = StartMenuSaveCallback}}, [MENU_ACTION_RETIRE_FRONTIER] = {gText_MenuRetire, {.u8_void = StartMenuBattlePyramidRetireCallback}}, [MENU_ACTION_PYRAMID_BAG] = {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}}, - [MENU_ACTION_DEBUG] = {gText_MenuDebug, {.u8_void = StartMenuDebugCallback}}, + [MENU_ACTION_DEBUG] = {gText_MenuDebug, {.u8_void = StartMenuDebugCallback}}, }; static const struct BgTemplate sBgTemplates_LinkBattleSave[] = @@ -762,7 +762,7 @@ static bool8 StartMenuDebugCallback(void) #if DEBUG_SYSTEM_ENABLE == TRUE Debug_ShowMainMenu(); - #endif +#endif return TRUE; } diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index c5f86bdf0e..8de9ff8d01 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -398,8 +398,8 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { for (auto &group : groups_data["group_order"].array_items()) { text << "// " << group.string_value() << "\n"; vector map_ids; - - size_t max_length = 0; //DEBUG + size_t max_length = 0; + int map_count = 0; //DEBUG for (auto &map_name : groups_data[group.string_value()].array_items()) { From c7fc2e13f771cb30a0eb579d1f77e76a85d3be5d Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 2 Sep 2022 16:54:58 -0400 Subject: [PATCH 079/115] Renamed TM flags to keep consistency with the rest of the repo --- .../AbandonedShip_HiddenFloorRooms/map.json | 2 +- data/maps/AbandonedShip_Room_B1F/map.json | 2 +- data/maps/MeteorFalls_1F_1R/map.json | 2 +- data/maps/MeteorFalls_B1F_2R/map.json | 2 +- data/maps/MtPyre_6F/map.json | 2 +- data/maps/MtPyre_Exterior/map.json | 2 +- data/maps/Route111/map.json | 2 +- data/maps/Route113/map.json | 2 +- data/maps/Route115/map.json | 2 +- data/maps/SafariZone_Northwest/map.json | 2 +- data/maps/ScorchedSlab/map.json | 2 +- data/maps/SeafloorCavern_Room9/map.json | 2 +- data/maps/ShoalCave_LowTideIceRoom/map.json | 2 +- data/maps/VictoryRoad_B1F/map.json | 2 +- include/constants/flags.h | 28 +++++++++---------- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/data/maps/AbandonedShip_HiddenFloorRooms/map.json b/data/maps/AbandonedShip_HiddenFloorRooms/map.json index b81c33c843..e9442f22e2 100644 --- a/data/maps/AbandonedShip_HiddenFloorRooms/map.json +++ b/data/maps/AbandonedShip_HiddenFloorRooms/map.json @@ -51,7 +51,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18", - "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_18" + "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM18" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/AbandonedShip_Room_B1F/map.json b/data/maps/AbandonedShip_Room_B1F/map.json index f5d14ac595..537f0ec645 100644 --- a/data/maps/AbandonedShip_Room_B1F/map.json +++ b/data/maps/AbandonedShip_Room_B1F/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "AbandonedShip_Room_B1F_EventScript_ItemTM13", - "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_13" + "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM13" } ], "warp_events": [ diff --git a/data/maps/MeteorFalls_1F_1R/map.json b/data/maps/MeteorFalls_1F_1R/map.json index f177410e27..145289ce79 100644 --- a/data/maps/MeteorFalls_1F_1R/map.json +++ b/data/maps/MeteorFalls_1F_1R/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "MeteorFalls_1F_1R_EventScript_ItemTM23", - "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM_23" + "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM23" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/MeteorFalls_B1F_2R/map.json b/data/maps/MeteorFalls_B1F_2R/map.json index 57276d86db..7fc43762f5 100644 --- a/data/maps/MeteorFalls_B1F_2R/map.json +++ b/data/maps/MeteorFalls_B1F_2R/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "MeteorFalls_B1F_2R_EventScript_ItemTM02", - "flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_02" + "flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02" } ], "warp_events": [ diff --git a/data/maps/MtPyre_6F/map.json b/data/maps/MtPyre_6F/map.json index dc2e7f9b00..88c091f3e3 100644 --- a/data/maps/MtPyre_6F/map.json +++ b/data/maps/MtPyre_6F/map.json @@ -38,7 +38,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "MtPyre_6F_EventScript_ItemTM30", - "flag": "FLAG_ITEM_MT_PYRE_6F_TM_30" + "flag": "FLAG_ITEM_MT_PYRE_6F_TM30" }, { "graphics_id": "OBJ_EVENT_GFX_PSYCHIC_M", diff --git a/data/maps/MtPyre_Exterior/map.json b/data/maps/MtPyre_Exterior/map.json index 58c865305f..2df79262c2 100644 --- a/data/maps/MtPyre_Exterior/map.json +++ b/data/maps/MtPyre_Exterior/map.json @@ -38,7 +38,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "MtPyre_Exterior_EventScript_ItemTM48", - "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM_48" + "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM48" } ], "warp_events": [ diff --git a/data/maps/Route111/map.json b/data/maps/Route111/map.json index 4621591e43..566e7c9629 100644 --- a/data/maps/Route111/map.json +++ b/data/maps/Route111/map.json @@ -262,7 +262,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "Route111_EventScript_ItemTM37", - "flag": "FLAG_ITEM_ROUTE_111_TM_37" + "flag": "FLAG_ITEM_ROUTE_111_TM37" }, { "graphics_id": "OBJ_EVENT_GFX_BERRY_TREE", diff --git a/data/maps/Route113/map.json b/data/maps/Route113/map.json index 422b88e6ef..783406346e 100644 --- a/data/maps/Route113/map.json +++ b/data/maps/Route113/map.json @@ -451,7 +451,7 @@ "y": 5, "elevation": 3, "item": "ITEM_TM32", - "flag": "FLAG_HIDDEN_ITEM_ROUTE_113_TM_32" + "flag": "FLAG_HIDDEN_ITEM_ROUTE_113_TM32" }, { "type": "hidden_item", diff --git a/data/maps/Route115/map.json b/data/maps/Route115/map.json index bbac132f52..a5e2b10f9e 100644 --- a/data/maps/Route115/map.json +++ b/data/maps/Route115/map.json @@ -166,7 +166,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "Route115_EventScript_ItemTM01", - "flag": "FLAG_ITEM_ROUTE_115_TM_01" + "flag": "FLAG_ITEM_ROUTE_115_TM01" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/SafariZone_Northwest/map.json b/data/maps/SafariZone_Northwest/map.json index 1e27def2cd..20fffd0498 100644 --- a/data/maps/SafariZone_Northwest/map.json +++ b/data/maps/SafariZone_Northwest/map.json @@ -49,7 +49,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "SafariZone_Northwest_EventScript_ItemTM22", - "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_22" + "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM22" } ], "warp_events": [], diff --git a/data/maps/ScorchedSlab/map.json b/data/maps/ScorchedSlab/map.json index e90f1f5c1f..cb97894903 100644 --- a/data/maps/ScorchedSlab/map.json +++ b/data/maps/ScorchedSlab/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "ScorchedSlab_EventScript_ItemTM11", - "flag": "FLAG_ITEM_SCORCHED_SLAB_TM_11" + "flag": "FLAG_ITEM_SCORCHED_SLAB_TM11" } ], "warp_events": [ diff --git a/data/maps/SeafloorCavern_Room9/map.json b/data/maps/SeafloorCavern_Room9/map.json index 0557b0c3eb..7942b3d1d4 100644 --- a/data/maps/SeafloorCavern_Room9/map.json +++ b/data/maps/SeafloorCavern_Room9/map.json @@ -90,7 +90,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "SeafloorCavern_Room9_EventScript_ItemTM26", - "flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_26" + "flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM26" }, { "graphics_id": "OBJ_EVENT_GFX_KYOGRE_ASLEEP", diff --git a/data/maps/ShoalCave_LowTideIceRoom/map.json b/data/maps/ShoalCave_LowTideIceRoom/map.json index ea4f0cedf4..3195d408b3 100644 --- a/data/maps/ShoalCave_LowTideIceRoom/map.json +++ b/data/maps/ShoalCave_LowTideIceRoom/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "ShoalCave_LowTideIceRoom_EventScript_ItemTM07", - "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_07" + "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM07" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/VictoryRoad_B1F/map.json b/data/maps/VictoryRoad_B1F/map.json index 6e290ce6de..68b013ef46 100644 --- a/data/maps/VictoryRoad_B1F/map.json +++ b/data/maps/VictoryRoad_B1F/map.json @@ -246,7 +246,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "VictoryRoad_B1F_EventScript_ItemTM29", - "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM_29" + "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM29" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/include/constants/flags.h b/include/constants/flags.h index 8fbc246300..4e108e1fe9 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -568,7 +568,7 @@ #define FLAG_HIDDEN_ITEM_LILYCOVE_CITY_HEART_SCALE (FLAG_HIDDEN_ITEMS_START + 0x1B) #define FLAG_HIDDEN_ITEM_FALLARBOR_TOWN_NUGGET (FLAG_HIDDEN_ITEMS_START + 0x1C) #define FLAG_HIDDEN_ITEM_MT_PYRE_EXTERIOR_ULTRA_BALL (FLAG_HIDDEN_ITEMS_START + 0x1D) -#define FLAG_HIDDEN_ITEM_ROUTE_113_TM_32 (FLAG_HIDDEN_ITEMS_START + 0x1E) +#define FLAG_HIDDEN_ITEM_ROUTE_113_TM32 (FLAG_HIDDEN_ITEMS_START + 0x1E) #define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_1_KEY (FLAG_HIDDEN_ITEMS_START + 0x1F) #define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_2_KEY (FLAG_HIDDEN_ITEMS_START + 0x20) #define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_4_KEY (FLAG_HIDDEN_ITEMS_START + 0x21) @@ -1053,7 +1053,7 @@ #define FLAG_ITEM_ROUTE_109_PP_UP 0x3ED #define FLAG_ITEM_ROUTE_109_RARE_CANDY 0x3EE #define FLAG_ITEM_ROUTE_110_DIRE_HIT 0x3EF -#define FLAG_ITEM_ROUTE_111_TM_37 0x3F0 +#define FLAG_ITEM_ROUTE_111_TM37 0x3F0 #define FLAG_ITEM_ROUTE_111_STARDUST 0x3F1 #define FLAG_ITEM_ROUTE_111_HP_UP 0x3F2 #define FLAG_ITEM_ROUTE_112_NUGGET 0x3F3 @@ -1062,7 +1062,7 @@ #define FLAG_ITEM_ROUTE_114_RARE_CANDY 0x3F6 #define FLAG_ITEM_ROUTE_114_PROTEIN 0x3F7 #define FLAG_ITEM_ROUTE_115_SUPER_POTION 0x3F8 -#define FLAG_ITEM_ROUTE_115_TM_01 0x3F9 +#define FLAG_ITEM_ROUTE_115_TM01 0x3F9 #define FLAG_ITEM_ROUTE_115_IRON 0x3FA #define FLAG_ITEM_ROUTE_116_ETHER 0x3FB #define FLAG_ITEM_ROUTE_116_REPEL 0x3FC @@ -1089,7 +1089,7 @@ #define FLAG_ITEM_RUSTBORO_CITY_X_DEFEND 0x411 #define FLAG_ITEM_LILYCOVE_CITY_MAX_REPEL 0x412 #define FLAG_ITEM_MOSSDEEP_CITY_NET_BALL 0x413 -#define FLAG_ITEM_METEOR_FALLS_1F_1R_TM_23 0x414 +#define FLAG_ITEM_METEOR_FALLS_1F_1R_TM23 0x414 #define FLAG_ITEM_METEOR_FALLS_1F_1R_FULL_HEAL 0x415 #define FLAG_ITEM_METEOR_FALLS_1F_1R_MOON_STONE 0x416 #define FLAG_ITEM_METEOR_FALLS_1F_1R_PP_UP 0x417 @@ -1119,35 +1119,35 @@ #define FLAG_ITEM_AQUA_HIDEOUT_B1F_MAX_ELIXIR 0x42F #define FLAG_ITEM_AQUA_HIDEOUT_B2F_NEST_BALL 0x430 #define FLAG_ITEM_MT_PYRE_EXTERIOR_MAX_POTION 0x431 -#define FLAG_ITEM_MT_PYRE_EXTERIOR_TM_48 0x432 +#define FLAG_ITEM_MT_PYRE_EXTERIOR_TM48 0x432 #define FLAG_ITEM_NEW_MAUVILLE_ULTRA_BALL 0x433 #define FLAG_ITEM_NEW_MAUVILLE_ESCAPE_ROPE 0x434 #define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_6_LUXURY_BALL 0x435 #define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_4_SCANNER 0x436 -#define FLAG_ITEM_SCORCHED_SLAB_TM_11 0x437 -#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_02 0x438 +#define FLAG_ITEM_SCORCHED_SLAB_TM11 0x437 +#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02 0x438 #define FLAG_ITEM_SHOAL_CAVE_ENTRANCE_BIG_PEARL 0x439 #define FLAG_ITEM_SHOAL_CAVE_INNER_ROOM_RARE_CANDY 0x43A #define FLAG_ITEM_SHOAL_CAVE_STAIRS_ROOM_ICE_HEAL 0x43B #define FLAG_ITEM_VICTORY_ROAD_1F_MAX_ELIXIR 0x43C #define FLAG_ITEM_VICTORY_ROAD_1F_PP_UP 0x43D -#define FLAG_ITEM_VICTORY_ROAD_B1F_TM_29 0x43E +#define FLAG_ITEM_VICTORY_ROAD_B1F_TM29 0x43E #define FLAG_ITEM_VICTORY_ROAD_B1F_FULL_RESTORE 0x43F #define FLAG_ITEM_VICTORY_ROAD_B2F_FULL_HEAL 0x440 -#define FLAG_ITEM_MT_PYRE_6F_TM_30 0x441 -#define FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_26 0x442 +#define FLAG_ITEM_MT_PYRE_6F_TM30 0x441 +#define FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM26 0x442 #define FLAG_ITEM_FIERY_PATH_TM06 0x443 #define FLAG_ITEM_ROUTE_124_RED_SHARD 0x444 #define FLAG_ITEM_ROUTE_124_BLUE_SHARD 0x445 -#define FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_22 0x446 +#define FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM22 0x446 #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_1F_HARBOR_MAIL 0x447 #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_ESCAPE_ROPE 0x448 #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_B1F_DIVE_BALL 0x449 -#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_13 0x44A +#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM13 0x44A #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_1F_REVIVE 0x44B #define FLAG_ITEM_ABANDONED_SHIP_CAPTAINS_OFFICE_STORAGE_KEY 0x44C #define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_3_WATER_STONE 0x44D -#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_18 0x44E +#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM18 0x44E #define FLAG_ITEM_ROUTE_121_CARBOS 0x44F #define FLAG_ITEM_ROUTE_123_ULTRA_BALL 0x450 #define FLAG_ITEM_ROUTE_126_GREEN_SHARD 0x451 @@ -1157,7 +1157,7 @@ #define FLAG_ITEM_ROUTE_123_ELIXIR 0x455 #define FLAG_ITEM_NEW_MAUVILLE_THUNDER_STONE 0x456 #define FLAG_ITEM_FIERY_PATH_FIRE_STONE 0x457 -#define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_07 0x458 +#define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM07 0x458 #define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_NEVER_MELT_ICE 0x459 #define FLAG_ITEM_ROUTE_103_GUARD_SPEC 0x45A #define FLAG_ITEM_ROUTE_104_X_ACCURACY 0x45B From 03498d7240b47bfb76b410323ebcf53c82c70ff3 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 2 Sep 2022 23:57:43 -0400 Subject: [PATCH 080/115] Applied remaining instances of BATTLE_OPPOSITE and BATTLE_PARTNER --- include/battle_ai_util.h | 2 +- src/battle_ai_main.c | 2 +- src/battle_ai_util.c | 2 +- src/battle_anim_new.c | 2 +- src/battle_controller_opponent.c | 2 +- src/battle_message.c | 6 +++--- src/battle_script_commands.c | 2 +- src/battle_util.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index 5e66577e30..11eba7b661 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -5,7 +5,7 @@ #define AI_IS_FASTER 0 #define AI_IS_SLOWER 1 -#define FOE(battler) ((battler ^ BIT_SIDE) & BIT_SIDE) +#define FOE(battler) ((BATTLE_OPPOSITE(battler)) & BIT_SIDE) bool32 AI_RandLessThan(u8 val); void RecordLastUsedMoveByTarget(void); diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index f496b90e81..af642aa8dc 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -486,7 +486,7 @@ static u8 ChooseMoveOrAction_Doubles(void) bestMovePointsForTarget[i] = mostViableMovesScores[0]; // Don't use a move against ally if it has less than 100 points. - if (i == (sBattler_AI ^ BIT_FLANK) && bestMovePointsForTarget[i] < 100) + if (i == BATTLE_PARTNER(sBattler_AI) && bestMovePointsForTarget[i] < 100) { bestMovePointsForTarget[i] = -1; mostViableMovesScores[0] = mostViableMovesScores[0]; // Needed to match. diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 25c7f3b9d5..98fcf948a3 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -3248,7 +3248,7 @@ s32 CountUsablePartyMons(u8 battlerId) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { battlerOnField1 = gBattlerPartyIndexes[battlerId]; - battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(GetBattlerPosition(battlerId) ^ BIT_FLANK)]; + battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battlerId)))]; } else // In singles there's only one battlerId by side. { diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 35c1244670..0a3d433b46 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -6523,7 +6523,7 @@ const struct SpriteTemplate gSoulStealZStarSpriteTemplate = //general void AnimTask_IsTargetPartner(u8 taskId) { - if (gBattleAnimTarget == (gBattleAnimAttacker ^ BIT_FLANK)) + if (gBattleAnimTarget == BATTLE_PARTNER(gBattleAnimAttacker)) gBattleAnimArgs[0] = 1; else gBattleAnimArgs[0] = 0; diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index d249fc38be..8f02fb3e35 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -226,7 +226,7 @@ static void Intro_DelayAndEnd(void) static bool32 TwoIntroMons(u32 battlerId) // Double battle with both player pokemon active. { - return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[battlerId ^ BIT_FLANK]])); + return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]])); } static void Intro_WaitForShinyAnimAndHealthbox(void) diff --git a/src/battle_message.c b/src/battle_message.c index 7b263ea657..8298accf1f 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2703,7 +2703,7 @@ void BufferStringBattle(u16 stringID) { if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY) stringPtr = sText_LegendaryPkmnAppeared; - else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]])) // interesting, looks like they had something planned for wild double battles + else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) // interesting, looks like they had something planned for wild double battles stringPtr = sText_TwoWildPkmnAppeared; else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) stringPtr = sText_WildPkmnAppearedPause; @@ -2714,7 +2714,7 @@ void BufferStringBattle(u16 stringID) case STRINGID_INTROSENDOUT: // poke first send-out if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]])) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) { if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) stringPtr = sText_InGamePartnerSentOutZGoN; @@ -2732,7 +2732,7 @@ void BufferStringBattle(u16 stringID) } else { - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]])) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) { if (BATTLE_TWO_VS_ONE_OPPONENT) stringPtr = sText_Trainer1SentOutTwoPkmn; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c485f40172..5c4ba2c401 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10730,7 +10730,7 @@ static void Cmd_forcerandomswitch(void) monsCount = 6; minNeeded = 2; battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; - battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; + battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)]; } else if ((gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_LINK) || (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) diff --git a/src/battle_util.c b/src/battle_util.c index d39b03215b..1c1cf685d9 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5817,7 +5817,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { if (gBattleMons[i].ability == ABILITY_TRACE && (gBattleResources->flags->flags[i] & RESOURCE_FLAG_TRACED)) { - u8 side = (GetBattlerPosition(i) ^ BIT_SIDE) & BIT_SIDE; // side of the opposing pokemon + u8 side = (BATTLE_OPPOSITE(GetBattlerPosition(i))) & BIT_SIDE; // side of the opposing pokemon u8 target1 = GetBattlerAtPosition(side); u8 target2 = GetBattlerAtPosition(side + BIT_FLANK); From 790bdd69f81a3ea43f7e30c783eee651f8496b5d Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 3 Sep 2022 00:28:32 -0400 Subject: [PATCH 081/115] Using GET_BATTLER_SIDE and GET_BATTLER_SIDE2 --- src/battle_anim_effects_2.c | 2 +- src/battle_anim_fight.c | 2 +- src/battle_anim_ice.c | 4 ++-- src/battle_controller_player.c | 2 +- src/battle_gfx_sfx_util.c | 2 +- src/battle_util.c | 4 ++-- src/pokemon.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 5bd28acea1..6b60440528 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -1667,7 +1667,7 @@ void AnimTask_AirCutterProjectile(u8 taskId) } else { - if ((gBattlerPositions[gBattleAnimTarget] & BIT_SIDE) == B_SIDE_PLAYER) + if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER) { gTasks[taskId].data[4] = 1; gBattleAnimArgs[0] = -gBattleAnimArgs[0]; diff --git a/src/battle_anim_fight.c b/src/battle_anim_fight.c index 0d7b977e9d..764a951ef8 100644 --- a/src/battle_anim_fight.c +++ b/src/battle_anim_fight.c @@ -492,7 +492,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite) if (Random2() & 1) y *= -1; - if ((gBattlerPositions[battler] & BIT_SIDE) == B_SIDE_PLAYER) + if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER) y += 0xFFF0; sprite->x += x; diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index d2779d1415..3032db7f3f 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -1193,12 +1193,12 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite) if (GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2)) sprite->data[7] = 0x8000; - if ((gBattlerPositions[gBattleAnimTarget] & BIT_SIDE) == B_SIDE_PLAYER) + if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER) { gBattleAnimArgs[1] = -gBattleAnimArgs[1]; gBattleAnimArgs[3] = -gBattleAnimArgs[3]; - if ((sprite->data[7] & 0x8000) && (gBattlerPositions[gBattleAnimAttacker] & BIT_SIDE) == B_SIDE_PLAYER) + if ((sprite->data[7] & 0x8000) && GET_BATTLER_SIDE2(gBattleAnimAttacker) == B_SIDE_PLAYER) sprite->subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1; sprite->data[6] = 1; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 96a3d6bf01..265bb7f657 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -498,7 +498,7 @@ static void HandleInputChooseMove(void) if (moveTarget & MOVE_TARGET_USER) gMultiUsePlayerCursor = gActiveBattler; else - gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler) & BIT_SIDE)); + gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler))); if (!gBattleBufferA[gActiveBattler][1]) // not a double battle { diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index c2d4fad186..9c5243548d 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -254,7 +254,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void) else if (moveTarget == MOVE_TARGET_SELECTED) chosenMoveId |= GetBattlePalaceTarget(); else - chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler) & BIT_SIDE)) << 8); + chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler))) << 8); return chosenMoveId; } diff --git a/src/battle_util.c b/src/battle_util.c index 9bfeacd2d2..bbf34ab316 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3844,7 +3844,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget) case MOVE_TARGET_BOTH: case MOVE_TARGET_FOES_AND_ALLY: case MOVE_TARGET_OPPONENTS_FIELD: - targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker) & BIT_SIDE)); + targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker))); if (gAbsentBattlerFlags & gBitTable[targetBattler]) targetBattler ^= BIT_FLANK; break; @@ -3872,7 +3872,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget) targetBattler ^= BIT_FLANK; } else - targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker) & BIT_SIDE)); + targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker))); break; case MOVE_TARGET_USER_OR_SELECTED: case MOVE_TARGET_USER: diff --git a/src/pokemon.c b/src/pokemon.c index 4b22947cb0..d4931f8e5e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3405,7 +3405,7 @@ static bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) u8 GetDefaultMoveTarget(u8 battlerId) { - u8 opposing = BATTLE_OPPOSITE(GetBattlerPosition(battlerId) & BIT_SIDE); + u8 opposing = BATTLE_OPPOSITE(GET_BATTLER_SIDE(battlerId)); if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) return GetBattlerAtPosition(opposing); From 41bf6bde258af3e52867800c7b2fdb02f0540674 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 3 Sep 2022 00:28:53 -0400 Subject: [PATCH 082/115] Removed pointless macro --- include/battle.h | 3 +-- src/battle_anim_mons.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/battle.h b/include/battle.h index 0eaa60f30f..5cc5521859 100644 --- a/include/battle.h +++ b/include/battle.h @@ -13,9 +13,8 @@ #include "battle_bg.h" #include "pokeball.h" -#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler]) #define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE) -#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE) +#define GET_BATTLER_SIDE2(battler) (gBattlerPositions[battler] & BIT_SIDE) // Used to exclude moves learned temporarily by Transform or Mimic #define MOVE_IS_PERMANENT(battler, moveSlot) \ diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index f8fc5647ea..25817c0740 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -857,7 +857,7 @@ u8 GetBattlerSide(u8 battlerId) u8 GetBattlerPosition(u8 battlerId) { - return GET_BATTLER_POSITION(battlerId); + return gBattlerPositions[battlerId]; } u8 GetBattlerAtPosition(u8 position) From 7e920040ca25227b7f72f8bfee50bfaa4c9a6e78 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 3 Sep 2022 09:59:53 -0300 Subject: [PATCH 083/115] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ce0b6b4c73..e4285f7239 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ The pokeemerald Expansion is a collection of feature branches that can be integr ## What feature branches are included? -- **[Battle Engine Upgrade](../tree/battle_engine):** Upgrades the battle engine in pokeemerald to newer Generation games' standards. It also adds newer moves and abilities. -- **[Pokémon Expansion](../tree/pokemon_expansion):** Adds Pokémon from newer Generations and makes them available in the National Dex. It also updates base stats and other Pokémon info. -- **[Item Expansion](../tree/item_expansion):** Adds items from newer Generations and also updates item effects for field use. -- **[master](../tree/master):** Combines the above branches into one single branch for the sake of convenience. Note that this branch is only updated once in a while, so you must merge manually if you want the latest features. +- **[Battle Engine Upgrade](../../tree/battle_engine):** Upgrades the battle engine in pokeemerald to newer Generation games' standards. It also adds newer moves and abilities. +- **[Pokémon Expansion](../../tree/pokemon_expansion):** Adds Pokémon from newer Generations and makes them available in the National Dex. It also updates base stats and other Pokémon info. +- **[Item Expansion](../../tree/item_expansion):** Adds items from newer Generations and also updates item effects for field use. +- **[master](../../tree/master):** Combines the above branches into one single branch for the sake of convenience. Note that this branch is only updated once in a while, so you must merge manually if you want the latest features. ## Who maintains the project? From 8079224340e2b5373cfcffd0ae29082dce0967d3 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 3 Sep 2022 10:20:52 -0300 Subject: [PATCH 084/115] Copy-pasted Eduardo's README --- README.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e4285f7239..8a1c3d37d4 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,19 @@ The pokeemerald Expansion is a collection of feature branches that can be integrated into existing [pokeemerald](https://github.com/pret/pokeemerald) projects. -## What feature branches are included? - -- **[Battle Engine Upgrade](../../tree/battle_engine):** Upgrades the battle engine in pokeemerald to newer Generation games' standards. It also adds newer moves and abilities. -- **[Pokémon Expansion](../../tree/pokemon_expansion):** Adds Pokémon from newer Generations and makes them available in the National Dex. It also updates base stats and other Pokémon info. -- **[Item Expansion](../../tree/item_expansion):** Adds items from newer Generations and also updates item effects for field use. -- **[master](../../tree/master):** Combines the above branches into one single branch for the sake of convenience. Note that this branch is only updated once in a while, so you must merge manually if you want the latest features. +## What features are included? +- Upgraded battle engine. + - Fairy Type. + - New moves and abilities up to SwSh. + - Options to change behaviors and data by generation. + - Mega Evolution and Primal Reversion + - Z-Moves (TODO: Ultra Burst) +- Adds Pokémon from newer Generations and makes them available in the National Dex (with the option to disable them if needed). + - Updates Hoenn's Regional Dex to match ORAS'. + - Option to change base stats by generation. + - New evolution methods. + - Hidden Abilities data (How to obtain them is up to the user). +- Adds items from newer Generations and also updates item effects for field use. ## Who maintains the project? @@ -19,7 +26,7 @@ The project has now gotten larger and DizzyEgg is now maintaining the project as ## Can I contribute even if I'm not a member of ROM Hacking Hideout? -Yes! Contributions are welcome via Pull Requests and they will be reviewed by maintainers. Please note that PRs to master are not accepted, as master is only intended to be a merged branch. +Yes! Contributions are welcome via Pull Requests and they will be reviewed by maintainers. Don't feel discouraged if we take a bit to review your PR, we'll get to it ## What is ROM Hacking Hideout? From 9df8d2dc63e59a96bda704a448ee33b01eb4a947 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 3 Sep 2022 10:21:11 -0300 Subject: [PATCH 085/115] Updated the README again --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8a1c3d37d4..d22891fdf0 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,25 @@ ## What is the pokeemerald Expansion? -The pokeemerald Expansion is a collection of feature branches that can be integrated into existing [pokeemerald](https://github.com/pret/pokeemerald) projects. +The Pokeemerald Expansion is a collection of feature branches that can be integrated into existing [pokeemerald](https://github.com/pret/pokeemerald) projects. ## What features are included? - Upgraded battle engine. - Fairy Type. + - Physical/Special/Status Category Split. - New moves and abilities up to SwSh. - Options to change behaviors and data by generation. - Mega Evolution and Primal Reversion - - Z-Moves (TODO: Ultra Burst) -- Adds Pokémon from newer Generations and makes them available in the National Dex (with the option to disable them if needed). + - Z-Moves +- Pokémon Species from newer Generations (with the option to disable them if needed). - Updates Hoenn's Regional Dex to match ORAS'. + - Updates National Dex incorporating all the new species. - Option to change base stats by generation. - New evolution methods. - - Hidden Abilities data (How to obtain them is up to the user). -- Adds items from newer Generations and also updates item effects for field use. + - Hidden Abilities data (How to make them available is up to the user). +- Items from newer Generations and updated item effects for battle and field use. + +Certain mechanics, moves, abilities and species sprites are missing. For more information, see [the project's milestones](https://github.com/rh-hideout/pokeemerald-expansion/milestones). ## Who maintains the project? @@ -26,7 +30,7 @@ The project has now gotten larger and DizzyEgg is now maintaining the project as ## Can I contribute even if I'm not a member of ROM Hacking Hideout? -Yes! Contributions are welcome via Pull Requests and they will be reviewed by maintainers. Don't feel discouraged if we take a bit to review your PR, we'll get to it +Yes! Contributions are welcome via Pull Requests and they will be reviewed by maintainers. Don't feel discouraged if we take a bit to review your PR, we'll get to it. ## What is ROM Hacking Hideout? From 4017fc3e20f3c996a46eccb650f72c46c302fc0b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 3 Sep 2022 21:22:15 -0400 Subject: [PATCH 086/115] Apply style suggestions from code review --- data/scripts/debug.inc | 2 +- include/constants/battle_config.h | 4 +- src/battle_main.c | 1 - src/debug.c | 815 ++++++++++++++---------------- src/item_use.c | 1 - src/trainer_see.c | 1 - 6 files changed, 372 insertions(+), 452 deletions(-) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index fe86197c8c..9463164ac2 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -52,7 +52,7 @@ Debug_FlagsNotSetMessage:: Debug_FlagsNotSetMessage_Text: .string "Feature unavailable!\n" .string "Please define a usable flag in:\l" - .string "'include/constants/debug{UNDERSCORE}config.h'!$" + .string "'include/constants/overworld{UNDERSCORE}config.h'!$" Debug_Script_1:: end diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index ad7775b673..461829e261 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -138,8 +138,8 @@ #define B_FLAG_INVERSE_BATTLE 0 // If this flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water. #define B_FLAG_FORCE_DOUBLE_WILD 0 // If this flag is set, all land and surfing wild battles will be double battles. #define B_SMART_WILD_AI_FLAG 0 // If not 0, you can set this flag in a script to enable smart wild pokemon -#define B_FLAG_NO_BAG_USE 0 // If this flag is set, the debug function in the Utility submenu to disable the bag in battle can be used. -#define B_FLAG_NO_CATCHING 0 // If this flag is set, the debug function in the Utility submenu to disable catching of wild Pokémon can be used. +#define B_FLAG_NO_BAG_USE 0 // If this flag is set, the ability to use the bag in battle is disabled. +#define B_FLAG_NO_CATCHING 0 // If this flag is set, the ability to catch wild Pokémon is disabled. // Var Settings // To use the following features in scripting, replace the 0s with the var ID you're assigning it to. diff --git a/src/battle_main.c b/src/battle_main.c index 39deaca27f..69335532c4 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -16,7 +16,6 @@ #include "berry.h" #include "bg.h" #include "data.h" -#include "debug.h" #include "decompress.h" #include "dma3.h" #include "event_data.h" diff --git a/src/debug.c b/src/debug.c index 81e30cff01..5d861640cd 100644 --- a/src/debug.c +++ b/src/debug.c @@ -151,7 +151,6 @@ enum { //Sound // EWRAM static EWRAM_DATA struct DebugMonData *sDebugMonData = NULL; - // ******************************* struct DebugMonData { @@ -172,7 +171,6 @@ struct DebugMonData u16 mon_move_3; }; - // ******************************* // Define functions static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate); @@ -285,12 +283,6 @@ 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]; // ******************************* @@ -299,108 +291,108 @@ static const u8 MAP_GROUP_COUNT[] = {57, 5, 5, 6, 7, 8, 9, 7, 7, 14, 8, 17, 10, // 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_Sound[] = _("Sound"); -static const u8 gDebugText_Cancel[] = _("Cancel"); +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_Sound[] = _("Sound"); +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"); +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"); -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_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"); -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"); +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_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"); +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"); -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_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"); -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"); +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_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"); +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_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}"); +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}"); -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_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}"); -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"); -static const u8 gDebugText_AccessPC[] = _("Access PC"); +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_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}"); +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"); +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}"); -static const u8 gDebugText_Sound_MUS[] = _("Music"); -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 gDebugText_Sound_SE[] = _("Effects"); +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{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} "); -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} "); +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, @@ -430,158 +422,156 @@ static const s32 sPowersOfTen[] = // List Menu Items 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}, - [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} + [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}, + [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[] = { - [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}, - [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}, + [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}, + [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_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}, + [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}, - [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_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}, - [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}, + [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_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}, + [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}, + [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_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}, - [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}, + [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}, + [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}, }; 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}, + [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 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, - [DEBUG_MENU_ITEM_SOUND] = DebugAction_OpenSoundMenu, - [DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, - [DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel + [DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu, + [DEBUG_MENU_ITEM_SCRIPTS] = DebugAction_OpenScriptsMenu, + [DEBUG_MENU_ITEM_FLAGS] = DebugAction_OpenFlagsMenu, + [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) = { - [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, - [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, + [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, + [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_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, + [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, - [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_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, - [DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF] = DebugAction_Flags_BagUseOnOff, - [DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF] = DebugAction_Flags_CatchingOnOff, + [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_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, + [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, + [DEBUG_VARS_MENU_ITEM_VARS] = DebugAction_Vars_Vars, }; static void (*const sDebugMenu_Actions_Give[])(u8) = { - [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, - [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, + [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, + [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, }; static void (*const sDebugMenu_Actions_Sound[])(u8) = { - [DEBUG_SOUND_MENU_ITEM_SE] = DebugAction_Sound_SE, - [DEBUG_SOUND_MENU_ITEM_MUS] = DebugAction_Sound_MUS, + [DEBUG_SOUND_MENU_ITEM_SE] = DebugAction_Sound_SE, + [DEBUG_SOUND_MENU_ITEM_MUS] = DebugAction_Sound_MUS, }; @@ -944,7 +934,6 @@ static void DebugAction_Util_Warp_Warp(u8 taskId) 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); @@ -965,31 +954,31 @@ static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId) if (gMain.newKeys & DPAD_ANY) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + 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 (gTasks[taskId].data[3] > MAP_GROUPS_COUNT - 1) + gTasks[taskId].data[3] = MAP_GROUPS_COUNT - 1; } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 0) + if (gTasks[taskId].data[3] < 0) gTasks[taskId].data[3] = 0; } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { - if(gTasks[taskId].data[4] > 0) + if (gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { - if(gTasks[taskId].data[4] < 2) + 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); + 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); @@ -1003,7 +992,7 @@ static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId) 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); + 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]]); @@ -1025,31 +1014,31 @@ static void DebugAction_Util_Warp_SelectMap(u8 taskId) if (gMain.newKeys & DPAD_ANY) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + 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(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) + if (gTasks[taskId].data[3] < 0) gTasks[taskId].data[3] = 0; } if(gMain.newKeys & DPAD_LEFT) { - if(gTasks[taskId].data[4] > 0) + if (gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + 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); + 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]]); @@ -1103,7 +1092,8 @@ static void DebugAction_Util_Warp_SelectWarp(u8 taskId) { 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 + //If there's no warp with the number available, warp to the center of the map. + SetWarpDestinationToMapWarp(gTasks[taskId].data[5], gTasks[taskId].data[6], gTasks[taskId].data[7]); DoWarp(); ResetInitialPlayerAvatarState(); DebugAction_DestroyExtraWindow(taskId); @@ -1277,7 +1267,7 @@ static void DebugAction_Flags_Flags(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); ConvertIntToHexStringN(gStringVar2, 0, STR_CONV_MODE_LEFT_ALIGN, 3); StringExpandPlaceholders(gStringVar1, gDebugText_Flags_FlagHex); - if(FlagGet(0) == TRUE) + if (FlagGet(0) == TRUE) StringCopyPadded(gStringVar2, gDebugText_Flags_FlagSet, CHAR_SPACE, 15); else StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); @@ -1301,38 +1291,38 @@ static void DebugAction_Flags_FlagsSelect(u8 taskId) return; } - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { PlaySE(SE_SELECT); gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] >= FLAGS_COUNT){ + if (gTasks[taskId].data[3] >= FLAGS_COUNT){ gTasks[taskId].data[3] = FLAGS_COUNT - 1; } } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { PlaySE(SE_SELECT); gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 0){ + if (gTasks[taskId].data[3] < 0){ gTasks[taskId].data[3] = 0; } } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { PlaySE(SE_SELECT); gTasks[taskId].data[4] -= 1; - if(gTasks[taskId].data[4] < 0) + if (gTasks[taskId].data[4] < 0) { gTasks[taskId].data[4] = 0; } } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { PlaySE(SE_SELECT); gTasks[taskId].data[4] += 1; - if(gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_FLAGS-1) + if (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_FLAGS - 1) { - gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_FLAGS-1; + gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_FLAGS - 1; } } @@ -1341,7 +1331,7 @@ 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_Flags_FlagHex); - if(FlagGet(gTasks[taskId].data[3]) == TRUE) + if (FlagGet(gTasks[taskId].data[3]) == TRUE) StringCopyPadded(gStringVar2, gDebugText_Flags_FlagSet, CHAR_SPACE, 15); else StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); @@ -1364,44 +1354,41 @@ static void DebugAction_Flags_SetPokedexFlags(u8 taskId) } static void DebugAction_Flags_SwitchDex(u8 taskId) { - if(FlagGet(FLAG_SYS_POKEDEX_GET)) - { - FlagClear(FLAG_SYS_POKEDEX_GET); + if (FlagGet(FLAG_SYS_POKEDEX_GET)) PlaySE(SE_PC_OFF); - }else{ - FlagSet(FLAG_SYS_POKEDEX_GET); + else PlaySE(SE_PC_LOGIN); - } + FlagToggle(FLAG_SYS_POKEDEX_GET); } static void DebugAction_Flags_SwitchNatDex(u8 taskId) { - if(IsNationalPokedexEnabled()) + if (IsNationalPokedexEnabled()) { DisableNationalPokedex(); PlaySE(SE_PC_OFF); - }else{ + } + else + { EnableNationalPokedex(); PlaySE(SE_PC_LOGIN); } } static void DebugAction_Flags_SwitchPokeNav(u8 taskId) { - if(FlagGet(FLAG_SYS_POKENAV_GET)) - { - FlagClear(FLAG_SYS_POKENAV_GET); + if (FlagGet(FLAG_SYS_POKENAV_GET)) PlaySE(SE_PC_OFF); - }else{ - FlagSet(FLAG_SYS_POKENAV_GET); + else PlaySE(SE_PC_LOGIN); - } + FlagToggle(FLAG_SYS_POKENAV_GET); } static void DebugAction_Flags_ToggleFlyFlags(u8 taskId) { // Sound effect - if(FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER)) + 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); @@ -1424,10 +1411,11 @@ static void DebugAction_Flags_ToggleFlyFlags(u8 taskId) static void DebugAction_Flags_ToggleBadgeFlags(u8 taskId) { // Sound effect - if(FlagGet(FLAG_BADGE08_GET)) + 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); @@ -1440,7 +1428,7 @@ static void DebugAction_Flags_ToggleBadgeFlags(u8 taskId) static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) { // Sound effect - if(FlagGet(FLAG_SYS_FRONTIER_PASS)) + if (FlagGet(FLAG_SYS_FRONTIER_PASS)) PlaySE(SE_PC_OFF); else PlaySE(SE_PC_LOGIN); @@ -1453,48 +1441,39 @@ static void DebugAction_Flags_CollisionOnOff(u8 taskId) LockPlayerFieldControls(); ScriptContext_SetupScript(Debug_FlagsNotSetMessage); #else - if(FlagGet(DEBUG_FLAG_NO_COLLISION)) - { - FlagClear(DEBUG_FLAG_NO_COLLISION); + if (FlagGet(DEBUG_FLAG_NO_COLLISION)) PlaySE(SE_PC_OFF); - }else{ - FlagSet(DEBUG_FLAG_NO_COLLISION); + else PlaySE(SE_PC_LOGIN); - } + FlagToggle(DEBUG_FLAG_NO_COLLISION); #endif } static void DebugAction_Flags_EncounterOnOff(u8 taskId) { -#if DEBUG_FLAG_NO_ENCOUNTER == 0 +#if OW_FLAG_NO_ENCOUNTER == 0 Debug_DestroyMenu(taskId); LockPlayerFieldControls(); ScriptContext_SetupScript(Debug_FlagsNotSetMessage); #else - if(FlagGet(DEBUG_FLAG_NO_ENCOUNTER)) - { - FlagClear(DEBUG_FLAG_NO_ENCOUNTER); + if (FlagGet(OW_FLAG_NO_ENCOUNTER)) PlaySE(SE_PC_OFF); - }else{ - FlagSet(DEBUG_FLAG_NO_ENCOUNTER); + else PlaySE(SE_PC_LOGIN); - } + FlagToggle(OW_FLAG_NO_ENCOUNTER); #endif } static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) { -#if DEBUG_FLAG_NO_TRAINER_SEE == 0 +#if OW_FLAG_NO_TRAINER_SEE == 0 Debug_DestroyMenu(taskId); LockPlayerFieldControls(); ScriptContext_SetupScript(Debug_FlagsNotSetMessage); #else - if(FlagGet(DEBUG_FLAG_NO_TRAINER_SEE)) - { - FlagClear(DEBUG_FLAG_NO_TRAINER_SEE); + if (FlagGet(OW_FLAG_NO_TRAINER_SEE)) PlaySE(SE_PC_OFF); - }else{ - FlagSet(DEBUG_FLAG_NO_TRAINER_SEE); + else PlaySE(SE_PC_LOGIN); - } + FlagToggle(OW_FLAG_NO_TRAINER_SEE); #endif } static void DebugAction_Flags_BagUseOnOff(u8 taskId) @@ -1504,14 +1483,11 @@ static void DebugAction_Flags_BagUseOnOff(u8 taskId) LockPlayerFieldControls(); ScriptContext_SetupScript(Debug_FlagsNotSetMessage); #else - if(FlagGet(B_FLAG_NO_BAG_USE)) - { - FlagClear(B_FLAG_NO_BAG_USE); + if (FlagGet(B_FLAG_NO_BAG_USE)) PlaySE(SE_PC_OFF); - }else{ - FlagSet(B_FLAG_NO_BAG_USE); + else PlaySE(SE_PC_LOGIN); - } + FlagToggle(B_FLAG_NO_BAG_USE); #endif } static void DebugAction_Flags_CatchingOnOff(u8 taskId) @@ -1521,14 +1497,11 @@ static void DebugAction_Flags_CatchingOnOff(u8 taskId) LockPlayerFieldControls(); ScriptContext_SetupScript(Debug_FlagsNotSetMessage); #else - if(FlagGet(B_FLAG_NO_CATCHING)) - { - FlagClear(B_FLAG_NO_CATCHING); + if (FlagGet(B_FLAG_NO_CATCHING)) PlaySE(SE_PC_OFF); - }else{ - FlagSet(B_FLAG_NO_CATCHING); + else PlaySE(SE_PC_LOGIN); - } + FlagToggle(B_FLAG_NO_CATCHING); #endif } @@ -1560,42 +1533,36 @@ static void DebugAction_Vars_Vars(u8 taskId) 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[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) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > VARS_END){ + if(gTasks[taskId].data[3] > VARS_END) gTasks[taskId].data[3] = VARS_END; - } } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < VARS_START){ + if (gTasks[taskId].data[3] < VARS_START) gTasks[taskId].data[3] = VARS_START; - } } - if(gMain.newKeys & DPAD_LEFT) + 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) + 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 (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_VARIABLES - 1) + gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_VARIABLES - 1; } if (gMain.newKeys & DPAD_ANY) @@ -1653,30 +1620,30 @@ static void DebugAction_Vars_SetValue(u8 taskId) 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; - } + gTasks[taskId].data[6] = 32000 - 1; + + if (gTasks[taskId].data[6] >= 32000) + gTasks[taskId].data[6] = 32000 - 1; } if(gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[6] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[6] < 0){ + if (gTasks[taskId].data[6] < 0){ gTasks[taskId].data[6] = 0; } } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { gTasks[taskId].data[4] -= 1; - if(gTasks[taskId].data[4] < 0) + if (gTasks[taskId].data[4] < 0) { gTasks[taskId].data[4] = 0; } } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { gTasks[taskId].data[4] += 1; - if(gTasks[taskId].data[4] > 4) + if (gTasks[taskId].data[4] > 4) { gTasks[taskId].data[4] = 4; } @@ -1751,26 +1718,26 @@ static void DebugAction_Give_Item_SelectId(u8 taskId) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + 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) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 1) + if (gTasks[taskId].data[3] < 1) gTasks[taskId].data[3] = 1; } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { if(gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { - if(gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1) + if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) gTasks[taskId].data[4] += 1; } @@ -1822,26 +1789,26 @@ static void DebugAction_Give_Item_SelectQuantity(u8 taskId) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] >= 100) + if (gTasks[taskId].data[3] >= 100) gTasks[taskId].data[3] = 99; } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 1) + if (gTasks[taskId].data[3] < 1) gTasks[taskId].data[3] = 1; } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { - if(gTasks[taskId].data[4] > 0) + if (gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { - if(gTasks[taskId].data[4] < 2) + if (gTasks[taskId].data[4] < 2) gTasks[taskId].data[4] += 1; } @@ -1880,9 +1847,11 @@ 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)) + for (i = ITEM_TM01; i <= ITEM_HM08; i++) + { + if (ItemIdToBattleMoveId(i) != MOVE_NONE && !CheckBagHasItem(i, 1)) AddBagItem(i, 1); + } Debug_DestroyMenu(taskId); ScriptContext_Enable(); } @@ -1937,12 +1906,7 @@ 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 - #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 + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID } static void DebugAction_Give_PokemonComplex(u8 taskId) @@ -1972,7 +1936,6 @@ static void DebugAction_Give_PokemonComplex(u8 taskId) 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 @@ -1980,12 +1943,7 @@ 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 - #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 + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID gTasks[taskId].data[7] = 0; //iterator } @@ -1996,30 +1954,26 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + 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) + if (gTasks[taskId].data[3] >= NUM_SPECIES) gTasks[taskId].data[3] = NUM_SPECIES - 1; } - if(gMain.newKeys & DPAD_DOWN) + 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) + if (gTasks[taskId].data[3] < 1) gTasks[taskId].data[3] = 1; } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { - if(gTasks[taskId].data[4] > 0) + if (gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { - if(gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1) + if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) gTasks[taskId].data[4] += 1; } @@ -2033,12 +1987,7 @@ 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 - #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 + gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite gSprites[gTasks[taskId].data[6]].oam.priority = 0; } @@ -2071,26 +2020,26 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > 100) + if (gTasks[taskId].data[3] > 100) gTasks[taskId].data[3] = 100; } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 1) + if (gTasks[taskId].data[3] < 1) gTasks[taskId].data[3] = 1; } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { - if(gTasks[taskId].data[4] > 0) + if (gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { - if(gTasks[taskId].data[4] < 2) + if (gTasks[taskId].data[4] < 2) gTasks[taskId].data[4] += 1; } @@ -2143,20 +2092,20 @@ static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > 1) + if (gTasks[taskId].data[3] > 1) gTasks[taskId].data[3] = 1; } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 0) + if (gTasks[taskId].data[3] < 0) gTasks[taskId].data[3] = 0; } - if(gTasks[taskId].data[3] == 1) + if (gTasks[taskId].data[3] == 1) StringCopyPadded(gStringVar2, gDebugText_Flags_FlagSet, CHAR_SPACE, 15); else StringCopyPadded(gStringVar2, gDebugText_Flags_FlagUnset, CHAR_SPACE, 15); @@ -2194,13 +2143,13 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > NUM_NATURES-1) + if (gTasks[taskId].data[3] > NUM_NATURES-1) gTasks[taskId].data[3] = NUM_NATURES-1; } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; if(gTasks[taskId].data[3] < 0) @@ -2242,26 +2191,23 @@ static void DebugAction_Give_Pokemon_SelectNature(u8 taskId) static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) { u8 abilityId; - u8 abilityCount = 2 - 1; //-1 for proper iteration + u8 abilityCount = NUM_ABILITY_SLOTS - 1; //-1 for proper iteration u8 i = 0; - #ifdef POKEMON_EXPANSION - abilityCount = NUM_ABILITY_SLOTS - 1; - #endif if (gMain.newKeys & DPAD_ANY) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > abilityCount) + if (gTasks[taskId].data[3] > abilityCount) gTasks[taskId].data[3] = abilityCount; } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 0) + if (gTasks[taskId].data[3] < 0) gTasks[taskId].data[3] = 0; } @@ -2305,26 +2251,26 @@ static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > 31) + if (gTasks[taskId].data[3] > 31) gTasks[taskId].data[3] = 31; } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 0) + if (gTasks[taskId].data[3] < 0) gTasks[taskId].data[3] = 0; } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { - if(gTasks[taskId].data[4] > 0) + if (gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { - if(gTasks[taskId].data[4] < 2) + if (gTasks[taskId].data[4] < 2) gTasks[taskId].data[4] += 1; } @@ -2444,26 +2390,26 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId) { PlaySE(SE_SELECT); - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(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) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 0) + if (gTasks[taskId].data[3] < 0) gTasks[taskId].data[3] = 0; } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { - if(gTasks[taskId].data[4] > 0) + if (gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { - if(gTasks[taskId].data[4] < 3) + if (gTasks[taskId].data[4] < 3) gTasks[taskId].data[4] += 1; } @@ -2583,12 +2529,11 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu IVs[4] = sDebugMonData->mon_iv_satk; IVs[5] = sDebugMonData->mon_iv_sdef; - //Nature if (nature == NUM_NATURES || nature == 0xFF) nature = Random() % NUM_NATURES; - //Shinyness + //Shininess if (isShiny == 1) { u32 personality; @@ -2608,21 +2553,9 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu else CreateMonWithNature(&mon, species, level, 32, nature); - //EVs/IVs + //IVs 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 iv_val = IVs[i]; if (iv_val != 32 && iv_val != 0xFF) SetMonData(&mon, MON_DATA_HP_IV + i, &iv_val); @@ -2648,17 +2581,7 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu 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++) @@ -2805,26 +2728,26 @@ static void DebugAction_Sound_SE_SelectId(u8 taskId) { if (gMain.newKeys & DPAD_ANY) { - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > END_SE) + if (gTasks[taskId].data[3] > END_SE) gTasks[taskId].data[3] = END_SE; } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < 1) + if (gTasks[taskId].data[3] < 1) gTasks[taskId].data[3] = 1; } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { - if(gTasks[taskId].data[4] > 0) + if (gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { - if(gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1) + if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) gTasks[taskId].data[4] += 1; } @@ -2882,26 +2805,26 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId) { if (gMain.newKeys & DPAD_ANY) { - if(gMain.newKeys & DPAD_UP) + if (gMain.newKeys & DPAD_UP) { gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] > END_MUS) + if (gTasks[taskId].data[3] > END_MUS) gTasks[taskId].data[3] = END_MUS; } - if(gMain.newKeys & DPAD_DOWN) + if (gMain.newKeys & DPAD_DOWN) { gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if(gTasks[taskId].data[3] < START_MUS) + if (gTasks[taskId].data[3] < START_MUS) gTasks[taskId].data[3] = START_MUS; } - if(gMain.newKeys & DPAD_LEFT) + if (gMain.newKeys & DPAD_LEFT) { - if(gTasks[taskId].data[4] > 0) + if (gTasks[taskId].data[4] > 0) gTasks[taskId].data[4] -= 1; } - if(gMain.newKeys & DPAD_RIGHT) + if (gMain.newKeys & DPAD_RIGHT) { - if(gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1) + if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS - 1) gTasks[taskId].data[4] += 1; } diff --git a/src/item_use.c b/src/item_use.c index a0b4233fff..cb85ae3e35 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -9,7 +9,6 @@ #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" diff --git a/src/trainer_see.c b/src/trainer_see.c index d44e5e46fb..b720a59d90 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -1,6 +1,5 @@ #include "global.h" #include "battle_setup.h" -#include "debug.h" #include "event_data.h" #include "event_object_movement.h" #include "field_effect.h" From 1287c3d2636a411a11ec96f32e7bd906c5a779aa Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 3 Sep 2022 21:27:29 -0400 Subject: [PATCH 087/115] Fixed call to ItemIdToBattleMoveId --- src/debug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/debug.c b/src/debug.c index 5d861640cd..f889ed5d29 100644 --- a/src/debug.c +++ b/src/debug.c @@ -33,6 +33,7 @@ #include "new_game.h" #include "overworld.h" #include "palette.h" +#include "party_menu.h" #include "pokedex.h" #include "pokemon.h" #include "pokemon_icon.h" From 7e9d243677d52df99bfac420f430b152e8ac0c22 Mon Sep 17 00:00:00 2001 From: Blackforest92 Date: Sun, 4 Sep 2022 23:24:37 +0700 Subject: [PATCH 088/115] Tidying graphics/battle_anims --- .../backgrounds/{new => }/aeroblast.pal | 0 .../backgrounds/{new => }/aeroblast_map.bin | Bin .../backgrounds/{new => }/aeroblast_tiles.png | Bin .../backgrounds/{new => }/aura_sphere.pal | 0 .../{new => }/blackhole_eclipse.bin | Bin .../{new => }/blackhole_eclipse.png | Bin .../backgrounds/{new => }/bloom_doom.bin | 0 .../backgrounds/{new => }/bloom_doom.pal | 0 .../backgrounds/{new => }/bloom_doom.png | Bin .../backgrounds/{new => }/bolt_strike.bin | Bin .../backgrounds/{new => }/bolt_strike.pal | 0 .../backgrounds/{new => }/bolt_strike.png | Bin .../{new => }/clangorous_soulblaze.bin | 0 .../{new => }/clangorous_soulblaze.pal | 0 .../{new => }/clangorous_soulblaze.png | Bin .../backgrounds/{new => }/dark_void.bin | 0 .../backgrounds/{new => }/dark_void.pal | 0 .../backgrounds/{new => }/dynamax_cannon.pal | 0 .../{new => }/electric_terrain.bin | Bin .../{new => }/electric_terrain.pal | 0 .../{new => }/electric_terrain.png | Bin .../backgrounds/{new => }/fire1.bin | 0 .../backgrounds/{new => }/fire1.pal | 0 .../backgrounds/{new => }/fire1.png | Bin .../backgrounds/{new => }/fire2.pal | 0 .../backgrounds/{new => }/focus_blast.bin | 0 .../backgrounds/{new => }/focus_blast.pal | 0 .../backgrounds/{new => }/focus_blast.png | Bin .../backgrounds/{new => }/garbage_falls.pal | 0 .../backgrounds/{new => }/giga_impact.pal | 0 .../backgrounds/{new => }/giga_impact.png | Bin .../{new => }/giga_impact_contest.bin | 0 .../{new => }/giga_impact_opponent.bin | 0 .../{new => }/giga_impact_player.bin | Bin .../backgrounds/{new => }/grassy_terrain.bin | Bin .../backgrounds/{new => }/grassy_terrain.pal | 0 .../backgrounds/{new => }/grassy_terrain.png | Bin .../backgrounds/{new => }/gunk_shot.pal | 0 .../backgrounds/{new => }/hurricane.bin | Bin .../backgrounds/{new => }/hurricane.pal | 0 .../backgrounds/{new => }/hurricane.png | Bin .../backgrounds/{new => }/hydro_cannon.bin | Bin .../backgrounds/{new => }/hydro_cannon.pal | 0 .../backgrounds/{new => }/hydro_cannon.png | Bin .../backgrounds/{new => }/hydro_pump.bin | 0 .../backgrounds/{new => }/hydro_pump.pal | 0 .../backgrounds/{new => }/hydro_pump.png | Bin .../backgrounds/{new => }/hyper_beam.pal | 0 .../backgrounds/{new => }/hyperspace_fury.pal | 0 .../{new => }/inferno_overdrive.bin | 0 .../{new => }/inferno_overdrive.pal | 0 .../{new => }/inferno_overdrive.png | Bin .../backgrounds/{new => }/leaf_storm.bin | Bin .../backgrounds/{new => }/leaf_storm.pal | 0 .../backgrounds/{new => }/leaf_storm.png | Bin .../backgrounds/{new => }/magic_room.pal | 0 .../{new => }/malicious_moonsault.bin | 0 .../{new => }/malicious_moonsault.pal | 0 .../{new => }/malicious_moonsault.png | Bin .../backgrounds/{new => }/max_lightning.bin | Bin .../backgrounds/{new => }/max_lightning.pal | 0 .../backgrounds/{new => }/max_lightning.png | Bin .../backgrounds/{new => }/misty_terrain.bin | Bin .../backgrounds/{new => }/misty_terrain.pal | 0 .../backgrounds/{new => }/misty_terrain.png | Bin .../{new => }/neverending_nightmare.bin | Bin .../{new => }/neverending_nightmare.pal | 0 .../{new => }/neverending_nightmare.png | Bin .../backgrounds/new/tectonic_rage.bin | Bin 296 -> 0 bytes .../backgrounds/{new => }/nightmare.bin | Bin .../backgrounds/{new => }/nightmare.pal | 0 .../backgrounds/{new => }/nightmare.png | Bin .../backgrounds/{new => }/poison_falls.pal | 0 .../{new/psychic.pal => psychic_new.pal} | 0 .../backgrounds/{new => }/psychic_terrain.bin | Bin .../backgrounds/{new => }/psychic_terrain.pal | 0 .../backgrounds/{new => }/psychic_terrain.png | Bin .../backgrounds/{new => }/rock_wrecker.pal | 0 .../{new => }/shattered_psyche.bin | Bin .../{new => }/shattered_psyche.pal | 0 .../{new => }/shattered_psyche.png | Bin .../backgrounds/{new => }/sky_afternoon.pal | 0 .../backgrounds/{new => }/sky_day.bin | Bin .../backgrounds/{new => }/sky_day.pal | 0 .../backgrounds/{new => }/sky_day.png | Bin .../backgrounds/{new => }/sky_night.pal | 0 .../backgrounds/{new => }/sludge_wave.pal | 0 .../backgrounds/{new => }/snuggle_forever.bin | Bin .../backgrounds/{new => }/snuggle_forever.pal | 0 .../backgrounds/{new => }/snuggle_forever.png | Bin .../{new => }/soulstealing_7star_strike.bin | Bin .../{new => }/soulstealing_7star_strike.pal | 0 .../{new => }/soulstealing_7star_strike.png | Bin .../backgrounds/{new => }/spacial_rend.pal | 0 .../backgrounds/{new => }/spacial_rend.png | Bin .../{new/steel_beam_bg.pal => steel_beam.pal} | 0 .../backgrounds/{new => }/tectonic_rage.pal | 0 .../backgrounds/{new => }/trick_room.bin | Bin .../backgrounds/{new => }/trick_room.pal | 0 .../backgrounds/{new => }/trick_room.png | Bin .../backgrounds/{new => }/twinkle_tackle.bin | Bin .../backgrounds/{new => }/twinkle_tackle.pal | 0 .../backgrounds/{new => }/twinkle_tackle.png | Bin .../backgrounds/{new => }/water_pulse.bin | 0 .../backgrounds/{new => }/water_pulse.pal | 0 .../backgrounds/{new => }/water_pulse.png | Bin .../backgrounds/{new => }/waterfall.bin | 0 .../backgrounds/{new => }/waterfall.pal | 0 .../backgrounds/{new => }/waterfall.png | Bin .../backgrounds/{new => }/wonder_room.pal | 0 .../backgrounds/{new => }/zmove_activate.bin | 0 .../backgrounds/{new => }/zmove_activate.pal | 0 .../backgrounds/{new => }/zmove_activate.png | Bin .../backgrounds/{new => }/zmove_mountain.bin | Bin .../backgrounds/{new => }/zmove_mountain.pal | 0 .../backgrounds/{new => }/zmove_mountain.png | Bin .../sprites/{new => }/acupressure_finger.png | Bin .../sprites/{new => }/alpha_stone.png | Bin .../battle_anims/sprites/{new => }/anchor.png | Bin .../battle_anims/sprites/{new => }/apple.png | Bin .../battle_anims/sprites/{new => }/arrows.png | Bin .../sprites/{new => }/assurance_hand.png | Bin .../sprites/{new => }/aura_sphere.png | Bin .../sprites/{new => }/avalanche_rocks.pal | 0 .../sprites/{new => }/baton_pass_ball.png | Bin .../sprites/{new => }/berry_eaten.png | Bin .../sprites/{new => }/berry_normal.png | Bin .../sprites/{new => }/big_rock.png | Bin .../sprites/{new => }/blacephalon_head.png | Bin .../sprites/{new => }/blue_flare.pal | 0 .../battle_anims/sprites/{new => }/branch.png | Bin .../battle_anims/sprites/{new => }/brine.png | Bin .../battle_anims/sprites/{new => }/cacoon.png | Bin .../sprites/{new => }/chain_link.png | Bin .../battle_anims/sprites/{new => }/chop.png | Bin .../sprites/{new => }/confide.png | Bin .../sprites/{new => }/crafty_shield.png | Bin .../sprites/{new => }/curse_nail.png | Bin .../sprites/{new => }/draco_meteor.pal | 0 .../sprites/{new => }/dragon_pulse_ring.png | Bin .../sprites/{new => }/dreepy_missile.png | Bin .../battle_anims/sprites/{new => }/drill.png | Bin .../battle_anims/sprites/{new => }/embers.png | Bin .../sprites/{new => }/fairy_lock_chains.png | Bin .../sprites/{new => }/fishies.png | Bin .../battle_anims/sprites/{new => }/fly.png | Bin .../sprites/{new => }/fusion_flare.pal | 0 .../{new => }/garbage_poison_column.pal | 0 .../battle_anims/sprites/{new => }/gear.png | Bin .../{new => }/gigavolt_havoc_spear.png | Bin .../sprites/{new => }/golden_apple.png | Bin .../sprites/{new => }/green_drake.pal | 0 .../green_star.png => green_star_new.png} | Bin .../thrash.png => hands_and_feet_new.png} | Bin .../sprites/{new => }/heart_stamp.png | Bin .../battle_anims/sprites/{new => }/hexes.png | Bin .../sprites/{new => }/hoopa_hand.png | Bin .../sprites/{new => }/hoopa_ring.png | Bin .../{new/horn.png => horn_hit_new.png} | Bin .../sprites/{new => }/horn_leech.png | Bin .../sprites/{new => }/horseshoe_fist.png | Bin .../sprites/{new => }/hydro_pump.png | Bin .../sprites/{new => }/ice_rock.png | Bin .../{new/impact.pal => impact_new.pal} | 0 .../sprites/{new => }/large_spike.png | Bin .../battle_anims/sprites/{new => }/leaves.png | Bin .../sprites/{new => }/leech_seed.png | Bin .../sprites/{new => }/lightning_rain.png | Bin .../sprites/{new => }/mean_look.png | Bin .../sprites/{new => }/metal_bits.png | Bin .../sprites/{new => }/mud_bomb.png | Bin .../sprites/{new => }/mushroom.png | Bin .../sprites/{new => }/natural_gift_ring.pal | 0 .../sprites/{new => }/necrozma_star.png | Bin .../sprites/new/ability_pop_up.png | Bin 275 -> 0 bytes graphics/battle_anims/sprites/new/bee.png | Bin 317 -> 0 bytes .../battle_anims/sprites/new/energy_ball.png | Bin 409 -> 0 bytes .../sprites/new/flash_cannon_ball.png | Bin 257 -> 0 bytes .../battle_anims/sprites/new/poison_jab.png | Bin 194 -> 0 bytes .../battle_anims/sprites/new/power_gem.png | Bin 179 -> 0 bytes .../battle_anims/sprites/new/punishment.png | Bin 470 -> 0 bytes .../battle_anims/sprites/new/quick_guard.png | Bin 205 -> 0 bytes .../battle_anims/sprites/new/stealth_rock.png | Bin 395 -> 0 bytes .../battle_anims/sprites/new/stone_edge.png | Bin 326 -> 0 bytes .../battle_anims/sprites/new/water_gun.png | Bin 214 -> 0 bytes graphics/battle_anims/sprites/new/wood.png | Bin 881 -> 0 bytes .../sprites/{new => }/obstruct.png | Bin .../sprites/{new => }/omega_stone.png | Bin .../sprites/{new => }/pink_diamond.png | Bin .../sprites/{new => }/poison_column.png | Bin .../sprites/{new => }/poltergeist.pal | 0 .../sprites/{new => }/power_trick.png | Bin .../sprites/{new => }/purple_drake.png | Bin .../sprites/{new => }/razor_shell.png | Bin .../sprites/{new => }/rock_small.png | Bin .../sprites/{new/rocks.png => rocks_new.png} | Bin .../sprites/{new => }/shell_left.png | Bin .../sprites/{new => }/shell_right.png | Bin .../sprites/{new => }/spacial_rend_slices.pal | 0 .../{new/spikes.png => spikes_new.png} | Bin .../{new => }/spirit_shackle_arrow.png | Bin .../sprites/{new => }/steam_eruption.png | Bin .../sprites/{new => }/steamroller.png | Bin .../sprites/{new => }/steel_beam.pal | 0 .../sprites/{new => }/stone_pillar.png | Bin .../sprites/{new => }/straight_beam.png | Bin ...itute_back.png => substitute_back_new.png} | Bin ...ubstitute_front.png => substitute_new.png} | Bin .../sprites/{new => }/surf_new.pal | 0 .../sprites/{new/sword.png => sword_new.png} | Bin .../sprites/{new/teeth.png => teeth_new.png} | Bin .../sprites/{new => }/tornado.png | Bin .../sprites/{new => }/z_move_symbol.png | Bin src/graphics.c | 537 +++++++++--------- 214 files changed, 269 insertions(+), 268 deletions(-) rename graphics/battle_anims/backgrounds/{new => }/aeroblast.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/aeroblast_map.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/aeroblast_tiles.png (100%) rename graphics/battle_anims/backgrounds/{new => }/aura_sphere.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/blackhole_eclipse.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/blackhole_eclipse.png (100%) rename graphics/battle_anims/backgrounds/{new => }/bloom_doom.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/bloom_doom.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/bloom_doom.png (100%) rename graphics/battle_anims/backgrounds/{new => }/bolt_strike.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/bolt_strike.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/bolt_strike.png (100%) rename graphics/battle_anims/backgrounds/{new => }/clangorous_soulblaze.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/clangorous_soulblaze.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/clangorous_soulblaze.png (100%) rename graphics/battle_anims/backgrounds/{new => }/dark_void.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/dark_void.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/dynamax_cannon.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/electric_terrain.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/electric_terrain.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/electric_terrain.png (100%) rename graphics/battle_anims/backgrounds/{new => }/fire1.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/fire1.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/fire1.png (100%) rename graphics/battle_anims/backgrounds/{new => }/fire2.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/focus_blast.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/focus_blast.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/focus_blast.png (100%) rename graphics/battle_anims/backgrounds/{new => }/garbage_falls.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/giga_impact.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/giga_impact.png (100%) rename graphics/battle_anims/backgrounds/{new => }/giga_impact_contest.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/giga_impact_opponent.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/giga_impact_player.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/grassy_terrain.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/grassy_terrain.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/grassy_terrain.png (100%) rename graphics/battle_anims/backgrounds/{new => }/gunk_shot.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/hurricane.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/hurricane.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/hurricane.png (100%) rename graphics/battle_anims/backgrounds/{new => }/hydro_cannon.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/hydro_cannon.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/hydro_cannon.png (100%) rename graphics/battle_anims/backgrounds/{new => }/hydro_pump.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/hydro_pump.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/hydro_pump.png (100%) rename graphics/battle_anims/backgrounds/{new => }/hyper_beam.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/hyperspace_fury.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/inferno_overdrive.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/inferno_overdrive.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/inferno_overdrive.png (100%) rename graphics/battle_anims/backgrounds/{new => }/leaf_storm.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/leaf_storm.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/leaf_storm.png (100%) rename graphics/battle_anims/backgrounds/{new => }/magic_room.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/malicious_moonsault.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/malicious_moonsault.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/malicious_moonsault.png (100%) rename graphics/battle_anims/backgrounds/{new => }/max_lightning.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/max_lightning.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/max_lightning.png (100%) rename graphics/battle_anims/backgrounds/{new => }/misty_terrain.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/misty_terrain.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/misty_terrain.png (100%) rename graphics/battle_anims/backgrounds/{new => }/neverending_nightmare.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/neverending_nightmare.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/neverending_nightmare.png (100%) delete mode 100644 graphics/battle_anims/backgrounds/new/tectonic_rage.bin rename graphics/battle_anims/backgrounds/{new => }/nightmare.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/nightmare.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/nightmare.png (100%) rename graphics/battle_anims/backgrounds/{new => }/poison_falls.pal (100%) rename graphics/battle_anims/backgrounds/{new/psychic.pal => psychic_new.pal} (100%) rename graphics/battle_anims/backgrounds/{new => }/psychic_terrain.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/psychic_terrain.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/psychic_terrain.png (100%) rename graphics/battle_anims/backgrounds/{new => }/rock_wrecker.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/shattered_psyche.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/shattered_psyche.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/shattered_psyche.png (100%) rename graphics/battle_anims/backgrounds/{new => }/sky_afternoon.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/sky_day.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/sky_day.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/sky_day.png (100%) rename graphics/battle_anims/backgrounds/{new => }/sky_night.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/sludge_wave.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/snuggle_forever.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/snuggle_forever.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/snuggle_forever.png (100%) rename graphics/battle_anims/backgrounds/{new => }/soulstealing_7star_strike.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/soulstealing_7star_strike.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/soulstealing_7star_strike.png (100%) rename graphics/battle_anims/backgrounds/{new => }/spacial_rend.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/spacial_rend.png (100%) rename graphics/battle_anims/backgrounds/{new/steel_beam_bg.pal => steel_beam.pal} (100%) rename graphics/battle_anims/backgrounds/{new => }/tectonic_rage.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/trick_room.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/trick_room.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/trick_room.png (100%) rename graphics/battle_anims/backgrounds/{new => }/twinkle_tackle.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/twinkle_tackle.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/twinkle_tackle.png (100%) rename graphics/battle_anims/backgrounds/{new => }/water_pulse.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/water_pulse.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/water_pulse.png (100%) rename graphics/battle_anims/backgrounds/{new => }/waterfall.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/waterfall.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/waterfall.png (100%) rename graphics/battle_anims/backgrounds/{new => }/wonder_room.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/zmove_activate.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/zmove_activate.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/zmove_activate.png (100%) rename graphics/battle_anims/backgrounds/{new => }/zmove_mountain.bin (100%) rename graphics/battle_anims/backgrounds/{new => }/zmove_mountain.pal (100%) rename graphics/battle_anims/backgrounds/{new => }/zmove_mountain.png (100%) rename graphics/battle_anims/sprites/{new => }/acupressure_finger.png (100%) rename graphics/battle_anims/sprites/{new => }/alpha_stone.png (100%) rename graphics/battle_anims/sprites/{new => }/anchor.png (100%) rename graphics/battle_anims/sprites/{new => }/apple.png (100%) rename graphics/battle_anims/sprites/{new => }/arrows.png (100%) rename graphics/battle_anims/sprites/{new => }/assurance_hand.png (100%) rename graphics/battle_anims/sprites/{new => }/aura_sphere.png (100%) rename graphics/battle_anims/sprites/{new => }/avalanche_rocks.pal (100%) rename graphics/battle_anims/sprites/{new => }/baton_pass_ball.png (100%) rename graphics/battle_anims/sprites/{new => }/berry_eaten.png (100%) rename graphics/battle_anims/sprites/{new => }/berry_normal.png (100%) rename graphics/battle_anims/sprites/{new => }/big_rock.png (100%) rename graphics/battle_anims/sprites/{new => }/blacephalon_head.png (100%) rename graphics/battle_anims/sprites/{new => }/blue_flare.pal (100%) rename graphics/battle_anims/sprites/{new => }/branch.png (100%) rename graphics/battle_anims/sprites/{new => }/brine.png (100%) rename graphics/battle_anims/sprites/{new => }/cacoon.png (100%) rename graphics/battle_anims/sprites/{new => }/chain_link.png (100%) rename graphics/battle_anims/sprites/{new => }/chop.png (100%) rename graphics/battle_anims/sprites/{new => }/confide.png (100%) rename graphics/battle_anims/sprites/{new => }/crafty_shield.png (100%) rename graphics/battle_anims/sprites/{new => }/curse_nail.png (100%) rename graphics/battle_anims/sprites/{new => }/draco_meteor.pal (100%) rename graphics/battle_anims/sprites/{new => }/dragon_pulse_ring.png (100%) rename graphics/battle_anims/sprites/{new => }/dreepy_missile.png (100%) rename graphics/battle_anims/sprites/{new => }/drill.png (100%) rename graphics/battle_anims/sprites/{new => }/embers.png (100%) rename graphics/battle_anims/sprites/{new => }/fairy_lock_chains.png (100%) rename graphics/battle_anims/sprites/{new => }/fishies.png (100%) rename graphics/battle_anims/sprites/{new => }/fly.png (100%) rename graphics/battle_anims/sprites/{new => }/fusion_flare.pal (100%) rename graphics/battle_anims/sprites/{new => }/garbage_poison_column.pal (100%) rename graphics/battle_anims/sprites/{new => }/gear.png (100%) rename graphics/battle_anims/sprites/{new => }/gigavolt_havoc_spear.png (100%) rename graphics/battle_anims/sprites/{new => }/golden_apple.png (100%) rename graphics/battle_anims/sprites/{new => }/green_drake.pal (100%) rename graphics/battle_anims/sprites/{new/green_star.png => green_star_new.png} (100%) rename graphics/battle_anims/sprites/{new/thrash.png => hands_and_feet_new.png} (100%) rename graphics/battle_anims/sprites/{new => }/heart_stamp.png (100%) rename graphics/battle_anims/sprites/{new => }/hexes.png (100%) rename graphics/battle_anims/sprites/{new => }/hoopa_hand.png (100%) rename graphics/battle_anims/sprites/{new => }/hoopa_ring.png (100%) rename graphics/battle_anims/sprites/{new/horn.png => horn_hit_new.png} (100%) rename graphics/battle_anims/sprites/{new => }/horn_leech.png (100%) rename graphics/battle_anims/sprites/{new => }/horseshoe_fist.png (100%) rename graphics/battle_anims/sprites/{new => }/hydro_pump.png (100%) rename graphics/battle_anims/sprites/{new => }/ice_rock.png (100%) rename graphics/battle_anims/sprites/{new/impact.pal => impact_new.pal} (100%) rename graphics/battle_anims/sprites/{new => }/large_spike.png (100%) rename graphics/battle_anims/sprites/{new => }/leaves.png (100%) rename graphics/battle_anims/sprites/{new => }/leech_seed.png (100%) rename graphics/battle_anims/sprites/{new => }/lightning_rain.png (100%) rename graphics/battle_anims/sprites/{new => }/mean_look.png (100%) rename graphics/battle_anims/sprites/{new => }/metal_bits.png (100%) rename graphics/battle_anims/sprites/{new => }/mud_bomb.png (100%) rename graphics/battle_anims/sprites/{new => }/mushroom.png (100%) rename graphics/battle_anims/sprites/{new => }/natural_gift_ring.pal (100%) rename graphics/battle_anims/sprites/{new => }/necrozma_star.png (100%) delete mode 100644 graphics/battle_anims/sprites/new/ability_pop_up.png delete mode 100644 graphics/battle_anims/sprites/new/bee.png delete mode 100644 graphics/battle_anims/sprites/new/energy_ball.png delete mode 100644 graphics/battle_anims/sprites/new/flash_cannon_ball.png delete mode 100644 graphics/battle_anims/sprites/new/poison_jab.png delete mode 100644 graphics/battle_anims/sprites/new/power_gem.png delete mode 100644 graphics/battle_anims/sprites/new/punishment.png delete mode 100644 graphics/battle_anims/sprites/new/quick_guard.png delete mode 100644 graphics/battle_anims/sprites/new/stealth_rock.png delete mode 100644 graphics/battle_anims/sprites/new/stone_edge.png delete mode 100644 graphics/battle_anims/sprites/new/water_gun.png delete mode 100644 graphics/battle_anims/sprites/new/wood.png rename graphics/battle_anims/sprites/{new => }/obstruct.png (100%) rename graphics/battle_anims/sprites/{new => }/omega_stone.png (100%) rename graphics/battle_anims/sprites/{new => }/pink_diamond.png (100%) rename graphics/battle_anims/sprites/{new => }/poison_column.png (100%) rename graphics/battle_anims/sprites/{new => }/poltergeist.pal (100%) rename graphics/battle_anims/sprites/{new => }/power_trick.png (100%) rename graphics/battle_anims/sprites/{new => }/purple_drake.png (100%) rename graphics/battle_anims/sprites/{new => }/razor_shell.png (100%) rename graphics/battle_anims/sprites/{new => }/rock_small.png (100%) rename graphics/battle_anims/sprites/{new/rocks.png => rocks_new.png} (100%) rename graphics/battle_anims/sprites/{new => }/shell_left.png (100%) rename graphics/battle_anims/sprites/{new => }/shell_right.png (100%) rename graphics/battle_anims/sprites/{new => }/spacial_rend_slices.pal (100%) rename graphics/battle_anims/sprites/{new/spikes.png => spikes_new.png} (100%) rename graphics/battle_anims/sprites/{new => }/spirit_shackle_arrow.png (100%) rename graphics/battle_anims/sprites/{new => }/steam_eruption.png (100%) rename graphics/battle_anims/sprites/{new => }/steamroller.png (100%) rename graphics/battle_anims/sprites/{new => }/steel_beam.pal (100%) rename graphics/battle_anims/sprites/{new => }/stone_pillar.png (100%) rename graphics/battle_anims/sprites/{new => }/straight_beam.png (100%) rename graphics/battle_anims/sprites/{new/substitute_back.png => substitute_back_new.png} (100%) rename graphics/battle_anims/sprites/{new/substitute_front.png => substitute_new.png} (100%) rename graphics/battle_anims/sprites/{new => }/surf_new.pal (100%) rename graphics/battle_anims/sprites/{new/sword.png => sword_new.png} (100%) rename graphics/battle_anims/sprites/{new/teeth.png => teeth_new.png} (100%) rename graphics/battle_anims/sprites/{new => }/tornado.png (100%) rename graphics/battle_anims/sprites/{new => }/z_move_symbol.png (100%) diff --git a/graphics/battle_anims/backgrounds/new/aeroblast.pal b/graphics/battle_anims/backgrounds/aeroblast.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/aeroblast.pal rename to graphics/battle_anims/backgrounds/aeroblast.pal diff --git a/graphics/battle_anims/backgrounds/new/aeroblast_map.bin b/graphics/battle_anims/backgrounds/aeroblast_map.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/aeroblast_map.bin rename to graphics/battle_anims/backgrounds/aeroblast_map.bin diff --git a/graphics/battle_anims/backgrounds/new/aeroblast_tiles.png b/graphics/battle_anims/backgrounds/aeroblast_tiles.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/aeroblast_tiles.png rename to graphics/battle_anims/backgrounds/aeroblast_tiles.png diff --git a/graphics/battle_anims/backgrounds/new/aura_sphere.pal b/graphics/battle_anims/backgrounds/aura_sphere.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/aura_sphere.pal rename to graphics/battle_anims/backgrounds/aura_sphere.pal diff --git a/graphics/battle_anims/backgrounds/new/blackhole_eclipse.bin b/graphics/battle_anims/backgrounds/blackhole_eclipse.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/blackhole_eclipse.bin rename to graphics/battle_anims/backgrounds/blackhole_eclipse.bin diff --git a/graphics/battle_anims/backgrounds/new/blackhole_eclipse.png b/graphics/battle_anims/backgrounds/blackhole_eclipse.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/blackhole_eclipse.png rename to graphics/battle_anims/backgrounds/blackhole_eclipse.png diff --git a/graphics/battle_anims/backgrounds/new/bloom_doom.bin b/graphics/battle_anims/backgrounds/bloom_doom.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/bloom_doom.bin rename to graphics/battle_anims/backgrounds/bloom_doom.bin diff --git a/graphics/battle_anims/backgrounds/new/bloom_doom.pal b/graphics/battle_anims/backgrounds/bloom_doom.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/bloom_doom.pal rename to graphics/battle_anims/backgrounds/bloom_doom.pal diff --git a/graphics/battle_anims/backgrounds/new/bloom_doom.png b/graphics/battle_anims/backgrounds/bloom_doom.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/bloom_doom.png rename to graphics/battle_anims/backgrounds/bloom_doom.png diff --git a/graphics/battle_anims/backgrounds/new/bolt_strike.bin b/graphics/battle_anims/backgrounds/bolt_strike.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/bolt_strike.bin rename to graphics/battle_anims/backgrounds/bolt_strike.bin diff --git a/graphics/battle_anims/backgrounds/new/bolt_strike.pal b/graphics/battle_anims/backgrounds/bolt_strike.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/bolt_strike.pal rename to graphics/battle_anims/backgrounds/bolt_strike.pal diff --git a/graphics/battle_anims/backgrounds/new/bolt_strike.png b/graphics/battle_anims/backgrounds/bolt_strike.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/bolt_strike.png rename to graphics/battle_anims/backgrounds/bolt_strike.png diff --git a/graphics/battle_anims/backgrounds/new/clangorous_soulblaze.bin b/graphics/battle_anims/backgrounds/clangorous_soulblaze.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/clangorous_soulblaze.bin rename to graphics/battle_anims/backgrounds/clangorous_soulblaze.bin diff --git a/graphics/battle_anims/backgrounds/new/clangorous_soulblaze.pal b/graphics/battle_anims/backgrounds/clangorous_soulblaze.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/clangorous_soulblaze.pal rename to graphics/battle_anims/backgrounds/clangorous_soulblaze.pal diff --git a/graphics/battle_anims/backgrounds/new/clangorous_soulblaze.png b/graphics/battle_anims/backgrounds/clangorous_soulblaze.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/clangorous_soulblaze.png rename to graphics/battle_anims/backgrounds/clangorous_soulblaze.png diff --git a/graphics/battle_anims/backgrounds/new/dark_void.bin b/graphics/battle_anims/backgrounds/dark_void.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/dark_void.bin rename to graphics/battle_anims/backgrounds/dark_void.bin diff --git a/graphics/battle_anims/backgrounds/new/dark_void.pal b/graphics/battle_anims/backgrounds/dark_void.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/dark_void.pal rename to graphics/battle_anims/backgrounds/dark_void.pal diff --git a/graphics/battle_anims/backgrounds/new/dynamax_cannon.pal b/graphics/battle_anims/backgrounds/dynamax_cannon.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/dynamax_cannon.pal rename to graphics/battle_anims/backgrounds/dynamax_cannon.pal diff --git a/graphics/battle_anims/backgrounds/new/electric_terrain.bin b/graphics/battle_anims/backgrounds/electric_terrain.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/electric_terrain.bin rename to graphics/battle_anims/backgrounds/electric_terrain.bin diff --git a/graphics/battle_anims/backgrounds/new/electric_terrain.pal b/graphics/battle_anims/backgrounds/electric_terrain.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/electric_terrain.pal rename to graphics/battle_anims/backgrounds/electric_terrain.pal diff --git a/graphics/battle_anims/backgrounds/new/electric_terrain.png b/graphics/battle_anims/backgrounds/electric_terrain.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/electric_terrain.png rename to graphics/battle_anims/backgrounds/electric_terrain.png diff --git a/graphics/battle_anims/backgrounds/new/fire1.bin b/graphics/battle_anims/backgrounds/fire1.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/fire1.bin rename to graphics/battle_anims/backgrounds/fire1.bin diff --git a/graphics/battle_anims/backgrounds/new/fire1.pal b/graphics/battle_anims/backgrounds/fire1.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/fire1.pal rename to graphics/battle_anims/backgrounds/fire1.pal diff --git a/graphics/battle_anims/backgrounds/new/fire1.png b/graphics/battle_anims/backgrounds/fire1.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/fire1.png rename to graphics/battle_anims/backgrounds/fire1.png diff --git a/graphics/battle_anims/backgrounds/new/fire2.pal b/graphics/battle_anims/backgrounds/fire2.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/fire2.pal rename to graphics/battle_anims/backgrounds/fire2.pal diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.bin b/graphics/battle_anims/backgrounds/focus_blast.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/focus_blast.bin rename to graphics/battle_anims/backgrounds/focus_blast.bin diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.pal b/graphics/battle_anims/backgrounds/focus_blast.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/focus_blast.pal rename to graphics/battle_anims/backgrounds/focus_blast.pal diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.png b/graphics/battle_anims/backgrounds/focus_blast.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/focus_blast.png rename to graphics/battle_anims/backgrounds/focus_blast.png diff --git a/graphics/battle_anims/backgrounds/new/garbage_falls.pal b/graphics/battle_anims/backgrounds/garbage_falls.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/garbage_falls.pal rename to graphics/battle_anims/backgrounds/garbage_falls.pal diff --git a/graphics/battle_anims/backgrounds/new/giga_impact.pal b/graphics/battle_anims/backgrounds/giga_impact.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact.pal rename to graphics/battle_anims/backgrounds/giga_impact.pal diff --git a/graphics/battle_anims/backgrounds/new/giga_impact.png b/graphics/battle_anims/backgrounds/giga_impact.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact.png rename to graphics/battle_anims/backgrounds/giga_impact.png diff --git a/graphics/battle_anims/backgrounds/new/giga_impact_contest.bin b/graphics/battle_anims/backgrounds/giga_impact_contest.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact_contest.bin rename to graphics/battle_anims/backgrounds/giga_impact_contest.bin diff --git a/graphics/battle_anims/backgrounds/new/giga_impact_opponent.bin b/graphics/battle_anims/backgrounds/giga_impact_opponent.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact_opponent.bin rename to graphics/battle_anims/backgrounds/giga_impact_opponent.bin diff --git a/graphics/battle_anims/backgrounds/new/giga_impact_player.bin b/graphics/battle_anims/backgrounds/giga_impact_player.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/giga_impact_player.bin rename to graphics/battle_anims/backgrounds/giga_impact_player.bin diff --git a/graphics/battle_anims/backgrounds/new/grassy_terrain.bin b/graphics/battle_anims/backgrounds/grassy_terrain.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/grassy_terrain.bin rename to graphics/battle_anims/backgrounds/grassy_terrain.bin diff --git a/graphics/battle_anims/backgrounds/new/grassy_terrain.pal b/graphics/battle_anims/backgrounds/grassy_terrain.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/grassy_terrain.pal rename to graphics/battle_anims/backgrounds/grassy_terrain.pal diff --git a/graphics/battle_anims/backgrounds/new/grassy_terrain.png b/graphics/battle_anims/backgrounds/grassy_terrain.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/grassy_terrain.png rename to graphics/battle_anims/backgrounds/grassy_terrain.png diff --git a/graphics/battle_anims/backgrounds/new/gunk_shot.pal b/graphics/battle_anims/backgrounds/gunk_shot.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/gunk_shot.pal rename to graphics/battle_anims/backgrounds/gunk_shot.pal diff --git a/graphics/battle_anims/backgrounds/new/hurricane.bin b/graphics/battle_anims/backgrounds/hurricane.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/hurricane.bin rename to graphics/battle_anims/backgrounds/hurricane.bin diff --git a/graphics/battle_anims/backgrounds/new/hurricane.pal b/graphics/battle_anims/backgrounds/hurricane.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hurricane.pal rename to graphics/battle_anims/backgrounds/hurricane.pal diff --git a/graphics/battle_anims/backgrounds/new/hurricane.png b/graphics/battle_anims/backgrounds/hurricane.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/hurricane.png rename to graphics/battle_anims/backgrounds/hurricane.png diff --git a/graphics/battle_anims/backgrounds/new/hydro_cannon.bin b/graphics/battle_anims/backgrounds/hydro_cannon.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_cannon.bin rename to graphics/battle_anims/backgrounds/hydro_cannon.bin diff --git a/graphics/battle_anims/backgrounds/new/hydro_cannon.pal b/graphics/battle_anims/backgrounds/hydro_cannon.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_cannon.pal rename to graphics/battle_anims/backgrounds/hydro_cannon.pal diff --git a/graphics/battle_anims/backgrounds/new/hydro_cannon.png b/graphics/battle_anims/backgrounds/hydro_cannon.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_cannon.png rename to graphics/battle_anims/backgrounds/hydro_cannon.png diff --git a/graphics/battle_anims/backgrounds/new/hydro_pump.bin b/graphics/battle_anims/backgrounds/hydro_pump.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_pump.bin rename to graphics/battle_anims/backgrounds/hydro_pump.bin diff --git a/graphics/battle_anims/backgrounds/new/hydro_pump.pal b/graphics/battle_anims/backgrounds/hydro_pump.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_pump.pal rename to graphics/battle_anims/backgrounds/hydro_pump.pal diff --git a/graphics/battle_anims/backgrounds/new/hydro_pump.png b/graphics/battle_anims/backgrounds/hydro_pump.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/hydro_pump.png rename to graphics/battle_anims/backgrounds/hydro_pump.png diff --git a/graphics/battle_anims/backgrounds/new/hyper_beam.pal b/graphics/battle_anims/backgrounds/hyper_beam.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hyper_beam.pal rename to graphics/battle_anims/backgrounds/hyper_beam.pal diff --git a/graphics/battle_anims/backgrounds/new/hyperspace_fury.pal b/graphics/battle_anims/backgrounds/hyperspace_fury.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/hyperspace_fury.pal rename to graphics/battle_anims/backgrounds/hyperspace_fury.pal diff --git a/graphics/battle_anims/backgrounds/new/inferno_overdrive.bin b/graphics/battle_anims/backgrounds/inferno_overdrive.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/inferno_overdrive.bin rename to graphics/battle_anims/backgrounds/inferno_overdrive.bin diff --git a/graphics/battle_anims/backgrounds/new/inferno_overdrive.pal b/graphics/battle_anims/backgrounds/inferno_overdrive.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/inferno_overdrive.pal rename to graphics/battle_anims/backgrounds/inferno_overdrive.pal diff --git a/graphics/battle_anims/backgrounds/new/inferno_overdrive.png b/graphics/battle_anims/backgrounds/inferno_overdrive.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/inferno_overdrive.png rename to graphics/battle_anims/backgrounds/inferno_overdrive.png diff --git a/graphics/battle_anims/backgrounds/new/leaf_storm.bin b/graphics/battle_anims/backgrounds/leaf_storm.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/leaf_storm.bin rename to graphics/battle_anims/backgrounds/leaf_storm.bin diff --git a/graphics/battle_anims/backgrounds/new/leaf_storm.pal b/graphics/battle_anims/backgrounds/leaf_storm.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/leaf_storm.pal rename to graphics/battle_anims/backgrounds/leaf_storm.pal diff --git a/graphics/battle_anims/backgrounds/new/leaf_storm.png b/graphics/battle_anims/backgrounds/leaf_storm.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/leaf_storm.png rename to graphics/battle_anims/backgrounds/leaf_storm.png diff --git a/graphics/battle_anims/backgrounds/new/magic_room.pal b/graphics/battle_anims/backgrounds/magic_room.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/magic_room.pal rename to graphics/battle_anims/backgrounds/magic_room.pal diff --git a/graphics/battle_anims/backgrounds/new/malicious_moonsault.bin b/graphics/battle_anims/backgrounds/malicious_moonsault.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/malicious_moonsault.bin rename to graphics/battle_anims/backgrounds/malicious_moonsault.bin diff --git a/graphics/battle_anims/backgrounds/new/malicious_moonsault.pal b/graphics/battle_anims/backgrounds/malicious_moonsault.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/malicious_moonsault.pal rename to graphics/battle_anims/backgrounds/malicious_moonsault.pal diff --git a/graphics/battle_anims/backgrounds/new/malicious_moonsault.png b/graphics/battle_anims/backgrounds/malicious_moonsault.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/malicious_moonsault.png rename to graphics/battle_anims/backgrounds/malicious_moonsault.png diff --git a/graphics/battle_anims/backgrounds/new/max_lightning.bin b/graphics/battle_anims/backgrounds/max_lightning.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/max_lightning.bin rename to graphics/battle_anims/backgrounds/max_lightning.bin diff --git a/graphics/battle_anims/backgrounds/new/max_lightning.pal b/graphics/battle_anims/backgrounds/max_lightning.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/max_lightning.pal rename to graphics/battle_anims/backgrounds/max_lightning.pal diff --git a/graphics/battle_anims/backgrounds/new/max_lightning.png b/graphics/battle_anims/backgrounds/max_lightning.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/max_lightning.png rename to graphics/battle_anims/backgrounds/max_lightning.png diff --git a/graphics/battle_anims/backgrounds/new/misty_terrain.bin b/graphics/battle_anims/backgrounds/misty_terrain.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/misty_terrain.bin rename to graphics/battle_anims/backgrounds/misty_terrain.bin diff --git a/graphics/battle_anims/backgrounds/new/misty_terrain.pal b/graphics/battle_anims/backgrounds/misty_terrain.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/misty_terrain.pal rename to graphics/battle_anims/backgrounds/misty_terrain.pal diff --git a/graphics/battle_anims/backgrounds/new/misty_terrain.png b/graphics/battle_anims/backgrounds/misty_terrain.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/misty_terrain.png rename to graphics/battle_anims/backgrounds/misty_terrain.png diff --git a/graphics/battle_anims/backgrounds/new/neverending_nightmare.bin b/graphics/battle_anims/backgrounds/neverending_nightmare.bin similarity index 100% rename from graphics/battle_anims/backgrounds/new/neverending_nightmare.bin rename to graphics/battle_anims/backgrounds/neverending_nightmare.bin diff --git a/graphics/battle_anims/backgrounds/new/neverending_nightmare.pal b/graphics/battle_anims/backgrounds/neverending_nightmare.pal similarity index 100% rename from graphics/battle_anims/backgrounds/new/neverending_nightmare.pal rename to graphics/battle_anims/backgrounds/neverending_nightmare.pal diff --git a/graphics/battle_anims/backgrounds/new/neverending_nightmare.png b/graphics/battle_anims/backgrounds/neverending_nightmare.png similarity index 100% rename from graphics/battle_anims/backgrounds/new/neverending_nightmare.png rename to graphics/battle_anims/backgrounds/neverending_nightmare.png diff --git a/graphics/battle_anims/backgrounds/new/tectonic_rage.bin b/graphics/battle_anims/backgrounds/new/tectonic_rage.bin deleted file mode 100644 index 914a9deb9a21e551d801771755bfa9409d48c68a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 296 zcmXAize@sP9EU&GtK8Q6zPG4by*H?vbb&c(^aT|cA!vPt;BM;|ai=(xDG0S>36AI9 zVzf2&C%CoRTFYDifOQ1V_V9c@VzmJeFxGvV$XN5Vwd=a%?RYhNUoE+kQaWHi#x8MV zEmBm5E-#@=b|RyU+H|7Kc49lvQ#6T24WeFZM${cISQLS#LD(Dx;Xy;NOW&^>X4sqH zo%OWn(s1ucLA%f%j)kpmx9lkLpo`Fjcfn9Eqm{pAh8up8Z&&eD!ONL$pY||QG%C3C zSgU+rO>)v1WFb{=CY|oMBo$caZ%95^L72MEaktF()}8K_KW5d&4I+y&nwBi#sPO*c~|VM5IgH zfMd2$z=B0y9*r+f1T>g0XmngVsZHKs#gxbFi@6fGE^%rEm?;ZfVfn;s@c6;miUn)T zIT#LEcHIzFuzAuG%c@kVWzC%s+%V-(s0fD!hndO(g%h0(O$QR!FznPhu!_O5F)6fR z&JlM}f#nN&0s_>f6N4W(X*^e$&KhBSPJw|Tm}5Dk)xBpbATM~j`njxgN@xNAFV|SY diff --git a/graphics/battle_anims/sprites/new/bee.png b/graphics/battle_anims/sprites/new/bee.png deleted file mode 100644 index 448935c10a426b59ab5eb9439ca6751329a9c767..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0zf>0g&9bG&i&Q}qznRlLR@EDSn%wu-j4aIKYsk! zxN&1vR+f#84Nwvnux309GW3L}i(^Q|oVOEf`3@QIv~CWWn|R`!6Mq0ZU&6vQQ!lM3 z?wYbrbjjDRmCxLD?le?&%(Jupwz=0aWTWx<7q_|NCR%P#nz(WYgUU+_*D`_Kd-Pd0 z%1xdtvC>NWm5-^)>^DtvCCs0Wv9Rr$rx;Uzxx@DIOkEWPd)ki_Af#iq_$SsGalG;$I^UygYL9z;$6EI t=$!FmKRPx#1ZP1_K>z@;j|==^1poj5Fi=cXMWm991Zo5X(gXyu1O$o%{Qmq5`UC&~chHgk z0Bt+~Zj}IacL7l-0BsBbZU6yw0DS{qcK`qY32;bRa{vGi!vFvd!vV){sAK>D0P;yh zK~yNub&)}C!yphv2Z*|^V;_KEsq2Y9^|}#}Z$Q^o+;aaTbRdMfayuKucKhTt#VW*=Tsy7@*_0L!BN<5vF_SLeV_=PH>sh0D1QfG^P%XF!xe`JA}o0m}EO|3K+! zz;doF6p3gK*V;mn7$?=5EKRiZYYe+V?MJyEb}OQ9no2meApg1X00000NkvXXu0mjf D0#u|d diff --git a/graphics/battle_anims/sprites/new/flash_cannon_ball.png b/graphics/battle_anims/sprites/new/flash_cannon_ball.png deleted file mode 100644 index b08d1d39f4a2deb8450fb465793258d6db9499b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvg8-ip*Z(JOym;~A!Gi}EE?n5K zVM9SdK|(?TP!bn7*s&r7DA(iZ;uumfXX~Vmf`=7&TvxuB%iCnGaF3y~`N1vUE&n-w zdK_8)dHrXry}wT=SgN|4x`tHub3Ju%)_q{~^Rrm8{W-}A-E-^N-Ha2qRd3Jp=74DW~bv>&m;MQJPZu} W8~7IgR$ki%vd+`h&t;ucLK6Vw&^gcm diff --git a/graphics/battle_anims/sprites/new/power_gem.png b/graphics/battle_anims/sprites/new/power_gem.png deleted file mode 100644 index 5523bb8a7570bab7fbfdd46f16dcfb29fa32194a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 179 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFP2=EDU{h!V7{{8!B&z|8YuU)&g zb?esR;$rtl!P|g(?L1u^LpWw8Cmdk=k=Ro&zkn(KzB8-dz26Li0+U#||L#`N;1GIL xUmY0m@m=+X4uJ@kg>37%6Z!6>w8SPbFz{Q-b)VaPzz}E>gQu&X%Q~loCIFK{P)z^; diff --git a/graphics/battle_anims/sprites/new/punishment.png b/graphics/battle_anims/sprites/new/punishment.png deleted file mode 100644 index 9215b6ec07019d39cf52c78ec4efb33f40749251..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 470 zcmeAS@N?(olHy`uVBq!ia0vp^3P8Mog&9cBe^M+DqznRlLR^zI|7SZT@9kOJlUxiG zBM8>me#vHFU`+IMaSW-LvvgYEq!tApRzW=lV|4+4hI{|>w69(B`V}a=e470&7N$zI zmIcb+4bR;_Zs}GsCFq;*U6rYQt0sL_`>4dsv39c6J6*Mp3r~6pGb@R|RGZD%tB^GN z^zkM)f!GN#0z1|=r76#Ch+w?*s!_G#LH?7RxzocLtwcAaCtvSE}@?d=wF$`ugP8_nTIq z3EJ@ce~#(|uMhuy>iJWqMFVdQ&MBb@07pf*{r~^~ diff --git a/graphics/battle_anims/sprites/new/quick_guard.png b/graphics/battle_anims/sprites/new/quick_guard.png deleted file mode 100644 index 71d343eeb5a8f93b0a50cd832de74728bb9c2b6e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvg8-ip*Z=?jYiepLC@4rsNC*fB zluka#CnN!s#07E|XG#I(B0OCjLn`KMz39l*V8G*YF{fyMj+%MKyZRQbgA&V{xPFz_ zE@>5-=%Z-c+FttM0|Un|9u5vD diff --git a/graphics/battle_anims/sprites/new/stealth_rock.png b/graphics/battle_anims/sprites/new/stealth_rock.png deleted file mode 100644 index 6ade3bb8797edee17a694e0c61ad21f15dc3e83c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 395 zcmV;60d)R}P)T%~}0000mP)t-sI@TeC zb1_Of8Dm-@85tSQwPR9BAt4zErIbnl004VyIx#5_2nYysV<}@&DLOG3jtgKo0003N zNklNX7F!G5B8S8#raX%)&Q_~^0gC}!n;>Z|2CM5Nh@C}9 z;YkD!S&PF;Ft4y+VPTbPtSl0DcAIN%n*U=MX2x+=s@b!-fw(aEKs=^&8QPZ15@dvc zF_sXXS;Ep?!f2oE#2WAE5#xs%VLIZqL0$8hhQm+ErCHrb`DTxW&B9qzlP{ZFLW~Vg zgm|DFps=k0mI4Xe`oWU$hb30mgxL??EHzH6M{K_}ylU2V23^-KY1ljK+up36^!=|r z=1s=y{wbbpx=KwA?v*;A3_#gd0FeU1CICc)ONfA95QZ;sKG(S8G00a9pAThjkmqtv p!~Sh1GqbwLvMYPcFQzLm`~z^SVKrewrilOm002ovPDHLkV1k*3o{j(j diff --git a/graphics/battle_anims/sprites/new/stone_edge.png b/graphics/battle_anims/sprites/new/stone_edge.png deleted file mode 100644 index 8e27efb9a2c528fad7817d986e35864703d5cd9f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 326 zcmV-M0lEH(P)Or#cy)!AL82muq2R`1#<_0azp)_8C4J} zW1s_1(%ZBtyMYG;fl5ueve3ko>5dHn!t`Mw{L0aRtN@C_ecy?w8dS#4M5E5UV%&eu Y2WF&G=u-g_xc~qF07*qoM6N<$g3EG&EdT%j diff --git a/graphics/battle_anims/sprites/new/water_gun.png b/graphics/battle_anims/sprites/new/water_gun.png deleted file mode 100644 index 4f30b2133dcca00deb0874af741c321f3ec21d59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^0zhoQ!VDx|6+TY^aRPioT>mQ?N^ae1cqPk_P= zZc)xy?vy3WFAFAku!R^lM`UMId~}`AXl`Y7fURjwfQZAk5)lDbhP)CbyHbT!Z9vNy NJYD@<);T3K0RXhmR=@xN diff --git a/graphics/battle_anims/sprites/new/wood.png b/graphics/battle_anims/sprites/new/wood.png deleted file mode 100644 index 1b64a647f5ce0f878de260bac06bcdf5ecc0cbc1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 881 zcmV-%1CIQOP)BjU5Xax(!5TH#F}O<)gj#GtAz6|skSxs>!D|aqhYU@JO!4v(L?9`o zmdVo179HbBn+3)#ZigBKEz#0I3H>%bIkI&3LMa3~r1S`Z_v7B(y?g(AvJhxSh$c!i zLa@LlB!qV2+DGpS(06_$aIFepsQ5|)9gs7d0v{5$rAQ1PQV9eM6j(C~4CPoeNA(DR z#B(MDbYshN?4z>OevCmm0GTjwY^72MZi|3{58g{SB!wVgr6Q2hVWoofIJmMnz)~el zN`RGF(qn~mEUk8IA^-!9bZH^|&J>Mx^^0kmmjrw=o6~)>1cCWrWRAX`l$E``oPKYV zO~v~Tf`G2?Xw{%dQd!UbpKdo6q%zDhAM8#V3vjWS^|iiK%Uvo_v@QmngVFY3?y?mP z@xU$f+3v{#L{GbMd$go-un|S83eueevj}q0@3cLD!vd^!A)#&F%68DER`4EB?o4)` zrzuss+Rb_HB&0j^d*VAX2d0L(1F(tWJF@AZ8Z^2-ST0eiagOp~InH&(y^ncSVld`{ z6NZGAqHlo+-zYNpbHW~ryIK%v>*gLKfvh(RwV+kaSIyBr0jE-$wFv=drs+=E>HIO9 z+IiPmLyRu=(56z)Zj!zQs6dN74#L1TbD-LC_JK#mw$i5IsLxsqWI3a)#Af+|9`Uc>C`&3H_LfV>+R-vwJZ$E&_{im;`*4o|F{n4#S{MO$ z_-}v1D*9TVxV53S)}D{8NCWgancMOjcMvPuMBaL{{!#k{k;_KLriUb&00000NkvXX Hu0mjfT=bMR diff --git a/graphics/battle_anims/sprites/new/obstruct.png b/graphics/battle_anims/sprites/obstruct.png similarity index 100% rename from graphics/battle_anims/sprites/new/obstruct.png rename to graphics/battle_anims/sprites/obstruct.png diff --git a/graphics/battle_anims/sprites/new/omega_stone.png b/graphics/battle_anims/sprites/omega_stone.png similarity index 100% rename from graphics/battle_anims/sprites/new/omega_stone.png rename to graphics/battle_anims/sprites/omega_stone.png diff --git a/graphics/battle_anims/sprites/new/pink_diamond.png b/graphics/battle_anims/sprites/pink_diamond.png similarity index 100% rename from graphics/battle_anims/sprites/new/pink_diamond.png rename to graphics/battle_anims/sprites/pink_diamond.png diff --git a/graphics/battle_anims/sprites/new/poison_column.png b/graphics/battle_anims/sprites/poison_column.png similarity index 100% rename from graphics/battle_anims/sprites/new/poison_column.png rename to graphics/battle_anims/sprites/poison_column.png diff --git a/graphics/battle_anims/sprites/new/poltergeist.pal b/graphics/battle_anims/sprites/poltergeist.pal similarity index 100% rename from graphics/battle_anims/sprites/new/poltergeist.pal rename to graphics/battle_anims/sprites/poltergeist.pal diff --git a/graphics/battle_anims/sprites/new/power_trick.png b/graphics/battle_anims/sprites/power_trick.png similarity index 100% rename from graphics/battle_anims/sprites/new/power_trick.png rename to graphics/battle_anims/sprites/power_trick.png diff --git a/graphics/battle_anims/sprites/new/purple_drake.png b/graphics/battle_anims/sprites/purple_drake.png similarity index 100% rename from graphics/battle_anims/sprites/new/purple_drake.png rename to graphics/battle_anims/sprites/purple_drake.png diff --git a/graphics/battle_anims/sprites/new/razor_shell.png b/graphics/battle_anims/sprites/razor_shell.png similarity index 100% rename from graphics/battle_anims/sprites/new/razor_shell.png rename to graphics/battle_anims/sprites/razor_shell.png diff --git a/graphics/battle_anims/sprites/new/rock_small.png b/graphics/battle_anims/sprites/rock_small.png similarity index 100% rename from graphics/battle_anims/sprites/new/rock_small.png rename to graphics/battle_anims/sprites/rock_small.png diff --git a/graphics/battle_anims/sprites/new/rocks.png b/graphics/battle_anims/sprites/rocks_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/rocks.png rename to graphics/battle_anims/sprites/rocks_new.png diff --git a/graphics/battle_anims/sprites/new/shell_left.png b/graphics/battle_anims/sprites/shell_left.png similarity index 100% rename from graphics/battle_anims/sprites/new/shell_left.png rename to graphics/battle_anims/sprites/shell_left.png diff --git a/graphics/battle_anims/sprites/new/shell_right.png b/graphics/battle_anims/sprites/shell_right.png similarity index 100% rename from graphics/battle_anims/sprites/new/shell_right.png rename to graphics/battle_anims/sprites/shell_right.png diff --git a/graphics/battle_anims/sprites/new/spacial_rend_slices.pal b/graphics/battle_anims/sprites/spacial_rend_slices.pal similarity index 100% rename from graphics/battle_anims/sprites/new/spacial_rend_slices.pal rename to graphics/battle_anims/sprites/spacial_rend_slices.pal diff --git a/graphics/battle_anims/sprites/new/spikes.png b/graphics/battle_anims/sprites/spikes_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/spikes.png rename to graphics/battle_anims/sprites/spikes_new.png diff --git a/graphics/battle_anims/sprites/new/spirit_shackle_arrow.png b/graphics/battle_anims/sprites/spirit_shackle_arrow.png similarity index 100% rename from graphics/battle_anims/sprites/new/spirit_shackle_arrow.png rename to graphics/battle_anims/sprites/spirit_shackle_arrow.png diff --git a/graphics/battle_anims/sprites/new/steam_eruption.png b/graphics/battle_anims/sprites/steam_eruption.png similarity index 100% rename from graphics/battle_anims/sprites/new/steam_eruption.png rename to graphics/battle_anims/sprites/steam_eruption.png diff --git a/graphics/battle_anims/sprites/new/steamroller.png b/graphics/battle_anims/sprites/steamroller.png similarity index 100% rename from graphics/battle_anims/sprites/new/steamroller.png rename to graphics/battle_anims/sprites/steamroller.png diff --git a/graphics/battle_anims/sprites/new/steel_beam.pal b/graphics/battle_anims/sprites/steel_beam.pal similarity index 100% rename from graphics/battle_anims/sprites/new/steel_beam.pal rename to graphics/battle_anims/sprites/steel_beam.pal diff --git a/graphics/battle_anims/sprites/new/stone_pillar.png b/graphics/battle_anims/sprites/stone_pillar.png similarity index 100% rename from graphics/battle_anims/sprites/new/stone_pillar.png rename to graphics/battle_anims/sprites/stone_pillar.png diff --git a/graphics/battle_anims/sprites/new/straight_beam.png b/graphics/battle_anims/sprites/straight_beam.png similarity index 100% rename from graphics/battle_anims/sprites/new/straight_beam.png rename to graphics/battle_anims/sprites/straight_beam.png diff --git a/graphics/battle_anims/sprites/new/substitute_back.png b/graphics/battle_anims/sprites/substitute_back_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/substitute_back.png rename to graphics/battle_anims/sprites/substitute_back_new.png diff --git a/graphics/battle_anims/sprites/new/substitute_front.png b/graphics/battle_anims/sprites/substitute_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/substitute_front.png rename to graphics/battle_anims/sprites/substitute_new.png diff --git a/graphics/battle_anims/sprites/new/surf_new.pal b/graphics/battle_anims/sprites/surf_new.pal similarity index 100% rename from graphics/battle_anims/sprites/new/surf_new.pal rename to graphics/battle_anims/sprites/surf_new.pal diff --git a/graphics/battle_anims/sprites/new/sword.png b/graphics/battle_anims/sprites/sword_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/sword.png rename to graphics/battle_anims/sprites/sword_new.png diff --git a/graphics/battle_anims/sprites/new/teeth.png b/graphics/battle_anims/sprites/teeth_new.png similarity index 100% rename from graphics/battle_anims/sprites/new/teeth.png rename to graphics/battle_anims/sprites/teeth_new.png diff --git a/graphics/battle_anims/sprites/new/tornado.png b/graphics/battle_anims/sprites/tornado.png similarity index 100% rename from graphics/battle_anims/sprites/new/tornado.png rename to graphics/battle_anims/sprites/tornado.png diff --git a/graphics/battle_anims/sprites/new/z_move_symbol.png b/graphics/battle_anims/sprites/z_move_symbol.png similarity index 100% rename from graphics/battle_anims/sprites/new/z_move_symbol.png rename to graphics/battle_anims/sprites/z_move_symbol.png diff --git a/src/graphics.c b/src/graphics.c index 7ccd0d5799..4a795a8b3e 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -43,8 +43,8 @@ const u32 gBattleAnimSpriteGfx_OmegaSymbol[] = INCBIN_U32("graphics/battle_anims const u32 gBattleAnimSpritePal_OmegaSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/omega_symbol.gbapal.lz"); const u32 gBattleAnimSpriteGfx_PrimalParticles[] = INCBIN_U32("graphics/battle_anims/sprites/primal_particles.4bpp.lz"); -const u32 gBattleAnimSpritePal_PrimalParticles[] = INCBIN_U32("graphics/battle_anims/sprites/primal_particles.gbapal.lz"); +const u32 gBattleAnimSpritePal_PrimalParticles[] = INCBIN_U32("graphics/battle_anims/sprites/primal_particles.gbapal.lz"); const u32 gBattleAnimSpriteGfx_FlashCannonBall[] = INCBIN_U32("graphics/battle_anims/sprites/flash_cannon_ball.4bpp.lz"); const u32 gBattleAnimSpritePal_FlashCannonBall[] = INCBIN_U32("graphics/battle_anims/sprites/flash_cannon_ball.gbapal.lz"); @@ -57,238 +57,240 @@ const u32 gBattleAnimSpritePal_Punishment[] = INCBIN_U32("graphics/battle_anims/ const u32 gBattleAnimSpriteGfx_QuickGuard[] = INCBIN_U32("graphics/battle_anims/sprites/quick_guard.4bpp.lz"); const u32 gBattleAnimSpritePal_QuickGuard[] = INCBIN_U32("graphics/battle_anims/sprites/quick_guard.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/new/acupressure_finger.4bpp.lz"); -const u32 gBattleAnimSpritePal_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/new/acupressure_finger.gbapal.lz"); +const u32 gBattleAnimSpritePal_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/acupressure_finger.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/acupressure_finger.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/new/alpha_stone.4bpp.lz"); -const u32 gBattleAnimSpritePal_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/new/alpha_stone.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/alpha_stone.4bpp.lz"); +const u32 gBattleAnimSpritePal_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/alpha_stone.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Anchor[] = INCBIN_U32("graphics/battle_anims/sprites/new/anchor.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_Anchor[] = INCBIN_U32("graphics/battle_anims/sprites/anchor.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_Apple[] = INCBIN_U32("graphics/battle_anims/sprites/new/apple.4bpp.lz"); -const u32 gBattleAnimSpritePal_Apple[] = INCBIN_U32("graphics/battle_anims/sprites/new/apple.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Apple[] = INCBIN_U32("graphics/battle_anims/sprites/apple.4bpp.lz"); +const u32 gBattleAnimSpritePal_Apple[] = INCBIN_U32("graphics/battle_anims/sprites/apple.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Arrows[] = INCBIN_U32("graphics/battle_anims/sprites/new/arrows.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_Arrows[] = INCBIN_U32("graphics/battle_anims/sprites/arrows.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_AssuranceHand[] = INCBIN_U32("graphics/battle_anims/sprites/new/assurance_hand.4bpp.lz"); -const u32 gBattleAnimSpritePal_AssuranceHand[] = INCBIN_U32("graphics/battle_anims/sprites/new/assurance_hand.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_AssuranceHand[] = INCBIN_U32("graphics/battle_anims/sprites/assurance_hand.4bpp.lz"); +const u32 gBattleAnimSpritePal_AssuranceHand[] = INCBIN_U32("graphics/battle_anims/sprites/assurance_hand.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_AuraSphere[] = INCBIN_U32("graphics/battle_anims/sprites/new/aura_sphere.4bpp.lz"); -const u32 gBattleAnimSpritePal_AuraSphere[] = INCBIN_U32("graphics/battle_anims/sprites/new/aura_sphere.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_AuraSphere[] = INCBIN_U32("graphics/battle_anims/sprites/aura_sphere.4bpp.lz"); +const u32 gBattleAnimSpritePal_AuraSphere[] = INCBIN_U32("graphics/battle_anims/sprites/aura_sphere.gbapal.lz"); -const u32 gBattleAnimSpritePal_AvalancheRocks[] = INCBIN_U32("graphics/battle_anims/sprites/new/avalanche_rocks.gbapal.lz"); +const u32 gBattleAnimSpritePal_AvalancheRocks[] = INCBIN_U32("graphics/battle_anims/sprites/avalanche_rocks.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewPokeball[] = INCBIN_U32("graphics/battle_anims/sprites/new/baton_pass_ball.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewPokeball[] = INCBIN_U32("graphics/battle_anims/sprites/new/baton_pass_ball.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewPokeball[] = INCBIN_U32("graphics/battle_anims/sprites/baton_pass_ball.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewPokeball[] = INCBIN_U32("graphics/battle_anims/sprites/baton_pass_ball.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_BerryEaten[] = INCBIN_U32("graphics/battle_anims/sprites/new/berry_eaten.4bpp.lz"); -const u32 gBattleAnimSpritePal_BerryEaten[] = INCBIN_U32("graphics/battle_anims/sprites/new/berry_eaten.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_BerryEaten[] = INCBIN_U32("graphics/battle_anims/sprites/berry_eaten.4bpp.lz"); +const u32 gBattleAnimSpritePal_BerryEaten[] = INCBIN_U32("graphics/battle_anims/sprites/berry_eaten.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_BerryNormal[] = INCBIN_U32("graphics/battle_anims/sprites/new/berry_normal.4bpp.lz"); -const u32 gBattleAnimSpritePal_BerryNormal[] = INCBIN_U32("graphics/battle_anims/sprites/new/berry_normal.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_BerryNormal[] = INCBIN_U32("graphics/battle_anims/sprites/berry_normal.4bpp.lz"); +const u32 gBattleAnimSpritePal_BerryNormal[] = INCBIN_U32("graphics/battle_anims/sprites/berry_normal.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_BigRock[] = INCBIN_U32("graphics/battle_anims/sprites/new/big_rock.4bpp.lz"); -const u32 gBattleAnimSpritePal_BigRock[] = INCBIN_U32("graphics/battle_anims/sprites/new/big_rock.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_BigRock[] = INCBIN_U32("graphics/battle_anims/sprites/big_rock.4bpp.lz"); +const u32 gBattleAnimSpritePal_BigRock[] = INCBIN_U32("graphics/battle_anims/sprites/big_rock.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_BlacephalonHead[] = INCBIN_U32("graphics/battle_anims/sprites/new/blacephalon_head.4bpp.lz"); -const u32 gBattleAnimSpritePal_BlacephalonHead[] = INCBIN_U32("graphics/battle_anims/sprites/new/blacephalon_head.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_BlacephalonHead[] = INCBIN_U32("graphics/battle_anims/sprites/blacephalon_head.4bpp.lz"); +const u32 gBattleAnimSpritePal_BlacephalonHead[] = INCBIN_U32("graphics/battle_anims/sprites/blacephalon_head.gbapal.lz"); -const u32 gBattleAnimSpritePal_BlueFlare[] = INCBIN_U32("graphics/battle_anims/sprites/new/blue_flare.gbapal.lz"); +const u32 gBattleAnimSpritePal_BlueFlare[] = INCBIN_U32("graphics/battle_anims/sprites/blue_flare.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Branch[] = INCBIN_U32("graphics/battle_anims/sprites/new/branch.4bpp.lz"); -const u32 gBattleAnimSpritePal_Branch[] = INCBIN_U32("graphics/battle_anims/sprites/new/branch.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Branch[] = INCBIN_U32("graphics/battle_anims/sprites/branch.4bpp.lz"); +const u32 gBattleAnimSpritePal_Branch[] = INCBIN_U32("graphics/battle_anims/sprites/branch.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Brine[] = INCBIN_U32("graphics/battle_anims/sprites/new/brine.4bpp.lz"); -const u32 gBattleAnimSpritePal_Brine[] = INCBIN_U32("graphics/battle_anims/sprites/new/brine.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Brine[] = INCBIN_U32("graphics/battle_anims/sprites/brine.4bpp.lz"); +const u32 gBattleAnimSpritePal_Brine[] = INCBIN_U32("graphics/battle_anims/sprites/brine.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ChainLink[] = INCBIN_U32("graphics/battle_anims/sprites/new/chain_link.4bpp.lz"); -const u32 gBattleAnimSpritePal_ChainLink[] = INCBIN_U32("graphics/battle_anims/sprites/new/chain_link.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_ChainLink[] = INCBIN_U32("graphics/battle_anims/sprites/chain_link.4bpp.lz"); +const u32 gBattleAnimSpritePal_ChainLink[] = INCBIN_U32("graphics/battle_anims/sprites/chain_link.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Chop[] = INCBIN_U32("graphics/battle_anims/sprites/new/chop.4bpp.lz"); -const u32 gBattleAnimSpritePal_Chop[] = INCBIN_U32("graphics/battle_anims/sprites/new/chop.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Chop[] = INCBIN_U32("graphics/battle_anims/sprites/chop.4bpp.lz"); +const u32 gBattleAnimSpritePal_Chop[] = INCBIN_U32("graphics/battle_anims/sprites/chop.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Cacoon[] = INCBIN_U32("graphics/battle_anims/sprites/new/cacoon.4bpp.lz"); -const u32 gBattleAnimSpritePal_Cacoon[] = INCBIN_U32("graphics/battle_anims/sprites/new/cacoon.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Cacoon[] = INCBIN_U32("graphics/battle_anims/sprites/cacoon.4bpp.lz"); +const u32 gBattleAnimSpritePal_Cacoon[] = INCBIN_U32("graphics/battle_anims/sprites/cacoon.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Confide[] = INCBIN_U32("graphics/battle_anims/sprites/new/confide.4bpp.lz"); -const u32 gBattleAnimSpritePal_Confide[] = INCBIN_U32("graphics/battle_anims/sprites/new/confide.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Confide[] = INCBIN_U32("graphics/battle_anims/sprites/confide.4bpp.lz"); +const u32 gBattleAnimSpritePal_Confide[] = INCBIN_U32("graphics/battle_anims/sprites/confide.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_CraftyShield[] = INCBIN_U32("graphics/battle_anims/sprites/new/crafty_shield.4bpp.lz"); -const u32 gBattleAnimSpritePal_CraftyShield[] = INCBIN_U32("graphics/battle_anims/sprites/new/crafty_shield.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_CraftyShield[] = INCBIN_U32("graphics/battle_anims/sprites/crafty_shield.4bpp.lz"); +const u32 gBattleAnimSpritePal_CraftyShield[] = INCBIN_U32("graphics/battle_anims/sprites/crafty_shield.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewNail[] = INCBIN_U32("graphics/battle_anims/sprites/new/curse_nail.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewNail[] = INCBIN_U32("graphics/battle_anims/sprites/new/curse_nail.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewNail[] = INCBIN_U32("graphics/battle_anims/sprites/curse_nail.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewNail[] = INCBIN_U32("graphics/battle_anims/sprites/curse_nail.gbapal.lz"); -const u32 gBattleAnimSpritePal_DracoMeteor[] = INCBIN_U32("graphics/battle_anims/sprites/new/draco_meteor.gbapal.lz"); +const u32 gBattleAnimSpritePal_DracoMeteor[] = INCBIN_U32("graphics/battle_anims/sprites/draco_meteor.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_DragonPulseRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/dragon_pulse_ring.4bpp.lz"); -const u32 gBattleAnimSpritePal_DragonPulseRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/dragon_pulse_ring.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_DragonPulseRing[] = INCBIN_U32("graphics/battle_anims/sprites/dragon_pulse_ring.4bpp.lz"); +const u32 gBattleAnimSpritePal_DragonPulseRing[] = INCBIN_U32("graphics/battle_anims/sprites/dragon_pulse_ring.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/new/dreepy_missile.4bpp.lz"); -const u32 gBattleAnimSpritePal_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/new/dreepy_missile.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/dreepy_missile.4bpp.lz"); +const u32 gBattleAnimSpritePal_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/dreepy_missile.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/new/drill.4bpp.lz"); -const u32 gBattleAnimSpritePal_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/new/drill.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/drill.4bpp.lz"); +const u32 gBattleAnimSpritePal_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/drill.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewEmbers[] = INCBIN_U32("graphics/battle_anims/sprites/new/embers.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewEmbers[] = INCBIN_U32("graphics/battle_anims/sprites/new/embers.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewEmbers[] = INCBIN_U32("graphics/battle_anims/sprites/embers.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewEmbers[] = INCBIN_U32("graphics/battle_anims/sprites/embers.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_FairyLockChains[] = INCBIN_U32("graphics/battle_anims/sprites/new/fairy_lock_chains.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_FairyLockChains[] = INCBIN_U32("graphics/battle_anims/sprites/fairy_lock_chains.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_Fishies[] = INCBIN_U32("graphics/battle_anims/sprites/new/fishies.4bpp.lz"); -const u32 gBattleAnimSpritePal_Fishies[] = INCBIN_U32("graphics/battle_anims/sprites/new/fishies.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Fishies[] = INCBIN_U32("graphics/battle_anims/sprites/fishies.4bpp.lz"); +const u32 gBattleAnimSpritePal_Fishies[] = INCBIN_U32("graphics/battle_anims/sprites/fishies.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewFly[] = INCBIN_U32("graphics/battle_anims/sprites/new/fly.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewFly[] = INCBIN_U32("graphics/battle_anims/sprites/new/fly.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewFly[] = INCBIN_U32("graphics/battle_anims/sprites/fly.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewFly[] = INCBIN_U32("graphics/battle_anims/sprites/fly.gbapal.lz"); -const u32 gBattleAnimSpritePal_FusionFlare[] = INCBIN_U32("graphics/battle_anims/sprites/new/fusion_flare.gbapal.lz"); +const u32 gBattleAnimSpritePal_FusionFlare[] = INCBIN_U32("graphics/battle_anims/sprites/fusion_flare.gbapal.lz"); -const u32 gBattleAnimSpritePal_GarbagePoisonPillar[] = INCBIN_U32("graphics/battle_anims/sprites/new/garbage_poison_column.gbapal.lz"); +const u32 gBattleAnimSpritePal_GarbagePoisonPillar[] = INCBIN_U32("graphics/battle_anims/sprites/garbage_poison_column.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Gear[] = INCBIN_U32("graphics/battle_anims/sprites/new/gear.4bpp.lz"); -const u32 gBattleAnimSpritePal_Gear[] = INCBIN_U32("graphics/battle_anims/sprites/new/gear.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Gear[] = INCBIN_U32("graphics/battle_anims/sprites/gear.4bpp.lz"); +const u32 gBattleAnimSpritePal_Gear[] = INCBIN_U32("graphics/battle_anims/sprites/gear.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_GigavoltHavocSpear[] = INCBIN_U32("graphics/battle_anims/sprites/new/gigavolt_havoc_spear.4bpp.lz"); -const u32 gBattleAnimSpritePal_GigavoltHavocSpear[] = INCBIN_U32("graphics/battle_anims/sprites/new/gigavolt_havoc_spear.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_GigavoltHavocSpear[] = INCBIN_U32("graphics/battle_anims/sprites/gigavolt_havoc_spear.4bpp.lz"); +const u32 gBattleAnimSpritePal_GigavoltHavocSpear[] = INCBIN_U32("graphics/battle_anims/sprites/gigavolt_havoc_spear.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_GoldenApple[] = INCBIN_U32("graphics/battle_anims/sprites/new/golden_apple.4bpp.lz"); -const u32 gBattleAnimSpritePal_GoldenApple[] = INCBIN_U32("graphics/battle_anims/sprites/new/golden_apple.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_GoldenApple[] = INCBIN_U32("graphics/battle_anims/sprites/golden_apple.4bpp.lz"); +const u32 gBattleAnimSpritePal_GoldenApple[] = INCBIN_U32("graphics/battle_anims/sprites/golden_apple.gbapal.lz"); -const u32 gBattleAnimSpritePal_GreenDrake[] = INCBIN_U32("graphics/battle_anims/sprites/new/green_drake.gbapal.lz"); +const u32 gBattleAnimSpritePal_GreenDrake[] = INCBIN_U32("graphics/battle_anims/sprites/green_drake.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewGreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/new/green_star.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewGreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/new/green_star.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewGreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewGreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HeartStamp[] = INCBIN_U32("graphics/battle_anims/sprites/new/heart_stamp.4bpp.lz"); -const u32 gBattleAnimSpritePal_HeartStamp[] = INCBIN_U32("graphics/battle_anims/sprites/new/heart_stamp.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HeartStamp[] = INCBIN_U32("graphics/battle_anims/sprites/heart_stamp.4bpp.lz"); +const u32 gBattleAnimSpritePal_HeartStamp[] = INCBIN_U32("graphics/battle_anims/sprites/heart_stamp.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ZygardeHexes[] = INCBIN_U32("graphics/battle_anims/sprites/new/hexes.4bpp.lz"); -const u32 gBattleAnimSpritePal_ZygardeHexes[] = INCBIN_U32("graphics/battle_anims/sprites/new/hexes.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_ZygardeHexes[] = INCBIN_U32("graphics/battle_anims/sprites/hexes.4bpp.lz"); +const u32 gBattleAnimSpritePal_ZygardeHexes[] = INCBIN_U32("graphics/battle_anims/sprites/hexes.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HoopaHand[] = INCBIN_U32("graphics/battle_anims/sprites/new/hoopa_hand.4bpp.lz"); -const u32 gBattleAnimSpritePal_HoopaHand[] = INCBIN_U32("graphics/battle_anims/sprites/new/hoopa_hand.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HoopaHand[] = INCBIN_U32("graphics/battle_anims/sprites/hoopa_hand.4bpp.lz"); +const u32 gBattleAnimSpritePal_HoopaHand[] = INCBIN_U32("graphics/battle_anims/sprites/hoopa_hand.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HoopaRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/hoopa_ring.4bpp.lz"); -const u32 gBattleAnimSpritePal_HoopaRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/hoopa_ring.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HoopaRing[] = INCBIN_U32("graphics/battle_anims/sprites/hoopa_ring.4bpp.lz"); +const u32 gBattleAnimSpritePal_HoopaRing[] = INCBIN_U32("graphics/battle_anims/sprites/hoopa_ring.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewHornHit[] = INCBIN_U32("graphics/battle_anims/sprites/new/horn.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewHornHit[] = INCBIN_U32("graphics/battle_anims/sprites/new/horn.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewHornHit[] = INCBIN_U32("graphics/battle_anims/sprites/horn_hit_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewHornHit[] = INCBIN_U32("graphics/battle_anims/sprites/horn_hit_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HornLeech[] = INCBIN_U32("graphics/battle_anims/sprites/new/horn_leech.4bpp.lz"); -const u32 gBattleAnimSpritePal_HornLeech[] = INCBIN_U32("graphics/battle_anims/sprites/new/horn_leech.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HornLeech[] = INCBIN_U32("graphics/battle_anims/sprites/horn_leech.4bpp.lz"); +const u32 gBattleAnimSpritePal_HornLeech[] = INCBIN_U32("graphics/battle_anims/sprites/horn_leech.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HorseshoeFist[] = INCBIN_U32("graphics/battle_anims/sprites/new/horseshoe_fist.4bpp.lz"); -const u32 gBattleAnimSpritePal_HorseshoeFist[] = INCBIN_U32("graphics/battle_anims/sprites/new/horseshoe_fist.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HorseshoeFist[] = INCBIN_U32("graphics/battle_anims/sprites/horseshoe_fist.4bpp.lz"); +const u32 gBattleAnimSpritePal_HorseshoeFist[] = INCBIN_U32("graphics/battle_anims/sprites/horseshoe_fist.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_HydroPump[] = INCBIN_U32("graphics/battle_anims/sprites/new/hydro_pump.4bpp.lz"); -const u32 gBattleAnimSpritePal_HydroPump[] = INCBIN_U32("graphics/battle_anims/sprites/new/hydro_pump.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_HydroPump[] = INCBIN_U32("graphics/battle_anims/sprites/hydro_pump.4bpp.lz"); +const u32 gBattleAnimSpritePal_HydroPump[] = INCBIN_U32("graphics/battle_anims/sprites/hydro_pump.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_IceRock[] = INCBIN_U32("graphics/battle_anims/sprites/new/ice_rock.4bpp.lz"); -const u32 gBattleAnimSpritePal_IceRock[] = INCBIN_U32("graphics/battle_anims/sprites/new/ice_rock.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_IceRock[] = INCBIN_U32("graphics/battle_anims/sprites/ice_rock.4bpp.lz"); +const u32 gBattleAnimSpritePal_IceRock[] = INCBIN_U32("graphics/battle_anims/sprites/ice_rock.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_LargeSpike[] = INCBIN_U32("graphics/battle_anims/sprites/new/large_spike.4bpp.lz"); -const u32 gBattleAnimSpritePal_LargeSpike[] = INCBIN_U32("graphics/battle_anims/sprites/new/large_spike.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_LargeSpike[] = INCBIN_U32("graphics/battle_anims/sprites/large_spike.4bpp.lz"); +const u32 gBattleAnimSpritePal_LargeSpike[] = INCBIN_U32("graphics/battle_anims/sprites/large_spike.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewLeaf[] = INCBIN_U32("graphics/battle_anims/sprites/new/leaves.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewLeaf[] = INCBIN_U32("graphics/battle_anims/sprites/new/leaves.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewLeaf[] = INCBIN_U32("graphics/battle_anims/sprites/leaves.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewLeaf[] = INCBIN_U32("graphics/battle_anims/sprites/leaves.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewLeechSeed[] = INCBIN_U32("graphics/battle_anims/sprites/new/leech_seed.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewLeechSeed[] = INCBIN_U32("graphics/battle_anims/sprites/new/leech_seed.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewLeechSeed[] = INCBIN_U32("graphics/battle_anims/sprites/leech_seed.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewLeechSeed[] = INCBIN_U32("graphics/battle_anims/sprites/leech_seed.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_LightningRain[] = INCBIN_U32("graphics/battle_anims/sprites/new/lightning_rain.4bpp.lz"); -const u32 gBattleAnimSpritePal_LightningRain[] = INCBIN_U32("graphics/battle_anims/sprites/new/lightning_rain.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_LightningRain[] = INCBIN_U32("graphics/battle_anims/sprites/lightning_rain.4bpp.lz"); +const u32 gBattleAnimSpritePal_LightningRain[] = INCBIN_U32("graphics/battle_anims/sprites/lightning_rain.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewEye[] = INCBIN_U32("graphics/battle_anims/sprites/new/mean_look.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewEye[] = INCBIN_U32("graphics/battle_anims/sprites/new/mean_look.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewEye[] = INCBIN_U32("graphics/battle_anims/sprites/mean_look.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewEye[] = INCBIN_U32("graphics/battle_anims/sprites/mean_look.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_MetalBits[] = INCBIN_U32("graphics/battle_anims/sprites/new/metal_bits.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_MetalBits[] = INCBIN_U32("graphics/battle_anims/sprites/metal_bits.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_MudBomb[] = INCBIN_U32("graphics/battle_anims/sprites/new/mud_bomb.4bpp.lz"); -const u32 gBattleAnimSpritePal_MudBomb[] = INCBIN_U32("graphics/battle_anims/sprites/new/mud_bomb.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_MudBomb[] = INCBIN_U32("graphics/battle_anims/sprites/mud_bomb.4bpp.lz"); +const u32 gBattleAnimSpritePal_MudBomb[] = INCBIN_U32("graphics/battle_anims/sprites/mud_bomb.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Mushroom[] = INCBIN_U32("graphics/battle_anims/sprites/new/mushroom.4bpp.lz"); -const u32 gBattleAnimSpritePal_Mushroom[] = INCBIN_U32("graphics/battle_anims/sprites/new/mushroom.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Mushroom[] = INCBIN_U32("graphics/battle_anims/sprites/mushroom.4bpp.lz"); +const u32 gBattleAnimSpritePal_Mushroom[] = INCBIN_U32("graphics/battle_anims/sprites/mushroom.gbapal.lz"); -const u32 gBattleAnimSpritePal_NaturalGiftRing[] = INCBIN_U32("graphics/battle_anims/sprites/new/natural_gift_ring.gbapal.lz"); +const u32 gBattleAnimSpritePal_NaturalGiftRing[] = INCBIN_U32("graphics/battle_anims/sprites/natural_gift_ring.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NecrozmaStar[] = INCBIN_U32("graphics/battle_anims/sprites/new/necrozma_star.4bpp.lz"); -const u32 gBattleAnimSpritePal_NecrozmaStar[] = INCBIN_U32("graphics/battle_anims/sprites/new/necrozma_star.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NecrozmaStar[] = INCBIN_U32("graphics/battle_anims/sprites/necrozma_star.4bpp.lz"); +const u32 gBattleAnimSpritePal_NecrozmaStar[] = INCBIN_U32("graphics/battle_anims/sprites/necrozma_star.gbapal.lz"); -const u32 gBattleAnimSpritePal_NewImpact[] = INCBIN_U32("graphics/battle_anims/sprites/new/impact.gbapal.lz"); +const u32 gBattleAnimSpritePal_NewImpact[] = INCBIN_U32("graphics/battle_anims/sprites/impact_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Obstruct[] = INCBIN_U32("graphics/battle_anims/sprites/new/obstruct.4bpp.lz"); -const u32 gBattleAnimSpritePal_Obstruct[] = INCBIN_U32("graphics/battle_anims/sprites/new/obstruct.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Obstruct[] = INCBIN_U32("graphics/battle_anims/sprites/obstruct.4bpp.lz"); +const u32 gBattleAnimSpritePal_Obstruct[] = INCBIN_U32("graphics/battle_anims/sprites/obstruct.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_OmegaStone[] = INCBIN_U32("graphics/battle_anims/sprites/new/omega_stone.4bpp.lz"); -const u32 gBattleAnimSpritePal_OmegaStone[] = INCBIN_U32("graphics/battle_anims/sprites/new/omega_stone.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_OmegaStone[] = INCBIN_U32("graphics/battle_anims/sprites/omega_stone.4bpp.lz"); +const u32 gBattleAnimSpritePal_OmegaStone[] = INCBIN_U32("graphics/battle_anims/sprites/omega_stone.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_PinkDiamond[] = INCBIN_U32("graphics/battle_anims/sprites/new/pink_diamond.4bpp.lz"); -const u32 gBattleAnimSpritePal_PinkDiamond[] = INCBIN_U32("graphics/battle_anims/sprites/new/pink_diamond.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_PinkDiamond[] = INCBIN_U32("graphics/battle_anims/sprites/pink_diamond.4bpp.lz"); +const u32 gBattleAnimSpritePal_PinkDiamond[] = INCBIN_U32("graphics/battle_anims/sprites/pink_diamond.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_PoisonColumn[] = INCBIN_U32("graphics/battle_anims/sprites/new/poison_column.4bpp.lz"); -const u32 gBattleAnimSpritePal_PoisonColumn[] = INCBIN_U32("graphics/battle_anims/sprites/new/poison_column.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_PoisonColumn[] = INCBIN_U32("graphics/battle_anims/sprites/poison_column.4bpp.lz"); +const u32 gBattleAnimSpritePal_PoisonColumn[] = INCBIN_U32("graphics/battle_anims/sprites/poison_column.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_PowerTrick[] = INCBIN_U32("graphics/battle_anims/sprites/new/power_trick.4bpp.lz"); -const u32 gBattleAnimSpritePal_PowerTrick[] = INCBIN_U32("graphics/battle_anims/sprites/new/power_trick.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_PowerTrick[] = INCBIN_U32("graphics/battle_anims/sprites/power_trick.4bpp.lz"); +const u32 gBattleAnimSpritePal_PowerTrick[] = INCBIN_U32("graphics/battle_anims/sprites/power_trick.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_PurpleDrake[] = INCBIN_U32("graphics/battle_anims/sprites/new/purple_drake.4bpp.lz"); -const u32 gBattleAnimSpritePal_PurpleDrake[] = INCBIN_U32("graphics/battle_anims/sprites/new/purple_drake.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_PurpleDrake[] = INCBIN_U32("graphics/battle_anims/sprites/purple_drake.4bpp.lz"); +const u32 gBattleAnimSpritePal_PurpleDrake[] = INCBIN_U32("graphics/battle_anims/sprites/purple_drake.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_RazorShell[] = INCBIN_U32("graphics/battle_anims/sprites/new/razor_shell.4bpp.lz"); -const u32 gBattleAnimSpritePal_RazorShell[] = INCBIN_U32("graphics/battle_anims/sprites/new/razor_shell.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_RazorShell[] = INCBIN_U32("graphics/battle_anims/sprites/razor_shell.4bpp.lz"); +const u32 gBattleAnimSpritePal_RazorShell[] = INCBIN_U32("graphics/battle_anims/sprites/razor_shell.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_RocksSmall[] = INCBIN_U32("graphics/battle_anims/sprites/new/rock_small.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_RocksSmall[] = INCBIN_U32("graphics/battle_anims/sprites/rock_small.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_NewRocks[] = INCBIN_U32("graphics/battle_anims/sprites/new/rocks.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewRocks[] = INCBIN_U32("graphics/battle_anims/sprites/new/rocks.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewRocks[] = INCBIN_U32("graphics/battle_anims/sprites/rocks_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewRocks[] = INCBIN_U32("graphics/battle_anims/sprites/rocks_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ShellLeft[] = INCBIN_U32("graphics/battle_anims/sprites/new/shell_left.4bpp.lz"); -const u32 gBattleAnimSpritePal_ShellLeft[] = INCBIN_U32("graphics/battle_anims/sprites/new/shell_left.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_ShellLeft[] = INCBIN_U32("graphics/battle_anims/sprites/shell_left.4bpp.lz"); +const u32 gBattleAnimSpritePal_ShellLeft[] = INCBIN_U32("graphics/battle_anims/sprites/shell_left.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ShellRight[] = INCBIN_U32("graphics/battle_anims/sprites/new/shell_right.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_ShellRight[] = INCBIN_U32("graphics/battle_anims/sprites/shell_right.4bpp.lz"); -const u32 gBattleAnimSpritePal_SpacialRendSlices[] = INCBIN_U32("graphics/battle_anims/sprites/new/spacial_rend_slices.gbapal.lz"); +const u32 gBattleAnimSpritePal_SpacialRendSlices[] = INCBIN_U32("graphics/battle_anims/sprites/spacial_rend_slices.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewSpikes[] = INCBIN_U32("graphics/battle_anims/sprites/new/spikes.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewSpikes[] = INCBIN_U32("graphics/battle_anims/sprites/new/spikes.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewSpikes[] = INCBIN_U32("graphics/battle_anims/sprites/spikes_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewSpikes[] = INCBIN_U32("graphics/battle_anims/sprites/spikes_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_SpiritShackleArrow[] = INCBIN_U32("graphics/battle_anims/sprites/new/spirit_shackle_arrow.4bpp.lz"); -const u32 gBattleAnimSpritePal_SpiritShackleArrow[] = INCBIN_U32("graphics/battle_anims/sprites/new/spirit_shackle_arrow.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_SpiritShackleArrow[] = INCBIN_U32("graphics/battle_anims/sprites/spirit_shackle_arrow.4bpp.lz"); +const u32 gBattleAnimSpritePal_SpiritShackleArrow[] = INCBIN_U32("graphics/battle_anims/sprites/spirit_shackle_arrow.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_SteamEruption[] = INCBIN_U32("graphics/battle_anims/sprites/new/steam_eruption.4bpp.lz"); -const u32 gBattleAnimSpritePal_SteamEruption[] = INCBIN_U32("graphics/battle_anims/sprites/new/steam_eruption.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_SteamEruption[] = INCBIN_U32("graphics/battle_anims/sprites/steam_eruption.4bpp.lz"); +const u32 gBattleAnimSpritePal_SteamEruption[] = INCBIN_U32("graphics/battle_anims/sprites/steam_eruption.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Steamroller[] = INCBIN_U32("graphics/battle_anims/sprites/new/steamroller.4bpp.lz"); -const u32 gBattleAnimSpritePal_Steamroller[] = INCBIN_U32("graphics/battle_anims/sprites/new/steamroller.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Steamroller[] = INCBIN_U32("graphics/battle_anims/sprites/steamroller.4bpp.lz"); +const u32 gBattleAnimSpritePal_Steamroller[] = INCBIN_U32("graphics/battle_anims/sprites/steamroller.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_StonePillar[] = INCBIN_U32("graphics/battle_anims/sprites/new/stone_pillar.4bpp.lz"); -const u32 gBattleAnimSpritePal_StonePillar[] = INCBIN_U32("graphics/battle_anims/sprites/new/stone_pillar.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_StonePillar[] = INCBIN_U32("graphics/battle_anims/sprites/stone_pillar.4bpp.lz"); +const u32 gBattleAnimSpritePal_StonePillar[] = INCBIN_U32("graphics/battle_anims/sprites/stone_pillar.gbapal.lz"); -const u32 gBattleAnimSpritePal_Poltergeist[] = INCBIN_U32("graphics/battle_anims/sprites/new/poltergeist.gbapal.lz"); +const u32 gBattleAnimSpritePal_Poltergeist[] = INCBIN_U32("graphics/battle_anims/sprites/poltergeist.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/new/straight_beam.4bpp.lz"); -const u32 gBattleAnimSpritePal_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/new/straight_beam.gbapal.lz"); +const u32 gBattleAnimSpritePal_SteelBeam[] = INCBIN_U32("graphics/battle_anims/sprites/steel_beam.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_SubstituteBack[] = INCBIN_U32("graphics/battle_anims/sprites/new/substitute_back.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/new/substitute_front.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/new/substitute_front.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/straight_beam.4bpp.lz"); +const u32 gBattleAnimSpritePal_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/straight_beam.gbapal.lz"); -const u32 gBattleAnimSpritePal_NewSurf[] = INCBIN_U32("graphics/battle_anims/sprites/new/surf_new.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_SubstituteBack[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_back_new.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewSword[] = INCBIN_U32("graphics/battle_anims/sprites/new/sword.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewSword[] = INCBIN_U32("graphics/battle_anims/sprites/new/sword.gbapal.lz"); +const u32 gBattleAnimSpritePal_NewSurf[] = INCBIN_U32("graphics/battle_anims/sprites/surf_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewTeeth[] = INCBIN_U32("graphics/battle_anims/sprites/new/teeth.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewTeeth[] = INCBIN_U32("graphics/battle_anims/sprites/new/teeth.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewSword[] = INCBIN_U32("graphics/battle_anims/sprites/sword_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewSword[] = INCBIN_U32("graphics/battle_anims/sprites/sword_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_NewHandsAndFeet[] = INCBIN_U32("graphics/battle_anims/sprites/new/thrash.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewHandsAndFeet[] = INCBIN_U32("graphics/battle_anims/sprites/new/thrash.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewTeeth[] = INCBIN_U32("graphics/battle_anims/sprites/teeth_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewTeeth[] = INCBIN_U32("graphics/battle_anims/sprites/teeth_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Tornado[] = INCBIN_U32("graphics/battle_anims/sprites/new/tornado.4bpp.lz"); -const u32 gBattleAnimSpritePal_Tornado[] = INCBIN_U32("graphics/battle_anims/sprites/new/tornado.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_NewHandsAndFeet[] = INCBIN_U32("graphics/battle_anims/sprites/hands_and_feet_new.4bpp.lz"); +const u32 gBattleAnimSpritePal_NewHandsAndFeet[] = INCBIN_U32("graphics/battle_anims/sprites/hands_and_feet_new.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/new/z_move_symbol.4bpp.lz"); -const u32 gBattleAnimSpritePal_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/new/z_move_symbol.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Tornado[] = INCBIN_U32("graphics/battle_anims/sprites/tornado.4bpp.lz"); +const u32 gBattleAnimSpritePal_Tornado[] = INCBIN_U32("graphics/battle_anims/sprites/tornado.gbapal.lz"); + +const u32 gBattleAnimSpriteGfx_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/z_move_symbol.4bpp.lz"); +const u32 gBattleAnimSpritePal_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/z_move_symbol.gbapal.lz"); // Battle anims @@ -1379,172 +1381,171 @@ const u32 gBattleAnimBgPalette_MagmaStorm[] = INCBIN_U32("graphics/battle_anims/ //new battle bgs -const u32 gBattleAnimBgImage_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.4bpp.lz"); -const u32 gBattleAnimBgPalette_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.bin.lz"); +const u32 gBattleAnimBgImage_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/hurricane.4bpp.lz"); +const u32 gBattleAnimBgPalette_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/hurricane.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/hurricane.bin.lz"); -const u32 gBattleAnimBgPalette_RockWrecker[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/rock_wrecker.gbapal.lz"); +const u32 gBattleAnimBgPalette_RockWrecker[] = INCBIN_U32("graphics/battle_anims/backgrounds/rock_wrecker.gbapal.lz"); -const u32 gBattleAnimBgTilemap_GigaImpactPlayer[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact_player.bin.lz"); -const u32 gBattleAnimBgTilemap_GigaImpactOpponent[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact_opponent.bin.lz"); -const u32 gBattleAnimBgTilemap_GigaImpactContest[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact_contest.bin.lz"); -const u32 gBattleAnimBgImage_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact.4bpp.lz"); -const u32 gBattleAnimBgPalette_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/giga_impact.gbapal.lz"); +const u32 gBattleAnimBgTilemap_GigaImpactPlayer[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact_player.bin.lz"); +const u32 gBattleAnimBgTilemap_GigaImpactOpponent[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact_opponent.bin.lz"); +const u32 gBattleAnimBgTilemap_GigaImpactContest[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact_contest.bin.lz"); +const u32 gBattleAnimBgImage_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact.4bpp.lz"); +const u32 gBattleAnimBgPalette_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact.gbapal.lz"); -const u32 gBattleAnimBgImage_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/spacial_rend.4bpp.lz"); -const u32 gBattleAnimBgPalette_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/spacial_rend.gbapal.lz"); +const u32 gBattleAnimBgImage_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/spacial_rend.4bpp.lz"); +const u32 gBattleAnimBgPalette_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/spacial_rend.gbapal.lz"); -const u32 gBattleAnimBgPalette_SludgeWave[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sludge_wave.gbapal.lz"); +const u32 gBattleAnimBgPalette_SludgeWave[] = INCBIN_U32("graphics/battle_anims/backgrounds/sludge_wave.gbapal.lz"); -const u32 gBattleAnimBgImage_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aeroblast_tiles.4bpp.lz"); -const u32 gBattleAnimBgPalette_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aeroblast.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aeroblast_map.bin.lz"); +const u32 gBattleAnimBgImage_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/aeroblast_tiles.4bpp.lz"); +const u32 gBattleAnimBgPalette_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/aeroblast.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/aeroblast_map.bin.lz"); -const u32 gBattleAnimBgPalette_AuraSphere[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aura_sphere.gbapal.lz"); +const u32 gBattleAnimBgPalette_AuraSphere[] = INCBIN_U32("graphics/battle_anims/backgrounds/aura_sphere.gbapal.lz"); -const u32 gBattleAnimBgImage_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/blackhole_eclipse.4bpp.lz"); -const u32 gBattleAnimBgPalette_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/blackhole_eclipse.gbapal.lz"); -const u32 gBattleAnimBgTilemap_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/blackhole_eclipse.bin.lz"); +const u32 gBattleAnimBgImage_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/blackhole_eclipse.4bpp.lz"); +const u32 gBattleAnimBgPalette_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/blackhole_eclipse.gbapal.lz"); +const u32 gBattleAnimBgTilemap_BlackholeEclipse[] = INCBIN_U32("graphics/battle_anims/backgrounds/blackhole_eclipse.bin.lz"); -const u32 gBattleAnimBgImage_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bloom_doom.4bpp.lz"); -const u32 gBattleAnimBgPalette_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bloom_doom.gbapal.lz"); -const u32 gBattleAnimBgTilemap_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bloom_doom.bin.lz"); +const u32 gBattleAnimBgImage_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/bloom_doom.4bpp.lz"); +const u32 gBattleAnimBgPalette_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/bloom_doom.gbapal.lz"); +const u32 gBattleAnimBgTilemap_BloomDoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/bloom_doom.bin.lz"); -const u32 gBattleAnimBgImage_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bolt_strike.4bpp.lz"); -const u32 gBattleAnimBgPalette_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bolt_strike.gbapal.lz"); -const u32 gBattleAnimBgTilemap_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/bolt_strike.bin.lz"); +const u32 gBattleAnimBgImage_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/bolt_strike.4bpp.lz"); +const u32 gBattleAnimBgPalette_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/bolt_strike.gbapal.lz"); +const u32 gBattleAnimBgTilemap_BoltStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/bolt_strike.bin.lz"); -const u32 gBattleAnimBgImage_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.4bpp.lz"); -const u32 gBattleAnimBgPalette_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.bin.lz"); +const u32 gBattleAnimBgImage_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/clangorous_soulblaze.4bpp.lz"); +const u32 gBattleAnimBgPalette_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/clangorous_soulblaze.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/clangorous_soulblaze.bin.lz"); -const u32 gBattleAnimBgPalette_DynamaxCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dynamax_cannon.gbapal.lz"); +const u32 gBattleAnimBgPalette_DynamaxCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/dynamax_cannon.gbapal.lz"); -const u32 gBattleAnimBgImage_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/electric_terrain.4bpp.lz"); -const u32 gBattleAnimBgPalette_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/electric_terrain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/electric_terrain.bin.lz"); +const u32 gBattleAnimBgImage_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/electric_terrain.4bpp.lz"); +const u32 gBattleAnimBgPalette_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/electric_terrain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/electric_terrain.bin.lz"); -const u32 gBattleAnimBgImage_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/fire1.4bpp.lz"); -const u32 gBattleAnimBgPalette_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/fire1.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/fire1.bin.lz"); +const u32 gBattleAnimBgImage_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/fire1.4bpp.lz"); +const u32 gBattleAnimBgPalette_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/fire1.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Fire1[] = INCBIN_U32("graphics/battle_anims/backgrounds/fire1.bin.lz"); -const u32 gBattleAnimBgPalette_Fire2[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/fire2.gbapal.lz"); +const u32 gBattleAnimBgPalette_Fire2[] = INCBIN_U32("graphics/battle_anims/backgrounds/fire2.gbapal.lz"); -const u32 gBattleAnimBgImage_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/focus_blast.4bpp.lz"); -const u32 gBattleAnimBgPalette_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/focus_blast.gbapal.lz"); -const u32 gBattleAnimBgTilemap_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/focus_blast.bin.lz"); +const u32 gBattleAnimBgImage_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/focus_blast.4bpp.lz"); +const u32 gBattleAnimBgPalette_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/focus_blast.gbapal.lz"); +const u32 gBattleAnimBgTilemap_FocusBlast[] = INCBIN_U32("graphics/battle_anims/backgrounds/focus_blast.bin.lz"); -const u32 gBattleAnimBgPalette_GarbageFalls[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/garbage_falls.gbapal.lz"); +const u32 gBattleAnimBgPalette_GarbageFalls[] = INCBIN_U32("graphics/battle_anims/backgrounds/garbage_falls.gbapal.lz"); -const u32 gBattleAnimBgImage_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/grassy_terrain.4bpp.lz"); -const u32 gBattleAnimBgPalette_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/grassy_terrain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/grassy_terrain.bin.lz"); +const u32 gBattleAnimBgImage_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/grassy_terrain.4bpp.lz"); +const u32 gBattleAnimBgPalette_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/grassy_terrain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_GrassyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/grassy_terrain.bin.lz"); -const u32 gBattleAnimBgPalette_GunkShot[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/gunk_shot.gbapal.lz"); +const u32 gBattleAnimBgPalette_GunkShot[] = INCBIN_U32("graphics/battle_anims/backgrounds/gunk_shot.gbapal.lz"); -const u32 gBattleAnimBgImage_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_cannon.4bpp.lz"); -const u32 gBattleAnimBgPalette_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_cannon.gbapal.lz"); -const u32 gBattleAnimBgTilemap_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_cannon.bin.lz"); +const u32 gBattleAnimBgImage_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_cannon.4bpp.lz"); +const u32 gBattleAnimBgPalette_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_cannon.gbapal.lz"); +const u32 gBattleAnimBgTilemap_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_cannon.bin.lz"); -const u32 gBattleAnimBgImage_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_pump.4bpp.lz"); -const u32 gBattleAnimBgPalette_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_pump.gbapal.lz"); -const u32 gBattleAnimBgTilemap_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hydro_pump.bin.lz"); +const u32 gBattleAnimBgImage_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_pump.4bpp.lz"); +const u32 gBattleAnimBgPalette_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_pump.gbapal.lz"); +const u32 gBattleAnimBgTilemap_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_pump.bin.lz"); -const u32 gBattleAnimBgPalette_HyperBeam[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hyper_beam.gbapal.lz"); +const u32 gBattleAnimBgPalette_HyperBeam[] = INCBIN_U32("graphics/battle_anims/backgrounds/hyper_beam.gbapal.lz"); -const u32 gBattleAnimBgPalette_HyperspaceFury[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hyperspace_fury.gbapal.lz"); +const u32 gBattleAnimBgPalette_HyperspaceFury[] = INCBIN_U32("graphics/battle_anims/backgrounds/hyperspace_fury.gbapal.lz"); -const u32 gBattleAnimBgImage_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/inferno_overdrive.4bpp.lz"); -const u32 gBattleAnimBgPalette_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/inferno_overdrive.gbapal.lz"); -const u32 gBattleAnimBgTilemap_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/inferno_overdrive.bin.lz"); +const u32 gBattleAnimBgImage_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/inferno_overdrive.4bpp.lz"); +const u32 gBattleAnimBgPalette_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/inferno_overdrive.gbapal.lz"); +const u32 gBattleAnimBgTilemap_InfernoOverdrive[] = INCBIN_U32("graphics/battle_anims/backgrounds/inferno_overdrive.bin.lz"); -const u32 gBattleAnimBgImage_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.4bpp.lz"); -const u32 gBattleAnimBgPalette_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.gbapal.lz"); -const u32 gBattleAnimBgTilemap_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.bin.lz"); +const u32 gBattleAnimBgImage_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/leaf_storm.4bpp.lz"); +const u32 gBattleAnimBgPalette_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/leaf_storm.gbapal.lz"); +const u32 gBattleAnimBgTilemap_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/leaf_storm.bin.lz"); -const u32 gBattleAnimBgImage_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.4bpp.lz"); -const u32 gBattleAnimBgPalette_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.gbapal.lz"); -const u32 gBattleAnimBgTilemap_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.bin.lz"); +const u32 gBattleAnimBgImage_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/malicious_moonsault.4bpp.lz"); +const u32 gBattleAnimBgPalette_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/malicious_moonsault.gbapal.lz"); +const u32 gBattleAnimBgTilemap_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/malicious_moonsault.bin.lz"); -const u32 gBattleAnimBgImage_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/max_lightning.4bpp.lz"); -const u32 gBattleAnimBgPalette_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/max_lightning.gbapal.lz"); -const u32 gBattleAnimBgTilemap_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/max_lightning.bin.lz"); +const u32 gBattleAnimBgImage_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/max_lightning.4bpp.lz"); +const u32 gBattleAnimBgPalette_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/max_lightning.gbapal.lz"); +const u32 gBattleAnimBgTilemap_MaxLightning[] = INCBIN_U32("graphics/battle_anims/backgrounds/max_lightning.bin.lz"); -const u32 gBattleAnimBgImage_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/misty_terrain.4bpp.lz"); -const u32 gBattleAnimBgPalette_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/misty_terrain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/misty_terrain.bin.lz"); +const u32 gBattleAnimBgImage_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/misty_terrain.4bpp.lz"); +const u32 gBattleAnimBgPalette_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/misty_terrain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_MistyTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/misty_terrain.bin.lz"); -const u32 gBattleAnimBgImage_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/neverending_nightmare.4bpp.lz"); -const u32 gBattleAnimBgPalette_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/neverending_nightmare.gbapal.lz"); -const u32 gBattleAnimBgTilemap_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/neverending_nightmare.bin.lz"); +const u32 gBattleAnimBgImage_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/neverending_nightmare.4bpp.lz"); +const u32 gBattleAnimBgPalette_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/neverending_nightmare.gbapal.lz"); +const u32 gBattleAnimBgTilemap_NeverendingNightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/neverending_nightmare.bin.lz"); -const u32 gBattleAnimBgImage_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/nightmare.4bpp.lz"); -const u32 gBattleAnimBgPalette_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/nightmare.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/nightmare.bin.lz"); +const u32 gBattleAnimBgImage_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/nightmare.4bpp.lz"); +const u32 gBattleAnimBgPalette_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/nightmare.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Nightmare[] = INCBIN_U32("graphics/battle_anims/backgrounds/nightmare.bin.lz"); -const u32 gBattleAnimBgPalette_PoisonFalls[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/poison_falls.gbapal.lz"); +const u32 gBattleAnimBgPalette_PoisonFalls[] = INCBIN_U32("graphics/battle_anims/backgrounds/poison_falls.gbapal.lz"); -const u32 gBattleAnimBgPalette_PsychicNew[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/psychic.gbapal.lz"); +const u32 gBattleAnimBgPalette_PsychicNew[] = INCBIN_U32("graphics/battle_anims/backgrounds/psychic_new.gbapal.lz"); -const u32 gBattleAnimBgImage_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/psychic_terrain.4bpp.lz"); -const u32 gBattleAnimBgPalette_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/psychic_terrain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/psychic_terrain.bin.lz"); +const u32 gBattleAnimBgImage_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/psychic_terrain.4bpp.lz"); +const u32 gBattleAnimBgPalette_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/psychic_terrain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_PsychicTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/psychic_terrain.bin.lz"); -const u32 gBattleAnimBgImage_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/shattered_psyche.4bpp.lz"); -const u32 gBattleAnimBgPalette_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/shattered_psyche.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/shattered_psyche.bin.lz"); +const u32 gBattleAnimBgImage_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/shattered_psyche.4bpp.lz"); +const u32 gBattleAnimBgPalette_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/shattered_psyche.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ShatteredPsyche[] = INCBIN_U32("graphics/battle_anims/backgrounds/shattered_psyche.bin.lz"); -const u32 gBattleAnimBgImage_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_day.4bpp.lz"); -const u32 gBattleAnimBgPalette_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_day.gbapal.lz"); -const u32 gBattleAnimBgTilemap_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_day.bin.lz"); +const u32 gBattleAnimBgImage_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_day.4bpp.lz"); +const u32 gBattleAnimBgPalette_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_day.gbapal.lz"); +const u32 gBattleAnimBgTilemap_SkyDay[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_day.bin.lz"); -const u32 gBattleAnimBgPalette_SkyAfternoon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_afternoon.gbapal.lz"); +const u32 gBattleAnimBgPalette_SkyAfternoon[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_afternoon.gbapal.lz"); -const u32 gBattleAnimBgPalette_SkyNight[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sky_night.gbapal.lz"); +const u32 gBattleAnimBgPalette_SkyNight[] = INCBIN_U32("graphics/battle_anims/backgrounds/sky_night.gbapal.lz"); -const u32 gBattleAnimBgImage_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/snuggle_forever.4bpp.lz"); -const u32 gBattleAnimBgPalette_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/snuggle_forever.gbapal.lz"); -const u32 gBattleAnimBgTilemap_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/snuggle_forever.bin.lz"); +const u32 gBattleAnimBgImage_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/snuggle_forever.4bpp.lz"); +const u32 gBattleAnimBgPalette_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/snuggle_forever.gbapal.lz"); +const u32 gBattleAnimBgTilemap_SnuggleForever[] = INCBIN_U32("graphics/battle_anims/backgrounds/snuggle_forever.bin.lz"); -const u32 gBattleAnimBgImage_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.4bpp.lz"); -const u32 gBattleAnimBgPalette_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.gbapal.lz"); -const u32 gBattleAnimBgTilemap_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/soulstealing_7star_strike.bin.lz"); +const u32 gBattleAnimBgImage_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/soulstealing_7star_strike.4bpp.lz"); +const u32 gBattleAnimBgPalette_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/soulstealing_7star_strike.gbapal.lz"); +const u32 gBattleAnimBgTilemap_SoulStealing7StarStrike[] = INCBIN_U32("graphics/battle_anims/backgrounds/soulstealing_7star_strike.bin.lz"); -const u32 gBattleAnimBgPalette_TectonicRage[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/tectonic_rage.gbapal.lz"); +const u32 gBattleAnimBgPalette_TectonicRage[] = INCBIN_U32("graphics/battle_anims/backgrounds/tectonic_rage.gbapal.lz"); -const u32 gBattleAnimBgImage_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.4bpp.lz"); -const u32 gBattleAnimBgPalette_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.gbapal.lz"); -const u32 gBattleAnimBgTilemap_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.bin.lz"); +const u32 gBattleAnimBgImage_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.4bpp.lz"); +const u32 gBattleAnimBgPalette_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.gbapal.lz"); +const u32 gBattleAnimBgTilemap_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.bin.lz"); -const u32 gBattleAnimBgPalette_MagicRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/magic_room.gbapal.lz"); +const u32 gBattleAnimBgPalette_MagicRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/magic_room.gbapal.lz"); -const u32 gBattleAnimBgPalette_WonderRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/wonder_room.gbapal.lz"); +const u32 gBattleAnimBgPalette_WonderRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/wonder_room.gbapal.lz"); -const u32 gBattleAnimBgImage_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.4bpp.lz"); -const u32 gBattleAnimBgPalette_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.gbapal.lz"); -const u32 gBattleAnimBgTilemap_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.bin.lz"); +const u32 gBattleAnimBgImage_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/twinkle_tackle.4bpp.lz"); +const u32 gBattleAnimBgPalette_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/twinkle_tackle.gbapal.lz"); +const u32 gBattleAnimBgTilemap_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/twinkle_tackle.bin.lz"); -const u32 gBattleAnimBgImage_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/water_pulse.4bpp.lz"); -const u32 gBattleAnimBgPalette_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/water_pulse.gbapal.lz"); -const u32 gBattleAnimBgTilemap_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/water_pulse.bin.lz"); +const u32 gBattleAnimBgImage_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/water_pulse.4bpp.lz"); +const u32 gBattleAnimBgPalette_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/water_pulse.gbapal.lz"); +const u32 gBattleAnimBgTilemap_WaterPulse[] = INCBIN_U32("graphics/battle_anims/backgrounds/water_pulse.bin.lz"); -const u32 gBattleAnimBgImage_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.4bpp.lz"); -const u32 gBattleAnimBgPalette_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.gbapal.lz"); -const u32 gBattleAnimBgTilemap_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.bin.lz"); +const u32 gBattleAnimBgImage_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/waterfall.4bpp.lz"); +const u32 gBattleAnimBgPalette_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/waterfall.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/waterfall.bin.lz"); -const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.gbapal.lz"); -const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.bin.lz"); +const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.gbapal.lz"); +const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.bin.lz"); -const u32 gBattleAnimBgImage_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.4bpp.lz"); -const u32 gBattleAnimBgPalette_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.bin.lz"); +const u32 gBattleAnimBgImage_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_activate.4bpp.lz"); +const u32 gBattleAnimBgPalette_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_activate.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_activate.bin.lz"); -const u32 gBattleAnimBgImage_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_mountain.4bpp.lz"); -const u32 gBattleAnimBgPalette_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_mountain.gbapal.lz"); -const u32 gBattleAnimBgTilemap_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_mountain.bin.lz"); +const u32 gBattleAnimBgImage_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_mountain.4bpp.lz"); +const u32 gBattleAnimBgPalette_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_mountain.gbapal.lz"); +const u32 gBattleAnimBgTilemap_ZMoveMountain[] = INCBIN_U32("graphics/battle_anims/backgrounds/zmove_mountain.bin.lz"); -const u32 gBattleAnimSpritePal_SteelBeam[] = INCBIN_U32("graphics/battle_anims/sprites/new/steel_beam.gbapal.lz"); -const u32 gBattleAnimBgPalette_SteelBeam[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/steel_beam_bg.gbapal.lz"); +const u32 gBattleAnimBgPalette_SteelBeam[] = INCBIN_U32("graphics/battle_anims/backgrounds/steel_beam.gbapal.lz"); // misc const u32 gBerryBlenderCenter_Gfx[] = INCBIN_U32("graphics/berry_blender/center.8bpp.lz"); From 2a8d2df6e71bb9f8fd6cb74f3e79dc636d7e5354 Mon Sep 17 00:00:00 2001 From: Blackforest92 Date: Sun, 4 Sep 2022 23:40:00 +0700 Subject: [PATCH 089/115] Fix minor oopsies of src/graphics.c - gBattleAnimSpritePal_PrimalParticles --- src/graphics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics.c b/src/graphics.c index 4a795a8b3e..a59d3a1616 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -43,8 +43,8 @@ const u32 gBattleAnimSpriteGfx_OmegaSymbol[] = INCBIN_U32("graphics/battle_anims const u32 gBattleAnimSpritePal_OmegaSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/omega_symbol.gbapal.lz"); const u32 gBattleAnimSpriteGfx_PrimalParticles[] = INCBIN_U32("graphics/battle_anims/sprites/primal_particles.4bpp.lz"); - const u32 gBattleAnimSpritePal_PrimalParticles[] = INCBIN_U32("graphics/battle_anims/sprites/primal_particles.gbapal.lz"); + const u32 gBattleAnimSpriteGfx_FlashCannonBall[] = INCBIN_U32("graphics/battle_anims/sprites/flash_cannon_ball.4bpp.lz"); const u32 gBattleAnimSpritePal_FlashCannonBall[] = INCBIN_U32("graphics/battle_anims/sprites/flash_cannon_ball.gbapal.lz"); From ce3dec43a7c0855f03ff74226f8169bba4a637df Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 4 Sep 2022 17:21:23 -0300 Subject: [PATCH 090/115] Fixed ball multiplier fallthroughs --- src/battle_script_commands.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 18fa5bbdff..7eebbff1c0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -13721,10 +13721,12 @@ static void Cmd_handleballthrow(void) { case ITEM_ULTRA_BALL: ballMultiplier = 20; + break; case ITEM_GREAT_BALL: case ITEM_SAFARI_BALL: case ITEM_SPORT_BALL: ballMultiplier = 15; + break; case ITEM_NET_BALL: if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_WATER) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_BUG)) #if B_NET_BALL_MODIFIER >= GEN_7 From 89550ed05d3377423f04285551f779ca7b0481c0 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 4 Sep 2022 18:54:23 -0300 Subject: [PATCH 091/115] Updated Sport Ball's modifier. --- include/constants/battle_config.h | 1 + src/battle_script_commands.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 89134daf91..d9e0abf104 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -130,6 +130,7 @@ #define B_LURE_BALL_MODIFIER GEN_7 // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3. #define B_HEAVY_BALL_MODIFIER GEN_7 // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow. #define B_DREAM_BALL_MODIFIER GEN_8 // In Gen8, Dream Ball's catch multiplier is x4 when the target is asleep or has the ability Comatose. +#define B_SPORT_BALL_MODIFIER GEN_8 // In Gen8, Sport Ball's catch multiplier was reduced from x1.5 to x1. #define B_SERENE_GRACE_BOOST GEN_7 // In Gen5+, Serene Grace boosts the added flinch chance of King's Rock and Razor Fang. // Flag settings diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7eebbff1c0..944255cfc9 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -13722,9 +13722,11 @@ static void Cmd_handleballthrow(void) case ITEM_ULTRA_BALL: ballMultiplier = 20; break; + #if B_SPORT_BALL_MODIFIER <= GEN_7 + case ITEM_SPORT_BALL: + #endif case ITEM_GREAT_BALL: case ITEM_SAFARI_BALL: - case ITEM_SPORT_BALL: ballMultiplier = 15; break; case ITEM_NET_BALL: From 2deabc2f367e82a0096be296bca85d64bbb1b390 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 5 Sep 2022 04:27:21 -0300 Subject: [PATCH 092/115] Quick update for GetBattleMonMoveSlot --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index c92d3690fc..12eeec4663 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7913,7 +7913,7 @@ u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move) { u8 i; - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { if (battleMon->moves[i] == move) break; From 6cab795c5c8f6e35992bee8689379461c50b8db1 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 5 Sep 2022 11:02:44 +0200 Subject: [PATCH 093/115] Update include/constants/overworld_config.h Co-authored-by: Eduardo Quezada D'Ottone --- include/constants/overworld_config.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/constants/overworld_config.h b/include/constants/overworld_config.h index 6d094d60f5..50f45933df 100644 --- a/include/constants/overworld_config.h +++ b/include/constants/overworld_config.h @@ -1,14 +1,18 @@ #ifndef GUARD_CONSTANTS_OVERWORLD_CONFIG_H #define GUARD_CONSTANTS_OVERWORLD_CONFIG_H +// Overworld flags +#define OW_FLAG_NO_ENCOUNTER 0 // If this flag is set, wild encounters will be disabled. +#define OW_FLAG_NO_TRAINER_SEE 0 // If this flag is set, trainers will not battle the player unless they're talked to. + // Debug options -#define DEBUG_SYSTEM_ENABLE TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by pressing R plus START. -#define DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (replaces the exit entry). +#define DEBUG_SYSTEM_ENABLE TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default. +#define DEBUG_SYSTEM_HELD_KEYS (R_BUTTON) // The keys required to be held to open the debug menu. +#define DEBUG_SYSTEM_TRIGGER_EVENT pressedStartButton // The event that opens the menu when holding the key(s) defined in DEBUG_SYSTEM_HELD_KEYS. +#define DEBUG_SYSTEM_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex). // Replace the used flags with others or disable with a 0 #define DEBUG_FLAG_NO_COLLISION 0 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. -#define DEBUG_FLAG_NO_ENCOUNTER 0 // If this flag is set, the debug function in the Utility submenu to disable wild encounters can be used. -#define DEBUG_FLAG_NO_TRAINER_SEE 0 // If this flag is set, the debug function in the Utility submenu to disable battles with trainer can be used. #define DEBUG_FLAG_PC_FROM_DEBUG_MENU 0 // If this flag is set, the debug function in debug menu to access the player PC works. #endif // GUARD_CONSTANTS_OVERWORLD_CONFIG_H From 0b3eddc9a4529d34debd2521b8d11dcdc2a38a96 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 5 Sep 2022 11:03:01 +0200 Subject: [PATCH 094/115] Update src/field_control_avatar.c Co-authored-by: Eduardo Quezada D'Ottone --- src/field_control_avatar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 76503a85a2..0494c52d81 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -132,10 +132,10 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) input->dpadDirection = DIR_EAST; #if DEBUG_SYSTEM_ENABLE == TRUE && DEBUG_SYSTEM_IN_MENU == FALSE - if ((heldKeys & R_BUTTON) && input->pressedStartButton) + if ((heldKeys & DEBUG_SYSTEM_HELD_KEYS) && input->DEBUG_SYSTEM_TRIGGER_EVENT) { input->input_field_1_2 = TRUE; - input->pressedStartButton = FALSE; + input->DEBUG_SYSTEM_TRIGGER_EVENT = FALSE; } #endif } From 57296dde71950e350b5354685c4c074043505cfc Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 5 Sep 2022 11:03:23 +0200 Subject: [PATCH 095/115] Update src/field_control_avatar.c Co-authored-by: Eduardo Quezada D'Ottone --- src/field_control_avatar.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 0494c52d81..d407cc0279 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -686,10 +686,8 @@ void RestartWildEncounterImmunitySteps(void) static bool8 CheckStandardWildEncounter(u16 metatileBehavior) { -#if DEBUG_SYSTEM_ENABLE == TRUE - if (FlagGet(DEBUG_FLAG_NO_ENCOUNTER)) + if (FlagGet(OW_FLAG_NO_ENCOUNTER)) return FALSE; -#endif if (sWildEncounterImmunitySteps < 4) { From 7696a78760016db2cd13a101cf5ca79576747583 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 5 Sep 2022 11:04:21 +0200 Subject: [PATCH 096/115] Update src/trainer_see.c Co-authored-by: Eduardo Quezada D'Ottone --- src/trainer_see.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/trainer_see.c b/src/trainer_see.c index b720a59d90..41534a55d8 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -192,10 +192,8 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; -#if DEBUG_SYSTEM_ENABLE == TRUE - if (FlagGet(DEBUG_FLAG_NO_TRAINER_SEE)) + if (FlagGet(OW_FLAG_NO_TRAINER_SEE)) return FALSE; -#endif gNoOfApproachingTrainers = 0; gApproachingTrainerId = 0; From 40e33799211c65e8b88fa97244733f728146e760 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 5 Sep 2022 11:15:18 +0200 Subject: [PATCH 097/115] removed music expansion songs, added newline, removed all weekday remains --- src/debug.c | 203 +--------------------------------------------------- 1 file changed, 2 insertions(+), 201 deletions(-) diff --git a/src/debug.c b/src/debug.c index f889ed5d29..9e8a9b5b89 100644 --- a/src/debug.c +++ b/src/debug.c @@ -78,7 +78,6 @@ enum { // Util 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, @@ -214,7 +213,6 @@ 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); -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); @@ -321,7 +319,6 @@ 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"); -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"); @@ -1161,14 +1158,6 @@ static void DebugAction_Util_SetWallClock(u8 taskId) LockPlayerFieldControls(); ScriptContext_SetupScript(PlayersHouse_2F_EventScript_SetWallClock); } -static void DebugAction_Util_CheckWeekDay(u8 taskId) -{ - //StringCopy(gStringVar4, GetDayOfWeekString(gLocalTime.dayOfWeek)); - Debug_DestroyMenu(taskId); - //LockPlayerFieldControls(); - //ScriptContext_SetupScript(Debug_ShowFieldMessageStringVar4); - ScriptContext_Enable(); -} static void DebugAction_Util_WatchCredits(u8 taskId) { struct Task* task = &gTasks[taskId]; @@ -2212,7 +2201,7 @@ static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId) gTasks[taskId].data[3] = 0; } - while (GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3] - i) == ABILITY_NONE) + while (GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3] - i) == ABILITY_NONE && gTasks[taskId].data[3] - i < NUM_ABILITY_SLOTS) { i++; } @@ -3060,194 +3049,6 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId) 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") \ @@ -3595,4 +3396,4 @@ SOUND_LIST_SE }; #undef X -#endif \ No newline at end of file +#endif From f6d111d0c7f994597f3a5243f16da7d6ef3ddab7 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Mon, 5 Sep 2022 11:17:21 +0200 Subject: [PATCH 098/115] Update src/debug.c Co-authored-by: Eduardo Quezada D'Ottone --- src/debug.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index 9e8a9b5b89..4cc1ac6168 100644 --- a/src/debug.c +++ b/src/debug.c @@ -128,7 +128,6 @@ enum { //Sound DEBUG_SOUND_MENU_ITEM_MUS, }; - // ******************************* // Constants #define DEBUG_MAIN_MENU_WIDTH 15 From 7dabd903cef19c03056a38d9571e26b600f93e5b Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-K1J86FD\\Owner" Date: Mon, 5 Sep 2022 12:07:38 -0400 Subject: [PATCH 099/115] v -> STATUS4_WATER_SPORT (applicable to Gens 3-5) --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 18fa5bbdff..ddc502c00d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -13476,7 +13476,7 @@ static void Cmd_settypebasedhalvers(void) #else if (!(gStatuses4[gBattlerAttacker] & STATUS4_WATER_SPORT)) { - gStatuses4[gBattlerAttacker] |= v; + gStatuses4[gBattlerAttacker] |= STATUS4_WATER_SPORT; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_FIRE; worked = TRUE; } From e253a87bc5c8a235b579383fac25f9f08f56da33 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 5 Sep 2022 14:49:14 -0400 Subject: [PATCH 100/115] Consolidated Gen constants into config.h, with a new const called GEN_LATEST, to help edit all at once. --- data/battle_anim_scripts.s | 1 + data/battle_scripts_1.s | 1 + include/config.h | 9 ++ include/constants/battle_config.h | 241 ++++++++++++++--------------- include/constants/item_config.h | 21 +-- include/constants/pokemon_config.h | 29 ++-- 6 files changed, 143 insertions(+), 159 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 47e9216422..9ca1c96655 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1,3 +1,4 @@ +#include "config.h" #include "constants/battle.h" #include "constants/battle_anim.h" #include "constants/rgb.h" diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index e3d4c89430..f1e72e8aa2 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1,3 +1,4 @@ +#include "config.h" #include "constants/global.h" #include "constants/battle.h" #include "constants/pokemon.h" diff --git a/include/config.h b/include/config.h index d4a71c0766..d6c60a2fa8 100644 --- a/include/config.h +++ b/include/config.h @@ -44,4 +44,13 @@ #define POKEMON_EXPANSION #define ITEM_EXPANSION +// Generation constants used in configs to define behavior +#define GEN_3 0 +#define GEN_4 1 +#define GEN_5 2 +#define GEN_6 3 +#define GEN_7 4 +#define GEN_8 5 +#define GEN_LATEST GEN_8 + #endif // GUARD_CONFIG_H diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index d85f5e4373..c2715fbaeb 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -1,135 +1,126 @@ #ifndef GUARD_CONSTANTS_BATTLE_CONFIG_H #define GUARD_CONSTANTS_BATTLE_CONFIG_H -#ifndef GEN_3 - #define GEN_3 0 - #define GEN_4 1 - #define GEN_5 2 - #define GEN_6 3 - #define GEN_7 4 - #define GEN_8 5 -#endif - // Calculation settings -#define B_CRIT_CHANCE GEN_7 // Chances of a critical hit landing. See CalcCritChanceStage. Gen6+ chances guarantee that Farfetch'd and Sirfetch'd always get critical hits while holding a Leek and using high-crit ratio moves. -#define B_CRIT_MULTIPLIER GEN_7 // In Gen6+, critical hits multiply damage by 1.5 instead of 2. -#define B_PARALYSIS_SPEED GEN_7 // In Gen7+, Speed is decreased by 50% instead of 75%. -#define B_CONFUSION_SELF_DMG_CHANCE GEN_7 // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%. -#define B_MULTI_HIT_CHANCE GEN_7 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. -#define B_WHITEOUT_MONEY GEN_7 // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.) +#define B_CRIT_CHANCE GEN_LATEST // Chances of a critical hit landing. See CalcCritChanceStage. Gen6+ chances guarantee that Farfetch'd and Sirfetch'd always get critical hits while holding a Leek and using high-crit ratio moves. +#define B_CRIT_MULTIPLIER GEN_LATEST // In Gen6+, critical hits multiply damage by 1.5 instead of 2. +#define B_PARALYSIS_SPEED GEN_LATEST // In Gen7+, Speed is decreased by 50% instead of 75%. +#define B_CONFUSION_SELF_DMG_CHANCE GEN_LATEST // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%. +#define B_MULTI_HIT_CHANCE GEN_LATEST // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. +#define B_WHITEOUT_MONEY GEN_LATEST // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.) // Exp and stat settings -#define B_EXP_CATCH GEN_7 // In Gen6+, Pokémon get experience from catching. -#define B_TRAINER_EXP_MULTIPLIER GEN_7 // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain. -#define B_SPLIT_EXP GEN_7 // In Gen6+, all participating mon get full experience. -#define B_SCALED_EXP GEN_7 // In Gen5 and Gen7+, experience is weighted by level difference. -#define B_BADGE_BOOST GEN_7 // In Gen4+, Gym Badges no longer boost a Pokémon's stats. -#define B_MAX_LEVEL_EV_GAINS GEN_7 // In Gen5+, Lv100 Pokémon can obtain Effort Values normally. -#define B_RECALCULATE_STATS GEN_7 // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle. +#define B_EXP_CATCH GEN_LATEST // In Gen6+, Pokémon get experience from catching. +#define B_TRAINER_EXP_MULTIPLIER GEN_LATEST // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain. +#define B_SPLIT_EXP GEN_LATEST // In Gen6+, all participating mon get full experience. +#define B_SCALED_EXP GEN_LATEST // In Gen5 and Gen7+, experience is weighted by level difference. +#define B_BADGE_BOOST GEN_LATEST // In Gen4+, Gym Badges no longer boost a Pokémon's stats. +#define B_MAX_LEVEL_EV_GAINS GEN_LATEST // In Gen5+, Lv100 Pokémon can obtain Effort Values normally. +#define B_RECALCULATE_STATS GEN_LATEST // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle. // Damage settings -#define B_BURN_DAMAGE GEN_7 // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th. -#define B_BURN_FACADE_DMG GEN_7 // In Gen6+, burn's effect of lowering the Attack stat no longer applies to Facade. -#define B_BINDING_DAMAGE GEN_7 // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.) -#define B_PSYWAVE_DMG GEN_7 // Psywave's damage formula. See Cmd_psywavedamageeffect. -#define B_PAYBACK_SWITCH_BOOST GEN_7 // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled. -#define B_HIDDEN_POWER_DMG GEN_7 // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs. -#define B_ROUGH_SKIN_DMG GEN_7 // In Gen4+, Rough Skin contact damage is 1/8th of max HP instead of 1/16th. This will also affect Iron Barbs. -#define B_KNOCK_OFF_DMG GEN_8 // In Gen6+, Knock Off deals 50% more damage when knocking off an item. -#define B_SPORT_DMG_REDUCTION GEN_7 // In Gen5+, Water/Mud Sport reduce Fire/Electric Damage by 67% instead of 50%. -#define B_EXPLOSION_DEFENSE GEN_7 // In Gen5+, Self-Destruct and Explosion don't halve the targets' defense. +#define B_BURN_DAMAGE GEN_LATEST // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th. +#define B_BURN_FACADE_DMG GEN_LATEST // In Gen6+, burn's effect of lowering the Attack stat no longer applies to Facade. +#define B_BINDING_DAMAGE GEN_LATEST // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.) +#define B_PSYWAVE_DMG GEN_LATEST // Psywave's damage formula. See Cmd_psywavedamageeffect. +#define B_PAYBACK_SWITCH_BOOST GEN_LATEST // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled. +#define B_HIDDEN_POWER_DMG GEN_LATEST // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs. +#define B_ROUGH_SKIN_DMG GEN_LATEST // In Gen4+, Rough Skin contact damage is 1/8th of max HP instead of 1/16th. This will also affect Iron Barbs. +#define B_KNOCK_OFF_DMG GEN_LATEST // In Gen6+, Knock Off deals 50% more damage when knocking off an item. +#define B_SPORT_DMG_REDUCTION GEN_LATEST // In Gen5+, Water/Mud Sport reduce Fire/Electric Damage by 67% instead of 50%. +#define B_EXPLOSION_DEFENSE GEN_LATEST // In Gen5+, Self-Destruct and Explosion don't halve the targets' defense. // Type settings -#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. -#define B_PARALYZE_ELECTRIC GEN_7 // In Gen6+, Electric-type Pokémon can't be paralyzed. -#define B_POWDER_GRASS GEN_7 // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. -#define B_STEEL_RESISTANCES GEN_7 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves. -#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon. -#define B_SHEER_COLD_IMMUNITY GEN_7 // In Gen7+, Ice-types are immune to Sheer Cold +#define B_GHOSTS_ESCAPE GEN_LATEST // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. +#define B_PARALYZE_ELECTRIC GEN_LATEST // In Gen6+, Electric-type Pokémon can't be paralyzed. +#define B_POWDER_GRASS GEN_LATEST // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. +#define B_STEEL_RESISTANCES GEN_LATEST // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves. +#define B_PRANKSTER_DARK_TYPES GEN_LATEST // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon. +#define B_SHEER_COLD_IMMUNITY GEN_LATEST // In Gen7+, Ice-types are immune to Sheer Cold // Turn settings -#define B_BINDING_TURNS GEN_7 // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.) -#define B_UPROAR_TURNS GEN_7 // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns. -#define B_DISABLE_TURNS GEN_7 // Disable's turns. See Cmd_disablelastusedattack. -#define B_TAILWIND_TURNS GEN_7 // In Gen5+, Tailwind lasts 4 turns instead of 3. -#define B_SLEEP_TURNS GEN_7 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns. -#define B_TAUNT_TURNS GEN_7 // In Gen5+, Taunt lasts 3 turns if the user acts before the target, or 4 turns if the target acted before the user. In Gen3, taunt lasts 2 turns and in Gen 4, 3-5 turns. -#define B_SPORT_TURNS GEN_7 // In Gen6+, Water/Mud Sport last 5 turns, even if the user switches out. -#define B_MEGA_EVO_TURN_ORDER GEN_7 // In Gen7, a Pokémon's Speed after Mega Evolution is used to determine turn order, not its Speed before. -#define B_RECALC_TURN_AFTER_ACTIONS GEN_8 // In Gen8, switching/using a move affects the current turn's order of actions. -#define B_FAINT_SWITCH_IN GEN_7 // In Gen4+, sending out a new Pokémon after the previous one fainted happens at the end of the turn. Before, it would happen after each action. +#define B_BINDING_TURNS GEN_LATEST // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.) +#define B_UPROAR_TURNS GEN_LATEST // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns. +#define B_DISABLE_TURNS GEN_LATEST // Disable's turns. See Cmd_disablelastusedattack. +#define B_TAILWIND_TURNS GEN_LATEST // In Gen5+, Tailwind lasts 4 turns instead of 3. +#define B_SLEEP_TURNS GEN_LATEST // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns. +#define B_TAUNT_TURNS GEN_LATEST // In Gen5+, Taunt lasts 3 turns if the user acts before the target, or 4 turns if the target acted before the user. In Gen3, taunt lasts 2 turns and in Gen 4, 3-5 turns. +#define B_SPORT_TURNS GEN_LATEST // In Gen6+, Water/Mud Sport last 5 turns, even if the user switches out. +#define B_MEGA_EVO_TURN_ORDER GEN_LATEST // In Gen7, a Pokémon's Speed after Mega Evolution is used to determine turn order, not its Speed before. +#define B_RECALC_TURN_AFTER_ACTIONS GEN_LATEST // In Gen8, switching/using a move affects the current turn's order of actions. +#define B_FAINT_SWITCH_IN GEN_LATEST // In Gen4+, sending out a new Pokémon after the previous one fainted happens at the end of the turn. Before, it would happen after each action. // Move data settings -#define B_UPDATED_MOVE_DATA GEN_8 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc. -#define B_PHYSICAL_SPECIAL_SPLIT GEN_7 // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this. -#define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing. -#define B_KLUTZ_FLING_INTERACTION GEN_7 // In Gen5+, Pokémon with the Klutz ability can't use Fling. -#define B_UPDATED_CONVERSION GEN_7 // In Gen6+, Conversion changes the user's type to match their first move's. Before, it would choose a move at random. -#define B_PP_REDUCED_BY_SPITE GEN_7 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5. +#define B_UPDATED_MOVE_DATA GEN_LATEST // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc. +#define B_PHYSICAL_SPECIAL_SPLIT GEN_LATEST // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this. +#define B_RECOIL_IF_MISS_DMG GEN_LATEST // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing. +#define B_KLUTZ_FLING_INTERACTION GEN_LATEST // In Gen5+, Pokémon with the Klutz ability can't use Fling. +#define B_UPDATED_CONVERSION GEN_LATEST // In Gen6+, Conversion changes the user's type to match their first move's. Before, it would choose a move at random. +#define B_PP_REDUCED_BY_SPITE GEN_LATEST // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5. // Move accuracy settings -#define B_TOXIC_NEVER_MISS GEN_7 // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss. -#define B_MINIMIZE_DMG_ACC GEN_7 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks. -#define B_BLIZZARD_HAIL GEN_7 // In Gen4+, Blizzard bypasses accuracy checks if it's hailing. -#define B_SHEER_COLD_ACC GEN_7 // In Gen7+, Sheer Cold's base chance of hitting is reduced to 20% if the user isn't Ice-typed. +#define B_TOXIC_NEVER_MISS GEN_LATEST // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss. +#define B_MINIMIZE_DMG_ACC GEN_LATEST // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks. +#define B_BLIZZARD_HAIL GEN_LATEST // In Gen4+, Blizzard bypasses accuracy checks if it's hailing. +#define B_SHEER_COLD_ACC GEN_LATEST // In Gen7+, Sheer Cold's base chance of hitting is reduced to 20% if the user isn't Ice-typed. // Move stat change settings -#define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. -#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen8+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. -#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage. -#define B_CHARGE_SPDEF_RAISE GEN_7 // In Gen5+, Charge raises the user's Special Defense by 1 stage. -#define B_MINIMIZE_EVASION GEN_7 // In Gen5+, Minimize raises evasion by 2 stages instead of 1. -#define B_GROWTH_STAT_RAISE GEN_7 // In Gen5+, Growth raises Attack in addition to Special Attack by 1 stage each. Under the effects of the sun, it raises them by 2 stages each instead. +#define B_FELL_STINGER_STAT_RAISE GEN_LATEST // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. +#define B_KINGS_SHIELD_LOWER_ATK GEN_LATEST // In Gen8+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. +#define B_SPEED_BUFFING_RAPID_SPIN GEN_LATEST // In Gen8, Rapid Spin raises the user's Speed by 1 stage. +#define B_CHARGE_SPDEF_RAISE GEN_LATEST // In Gen5+, Charge raises the user's Special Defense by 1 stage. +#define B_MINIMIZE_EVASION GEN_LATEST // In Gen5+, Minimize raises evasion by 2 stages instead of 1. +#define B_GROWTH_STAT_RAISE GEN_LATEST // In Gen5+, Growth raises Attack in addition to Special Attack by 1 stage each. Under the effects of the sun, it raises them by 2 stages each instead. // Other move settings -#define B_SOUND_SUBSTITUTE GEN_7 // In Gen6+, sound moves bypass Substitute. -#define B_INCINERATE_GEMS GEN_7 // In Gen6+, Incinerate can destroy Gems. -#define B_CAN_SPITE_FAIL GEN_7 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP. -#define B_CRASH_IF_TARGET_IMMUNE GEN_7 // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move. -#define B_MEMENTO_FAIL GEN_7 // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6. -#define B_GLARE_GHOST GEN_7 // In Gen4+, Glare can hit Ghost-type Pokémon normally. -#define B_SKILL_SWAP GEN_7 // In Gen4+, Skill Swap triggers switch-in abilities after use. -#define B_BRICK_BREAK GEN_7 // In Gen4+, you can destroy your own side's screens. In Gen 5+, screens are not removed if the target is immune. -#define B_WISH_HP_SOURCE GEN_7 // In Gen5+, Wish heals half of the user's max HP instead of the target's. -#define B_RAMPAGE_CANCELLING GEN_7 // In Gen5+, a failed Thrash, etc, will cancel except on its last turn. -#define B_HEAL_BLOCKING GEN_7 // In Gen5+, Heal Block prevents healing by Black Sludge, Leftovers, Shell Bell. Affected Pokémon will not consume held HP-restoring Berries or Berry Juice. - // Draining abilities will not heal but will prevent damage. In Gen6+, Heal Block prevents the use of most HP-draining moves. -#define B_ROOTED_GROUNDING GEN_7 // In Gen4+, Ingrain causes the affected Pokémon to become grounded. +#define B_SOUND_SUBSTITUTE GEN_LATEST // In Gen6+, sound moves bypass Substitute. +#define B_INCINERATE_GEMS GEN_LATEST // In Gen6+, Incinerate can destroy Gems. +#define B_CAN_SPITE_FAIL GEN_LATEST // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP. +#define B_CRASH_IF_TARGET_IMMUNE GEN_LATEST // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move. +#define B_MEMENTO_FAIL GEN_LATEST // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6. +#define B_GLARE_GHOST GEN_LATEST // In Gen4+, Glare can hit Ghost-type Pokémon normally. +#define B_SKILL_SWAP GEN_LATEST // In Gen4+, Skill Swap triggers switch-in abilities after use. +#define B_BRICK_BREAK GEN_LATEST // In Gen4+, you can destroy your own side's screens. In Gen 5+, screens are not removed if the target is immune. +#define B_WISH_HP_SOURCE GEN_LATEST // In Gen5+, Wish heals half of the user's max HP instead of the target's. +#define B_RAMPAGE_CANCELLING GEN_LATEST // In Gen5+, a failed Thrash, etc, will cancel except on its last turn. +#define B_HEAL_BLOCKING GEN_LATEST // In Gen5+, Heal Block prevents healing by Black Sludge, Leftovers, Shell Bell. Affected Pokémon will not consume held HP-restoring Berries or Berry Juice. + // Draining abilities will not heal but will prevent damage. In Gen6+, Heal Block prevents the use of most HP-draining moves. +#define B_ROOTED_GROUNDING GEN_LATEST // In Gen4+, Ingrain causes the affected Pokémon to become grounded. // Ability settings -#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. -#define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. -#define B_GALE_WINGS GEN_7 // In Gen7+ requires full HP to trigger. -#define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. -#define B_SHADOW_TAG_ESCAPE GEN_7 // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation. -#define B_MOODY_ACC_EVASION GEN_8 // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. -#define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. -#define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. -#define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. -#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled. -#define B_OBLIVIOUS_TAUNT GEN_7 // In Gen6+, Pokémon with Oblivious can't be taunted. -#define B_STURDY GEN_7 // In Gen5+, Sturdy causes the Pokémon to have 1 HP remaining if another Pokémon's attack or confusion damage would have brought it from full health to 0 HP. -#define B_PLUS_MINUS_INTERACTION GEN_7 // In Gen5+, Plus and Minus can be activated with themselves and the opposite ability. Before, only the opposing ability could activate it. +#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. +#define B_ABILITY_WEATHER GEN_LATEST // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. +#define B_GALE_WINGS GEN_LATEST // In Gen7+ requires full HP to trigger. +#define B_STANCE_CHANGE_FAIL GEN_LATEST // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. +#define B_SHADOW_TAG_ESCAPE GEN_LATEST // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation. +#define B_MOODY_ACC_EVASION GEN_LATEST // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. +#define B_FLASH_FIRE_FROZEN GEN_LATEST // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. +#define B_SYNCHRONIZE_NATURE GEN_LATEST // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. +#define B_SYNCHRONIZE_TOXIC GEN_LATEST // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. +#define B_UPDATED_INTIMIDATE GEN_LATEST // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled. +#define B_OBLIVIOUS_TAUNT GEN_LATEST // In Gen6+, Pokémon with Oblivious can't be taunted. +#define B_STURDY GEN_LATEST // In Gen5+, Sturdy causes the Pokémon to have 1 HP remaining if another Pokémon's attack or confusion damage would have brought it from full health to 0 HP. +#define B_PLUS_MINUS_INTERACTION GEN_LATEST // In Gen5+, Plus and Minus can be activated with themselves and the opposite ability. Before, only the opposing ability could activate it. // Item settings -#define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. -#define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end. -#define B_CONFUSE_BERRIES_HEAL GEN_8 // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP. -#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. -#define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before. -#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. -#define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. -#define B_NET_BALL_MODIFIER GEN_7 // In Gen7+, Net Ball's catch multiplier is x5 instead of x3. -#define B_DIVE_BALL_MODIFIER GEN_7 // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing. -#define B_NEST_BALL_MODIFIER GEN_7 // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow. -#define B_REPEAT_BALL_MODIFIER GEN_7 // In Gen7+, Repeat Ball's catch multiplier is x3.5 instead of x3. -#define B_TIMER_BALL_MODIFIER GEN_7 // In Gen5+, Timer Ball's effectiveness increases by x0.3 per turn instead of x0.1 -#define B_DUSK_BALL_MODIFIER GEN_7 // In Gen7+, Dusk Ball's catch multiplier is x3 instead of x3.5. -#define B_QUICK_BALL_MODIFIER GEN_7 // In Gen5+, Quick Ball's catch multiplier is x5 instead of x4. -#define B_LURE_BALL_MODIFIER GEN_7 // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3. -#define B_HEAVY_BALL_MODIFIER GEN_7 // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow. -#define B_DREAM_BALL_MODIFIER GEN_8 // In Gen8, Dream Ball's catch multiplier is x4 when the target is asleep or has the ability Comatose. -#define B_SERENE_GRACE_BOOST GEN_7 // In Gen5+, Serene Grace boosts the added flinch chance of King's Rock and Razor Fang. +#define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. +#define B_BERRIES_INSTANT GEN_LATEST // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end. +#define B_CONFUSE_BERRIES_HEAL GEN_LATEST // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP. +#define B_X_ITEMS_BUFF GEN_LATEST // In Gen7+, the X Items raise a stat by 2 stages instead of 1. +#define B_MENTAL_HERB GEN_LATEST // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before. +#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. +#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. +#define B_NET_BALL_MODIFIER GEN_LATEST // In Gen7+, Net Ball's catch multiplier is x5 instead of x3. +#define B_DIVE_BALL_MODIFIER GEN_LATEST // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing. +#define B_NEST_BALL_MODIFIER GEN_LATEST // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow. +#define B_REPEAT_BALL_MODIFIER GEN_LATEST // In Gen7+, Repeat Ball's catch multiplier is x3.5 instead of x3. +#define B_TIMER_BALL_MODIFIER GEN_LATEST // In Gen5+, Timer Ball's effectiveness increases by x0.3 per turn instead of x0.1 +#define B_DUSK_BALL_MODIFIER GEN_LATEST // In Gen7+, Dusk Ball's catch multiplier is x3 instead of x3.5. +#define B_QUICK_BALL_MODIFIER GEN_LATEST // In Gen5+, Quick Ball's catch multiplier is x5 instead of x4. +#define B_LURE_BALL_MODIFIER GEN_LATEST // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3. +#define B_HEAVY_BALL_MODIFIER GEN_LATEST // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow. +#define B_DREAM_BALL_MODIFIER GEN_LATEST // In Gen8, Dream Ball's catch multiplier is x4 when the target is asleep or has the ability Comatose. +#define B_SERENE_GRACE_BOOST GEN_LATEST // In Gen5+, Serene Grace boosts the added flinch chance of King's Rock and Razor Fang. // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. @@ -145,13 +136,13 @@ #define B_VAR_WILD_AI_FLAGS 0 // If not 0, you can use this var to add to default wild AI flags. NOT usable with flags above (1 << 15) // Terrain settings -#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. -#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. -#define B_TERRAIN_TYPE_BOOST GEN_8 // In Gen8, damage is boosted by 30% instead of 50%. -#define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect. -#define B_SECRET_POWER_ANIMATION GEN_7 // Secret Power's animations change depending on terrain and generation. -#define B_NATURE_POWER_MOVES GEN_8 // Nature Power calls different moves depending on terrain and generation. See sNaturePowerMoves. -#define B_CAMOUFLAGE_TYPES GEN_7 // Camouflage changes the user to different types depending on terrain and generation. See sTerrainToType. +#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. +#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. +#define B_TERRAIN_TYPE_BOOST GEN_LATEST // In Gen8, damage is boosted by 30% instead of 50%. +#define B_SECRET_POWER_EFFECT GEN_LATEST // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect. +#define B_SECRET_POWER_ANIMATION GEN_LATEST // Secret Power's animations change depending on terrain and generation. +#define B_NATURE_POWER_MOVES GEN_LATEST // Nature Power calls different moves depending on terrain and generation. See sNaturePowerMoves. +#define B_CAMOUFLAGE_TYPES GEN_LATEST // Camouflage changes the user to different types depending on terrain and generation. See sTerrainToType. // Interface settings #define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle. @@ -163,18 +154,18 @@ #define B_EXPANDED_MOVE_NAMES FALSE // If set to TRUE, move names are increased from 12 characters to 16 characters. // Catching settings -#define B_SEMI_INVULNERABLE_CATCH GEN_7 // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) -#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. -#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. -#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented -#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. +#define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) +#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. +#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. +#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented +#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. // Other settings -#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. -#define B_MULTI_BATTLE_WHITEOUT GEN_8 // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. -#define B_EVOLUTION_AFTER_WHITEOUT GEN_6 // In Gen6+, Pokemon that qualify for evolution after battle will evolve even if the player loses. -#define B_WILD_NATURAL_ENEMIES TRUE // If set to TRUE, certain wild mon species will attack other species when partnered in double wild battles (eg. Zangoose vs Seviper) -#define B_AFFECTION_MECHANICS FALSE // In Gen6+, there's a stat called affection that can trigger different effects in battle. From LGPE onwards, those effects use friendship instead. +#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. +#define B_MULTI_BATTLE_WHITEOUT GEN_LATEST // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. +#define B_EVOLUTION_AFTER_WHITEOUT GEN_LATEST // In Gen6+, Pokemon that qualify for evolution after battle will evolve even if the player loses. +#define B_WILD_NATURAL_ENEMIES TRUE // If set to TRUE, certain wild mon species will attack other species when partnered in double wild battles (eg. Zangoose vs Seviper) +#define B_AFFECTION_MECHANICS FALSE // In Gen6+, there's a stat called affection that can trigger different effects in battle. From LGPE onwards, those effects use friendship instead. // Animation Settings #define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle. diff --git a/include/constants/item_config.h b/include/constants/item_config.h index 70b4440c84..9261241a5f 100644 --- a/include/constants/item_config.h +++ b/include/constants/item_config.h @@ -1,21 +1,12 @@ #ifndef GUARD_CONSTANTS_ITEM_CONFIG_H #define GUARD_CONSTANTS_ITEM_CONFIG_H -#ifndef GEN_3 -#define GEN_3 0 -#define GEN_4 1 -#define GEN_5 2 -#define GEN_6 3 -#define GEN_7 4 -#define GEN_8 5 -#endif - // Item config -#define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects. -#define I_KEY_FOSSILS GEN_7 // In Gen4+, all Gen 3 fossils became regular items. -#define I_KEY_ESCAPE_ROPE GEN_7 // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. -#define I_HEALTH_RECOVERY GEN_7 // In Gen7+, certain healing items recover a different amount of HP than they used to. -#define I_SITRUS_BERRY_HEAL GEN_7 // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP. -#define I_VITAMIN_EV_CAP GEN_8 // In Gen8, the Vitamins no longer have a cap of 100 EV per stat. +#define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects. +#define I_KEY_FOSSILS GEN_LATEST // In Gen4+, all Gen 3 fossils became regular items. +#define I_KEY_ESCAPE_ROPE GEN_LATEST // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. +#define I_HEALTH_RECOVERY GEN_LATEST // In Gen7+, certain healing items recover a different amount of HP than they used to. +#define I_SITRUS_BERRY_HEAL GEN_LATEST // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP. +#define I_VITAMIN_EV_CAP GEN_LATEST // In Gen8, the Vitamins no longer have a cap of 100 EV per stat. #endif // GUARD_CONSTANTS_ITEM_CONFIG_H diff --git a/include/constants/pokemon_config.h b/include/constants/pokemon_config.h index 879b755641..40acd8c808 100644 --- a/include/constants/pokemon_config.h +++ b/include/constants/pokemon_config.h @@ -1,26 +1,17 @@ #ifndef GUARD_CONSTANTS_POKEMON_CONFIG_H #define GUARD_CONSTANTS_POKEMON_CONFIG_H -#ifndef GEN_3 -#define GEN_3 0 -#define GEN_4 1 -#define GEN_5 2 -#define GEN_6 3 -#define GEN_7 4 -#define GEN_8 5 -#endif +#define P_UPDATED_TYPES GEN_LATEST // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type. +#define P_UPDATED_STATS GEN_LATEST // Since Gen 6, Pokémon stats are updated with each passing generation. +#define P_UPDATED_ABILITIES GEN_LATEST // Since Gen 6, certain Pokémon have their abilities changed. +#define P_UPDATED_EGG_GROUPS GEN_LATEST // Since Gen 8, certain Pokémon have gained new egg groups. +#define P_SHEDINJA_BALL GEN_LATEST // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball. +#define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs. +#define P_KADABRA_EVERSTONE GEN_LATEST // Since Gen 4, Kadabra can evolve even when holding an Everstone. +#define P_NIDORAN_M_DITTO_BREED GEN_LATEST // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat. -#define P_UPDATED_TYPES GEN_8 // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type. -#define P_UPDATED_STATS GEN_8 // Since Gen 6, Pokémon stats are updated with each passing generation. -#define P_UPDATED_ABILITIES GEN_8 // Since Gen 6, certain Pokémon have their abilities changed. -#define P_UPDATED_EGG_GROUPS GEN_8 // Since Gen 8, certain Pokémon have gained new egg groups. -#define P_SHEDINJA_BALL GEN_8 // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball. -#define P_LEGENDARY_PERFECT_IVS GEN_8 // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs. -#define P_KADABRA_EVERSTONE GEN_8 // Since Gen 4, Kadabra can evolve even when holding an Everstone. -#define P_NIDORAN_M_DITTO_BREED GEN_8 // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat. +#define P_NEW_POKEMON TRUE // Turning this to FALSE will remove all newly added Pokémon and Forms. Only Unown, Castform and Deoxys forms will remain. -#define P_NEW_POKEMON TRUE // Turning this to FALSE will remove all newly added Pokémon and Forms. Only Unown, Castform and Deoxys forms will remain. - -#define P_ENABLE_DEBUG TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen. +#define P_ENABLE_DEBUG TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen. #endif // GUARD_CONSTANTS_POKEMON_CONFIG_H From cb97f93ef607d8398c81ef6a3f3f3654a1565f10 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 5 Sep 2022 14:49:40 -0400 Subject: [PATCH 101/115] Fixed B_SHADOW_TAG_ESCAPE use for Gen 3 config --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 1472c50bf0..4ea11d93f5 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6055,7 +6055,7 @@ u32 IsAbilityPreventingEscape(u32 battlerId) #if B_SHADOW_TAG_ESCAPE >= GEN_4 if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG) #else - if (id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) + if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG))) #endif return id; if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_ARENA_TRAP)) && IsBattlerGrounded(battlerId)) From bb290d5ab0f0e27466a71078a4f8b75f135863c4 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 1 Sep 2022 14:57:58 -0300 Subject: [PATCH 102/115] Updates -Removed the pointless param1 setting in sXerneasFormChangeTable -Updated the descriptions of Behemoth Blade and Behemoth Bash -Added a new parameter to the struct FormChange -Allowed FORM_BATTLE_BEGIN and FORM_BATTLE_END to replace a move through a new function called "TryToSetBattleFormChangeMoves". -Added missing calls to "CalculateMonStats". -Renamed BoxPokemon pointer in GetFormChangeTargetSpeciesBoxMon for consistency's sake -Optimized check inside UndoFormChange (even though the plan is to get rid of that func entirely.) Special thanks to Blecoutre who fixed my TryToSetBattleFormChangeMoves function. It just wasn't working correctly at all. --- include/pokemon.h | 5 ++- src/battle_main.c | 8 ++++ src/battle_util.c | 15 +++---- src/data/pokemon/form_change_tables.h | 16 ++++--- src/data/text/move_descriptions.h | 8 ++-- src/pokemon.c | 62 ++++++++++++++++++++++----- 6 files changed, 83 insertions(+), 31 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index c05628a598..9ebaa52a0d 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -366,11 +366,13 @@ struct Evolution u16 targetSpecies; }; -struct FormChange { +struct FormChange +{ u16 method; u16 targetSpecies; u16 param1; u16 param2; + u16 param3; }; #define NUM_UNOWN_FORMS 28 @@ -559,5 +561,6 @@ u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg); u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg); u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove); bool32 ShouldShowFemaleDifferences(u16 species, u32 personality); +void TryToSetBattleFormChangeMoves(struct Pokemon *mon); #endif // GUARD_POKEMON_H diff --git a/src/battle_main.c b/src/battle_main.c index f75a7ae80b..84af5ae748 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -578,11 +578,19 @@ static void CB2_InitBattleInternal(void) // Player's side targetSpecies = GetFormChangeTargetSpecies(&gPlayerParty[i], FORM_BATTLE_BEGIN, 0); if (targetSpecies != SPECIES_NONE) + { SetMonData(&gPlayerParty[i], MON_DATA_SPECIES, &targetSpecies); + CalculateMonStats(&gPlayerParty[i]); + TryToSetBattleFormChangeMoves(&gPlayerParty[i]); + } // Opponent's side targetSpecies = GetFormChangeTargetSpecies(&gEnemyParty[i], FORM_BATTLE_BEGIN, 0); if (targetSpecies != SPECIES_NONE) + { SetMonData(&gEnemyParty[i], MON_DATA_SPECIES, &targetSpecies); + CalculateMonStats(&gEnemyParty[i]); + TryToSetBattleFormChangeMoves(&gEnemyParty[i]); + } } gBattleCommunication[MULTIUSE_STATE] = 0; diff --git a/src/battle_util.c b/src/battle_util.c index dff9d71da5..c9b4435f4c 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -9624,17 +9624,12 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut) } if (!isSwitchingOut) { - // Apply party-wide end-of-battle form changes - for (i = 0; i < PARTY_SIZE; i++) + targetSpecies = GetFormChangeTargetSpecies(&party[monId], FORM_BATTLE_END, 0); + if (targetSpecies != SPECIES_NONE) { - // Player's side - targetSpecies = GetFormChangeTargetSpecies(&gPlayerParty[i], FORM_BATTLE_END, 0); - if (targetSpecies != SPECIES_NONE) - SetMonData(&gPlayerParty[i], MON_DATA_SPECIES, &targetSpecies); - // Opponent's side - targetSpecies = GetFormChangeTargetSpecies(&gEnemyParty[i], FORM_BATTLE_END, 0); - if (targetSpecies != SPECIES_NONE) - SetMonData(&gEnemyParty[i], MON_DATA_SPECIES, &targetSpecies); + SetMonData(&party[monId], MON_DATA_SPECIES, &targetSpecies); + CalculateMonStats(&party[monId]); + TryToSetBattleFormChangeMoves(&party[monId]); } } } diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index be76cc9956..914ca6d994 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -37,10 +37,14 @@ FORM_ITEM_USE_TIME: FORM_BATTLE_BEGIN: Form change activates when the Pokémon is sent out at the beginning of a battle param1 = item to hold, optional + param2 = a move that will be replaced, optional + param3 = a new move to replace it with, optional FORM_BATTLE_END: Form change activates at the end of a battle param1 = item to hold, optional + param2 = a move that will be replaced, optional + param3 = a new move to replace it with, optional */ // FORM_MOVE param2 Arguments @@ -194,20 +198,20 @@ static const struct FormChange sSilvallyFormChangeTable[] = { #endif static const struct FormChange sXerneasFormChangeTable[] = { - {FORM_BATTLE_BEGIN, SPECIES_XERNEAS_ACTIVE, ITEM_NONE}, - {FORM_BATTLE_END, SPECIES_XERNEAS, ITEM_NONE}, + {FORM_BATTLE_BEGIN, SPECIES_XERNEAS_ACTIVE}, + {FORM_BATTLE_END, SPECIES_XERNEAS, }, {FORM_CHANGE_END}, }; static const struct FormChange sZacianFormChangeTable[] = { - {FORM_BATTLE_BEGIN, SPECIES_ZACIAN_CROWNED_SWORD, ITEM_RUSTED_SWORD}, - {FORM_BATTLE_END, SPECIES_ZACIAN, ITEM_RUSTED_SWORD}, + {FORM_BATTLE_BEGIN, SPECIES_ZACIAN_CROWNED_SWORD, ITEM_RUSTED_SWORD, MOVE_IRON_HEAD, MOVE_BEHEMOTH_BLADE}, + {FORM_BATTLE_END, SPECIES_ZACIAN, ITEM_RUSTED_SWORD, MOVE_BEHEMOTH_BLADE, MOVE_IRON_HEAD}, {FORM_CHANGE_END}, }; static const struct FormChange sZamazentaFormChangeTable[] = { - {FORM_BATTLE_BEGIN, SPECIES_ZAMAZENTA_CROWNED_SHIELD, ITEM_RUSTED_SHIELD}, - {FORM_BATTLE_END, SPECIES_ZAMAZENTA, ITEM_RUSTED_SHIELD}, + {FORM_BATTLE_BEGIN, SPECIES_ZAMAZENTA_CROWNED_SHIELD, ITEM_RUSTED_SHIELD, MOVE_IRON_HEAD, MOVE_BEHEMOTH_BASH}, + {FORM_BATTLE_END, SPECIES_ZAMAZENTA, ITEM_RUSTED_SHIELD, MOVE_BEHEMOTH_BASH, MOVE_IRON_HEAD}, {FORM_CHANGE_END}, }; diff --git a/src/data/text/move_descriptions.h b/src/data/text/move_descriptions.h index 7d890b1d3d..0a1d385042 100644 --- a/src/data/text/move_descriptions.h +++ b/src/data/text/move_descriptions.h @@ -2791,12 +2791,12 @@ static const u8 sPyroBallDescription[] = _( "target. It may cause a burn."); static const u8 sBehemothBladeDescription[] = _( - "Strikes as a sword. It deals\n" - "2x damage to Dynamaxed foes."); + "Strikes as a sword. Deals 2x\n" + "damage to Dynamaxed foes."); static const u8 sBehemothBashDescription[] = _( - "Attacks as a shield. Deals\n" - "2x damage to Dynamaxed foes."); + "Attacks as a shield. Deals 2x\n" + "damage to Dynamaxed foes."); static const u8 sAuraWheelDescription[] = _( "Raises Speed to attack. The\n" diff --git a/src/pokemon.c b/src/pokemon.c index 06e75dbc3b..d1aa0abb07 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8243,19 +8243,19 @@ u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg) } // Returns SPECIES_NONE if no form change is possible -u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg) +u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 arg) { - u32 i; + u32 i, j; u16 targetSpecies = SPECIES_NONE; - u16 species = GetBoxMonData(mon, MON_DATA_SPECIES, NULL); + u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); const struct FormChange *formChanges = gFormChangeTablePointers[species]; u16 heldItem; u32 ability; if (formChanges != NULL) { - heldItem = GetBoxMonData(mon, MON_DATA_HELD_ITEM, NULL); - ability = GetAbilityBySpecies(species, GetBoxMonData(mon, MON_DATA_ABILITY_NUM, NULL)); + heldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); + ability = GetAbilityBySpecies(species, GetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, NULL)); for (i = 0; formChanges[i].method != FORM_CHANGE_END; i++) { @@ -8264,8 +8264,6 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg switch (method) { case FORM_ITEM_HOLD: - case FORM_BATTLE_BEGIN: - case FORM_BATTLE_END: if (heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) targetSpecies = formChanges[i].targetSpecies; break; @@ -8274,7 +8272,7 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg targetSpecies = formChanges[i].targetSpecies; break; case FORM_MOVE: - if (BoxMonKnowsMove(mon, formChanges[i].param1) != formChanges[i].param2) + if (BoxMonKnowsMove(boxMon, formChanges[i].param1) != formChanges[i].param2) targetSpecies = formChanges[i].targetSpecies; break; case FORM_ITEM_HOLD_ABILITY: @@ -8299,6 +8297,10 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg } } break; + case FORM_BATTLE_BEGIN: + case FORM_BATTLE_END: + if (heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) + targetSpecies = formChanges[i].targetSpecies; } } } @@ -8358,7 +8360,7 @@ void TrySpecialOverworldEvo(void) u8 i; u8 evoMethod = gSpecialVar_0x8000; u16 canStopEvo = gSpecialVar_0x8001; - u16 tryMultiple = gSpecialVar_0x8002; + u16 tryMultiple = gSpecialVar_0x8002; for (i = 0; i < PARTY_SIZE; i++) { @@ -8375,7 +8377,7 @@ void TrySpecialOverworldEvo(void) else gCB2_AfterEvolution = CB2_ReturnToField; return; - } + } } sTriedEvolving = 0; @@ -8386,3 +8388,43 @@ bool32 ShouldShowFemaleDifferences(u16 species, u32 personality) { return (gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE; } + +void TryToSetBattleFormChangeMoves(struct Pokemon *mon) +{ + int i, j; + u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); + const struct FormChange *formChanges = gFormChangeTablePointers[species]; + u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL); + + if (formChanges == NULL) + return; + + for (i = 0; formChanges[i].method != FORM_CHANGE_END; i++) + { + if ((formChanges[i].method == FORM_BATTLE_BEGIN || formChanges[i].method == FORM_BATTLE_END) + && formChanges[i].param2 && formChanges[i].param3 && formChanges[i].targetSpecies == species) + { + u16 originalMove = formChanges[i].param2; + u16 newMove = formChanges[i].param3; + + for (j = 0; j < MAX_MON_MOVES; j++) + { + u16 currMove = GetMonData(mon, MON_DATA_MOVE1 + j, NULL); + u8 totalPp = gBattleMoves[currMove].pp; // Get current move's max PP + u8 currPp = GetMonData(mon, MON_DATA_PP1 + j, NULL); // Get current move's remaining PP + u8 diffPp = totalPp - currPp; // Current move's PP difference + u8 finalPp = gBattleMoves[newMove].pp - diffPp; // Apply the PP difference to the new move + + if (currMove == originalMove) + { + if (finalPp > gBattleMoves[newMove].pp) + finalPp = 0; + SetMonMoveSlot(mon, newMove, j); + SetMonData(mon, MON_DATA_PP1 + j, &finalPp); + } + } + SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); + break; + } + } +} From 7a0838a0f2c45cae4a418f9513266daa02237796 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 1 Sep 2022 14:03:37 -0400 Subject: [PATCH 103/115] Adjusted `GetFormChangeTargetSpeciesBoxMon` to allow having form changes of the same method in the same table --- src/data/pokemon/form_change_table_pointers.h | 12 ++--- src/data/pokemon/form_change_tables.h | 50 ++++--------------- src/pokemon.c | 4 +- 3 files changed, 19 insertions(+), 47 deletions(-) diff --git a/src/data/pokemon/form_change_table_pointers.h b/src/data/pokemon/form_change_table_pointers.h index 7bf249fcbe..85685e50ef 100644 --- a/src/data/pokemon/form_change_table_pointers.h +++ b/src/data/pokemon/form_change_table_pointers.h @@ -24,15 +24,15 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] = [SPECIES_ARCEUS_DARK] = sArceusFormChangeTable, [SPECIES_ARCEUS_FAIRY] = sArceusFormChangeTable, [SPECIES_TORNADUS] = sTornadusFormChangeTable, - [SPECIES_TORNADUS_THERIAN] = sTornadusTherianFormChangeTable, + [SPECIES_TORNADUS_THERIAN] = sTornadusFormChangeTable, [SPECIES_THUNDURUS] = sThundurusFormChangeTable, - [SPECIES_THUNDURUS_THERIAN] = sThundurusTherianFormChangeTable, + [SPECIES_THUNDURUS_THERIAN] = sThundurusFormChangeTable, [SPECIES_LANDORUS] = sLandorusFormChangeTable, - [SPECIES_LANDORUS_THERIAN] = sLandorusTherianFormChangeTable, + [SPECIES_LANDORUS_THERIAN] = sLandorusFormChangeTable, [SPECIES_ENAMORUS] = sEnamorusFormChangeTable, - [SPECIES_ENAMORUS_THERIAN] = sEnamorusTherianFormChangeTable, + [SPECIES_ENAMORUS_THERIAN] = sEnamorusFormChangeTable, [SPECIES_KELDEO] = sKeldeoFormChangeTable, - [SPECIES_KELDEO_RESOLUTE] = sKeldeoResoluteFormChangeTable, + [SPECIES_KELDEO_RESOLUTE] = sKeldeoFormChangeTable, [SPECIES_GENESECT] = sGenesectFormChangeTable, [SPECIES_GENESECT_DOUSE_DRIVE] = sGenesectFormChangeTable, [SPECIES_GENESECT_SHOCK_DRIVE] = sGenesectFormChangeTable, @@ -41,7 +41,7 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] = [SPECIES_XERNEAS] = sXerneasFormChangeTable, [SPECIES_XERNEAS_ACTIVE] = sXerneasFormChangeTable, [SPECIES_HOOPA] = sHoopaFormChangeTable, - [SPECIES_HOOPA_UNBOUND] = sHoopaUnboundFormChangeTable, + [SPECIES_HOOPA_UNBOUND] = sHoopaFormChangeTable, [SPECIES_ORICORIO] = sOricorioFormChangeTable, [SPECIES_ORICORIO_POM_POM] = sOricorioFormChangeTable, [SPECIES_ORICORIO_PAU] = sOricorioFormChangeTable, diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index ba24b14371..3a97f4efe6 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -1,8 +1,4 @@ /* -For cycling between forms with the same method and parameters but different target species (eg. Tornadus using the -Reveal Glass to change between its two forms), a separate form change table is required for each form. -Otherwise, only the last form change on the table will trigger. - FORM_ITEM_HOLD: Form change activates when the item is given to or taken from the selected Pokémon. param1 = item to hold @@ -64,7 +60,7 @@ static const struct FormChange sGiratinaFormChangeTable[] = { static const struct FormChange sShayminFormChangeTable[] = { {FORM_ITEM_USE_TIME, SPECIES_SHAYMIN_SKY, ITEM_GRACIDEA, DAY}, - {FORM_WITHDRAW, SPECIES_SHAYMIN}, + // {FORM_WITHDRAW, SPECIES_SHAYMIN}, {FORM_CHANGE_END}, }; @@ -109,51 +105,25 @@ static const struct FormChange sArceusFormChangeTable[] = { static const struct FormChange sTornadusFormChangeTable[] = { {FORM_ITEM_USE, SPECIES_TORNADUS_THERIAN, ITEM_REVEAL_GLASS}, - {FORM_CHANGE_END}, -}; - -static const struct FormChange sTornadusTherianFormChangeTable[] = { {FORM_ITEM_USE, SPECIES_TORNADUS, ITEM_REVEAL_GLASS}, {FORM_CHANGE_END}, }; static const struct FormChange sThundurusFormChangeTable[] = { {FORM_ITEM_USE, SPECIES_THUNDURUS_THERIAN, ITEM_REVEAL_GLASS}, - {FORM_CHANGE_END}, -}; - -static const struct FormChange sThundurusTherianFormChangeTable[] = { {FORM_ITEM_USE, SPECIES_THUNDURUS, ITEM_REVEAL_GLASS}, {FORM_CHANGE_END}, }; static const struct FormChange sLandorusFormChangeTable[] = { {FORM_ITEM_USE, SPECIES_LANDORUS_THERIAN, ITEM_REVEAL_GLASS}, - {FORM_CHANGE_END}, -}; - -static const struct FormChange sLandorusTherianFormChangeTable[] = { {FORM_ITEM_USE, SPECIES_LANDORUS, ITEM_REVEAL_GLASS}, {FORM_CHANGE_END}, }; -static const struct FormChange sEnamorusFormChangeTable[] = { - {FORM_ITEM_USE, SPECIES_ENAMORUS, ITEM_REVEAL_GLASS}, - {FORM_CHANGE_END}, -}; - -static const struct FormChange sEnamorusTherianFormChangeTable[] = { - {FORM_ITEM_USE, SPECIES_ENAMORUS_THERIAN, ITEM_REVEAL_GLASS}, - {FORM_CHANGE_END}, -}; - static const struct FormChange sKeldeoFormChangeTable[] = { - {FORM_MOVE, SPECIES_KELDEO_RESOLUTE, MOVE_SECRET_SWORD, WHEN_LEARNED}, - {FORM_CHANGE_END}, -}; - -static const struct FormChange sKeldeoResoluteFormChangeTable[] = { - {FORM_MOVE, SPECIES_KELDEO, MOVE_SECRET_SWORD, WHEN_FORGOTTEN}, + // {FORM_MOVE, SPECIES_KELDEO_RESOLUTE, MOVE_SECRET_SWORD, WHEN_LEARNED}, + // {FORM_MOVE, SPECIES_KELDEO, MOVE_SECRET_SWORD, WHEN_FORGOTTEN}, {FORM_CHANGE_END}, }; @@ -167,12 +137,8 @@ static const struct FormChange sGenesectFormChangeTable[] = { }; static const struct FormChange sHoopaFormChangeTable[] = { - // {FORM_ITEM_USE, SPECIES_HOOPA_UNBOUND, ITEM_PRISON_BOTTLE, SPECIES_HOOPA}, - {FORM_CHANGE_END}, -}; - -static const struct FormChange sHoopaUnboundFormChangeTable[] = { - {FORM_WITHDRAW, SPECIES_HOOPA}, + {FORM_ITEM_USE, SPECIES_HOOPA_UNBOUND, ITEM_PRISON_BOTTLE, SPECIES_HOOPA}, + // {FORM_WITHDRAW, SPECIES_HOOPA}, {FORM_CHANGE_END}, }; @@ -225,5 +191,11 @@ static const struct FormChange sZamazentaFormChangeTable[] = { {FORM_CHANGE_END}, }; +static const struct FormChange sEnamorusFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_ENAMORUS, ITEM_REVEAL_GLASS}, + {FORM_ITEM_USE, SPECIES_ENAMORUS_THERIAN, ITEM_REVEAL_GLASS}, + {FORM_CHANGE_END}, +}; + #undef WHEN_LEARNED #undef WHEN_FORGOTTEN diff --git a/src/pokemon.c b/src/pokemon.c index f88f7dab2d..99a82ec130 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8277,7 +8277,7 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 for (i = 0; formChanges[i].method != FORM_CHANGE_END; i++) { - if (method == formChanges[i].method) + if (method == formChanges[i].method && species != formChanges[i].targetSpecies) { switch (method) { @@ -8324,7 +8324,7 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 } } - return species != targetSpecies ? targetSpecies : SPECIES_NONE; + return targetSpecies; } u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove) From 9e4b18dfe2a7b878c71116a0c569a410c7d751e0 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 6 Sep 2022 14:28:52 -0400 Subject: [PATCH 104/115] update readme with credits, wiki links --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index d22891fdf0..7b49d19926 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,16 @@ The Pokeemerald Expansion is a collection of feature branches that can be integr Certain mechanics, moves, abilities and species sprites are missing. For more information, see [the project's milestones](https://github.com/rh-hideout/pokeemerald-expansion/milestones). +### [Documentation on features can be found here](https://github.com/rh-hideout/pokeemerald-expansion/wiki) + ## Who maintains the project? The project was originally started by DizzyEgg alongside other contributors. The project has now gotten larger and DizzyEgg is now maintaining the project as part of the ROM Hacking Hideout community. Some members of this community are taking on larger roles to help maintain the project. +### Please consider crediting the entire [list of contributors](https://github.com/rh-hideout/pokeemerald-expansion/wiki/Credits) in your project, as they have all worked hard to develop this project :) + ## Can I contribute even if I'm not a member of ROM Hacking Hideout? Yes! Contributions are welcome via Pull Requests and they will be reviewed by maintainers. Don't feel discouraged if we take a bit to review your PR, we'll get to it. From b249399a530727dec08911cc769c86c844a25e37 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 6 Sep 2022 23:00:26 +0200 Subject: [PATCH 105/115] changed 'B_FLAG_NO_CATCHING' to be evaluated by 'GetBallThrowableState()' --- include/item_use.h | 1 + src/item_use.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/item_use.h b/include/item_use.h index 036a541012..d55f7cf0d7 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -43,6 +43,7 @@ enum { BALL_THROW_UNABLE_NO_ROOM, BALL_THROW_UNABLE_SEMI_INVULNERABLE, BALL_THROW_ABLE, + BALL_THROW_UNABLE_DISABLED_FLAG, }; bool32 CanThrowBall(void); diff --git a/src/item_use.c b/src/item_use.c index cb85ae3e35..645a5d1647 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -968,6 +968,8 @@ static u32 GetBallThrowableState(void) else if (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE) return BALL_THROW_UNABLE_SEMI_INVULNERABLE; #endif + else if (FlagGet(B_FLAG_NO_CATCHING)) + return BALL_THROW_UNABLE_DISABLED_FLAG; return BALL_THROW_ABLE; } @@ -979,15 +981,9 @@ bool32 CanThrowBall(void) static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThere are two Pokémon out there!\p"); static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p"); +static const u8 sText_CantThrowPokeBall_Disabled[] = _("POKé BALLS cannot be used\nright now!\p"); void ItemUseInBattle_PokeBall(u8 taskId) -{ - if (FlagGet(B_FLAG_NO_CATCHING)) - { - static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); - DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); - return; - } - +{ switch (GetBallThrowableState()) { case BALL_THROW_ABLE: @@ -1018,6 +1014,12 @@ void ItemUseInBattle_PokeBall(u8 taskId) DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage); break; #endif + case BALL_THROW_UNABLE_DISABLED_FLAG: + if (!InBattlePyramid()) + DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_Disabled, CloseItemMessage); + else + DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_Disabled, Task_CloseBattlePyramidBagMessage); + break; } } From 94995c54fb98a5891bffb5612ada93de7a46dfdc Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 6 Sep 2022 23:35:05 +0200 Subject: [PATCH 106/115] fix? --- src/item_use.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/item_use.c b/src/item_use.c index 645a5d1647..0bab2fe376 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -1006,14 +1006,14 @@ void ItemUseInBattle_PokeBall(u8 taskId) else DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage); break; - #if B_SEMI_INVULNERABLE_CATCH >= GEN_4 +#if B_SEMI_INVULNERABLE_CATCH >= GEN_4 case BALL_THROW_UNABLE_SEMI_INVULNERABLE: if (!InBattlePyramid()) DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage); break; - #endif +#endif case BALL_THROW_UNABLE_DISABLED_FLAG: if (!InBattlePyramid()) DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_Disabled, CloseItemMessage); From f1c153e469be4040eb4fb7882c5893f571713fe2 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 6 Sep 2022 18:37:16 -0300 Subject: [PATCH 107/115] Merged FORM_ITEM_HOLD_ABILITY into FORM_ITEM_HOLD There was never a reason not to. --- include/constants/pokemon.h | 7 +- src/data/pokemon/form_change_tables.h | 115 +++++++++++++------------- src/party_menu.c | 5 +- src/pokemon.c | 8 +- src/pokemon_storage_system.c | 4 +- src/script_pokemon_util.c | 4 +- 6 files changed, 64 insertions(+), 79 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index c7101cfaca..6912cfe6bb 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -322,10 +322,9 @@ #define FORM_ITEM_USE 2 #define FORM_MOVE 3 #define FORM_WITHDRAW 4 -#define FORM_ITEM_HOLD_ABILITY 5 -#define FORM_ITEM_USE_TIME 6 -#define FORM_BATTLE_BEGIN 7 -#define FORM_BATTLE_END 8 +#define FORM_ITEM_USE_TIME 5 +#define FORM_BATTLE_BEGIN 6 +#define FORM_BATTLE_END 7 #define NUM_MALE_LINK_FACILITY_CLASSES 8 #define NUM_FEMALE_LINK_FACILITY_CLASSES 8 diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index 3a97f4efe6..f24fe4d850 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -1,7 +1,10 @@ /* FORM_ITEM_HOLD: Form change activates when the item is given to or taken from the selected Pokémon. + Alternatively, form change activates when the item is used on the selected Pokémon + that has a particular ability. param1 = item to hold + param2 = ability to check for, optional FORM_ITEM_USE: Form change activates when the item is used on the selected Pokémon. @@ -17,12 +20,6 @@ FORM_WITHDRAW: Form change activates when the Pokémon is withdrawn from the PC or Daycare. no parameters -FORM_ITEM_HOLD_ABILITY: - Form change activates when the item is used on the selected Pokémon that has - a particular ability. - param1 = item to use - param2 = ability to check for - FORM_ITEM_USE_TIME: Form change activates when the item is used on the selected Pokémon at the appropriate time of day. @@ -65,41 +62,41 @@ static const struct FormChange sShayminFormChangeTable[] = { }; static const struct FormChange sArceusFormChangeTable[] = { - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS, ITEM_NONE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_FIGHTING, ITEM_FIST_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_FIGHTING, ITEM_FIGHTINIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_FLYING, ITEM_SKY_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_FLYING, ITEM_FLYINIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_POISON, ITEM_TOXIC_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_POISON, ITEM_POISONIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_ROCK, ITEM_STONE_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_ROCK, ITEM_ROCKIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_GROUND, ITEM_EARTH_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_GROUND, ITEM_GROUNDIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_BUG, ITEM_INSECT_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_BUG, ITEM_BUGINIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_GHOST, ITEM_SPOOKY_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_GHOST, ITEM_GHOSTIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_STEEL, ITEM_IRON_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_STEEL, ITEM_STEELIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_FIRE, ITEM_FLAME_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_FIRE, ITEM_FIRIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_WATER, ITEM_SPLASH_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_WATER, ITEM_WATERIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_GRASS, ITEM_MEADOW_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_GRASS, ITEM_GRASSIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_ELECTRIC, ITEM_ZAP_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_ELECTRIC, ITEM_ELECTRIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_PSYCHIC, ITEM_MIND_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_PSYCHIC, ITEM_PSYCHIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_ICE, ITEM_ICICLE_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_ICE, ITEM_ICIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_DRAGON, ITEM_DRACO_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_DRAGON, ITEM_DRAGONIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_DARK, ITEM_DREAD_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_DARK, ITEM_DARKINIUM_Z, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_FAIRY, ITEM_PIXIE_PLATE, ABILITY_MULTITYPE}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_ARCEUS_FAIRY, ITEM_FAIRIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS, ITEM_NONE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FIGHTING, ITEM_FIST_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FIGHTING, ITEM_FIGHTINIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FLYING, ITEM_SKY_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FLYING, ITEM_FLYINIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_POISON, ITEM_TOXIC_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_POISON, ITEM_POISONIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ROCK, ITEM_STONE_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ROCK, ITEM_ROCKIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GROUND, ITEM_EARTH_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GROUND, ITEM_GROUNDIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_BUG, ITEM_INSECT_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_BUG, ITEM_BUGINIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GHOST, ITEM_SPOOKY_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GHOST, ITEM_GHOSTIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_STEEL, ITEM_IRON_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_STEEL, ITEM_STEELIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FIRE, ITEM_FLAME_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FIRE, ITEM_FIRIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_WATER, ITEM_SPLASH_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_WATER, ITEM_WATERIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GRASS, ITEM_MEADOW_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GRASS, ITEM_GRASSIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ELECTRIC, ITEM_ZAP_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ELECTRIC, ITEM_ELECTRIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_PSYCHIC, ITEM_MIND_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_PSYCHIC, ITEM_PSYCHIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ICE, ITEM_ICICLE_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ICE, ITEM_ICIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_DRAGON, ITEM_DRACO_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_DRAGON, ITEM_DRAGONIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_DARK, ITEM_DREAD_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_DARK, ITEM_DARKINIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FAIRY, ITEM_PIXIE_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FAIRY, ITEM_FAIRIUM_Z, ABILITY_MULTITYPE}, {FORM_CHANGE_END}, }; @@ -151,24 +148,24 @@ static const struct FormChange sOricorioFormChangeTable[] = { }; static const struct FormChange sSilvallyFormChangeTable[] = { - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY, ITEM_NONE, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_FIGHTING, ITEM_FIGHTING_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_FLYING, ITEM_FLYING_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_POISON, ITEM_POISON_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_GROUND, ITEM_GROUND_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_ROCK, ITEM_ROCK_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_BUG, ITEM_BUG_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_GHOST, ITEM_GHOST_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_STEEL, ITEM_STEEL_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_FIRE, ITEM_FIRE_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_WATER, ITEM_WATER_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_GRASS, ITEM_GRASS_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_ELECTRIC, ITEM_ELECTRIC_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_PSYCHIC, ITEM_PSYCHIC_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_ICE, ITEM_ICE_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_DRAGON, ITEM_DRAGON_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_DARK, ITEM_DARK_MEMORY, ABILITY_RKS_SYSTEM}, - {FORM_ITEM_HOLD_ABILITY, SPECIES_SILVALLY_FAIRY, ITEM_FAIRY_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY, ITEM_NONE, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_FIGHTING, ITEM_FIGHTING_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_FLYING, ITEM_FLYING_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_POISON, ITEM_POISON_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_GROUND, ITEM_GROUND_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_ROCK, ITEM_ROCK_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_BUG, ITEM_BUG_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_GHOST, ITEM_GHOST_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_STEEL, ITEM_STEEL_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_FIRE, ITEM_FIRE_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_WATER, ITEM_WATER_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_GRASS, ITEM_GRASS_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_ELECTRIC, ITEM_ELECTRIC_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_PSYCHIC, ITEM_PSYCHIC_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_ICE, ITEM_ICE_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_DRAGON, ITEM_DRAGON_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_DARK, ITEM_DARK_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_FAIRY, ITEM_FAIRY_MEMORY, ABILITY_RKS_SYSTEM}, {FORM_CHANGE_END}, }; #endif diff --git a/src/party_menu.c b/src/party_menu.c index 00224f6bd6..03e4a5826d 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -5596,10 +5596,7 @@ void ItemUseCB_FormChange_ConsumedOnUse(u8 taskId, TaskFunc task) } void TryItemHoldFormChange(struct Pokemon *mon) { - u16 species = GetMonData(mon, MON_DATA_SPECIES); - u16 targetSpecies = GetFormChangeTargetSpecies(mon, FORM_ITEM_HOLD_ABILITY, 0); - if (targetSpecies == SPECIES_NONE) - targetSpecies = GetFormChangeTargetSpecies(mon, FORM_ITEM_HOLD, 0); + u16 targetSpecies = GetFormChangeTargetSpecies(mon, FORM_ITEM_HOLD, 0); if (targetSpecies != SPECIES_NONE) { PlayCry_NormalNoDucking(targetSpecies, 0, CRY_VOLUME_RS, CRY_VOLUME_RS); diff --git a/src/pokemon.c b/src/pokemon.c index 99a82ec130..4fbce67d1e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8282,7 +8282,8 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 switch (method) { case FORM_ITEM_HOLD: - if (heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) + if ((heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) + || ability == formChanges[i].param2) targetSpecies = formChanges[i].targetSpecies; break; case FORM_ITEM_USE: @@ -8293,11 +8294,6 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 if (BoxMonKnowsMove(boxMon, formChanges[i].param1) != formChanges[i].param2) targetSpecies = formChanges[i].targetSpecies; break; - case FORM_ITEM_HOLD_ABILITY: - if ((heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) - && ability == formChanges[i].param2) - targetSpecies = formChanges[i].targetSpecies; - break; case FORM_ITEM_USE_TIME: RtcCalcLocalTime(); if (arg == formChanges[i].param1) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index d3f5d433f4..fba5bbcda9 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -6893,9 +6893,7 @@ static void ReshowDisplayMon(void) void SetMonFormPSS(struct BoxPokemon *boxMon) { - u16 targetSpecies = GetFormChangeTargetSpeciesBoxMon(boxMon, FORM_ITEM_HOLD_ABILITY, 0); - if (targetSpecies == SPECIES_NONE) - targetSpecies = GetFormChangeTargetSpeciesBoxMon(boxMon, FORM_ITEM_HOLD, 0); + u16 targetSpecies = GetFormChangeTargetSpeciesBoxMon(boxMon, FORM_ITEM_HOLD, 0); if (targetSpecies != SPECIES_NONE) { SetBoxMonData(boxMon, MON_DATA_SPECIES, &targetSpecies); diff --git a/src/script_pokemon_util.c b/src/script_pokemon_util.c index 8a9e65ff8f..e33c8ffcad 100755 --- a/src/script_pokemon_util.c +++ b/src/script_pokemon_util.c @@ -72,9 +72,7 @@ u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 u SetMonData(&mon, MON_DATA_HELD_ITEM, heldItem); // In case a mon with a form changing item is given. Eg: SPECIES_ARCEUS with ITEM_SPLASH_PLATE will transform into SPECIES_ARCEUS_WATER upon gifted. - targetSpecies = GetFormChangeTargetSpecies(&mon, FORM_ITEM_HOLD_ABILITY, 0); - if (targetSpecies == SPECIES_NONE) - targetSpecies = GetFormChangeTargetSpecies(&mon, FORM_ITEM_HOLD, 0); + targetSpecies = GetFormChangeTargetSpecies(&mon, FORM_ITEM_HOLD, 0); if (targetSpecies != SPECIES_NONE) { SetMonData(&mon, MON_DATA_SPECIES, &targetSpecies); From a7a1ab9aeb5b965c31046601a874a2e3cebab286 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 6 Sep 2022 18:37:16 -0300 Subject: [PATCH 108/115] Merged FORM_ITEM_HOLD_ABILITY into FORM_ITEM_HOLD There was never a reason not to. --- src/data/pokemon/form_change_tables.h | 6 +++--- src/pokemon.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index f24fe4d850..ddcb4d9cbd 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -1,8 +1,8 @@ /* FORM_ITEM_HOLD: - Form change activates when the item is given to or taken from the selected Pokémon. - Alternatively, form change activates when the item is used on the selected Pokémon - that has a particular ability. + Form change activates when the specified item is given to or taken from the selected Pokémon. + Alternatively, form change activates when the specified item is is given to or taken from + the selected Pokémon that has a particular ability. param1 = item to hold param2 = ability to check for, optional diff --git a/src/pokemon.c b/src/pokemon.c index 4fbce67d1e..63b3dae9dc 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8285,6 +8285,8 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 if ((heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) || ability == formChanges[i].param2) targetSpecies = formChanges[i].targetSpecies; + if ((heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) && ability == formChanges[i].param2) + targetSpecies = formChanges[i].targetSpecies; break; case FORM_ITEM_USE: if (arg == formChanges[i].param1) From 4a6d3d1debab52c5e9fd5284062d924d583295b4 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Thu, 8 Sep 2022 00:19:13 -0400 Subject: [PATCH 109/115] Whitespace --- src/item_use.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/item_use.c b/src/item_use.c index 0bab2fe376..5cd162519f 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -983,7 +983,7 @@ static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThe static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p"); static const u8 sText_CantThrowPokeBall_Disabled[] = _("POKé BALLS cannot be used\nright now!\p"); void ItemUseInBattle_PokeBall(u8 taskId) -{ +{ switch (GetBallThrowableState()) { case BALL_THROW_ABLE: From 3acb32acb826ddb693c346da517a9a1b203b3582 Mon Sep 17 00:00:00 2001 From: Blackforest92 Date: Fri, 9 Sep 2022 00:25:43 +0700 Subject: [PATCH 110/115] Tyding graphics - Acupressure --- data/battle_anim_scripts.s | 6 +- .../battle_anims/sprites/accupressure.png | Bin 358 -> 0 bytes graphics/battle_anims/sprites/acupressure.png | Bin 0 -> 310 bytes .../sprites/acupressure_finger.png | Bin 298 -> 0 bytes include/constants/battle_anim.h | 125 +++++++++--------- include/constants/map_groups.h | 2 + include/graphics.h | 6 +- src/battle_anim_effects_1.c | 6 +- src/battle_anim_rock.c | 2 +- src/data/battle_anim.h | 6 +- src/graphics.c | 7 +- 11 files changed, 77 insertions(+), 83 deletions(-) delete mode 100644 graphics/battle_anims/sprites/accupressure.png create mode 100644 graphics/battle_anims/sprites/acupressure.png delete mode 100644 graphics/battle_anims/sprites/acupressure_finger.png diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 6a46a2d55e..f83d437a5d 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1185,9 +1185,9 @@ Move_TAILWIND: end Move_ACUPRESSURE: - loadspritegfx ANIM_TAG_ACCUPRESSURE + loadspritegfx ANIM_TAG_ACUPRESSURE loadspritegfx ANIM_TAG_SPARK_2 - createsprite gAccupressureSpriteTemplate, ANIM_ATTACKER, 40, 0, -40, 40 + createsprite gAcupressureSpriteTemplate, ANIM_ATTACKER, 40, 0, -40, 40 waitforvisualfinish call ElectricityEffect end @@ -4337,7 +4337,7 @@ Move_LUNAR_DANCE: Move_CRUSH_GRIP: loadspritegfx ANIM_TAG_EXPLOSION - loadspritegfx ANIM_TAG_ACCUPRESSURE + loadspritegfx ANIM_TAG_ACUPRESSURE loadspritegfx ANIM_TAG_PURPLE_HAND_OUTLINE setalpha 15, 0 createsprite gCrushGripHandTemplate, ANIM_TARGET, 2, 16, 0, 0, 0, 25, 0x101 diff --git a/graphics/battle_anims/sprites/accupressure.png b/graphics/battle_anims/sprites/accupressure.png deleted file mode 100644 index 0da836ff3fec4d52d5a2d30f4ae9cffb83aac295..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 358 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvxd5LKS0D`p5gri<0SP-+95}Gy z#Elydz~IG)4t8*0pd71sZz_izopr07S5TX#fBK diff --git a/graphics/battle_anims/sprites/acupressure.png b/graphics/battle_anims/sprites/acupressure.png new file mode 100644 index 0000000000000000000000000000000000000000..5d8ae62bc9ca1592ea13573666e6b9eccd5b3efc GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvg8-ip*NOux1Ox;kJR%YT5_YUO zaA3oU8#f++!HW+cJ^)prf!W#bgn>c_JzX3_G$yuA^cHF|5ODDOE pQ2T!%k^7adzzVa5`kV{9p7WJ!31o~*OvfAw|crbhE&X%I>DRoumX?E&7Ulm&io7=%mzW%0=sv( z**os5D^%$84F8%p@7Uplj!6HeWJXI%Shm$RvT(O3n*>^DZq)>O8t(PQvA^ z)N1Fn?E%-@TXWg}#ujaySe<9h+Ho=btuwPc!_}1BE!GdNIxmtmZz(q%Q~loCIEZJaCiU! diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index 28bcb283d4..db2efd8d05 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -308,7 +308,7 @@ #define ANIM_TAG_MEGA_PARTICLES (ANIM_SPRITES_START + 297) #define ANIM_TAG_TRUMP_CARD (ANIM_SPRITES_START + 298) #define ANIM_TAG_TRUMP_CARD_PARTICLES (ANIM_SPRITES_START + 299) -#define ANIM_TAG_ACCUPRESSURE (ANIM_SPRITES_START + 300) +#define ANIM_TAG_ACUPRESSURE (ANIM_SPRITES_START + 300) #define ANIM_TAG_WRING_OUT (ANIM_SPRITES_START + 301) #define ANIM_TAG_COLORED_ORBS (ANIM_SPRITES_START + 302) #define ANIM_TAG_WORRY_SEED (ANIM_SPRITES_START + 303) @@ -334,68 +334,67 @@ #define ANIM_TAG_BRINE (ANIM_SPRITES_START + 322) #define ANIM_TAG_GEAR (ANIM_SPRITES_START + 323) #define ANIM_TAG_ASSURANCE_HAND (ANIM_SPRITES_START + 324) -#define ANIM_TAG_ACUPRESSURE_FINGER (ANIM_SPRITES_START + 325) -#define ANIM_TAG_WISHIWASHI_FISH (ANIM_SPRITES_START + 326) -#define ANIM_TAG_ZYGARDE_HEXES (ANIM_SPRITES_START + 327) -#define ANIM_TAG_AURA_SPHERE (ANIM_SPRITES_START + 328) -#define ANIM_TAG_OMEGA_STONE (ANIM_SPRITES_START + 329) -#define ANIM_TAG_ALPHA_STONE (ANIM_SPRITES_START + 330) -#define ANIM_TAG_BERRY_NORMAL (ANIM_SPRITES_START + 331) -#define ANIM_TAG_BERRY_EATEN (ANIM_SPRITES_START + 332) -#define ANIM_TAG_DRAGON_ASCENT (ANIM_SPRITES_START + 333) -#define ANIM_TAG_PINK_DIAMOND (ANIM_SPRITES_START + 334) -#define ANIM_TAG_STEAM_ERUPTION (ANIM_SPRITES_START + 335) -#define ANIM_TAG_CONFIDE (ANIM_SPRITES_START + 336) -#define ANIM_TAG_VERTICAL_HEX (ANIM_SPRITES_START + 337) -#define ANIM_TAG_UNAVAILABLE_1 (ANIM_SPRITES_START + 338) //0x2862.. supposedly used elsewhere? -#define ANIM_TAG_UNAVAILABLE_2 (ANIM_SPRITES_START + 339) -#define ANIM_TAG_POWER_TRICK (ANIM_SPRITES_START + 340) -#define ANIM_TAG_CHAIN_LINK (ANIM_SPRITES_START + 341) -#define ANIM_TAG_ANCHOR (ANIM_SPRITES_START + 342) -#define ANIM_TAG_HORSESHOE_SIDE_FIST (ANIM_SPRITES_START + 343) -#define ANIM_TAG_DRAGON_ASCENT_FOE (ANIM_SPRITES_START + 344) -#define ANIM_TAG_CRAFTY_SHIELD (ANIM_SPRITES_START + 345) -#define ANIM_TAG_BLACEPHALON_HEAD (ANIM_SPRITES_START + 346) -#define ANIM_TAG_FAIRY_LOCK_CHAINS (ANIM_SPRITES_START + 347) -#define ANIM_TAG_IONS (ANIM_SPRITES_START + 348) -#define ANIM_TAG_CHOP (ANIM_SPRITES_START + 349) -#define ANIM_TAG_HEART_STAMP (ANIM_SPRITES_START + 350) -#define ANIM_TAG_HORN_LEECH (ANIM_SPRITES_START + 351) -#define ANIM_TAG_STEAMROLLER (ANIM_SPRITES_START + 352) -#define ANIM_TAG_HOOPA_HAND (ANIM_SPRITES_START + 353) -#define ANIM_TAG_HOOPA_RING (ANIM_SPRITES_START + 354) -#define ANIM_TAG_METAL_BITS (ANIM_SPRITES_START + 355) -#define ANIM_TAG_SMALL_ROCK (ANIM_SPRITES_START + 356) -#define ANIM_TAG_SPIRIT_ARROW (ANIM_SPRITES_START + 357) -#define ANIM_TAG_ULTRA_BURST_SYMBOL (ANIM_SPRITES_START + 358) -#define ANIM_TAG_Z_MOVE_SYMBOL (ANIM_SPRITES_START + 359) -#define ANIM_TAG_REALLY_BIG_ROCK (ANIM_SPRITES_START + 360) -#define ANIM_TAG_COCOON (ANIM_SPRITES_START + 361) -#define ANIM_TAG_CORKSCREW (ANIM_SPRITES_START + 362) -#define ANIM_TAG_HAVOC_SPEAR (ANIM_SPRITES_START + 363) -#define ANIM_TAG_PURPLE_DRAKE (ANIM_SPRITES_START + 364) -#define ANIM_TAG_MUD_BOMB (ANIM_SPRITES_START + 365) -#define ANIM_TAG_BRANCH (ANIM_SPRITES_START + 366) -#define ANIM_TAG_APPLE (ANIM_SPRITES_START + 367) -#define ANIM_TAG_OBSTRUCT_CROSS (ANIM_SPRITES_START + 368) -#define ANIM_TAG_POISON_COLUMN (ANIM_SPRITES_START + 369) -#define ANIM_TAG_GARBAGE_COLUMN (ANIM_SPRITES_START + 370) -#define ANIM_TAG_LARGE_SPIKE (ANIM_SPRITES_START + 371) -#define ANIM_TAG_DRAGON_PULSE_RING (ANIM_SPRITES_START + 372) -#define ANIM_TAG_STONE_PILLAR (ANIM_SPRITES_START + 373) -#define ANIM_TAG_MUSHROOM (ANIM_SPRITES_START + 374) -#define ANIM_TAG_GOLDEN_APPLE (ANIM_SPRITES_START + 375) -#define ANIM_TAG_ICE_ROCK (ANIM_SPRITES_START + 376) -#define ANIM_TAG_TORNADO (ANIM_SPRITES_START + 377) -#define ANIM_TAG_STRAIGHT_BEAM (ANIM_SPRITES_START + 378) -#define ANIM_TAG_DREEPY (ANIM_SPRITES_START + 379) -#define ANIM_TAG_ICE_ROCK_SINGLE (ANIM_SPRITES_START + 380) -#define ANIM_TAG_STONE_PILLAR_MULTI (ANIM_SPRITES_START + 381) -#define ANIM_TAG_ALPHA_SYMBOL (ANIM_SPRITES_START + 382) -#define ANIM_TAG_OMEGA_SYMBOL (ANIM_SPRITES_START + 383) -#define ANIM_TAG_PRIMAL_PARTICLES (ANIM_SPRITES_START + 384) -#define ANIM_TAG_STEEL_BEAM (ANIM_SPRITES_START + 385) -#define ANIM_TAG_POLTERGEIST (ANIM_SPRITES_START + 386) +#define ANIM_TAG_WISHIWASHI_FISH (ANIM_SPRITES_START + 325) +#define ANIM_TAG_ZYGARDE_HEXES (ANIM_SPRITES_START + 326) +#define ANIM_TAG_AURA_SPHERE (ANIM_SPRITES_START + 327) +#define ANIM_TAG_OMEGA_STONE (ANIM_SPRITES_START + 328) +#define ANIM_TAG_ALPHA_STONE (ANIM_SPRITES_START + 329) +#define ANIM_TAG_BERRY_NORMAL (ANIM_SPRITES_START + 330) +#define ANIM_TAG_BERRY_EATEN (ANIM_SPRITES_START + 331) +#define ANIM_TAG_DRAGON_ASCENT (ANIM_SPRITES_START + 332) +#define ANIM_TAG_PINK_DIAMOND (ANIM_SPRITES_START + 333) +#define ANIM_TAG_STEAM_ERUPTION (ANIM_SPRITES_START + 334) +#define ANIM_TAG_CONFIDE (ANIM_SPRITES_START + 335) +#define ANIM_TAG_VERTICAL_HEX (ANIM_SPRITES_START + 336) +#define ANIM_TAG_UNAVAILABLE_1 (ANIM_SPRITES_START + 337) //0x2862.. supposedly used elsewhere? +#define ANIM_TAG_UNAVAILABLE_2 (ANIM_SPRITES_START + 338) +#define ANIM_TAG_POWER_TRICK (ANIM_SPRITES_START + 339) +#define ANIM_TAG_CHAIN_LINK (ANIM_SPRITES_START + 340) +#define ANIM_TAG_ANCHOR (ANIM_SPRITES_START + 341) +#define ANIM_TAG_HORSESHOE_SIDE_FIST (ANIM_SPRITES_START + 342) +#define ANIM_TAG_DRAGON_ASCENT_FOE (ANIM_SPRITES_START + 343) +#define ANIM_TAG_CRAFTY_SHIELD (ANIM_SPRITES_START + 344) +#define ANIM_TAG_BLACEPHALON_HEAD (ANIM_SPRITES_START + 345) +#define ANIM_TAG_FAIRY_LOCK_CHAINS (ANIM_SPRITES_START + 346) +#define ANIM_TAG_IONS (ANIM_SPRITES_START + 347) +#define ANIM_TAG_CHOP (ANIM_SPRITES_START + 348) +#define ANIM_TAG_HEART_STAMP (ANIM_SPRITES_START + 349) +#define ANIM_TAG_HORN_LEECH (ANIM_SPRITES_START + 350) +#define ANIM_TAG_STEAMROLLER (ANIM_SPRITES_START + 351) +#define ANIM_TAG_HOOPA_HAND (ANIM_SPRITES_START + 352) +#define ANIM_TAG_HOOPA_RING (ANIM_SPRITES_START + 353) +#define ANIM_TAG_METAL_BITS (ANIM_SPRITES_START + 354) +#define ANIM_TAG_SMALL_ROCK (ANIM_SPRITES_START + 355) +#define ANIM_TAG_SPIRIT_ARROW (ANIM_SPRITES_START + 356) +#define ANIM_TAG_ULTRA_BURST_SYMBOL (ANIM_SPRITES_START + 357) +#define ANIM_TAG_Z_MOVE_SYMBOL (ANIM_SPRITES_START + 358) +#define ANIM_TAG_REALLY_BIG_ROCK (ANIM_SPRITES_START + 359) +#define ANIM_TAG_COCOON (ANIM_SPRITES_START + 360) +#define ANIM_TAG_CORKSCREW (ANIM_SPRITES_START + 361) +#define ANIM_TAG_HAVOC_SPEAR (ANIM_SPRITES_START + 362) +#define ANIM_TAG_PURPLE_DRAKE (ANIM_SPRITES_START + 363) +#define ANIM_TAG_MUD_BOMB (ANIM_SPRITES_START + 364) +#define ANIM_TAG_BRANCH (ANIM_SPRITES_START + 365) +#define ANIM_TAG_APPLE (ANIM_SPRITES_START + 366) +#define ANIM_TAG_OBSTRUCT_CROSS (ANIM_SPRITES_START + 367) +#define ANIM_TAG_POISON_COLUMN (ANIM_SPRITES_START + 368) +#define ANIM_TAG_GARBAGE_COLUMN (ANIM_SPRITES_START + 369) +#define ANIM_TAG_LARGE_SPIKE (ANIM_SPRITES_START + 370) +#define ANIM_TAG_DRAGON_PULSE_RING (ANIM_SPRITES_START + 371) +#define ANIM_TAG_STONE_PILLAR (ANIM_SPRITES_START + 372) +#define ANIM_TAG_MUSHROOM (ANIM_SPRITES_START + 373) +#define ANIM_TAG_GOLDEN_APPLE (ANIM_SPRITES_START + 374) +#define ANIM_TAG_ICE_ROCK (ANIM_SPRITES_START + 375) +#define ANIM_TAG_TORNADO (ANIM_SPRITES_START + 376) +#define ANIM_TAG_STRAIGHT_BEAM (ANIM_SPRITES_START + 377) +#define ANIM_TAG_DREEPY (ANIM_SPRITES_START + 378) +#define ANIM_TAG_ICE_ROCK_SINGLE (ANIM_SPRITES_START + 379) +#define ANIM_TAG_STONE_PILLAR_MULTI (ANIM_SPRITES_START + 380) +#define ANIM_TAG_ALPHA_SYMBOL (ANIM_SPRITES_START + 381) +#define ANIM_TAG_OMEGA_SYMBOL (ANIM_SPRITES_START + 382) +#define ANIM_TAG_PRIMAL_PARTICLES (ANIM_SPRITES_START + 383) +#define ANIM_TAG_STEEL_BEAM (ANIM_SPRITES_START + 384) +#define ANIM_TAG_POLTERGEIST (ANIM_SPRITES_START + 385) // battlers #define ANIM_ATTACKER 0 diff --git a/include/constants/map_groups.h b/include/constants/map_groups.h index eaf40a525d..2e6c781943 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/graphics.h b/include/graphics.h index 80532ad933..197cb4bb41 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -9304,7 +9304,7 @@ extern const u32 gBattleAnimSpriteGfx_Bird[]; extern const u32 gBattleAnimSpriteGfx_CrossImpact[]; extern const u32 gBattleAnimSpriteGfx_TrumpCard[]; extern const u32 gBattleAnimSpriteGfx_TrumpCardParticles[]; -extern const u32 gBattleAnimSpriteGfx_Accupressure[]; +extern const u32 gBattleAnimSpriteGfx_Acupressure[]; extern const u32 gBattleAnimSpriteGfx_WringOut[]; extern const u32 gBattleAnimSpriteGfx_ColoredOrbs[]; extern const u32 gBattleAnimSpriteGfx_WorrySeed[]; @@ -9606,7 +9606,7 @@ extern const u32 gBattleAnimSpritePal_WhipHit[]; extern const u32 gBattleAnimSpritePal_BlueRing2[]; extern const u32 gBattleAnimSpritePal_TrumpCard[]; extern const u32 gBattleAnimSpritePal_TrumpCardParticles[]; -extern const u32 gBattleAnimSpritePal_Accupressure[]; +extern const u32 gBattleAnimSpritePal_Acupressure[]; extern const u32 gBattleAnimSpritePal_WringOut[]; extern const u32 gBattleAnimSpritePal_ColoredOrbs[]; extern const u32 gBattleAnimSpritePal_WorrySeed[]; @@ -9645,8 +9645,6 @@ extern const u32 gBattleAnimSpriteGfx_QuickGuard[]; extern const u32 gBattleAnimSpritePal_QuickGuard[]; // New Battle Anim Particles -extern const u32 gBattleAnimSpriteGfx_AcupressureFinger[]; -extern const u32 gBattleAnimSpritePal_AcupressureFinger[]; extern const u32 gBattleAnimSpriteGfx_AlphaStone[]; extern const u32 gBattleAnimSpritePal_AlphaStone[]; extern const u32 gBattleAnimSpriteGfx_AlphaSymbol[]; diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index ff9495d0e0..048b37c660 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -354,10 +354,10 @@ const struct SpriteTemplate gSmallCloudTemplate = .callback = AnimMoveSmallCloud }; -const struct SpriteTemplate gAccupressureSpriteTemplate = +const struct SpriteTemplate gAcupressureSpriteTemplate = { - .tileTag = ANIM_TAG_ACCUPRESSURE, - .paletteTag = ANIM_TAG_ACCUPRESSURE, + .tileTag = ANIM_TAG_ACUPRESSURE, + .paletteTag = ANIM_TAG_ACUPRESSURE, .oam = &gOamData_AffineDouble_ObjNormal_32x32, .anims = gDummySpriteAnimTable, .images = NULL, diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index e1a90b1948..b1ccc9a582 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -331,7 +331,7 @@ static const union AffineAnimCmd* const sSpriteAffineAnimTable_CrushGripHand[] = const struct SpriteTemplate gCrushGripHandTemplate = { .tileTag = ANIM_TAG_PURPLE_HAND_OUTLINE, - .paletteTag = ANIM_TAG_ACCUPRESSURE, + .paletteTag = ANIM_TAG_ACUPRESSURE, .oam = &gOamData_AffineNormal_ObjNormal_32x32, .anims = sAnims_BasicRock, .images = NULL, diff --git a/src/data/battle_anim.h b/src/data/battle_anim.h index b8fb8c0378..6a67e0cd60 100644 --- a/src/data/battle_anim.h +++ b/src/data/battle_anim.h @@ -1365,7 +1365,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_MegaParticles, 0x0180, ANIM_TAG_MEGA_PARTICLES}, {gBattleAnimSpriteGfx_TrumpCard, 0x0180, ANIM_TAG_TRUMP_CARD}, {gBattleAnimSpriteGfx_TrumpCardParticles, 0x0060, ANIM_TAG_TRUMP_CARD_PARTICLES}, - {gBattleAnimSpriteGfx_Accupressure, 0x0200, ANIM_TAG_ACCUPRESSURE}, + {gBattleAnimSpriteGfx_Acupressure, 0x0200, ANIM_TAG_ACUPRESSURE}, {gBattleAnimSpriteGfx_WringOut, 0x0200, ANIM_TAG_WRING_OUT}, {gBattleAnimSpriteGfx_ColoredOrbs, 0x0300, ANIM_TAG_COLORED_ORBS}, {gBattleAnimSpriteGfx_WorrySeed, 0x0080, ANIM_TAG_WORRY_SEED}, @@ -1390,7 +1390,6 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Brine, 0xc00, ANIM_TAG_BRINE}, {gBattleAnimSpriteGfx_Gear, 0x200, ANIM_TAG_GEAR}, {gBattleAnimSpriteGfx_AssuranceHand, 0x200, ANIM_TAG_ASSURANCE_HAND}, - {gBattleAnimSpriteGfx_AcupressureFinger, 0x200, ANIM_TAG_ACUPRESSURE_FINGER}, {gBattleAnimSpriteGfx_Fishies, 0x480, ANIM_TAG_WISHIWASHI_FISH}, {gBattleAnimSpriteGfx_ZygardeHexes, 0x480, ANIM_TAG_ZYGARDE_HEXES}, {gBattleAnimSpriteGfx_AuraSphere, 0x200, ANIM_TAG_AURA_SPHERE}, @@ -1817,7 +1816,7 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_MegaParticles, ANIM_TAG_MEGA_PARTICLES}, {gBattleAnimSpritePal_TrumpCard, ANIM_TAG_TRUMP_CARD}, {gBattleAnimSpritePal_TrumpCardParticles, ANIM_TAG_TRUMP_CARD_PARTICLES}, - {gBattleAnimSpritePal_Accupressure, ANIM_TAG_ACCUPRESSURE}, + {gBattleAnimSpritePal_Acupressure, ANIM_TAG_ACUPRESSURE}, {gBattleAnimSpritePal_WringOut, ANIM_TAG_WRING_OUT}, {gBattleAnimSpritePal_ColoredOrbs, ANIM_TAG_COLORED_ORBS}, {gBattleAnimSpritePal_WorrySeed, ANIM_TAG_WORRY_SEED}, @@ -1842,7 +1841,6 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Brine, ANIM_TAG_BRINE}, {gBattleAnimSpritePal_Gear, ANIM_TAG_GEAR}, {gBattleAnimSpritePal_AssuranceHand, ANIM_TAG_ASSURANCE_HAND}, - {gBattleAnimSpritePal_AcupressureFinger, ANIM_TAG_ACUPRESSURE_FINGER}, {gBattleAnimSpritePal_Fishies, ANIM_TAG_WISHIWASHI_FISH}, {gBattleAnimSpritePal_ZygardeHexes, ANIM_TAG_ZYGARDE_HEXES}, {gBattleAnimSpritePal_AuraSphere, ANIM_TAG_AURA_SPHERE}, diff --git a/src/graphics.c b/src/graphics.c index a59d919527..6a12dda1cc 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -57,9 +57,6 @@ const u32 gBattleAnimSpritePal_Punishment[] = INCBIN_U32("graphics/battle_anims/ const u32 gBattleAnimSpriteGfx_QuickGuard[] = INCBIN_U32("graphics/battle_anims/sprites/quick_guard.4bpp.lz"); const u32 gBattleAnimSpritePal_QuickGuard[] = INCBIN_U32("graphics/battle_anims/sprites/quick_guard.gbapal.lz"); -const u32 gBattleAnimSpritePal_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/acupressure_finger.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_AcupressureFinger[] = INCBIN_U32("graphics/battle_anims/sprites/acupressure_finger.4bpp.lz"); - const u32 gBattleAnimSpriteGfx_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/alpha_stone.4bpp.lz"); const u32 gBattleAnimSpritePal_AlphaStone[] = INCBIN_U32("graphics/battle_anims/sprites/alpha_stone.gbapal.lz"); @@ -375,8 +372,8 @@ const u32 gBattleAnimSpritePal_TrumpCard[] = INCBIN_U32("graphics/battle_anims/s const u32 gBattleAnimSpriteGfx_TrumpCardParticles[] = INCBIN_U32("graphics/battle_anims/sprites/trump_card_particles.4bpp.lz"); const u32 gBattleAnimSpritePal_TrumpCardParticles[] = INCBIN_U32("graphics/battle_anims/sprites/trump_card_particles.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_Accupressure[] = INCBIN_U32("graphics/battle_anims/sprites/accupressure.4bpp.lz"); -const u32 gBattleAnimSpritePal_Accupressure[] = INCBIN_U32("graphics/battle_anims/sprites/accupressure.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_Acupressure[] = INCBIN_U32("graphics/battle_anims/sprites/acupressure.4bpp.lz"); +const u32 gBattleAnimSpritePal_Acupressure[] = INCBIN_U32("graphics/battle_anims/sprites/acupressure.gbapal.lz"); const u32 gBattleAnimSpriteGfx_WringOut[] = INCBIN_U32("graphics/battle_anims/sprites/wring_out.4bpp.lz"); const u32 gBattleAnimSpritePal_WringOut[] = INCBIN_U32("graphics/battle_anims/sprites/wring_out.gbapal.lz"); From caf323a653907cfa4158cc86ef9be124afce48a5 Mon Sep 17 00:00:00 2001 From: Blackforest92 Date: Fri, 9 Sep 2022 00:40:30 +0700 Subject: [PATCH 111/115] Erase ghost data in include/constants/map_groups.h --- include/constants/map_groups.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/constants/map_groups.h b/include/constants/map_groups.h index 2e6c781943..eaf40a525d 100755 --- a/include/constants/map_groups.h +++ b/include/constants/map_groups.h @@ -593,6 +593,4 @@ #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 From db6d285f00ad5ce09b06ef282d29727d34bd6d07 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 8 Sep 2022 17:53:15 -0300 Subject: [PATCH 112/115] Small syntax fix for CanLearnTeachableMove --- src/pokemon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index d3b401e8c3..fc80330306 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -7297,9 +7297,8 @@ u8 CanLearnTeachableMove(u16 species, u16 move) u8 i; for (i = 0; gTeachableLearnsets[species][i] != MOVE_UNAVAILABLE; i++) { - if (gTeachableLearnsets[species][i] == move) { + if (gTeachableLearnsets[species][i] == move) return TRUE; - } } return FALSE; } From e8832a265523d52149849f74298202aa89aed856 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 9 Sep 2022 14:56:12 -0300 Subject: [PATCH 113/115] Updated FORM_ITEM_HOLD check in GetFormChangeTargetSpeciesBoxMon --- src/pokemon.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 63b3dae9dc..4dcec70b06 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8283,9 +8283,7 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 { case FORM_ITEM_HOLD: if ((heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) - || ability == formChanges[i].param2) - targetSpecies = formChanges[i].targetSpecies; - if ((heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) && ability == formChanges[i].param2) + && (ability == formChanges[i].param2 || formChanges[i].param2 == ABILITY_NONE)) targetSpecies = formChanges[i].targetSpecies; break; case FORM_ITEM_USE: From 12fee71008028e30bfc3bc446034a1390403bf01 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 9 Sep 2022 15:39:48 -0300 Subject: [PATCH 114/115] Merged FORM_ITEM_USE_TIME into FORM_ITEM_USE --- include/constants/pokemon.h | 5 ++-- src/data/items.h | 2 +- src/data/pokemon/form_change_tables.h | 17 +++++------- src/pokemon.c | 39 ++++++++++++++------------- 4 files changed, 30 insertions(+), 33 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 6912cfe6bb..98b32ffd51 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -322,9 +322,8 @@ #define FORM_ITEM_USE 2 #define FORM_MOVE 3 #define FORM_WITHDRAW 4 -#define FORM_ITEM_USE_TIME 5 -#define FORM_BATTLE_BEGIN 6 -#define FORM_BATTLE_END 7 +#define FORM_BATTLE_BEGIN 5 +#define FORM_BATTLE_END 6 #define NUM_MALE_LINK_FACILITY_CLASSES 8 #define NUM_FEMALE_LINK_FACILITY_CLASSES 8 diff --git a/src/data/items.h b/src/data/items.h index 08060db773..6649fb24b6 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -9071,7 +9071,7 @@ const struct Item gItems[] = .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_FormChange, - .secondaryId = FORM_ITEM_USE_TIME, + .secondaryId = FORM_ITEM_USE, }, [ITEM_REVEAL_GLASS] = diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index ddcb4d9cbd..2531a10c9b 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -9,6 +9,8 @@ FORM_ITEM_HOLD: FORM_ITEM_USE: Form change activates when the item is used on the selected Pokémon. param1 = item to use + param2 = DAY if form change activates in the daytime, optional + NIGHT if form change activates at nighttime, optional FORM_MOVE: Form change activates when the Pokémon learns or forgets the move. @@ -20,13 +22,6 @@ FORM_WITHDRAW: Form change activates when the Pokémon is withdrawn from the PC or Daycare. no parameters -FORM_ITEM_USE_TIME: - Form change activates when the item is used on the selected Pokémon at the - appropriate time of day. - param1 = item to use - param2 = DAY if form change activates in the daytime - NIGHT if form change activates at nighttime - FORM_BATTLE_BEGIN: Form change activates when the Pokémon is sent out at the beginning of a battle param1 = item to hold, optional @@ -44,9 +39,9 @@ FORM_BATTLE_END: #define WHEN_LEARNED 0 #define WHEN_FORGOTTEN 1 -// FORM_ITEM_USE_TIME param2 Arguments -#define DAY 0 -#define NIGHT 1 +// FORM_ITEM_USE param2 Arguments +#define DAY 1 +#define NIGHT 2 #if P_NEW_POKEMON == TRUE static const struct FormChange sGiratinaFormChangeTable[] = { @@ -56,7 +51,7 @@ static const struct FormChange sGiratinaFormChangeTable[] = { }; static const struct FormChange sShayminFormChangeTable[] = { - {FORM_ITEM_USE_TIME, SPECIES_SHAYMIN_SKY, ITEM_GRACIDEA, DAY}, + {FORM_ITEM_USE, SPECIES_SHAYMIN_SKY, ITEM_GRACIDEA, DAY}, // {FORM_WITHDRAW, SPECIES_SHAYMIN}, {FORM_CHANGE_END}, }; diff --git a/src/pokemon.c b/src/pokemon.c index 722eaafe87..f735918083 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8273,30 +8273,33 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 targetSpecies = formChanges[i].targetSpecies; break; case FORM_ITEM_USE: + RtcCalcLocalTime(); if (arg == formChanges[i].param1) - targetSpecies = formChanges[i].targetSpecies; + { + if (!formChanges[i].param2) + { + targetSpecies = formChanges[i].targetSpecies; + } + else + { + switch (formChanges[i].param2) + { + case DAY: + if (gLocalTime.hours >= 12 && gLocalTime.hours < 24) + targetSpecies = formChanges[i].targetSpecies; + break; + case NIGHT: + if (gLocalTime.hours >= 0 && gLocalTime.hours < 12) + targetSpecies = formChanges[i].targetSpecies; + break; + } + } + } break; case FORM_MOVE: if (BoxMonKnowsMove(boxMon, formChanges[i].param1) != formChanges[i].param2) targetSpecies = formChanges[i].targetSpecies; break; - case FORM_ITEM_USE_TIME: - RtcCalcLocalTime(); - if (arg == formChanges[i].param1) - { - switch (formChanges[i].param2) - { - case DAY: - if (gLocalTime.hours >= 12 && gLocalTime.hours < 24) - targetSpecies = formChanges[i].targetSpecies; - break; - case NIGHT: - if (gLocalTime.hours >= 0 && gLocalTime.hours < 12) - targetSpecies = formChanges[i].targetSpecies; - break; - } - } - break; case FORM_BATTLE_BEGIN: case FORM_BATTLE_END: if (heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE) From ceb0c67bcfc44ca202e22e9afa5638746a625bd8 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 9 Sep 2022 16:05:32 -0300 Subject: [PATCH 115/115] Modified check in case FORM_ITEM_USE of GetFormChangeTargetSpeciesBoxMon --- src/pokemon.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index f735918083..b421e5aced 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8273,26 +8273,23 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 targetSpecies = formChanges[i].targetSpecies; break; case FORM_ITEM_USE: - RtcCalcLocalTime(); if (arg == formChanges[i].param1) { - if (!formChanges[i].param2) + switch (formChanges[i].param2) { + case DAY: + RtcCalcLocalTime(); + if (gLocalTime.hours >= 12 && gLocalTime.hours < 24) + targetSpecies = formChanges[i].targetSpecies; + break; + case NIGHT: + RtcCalcLocalTime(); + if (gLocalTime.hours >= 0 && gLocalTime.hours < 12) + targetSpecies = formChanges[i].targetSpecies; + break; + default: targetSpecies = formChanges[i].targetSpecies; - } - else - { - switch (formChanges[i].param2) - { - case DAY: - if (gLocalTime.hours >= 12 && gLocalTime.hours < 24) - targetSpecies = formChanges[i].targetSpecies; - break; - case NIGHT: - if (gLocalTime.hours >= 0 && gLocalTime.hours < 12) - targetSpecies = formChanges[i].targetSpecies; - break; - } + break; } } break;