From dc2e210ade38bc5789764d0c3836c3d995a1d4ef Mon Sep 17 00:00:00 2001 From: laqieer Date: Sun, 23 Jan 2022 17:31:54 +0800 Subject: [PATCH 01/65] Install libpng using pacman instead of manual build for msys2 --- INSTALL.md | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 1ad3b4b0c..1f1e1164b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -125,12 +125,12 @@ Otherwise, ask for help on Discord or IRC (see [README.md](README.md)), or conti Note that in msys2, Copy is Ctrl+Insert and Paste is Shift+Insert. -1. Open msys2 at C:\devkitPro\msys2\msys2_shell.bat. +1. Open msys2 at C:\devkitPro\msys2\mingw64.exe or run `C:\devkitPro\msys2\msys2_shell.bat -mingw64`. 2. Certain packages are required to build pokeemerald. Install these by running the following command: ```bash - pacman -S make gcc zlib-devel git + pacman -S make zlib-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-libpng ```
Note... @@ -138,39 +138,6 @@ Note that in msys2, Copy is Ctrl+Insert and Paste is Shift+Insert. > This command will ask for confirmation, just enter the yes action when prompted.
-3. Download [libpng](https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.xz/download). - -4. Change directory to where libpng was downloaded. By default, msys2 will start in the current user's profile folder, located at **C:\Users\\⁠_\_**, where *\* is your Windows username. In most cases, libpng should be saved within a subfolder of the profile folder. For example, if libpng was saved to **C:\Users\\_\_\Downloads** (the Downloads location for most users), enter this command: - - ```bash - cd Downloads - ``` - -
- Notes... - - > Note 1: While not shown, msys uses forward slashes `/` instead of backwards slashes `\` as the directory separator. - > Note 2: If the path has spaces, then the path must be wrapped with quotations, e.g. `cd "Downloads/My Downloads"`. - > Note 3: Windows path names are case-insensitive so adhering to capitalization isn’t needed. - > Note 4: If libpng was saved elsewhere, you will need to specify the full path to where libpng was downloaded, e.g. `cd c:/devkitpro/msys2` if it was saved there. -
- -5. Run the following commands to uncompress and install libpng. - - ```bash - tar xf libpng-1.6.37.tar.xz - cd libpng-1.6.37 - ./configure --prefix=/usr - make check - make install - ``` - -6. Then finally, run the following command to change back to the user profile folder. - - ```bash - cd - ``` - ### Choosing where to store pokeemerald (msys2) At this point, you can choose a folder to store pokeemerald into. If you're okay with storing pokeemerald in the user profile folder, then proceed to [Installation](#installation). Otherwise, you'll need to account for where pokeemerald is stored when changing directory to the pokeemerald folder. From 40efac0ddf1b6f89bcebc371e2c46b163abb6a3c Mon Sep 17 00:00:00 2001 From: sphericalice Date: Tue, 22 Feb 2022 19:13:17 +0000 Subject: [PATCH 02/65] Rename GetBattlePyramindTrainerEncounterMusicId to fix typo --- include/battle_pyramid.h | 2 +- src/battle_pyramid.c | 2 +- src/pokemon.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/battle_pyramid.h b/include/battle_pyramid.h index c4a72095f..62320358b 100644 --- a/include/battle_pyramid.h +++ b/include/battle_pyramid.h @@ -14,7 +14,7 @@ void SoftResetInBattlePyramid(void); void CopyPyramidTrainerSpeechBefore(u16 trainerId); void CopyPyramidTrainerWinSpeech(u16 trainerId); void CopyPyramidTrainerLoseSpeech(u16 trainerId); -u8 GetBattlePyramindTrainerEncounterMusicId(u16 trainerId); +u8 GetTrainerEncounterMusicIdInBattlePyramid(u16 trainerId); void GenerateBattlePyramidFloorLayout(u16 *mapArg, bool8 setPlayerPosition); void LoadBattlePyramidObjectEventTemplates(void); void LoadBattlePyramidFloorObjectEventScripts(void); diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 154760396..9039f60f2 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -1465,7 +1465,7 @@ void CopyPyramidTrainerLoseSpeech(u16 trainerId) FrontierSpeechToString(gFacilityTrainers[trainerId].speechLose); } -u8 GetBattlePyramindTrainerEncounterMusicId(u16 trainerId) +u8 GetTrainerEncounterMusicIdInBattlePyramid(u16 trainerId) { int i; diff --git a/src/pokemon.c b/src/pokemon.c index 08a6fd0f9..61125e362 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5810,7 +5810,7 @@ s32 GetBattlerMultiplayerId(u16 a1) u8 GetTrainerEncounterMusicId(u16 trainerOpponentId) { if (InBattlePyramid()) - return GetBattlePyramindTrainerEncounterMusicId(trainerOpponentId); + return GetTrainerEncounterMusicIdInBattlePyramid(trainerOpponentId); else if (InTrainerHillChallenge()) return GetTrainerEncounterMusicIdInTrainerHill(trainerOpponentId); else From f826a5a82d3563cf30f7acd5270f200119cc6745 Mon Sep 17 00:00:00 2001 From: cbt6 <91667135+cbt6@users.noreply.github.com> Date: Wed, 23 Feb 2022 15:07:22 +0800 Subject: [PATCH 03/65] Use constants for PC locations --- data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc | 4 ++-- data/maps/LittlerootTown_MaysHouse_2F/scripts.inc | 4 ++-- data/scripts/pc.inc | 4 ++-- src/field_specials.c | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc b/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc index 901940ab8..cd4d15519 100644 --- a/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc +++ b/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc @@ -243,7 +243,7 @@ LittlerootTown_BrendansHouse_2F_EventScript_PC:: end LittlerootTown_BrendansHouse_2F_EventScript_CheckPlayersPC:: - setvar VAR_0x8004, 1 + setvar VAR_0x8004, PC_LOCATION_BRENDANS_HOUSE special DoPCTurnOnEffect playse SE_PC_ON msgbox gText_PlayerHouseBootPC, MSGBOX_DEFAULT @@ -253,7 +253,7 @@ LittlerootTown_BrendansHouse_2F_EventScript_CheckPlayersPC:: end LittlerootTown_BrendansHouse_2F_EventScript_TurnOffPlayerPC:: - setvar VAR_0x8004, 1 + setvar VAR_0x8004, PC_LOCATION_BRENDANS_HOUSE playse SE_PC_OFF special DoPCTurnOffEffect releaseall diff --git a/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc b/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc index 7403f3fcf..ef8e83bf7 100644 --- a/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc +++ b/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc @@ -294,7 +294,7 @@ LittlerootTown_MaysHouse_2F_EventScript_CheckRivalsPC:: end LittlerootTown_MaysHouse_2F_EventScript_CheckPlayersPC:: - setvar VAR_0x8004, 2 + setvar VAR_0x8004, PC_LOCATION_MAYS_HOUSE special DoPCTurnOnEffect playse SE_PC_ON msgbox gText_PlayerHouseBootPC, MSGBOX_DEFAULT @@ -304,7 +304,7 @@ LittlerootTown_MaysHouse_2F_EventScript_CheckPlayersPC:: end LittlerootTown_MaysHouse_2F_EventScript_TurnOffPlayerPC:: - setvar VAR_0x8004, 2 + setvar VAR_0x8004, PC_LOCATION_MAYS_HOUSE playse SE_PC_OFF special DoPCTurnOffEffect releaseall diff --git a/data/scripts/pc.inc b/data/scripts/pc.inc index 43c0bca0d..1993aaf63 100644 --- a/data/scripts/pc.inc +++ b/data/scripts/pc.inc @@ -1,6 +1,6 @@ EventScript_PC:: lockall - setvar VAR_0x8004, 0 + setvar VAR_0x8004, PC_LOCATION_OTHER special DoPCTurnOnEffect playse SE_PC_ON msgbox Text_BootUpPC, MSGBOX_DEFAULT @@ -51,7 +51,7 @@ EventScript_AccessLanettesPC:: return EventScript_TurnOffPC:: - setvar VAR_0x8004, 0 + setvar VAR_0x8004, PC_LOCATION_OTHER playse SE_PC_OFF special DoPCTurnOffEffect releaseall diff --git a/src/field_specials.c b/src/field_specials.c index f749ea8fc..a4cdafafc 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1069,11 +1069,11 @@ static void PCTurnOffEffect(void) dy = -1; break; } - if (gSpecialVar_0x8004 == 0) + if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) tileId = METATILE_Building_PC_Off; - else if (gSpecialVar_0x8004 == 1) + else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) tileId = METATILE_BrendansMaysHouse_BrendanPC_Off; - else if (gSpecialVar_0x8004 == 2) + else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) tileId = METATILE_BrendansMaysHouse_MayPC_Off; MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK); DrawWholeMapView(); From 36e5d5e759d32e4987ffbbac70f84978e1893d16 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 27 Feb 2022 13:47:50 -0500 Subject: [PATCH 04/65] Add missing menu array counts --- src/main_menu.c | 2 +- src/menu.c | 8 ++++---- src/player_pc.c | 4 ++-- src/secret_base.c | 2 +- src/trade.c | 2 +- src/trader.c | 18 +++++++----------- src/union_room_chat.c | 2 +- 7 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/main_menu.c b/src/main_menu.c index 54a4f6891..ed6158a9c 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -2090,7 +2090,7 @@ static void NewGameBirchSpeech_ShowGenderMenu(void) DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3); FillWindowPixelBuffer(1, PIXEL_FILL(1)); PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender); - InitMenuInUpperLeftCornerNormal(1, 2, 0); + InitMenuInUpperLeftCornerNormal(1, ARRAY_COUNT(sMenuActions_Gender), 0); PutWindowTilemap(1); CopyWindowToVram(1, COPYWIN_FULL); } diff --git a/src/menu.c b/src/menu.c index 6b915f9ce..49baddded 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1542,25 +1542,25 @@ static s8 Menu_ProcessGridInputRepeat(void) { return MENU_B_PRESSED; } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_UP) { if (oldPos != ChangeGridMenuCursorPosition(0, -1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN) { if (oldPos != ChangeGridMenuCursorPosition(0, 1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED) { if (oldPos != ChangeGridMenuCursorPosition(-1, 0)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED) { if (oldPos != ChangeGridMenuCursorPosition(1, 0)) PlaySE(SE_SELECT); diff --git a/src/player_pc.c b/src/player_pc.c index 06f58fdeb..bf8479ce1 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -511,7 +511,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var) tWindowId = AddWindow(&windowTemplate); SetStandardWindowBorderStyle(tWindowId, 0); PrintMenuTable(tWindowId, ARRAY_COUNT(sItemStorage_MenuActions), sItemStorage_MenuActions); - InitMenuInUpperLeftCornerNormal(tWindowId, 4, var); + InitMenuInUpperLeftCornerNormal(tWindowId, ARRAY_COUNT(sItemStorage_MenuActions), var); ScheduleBgCopyTilemapToVram(0); ItemStorageMenuPrint(sItemStorage_OptionDescriptions[var]); } @@ -753,7 +753,7 @@ static void Mailbox_PrintMailOptions(u8 taskId) { u8 windowId = MailboxMenu_AddWindow(MAILBOXWIN_OPTIONS); PrintMenuTable(windowId, ARRAY_COUNT(gMailboxMailOptions), gMailboxMailOptions); - InitMenuInUpperLeftCornerNormal(windowId, 4, 0); + InitMenuInUpperLeftCornerNormal(windowId, ARRAY_COUNT(gMailboxMailOptions), 0); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = Mailbox_MailOptionsProcessInput; } diff --git a/src/secret_base.c b/src/secret_base.c index 9398c4bb2..fa424889e 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1027,7 +1027,7 @@ static void ShowRegistryMenuActions(u8 taskId) tActionWindowId = AddWindow(&template); SetStandardWindowBorderStyle(tActionWindowId, 0); PrintMenuTable(tActionWindowId, ARRAY_COUNT(sRegistryMenuActions), sRegistryMenuActions); - InitMenuInUpperLeftCornerNormal(tActionWindowId, 2, 0); + InitMenuInUpperLeftCornerNormal(tActionWindowId, ARRAY_COUNT(sRegistryMenuActions), 0); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = HandleRegistryMenuActionsInput; } diff --git a/src/trade.c b/src/trade.c index b48d1abf5..dd0851bbd 100644 --- a/src/trade.c +++ b/src/trade.c @@ -1394,7 +1394,7 @@ static void TradeMenuProcessInput(void) DrawTextBorderOuter(1, 1, 14); FillWindowPixelBuffer(1, PIXEL_FILL(1)); PrintMenuTable(1, ARRAY_COUNT(sSelectTradeMonActions), sSelectTradeMonActions); - InitMenuInUpperLeftCornerNormal(1, 2, 0); + InitMenuInUpperLeftCornerNormal(1, ARRAY_COUNT(sSelectTradeMonActions), 0); PutWindowTilemap(1); CopyWindowToVram(1, COPYWIN_FULL); sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_SELECTED_MON; diff --git a/src/trader.c b/src/trader.c index abe581db3..b89ad6043 100644 --- a/src/trader.c +++ b/src/trader.c @@ -15,7 +15,7 @@ #include "task.h" #include "script_menu.h" -static const u8 * const sDefaultTraderNames[] = +static const u8 * const sDefaultTraderNames[NUM_TRADER_ITEMS] = { gText_Tristan, gText_Philip, @@ -23,7 +23,7 @@ static const u8 * const sDefaultTraderNames[] = gText_Roberto, }; -static const u8 sDefaultTraderDecorations[] = +static const u8 sDefaultTraderDecorations[NUM_TRADER_ITEMS] = { DECOR_DUSKULL_DOLL, DECOR_BALL_CUSHION, @@ -39,7 +39,7 @@ void TraderSetup(void) trader->id = MAUVILLE_MAN_TRADER; trader->alreadyTraded = FALSE; - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_TRADER_ITEMS; i++) { StringCopy(trader->playerNames[i], sDefaultTraderNames[i]); trader->decorations[i] = sDefaultTraderDecorations[i]; @@ -61,7 +61,7 @@ void CreateAvailableDecorationsMenu(u8 taskId) struct WindowTemplate windowTemplate = {0, 1, 1, 10, 10, 15, 1}; s32 windowWidth = GetStringWidth(FONT_NORMAL, gText_Exit, 0); s32 fiveMarksWidth = GetStringWidth(FONT_NORMAL, gText_FiveMarks, 0); - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_TRADER_ITEMS; i++) { s32 curWidth; if (trader->decorations[i] > NUM_DECORATIONS) @@ -74,7 +74,7 @@ void CreateAvailableDecorationsMenu(u8 taskId) windowTemplate.width = ConvertPixelWidthToTileWidth(windowWidth); data[3] = AddWindow(&windowTemplate); DrawStdFrameWithCustomTileAndPalette(data[3], FALSE, 0x214, 14); - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_TRADER_ITEMS; i++) { if (trader->decorations[i] > NUM_DECORATIONS) AddTextPrinterParameterized(data[3], FONT_NORMAL, gText_FiveMarks, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); @@ -82,7 +82,7 @@ void CreateAvailableDecorationsMenu(u8 taskId) AddTextPrinterParameterized(data[3], FONT_NORMAL, gDecorations[trader->decorations[i]].name, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); } AddTextPrinterParameterized(data[3], FONT_NORMAL, gText_Exit, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); - InitMenuInUpperLeftCornerNormal(data[3], 5, 0); + InitMenuInUpperLeftCornerNormal(data[3], NUM_TRADER_ITEMS + 1, 0); ScheduleBgCopyTilemapToVram(0); } @@ -90,13 +90,9 @@ void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId) { s16 * data = gTasks[taskId].data; if (decorationId > NUM_DECORATIONS) - { gSpecialVar_0x8004 = 0xFFFF; - } else - { gSpecialVar_0x8004 = decorationId; - } ClearStdWindowAndFrameToTransparent(data[3], FALSE); ClearWindowTilemap(data[3]); @@ -116,7 +112,7 @@ void Task_HandleGetDecorationMenuInput(u8 taskId) case MENU_NOTHING_CHOSEN: break; case MENU_B_PRESSED: - case 4: + case NUM_TRADER_ITEMS: PlaySE(SE_SELECT); Task_BufferDecorSelectionAndCloseWindow(taskId, 0); break; diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 22268ef4a..9890bc1f8 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -2987,7 +2987,7 @@ static void ShowKeyboardSwapMenu(void) { FillWindowPixelBuffer(3, PIXEL_FILL(1)); DrawTextBorderOuter(3, 1, 13); - PrintMenuActionTextsAtPos(3, FONT_SHORT, 8, 1, 14, 5, sKeyboardPageTitleTexts); + PrintMenuActionTextsAtPos(3, FONT_SHORT, 8, 1, 14, ARRAY_COUNT(sKeyboardPageTitleTexts), sKeyboardPageTitleTexts); InitMenuNormal(3, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage()); PutWindowTilemap(3); } From 3d0663fe811cdd01010b391b88423f91387f89e1 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 27 Feb 2022 13:58:48 -0500 Subject: [PATCH 05/65] Additional trader clean up --- src/decoration_inventory.c | 2 +- src/trader.c | 34 ++++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/decoration_inventory.c b/src/decoration_inventory.c index af1071b1b..c84ee69a4 100644 --- a/src/decoration_inventory.c +++ b/src/decoration_inventory.c @@ -33,7 +33,7 @@ static void ClearDecorationInventory(u8 category) void ClearDecorationInventories(void) { u8 category; - for (category = 0; category < 8; category++) + for (category = 0; category < DECORCAT_COUNT; category++) ClearDecorationInventory(category); } diff --git a/src/trader.c b/src/trader.c index b89ad6043..040ee695b 100644 --- a/src/trader.c +++ b/src/trader.c @@ -53,12 +53,22 @@ void Trader_ResetFlag(void) trader->alreadyTraded = FALSE; } +#define tWindowId data[3] + void CreateAvailableDecorationsMenu(u8 taskId) { u8 i; s16 * data = gTasks[taskId].data; struct MauvilleOldManTrader *trader = &gSaveBlock1Ptr->oldMan.trader; - struct WindowTemplate windowTemplate = {0, 1, 1, 10, 10, 15, 1}; + struct WindowTemplate windowTemplate = { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 10, + .height = 10, + .paletteNum = 15, + .baseBlock = 1 + }; s32 windowWidth = GetStringWidth(FONT_NORMAL, gText_Exit, 0); s32 fiveMarksWidth = GetStringWidth(FONT_NORMAL, gText_FiveMarks, 0); for (i = 0; i < NUM_TRADER_ITEMS; i++) @@ -72,17 +82,17 @@ void CreateAvailableDecorationsMenu(u8 taskId) windowWidth = curWidth; } windowTemplate.width = ConvertPixelWidthToTileWidth(windowWidth); - data[3] = AddWindow(&windowTemplate); - DrawStdFrameWithCustomTileAndPalette(data[3], FALSE, 0x214, 14); + tWindowId = AddWindow(&windowTemplate); + DrawStdFrameWithCustomTileAndPalette(tWindowId, FALSE, 0x214, 14); for (i = 0; i < NUM_TRADER_ITEMS; i++) { if (trader->decorations[i] > NUM_DECORATIONS) - AddTextPrinterParameterized(data[3], FONT_NORMAL, gText_FiveMarks, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(tWindowId, FONT_NORMAL, gText_FiveMarks, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); else - AddTextPrinterParameterized(data[3], FONT_NORMAL, gDecorations[trader->decorations[i]].name, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(tWindowId, FONT_NORMAL, gDecorations[trader->decorations[i]].name, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); } - AddTextPrinterParameterized(data[3], FONT_NORMAL, gText_Exit, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); - InitMenuInUpperLeftCornerNormal(data[3], NUM_TRADER_ITEMS + 1, 0); + AddTextPrinterParameterized(tWindowId, FONT_NORMAL, gText_Exit, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); + InitMenuInUpperLeftCornerNormal(tWindowId, NUM_TRADER_ITEMS + 1, 0); ScheduleBgCopyTilemapToVram(0); } @@ -94,9 +104,9 @@ void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId) else gSpecialVar_0x8004 = decorationId; - ClearStdWindowAndFrameToTransparent(data[3], FALSE); - ClearWindowTilemap(data[3]); - RemoveWindow(data[3]); + ClearStdWindowAndFrameToTransparent(tWindowId, FALSE); + ClearWindowTilemap(tWindowId); + RemoveWindow(tWindowId); ScheduleBgCopyTilemapToVram(0); DestroyTask(taskId); EnableBothScriptContexts(); @@ -112,7 +122,7 @@ void Task_HandleGetDecorationMenuInput(u8 taskId) case MENU_NOTHING_CHOSEN: break; case MENU_B_PRESSED: - case NUM_TRADER_ITEMS: + case NUM_TRADER_ITEMS: // EXIT PlaySE(SE_SELECT); Task_BufferDecorSelectionAndCloseWindow(taskId, 0); break; @@ -136,7 +146,7 @@ void DoesPlayerHaveNoDecorations(void) { u8 i; - for (i = 0; i < 8; i++) + for (i = 0; i < DECORCAT_COUNT; i++) { if (GetNumOwnedDecorationsInCategory(i)) { From 5d58cdd2971b8644e60bc65bd79177d4f5bf4d93 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 28 Feb 2022 13:34:39 -0500 Subject: [PATCH 06/65] Fix bunny hoppy typo --- include/constants/event_object_movement.h | 16 ++++----- src/data/object_events/object_event_anims.h | 32 +++++++++--------- src/event_object_movement.c | 36 ++++++++++----------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/include/constants/event_object_movement.h b/include/constants/event_object_movement.h index 2c4273524..a9d59935e 100755 --- a/include/constants/event_object_movement.h +++ b/include/constants/event_object_movement.h @@ -273,14 +273,14 @@ #define ANIM_RUN_WEST (ANIM_STD_COUNT + 2) #define ANIM_RUN_EAST (ANIM_STD_COUNT + 3) -#define ANIM_BUNNY_HOPPY_BACK_WHEEL_SOUTH (ANIM_STD_COUNT + 0) -#define ANIM_BUNNY_HOPPY_BACK_WHEEL_NORTH (ANIM_STD_COUNT + 1) -#define ANIM_BUNNY_HOPPY_BACK_WHEEL_WEST (ANIM_STD_COUNT + 2) -#define ANIM_BUNNY_HOPPY_BACK_WHEEL_EAST (ANIM_STD_COUNT + 3) -#define ANIM_BUNNY_HOPPY_FRONT_WHEEL_SOUTH (ANIM_STD_COUNT + 4) -#define ANIM_BUNNY_HOPPY_FRONT_WHEEL_NORTH (ANIM_STD_COUNT + 5) -#define ANIM_BUNNY_HOPPY_FRONT_WHEEL_WEST (ANIM_STD_COUNT + 6) -#define ANIM_BUNNY_HOPPY_FRONT_WHEEL_EAST (ANIM_STD_COUNT + 7) +#define ANIM_BUNNY_HOP_BACK_WHEEL_SOUTH (ANIM_STD_COUNT + 0) +#define ANIM_BUNNY_HOP_BACK_WHEEL_NORTH (ANIM_STD_COUNT + 1) +#define ANIM_BUNNY_HOP_BACK_WHEEL_WEST (ANIM_STD_COUNT + 2) +#define ANIM_BUNNY_HOP_BACK_WHEEL_EAST (ANIM_STD_COUNT + 3) +#define ANIM_BUNNY_HOP_FRONT_WHEEL_SOUTH (ANIM_STD_COUNT + 4) +#define ANIM_BUNNY_HOP_FRONT_WHEEL_NORTH (ANIM_STD_COUNT + 5) +#define ANIM_BUNNY_HOP_FRONT_WHEEL_WEST (ANIM_STD_COUNT + 6) +#define ANIM_BUNNY_HOP_FRONT_WHEEL_EAST (ANIM_STD_COUNT + 7) #define ANIM_STANDING_WHEELIE_BACK_WHEEL_SOUTH (ANIM_STD_COUNT + 8) #define ANIM_STANDING_WHEELIE_BACK_WHEEL_NORTH (ANIM_STD_COUNT + 9) #define ANIM_STANDING_WHEELIE_BACK_WHEEL_WEST (ANIM_STD_COUNT + 10) diff --git a/src/data/object_events/object_event_anims.h b/src/data/object_events/object_event_anims.h index a5fb41462..f96e52de5 100755 --- a/src/data/object_events/object_event_anims.h +++ b/src/data/object_events/object_event_anims.h @@ -413,56 +413,56 @@ static const union AnimCmd sAnim_GetOnOffSurfBlobEast[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd sAnim_BunnyHoppyBackWheelSouth[] = +static const union AnimCmd sAnim_BunnyHopBackWheelSouth[] = { ANIMCMD_FRAME(9, 4), ANIMCMD_FRAME(10, 4), ANIMCMD_END, }; -static const union AnimCmd sAnim_BunnyHoppyBackWheelNorth[] = +static const union AnimCmd sAnim_BunnyHopBackWheelNorth[] = { ANIMCMD_FRAME(13, 4), ANIMCMD_FRAME(14, 4), ANIMCMD_END, }; -static const union AnimCmd sAnim_BunnyHoppyBackWheelWest[] = +static const union AnimCmd sAnim_BunnyHopBackWheelWest[] = { ANIMCMD_FRAME(17, 4), ANIMCMD_FRAME(18, 4), ANIMCMD_END, }; -static const union AnimCmd sAnim_BunnyHoppyBackWheelEast[] = +static const union AnimCmd sAnim_BunnyHopBackWheelEast[] = { ANIMCMD_FRAME(17, 4, .hFlip = TRUE), ANIMCMD_FRAME(18, 4, .hFlip = TRUE), ANIMCMD_END, }; -static const union AnimCmd sAnim_BunnyHoppyFrontWheelSouth[] = +static const union AnimCmd sAnim_BunnyHopFrontWheelSouth[] = { ANIMCMD_FRAME(11, 4), ANIMCMD_FRAME(12, 4), ANIMCMD_END, }; -static const union AnimCmd sAnim_BunnyHoppyFrontWheelNorth[] = +static const union AnimCmd sAnim_BunnyHopFrontWheelNorth[] = { ANIMCMD_FRAME(15, 4), ANIMCMD_FRAME(16, 4), ANIMCMD_END, }; -static const union AnimCmd sAnim_BunnyHoppyFrontWheelWest[] = +static const union AnimCmd sAnim_BunnyHopFrontWheelWest[] = { ANIMCMD_FRAME(19, 4), ANIMCMD_FRAME(20, 4), ANIMCMD_END, }; -static const union AnimCmd sAnim_BunnyHoppyFrontWheelEast[] = +static const union AnimCmd sAnim_BunnyHopFrontWheelEast[] = { ANIMCMD_FRAME(19, 4, .hFlip = TRUE), ANIMCMD_FRAME(20, 4, .hFlip = TRUE), @@ -1024,14 +1024,14 @@ static const union AnimCmd *const sAnimTable_AcroBike[] = { [ANIM_STD_GO_FASTEST_NORTH] = sAnim_GoFastestNorth, [ANIM_STD_GO_FASTEST_WEST] = sAnim_GoFastestWest, [ANIM_STD_GO_FASTEST_EAST] = sAnim_GoFastestEast, - [ANIM_BUNNY_HOPPY_BACK_WHEEL_SOUTH] = sAnim_BunnyHoppyBackWheelSouth, - [ANIM_BUNNY_HOPPY_BACK_WHEEL_NORTH] = sAnim_BunnyHoppyBackWheelNorth, - [ANIM_BUNNY_HOPPY_BACK_WHEEL_WEST] = sAnim_BunnyHoppyBackWheelWest, - [ANIM_BUNNY_HOPPY_BACK_WHEEL_EAST] = sAnim_BunnyHoppyBackWheelEast, - [ANIM_BUNNY_HOPPY_FRONT_WHEEL_SOUTH] = sAnim_BunnyHoppyFrontWheelSouth, - [ANIM_BUNNY_HOPPY_FRONT_WHEEL_NORTH] = sAnim_BunnyHoppyFrontWheelNorth, - [ANIM_BUNNY_HOPPY_FRONT_WHEEL_WEST] = sAnim_BunnyHoppyFrontWheelWest, - [ANIM_BUNNY_HOPPY_FRONT_WHEEL_EAST] = sAnim_BunnyHoppyFrontWheelEast, + [ANIM_BUNNY_HOP_BACK_WHEEL_SOUTH] = sAnim_BunnyHopBackWheelSouth, + [ANIM_BUNNY_HOP_BACK_WHEEL_NORTH] = sAnim_BunnyHopBackWheelNorth, + [ANIM_BUNNY_HOP_BACK_WHEEL_WEST] = sAnim_BunnyHopBackWheelWest, + [ANIM_BUNNY_HOP_BACK_WHEEL_EAST] = sAnim_BunnyHopBackWheelEast, + [ANIM_BUNNY_HOP_FRONT_WHEEL_SOUTH] = sAnim_BunnyHopFrontWheelSouth, + [ANIM_BUNNY_HOP_FRONT_WHEEL_NORTH] = sAnim_BunnyHopFrontWheelNorth, + [ANIM_BUNNY_HOP_FRONT_WHEEL_WEST] = sAnim_BunnyHopFrontWheelWest, + [ANIM_BUNNY_HOP_FRONT_WHEEL_EAST] = sAnim_BunnyHopFrontWheelEast, [ANIM_STANDING_WHEELIE_BACK_WHEEL_SOUTH] = sAnim_StandingWheelieBackWheelSouth, [ANIM_STANDING_WHEELIE_BACK_WHEEL_NORTH] = sAnim_StandingWheelieBackWheelNorth, [ANIM_STANDING_WHEELIE_BACK_WHEEL_WEST] = sAnim_StandingWheelieBackWheelWest, diff --git a/src/event_object_movement.c b/src/event_object_movement.c index df79a1d62..eb699e89f 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -744,26 +744,26 @@ static const u8 sJumpSpecialDirectionAnimNums[] = { // used for jumping onto sur [DIR_NORTHEAST] = ANIM_GET_ON_OFF_POKEMON_NORTH, }; static const u8 sAcroWheelieDirectionAnimNums[] = { - [DIR_NONE] = ANIM_BUNNY_HOPPY_BACK_WHEEL_SOUTH, - [DIR_SOUTH] = ANIM_BUNNY_HOPPY_BACK_WHEEL_SOUTH, - [DIR_NORTH] = ANIM_BUNNY_HOPPY_BACK_WHEEL_NORTH, - [DIR_WEST] = ANIM_BUNNY_HOPPY_BACK_WHEEL_WEST, - [DIR_EAST] = ANIM_BUNNY_HOPPY_BACK_WHEEL_EAST, - [DIR_SOUTHWEST] = ANIM_BUNNY_HOPPY_BACK_WHEEL_SOUTH, - [DIR_SOUTHEAST] = ANIM_BUNNY_HOPPY_BACK_WHEEL_SOUTH, - [DIR_NORTHWEST] = ANIM_BUNNY_HOPPY_BACK_WHEEL_NORTH, - [DIR_NORTHEAST] = ANIM_BUNNY_HOPPY_BACK_WHEEL_NORTH, + [DIR_NONE] = ANIM_BUNNY_HOP_BACK_WHEEL_SOUTH, + [DIR_SOUTH] = ANIM_BUNNY_HOP_BACK_WHEEL_SOUTH, + [DIR_NORTH] = ANIM_BUNNY_HOP_BACK_WHEEL_NORTH, + [DIR_WEST] = ANIM_BUNNY_HOP_BACK_WHEEL_WEST, + [DIR_EAST] = ANIM_BUNNY_HOP_BACK_WHEEL_EAST, + [DIR_SOUTHWEST] = ANIM_BUNNY_HOP_BACK_WHEEL_SOUTH, + [DIR_SOUTHEAST] = ANIM_BUNNY_HOP_BACK_WHEEL_SOUTH, + [DIR_NORTHWEST] = ANIM_BUNNY_HOP_BACK_WHEEL_NORTH, + [DIR_NORTHEAST] = ANIM_BUNNY_HOP_BACK_WHEEL_NORTH, }; static const u8 sAcroUnusedDirectionAnimNums[] = { - [DIR_NONE] = ANIM_BUNNY_HOPPY_FRONT_WHEEL_SOUTH, - [DIR_SOUTH] = ANIM_BUNNY_HOPPY_FRONT_WHEEL_SOUTH, - [DIR_NORTH] = ANIM_BUNNY_HOPPY_FRONT_WHEEL_NORTH, - [DIR_WEST] = ANIM_BUNNY_HOPPY_FRONT_WHEEL_WEST, - [DIR_EAST] = ANIM_BUNNY_HOPPY_FRONT_WHEEL_EAST, - [DIR_SOUTHWEST] = ANIM_BUNNY_HOPPY_FRONT_WHEEL_SOUTH, - [DIR_SOUTHEAST] = ANIM_BUNNY_HOPPY_FRONT_WHEEL_SOUTH, - [DIR_NORTHWEST] = ANIM_BUNNY_HOPPY_FRONT_WHEEL_NORTH, - [DIR_NORTHEAST] = ANIM_BUNNY_HOPPY_FRONT_WHEEL_NORTH, + [DIR_NONE] = ANIM_BUNNY_HOP_FRONT_WHEEL_SOUTH, + [DIR_SOUTH] = ANIM_BUNNY_HOP_FRONT_WHEEL_SOUTH, + [DIR_NORTH] = ANIM_BUNNY_HOP_FRONT_WHEEL_NORTH, + [DIR_WEST] = ANIM_BUNNY_HOP_FRONT_WHEEL_WEST, + [DIR_EAST] = ANIM_BUNNY_HOP_FRONT_WHEEL_EAST, + [DIR_SOUTHWEST] = ANIM_BUNNY_HOP_FRONT_WHEEL_SOUTH, + [DIR_SOUTHEAST] = ANIM_BUNNY_HOP_FRONT_WHEEL_SOUTH, + [DIR_NORTHWEST] = ANIM_BUNNY_HOP_FRONT_WHEEL_NORTH, + [DIR_NORTHEAST] = ANIM_BUNNY_HOP_FRONT_WHEEL_NORTH, }; static const u8 sAcroEndWheelieDirectionAnimNums[] = { [DIR_NONE] = ANIM_STANDING_WHEELIE_BACK_WHEEL_SOUTH, From 8bf7e7b6f5abad1a4f0772a88ed415079edb7df8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 2 Mar 2022 19:45:28 -0500 Subject: [PATCH 07/65] Improve egg hatch documentation --- .../egg_hatch.png => pokemon/egg/hatch.png} | Bin .../egg_shard.png => pokemon/egg/shard.png} | Bin src/egg_hatch.c | 476 ++++++++++-------- 3 files changed, 265 insertions(+), 211 deletions(-) rename graphics/{misc/egg_hatch.png => pokemon/egg/hatch.png} (100%) rename graphics/{misc/egg_shard.png => pokemon/egg/shard.png} (100%) diff --git a/graphics/misc/egg_hatch.png b/graphics/pokemon/egg/hatch.png similarity index 100% rename from graphics/misc/egg_hatch.png rename to graphics/pokemon/egg/hatch.png diff --git a/graphics/misc/egg_shard.png b/graphics/pokemon/egg/shard.png similarity index 100% rename from graphics/misc/egg_shard.png rename to graphics/pokemon/egg/shard.png diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 283ec753a..5dd83c9b1 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -37,16 +37,24 @@ #include "battle.h" // to get rid of later #include "constants/rgb.h" +#define GFXTAG_EGG 12345 +#define GFXTAG_EGG_SHARD 23456 + +#define PALTAG_EGG 54321 + +#define EGG_X (DISPLAY_WIDTH / 2) +#define EGG_Y (DISPLAY_HEIGHT / 2 - 5) + struct EggHatchData { - u8 eggSpriteID; - u8 pokeSpriteID; - u8 CB2_state; - u8 CB2_PalCounter; - u8 eggPartyID; + u8 eggSpriteId; + u8 monSpriteId; + u8 state; + u8 delayTimer; + u8 eggPartyId; u8 unused_5; u8 unused_6; - u8 eggShardVelocityID; + u8 eggShardVelocityId; u8 windowId; u8 unused_9; u8 unused_A; @@ -58,29 +66,27 @@ extern const u32 gTradePlatform_Tilemap[]; extern const u8 gText_HatchedFromEgg[]; extern const u8 gText_NicknameHatchPrompt[]; -static void Task_EggHatch(u8 taskID); -static void CB2_EggHatch_0(void); -static void CB2_EggHatch_1(void); -static void SpriteCB_Egg_0(struct Sprite* sprite); -static void SpriteCB_Egg_1(struct Sprite* sprite); -static void SpriteCB_Egg_2(struct Sprite* sprite); -static void SpriteCB_Egg_3(struct Sprite* sprite); -static void SpriteCB_Egg_4(struct Sprite* sprite); -static void SpriteCB_Egg_5(struct Sprite* sprite); -static void SpriteCB_EggShard(struct Sprite* sprite); -static void EggHatchPrintMessage(u8 windowId, u8* string, u8 x, u8 y, u8 speed); +static void Task_EggHatch(u8); +static void CB2_LoadEggHatch(void); +static void CB2_EggHatch(void); +static void SpriteCB_Egg_Shake1(struct Sprite*); +static void SpriteCB_Egg_Shake2(struct Sprite*); +static void SpriteCB_Egg_Shake3(struct Sprite*); +static void SpriteCB_Egg_WaitHatch(struct Sprite*); +static void SpriteCB_Egg_Hatch(struct Sprite*); +static void SpriteCB_Egg_Reveal(struct Sprite*); +static void SpriteCB_EggShard(struct Sprite*); +static void EggHatchPrintMessage(u8, u8*, u8, u8, u8); static void CreateRandomEggShardSprite(void); -static void CreateEggShardSprite(u8 x, u8 y, s16 data1, s16 data2, s16 data3, u8 spriteAnimIndex); +static void CreateEggShardSprite(u8, u8, s16, s16, s16, u8); -// IWRAM bss static struct EggHatchData *sEggHatchData; -// rom data -static const u16 sEggPalette[] = INCBIN_U16("graphics/pokemon/egg/normal.gbapal"); -static const u8 sEggHatchTiles[] = INCBIN_U8("graphics/misc/egg_hatch.4bpp"); -static const u8 sEggShardTiles[] = INCBIN_U8("graphics/misc/egg_shard.4bpp"); +static const u16 sEggPalette[] = INCBIN_U16("graphics/pokemon/egg/normal.gbapal"); +static const u8 sEggHatchTiles[] = INCBIN_U8("graphics/pokemon/egg/hatch.4bpp"); +static const u8 sEggShardTiles[] = INCBIN_U8("graphics/pokemon/egg/shard.4bpp"); -static const struct OamData sOamData_EggHatch = +static const struct OamData sOamData_Egg = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -97,64 +103,71 @@ static const struct OamData sOamData_EggHatch = .affineParam = 0, }; -static const union AnimCmd sSpriteAnim_EggHatch0[] = +static const union AnimCmd sSpriteAnim_Egg_Normal[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_EggHatch1[] = +static const union AnimCmd sSpriteAnim_Egg_Cracked1[] = { ANIMCMD_FRAME(16, 5), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_EggHatch2[] = +static const union AnimCmd sSpriteAnim_Egg_Cracked2[] = { ANIMCMD_FRAME(32, 5), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_EggHatch3[] = +static const union AnimCmd sSpriteAnim_Egg_Cracked3[] = { ANIMCMD_FRAME(48, 5), ANIMCMD_END }; -static const union AnimCmd *const sSpriteAnimTable_EggHatch[] = +enum { + EGG_ANIM_NORMAL, + EGG_ANIM_CRACKED_1, + EGG_ANIM_CRACKED_2, + EGG_ANIM_CRACKED_3, +}; + +static const union AnimCmd *const sSpriteAnimTable_Egg[] = { - sSpriteAnim_EggHatch0, - sSpriteAnim_EggHatch1, - sSpriteAnim_EggHatch2, - sSpriteAnim_EggHatch3, + [EGG_ANIM_NORMAL] = sSpriteAnim_Egg_Normal, + [EGG_ANIM_CRACKED_1] = sSpriteAnim_Egg_Cracked1, + [EGG_ANIM_CRACKED_2] = sSpriteAnim_Egg_Cracked2, + [EGG_ANIM_CRACKED_3] = sSpriteAnim_Egg_Cracked3, }; static const struct SpriteSheet sEggHatch_Sheet = { .data = sEggHatchTiles, - .size = 2048, - .tag = 12345, + .size = 0x800, + .tag = GFXTAG_EGG, }; static const struct SpriteSheet sEggShards_Sheet = { .data = sEggShardTiles, - .size = 128, - .tag = 23456, + .size = 0x80, + .tag = GFXTAG_EGG_SHARD, }; static const struct SpritePalette sEgg_SpritePalette = { .data = sEggPalette, - .tag = 54321 + .tag = PALTAG_EGG }; -static const struct SpriteTemplate sSpriteTemplate_EggHatch = +static const struct SpriteTemplate sSpriteTemplate_Egg = { - .tileTag = 12345, - .paletteTag = 54321, - .oam = &sOamData_EggHatch, - .anims = sSpriteAnimTable_EggHatch, + .tileTag = GFXTAG_EGG, + .paletteTag = PALTAG_EGG, + .oam = &sOamData_Egg, + .anims = sSpriteAnimTable_Egg, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy @@ -211,8 +224,8 @@ static const union AnimCmd *const sSpriteAnimTable_EggShard[] = static const struct SpriteTemplate sSpriteTemplate_EggShard = { - .tileTag = 23456, - .paletteTag = 54321, + .tileTag = GFXTAG_EGG_SHARD, + .paletteTag = PALTAG_EGG, .oam = &sOamData_EggShard, .anims = sSpriteAnimTable_EggShard, .images = NULL, @@ -220,7 +233,7 @@ static const struct SpriteTemplate sSpriteTemplate_EggShard = .callback = SpriteCB_EggShard }; -static const struct BgTemplate sBgTemplates_EggHatch[2] = +static const struct BgTemplate sBgTemplates_EggHatch[] = { { .bg = 0, @@ -243,7 +256,7 @@ static const struct BgTemplate sBgTemplates_EggHatch[2] = }, }; -static const struct WindowTemplate sWinTemplates_EggHatch[2] = +static const struct WindowTemplate sWinTemplates_EggHatch[] = { { .bg = 0, @@ -270,9 +283,14 @@ static const struct WindowTemplate sYesNoWinTemplate = static const s16 sEggShardVelocities[][2] = { + // First shake {Q_8_8(-1.5), Q_8_8(-3.75)}, + + // Third shake {Q_8_8(-5), Q_8_8(-3)}, {Q_8_8(3.5), Q_8_8(-3)}, + + // Hatching {Q_8_8(-4), Q_8_8(-3.75)}, {Q_8_8(2), Q_8_8(-1.5)}, {Q_8_8(-0.5), Q_8_8(-6.75)}, @@ -291,8 +309,6 @@ static const s16 sEggShardVelocities[][2] = {Q_8_8(2.5), Q_8_8(-7.5)}, }; -// code - static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp) { u16 species; @@ -301,21 +317,17 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp) u16 moves[MAX_MON_MOVES]; u32 ivs[NUM_STATS]; - species = GetMonData(egg, MON_DATA_SPECIES); for (i = 0; i < MAX_MON_MOVES; i++) - { moves[i] = GetMonData(egg, MON_DATA_MOVE1 + i); - } personality = GetMonData(egg, MON_DATA_PERSONALITY); for (i = 0; i < NUM_STATS; i++) - { ivs[i] = GetMonData(egg, MON_DATA_HP_IV + i); - } + // The language is initially read from the Egg but is later overwritten below language = GetMonData(egg, MON_DATA_LANGUAGE); gameMet = GetMonData(egg, MON_DATA_MET_GAME); markings = GetMonData(egg, MON_DATA_MARKINGS); @@ -325,14 +337,10 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp) CreateMon(temp, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, TRUE, personality, OT_ID_PLAYER_ID, 0); for (i = 0; i < MAX_MON_MOVES; i++) - { SetMonData(temp, MON_DATA_MOVE1 + i, &moves[i]); - } for (i = 0; i < NUM_STATS; i++) - { SetMonData(temp, MON_DATA_HP_IV + i, &ivs[i]); - } language = GAME_LANGUAGE; SetMonData(temp, MON_DATA_LANGUAGE, &language); @@ -350,34 +358,35 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp) static void AddHatchedMonToParty(u8 id) { u8 isEgg = 0x46; // ? - u16 pokeNum; - u8 name[12]; + u16 species; + u8 name[POKEMON_NAME_LENGTH + 1]; u16 ball; - u16 caughtLvl; - u8 mapNameID; + u16 metLevel; + u8 metLocation; struct Pokemon* mon = &gPlayerParty[id]; CreateHatchedMon(mon, &gEnemyParty[0]); SetMonData(mon, MON_DATA_IS_EGG, &isEgg); - pokeNum = GetMonData(mon, MON_DATA_SPECIES); - GetSpeciesName(name, pokeNum); + species = GetMonData(mon, MON_DATA_SPECIES); + GetSpeciesName(name, species); SetMonData(mon, MON_DATA_NICKNAME, name); - pokeNum = SpeciesToNationalPokedexNum(pokeNum); - GetSetPokedexFlag(pokeNum, FLAG_SET_SEEN); - GetSetPokedexFlag(pokeNum, FLAG_SET_CAUGHT); + species = SpeciesToNationalPokedexNum(species); + GetSetPokedexFlag(species, FLAG_SET_SEEN); + GetSetPokedexFlag(species, FLAG_SET_CAUGHT); GetMonNickname2(mon, gStringVar1); ball = ITEM_POKE_BALL; SetMonData(mon, MON_DATA_POKEBALL, &ball); - caughtLvl = 0; - SetMonData(mon, MON_DATA_MET_LEVEL, &caughtLvl); + // A met level of 0 is interpreted on the summary screen as "hatched at" + metLevel = 0; + SetMonData(mon, MON_DATA_MET_LEVEL, &metLevel); - mapNameID = GetCurrentRegionMapSectionId(); - SetMonData(mon, MON_DATA_MET_LOCATION, &mapNameID); + metLocation = GetCurrentRegionMapSectionId(); + SetMonData(mon, MON_DATA_MET_LOCATION, &metLocation); MonRestorePP(mon); CalculateMonStats(mon); @@ -396,7 +405,7 @@ static bool8 _CheckDaycareMonReceivedMail(struct DayCare *daycare, u8 daycareId) GetBoxMonNickname(&daycareMon->mon, nickname); if (daycareMon->mail.message.itemId != ITEM_NONE && (StringCompareWithoutExtCtrlCodes(nickname, daycareMon->mail.monName) != 0 - || StringCompareWithoutExtCtrlCodes(gSaveBlock2Ptr->playerName, daycareMon->mail.otName) != 0)) + || StringCompareWithoutExtCtrlCodes(gSaveBlock2Ptr->playerName, daycareMon->mail.otName) != 0)) { StringCopy(gStringVar1, nickname); TVShowConvertInternationalString(gStringVar2, daycareMon->mail.otName, daycareMon->mail.gameLanguage); @@ -411,26 +420,27 @@ bool8 CheckDaycareMonReceivedMail(void) return _CheckDaycareMonReceivedMail(&gSaveBlock1Ptr->daycare, gSpecialVar_0x8004); } -static u8 EggHatchCreateMonSprite(u8 useAlt, u8 switchID, u8 pokeID, u16* speciesLoc) +static u8 EggHatchCreateMonSprite(u8 useAlt, u8 state, u8 partyId, u16* speciesLoc) { u8 position = 0; - u8 spriteID = 0; + u8 spriteId = 0; struct Pokemon* mon = NULL; if (useAlt == FALSE) { - mon = &gPlayerParty[pokeID]; + mon = &gPlayerParty[partyId]; position = B_POSITION_OPPONENT_LEFT; } if (useAlt == TRUE) { // Alternate sprite allocation position. Never reached. - mon = &gPlayerParty[pokeID]; + mon = &gPlayerParty[partyId]; position = B_POSITION_OPPONENT_RIGHT; } - switch (switchID) + switch (state) { case 0: + // Load mon sprite gfx { u16 species = GetMonData(mon, MON_DATA_SPECIES); u32 pid = GetMonData(mon, MON_DATA_PERSONALITY); @@ -442,13 +452,14 @@ static u8 EggHatchCreateMonSprite(u8 useAlt, u8 switchID, u8 pokeID, u16* specie } break; case 1: + // Create mon sprite SetMultiuseSpriteTemplateToPokemon(GetMonSpritePalStruct(mon)->tag, position); - spriteID = CreateSprite(&gMultiuseSpriteTemplate, 120, 75, 6); - gSprites[spriteID].invisible = TRUE; - gSprites[spriteID].callback = SpriteCallbackDummy; + spriteId = CreateSprite(&gMultiuseSpriteTemplate, EGG_X, EGG_Y, 6); + gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].callback = SpriteCallbackDummy; break; } - return spriteID; + return spriteId; } static void VBlankCB_EggHatch(void) @@ -465,28 +476,28 @@ void EggHatch(void) FadeScreen(FADE_TO_BLACK, 0); } -static void Task_EggHatch(u8 taskID) +static void Task_EggHatch(u8 taskId) { if (!gPaletteFade.active) { CleanupOverworldWindowsAndTilemaps(); - SetMainCallback2(CB2_EggHatch_0); + SetMainCallback2(CB2_LoadEggHatch); gFieldCallback = FieldCB_ContinueScriptHandleMusic; - DestroyTask(taskID); + DestroyTask(taskId); } } -static void CB2_EggHatch_0(void) +static void CB2_LoadEggHatch(void) { switch (gMain.state) { case 0: SetGpuReg(REG_OFFSET_DISPCNT, 0); - sEggHatchData = Alloc(sizeof(struct EggHatchData)); + sEggHatchData = Alloc(sizeof(*sEggHatchData)); AllocateMonSpritesGfx(); - sEggHatchData->eggPartyID = gSpecialVar_0x8004; - sEggHatchData->eggShardVelocityID = 0; + sEggHatchData->eggPartyId = gSpecialVar_0x8004; + sEggHatchData->eggShardVelocityId = 0; SetVBlankCallback(VBlankCB_EggHatch); gSpecialVar_0x8005 = GetCurrentMapMusic(); @@ -532,15 +543,15 @@ static void CB2_EggHatch_0(void) break; case 4: CopyBgTilemapBufferToVram(0); - AddHatchedMonToParty(sEggHatchData->eggPartyID); + AddHatchedMonToParty(sEggHatchData->eggPartyId); gMain.state++; break; case 5: - EggHatchCreateMonSprite(FALSE, 0, sEggHatchData->eggPartyID, &sEggHatchData->species); + EggHatchCreateMonSprite(FALSE, 0, sEggHatchData->eggPartyId, &sEggHatchData->species); gMain.state++; break; case 6: - sEggHatchData->pokeSpriteID = EggHatchCreateMonSprite(FALSE, 1, sEggHatchData->eggPartyID, &sEggHatchData->species); + sEggHatchData->monSpriteId = EggHatchCreateMonSprite(FALSE, 1, sEggHatchData->eggPartyId, &sEggHatchData->species); gMain.state++; break; case 7: @@ -552,8 +563,8 @@ static void CB2_EggHatch_0(void) gMain.state++; break; case 8: - SetMainCallback2(CB2_EggHatch_1); - sEggHatchData->CB2_state = 0; + SetMainCallback2(CB2_EggHatch); + sEggHatchData->state = 0; break; } RunTasks(); @@ -571,121 +582,127 @@ static void EggHatchSetMonNickname(void) SetMainCallback2(CB2_ReturnToField); } -static void Task_EggHatchPlayBGM(u8 taskID) +#define tTimer data[0] + +static void Task_EggHatchPlayBGM(u8 taskId) { - if (gTasks[taskID].data[0] == 0) + if (gTasks[taskId].tTimer == 0) { StopMapMusic(); PlayRainStoppingSoundEffect(); } - if (gTasks[taskID].data[0] == 1) + + if (gTasks[taskId].tTimer == 1) PlayBGM(MUS_EVOLUTION_INTRO); - if (gTasks[taskID].data[0] > 60) + + if (gTasks[taskId].tTimer > 60) { PlayBGM(MUS_EVOLUTION); - DestroyTask(taskID); - // UB: task is destroyed, yet the value is incremented - #ifdef UBFIX - return; - #endif + DestroyTask(taskId); } - gTasks[taskID].data[0]++; + gTasks[taskId].tTimer++; } -static void CB2_EggHatch_1(void) +static void CB2_EggHatch(void) { u16 species; u8 gender; u32 personality; - switch (sEggHatchData->CB2_state) + switch (sEggHatchData->state) { case 0: - BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); - sEggHatchData->eggSpriteID = CreateSprite(&sSpriteTemplate_EggHatch, 120, 75, 5); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); + sEggHatchData->eggSpriteId = CreateSprite(&sSpriteTemplate_Egg, EGG_X, EGG_Y, 5); ShowBg(0); ShowBg(1); - sEggHatchData->CB2_state++; + sEggHatchData->state++; CreateTask(Task_EggHatchPlayBGM, 5); break; case 1: if (!gPaletteFade.active) { FillWindowPixelBuffer(sEggHatchData->windowId, PIXEL_FILL(0)); - sEggHatchData->CB2_PalCounter = 0; - sEggHatchData->CB2_state++; + sEggHatchData->delayTimer = 0; + sEggHatchData->state++; } break; case 2: - if (++sEggHatchData->CB2_PalCounter > 30) + if (++sEggHatchData->delayTimer > 30) { - sEggHatchData->CB2_state++; - gSprites[sEggHatchData->eggSpriteID].callback = SpriteCB_Egg_0; + // Start hatching animation + sEggHatchData->state++; + gSprites[sEggHatchData->eggSpriteId].callback = SpriteCB_Egg_Shake1; } break; case 3: - if (gSprites[sEggHatchData->eggSpriteID].callback == SpriteCallbackDummy) + // Wait for hatching animation to finish + if (gSprites[sEggHatchData->eggSpriteId].callback == SpriteCallbackDummy) { - species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_SPECIES); - DoMonFrontSpriteAnimation(&gSprites[sEggHatchData->pokeSpriteID], species, FALSE, 1); - sEggHatchData->CB2_state++; + species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyId], MON_DATA_SPECIES); + DoMonFrontSpriteAnimation(&gSprites[sEggHatchData->monSpriteId], species, FALSE, 1); + sEggHatchData->state++; } break; case 4: - if (gSprites[sEggHatchData->pokeSpriteID].callback == SpriteCallbackDummy) - { - sEggHatchData->CB2_state++; - } + // Wait for Pokémon's front sprite animation + if (gSprites[sEggHatchData->monSpriteId].callback == SpriteCallbackDummy) + sEggHatchData->state++; break; case 5: - GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar1); + // "{mon} hatched from egg" message/fanfare + GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyId], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_HatchedFromEgg); EggHatchPrintMessage(sEggHatchData->windowId, gStringVar4, 0, 3, TEXT_SKIP_DRAW); PlayFanfare(MUS_EVOLVED); - sEggHatchData->CB2_state++; + sEggHatchData->state++; PutWindowTilemap(sEggHatchData->windowId); CopyWindowToVram(sEggHatchData->windowId, COPYWIN_FULL); break; case 6: if (IsFanfareTaskInactive()) - sEggHatchData->CB2_state++; + sEggHatchData->state++; break; - case 7: + case 7: // Twice? if (IsFanfareTaskInactive()) - sEggHatchData->CB2_state++; + sEggHatchData->state++; break; case 8: - GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar1); + // Ready the nickname prompt + GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyId], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_NicknameHatchPrompt); EggHatchPrintMessage(sEggHatchData->windowId, gStringVar4, 0, 2, 1); - sEggHatchData->CB2_state++; + sEggHatchData->state++; break; case 9: + // Print the nickname prompt if (!IsTextPrinterActive(sEggHatchData->windowId)) { LoadUserWindowBorderGfx(sEggHatchData->windowId, 0x140, 0xE0); CreateYesNoMenu(&sYesNoWinTemplate, 0x140, 0xE, 0); - sEggHatchData->CB2_state++; + sEggHatchData->state++; } break; case 10: + // Handle the nickname prompt input switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case 0: - GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar3); - species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_SPECIES); - gender = GetMonGender(&gPlayerParty[sEggHatchData->eggPartyID]); - personality = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_PERSONALITY, 0); + case 0: // Yes + GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyId], gStringVar3); + species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyId], MON_DATA_SPECIES); + gender = GetMonGender(&gPlayerParty[sEggHatchData->eggPartyId]); + personality = GetMonData(&gPlayerParty[sEggHatchData->eggPartyId], MON_DATA_PERSONALITY, 0); DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar3, species, gender, personality, EggHatchSetMonNickname); break; - case 1: - case -1: - sEggHatchData->CB2_state++; + case 1: // No + case MENU_B_PRESSED: + sEggHatchData->state++; + break; } break; case 11: - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); - sEggHatchData->CB2_state++; + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); + sEggHatchData->state++; break; case 12: if (!gPaletteFade.active) @@ -707,136 +724,170 @@ static void CB2_EggHatch_1(void) UpdatePaletteFade(); } -static void SpriteCB_Egg_0(struct Sprite* sprite) +#define sTimer data[0] +#define sSinIdx data[1] +#define sDelayTimer data[2] + +static void SpriteCB_Egg_Shake1(struct Sprite* sprite) { - if (++sprite->data[0] > 20) + if (++sprite->sTimer > 20) { - sprite->callback = SpriteCB_Egg_1; - sprite->data[0] = 0; + sprite->callback = SpriteCB_Egg_Shake2; + sprite->sTimer = 0; } else { - sprite->data[1] = (sprite->data[1] + 20) & 0xFF; - sprite->x2 = Sin(sprite->data[1], 1); - if (sprite->data[0] == 15) + // Shake egg + sprite->sSinIdx = (sprite->sSinIdx + 20) & 0xFF; + sprite->x2 = Sin(sprite->sSinIdx, 1); + if (sprite->sTimer == 15) { + // First egg crack PlaySE(SE_BALL); - StartSpriteAnim(sprite, 1); + StartSpriteAnim(sprite, EGG_ANIM_CRACKED_1); CreateRandomEggShardSprite(); } } } -static void SpriteCB_Egg_1(struct Sprite* sprite) +static void SpriteCB_Egg_Shake2(struct Sprite* sprite) { - if (++sprite->data[2] > 30) + if (++sprite->sDelayTimer > 30) { - if (++sprite->data[0] > 20) + if (++sprite->sTimer > 20) { - sprite->callback = SpriteCB_Egg_2; - sprite->data[0] = 0; - sprite->data[2] = 0; + sprite->callback = SpriteCB_Egg_Shake3; + sprite->sTimer = 0; + sprite->sDelayTimer = 0; } else { - sprite->data[1] = (sprite->data[1] + 20) & 0xFF; - sprite->x2 = Sin(sprite->data[1], 2); - if (sprite->data[0] == 15) + // Shake egg + sprite->sSinIdx = (sprite->sSinIdx + 20) & 0xFF; + sprite->x2 = Sin(sprite->sSinIdx, 2); + if (sprite->sTimer == 15) { + // Second egg crack PlaySE(SE_BALL); - StartSpriteAnim(sprite, 2); + StartSpriteAnim(sprite, EGG_ANIM_CRACKED_2); } } } } -static void SpriteCB_Egg_2(struct Sprite* sprite) +static void SpriteCB_Egg_Shake3(struct Sprite* sprite) { - if (++sprite->data[2] > 30) + if (++sprite->sDelayTimer > 30) { - if (++sprite->data[0] > 38) + if (++sprite->sTimer > 38) { u16 species; - - sprite->callback = SpriteCB_Egg_3; - sprite->data[0] = 0; - species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_SPECIES); - gSprites[sEggHatchData->pokeSpriteID].x2 = 0; - gSprites[sEggHatchData->pokeSpriteID].y2 = 0; + sprite->callback = SpriteCB_Egg_WaitHatch; + sprite->sTimer = 0; + species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyId], MON_DATA_SPECIES); + gSprites[sEggHatchData->monSpriteId].x2 = 0; + gSprites[sEggHatchData->monSpriteId].y2 = 0; } else { - sprite->data[1] = (sprite->data[1] + 20) & 0xFF; - sprite->x2 = Sin(sprite->data[1], 2); - if (sprite->data[0] == 15) + // Shake egg + sprite->sSinIdx = (sprite->sSinIdx + 20) & 0xFF; + sprite->x2 = Sin(sprite->sSinIdx, 2); + if (sprite->sTimer == 15) { + // Third egg crack + // This ineffectually sets the animation to the frame it's already using. + // They likely meant to use the 3rd and final cracked frame of the egg, which goes unused as a result. PlaySE(SE_BALL); - StartSpriteAnim(sprite, 2); + #ifdef BUGFIX + StartSpriteAnim(sprite, EGG_ANIM_CRACKED_3); + #else + StartSpriteAnim(sprite, EGG_ANIM_CRACKED_2); + #endif CreateRandomEggShardSprite(); CreateRandomEggShardSprite(); } - if (sprite->data[0] == 30) + if (sprite->sTimer == 30) PlaySE(SE_BALL); } } } -static void SpriteCB_Egg_3(struct Sprite* sprite) +static void SpriteCB_Egg_WaitHatch(struct Sprite* sprite) { - if (++sprite->data[0] > 50) + if (++sprite->sTimer > 50) { - sprite->callback = SpriteCB_Egg_4; - sprite->data[0] = 0; + sprite->callback = SpriteCB_Egg_Hatch; + sprite->sTimer = 0; } } -static void SpriteCB_Egg_4(struct Sprite* sprite) +static void SpriteCB_Egg_Hatch(struct Sprite* sprite) { s16 i; - if (sprite->data[0] == 0) - BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 0x10, RGB_WHITEALPHA); - if (sprite->data[0] < 4u) + + // Fade to white to hide transition from egg to Pokémon + if (sprite->sTimer == 0) + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_WHITEALPHA); + + // Create a shower of 16 egg shards in 4 groups of 4 + if ((u32)sprite->sTimer < 4) { - for (i = 0; i <= 3; i++) + for (i = 0; i < 4; i++) CreateRandomEggShardSprite(); } - sprite->data[0]++; + + sprite->sTimer++; + if (!gPaletteFade.active) { + // Screen is hidden by the fade to white, hide egg PlaySE(SE_EGG_HATCH); sprite->invisible = TRUE; - sprite->callback = SpriteCB_Egg_5; - sprite->data[0] = 0; + sprite->callback = SpriteCB_Egg_Reveal; + sprite->sTimer = 0; } } -static void SpriteCB_Egg_5(struct Sprite* sprite) +static void SpriteCB_Egg_Reveal(struct Sprite* sprite) { - if (sprite->data[0] == 0) + if (sprite->sTimer == 0) { - gSprites[sEggHatchData->pokeSpriteID].invisible = FALSE; - StartSpriteAffineAnim(&gSprites[sEggHatchData->pokeSpriteID], BATTLER_AFFINE_EMERGE); + // Reveal hatched Pokémon + gSprites[sEggHatchData->monSpriteId].invisible = FALSE; + StartSpriteAffineAnim(&gSprites[sEggHatchData->monSpriteId], BATTLER_AFFINE_EMERGE); } - if (sprite->data[0] == 8) - BeginNormalPaletteFade(PALETTES_ALL, -1, 0x10, 0, RGB_WHITEALPHA); - if (sprite->data[0] <= 9) - gSprites[sEggHatchData->pokeSpriteID].y -= 1; - if (sprite->data[0] > 40) - sprite->callback = SpriteCallbackDummy; - sprite->data[0]++; + + // Fade back from white for reveal + if (sprite->sTimer == 8) + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_WHITEALPHA); + + if (sprite->sTimer <= 9) + gSprites[sEggHatchData->monSpriteId].y--; + + if (sprite->sTimer > 40) + sprite->callback = SpriteCallbackDummy; // Finished + + sprite->sTimer++; } +#define sVelocX data[1] +#define sVelocY data[2] +#define sAccelY data[3] +#define sDeltaX data[4] +#define sDeltaY data[5] + static void SpriteCB_EggShard(struct Sprite* sprite) { - sprite->data[4] += sprite->data[1]; - sprite->data[5] += sprite->data[2]; + sprite->sDeltaX += sprite->sVelocX; + sprite->sDeltaY += sprite->sVelocY; - sprite->x2 = sprite->data[4] / 256; - sprite->y2 = sprite->data[5] / 256; + sprite->x2 = sprite->sDeltaX / 256; + sprite->y2 = sprite->sDeltaY / 256; - sprite->data[2] += sprite->data[3]; + sprite->sVelocY += sprite->sAccelY; - if (sprite->y + sprite->y2 > sprite->y + 20 && sprite->data[2] > 0) + if (sprite->y + sprite->y2 > sprite->y + 20 && sprite->sVelocY > 0) DestroySprite(sprite); } @@ -844,20 +895,23 @@ static void CreateRandomEggShardSprite(void) { u16 spriteAnimIndex; - s16 velocity1 = sEggShardVelocities[sEggHatchData->eggShardVelocityID][0]; - s16 velocity2 = sEggShardVelocities[sEggHatchData->eggShardVelocityID][1]; - sEggHatchData->eggShardVelocityID++; - spriteAnimIndex = Random() % 4; - CreateEggShardSprite(120, 60, velocity1, velocity2, 100, spriteAnimIndex); + s16 velocityX = sEggShardVelocities[sEggHatchData->eggShardVelocityId][0]; + s16 velocityY = sEggShardVelocities[sEggHatchData->eggShardVelocityId][1]; + sEggHatchData->eggShardVelocityId++; + + // Randomly choose one of the 4 shard images + spriteAnimIndex = Random() % ARRAY_COUNT(sSpriteAnimTable_EggShard); + + CreateEggShardSprite(EGG_X, EGG_Y - 15, velocityX, velocityY, 100, spriteAnimIndex); } -static void CreateEggShardSprite(u8 x, u8 y, s16 data1, s16 data2, s16 data3, u8 spriteAnimIndex) +static void CreateEggShardSprite(u8 x, u8 y, s16 velocityX, s16 velocityY, s16 acceleration, u8 spriteAnimIndex) { - u8 spriteID = CreateSprite(&sSpriteTemplate_EggShard, x, y, 4); - gSprites[spriteID].data[1] = data1; - gSprites[spriteID].data[2] = data2; - gSprites[spriteID].data[3] = data3; - StartSpriteAnim(&gSprites[spriteID], spriteAnimIndex); + u8 spriteId = CreateSprite(&sSpriteTemplate_EggShard, x, y, 4); + gSprites[spriteId].sVelocX = velocityX; + gSprites[spriteId].sVelocY = velocityY; + gSprites[spriteId].sAccelY = acceleration; + StartSpriteAnim(&gSprites[spriteId], spriteAnimIndex); } static void EggHatchPrintMessage(u8 windowId, u8* string, u8 x, u8 y, u8 speed) From f78f46a1e28667632bf25c968ffb97aea84bdb15 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 3 Mar 2022 14:54:05 -0500 Subject: [PATCH 08/65] Use ARRAY_COUNT for obj event subsprite tables --- .../object_events/object_event_subsprites.h | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/data/object_events/object_event_subsprites.h b/src/data/object_events/object_event_subsprites.h index b508509ca..808491992 100755 --- a/src/data/object_events/object_event_subsprites.h +++ b/src/data/object_events/object_event_subsprites.h @@ -78,12 +78,12 @@ static const struct Subsprite sOamTable_16x16_4[] = { }; static const struct SubspriteTable sOamTables_16x16[] = { - {0, NULL}, - {1, sOamTable_16x16_0}, - {1, sOamTable_16x16_1}, - {2, sOamTable_16x16_2}, - {2, sOamTable_16x16_3}, - {2, sOamTable_16x16_4} + {}, + {ARRAY_COUNT(sOamTable_16x16_0), sOamTable_16x16_0}, + {ARRAY_COUNT(sOamTable_16x16_1), sOamTable_16x16_1}, + {ARRAY_COUNT(sOamTable_16x16_2), sOamTable_16x16_2}, + {ARRAY_COUNT(sOamTable_16x16_3), sOamTable_16x16_3}, + {ARRAY_COUNT(sOamTable_16x16_4), sOamTable_16x16_4} }; static const struct Subsprite sOamTable_16x32_0[] = { @@ -174,12 +174,12 @@ static const struct Subsprite sOamTable_16x32_4[] = { }; static const struct SubspriteTable sOamTables_16x32[] = { - {0, NULL}, - {1, sOamTable_16x32_0}, - {1, sOamTable_16x32_1}, - {3, sOamTable_16x32_2}, - {2, sOamTable_16x32_3}, - {2, sOamTable_16x32_4} + {}, + {ARRAY_COUNT(sOamTable_16x32_0), sOamTable_16x32_0}, + {ARRAY_COUNT(sOamTable_16x32_1), sOamTable_16x32_1}, + {ARRAY_COUNT(sOamTable_16x32_2), sOamTable_16x32_2}, + {ARRAY_COUNT(sOamTable_16x32_3), sOamTable_16x32_3}, + {ARRAY_COUNT(sOamTable_16x32_4), sOamTable_16x32_4} }; static const struct Subsprite sOamTable_32x32_0[] = { @@ -270,12 +270,12 @@ static const struct Subsprite sOamTable_32x32_4[] = { }; static const struct SubspriteTable sOamTables_32x32[] = { - {0, NULL}, - {1, sOamTable_32x32_0}, - {1, sOamTable_32x32_1}, - {3, sOamTable_32x32_2}, - {2, sOamTable_32x32_3}, - {2, sOamTable_32x32_4} + {}, + {ARRAY_COUNT(sOamTable_32x32_0), sOamTable_32x32_0}, + {ARRAY_COUNT(sOamTable_32x32_1), sOamTable_32x32_1}, + {ARRAY_COUNT(sOamTable_32x32_2), sOamTable_32x32_2}, + {ARRAY_COUNT(sOamTable_32x32_3), sOamTable_32x32_3}, + {ARRAY_COUNT(sOamTable_32x32_4), sOamTable_32x32_4} }; static const struct Subsprite sOamTable_48x48[] = { @@ -378,12 +378,12 @@ static const struct Subsprite sOamTable_48x48[] = { }; static const struct SubspriteTable sOamTables_48x48[] = { - {12, sOamTable_48x48}, - {12, sOamTable_48x48}, - {12, sOamTable_48x48}, - {12, sOamTable_48x48}, - {12, sOamTable_48x48}, - {12, sOamTable_48x48} + {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, + {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, + {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, + {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, + {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, + {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48} }; static const struct Subsprite sOamTable_64x32_0[] = { @@ -432,12 +432,12 @@ static const struct Subsprite sOamTable_64x32_3[] = { // Unused static const struct SubspriteTable sOamTables_64x32[] = { - {0, NULL}, - {1, sOamTable_64x32_0}, - {1, sOamTable_64x32_1}, - {1, sOamTable_64x32_2}, - {1, sOamTable_64x32_3}, - {1, sOamTable_64x32_3} + {}, + {ARRAY_COUNT(sOamTable_64x32_0), sOamTable_64x32_0}, + {ARRAY_COUNT(sOamTable_64x32_1), sOamTable_64x32_1}, + {ARRAY_COUNT(sOamTable_64x32_2), sOamTable_64x32_2}, + {ARRAY_COUNT(sOamTable_64x32_3), sOamTable_64x32_3}, + {ARRAY_COUNT(sOamTable_64x32_3), sOamTable_64x32_3} }; static const struct Subsprite sOamTable_64x64_0[] = { @@ -485,12 +485,12 @@ static const struct Subsprite sOamTable_64x64_3[] = { }; static const struct SubspriteTable sOamTables_64x64[] = { - {0, NULL}, - {1, sOamTable_64x64_0}, - {1, sOamTable_64x64_1}, - {1, sOamTable_64x64_2}, - {1, sOamTable_64x64_3}, - {1, sOamTable_64x64_3} + {}, + {ARRAY_COUNT(sOamTable_64x64_0), sOamTable_64x64_0}, + {ARRAY_COUNT(sOamTable_64x64_1), sOamTable_64x64_1}, + {ARRAY_COUNT(sOamTable_64x64_2), sOamTable_64x64_2}, + {ARRAY_COUNT(sOamTable_64x64_3), sOamTable_64x64_3}, + {ARRAY_COUNT(sOamTable_64x64_3), sOamTable_64x64_3} }; static const struct Subsprite sOamTable_96x40_0[] = { @@ -987,12 +987,12 @@ static const struct Subsprite sOamTable_96x40_3[] = { // Used by SS Tidal static const struct SubspriteTable sOamTables_96x40[] = { - {15, sOamTable_96x40_0}, - {15, sOamTable_96x40_0}, - {15, sOamTable_96x40_1}, - {15, sOamTable_96x40_2}, - {15, sOamTable_96x40_3}, - {15, sOamTable_96x40_3} + {ARRAY_COUNT(sOamTable_96x40_0), sOamTable_96x40_0}, + {ARRAY_COUNT(sOamTable_96x40_0), sOamTable_96x40_0}, + {ARRAY_COUNT(sOamTable_96x40_1), sOamTable_96x40_1}, + {ARRAY_COUNT(sOamTable_96x40_2), sOamTable_96x40_2}, + {ARRAY_COUNT(sOamTable_96x40_3), sOamTable_96x40_3}, + {ARRAY_COUNT(sOamTable_96x40_3), sOamTable_96x40_3} }; static const struct Subsprite sOamTable_88x32_0[] = { @@ -1521,10 +1521,10 @@ static const struct Subsprite sOamTable_88x32_3[] = { // Used by Submarine Shadow static const struct SubspriteTable sOamTables_88x32[] = { - {16, sOamTable_88x32_0}, - {16, sOamTable_88x32_0}, - {16, sOamTable_88x32_1}, - {16, sOamTable_88x32_2}, - {16, sOamTable_88x32_3}, - {16, sOamTable_88x32_3} + {ARRAY_COUNT(sOamTable_88x32_0), sOamTable_88x32_0}, + {ARRAY_COUNT(sOamTable_88x32_0), sOamTable_88x32_0}, + {ARRAY_COUNT(sOamTable_88x32_1), sOamTable_88x32_1}, + {ARRAY_COUNT(sOamTable_88x32_2), sOamTable_88x32_2}, + {ARRAY_COUNT(sOamTable_88x32_3), sOamTable_88x32_3}, + {ARRAY_COUNT(sOamTable_88x32_3), sOamTable_88x32_3} }; From d66413557288082f0b553b209b51fede7d8810c8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 10 Mar 2022 10:33:23 -0500 Subject: [PATCH 09/65] Add usage of battle strings table offset constant --- include/battle_arena.h | 2 +- include/constants/battle_string_ids.h | 10 +- src/battle_arena.c | 2 +- src/battle_controller_opponent.c | 2 +- src/battle_controller_player.c | 2 +- src/battle_message.c | 746 +++++++++++++------------- src/battle_tv.c | 2 +- src/evolution_scene.c | 44 +- 8 files changed, 406 insertions(+), 404 deletions(-) diff --git a/include/battle_arena.h b/include/battle_arena.h index c9a18ef61..cc0e72c0c 100644 --- a/include/battle_arena.h +++ b/include/battle_arena.h @@ -6,7 +6,7 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state); void BattleArena_InitPoints(void); void BattleArena_AddMindPoints(u8 battler); void BattleArena_AddSkillPoints(u8 battler); -void BattleArena_DeductMindPoints(u8 battler, u16 stringId); +void BattleArena_DeductSkillPoints(u8 battler, u16 stringId); void DrawArenaRefereeTextBox(void); void EraseArenaRefereeTextBox(void); diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index c8d37aac6..d5d0698b9 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -1,10 +1,6 @@ #ifndef GUARD_CONSTANTS_BATTLE_STRING_IDS_H #define GUARD_CONSTANTS_BATTLE_STRING_IDS_H -#define BATTLESTRINGS_COUNT 369 - -#define BATTLESTRINGS_ID_ADDER 12 // all battlestrings have its ID + 12, because first 5 are reserved - #define STRINGID_INTROMSG 0 #define STRINGID_INTROSENDOUT 1 #define STRINGID_RETURNMON 2 @@ -383,6 +379,12 @@ #define STRINGID_TRAINER1WINTEXT 379 #define STRINGID_TRAINER2WINTEXT 380 +#define BATTLESTRINGS_COUNT 381 + +// This is the string id that gBattleStringsTable starts with. +// String ids before this (e.g. STRINGID_INTROMSG) are not in the table, +// and are instead handled explicitly by BufferStringBattle. +#define BATTLESTRINGS_TABLE_START STRINGID_TRAINER1LOSETEXT // The below IDs are all indexes into battle message tables, // used to determine which of a set of messages to print. diff --git a/src/battle_arena.c b/src/battle_arena.c index f744a3b2b..a7c74366b 100644 --- a/src/battle_arena.c +++ b/src/battle_arena.c @@ -741,7 +741,7 @@ void BattleArena_AddSkillPoints(u8 battler) } } -void BattleArena_DeductMindPoints(u8 battler, u16 stringId) +void BattleArena_DeductSkillPoints(u8 battler, u16 stringId) { s8 *skillPoints = gBattleStruct->arenaSkillPoints; diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index c3830780b..ead5a8768 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -1523,7 +1523,7 @@ static void OpponentHandlePrintString(void) BufferStringBattle(*stringId); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; - BattleArena_DeductMindPoints(gActiveBattler, *stringId); + BattleArena_DeductSkillPoints(gActiveBattler, *stringId); } static void OpponentHandlePrintSelectionString(void) diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 2133d5b6f..5b69030df 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -2551,7 +2551,7 @@ static void PlayerHandlePrintString(void) BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2; BattleTv_SetDataBasedOnString(*stringId); - BattleArena_DeductMindPoints(gActiveBattler, *stringId); + BattleArena_DeductSkillPoints(gActiveBattler, *stringId); } static void PlayerHandlePrintSelectionString(void) diff --git a/src/battle_message.c b/src/battle_message.c index 1df935694..9d1b88ba7 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -514,377 +514,377 @@ static const u8 sText_Trainer2WinText[]; static const u8 sText_TwoInGameTrainersDefeated[]; static const u8 sText_Trainer2LoseText[]; -const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT] = +const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT - BATTLESTRINGS_TABLE_START] = { - [STRINGID_TRAINER1LOSETEXT - 12] = sText_Trainer1LoseText, - [STRINGID_PKMNGAINEDEXP - 12] = sText_PkmnGainedEXP, - [STRINGID_PKMNGREWTOLV - 12] = sText_PkmnGrewToLv, - [STRINGID_PKMNLEARNEDMOVE - 12] = sText_PkmnLearnedMove, - [STRINGID_TRYTOLEARNMOVE1 - 12] = sText_TryToLearnMove1, - [STRINGID_TRYTOLEARNMOVE2 - 12] = sText_TryToLearnMove2, - [STRINGID_TRYTOLEARNMOVE3 - 12] = sText_TryToLearnMove3, - [STRINGID_PKMNFORGOTMOVE - 12] = sText_PkmnForgotMove, - [STRINGID_STOPLEARNINGMOVE - 12] = sText_StopLearningMove, - [STRINGID_DIDNOTLEARNMOVE - 12] = sText_DidNotLearnMove, - [STRINGID_PKMNLEARNEDMOVE2 - 12] = sText_PkmnLearnedMove2, - [STRINGID_ATTACKMISSED - 12] = sText_AttackMissed, - [STRINGID_PKMNPROTECTEDITSELF - 12] = sText_PkmnProtectedItself, - [STRINGID_STATSWONTINCREASE2 - 12] = sText_StatsWontIncrease2, - [STRINGID_AVOIDEDDAMAGE - 12] = sText_AvoidedDamage, - [STRINGID_ITDOESNTAFFECT - 12] = sText_ItDoesntAffect, - [STRINGID_ATTACKERFAINTED - 12] = sText_AttackerFainted, - [STRINGID_TARGETFAINTED - 12] = sText_TargetFainted, - [STRINGID_PLAYERGOTMONEY - 12] = sText_PlayerGotMoney, - [STRINGID_PLAYERWHITEOUT - 12] = sText_PlayerWhiteout, - [STRINGID_PLAYERWHITEOUT2 - 12] = sText_PlayerWhiteout2, - [STRINGID_PREVENTSESCAPE - 12] = sText_PreventsEscape, - [STRINGID_HITXTIMES - 12] = sText_HitXTimes, - [STRINGID_PKMNFELLASLEEP - 12] = sText_PkmnFellAsleep, - [STRINGID_PKMNMADESLEEP - 12] = sText_PkmnMadeSleep, - [STRINGID_PKMNALREADYASLEEP - 12] = sText_PkmnAlreadyAsleep, - [STRINGID_PKMNALREADYASLEEP2 - 12] = sText_PkmnAlreadyAsleep2, - [STRINGID_PKMNWASNTAFFECTED - 12] = sText_PkmnWasntAffected, - [STRINGID_PKMNWASPOISONED - 12] = sText_PkmnWasPoisoned, - [STRINGID_PKMNPOISONEDBY - 12] = sText_PkmnPoisonedBy, - [STRINGID_PKMNHURTBYPOISON - 12] = sText_PkmnHurtByPoison, - [STRINGID_PKMNALREADYPOISONED - 12] = sText_PkmnAlreadyPoisoned, - [STRINGID_PKMNBADLYPOISONED - 12] = sText_PkmnBadlyPoisoned, - [STRINGID_PKMNENERGYDRAINED - 12] = sText_PkmnEnergyDrained, - [STRINGID_PKMNWASBURNED - 12] = sText_PkmnWasBurned, - [STRINGID_PKMNBURNEDBY - 12] = sText_PkmnBurnedBy, - [STRINGID_PKMNHURTBYBURN - 12] = sText_PkmnHurtByBurn, - [STRINGID_PKMNWASFROZEN - 12] = sText_PkmnWasFrozen, - [STRINGID_PKMNFROZENBY - 12] = sText_PkmnFrozenBy, - [STRINGID_PKMNISFROZEN - 12] = sText_PkmnIsFrozen, - [STRINGID_PKMNWASDEFROSTED - 12] = sText_PkmnWasDefrosted, - [STRINGID_PKMNWASDEFROSTED2 - 12] = sText_PkmnWasDefrosted2, - [STRINGID_PKMNWASDEFROSTEDBY - 12] = sText_PkmnWasDefrostedBy, - [STRINGID_PKMNWASPARALYZED - 12] = sText_PkmnWasParalyzed, - [STRINGID_PKMNWASPARALYZEDBY - 12] = sText_PkmnWasParalyzedBy, - [STRINGID_PKMNISPARALYZED - 12] = sText_PkmnIsParalyzed, - [STRINGID_PKMNISALREADYPARALYZED - 12] = sText_PkmnIsAlreadyParalyzed, - [STRINGID_PKMNHEALEDPARALYSIS - 12] = sText_PkmnHealedParalysis, - [STRINGID_PKMNDREAMEATEN - 12] = sText_PkmnDreamEaten, - [STRINGID_STATSWONTINCREASE - 12] = sText_StatsWontIncrease, - [STRINGID_STATSWONTDECREASE - 12] = sText_StatsWontDecrease, - [STRINGID_TEAMSTOPPEDWORKING - 12] = sText_TeamStoppedWorking, - [STRINGID_FOESTOPPEDWORKING - 12] = sText_FoeStoppedWorking, - [STRINGID_PKMNISCONFUSED - 12] = sText_PkmnIsConfused, - [STRINGID_PKMNHEALEDCONFUSION - 12] = sText_PkmnHealedConfusion, - [STRINGID_PKMNWASCONFUSED - 12] = sText_PkmnWasConfused, - [STRINGID_PKMNALREADYCONFUSED - 12] = sText_PkmnAlreadyConfused, - [STRINGID_PKMNFELLINLOVE - 12] = sText_PkmnFellInLove, - [STRINGID_PKMNINLOVE - 12] = sText_PkmnInLove, - [STRINGID_PKMNIMMOBILIZEDBYLOVE - 12] = sText_PkmnImmobilizedByLove, - [STRINGID_PKMNBLOWNAWAY - 12] = sText_PkmnBlownAway, - [STRINGID_PKMNCHANGEDTYPE - 12] = sText_PkmnChangedType, - [STRINGID_PKMNFLINCHED - 12] = sText_PkmnFlinched, - [STRINGID_PKMNREGAINEDHEALTH - 12] = sText_PkmnRegainedHealth, - [STRINGID_PKMNHPFULL - 12] = sText_PkmnHPFull, - [STRINGID_PKMNRAISEDSPDEF - 12] = sText_PkmnRaisedSpDef, - [STRINGID_PKMNRAISEDDEF - 12] = sText_PkmnRaisedDef, - [STRINGID_PKMNCOVEREDBYVEIL - 12] = sText_PkmnCoveredByVeil, - [STRINGID_PKMNUSEDSAFEGUARD - 12] = sText_PkmnUsedSafeguard, - [STRINGID_PKMNSAFEGUARDEXPIRED - 12] = sText_PkmnSafeguardExpired, - [STRINGID_PKMNWENTTOSLEEP - 12] = sText_PkmnWentToSleep, - [STRINGID_PKMNSLEPTHEALTHY - 12] = sText_PkmnSleptHealthy, - [STRINGID_PKMNWHIPPEDWHIRLWIND - 12] = sText_PkmnWhippedWhirlwind, - [STRINGID_PKMNTOOKSUNLIGHT - 12] = sText_PkmnTookSunlight, - [STRINGID_PKMNLOWEREDHEAD - 12] = sText_PkmnLoweredHead, - [STRINGID_PKMNISGLOWING - 12] = sText_PkmnIsGlowing, - [STRINGID_PKMNFLEWHIGH - 12] = sText_PkmnFlewHigh, - [STRINGID_PKMNDUGHOLE - 12] = sText_PkmnDugHole, - [STRINGID_PKMNSQUEEZEDBYBIND - 12] = sText_PkmnSqueezedByBind, - [STRINGID_PKMNTRAPPEDINVORTEX - 12] = sText_PkmnTrappedInVortex, - [STRINGID_PKMNWRAPPEDBY - 12] = sText_PkmnWrappedBy, - [STRINGID_PKMNCLAMPED - 12] = sText_PkmnClamped, - [STRINGID_PKMNHURTBY - 12] = sText_PkmnHurtBy, - [STRINGID_PKMNFREEDFROM - 12] = sText_PkmnFreedFrom, - [STRINGID_PKMNCRASHED - 12] = sText_PkmnCrashed, - [STRINGID_PKMNSHROUDEDINMIST - 12] = gText_PkmnShroudedInMist, - [STRINGID_PKMNPROTECTEDBYMIST - 12] = sText_PkmnProtectedByMist, - [STRINGID_PKMNGETTINGPUMPED - 12] = gText_PkmnGettingPumped, - [STRINGID_PKMNHITWITHRECOIL - 12] = sText_PkmnHitWithRecoil, - [STRINGID_PKMNPROTECTEDITSELF2 - 12] = sText_PkmnProtectedItself2, - [STRINGID_PKMNBUFFETEDBYSANDSTORM - 12] = sText_PkmnBuffetedBySandstorm, - [STRINGID_PKMNPELTEDBYHAIL - 12] = sText_PkmnPeltedByHail, - [STRINGID_PKMNSEEDED - 12] = sText_PkmnSeeded, - [STRINGID_PKMNEVADEDATTACK - 12] = sText_PkmnEvadedAttack, - [STRINGID_PKMNSAPPEDBYLEECHSEED - 12] = sText_PkmnSappedByLeechSeed, - [STRINGID_PKMNFASTASLEEP - 12] = sText_PkmnFastAsleep, - [STRINGID_PKMNWOKEUP - 12] = sText_PkmnWokeUp, - [STRINGID_PKMNUPROARKEPTAWAKE - 12] = sText_PkmnUproarKeptAwake, - [STRINGID_PKMNWOKEUPINUPROAR - 12] = sText_PkmnWokeUpInUproar, - [STRINGID_PKMNCAUSEDUPROAR - 12] = sText_PkmnCausedUproar, - [STRINGID_PKMNMAKINGUPROAR - 12] = sText_PkmnMakingUproar, - [STRINGID_PKMNCALMEDDOWN - 12] = sText_PkmnCalmedDown, - [STRINGID_PKMNCANTSLEEPINUPROAR - 12] = sText_PkmnCantSleepInUproar, - [STRINGID_PKMNSTOCKPILED - 12] = sText_PkmnStockpiled, - [STRINGID_PKMNCANTSTOCKPILE - 12] = sText_PkmnCantStockpile, - [STRINGID_PKMNCANTSLEEPINUPROAR2 - 12] = sText_PkmnCantSleepInUproar2, - [STRINGID_UPROARKEPTPKMNAWAKE - 12] = sText_UproarKeptPkmnAwake, - [STRINGID_PKMNSTAYEDAWAKEUSING - 12] = sText_PkmnStayedAwakeUsing, - [STRINGID_PKMNSTORINGENERGY - 12] = sText_PkmnStoringEnergy, - [STRINGID_PKMNUNLEASHEDENERGY - 12] = sText_PkmnUnleashedEnergy, - [STRINGID_PKMNFATIGUECONFUSION - 12] = sText_PkmnFatigueConfusion, - [STRINGID_PLAYERPICKEDUPMONEY - 12] = sText_PlayerPickedUpMoney, - [STRINGID_PKMNUNAFFECTED - 12] = sText_PkmnUnaffected, - [STRINGID_PKMNTRANSFORMEDINTO - 12] = sText_PkmnTransformedInto, - [STRINGID_PKMNMADESUBSTITUTE - 12] = sText_PkmnMadeSubstitute, - [STRINGID_PKMNHASSUBSTITUTE - 12] = sText_PkmnHasSubstitute, - [STRINGID_SUBSTITUTEDAMAGED - 12] = sText_SubstituteDamaged, - [STRINGID_PKMNSUBSTITUTEFADED - 12] = sText_PkmnSubstituteFaded, - [STRINGID_PKMNMUSTRECHARGE - 12] = sText_PkmnMustRecharge, - [STRINGID_PKMNRAGEBUILDING - 12] = sText_PkmnRageBuilding, - [STRINGID_PKMNMOVEWASDISABLED - 12] = sText_PkmnMoveWasDisabled, - [STRINGID_PKMNMOVEISDISABLED - 12] = sText_PkmnMoveIsDisabled, - [STRINGID_PKMNMOVEDISABLEDNOMORE - 12] = sText_PkmnMoveDisabledNoMore, - [STRINGID_PKMNGOTENCORE - 12] = sText_PkmnGotEncore, - [STRINGID_PKMNENCOREENDED - 12] = sText_PkmnEncoreEnded, - [STRINGID_PKMNTOOKAIM - 12] = sText_PkmnTookAim, - [STRINGID_PKMNSKETCHEDMOVE - 12] = sText_PkmnSketchedMove, - [STRINGID_PKMNTRYINGTOTAKEFOE - 12] = sText_PkmnTryingToTakeFoe, - [STRINGID_PKMNTOOKFOE - 12] = sText_PkmnTookFoe, - [STRINGID_PKMNREDUCEDPP - 12] = sText_PkmnReducedPP, - [STRINGID_PKMNSTOLEITEM - 12] = sText_PkmnStoleItem, - [STRINGID_TARGETCANTESCAPENOW - 12] = sText_TargetCantEscapeNow, - [STRINGID_PKMNFELLINTONIGHTMARE - 12] = sText_PkmnFellIntoNightmare, - [STRINGID_PKMNLOCKEDINNIGHTMARE - 12] = sText_PkmnLockedInNightmare, - [STRINGID_PKMNLAIDCURSE - 12] = sText_PkmnLaidCurse, - [STRINGID_PKMNAFFLICTEDBYCURSE - 12] = sText_PkmnAfflictedByCurse, - [STRINGID_SPIKESSCATTERED - 12] = sText_SpikesScattered, - [STRINGID_PKMNHURTBYSPIKES - 12] = sText_PkmnHurtBySpikes, - [STRINGID_PKMNIDENTIFIED - 12] = sText_PkmnIdentified, - [STRINGID_PKMNPERISHCOUNTFELL - 12] = sText_PkmnPerishCountFell, - [STRINGID_PKMNBRACEDITSELF - 12] = sText_PkmnBracedItself, - [STRINGID_PKMNENDUREDHIT - 12] = sText_PkmnEnduredHit, - [STRINGID_MAGNITUDESTRENGTH - 12] = sText_MagnitudeStrength, - [STRINGID_PKMNCUTHPMAXEDATTACK - 12] = sText_PkmnCutHPMaxedAttack, - [STRINGID_PKMNCOPIEDSTATCHANGES - 12] = sText_PkmnCopiedStatChanges, - [STRINGID_PKMNGOTFREE - 12] = sText_PkmnGotFree, - [STRINGID_PKMNSHEDLEECHSEED - 12] = sText_PkmnShedLeechSeed, - [STRINGID_PKMNBLEWAWAYSPIKES - 12] = sText_PkmnBlewAwaySpikes, - [STRINGID_PKMNFLEDFROMBATTLE - 12] = sText_PkmnFledFromBattle, - [STRINGID_PKMNFORESAWATTACK - 12] = sText_PkmnForesawAttack, - [STRINGID_PKMNTOOKATTACK - 12] = sText_PkmnTookAttack, - [STRINGID_PKMNATTACK - 12] = sText_PkmnAttack, - [STRINGID_PKMNCENTERATTENTION - 12] = sText_PkmnCenterAttention, - [STRINGID_PKMNCHARGINGPOWER - 12] = sText_PkmnChargingPower, - [STRINGID_NATUREPOWERTURNEDINTO - 12] = sText_NaturePowerTurnedInto, - [STRINGID_PKMNSTATUSNORMAL - 12] = sText_PkmnStatusNormal, - [STRINGID_PKMNHASNOMOVESLEFT - 12] = sText_PkmnHasNoMovesLeft, - [STRINGID_PKMNSUBJECTEDTOTORMENT - 12] = sText_PkmnSubjectedToTorment, - [STRINGID_PKMNCANTUSEMOVETORMENT - 12] = sText_PkmnCantUseMoveTorment, - [STRINGID_PKMNTIGHTENINGFOCUS - 12] = sText_PkmnTighteningFocus, - [STRINGID_PKMNFELLFORTAUNT - 12] = sText_PkmnFellForTaunt, - [STRINGID_PKMNCANTUSEMOVETAUNT - 12] = sText_PkmnCantUseMoveTaunt, - [STRINGID_PKMNREADYTOHELP - 12] = sText_PkmnReadyToHelp, - [STRINGID_PKMNSWITCHEDITEMS - 12] = sText_PkmnSwitchedItems, - [STRINGID_PKMNCOPIEDFOE - 12] = sText_PkmnCopiedFoe, - [STRINGID_PKMNMADEWISH - 12] = sText_PkmnMadeWish, - [STRINGID_PKMNWISHCAMETRUE - 12] = sText_PkmnWishCameTrue, - [STRINGID_PKMNPLANTEDROOTS - 12] = sText_PkmnPlantedRoots, - [STRINGID_PKMNABSORBEDNUTRIENTS - 12] = sText_PkmnAbsorbedNutrients, - [STRINGID_PKMNANCHOREDITSELF - 12] = sText_PkmnAnchoredItself, - [STRINGID_PKMNWASMADEDROWSY - 12] = sText_PkmnWasMadeDrowsy, - [STRINGID_PKMNKNOCKEDOFF - 12] = sText_PkmnKnockedOff, - [STRINGID_PKMNSWAPPEDABILITIES - 12] = sText_PkmnSwappedAbilities, - [STRINGID_PKMNSEALEDOPPONENTMOVE - 12] = sText_PkmnSealedOpponentMove, - [STRINGID_PKMNCANTUSEMOVESEALED - 12] = sText_PkmnCantUseMoveSealed, - [STRINGID_PKMNWANTSGRUDGE - 12] = sText_PkmnWantsGrudge, - [STRINGID_PKMNLOSTPPGRUDGE - 12] = sText_PkmnLostPPGrudge, - [STRINGID_PKMNSHROUDEDITSELF - 12] = sText_PkmnShroudedItself, - [STRINGID_PKMNMOVEBOUNCED - 12] = sText_PkmnMoveBounced, - [STRINGID_PKMNWAITSFORTARGET - 12] = sText_PkmnWaitsForTarget, - [STRINGID_PKMNSNATCHEDMOVE - 12] = sText_PkmnSnatchedMove, - [STRINGID_PKMNMADEITRAIN - 12] = sText_PkmnMadeItRain, - [STRINGID_PKMNRAISEDSPEED - 12] = sText_PkmnRaisedSpeed, - [STRINGID_PKMNPROTECTEDBY - 12] = sText_PkmnProtectedBy, - [STRINGID_PKMNPREVENTSUSAGE - 12] = sText_PkmnPreventsUsage, - [STRINGID_PKMNRESTOREDHPUSING - 12] = sText_PkmnRestoredHPUsing, - [STRINGID_PKMNCHANGEDTYPEWITH - 12] = sText_PkmnChangedTypeWith, - [STRINGID_PKMNPREVENTSPARALYSISWITH - 12] = sText_PkmnPreventsParalysisWith, - [STRINGID_PKMNPREVENTSROMANCEWITH - 12] = sText_PkmnPreventsRomanceWith, - [STRINGID_PKMNPREVENTSPOISONINGWITH - 12] = sText_PkmnPreventsPoisoningWith, - [STRINGID_PKMNPREVENTSCONFUSIONWITH - 12] = sText_PkmnPreventsConfusionWith, - [STRINGID_PKMNRAISEDFIREPOWERWITH - 12] = sText_PkmnRaisedFirePowerWith, - [STRINGID_PKMNANCHORSITSELFWITH - 12] = sText_PkmnAnchorsItselfWith, - [STRINGID_PKMNCUTSATTACKWITH - 12] = sText_PkmnCutsAttackWith, - [STRINGID_PKMNPREVENTSSTATLOSSWITH - 12] = sText_PkmnPreventsStatLossWith, - [STRINGID_PKMNHURTSWITH - 12] = sText_PkmnHurtsWith, - [STRINGID_PKMNTRACED - 12] = sText_PkmnTraced, - [STRINGID_STATSHARPLY - 12] = sText_StatSharply, - [STRINGID_STATROSE - 12] = gText_StatRose, - [STRINGID_STATHARSHLY - 12] = sText_StatHarshly, - [STRINGID_STATFELL - 12] = sText_StatFell, - [STRINGID_ATTACKERSSTATROSE - 12] = sText_AttackersStatRose, - [STRINGID_DEFENDERSSTATROSE - 12] = gText_DefendersStatRose, - [STRINGID_ATTACKERSSTATFELL - 12] = sText_AttackersStatFell, - [STRINGID_DEFENDERSSTATFELL - 12] = sText_DefendersStatFell, - [STRINGID_CRITICALHIT - 12] = sText_CriticalHit, - [STRINGID_ONEHITKO - 12] = sText_OneHitKO, - [STRINGID_123POOF - 12] = sText_123Poof, - [STRINGID_ANDELLIPSIS - 12] = sText_AndEllipsis, - [STRINGID_NOTVERYEFFECTIVE - 12] = sText_NotVeryEffective, - [STRINGID_SUPEREFFECTIVE - 12] = sText_SuperEffective, - [STRINGID_GOTAWAYSAFELY - 12] = sText_GotAwaySafely, - [STRINGID_WILDPKMNFLED - 12] = sText_WildPkmnFled, - [STRINGID_NORUNNINGFROMTRAINERS - 12] = sText_NoRunningFromTrainers, - [STRINGID_CANTESCAPE - 12] = sText_CantEscape, - [STRINGID_DONTLEAVEBIRCH - 12] = sText_DontLeaveBirch, - [STRINGID_BUTNOTHINGHAPPENED - 12] = sText_ButNothingHappened, - [STRINGID_BUTITFAILED - 12] = sText_ButItFailed, - [STRINGID_ITHURTCONFUSION - 12] = sText_ItHurtConfusion, - [STRINGID_MIRRORMOVEFAILED - 12] = sText_MirrorMoveFailed, - [STRINGID_STARTEDTORAIN - 12] = sText_StartedToRain, - [STRINGID_DOWNPOURSTARTED - 12] = sText_DownpourStarted, - [STRINGID_RAINCONTINUES - 12] = sText_RainContinues, - [STRINGID_DOWNPOURCONTINUES - 12] = sText_DownpourContinues, - [STRINGID_RAINSTOPPED - 12] = sText_RainStopped, - [STRINGID_SANDSTORMBREWED - 12] = sText_SandstormBrewed, - [STRINGID_SANDSTORMRAGES - 12] = sText_SandstormRages, - [STRINGID_SANDSTORMSUBSIDED - 12] = sText_SandstormSubsided, - [STRINGID_SUNLIGHTGOTBRIGHT - 12] = sText_SunlightGotBright, - [STRINGID_SUNLIGHTSTRONG - 12] = sText_SunlightStrong, - [STRINGID_SUNLIGHTFADED - 12] = sText_SunlightFaded, - [STRINGID_STARTEDHAIL - 12] = sText_StartedHail, - [STRINGID_HAILCONTINUES - 12] = sText_HailContinues, - [STRINGID_HAILSTOPPED - 12] = sText_HailStopped, - [STRINGID_FAILEDTOSPITUP - 12] = sText_FailedToSpitUp, - [STRINGID_FAILEDTOSWALLOW - 12] = sText_FailedToSwallow, - [STRINGID_WINDBECAMEHEATWAVE - 12] = sText_WindBecameHeatWave, - [STRINGID_STATCHANGESGONE - 12] = sText_StatChangesGone, - [STRINGID_COINSSCATTERED - 12] = sText_CoinsScattered, - [STRINGID_TOOWEAKFORSUBSTITUTE - 12] = sText_TooWeakForSubstitute, - [STRINGID_SHAREDPAIN - 12] = sText_SharedPain, - [STRINGID_BELLCHIMED - 12] = sText_BellChimed, - [STRINGID_FAINTINTHREE - 12] = sText_FaintInThree, - [STRINGID_NOPPLEFT - 12] = sText_NoPPLeft, - [STRINGID_BUTNOPPLEFT - 12] = sText_ButNoPPLeft, - [STRINGID_PLAYERUSEDITEM - 12] = sText_PlayerUsedItem, - [STRINGID_WALLYUSEDITEM - 12] = sText_WallyUsedItem, - [STRINGID_TRAINERBLOCKEDBALL - 12] = sText_TrainerBlockedBall, - [STRINGID_DONTBEATHIEF - 12] = sText_DontBeAThief, - [STRINGID_ITDODGEDBALL - 12] = sText_ItDodgedBall, - [STRINGID_YOUMISSEDPKMN - 12] = sText_YouMissedPkmn, - [STRINGID_PKMNBROKEFREE - 12] = sText_PkmnBrokeFree, - [STRINGID_ITAPPEAREDCAUGHT - 12] = sText_ItAppearedCaught, - [STRINGID_AARGHALMOSTHADIT - 12] = sText_AarghAlmostHadIt, - [STRINGID_SHOOTSOCLOSE - 12] = sText_ShootSoClose, - [STRINGID_GOTCHAPKMNCAUGHT - 12] = sText_GotchaPkmnCaught, - [STRINGID_GOTCHAPKMNCAUGHT2 - 12] = sText_GotchaPkmnCaught2, - [STRINGID_GIVENICKNAMECAPTURED - 12] = sText_GiveNicknameCaptured, - [STRINGID_PKMNSENTTOPC - 12] = sText_PkmnSentToPC, - [STRINGID_PKMNDATAADDEDTODEX - 12] = sText_PkmnDataAddedToDex, - [STRINGID_ITISRAINING - 12] = sText_ItIsRaining, - [STRINGID_SANDSTORMISRAGING - 12] = sText_SandstormIsRaging, - [STRINGID_CANTESCAPE2 - 12] = sText_CantEscape2, - [STRINGID_PKMNIGNORESASLEEP - 12] = sText_PkmnIgnoresAsleep, - [STRINGID_PKMNIGNOREDORDERS - 12] = sText_PkmnIgnoredOrders, - [STRINGID_PKMNBEGANTONAP - 12] = sText_PkmnBeganToNap, - [STRINGID_PKMNLOAFING - 12] = sText_PkmnLoafing, - [STRINGID_PKMNWONTOBEY - 12] = sText_PkmnWontObey, - [STRINGID_PKMNTURNEDAWAY - 12] = sText_PkmnTurnedAway, - [STRINGID_PKMNPRETENDNOTNOTICE - 12] = sText_PkmnPretendNotNotice, - [STRINGID_ENEMYABOUTTOSWITCHPKMN - 12] = sText_EnemyAboutToSwitchPkmn, - [STRINGID_CREPTCLOSER - 12] = sText_CreptCloser, - [STRINGID_CANTGETCLOSER - 12] = sText_CantGetCloser, - [STRINGID_PKMNWATCHINGCAREFULLY - 12] = sText_PkmnWatchingCarefully, - [STRINGID_PKMNCURIOUSABOUTX - 12] = sText_PkmnCuriousAboutX, - [STRINGID_PKMNENTHRALLEDBYX - 12] = sText_PkmnEnthralledByX, - [STRINGID_PKMNIGNOREDX - 12] = sText_PkmnIgnoredX, - [STRINGID_THREWPOKEBLOCKATPKMN - 12] = sText_ThrewPokeblockAtPkmn, - [STRINGID_OUTOFSAFARIBALLS - 12] = sText_OutOfSafariBalls, - [STRINGID_PKMNSITEMCUREDPARALYSIS - 12] = sText_PkmnsItemCuredParalysis, - [STRINGID_PKMNSITEMCUREDPOISON - 12] = sText_PkmnsItemCuredPoison, - [STRINGID_PKMNSITEMHEALEDBURN - 12] = sText_PkmnsItemHealedBurn, - [STRINGID_PKMNSITEMDEFROSTEDIT - 12] = sText_PkmnsItemDefrostedIt, - [STRINGID_PKMNSITEMWOKEIT - 12] = sText_PkmnsItemWokeIt, - [STRINGID_PKMNSITEMSNAPPEDOUT - 12] = sText_PkmnsItemSnappedOut, - [STRINGID_PKMNSITEMCUREDPROBLEM - 12] = sText_PkmnsItemCuredProblem, - [STRINGID_PKMNSITEMRESTOREDHEALTH - 12] = sText_PkmnsItemRestoredHealth, - [STRINGID_PKMNSITEMRESTOREDPP - 12] = sText_PkmnsItemRestoredPP, - [STRINGID_PKMNSITEMRESTOREDSTATUS - 12] = sText_PkmnsItemRestoredStatus, - [STRINGID_PKMNSITEMRESTOREDHPALITTLE - 12] = sText_PkmnsItemRestoredHPALittle, - [STRINGID_ITEMALLOWSONLYYMOVE - 12] = sText_ItemAllowsOnlyYMove, - [STRINGID_PKMNHUNGONWITHX - 12] = sText_PkmnHungOnWithX, - [STRINGID_EMPTYSTRING3 - 12] = gText_EmptyString3, - [STRINGID_PKMNSXPREVENTSBURNS - 12] = sText_PkmnsXPreventsBurns, - [STRINGID_PKMNSXBLOCKSY - 12] = sText_PkmnsXBlocksY, - [STRINGID_PKMNSXRESTOREDHPALITTLE2 - 12] = sText_PkmnsXRestoredHPALittle2, - [STRINGID_PKMNSXWHIPPEDUPSANDSTORM - 12] = sText_PkmnsXWhippedUpSandstorm, - [STRINGID_PKMNSXPREVENTSYLOSS - 12] = sText_PkmnsXPreventsYLoss, - [STRINGID_PKMNSXINFATUATEDY - 12] = sText_PkmnsXInfatuatedY, - [STRINGID_PKMNSXMADEYINEFFECTIVE - 12] = sText_PkmnsXMadeYIneffective, - [STRINGID_PKMNSXCUREDYPROBLEM - 12] = sText_PkmnsXCuredYProblem, - [STRINGID_ITSUCKEDLIQUIDOOZE - 12] = sText_ItSuckedLiquidOoze, - [STRINGID_PKMNTRANSFORMED - 12] = sText_PkmnTransformed, - [STRINGID_ELECTRICITYWEAKENED - 12] = sText_ElectricityWeakened, - [STRINGID_FIREWEAKENED - 12] = sText_FireWeakened, - [STRINGID_PKMNHIDUNDERWATER - 12] = sText_PkmnHidUnderwater, - [STRINGID_PKMNSPRANGUP - 12] = sText_PkmnSprangUp, - [STRINGID_HMMOVESCANTBEFORGOTTEN - 12] = sText_HMMovesCantBeForgotten, - [STRINGID_XFOUNDONEY - 12] = sText_XFoundOneY, - [STRINGID_PLAYERDEFEATEDTRAINER1 - 12] = sText_PlayerDefeatedLinkTrainerTrainer1, - [STRINGID_SOOTHINGAROMA - 12] = sText_SoothingAroma, - [STRINGID_ITEMSCANTBEUSEDNOW - 12] = sText_ItemsCantBeUsedNow, - [STRINGID_FORXCOMMAYZ - 12] = sText_ForXCommaYZ, - [STRINGID_USINGITEMSTATOFPKMNROSE - 12] = sText_UsingItemTheStatOfPkmnRose, - [STRINGID_PKMNUSEDXTOGETPUMPED - 12] = sText_PkmnUsedXToGetPumped, - [STRINGID_PKMNSXMADEYUSELESS - 12] = sText_PkmnsXMadeYUseless, - [STRINGID_PKMNTRAPPEDBYSANDTOMB - 12] = sText_PkmnTrappedBySandTomb, - [STRINGID_EMPTYSTRING4 - 12] = sText_EmptyString4, - [STRINGID_ABOOSTED - 12] = sText_ABoosted, - [STRINGID_PKMNSXINTENSIFIEDSUN - 12] = sText_PkmnsXIntensifiedSun, - [STRINGID_PKMNMAKESGROUNDMISS - 12] = sText_PkmnMakesGroundMiss, - [STRINGID_YOUTHROWABALLNOWRIGHT - 12] = sText_YouThrowABallNowRight, - [STRINGID_PKMNSXTOOKATTACK - 12] = sText_PkmnsXTookAttack, - [STRINGID_PKMNCHOSEXASDESTINY - 12] = sText_PkmnChoseXAsDestiny, - [STRINGID_PKMNLOSTFOCUS - 12] = sText_PkmnLostFocus, - [STRINGID_USENEXTPKMN - 12] = sText_UseNextPkmn, - [STRINGID_PKMNFLEDUSINGITS - 12] = sText_PkmnFledUsingIts, - [STRINGID_PKMNFLEDUSING - 12] = sText_PkmnFledUsing, - [STRINGID_PKMNWASDRAGGEDOUT - 12] = sText_PkmnWasDraggedOut, - [STRINGID_PREVENTEDFROMWORKING - 12] = sText_PreventedFromWorking, - [STRINGID_PKMNSITEMNORMALIZEDSTATUS - 12] = sText_PkmnsItemNormalizedStatus, - [STRINGID_TRAINER1USEDITEM - 12] = sText_Trainer1UsedItem, - [STRINGID_BOXISFULL - 12] = sText_BoxIsFull, - [STRINGID_PKMNAVOIDEDATTACK - 12] = sText_PkmnAvoidedAttack, - [STRINGID_PKMNSXMADEITINEFFECTIVE - 12] = sText_PkmnsXMadeItIneffective, - [STRINGID_PKMNSXPREVENTSFLINCHING - 12] = sText_PkmnsXPreventsFlinching, - [STRINGID_PKMNALREADYHASBURN - 12] = sText_PkmnAlreadyHasBurn, - [STRINGID_STATSWONTDECREASE2 - 12] = sText_StatsWontDecrease2, - [STRINGID_PKMNSXBLOCKSY2 - 12] = sText_PkmnsXBlocksY2, - [STRINGID_PKMNSXWOREOFF - 12] = sText_PkmnsXWoreOff, - [STRINGID_PKMNRAISEDDEFALITTLE - 12] = sText_PkmnRaisedDefALittle, - [STRINGID_PKMNRAISEDSPDEFALITTLE - 12] = sText_PkmnRaisedSpDefALittle, - [STRINGID_THEWALLSHATTERED - 12] = sText_TheWallShattered, - [STRINGID_PKMNSXPREVENTSYSZ - 12] = sText_PkmnsXPreventsYsZ, - [STRINGID_PKMNSXCUREDITSYPROBLEM - 12] = sText_PkmnsXCuredItsYProblem, - [STRINGID_ATTACKERCANTESCAPE - 12] = sText_AttackerCantEscape, - [STRINGID_PKMNOBTAINEDX - 12] = sText_PkmnObtainedX, - [STRINGID_PKMNOBTAINEDX2 - 12] = sText_PkmnObtainedX2, - [STRINGID_PKMNOBTAINEDXYOBTAINEDZ - 12] = sText_PkmnObtainedXYObtainedZ, - [STRINGID_BUTNOEFFECT - 12] = sText_ButNoEffect, - [STRINGID_PKMNSXHADNOEFFECTONY - 12] = sText_PkmnsXHadNoEffectOnY, - [STRINGID_TWOENEMIESDEFEATED - 12] = sText_TwoInGameTrainersDefeated, - [STRINGID_TRAINER2LOSETEXT - 12] = sText_Trainer2LoseText, - [STRINGID_PKMNINCAPABLEOFPOWER - 12] = sText_PkmnIncapableOfPower, - [STRINGID_GLINTAPPEARSINEYE - 12] = sText_GlintAppearsInEye, - [STRINGID_PKMNGETTINGINTOPOSITION - 12] = sText_PkmnGettingIntoPosition, - [STRINGID_PKMNBEGANGROWLINGDEEPLY - 12] = sText_PkmnBeganGrowlingDeeply, - [STRINGID_PKMNEAGERFORMORE - 12] = sText_PkmnEagerForMore, - [STRINGID_DEFEATEDOPPONENTBYREFEREE - 12] = sText_DefeatedOpponentByReferee, - [STRINGID_LOSTTOOPPONENTBYREFEREE - 12] = sText_LostToOpponentByReferee, - [STRINGID_TIEDOPPONENTBYREFEREE - 12] = sText_TiedOpponentByReferee, - [STRINGID_QUESTIONFORFEITMATCH - 12] = sText_QuestionForfeitMatch, - [STRINGID_FORFEITEDMATCH - 12] = sText_ForfeitedMatch, - [STRINGID_PKMNTRANSFERREDSOMEONESPC - 12] = gText_PkmnTransferredSomeonesPC, - [STRINGID_PKMNTRANSFERREDLANETTESPC - 12] = gText_PkmnTransferredLanettesPC, - [STRINGID_PKMNBOXSOMEONESPCFULL - 12] = gText_PkmnTransferredSomeonesPCBoxFull, - [STRINGID_PKMNBOXLANETTESPCFULL - 12] = gText_PkmnTransferredLanettesPCBoxFull, - [STRINGID_TRAINER1WINTEXT - 12] = sText_Trainer1WinText, - [STRINGID_TRAINER2WINTEXT - 12] = sText_Trainer2WinText, + [STRINGID_TRAINER1LOSETEXT - BATTLESTRINGS_TABLE_START] = sText_Trainer1LoseText, + [STRINGID_PKMNGAINEDEXP - BATTLESTRINGS_TABLE_START] = sText_PkmnGainedEXP, + [STRINGID_PKMNGREWTOLV - BATTLESTRINGS_TABLE_START] = sText_PkmnGrewToLv, + [STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_TABLE_START] = sText_PkmnLearnedMove, + [STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_TABLE_START] = sText_TryToLearnMove1, + [STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_TABLE_START] = sText_TryToLearnMove2, + [STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_TABLE_START] = sText_TryToLearnMove3, + [STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_TABLE_START] = sText_PkmnForgotMove, + [STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_TABLE_START] = sText_StopLearningMove, + [STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_TABLE_START] = sText_DidNotLearnMove, + [STRINGID_PKMNLEARNEDMOVE2 - BATTLESTRINGS_TABLE_START] = sText_PkmnLearnedMove2, + [STRINGID_ATTACKMISSED - BATTLESTRINGS_TABLE_START] = sText_AttackMissed, + [STRINGID_PKMNPROTECTEDITSELF - BATTLESTRINGS_TABLE_START] = sText_PkmnProtectedItself, + [STRINGID_STATSWONTINCREASE2 - BATTLESTRINGS_TABLE_START] = sText_StatsWontIncrease2, + [STRINGID_AVOIDEDDAMAGE - BATTLESTRINGS_TABLE_START] = sText_AvoidedDamage, + [STRINGID_ITDOESNTAFFECT - BATTLESTRINGS_TABLE_START] = sText_ItDoesntAffect, + [STRINGID_ATTACKERFAINTED - BATTLESTRINGS_TABLE_START] = sText_AttackerFainted, + [STRINGID_TARGETFAINTED - BATTLESTRINGS_TABLE_START] = sText_TargetFainted, + [STRINGID_PLAYERGOTMONEY - BATTLESTRINGS_TABLE_START] = sText_PlayerGotMoney, + [STRINGID_PLAYERWHITEOUT - BATTLESTRINGS_TABLE_START] = sText_PlayerWhiteout, + [STRINGID_PLAYERWHITEOUT2 - BATTLESTRINGS_TABLE_START] = sText_PlayerWhiteout2, + [STRINGID_PREVENTSESCAPE - BATTLESTRINGS_TABLE_START] = sText_PreventsEscape, + [STRINGID_HITXTIMES - BATTLESTRINGS_TABLE_START] = sText_HitXTimes, + [STRINGID_PKMNFELLASLEEP - BATTLESTRINGS_TABLE_START] = sText_PkmnFellAsleep, + [STRINGID_PKMNMADESLEEP - BATTLESTRINGS_TABLE_START] = sText_PkmnMadeSleep, + [STRINGID_PKMNALREADYASLEEP - BATTLESTRINGS_TABLE_START] = sText_PkmnAlreadyAsleep, + [STRINGID_PKMNALREADYASLEEP2 - BATTLESTRINGS_TABLE_START] = sText_PkmnAlreadyAsleep2, + [STRINGID_PKMNWASNTAFFECTED - BATTLESTRINGS_TABLE_START] = sText_PkmnWasntAffected, + [STRINGID_PKMNWASPOISONED - BATTLESTRINGS_TABLE_START] = sText_PkmnWasPoisoned, + [STRINGID_PKMNPOISONEDBY - BATTLESTRINGS_TABLE_START] = sText_PkmnPoisonedBy, + [STRINGID_PKMNHURTBYPOISON - BATTLESTRINGS_TABLE_START] = sText_PkmnHurtByPoison, + [STRINGID_PKMNALREADYPOISONED - BATTLESTRINGS_TABLE_START] = sText_PkmnAlreadyPoisoned, + [STRINGID_PKMNBADLYPOISONED - BATTLESTRINGS_TABLE_START] = sText_PkmnBadlyPoisoned, + [STRINGID_PKMNENERGYDRAINED - BATTLESTRINGS_TABLE_START] = sText_PkmnEnergyDrained, + [STRINGID_PKMNWASBURNED - BATTLESTRINGS_TABLE_START] = sText_PkmnWasBurned, + [STRINGID_PKMNBURNEDBY - BATTLESTRINGS_TABLE_START] = sText_PkmnBurnedBy, + [STRINGID_PKMNHURTBYBURN - BATTLESTRINGS_TABLE_START] = sText_PkmnHurtByBurn, + [STRINGID_PKMNWASFROZEN - BATTLESTRINGS_TABLE_START] = sText_PkmnWasFrozen, + [STRINGID_PKMNFROZENBY - BATTLESTRINGS_TABLE_START] = sText_PkmnFrozenBy, + [STRINGID_PKMNISFROZEN - BATTLESTRINGS_TABLE_START] = sText_PkmnIsFrozen, + [STRINGID_PKMNWASDEFROSTED - BATTLESTRINGS_TABLE_START] = sText_PkmnWasDefrosted, + [STRINGID_PKMNWASDEFROSTED2 - BATTLESTRINGS_TABLE_START] = sText_PkmnWasDefrosted2, + [STRINGID_PKMNWASDEFROSTEDBY - BATTLESTRINGS_TABLE_START] = sText_PkmnWasDefrostedBy, + [STRINGID_PKMNWASPARALYZED - BATTLESTRINGS_TABLE_START] = sText_PkmnWasParalyzed, + [STRINGID_PKMNWASPARALYZEDBY - BATTLESTRINGS_TABLE_START] = sText_PkmnWasParalyzedBy, + [STRINGID_PKMNISPARALYZED - BATTLESTRINGS_TABLE_START] = sText_PkmnIsParalyzed, + [STRINGID_PKMNISALREADYPARALYZED - BATTLESTRINGS_TABLE_START] = sText_PkmnIsAlreadyParalyzed, + [STRINGID_PKMNHEALEDPARALYSIS - BATTLESTRINGS_TABLE_START] = sText_PkmnHealedParalysis, + [STRINGID_PKMNDREAMEATEN - BATTLESTRINGS_TABLE_START] = sText_PkmnDreamEaten, + [STRINGID_STATSWONTINCREASE - BATTLESTRINGS_TABLE_START] = sText_StatsWontIncrease, + [STRINGID_STATSWONTDECREASE - BATTLESTRINGS_TABLE_START] = sText_StatsWontDecrease, + [STRINGID_TEAMSTOPPEDWORKING - BATTLESTRINGS_TABLE_START] = sText_TeamStoppedWorking, + [STRINGID_FOESTOPPEDWORKING - BATTLESTRINGS_TABLE_START] = sText_FoeStoppedWorking, + [STRINGID_PKMNISCONFUSED - BATTLESTRINGS_TABLE_START] = sText_PkmnIsConfused, + [STRINGID_PKMNHEALEDCONFUSION - BATTLESTRINGS_TABLE_START] = sText_PkmnHealedConfusion, + [STRINGID_PKMNWASCONFUSED - BATTLESTRINGS_TABLE_START] = sText_PkmnWasConfused, + [STRINGID_PKMNALREADYCONFUSED - BATTLESTRINGS_TABLE_START] = sText_PkmnAlreadyConfused, + [STRINGID_PKMNFELLINLOVE - BATTLESTRINGS_TABLE_START] = sText_PkmnFellInLove, + [STRINGID_PKMNINLOVE - BATTLESTRINGS_TABLE_START] = sText_PkmnInLove, + [STRINGID_PKMNIMMOBILIZEDBYLOVE - BATTLESTRINGS_TABLE_START] = sText_PkmnImmobilizedByLove, + [STRINGID_PKMNBLOWNAWAY - BATTLESTRINGS_TABLE_START] = sText_PkmnBlownAway, + [STRINGID_PKMNCHANGEDTYPE - BATTLESTRINGS_TABLE_START] = sText_PkmnChangedType, + [STRINGID_PKMNFLINCHED - BATTLESTRINGS_TABLE_START] = sText_PkmnFlinched, + [STRINGID_PKMNREGAINEDHEALTH - BATTLESTRINGS_TABLE_START] = sText_PkmnRegainedHealth, + [STRINGID_PKMNHPFULL - BATTLESTRINGS_TABLE_START] = sText_PkmnHPFull, + [STRINGID_PKMNRAISEDSPDEF - BATTLESTRINGS_TABLE_START] = sText_PkmnRaisedSpDef, + [STRINGID_PKMNRAISEDDEF - BATTLESTRINGS_TABLE_START] = sText_PkmnRaisedDef, + [STRINGID_PKMNCOVEREDBYVEIL - BATTLESTRINGS_TABLE_START] = sText_PkmnCoveredByVeil, + [STRINGID_PKMNUSEDSAFEGUARD - BATTLESTRINGS_TABLE_START] = sText_PkmnUsedSafeguard, + [STRINGID_PKMNSAFEGUARDEXPIRED - BATTLESTRINGS_TABLE_START] = sText_PkmnSafeguardExpired, + [STRINGID_PKMNWENTTOSLEEP - BATTLESTRINGS_TABLE_START] = sText_PkmnWentToSleep, + [STRINGID_PKMNSLEPTHEALTHY - BATTLESTRINGS_TABLE_START] = sText_PkmnSleptHealthy, + [STRINGID_PKMNWHIPPEDWHIRLWIND - BATTLESTRINGS_TABLE_START] = sText_PkmnWhippedWhirlwind, + [STRINGID_PKMNTOOKSUNLIGHT - BATTLESTRINGS_TABLE_START] = sText_PkmnTookSunlight, + [STRINGID_PKMNLOWEREDHEAD - BATTLESTRINGS_TABLE_START] = sText_PkmnLoweredHead, + [STRINGID_PKMNISGLOWING - BATTLESTRINGS_TABLE_START] = sText_PkmnIsGlowing, + [STRINGID_PKMNFLEWHIGH - BATTLESTRINGS_TABLE_START] = sText_PkmnFlewHigh, + [STRINGID_PKMNDUGHOLE - BATTLESTRINGS_TABLE_START] = sText_PkmnDugHole, + [STRINGID_PKMNSQUEEZEDBYBIND - BATTLESTRINGS_TABLE_START] = sText_PkmnSqueezedByBind, + [STRINGID_PKMNTRAPPEDINVORTEX - BATTLESTRINGS_TABLE_START] = sText_PkmnTrappedInVortex, + [STRINGID_PKMNWRAPPEDBY - BATTLESTRINGS_TABLE_START] = sText_PkmnWrappedBy, + [STRINGID_PKMNCLAMPED - BATTLESTRINGS_TABLE_START] = sText_PkmnClamped, + [STRINGID_PKMNHURTBY - BATTLESTRINGS_TABLE_START] = sText_PkmnHurtBy, + [STRINGID_PKMNFREEDFROM - BATTLESTRINGS_TABLE_START] = sText_PkmnFreedFrom, + [STRINGID_PKMNCRASHED - BATTLESTRINGS_TABLE_START] = sText_PkmnCrashed, + [STRINGID_PKMNSHROUDEDINMIST - BATTLESTRINGS_TABLE_START] = gText_PkmnShroudedInMist, + [STRINGID_PKMNPROTECTEDBYMIST - BATTLESTRINGS_TABLE_START] = sText_PkmnProtectedByMist, + [STRINGID_PKMNGETTINGPUMPED - BATTLESTRINGS_TABLE_START] = gText_PkmnGettingPumped, + [STRINGID_PKMNHITWITHRECOIL - BATTLESTRINGS_TABLE_START] = sText_PkmnHitWithRecoil, + [STRINGID_PKMNPROTECTEDITSELF2 - BATTLESTRINGS_TABLE_START] = sText_PkmnProtectedItself2, + [STRINGID_PKMNBUFFETEDBYSANDSTORM - BATTLESTRINGS_TABLE_START] = sText_PkmnBuffetedBySandstorm, + [STRINGID_PKMNPELTEDBYHAIL - BATTLESTRINGS_TABLE_START] = sText_PkmnPeltedByHail, + [STRINGID_PKMNSEEDED - BATTLESTRINGS_TABLE_START] = sText_PkmnSeeded, + [STRINGID_PKMNEVADEDATTACK - BATTLESTRINGS_TABLE_START] = sText_PkmnEvadedAttack, + [STRINGID_PKMNSAPPEDBYLEECHSEED - BATTLESTRINGS_TABLE_START] = sText_PkmnSappedByLeechSeed, + [STRINGID_PKMNFASTASLEEP - BATTLESTRINGS_TABLE_START] = sText_PkmnFastAsleep, + [STRINGID_PKMNWOKEUP - BATTLESTRINGS_TABLE_START] = sText_PkmnWokeUp, + [STRINGID_PKMNUPROARKEPTAWAKE - BATTLESTRINGS_TABLE_START] = sText_PkmnUproarKeptAwake, + [STRINGID_PKMNWOKEUPINUPROAR - BATTLESTRINGS_TABLE_START] = sText_PkmnWokeUpInUproar, + [STRINGID_PKMNCAUSEDUPROAR - BATTLESTRINGS_TABLE_START] = sText_PkmnCausedUproar, + [STRINGID_PKMNMAKINGUPROAR - BATTLESTRINGS_TABLE_START] = sText_PkmnMakingUproar, + [STRINGID_PKMNCALMEDDOWN - BATTLESTRINGS_TABLE_START] = sText_PkmnCalmedDown, + [STRINGID_PKMNCANTSLEEPINUPROAR - BATTLESTRINGS_TABLE_START] = sText_PkmnCantSleepInUproar, + [STRINGID_PKMNSTOCKPILED - BATTLESTRINGS_TABLE_START] = sText_PkmnStockpiled, + [STRINGID_PKMNCANTSTOCKPILE - BATTLESTRINGS_TABLE_START] = sText_PkmnCantStockpile, + [STRINGID_PKMNCANTSLEEPINUPROAR2 - BATTLESTRINGS_TABLE_START] = sText_PkmnCantSleepInUproar2, + [STRINGID_UPROARKEPTPKMNAWAKE - BATTLESTRINGS_TABLE_START] = sText_UproarKeptPkmnAwake, + [STRINGID_PKMNSTAYEDAWAKEUSING - BATTLESTRINGS_TABLE_START] = sText_PkmnStayedAwakeUsing, + [STRINGID_PKMNSTORINGENERGY - BATTLESTRINGS_TABLE_START] = sText_PkmnStoringEnergy, + [STRINGID_PKMNUNLEASHEDENERGY - BATTLESTRINGS_TABLE_START] = sText_PkmnUnleashedEnergy, + [STRINGID_PKMNFATIGUECONFUSION - BATTLESTRINGS_TABLE_START] = sText_PkmnFatigueConfusion, + [STRINGID_PLAYERPICKEDUPMONEY - BATTLESTRINGS_TABLE_START] = sText_PlayerPickedUpMoney, + [STRINGID_PKMNUNAFFECTED - BATTLESTRINGS_TABLE_START] = sText_PkmnUnaffected, + [STRINGID_PKMNTRANSFORMEDINTO - BATTLESTRINGS_TABLE_START] = sText_PkmnTransformedInto, + [STRINGID_PKMNMADESUBSTITUTE - BATTLESTRINGS_TABLE_START] = sText_PkmnMadeSubstitute, + [STRINGID_PKMNHASSUBSTITUTE - BATTLESTRINGS_TABLE_START] = sText_PkmnHasSubstitute, + [STRINGID_SUBSTITUTEDAMAGED - BATTLESTRINGS_TABLE_START] = sText_SubstituteDamaged, + [STRINGID_PKMNSUBSTITUTEFADED - BATTLESTRINGS_TABLE_START] = sText_PkmnSubstituteFaded, + [STRINGID_PKMNMUSTRECHARGE - BATTLESTRINGS_TABLE_START] = sText_PkmnMustRecharge, + [STRINGID_PKMNRAGEBUILDING - BATTLESTRINGS_TABLE_START] = sText_PkmnRageBuilding, + [STRINGID_PKMNMOVEWASDISABLED - BATTLESTRINGS_TABLE_START] = sText_PkmnMoveWasDisabled, + [STRINGID_PKMNMOVEISDISABLED - BATTLESTRINGS_TABLE_START] = sText_PkmnMoveIsDisabled, + [STRINGID_PKMNMOVEDISABLEDNOMORE - BATTLESTRINGS_TABLE_START] = sText_PkmnMoveDisabledNoMore, + [STRINGID_PKMNGOTENCORE - BATTLESTRINGS_TABLE_START] = sText_PkmnGotEncore, + [STRINGID_PKMNENCOREENDED - BATTLESTRINGS_TABLE_START] = sText_PkmnEncoreEnded, + [STRINGID_PKMNTOOKAIM - BATTLESTRINGS_TABLE_START] = sText_PkmnTookAim, + [STRINGID_PKMNSKETCHEDMOVE - BATTLESTRINGS_TABLE_START] = sText_PkmnSketchedMove, + [STRINGID_PKMNTRYINGTOTAKEFOE - BATTLESTRINGS_TABLE_START] = sText_PkmnTryingToTakeFoe, + [STRINGID_PKMNTOOKFOE - BATTLESTRINGS_TABLE_START] = sText_PkmnTookFoe, + [STRINGID_PKMNREDUCEDPP - BATTLESTRINGS_TABLE_START] = sText_PkmnReducedPP, + [STRINGID_PKMNSTOLEITEM - BATTLESTRINGS_TABLE_START] = sText_PkmnStoleItem, + [STRINGID_TARGETCANTESCAPENOW - BATTLESTRINGS_TABLE_START] = sText_TargetCantEscapeNow, + [STRINGID_PKMNFELLINTONIGHTMARE - BATTLESTRINGS_TABLE_START] = sText_PkmnFellIntoNightmare, + [STRINGID_PKMNLOCKEDINNIGHTMARE - BATTLESTRINGS_TABLE_START] = sText_PkmnLockedInNightmare, + [STRINGID_PKMNLAIDCURSE - BATTLESTRINGS_TABLE_START] = sText_PkmnLaidCurse, + [STRINGID_PKMNAFFLICTEDBYCURSE - BATTLESTRINGS_TABLE_START] = sText_PkmnAfflictedByCurse, + [STRINGID_SPIKESSCATTERED - BATTLESTRINGS_TABLE_START] = sText_SpikesScattered, + [STRINGID_PKMNHURTBYSPIKES - BATTLESTRINGS_TABLE_START] = sText_PkmnHurtBySpikes, + [STRINGID_PKMNIDENTIFIED - BATTLESTRINGS_TABLE_START] = sText_PkmnIdentified, + [STRINGID_PKMNPERISHCOUNTFELL - BATTLESTRINGS_TABLE_START] = sText_PkmnPerishCountFell, + [STRINGID_PKMNBRACEDITSELF - BATTLESTRINGS_TABLE_START] = sText_PkmnBracedItself, + [STRINGID_PKMNENDUREDHIT - BATTLESTRINGS_TABLE_START] = sText_PkmnEnduredHit, + [STRINGID_MAGNITUDESTRENGTH - BATTLESTRINGS_TABLE_START] = sText_MagnitudeStrength, + [STRINGID_PKMNCUTHPMAXEDATTACK - BATTLESTRINGS_TABLE_START] = sText_PkmnCutHPMaxedAttack, + [STRINGID_PKMNCOPIEDSTATCHANGES - BATTLESTRINGS_TABLE_START] = sText_PkmnCopiedStatChanges, + [STRINGID_PKMNGOTFREE - BATTLESTRINGS_TABLE_START] = sText_PkmnGotFree, + [STRINGID_PKMNSHEDLEECHSEED - BATTLESTRINGS_TABLE_START] = sText_PkmnShedLeechSeed, + [STRINGID_PKMNBLEWAWAYSPIKES - BATTLESTRINGS_TABLE_START] = sText_PkmnBlewAwaySpikes, + [STRINGID_PKMNFLEDFROMBATTLE - BATTLESTRINGS_TABLE_START] = sText_PkmnFledFromBattle, + [STRINGID_PKMNFORESAWATTACK - BATTLESTRINGS_TABLE_START] = sText_PkmnForesawAttack, + [STRINGID_PKMNTOOKATTACK - BATTLESTRINGS_TABLE_START] = sText_PkmnTookAttack, + [STRINGID_PKMNATTACK - BATTLESTRINGS_TABLE_START] = sText_PkmnAttack, + [STRINGID_PKMNCENTERATTENTION - BATTLESTRINGS_TABLE_START] = sText_PkmnCenterAttention, + [STRINGID_PKMNCHARGINGPOWER - BATTLESTRINGS_TABLE_START] = sText_PkmnChargingPower, + [STRINGID_NATUREPOWERTURNEDINTO - BATTLESTRINGS_TABLE_START] = sText_NaturePowerTurnedInto, + [STRINGID_PKMNSTATUSNORMAL - BATTLESTRINGS_TABLE_START] = sText_PkmnStatusNormal, + [STRINGID_PKMNHASNOMOVESLEFT - BATTLESTRINGS_TABLE_START] = sText_PkmnHasNoMovesLeft, + [STRINGID_PKMNSUBJECTEDTOTORMENT - BATTLESTRINGS_TABLE_START] = sText_PkmnSubjectedToTorment, + [STRINGID_PKMNCANTUSEMOVETORMENT - BATTLESTRINGS_TABLE_START] = sText_PkmnCantUseMoveTorment, + [STRINGID_PKMNTIGHTENINGFOCUS - BATTLESTRINGS_TABLE_START] = sText_PkmnTighteningFocus, + [STRINGID_PKMNFELLFORTAUNT - BATTLESTRINGS_TABLE_START] = sText_PkmnFellForTaunt, + [STRINGID_PKMNCANTUSEMOVETAUNT - BATTLESTRINGS_TABLE_START] = sText_PkmnCantUseMoveTaunt, + [STRINGID_PKMNREADYTOHELP - BATTLESTRINGS_TABLE_START] = sText_PkmnReadyToHelp, + [STRINGID_PKMNSWITCHEDITEMS - BATTLESTRINGS_TABLE_START] = sText_PkmnSwitchedItems, + [STRINGID_PKMNCOPIEDFOE - BATTLESTRINGS_TABLE_START] = sText_PkmnCopiedFoe, + [STRINGID_PKMNMADEWISH - BATTLESTRINGS_TABLE_START] = sText_PkmnMadeWish, + [STRINGID_PKMNWISHCAMETRUE - BATTLESTRINGS_TABLE_START] = sText_PkmnWishCameTrue, + [STRINGID_PKMNPLANTEDROOTS - BATTLESTRINGS_TABLE_START] = sText_PkmnPlantedRoots, + [STRINGID_PKMNABSORBEDNUTRIENTS - BATTLESTRINGS_TABLE_START] = sText_PkmnAbsorbedNutrients, + [STRINGID_PKMNANCHOREDITSELF - BATTLESTRINGS_TABLE_START] = sText_PkmnAnchoredItself, + [STRINGID_PKMNWASMADEDROWSY - BATTLESTRINGS_TABLE_START] = sText_PkmnWasMadeDrowsy, + [STRINGID_PKMNKNOCKEDOFF - BATTLESTRINGS_TABLE_START] = sText_PkmnKnockedOff, + [STRINGID_PKMNSWAPPEDABILITIES - BATTLESTRINGS_TABLE_START] = sText_PkmnSwappedAbilities, + [STRINGID_PKMNSEALEDOPPONENTMOVE - BATTLESTRINGS_TABLE_START] = sText_PkmnSealedOpponentMove, + [STRINGID_PKMNCANTUSEMOVESEALED - BATTLESTRINGS_TABLE_START] = sText_PkmnCantUseMoveSealed, + [STRINGID_PKMNWANTSGRUDGE - BATTLESTRINGS_TABLE_START] = sText_PkmnWantsGrudge, + [STRINGID_PKMNLOSTPPGRUDGE - BATTLESTRINGS_TABLE_START] = sText_PkmnLostPPGrudge, + [STRINGID_PKMNSHROUDEDITSELF - BATTLESTRINGS_TABLE_START] = sText_PkmnShroudedItself, + [STRINGID_PKMNMOVEBOUNCED - BATTLESTRINGS_TABLE_START] = sText_PkmnMoveBounced, + [STRINGID_PKMNWAITSFORTARGET - BATTLESTRINGS_TABLE_START] = sText_PkmnWaitsForTarget, + [STRINGID_PKMNSNATCHEDMOVE - BATTLESTRINGS_TABLE_START] = sText_PkmnSnatchedMove, + [STRINGID_PKMNMADEITRAIN - BATTLESTRINGS_TABLE_START] = sText_PkmnMadeItRain, + [STRINGID_PKMNRAISEDSPEED - BATTLESTRINGS_TABLE_START] = sText_PkmnRaisedSpeed, + [STRINGID_PKMNPROTECTEDBY - BATTLESTRINGS_TABLE_START] = sText_PkmnProtectedBy, + [STRINGID_PKMNPREVENTSUSAGE - BATTLESTRINGS_TABLE_START] = sText_PkmnPreventsUsage, + [STRINGID_PKMNRESTOREDHPUSING - BATTLESTRINGS_TABLE_START] = sText_PkmnRestoredHPUsing, + [STRINGID_PKMNCHANGEDTYPEWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnChangedTypeWith, + [STRINGID_PKMNPREVENTSPARALYSISWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnPreventsParalysisWith, + [STRINGID_PKMNPREVENTSROMANCEWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnPreventsRomanceWith, + [STRINGID_PKMNPREVENTSPOISONINGWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnPreventsPoisoningWith, + [STRINGID_PKMNPREVENTSCONFUSIONWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnPreventsConfusionWith, + [STRINGID_PKMNRAISEDFIREPOWERWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnRaisedFirePowerWith, + [STRINGID_PKMNANCHORSITSELFWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnAnchorsItselfWith, + [STRINGID_PKMNCUTSATTACKWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnCutsAttackWith, + [STRINGID_PKMNPREVENTSSTATLOSSWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnPreventsStatLossWith, + [STRINGID_PKMNHURTSWITH - BATTLESTRINGS_TABLE_START] = sText_PkmnHurtsWith, + [STRINGID_PKMNTRACED - BATTLESTRINGS_TABLE_START] = sText_PkmnTraced, + [STRINGID_STATSHARPLY - BATTLESTRINGS_TABLE_START] = sText_StatSharply, + [STRINGID_STATROSE - BATTLESTRINGS_TABLE_START] = gText_StatRose, + [STRINGID_STATHARSHLY - BATTLESTRINGS_TABLE_START] = sText_StatHarshly, + [STRINGID_STATFELL - BATTLESTRINGS_TABLE_START] = sText_StatFell, + [STRINGID_ATTACKERSSTATROSE - BATTLESTRINGS_TABLE_START] = sText_AttackersStatRose, + [STRINGID_DEFENDERSSTATROSE - BATTLESTRINGS_TABLE_START] = gText_DefendersStatRose, + [STRINGID_ATTACKERSSTATFELL - BATTLESTRINGS_TABLE_START] = sText_AttackersStatFell, + [STRINGID_DEFENDERSSTATFELL - BATTLESTRINGS_TABLE_START] = sText_DefendersStatFell, + [STRINGID_CRITICALHIT - BATTLESTRINGS_TABLE_START] = sText_CriticalHit, + [STRINGID_ONEHITKO - BATTLESTRINGS_TABLE_START] = sText_OneHitKO, + [STRINGID_123POOF - BATTLESTRINGS_TABLE_START] = sText_123Poof, + [STRINGID_ANDELLIPSIS - BATTLESTRINGS_TABLE_START] = sText_AndEllipsis, + [STRINGID_NOTVERYEFFECTIVE - BATTLESTRINGS_TABLE_START] = sText_NotVeryEffective, + [STRINGID_SUPEREFFECTIVE - BATTLESTRINGS_TABLE_START] = sText_SuperEffective, + [STRINGID_GOTAWAYSAFELY - BATTLESTRINGS_TABLE_START] = sText_GotAwaySafely, + [STRINGID_WILDPKMNFLED - BATTLESTRINGS_TABLE_START] = sText_WildPkmnFled, + [STRINGID_NORUNNINGFROMTRAINERS - BATTLESTRINGS_TABLE_START] = sText_NoRunningFromTrainers, + [STRINGID_CANTESCAPE - BATTLESTRINGS_TABLE_START] = sText_CantEscape, + [STRINGID_DONTLEAVEBIRCH - BATTLESTRINGS_TABLE_START] = sText_DontLeaveBirch, + [STRINGID_BUTNOTHINGHAPPENED - BATTLESTRINGS_TABLE_START] = sText_ButNothingHappened, + [STRINGID_BUTITFAILED - BATTLESTRINGS_TABLE_START] = sText_ButItFailed, + [STRINGID_ITHURTCONFUSION - BATTLESTRINGS_TABLE_START] = sText_ItHurtConfusion, + [STRINGID_MIRRORMOVEFAILED - BATTLESTRINGS_TABLE_START] = sText_MirrorMoveFailed, + [STRINGID_STARTEDTORAIN - BATTLESTRINGS_TABLE_START] = sText_StartedToRain, + [STRINGID_DOWNPOURSTARTED - BATTLESTRINGS_TABLE_START] = sText_DownpourStarted, + [STRINGID_RAINCONTINUES - BATTLESTRINGS_TABLE_START] = sText_RainContinues, + [STRINGID_DOWNPOURCONTINUES - BATTLESTRINGS_TABLE_START] = sText_DownpourContinues, + [STRINGID_RAINSTOPPED - BATTLESTRINGS_TABLE_START] = sText_RainStopped, + [STRINGID_SANDSTORMBREWED - BATTLESTRINGS_TABLE_START] = sText_SandstormBrewed, + [STRINGID_SANDSTORMRAGES - BATTLESTRINGS_TABLE_START] = sText_SandstormRages, + [STRINGID_SANDSTORMSUBSIDED - BATTLESTRINGS_TABLE_START] = sText_SandstormSubsided, + [STRINGID_SUNLIGHTGOTBRIGHT - BATTLESTRINGS_TABLE_START] = sText_SunlightGotBright, + [STRINGID_SUNLIGHTSTRONG - BATTLESTRINGS_TABLE_START] = sText_SunlightStrong, + [STRINGID_SUNLIGHTFADED - BATTLESTRINGS_TABLE_START] = sText_SunlightFaded, + [STRINGID_STARTEDHAIL - BATTLESTRINGS_TABLE_START] = sText_StartedHail, + [STRINGID_HAILCONTINUES - BATTLESTRINGS_TABLE_START] = sText_HailContinues, + [STRINGID_HAILSTOPPED - BATTLESTRINGS_TABLE_START] = sText_HailStopped, + [STRINGID_FAILEDTOSPITUP - BATTLESTRINGS_TABLE_START] = sText_FailedToSpitUp, + [STRINGID_FAILEDTOSWALLOW - BATTLESTRINGS_TABLE_START] = sText_FailedToSwallow, + [STRINGID_WINDBECAMEHEATWAVE - BATTLESTRINGS_TABLE_START] = sText_WindBecameHeatWave, + [STRINGID_STATCHANGESGONE - BATTLESTRINGS_TABLE_START] = sText_StatChangesGone, + [STRINGID_COINSSCATTERED - BATTLESTRINGS_TABLE_START] = sText_CoinsScattered, + [STRINGID_TOOWEAKFORSUBSTITUTE - BATTLESTRINGS_TABLE_START] = sText_TooWeakForSubstitute, + [STRINGID_SHAREDPAIN - BATTLESTRINGS_TABLE_START] = sText_SharedPain, + [STRINGID_BELLCHIMED - BATTLESTRINGS_TABLE_START] = sText_BellChimed, + [STRINGID_FAINTINTHREE - BATTLESTRINGS_TABLE_START] = sText_FaintInThree, + [STRINGID_NOPPLEFT - BATTLESTRINGS_TABLE_START] = sText_NoPPLeft, + [STRINGID_BUTNOPPLEFT - BATTLESTRINGS_TABLE_START] = sText_ButNoPPLeft, + [STRINGID_PLAYERUSEDITEM - BATTLESTRINGS_TABLE_START] = sText_PlayerUsedItem, + [STRINGID_WALLYUSEDITEM - BATTLESTRINGS_TABLE_START] = sText_WallyUsedItem, + [STRINGID_TRAINERBLOCKEDBALL - BATTLESTRINGS_TABLE_START] = sText_TrainerBlockedBall, + [STRINGID_DONTBEATHIEF - BATTLESTRINGS_TABLE_START] = sText_DontBeAThief, + [STRINGID_ITDODGEDBALL - BATTLESTRINGS_TABLE_START] = sText_ItDodgedBall, + [STRINGID_YOUMISSEDPKMN - BATTLESTRINGS_TABLE_START] = sText_YouMissedPkmn, + [STRINGID_PKMNBROKEFREE - BATTLESTRINGS_TABLE_START] = sText_PkmnBrokeFree, + [STRINGID_ITAPPEAREDCAUGHT - BATTLESTRINGS_TABLE_START] = sText_ItAppearedCaught, + [STRINGID_AARGHALMOSTHADIT - BATTLESTRINGS_TABLE_START] = sText_AarghAlmostHadIt, + [STRINGID_SHOOTSOCLOSE - BATTLESTRINGS_TABLE_START] = sText_ShootSoClose, + [STRINGID_GOTCHAPKMNCAUGHT - BATTLESTRINGS_TABLE_START] = sText_GotchaPkmnCaught, + [STRINGID_GOTCHAPKMNCAUGHT2 - BATTLESTRINGS_TABLE_START] = sText_GotchaPkmnCaught2, + [STRINGID_GIVENICKNAMECAPTURED - BATTLESTRINGS_TABLE_START] = sText_GiveNicknameCaptured, + [STRINGID_PKMNSENTTOPC - BATTLESTRINGS_TABLE_START] = sText_PkmnSentToPC, + [STRINGID_PKMNDATAADDEDTODEX - BATTLESTRINGS_TABLE_START] = sText_PkmnDataAddedToDex, + [STRINGID_ITISRAINING - BATTLESTRINGS_TABLE_START] = sText_ItIsRaining, + [STRINGID_SANDSTORMISRAGING - BATTLESTRINGS_TABLE_START] = sText_SandstormIsRaging, + [STRINGID_CANTESCAPE2 - BATTLESTRINGS_TABLE_START] = sText_CantEscape2, + [STRINGID_PKMNIGNORESASLEEP - BATTLESTRINGS_TABLE_START] = sText_PkmnIgnoresAsleep, + [STRINGID_PKMNIGNOREDORDERS - BATTLESTRINGS_TABLE_START] = sText_PkmnIgnoredOrders, + [STRINGID_PKMNBEGANTONAP - BATTLESTRINGS_TABLE_START] = sText_PkmnBeganToNap, + [STRINGID_PKMNLOAFING - BATTLESTRINGS_TABLE_START] = sText_PkmnLoafing, + [STRINGID_PKMNWONTOBEY - BATTLESTRINGS_TABLE_START] = sText_PkmnWontObey, + [STRINGID_PKMNTURNEDAWAY - BATTLESTRINGS_TABLE_START] = sText_PkmnTurnedAway, + [STRINGID_PKMNPRETENDNOTNOTICE - BATTLESTRINGS_TABLE_START] = sText_PkmnPretendNotNotice, + [STRINGID_ENEMYABOUTTOSWITCHPKMN - BATTLESTRINGS_TABLE_START] = sText_EnemyAboutToSwitchPkmn, + [STRINGID_CREPTCLOSER - BATTLESTRINGS_TABLE_START] = sText_CreptCloser, + [STRINGID_CANTGETCLOSER - BATTLESTRINGS_TABLE_START] = sText_CantGetCloser, + [STRINGID_PKMNWATCHINGCAREFULLY - BATTLESTRINGS_TABLE_START] = sText_PkmnWatchingCarefully, + [STRINGID_PKMNCURIOUSABOUTX - BATTLESTRINGS_TABLE_START] = sText_PkmnCuriousAboutX, + [STRINGID_PKMNENTHRALLEDBYX - BATTLESTRINGS_TABLE_START] = sText_PkmnEnthralledByX, + [STRINGID_PKMNIGNOREDX - BATTLESTRINGS_TABLE_START] = sText_PkmnIgnoredX, + [STRINGID_THREWPOKEBLOCKATPKMN - BATTLESTRINGS_TABLE_START] = sText_ThrewPokeblockAtPkmn, + [STRINGID_OUTOFSAFARIBALLS - BATTLESTRINGS_TABLE_START] = sText_OutOfSafariBalls, + [STRINGID_PKMNSITEMCUREDPARALYSIS - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemCuredParalysis, + [STRINGID_PKMNSITEMCUREDPOISON - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemCuredPoison, + [STRINGID_PKMNSITEMHEALEDBURN - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemHealedBurn, + [STRINGID_PKMNSITEMDEFROSTEDIT - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemDefrostedIt, + [STRINGID_PKMNSITEMWOKEIT - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemWokeIt, + [STRINGID_PKMNSITEMSNAPPEDOUT - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemSnappedOut, + [STRINGID_PKMNSITEMCUREDPROBLEM - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemCuredProblem, + [STRINGID_PKMNSITEMRESTOREDHEALTH - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemRestoredHealth, + [STRINGID_PKMNSITEMRESTOREDPP - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemRestoredPP, + [STRINGID_PKMNSITEMRESTOREDSTATUS - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemRestoredStatus, + [STRINGID_PKMNSITEMRESTOREDHPALITTLE - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemRestoredHPALittle, + [STRINGID_ITEMALLOWSONLYYMOVE - BATTLESTRINGS_TABLE_START] = sText_ItemAllowsOnlyYMove, + [STRINGID_PKMNHUNGONWITHX - BATTLESTRINGS_TABLE_START] = sText_PkmnHungOnWithX, + [STRINGID_EMPTYSTRING3 - BATTLESTRINGS_TABLE_START] = gText_EmptyString3, + [STRINGID_PKMNSXPREVENTSBURNS - BATTLESTRINGS_TABLE_START] = sText_PkmnsXPreventsBurns, + [STRINGID_PKMNSXBLOCKSY - BATTLESTRINGS_TABLE_START] = sText_PkmnsXBlocksY, + [STRINGID_PKMNSXRESTOREDHPALITTLE2 - BATTLESTRINGS_TABLE_START] = sText_PkmnsXRestoredHPALittle2, + [STRINGID_PKMNSXWHIPPEDUPSANDSTORM - BATTLESTRINGS_TABLE_START] = sText_PkmnsXWhippedUpSandstorm, + [STRINGID_PKMNSXPREVENTSYLOSS - BATTLESTRINGS_TABLE_START] = sText_PkmnsXPreventsYLoss, + [STRINGID_PKMNSXINFATUATEDY - BATTLESTRINGS_TABLE_START] = sText_PkmnsXInfatuatedY, + [STRINGID_PKMNSXMADEYINEFFECTIVE - BATTLESTRINGS_TABLE_START] = sText_PkmnsXMadeYIneffective, + [STRINGID_PKMNSXCUREDYPROBLEM - BATTLESTRINGS_TABLE_START] = sText_PkmnsXCuredYProblem, + [STRINGID_ITSUCKEDLIQUIDOOZE - BATTLESTRINGS_TABLE_START] = sText_ItSuckedLiquidOoze, + [STRINGID_PKMNTRANSFORMED - BATTLESTRINGS_TABLE_START] = sText_PkmnTransformed, + [STRINGID_ELECTRICITYWEAKENED - BATTLESTRINGS_TABLE_START] = sText_ElectricityWeakened, + [STRINGID_FIREWEAKENED - BATTLESTRINGS_TABLE_START] = sText_FireWeakened, + [STRINGID_PKMNHIDUNDERWATER - BATTLESTRINGS_TABLE_START] = sText_PkmnHidUnderwater, + [STRINGID_PKMNSPRANGUP - BATTLESTRINGS_TABLE_START] = sText_PkmnSprangUp, + [STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_TABLE_START] = sText_HMMovesCantBeForgotten, + [STRINGID_XFOUNDONEY - BATTLESTRINGS_TABLE_START] = sText_XFoundOneY, + [STRINGID_PLAYERDEFEATEDTRAINER1 - BATTLESTRINGS_TABLE_START] = sText_PlayerDefeatedLinkTrainerTrainer1, + [STRINGID_SOOTHINGAROMA - BATTLESTRINGS_TABLE_START] = sText_SoothingAroma, + [STRINGID_ITEMSCANTBEUSEDNOW - BATTLESTRINGS_TABLE_START] = sText_ItemsCantBeUsedNow, + [STRINGID_FORXCOMMAYZ - BATTLESTRINGS_TABLE_START] = sText_ForXCommaYZ, + [STRINGID_USINGITEMSTATOFPKMNROSE - BATTLESTRINGS_TABLE_START] = sText_UsingItemTheStatOfPkmnRose, + [STRINGID_PKMNUSEDXTOGETPUMPED - BATTLESTRINGS_TABLE_START] = sText_PkmnUsedXToGetPumped, + [STRINGID_PKMNSXMADEYUSELESS - BATTLESTRINGS_TABLE_START] = sText_PkmnsXMadeYUseless, + [STRINGID_PKMNTRAPPEDBYSANDTOMB - BATTLESTRINGS_TABLE_START] = sText_PkmnTrappedBySandTomb, + [STRINGID_EMPTYSTRING4 - BATTLESTRINGS_TABLE_START] = sText_EmptyString4, + [STRINGID_ABOOSTED - BATTLESTRINGS_TABLE_START] = sText_ABoosted, + [STRINGID_PKMNSXINTENSIFIEDSUN - BATTLESTRINGS_TABLE_START] = sText_PkmnsXIntensifiedSun, + [STRINGID_PKMNMAKESGROUNDMISS - BATTLESTRINGS_TABLE_START] = sText_PkmnMakesGroundMiss, + [STRINGID_YOUTHROWABALLNOWRIGHT - BATTLESTRINGS_TABLE_START] = sText_YouThrowABallNowRight, + [STRINGID_PKMNSXTOOKATTACK - BATTLESTRINGS_TABLE_START] = sText_PkmnsXTookAttack, + [STRINGID_PKMNCHOSEXASDESTINY - BATTLESTRINGS_TABLE_START] = sText_PkmnChoseXAsDestiny, + [STRINGID_PKMNLOSTFOCUS - BATTLESTRINGS_TABLE_START] = sText_PkmnLostFocus, + [STRINGID_USENEXTPKMN - BATTLESTRINGS_TABLE_START] = sText_UseNextPkmn, + [STRINGID_PKMNFLEDUSINGITS - BATTLESTRINGS_TABLE_START] = sText_PkmnFledUsingIts, + [STRINGID_PKMNFLEDUSING - BATTLESTRINGS_TABLE_START] = sText_PkmnFledUsing, + [STRINGID_PKMNWASDRAGGEDOUT - BATTLESTRINGS_TABLE_START] = sText_PkmnWasDraggedOut, + [STRINGID_PREVENTEDFROMWORKING - BATTLESTRINGS_TABLE_START] = sText_PreventedFromWorking, + [STRINGID_PKMNSITEMNORMALIZEDSTATUS - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemNormalizedStatus, + [STRINGID_TRAINER1USEDITEM - BATTLESTRINGS_TABLE_START] = sText_Trainer1UsedItem, + [STRINGID_BOXISFULL - BATTLESTRINGS_TABLE_START] = sText_BoxIsFull, + [STRINGID_PKMNAVOIDEDATTACK - BATTLESTRINGS_TABLE_START] = sText_PkmnAvoidedAttack, + [STRINGID_PKMNSXMADEITINEFFECTIVE - BATTLESTRINGS_TABLE_START] = sText_PkmnsXMadeItIneffective, + [STRINGID_PKMNSXPREVENTSFLINCHING - BATTLESTRINGS_TABLE_START] = sText_PkmnsXPreventsFlinching, + [STRINGID_PKMNALREADYHASBURN - BATTLESTRINGS_TABLE_START] = sText_PkmnAlreadyHasBurn, + [STRINGID_STATSWONTDECREASE2 - BATTLESTRINGS_TABLE_START] = sText_StatsWontDecrease2, + [STRINGID_PKMNSXBLOCKSY2 - BATTLESTRINGS_TABLE_START] = sText_PkmnsXBlocksY2, + [STRINGID_PKMNSXWOREOFF - BATTLESTRINGS_TABLE_START] = sText_PkmnsXWoreOff, + [STRINGID_PKMNRAISEDDEFALITTLE - BATTLESTRINGS_TABLE_START] = sText_PkmnRaisedDefALittle, + [STRINGID_PKMNRAISEDSPDEFALITTLE - BATTLESTRINGS_TABLE_START] = sText_PkmnRaisedSpDefALittle, + [STRINGID_THEWALLSHATTERED - BATTLESTRINGS_TABLE_START] = sText_TheWallShattered, + [STRINGID_PKMNSXPREVENTSYSZ - BATTLESTRINGS_TABLE_START] = sText_PkmnsXPreventsYsZ, + [STRINGID_PKMNSXCUREDITSYPROBLEM - BATTLESTRINGS_TABLE_START] = sText_PkmnsXCuredItsYProblem, + [STRINGID_ATTACKERCANTESCAPE - BATTLESTRINGS_TABLE_START] = sText_AttackerCantEscape, + [STRINGID_PKMNOBTAINEDX - BATTLESTRINGS_TABLE_START] = sText_PkmnObtainedX, + [STRINGID_PKMNOBTAINEDX2 - BATTLESTRINGS_TABLE_START] = sText_PkmnObtainedX2, + [STRINGID_PKMNOBTAINEDXYOBTAINEDZ - BATTLESTRINGS_TABLE_START] = sText_PkmnObtainedXYObtainedZ, + [STRINGID_BUTNOEFFECT - BATTLESTRINGS_TABLE_START] = sText_ButNoEffect, + [STRINGID_PKMNSXHADNOEFFECTONY - BATTLESTRINGS_TABLE_START] = sText_PkmnsXHadNoEffectOnY, + [STRINGID_TWOENEMIESDEFEATED - BATTLESTRINGS_TABLE_START] = sText_TwoInGameTrainersDefeated, + [STRINGID_TRAINER2LOSETEXT - BATTLESTRINGS_TABLE_START] = sText_Trainer2LoseText, + [STRINGID_PKMNINCAPABLEOFPOWER - BATTLESTRINGS_TABLE_START] = sText_PkmnIncapableOfPower, + [STRINGID_GLINTAPPEARSINEYE - BATTLESTRINGS_TABLE_START] = sText_GlintAppearsInEye, + [STRINGID_PKMNGETTINGINTOPOSITION - BATTLESTRINGS_TABLE_START] = sText_PkmnGettingIntoPosition, + [STRINGID_PKMNBEGANGROWLINGDEEPLY - BATTLESTRINGS_TABLE_START] = sText_PkmnBeganGrowlingDeeply, + [STRINGID_PKMNEAGERFORMORE - BATTLESTRINGS_TABLE_START] = sText_PkmnEagerForMore, + [STRINGID_DEFEATEDOPPONENTBYREFEREE - BATTLESTRINGS_TABLE_START] = sText_DefeatedOpponentByReferee, + [STRINGID_LOSTTOOPPONENTBYREFEREE - BATTLESTRINGS_TABLE_START] = sText_LostToOpponentByReferee, + [STRINGID_TIEDOPPONENTBYREFEREE - BATTLESTRINGS_TABLE_START] = sText_TiedOpponentByReferee, + [STRINGID_QUESTIONFORFEITMATCH - BATTLESTRINGS_TABLE_START] = sText_QuestionForfeitMatch, + [STRINGID_FORFEITEDMATCH - BATTLESTRINGS_TABLE_START] = sText_ForfeitedMatch, + [STRINGID_PKMNTRANSFERREDSOMEONESPC - BATTLESTRINGS_TABLE_START] = gText_PkmnTransferredSomeonesPC, + [STRINGID_PKMNTRANSFERREDLANETTESPC - BATTLESTRINGS_TABLE_START] = gText_PkmnTransferredLanettesPC, + [STRINGID_PKMNBOXSOMEONESPCFULL - BATTLESTRINGS_TABLE_START] = gText_PkmnTransferredSomeonesPCBoxFull, + [STRINGID_PKMNBOXLANETTESPCFULL - BATTLESTRINGS_TABLE_START] = gText_PkmnTransferredLanettesPCBoxFull, + [STRINGID_TRAINER1WINTEXT - BATTLESTRINGS_TABLE_START] = sText_Trainer1WinText, + [STRINGID_TRAINER2WINTEXT - BATTLESTRINGS_TABLE_START] = sText_Trainer2WinText, }; const u16 gMissStringIds[] = @@ -2331,14 +2331,14 @@ void BufferStringBattle(u16 stringID) } break; default: // load a string from the table - if (stringID >= BATTLESTRINGS_COUNT + BATTLESTRINGS_ID_ADDER) + if (stringID >= BATTLESTRINGS_COUNT) { gDisplayedStringBattle[0] = EOS; return; } else { - stringPtr = gBattleStringsTable[stringID - BATTLESTRINGS_ID_ADDER]; + stringPtr = gBattleStringsTable[stringID - BATTLESTRINGS_TABLE_START]; } break; } @@ -2862,7 +2862,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst) { case B_BUFF_STRING: // battle string hword = T1_READ_16(&src[srcID + 1]); - StringAppend(dst, gBattleStringsTable[hword - BATTLESTRINGS_ID_ADDER]); + StringAppend(dst, gBattleStringsTable[hword - BATTLESTRINGS_TABLE_START]); srcID += 3; break; case B_BUFF_NUMBER: // int to string diff --git a/src/battle_tv.c b/src/battle_tv.c index f65bf73ea..b9008b47a 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -570,7 +570,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, gBattleMsgDataPtr->currentMove); - if (moveSlot >= MAX_MON_MOVES && IsNotSpecialBattleString(stringId) && stringId > BATTLESTRINGS_ID_ADDER) + if (moveSlot >= MAX_MON_MOVES && IsNotSpecialBattleString(stringId) && stringId > BATTLESTRINGS_TABLE_START) { tvPtr->side[atkSide].faintCause = FNT_OTHER; return; diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 327e48d19..bde11ddb5 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -855,7 +855,7 @@ static void Task_EvolutionScene(u8 taskId) { BufferMoveToLearnIntoBattleTextBuff2(); PlayFanfare(MUS_LEVEL_UP); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tLearnsFirstMove = 0x40; // re-used as a counter gTasks[taskId].tState++; @@ -873,7 +873,7 @@ static void Task_EvolutionScene(u8 taskId) { // "{mon} is trying to learn {move}" BufferMoveToLearnIntoBattleTextBuff2(); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tLearnMoveState++; } @@ -882,7 +882,7 @@ static void Task_EvolutionScene(u8 taskId) if (!IsTextPrinterActive(0) && !IsSEPlaying()) { // "But, {mon} can't learn more than four moves" - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tLearnMoveState++; } @@ -891,7 +891,7 @@ static void Task_EvolutionScene(u8 taskId) if (!IsTextPrinterActive(0) && !IsSEPlaying()) { // "Delete a move to make room for {move}?" - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tLearnMoveYesState = MVSTATE_SHOW_MOVE_SELECT; gTasks[taskId].tLearnMoveNoState = MVSTATE_ASK_CANCEL; @@ -979,7 +979,7 @@ static void Task_EvolutionScene(u8 taskId) if (IsHMMove2(move)) { // Can't forget HMs - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tLearnMoveState = MVSTATE_RETRY_AFTER_HM; } @@ -996,14 +996,14 @@ static void Task_EvolutionScene(u8 taskId) } break; case MVSTATE_FORGET_MSG_1: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tLearnMoveState++; break; case MVSTATE_FORGET_MSG_2: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tLearnMoveState++; } @@ -1011,20 +1011,20 @@ static void Task_EvolutionScene(u8 taskId) case MVSTATE_LEARNED_MOVE: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tState = EVOSTATE_LEARNED_MOVE; } break; case MVSTATE_ASK_CANCEL: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tLearnMoveYesState = MVSTATE_CANCEL; gTasks[taskId].tLearnMoveNoState = MVSTATE_INTRO_MSG_1; gTasks[taskId].tLearnMoveState = MVSTATE_PRINT_YES_NO; break; case MVSTATE_CANCEL: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_TABLE_START]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); gTasks[taskId].tState = EVOSTATE_TRY_LEARN_MOVE; break; @@ -1258,7 +1258,7 @@ static void Task_TradeEvolutionScene(u8 taskId) { BufferMoveToLearnIntoBattleTextBuff2(); PlayFanfare(MUS_LEVEL_UP); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnsFirstMove = 0x40; // re-used as a counter gTasks[taskId].tState++; @@ -1276,7 +1276,7 @@ static void Task_TradeEvolutionScene(u8 taskId) { // "{mon} is trying to learn {move}" BufferMoveToLearnIntoBattleTextBuff2(); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnMoveState++; } @@ -1285,7 +1285,7 @@ static void Task_TradeEvolutionScene(u8 taskId) if (!IsTextPrinterActive(0) && !IsSEPlaying()) { // "But, {mon} can't learn more than four moves" - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnMoveState++; } @@ -1294,7 +1294,7 @@ static void Task_TradeEvolutionScene(u8 taskId) if (!IsTextPrinterActive(0) && !IsSEPlaying()) { // "Delete a move to make room for {move}?" - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnMoveYesState = T_MVSTATE_SHOW_MOVE_SELECT; gTasks[taskId].tLearnMoveNoState = T_MVSTATE_ASK_CANCEL; @@ -1315,7 +1315,7 @@ static void Task_TradeEvolutionScene(u8 taskId) { case 0: // YES sEvoCursorPos = 0; - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveYesState; if (gTasks[taskId].tLearnMoveState == T_MVSTATE_SHOW_MOVE_SELECT) @@ -1324,7 +1324,7 @@ static void Task_TradeEvolutionScene(u8 taskId) case 1: // NO case MENU_B_PRESSED: sEvoCursorPos = 1; - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveNoState; break; @@ -1363,7 +1363,7 @@ static void Task_TradeEvolutionScene(u8 taskId) if (IsHMMove2(move)) { // Can't forget HMs - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnMoveState = T_MVSTATE_RETRY_AFTER_HM; } @@ -1374,7 +1374,7 @@ static void Task_TradeEvolutionScene(u8 taskId) RemoveMonPPBonus(mon, var); SetMonMoveSlot(mon, gMoveToLearn, var); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnMoveState++; } @@ -1384,7 +1384,7 @@ static void Task_TradeEvolutionScene(u8 taskId) case T_MVSTATE_FORGET_MSG: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnMoveState++; } @@ -1392,20 +1392,20 @@ static void Task_TradeEvolutionScene(u8 taskId) case T_MVSTATE_LEARNED_MOVE: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tState = T_EVOSTATE_LEARNED_MOVE; } break; case T_MVSTATE_ASK_CANCEL: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tLearnMoveYesState = T_MVSTATE_CANCEL; gTasks[taskId].tLearnMoveNoState = T_MVSTATE_INTRO_MSG_1; gTasks[taskId].tLearnMoveState = T_MVSTATE_PRINT_YES_NO; break; case T_MVSTATE_CANCEL: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_TABLE_START]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); gTasks[taskId].tState = T_EVOSTATE_TRY_LEARN_MOVE; break; From bb91b1b0d1cf70fa49cb0b1f2a309ad541927164 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 10 Mar 2022 16:36:41 -0500 Subject: [PATCH 10/65] Update generic macro argument names --- asm/macros/event.inc | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 58e37d0a6..661e675c9 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -828,10 +828,10 @@ .endm @ Sets the movement type (MOVEMENT_TYPE_*) for an object's template. - .macro setobjectmovementtype word:req, byte:req + .macro setobjectmovementtype localId:req, movementType:req .byte 0x65 - .2byte \word - .byte \byte + .2byte \localId + .byte \movementType .endm @ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the @@ -1451,48 +1451,48 @@ .endm @ Equivalent to goto using the relative address set by setvaddress. - .macro vgoto pointer:req + .macro vgoto destination:req .byte 0xb9 - .4byte \pointer + .4byte \destination .endm @ Equivalent to call using the relative address set by setvaddress. - .macro vcall pointer:req + .macro vcall destination:req .byte 0xba - .4byte \pointer + .4byte \destination .endm @ Equivalent to goto_if using the relative address set by setvaddress. - .macro vgoto_if byte:req, pointer:req + .macro vgoto_if condition:req, destination:req .byte 0xbb - .byte \byte - .4byte \pointer + .byte \condition + .4byte \destination .endm @ Equivalent to call_if using the relative address set by setvaddress. - .macro vcall_if byte:req, pointer:req + .macro vcall_if condition:req, destination:req .byte 0xbc - .byte \byte - .4byte \pointer + .byte \condition + .4byte \destination .endm @ Equivalent to message using the relative address set by setvaddress. - .macro vmessage pointer:req + .macro vmessage text:req .byte 0xbd - .4byte \pointer + .4byte \text .endm @ Expands the given text at the pointer (- the relative address set by setvaddress) into gStringVar4 - .macro vbuffermessage ptr:req + .macro vbuffermessage text:req .byte 0xbe - .4byte \ptr + .4byte \text .endm @ Equivalent to bufferstring using the relative address set by setvaddress. - .macro vbufferstring stringVarIndex:req, pointer:req + .macro vbufferstring stringVarIndex:req, text:req .byte 0xbf stringvar \stringVarIndex - .4byte \pointer + .4byte \text .endm @ Create a window showing how many Coins the player has. @@ -1549,9 +1549,9 @@ .endm @ Used only in FireRed/LeafGreen, does nothing in Emerald. - .macro loadhelp pointer:req + .macro loadhelp text:req .byte 0xc8 - .4byte \pointer + .4byte \text .endm @ Used only in FireRed/LeafGreen, does nothing in Emerald. From 0a0157b62c29172eabd07f0c0eb02d6567957c2c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 14 Mar 2022 15:54:47 -0400 Subject: [PATCH 11/65] Name unknown_16.png --- .../pics/{unknown_16.png => jump_long_grass.png} | Bin spritesheet_rules.mk | 2 +- src/data/object_events/object_event_graphics.h | 2 +- src/field_effect_helpers.c | 2 ++ 4 files changed, 4 insertions(+), 2 deletions(-) rename graphics/field_effects/pics/{unknown_16.png => jump_long_grass.png} (100%) diff --git a/graphics/field_effects/pics/unknown_16.png b/graphics/field_effects/pics/jump_long_grass.png similarity index 100% rename from graphics/field_effects/pics/unknown_16.png rename to graphics/field_effects/pics/jump_long_grass.png diff --git a/spritesheet_rules.mk b/spritesheet_rules.mk index ae7971960..9fb184638 100644 --- a/spritesheet_rules.mk +++ b/spritesheet_rules.mk @@ -636,7 +636,7 @@ $(FLDEFFGFXDIR)/tall_grass.4bpp: %.4bpp: %.png $(FLDEFFGFXDIR)/tree_disguise.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 4 -$(FLDEFFGFXDIR)/unknown_16.4bpp: %.4bpp: %.png +$(FLDEFFGFXDIR)/jump_long_grass.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 $(FLDEFFGFXDIR)/unknown_17.4bpp: %.4bpp: %.png diff --git a/src/data/object_events/object_event_graphics.h b/src/data/object_events/object_event_graphics.h index 81d83a856..6ee56cc78 100755 --- a/src/data/object_events/object_event_graphics.h +++ b/src/data/object_events/object_event_graphics.h @@ -305,7 +305,7 @@ const u16 gFieldEffectObjectPalette1[] = INCBIN_U16("graphics/field_effects/pale const u32 gFieldEffectObjectPic_GroundImpactDust[] = INCBIN_U32("graphics/field_effects/pics/ground_impact_dust.4bpp"); const u32 gFieldEffectObjectPic_JumpTallGrass[] = INCBIN_U32("graphics/field_effects/pics/jump_tall_grass.4bpp"); const u32 gUnusedGrass3[] = INCBIN_U32("graphics/field_effects/pics/unused_grass_3.4bpp"); -const u32 gFieldEffectObjectPic_JumpLongGrass[] = INCBIN_U32("graphics/field_effects/pics/unknown_16.4bpp"); +const u32 gFieldEffectObjectPic_JumpLongGrass[] = INCBIN_U32("graphics/field_effects/pics/jump_long_grass.4bpp"); const u32 gFieldEffectObjectPic_Unknown17[] = INCBIN_U32("graphics/field_effects/pics/unknown_17.4bpp"); const u32 gFieldEffectObjectPic_UnusedGrass2[] = INCBIN_U32("graphics/field_effects/pics/unused_grass_2.4bpp"); const u32 gFieldEffectObjectPic_LongGrass[] = INCBIN_U32("graphics/field_effects/pics/long_grass.4bpp"); diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 65617038d..036ff33f2 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -487,6 +487,8 @@ void UpdateLongGrassFieldEffect(struct Sprite *sprite) #undef sCurrentMap #undef sObjectMoved +// Effectively unused as it's not possible in vanilla to jump onto long grass (no adjacent ledges, and can't ride the Acro Bike in it). +// The graphics for this effect do not visually correspond to tall grass either. Perhaps these graphics were its original design? u32 FldEff_JumpLongGrass(void) { u8 spriteId; From 058783c14841b87dab93b114f216ed1417b27db3 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 14 Mar 2022 16:01:17 -0400 Subject: [PATCH 12/65] Fix comment mistake --- src/field_effect_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 036ff33f2..c3332c7fc 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -488,7 +488,7 @@ void UpdateLongGrassFieldEffect(struct Sprite *sprite) #undef sObjectMoved // Effectively unused as it's not possible in vanilla to jump onto long grass (no adjacent ledges, and can't ride the Acro Bike in it). -// The graphics for this effect do not visually correspond to tall grass either. Perhaps these graphics were its original design? +// The graphics for this effect do not visually correspond to long grass either. Perhaps these graphics were its original design? u32 FldEff_JumpLongGrass(void) { u8 spriteId; From f8b3a1c6584a76cd3e3f2721c5fb3a54bbf3a4f6 Mon Sep 17 00:00:00 2001 From: Andrea Jemmett <1787979+acidghost@users.noreply.github.com> Date: Wed, 16 Mar 2022 14:41:12 +0100 Subject: [PATCH 13/65] Fix finding libpng in gbagfx and rsfont On macOS 12, Homebrew installs libpng in a custom location. --- tools/gbagfx/Makefile | 2 ++ tools/rsfont/Makefile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tools/gbagfx/Makefile b/tools/gbagfx/Makefile index b4244aa8d..8728fa8d0 100644 --- a/tools/gbagfx/Makefile +++ b/tools/gbagfx/Makefile @@ -1,8 +1,10 @@ CC = gcc CFLAGS = -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK +CFLAGS += $(shell pkg-config --cflags libpng) LIBS = -lpng -lz +LDFLAGS += $(shell pkg-config --libs-only-L libpng) SRCS = main.c convert_png.c gfx.c jasc_pal.c lz.c rl.c util.c font.c huff.c diff --git a/tools/rsfont/Makefile b/tools/rsfont/Makefile index 0bc88a42b..92e44b545 100644 --- a/tools/rsfont/Makefile +++ b/tools/rsfont/Makefile @@ -1,8 +1,10 @@ CC ?= gcc CFLAGS = -Wall -Wextra -Werror -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK +CFLAGS += $(shell pkg-config --cflags libpng) LIBS = -lpng -lz +LDFLAGS += $(shell pkg-config --libs-only-L libpng) SRCS = main.c convert_png.c util.c font.c From 66cbe29c1408feef07772ba0b8a5b89995fa3056 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 30 Mar 2022 09:37:03 -0400 Subject: [PATCH 14/65] Add bugfix for Battle Factory trainer IVs --- include/battle_factory.h | 2 +- src/battle_factory.c | 24 ++++++++++++++++-------- src/battle_tower.c | 11 ++++++++--- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/include/battle_factory.h b/include/battle_factory.h index 5606d60d1..d414bdb3b 100644 --- a/include/battle_factory.h +++ b/include/battle_factory.h @@ -3,7 +3,7 @@ void CallBattleFactoryFunction(void); bool8 InBattleFactory(void); -u8 GetFactoryMonFixedIV(u8 arg0, u8 arg1); +u8 GetFactoryMonFixedIV(u8 challengeNum, bool8 isLastBattle); void FillFactoryBrainParty(void); u8 GetNumPastRentalsRank(u8 battleMode, u8 lvlMode); u32 GetAiScriptsInBattleFactory(void); diff --git a/src/battle_factory.c b/src/battle_factory.c index 23fa664f3..d88ed37f9 100644 --- a/src/battle_factory.c +++ b/src/battle_factory.c @@ -720,17 +720,25 @@ static void RestorePlayerPartyHeldItems(void) } } -u8 GetFactoryMonFixedIV(u8 arg0, u8 arg1) +// Get the IV to use for the opponent's pokémon. +// The IVs get higher for each subsequent challenge and for +// the last trainer in each challenge. Noland is an exception +// to this, as he uses the IVs that would be used by the regular +// trainers 2 challenges ahead of the current one. +// Due to a mistake in FillFactoryFrontierTrainerParty, the +// challenge number used to determine the IVs for regular trainers +// is Battle Tower's instead of Battle Factory's. +u8 GetFactoryMonFixedIV(u8 challengeNum, bool8 isLastBattle) { - u8 a1; - u8 a2 = (arg1 != 0) ? 1 : 0; + u8 ivSet; + bool8 useHigherIV = isLastBattle ? TRUE : FALSE; - if (arg0 > 8) - a1 = 7; + if (challengeNum > 8) + ivSet = 7; else - a1 = arg0; + ivSet = challengeNum; - return sFixedIVTable[a1][a2]; + return sFixedIVTable[ivSet][useHigherIV]; } void FillFactoryBrainParty(void) @@ -746,7 +754,7 @@ void FillFactoryBrainParty(void) u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u8 challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7; - fixedIV = GetFactoryMonFixedIV(challengeNum + 2, 0); + fixedIV = GetFactoryMonFixedIV(challengeNum + 2, FALSE); monLevel = SetFacilityPtrsGetLevel(); i = 0; otId = T1_READ_32(gSaveBlock2Ptr->playerTrainerId); diff --git a/src/battle_tower.c b/src/battle_tower.c index b747a3dc0..989412e9e 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -1827,13 +1827,18 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId) if (trainerId < FRONTIER_TRAINERS_COUNT) { - u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable. + u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); + // By mistake Battle Tower's Level 50 challenge number is used to determine the IVs for Battle Factory. + #ifdef BUGFIX + u8 challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7; + #else u8 challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][FRONTIER_LVL_50] / 7; + #endif if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6) - fixedIV = GetFactoryMonFixedIV(challengeNum, 0); + fixedIV = GetFactoryMonFixedIV(challengeNum, FALSE); else - fixedIV = GetFactoryMonFixedIV(challengeNum, 1); + fixedIV = GetFactoryMonFixedIV(challengeNum, TRUE); // Last trainer in challenge uses higher IVs } else if (trainerId == TRAINER_EREADER) { From 62f3f144ab499ff47c4451212b7350e0815a57c7 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 4 Mar 2022 11:02:19 -0500 Subject: [PATCH 15/65] Clean up some trainer hill --- asm/macros/trainer_hill.inc | 8 +- data/maps/TrainerHill_Entrance/scripts.inc | 2 +- include/constants/trainer_hill.h | 27 +- include/ereader_helpers.h | 2 +- include/global.h | 11 +- include/trainer_hill.h | 40 +- src/data/battle_frontier/trainer_hill.h | 957 ++++++--------------- src/ereader_helpers.c | 122 ++- src/trainer_hill.c | 167 ++-- 9 files changed, 456 insertions(+), 880 deletions(-) diff --git a/asm/macros/trainer_hill.inc b/asm/macros/trainer_hill.inc index 65c8c6bef..988e2867a 100644 --- a/asm/macros/trainer_hill.inc +++ b/asm/macros/trainer_hill.inc @@ -100,9 +100,9 @@ special CallTrainerHillFunction .endm - @ Set the challenge mode to HILL_TAG_* (Normal, Variety, Unique, or Expert) - .macro trainerhill_settag tag:req - setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_TAG - copyvar VAR_0x8005, \tag + @ Set the challenge mode to HILL_MODE_* (Normal, Variety, Unique, or Expert) + .macro trainerhill_setmode mode:req + setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_MODE + copyvar VAR_0x8005, \mode special CallTrainerHillFunction .endm diff --git a/data/maps/TrainerHill_Entrance/scripts.inc b/data/maps/TrainerHill_Entrance/scripts.inc index 8989883e4..2dd001a3b 100644 --- a/data/maps/TrainerHill_Entrance/scripts.inc +++ b/data/maps/TrainerHill_Entrance/scripts.inc @@ -157,7 +157,7 @@ TrainerHill_Entrance_EventScript_ChooseChallenge:: switch VAR_RESULT case 4, TrainerHill_Entrance_EventScript_CancelEntry case MULTI_B_PRESSED, TrainerHill_Entrance_EventScript_CancelEntry - trainerhill_settag VAR_RESULT + trainerhill_setmode VAR_RESULT setvar VAR_TRAINER_HILL_IS_ACTIVE, 1 setvar VAR_TEMP_5, 0 special HealPlayerParty diff --git a/include/constants/trainer_hill.h b/include/constants/trainer_hill.h index 0e802bba8..371763faf 100644 --- a/include/constants/trainer_hill.h +++ b/include/constants/trainer_hill.h @@ -8,6 +8,12 @@ #define TRAINER_HILL_ROOF 5 #define TRAINER_HILL_ENTRANCE 6 +#define HILL_MODE_NORMAL 0 +#define HILL_MODE_VARIETY 1 +#define HILL_MODE_UNIQUE 2 +#define HILL_MODE_EXPERT 3 +#define NUM_TRAINER_HILL_MODES 4 + #define NUM_TRAINER_HILL_FLOORS 4 #define NUM_TRAINER_HILL_FLOORS_JP 2 @@ -30,20 +36,33 @@ #define TRAINER_HILL_FUNC_SET_GAME_SAVED 14 #define TRAINER_HILL_FUNC_CLEAR_GAME_SAVED 15 #define TRAINER_HILL_FUNC_GET_WON 16 -#define TRAINER_HILL_FUNC_SET_TAG 17 +#define TRAINER_HILL_FUNC_SET_MODE 17 #define TRAINER_HILL_TEXT_INTRO 2 #define TRAINER_HILL_TEXT_PLAYER_LOST 3 #define TRAINER_HILL_TEXT_PLAYER_WON 4 #define TRAINER_HILL_TEXT_AFTER 5 -#define TRAINER_HILL_TRAINERS_PER_FLOOR 2 -#define NUM_TRAINER_HILL_TRAINERS (NUM_TRAINER_HILL_FLOORS * TRAINER_HILL_TRAINERS_PER_FLOOR) -#define NUM_TRAINER_HILL_TRAINERS_JP (NUM_TRAINER_HILL_FLOORS_JP * TRAINER_HILL_TRAINERS_PER_FLOOR) +#define HILL_TRAINERS_PER_FLOOR 2 +#define NUM_TRAINER_HILL_TRAINERS (NUM_TRAINER_HILL_FLOORS * HILL_TRAINERS_PER_FLOOR) +#define NUM_TRAINER_HILL_TRAINERS_JP (NUM_TRAINER_HILL_FLOORS_JP * HILL_TRAINERS_PER_FLOOR) // Values returned by TrainerHillGetChallengeStatus #define TRAINER_HILL_PLAYER_STATUS_LOST 0 #define TRAINER_HILL_PLAYER_STATUS_ECARD_SCANNED 1 #define TRAINER_HILL_PLAYER_STATUS_NORMAL 2 +#define HILL_TRAINER_NAME_LENGTH 11 + +#define TRAINER_HILL_OTID 0x10000000 + +// The full map of each Trainer Hill floor is 16x21. +// The first 5x21 at the top is the entrance/exit area, +// and the remaining 16x16 is the randomized portion of +// the room where the trainers are. +#define HILL_FLOOR_WIDTH 16 +#define HILL_FLOOR_HEIGHT_MAIN 16 +#define HILL_FLOOR_HEIGHT_MARGIN 5 +#define HILL_FLOOR_HEIGHT (HILL_FLOOR_HEIGHT_MAIN + HILL_FLOOR_HEIGHT_MARGIN) + #endif diff --git a/include/ereader_helpers.h b/include/ereader_helpers.h index 8bf3dc43b..29386bcb2 100755 --- a/include/ereader_helpers.h +++ b/include/ereader_helpers.h @@ -35,7 +35,7 @@ struct EReaderTrainerHillTrainer { u8 trainerNum; struct TrainerHillTrainer trainer; - struct TrHillDisplay display; + struct TrainerHillFloorMap map; u32 checksum; }; // size=0x274 diff --git a/include/global.h b/include/global.h index 0122ecd5c..89f725176 100644 --- a/include/global.h +++ b/include/global.h @@ -14,6 +14,7 @@ #include "constants/maps.h" #include "constants/pokemon.h" #include "constants/easy_chat.h" +#include "constants/trainer_hill.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); @@ -279,8 +280,6 @@ struct BattleTowerPokemon u8 friendship; }; -#define NULL_BATTLE_TOWER_POKEMON { .nickname = __("$$$$$$$$$$$") } - struct EmeraldBattleTowerRecord { /*0x00*/ u8 lvlMode; // 0 = level 50, 1 = level 100 @@ -808,7 +807,7 @@ struct TrainerNameRecord u8 trainerName[PLAYER_NAME_LENGTH + 1]; }; -struct SaveTrainerHill +struct TrainerHillSave { /*0x3D64*/ u32 timer; /*0x3D68*/ u32 bestTime; @@ -820,7 +819,7 @@ struct SaveTrainerHill /*0x3D6E*/ u16 hasLost:1; /*0x3D6E*/ u16 maybeECardScanDuringChallenge:1; /*0x3D6E*/ u16 field_3D6E_0f:1; - /*0x3D6E*/ u16 tag:2; + /*0x3D6E*/ u16 mode:2; // HILL_MODE_* }; struct WonderNewsMetadata @@ -1003,7 +1002,7 @@ struct SaveBlock1 /*0x31F8*/ struct EnigmaBerry enigmaBerry; /*0x322C*/ struct MysteryGiftSave mysteryGift; /*0x3598*/ u8 unused_3598[0x180]; - /*0x3718*/ u32 trainerHillTimes[4]; + /*0x3718*/ u32 trainerHillTimes[NUM_TRAINER_HILL_MODES]; /*0x3728*/ struct RamScript ramScript; /*0x3B14*/ struct RecordMixingGift recordMixingGift; /*0x3B24*/ u8 seen2[NUM_DEX_FLAG_BYTES]; @@ -1011,7 +1010,7 @@ struct SaveBlock1 /*0x3B98*/ struct TrainerNameRecord trainerNameRecords[20]; /*0x3C88*/ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21]; /*0x3D5A*/ u8 unused_3D5A[10]; - /*0x3D64*/ struct SaveTrainerHill trainerHill; + /*0x3D64*/ struct TrainerHillSave trainerHill; /*0x3D70*/ struct WaldaPhrase waldaPhrase; // sizeof: 0x3D88 }; diff --git a/include/trainer_hill.h b/include/trainer_hill.h index 647ba9647..857cabeae 100644 --- a/include/trainer_hill.h +++ b/include/trainer_hill.h @@ -1,7 +1,7 @@ #ifndef GUARD_TRAINER_HILL_H #define GUARD_TRAINER_HILL_H -#define HILL_TRAINER_NAME_LENGTH 11 +#define DUMMY_HILL_MON { .nickname = __("$$$$$$$$$$$") } struct TrainerHillTrainer { @@ -15,44 +15,30 @@ struct TrainerHillTrainer struct BattleTowerPokemon mons[PARTY_SIZE]; }; -struct TrHillRoomTrainers +struct TrainerHillFloorMap { - u8 name[2][HILL_TRAINER_NAME_LENGTH]; - u8 facilityClass[2]; + u8 metatileData[HILL_FLOOR_WIDTH * HILL_FLOOR_HEIGHT_MAIN]; // Add NUM_METATILES_IN_PRIMARY to the values in this array to get metatile ids. + u16 collisionData[HILL_FLOOR_WIDTH]; // One bit for each tile in column-major order, so every array entry is one row. 1 = impassable, 0 = passable + u8 trainerCoords[HILL_TRAINERS_PER_FLOOR]; // Starting at (0,6). Format is 0bYYYYXXXX. + u8 trainerDirections; // DIR_* - 1, 4 bits per trainer + u8 trainerRanges; // 4 bits per trainer }; -struct TrHillDisplay -{ - // Metatile data. Add 0x200 to the values in this array to get metatiles. - // This data then overwrites the metatiles in the map starting at (0,5) - u8 metatileData[0x100]; - // Collision data. One bit for each tile in column-major order, - // so every array entry is one row. 1 = impassable, 0 = passable - u16 collisionData[16]; - // Trainer coordinates, starting at (0,6). Format is 0bYYYYXXXX. - u8 coords[2]; - // Trainer facing directions. Same as (DIR_* - 1). - // Effectively an array of nibbles, one for each trainer. - u8 direction; - // Trainer sight ranges. Effectively an array of nibbles, one for each trainer. - u8 range; -}; - -struct TrHillFloor +struct TrainerHillFloor { u8 trainerNum1; u8 trainerNum2; - struct TrainerHillTrainer trainers[2]; - struct TrHillDisplay display; + struct TrainerHillTrainer trainers[HILL_TRAINERS_PER_FLOOR]; + struct TrainerHillFloorMap map; }; -struct TrHillTag +struct TrainerHillChallenge { u8 numTrainers; u8 unused1; u8 numFloors; - u32 checksum; - struct TrHillFloor floors[0]; + u32 checksum; // A byte array sum of the floor data + struct TrainerHillFloor floors[0]; // Floor data is assumed to follow, so this will be intentionally read out of bounds }; extern u32 *gTrainerHillVBlankCounter; diff --git a/src/data/battle_frontier/trainer_hill.h b/src/data/battle_frontier/trainer_hill.h index 75785b258..413ec8e12 100644 --- a/src/data/battle_frontier/trainer_hill.h +++ b/src/data/battle_frontier/trainer_hill.h @@ -1,20 +1,23 @@ -#define TRAINER_HILL_OTID 0x10000000 - // NOTE: Each of these macros turn data into one byte. Therefore ranges for all arguments is 0-15 -// See struct TrHillDisplay for more info about each +// See struct TrainerHillFloorMap for more info about each #define COORDS_XY(x,y) ((y<<4)|(x)) #define TRAINER_DIRS(a, b) (((a-1)<<4)|(b-1)) #define TRAINER_RANGE(a, b) ((a<<4)|(b)) -static const struct TrHillTag sDataTagJPDefault = { +// WARNING: While not referenced directly, the floor data in this file is referenced by virtue +// of coming after its corresponding challenge (see SetUpDataStruct in trainer_hill.c). +// Do not insert data between a pair of 'sChallenge_Mode' and 'sFloors_Mode'. + +// Unused +static const struct TrainerHillChallenge sChallenge_JPDefault = { .numTrainers = NUM_TRAINER_HILL_TRAINERS_JP, .unused1 = 1, .numFloors = NUM_TRAINER_HILL_FLOORS_JP, .checksum = 0x0 }; - -static const struct TrHillFloor sDataTagJPDefault_Floors[] = { +// Unused +static const struct TrainerHillFloor sFloors_JPDefault[] = { [0] = { .trainerNum1 = 0, .trainerNum2 = 0, @@ -32,8 +35,6 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .species = SPECIES_ZIGZAGOON, .heldItem = ITEM_SITRUS_BERRY, .moves = { MOVE_HEADBUTT, MOVE_PIN_MISSILE, MOVE_GROWL, MOVE_TAIL_WHIP }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 110, .attackEV = 100, .defenseEV = 100, @@ -50,14 +51,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 0, .personality = 0x80, .nickname = __("ジグザグマ$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [1] = { .species = SPECIES_SHROOMISH, .heldItem = ITEM_PECHA_BERRY, .moves = { MOVE_MEGA_DRAIN, MOVE_LEECH_SEED, MOVE_POISON_POWDER, MOVE_GROWTH }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 120, .attackEV = 0, .defenseEV = 120, @@ -74,14 +73,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 0, .personality = 0x0, .nickname = __("キノココ$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [2] = { .species = SPECIES_SANDSHREW, .heldItem = ITEM_QUICK_CLAW, .moves = { MOVE_SCRATCH, MOVE_POISON_STING, MOVE_SAND_ATTACK, MOVE_SWIFT }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 110, .attackEV = 100, .defenseEV = 100, @@ -98,11 +95,11 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 0, .personality = 0x80, .nickname = __("サンド$$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, - [3] = NULL_BATTLE_TOWER_POKEMON, - [4] = NULL_BATTLE_TOWER_POKEMON, - [5] = NULL_BATTLE_TOWER_POKEMON + [3] = DUMMY_HILL_MON, + [4] = DUMMY_HILL_MON, + [5] = DUMMY_HILL_MON } }, [1] = { @@ -114,15 +111,13 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .speechLose = { EC_WORD_OH_QUES, EC_MOVE(EARTHQUAKE), EC_WORD_EXISTS, EC_WORD_OF, EC_WORD_WITHOUT, EC_WORD_EXCL }, .speechAfter = { EC_WORD_YOU_RE, EC_WORD_PROBABLY, EC_WORD_END, EC_WORD_UNTIL, EC_WORD_GOING, EC_WORD_ANYWHERE }, .mons = { - [0] = NULL_BATTLE_TOWER_POKEMON, - [1] = NULL_BATTLE_TOWER_POKEMON, - [2] = NULL_BATTLE_TOWER_POKEMON, + [0] = DUMMY_HILL_MON, + [1] = DUMMY_HILL_MON, + [2] = DUMMY_HILL_MON, [3] = { .species = SPECIES_WINGULL, .heldItem = ITEM_CHERI_BERRY, .moves = { MOVE_WATER_GUN, MOVE_WING_ATTACK, MOVE_GROWL, MOVE_SUPERSONIC }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 110, .attackEV = 100, .defenseEV = 100, @@ -139,14 +134,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 0, .personality = 0x0, .nickname = __("キャモメ$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [4] = { .species = SPECIES_NUMEL, .heldItem = ITEM_FOCUS_BAND, .moves = { MOVE_EMBER, MOVE_DIG, MOVE_TACKLE, MOVE_FOCUS_ENERGY }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 110, .attackEV = 100, .defenseEV = 100, @@ -163,14 +156,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 0, .personality = 0x96, .nickname = __("ドンメル$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [5] = { .species = SPECIES_SURSKIT, .heldItem = ITEM_PERSIM_BERRY, .moves = { MOVE_BUBBLE_BEAM, MOVE_MUD_SHOT, MOVE_QUICK_ATTACK, MOVE_AGILITY }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 100, .attackEV = 100, .defenseEV = 100, @@ -187,12 +178,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 0, .personality = 0x0, .nickname = __("アメタマ$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, } }, }, - .display = { + .map = { .metatileData = { 0x31, 0x35, 0x35, 0x3b, 0x26, 0x26, 0x1b, 0x1c, 0x1d, 0x25, 0x39, 0x3a, 0x3b, 0x3b, 0x3b, 0x08, 0x31, 0x2b, 0x2b, 0x3b, 0x34, 0x34, 0x2b, 0x2b, 0x34, 0x33, 0x3f, 0x3f, 0x3f, 0x3f, 0x3b, 0x08, @@ -212,9 +203,9 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = { 0x0381, 0x6fc1, 0x6341, 0x6041, 0x7f41, 0x4401, 0x5541, 0x5541, 0x11c1, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff }, - .coords = { COORDS_XY(8,2), COORDS_XY(8,7) }, - .direction = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), - .range = TRAINER_RANGE(2, 3) + .trainerCoords = { COORDS_XY(8,2), COORDS_XY(8,7) }, + .trainerDirections = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), + .trainerRanges = TRAINER_RANGE(2, 3) } }, [1] = { @@ -234,8 +225,6 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .species = SPECIES_ELECTRIKE, .heldItem = ITEM_CHERI_BERRY, .moves = { MOVE_SPARK, MOVE_THUNDER_WAVE, MOVE_QUICK_ATTACK, MOVE_ROAR }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 120, .attackEV = 120, .defenseEV = 0, @@ -252,14 +241,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 1, .personality = 0x0, .nickname = __("ラクライ$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [1] = { .species = SPECIES_CORPHISH, .heldItem = ITEM_QUICK_CLAW, .moves = { MOVE_KNOCK_OFF, MOVE_CRABHAMMER, MOVE_TAUNT, MOVE_PROTECT }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 100, .attackEV = 110, .defenseEV = 100, @@ -276,14 +263,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 1, .personality = 0x96, .nickname = __("ヘイガニ$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [2] = { .species = SPECIES_BALTOY, .heldItem = ITEM_PERSIM_BERRY, .moves = { MOVE_PSYBEAM, MOVE_ROCK_TOMB, MOVE_MUD_SLAP, MOVE_HARDEN }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 100, .attackEV = 100, .defenseEV = 100, @@ -300,11 +285,11 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 0, .personality = 0x96, .nickname = __("ヤジロン$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, - [3] = NULL_BATTLE_TOWER_POKEMON, - [4] = NULL_BATTLE_TOWER_POKEMON, - [5] = NULL_BATTLE_TOWER_POKEMON, + [3] = DUMMY_HILL_MON, + [4] = DUMMY_HILL_MON, + [5] = DUMMY_HILL_MON, } }, [1] = { @@ -316,15 +301,13 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .speechLose = { EC_WORD_AWFUL, EC_WORD_GWAH, EC_WORD_HOPELESS, EC_WORD_CAN_T_WIN, EC_WORD_IS, EC_WORD_NONE }, .speechAfter = { EC_WORD_AWW, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_ALMOST, EC_WORD_GOOD, EC_WORD_ANYWHERE }, .mons = { - [0] = NULL_BATTLE_TOWER_POKEMON, - [1] = NULL_BATTLE_TOWER_POKEMON, - [2] = NULL_BATTLE_TOWER_POKEMON, + [0] = DUMMY_HILL_MON, + [1] = DUMMY_HILL_MON, + [2] = DUMMY_HILL_MON, [3] = { .species = SPECIES_SPHEAL, .heldItem = ITEM_FOCUS_BAND, .moves = { MOVE_ICE_BALL, MOVE_BODY_SLAM, MOVE_WATER_GUN, MOVE_ENCORE }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 100, .attackEV = 100, .defenseEV = 100, @@ -341,14 +324,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 0, .personality = 0x80, .nickname = __("タマザラシ$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [4] = { .species = SPECIES_SPOINK, .heldItem = ITEM_PERSIM_BERRY, .moves = { MOVE_PSYWAVE, MOVE_FUTURE_SIGHT, MOVE_CONFUSE_RAY, MOVE_MAGIC_COAT }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 100, .attackEV = 0, .defenseEV = 100, @@ -365,14 +346,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 1, .personality = 0xf, .nickname = __("バネブー$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [5] = { .species = SPECIES_POOCHYENA, .heldItem = ITEM_PECHA_BERRY, .moves = { MOVE_BITE, MOVE_POISON_FANG, MOVE_SWAGGER, MOVE_SCARY_FACE }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 70, .attackEV = 80, .defenseEV = 80, @@ -389,12 +368,12 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .abilityNum = 0, .personality = 0x96, .nickname = __("ポチエナ$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, } }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3b, 0x35, 0x3b, 0x39, 0x26, 0x1b, 0x1c, 0x1d, 0x25, 0x39, 0x3a, 0x3b, 0x35, 0x3b, 0x08, 0x31, 0x3b, 0x2b, 0x3b, 0x3b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x3b, 0x3b, 0x3b, 0x2b, 0x3b, 0x08, @@ -414,14 +393,14 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = { 0x0381, 0x27c5, 0x27c5, 0x27c5, 0x27c5, 0x27c5, 0x26c5, 0x2005, 0x3efd, 0x1, 0x6ff, 0x7ff, 0x7ff, 0xffff, 0xffff, 0xffff }, - .coords = { COORDS_XY(7,6), COORDS_XY(7,10) }, - .direction = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), - .range = TRAINER_RANGE(3, 3) + .trainerCoords = { COORDS_XY(7,6), COORDS_XY(7,10) }, + .trainerDirections = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), + .trainerRanges = TRAINER_RANGE(3, 3) } }, }; -static const struct TrHillTag sDataTagNormal = +static const struct TrainerHillChallenge sChallenge_Normal = { .numTrainers = NUM_TRAINER_HILL_TRAINERS, .unused1 = 2, @@ -429,7 +408,7 @@ static const struct TrHillTag sDataTagNormal = .checksum = 0x00051E05 }; -static const struct TrHillFloor sDataTagNormal_Floors[] = +static const struct TrainerHillFloor sFloors_Normal[] = { [0] = { @@ -453,8 +432,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_MISDREAVUS, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_SHADOW_BALL, MOVE_PSYCHIC, MOVE_THUNDERBOLT, MOVE_CONFUSE_RAY}, - .level = 0, - .ppBonuses = 0, .attackEV = 155, .speedEV = 255, .spAttackEV = 100, @@ -468,15 +445,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x0, .nickname = _("MISDREAVUS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_SOLROCK, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_PSYCHIC, MOVE_FLAMETHROWER, MOVE_ROCK_SLIDE, MOVE_CALM_MIND}, - .level = 0, - .ppBonuses = 0, .hpEV = 200, .defenseEV = 100, .spAttackEV = 110, @@ -491,15 +466,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0xF, .nickname = _("SOLROCK"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_CLAYDOL, .heldItem = ITEM_SHELL_BELL, .moves = {MOVE_EARTHQUAKE, MOVE_PSYCHIC, MOVE_SHADOW_BALL, MOVE_ICE_BEAM}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .defenseEV = 135, .spDefenseEV = 120, @@ -513,15 +486,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0xC, .nickname = _("CLAYDOL"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_WEEZING, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_SLUDGE_BOMB, MOVE_SHADOW_BALL, MOVE_FRUSTRATION, MOVE_DESTINY_BOND}, - .level = 0, - .ppBonuses = 0, .hpEV = 110, .attackEV = 200, .spDefenseEV = 200, @@ -542,8 +513,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_LUNATONE, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_PSYCHIC, MOVE_ICE_BEAM, MOVE_ROCK_SLIDE, MOVE_CALM_MIND}, - .level = 0, - .ppBonuses = 0, .hpEV = 200, .defenseEV = 100, .spAttackEV = 110, @@ -558,15 +527,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0xF, .nickname = _("LUNATONE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_FLYGON, .heldItem = ITEM_CHOICE_BAND, .moves = {MOVE_EARTHQUAKE, MOVE_DRAGON_CLAW, MOVE_CRUNCH, MOVE_FLAMETHROWER}, - .level = 0, - .ppBonuses = 0, .attackEV = 155, .speedEV = 255, .spAttackEV = 100, @@ -580,7 +547,7 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x83, .nickname = _("FLYGON"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -600,8 +567,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_SEALEO, .heldItem = ITEM_NEVER_MELT_ICE, .moves = {MOVE_BLIZZARD, MOVE_ICE_BALL, MOVE_ENCORE, MOVE_HAIL}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -614,15 +579,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0xF, .nickname = _("SEALEO"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_AMPHAROS, .heldItem = ITEM_MAGNET, .moves = {MOVE_THUNDER, MOVE_THUNDER_WAVE, MOVE_COTTON_SPORE, MOVE_LIGHT_SCREEN}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -635,15 +598,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0xF, .nickname = _("AMPHAROS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_MACHOKE, .heldItem = ITEM_BLACK_BELT, .moves = {MOVE_DYNAMIC_PUNCH, MOVE_MUD_SLAP, MOVE_COUNTER, MOVE_SCARY_FACE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .attackEV = 255, .otId = TRAINER_HILL_OTID, @@ -656,15 +617,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x4E, .nickname = _("MACHOKE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_FLAREON, .heldItem = ITEM_CHARCOAL, .moves = {MOVE_FIRE_BLAST, MOVE_BITE, MOVE_QUICK_ATTACK, MOVE_SAND_ATTACK}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -677,15 +636,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x28, .nickname = _("FLAREON"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_MAGNETON, .heldItem = ITEM_MAGNET, .moves = {MOVE_ZAP_CANNON, MOVE_THUNDER_WAVE, MOVE_SCREECH, MOVE_METAL_SOUND}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -698,15 +655,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x0, .nickname = _("MAGNETON"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_PINSIR, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_GUILLOTINE, MOVE_BRICK_BREAK, MOVE_SWAGGER, MOVE_FAINT_ATTACK}, - .level = 0, - .ppBonuses = 0, .hpEV = 200, .defenseEV = 155, .spDefenseEV = 155, @@ -720,12 +675,12 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x85, .nickname = _("PINSIR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x35, 0x35, 0x26, 0x26, 0x1B, 0x1C, 0x1D, 0x25, 0x26, 0x3A, 0x3B, 0x35, 0x3B, 0x08, 0x31, 0x3B, 0x2C, 0x2C, 0x2C, 0x2B, 0x24, 0x24, 0x24, 0x24, 0x2C, 0x3B, 0x3B, 0x2C, 0x3B, 0x08, @@ -745,10 +700,10 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x3FE5, 0x0401, 0xBDED, 0x8425, 0xDFBD, 0x0221, 0x7E7F, 0x0941, 0x7F7D, 0x0911, 0x7FF7, 0x4101, 0x79F9, 0x0803, 0xFFFF}, - .coords = {COORDS_XY(11,1), COORDS_XY(13,2)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_NORTH), - .range = TRAINER_RANGE(2, 1), - } + .trainerCoords = {COORDS_XY(11,1), COORDS_XY(13,2)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_NORTH), + .trainerRanges = TRAINER_RANGE(2, 1), + } }, [1] = { @@ -772,8 +727,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_MEDITITE, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_FOCUS_PUNCH, MOVE_PROTECT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -787,15 +740,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x80, .nickname = _("MEDITITE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_HERACROSS, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_FOCUS_PUNCH, MOVE_PROTECT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -809,15 +760,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 1, .personality = 0x80, .nickname = _("HERACROSS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_HITMONTOP, .heldItem = ITEM_SHELL_BELL, .moves = {MOVE_FOCUS_PUNCH, MOVE_PROTECT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -831,15 +780,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x3, .nickname = _("HITMONTOP"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_MACHOP, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_FOCUS_PUNCH, MOVE_REVENGE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -853,15 +800,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x4E, .nickname = _("MACHOP"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_PINSIR, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_FOCUS_PUNCH, MOVE_REVENGE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -875,15 +820,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x80, .nickname = _("PINSIR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_HITMONCHAN, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_FOCUS_PUNCH, MOVE_REVENGE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -897,7 +840,7 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x3, .nickname = _("HITMONCHAN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -917,8 +860,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_VULPIX, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_WILL_O_WISP, MOVE_CONFUSE_RAY, MOVE_TAIL_WHIP, MOVE_OVERHEAT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 252, .spDefenseEV = 6, @@ -932,15 +873,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0xF, .nickname = _("VULPIX"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_MINUN, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_THUNDER_WAVE, MOVE_CHARM, MOVE_ENCORE, MOVE_SPARK}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 252, .spAttackEV = 6, @@ -954,15 +893,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x8C, .nickname = _("MINUN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_ROSELIA, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_TOXIC, MOVE_LEECH_SEED, MOVE_SWEET_SCENT, MOVE_GIGA_DRAIN}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 252, .spAttackEV = 6, @@ -976,15 +913,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 1, .personality = 0xF, .nickname = _("ROSELIA"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_MR_MIME, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_SAFEGUARD, MOVE_REFLECT, MOVE_LIGHT_SCREEN, MOVE_PSYCHIC}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 252, .spDefenseEV = 6, @@ -998,15 +933,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x82, .nickname = _("MR. MIME"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_PLUSLE, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_RAIN_DANCE, MOVE_LIGHT_SCREEN, MOVE_HELPING_HAND, MOVE_THUNDER}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 252, .spDefenseEV = 6, @@ -1020,15 +953,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x5, .nickname = _("PLUSLE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_TOGEPI, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_LIGHT_SCREEN, MOVE_REFLECT, MOVE_FOLLOW_ME, MOVE_METRONOME}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 252, .spDefenseEV = 6, @@ -1042,12 +973,12 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 1, .personality = 0x37, .nickname = _("TOGEPI"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0xD1, 0xD5, 0xD5, 0xD5, 0xD9, 0xD9, 0x1B, 0x1C, 0x1D, 0xC5, 0xC6, 0xCE, 0xD5, 0xDB, 0xD5, 0x08, 0xD1, 0xCB, 0xC4, 0xC4, 0xDB, 0xDB, 0xC4, 0xC4, 0xC4, 0xCC, 0xCC, 0xCC, 0xCB, 0xDB, 0xCB, 0x08, @@ -1067,10 +998,10 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x73FB, 0x400B, 0x400B, 0x51EB, 0x538B, 0x51BB, 0x518B, 0x51EB, 0x518B, 0x51BB, 0x5003, 0x501F, 0x101F, 0x101F, 0xFFFF}, - .coords = {COORDS_XY(4,11), COORDS_XY(9,14)}, - .direction = TRAINER_DIRS(DIR_SOUTH, DIR_EAST), - .range = TRAINER_RANGE(3, 5), - } + .trainerCoords = {COORDS_XY(4,11), COORDS_XY(9,14)}, + .trainerDirections = TRAINER_DIRS(DIR_SOUTH, DIR_EAST), + .trainerRanges = TRAINER_RANGE(3, 5), + } }, [2] = { @@ -1094,8 +1025,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_VAPOREON, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_HAZE, MOVE_HELPING_HAND, MOVE_TICKLE, MOVE_WATER_PULSE}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -1116,8 +1045,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_DODRIO, .heldItem = ITEM_KINGS_ROCK, .moves = {MOVE_HAZE, MOVE_TRI_ATTACK, MOVE_TAUNT, MOVE_TORMENT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spDefenseEV = 6, @@ -1138,8 +1065,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_OMASTAR, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_HAZE, MOVE_HYDRO_PUMP, MOVE_TICKLE, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -1153,15 +1078,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x14, .nickname = _("OMASTAR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_LICKITUNG, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_BELLY_DRUM, MOVE_REST, MOVE_MUD_SLAP, MOVE_SWAGGER}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -1175,15 +1098,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x8, .nickname = _("LICKITUNG"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_SLOWBRO, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_BELLY_DRUM, MOVE_MUD_SLAP, MOVE_SWAGGER, MOVE_AMNESIA}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -1204,8 +1125,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_LINOONE, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_BELLY_DRUM, MOVE_REST, MOVE_MUD_SLAP, MOVE_SWAGGER}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -1219,7 +1138,7 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x8, .nickname = _("LINOONE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -1239,8 +1158,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_SKITTY, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_PSYCH_UP, MOVE_DOUBLE_EDGE, MOVE_SHADOW_BALL, MOVE_IRON_TAIL}, - .level = 0, - .ppBonuses = 0, .attackEV = 252, .speedEV = 252, .otId = TRAINER_HILL_OTID, @@ -1253,15 +1170,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0xCB, .nickname = _("SKITTY"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_MEDICHAM, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_PSYCH_UP, MOVE_HI_JUMP_KICK, MOVE_MEGA_KICK, MOVE_ROCK_SLIDE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 6, .speedEV = 252, @@ -1282,8 +1197,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_STANTLER, .heldItem = ITEM_SHELL_BELL, .moves = {MOVE_PSYCH_UP, MOVE_RETURN, MOVE_EARTHQUAKE, MOVE_SHADOW_BALL}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .speedEV = 6, @@ -1304,8 +1217,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_NIDOQUEEN, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_SUPERPOWER, MOVE_BITE, MOVE_CHARM, MOVE_FLATTER}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -1326,8 +1237,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_NINETALES, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_OVERHEAT, MOVE_QUICK_ATTACK, MOVE_SPITE, MOVE_TAIL_WHIP}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -1341,15 +1250,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0xD7, .nickname = _("NINETALES"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_CHARIZARD, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_OVERHEAT, MOVE_BEAT_UP, MOVE_SCARY_FACE, MOVE_GROWL}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -1363,12 +1270,12 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x28, .nickname = _("CHARIZARD"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x35, 0x35, 0x35, 0x26, 0x26, 0x13, 0x14, 0x15, 0x38, 0x26, 0x2E, 0x35, 0x35, 0x3B, 0x08, 0x69, 0x63, 0x64, 0x64, 0x64, 0x64, 0x71, 0x71, 0x71, 0x72, 0x64, 0x64, 0x64, 0x63, 0x73, 0x08, @@ -1388,10 +1295,10 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = 0x69, 0x42, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x42, 0x73, 0x08, }, .collisionData = {0x0381, 0x7C3D, 0x4005, 0x4005, 0x4005, 0x4045, 0x4005, 0x4805, 0x4005, 0x4045, 0x4005, 0x4205, 0x4005, 0x4045, 0x1, 0x1}, - .coords = {COORDS_XY(5,2), COORDS_XY(9,2)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_EAST), - .range = TRAINER_RANGE(3, 3), - } + .trainerCoords = {COORDS_XY(5,2), COORDS_XY(9,2)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_EAST), + .trainerRanges = TRAINER_RANGE(3, 3), + } }, [3] = { @@ -1415,8 +1322,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_ALAKAZAM, .heldItem = ITEM_PETAYA_BERRY, .moves = {MOVE_SKILL_SWAP, MOVE_FIRE_PUNCH, MOVE_ICE_PUNCH, MOVE_REFLECT}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -1429,15 +1334,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x41, .nickname = _("ALAKAZAM"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_BLISSEY, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_SKILL_SWAP, MOVE_EGG_BOMB, MOVE_THUNDERBOLT, MOVE_SING}, - .level = 0, - .ppBonuses = 0, .defenseEV = 255, .spAttackEV = 155, .spDefenseEV = 100, @@ -1451,15 +1354,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 1, .personality = 0xF, .nickname = _("BLISSEY"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_GRUMPIG, .heldItem = ITEM_TWISTED_SPOON, .moves = {MOVE_SKILL_SWAP, MOVE_PSYCHIC, MOVE_CONFUSE_RAY, MOVE_REST}, - .level = 0, - .ppBonuses = 0, .hpEV = 110, .defenseEV = 200, .spAttackEV = 200, @@ -1473,15 +1374,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x8C, .nickname = _("GRUMPIG"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_GARDEVOIR, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_SKILL_SWAP, MOVE_DREAM_EATER, MOVE_HYPNOSIS, MOVE_PROTECT}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -1494,15 +1393,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 1, .personality = 0xF, .nickname = _("GARDEVOIR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_VENOMOTH, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_SKILL_SWAP, MOVE_SIGNAL_BEAM, MOVE_SLEEP_POWDER, MOVE_TOXIC}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1515,15 +1412,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x80, .nickname = _("VENOMOTH"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_ESPEON, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_SKILL_SWAP, MOVE_PSYBEAM, MOVE_SWIFT, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -1536,7 +1431,7 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0xF, .nickname = _("ESPEON"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -1556,8 +1451,6 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .species = SPECIES_WEEZING, .heldItem = ITEM_POISON_BARB, .moves = {MOVE_TOXIC, MOVE_SLUDGE_BOMB, MOVE_SMOKESCREEN, MOVE_HAZE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .attackEV = 255, .otId = TRAINER_HILL_OTID, @@ -1570,15 +1463,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x3, .nickname = _("WEEZING"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_GLOOM, .heldItem = ITEM_MIRACLE_SEED, .moves = {MOVE_PETAL_DANCE, MOVE_SYNTHESIS, MOVE_SUNNY_DAY, MOVE_SOLAR_BEAM}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -1591,15 +1482,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x8C, .nickname = _("GLOOM"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_MUK, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_SCREECH, MOVE_DISABLE, MOVE_SLUDGE_BOMB, MOVE_ACID_ARMOR}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .attackEV = 255, .otId = TRAINER_HILL_OTID, @@ -1612,15 +1501,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x3, .nickname = _("MUK"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_TROPIUS, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_SUNNY_DAY, MOVE_SOLAR_BEAM, MOVE_SWEET_SCENT, MOVE_AERIAL_ACE}, - .level = 0, - .ppBonuses = 0, .attackEV = 120, .speedEV = 255, .spAttackEV = 135, @@ -1634,15 +1521,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x83, .nickname = _("TROPIUS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_BELLOSSOM, .heldItem = ITEM_MENTAL_HERB, .moves = {MOVE_SWEET_SCENT, MOVE_PETAL_DANCE, MOVE_STUN_SPORE, MOVE_SLUDGE_BOMB}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1655,15 +1540,13 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x6, .nickname = _("BELLOSSOM"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_MEGANIUM, .heldItem = ITEM_MIRACLE_SEED, .moves = {MOVE_RAZOR_LEAF, MOVE_BODY_SLAM, MOVE_LEECH_SEED, MOVE_SYNTHESIS}, - .level = 0, - .ppBonuses = 0, .attackEV = 200, .speedEV = 110, .spAttackEV = 200, @@ -1677,12 +1560,12 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .abilityNum = 0, .personality = 0x1F, .nickname = _("MEGANIUM"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x26, 0x1B, 0x1C, 0x1D, 0x25, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x1F, 0x17, 0x17, 0x17, 0x17, 0x2B, 0x24, 0x24, 0x24, 0x2B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x08, @@ -1702,14 +1585,14 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x7C1, 0x8441, 0x8477, 0x8441, 0xA441, 0x0401, 0x1, 0x8401, 0x8465, 0x0445, 0x1441, 0x8449, 0x8449, 0x87C1, 0xFFFF}, - .coords = {COORDS_XY(7,4), COORDS_XY(7,10)}, - .direction = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), - .range = TRAINER_RANGE(3, 3), - } + .trainerCoords = {COORDS_XY(7,4), COORDS_XY(7,10)}, + .trainerDirections = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), + .trainerRanges = TRAINER_RANGE(3, 3), + } }, }; -static const struct TrHillTag sDataTagVariety = +static const struct TrainerHillChallenge sChallenge_Variety = { .numTrainers = NUM_TRAINER_HILL_TRAINERS, .unused1 = 1, @@ -1717,7 +1600,7 @@ static const struct TrHillTag sDataTagVariety = .checksum = 0x00054C15 }; -static const struct TrHillFloor sDataTagVariety_Floors[] = { +static const struct TrainerHillFloor sFloors_Variety[] = { [0] = { .trainerNum1 = 41, @@ -1740,8 +1623,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_DELIBIRD, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_PRESENT, MOVE_SPLASH, MOVE_HAIL, MOVE_PROTECT}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1754,15 +1635,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 1, .personality = 0x8A, .nickname = _("DELIBIRD"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_CLEFAIRY, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_PRESENT, MOVE_COSMIC_POWER, MOVE_LIGHT_SCREEN, MOVE_MOONLIGHT}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1775,15 +1654,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xD, .nickname = _("CLEFAIRY"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_PIKACHU, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_PRESENT, MOVE_GROWL, MOVE_TAIL_WHIP, MOVE_AGILITY}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1796,15 +1673,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xD, .nickname = _("PIKACHU"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_MARILL, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_PRESENT, MOVE_DEFENSE_CURL, MOVE_TAIL_WHIP, MOVE_ENDURE}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1817,15 +1692,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 1, .personality = 0x8A, .nickname = _("MARILL"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_JIGGLYPUFF, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_PRESENT, MOVE_SING, MOVE_DISABLE, MOVE_REST}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1838,15 +1711,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xD, .nickname = _("JIGGLYPUFF"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_TOGETIC, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_PRESENT, MOVE_CHARM, MOVE_SWEET_KISS, MOVE_WISH}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1859,7 +1730,7 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 1, .personality = 0x26, .nickname = _("TOGETIC"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -1879,8 +1750,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_WIGGLYTUFF, .heldItem = ITEM_SILK_SCARF, .moves = {MOVE_ROLLOUT, MOVE_DEFENSE_CURL, MOVE_SING, MOVE_DREAM_EATER}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1893,15 +1762,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xC1, .nickname = _("WIGGLYTUFF"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_SABLEYE, .heldItem = ITEM_SILK_SCARF, .moves = {MOVE_ASTONISH, MOVE_FAINT_ATTACK, MOVE_DETECT, MOVE_CONFUSE_RAY}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1914,15 +1781,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x87, .nickname = _("SABLEYE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_GRUMPIG, .heldItem = ITEM_SILK_SCARF, .moves = {MOVE_PSYBEAM, MOVE_MAGIC_COAT, MOVE_BOUNCE, MOVE_FUTURE_SIGHT}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1935,15 +1800,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xA, .nickname = _("GRUMPIG"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_CORSOLA, .heldItem = ITEM_SILK_SCARF, .moves = {MOVE_BUBBLE_BEAM, MOVE_ROCK_BLAST, MOVE_REFLECT, MOVE_LIGHT_SCREEN}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1956,15 +1819,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x12, .nickname = _("CORSOLA"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_CLAMPERL, .heldItem = ITEM_SILK_SCARF, .moves = {MOVE_WHIRLPOOL, MOVE_IRON_DEFENSE, MOVE_ENDURE, MOVE_CONFUSE_RAY}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1977,15 +1838,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xA, .nickname = _("CLAMPERL"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_STARMIE, .heldItem = ITEM_SILK_SCARF, .moves = {MOVE_DIVE, MOVE_ICY_WIND, MOVE_SWIFT, MOVE_SKILL_SWAP}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -1998,12 +1857,12 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xA, .nickname = _("STARMIE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x39, 0x13, 0x14, 0x15, 0x38, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x40, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x43, 0x43, 0x43, 0x43, 0x43, 0x40, 0x41, 0x41, 0x08, @@ -2023,9 +1882,9 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { 0x40, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x08, }, .collisionData = {0x0381, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1}, - .coords = {COORDS_XY(5,8), COORDS_XY(9,8)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_EAST), - .range = TRAINER_RANGE(3, 3), + .trainerCoords = {COORDS_XY(5,8), COORDS_XY(9,8)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_EAST), + .trainerRanges = TRAINER_RANGE(3, 3), } }, [1] = @@ -2050,8 +1909,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_JIGGLYPUFF, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_SING, MOVE_HYPER_VOICE, MOVE_ATTRACT, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 85, .attackEV = 85, .defenseEV = 85, @@ -2068,15 +1925,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x0, .nickname = _("JIGGLYPUFF"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_JYNX, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_PERISH_SONG, MOVE_FAKE_TEARS, MOVE_ATTRACT, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 85, .attackEV = 85, .defenseEV = 85, @@ -2093,15 +1948,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x0, .nickname = _("JYNX"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_EXPLOUD, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_HOWL, MOVE_HYPER_VOICE, MOVE_ATTRACT, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 85, .attackEV = 85, .defenseEV = 85, @@ -2118,15 +1971,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x96, .nickname = _("EXPLOUD"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_ABSOL, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_SWORDS_DANCE, MOVE_SLASH, MOVE_ATTRACT, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 85, .attackEV = 85, .defenseEV = 85, @@ -2143,15 +1994,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x96, .nickname = _("ABSOL"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_PIDGEOTTO, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_FEATHER_DANCE, MOVE_AERIAL_ACE, MOVE_ATTRACT, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 85, .attackEV = 85, .defenseEV = 85, @@ -2168,15 +2017,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x96, .nickname = _("PIDGEOTTO"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_ALTARIA, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_DRAGON_DANCE, MOVE_AERIAL_ACE, MOVE_ATTRACT, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 85, .attackEV = 85, .defenseEV = 85, @@ -2193,7 +2040,7 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x0, .nickname = _("ALTARIA"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -2213,8 +2060,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_CHIMECHO, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_UPROAR, MOVE_ATTRACT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -2228,15 +2073,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xD, .nickname = _("CHIMECHO"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_WHISMUR, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_UPROAR, MOVE_ATTRACT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -2250,15 +2093,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xD, .nickname = _("WHISMUR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_YANMA, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_UPROAR, MOVE_ATTRACT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -2272,15 +2113,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x8A, .nickname = _("YANMA"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_ILLUMISE, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_ENCORE, MOVE_ATTRACT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 6, .speedEV = 252, @@ -2294,15 +2133,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xA, .nickname = _("ILLUMISE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_SPHEAL, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_ENCORE, MOVE_ATTRACT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spDefenseEV = 6, @@ -2316,15 +2153,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xA, .nickname = _("SPHEAL"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_VIGOROTH, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_ENCORE, MOVE_ATTRACT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 6, .speedEV = 252, @@ -2338,12 +2173,12 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x87, .nickname = _("VIGOROTH"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x39, 0x13, 0x14, 0x15, 0x38, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x91, 0x9B, 0x9C, 0x96, 0x40, 0x40, 0x96, 0x9B, 0x96, 0x40, 0x40, 0x96, 0x9B, 0x9C, 0x9B, 0x08, @@ -2363,9 +2198,9 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xFFFF}, - .coords = {COORDS_XY(3,8), COORDS_XY(11,8)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_EAST), - .range = TRAINER_RANGE(7, 7), + .trainerCoords = {COORDS_XY(3,8), COORDS_XY(11,8)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_EAST), + .trainerRanges = TRAINER_RANGE(7, 7), } }, [2] = @@ -2390,8 +2225,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_WOOPER, .heldItem = ITEM_FIGY_BERRY, .moves = {MOVE_RAIN_DANCE, MOVE_YAWN, MOVE_SURF, MOVE_HAZE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 6, .spAttackEV = 252, @@ -2405,15 +2238,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x8C, .nickname = _("WOOPER"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_POLIWAG, .heldItem = ITEM_WIKI_BERRY, .moves = {MOVE_SURF, MOVE_ICE_BEAM, MOVE_MIST, MOVE_HYPNOSIS}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 6, .spAttackEV = 252, @@ -2427,15 +2258,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 1, .personality = 0x3, .nickname = _("POLIWAG"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_PSYDUCK, .heldItem = ITEM_AGUAV_BERRY, .moves = {MOVE_HYPNOSIS, MOVE_SURF, MOVE_DISABLE, MOVE_SEISMIC_TOSS}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -2449,15 +2278,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("PSYDUCK"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_RHYDON, .heldItem = ITEM_SOFT_SAND, .moves = {MOVE_EARTHQUAKE, MOVE_MAGNITUDE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .speedEV = 6, @@ -2478,8 +2305,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_RHYHORN, .heldItem = ITEM_SOFT_SAND, .moves = {MOVE_EARTHQUAKE, MOVE_MAGNITUDE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -2500,8 +2325,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_CUBONE, .heldItem = ITEM_SOFT_SAND, .moves = {MOVE_EARTHQUAKE, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -2535,8 +2358,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_MAGNEMITE, .heldItem = ITEM_MAGNET, .moves = {MOVE_THUNDER, MOVE_ZAP_CANNON, MOVE_SPARK, MOVE_THUNDER_SHOCK}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -2550,15 +2371,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x8C, .nickname = _("MAGNEMITE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_ELECTABUZZ, .heldItem = ITEM_MAGNET, .moves = {MOVE_THUNDER, MOVE_THUNDERBOLT, MOVE_THUNDER_PUNCH, MOVE_SHOCK_WAVE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -2572,15 +2391,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x41, .nickname = _("ELECTABUZZ"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_FLAAFFY, .heldItem = ITEM_MAGNET, .moves = {MOVE_THUNDER, MOVE_THUNDERBOLT, MOVE_SHOCK_WAVE, MOVE_THUNDER_SHOCK}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .spAttackEV = 130, .otId = TRAINER_HILL_OTID, @@ -2593,15 +2410,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x0, .nickname = _("FLAAFFY"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_BALTOY, .heldItem = ITEM_SILK_SCARF, .moves = {MOVE_EXPLOSION, MOVE_SELF_DESTRUCT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -2622,8 +2437,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_PINECO, .heldItem = ITEM_SILK_SCARF, .moves = {MOVE_EXPLOSION, MOVE_SELF_DESTRUCT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .speedEV = 6, @@ -2644,8 +2457,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_VOLTORB, .heldItem = ITEM_SILK_SCARF, .moves = {MOVE_EXPLOSION, MOVE_SELF_DESTRUCT, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -2664,7 +2475,7 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x39, 0x1B, 0x1C, 0x1D, 0x38, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x91, 0x9B, 0x9B, 0x9B, 0x9B, 0x9B, 0x84, 0x84, 0x84, 0x9A, 0x9B, 0x9B, 0x9B, 0x9B, 0x9B, 0x08, @@ -2684,9 +2495,9 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { 0x17, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x17, 0xBB, 0xBB, 0x08, }, .collisionData = {0x0381, 0x0381, 0x7FF7, 0x1, 0x7FF7, 0x1, 0x7FF7, 0x1, 0x7FF7, 0x1, 0x7FF7, 0x1, 0x7FF7, 0x1, 0x7FF7, 0x1}, - .coords = {COORDS_XY(9,1), COORDS_XY(14,1)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_EAST), - .range = TRAINER_RANGE(4, 4), + .trainerCoords = {COORDS_XY(9,1), COORDS_XY(14,1)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_EAST), + .trainerRanges = TRAINER_RANGE(4, 4), } }, [3] = @@ -2711,8 +2522,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_UNOWN, .heldItem = ITEM_MIRACLE_SEED, .moves = {MOVE_HIDDEN_POWER, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2725,15 +2534,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x202, .nickname = _("UNOWN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_UNOWN, .heldItem = ITEM_MYSTIC_WATER, .moves = {MOVE_HIDDEN_POWER, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2746,15 +2553,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x10001, .nickname = _("UNOWN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_UNOWN, .heldItem = ITEM_BLACK_BELT, .moves = {MOVE_HIDDEN_POWER, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2767,15 +2572,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x102, .nickname = _("UNOWN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_SPINDA, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_TEETER_DANCE, MOVE_DIZZY_PUNCH, MOVE_CALM_MIND, MOVE_BATON_PASS}, - .level = 0, - .ppBonuses = 0, .hpEV = 110, .defenseEV = 200, .spDefenseEV = 200, @@ -2789,15 +2592,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x88FE980F, .nickname = _("SPINDA"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_PLUSLE, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_HELPING_HAND, MOVE_THUNDERBOLT, MOVE_AGILITY, MOVE_BATON_PASS}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2810,15 +2611,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("PLUSLE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_VOLBEAT, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_HELPING_HAND, MOVE_SIGNAL_BEAM, MOVE_SOLAR_BEAM, MOVE_MOONLIGHT}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2831,7 +2630,7 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 1, .personality = 0xF, .nickname = _("VOLBEAT"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -2851,8 +2650,6 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .species = SPECIES_SPINDA, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_TEETER_DANCE, MOVE_DIZZY_PUNCH, MOVE_CALM_MIND, MOVE_BATON_PASS}, - .level = 0, - .ppBonuses = 0, .hpEV = 110, .defenseEV = 200, .spDefenseEV = 200, @@ -2866,15 +2663,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xE2880098, .nickname = _("SPINDA"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_MINUN, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_HELPING_HAND, MOVE_THUNDERBOLT, MOVE_AGILITY, MOVE_BATON_PASS}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2887,15 +2682,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x8C, .nickname = _("MINUN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_ILLUMISE, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_HELPING_HAND, MOVE_WISH, MOVE_THUNDERBOLT, MOVE_MOONLIGHT}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2908,15 +2701,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("ILLUMISE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_UNOWN, .heldItem = ITEM_CHARCOAL, .moves = {MOVE_HIDDEN_POWER, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2929,15 +2720,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x302, .nickname = _("UNOWN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_UNOWN, .heldItem = ITEM_SOFT_SAND, .moves = {MOVE_HIDDEN_POWER, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .attackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2950,15 +2739,13 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x203, .nickname = _("UNOWN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_UNOWN, .heldItem = ITEM_TWISTED_SPOON, .moves = {MOVE_HIDDEN_POWER, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -2971,12 +2758,12 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .abilityNum = 0, .personality = 0x301, .nickname = _("UNOWN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x39, 0x13, 0x14, 0x15, 0x38, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x69, 0x40, 0x6D, 0x41, 0x73, 0x41, 0x5E, 0x41, 0x71, 0x42, 0x45, 0x45, 0x45, 0x45, 0x45, 0x08, @@ -2996,14 +2783,14 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x1, 0x2201, 0x1, 0x8881, 0x1, 0x2223, 0x1, 0x8889, 0x1, 0x2223, 0x1, 0x8889, 0x1, 0x2223, 0xFFFF}, - .coords = {COORDS_XY(10,2), COORDS_XY(14,2)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_EAST), - .range = TRAINER_RANGE(3, 3), + .trainerCoords = {COORDS_XY(10,2), COORDS_XY(14,2)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_EAST), + .trainerRanges = TRAINER_RANGE(3, 3), } }, }; -static const struct TrHillTag sDataTagUnique = +static const struct TrainerHillChallenge sChallenge_Unique = { .numTrainers = NUM_TRAINER_HILL_TRAINERS, .unused1 = 3, @@ -3011,7 +2798,7 @@ static const struct TrHillTag sDataTagUnique = .checksum = 0x000652F3 }; -static const struct TrHillFloor sDataTagUnique_Floors[] = { +static const struct TrainerHillFloor sFloors_Unique[] = { [0] = { .trainerNum1 = 49, @@ -3034,8 +2821,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_SUNFLORA, .heldItem = ITEM_PERSIM_BERRY, .moves = {MOVE_PETAL_DANCE, MOVE_GRASS_WHISTLE, MOVE_LIGHT_SCREEN, MOVE_SUNNY_DAY}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .defenseEV = 155, .spDefenseEV = 100, @@ -3049,15 +2834,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x0, .nickname = _("SUNFLORA"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_TANGELA, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_GIGA_DRAIN, MOVE_SLEEP_POWDER, MOVE_AMNESIA, MOVE_SUNNY_DAY}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spDefenseEV = 255, .otId = TRAINER_HILL_OTID, @@ -3070,15 +2853,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x91, .nickname = _("TANGELA"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_VENUSAUR, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_SOLAR_BEAM, MOVE_EARTHQUAKE, MOVE_SYNTHESIS, MOVE_SUNNY_DAY}, - .level = 0, - .ppBonuses = 0, .hpEV = 100, .attackEV = 110, .defenseEV = 100, @@ -3094,15 +2875,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x1F, .nickname = _("VENUSAUR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_LANTURN, .heldItem = ITEM_PERSIM_BERRY, .moves = {MOVE_SPARK, MOVE_WATER_PULSE, MOVE_CONFUSE_RAY, MOVE_RAIN_DANCE}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -3115,15 +2894,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("LANTURN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_MANECTRIC, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_THUNDERBOLT, MOVE_HEADBUTT, MOVE_BITE, MOVE_RAIN_DANCE}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -3136,15 +2913,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 1, .personality = 0xF, .nickname = _("MANECTRIC"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_RAIKOU, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_THUNDER, MOVE_CRUNCH, MOVE_ROAR, MOVE_RAIN_DANCE}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -3157,7 +2932,7 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("RAIKOU"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -3177,8 +2952,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_RELICANTH, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_ANCIENT_POWER, MOVE_WATER_PULSE, MOVE_MUD_SPORT, MOVE_RAIN_DANCE}, - .level = 0, - .ppBonuses = 0, .hpEV = 155, .defenseEV = 100, .spDefenseEV = 255, @@ -3192,15 +2965,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x2F, .nickname = _("RELICANTH"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_GOLDUCK, .heldItem = ITEM_LAX_INCENSE, .moves = {MOVE_SURF, MOVE_PSYBEAM, MOVE_BRICK_BREAK, MOVE_RAIN_DANCE}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -3213,15 +2984,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("GOLDUCK"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_BLASTOISE, .heldItem = ITEM_SHELL_BELL, .moves = {MOVE_HYDRO_PUMP, MOVE_BITE, MOVE_MIRROR_COAT, MOVE_RAIN_DANCE}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -3234,15 +3003,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x28, .nickname = _("BLASTOISE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_MAGCARGO, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_HEAT_WAVE, MOVE_ROCK_SLIDE, MOVE_PROTECT, MOVE_SUNNY_DAY}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spDefenseEV = 255, .otId = TRAINER_HILL_OTID, @@ -3255,15 +3022,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 1, .personality = 0x93, .nickname = _("MAGCARGO"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_RAPIDASH, .heldItem = ITEM_KINGS_ROCK, .moves = {MOVE_FIRE_BLAST, MOVE_BOUNCE, MOVE_QUICK_ATTACK, MOVE_SUNNY_DAY}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -3276,15 +3041,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 1, .personality = 0xF, .nickname = _("RAPIDASH"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_MOLTRES, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_SKY_ATTACK, MOVE_AERIAL_ACE, MOVE_ROAR, MOVE_SUNNY_DAY}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -3297,12 +3060,12 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("MOLTRES"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0xF1, 0xF5, 0xFB, 0xF5, 0xE6, 0xE6, 0x1B, 0x14, 0x15, 0xF8, 0xF9, 0xFA, 0xFB, 0xFB, 0xFB, 0x08, 0xF1, 0xEB, 0xFB, 0xEB, 0xEC, 0xEC, 0xEC, 0xF9, 0xE6, 0xEE, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0x08, @@ -3322,9 +3085,9 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x5E01, 0x50FF, 0x5083, 0x503B, 0x5FEB, 0xC02B, 0x5FEB, 0x5009, 0x57FD, 0x1005, 0x7FF5, 0x15, 0x7FF5, 0x1, 0xFFFF}, - .coords = {COORDS_XY(4,3), COORDS_XY(7,3)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_EAST), - .range = TRAINER_RANGE(2, 2), + .trainerCoords = {COORDS_XY(4,3), COORDS_XY(7,3)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_EAST), + .trainerRanges = TRAINER_RANGE(2, 2), } }, [1] = @@ -3349,8 +3112,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_SMEARGLE, .heldItem = ITEM_SCOPE_LENS, .moves = {MOVE_EARTHQUAKE, MOVE_SHADOW_BALL, MOVE_AERIAL_ACE, MOVE_IMPRISON}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 6, .speedEV = 252, @@ -3364,15 +3125,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x8A, .nickname = _("SMEARGLE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_SMEARGLE, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_REST, MOVE_THUNDER_WAVE, MOVE_FLAMETHROWER, MOVE_IMPRISON}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spAttackEV = 6, @@ -3386,15 +3145,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x87, .nickname = _("SMEARGLE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_SMEARGLE, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_TEETER_DANCE, MOVE_LOCK_ON, MOVE_SHEER_COLD, MOVE_EXPLOSION}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 6, .speedEV = 252, @@ -3408,15 +3165,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xD, .nickname = _("SMEARGLE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_SMEARGLE, .heldItem = ITEM_SCOPE_LENS, .moves = {MOVE_PSYCHIC, MOVE_SURF, MOVE_THUNDERBOLT, MOVE_IMPRISON}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spAttackEV = 6, @@ -3430,15 +3185,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xA, .nickname = _("SMEARGLE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_SMEARGLE, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_TOXIC, MOVE_PROTECT, MOVE_WILL_O_WISP, MOVE_IMPRISON}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 6, .speedEV = 252, @@ -3452,15 +3205,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xA, .nickname = _("SMEARGLE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_SMEARGLE, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_TEETER_DANCE, MOVE_LOCK_ON, MOVE_SHEER_COLD, MOVE_DESTINY_BOND}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 6, .speedEV = 252, @@ -3474,7 +3225,7 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x8A, .nickname = _("SMEARGLE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -3494,8 +3245,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_STARYU, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_CAMOUFLAGE, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spAttackEV = 6, @@ -3509,15 +3258,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 1, .personality = 0xA, .nickname = _("STARYU"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_MEOWTH, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_PAY_DAY, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spAttackEV = 6, @@ -3531,15 +3278,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xD, .nickname = _("MEOWTH"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_BLAZIKEN, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_BLAZE_KICK, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spDefenseEV = 6, @@ -3553,15 +3298,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x28, .nickname = _("BLAZIKEN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_CUBONE, .heldItem = ITEM_THICK_CLUB, .moves = {MOVE_BONEMERANG, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 6, .spDefenseEV = 252, @@ -3575,15 +3318,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 1, .personality = 0x16, .nickname = _("CUBONE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_BEEDRILL, .heldItem = ITEM_SHELL_BELL, .moves = {MOVE_TWINEEDLE, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .otId = TRAINER_HILL_OTID, @@ -3596,15 +3337,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x8A, .nickname = _("BEEDRILL"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_RATICATE, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_SUPER_FANG, MOVE_NONE, MOVE_NONE, MOVE_NONE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 6, .speedEV = 252, @@ -3618,12 +3357,12 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 1, .personality = 0xD, .nickname = _("RATICATE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x26, 0x1B, 0x1C, 0x1D, 0x25, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x2D, 0x3B, 0x3B, 0x3B, 0x35, 0x2C, 0x23, 0x24, 0x23, 0x2C, 0x35, 0x3B, 0x3B, 0x3B, 0x3B, 0x08, @@ -3643,9 +3382,9 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x7C1, 0x8AA1, 0x0209, 0x5557, 0xA281, 0x81, 0x5D6D, 0x2283, 0x89, 0xDD55, 0x20A1, 0xA81, 0x7D5D, 0x9, 0xFFFF}, - .coords = {COORDS_XY(9,6), COORDS_XY(13,6)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_EAST), - .range = TRAINER_RANGE(3, 3), + .trainerCoords = {COORDS_XY(9,6), COORDS_XY(13,6)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_EAST), + .trainerRanges = TRAINER_RANGE(3, 3), } }, [2] = @@ -3670,8 +3409,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_CHARMELEON, .heldItem = ITEM_CHARCOAL, .moves = {MOVE_FIRE_SPIN, MOVE_DRAGON_RAGE, MOVE_FLAMETHROWER, MOVE_SLASH}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spAttackEV = 6, @@ -3692,8 +3429,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_WARTORTLE, .heldItem = ITEM_MYSTIC_WATER, .moves = {MOVE_HYDRO_PUMP, MOVE_SKULL_BASH, MOVE_RAIN_DANCE, MOVE_PROTECT}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .otId = TRAINER_HILL_OTID, @@ -3713,8 +3448,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_IVYSAUR, .heldItem = ITEM_MIRACLE_SEED, .moves = {MOVE_SOLAR_BEAM, MOVE_SYNTHESIS, MOVE_GROWTH, MOVE_SWEET_SCENT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 6, .spAttackEV = 252, @@ -3735,8 +3468,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_BAYLEEF, .heldItem = ITEM_MIRACLE_SEED, .moves = {MOVE_SOLAR_BEAM, MOVE_SAFEGUARD, MOVE_LIGHT_SCREEN, MOVE_BODY_SLAM}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .attackEV = 130, .spAttackEV = 130, @@ -3757,8 +3488,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_CROCONAW, .heldItem = ITEM_MYSTIC_WATER, .moves = {MOVE_SCARY_FACE, MOVE_SLASH, MOVE_HYDRO_PUMP, MOVE_SCREECH}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .speedEV = 6, @@ -3779,8 +3508,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_QUILAVA, .heldItem = ITEM_CHARCOAL, .moves = {MOVE_QUICK_ATTACK, MOVE_FLAMETHROWER, MOVE_FLAME_WHEEL, MOVE_SWIFT}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -3814,8 +3541,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_SMOOCHUM, .heldItem = ITEM_PETAYA_BERRY, .moves = {MOVE_ICE_BEAM, MOVE_PSYCHIC, MOVE_SWEET_KISS, MOVE_FAKE_TEARS}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -3836,8 +3561,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_AZURILL, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_SURF, MOVE_SING, MOVE_RAIN_DANCE, MOVE_BLIZZARD}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -3858,8 +3581,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_ELEKID, .heldItem = ITEM_KINGS_ROCK, .moves = {MOVE_FIRE_PUNCH, MOVE_THUNDER, MOVE_ICE_PUNCH, MOVE_THUNDER_WAVE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -3880,8 +3601,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_CLEFFA, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_MEGA_KICK, MOVE_SWEET_KISS, MOVE_SING, MOVE_METRONOME}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -3902,8 +3621,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_WYNAUT, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_ENCORE, MOVE_COUNTER, MOVE_MIRROR_COAT, MOVE_DESTINY_BOND}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -3924,8 +3641,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_MAGBY, .heldItem = ITEM_SCOPE_LENS, .moves = {MOVE_FIRE_BLAST, MOVE_CONFUSE_RAY, MOVE_THUNDER_PUNCH, MOVE_BARRIER}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -3944,7 +3659,7 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x39, 0x13, 0x14, 0x15, 0x38, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x69, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x7C, 0x46, 0x08, @@ -3964,9 +3679,9 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x7FFB, 0x4003, 0x5FFF, 0x4003, 0x7FFB, 0x4003, 0x7EFF, 0x4443, 0x4443, 0x4443, 0x7EFF, 0x4001, 0x7FFD, 0x1, 0xFFFF}, - .coords = {COORDS_XY(6,9), COORDS_XY(8,9)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_EAST), - .range = TRAINER_RANGE(1, 1), + .trainerCoords = {COORDS_XY(6,9), COORDS_XY(8,9)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_EAST), + .trainerRanges = TRAINER_RANGE(1, 1), } }, [3] = @@ -3991,8 +3706,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_SUDOWOODO, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_ROCK_SLIDE, MOVE_BLOCK, MOVE_TOXIC, MOVE_EXPLOSION}, - .level = 0, - .ppBonuses = 0, .hpEV = 100, .attackEV = 255, .spDefenseEV = 155, @@ -4006,15 +3719,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x80, .nickname = _("SUDOWOODO"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_SLOWKING, .heldItem = ITEM_SCOPE_LENS, .moves = {MOVE_SURF, MOVE_PSYCHIC, MOVE_BLIZZARD, MOVE_DISABLE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .defenseEV = 255, .otId = TRAINER_HILL_OTID, @@ -4027,15 +3738,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 1, .personality = 0x8C, .nickname = _("SLOWKING"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_ENTEI, .heldItem = ITEM_PETAYA_BERRY, .moves = {MOVE_FLAMETHROWER, MOVE_CALM_MIND, MOVE_FIRE_SPIN, MOVE_ROAR}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -4048,15 +3757,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("ENTEI"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_HITMONCHAN, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_MEGA_PUNCH, MOVE_DETECT, MOVE_COUNTER, MOVE_SKY_UPPERCUT}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -4069,15 +3776,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("HITMONCHAN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_MANTINE, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_SURF, MOVE_CONFUSE_RAY, MOVE_ATTRACT, MOVE_AERIAL_ACE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .defenseEV = 255, .otId = TRAINER_HILL_OTID, @@ -4090,15 +3795,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 1, .personality = 0x6, .nickname = _("MANTINE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_ZAPDOS, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_THUNDERBOLT, MOVE_DRILL_PECK, MOVE_THUNDER_WAVE, MOVE_AGILITY}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -4111,7 +3814,7 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x18, .nickname = _("ZAPDOS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -4131,8 +3834,6 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .species = SPECIES_HITMONLEE, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_MEGA_KICK, MOVE_MIND_READER, MOVE_FOCUS_ENERGY, MOVE_HI_JUMP_KICK}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .attackEV = 255, .otId = TRAINER_HILL_OTID, @@ -4145,15 +3846,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("HITMONLEE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_PORYGON2, .heldItem = ITEM_SCOPE_LENS, .moves = {MOVE_LOCK_ON, MOVE_BLIZZARD, MOVE_CONVERSION_2, MOVE_PSYCHIC}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -4166,15 +3865,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("PORYGON2"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_SUICUNE, .heldItem = ITEM_PETAYA_BERRY, .moves = {MOVE_SURF, MOVE_CALM_MIND, MOVE_MIRROR_COAT, MOVE_MIST}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -4187,15 +3884,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("SUICUNE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_HOUNDOOM, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_FLAMETHROWER, MOVE_CRUNCH, MOVE_ROAR, MOVE_WILL_O_WISP}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -4208,15 +3903,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 1, .personality = 0xF, .nickname = _("HOUNDOOM"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_STANTLER, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_CONFUSE_RAY, MOVE_SWAGGER, MOVE_PSYCH_UP, MOVE_TAKE_DOWN}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -4229,15 +3922,13 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("STANTLER"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_ARTICUNO, .heldItem = ITEM_NEVER_MELT_ICE, .moves = {MOVE_BLIZZARD, MOVE_SHEER_COLD, MOVE_MIST, MOVE_AERIAL_ACE}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -4250,12 +3941,12 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("ARTICUNO"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0xF1, 0xFB, 0xFB, 0xFB, 0xF9, 0xF9, 0x1B, 0x1C, 0x1D, 0xE5, 0xE6, 0xEE, 0xF5, 0xFB, 0xFB, 0x08, 0xED, 0xF5, 0xF5, 0xF5, 0xFB, 0xFB, 0xEC, 0xEC, 0xEC, 0xEB, 0xEC, 0xEC, 0xEC, 0xFB, 0xFB, 0x08, @@ -4275,14 +3966,14 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x3F9, 0xF041, 0x41, 0x7F5F, 0x4401, 0x4541, 0x5579, 0x5541, 0x555F, 0x5541, 0x5541, 0x557D, 0x1101, 0x1101, 0xFFFF}, - .coords = {COORDS_XY(8,2), COORDS_XY(11,5)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_NORTH), - .range = TRAINER_RANGE(3, 3), + .trainerCoords = {COORDS_XY(8,2), COORDS_XY(11,5)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_NORTH), + .trainerRanges = TRAINER_RANGE(3, 3), } }, }; -static const struct TrHillTag sDataTagExpert = +static const struct TrainerHillChallenge sChallenge_Expert = { .numTrainers = NUM_TRAINER_HILL_TRAINERS, .unused1 = 1, @@ -4290,7 +3981,7 @@ static const struct TrHillTag sDataTagExpert = .checksum = 0x00061F3F }; -static const struct TrHillFloor sDataTagExpert_Floors[] = { +static const struct TrainerHillFloor sFloors_Expert[] = { [0] = { .trainerNum1 = 57, @@ -4313,8 +4004,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_SNORLAX, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_MEGA_KICK, MOVE_SHADOW_BALL, MOVE_BRICK_BREAK, MOVE_EARTHQUAKE}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .defenseEV = 252, @@ -4328,15 +4017,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x35, .nickname = _("SNORLAX"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_MILTANK, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_DOUBLE_EDGE, MOVE_SHADOW_BALL, MOVE_ATTRACT, MOVE_MILK_DRINK}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -4350,15 +4037,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("MILTANK"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_URSARING, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_DOUBLE_EDGE, MOVE_CRUNCH, MOVE_BRICK_BREAK, MOVE_AERIAL_ACE}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spAttackEV = 6, @@ -4372,15 +4057,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x7F, .nickname = _("URSARING"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_SLAKING, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_HYPER_BEAM, MOVE_SHADOW_BALL, MOVE_BRICK_BREAK, MOVE_REST}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .spDefenseEV = 252, @@ -4394,15 +4077,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x80, .nickname = _("SLAKING"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_KANGASKHAN, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_MEGA_KICK, MOVE_SHADOW_BALL, MOVE_ATTRACT, MOVE_FAKE_OUT}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -4416,15 +4097,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("KANGASKHAN"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_ZANGOOSE, .heldItem = ITEM_SCOPE_LENS, .moves = {MOVE_CRUSH_CLAW, MOVE_SHADOW_BALL, MOVE_BRICK_BREAK, MOVE_ROAR}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -4438,7 +4117,7 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x80, .nickname = _("ZANGOOSE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -4458,8 +4137,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_SLOWKING, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_PSYCHIC, MOVE_SURF, MOVE_ICE_BEAM, MOVE_SKILL_SWAP}, - .level = 0, - .ppBonuses = 0, .hpEV = 200, .defenseEV = 110, .spAttackEV = 200, @@ -4473,15 +4150,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 1, .personality = 0xF, .nickname = _("SLOWKING"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_ESPEON, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_PSYCHIC, MOVE_BITE, MOVE_CALM_MIND, MOVE_REFLECT}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -4495,15 +4170,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x28, .nickname = _("ESPEON"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_STARMIE, .heldItem = ITEM_SHELL_BELL, .moves = {MOVE_PSYCHIC, MOVE_SURF, MOVE_THUNDERBOLT, MOVE_ICE_BEAM}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -4517,15 +4190,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 1, .personality = 0xF, .nickname = _("STARMIE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_GENGAR, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_PSYCHIC, MOVE_THUNDERBOLT, MOVE_FIRE_PUNCH, MOVE_ICE_PUNCH}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -4539,15 +4210,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("GENGAR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_GARDEVOIR, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_PSYCHIC, MOVE_THUNDERBOLT, MOVE_MAGICAL_LEAF, MOVE_DESTINY_BOND}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -4561,15 +4230,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("GARDEVOIR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_ALAKAZAM, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_PSYCHIC, MOVE_RECOVER, MOVE_THUNDER_WAVE, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -4583,12 +4250,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("ALAKAZAM"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x39, 0x1B, 0x14, 0x15, 0x38, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x31, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x2C, 0x39, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x08, @@ -4608,9 +4275,9 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x0201, 0x3EF9, 0x3EF9, 0x3EF9, 0x2009, 0x3019, 0x2009, 0x3019, 0x2009, 0x3019, 0x3019, 0x3C79, 0x1, 0x1, 0xFFFF}, - .coords = {COORDS_XY(4,7), COORDS_XY(10,7)}, - .direction = TRAINER_DIRS(DIR_WEST, DIR_EAST), - .range = TRAINER_RANGE(5, 5), + .trainerCoords = {COORDS_XY(4,7), COORDS_XY(10,7)}, + .trainerDirections = TRAINER_DIRS(DIR_WEST, DIR_EAST), + .trainerRanges = TRAINER_RANGE(5, 5), } }, [1] = @@ -4635,8 +4302,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_SWELLOW, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_AERIAL_ACE, MOVE_AGILITY, MOVE_FACADE, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -4650,15 +4315,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("SWELLOW"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_MACHAMP, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_LOW_KICK, MOVE_ROCK_SLIDE, MOVE_FACADE, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -4672,15 +4335,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("MACHAMP"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_URSARING, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_PROTECT, MOVE_ROCK_SLIDE, MOVE_FACADE, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -4694,15 +4355,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("URSARING"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_KINGLER, .heldItem = ITEM_PERSIM_BERRY, .moves = {MOVE_RETURN, MOVE_PROTECT, MOVE_CRABHAMMER, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -4716,15 +4375,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x80, .nickname = _("KINGLER"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_TYRANITAR, .heldItem = ITEM_PERSIM_BERRY, .moves = {MOVE_ROCK_SLIDE, MOVE_CRUNCH, MOVE_EARTHQUAKE, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .defenseEV = 6, @@ -4738,15 +4395,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x80, .nickname = _("TYRANITAR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_DRAGONITE, .heldItem = ITEM_PERSIM_BERRY, .moves = {MOVE_BODY_SLAM, MOVE_THUNDER_WAVE, MOVE_EARTHQUAKE, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .attackEV = 252, .spDefenseEV = 6, @@ -4760,7 +4415,7 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x80, .nickname = _("DRAGONITE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -4780,8 +4435,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_JOLTEON, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_THUNDERBOLT, MOVE_THUNDER_WAVE, MOVE_ATTRACT, MOVE_SWAGGER}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -4795,15 +4448,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0xA, .nickname = _("JOLTEON"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_ALAKAZAM, .heldItem = ITEM_KINGS_ROCK, .moves = {MOVE_PSYCHIC, MOVE_ICE_PUNCH, MOVE_ATTRACT, MOVE_SWAGGER}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -4817,15 +4468,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0xA, .nickname = _("ALAKAZAM"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_STARMIE, .heldItem = ITEM_SCOPE_LENS, .moves = {MOVE_SURF, MOVE_PSYCHIC, MOVE_CONFUSE_RAY, MOVE_SWAGGER}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -4839,15 +4488,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 1, .personality = 0xA, .nickname = _("STARMIE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_DUSCLOPS, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_PURSUIT, MOVE_PROTECT, MOVE_ATTRACT, MOVE_WILL_O_WISP}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 252, .spDefenseEV = 6, @@ -4861,15 +4508,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x82, .nickname = _("DUSCLOPS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_NINETALES, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_OVERHEAT, MOVE_CONFUSE_RAY, MOVE_WILL_O_WISP, MOVE_ATTRACT}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .speedEV = 252, .spAttackEV = 252, @@ -4883,15 +4528,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0xD2, .nickname = _("NINETALES"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_BANETTE, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_SHADOW_BALL, MOVE_FAINT_ATTACK, MOVE_ATTRACT, MOVE_WILL_O_WISP}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 252, .spDefenseEV = 6, @@ -4905,12 +4548,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x85, .nickname = _("BANETTE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x39, 0x13, 0x14, 0x15, 0x38, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x91, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x78, 0x08, @@ -4930,9 +4573,9 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }, .collisionData = {0x0381, 0x7FFD, 0x4001, 0x5FFF, 0x4001, 0x7FFD, 0x4001, 0x5FFF, 0x4001, 0x7FFD, 0x1, 0x1, 0x1, 0x1, 0x1, 0xFFFF}, - .coords = {COORDS_XY(7,10), COORDS_XY(7,14)}, - .direction = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), - .range = TRAINER_RANGE(3, 3), + .trainerCoords = {COORDS_XY(7,10), COORDS_XY(7,14)}, + .trainerDirections = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), + .trainerRanges = TRAINER_RANGE(3, 3), } }, [2] = @@ -4957,8 +4600,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_WOBBUFFET, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_MIRROR_COAT, MOVE_COUNTER, MOVE_SAFEGUARD, MOVE_ENCORE}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -4972,15 +4613,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x94, .nickname = _("WOBBUFFET"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_EXPLOUD, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_HYPER_VOICE, MOVE_COUNTER, MOVE_REST, MOVE_ROCK_SLIDE}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -5001,8 +4640,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_CROBAT, .heldItem = ITEM_KINGS_ROCK, .moves = {MOVE_MEAN_LOOK, MOVE_CONFUSE_RAY, MOVE_AERIAL_ACE, MOVE_TOXIC}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -5016,15 +4653,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x0, .nickname = _("CROBAT"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_DUGTRIO, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_DOUBLE_TEAM, MOVE_PROTECT, MOVE_RETURN, MOVE_SLUDGE_BOMB}, - .level = 0, - .ppBonuses = 0, .hpEV = 6, .attackEV = 252, .speedEV = 252, @@ -5038,15 +4673,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 1, .personality = 0xD, .nickname = _("DUGTRIO"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_ELECTRODE, .heldItem = ITEM_PETAYA_BERRY, .moves = {MOVE_TORMENT, MOVE_MIRROR_COAT, MOVE_THUNDERBOLT, MOVE_LIGHT_SCREEN}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 252, .spAttackEV = 6, @@ -5067,8 +4700,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_GENGAR, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_CONFUSE_RAY, MOVE_MEAN_LOOK, MOVE_GIGA_DRAIN, MOVE_WILL_O_WISP}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spDefenseEV = 6, @@ -5082,7 +4713,7 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x14, .nickname = _("GENGAR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -5102,8 +4733,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_LAPRAS, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_SURF, MOVE_ICE_BEAM, MOVE_PERISH_SONG, MOVE_SING}, - .level = 0, - .ppBonuses = 0, .hpEV = 250, .defenseEV = 130, .spDefenseEV = 130, @@ -5124,8 +4753,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_ABSOL, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_PERISH_SONG, MOVE_DOUBLE_EDGE, MOVE_PROTECT, MOVE_TORMENT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .defenseEV = 6, .speedEV = 252, @@ -5146,8 +4773,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_ALTARIA, .heldItem = ITEM_KINGS_ROCK, .moves = {MOVE_PERISH_SONG, MOVE_PROTECT, MOVE_DRAGON_CLAW, MOVE_FIRE_BLAST}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .spAttackEV = 6, .spDefenseEV = 252, @@ -5168,8 +4793,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_DEWGONG, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_ICE_BEAM, MOVE_SIGNAL_BEAM, MOVE_REST, MOVE_PERISH_SONG}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 252, .spAttackEV = 6, @@ -5190,8 +4813,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_POLITOED, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_HYDRO_PUMP, MOVE_BLIZZARD, MOVE_MIND_READER, MOVE_PERISH_SONG}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .spAttackEV = 6, .spDefenseEV = 252, @@ -5212,8 +4833,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_MAROWAK, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_PERISH_SONG, MOVE_EARTHQUAKE, MOVE_COUNTER, MOVE_PROTECT}, - .level = 0, - .ppBonuses = 0, .hpEV = 252, .speedEV = 6, .spDefenseEV = 252, @@ -5232,7 +4851,7 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { }, }, }, - .display = { + .map = { .metatileData = { 0xD1, 0xDB, 0xDB, 0xDB, 0xD9, 0xD9, 0x1B, 0x14, 0x15, 0x98, 0x99, 0x9A, 0x9B, 0x9B, 0x9B, 0x08, 0xD1, 0xDB, 0xDB, 0xDB, 0xD5, 0xD5, 0xC3, 0xF9, 0x86, 0x8E, 0x95, 0x9B, 0x9B, 0x9B, 0x9B, 0x08, @@ -5252,9 +4871,9 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { 0xD1, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0xCC, 0xFB, 0x9B, 0x9B, 0x9B, 0x9B, 0x9B, 0x9B, 0x9B, 0x08, }, .collisionData = {0x0381, 0x0201, 0xEE1, 0x1EF1, 0x3EF9, 0x3EF9, 0x7E7D, 0x783D, 0x2BD, 0x783D, 0x7E7D, 0x3E79, 0x3EF9, 0x1EF1, 0xEE1, 0x201}, - .coords = {COORDS_XY(7,6), COORDS_XY(7,10)}, - .direction = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), - .range = TRAINER_RANGE(3, 3), + .trainerCoords = {COORDS_XY(7,6), COORDS_XY(7,10)}, + .trainerDirections = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), + .trainerRanges = TRAINER_RANGE(3, 3), } }, [3] = @@ -5279,8 +4898,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_FORRETRESS, .heldItem = ITEM_QUICK_CLAW, .moves = {MOVE_EXPLOSION, MOVE_EARTHQUAKE, MOVE_ATTRACT, MOVE_SPIKES}, - .level = 0, - .ppBonuses = 0, .hpEV = 110, .attackEV = 200, .spDefenseEV = 200, @@ -5294,15 +4911,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("FORRETRESS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_ELECTRODE, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_EXPLOSION, MOVE_THUNDERBOLT, MOVE_SWIFT, MOVE_LIGHT_SCREEN}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -5315,15 +4930,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 1, .personality = 0xC, .nickname = _("ELECTRODE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_EXEGGUTOR, .heldItem = ITEM_SHELL_BELL, .moves = {MOVE_EXPLOSION, MOVE_HYPNOSIS, MOVE_PSYCHIC, MOVE_SOLAR_BEAM}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -5336,15 +4949,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x7F, .nickname = _("EXEGGUTOR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_DUSCLOPS, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_IMPRISON, MOVE_PROTECT, MOVE_ICE_BEAM, MOVE_EARTHQUAKE}, - .level = 0, - .ppBonuses = 0, .hpEV = 110, .defenseEV = 200, .spDefenseEV = 200, @@ -5358,15 +4969,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x93, .nickname = _("DUSCLOPS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_NINETALES, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_IMPRISON, MOVE_PROTECT, MOVE_OVERHEAT, MOVE_CONFUSE_RAY}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -5379,15 +4988,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0xF, .nickname = _("NINETALES"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_BANETTE, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_IMPRISON, MOVE_PROTECT, MOVE_THUNDERBOLT, MOVE_THUNDER}, - .level = 0, - .ppBonuses = 0, .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -5400,7 +5007,7 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x96, .nickname = _("BANETTE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, @@ -5420,8 +5027,6 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .species = SPECIES_SALAMENCE, .heldItem = ITEM_SHELL_BELL, .moves = {MOVE_ROCK_SLIDE, MOVE_FLAMETHROWER, MOVE_DRAGON_CLAW, MOVE_AERIAL_ACE}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -5434,15 +5039,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x95, .nickname = _("SALAMENCE"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [1] = { .species = SPECIES_GENGAR, .heldItem = ITEM_LUM_BERRY, .moves = {MOVE_PSYCHIC, MOVE_GIGA_DRAIN, MOVE_WILL_O_WISP, MOVE_DESTINY_BOND}, - .level = 0, - .ppBonuses = 0, .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, @@ -5455,15 +5058,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x8C, .nickname = _("GENGAR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [2] = { .species = SPECIES_GYARADOS, .heldItem = ITEM_BRIGHT_POWDER, .moves = {MOVE_DRAGON_DANCE, MOVE_HYPER_BEAM, MOVE_BITE, MOVE_EARTHQUAKE}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -5476,15 +5077,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("GYARADOS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [3] = { .species = SPECIES_GENGAR, .heldItem = ITEM_SALAC_BERRY, .moves = {MOVE_EXPLOSION, MOVE_MEAN_LOOK, MOVE_SHADOW_BALL, MOVE_CONFUSE_RAY}, - .level = 0, - .ppBonuses = 0, .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, @@ -5497,15 +5096,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x3, .nickname = _("GENGAR"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [4] = { .species = SPECIES_DUSCLOPS, .heldItem = ITEM_LEFTOVERS, .moves = {MOVE_MEAN_LOOK, MOVE_CONFUSE_RAY, MOVE_WILL_O_WISP, MOVE_SHADOW_BALL}, - .level = 0, - .ppBonuses = 0, .hpEV = 110, .defenseEV = 200, .spDefenseEV = 200, @@ -5519,15 +5116,13 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x14, .nickname = _("DUSCLOPS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, [5] = { .species = SPECIES_MISDREAVUS, .heldItem = ITEM_FOCUS_BAND, .moves = {MOVE_MEAN_LOOK, MOVE_CONFUSE_RAY, MOVE_PERISH_SONG, MOVE_SHADOW_BALL}, - .level = 0, - .ppBonuses = 0, .hpEV = 180, .defenseEV = 180, .spDefenseEV = 150, @@ -5541,12 +5136,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .abilityNum = 0, .personality = 0x85, .nickname = _("MISDREAVUS"), - .friendship = 255, + .friendship = MAX_FRIENDSHIP, }, }, }, }, - .display = { + .map = { .metatileData = { 0x31, 0x3B, 0x3B, 0x3B, 0x39, 0x39, 0x13, 0x14, 0x15, 0x39, 0x39, 0x3A, 0x3B, 0x3B, 0x3B, 0x08, 0x96, 0xFB, 0xF6, 0xFD, 0xF6, 0xF6, 0xFB, 0x46, 0xFB, 0xF6, 0xF6, 0xFD, 0xF6, 0xFB, 0x9B, 0x08, @@ -5566,9 +5161,9 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { 0x96, 0xFB, 0xF6, 0xFD, 0xF6, 0xF6, 0xFB, 0x46, 0xFB, 0xF6, 0xF6, 0xFD, 0xF6, 0xFB, 0x9B, 0x08, }, .collisionData = {0x0381, 0x0101, 0x0101, 0x6C1, 0x0821, 0x16D1, 0x2829, 0x2009, 0x1, 0x2009, 0x2829, 0x16D1, 0x0821, 0x6C1, 0x0101, 0x101}, - .coords = {COORDS_XY(7,6), COORDS_XY(7,10)}, - .direction = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), - .range = TRAINER_RANGE(3, 3), + .trainerCoords = {COORDS_XY(7,6), COORDS_XY(7,10)}, + .trainerDirections = TRAINER_DIRS(DIR_SOUTH, DIR_NORTH), + .trainerRanges = TRAINER_RANGE(3, 3), } }, }; diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index c3f17f234..ac6e0e1e1 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -57,22 +57,20 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .speechLose = { EC_WORD_TO_HER, EC_WORD_WIN, EC_WORD_JOKING, EC_WORD_HIGHS, EC_WORD_SCARY, EC_WORD_ELLIPSIS_EXCL }, .speechAfter = { EC_WORD_IGNORANT, EC_WORD_SO, EC_WORD_TODAY, EC_WORD_NIGHTTIME, EC_WORD_YOU_RE, EC_WORD_ELLIPSIS_ELLIPSIS_ELLIPSIS }, .mons = { - [0] = NULL_BATTLE_TOWER_POKEMON, - [1] = NULL_BATTLE_TOWER_POKEMON, - [2] = NULL_BATTLE_TOWER_POKEMON, + [0] = DUMMY_HILL_MON, + [1] = DUMMY_HILL_MON, + [2] = DUMMY_HILL_MON, [3] = { .species = SPECIES_SWALOT, .heldItem = ITEM_SHELL_BELL, .moves = { MOVE_SLUDGE_BOMB, MOVE_SHADOW_BALL, MOVE_PAIN_SPLIT, MOVE_YAWN }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 55, .attackEV = 255, .defenseEV = 100, .speedEV = 0, .spAttackEV = 0, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -82,21 +80,19 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 1, .personality = 0x80, .nickname = __("マルノーム$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [4] = { .species = SPECIES_DUSTOX, .heldItem = ITEM_BRIGHT_POWDER, .moves = { MOVE_SILVER_WIND, MOVE_SLUDGE_BOMB, MOVE_SHADOW_BALL, MOVE_GIGA_DRAIN }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 0, .attackEV = 255, .defenseEV = 0, .speedEV = 0, .spAttackEV = 255, .spDefenseEV = 0, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -106,21 +102,19 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 0, .personality = 0x6, .nickname = __("ドクケイル$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [5] = { .species = SPECIES_RELICANTH, .heldItem = ITEM_QUICK_CLAW, .moves = { MOVE_ANCIENT_POWER, MOVE_SURF, MOVE_EARTHQUAKE, MOVE_AMNESIA }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 100, .attackEV = 0, .defenseEV = 0, .speedEV = 0, .spAttackEV = 155, .spDefenseEV = 255, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -130,7 +124,7 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 0, .personality = 0x2f, .nickname = __("ジーランス$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, } }, @@ -143,22 +137,20 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .speechLose = { EC_MOVE2(MINIMIZE), EC_WORD_AS_MUCH_AS, EC_EMPTY_WORD, EC_WORD_THEY_RE, EC_WORD_SAD, EC_WORD_EXCL }, .speechAfter = { EC_MOVE(BITE), EC_WORD_AS_MUCH_AS, EC_EMPTY_WORD, EC_WORD_THEY_RE, EC_WORD_ANGRY, EC_WORD_EXCL }, .mons = { - [0] = NULL_BATTLE_TOWER_POKEMON, - [1] = NULL_BATTLE_TOWER_POKEMON, - [2] = NULL_BATTLE_TOWER_POKEMON, + [0] = DUMMY_HILL_MON, + [1] = DUMMY_HILL_MON, + [2] = DUMMY_HILL_MON, [3] = { .species = SPECIES_CACTURNE, .heldItem = ITEM_QUICK_CLAW, .moves = { MOVE_GIGA_DRAIN, MOVE_FAINT_ATTACK, MOVE_THUNDER_PUNCH, MOVE_GROWTH }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 55, .attackEV = 0, .defenseEV = 100, .speedEV = 0, .spAttackEV = 255, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -168,21 +160,19 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 0, .personality = 0x8c, .nickname = __("ノクタス$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [4] = { .species = SPECIES_SWELLOW, .heldItem = ITEM_BRIGHT_POWDER, .moves = { MOVE_FACADE, MOVE_AERIAL_ACE, MOVE_QUICK_ATTACK, MOVE_DOUBLE_TEAM }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 255, .attackEV = 255, .defenseEV = 0, .speedEV = 0, .spAttackEV = 0, .spDefenseEV = 0, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -192,21 +182,19 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 0, .personality = 0x80, .nickname = __("オオスバメ$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [5] = { .species = SPECIES_WHISCASH, .heldItem = ITEM_CHESTO_BERRY, .moves = { MOVE_SURF, MOVE_EARTHQUAKE, MOVE_AMNESIA, MOVE_REST }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 0, .attackEV = 255, .defenseEV = 0, .speedEV = 0, .spAttackEV = 255, .spDefenseEV = 0, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -216,7 +204,7 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 0, .personality = 0x0, .nickname = __("ナマズン$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, } }, @@ -229,22 +217,20 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .speechLose = { EC_WORD_THAT, EC_WORD_ABOVE, EC_WORD_LOST, EC_WORD_STORES, EC_WORD_JOKING, EC_WORD_ELLIPSIS_ELLIPSIS_ELLIPSIS }, .speechAfter = { EC_WORD_ENTERTAINING, EC_WORD_NONE, EC_WORD_HEY_QUES, EC_WORD_ALMOST, EC_WORD_EXCL, EC_EMPTY_WORD }, .mons = { - [0] = NULL_BATTLE_TOWER_POKEMON, - [1] = NULL_BATTLE_TOWER_POKEMON, - [2] = NULL_BATTLE_TOWER_POKEMON, + [0] = DUMMY_HILL_MON, + [1] = DUMMY_HILL_MON, + [2] = DUMMY_HILL_MON, [3] = { .species = SPECIES_DELCATTY, .heldItem = ITEM_LUM_BERRY, .moves = { MOVE_SING, MOVE_BODY_SLAM, MOVE_SHADOW_BALL, MOVE_IRON_TAIL }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 0, .attackEV = 255, .defenseEV = 0, .speedEV = 255, .spAttackEV = 0, .spDefenseEV = 0, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -254,21 +240,19 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 0, .personality = 0x3, .nickname = __("エネコロロ$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [4] = { .species = SPECIES_ROSELIA, .heldItem = ITEM_LEFTOVERS, .moves = { MOVE_GIGA_DRAIN, MOVE_GRASS_WHISTLE, MOVE_TOXIC, MOVE_LEECH_SEED }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 255, .attackEV = 0, .defenseEV = 0, .speedEV = 0, .spAttackEV = 255, .spDefenseEV = 0, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -278,21 +262,19 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 1, .personality = 0x6, .nickname = __("ロゼリア$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [5] = { .species = SPECIES_BEAUTIFLY, .heldItem = ITEM_BRIGHT_POWDER, .moves = { MOVE_SILVER_WIND, MOVE_AERIAL_ACE, MOVE_ATTRACT, MOVE_PSYCHIC }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 100, .attackEV = 200, .defenseEV = 0, .speedEV = 0, .spAttackEV = 200, .spDefenseEV = 0, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -302,7 +284,7 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 0, .personality = 0x6, .nickname = __("アゲハント$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, } }, @@ -315,22 +297,20 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .speechLose = { EC_WORD_OUTSIDE, EC_WORD_UNCLE, EC_WORD_SURPRISE, EC_WORD_THESE, EC_WORD_HEY_QUES, EC_WORD_ELLIPSIS_EXCL }, .speechAfter = { EC_WORD_HE_S, EC_WORD_NO_1, EC_WORD_STRONG, EC_WORD_CHILDREN, EC_WORD_CAN_T, EC_WORD_EXCL_EXCL }, .mons = { - [0] = NULL_BATTLE_TOWER_POKEMON, - [1] = NULL_BATTLE_TOWER_POKEMON, - [2] = NULL_BATTLE_TOWER_POKEMON, + [0] = DUMMY_HILL_MON, + [1] = DUMMY_HILL_MON, + [2] = DUMMY_HILL_MON, [3] = { .species = SPECIES_MAWILE, .heldItem = ITEM_BRIGHT_POWDER, .moves = { MOVE_CRUNCH, MOVE_FLAMETHROWER, MOVE_THUNDER_PUNCH, MOVE_COMET_PUNCH }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 0, .attackEV = 0, .defenseEV = 100, .speedEV = 0, .spAttackEV = 255, .spDefenseEV = 155, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -340,21 +320,19 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 1, .personality = 0x0, .nickname = __("クチート$$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [4] = { .species = SPECIES_SHARPEDO, .heldItem = ITEM_SCOPE_LENS, .moves = { MOVE_SURF, MOVE_CRUNCH, MOVE_DOUBLE_EDGE, MOVE_EARTHQUAKE }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 255, .attackEV = 0, .defenseEV = 0, .speedEV = 0, .spAttackEV = 255, .spDefenseEV = 0, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -364,21 +342,19 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 0, .personality = 0x96, .nickname = __("サメハダー$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, [5] = { .species = SPECIES_BANETTE, .heldItem = ITEM_LUM_BERRY, .moves = { MOVE_PSYCHIC, MOVE_SHADOW_BALL, MOVE_THUNDERBOLT, MOVE_WILL_O_WISP }, - .level = 0, - .ppBonuses = 0x0, .hpEV = 255, .attackEV = 0, .defenseEV = 0, .speedEV = 0, .spAttackEV = 255, .spDefenseEV = 0, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -388,7 +364,7 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .abilityNum = 0, .personality = 0x96, .nickname = __("ジュペッタ$$$$$$"), - .friendship = 255 + .friendship = MAX_FRIENDSHIP }, } }, @@ -447,40 +423,40 @@ static bool32 ValidateTrainerHillChecksum(struct EReaderTrainerHillSet *hillSet) return TRUE; } -static bool32 TryWriteTrainerHill_Internal(struct EReaderTrainerHillSet * hillSet, struct TrHillTag * hillTag) +static bool32 TryWriteTrainerHill_Internal(struct EReaderTrainerHillSet * hillSet, struct TrainerHillChallenge * challenge) { int i; AGB_ASSERT_EX(hillSet->dummy == 0, "cereader_tool.c", 450); AGB_ASSERT_EX(hillSet->id == 0, "cereader_tool.c", 452); - memset(hillTag, 0, SECTOR_SIZE); - hillTag->numTrainers = hillSet->numTrainers; - hillTag->unused1 = GetTrainerHillUnkVal(); - hillTag->numFloors = (hillSet->numTrainers + 1) / TRAINER_HILL_TRAINERS_PER_FLOOR; + memset(challenge, 0, SECTOR_SIZE); + challenge->numTrainers = hillSet->numTrainers; + challenge->unused1 = GetTrainerHillUnkVal(); + challenge->numFloors = (hillSet->numTrainers + 1) / HILL_TRAINERS_PER_FLOOR; for (i = 0; i < hillSet->numTrainers; i++) { if (!(i & 1)) { - hillTag->floors[i / TRAINER_HILL_TRAINERS_PER_FLOOR].trainerNum1 = hillSet->trainers[i].trainerNum; - hillTag->floors[i / TRAINER_HILL_TRAINERS_PER_FLOOR].display = hillSet->trainers[i].display; - hillTag->floors[i / TRAINER_HILL_TRAINERS_PER_FLOOR].trainers[0] = hillSet->trainers[i].trainer; + challenge->floors[i / HILL_TRAINERS_PER_FLOOR].trainerNum1 = hillSet->trainers[i].trainerNum; + challenge->floors[i / HILL_TRAINERS_PER_FLOOR].map = hillSet->trainers[i].map; + challenge->floors[i / HILL_TRAINERS_PER_FLOOR].trainers[0] = hillSet->trainers[i].trainer; } else { - hillTag->floors[i / TRAINER_HILL_TRAINERS_PER_FLOOR].trainerNum2 = hillSet->trainers[i].trainerNum; - hillTag->floors[i / TRAINER_HILL_TRAINERS_PER_FLOOR].trainers[1] = hillSet->trainers[i].trainer; + challenge->floors[i / HILL_TRAINERS_PER_FLOOR].trainerNum2 = hillSet->trainers[i].trainerNum; + challenge->floors[i / HILL_TRAINERS_PER_FLOOR].trainers[1] = hillSet->trainers[i].trainer; } } if (i & 1) { - hillTag->floors[i / TRAINER_HILL_TRAINERS_PER_FLOOR].trainers[1] = sTrainerHillTrainerTemplates_JP[i / TRAINER_HILL_TRAINERS_PER_FLOOR]; + challenge->floors[i / HILL_TRAINERS_PER_FLOOR].trainers[1] = sTrainerHillTrainerTemplates_JP[i / HILL_TRAINERS_PER_FLOOR]; } - hillTag->checksum = CalcByteArraySum((u8 *)hillTag->floors, NUM_TRAINER_HILL_FLOORS * sizeof(struct TrHillFloor)); - if (TryWriteSpecialSaveSector(SECTOR_ID_TRAINER_HILL, (u8 *)hillTag) != SAVE_STATUS_OK) + challenge->checksum = CalcByteArraySum((u8 *)challenge->floors, NUM_TRAINER_HILL_FLOORS * sizeof(struct TrainerHillFloor)); + if (TryWriteSpecialSaveSector(SECTOR_ID_TRAINER_HILL, (u8 *)challenge) != SAVE_STATUS_OK) return FALSE; return TRUE; diff --git a/src/trainer_hill.c b/src/trainer_hill.c index 39c6202a0..2deacfc70 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -32,23 +32,21 @@ #include "constants/trainer_hill.h" #include "constants/trainer_types.h" -#define HILL_TAG_NORMAL 0 -#define HILL_TAG_VARIETY 1 -#define HILL_TAG_UNIQUE 2 -#define HILL_TAG_EXPERT 3 - #define HILL_MAX_TIME 215999 // 60 * 60 * 60 - 1 -// EWRAM -struct TrHillStruct2 +struct FloorTrainers { - u8 floorId; - struct TrHillTag tag; - struct TrHillFloor floors[NUM_TRAINER_HILL_FLOORS]; + u8 name[HILL_TRAINERS_PER_FLOOR][HILL_TRAINER_NAME_LENGTH]; + u8 facilityClass[HILL_TRAINERS_PER_FLOOR]; }; -static EWRAM_DATA struct TrHillStruct2 *sHillData = NULL; -static EWRAM_DATA struct TrHillRoomTrainers *sRoomTrainers = NULL; +static EWRAM_DATA struct { + u8 floorId; + struct TrainerHillChallenge challenge; + struct TrainerHillFloor floors[NUM_TRAINER_HILL_FLOORS]; +} *sHillData = NULL; + +static EWRAM_DATA struct FloorTrainers *sFloorTrainers = NULL; EWRAM_DATA u32 *gTrainerHillVBlankCounter = NULL; // This file's functions. @@ -69,7 +67,7 @@ static void GetGameSaved(void); static void SetGameSaved(void); static void ClearGameSaved(void); static void GetChallengeWon(void); -static void TrainerHillSetTag(void); +static void TrainerHillSetMode(void); static void SetUpDataStruct(void); static void FreeDataStruct(void); static void TrainerHillDummy(void); @@ -202,12 +200,12 @@ static const u16 *const *const sPrizeListSets[] = static const u16 sEReader_Pal[] = INCBIN_U16("graphics/trainer_hill/ereader.gbapal"); static const u8 sRecordWinColors[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY}; -static const struct TrHillTag *const sDataPerTag[] = +static const struct TrainerHillChallenge *const sChallengeData[NUM_TRAINER_HILL_MODES] = { - &sDataTagNormal, - &sDataTagVariety, - &sDataTagUnique, - &sDataTagExpert, + [HILL_MODE_NORMAL] = &sChallenge_Normal, + [HILL_MODE_VARIETY] = &sChallenge_Variety, + [HILL_MODE_UNIQUE] = &sChallenge_Unique, + [HILL_MODE_EXPERT] = &sChallenge_Expert, }; // Unused. @@ -238,15 +236,15 @@ static void (* const sHillFunctions[])(void) = [TRAINER_HILL_FUNC_SET_GAME_SAVED] = SetGameSaved, [TRAINER_HILL_FUNC_CLEAR_GAME_SAVED] = ClearGameSaved, [TRAINER_HILL_FUNC_GET_WON] = GetChallengeWon, - [TRAINER_HILL_FUNC_SET_TAG] = TrainerHillSetTag, + [TRAINER_HILL_FUNC_SET_MODE] = TrainerHillSetMode, }; -static const u8 *const sTagMatchStrings[] = +static const u8 *const sModeStrings[NUM_TRAINER_HILL_MODES] = { - gText_NormalTagMatch, - gText_VarietyTagMatch, - gText_UniqueTagMatch, - gText_ExpertTagMatch, + [HILL_MODE_NORMAL] = gText_NormalTagMatch, + [HILL_MODE_VARIETY] = gText_VarietyTagMatch, + [HILL_MODE_UNIQUE] = gText_UniqueTagMatch, + [HILL_MODE_EXPERT] = gText_ExpertTagMatch, }; static const struct ObjectEventTemplate sTrainerObjectEventTemplate = @@ -261,18 +259,17 @@ static const struct ObjectEventTemplate sTrainerObjectEventTemplate = static const u32 sNextFloorMapNum[NUM_TRAINER_HILL_FLOORS] = { - MAP_NUM(TRAINER_HILL_2F), - MAP_NUM(TRAINER_HILL_3F), - MAP_NUM(TRAINER_HILL_4F), - MAP_NUM(TRAINER_HILL_ROOF) + [TRAINER_HILL_1F - 1] = MAP_NUM(TRAINER_HILL_2F), + [TRAINER_HILL_2F - 1] = MAP_NUM(TRAINER_HILL_3F), + [TRAINER_HILL_3F - 1] = MAP_NUM(TRAINER_HILL_4F), + [TRAINER_HILL_4F - 1] = MAP_NUM(TRAINER_HILL_ROOF) }; -static const u8 sTrainerPartySlots[][PARTY_SIZE / 2] = +static const u8 sTrainerPartySlots[HILL_TRAINERS_PER_FLOOR][PARTY_SIZE / 2] = { {0, 1, 2}, {3, 4, 5} }; -// code void CallTrainerHillFunction(void) { SetUpDataStruct(); @@ -287,7 +284,7 @@ void ResetTrainerHillResults(void) gSaveBlock2Ptr->frontier.savedGame = 0; gSaveBlock2Ptr->frontier.unk_EF9 = 0; gSaveBlock1Ptr->trainerHill.bestTime = 0; - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_TRAINER_HILL_MODES; i++) SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME); } @@ -300,7 +297,7 @@ u8 GetTrainerHillOpponentClass(u16 trainerId) { u8 id = trainerId - 1; - return gFacilityClassToTrainerClass[sRoomTrainers->facilityClass[id]]; + return gFacilityClassToTrainerClass[sFloorTrainers->facilityClass[id]]; } void GetTrainerHillTrainerName(u8 *dst, u16 trainerId) @@ -309,7 +306,7 @@ void GetTrainerHillTrainerName(u8 *dst, u16 trainerId) u8 id = trainerId - 1; for (i = 0; i < HILL_TRAINER_NAME_LENGTH; i++) - dst[i] = sRoomTrainers->name[id][i]; + dst[i] = sFloorTrainers->name[id][i]; } u8 GetTrainerHillTrainerFrontSpriteId(u16 trainerId) @@ -329,15 +326,14 @@ void InitTrainerHillBattleStruct(void) s32 i, j; SetUpDataStruct(); - sRoomTrainers = AllocZeroed(sizeof(*sRoomTrainers)); + sFloorTrainers = AllocZeroed(sizeof(*sFloorTrainers)); - for (i = 0; i < 2; i++) + for (i = 0; i < HILL_TRAINERS_PER_FLOOR; i++) { for (j = 0; j < HILL_TRAINER_NAME_LENGTH; j++) - { - sRoomTrainers->name[i][j] = sHillData->floors[sHillData->floorId].trainers[i].name[j]; - } - sRoomTrainers->facilityClass[i] = sHillData->floors[sHillData->floorId].trainers[i].facilityClass; + sFloorTrainers->name[i][j] = sHillData->floors[sHillData->floorId].trainers[i].name[j]; + + sFloorTrainers->facilityClass[i] = sHillData->floors[sHillData->floorId].trainers[i].facilityClass; } SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer); FreeDataStruct(); @@ -345,8 +341,7 @@ void InitTrainerHillBattleStruct(void) void FreeTrainerHillBattleStruct(void) { - if (sRoomTrainers != NULL) - FREE_AND_SET_NULL(sRoomTrainers); + TRY_FREE_AND_SET_NULL(sFloorTrainers); } static void SetUpDataStruct(void) @@ -355,15 +350,20 @@ static void SetUpDataStruct(void) { sHillData = AllocZeroed(sizeof(*sHillData)); sHillData->floorId = gMapHeader.mapLayoutId - LAYOUT_TRAINER_HILL_1F; - CpuCopy32(sDataPerTag[gSaveBlock1Ptr->trainerHill.tag], &sHillData->tag, sizeof(sHillData->tag) + 4 * sizeof(struct TrHillFloor)); + + // This copy depends on the floor data for each challenge being directly after the + // challenge header data, and for the field 'floors' in sHillData to come directly + // after the field 'challenge'. + // e.g. for HILL_MODE_NORMAL, it will copy sChallenge_Normal to sHillData->challenge and + // it will copy sFloors_Normal to sHillData->floors + CpuCopy32(sChallengeData[gSaveBlock1Ptr->trainerHill.mode], &sHillData->challenge, sizeof(sHillData->challenge) + sizeof(sHillData->floors)); TrainerHillDummy(); } } static void FreeDataStruct(void) { - if (sHillData != NULL) - FREE_AND_SET_NULL(sHillData); + TRY_FREE_AND_SET_NULL(sHillData); } void CopyTrainerHillTrainerText(u8 which, u16 trainerId) @@ -428,7 +428,7 @@ static void GiveChallengePrize(void) { u16 itemId = GetPrizeItemId(); - if (sHillData->tag.numFloors != NUM_TRAINER_HILL_FLOORS || gSaveBlock1Ptr->trainerHill.receivedPrize) + if (sHillData->challenge.numFloors != NUM_TRAINER_HILL_FLOORS || gSaveBlock1Ptr->trainerHill.receivedPrize) { gSpecialVar_Result = 2; } @@ -456,7 +456,7 @@ static void CheckFinalTime(void) else if (GetTimerValue(&gSaveBlock1Ptr->trainerHill.bestTime) > gSaveBlock1Ptr->trainerHill.timer) { SetTimerValue(&gSaveBlock1Ptr->trainerHill.bestTime, gSaveBlock1Ptr->trainerHill.timer); - gSaveBlock1Ptr->trainerHillTimes[gSaveBlock1Ptr->trainerHill.tag] = gSaveBlock1Ptr->trainerHill.bestTime; + gSaveBlock1Ptr->trainerHillTimes[gSaveBlock1Ptr->trainerHill.mode] = gSaveBlock1Ptr->trainerHill.bestTime; gSpecialVar_Result = 0; } else @@ -529,9 +529,9 @@ static void BufferChallengeTime(void) static void GetAllFloorsUsed(void) { SetUpDataStruct(); - if (sHillData->tag.numFloors != NUM_TRAINER_HILL_FLOORS) + if (sHillData->challenge.numFloors != NUM_TRAINER_HILL_FLOORS) { - ConvertIntToDecimalStringN(gStringVar1, sHillData->tag.numFloors, STR_CONV_MODE_LEFT_ALIGN, 1); + ConvertIntToDecimalStringN(gStringVar1, sHillData->challenge.numFloors, STR_CONV_MODE_LEFT_ALIGN, 1); gSpecialVar_Result = FALSE; } else @@ -592,9 +592,9 @@ void PrintOnTrainerHillRecordsWindow(void) AddTextPrinterParameterized3(0, FONT_NORMAL, x, 2, sRecordWinColors, TEXT_SKIP_DRAW, gText_TimeBoard); y = 18; - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_TRAINER_HILL_MODES; i++) { - AddTextPrinterParameterized3(0, FONT_NORMAL, 0, y, sRecordWinColors, TEXT_SKIP_DRAW, sTagMatchStrings[i]); + AddTextPrinterParameterized3(0, FONT_NORMAL, 0, y, sRecordWinColors, TEXT_SKIP_DRAW, sModeStrings[i]); y += 15; total = GetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i]); minutes = total / (60 * 60); @@ -637,23 +637,23 @@ void LoadTrainerHillObjectEventTemplates(void) return; SetUpDataStruct(); - for (i = 0; i < 2; i++) + for (i = 0; i < HILL_TRAINERS_PER_FLOOR; i++) gSaveBlock2Ptr->frontier.trainerIds[i] = 0xFFFF; CpuFill32(0, gSaveBlock1Ptr->objectEventTemplates, sizeof(gSaveBlock1Ptr->objectEventTemplates)); floorId = GetFloorId(); - for (i = 0; i < 2; i++) + for (i = 0; i < HILL_TRAINERS_PER_FLOOR; i++) { u8 bits; eventTemplates[i] = sTrainerObjectEventTemplate; eventTemplates[i].localId = i + 1; eventTemplates[i].graphicsId = FacilityClassToGraphicsId(sHillData->floors[floorId].trainers[i].facilityClass); - eventTemplates[i].x = sHillData->floors[floorId].display.coords[i] & 0xF; - eventTemplates[i].y = ((sHillData->floors[floorId].display.coords[i] >> 4) & 0xF) + 5; + eventTemplates[i].x = sHillData->floors[floorId].map.trainerCoords[i] & 0xF; + eventTemplates[i].y = ((sHillData->floors[floorId].map.trainerCoords[i] >> 4) & 0xF) + 5; bits = i << 2; - eventTemplates[i].movementType = ((sHillData->floors[floorId].display.direction >> bits) & 0xF) + MOVEMENT_TYPE_FACE_UP; - eventTemplates[i].trainerRange_berryTreeId = (sHillData->floors[floorId].display.range >> bits) & 0xF; + eventTemplates[i].movementType = ((sHillData->floors[floorId].map.trainerDirections >> bits) & 0xF) + MOVEMENT_TYPE_FACE_UP; + eventTemplates[i].trainerRange_berryTreeId = (sHillData->floors[floorId].map.trainerRanges >> bits) & 0xF; eventTemplates[i].script = TrainerHill_EventScript_TrainerBattle; gSaveBlock2Ptr->frontier.trainerIds[i] = i + 1; } @@ -669,14 +669,14 @@ bool32 LoadTrainerHillFloorObjectEventScripts(void) return TRUE; } -static u16 GetMetatileForFloor(u8 floorId, u32 x, u32 y, u32 stride) // stride is always 16 +static u16 GetMetatileForFloor(u8 floorId, u32 x, u32 y, u32 floorWidth) // floorWidth is always 16 { bool8 impassable; u16 metatile; u16 elevation; - impassable = (sHillData->floors[floorId].display.collisionData[y] >> (15 - x) & 1); - metatile = sHillData->floors[floorId].display.metatileData[stride * y + x] + NUM_METATILES_IN_PRIMARY; + impassable = (sHillData->floors[floorId].map.collisionData[y] >> (15 - x) & 1); + metatile = sHillData->floors[floorId].map.metatileData[floorWidth * y + x] + NUM_METATILES_IN_PRIMARY; elevation = 3 << MAPGRID_ELEVATION_SHIFT; return ((impassable << MAPGRID_COLLISION_SHIFT) & MAPGRID_COLLISION_MASK) | elevation | (metatile & MAPGRID_METATILE_ID_MASK); @@ -684,7 +684,7 @@ static u16 GetMetatileForFloor(u8 floorId, u32 x, u32 y, u32 stride) // stride i void GenerateTrainerHillFloorLayout(u16 *mapArg) { - s32 i, j; + s32 y, x; u16 *src, *dst; u8 mapId = GetCurrentTrainerHillMapId(); @@ -705,24 +705,25 @@ void GenerateTrainerHillFloorLayout(u16 *mapArg) mapId = GetFloorId(); src = gMapHeader.mapLayout->map; gBackupMapLayout.map = mapArg; - gBackupMapLayout.width = 31; - gBackupMapLayout.height = 35; + // Dimensions include border area loaded beyond map + gBackupMapLayout.width = HILL_FLOOR_WIDTH + 15; + gBackupMapLayout.height = HILL_FLOOR_HEIGHT + 14; dst = mapArg + 224; // First 5 rows of the map (Entrance / Exit) are always the same - for (i = 0; i < 5; i++) + for (y = 0; y < HILL_FLOOR_HEIGHT_MARGIN; y++) { - for (j = 0; j < 16; j++) - dst[j] = src[j]; + for (x = 0; x < HILL_FLOOR_WIDTH; x++) + dst[x] = src[x]; dst += 31; src += 16; } // Load the 16x16 floor-specific layout - for (i = 0; i < 16; i++) + for (y = 0; y < HILL_FLOOR_HEIGHT_MAIN; y++) { - for (j = 0; j < 16; j++) - dst[j] = GetMetatileForFloor(mapId, j, i, 16); + for (x = 0; x < HILL_FLOOR_WIDTH; x++) + dst[x] = GetMetatileForFloor(mapId, x, y, HILL_FLOOR_WIDTH); dst += 31; } @@ -812,8 +813,8 @@ u16 LocalIdToHillTrainerId(u8 localId) bool8 GetHillTrainerFlag(u8 objectEventId) { - u32 floorId = GetFloorId() * 2; - u8 bitId = gObjectEvents[objectEventId].localId - 1 + floorId; + u32 trainerIndexStart = GetFloorId() * HILL_TRAINERS_PER_FLOOR; + u8 bitId = gObjectEvents[objectEventId].localId - 1 + trainerIndexStart; return gSaveBlock2Ptr->frontier.trainerFlags & gBitTable[bitId]; } @@ -821,24 +822,24 @@ bool8 GetHillTrainerFlag(u8 objectEventId) void SetHillTrainerFlag(void) { u8 i; - u8 floorId = GetFloorId() * 2; + u8 trainerIndexStart = GetFloorId() * HILL_TRAINERS_PER_FLOOR; - for (i = 0; i < 2; i++) + for (i = 0; i < HILL_TRAINERS_PER_FLOOR; i++) { if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_A) { - gSaveBlock2Ptr->frontier.trainerFlags |= gBitTable[floorId + i]; + gSaveBlock2Ptr->frontier.trainerFlags |= gBitTable[trainerIndexStart + i]; break; } } if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) { - for (i = 0; i < 2; i++) + for (i = 0; i < HILL_TRAINERS_PER_FLOOR; i++) { if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_B) { - gSaveBlock2Ptr->frontier.trainerFlags |= gBitTable[floorId + i]; + gSaveBlock2Ptr->frontier.trainerFlags |= gBitTable[trainerIndexStart + i]; break; } } @@ -861,14 +862,14 @@ static void CreateNPCTrainerHillParty(u16 trainerId, u8 firstMonId) u8 trId, level; s32 i, floorId, partySlot; - if (trainerId == 0 || trainerId > 2) + if (trainerId == 0 || trainerId > HILL_TRAINERS_PER_FLOOR) return; trId = trainerId - 1; SetUpDataStruct(); level = GetHighestLevelInPlayerParty(); floorId = GetFloorId(); - for (i = firstMonId, partySlot = 0; i < firstMonId + 3; i++, partySlot++) + for (i = firstMonId, partySlot = 0; i < firstMonId + PARTY_SIZE / 2; i++, partySlot++) { u8 id = sTrainerPartySlots[trId][partySlot]; struct Pokemon *mon = &gEnemyParty[i]; @@ -890,7 +891,7 @@ void FillHillTrainersParties(void) { ZeroEnemyPartyMons(); CreateNPCTrainerHillParty(gTrainerBattleOpponent_A, 0); - CreateNPCTrainerHillParty(gTrainerBattleOpponent_B, 3); + CreateNPCTrainerHillParty(gTrainerBattleOpponent_B, PARTY_SIZE / 2); } // This function is unused, but my best guess is @@ -935,7 +936,7 @@ u8 GetNumFloorsInTrainerHillChallenge(void) u8 floors; SetUpDataStruct(); - floors = sHillData->tag.numFloors; + floors = sHillData->challenge.numFloors; FreeDataStruct(); return floors; @@ -989,9 +990,9 @@ static void GetChallengeWon(void) gSpecialVar_Result = TRUE; } -static void TrainerHillSetTag(void) +static void TrainerHillSetMode(void) { - gSaveBlock1Ptr->trainerHill.tag = gSpecialVar_0x8005; + gSaveBlock1Ptr->trainerHill.mode = gSpecialVar_0x8005; gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005]; } @@ -1030,12 +1031,12 @@ static u16 GetPrizeItemId(void) prizeListSetId = var / 256; prizeListSetId %= 2; - if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->tag.numTrainers == NUM_TRAINER_HILL_TRAINERS) + if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->challenge.numTrainers == NUM_TRAINER_HILL_TRAINERS) i = GetPrizeListId(TRUE); else i = GetPrizeListId(FALSE); - if (gSaveBlock1Ptr->trainerHill.tag == HILL_TAG_EXPERT) + if (gSaveBlock1Ptr->trainerHill.mode == HILL_MODE_EXPERT) i = (i + 1) % NUM_TRAINER_HILL_PRIZE_LISTS; prizeList = sPrizeListSets[prizeListSetId][i]; From 328b925a08c3dfc47ebd49b7b8f9db2822790e34 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 31 Mar 2022 13:11:44 -0400 Subject: [PATCH 16/65] Move trainer hill map data to bin files --- .../maps_expert/floor_0/collision.bin | Bin 0 -> 32 bytes .../maps_expert/floor_0/metatiles.bin | 1 + .../maps_expert/floor_1/collision.bin | Bin 0 -> 32 bytes .../maps_expert/floor_1/metatiles.bin | 1 + .../maps_expert/floor_2/collision.bin | 1 + .../maps_expert/floor_2/metatiles.bin | 1 + .../maps_expert/floor_3/collision.bin | Bin 0 -> 32 bytes .../maps_expert/floor_3/metatiles.bin | 1 + .../maps_jp/floor_0/collision.bin | 1 + .../maps_jp/floor_0/metatiles.bin | 1 + .../maps_jp/floor_1/collision.bin | Bin 0 -> 32 bytes .../maps_jp/floor_1/metatiles.bin | 1 + .../maps_normal/floor_0/collision.bin | 1 + .../maps_normal/floor_0/metatiles.bin | 1 + .../maps_normal/floor_1/collision.bin | 1 + .../maps_normal/floor_1/metatiles.bin | 1 + .../maps_normal/floor_2/collision.bin | Bin 0 -> 32 bytes .../maps_normal/floor_2/metatiles.bin | 1 + .../maps_normal/floor_3/collision.bin | Bin 0 -> 32 bytes .../maps_normal/floor_3/metatiles.bin | 1 + .../maps_unique/floor_0/collision.bin | Bin 0 -> 32 bytes .../maps_unique/floor_0/metatiles.bin | 1 + .../maps_unique/floor_1/collision.bin | Bin 0 -> 32 bytes .../maps_unique/floor_1/metatiles.bin | 1 + .../maps_unique/floor_2/collision.bin | Bin 0 -> 32 bytes .../maps_unique/floor_2/metatiles.bin | 1 + .../maps_unique/floor_3/collision.bin | Bin 0 -> 32 bytes .../maps_unique/floor_3/metatiles.bin | 1 + .../maps_variety/floor_0/collision.bin | Bin 0 -> 32 bytes .../maps_variety/floor_0/metatiles.bin | 1 + .../maps_variety/floor_1/collision.bin | Bin 0 -> 32 bytes .../maps_variety/floor_1/metatiles.bin | 1 + .../maps_variety/floor_2/collision.bin | Bin 0 -> 32 bytes .../maps_variety/floor_2/metatiles.bin | 1 + .../maps_variety/floor_3/collision.bin | Bin 0 -> 32 bytes .../maps_variety/floor_3/metatiles.bin | 1 + include/trainer_hill.h | 2 +- src/data/battle_frontier/trainer_hill.h | 432 ++---------------- 38 files changed, 63 insertions(+), 393 deletions(-) create mode 100755 graphics/trainer_hill/maps_expert/floor_0/collision.bin create mode 100755 graphics/trainer_hill/maps_expert/floor_0/metatiles.bin create mode 100755 graphics/trainer_hill/maps_expert/floor_1/collision.bin create mode 100755 graphics/trainer_hill/maps_expert/floor_1/metatiles.bin create mode 100755 graphics/trainer_hill/maps_expert/floor_2/collision.bin create mode 100755 graphics/trainer_hill/maps_expert/floor_2/metatiles.bin create mode 100755 graphics/trainer_hill/maps_expert/floor_3/collision.bin create mode 100755 graphics/trainer_hill/maps_expert/floor_3/metatiles.bin create mode 100755 graphics/trainer_hill/maps_jp/floor_0/collision.bin create mode 100755 graphics/trainer_hill/maps_jp/floor_0/metatiles.bin create mode 100755 graphics/trainer_hill/maps_jp/floor_1/collision.bin create mode 100755 graphics/trainer_hill/maps_jp/floor_1/metatiles.bin create mode 100755 graphics/trainer_hill/maps_normal/floor_0/collision.bin create mode 100755 graphics/trainer_hill/maps_normal/floor_0/metatiles.bin create mode 100755 graphics/trainer_hill/maps_normal/floor_1/collision.bin create mode 100755 graphics/trainer_hill/maps_normal/floor_1/metatiles.bin create mode 100755 graphics/trainer_hill/maps_normal/floor_2/collision.bin create mode 100755 graphics/trainer_hill/maps_normal/floor_2/metatiles.bin create mode 100755 graphics/trainer_hill/maps_normal/floor_3/collision.bin create mode 100755 graphics/trainer_hill/maps_normal/floor_3/metatiles.bin create mode 100755 graphics/trainer_hill/maps_unique/floor_0/collision.bin create mode 100755 graphics/trainer_hill/maps_unique/floor_0/metatiles.bin create mode 100755 graphics/trainer_hill/maps_unique/floor_1/collision.bin create mode 100755 graphics/trainer_hill/maps_unique/floor_1/metatiles.bin create mode 100755 graphics/trainer_hill/maps_unique/floor_2/collision.bin create mode 100755 graphics/trainer_hill/maps_unique/floor_2/metatiles.bin create mode 100755 graphics/trainer_hill/maps_unique/floor_3/collision.bin create mode 100755 graphics/trainer_hill/maps_unique/floor_3/metatiles.bin create mode 100755 graphics/trainer_hill/maps_variety/floor_0/collision.bin create mode 100755 graphics/trainer_hill/maps_variety/floor_0/metatiles.bin create mode 100755 graphics/trainer_hill/maps_variety/floor_1/collision.bin create mode 100755 graphics/trainer_hill/maps_variety/floor_1/metatiles.bin create mode 100755 graphics/trainer_hill/maps_variety/floor_2/collision.bin create mode 100755 graphics/trainer_hill/maps_variety/floor_2/metatiles.bin create mode 100755 graphics/trainer_hill/maps_variety/floor_3/collision.bin create mode 100755 graphics/trainer_hill/maps_variety/floor_3/metatiles.bin diff --git a/graphics/trainer_hill/maps_expert/floor_0/collision.bin b/graphics/trainer_hill/maps_expert/floor_0/collision.bin new file mode 100755 index 0000000000000000000000000000000000000000..ca6e4ca28beaf070d34dedbd697149620da6ea68 GIT binary patch literal 32 ecmZo0f}Z{gu?&-0mT0byZ`_I literal 0 HcmV?d00001 diff --git a/graphics/trainer_hill/maps_expert/floor_1/metatiles.bin b/graphics/trainer_hill/maps_expert/floor_1/metatiles.bin new file mode 100755 index 000000000..a89a14c69 --- /dev/null +++ b/graphics/trainer_hill/maps_expert/floor_1/metatiles.bin @@ -0,0 +1 @@ +1;;;9989:;;;FFFFFFFFFFFFFxF|}|{zF}FFFFFFFFFFFFF~}~FFFFFFFFFFFFFF}|{z|FFFFFFFFFFFFFF|}~}~FFFFFFFFFFFFF֖֖֛֖֖֖֖֖֖֖֛ \ No newline at end of file diff --git a/graphics/trainer_hill/maps_expert/floor_2/collision.bin b/graphics/trainer_hill/maps_expert/floor_2/collision.bin new file mode 100755 index 000000000..891a7f2c1 --- /dev/null +++ b/graphics/trainer_hill/maps_expert/floor_2/collision.bin @@ -0,0 +1 @@ +>>}~=x=x}~y>> \ No newline at end of file diff --git a/graphics/trainer_hill/maps_expert/floor_2/metatiles.bin b/graphics/trainer_hill/maps_expert/floor_2/metatiles.bin new file mode 100755 index 000000000..7164f059d --- /dev/null +++ b/graphics/trainer_hill/maps_expert/floor_2/metatiles.bin @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/trainer_hill/maps_expert/floor_3/collision.bin b/graphics/trainer_hill/maps_expert/floor_3/collision.bin new file mode 100755 index 0000000000000000000000000000000000000000..3d25428f1569114f61521dfb75a0b10efeaee5ba GIT binary patch literal 32 kcmZoFHg#WXcI6&M*f6*M(2iYam&WCO_n09tVcFaQ7m literal 0 HcmV?d00001 diff --git a/graphics/trainer_hill/maps_expert/floor_3/metatiles.bin b/graphics/trainer_hill/maps_expert/floor_3/metatiles.bin new file mode 100755 index 000000000..f2200b713 --- /dev/null +++ b/graphics/trainer_hill/maps_expert/floor_3/metatiles.bin @@ -0,0 +1 @@ +1;;;9999:;;;FFFFFFF6666FFFFFFFF6FۛF6FF6ۛ6F֖ۛF6ۛ6FF6FۛF6FFFFFFFF6666FFFFFFF \ No newline at end of file diff --git a/graphics/trainer_hill/maps_jp/floor_0/collision.bin b/graphics/trainer_hill/maps_jp/floor_0/collision.bin new file mode 100755 index 000000000..817f4f54c --- /dev/null +++ b/graphics/trainer_hill/maps_jp/floor_0/collision.bin @@ -0,0 +1 @@ +oAcA`ADAUAU \ No newline at end of file diff --git a/graphics/trainer_hill/maps_jp/floor_0/metatiles.bin b/graphics/trainer_hill/maps_jp/floor_0/metatiles.bin new file mode 100755 index 000000000..8d1787efd --- /dev/null +++ b/graphics/trainer_hill/maps_jp/floor_0/metatiles.bin @@ -0,0 +1 @@ +155;&&%9:;;;1++;44++43????;1++;;;44;3???;;1++55555;3???;?1+444+44;,???;;1+;5;+;5;5;???;1+;+;+;+;+;???;14;+;4;+5+;;?;;1;;4;;;444?;;;? \ No newline at end of file diff --git a/graphics/trainer_hill/maps_jp/floor_1/collision.bin b/graphics/trainer_hill/maps_jp/floor_1/collision.bin new file mode 100755 index 0000000000000000000000000000000000000000..58f80b49bb1ab2c9e27f9e8c19f3cfa17b6dcdfe GIT binary patch literal 32 bcmZo?HC#Uv;AiWLNEXT<6#hZ literal 0 HcmV?d00001 diff --git a/graphics/trainer_hill/maps_jp/floor_1/metatiles.bin b/graphics/trainer_hill/maps_jp/floor_1/metatiles.bin new file mode 100755 index 000000000..951723792 --- /dev/null +++ b/graphics/trainer_hill/maps_jp/floor_1/metatiles.bin @@ -0,0 +1 @@ +1;5;9&%9:;5;1;+;;+++++;;;+;1;+;;+++++>>;+;1;+;;+++++;;;+;?;+;;+++++;>>+;1;+;;++,++;;;+;1?+;;,,;,,>>;+;1;+5555;55555+;?;,,,,,;,,,,,,;1;??;55;55555551???;++5+++++++1??;;++++++++++1;;;?,,,,,,,,,, \ No newline at end of file diff --git a/graphics/trainer_hill/maps_normal/floor_0/collision.bin b/graphics/trainer_hill/maps_normal/floor_0/collision.bin new file mode 100755 index 000000000..80213aaae --- /dev/null +++ b/graphics/trainer_hill/maps_normal/floor_0/collision.bin @@ -0,0 +1 @@ +?%!~A } Ay \ No newline at end of file diff --git a/graphics/trainer_hill/maps_normal/floor_0/metatiles.bin b/graphics/trainer_hill/maps_normal/floor_0/metatiles.bin new file mode 100755 index 000000000..658a5ace6 --- /dev/null +++ b/graphics/trainer_hill/maps_normal/floor_0/metatiles.bin @@ -0,0 +1 @@ +1;55&&%&:;5;1;,,,+$$$$,;;,;-;;;;+;;;;5;55;3;2!0+;2!0+;,+;35;;;,5;;;+;;+;4,;2!0+20;+20,;15;;5;,;;5,;;551,20+205;+2!0,,15;;+;;+;,;5;;;1,20+20+;20+20;1555+;;+;;5+;551+,,,20+20,,;,,1+;;5;;+;;5;;;;1,20+;;,20,20;51;;;,;;;;;;;;;, \ No newline at end of file diff --git a/graphics/trainer_hill/maps_normal/floor_1/collision.bin b/graphics/trainer_hill/maps_normal/floor_1/collision.bin new file mode 100755 index 000000000..fb3f6aec0 --- /dev/null +++ b/graphics/trainer_hill/maps_normal/floor_1/collision.bin @@ -0,0 +1 @@ +s @ @QSQQQQQPP \ No newline at end of file diff --git a/graphics/trainer_hill/maps_normal/floor_1/metatiles.bin b/graphics/trainer_hill/maps_normal/floor_1/metatiles.bin new file mode 100755 index 000000000..52af9cfdc --- /dev/null +++ b/graphics/trainer_hill/maps_normal/floor_1/metatiles.bin @@ -0,0 +1 @@ +˛ۛۛۛ \ No newline at end of file diff --git a/graphics/trainer_hill/maps_normal/floor_2/collision.bin b/graphics/trainer_hill/maps_normal/floor_2/collision.bin new file mode 100755 index 0000000000000000000000000000000000000000..b3ccacdd4c25fee4cf227fac1346ee02b189d8c2 GIT binary patch literal 32 acmZoeskKr|x*BLe_r>jg#t literal 0 HcmV?d00001 diff --git a/graphics/trainer_hill/maps_normal/floor_2/metatiles.bin b/graphics/trainer_hill/maps_normal/floor_2/metatiles.bin new file mode 100755 index 000000000..bf2b52c32 --- /dev/null +++ b/graphics/trainer_hill/maps_normal/floor_2/metatiles.bin @@ -0,0 +1 @@ +1555&&8&.55;icddddqqqrdddcsicssssssssssscsicssssssssssscsicCA@ABAAJBAAcsicsssssssdssscsicACKCCABB@A@csicssdsssssssscsicA@BBAABJBABcsicsssssssdssscsicABACKAAA@CAcsicssssdsssssscsicA@CABBAJBABcsidsssssssdsssdsiCCABBACAA@BABsiBsssssssssssBs \ No newline at end of file diff --git a/graphics/trainer_hill/maps_normal/floor_3/collision.bin b/graphics/trainer_hill/maps_normal/floor_3/collision.bin new file mode 100755 index 0000000000000000000000000000000000000000..f4c47254c56adb7e19d0d6ed491a13178b73c526 GIT binary patch literal 32 ncmZoUbL@H$@m!0ULkk4!I2@pp3%k8wKCK(G#-c@Lu*4B1sMhZ{|5lD4+_)( literal 0 HcmV?d00001 diff --git a/graphics/trainer_hill/maps_unique/floor_3/metatiles.bin b/graphics/trainer_hill/maps_unique/floor_3/metatiles.bin new file mode 100755 index 000000000..66840137c --- /dev/null +++ b/graphics/trainer_hill/maps_unique/floor_3/metatiles.bin @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/trainer_hill/maps_variety/floor_0/collision.bin b/graphics/trainer_hill/maps_variety/floor_0/collision.bin new file mode 100755 index 0000000000000000000000000000000000000000..24fc2ea1e6b203d760a554f6b02de209bdeadb1e GIT binary patch literal 32 McmZo+m literal 0 HcmV?d00001 diff --git a/graphics/trainer_hill/maps_variety/floor_1/metatiles.bin b/graphics/trainer_hill/maps_variety/floor_1/metatiles.bin new file mode 100755 index 000000000..c5a9aa5d4 --- /dev/null +++ b/graphics/trainer_hill/maps_variety/floor_1/metatiles.bin @@ -0,0 +1 @@ +1;;;9989:;;;@@@@@@@B@BBBBBBBBBBBBBBBBBAB֖AB֖@֜ \ No newline at end of file diff --git a/graphics/trainer_hill/maps_variety/floor_2/collision.bin b/graphics/trainer_hill/maps_variety/floor_2/collision.bin new file mode 100755 index 0000000000000000000000000000000000000000..606249b2a0085c18fc9fea19f02a98713c93233a GIT binary patch literal 32 RcmZo Date: Fri, 1 Apr 2022 01:21:00 -0400 Subject: [PATCH 17/65] Document trainer hill prize selection --- src/trainer_hill.c | 60 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/src/trainer_hill.c b/src/trainer_hill.c index 2deacfc70..dad6b97ea 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -996,10 +996,14 @@ static void TrainerHillSetMode(void) gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005]; } -static u8 GetPrizeListId(bool8 maxTrainers) +// Determines which prize list to use from the set of prize lists. +static u8 GetPrizeListId(bool8 allowTMs) { u8 prizeListId, i, modBy; + // The initial selection depends on the trainer numbers for the completed challenge. + // These don't change with the available challenge modes, so Normal/Unique will always + // have a prizeListId of 8, and Variety/Expert will have a prizeListId of 24. prizeListId = 0; for (i = 0; i < NUM_TRAINER_HILL_FLOORS; i++) { @@ -1007,8 +1011,10 @@ static u8 GetPrizeListId(bool8 maxTrainers) prizeListId ^= sHillData->floors[i].trainerNum2 & 0x1F; } - // Not possible to win TMs with fewer than 8 trainers - if (maxTrainers) + // In practice, the conditional below is always true. + // The 2nd half of the lists in both sets of lists all have a TM as the "grand prize", while the 1st half do not, + // so taking the mod of the (total / 2) ensures that a prize list without a TM will be used. + if (allowTMs) modBy = NUM_TRAINER_HILL_PRIZE_LISTS; else modBy = NUM_TRAINER_HILL_PRIZE_LISTS / 2; @@ -1021,38 +1027,64 @@ static u16 GetPrizeItemId(void) { u8 i; const u16 *prizeList; - s32 var = 0, prizeListSetId, minutes, id; + s32 trainerNumSum = 0, prizeListSetId, minutes, id; + // First determine which set of prize lists to use. The sets of lists only differ in + // what TMs they can offer as the "grand prize" for a time under 12 minutes. + // Which set of lists gets used is based on the sum of all the trainer numbers for that + // challenge. These don't change with the available challenge modes, so Normal will always + // have a prizeListSetId of 0, and Unique/Variety/Expert will have a prizeListSetId of 1. for (i = 0; i < NUM_TRAINER_HILL_FLOORS; i++) { - var += sHillData->floors[i].trainerNum1; - var += sHillData->floors[i].trainerNum2; + trainerNumSum += sHillData->floors[i].trainerNum1; + trainerNumSum += sHillData->floors[i].trainerNum2; } + prizeListSetId = trainerNumSum / 256; + prizeListSetId %= (int)ARRAY_COUNT(sPrizeListSets); - prizeListSetId = var / 256; - prizeListSetId %= 2; + // Now get which prize list to use from the set. See GetPrizeListId for details. + // The below conditional will always be true, because a Trainer Hill challenge can't be entered + // until the player has entered the Hall of Fame (FLAG_SYS_GAME_CLEAR is set) and because all + // of the available challenge modes have the full 8 trainers (NUM_TRAINER_HILL_TRAINERS). if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->challenge.numTrainers == NUM_TRAINER_HILL_TRAINERS) i = GetPrizeListId(TRUE); else i = GetPrizeListId(FALSE); + // 1 is added to Expert mode's prize list selection because otherwise it has the same prizes as Variety if (gSaveBlock1Ptr->trainerHill.mode == HILL_MODE_EXPERT) i = (i + 1) % NUM_TRAINER_HILL_PRIZE_LISTS; + // After the above (non-random) calculations, the following are the possible prize list selections: + // sPrizeListSets[0][8] (Normal) + // sPrizeListSets[1][4] (Variety) + // sPrizeListSets[1][8] (Unique) + // sPrizeListSets[1][5] (Expert) prizeList = sPrizeListSets[prizeListSetId][i]; + + // Which prize is given from the list depends on the time scored. + // The prize for any time after 12 minutes is the same in every list. + // The prizes for a time under 12 minutes are: + // - ITEM_TM11_SUNNY_DAY (Normal) + // - ITEM_ELIXIR (Variety) + // - ITEM_TM19_GIGA_DRAIN (Unique) + // - ITEM_TM31_BRICK_BREAK (Expert) + // As an additional note, if players were allowed to enter a Trainer Hill challenge before + // entering the Hall of Fame, there would be 1 additional prize possibility (ITEM_MAX_ETHER) + // as Normal / Unique modes would use sPrizeListSets[0][3] / sPrizeListSets[1][3] respectively. minutes = (signed)(gSaveBlock1Ptr->trainerHill.timer) / (60 * 60); if (minutes < 12) - id = 0; + id = 0; // Depends on list else if (minutes < 13) - id = 1; + id = 1; // ITEM_ETHER else if (minutes < 14) - id = 2; + id = 2; // ITEM_MAX_POTION else if (minutes < 16) - id = 3; + id = 3; // ITEM_REVIVE else if (minutes < 18) - id = 4; + id = 4; // ITEM_FLUFFY_TAIL else - id = 5; + id = 5; // ITEM_GREAT_BALL return prizeList[id]; } From e1f89c70d9c0f1d34fa5d3eb45c6baf0d7a42287 Mon Sep 17 00:00:00 2001 From: Eldred Habert Date: Sat, 2 Apr 2022 00:22:36 +0200 Subject: [PATCH 18/65] Add Arch Linux install instructions I didn't test the devkitARM install instructions, but they are pretty much transcribed from the Ubuntu/Deb ones, so that should be fine. --- INSTALL.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 1f1e1164b..f6434c07b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -305,6 +305,20 @@ Then proceed to [Choosing where to store pokeemerald (Linux)](#choosing-where-to > then you will have to install devkitARM. Install all the above packages except binutils-arm-none-eabi, and follow the instructions to > [install devkitARM on Debian/Ubuntu-based distributions](#installing-devkitarm-on-debianubuntu-based-distributions). + +### Arch Linux +Run this command as root to install the necessary packages: +```bash +pacman -S base-devel arm-none-eabi-binutils git libpng +``` +Then proceed to [Choosing where to store pokeemerald (Linux)](#choosing-where-to-store-pokeemerald-linux). +
+ Note for legacy repos... + +> If the repository you plan to build has an **[older revision of the INSTALL.md](https://github.com/pret/pokeemerald/blob/571c598/INSTALL.md)**, +> then you will have to install devkitARM. Install all the above packages except binutils-arm-none-eabi, and follow the instructions to +> [install devkitARM on Arch Linux](#installing-devkitarm-on-arch-linux). +
### Other distributions _(Specific instructions for other distributions would be greatly appreciated!)_ @@ -520,6 +534,24 @@ devkitARM is now installed. devkitARM is now installed. +## Installing devkitARM on Arch Linux + +1. Follow [devkitPro's instructions](https://devkitpro.org/wiki/devkitPro_pacman#Customising_Existing_Pacman_Install) to configure `pacman` to download devkitPro packages. +2. Install `gba-dev`: run the following command as root. + + ```console + pacman -S gba-dev + ``` + This will ask for the selection of packages to install. Just press Enter to install all of them, followed by entering Y to proceed with the installation. + +3. Run the following command to set devkitPro related environment variables (alternatively, close and re-open the Terminal): + + ```bash + source /etc/profile.d/devkit-env.sh + ``` + +devkitARM is now installed. + ## Other toolchains To build using a toolchain other than devkitARM, override the `TOOLCHAIN` environment variable with the path to your toolchain, which must contain the subdirectory `bin`. From 59cff2190d44edf9e64c1d8c4cfd5931b2354aaf Mon Sep 17 00:00:00 2001 From: sbird Date: Sat, 16 Apr 2022 19:03:20 +0200 Subject: [PATCH 19/65] fix building without NDEBUG on agbcc --- ld_script.txt | 43 ++++++++++++++++++++++++++++++++++++++++--- src/libisagbprn.c | 10 +++++----- src/mystery_gift.c | 4 ++++ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/ld_script.txt b/ld_script.txt index d68498a8b..1460c8443 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -20,7 +20,9 @@ SECTIONS { . = 0x1C000; INCLUDE "sym_ewram.ld" - + *libc.a:impure.o(.data); + *libc.a:locale.o(.data); + *libc.a:mallocr.o(.data); . = 0x40000; } @@ -462,6 +464,7 @@ SECTIONS { src/mystery_gift_server.o(.rodata); src/mystery_gift_client.o(.rodata); src/mystery_gift_scripts.o(.rodata); + src/wonder_news.o(.rodata); src/union_room_chat.o(.rodata); src/berry_crush.o(.rodata); src/berry_powder.o(.rodata); @@ -1245,9 +1248,43 @@ SECTIONS { src/librfu_sio32id.o(.rodata); *libgcc.a:_divdi3.o(.rodata); *libgcc.a:_udivdi3.o(.rodata); - *libc.a(.rodata); - *libc.a(.data); + *libc.a:memcpy.o(.rodata); + *libc.a:memset.o(.rodata); + *libc.a:strcmp.o(.rodata); + *libc.a:strcpy.o(.rodata); + *libc.a:impure.o(.rodata); + *libc.a:vsprintf.o(.rodata); + *libc.a:vfprintf.o(.rodata); + *libc.a:wsetup.o(.rodata); + *libc.a:dtoa.o(.rodata); + *libc.a:fflush.o(.rodata); + *libc.a:findfp.o(.rodata); + *libc.a:freer.o(.rodata); + *libc.a:mtrim.o(.rodata); + *libc.a:fvwrite.o(.rodata); + *libc.a:fwalk.o(.rodata); + *libc.a:locale.o(.rodata); + *libc.a:makebuf.o(.rodata); + *libc.a:mallocr.o(.rodata); + *libc.a:mbtowc_r.o(.rodata); + *libc.a:memchr.o(.rodata); + *libc.a:memmove.o(.rodata); + *libc.a:mlock.o(.rodata); + *libc.a:mprec.o(.rodata); + *libc.a:s_isinf.o(.rodata); + *libc.a:s_isnan.o(.rodata); + *libc.a:sbrkr.o(.rodata); + *libc.a:stdio.o(.rodata); + *libc.a:strlen.o(.rodata); *libc.a:syscalls.o(.rodata); + *libc.a:writer.o(.rodata); + *libc.a:callocr.o(.rodata); + *libc.a:closer.o(.rodata); + *libc.a:errno.o(.rodata); + *libc.a:fstatr.o(.rodata); + *libc.a:libcfunc.o(.rodata); + *libc.a:lseekr.o(.rodata); + *libc.a:readr.o(.rodata); src/libisagbprn.o(.rodata); } =0 diff --git a/src/libisagbprn.c b/src/libisagbprn.c index 69c6986ae..7a70cf41f 100644 --- a/src/libisagbprn.c +++ b/src/libisagbprn.c @@ -31,7 +31,7 @@ void AGBPrintFlush1Block(void); void AGBPrintInit(void) { volatile struct AGBPrintStruct *pPrint = (struct AGBPrintStruct *)AGB_PRINT_STRUCT_ADDR; - u16 *pWSCNT = ®_WAITCNT; + vu16 *pWSCNT = ®_WAITCNT; u16 *pProtect = (u16 *)AGB_PRINT_PROTECT_ADDR; u16 nOldWSCNT = *pWSCNT; *pWSCNT = WSCNT_DATA; @@ -57,7 +57,7 @@ static void AGBPutcInternal(const char cChr) void AGBPutc(const char cChr) { - u16 *pWSCNT = ®_WAITCNT; + vu16 *pWSCNT = ®_WAITCNT; u16 nOldWSCNT = *pWSCNT; volatile struct AGBPrintStruct *pPrint; *pWSCNT = WSCNT_DATA; @@ -71,7 +71,7 @@ void AGBPutc(const char cChr) void AGBPrint(const char *pBuf) { volatile struct AGBPrintStruct *pPrint = (struct AGBPrintStruct *)AGB_PRINT_STRUCT_ADDR; - u16 *pWSCNT = ®_WAITCNT; + vu16 *pWSCNT = ®_WAITCNT; u16 nOldWSCNT = *pWSCNT; *pWSCNT = WSCNT_DATA; while (*pBuf) @@ -95,9 +95,9 @@ void AGBPrintf(const char *pBuf, ...) static void AGBPrintTransferDataInternal(u32 bAllData) { LPFN_PRINT_FLUSH lpfnFuncFlush; - u16 *pIME; + vu16 *pIME; u16 nIME; - u16 *pWSCNT; + vu16 *pWSCNT; u16 nOldWSCNT; u16 *pProtect; volatile struct AGBPrintStruct *pPrint; diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 1df6533d9..72fc2b377 100755 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -506,9 +506,13 @@ static void IncrementCardStat(u32 statType) } if (stat == NULL) + { AGB_ASSERT(0); + } else if (++(*stat) > MAX_WONDER_CARD_STAT) + { *stat = MAX_WONDER_CARD_STAT; + } } } From 0bda107188b5623f34d95214fae1c715b757ec7f Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Wed, 20 Apr 2022 01:07:10 -0400 Subject: [PATCH 20/65] don't build modern with -g by default --- INSTALL.md | 1 + Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index f6434c07b..72f3c92f3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -457,6 +457,7 @@ To build **pokeemerald.elf** with enhanced debug info: ```bash make DINFO=1 ``` +Note that this is only necessary for the `modern` target; the regular target has debug info enabled by default. ## devkitARM's C compiler diff --git a/Makefile b/Makefile index 6283a87fe..c36cc8e93 100644 --- a/Makefile +++ b/Makefile @@ -107,7 +107,7 @@ LIBPATH := -L ../../tools/agbcc/lib LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall else CC1 = $(shell $(PATH_MODERNCC) --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 -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast ROM := $(MODERN_ROM_NAME) OBJ_DIR := $(MODERN_OBJ_DIR_NAME) LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))" From 2b223acd876169cd8f90f8f5723f28aaaa32f373 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 26 Apr 2022 21:44:11 -0400 Subject: [PATCH 21/65] Fix math in CreateBerrySprite --- src/berry_blender.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/berry_blender.c b/src/berry_blender.c index 27ea641ce..9b74c7bab 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1188,9 +1188,9 @@ static void SetBerrySpriteData(struct Sprite* sprite, s16 x, s16 y, s16 bounceSp #undef sXSpeed #undef sYDownSpeed -static void CreateBerrySprite(u16 a0, u8 playerId) +static void CreateBerrySprite(u16 itemId, u8 playerId) { - u8 spriteId = CreateSpinningBerrySprite(a0 + FIRST_BERRY_INDEX - 10, 0, 80, playerId & 1); + u8 spriteId = CreateSpinningBerrySprite(ITEM_TO_BERRY(itemId) - 1, 0, 80, playerId & 1); SetBerrySpriteData(&gSprites[spriteId], sBerrySpriteData[playerId][0], sBerrySpriteData[playerId][1], From 1c13335d16f610d2c3881effb7eddf3fefd5d894 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Thu, 12 May 2022 22:05:44 -0400 Subject: [PATCH 22/65] Update INSTALL.md --- INSTALL.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 72f3c92f3..42d8a75ec 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -451,14 +451,6 @@ Replace `` with the number that the `nproc` command returned. `nproc` is not available on macOS. The alternative is `sysctl -n hw.ncpu` ([relevant Stack Overflow thread](https://stackoverflow.com/questions/1715580)). -## Debug info - -To build **pokeemerald.elf** with enhanced debug info: -```bash -make DINFO=1 -``` -Note that this is only necessary for the `modern` target; the regular target has debug info enabled by default. - ## devkitARM's C compiler This project supports the `arm-none-eabi-gcc` compiler included with devkitARM. If devkitARM (a.k.a. gba-dev) has already been installed as part of the platform-specific instructions, simply run: @@ -535,7 +527,7 @@ devkitARM is now installed. devkitARM is now installed. -## Installing devkitARM on Arch Linux +### Installing devkitARM on Arch Linux 1. Follow [devkitPro's instructions](https://devkitpro.org/wiki/devkitPro_pacman#Customising_Existing_Pacman_Install) to configure `pacman` to download devkitPro packages. 2. Install `gba-dev`: run the following command as root. @@ -553,7 +545,7 @@ devkitARM is now installed. devkitARM is now installed. -## Other toolchains +### Other toolchains To build using a toolchain other than devkitARM, override the `TOOLCHAIN` environment variable with the path to your toolchain, which must contain the subdirectory `bin`. ```bash @@ -565,6 +557,14 @@ make TOOLCHAIN="/usr/local/arm-none-eabi" ``` To compile the `modern` target with this toolchain, the subdirectories `lib`, `include`, and `arm-none-eabi` must also be present. +### Building with debug info under a modern toolchain + +To build **pokeemerald.elf** with debug symbols under a modern toolchain: +```bash +make DINFO=1 +``` +Note that this is not necessary for a non-modern build since those are built with debug symbols by default. + # Useful additional tools * [porymap](https://github.com/huderlem/porymap) for viewing and editing maps From 7d224197c05fb319c03d2bcbed3ed36d6f246fd8 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Thu, 12 May 2022 22:33:17 -0400 Subject: [PATCH 23/65] Update INSTALL.md --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 42d8a75ec..7f1d47879 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -561,7 +561,7 @@ To compile the `modern` target with this toolchain, the subdirectories `lib`, `i To build **pokeemerald.elf** with debug symbols under a modern toolchain: ```bash -make DINFO=1 +make modern DINFO=1 ``` Note that this is not necessary for a non-modern build since those are built with debug symbols by default. From 6d6dac3adde8cd3e47d062aa2698239d97e44679 Mon Sep 17 00:00:00 2001 From: cbt6 <91667135+cbt6@users.noreply.github.com> Date: Sun, 15 May 2022 21:44:04 +0800 Subject: [PATCH 24/65] Use ARRAY_COUNT in sStepTimes for step functions --- src/event_object_movement.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index eb699e89f..091293551 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -8251,11 +8251,11 @@ static const SpriteStepFunc *const sNpcStepFuncTables[] = { }; static const s16 sStepTimes[] = { - [MOVE_SPEED_NORMAL] = 16, - [MOVE_SPEED_FAST_1] = 8, - [MOVE_SPEED_FAST_2] = 6, - [MOVE_SPEED_FASTER] = 4, - [MOVE_SPEED_FASTEST] = 2, + [MOVE_SPEED_NORMAL] = ARRAY_COUNT(sStep1Funcs), + [MOVE_SPEED_FAST_1] = ARRAY_COUNT(sStep2Funcs), + [MOVE_SPEED_FAST_2] = ARRAY_COUNT(sStep3Funcs), + [MOVE_SPEED_FASTER] = ARRAY_COUNT(sStep4Funcs), + [MOVE_SPEED_FASTEST] = ARRAY_COUNT(sStep8Funcs), }; static bool8 NpcTakeStep(struct Sprite *sprite) From 71ea78cc32ed2f6178434c516118118e282f9e65 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 16 May 2022 14:55:20 -0400 Subject: [PATCH 25/65] Document Task_UpdateContestResultBar --- src/contest_util.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/contest_util.c b/src/contest_util.c index 1ca217526..d8726d860 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -77,7 +77,10 @@ enum { #define TAG_CONFETTI 3017 #define TAG_WIRELESS_INDICATOR_WINDOW 22222 -#define MAX_BAR_LENGTH 87 +// Length of the score bar on the results screen +#define NUM_BAR_SEGMENTS 11 +#define BAR_SEGMENT_LENGTH 8 // Each segment of the results bar is a single tile, so 8 pixels long +#define MAX_BAR_LENGTH (NUM_BAR_SEGMENTS * BAR_SEGMENT_LENGTH) // Starting x/y for the sliding results screen text box #define TEXT_BOX_X (DISPLAY_WIDTH + 32) @@ -96,7 +99,7 @@ struct ContestResultsInternal u8 winnerMonSpriteId; bool8 destroyConfetti; bool8 pointsFlashing; - s16 unkC[CONTESTANT_COUNT]; + s16 barLength[CONTESTANT_COUNT]; u8 numBarsUpdating; }; @@ -1748,7 +1751,7 @@ static void CalculateContestantsResultData(void) if ((*sContestResults->monResults)[i].lostPoints) barLengthRound2 *= -1; - if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH + 1) + if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH) { if (barLengthRound2 > 0) (*sContestResults->monResults)[i].barLengthRound2--; @@ -1841,47 +1844,52 @@ static void Task_UpdateContestResultBar(u8 taskId) s16 target = gTasks[taskId].tTarget; s16 decreasing = gTasks[taskId].tDecreasing; + // Has the results bar reached the limit? if (decreasing) { - if (sContestResults->data->unkC[monId] <= 0) + if (sContestResults->data->barLength[monId] <= 0) minMaxReached = TRUE; } else { - if (sContestResults->data->unkC[monId] > MAX_BAR_LENGTH) + if (sContestResults->data->barLength[monId] >= MAX_BAR_LENGTH) minMaxReached = TRUE; } - if (sContestResults->data->unkC[monId] == target) + if (sContestResults->data->barLength[monId] == target) targetReached = TRUE; if (!targetReached) { + // Target length has not been reached, update bar length if (minMaxReached) - sContestResults->data->unkC[monId] = target; + sContestResults->data->barLength[monId] = target; else if (decreasing) - sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] - 1; + sContestResults->data->barLength[monId]--; else - sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] + 1; + sContestResults->data->barLength[monId]++; } + // Update the tiles of the results bar if it's still changing if (!minMaxReached && !targetReached) { - u8 var0; + u8 tileOffset; u16 tileNum; - for (i = 0; i < 11; i++) + for (i = 0; i < NUM_BAR_SEGMENTS; i++) { - if (sContestResults->data->unkC[monId] >= (i + 1) * 8) - var0 = 8; - else if (sContestResults->data->unkC[monId] >= i * 8) - var0 = sContestResults->data->unkC[monId] % 8; + if (sContestResults->data->barLength[monId] >= (i + 1) * BAR_SEGMENT_LENGTH) + tileOffset = 8; // Bar segment is full + else if (sContestResults->data->barLength[monId] >= i * BAR_SEGMENT_LENGTH) + tileOffset = sContestResults->data->barLength[monId] % 8; // Bar segment is between full and empty else - var0 = 0; + tileOffset = 0; // Bar segment is empty - if (var0 < 4) - tileNum = 0x504C + var0; + // The first 4 bar segment tiles are not adjacent in the tileset to the + // remaining bar segment tiles; choose the base tile number accordingly. + if (tileOffset < 4) + tileNum = 0x504C + tileOffset; else - tileNum = 0x5057 + var0; + tileNum = 0x5057 + tileOffset; FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, monId * 3 + 6, 1, 1); } From 593e2c9be0329241c3c110059333f41a865409bb Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 17 May 2022 13:51:54 -0400 Subject: [PATCH 26/65] Fix inconsistent static s/g names --- data/scripts/gift_altering_cave.inc | 2 +- data/text/pokedex_rating.inc | 2 +- include/constants/battle.h | 2 +- include/constants/flags.h | 2 +- include/contest.h | 1 - src/agb_flash_1m.c | 2 +- src/battle_anim_dragon.c | 4 +- src/battle_anim_status_effects.c | 4 +- src/battle_bg.c | 8 +- src/battle_tower.c | 4 +- src/coins.c | 2 +- src/contest.c | 26 +- src/data/field_effects/field_effect_objects.h | 2 +- src/data/trade.h | 6 +- src/data/trainer_graphics/back_pic_anims.h | 30 +- src/dodrio_berry_picking.c | 2 +- src/event_data.c | 6 +- src/field_effect.c | 46 +- src/field_screen_effect.c | 2 +- src/field_special_scene.c | 8 +- src/field_weather.c | 2 +- src/field_weather_effect.c | 30 +- src/fieldmap.c | 42 +- src/item_menu_icons.c | 16 +- src/landmark.c | 16 +- src/m4a_1.s | 8 +- src/main.c | 6 +- src/main_menu.c | 16 +- src/map_name_popup.c | 38 +- src/overworld.c | 14 +- src/palette.c | 6 +- src/pokedex.c | 4 +- src/pokemon_storage_system.c | 4 +- src/pokenav_main_menu.c | 10 +- src/pokenav_match_call_data.c | 2 +- src/pokenav_region_map.c | 2 +- src/region_map.c | 596 +++++++++--------- src/rotating_gate.c | 70 +- src/script_movement.c | 9 +- src/tileset_anims.c | 6 +- src/trade.c | 2 +- src/tv.c | 2 +- 42 files changed, 528 insertions(+), 534 deletions(-) diff --git a/data/scripts/gift_altering_cave.inc b/data/scripts/gift_altering_cave.inc index 65ff87068..0ea69aac0 100644 --- a/data/scripts/gift_altering_cave.inc +++ b/data/scripts/gift_altering_cave.inc @@ -12,7 +12,7 @@ MysteryGiftScript_AlteringCave_: release end -sText_MysteryGiftAlteringCave:: +sText_MysteryGiftAlteringCave: .string "Thank you for using the MYSTERY\n" .string "GIFT System.\p" .string "There appears to be a rumor about\n" diff --git a/data/text/pokedex_rating.inc b/data/text/pokedex_rating.inc index fcb26bc7d..175aaccc6 100644 --- a/data/text/pokedex_rating.inc +++ b/data/text/pokedex_rating.inc @@ -3,7 +3,7 @@ gBirchDexRatingText_AreYouCurious:: .string "Are you curious about how your\n" .string "POKéDEX is coming along?$" -gBirchDexRatingText_Cancel: +gBirchDexRatingText_Cancel:: .string "Hm? Oh, you haven't caught enough\n" .string "POKéMON to make it worthwhile.$" diff --git a/include/constants/battle.h b/include/constants/battle.h index d87a800e2..31bc7fa3f 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -319,7 +319,7 @@ #define B_WIN_TYPE_NORMAL 0 #define B_WIN_TYPE_ARENA 1 -// Window Ids for gStandardBattleWindowTemplates / gBattleArenaWindowTemplates +// Window Ids for sStandardBattleWindowTemplates / sBattleArenaWindowTemplates #define B_WIN_MSG 0 #define B_WIN_ACTION_PROMPT 1 // "What will {x} do?" #define B_WIN_ACTION_MENU 2 // "Fight/Pokémon/Bag/Run" menu diff --git a/include/constants/flags.h b/include/constants/flags.h index eacb2426d..8fbc24630 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1634,7 +1634,7 @@ #define FLAGS_COUNT (DAILY_FLAGS_END + 1) -// Special Flags (Stored in EWRAM (gSpecialFlags), not in the SaveBlock) +// Special Flags (Stored in EWRAM (sSpecialFlags), not in the SaveBlock) #define SPECIAL_FLAGS_START 0x4000 #define FLAG_HIDE_MAP_NAME_POPUP (SPECIAL_FLAGS_START + 0x0) #define FLAG_DONT_TRANSITION_MUSIC (SPECIAL_FLAGS_START + 0x1) diff --git a/include/contest.h b/include/contest.h index e7acb5a11..1168ebfe7 100644 --- a/include/contest.h +++ b/include/contest.h @@ -324,7 +324,6 @@ extern u16 gSpecialVar_ContestRank; extern u8 gNumLinkContestPlayers; extern u8 gHighestRibbonRank; extern struct ContestResources *gContestResources; -extern u8 sContestBgCopyFlags; extern struct ContestWinner gCurContestWinner; extern u8 gCurContestWinnerIsForArtist; extern u8 gCurContestWinnerSaveIdx; diff --git a/src/agb_flash_1m.c b/src/agb_flash_1m.c index e249fab9a..6fc4f3d60 100644 --- a/src/agb_flash_1m.c +++ b/src/agb_flash_1m.c @@ -3,7 +3,7 @@ static const char AgbLibFlashVersion[] = "FLASH1M_V103"; -const struct FlashSetupInfo * const sSetupInfos[] = +static const struct FlashSetupInfo * const sSetupInfos[] = { &MX29L010, &LE26FV10N1TS, diff --git a/src/battle_anim_dragon.c b/src/battle_anim_dragon.c index 029a5c30d..4badd5362 100644 --- a/src/battle_anim_dragon.c +++ b/src/battle_anim_dragon.c @@ -15,7 +15,7 @@ static void AnimOverheatFlame_Step(struct Sprite *); static void AnimTask_DragonDanceWaver_Step(u8); static void UpdateDragonDanceScanlineEffect(struct Task *); -EWRAM_DATA static u16 gUnusedOverheatData[7] = {0}; +EWRAM_DATA static u16 sUnusedOverheatData[7] = {0}; static const union AnimCmd sAnim_OutrageOverheatFire_0[] = { @@ -426,7 +426,7 @@ static void AnimOverheatFlame(struct Sprite *sprite) sprite->data[3] = gBattleAnimArgs[3]; sprite->callback = AnimOverheatFlame_Step; for (i = 0; i < 7; i++) - gUnusedOverheatData[i] = sprite->data[i]; + sUnusedOverheatData[i] = sprite->data[i]; } static void AnimOverheatFlame_Step(struct Sprite *sprite) diff --git a/src/battle_anim_status_effects.c b/src/battle_anim_status_effects.c index 9be3d65dc..47ba00c90 100644 --- a/src/battle_anim_status_effects.c +++ b/src/battle_anim_status_effects.c @@ -248,7 +248,7 @@ static const struct SubspriteTable sFrozenIceCubeSubspriteTable[] = {ARRAY_COUNT(sFrozenIceCubeSubsprites), sFrozenIceCubeSubsprites}, }; -static const struct SpriteTemplate gFrozenIceCubeSpriteTemplate = +static const struct SpriteTemplate sFrozenIceCubeSpriteTemplate = { .tileTag = ANIM_TAG_ICE_CUBE, .paletteTag = ANIM_TAG_ICE_CUBE, @@ -389,7 +389,7 @@ void AnimTask_FrozenIceCube(u8 taskId) x -= 6; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); - spriteId = CreateSprite(&gFrozenIceCubeSpriteTemplate, x, y, 4); + spriteId = CreateSprite(&sFrozenIceCubeSpriteTemplate, x, y, 4); if (GetSpriteTileStartByTag(ANIM_TAG_ICE_CUBE) == 0xFFFF) gSprites[spriteId].invisible = TRUE; SetSubspriteTables(&gSprites[spriteId], sFrozenIceCubeSubspriteTable); diff --git a/src/battle_bg.c b/src/battle_bg.c index f739a002f..ed32c009c 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -159,7 +159,7 @@ const struct BgTemplate gBattleBgTemplates[] = }, }; -static const struct WindowTemplate gStandardBattleWindowTemplates[] = +static const struct WindowTemplate sStandardBattleWindowTemplates[] = { [B_WIN_MSG] = { .bg = 0, @@ -380,7 +380,7 @@ static const struct WindowTemplate gStandardBattleWindowTemplates[] = DUMMY_WIN_TEMPLATE }; -static const struct WindowTemplate gBattleArenaWindowTemplates[] = +static const struct WindowTemplate sBattleArenaWindowTemplates[] = { [B_WIN_MSG] = { .bg = 0, @@ -594,8 +594,8 @@ static const struct WindowTemplate gBattleArenaWindowTemplates[] = const struct WindowTemplate * const gBattleWindowTemplates[] = { - [B_WIN_TYPE_NORMAL] = gStandardBattleWindowTemplates, - [B_WIN_TYPE_ARENA] = gBattleArenaWindowTemplates, + [B_WIN_TYPE_NORMAL] = sStandardBattleWindowTemplates, + [B_WIN_TYPE_ARENA] = sBattleArenaWindowTemplates, }; static const struct BattleBackground sBattleTerrainTable[] = diff --git a/src/battle_tower.c b/src/battle_tower.c index 989412e9e..e652038ac 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -687,7 +687,7 @@ struct { u32 facilityClass; const u8 *const *strings; -} const sPartnerTrainerTextTables[] = +} static const sPartnerTrainerTextTables[] = { {FACILITY_CLASS_LASS, sPartnerTextsLass}, {FACILITY_CLASS_YOUNGSTER, sPartnerTextsYoungster}, @@ -769,7 +769,7 @@ struct u8 nature; u8 evs[NUM_STATS]; u16 moves[MAX_MON_MOVES]; -} const sStevenMons[MULTI_PARTY_SIZE] = +} static const sStevenMons[MULTI_PARTY_SIZE] = { { .species = SPECIES_METANG, diff --git a/src/coins.c b/src/coins.c index 17fd147b7..4c4739999 100644 --- a/src/coins.c +++ b/src/coins.c @@ -8,7 +8,7 @@ #include "international_string_util.h" #include "constants/coins.h" -EWRAM_DATA u8 sCoinsWindowId = 0; +static EWRAM_DATA u8 sCoinsWindowId = 0; void PrintCoinsString(u32 coinAmount) { diff --git a/src/contest.c b/src/contest.c index ced9f90cd..091d7fb63 100644 --- a/src/contest.c +++ b/src/contest.c @@ -352,7 +352,7 @@ EWRAM_DATA u16 gSpecialVar_ContestRank = 0; EWRAM_DATA u8 gNumLinkContestPlayers = 0; EWRAM_DATA u8 gHighestRibbonRank = 0; EWRAM_DATA struct ContestResources *gContestResources = NULL; -EWRAM_DATA u8 sContestBgCopyFlags = 0; +static EWRAM_DATA u8 sContestBgCopyFlags = 0; EWRAM_DATA struct ContestWinner gCurContestWinner = {0}; EWRAM_DATA bool8 gCurContestWinnerIsForArtist = 0; EWRAM_DATA u8 gCurContestWinnerSaveIdx = 0; @@ -625,7 +625,7 @@ static const struct SpriteTemplate sSpriteTemplate_ApplauseMeter = .callback = SpriteCallbackDummy }; -const struct OamData sOam_Judge = +static const struct OamData sOam_Judge = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -639,7 +639,7 @@ const struct OamData sOam_Judge = .paletteNum = 2, }; -const struct SpriteTemplate sSpriteTemplate_Judge = +static const struct SpriteTemplate sSpriteTemplate_Judge = { .tileTag = TAG_JUDGE, .paletteTag = TAG_JUDGE, @@ -650,7 +650,7 @@ const struct SpriteTemplate sSpriteTemplate_Judge = .callback = SpriteCallbackDummy }; -const struct CompressedSpriteSheet sSpriteSheet_Judge = +static const struct CompressedSpriteSheet sSpriteSheet_Judge = { .data = gContestJudgeGfx, .size = 0x800, @@ -664,13 +664,13 @@ static const struct CompressedSpriteSheet sSpriteSheet_JudgeSymbols = .tag = TAG_JUDGE_SYMBOLS_GFX }; -const struct CompressedSpritePalette sSpritePalette_JudgeSymbols = +static const struct CompressedSpritePalette sSpritePalette_JudgeSymbols = { .data = gContestJudgeSymbolsPal, .tag = TAG_CONTEST_SYMBOLS_PAL }; -const struct SpriteTemplate sSpriteTemplate_JudgeSpeechBubble = +static const struct SpriteTemplate sSpriteTemplate_JudgeSpeechBubble = { .tileTag = TAG_JUDGE_SYMBOLS_GFX, .paletteTag = TAG_CONTEST_SYMBOLS_PAL, @@ -876,7 +876,7 @@ static const struct SpritePalette sSpritePalettes_ContestantsTurnBlinkEffect[CON } }; -const struct OamData sOam_ContestantsTurnBlinkEffect = +static const struct OamData sOam_ContestantsTurnBlinkEffect = { .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, @@ -891,13 +891,13 @@ const struct OamData sOam_ContestantsTurnBlinkEffect = .affineParam = 0, }; -const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_0[] = +static const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_0[] = { AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), AFFINEANIMCMD_END }; -const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] = +static const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] = { AFFINEANIMCMD_FRAME(3, 3, 0, 15), AFFINEANIMCMD_FRAME(-3, -3, 0, 15), @@ -906,13 +906,13 @@ const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] = AFFINEANIMCMD_END }; -const union AffineAnimCmd *const sAffineAnims_ContestantsTurnBlinkEffect[] = +static const union AffineAnimCmd *const sAffineAnims_ContestantsTurnBlinkEffect[] = { sAffineAnim_ContestantsTurnBlinkEffect_0, sAffineAnim_ContestantsTurnBlinkEffect_1 }; -const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] = +static const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] = { { .tileTag = TAG_BLINK_EFFECT_CONTESTANT0, @@ -952,7 +952,7 @@ const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTA } }; -static const s8 gContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGORIES_COUNT] = +static const s8 sContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGORIES_COUNT] = { [CONTEST_CATEGORY_COOL] = { [CONTEST_CATEGORY_COOL] = +1, @@ -4744,7 +4744,7 @@ static void UpdateApplauseMeter(void) s8 Contest_GetMoveExcitement(u16 move) { - return gContestExcitementTable[gSpecialVar_ContestCategory][gContestMoves[move].contestCategory]; + return sContestExcitementTable[gSpecialVar_ContestCategory][gContestMoves[move].contestCategory]; } static u8 StartApplauseOverflowAnimation(void) diff --git a/src/data/field_effects/field_effect_objects.h b/src/data/field_effects/field_effect_objects.h index 598b88932..938b6bfc5 100755 --- a/src/data/field_effects/field_effect_objects.h +++ b/src/data/field_effects/field_effect_objects.h @@ -1272,7 +1272,7 @@ static const union AnimCmd *const sAnimTable_RayquazaSpotlightEffect[] = { sAnim_RayquazaSpotlightEffect, }; -const struct SpriteFrameImage sPicTable_RayquazaSpotlightEffect[] = { +static const struct SpriteFrameImage sPicTable_RayquazaSpotlightEffect[] = { overworld_frame(gObjectEventPic_Rayquaza, 4, 4, 0), }; diff --git a/src/data/trade.h b/src/data/trade.h index b26072763..80d17a49b 100644 --- a/src/data/trade.h +++ b/src/data/trade.h @@ -174,10 +174,10 @@ static const struct SpriteTemplate sSpriteTemplate_MenuText = .callback = SpriteCallbackDummy, }; -static const u16 TradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal"); -static const struct SpritePalette gSpritePalette_TradeScreenText = +static const u16 sTradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal"); +static const struct SpritePalette sSpritePalette_TradeScreenText = { - .data = TradeScreenTextPalette, + .data = sTradeScreenTextPalette, .tag = PALTAG_MENU_TEXT }; diff --git a/src/data/trainer_graphics/back_pic_anims.h b/src/data/trainer_graphics/back_pic_anims.h index 821039cb3..ed12e0cb4 100644 --- a/src/data/trainer_graphics/back_pic_anims.h +++ b/src/data/trainer_graphics/back_pic_anims.h @@ -1,4 +1,4 @@ -static const union AnimCmd gAnimCmd_Brendan_1[] = +static const union AnimCmd sAnimCmd_Brendan_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -8,7 +8,7 @@ static const union AnimCmd gAnimCmd_Brendan_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_May_Steven_1[] = +static const union AnimCmd sAnimCmd_May_Steven_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -18,7 +18,7 @@ static const union AnimCmd gAnimCmd_May_Steven_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_Wally_1[] = +static const union AnimCmd sAnimCmd_Wally_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -28,7 +28,7 @@ static const union AnimCmd gAnimCmd_Wally_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_Red_1[] = +static const union AnimCmd sAnimCmd_Red_1[] = { ANIMCMD_FRAME(1, 20), ANIMCMD_FRAME(2, 6), @@ -38,7 +38,7 @@ static const union AnimCmd gAnimCmd_Red_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_Leaf_1[] = +static const union AnimCmd sAnimCmd_Leaf_1[] = { ANIMCMD_FRAME(1, 20), ANIMCMD_FRAME(2, 6), @@ -48,7 +48,7 @@ static const union AnimCmd gAnimCmd_Leaf_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_RubySapphireBrendan_1[] = +static const union AnimCmd sAnimCmd_RubySapphireBrendan_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -58,7 +58,7 @@ static const union AnimCmd gAnimCmd_RubySapphireBrendan_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_RubySapphireMay_1[] = +static const union AnimCmd sAnimCmd_RubySapphireMay_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -71,49 +71,49 @@ static const union AnimCmd gAnimCmd_RubySapphireMay_1[] = static const union AnimCmd *const sBackAnims_Brendan[] = { sAnim_GeneralFrame3, - gAnimCmd_Brendan_1, + sAnimCmd_Brendan_1, }; static const union AnimCmd *const sBackAnims_May[] = { sAnim_GeneralFrame3, - gAnimCmd_May_Steven_1, + sAnimCmd_May_Steven_1, }; static const union AnimCmd *const sBackAnims_Red[] = { sAnim_GeneralFrame0, - gAnimCmd_Red_1, + sAnimCmd_Red_1, }; static const union AnimCmd *const sBackAnims_Leaf[] = { sAnim_GeneralFrame0, - gAnimCmd_Leaf_1, + sAnimCmd_Leaf_1, }; static const union AnimCmd *const sBackAnims_RubySapphireBrendan[] = { sAnim_GeneralFrame3, - gAnimCmd_RubySapphireBrendan_1, + sAnimCmd_RubySapphireBrendan_1, }; static const union AnimCmd *const sBackAnims_RubySapphireMay[] = { sAnim_GeneralFrame3, - gAnimCmd_RubySapphireMay_1, + sAnimCmd_RubySapphireMay_1, }; static const union AnimCmd *const sBackAnims_Wally[] = { sAnim_GeneralFrame3, - gAnimCmd_Wally_1, + sAnimCmd_Wally_1, }; static const union AnimCmd *const sBackAnims_Steven[] = { sAnim_GeneralFrame3, - gAnimCmd_May_Steven_1, + sAnimCmd_May_Steven_1, }; const union AnimCmd *const *const gTrainerBackAnimsPtrTable[] = diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 691ca6b2a..80cdd8126 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -4546,7 +4546,7 @@ struct { u8 id; void (*func)(void); -} const sGfxFuncs[] = +} static const sGfxFuncs[] = { {GFXFUNC_LOAD, LoadGfx}, // Element not used, LoadGfx is passed directly to SetGfxFunc {GFXFUNC_SHOW_NAMES, ShowNames}, diff --git a/src/event_data.c b/src/event_data.c index e2af6c3d0..22ebdb0d1 100644 --- a/src/event_data.c +++ b/src/event_data.c @@ -30,7 +30,7 @@ EWRAM_DATA u16 gSpecialVar_Facing = 0; EWRAM_DATA u16 gSpecialVar_MonBoxId = 0; EWRAM_DATA u16 gSpecialVar_MonBoxPos = 0; EWRAM_DATA u16 gSpecialVar_Unused_0x8014 = 0; -EWRAM_DATA static u8 gSpecialFlags[SPECIAL_FLAGS_SIZE] = {0}; +EWRAM_DATA static u8 sSpecialFlags[SPECIAL_FLAGS_SIZE] = {0}; extern u16 *const gSpecialVars[]; @@ -38,7 +38,7 @@ void InitEventData(void) { memset(gSaveBlock1Ptr->flags, 0, sizeof(gSaveBlock1Ptr->flags)); memset(gSaveBlock1Ptr->vars, 0, sizeof(gSaveBlock1Ptr->vars)); - memset(gSpecialFlags, 0, sizeof(gSpecialFlags)); + memset(sSpecialFlags, 0, sizeof(sSpecialFlags)); } void ClearTempFieldEventData(void) @@ -205,7 +205,7 @@ u8 *GetFlagPointer(u16 id) else if (id < SPECIAL_FLAGS_START) return &gSaveBlock1Ptr->flags[id / 8]; else - return &gSpecialFlags[(id - SPECIAL_FLAGS_START) / 8]; + return &sSpecialFlags[(id - SPECIAL_FLAGS_START) / 8]; } u8 FlagSet(u16 id) diff --git a/src/field_effect.c b/src/field_effect.c index f57ce8cdd..369239f6b 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -481,13 +481,13 @@ static const struct Subsprite sSubsprites_HofMonitorBig[] = static const struct SubspriteTable sSubspriteTable_HofMonitorBig = subsprite_table(sSubsprites_HofMonitorBig); -const union AnimCmd sAnim_Static[] = +static const union AnimCmd sAnim_Static[] = { ANIMCMD_FRAME(.imageValue = 0, .duration = 1), ANIMCMD_JUMP(0) }; -const union AnimCmd sAnim_Flicker[] = +static const union AnimCmd sAnim_Flicker[] = { ANIMCMD_FRAME(.imageValue = 0, .duration = 16), ANIMCMD_FRAME(.imageValue = 1, .duration = 16), @@ -501,7 +501,7 @@ const union AnimCmd sAnim_Flicker[] = }; // Flicker on and off, for the Pokéballs / monitors during the PokéCenter heal effect -const union AnimCmd *const sAnims_Flicker[] = +static const union AnimCmd *const sAnims_Flicker[] = { sAnim_Static, sAnim_Flicker @@ -556,7 +556,7 @@ static const struct SpriteTemplate sSpriteTemplate_HofMonitorSmall = .callback = SpriteCB_HallOfFameMonitor }; -void (*const sPokecenterHealEffectFuncs[])(struct Task *) = +static void (*const sPokecenterHealEffectFuncs[])(struct Task *) = { PokecenterHealEffect_Init, PokecenterHealEffect_WaitForBallPlacement, @@ -564,7 +564,7 @@ void (*const sPokecenterHealEffectFuncs[])(struct Task *) = PokecenterHealEffect_WaitForSoundAndEnd }; -void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) = +static void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) = { HallOfFameRecordEffect_Init, HallOfFameRecordEffect_WaitForBallPlacement, @@ -572,7 +572,7 @@ void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) = HallOfFameRecordEffect_WaitForSoundAndEnd }; -void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) = +static void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) = { PokeballGlowEffect_PlaceBalls, PokeballGlowEffect_TryPlaySe, @@ -598,7 +598,7 @@ static const u8 sPokeballGlowReds[] = {16, 12, 8, 0}; static const u8 sPokeballGlowGreens[] = {16, 12, 8, 0}; static const u8 sPokeballGlowBlues[] = { 0, 0, 0, 0}; -bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) = +static bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) = { FallWarpEffect_Init, FallWarpEffect_WaitWeather, @@ -609,7 +609,7 @@ bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) = FallWarpEffect_End, }; -bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) = +static bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) = { EscalatorWarpOut_Init, EscalatorWarpOut_WaitForPlayer, @@ -619,7 +619,7 @@ bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) = EscalatorWarpOut_Down_End, }; -bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) = +static bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) = { EscalatorWarpIn_Init, EscalatorWarpIn_Down_Init, @@ -630,7 +630,7 @@ bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) = EscalatorWarpIn_End, }; -bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) = +static bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) = { WaterfallFieldEffect_Init, WaterfallFieldEffect_ShowMon, @@ -639,14 +639,14 @@ bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) WaterfallFieldEffect_ContinueRideOrEnd, }; -bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) = +static bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) = { DiveFieldEffect_Init, DiveFieldEffect_ShowMon, DiveFieldEffect_TryWarp, }; -bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = +static bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { LavaridgeGymB1FWarpEffect_Init, LavaridgeGymB1FWarpEffect_CameraShake, @@ -656,7 +656,7 @@ bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEve LavaridgeGymB1FWarpEffect_Warp, }; -bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = +static bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { LavaridgeGymB1FWarpExitEffect_Init, LavaridgeGymB1FWarpExitEffect_StartPopOut, @@ -664,7 +664,7 @@ bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct Objec LavaridgeGymB1FWarpExitEffect_End, }; -bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = +static bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { LavaridgeGym1FWarpEffect_Init, LavaridgeGym1FWarpEffect_AshPuff, @@ -673,7 +673,7 @@ bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEven LavaridgeGym1FWarpEffect_Warp, }; -void (*const sEscapeRopeWarpOutEffectFuncs[])(struct Task *) = +static void (*const sEscapeRopeWarpOutEffectFuncs[])(struct Task *) = { EscapeRopeWarpOutEffect_Init, EscapeRopeWarpOutEffect_Spin, @@ -2277,7 +2277,7 @@ static void EscapeRopeWarpOutEffect_Spin(struct Task *task) } } -void (*const sEscapeRopeWarpInEffectFuncs[])(struct Task *) = { +static void (*const sEscapeRopeWarpInEffectFuncs[])(struct Task *) = { EscapeRopeWarpInEffect_Init, EscapeRopeWarpInEffect_Spin }; @@ -2448,7 +2448,7 @@ static void FieldCallback_TeleportWarpIn(void) CreateTask(Task_TeleportWarpIn, 0); } -void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = { +static void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = { TeleportWarpInFieldEffect_Init, TeleportWarpInFieldEffect_SpinEnter, TeleportWarpInFieldEffect_SpinGround @@ -2582,7 +2582,7 @@ bool8 FldEff_FieldMoveShowMonInit(void) return FALSE; } -void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = { +static void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = { FieldMoveShowMonOutdoorsEffect_Init, FieldMoveShowMonOutdoorsEffect_LoadGfx, FieldMoveShowMonOutdoorsEffect_CreateBanner, @@ -2750,7 +2750,7 @@ static void LoadFieldMoveOutdoorStreaksTilemap(u16 offs) #define tBgOffset data[4] #define tMonSpriteId data[15] -void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = { +static void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = { FieldMoveShowMonIndoorsEffect_Init, FieldMoveShowMonIndoorsEffect_LoadGfx, FieldMoveShowMonIndoorsEffect_SlideBannerOn, @@ -2978,7 +2978,7 @@ u8 FldEff_UseSurf(void) return FALSE; } -void (*const sSurfFieldEffectFuncs[])(struct Task *) = { +static void (*const sSurfFieldEffectFuncs[])(struct Task *) = { SurfFieldEffect_Init, SurfFieldEffect_FieldMovePose, SurfFieldEffect_ShowMon, @@ -3154,7 +3154,7 @@ u8 FldEff_UseFly(void) return 0; } -void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = { +static void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = { FlyOutFieldEffect_FieldMovePose, FlyOutFieldEffect_ShowMon, FlyOutFieldEffect_BirdLeaveBall, @@ -3444,7 +3444,7 @@ u8 FldEff_FlyIn(void) return 0; } -void (*const sFlyInFieldEffectFuncs[])(struct Task *) = { +static void (*const sFlyInFieldEffectFuncs[])(struct Task *) = { FlyInFieldEffect_BirdSwoopDown, FlyInFieldEffect_FlyInWithBird, FlyInFieldEffect_JumpOffBird, @@ -3675,7 +3675,7 @@ static void StartEndingDeoxysRockCameraShake(u8 taskId) #undef tEndDelay #undef tEnding -void (*const sDestroyDeoxysRockEffectFuncs[])(s16*, u8) = { +static void (*const sDestroyDeoxysRockEffectFuncs[])(s16*, u8) = { DestroyDeoxysRockEffect_CameraShake, DestroyDeoxysRockEffect_RockFragments, DestroyDeoxysRockEffect_WaitAndEnd, diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index eda146725..77978c269 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -53,7 +53,7 @@ static void Task_EnableScriptAfterMusicFade(u8 taskId); static const u16 sFlashLevelToRadius[] = { 200, 72, 64, 56, 48, 40, 32, 24, 0 }; const s32 gMaxFlashLevel = ARRAY_COUNT(sFlashLevelToRadius) - 1; -const struct ScanlineEffectParams sFlashEffectParams = +static const struct ScanlineEffectParams sFlashEffectParams = { ®_WIN0H, ((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_DEST_RELOAD) << 16) | 1, diff --git a/src/field_special_scene.c b/src/field_special_scene.c index d8b9eb05d..da7e4ed7d 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -31,7 +31,7 @@ enum }; //. rodata -static const s8 gTruckCamera_HorizontalTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, -1, -1, -1, 0}; +static const s8 sTruckCamera_HorizontalTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, -1, -1, -1, 0}; static const u8 sSSTidalSailEastMovementScript[] = { @@ -109,10 +109,10 @@ void Task_Truck2(u8 taskId) } else { - if (gTruckCamera_HorizontalTable[data[1]] == 2) + if (sTruckCamera_HorizontalTable[data[1]] == 2) gTasks[taskId].func = Task_Truck3; - cameraXpan = gTruckCamera_HorizontalTable[data[1]]; + cameraXpan = sTruckCamera_HorizontalTable[data[1]]; cameraYpan = GetTruckCameraBobbingY(data[2]); SetCameraPanning(cameraXpan, cameraYpan); box1 = GetTruckBoxMovement(data[2] + 30) * 4; @@ -144,7 +144,7 @@ static void Task_Truck3(u8 taskId) } else { - cameraXpan = gTruckCamera_HorizontalTable[data[1]]; + cameraXpan = sTruckCamera_HorizontalTable[data[1]]; cameraYpan = 0; SetCameraPanning(cameraXpan, 0); SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, cameraYpan + 3); diff --git a/src/field_weather.c b/src/field_weather.c index cd3436441..0f203bd24 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -72,7 +72,7 @@ static const u8 *sPaletteGammaTypes; // The drought weather effect uses a precalculated color lookup table. Presumably this // is because the underlying color shift calculation is slow. -const u16 sDroughtWeatherColors[][0x1000] = { +static const u16 sDroughtWeatherColors[][0x1000] = { INCBIN_U16("graphics/weather/drought/colors_0.bin"), INCBIN_U16("graphics/weather/drought/colors_1.bin"), INCBIN_U16("graphics/weather/drought/colors_2.bin"), diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 2b87557c2..94c41a613 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -15,8 +15,8 @@ #include "gpu_regs.h" // EWRAM -EWRAM_DATA static u8 gCurrentAbnormalWeather = 0; -EWRAM_DATA static u16 gUnusedWeatherRelated = 0; +EWRAM_DATA static u8 sCurrentAbnormalWeather = 0; +EWRAM_DATA static u16 sUnusedWeatherRelated = 0; // CONST const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal"); @@ -1815,7 +1815,7 @@ static void UpdateFogDiagonalMovement(void) gWeatherPtr->fogDPosY = gSpriteCoordOffsetY + gWeatherPtr->fogDYOffset; } -static const struct SpriteSheet gFogDiagonalSpriteSheet = +static const struct SpriteSheet sFogDiagonalSpriteSheet = { .data = gWeatherFogDiagonalTiles, .size = sizeof(gWeatherFogDiagonalTiles), @@ -1870,7 +1870,7 @@ static void CreateFogDiagonalSprites(void) if (!gWeatherPtr->fogDSpritesCreated) { - fogDiagonalSpriteSheet = gFogDiagonalSpriteSheet; + fogDiagonalSpriteSheet = sFogDiagonalSpriteSheet; LoadSpriteSheet(&fogDiagonalSpriteSheet); for (i = 0; i < NUM_FOG_DIAGONAL_SPRITES; i++) { @@ -2429,8 +2429,8 @@ static void UpdateBubbleSprite(struct Sprite *sprite) // Unused function. static void UnusedSetCurrentAbnormalWeather(u32 a0, u32 a1) { - gCurrentAbnormalWeather = a0; - gUnusedWeatherRelated = a1; + sCurrentAbnormalWeather = a0; + sUnusedWeatherRelated = a1; } static void Task_DoAbnormalWeather(u8 taskId) @@ -2443,7 +2443,7 @@ static void Task_DoAbnormalWeather(u8 taskId) if (data[15]-- <= 0) { SetNextWeather(data[1]); - gCurrentAbnormalWeather = data[1]; + sCurrentAbnormalWeather = data[1]; data[15] = 600; data[0]++; } @@ -2452,7 +2452,7 @@ static void Task_DoAbnormalWeather(u8 taskId) if (data[15]-- <= 0) { SetNextWeather(data[2]); - gCurrentAbnormalWeather = data[2]; + sCurrentAbnormalWeather = data[2]; data[15] = 600; data[0] = 0; } @@ -2466,19 +2466,19 @@ static void CreateAbnormalWeatherTask(void) s16 *data = gTasks[taskId].data; data[15] = 600; - if (gCurrentAbnormalWeather == WEATHER_DOWNPOUR) + if (sCurrentAbnormalWeather == WEATHER_DOWNPOUR) { data[1] = WEATHER_DROUGHT; data[2] = WEATHER_DOWNPOUR; } - else if (gCurrentAbnormalWeather == WEATHER_DROUGHT) + else if (sCurrentAbnormalWeather == WEATHER_DROUGHT) { data[1] = WEATHER_DOWNPOUR; data[2] = WEATHER_DROUGHT; } else { - gCurrentAbnormalWeather = WEATHER_DOWNPOUR; + sCurrentAbnormalWeather = WEATHER_DOWNPOUR; data[1] = WEATHER_DROUGHT; data[2] = WEATHER_DOWNPOUR; } @@ -2526,13 +2526,13 @@ void DoCurrentWeather(void) { if (!FuncIsActiveTask(Task_DoAbnormalWeather)) CreateAbnormalWeatherTask(); - weather = gCurrentAbnormalWeather; + weather = sCurrentAbnormalWeather; } else { if (FuncIsActiveTask(Task_DoAbnormalWeather)) DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather)); - gCurrentAbnormalWeather = WEATHER_DOWNPOUR; + sCurrentAbnormalWeather = WEATHER_DOWNPOUR; } SetNextWeather(weather); } @@ -2545,13 +2545,13 @@ void ResumePausedWeather(void) { if (!FuncIsActiveTask(Task_DoAbnormalWeather)) CreateAbnormalWeatherTask(); - weather = gCurrentAbnormalWeather; + weather = sCurrentAbnormalWeather; } else { if (FuncIsActiveTask(Task_DoAbnormalWeather)) DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather)); - gCurrentAbnormalWeather = WEATHER_DOWNPOUR; + sCurrentAbnormalWeather = WEATHER_DOWNPOUR; } SetCurrentAndNextWeather(weather); } diff --git a/src/fieldmap.c b/src/fieldmap.c index 4dbf981cf..a02355e72 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -25,10 +25,10 @@ struct ConnectionFlags u8 east:1; }; -EWRAM_DATA static u16 gBackupMapData[MAX_MAP_DATA_SIZE] = {0}; +EWRAM_DATA static u16 sBackupMapData[MAX_MAP_DATA_SIZE] = {0}; EWRAM_DATA struct MapHeader gMapHeader = {0}; EWRAM_DATA struct Camera gCamera = {0}; -EWRAM_DATA static struct ConnectionFlags gMapConnectionFlags = {0}; +EWRAM_DATA static struct ConnectionFlags sMapConnectionFlags = {0}; EWRAM_DATA static u32 sFiller = 0; // without this, the next file won't align properly struct BackupMapLayout gBackupMapLayout; @@ -87,14 +87,14 @@ void InitMapFromSavedGame(void) void InitBattlePyramidMap(bool8 setPlayerPosition) { - CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData)); - GenerateBattlePyramidFloorLayout(gBackupMapData, setPlayerPosition); + CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); + GenerateBattlePyramidFloorLayout(sBackupMapData, setPlayerPosition); } void InitTrainerHillMap(void) { - CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData)); - GenerateTrainerHillFloorLayout(gBackupMapData); + CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); + GenerateTrainerHillFloorLayout(sBackupMapData); } static void InitMapLayoutData(struct MapHeader *mapHeader) @@ -103,8 +103,8 @@ static void InitMapLayoutData(struct MapHeader *mapHeader) int width; int height; mapLayout = mapHeader->mapLayout; - CpuFastFill16(MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData)); - gBackupMapLayout.map = gBackupMapData; + CpuFastFill16(MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); + gBackupMapLayout.map = sBackupMapData; width = mapLayout->width + MAP_OFFSET_W; gBackupMapLayout.width = width; height = mapLayout->height + MAP_OFFSET_H; @@ -140,7 +140,7 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader) { count = mapHeader->connections->count; connection = mapHeader->connections->connections; - gMapConnectionFlags = sDummyConnectionFlags; + sMapConnectionFlags = sDummyConnectionFlags; for (i = 0; i < count; i++, connection++) { struct MapHeader const *cMap = GetMapHeaderFromConnection(connection); @@ -149,19 +149,19 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader) { case CONNECTION_SOUTH: FillSouthConnection(mapHeader, cMap, offset); - gMapConnectionFlags.south = TRUE; + sMapConnectionFlags.south = TRUE; break; case CONNECTION_NORTH: FillNorthConnection(mapHeader, cMap, offset); - gMapConnectionFlags.north = TRUE; + sMapConnectionFlags.north = TRUE; break; case CONNECTION_WEST: FillWestConnection(mapHeader, cMap, offset); - gMapConnectionFlags.west = TRUE; + sMapConnectionFlags.west = TRUE; break; case CONNECTION_EAST: FillEastConnection(mapHeader, cMap, offset); - gMapConnectionFlags.east = TRUE; + sMapConnectionFlags.east = TRUE; break; } } @@ -436,7 +436,7 @@ void SaveMapView(void) for (i = y; i < y + MAP_OFFSET_H; i++) { for (j = x; j < x + MAP_OFFSET_W; j++) - *mapView++ = gBackupMapData[width * i + j]; + *mapView++ = sBackupMapData[width * i + j]; } } @@ -491,8 +491,8 @@ static void LoadSavedMapView(void) for (j = x; j < x + MAP_OFFSET_W; j++) { - if (!SkipCopyingMetatileFromSavedMap(&gBackupMapData[j + width * i], width, yMode)) - gBackupMapData[j + width * i] = *mapView; + if (!SkipCopyingMetatileFromSavedMap(&sBackupMapData[j + width * i], width, yMode)) + sBackupMapData[j + width * i] = *mapView; mapView++; } } @@ -554,7 +554,7 @@ static void MoveMapViewToBackup(u8 direction) desti = width * (y + y0); srci = (y + r8) * MAP_OFFSET_W + r9; src = &mapView[srci + i]; - dest = &gBackupMapData[x0 + desti + j]; + dest = &sBackupMapData[x0 + desti + j]; *dest = *src; i++; j++; @@ -570,28 +570,28 @@ int GetMapBorderIdAt(int x, int y) if (x >= (gBackupMapLayout.width - (MAP_OFFSET + 1))) { - if (!gMapConnectionFlags.east) + if (!sMapConnectionFlags.east) return CONNECTION_INVALID; return CONNECTION_EAST; } else if (x < MAP_OFFSET) { - if (!gMapConnectionFlags.west) + if (!sMapConnectionFlags.west) return CONNECTION_INVALID; return CONNECTION_WEST; } else if (y >= (gBackupMapLayout.height - MAP_OFFSET)) { - if (!gMapConnectionFlags.south) + if (!sMapConnectionFlags.south) return CONNECTION_INVALID; return CONNECTION_SOUTH; } else if (y < MAP_OFFSET) { - if (!gMapConnectionFlags.north) + if (!sMapConnectionFlags.north) return CONNECTION_INVALID; return CONNECTION_NORTH; diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index a5c265f90..b1e163499 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -35,8 +35,8 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite); // static const rom data static const u16 sRotatingBall_Pal[] = INCBIN_U16("graphics/bag/rotating_ball.gbapal"); static const u8 sRotatingBall_Gfx[] = INCBIN_U8("graphics/bag/rotating_ball.4bpp"); -static const u8 gCherryUnused[] = INCBIN_U8("graphics/unused/cherry.4bpp"); -static const u16 gCherryUnused_Pal[] = INCBIN_U16("graphics/unused/cherry.gbapal"); +static const u8 sCherryUnused[] = INCBIN_U8("graphics/unused/cherry.4bpp"); +static const u16 sCherryUnused_Pal[] = INCBIN_U16("graphics/unused/cherry.gbapal"); static const struct OamData sBagOamData = { @@ -269,7 +269,7 @@ static const struct SpriteFrameImage sBerryPicSpriteImageTable[] = {&gDecompressionBuffer[0], 0x800}, }; -static const struct SpriteTemplate gBerryPicSpriteTemplate = +static const struct SpriteTemplate sBerryPicSpriteTemplate = { .tileTag = TAG_NONE, .paletteTag = TAG_BERRY_PIC_PAL, @@ -308,7 +308,7 @@ static const union AffineAnimCmd *const sBerryPicRotatingAnimCmds[] = sSpriteAffineAnim_BerryPicRotation2 }; -static const struct SpriteTemplate gBerryPicRotatingSpriteTemplate = +static const struct SpriteTemplate sBerryPicRotatingSpriteTemplate = { .tileTag = TAG_NONE, .paletteTag = TAG_BERRY_PIC_PAL, @@ -404,7 +404,7 @@ static const union AnimCmd *const sBerryCheckCircleSpriteAnimTable[] = sSpriteAnim_BerryCheckCircle }; -static const struct SpriteTemplate gBerryCheckCircleSpriteTemplate = +static const struct SpriteTemplate sBerryCheckCircleSpriteTemplate = { .tileTag = TAG_BERRY_CHECK_CIRCLE_GFX, .paletteTag = TAG_BERRY_CHECK_CIRCLE_GFX, @@ -609,7 +609,7 @@ static void LoadBerryGfx(u8 berryId) u8 CreateBerryTagSprite(u8 id, s16 x, s16 y) { LoadBerryGfx(id); - return CreateSprite(&gBerryPicSpriteTemplate, x, y, 0); + return CreateSprite(&sBerryPicSpriteTemplate, x, y, 0); } void FreeBerryTagSpritePalette(void) @@ -624,7 +624,7 @@ u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine) FreeSpritePaletteByTag(TAG_BERRY_PIC_PAL); LoadBerryGfx(berryId); - spriteId = CreateSprite(&gBerryPicRotatingSpriteTemplate, x, y, 0); + spriteId = CreateSprite(&sBerryPicRotatingSpriteTemplate, x, y, 0); if (startAffine == TRUE) StartSpriteAffineAnim(&gSprites[spriteId], 1); @@ -633,5 +633,5 @@ u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine) u8 CreateBerryFlavorCircleSprite(s16 x) { - return CreateSprite(&gBerryCheckCircleSpriteTemplate, x, 116, 0); + return CreateSprite(&sBerryCheckCircleSpriteTemplate, x, 116, 0); } diff --git a/src/landmark.c b/src/landmark.c index 52d52500a..615a9bfe3 100644 --- a/src/landmark.c +++ b/src/landmark.c @@ -336,7 +336,7 @@ static const struct Landmark *const Landmarks_MtChimney_2[] = NULL, }; -static const struct LandmarkList gLandmarkLists[] = +static const struct LandmarkList sLandmarkLists[] = { {MAPSEC_ROUTE_103, 2, Landmarks_Route103_2}, {MAPSEC_ROUTE_104, 0, Landmarks_Route104_0}, @@ -420,21 +420,21 @@ static const struct Landmark *const *GetLandmarks(u8 mapSection, u8 id) { u16 i = 0; - for (; gLandmarkLists[i].mapSection != MAPSEC_NONE; i++) + for (; sLandmarkLists[i].mapSection != MAPSEC_NONE; i++) { - if (gLandmarkLists[i].mapSection > mapSection) + if (sLandmarkLists[i].mapSection > mapSection) return NULL; - if (gLandmarkLists[i].mapSection == mapSection) + if (sLandmarkLists[i].mapSection == mapSection) break; } - if (gLandmarkLists[i].mapSection == MAPSEC_NONE) + if (sLandmarkLists[i].mapSection == MAPSEC_NONE) return NULL; - for (; gLandmarkLists[i].mapSection == mapSection; i++) + for (; sLandmarkLists[i].mapSection == mapSection; i++) { - if (gLandmarkLists[i].id == id) - return gLandmarkLists[i].landmarks; + if (sLandmarkLists[i].id == id) + return sLandmarkLists[i].landmarks; } return NULL; diff --git a/src/m4a_1.s b/src/m4a_1.s index cc5d3238d..3f1578806 100644 --- a/src/m4a_1.s +++ b/src/m4a_1.s @@ -680,7 +680,7 @@ SoundMainRAM_Unk2: ldr r1, [r4, o_SoundChannel_wav] add r2, r2, r1 add r2, r2, 0x10 - ldr r5, =gDecodingBuffer + ldr r5, =sDecodingBuffer ldr r6, =gDeltaEncodingTable mov r7, 0x40 ldrb lr, [r2], 1 @@ -701,7 +701,7 @@ _081DD57C: subs r7, r7, 2 bgt _081DD568 _081DD594: - ldr r5, =gDecodingBuffer + ldr r5, =sDecodingBuffer and r0, r3, 0x3F ldrsb r1, [r5, r0] pop {r0,r2,r5-r7,pc} @@ -1911,6 +1911,6 @@ _081DDD90: .align 2, 0 @ Don't pad with nop. .bss -gDecodingBuffer: @ Used as a buffer for audio decoded from compressed DPCM +sDecodingBuffer: @ Used as a buffer for audio decoded from compressed DPCM .space 0x40 - .size gDecodingBuffer, .-gDecodingBuffer + .size sDecodingBuffer, .-sDecodingBuffer diff --git a/src/main.c b/src/main.c index 2b96a8698..5fd236447 100644 --- a/src/main.c +++ b/src/main.c @@ -69,7 +69,7 @@ u8 gLinkVSyncDisabled; u32 IntrMain_Buffer[0x200]; s8 gPcmDmaCounter; -static EWRAM_DATA u16 gTrainerId = 0; +static EWRAM_DATA u16 sTrainerId = 0; //EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; @@ -201,12 +201,12 @@ void SeedRngAndSetTrainerId(void) u16 val = REG_TM1CNT_L; SeedRng(val); REG_TM1CNT_H = 0; - gTrainerId = val; + sTrainerId = val; } u16 GetGeneratedTrainerIdLower(void) { - return gTrainerId; + return sTrainerId; } void EnableVCountIntrAtLine150(void) diff --git a/src/main_menu.c b/src/main_menu.c index ed6158a9c..7a5dd9ebd 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -371,7 +371,7 @@ static const struct WindowTemplate sWindowTemplates_MainMenu[] = DUMMY_WIN_TEMPLATE }; -static const struct WindowTemplate gNewGameBirchSpeechTextWindows[] = +static const struct WindowTemplate sNewGameBirchSpeechTextWindows[] = { { .bg = 0, @@ -457,7 +457,7 @@ static const struct MenuAction sMenuActions_Gender[] = { {gText_BirchGirl, NULL} }; -static const u8 *const gMalePresetNames[] = { +static const u8 *const sMalePresetNames[] = { gText_DefaultNameStu, gText_DefaultNameMilton, gText_DefaultNameTom, @@ -480,7 +480,7 @@ static const u8 *const gMalePresetNames[] = { gText_DefaultNameQuincy }; -static const u8 *const gFemalePresetNames[] = { +static const u8 *const sFemalePresetNames[] = { gText_DefaultNameKimmy, gText_DefaultNameTiara, gText_DefaultNameBella, @@ -1325,7 +1325,7 @@ static void Task_NewGameBirchSpeech_WaitForSpriteFadeInWelcome(u8 taskId) } else { - InitWindows(gNewGameBirchSpeechTextWindows); + InitWindows(sNewGameBirchSpeechTextWindows); LoadMainMenuWindowFrameTiles(0, 0xF3); LoadMessageBoxGfx(0, 0xFC, 0xF0); NewGameBirchSpeech_ShowDialogueWindow(0, 1); @@ -1851,7 +1851,7 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void) REG_IME = savedIme; SetVBlankCallback(VBlankCB_MainMenu); SetMainCallback2(CB2_MainMenu); - InitWindows(gNewGameBirchSpeechTextWindows); + InitWindows(sNewGameBirchSpeechTextWindows); LoadMainMenuWindowFrameTiles(0, 0xF3); LoadMessageBoxGfx(0, 0xFC, 0xF0); PutWindowTilemap(0); @@ -2087,7 +2087,7 @@ static void NewGameBirchSpeech_StartFadePlatformOut(u8 taskId, u8 delay) static void NewGameBirchSpeech_ShowGenderMenu(void) { - DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3); + DrawMainMenuWindowBorder(&sNewGameBirchSpeechTextWindows[1], 0xF3); FillWindowPixelBuffer(1, PIXEL_FILL(1)); PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender); InitMenuInUpperLeftCornerNormal(1, ARRAY_COUNT(sMenuActions_Gender), 0); @@ -2106,9 +2106,9 @@ static void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId) u8 i; if (gSaveBlock2Ptr->playerGender == MALE) - name = gMalePresetNames[nameId]; + name = sMalePresetNames[nameId]; else - name = gFemalePresetNames[nameId]; + name = sFemalePresetNames[nameId]; for (i = 0; i < PLAYER_NAME_LENGTH; i++) gSaveBlock2Ptr->playerName[i] = name[i]; gSaveBlock2Ptr->playerName[PLAYER_NAME_LENGTH] = EOS; diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 8cf1a6bab..363f2bc06 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -176,25 +176,25 @@ static const u8 sRegionMapSectionId_To_PopUpThemeIdMapping[] = [MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE }; -static const u8 gText_PyramidFloor1[] = _("PYRAMID FLOOR 1"); -static const u8 gText_PyramidFloor2[] = _("PYRAMID FLOOR 2"); -static const u8 gText_PyramidFloor3[] = _("PYRAMID FLOOR 3"); -static const u8 gText_PyramidFloor4[] = _("PYRAMID FLOOR 4"); -static const u8 gText_PyramidFloor5[] = _("PYRAMID FLOOR 5"); -static const u8 gText_PyramidFloor6[] = _("PYRAMID FLOOR 6"); -static const u8 gText_PyramidFloor7[] = _("PYRAMID FLOOR 7"); -static const u8 gText_Pyramid[] = _("PYRAMID"); +static const u8 sText_PyramidFloor1[] = _("PYRAMID FLOOR 1"); +static const u8 sText_PyramidFloor2[] = _("PYRAMID FLOOR 2"); +static const u8 sText_PyramidFloor3[] = _("PYRAMID FLOOR 3"); +static const u8 sText_PyramidFloor4[] = _("PYRAMID FLOOR 4"); +static const u8 sText_PyramidFloor5[] = _("PYRAMID FLOOR 5"); +static const u8 sText_PyramidFloor6[] = _("PYRAMID FLOOR 6"); +static const u8 sText_PyramidFloor7[] = _("PYRAMID FLOOR 7"); +static const u8 sText_Pyramid[] = _("PYRAMID"); -static const u8 * const gBattlePyramid_MapHeaderStrings[] = +static const u8 * const sBattlePyramid_MapHeaderStrings[] = { - gText_PyramidFloor1, - gText_PyramidFloor2, - gText_PyramidFloor3, - gText_PyramidFloor4, - gText_PyramidFloor5, - gText_PyramidFloor6, - gText_PyramidFloor7, - gText_Pyramid, + sText_PyramidFloor1, + sText_PyramidFloor2, + sText_PyramidFloor3, + sText_PyramidFloor4, + sText_PyramidFloor5, + sText_PyramidFloor6, + sText_PyramidFloor7, + sText_Pyramid, }; // Unused @@ -309,12 +309,12 @@ static void ShowMapNamePopUpWindow(void) if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP) { withoutPrefixPtr = &(mapDisplayHeader[3]); - mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7]; + mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[7]; } else { withoutPrefixPtr = &(mapDisplayHeader[3]); - mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.curChallengeBattleNum]; + mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.curChallengeBattleNum]; } StringCopy(withoutPrefixPtr, mapDisplayHeaderSource); } diff --git a/src/overworld.c b/src/overworld.c index ba6eaa167..36f52223f 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -318,7 +318,7 @@ static u8 MovementEventModeCB_Normal(struct LinkPlayerObjectEvent *, struct Obje static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8); static u8 MovementEventModeCB_Scripted(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8); -static u8 (*const gLinkPlayerMovementModes[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) = +static u8 (*const sLinkPlayerMovementModes[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) = { [MOVEMENT_MODE_FREE] = MovementEventModeCB_Normal, [MOVEMENT_MODE_FROZEN] = MovementEventModeCB_Ignored, @@ -330,7 +330,7 @@ static u8 FacingHandler_DpadMovement(struct LinkPlayerObjectEvent *, struct Obje static u8 FacingHandler_ForcedFacingChange(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8); // These handlers return TRUE if the movement was scripted and successful, and FALSE otherwise. -static bool8 (*const gLinkPlayerFacingHandlers[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) = +static bool8 (*const sLinkPlayerFacingHandlers[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) = { FacingHandler_DoNothing, FacingHandler_DpadMovement, @@ -349,7 +349,7 @@ static void MovementStatusHandler_EnterFreeMode(struct LinkPlayerObjectEvent *, static void MovementStatusHandler_TryAdvanceScript(struct LinkPlayerObjectEvent *, struct ObjectEvent *); // These handlers are run after an attempted movement. -static void (*const gMovementStatusHandler[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *) = +static void (*const sMovementStatusHandler[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *) = { // FALSE: MovementStatusHandler_EnterFreeMode, @@ -3048,9 +3048,9 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing) { // This is a hack to split this code onto two separate lines, without declaring a local variable. // C++ style inline variables would be nice here. - #define TEMP gLinkPlayerMovementModes[linkPlayerObjEvent->movementMode](linkPlayerObjEvent, objEvent, facing) + #define TEMP sLinkPlayerMovementModes[linkPlayerObjEvent->movementMode](linkPlayerObjEvent, objEvent, facing) - gMovementStatusHandler[TEMP](linkPlayerObjEvent, objEvent); + sMovementStatusHandler[TEMP](linkPlayerObjEvent, objEvent); // Clean up the hack. #undef TEMP @@ -3061,7 +3061,7 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing) static u8 MovementEventModeCB_Normal(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir) { - return gLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir); + return sLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir); } static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir) @@ -3072,7 +3072,7 @@ static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *linkPlayerOb // Identical to MovementEventModeCB_Normal static u8 MovementEventModeCB_Scripted(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir) { - return gLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir); + return sLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir); } static bool8 FacingHandler_DoNothing(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir) diff --git a/src/palette.c b/src/palette.c index 9fec449bc..174c04e14 100644 --- a/src/palette.c +++ b/src/palette.c @@ -60,13 +60,13 @@ static void Task_BlendPalettesGradually(u8 taskId); // unaligned word reads are issued in BlendPalette otherwise ALIGNED(4) EWRAM_DATA u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE] = {0}; ALIGNED(4) EWRAM_DATA u16 gPlttBufferFaded[PLTT_BUFFER_SIZE] = {0}; -EWRAM_DATA struct PaletteStruct sPaletteStructs[NUM_PALETTE_STRUCTS] = {0}; +static EWRAM_DATA struct PaletteStruct sPaletteStructs[NUM_PALETTE_STRUCTS] = {0}; EWRAM_DATA struct PaletteFadeControl gPaletteFade = {0}; static EWRAM_DATA u32 sFiller = 0; static EWRAM_DATA u32 sPlttBufferTransferPending = 0; EWRAM_DATA u8 gPaletteDecompressionBuffer[PLTT_DECOMP_BUFFER_SIZE] = {0}; -static const struct PaletteStructTemplate gDummyPaletteStructTemplate = { +static const struct PaletteStructTemplate sDummyPaletteStructTemplate = { .id = 0xFFFF, .state = 1 }; @@ -352,7 +352,7 @@ void PaletteStruct_ResetById(u16 id) static void PaletteStruct_Reset(u8 paletteNum) { - sPaletteStructs[paletteNum].template = &gDummyPaletteStructTemplate; + sPaletteStructs[paletteNum].template = &sDummyPaletteStructTemplate; sPaletteStructs[paletteNum].active = FALSE; sPaletteStructs[paletteNum].baseDestOffset = 0; sPaletteStructs[paletteNum].destOffset = 0; diff --git a/src/pokedex.c b/src/pokedex.c index 206782e59..5730593e1 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -840,7 +840,7 @@ static const u8 sText_No000[] = _("{NO}000"); static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp"); static const u8 sText_TenDashes[] = _("----------"); -ALIGNED(4) static const u8 gExpandedPlaceholder_PokedexDescription[] = _(""); +ALIGNED(4) static const u8 sExpandedPlaceholder_PokedexDescription[] = _(""); #include "data/pokemon/pokedex_text.h" #include "data/pokemon/pokedex_entries.h" @@ -4138,7 +4138,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) if (owned) description = gPokedexEntries[num].description; else - description = gExpandedPlaceholder_PokedexDescription; + description = sExpandedPlaceholder_PokedexDescription; PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 0x5F); } diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 8bf12c2bd..8f80b0b37 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1040,7 +1040,7 @@ static const struct BgTemplate sBgTemplates[] = }, }; -static const struct SpritePalette gWaveformSpritePalette = +static const struct SpritePalette sWaveformSpritePalette = { sWaveform_Pal, PALTAG_MISC_2 }; @@ -3844,7 +3844,7 @@ static bool8 InitPokeStorageWindows(void) static void LoadWaveformSpritePalette(void) { - LoadSpritePalette(&gWaveformSpritePalette); + LoadSpritePalette(&sWaveformSpritePalette); } static void InitPalettesAndSprites(void) diff --git a/src/pokenav_main_menu.c b/src/pokenav_main_menu.c index 318ed520d..7d668c67f 100644 --- a/src/pokenav_main_menu.c +++ b/src/pokenav_main_menu.c @@ -105,7 +105,7 @@ static const u8 sHelpBarTextColors[3] = TEXT_COLOR_RED, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY }; -static const struct CompressedSpriteSheet gSpinningPokenavSpriteSheet[] = +static const struct CompressedSpriteSheet sSpinningPokenavSpriteSheet[] = { { .data = sSpinningPokenav_Gfx, @@ -114,7 +114,7 @@ static const struct CompressedSpriteSheet gSpinningPokenavSpriteSheet[] = } }; -static const struct SpritePalette gSpinningNavgearPalettes[] = +static const struct SpritePalette sSpinningNavgearPalettes[] = { { .data = sSpinningPokenav_Pal, @@ -583,10 +583,10 @@ static void InitPokenavMainMenuResources(void) u8 spriteId; struct Pokenav_MainMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_MAIN_MENU); - for (i = 0; i < ARRAY_COUNT(gSpinningPokenavSpriteSheet); i++) - LoadCompressedSpriteSheet(&gSpinningPokenavSpriteSheet[i]); + for (i = 0; i < ARRAY_COUNT(sSpinningPokenavSpriteSheet); i++) + LoadCompressedSpriteSheet(&sSpinningPokenavSpriteSheet[i]); - Pokenav_AllocAndLoadPalettes(gSpinningNavgearPalettes); + Pokenav_AllocAndLoadPalettes(sSpinningNavgearPalettes); menu->palettes = ~1 & ~(0x10000 << IndexOfSpritePaletteTag(0)); spriteId = CreateSprite(&sSpinningPokenavSpriteTemplate, 220, 12, 0); menu->spinningPokenav = &gSprites[spriteId]; diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 29dd62621..2e8cc40b5 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -324,7 +324,7 @@ static const match_call_text_data_t sWallyTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -const struct MatchCallLocationOverride sWallyLocationData[] = { +static const struct MatchCallLocationOverride sWallyLocationData[] = { { FLAG_HIDE_MAUVILLE_CITY_WALLY, MAPSEC_VERDANTURF_TOWN }, { FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, MAPSEC_NONE }, { FLAG_HIDE_VICTORY_ROAD_ENTRANCE_WALLY, MAPSEC_VICTORY_ROAD }, diff --git a/src/pokenav_region_map.c b/src/pokenav_region_map.c index 16ba48070..828bd525d 100755 --- a/src/pokenav_region_map.c +++ b/src/pokenav_region_map.c @@ -146,7 +146,7 @@ static const struct WindowTemplate sMapSecInfoWindowTemplate = #include "data/region_map/city_map_entries.h" -const struct OamData sCityZoomTextSprite_OamData = +static const struct OamData sCityZoomTextSprite_OamData = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, diff --git a/src/region_map.c b/src/region_map.c index 09e2d69bf..5b3b8b008 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -64,7 +64,7 @@ struct MultiNameFlyDest // Static RAM declarations -static EWRAM_DATA struct RegionMap *gRegionMap = NULL; +static EWRAM_DATA struct RegionMap *sRegionMap = NULL; static EWRAM_DATA struct { void (*callback)(void); @@ -516,49 +516,49 @@ void InitRegionMap(struct RegionMap *regionMap, bool8 zoomed) void InitRegionMapData(struct RegionMap *regionMap, const struct BgTemplate *template, bool8 zoomed) { - gRegionMap = regionMap; - gRegionMap->initStep = 0; - gRegionMap->zoomed = zoomed; - gRegionMap->inputCallback = zoomed == TRUE ? ProcessRegionMapInput_Zoomed : ProcessRegionMapInput_Full; + sRegionMap = regionMap; + sRegionMap->initStep = 0; + sRegionMap->zoomed = zoomed; + sRegionMap->inputCallback = zoomed == TRUE ? ProcessRegionMapInput_Zoomed : ProcessRegionMapInput_Full; if (template != NULL) { - gRegionMap->bgNum = template->bg; - gRegionMap->charBaseIdx = template->charBaseIndex; - gRegionMap->mapBaseIdx = template->mapBaseIndex; - gRegionMap->bgManaged = TRUE; + sRegionMap->bgNum = template->bg; + sRegionMap->charBaseIdx = template->charBaseIndex; + sRegionMap->mapBaseIdx = template->mapBaseIndex; + sRegionMap->bgManaged = TRUE; } else { - gRegionMap->bgNum = 2; - gRegionMap->charBaseIdx = 2; - gRegionMap->mapBaseIdx = 28; - gRegionMap->bgManaged = FALSE; + sRegionMap->bgNum = 2; + sRegionMap->charBaseIdx = 2; + sRegionMap->mapBaseIdx = 28; + sRegionMap->bgManaged = FALSE; } } void ShowRegionMapForPokedexAreaScreen(struct RegionMap *regionMap) { - gRegionMap = regionMap; + sRegionMap = regionMap; InitMapBasedOnPlayerLocation(); - gRegionMap->playerIconSpritePosX = gRegionMap->cursorPosX; - gRegionMap->playerIconSpritePosY = gRegionMap->cursorPosY; + sRegionMap->playerIconSpritePosX = sRegionMap->cursorPosX; + sRegionMap->playerIconSpritePosY = sRegionMap->cursorPosY; } bool8 LoadRegionMapGfx(void) { - switch (gRegionMap->initStep) + switch (sRegionMap->initStep) { case 0: - if (gRegionMap->bgManaged) - DecompressAndCopyTileDataToVram(gRegionMap->bgNum, sRegionMapBg_GfxLZ, 0, 0, 0); + if (sRegionMap->bgManaged) + DecompressAndCopyTileDataToVram(sRegionMap->bgNum, sRegionMapBg_GfxLZ, 0, 0, 0); else LZ77UnCompVram(sRegionMapBg_GfxLZ, (u16 *)BG_CHAR_ADDR(2)); break; case 1: - if (gRegionMap->bgManaged) + if (sRegionMap->bgManaged) { if (!FreeTempTileDataBuffersIfPossible()) - DecompressAndCopyTileDataToVram(gRegionMap->bgNum, sRegionMapBg_TilemapLZ, 0, 0, 1); + DecompressAndCopyTileDataToVram(sRegionMap->bgNum, sRegionMapBg_TilemapLZ, 0, 0, 1); } else { @@ -570,54 +570,54 @@ bool8 LoadRegionMapGfx(void) LoadPalette(sRegionMapBg_Pal, 0x70, 0x60); break; case 3: - LZ77UnCompWram(sRegionMapCursorSmallGfxLZ, gRegionMap->cursorSmallImage); + LZ77UnCompWram(sRegionMapCursorSmallGfxLZ, sRegionMap->cursorSmallImage); break; case 4: - LZ77UnCompWram(sRegionMapCursorLargeGfxLZ, gRegionMap->cursorLargeImage); + LZ77UnCompWram(sRegionMapCursorLargeGfxLZ, sRegionMap->cursorLargeImage); break; case 5: InitMapBasedOnPlayerLocation(); - gRegionMap->playerIconSpritePosX = gRegionMap->cursorPosX; - gRegionMap->playerIconSpritePosY = gRegionMap->cursorPosY; - gRegionMap->mapSecId = CorrectSpecialMapSecId_Internal(gRegionMap->mapSecId); - gRegionMap->mapSecType = GetMapsecType(gRegionMap->mapSecId); - GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, MAP_NAME_LENGTH); + sRegionMap->playerIconSpritePosX = sRegionMap->cursorPosX; + sRegionMap->playerIconSpritePosY = sRegionMap->cursorPosY; + sRegionMap->mapSecId = CorrectSpecialMapSecId_Internal(sRegionMap->mapSecId); + sRegionMap->mapSecType = GetMapsecType(sRegionMap->mapSecId); + GetMapName(sRegionMap->mapSecName, sRegionMap->mapSecId, MAP_NAME_LENGTH); break; case 6: - if (gRegionMap->zoomed == FALSE) + if (sRegionMap->zoomed == FALSE) { CalcZoomScrollParams(0, 0, 0, 0, 0x100, 0x100, 0); } else { - gRegionMap->scrollX = gRegionMap->cursorPosX * 8 - 0x34; - gRegionMap->scrollY = gRegionMap->cursorPosY * 8 - 0x44; - gRegionMap->zoomedCursorPosX = gRegionMap->cursorPosX; - gRegionMap->zoomedCursorPosY = gRegionMap->cursorPosY; - CalcZoomScrollParams(gRegionMap->scrollX, gRegionMap->scrollY, 0x38, 0x48, 0x80, 0x80, 0); + sRegionMap->scrollX = sRegionMap->cursorPosX * 8 - 0x34; + sRegionMap->scrollY = sRegionMap->cursorPosY * 8 - 0x44; + sRegionMap->zoomedCursorPosX = sRegionMap->cursorPosX; + sRegionMap->zoomedCursorPosY = sRegionMap->cursorPosY; + CalcZoomScrollParams(sRegionMap->scrollX, sRegionMap->scrollY, 0x38, 0x48, 0x80, 0x80, 0); } break; case 7: GetPositionOfCursorWithinMapSec(); UpdateRegionMapVideoRegs(); - gRegionMap->cursorSprite = NULL; - gRegionMap->playerIconSprite = NULL; - gRegionMap->cursorMovementFrameCounter = 0; - gRegionMap->blinkPlayerIcon = FALSE; - if (gRegionMap->bgManaged) + sRegionMap->cursorSprite = NULL; + sRegionMap->playerIconSprite = NULL; + sRegionMap->cursorMovementFrameCounter = 0; + sRegionMap->blinkPlayerIcon = FALSE; + if (sRegionMap->bgManaged) { - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_SCREENSIZE, 2); - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_CHARBASEINDEX, gRegionMap->charBaseIdx); - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_MAPBASEINDEX, gRegionMap->mapBaseIdx); - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_WRAPAROUND, 1); - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_PALETTEMODE, 1); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_SCREENSIZE, 2); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_CHARBASEINDEX, sRegionMap->charBaseIdx); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_MAPBASEINDEX, sRegionMap->mapBaseIdx); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_WRAPAROUND, 1); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_PALETTEMODE, 1); } - gRegionMap->initStep++; + sRegionMap->initStep++; return FALSE; default: return FALSE; } - gRegionMap->initStep++; + sRegionMap->initStep++; return TRUE; } @@ -629,23 +629,23 @@ void BlendRegionMap(u16 color, u32 coeff) void FreeRegionMapIconResources(void) { - if (gRegionMap->cursorSprite != NULL) + if (sRegionMap->cursorSprite != NULL) { - DestroySprite(gRegionMap->cursorSprite); - FreeSpriteTilesByTag(gRegionMap->cursorTileTag); - FreeSpritePaletteByTag(gRegionMap->cursorPaletteTag); + DestroySprite(sRegionMap->cursorSprite); + FreeSpriteTilesByTag(sRegionMap->cursorTileTag); + FreeSpritePaletteByTag(sRegionMap->cursorPaletteTag); } - if (gRegionMap->playerIconSprite != NULL) + if (sRegionMap->playerIconSprite != NULL) { - DestroySprite(gRegionMap->playerIconSprite); - FreeSpriteTilesByTag(gRegionMap->playerIconTileTag); - FreeSpritePaletteByTag(gRegionMap->playerIconPaletteTag); + DestroySprite(sRegionMap->playerIconSprite); + FreeSpriteTilesByTag(sRegionMap->playerIconTileTag); + FreeSpritePaletteByTag(sRegionMap->playerIconPaletteTag); } } u8 DoRegionMapInputCallback(void) { - return gRegionMap->inputCallback(); + return sRegionMap->inputCallback(); } static u8 ProcessRegionMapInput_Full(void) @@ -653,26 +653,26 @@ static u8 ProcessRegionMapInput_Full(void) u8 input; input = MAP_INPUT_NONE; - gRegionMap->cursorDeltaX = 0; - gRegionMap->cursorDeltaY = 0; - if (JOY_HELD(DPAD_UP) && gRegionMap->cursorPosY > MAPCURSOR_Y_MIN) + sRegionMap->cursorDeltaX = 0; + sRegionMap->cursorDeltaY = 0; + if (JOY_HELD(DPAD_UP) && sRegionMap->cursorPosY > MAPCURSOR_Y_MIN) { - gRegionMap->cursorDeltaY = -1; + sRegionMap->cursorDeltaY = -1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_DOWN) && gRegionMap->cursorPosY < MAPCURSOR_Y_MAX) + if (JOY_HELD(DPAD_DOWN) && sRegionMap->cursorPosY < MAPCURSOR_Y_MAX) { - gRegionMap->cursorDeltaY = +1; + sRegionMap->cursorDeltaY = +1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_LEFT) && gRegionMap->cursorPosX > MAPCURSOR_X_MIN) + if (JOY_HELD(DPAD_LEFT) && sRegionMap->cursorPosX > MAPCURSOR_X_MIN) { - gRegionMap->cursorDeltaX = -1; + sRegionMap->cursorDeltaX = -1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_RIGHT) && gRegionMap->cursorPosX < MAPCURSOR_X_MAX) + if (JOY_HELD(DPAD_RIGHT) && sRegionMap->cursorPosX < MAPCURSOR_X_MAX) { - gRegionMap->cursorDeltaX = +1; + sRegionMap->cursorDeltaX = +1; input = MAP_INPUT_MOVE_START; } if (JOY_NEW(A_BUTTON)) @@ -685,8 +685,8 @@ static u8 ProcessRegionMapInput_Full(void) } if (input == MAP_INPUT_MOVE_START) { - gRegionMap->cursorMovementFrameCounter = 4; - gRegionMap->inputCallback = MoveRegionMapCursor_Full; + sRegionMap->cursorMovementFrameCounter = 4; + sRegionMap->inputCallback = MoveRegionMapCursor_Full; } return input; } @@ -695,35 +695,35 @@ static u8 MoveRegionMapCursor_Full(void) { u16 mapSecId; - if (gRegionMap->cursorMovementFrameCounter != 0) + if (sRegionMap->cursorMovementFrameCounter != 0) return MAP_INPUT_MOVE_CONT; - if (gRegionMap->cursorDeltaX > 0) + if (sRegionMap->cursorDeltaX > 0) { - gRegionMap->cursorPosX++; + sRegionMap->cursorPosX++; } - if (gRegionMap->cursorDeltaX < 0) + if (sRegionMap->cursorDeltaX < 0) { - gRegionMap->cursorPosX--; + sRegionMap->cursorPosX--; } - if (gRegionMap->cursorDeltaY > 0) + if (sRegionMap->cursorDeltaY > 0) { - gRegionMap->cursorPosY++; + sRegionMap->cursorPosY++; } - if (gRegionMap->cursorDeltaY < 0) + if (sRegionMap->cursorDeltaY < 0) { - gRegionMap->cursorPosY--; + sRegionMap->cursorPosY--; } - mapSecId = GetMapSecIdAt(gRegionMap->cursorPosX, gRegionMap->cursorPosY); - gRegionMap->mapSecType = GetMapsecType(mapSecId); - if (mapSecId != gRegionMap->mapSecId) + mapSecId = GetMapSecIdAt(sRegionMap->cursorPosX, sRegionMap->cursorPosY); + sRegionMap->mapSecType = GetMapsecType(mapSecId); + if (mapSecId != sRegionMap->mapSecId) { - gRegionMap->mapSecId = mapSecId; - GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, MAP_NAME_LENGTH); + sRegionMap->mapSecId = mapSecId; + GetMapName(sRegionMap->mapSecName, sRegionMap->mapSecId, MAP_NAME_LENGTH); } GetPositionOfCursorWithinMapSec(); - gRegionMap->inputCallback = ProcessRegionMapInput_Full; + sRegionMap->inputCallback = ProcessRegionMapInput_Full; return MAP_INPUT_MOVE_END; } @@ -732,26 +732,26 @@ static u8 ProcessRegionMapInput_Zoomed(void) u8 input; input = MAP_INPUT_NONE; - gRegionMap->zoomedCursorDeltaX = 0; - gRegionMap->zoomedCursorDeltaY = 0; - if (JOY_HELD(DPAD_UP) && gRegionMap->scrollY > -0x34) + sRegionMap->zoomedCursorDeltaX = 0; + sRegionMap->zoomedCursorDeltaY = 0; + if (JOY_HELD(DPAD_UP) && sRegionMap->scrollY > -0x34) { - gRegionMap->zoomedCursorDeltaY = -1; + sRegionMap->zoomedCursorDeltaY = -1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_DOWN) && gRegionMap->scrollY < 0x3c) + if (JOY_HELD(DPAD_DOWN) && sRegionMap->scrollY < 0x3c) { - gRegionMap->zoomedCursorDeltaY = +1; + sRegionMap->zoomedCursorDeltaY = +1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_LEFT) && gRegionMap->scrollX > -0x2c) + if (JOY_HELD(DPAD_LEFT) && sRegionMap->scrollX > -0x2c) { - gRegionMap->zoomedCursorDeltaX = -1; + sRegionMap->zoomedCursorDeltaX = -1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_RIGHT) && gRegionMap->scrollX < 0xac) + if (JOY_HELD(DPAD_RIGHT) && sRegionMap->scrollX < 0xac) { - gRegionMap->zoomedCursorDeltaX = +1; + sRegionMap->zoomedCursorDeltaX = +1; input = MAP_INPUT_MOVE_START; } if (JOY_NEW(A_BUTTON)) @@ -764,8 +764,8 @@ static u8 ProcessRegionMapInput_Zoomed(void) } if (input == MAP_INPUT_MOVE_START) { - gRegionMap->inputCallback = MoveRegionMapCursor_Zoomed; - gRegionMap->zoomedCursorMovementFrameCounter = 0; + sRegionMap->inputCallback = MoveRegionMapCursor_Zoomed; + sRegionMap->zoomedCursorMovementFrameCounter = 0; } return input; } @@ -776,29 +776,29 @@ static u8 MoveRegionMapCursor_Zoomed(void) u16 y; u16 mapSecId; - gRegionMap->scrollY += gRegionMap->zoomedCursorDeltaY; - gRegionMap->scrollX += gRegionMap->zoomedCursorDeltaX; - RegionMap_SetBG2XAndBG2Y(gRegionMap->scrollX, gRegionMap->scrollY); - gRegionMap->zoomedCursorMovementFrameCounter++; - if (gRegionMap->zoomedCursorMovementFrameCounter == 8) + sRegionMap->scrollY += sRegionMap->zoomedCursorDeltaY; + sRegionMap->scrollX += sRegionMap->zoomedCursorDeltaX; + RegionMap_SetBG2XAndBG2Y(sRegionMap->scrollX, sRegionMap->scrollY); + sRegionMap->zoomedCursorMovementFrameCounter++; + if (sRegionMap->zoomedCursorMovementFrameCounter == 8) { - x = (gRegionMap->scrollX + 0x2c) / 8 + 1; - y = (gRegionMap->scrollY + 0x34) / 8 + 2; - if (x != gRegionMap->zoomedCursorPosX || y != gRegionMap->zoomedCursorPosY) + x = (sRegionMap->scrollX + 0x2c) / 8 + 1; + y = (sRegionMap->scrollY + 0x34) / 8 + 2; + if (x != sRegionMap->zoomedCursorPosX || y != sRegionMap->zoomedCursorPosY) { - gRegionMap->zoomedCursorPosX = x; - gRegionMap->zoomedCursorPosY = y; + sRegionMap->zoomedCursorPosX = x; + sRegionMap->zoomedCursorPosY = y; mapSecId = GetMapSecIdAt(x, y); - gRegionMap->mapSecType = GetMapsecType(mapSecId); - if (mapSecId != gRegionMap->mapSecId) + sRegionMap->mapSecType = GetMapsecType(mapSecId); + if (mapSecId != sRegionMap->mapSecId) { - gRegionMap->mapSecId = mapSecId; - GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, MAP_NAME_LENGTH); + sRegionMap->mapSecId = mapSecId; + GetMapName(sRegionMap->mapSecName, sRegionMap->mapSecId, MAP_NAME_LENGTH); } GetPositionOfCursorWithinMapSec(); } - gRegionMap->zoomedCursorMovementFrameCounter = 0; - gRegionMap->inputCallback = ProcessRegionMapInput_Zoomed; + sRegionMap->zoomedCursorMovementFrameCounter = 0; + sRegionMap->inputCallback = ProcessRegionMapInput_Zoomed; return MAP_INPUT_MOVE_END; } return MAP_INPUT_MOVE_CONT; @@ -806,35 +806,35 @@ static u8 MoveRegionMapCursor_Zoomed(void) void SetRegionMapDataForZoom(void) { - if (gRegionMap->zoomed == FALSE) + if (sRegionMap->zoomed == FALSE) { - gRegionMap->scrollY = 0; - gRegionMap->scrollX = 0; - gRegionMap->unk_040 = 0; - gRegionMap->unk_03c = 0; - gRegionMap->unk_060 = gRegionMap->cursorPosX * 8 - 0x34; - gRegionMap->unk_062 = gRegionMap->cursorPosY * 8 - 0x44; - gRegionMap->unk_044 = (gRegionMap->unk_060 << 8) / 16; - gRegionMap->unk_048 = (gRegionMap->unk_062 << 8) / 16; - gRegionMap->zoomedCursorPosX = gRegionMap->cursorPosX; - gRegionMap->zoomedCursorPosY = gRegionMap->cursorPosY; - gRegionMap->unk_04c = 0x10000; - gRegionMap->unk_050 = -0x800; + sRegionMap->scrollY = 0; + sRegionMap->scrollX = 0; + sRegionMap->unk_040 = 0; + sRegionMap->unk_03c = 0; + sRegionMap->unk_060 = sRegionMap->cursorPosX * 8 - 0x34; + sRegionMap->unk_062 = sRegionMap->cursorPosY * 8 - 0x44; + sRegionMap->unk_044 = (sRegionMap->unk_060 << 8) / 16; + sRegionMap->unk_048 = (sRegionMap->unk_062 << 8) / 16; + sRegionMap->zoomedCursorPosX = sRegionMap->cursorPosX; + sRegionMap->zoomedCursorPosY = sRegionMap->cursorPosY; + sRegionMap->unk_04c = 0x10000; + sRegionMap->unk_050 = -0x800; } else { - gRegionMap->unk_03c = gRegionMap->scrollX * 0x100; - gRegionMap->unk_040 = gRegionMap->scrollY * 0x100; - gRegionMap->unk_060 = 0; - gRegionMap->unk_062 = 0; - gRegionMap->unk_044 = -(gRegionMap->unk_03c / 16); - gRegionMap->unk_048 = -(gRegionMap->unk_040 / 16); - gRegionMap->cursorPosX = gRegionMap->zoomedCursorPosX; - gRegionMap->cursorPosY = gRegionMap->zoomedCursorPosY; - gRegionMap->unk_04c = 0x8000; - gRegionMap->unk_050 = 0x800; + sRegionMap->unk_03c = sRegionMap->scrollX * 0x100; + sRegionMap->unk_040 = sRegionMap->scrollY * 0x100; + sRegionMap->unk_060 = 0; + sRegionMap->unk_062 = 0; + sRegionMap->unk_044 = -(sRegionMap->unk_03c / 16); + sRegionMap->unk_048 = -(sRegionMap->unk_040 / 16); + sRegionMap->cursorPosX = sRegionMap->zoomedCursorPosX; + sRegionMap->cursorPosY = sRegionMap->zoomedCursorPosY; + sRegionMap->unk_04c = 0x8000; + sRegionMap->unk_050 = 0x800; } - gRegionMap->unk_06e = 0; + sRegionMap->unk_06e = 0; FreeRegionMapCursorSprite(); HideRegionMapPlayerIcon(); } @@ -843,60 +843,60 @@ bool8 UpdateRegionMapZoom(void) { bool8 retVal; - if (gRegionMap->unk_06e >= 16) + if (sRegionMap->unk_06e >= 16) { return FALSE; } - gRegionMap->unk_06e++; - if (gRegionMap->unk_06e == 16) + sRegionMap->unk_06e++; + if (sRegionMap->unk_06e == 16) { - gRegionMap->unk_044 = 0; - gRegionMap->unk_048 = 0; - gRegionMap->scrollX = gRegionMap->unk_060; - gRegionMap->scrollY = gRegionMap->unk_062; - gRegionMap->unk_04c = (gRegionMap->zoomed == FALSE) ? (128 << 8) : (256 << 8); - gRegionMap->zoomed = !gRegionMap->zoomed; - gRegionMap->inputCallback = (gRegionMap->zoomed == FALSE) ? ProcessRegionMapInput_Full : ProcessRegionMapInput_Zoomed; - CreateRegionMapCursor(gRegionMap->cursorTileTag, gRegionMap->cursorPaletteTag); + sRegionMap->unk_044 = 0; + sRegionMap->unk_048 = 0; + sRegionMap->scrollX = sRegionMap->unk_060; + sRegionMap->scrollY = sRegionMap->unk_062; + sRegionMap->unk_04c = (sRegionMap->zoomed == FALSE) ? (128 << 8) : (256 << 8); + sRegionMap->zoomed = !sRegionMap->zoomed; + sRegionMap->inputCallback = (sRegionMap->zoomed == FALSE) ? ProcessRegionMapInput_Full : ProcessRegionMapInput_Zoomed; + CreateRegionMapCursor(sRegionMap->cursorTileTag, sRegionMap->cursorPaletteTag); UnhideRegionMapPlayerIcon(); retVal = FALSE; } else { - gRegionMap->unk_03c += gRegionMap->unk_044; - gRegionMap->unk_040 += gRegionMap->unk_048; - gRegionMap->scrollX = gRegionMap->unk_03c >> 8; - gRegionMap->scrollY = gRegionMap->unk_040 >> 8; - gRegionMap->unk_04c += gRegionMap->unk_050; - if ((gRegionMap->unk_044 < 0 && gRegionMap->scrollX < gRegionMap->unk_060) || (gRegionMap->unk_044 > 0 && gRegionMap->scrollX > gRegionMap->unk_060)) + sRegionMap->unk_03c += sRegionMap->unk_044; + sRegionMap->unk_040 += sRegionMap->unk_048; + sRegionMap->scrollX = sRegionMap->unk_03c >> 8; + sRegionMap->scrollY = sRegionMap->unk_040 >> 8; + sRegionMap->unk_04c += sRegionMap->unk_050; + if ((sRegionMap->unk_044 < 0 && sRegionMap->scrollX < sRegionMap->unk_060) || (sRegionMap->unk_044 > 0 && sRegionMap->scrollX > sRegionMap->unk_060)) { - gRegionMap->scrollX = gRegionMap->unk_060; - gRegionMap->unk_044 = 0; + sRegionMap->scrollX = sRegionMap->unk_060; + sRegionMap->unk_044 = 0; } - if ((gRegionMap->unk_048 < 0 && gRegionMap->scrollY < gRegionMap->unk_062) || (gRegionMap->unk_048 > 0 && gRegionMap->scrollY > gRegionMap->unk_062)) + if ((sRegionMap->unk_048 < 0 && sRegionMap->scrollY < sRegionMap->unk_062) || (sRegionMap->unk_048 > 0 && sRegionMap->scrollY > sRegionMap->unk_062)) { - gRegionMap->scrollY = gRegionMap->unk_062; - gRegionMap->unk_048 = 0; + sRegionMap->scrollY = sRegionMap->unk_062; + sRegionMap->unk_048 = 0; } - if (gRegionMap->zoomed == FALSE) + if (sRegionMap->zoomed == FALSE) { - if (gRegionMap->unk_04c < (128 << 8)) + if (sRegionMap->unk_04c < (128 << 8)) { - gRegionMap->unk_04c = (128 << 8); - gRegionMap->unk_050 = 0; + sRegionMap->unk_04c = (128 << 8); + sRegionMap->unk_050 = 0; } } else { - if (gRegionMap->unk_04c > (256 << 8)) + if (sRegionMap->unk_04c > (256 << 8)) { - gRegionMap->unk_04c = (256 << 8); - gRegionMap->unk_050 = 0; + sRegionMap->unk_04c = (256 << 8); + sRegionMap->unk_050 = 0; } } retVal = TRUE; } - CalcZoomScrollParams(gRegionMap->scrollX, gRegionMap->scrollY, 0x38, 0x48, gRegionMap->unk_04c >> 8, gRegionMap->unk_04c >> 8, 0); + CalcZoomScrollParams(sRegionMap->scrollX, sRegionMap->scrollY, 0x38, 0x48, sRegionMap->unk_04c >> 8, sRegionMap->unk_04c >> 8, 0); return retVal; } @@ -907,42 +907,42 @@ static void CalcZoomScrollParams(s16 scrollX, s16 scrollY, s16 c, s16 d, u16 e, s32 var3; s32 var4; - gRegionMap->bg2pa = e * gSineTable[rotation + 64] >> 8; - gRegionMap->bg2pc = e * -gSineTable[rotation] >> 8; - gRegionMap->bg2pb = f * gSineTable[rotation] >> 8; - gRegionMap->bg2pd = f * gSineTable[rotation + 64] >> 8; + sRegionMap->bg2pa = e * gSineTable[rotation + 64] >> 8; + sRegionMap->bg2pc = e * -gSineTable[rotation] >> 8; + sRegionMap->bg2pb = f * gSineTable[rotation] >> 8; + sRegionMap->bg2pd = f * gSineTable[rotation + 64] >> 8; var1 = (scrollX << 8) + (c << 8); - var2 = d * gRegionMap->bg2pb + gRegionMap->bg2pa * c; - gRegionMap->bg2x = var1 - var2; + var2 = d * sRegionMap->bg2pb + sRegionMap->bg2pa * c; + sRegionMap->bg2x = var1 - var2; var3 = (scrollY << 8) + (d << 8); - var4 = gRegionMap->bg2pd * d + gRegionMap->bg2pc * c; - gRegionMap->bg2y = var3 - var4; + var4 = sRegionMap->bg2pd * d + sRegionMap->bg2pc * c; + sRegionMap->bg2y = var3 - var4; - gRegionMap->needUpdateVideoRegs = TRUE; + sRegionMap->needUpdateVideoRegs = TRUE; } static void RegionMap_SetBG2XAndBG2Y(s16 x, s16 y) { - gRegionMap->bg2x = (x << 8) + 0x1c00; - gRegionMap->bg2y = (y << 8) + 0x2400; - gRegionMap->needUpdateVideoRegs = TRUE; + sRegionMap->bg2x = (x << 8) + 0x1c00; + sRegionMap->bg2y = (y << 8) + 0x2400; + sRegionMap->needUpdateVideoRegs = TRUE; } void UpdateRegionMapVideoRegs(void) { - if (gRegionMap->needUpdateVideoRegs) + if (sRegionMap->needUpdateVideoRegs) { - SetGpuReg(REG_OFFSET_BG2PA, gRegionMap->bg2pa); - SetGpuReg(REG_OFFSET_BG2PB, gRegionMap->bg2pb); - SetGpuReg(REG_OFFSET_BG2PC, gRegionMap->bg2pc); - SetGpuReg(REG_OFFSET_BG2PD, gRegionMap->bg2pd); - SetGpuReg(REG_OFFSET_BG2X_L, gRegionMap->bg2x); - SetGpuReg(REG_OFFSET_BG2X_H, gRegionMap->bg2x >> 16); - SetGpuReg(REG_OFFSET_BG2Y_L, gRegionMap->bg2y); - SetGpuReg(REG_OFFSET_BG2Y_H, gRegionMap->bg2y >> 16); - gRegionMap->needUpdateVideoRegs = FALSE; + SetGpuReg(REG_OFFSET_BG2PA, sRegionMap->bg2pa); + SetGpuReg(REG_OFFSET_BG2PB, sRegionMap->bg2pb); + SetGpuReg(REG_OFFSET_BG2PC, sRegionMap->bg2pc); + SetGpuReg(REG_OFFSET_BG2PD, sRegionMap->bg2pd); + SetGpuReg(REG_OFFSET_BG2X_L, sRegionMap->bg2x); + SetGpuReg(REG_OFFSET_BG2X_H, sRegionMap->bg2x >> 16); + SetGpuReg(REG_OFFSET_BG2Y_L, sRegionMap->bg2y); + SetGpuReg(REG_OFFSET_BG2Y_H, sRegionMap->bg2y >> 16); + sRegionMap->needUpdateVideoRegs = FALSE; } } @@ -950,10 +950,10 @@ void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y) { CalcZoomScrollParams(x, y, 0x38, 0x48, 0x100, 0x100, 0); UpdateRegionMapVideoRegs(); - if (gRegionMap->playerIconSprite != NULL) + if (sRegionMap->playerIconSprite != NULL) { - gRegionMap->playerIconSprite->x2 = -x; - gRegionMap->playerIconSprite->y2 = -y; + sRegionMap->playerIconSprite->x2 = -x; + sRegionMap->playerIconSprite->y2 = -y; } } @@ -996,22 +996,22 @@ static void InitMapBasedOnPlayerLocation(void) case MAP_TYPE_ROUTE: case MAP_TYPE_UNDERWATER: case MAP_TYPE_OCEAN_ROUTE: - gRegionMap->mapSecId = gMapHeader.regionMapSectionId; - gRegionMap->playerIsInCave = FALSE; + sRegionMap->mapSecId = gMapHeader.regionMapSectionId; + sRegionMap->playerIsInCave = FALSE; mapWidth = gMapHeader.mapLayout->width; mapHeight = gMapHeader.mapLayout->height; x = gSaveBlock1Ptr->pos.x; y = gSaveBlock1Ptr->pos.y; - if (gRegionMap->mapSecId == MAPSEC_UNDERWATER_SEAFLOOR_CAVERN || gRegionMap->mapSecId == MAPSEC_UNDERWATER_MARINE_CAVE) - gRegionMap->playerIsInCave = TRUE; + if (sRegionMap->mapSecId == MAPSEC_UNDERWATER_SEAFLOOR_CAVERN || sRegionMap->mapSecId == MAPSEC_UNDERWATER_MARINE_CAVE) + sRegionMap->playerIsInCave = TRUE; break; case MAP_TYPE_UNDERGROUND: case MAP_TYPE_UNKNOWN: if (gMapHeader.allowEscaping) { mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->escapeWarp.mapGroup, gSaveBlock1Ptr->escapeWarp.mapNum); - gRegionMap->mapSecId = mapHeader->regionMapSectionId; - gRegionMap->playerIsInCave = TRUE; + sRegionMap->mapSecId = mapHeader->regionMapSectionId; + sRegionMap->playerIsInCave = TRUE; mapWidth = mapHeader->mapLayout->width; mapHeight = mapHeader->mapLayout->height; x = gSaveBlock1Ptr->escapeWarp.x; @@ -1019,8 +1019,8 @@ static void InitMapBasedOnPlayerLocation(void) } else { - gRegionMap->mapSecId = gMapHeader.regionMapSectionId; - gRegionMap->playerIsInCave = TRUE; + sRegionMap->mapSecId = gMapHeader.regionMapSectionId; + sRegionMap->playerIsInCave = TRUE; mapWidth = 1; mapHeight = 1; x = 1; @@ -1029,16 +1029,16 @@ static void InitMapBasedOnPlayerLocation(void) break; case MAP_TYPE_SECRET_BASE: mapHeader = Overworld_GetMapHeaderByGroupAndId((u16)gSaveBlock1Ptr->dynamicWarp.mapGroup, (u16)gSaveBlock1Ptr->dynamicWarp.mapNum); - gRegionMap->mapSecId = mapHeader->regionMapSectionId; - gRegionMap->playerIsInCave = TRUE; + sRegionMap->mapSecId = mapHeader->regionMapSectionId; + sRegionMap->playerIsInCave = TRUE; mapWidth = mapHeader->mapLayout->width; mapHeight = mapHeader->mapLayout->height; x = gSaveBlock1Ptr->dynamicWarp.x; y = gSaveBlock1Ptr->dynamicWarp.y; break; case MAP_TYPE_INDOOR: - gRegionMap->mapSecId = gMapHeader.regionMapSectionId; - if (gRegionMap->mapSecId != MAPSEC_DYNAMIC) + sRegionMap->mapSecId = gMapHeader.regionMapSectionId; + if (sRegionMap->mapSecId != MAPSEC_DYNAMIC) { warp = &gSaveBlock1Ptr->escapeWarp; mapHeader = Overworld_GetMapHeaderByGroupAndId(warp->mapGroup, warp->mapNum); @@ -1047,13 +1047,13 @@ static void InitMapBasedOnPlayerLocation(void) { warp = &gSaveBlock1Ptr->dynamicWarp; mapHeader = Overworld_GetMapHeaderByGroupAndId(warp->mapGroup, warp->mapNum); - gRegionMap->mapSecId = mapHeader->regionMapSectionId; + sRegionMap->mapSecId = mapHeader->regionMapSectionId; } - if (IsPlayerInAquaHideout(gRegionMap->mapSecId)) - gRegionMap->playerIsInCave = TRUE; + if (IsPlayerInAquaHideout(sRegionMap->mapSecId)) + sRegionMap->playerIsInCave = TRUE; else - gRegionMap->playerIsInCave = FALSE; + sRegionMap->playerIsInCave = FALSE; mapWidth = mapHeader->mapLayout->width; mapHeight = mapHeader->mapLayout->height; @@ -1064,29 +1064,29 @@ static void InitMapBasedOnPlayerLocation(void) xOnMap = x; - dimensionScale = mapWidth / gRegionMapEntries[gRegionMap->mapSecId].width; + dimensionScale = mapWidth / gRegionMapEntries[sRegionMap->mapSecId].width; if (dimensionScale == 0) { dimensionScale = 1; } x /= dimensionScale; - if (x >= gRegionMapEntries[gRegionMap->mapSecId].width) + if (x >= gRegionMapEntries[sRegionMap->mapSecId].width) { - x = gRegionMapEntries[gRegionMap->mapSecId].width - 1; + x = gRegionMapEntries[sRegionMap->mapSecId].width - 1; } - dimensionScale = mapHeight / gRegionMapEntries[gRegionMap->mapSecId].height; + dimensionScale = mapHeight / gRegionMapEntries[sRegionMap->mapSecId].height; if (dimensionScale == 0) { dimensionScale = 1; } y /= dimensionScale; - if (y >= gRegionMapEntries[gRegionMap->mapSecId].height) + if (y >= gRegionMapEntries[sRegionMap->mapSecId].height) { - y = gRegionMapEntries[gRegionMap->mapSecId].height - 1; + y = gRegionMapEntries[sRegionMap->mapSecId].height - 1; } - switch (gRegionMap->mapSecId) + switch (sRegionMap->mapSecId) { case MAPSEC_ROUTE_114: if (y != 0) @@ -1116,11 +1116,11 @@ static void InitMapBasedOnPlayerLocation(void) x++; break; case MAPSEC_UNDERWATER_MARINE_CAVE: - GetMarineCaveCoords(&gRegionMap->cursorPosX, &gRegionMap->cursorPosY); + GetMarineCaveCoords(&sRegionMap->cursorPosX, &sRegionMap->cursorPosY); return; } - gRegionMap->cursorPosX = gRegionMapEntries[gRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN; - gRegionMap->cursorPosY = gRegionMapEntries[gRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN; + sRegionMap->cursorPosX = gRegionMapEntries[sRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN; + sRegionMap->cursorPosY = gRegionMapEntries[sRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN; } static void RegionMap_InitializeStateBasedOnSSTidalLocation(void) @@ -1139,40 +1139,40 @@ static void RegionMap_InitializeStateBasedOnSSTidalLocation(void) switch (GetSSTidalLocation(&mapGroup, &mapNum, &xOnMap, &yOnMap)) { case SS_TIDAL_LOCATION_SLATEPORT: - gRegionMap->mapSecId = MAPSEC_SLATEPORT_CITY; + sRegionMap->mapSecId = MAPSEC_SLATEPORT_CITY; break; case SS_TIDAL_LOCATION_LILYCOVE: - gRegionMap->mapSecId = MAPSEC_LILYCOVE_CITY; + sRegionMap->mapSecId = MAPSEC_LILYCOVE_CITY; break; case SS_TIDAL_LOCATION_ROUTE124: - gRegionMap->mapSecId = MAPSEC_ROUTE_124; + sRegionMap->mapSecId = MAPSEC_ROUTE_124; break; case SS_TIDAL_LOCATION_ROUTE131: - gRegionMap->mapSecId = MAPSEC_ROUTE_131; + sRegionMap->mapSecId = MAPSEC_ROUTE_131; break; default: case SS_TIDAL_LOCATION_CURRENTS: mapHeader = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum); - gRegionMap->mapSecId = mapHeader->regionMapSectionId; - dimensionScale = mapHeader->mapLayout->width / gRegionMapEntries[gRegionMap->mapSecId].width; + sRegionMap->mapSecId = mapHeader->regionMapSectionId; + dimensionScale = mapHeader->mapLayout->width / gRegionMapEntries[sRegionMap->mapSecId].width; if (dimensionScale == 0) dimensionScale = 1; x = xOnMap / dimensionScale; - if (x >= gRegionMapEntries[gRegionMap->mapSecId].width) - x = gRegionMapEntries[gRegionMap->mapSecId].width - 1; + if (x >= gRegionMapEntries[sRegionMap->mapSecId].width) + x = gRegionMapEntries[sRegionMap->mapSecId].width - 1; - dimensionScale = mapHeader->mapLayout->height / gRegionMapEntries[gRegionMap->mapSecId].height; + dimensionScale = mapHeader->mapLayout->height / gRegionMapEntries[sRegionMap->mapSecId].height; if (dimensionScale == 0) dimensionScale = 1; y = yOnMap / dimensionScale; - if (y >= gRegionMapEntries[gRegionMap->mapSecId].height) - y = gRegionMapEntries[gRegionMap->mapSecId].height - 1; + if (y >= gRegionMapEntries[sRegionMap->mapSecId].height) + y = gRegionMapEntries[sRegionMap->mapSecId].height - 1; break; } - gRegionMap->playerIsInCave = FALSE; - gRegionMap->cursorPosX = gRegionMapEntries[gRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN; - gRegionMap->cursorPosY = gRegionMapEntries[gRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN; + sRegionMap->playerIsInCave = FALSE; + sRegionMap->cursorPosX = gRegionMapEntries[sRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN; + sRegionMap->cursorPosY = gRegionMapEntries[sRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN; } static u8 GetMapsecType(u16 mapSecId) @@ -1300,20 +1300,20 @@ static void GetPositionOfCursorWithinMapSec(void) u16 y; u16 posWithinMapSec; - if (gRegionMap->mapSecId == MAPSEC_NONE) + if (sRegionMap->mapSecId == MAPSEC_NONE) { - gRegionMap->posWithinMapSec = 0; + sRegionMap->posWithinMapSec = 0; return; } - if (!gRegionMap->zoomed) + if (!sRegionMap->zoomed) { - x = gRegionMap->cursorPosX; - y = gRegionMap->cursorPosY; + x = sRegionMap->cursorPosX; + y = sRegionMap->cursorPosY; } else { - x = gRegionMap->zoomedCursorPosX; - y = gRegionMap->zoomedCursorPosY; + x = sRegionMap->zoomedCursorPosX; + y = sRegionMap->zoomedCursorPosY; } posWithinMapSec = 0; while (1) @@ -1333,13 +1333,13 @@ static void GetPositionOfCursorWithinMapSec(void) else { x--; - if (GetMapSecIdAt(x, y) == gRegionMap->mapSecId) + if (GetMapSecIdAt(x, y) == sRegionMap->mapSecId) { posWithinMapSec++; } } } - gRegionMap->posWithinMapSec = posWithinMapSec; + sRegionMap->posWithinMapSec = posWithinMapSec; } static bool8 RegionMap_IsMapSecIdInNextRow(u16 y) @@ -1352,7 +1352,7 @@ static bool8 RegionMap_IsMapSecIdInNextRow(u16 y) } for (x = MAPCURSOR_X_MIN; x <= MAPCURSOR_X_MAX; x++) { - if (GetMapSecIdAt(x, y) == gRegionMap->mapSecId) + if (GetMapSecIdAt(x, y) == sRegionMap->mapSecId) { return TRUE; } @@ -1362,11 +1362,11 @@ static bool8 RegionMap_IsMapSecIdInNextRow(u16 y) static void SpriteCB_CursorMapFull(struct Sprite *sprite) { - if (gRegionMap->cursorMovementFrameCounter != 0) + if (sRegionMap->cursorMovementFrameCounter != 0) { - sprite->x += 2 * gRegionMap->cursorDeltaX; - sprite->y += 2 * gRegionMap->cursorDeltaY; - gRegionMap->cursorMovementFrameCounter--; + sprite->x += 2 * sRegionMap->cursorDeltaX; + sprite->y += 2 * sRegionMap->cursorDeltaY; + sRegionMap->cursorMovementFrameCounter--; } } @@ -1386,20 +1386,20 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag) template = sRegionMapCursorSpriteTemplate; sheet.tag = tileTag; template.tileTag = tileTag; - gRegionMap->cursorTileTag = tileTag; + sRegionMap->cursorTileTag = tileTag; palette.tag = paletteTag; template.paletteTag = paletteTag; - gRegionMap->cursorPaletteTag = paletteTag; - if (!gRegionMap->zoomed) + sRegionMap->cursorPaletteTag = paletteTag; + if (!sRegionMap->zoomed) { - sheet.data = gRegionMap->cursorSmallImage; - sheet.size = sizeof(gRegionMap->cursorSmallImage); + sheet.data = sRegionMap->cursorSmallImage; + sheet.size = sizeof(sRegionMap->cursorSmallImage); template.callback = SpriteCB_CursorMapFull; } else { - sheet.data = gRegionMap->cursorLargeImage; - sheet.size = sizeof(gRegionMap->cursorLargeImage); + sheet.data = sRegionMap->cursorLargeImage; + sheet.size = sizeof(sRegionMap->cursorLargeImage); template.callback = SpriteCB_CursorMapZoomed; } LoadSpriteSheet(&sheet); @@ -1407,46 +1407,46 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag) spriteId = CreateSprite(&template, 0x38, 0x48, 0); if (spriteId != MAX_SPRITES) { - gRegionMap->cursorSprite = &gSprites[spriteId]; - if (gRegionMap->zoomed == TRUE) + sRegionMap->cursorSprite = &gSprites[spriteId]; + if (sRegionMap->zoomed == TRUE) { - gRegionMap->cursorSprite->oam.size = SPRITE_SIZE(32x32); - gRegionMap->cursorSprite->x -= 8; - gRegionMap->cursorSprite->y -= 8; - StartSpriteAnim(gRegionMap->cursorSprite, 1); + sRegionMap->cursorSprite->oam.size = SPRITE_SIZE(32x32); + sRegionMap->cursorSprite->x -= 8; + sRegionMap->cursorSprite->y -= 8; + StartSpriteAnim(sRegionMap->cursorSprite, 1); } else { - gRegionMap->cursorSprite->oam.size = SPRITE_SIZE(16x16); - gRegionMap->cursorSprite->x = 8 * gRegionMap->cursorPosX + 4; - gRegionMap->cursorSprite->y = 8 * gRegionMap->cursorPosY + 4; + sRegionMap->cursorSprite->oam.size = SPRITE_SIZE(16x16); + sRegionMap->cursorSprite->x = 8 * sRegionMap->cursorPosX + 4; + sRegionMap->cursorSprite->y = 8 * sRegionMap->cursorPosY + 4; } - gRegionMap->cursorSprite->data[1] = 2; - gRegionMap->cursorSprite->data[2] = (IndexOfSpritePaletteTag(paletteTag) << 4) + 0x101; - gRegionMap->cursorSprite->data[3] = TRUE; + sRegionMap->cursorSprite->data[1] = 2; + sRegionMap->cursorSprite->data[2] = (IndexOfSpritePaletteTag(paletteTag) << 4) + 0x101; + sRegionMap->cursorSprite->data[3] = TRUE; } } static void FreeRegionMapCursorSprite(void) { - if (gRegionMap->cursorSprite != NULL) + if (sRegionMap->cursorSprite != NULL) { - DestroySprite(gRegionMap->cursorSprite); - FreeSpriteTilesByTag(gRegionMap->cursorTileTag); - FreeSpritePaletteByTag(gRegionMap->cursorPaletteTag); + DestroySprite(sRegionMap->cursorSprite); + FreeSpriteTilesByTag(sRegionMap->cursorTileTag); + FreeSpritePaletteByTag(sRegionMap->cursorPaletteTag); } } // Unused static void SetUnkCursorSpriteData(void) { - gRegionMap->cursorSprite->data[3] = TRUE; + sRegionMap->cursorSprite->data[3] = TRUE; } // Unused static void ClearUnkCursorSpriteData(void) { - gRegionMap->cursorSprite->data[3] = FALSE; + sRegionMap->cursorSprite->data[3] = FALSE; } void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag) @@ -1458,7 +1458,7 @@ void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag) if (IsEventIslandMapSecId(gMapHeader.regionMapSectionId)) { - gRegionMap->playerIconSprite = NULL; + sRegionMap->playerIconSprite = NULL; return; } if (gSaveBlock2Ptr->playerGender == FEMALE) @@ -1469,49 +1469,49 @@ void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag) LoadSpriteSheet(&sheet); LoadSpritePalette(&palette); spriteId = CreateSprite(&template, 0, 0, 1); - gRegionMap->playerIconSprite = &gSprites[spriteId]; - if (!gRegionMap->zoomed) + sRegionMap->playerIconSprite = &gSprites[spriteId]; + if (!sRegionMap->zoomed) { - gRegionMap->playerIconSprite->x = gRegionMap->playerIconSpritePosX * 8 + 4; - gRegionMap->playerIconSprite->y = gRegionMap->playerIconSpritePosY * 8 + 4; - gRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapFull; + sRegionMap->playerIconSprite->x = sRegionMap->playerIconSpritePosX * 8 + 4; + sRegionMap->playerIconSprite->y = sRegionMap->playerIconSpritePosY * 8 + 4; + sRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapFull; } else { - gRegionMap->playerIconSprite->x = gRegionMap->playerIconSpritePosX * 16 - 0x30; - gRegionMap->playerIconSprite->y = gRegionMap->playerIconSpritePosY * 16 - 0x42; - gRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapZoomed; + sRegionMap->playerIconSprite->x = sRegionMap->playerIconSpritePosX * 16 - 0x30; + sRegionMap->playerIconSprite->y = sRegionMap->playerIconSpritePosY * 16 - 0x42; + sRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapZoomed; } } static void HideRegionMapPlayerIcon(void) { - if (gRegionMap->playerIconSprite != NULL) + if (sRegionMap->playerIconSprite != NULL) { - gRegionMap->playerIconSprite->invisible = TRUE; - gRegionMap->playerIconSprite->callback = SpriteCallbackDummy; + sRegionMap->playerIconSprite->invisible = TRUE; + sRegionMap->playerIconSprite->callback = SpriteCallbackDummy; } } static void UnhideRegionMapPlayerIcon(void) { - if (gRegionMap->playerIconSprite != NULL) + if (sRegionMap->playerIconSprite != NULL) { - if (gRegionMap->zoomed == TRUE) + if (sRegionMap->zoomed == TRUE) { - gRegionMap->playerIconSprite->x = gRegionMap->playerIconSpritePosX * 16 - 0x30; - gRegionMap->playerIconSprite->y = gRegionMap->playerIconSpritePosY * 16 - 0x42; - gRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapZoomed; - gRegionMap->playerIconSprite->invisible = FALSE; + sRegionMap->playerIconSprite->x = sRegionMap->playerIconSpritePosX * 16 - 0x30; + sRegionMap->playerIconSprite->y = sRegionMap->playerIconSpritePosY * 16 - 0x42; + sRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapZoomed; + sRegionMap->playerIconSprite->invisible = FALSE; } else { - gRegionMap->playerIconSprite->x = gRegionMap->playerIconSpritePosX * 8 + 4; - gRegionMap->playerIconSprite->y = gRegionMap->playerIconSpritePosY * 8 + 4; - gRegionMap->playerIconSprite->x2 = 0; - gRegionMap->playerIconSprite->y2 = 0; - gRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapFull; - gRegionMap->playerIconSprite->invisible = FALSE; + sRegionMap->playerIconSprite->x = sRegionMap->playerIconSpritePosX * 8 + 4; + sRegionMap->playerIconSprite->y = sRegionMap->playerIconSpritePosY * 8 + 4; + sRegionMap->playerIconSprite->x2 = 0; + sRegionMap->playerIconSprite->y2 = 0; + sRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapFull; + sRegionMap->playerIconSprite->invisible = FALSE; } } } @@ -1523,8 +1523,8 @@ static void UnhideRegionMapPlayerIcon(void) static void SpriteCB_PlayerIconMapZoomed(struct Sprite *sprite) { - sprite->x2 = -2 * gRegionMap->scrollX; - sprite->y2 = -2 * gRegionMap->scrollY; + sprite->x2 = -2 * sRegionMap->scrollX; + sprite->y2 = -2 * sRegionMap->scrollY; sprite->sY = sprite->y + sprite->y2 + sprite->centerToCornerVecY; sprite->sX = sprite->x + sprite->x2 + sprite->centerToCornerVecX; if (sprite->sY < -8 || sprite->sY > DISPLAY_HEIGHT + 8 || sprite->sX < -8 || sprite->sX > DISPLAY_WIDTH + 8) @@ -1545,7 +1545,7 @@ static void SpriteCB_PlayerIconMapFull(struct Sprite *sprite) static void SpriteCB_PlayerIcon(struct Sprite *sprite) { - if (gRegionMap->blinkPlayerIcon) + if (sRegionMap->blinkPlayerIcon) { if (++sprite->sTimer > 16) { @@ -1561,8 +1561,8 @@ static void SpriteCB_PlayerIcon(struct Sprite *sprite) void TrySetPlayerIconBlink(void) { - if (gRegionMap->playerIsInCave) - gRegionMap->blinkPlayerIcon = TRUE; + if (sRegionMap->playerIsInCave) + sRegionMap->blinkPlayerIcon = TRUE; } #undef sY @@ -1634,7 +1634,7 @@ static void GetMapSecDimensions(u16 mapSecId, u16 *x, u16 *y, u16 *width, u16 *h bool8 IsRegionMapZoomed(void) { - return gRegionMap->zoomed; + return sRegionMap->zoomed; } bool32 IsEventIslandMapSecId(u8 mapSecId) diff --git a/src/rotating_gate.c b/src/rotating_gate.c index f839d22c3..e2fd575a1 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -612,12 +612,10 @@ static const u8 sRotatingGate_ArmLayout[][4 * 2] = }, }; -// ewram -static EWRAM_DATA u8 gRotatingGate_GateSpriteIds[ROTATING_GATE_PUZZLE_MAX] = {0}; -static EWRAM_DATA const struct RotatingGatePuzzle *gRotatingGate_PuzzleConfig = NULL; -static EWRAM_DATA u8 gRotatingGate_PuzzleCount = 0; +static EWRAM_DATA u8 sRotatingGate_GateSpriteIds[ROTATING_GATE_PUZZLE_MAX] = {0}; +static EWRAM_DATA const struct RotatingGatePuzzle *sRotatingGate_PuzzleConfig = NULL; +static EWRAM_DATA u8 sRotatingGate_PuzzleCount = 0; -// text static s32 GetCurrentMapRotatingGatePuzzleType(void) { if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(FORTREE_CITY_GYM) && @@ -640,9 +638,9 @@ static void RotatingGate_ResetAllGateOrientations(void) s32 i; u8 *ptr = (u8 *)GetVarPointer(VAR_TEMP_0); - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - ptr[i] = gRotatingGate_PuzzleConfig[i].orientation; + ptr[i] = sRotatingGate_PuzzleConfig[i].orientation; } } @@ -683,12 +681,12 @@ static void RotatingGate_LoadPuzzleConfig(void) switch (puzzleType) { case PUZZLE_FORTREE_CITY_GYM: - gRotatingGate_PuzzleConfig = sRotatingGate_FortreePuzzleConfig; - gRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_FortreePuzzleConfig); + sRotatingGate_PuzzleConfig = sRotatingGate_FortreePuzzleConfig; + sRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_FortreePuzzleConfig); break; case PUZZLE_ROUTE110_TRICK_HOUSE_PUZZLE6: - gRotatingGate_PuzzleConfig = sRotatingGate_TrickHousePuzzleConfig; - gRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_TrickHousePuzzleConfig); + sRotatingGate_PuzzleConfig = sRotatingGate_TrickHousePuzzleConfig; + sRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_TrickHousePuzzleConfig); break; case PUZZLE_NONE: default: @@ -696,7 +694,7 @@ static void RotatingGate_LoadPuzzleConfig(void) } for (i = 0; i < ROTATING_GATE_PUZZLE_MAX - 1; i++) - gRotatingGate_GateSpriteIds[i] = MAX_SPRITES; + sRotatingGate_GateSpriteIds[i] = MAX_SPRITES; } static void RotatingGate_CreateGatesWithinViewport(s16 deltaX, s16 deltaY) @@ -710,15 +708,15 @@ static void RotatingGate_CreateGatesWithinViewport(s16 deltaX, s16 deltaY) s16 y = gSaveBlock1Ptr->pos.y - 2; s16 y2 = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H; - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - s16 x3 = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; - s16 y3 = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; + s16 x3 = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; + s16 y3 = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; if (y <= y3 && y2 >= y3 && x <= x3 && x2 >= x3 && - gRotatingGate_GateSpriteIds[i] == MAX_SPRITES) + sRotatingGate_GateSpriteIds[i] == MAX_SPRITES) { - gRotatingGate_GateSpriteIds[i] = RotatingGate_CreateGate(i, deltaX, deltaY); + sRotatingGate_GateSpriteIds[i] = RotatingGate_CreateGate(i, deltaX, deltaY); } } } @@ -730,7 +728,7 @@ static u8 RotatingGate_CreateGate(u8 gateId, s16 deltaX, s16 deltaY) u8 spriteId; s16 x, y; - const struct RotatingGatePuzzle *gate = &gRotatingGate_PuzzleConfig[gateId]; + const struct RotatingGatePuzzle *gate = &sRotatingGate_PuzzleConfig[gateId]; if (gate->shape == GATE_SHAPE_L1 || gate->shape == GATE_SHAPE_T1) template = sSpriteTemplate_RotatingGateRegular; @@ -827,20 +825,20 @@ static void RotatingGate_DestroyGatesOutsideViewport(void) s16 y = gSaveBlock1Ptr->pos.y - 2; s16 y2 = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H; - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - s16 xGate = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; - s16 yGate = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; + s16 xGate = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; + s16 yGate = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; - if (gRotatingGate_GateSpriteIds[i] == MAX_SPRITES) + if (sRotatingGate_GateSpriteIds[i] == MAX_SPRITES) continue; if (xGate < x || xGate > x2 || yGate < y || yGate > y2) { - struct Sprite *sprite = &gSprites[gRotatingGate_GateSpriteIds[i]]; + struct Sprite *sprite = &gSprites[sRotatingGate_GateSpriteIds[i]]; FreeSpriteOamMatrix(sprite); DestroySprite(sprite); - gRotatingGate_GateSpriteIds[i] = MAX_SPRITES; + sRotatingGate_GateSpriteIds[i] = MAX_SPRITES; } } } @@ -862,9 +860,9 @@ static s32 RotatingGate_CanRotate(u8 gateId, s32 rotationDirection) orientation = RotatingGate_GetGateOrientation(gateId); - shape = gRotatingGate_PuzzleConfig[gateId].shape; - x = gRotatingGate_PuzzleConfig[gateId].x + MAP_OFFSET; - y = gRotatingGate_PuzzleConfig[gateId].y + MAP_OFFSET; + shape = sRotatingGate_PuzzleConfig[gateId].shape; + x = sRotatingGate_PuzzleConfig[gateId].x + MAP_OFFSET; + y = sRotatingGate_PuzzleConfig[gateId].y + MAP_OFFSET; // Loop through the gate's "arms" clockwise (north, south, east, west) for (i = GATE_ARM_NORTH; i <= GATE_ARM_WEST; i++) @@ -891,15 +889,15 @@ static s32 RotatingGate_HasArm(u8 gateId, u8 armInfo) s32 isLongArm = armInfo % 2; s8 armOrientation = (arm - RotatingGate_GetGateOrientation(gateId) + 4) % 4; - s32 shape = gRotatingGate_PuzzleConfig[gateId].shape; + s32 shape = sRotatingGate_PuzzleConfig[gateId].shape; return sRotatingGate_ArmLayout[shape][armOrientation * 2 + isLongArm]; } static void RotatingGate_TriggerRotationAnimation(u8 gateId, s32 rotationDirection) { - if (gRotatingGate_GateSpriteIds[gateId] != MAX_SPRITES) + if (sRotatingGate_GateSpriteIds[gateId] != MAX_SPRITES) { - struct Sprite *sprite = &gSprites[gRotatingGate_GateSpriteIds[gateId]]; + struct Sprite *sprite = &gSprites[sRotatingGate_GateSpriteIds[gateId]]; sprite->data[1] = rotationDirection; sprite->data[2] = RotatingGate_GetGateOrientation(gateId); } @@ -957,10 +955,10 @@ bool8 CheckForRotatingGatePuzzleCollision(u8 direction, s16 x, s16 y) if (!GetCurrentMapRotatingGatePuzzleType()) return FALSE; - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - s16 gateX = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; - s16 gateY = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; + s16 gateX = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; + s16 gateY = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; if (gateX - 2 <= x && x <= gateX + 1 && gateY - 2 <= y && y <= gateY + 1) { @@ -995,10 +993,10 @@ bool8 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8 direction, s16 x, s if (!GetCurrentMapRotatingGatePuzzleType()) return FALSE; - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - s16 gateX = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; - s16 gateY = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; + s16 gateX = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; + s16 gateY = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; if (gateX - 2 <= x && x <= gateX + 1 && gateY - 2 <= y && y <= gateY + 1) { diff --git a/src/script_movement.c b/src/script_movement.c index 92f36e92d..10517dfc8 100644 --- a/src/script_movement.c +++ b/src/script_movement.c @@ -6,7 +6,6 @@ #include "constants/event_objects.h" #include "constants/event_object_movement.h" -// static functions static void ScriptMovement_StartMoveObjects(u8 priority); static u8 GetMoveObjectsTaskId(void); static bool8 ScriptMovement_TryAddNewMovement(u8 taskId, u8 objEventId, const u8 *movementScript); @@ -17,10 +16,8 @@ static void ScriptMovement_UnfreezeActiveObjects(u8 taskId); static void ScriptMovement_MoveObjects(u8 taskId); static void ScriptMovement_TakeStep(u8 taskId, u8 moveScrId, u8 objEventId, const u8 *movementScript); -// EWRAM_DATA -static EWRAM_DATA const u8 *gMovementScripts[OBJECT_EVENTS_COUNT] = {0}; +static EWRAM_DATA const u8 *sMovementScripts[OBJECT_EVENTS_COUNT] = {0}; -// text bool8 ScriptMovement_StartObjectMovementScript(u8 localId, u8 mapNum, u8 mapGroup, const u8 *movementScript) { u8 objEventId; @@ -167,12 +164,12 @@ static bool8 IsMovementScriptFinished(u8 taskId, u8 moveScrId) static void SetMovementScript(u8 moveScrId, const u8 *movementScript) { - gMovementScripts[moveScrId] = movementScript; + sMovementScripts[moveScrId] = movementScript; } static const u8 *GetMovementScript(u8 moveScrId) { - return gMovementScripts[moveScrId]; + return sMovementScripts[moveScrId]; } static void ScriptMovement_AddNewMovement(u8 taskId, u8 moveScrId, u8 objEventId, const u8 *movementScript) diff --git a/src/tileset_anims.c b/src/tileset_anims.c index 3676006a6..6a7589e36 100644 --- a/src/tileset_anims.c +++ b/src/tileset_anims.c @@ -537,7 +537,7 @@ const u16 *const gTilesetAnims_BattlePyramid_StatueShadow[] = { gTilesetAnims_BattlePyramid_StatueShadow_Frame2 }; -static const u16 *const gTilesetAnims_BattleDomeFloorLightPals[] = { +static const u16 *const sTilesetAnims_BattleDomeFloorLightPals[] = { gTilesetAnims_BattleDomePals0_0, gTilesetAnims_BattleDomePals0_1, gTilesetAnims_BattleDomePals0_2, @@ -1167,7 +1167,7 @@ static void QueueAnimTiles_BattlePyramid_StatueShadow(u16 timer) static void BlendAnimPalette_BattleDome_FloorLights(u16 timer) { - CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(gTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32); + CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32); BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) != TASK_NONE) { @@ -1178,7 +1178,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer) static void BlendAnimPalette_BattleDome_FloorLightsNoBlend(u16 timer) { - CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(gTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32); + CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32); if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) == TASK_NONE) { BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); diff --git a/src/trade.c b/src/trade.c index dd0851bbd..f95b479fe 100644 --- a/src/trade.c +++ b/src/trade.c @@ -2195,7 +2195,7 @@ static bool8 LoadTradeMenuSpriteSheetsAndPalettes(void) sTradeMenuData->timer++; break; case GFXTAG_MENU_TEXT_COUNT: - LoadSpritePalette(&gSpritePalette_TradeScreenText); + LoadSpritePalette(&sSpritePalette_TradeScreenText); sTradeMenuData->timer++; break; case GFXTAG_MENU_TEXT_COUNT + 1: diff --git a/src/tv.c b/src/tv.c index b9d064026..5cca91ff7 100644 --- a/src/tv.c +++ b/src/tv.c @@ -723,7 +723,7 @@ static const u8 *const sTVInSearchOfTrainersTextGroup[] = { // Secret Base Secrets TV Show states for actions that can be taken in a secret base // The flags that determine whether or not the action was taken are commented -const u8 sTVSecretBaseSecretsActions[NUM_SECRET_BASE_FLAGS] = +static const u8 sTVSecretBaseSecretsActions[NUM_SECRET_BASE_FLAGS] = { SBSECRETS_STATE_USED_CHAIR, // SECRET_BASE_USED_CHAIR SBSECRETS_STATE_USED_BALLOON, // SECRET_BASE_USED_BALLOON From 67d73ee36fc1cec15088f1ed7c04ea317449888c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 17 May 2022 17:13:29 -0400 Subject: [PATCH 27/65] Clean up door animation functions --- src/field_camera.c | 4 +-- src/field_door.c | 66 ++++++++++++++++++++++++++++------------------ 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/src/field_camera.c b/src/field_camera.c index 0a00dcbee..ae7b2bbb1 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -212,13 +212,13 @@ void CurrentMapDrawMetatileAt(int x, int y) } } -void DrawDoorMetatileAt(int x, int y, u16 *arr) +void DrawDoorMetatileAt(int x, int y, u16 *tiles) { int offset = MapPosToBgTilemapOffset(&sFieldCameraOffset, x, y); if (offset >= 0) { - DrawMetatile(METATILE_LAYER_TYPE_COVERED, arr, offset); + DrawMetatile(METATILE_LAYER_TYPE_COVERED, tiles, offset); sFieldCameraOffset.copyBGToVRAM = TRUE; } } diff --git a/src/field_door.c b/src/field_door.c index 988ea615d..fa813a053 100644 --- a/src/field_door.c +++ b/src/field_door.c @@ -18,7 +18,7 @@ struct DoorGraphics u8 sound; u8 size; const void *tiles; - const void *palette; + const void *palettes; }; struct DoorAnimFrame @@ -278,52 +278,68 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] = {}, }; +#define DOOR_TILE_START_SIZE1 (NUM_TILES_TOTAL - 8) +#define DOOR_TILE_START_SIZE2 (NUM_TILES_TOTAL - 16) + static void CopyDoorTilesToVram(const struct DoorGraphics *gfx, const struct DoorAnimFrame *frame) { if (gfx->size == 2) - CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7E00), 0x80); + CpuFastCopy(gfx->tiles + frame->offset, (void *)(VRAM + TILE_OFFSET_4BPP(DOOR_TILE_START_SIZE2)), 16 * TILE_SIZE_4BPP); else - CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7F00), 0x40); + CpuFastCopy(gfx->tiles + frame->offset, (void *)(VRAM + TILE_OFFSET_4BPP(DOOR_TILE_START_SIZE1)), 8 * TILE_SIZE_4BPP); } -static void door_build_blockdef(u16 *a, u16 b, const u8 *c) +static void BuildDoorTiles(u16 *tiles, u16 tileNum, const u8 *paletteNums) { int i; - u16 unk; + u16 tile; + // Only the first 4 tiles of each metatile (bottom layer) actually use the door tiles for (i = 0; i < 4; i++) { - unk = *(c++) << 12; - a[i] = unk | (b + i); + tile = *(paletteNums++) << 12; + tiles[i] = tile | (tileNum + i); } + + // The remaining layers are left as tile 0 (with the same palette) for (; i < 8; i++) { - unk = *(c++) << 12; - a[i] = unk; + tile = *(paletteNums++) << 12; + tiles[i] = tile; } } -static void DrawCurrentDoorAnimFrame(const struct DoorGraphics *gfx, u32 x, u32 y, const u8 *pal) +static void DrawCurrentDoorAnimFrame(const struct DoorGraphics *gfx, u32 x, u32 y, const u8 *paletteNums) { - u16 arr[24]; + u16 tiles[24]; if (gfx->size == 2) { - door_build_blockdef(&arr[8], 0x3F0, pal); - DrawDoorMetatileAt(x, y - 1, &arr[8]); - door_build_blockdef(&arr[8], 0x3F4, pal + 4); - DrawDoorMetatileAt(x, y, &arr[8]); - door_build_blockdef(&arr[8], 0x3F8, pal); - DrawDoorMetatileAt(x + 1, y - 1, &arr[8]); - door_build_blockdef(&arr[8], 0x3FC, pal + 4); - DrawDoorMetatileAt(x + 1, y, &arr[8]); + // Top left metatile + BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 0, &paletteNums[0]); + DrawDoorMetatileAt(x, y - 1, &tiles[8]); + + // Bottom left metatile + BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 4, &paletteNums[4]); + DrawDoorMetatileAt(x, y, &tiles[8]); + + // Top right metatile + BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 8, &paletteNums[0]); + DrawDoorMetatileAt(x + 1, y - 1, &tiles[8]); + + // Bottom right metatile + BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 12, &paletteNums[4]); + DrawDoorMetatileAt(x + 1, y, &tiles[8]); } else { - door_build_blockdef(&arr[0], 0x3F8, pal); - DrawDoorMetatileAt(x, y - 1, &arr[0]); - door_build_blockdef(&arr[0], 0x3FC, pal + 4); - DrawDoorMetatileAt(x, y, &arr[0]); + // Top metatile + BuildDoorTiles(&tiles[0], DOOR_TILE_START_SIZE1 + 0, &paletteNums[0]); + DrawDoorMetatileAt(x, y - 1, &tiles[0]); + + // Bottom metatile + BuildDoorTiles(&tiles[0], DOOR_TILE_START_SIZE1 + 4, &paletteNums[4]); + DrawDoorMetatileAt(x, y, &tiles[0]); } } @@ -350,9 +366,9 @@ static void DrawDoor(const struct DoorGraphics *gfx, const struct DoorAnimFrame else { CopyDoorTilesToVram(gfx, frame); - DrawCurrentDoorAnimFrame(gfx, x, y, gfx->palette); + DrawCurrentDoorAnimFrame(gfx, x, y, gfx->palettes); if (ShouldUseMultiCorridorDoor()) - DrawCurrentDoorAnimFrame(gfx, gSpecialVar_0x8004 + MAP_OFFSET, gSpecialVar_0x8005 + MAP_OFFSET, gfx->palette); + DrawCurrentDoorAnimFrame(gfx, gSpecialVar_0x8004 + MAP_OFFSET, gSpecialVar_0x8005 + MAP_OFFSET, gfx->palettes); } } From 5c8e1e81ea1734e5ff61fccc780c3fdaedcd4812 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 17 May 2022 18:38:21 -0400 Subject: [PATCH 28/65] Color single-palette door anim graphics --- graphics/door_anims/abandoned_ship.png | Bin 420 -> 306 bytes graphics/door_anims/abandoned_ship_room.png | Bin 419 -> 305 bytes graphics/door_anims/battle_arena.png | Bin 509 -> 394 bytes graphics/door_anims/battle_arena_lobby.png | Bin 408 -> 293 bytes graphics/door_anims/battle_dome.png | Bin 394 -> 279 bytes graphics/door_anims/battle_dome_corridor.png | Bin 462 -> 347 bytes graphics/door_anims/battle_dome_lobby.png | Bin 486 -> 374 bytes graphics/door_anims/battle_factory.png | Bin 366 -> 251 bytes graphics/door_anims/battle_frontier.png | Bin 421 -> 306 bytes graphics/door_anims/battle_frontier_sliding.png | Bin 390 -> 277 bytes graphics/door_anims/battle_palace_lobby.png | Bin 432 -> 319 bytes graphics/door_anims/battle_tent.png | Bin 544 -> 429 bytes graphics/door_anims/battle_tent_interior.png | Bin 504 -> 389 bytes graphics/door_anims/battle_tower.png | Bin 467 -> 352 bytes graphics/door_anims/battle_tower_corridor.png | Bin 404 -> 0 bytes graphics/door_anims/battle_tower_elevator.png | Bin 398 -> 283 bytes .../door_anims/battle_tower_multi_corridor.png | Bin 554 -> 413 bytes graphics/door_anims/battle_tower_old.png | Bin 458 -> 343 bytes graphics/door_anims/birchs_lab.png | Bin 402 -> 287 bytes graphics/door_anims/cable_club.png | Bin 368 -> 253 bytes graphics/door_anims/contest.png | Bin 452 -> 337 bytes graphics/door_anims/cycling_road.png | Bin 441 -> 328 bytes graphics/door_anims/fallarbor_light_roof.png | Bin 432 -> 317 bytes graphics/door_anims/general.png | Bin 425 -> 310 bytes graphics/door_anims/gym.png | Bin 404 -> 289 bytes graphics/door_anims/lilycove.png | Bin 426 -> 311 bytes graphics/door_anims/lilycove_dept_store.png | Bin 430 -> 315 bytes graphics/door_anims/lilycove_wooden.png | Bin 401 -> 286 bytes graphics/door_anims/mauville.png | Bin 432 -> 317 bytes graphics/door_anims/mossdeep_space_center.png | Bin 509 -> 394 bytes graphics/door_anims/pacifidlog.png | Bin 452 -> 337 bytes graphics/door_anims/petalburg_gym.png | Bin 0 -> 289 bytes graphics/door_anims/poke_center.png | Bin 419 -> 304 bytes graphics/door_anims/pokemon_league.png | Bin 445 -> 332 bytes graphics/door_anims/rustboro_gray.png | Bin 440 -> 325 bytes graphics/door_anims/rustboro_tan.png | Bin 440 -> 325 bytes graphics/door_anims/safari_zone.png | Bin 458 -> 343 bytes graphics/door_anims/sootopolis.png | Bin 435 -> 322 bytes graphics/door_anims/sootopolis_peaked_roof.png | Bin 435 -> 322 bytes .../door_anims/trainer_hill_lobby_elevator.png | Bin 348 -> 231 bytes include/constants/metatile_labels.h | 2 +- spritesheet_rules.mk | 3 +++ src/field_door.c | 6 +++--- 43 files changed, 7 insertions(+), 4 deletions(-) delete mode 100644 graphics/door_anims/battle_tower_corridor.png create mode 100644 graphics/door_anims/petalburg_gym.png diff --git a/graphics/door_anims/abandoned_ship.png b/graphics/door_anims/abandoned_ship.png index e46aca9ba94b1b66552d49666d925b87b1dfea1d..0030246b4e08aace30276066cf61d1510e8c2712 100644 GIT binary patch delta 290 zcmV+-0p0$j1F`~;8Gi!+008Fy?~?!k05DKYR7C&)07^mg{ds5z{VzjjXtgJcz|6;*#<;nm60KG{>K~yM_z0ffV!Y~xZ@mwKU z3Izjsi{LrDf@djo$xQ^a6f&fD@c^!c4z7;%CHbOQX+coG>3>J2yua9E;vEep4%iwb z77@beU4jo+zz1O0w+ZfSU!j4`soMfglMxDzfYb$H1p`poTLPKNP7Fm+45Fx3C`yuo zuqS@eM`}MhAk5)%ABLUb@<2C-{s5{TGRX7^e0?>gKHR|OKKz6}WJ(|UTc7yLWz=5< o-*YzyJUM07*qoM6N<$f`l}GNB{r; literal 420 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0IEi7Q8@egp~$Bq#cnfoLFB0AesmJ-~bw$k^lQ;uxZF ze(wc)u0sYQ$3L3yvJ%-<#qj=;Im<4W4{DKIw%y?$WSUNEyJ(bno=f=mXHi6^V?h1o zcAv_4tK=_za*KtxvGuzegnOxL++*r$^uDb6VsB+DYhL>|t}nH0;xdf++!d^*1~Yw| zcqT7oP!D8O3Y4|<{G@V2c>jyXYgd^ZD1LEA{lJ+G)eGhxu46F2CTV2C`S4d~(EJMr zp4dI)tWD9VeUe}MNPoIvo#?}DJd81o4C@>i!W9k_&9~0m?BaiY#VIkMKU7OxBT7;d zOH!?pi&B9UgOP!efv$m}u90DgfvJ_TrInG1wt<0_fkFNZD=!ocx%nxXX_dG&$Q^C^ P1`0AyS3j3^P6mg{ds5z{VzjjXtgJcz|6;*#<;nm60K7>=K~yM_z0ffV!Y~xZ@mwKU z3Izjsi{Lpti&rRg$xQ^a6f&fD@c^!c4z7;%CHbOQY(Y@J>3>J2yuWBLvB%bMz}`S& z5h0A;CHQa!d;oTRo8Zp&6&l!_x-HN&8KK|^NL>(CFaVXkC6KA?#84E)Ac|^*q9iE@ zd*T;;r1ql&!W=I5Vb~ci4|H?r51{HHgG`^m*H=^O!wqci!%yf#ru3n|^@+b+M*UUr nZ5afp0s>S40UD}+faN}SsrAO?ff1I$-}jNP6tjv*T7 z_g*mMI%FVn>|@V5zSebe2X=qqZPXLo<2lV~{ewuG_6MK11i4}-8UL766R5LIVa5F~ z%E9;Izs|5q&bCO*7udkD$ZIx>Z?uDOLFO)&&D+-(9C&*nu5sV_1x?BVF^p>$u&M3# ze2}=w>w%@$0hz0s=RF+_za7#4#j;$R`GSnvcflKyW&B%;ckn+rZq?kb=D2Qt$SY;u zoOjCpFAh7uJY4@;xPE8P$JG;V8%ca%<@v$HR>R1Ay7t|SC`b9FGq;HYy`fs-8c~vx zSdwa$T$Bo=7>o>z40H_)b&U)|3{0(zEv-z}I6;98E>g5EdT|jb2ya<8tgxIhE#{_{P+DQPOZ*6@W8T4sueFI*k ztz}~nB19rN&WESZw}vUTD_DC~=61PPQz4-l+UKK>+}oo zQ-TkM5Ywn3>T@~+VyEkLV?+$|0OPVE_S+20+9KBd2B{{3U_S8xAMee_tCG)Gk literal 509 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0G`Msst;e?TFDPV&9*H$8=og>^lXcknxhr8iYIoJXtCIo$u3tkA4@9dF7a6T zL+DfTf%-T6XIKM|@+2wnM_gxly~;qyRFWl7WZU}CuR9NJ zbqyiHjpp*@4gMU@ghNg~uk0(Vyez!$SVj7!2%#qtMt{0g!1AZLTaov#h6ul|nz!6^7JBH+@Ady{}6rCQ<|QIe8al4_M)lnSI6 zj0}tnbPWu3jSNE!Osz}|tPBjb4S=M?7F+jU4KoV;AZO3t`pHB`Uk|g zD&$0$u!nsn(^P?{3e1|BK@2A?1;~V>=R@QU+=nP=i(lXrq4Cif#R|llQHP{5hUxI0 zfs@G_B+m`lGG!kq%$t3n!}pPw?Hj&?vQJ#c8EvmWk7lxuSV0S-Vh79k>WrYh({63| b!9p+WZ#l8r2o9sd00000NkvXXu0mjf|I3L( literal 408 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0G`zU3V@`9L9o z_or>@kMQJPl*E4e$*Z0PdoSnZen04>ANu@o{{JujTYzp?Epd$~Nl7e8wMs5Z1yT$~ z21W+D28Oyuh9L%~Rwf2kh9=qu237_JCYH<(P&DM`r(~v8;@04rvO5N-fx*+&&t;uc GLK6T^XOOG_ diff --git a/graphics/door_anims/battle_dome.png b/graphics/door_anims/battle_dome.png index 729385b3fc7063eb1f781ecfe03d58bd183868e3..4bc9fab94b53c414908c14401b996d133fb93213 100644 GIT binary patch delta 262 zcmV+h0r~!l1D67j8Gi!+008Fy?~?!k05DKYR7DsmQvd(|-sbMT&E}l6-h+dSVq$wi zN@^)FT64YjVyy1}y@T$QbKYuV%|TLg#iX8JIZ6Nk0HR4mK~yM_&CtOK0x=K;(5cD_ zmhE810@j%Y58g~VvKq02c=V*H!TC-^Jncd}_#w=LB#?YMw|`J4?lCV^DrPNIO7)aN zzK}}xz`Pnw2W;IoG>zujIfhft`=JAAZa8imR2rBUAOR&YV>VM_!NZh$Yx!9}WA>~@ zGMfX;0cDnNuxBMCfPQfOkNUA!95eo&7J##W;XAmcfOJCw`oX)OCqy=@mZ6Cva{vGU M07*qoM6N<$f<&Tr>;M1& literal 394 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0G`t2Ubxw}3(d$%%etAR34jfEWx?4=`T^G8TEdIEHAP zKYQUICzGK7>xE3ks!uOU6vC3-BlG22&g@{dxO{Mv=#8nLeO+wcI@$bCJkzW)p~h-k zfcmylxenp9q$EGVw60c_NxaYEGWH~7e_v2I>4dJq{Gxs5WF@=~|Gc;0+Jk)zs{@P# z%LP@{!byW>wLzl8$j2pmbgZgq$HN4S|t~y0x1R~10w@n14CUS!w>^gD-#1N pQwwba11kfA^2_OYC>nC}Q!>*kacf}fyMGB3FrKb{F6*2UngECmgDU_4 diff --git a/graphics/door_anims/battle_dome_corridor.png b/graphics/door_anims/battle_dome_corridor.png index 198ad9acca356dd0b5025adcdb576b26ba046fd1..78e77869ea6752f126873b250962606ec13f34b9 100644 GIT binary patch delta 309 zcmV-50m}Z)1KR?S8Gi!+008Fy?~?!k05DKYR7L*)|58$Fl$4~+y~Y3k|K8Q+d#sC# z&8(d6&5NA0oV3NP&DFgr5Z+24|6(!!-h;|31}*>q0Om%y|M?OR@geoe~I}pfx;#Tx(6=Ha{3Vc7>ULS^m*)DOX z){!~adWLzPnEQDSEX#xWx-5GrbGITfmmknnd`3k8TOs1R?jjf8CDL{|wi!FF2+q7= zXhr|a2kj%D5iQpx-WIXe9aSYKo zzxKjL!Da&<)_}DWM2)y}uLNG&#a*0YamqnGe2#T?+Y4oRrRgnNS{JMZPSjiqE6Ehy zv5l+7?pFN#Wu8~{3e}eeZe3E+wog9f`9A)VyS`s%zvJ}F{gUcHd%r?$lZR>^fr z)26It*l_xhqeDx`1aF3q3JOkICsaTDuh}DSXHlh}E+JF=;8_LRjg3L2PxKR9rOXch zYhJzfM!<`>#yuAvY>3@-)o1bI3070&`i}RBdrCe&V)cus4d`Rl64!{5l*E!$tK_0o zAjM#0U}T_cV5n*WnyS$XsT^sU}a!X+moDyq9HdwB{QuOw+5bzx37T$*VEO{ JWt~$(69C{dqW=H@ diff --git a/graphics/door_anims/battle_dome_lobby.png b/graphics/door_anims/battle_dome_lobby.png index bd4e4e895baef67bd6e8104f8b3d248b6496ae70..631cdeccedb5b1fd7973a1ba8127945ff9bc2544 100644 GIT binary patch delta 358 zcmV-s0h#{h1NH)t8Gi!+008Fy?~?!k05DKYR7L*)|58$Fl$4~+y~Y3k|K8Q+d#sC# z&8(d6&5NA0oV3NP&DFgr5Z+24|6(!!-h;|31}*>q0Rc%wK~yM_z0f^Q12GT<;CBT( zijWm3Y$_V01R9c(Tp%U!DX8`w=BIF-q}dL6x7v!Hh6B)W0DsQFjAtbyVWmR6#-C)5 zta(_EK?PSiYutY2T;o#kiL;NK_kz>6oL8tZh>?#NE4ULpW7`I$bbEl`XY}wLW9YH! z_|1^88b$_|vAT)$&*U1U^ix zU~3urP~Zi$sb5UfrhkY(@&7o zRIm|Dk6|vD6jUCYNC^a4kfsDQ<#K9R2+j+%!2a&%8>gJ=K|q%GkN^Mx07*qoM6N<$ Eg75LGzW@LL literal 486 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0Hx^*@SJoq$3D$%%etAR34jfEWx?4=`T^GX8nGIEHAP z-+RH(kJ(Uw^+G)>pTl9sj2A1n-P-zMn`h8&jt9j#M>Sf_O zUu3R%w2sO8Y(}EB+vTLYA7{HI-tE~CK5w1f?fC^FZsK!4@0_}@FX_|^QL`q=L#EEs zcU0Ye9WwZ^{BVQ)o&JZ)FSx|!397S(IZXDNttP7R=E?)FK#IZ0z{o(?z);u7FvP&r%EZvh*izfTz{x~Hq3%Q~loCIA+?tFr(A diff --git a/graphics/door_anims/battle_factory.png b/graphics/door_anims/battle_factory.png index 7ed6c876b89fcf6701668add452862a571c62fec..1d74d8b58076856ad87d26e8ece5299f0ce5747c 100644 GIT binary patch delta 234 zcmVLkH5R->Q_=JO~ kQsM%E7{3$4pi=k%0C!q#D)xyq5dZ)H07*qoM6N<$f=U2l%>V!Z literal 366 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0HR`Tu-%@<1VhtT-`M>4Be@h*jZkp~0#Sb3O*?Ii5pHm!(lynfn%?Z#_|^Ts9XST1gE z;OWp#Q?R+gXjtjda-K`zs%wmbz~k~Hi4ZP%hEsp~zfJS|tOInBYKdz^NlIc#s#S7P zDv)9@GB7gGH89jQG7K>=wK6fXGB(sUFt9Q(P`LP;9YsTKeoAIqC2kFYJK~yM_#n7=4!ypU=Q16sJ zTPRF`e92uXQRhK2f@jGJZquO|f{-8%@j0bcy*mW=`2*VwJAZiEY#foz;6Y~tX!BVn z3K*D2!EMI7VXk;6@Tx#gWhb7(vMh>JkdIiApGy_okOU-2U!d*shIxLONL6|VLJQ|o8^>Bk+{&pOXP$n64o oQ)}trd+6ua@Ebk!1a|s?H@mc}+g#W~-2eap07*qoM6N<$g45WB+W-In literal 421 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0HRgOK~qZa^V{nh_rEHD^&M-s%LqarEi$r zi`zLe3(ro7NN2wIY;%vtM2573xjo^BBMJkL>{e>hwtnb(uew$Hg!_UM=XY{t6fjL$ zQq&zdaq>b14;vlBC*5{ji~mSvsiy&(F4{*A4|A z4f_3XbP0l+XkKzsQrc diff --git a/graphics/door_anims/battle_frontier_sliding.png b/graphics/door_anims/battle_frontier_sliding.png index a43cf519dda91ceaa86aa2b89c4b73e978aabc88..1359f4725b8d6061a5088ffd6efa5677705df3eb 100644 GIT binary patch delta 260 zcmV+f0sH=j1C;`h8Gi!+008Fy?~?!k05DKYR7DsmQvd(|-sbMT&E}l6-h+dSVq$wi zN@^)FT64YjVyy1}y@T$QbKYuV%|TLg#iX8JIZ6Nk0H8@kK~yM_)zGmGgD?~XP|re> z0Vr4iDHEJL!8d&pVTpwzF-um+3Yj5%`w;O@aEo#UdeUK#&wafZSHXk%QANf*neF9o z1g7>KeN6LwFA!D;F~UMDM&Q=>=MM;QZQE|c(%{lGr}FO!U~01*woi=QXGI7D_krgu z7Gj~7_uMB#6x=648~A_R$3PDad7tG%c@_h)NKFB;$W1!6x6d0NH`N|xMv)c(0000< KMNUMnLSTY0w{xNZ literal 390 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0I6<&#y$H-SO|$%%etAR34jfEWx?4=`T^GUj=@IEHAP zzj|RKZ?l02OThXGq7jXe6E+2?EN+qe&$(u{f)ICrfrC_8W4^r7KhG71MPGQfJKB{e z-eJso=KWMM-0=75`5b31mVYVCo|WCW!LdV3Ea@WC_r!{Qjt$36dabXq-L=_&YQK6z z;r|`|-|wV5bJ%`&e4-ucvYrMLXY>mdKI;Vst06Rr|u>b%7 diff --git a/graphics/door_anims/battle_palace_lobby.png b/graphics/door_anims/battle_palace_lobby.png index f106ae960d99172907dbf1fa3ca61e9ecb42222c..a4aa998d46eeb4322e164473076d799205e5b7ca 100644 GIT binary patch delta 303 zcmV+~0nq-i1HS^08Gi!+008Fy?~?!k05DKYR7C&)08&zFl$4~+y~Y3k{{R30ltE&o zVuQVlq|LM`=EYKbDG;PN7|lu`|6(!!-h(7-*tP%w0Ln>3K~yM_t&lMegD?;T_W|Tr zG|=R8G)9Wt(BLL7h{OjhrH$g_2Xtwi=3@I4T!2texN5vwdw+ckBE_tT@KD^^4IJT#s>2cp$KNAu^0pj%yU#fR$$x940nN3ZYX0}%i;aZ5gX}C*k%4RVhKO=^8x)~B)9D+DvSUC002ovPDHLkV1itn BhQ0s* literal 432 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0I63upOXra&QqxVj{_jU(+AI`l!<9bnreee;lUovJh%iYdA?60$P`FbOh z{TY7|&`+u*t`Q|Ei6yC4$wjF^iowXh$UxV?P}j&X#K6?b#MsKzOxwV~%D~{v?d1k2 c8glbfGSez?YuMW+-vbIhPgg&ebxsLQ00^m%=>Px# diff --git a/graphics/door_anims/battle_tent.png b/graphics/door_anims/battle_tent.png index a0a88e4c5fba405715e0b1441841074fbdef9119..b278e33109f5c138e7da2d54e3ef3f1fc3357411 100644 GIT binary patch delta 414 zcmV;P0b%~21g!&*8Gi!+008j2^br6605DKYR7DsmQvd(|-sbMT&E}l6-h+dSVq$wi zN@^)FT64YjVyy1}y@T$QbKYuV%|TLg#iX8JIZ6Nk0XRuSK~y-6#n7>8!!QsA;ClrX z8fYOyJ?3pXNFieeopE+skhkbyg909!A;I@H89n$F`V76(sefq;t?5#780!O_Y~2q> zlWGO@Bh}5Q%FU&$%{)w0ipt}MaH-gYsq5uE@ literal 544 zcmeAS@N?(olHy`uVBq!ia0vp^0zllr0wfq7@kRd!QY`6?zK#qG8~eHcB(eheOiAAE zE)4uuMs|yVJoXY#Usv`gjG}BTtlYW=Al(AViGF1u8i*Bu7z|PmFkfY0V6^abaSX9I zee}Y{tiuKZY!9ki_cgKiSI#y*If1W@HS^q@yZo**%?+i&%(zN^2&$9M+s;Thi&c$}8rXb6tPamq(` zTskAaXWpsi`cn&bDx71@Tz7u$|1;^CZ_BdcB6t6m3{8G(@bq%jY2i;#)lZ1zK4+Q3 zxLB{@@k<%@BN!DUSN`LE>z+zf9h7V8d;DMS3j3^P6xOMr+wdN=JT3g+d;LRy&di6o8z<)7GA@zX9~Ck%>kT#Y3=2O5XV4xf#thn?;Iu)C z7@Ri9rig4xmu~l6U2c$dL`44^nulmN_vZug{Ym{P@AMd?Knz3$0nsTYCPd;9reJU* zNazteC+o0$>qx<(yXXEtU*)}j5GAUj?6-$Vb^!S$^oDK`CD)xOXZfG-eVOWRS01*$ Ti^=MU00000NkvXXu0mjf7)Py+ literal 504 zcmeAS@N?(olHy`uVBq!ia0vp^0zllr0wfq7@kRd!QY`6?zK#qG8~eHcB(eheOiAAE zE)4uuMs|yVJoXY#Usv`gjG}BTS_}U0dIE(6k`w*PKr|3505KS(9$>!8z`!Wr>Eak- zaeD71!@R==JgfopT%C{IadX@x#SvKfLRTo@u5O2&L%?SpTi3Q8TW3%2Q0^-RlNLTq zu=kku#Z_X5Sj{!2m8|kxuU)Xq`yHVB;of`yUj{O5sc!_FootxI7W96ZZk6Ovkas!W z>iL1(_3O94Ep_uS-nV?u_Wsht+g9aP@JG!P`}cnDzlHYIi!R^kWxlwfCsx7Bo%Neb zmGfDf!-u{bN^fEBI@h>OJuP>F(vda1n>5pAUwZmDWV&>LtfR``wr7cQ&;IS{++)Ae z{^?tJX0Zj0I~BT8jje1Lnt)xo3(R- zb;D&Lx5HaHCcXBXviXw#kBvUQ@fOjpg&TLW@&W@%wZt`|BqgyV)hf9t6-Y4{85kMp z8W`#t8HN~`Ss9pE8Cz-_7+4t?2piwZM$wR)pOTqYiCaTbUea|?GMmPXTQ@hK~Q_=VM4Em`J(?>uX3{ iLtjJU8qQbX8vX!lNHy}x-WW4rtaSYKo ze{_Ox7n7kt>wVE8hWF8e>G|e6_+2lHXWY@A!dTAtm{G*(oI&W^Z|xjS98t4tmIzh6 zcQ)pgYh2Fg`&sJD>GuV@3(xUApLghu!Fzo(e)Xn>pGPx12d#z`u)=>kM0Ru&=DitF6D?|4zAV z%X~SxDWS?oU`c~nsIBj2p&4?|^bUV9_@0!%rAXa_^~#J_7pHa^*=lht7X4bp{#b3r ze5P9^JhJ}qa-v@uhz4Q>AO?ff1I$-}j5VGvjv*T7 z&tBZfdssn$H6U$a?~{#2++J!4%#)N_qm7waZFv$n(@qqYYy4QEq2V<#-uA8}cl~N( z_p=8IuFN%VJ>_`dLF0}{?}FQ69IvI09GNe$(|^6Bd8Yr%}aVC#>4_ zZt}-Aj8cfZ}y#_!Q7Xv(T57a&i^aVu5Z+24|6(!!-h7Aq}96QGbla-v@uhz4Q>AO?ff1I$-}jAfoKjv*T7 z_g*mMI&8qh8Zh_T?7ddz9xoKFrcao+z}#T2t;mv#7aXmebyGT=jY~2%(PTcPcT19cJX zM`d~1KK5&zYt@yQSfz6KlH(TMm47$LId7f6M!Me1{$QG=kn4F)(Xs^o^(REXUFJJF zk7>hJ#|gQQ_y7LM@OWxi6Z^MM?m!o-mbgZgq$HN4S|t~y0x1R~10w@n14CUS!w>^g tD-%;I0~2in11kdqxm_o$P&DM`r(~v8;?|J=yr2yfIG(P4F6*2UngCQTf;s>I diff --git a/graphics/door_anims/battle_tower_multi_corridor.png b/graphics/door_anims/battle_tower_multi_corridor.png index 145dea7a50ceb37a94d18775bcdfa610be88964a..cb32fbc70b8323bbb77195d14fc529dd8b81feb1 100644 GIT binary patch literal 413 zcmV;O0b>4%P)|NsBq)#m^IoB-~N0KJQIbAwuHv~!Eay(tjhN+ADYG5_9!)HKb>0003f zNkl_(H;Cvh*Hqa}$zlHfN z$^vM#t8;0WXn|L2O}7JSR=X|7p;I%<_4f_UOg5HDs5u6VO#})7epi)o@B*Ng100000NkvXX Hu0mjfq_nO+ literal 554 zcmeAS@N?(olHy`uVBq!ia0vp^0ziC#1xPTw4GWwMq*&4&eH|GXHuiJ>Nn{1`nUcKS zT^RVSjO-QzdF&;gzOL*~7)9CG%s-xC76J+hBq#cnfoLFB0AesmJ-~dGfq~J<)5S5w z;`H7td$X7gc^DGx*KV))>brg3&h{5FJQumYh+3s{oLKD3`pr1xlmDzIQ5n+fnwt5W zQzONe->X`2UCy5ATfoxxQ;hfH4cgC(W@|=rZI95qs%ianOF`gzx9wjHiNxW025PT^14vC26hlq(Mytg0oh5hW>!C8<`)MX5lF!N|bK zK-a)f*T^u$z|0DWOpLV+46F`Vp1Vj&_|fXPKRU=QYE4bF4dJw43?9T@mv-hcc(3FC8MO1PW?Q^M#N zm=a3#FexF65txpM%$9BY3HBSaX6uj$sg)+f)`1#__pVy1 z;@VyZa=UUnArgS8A_6=(STWu$ACft$%%etAR34jfEWx?4=`T^G9G!lIEHAP zKRRJACzGQ<>vC4Z?d;M9yN)pNZ4`*y&?K46dndxOX6ucX8Tq{Dim%(+o@J4h_>pk$ zkFDo)&m=D?f8pRurPF3i^7>Msr}$gQHiJ`g>WhP?S6z{rwe!`s%qKVWLd$c1bBbkO z&3h`qv2d#1;Zu!L?cdi$t$K7Tj=gAip|zq=!(>G!8@s0Ci(UBbKen@8zaS^2Qq$dE z%TRZ?UL}RY|AEx)_lIJ0G-4+T7~MI_R^tDF`7V>ZM>xa%duR4KEwC+UZaI5k|DTmh z*B_MIts_7Ge--0lfky&7&Nuel{L~=ryKcS3sm+gNfxcBOag8WRNi0dVN-jzTQVd20 zMh3bDhPpy@RBzdxL|EVrqLq zN@^)FTBOzHYQ4qo?)J^q?wp*obF4XY#iZT6gUSE^0IEquK~yM_#n90a!XOL=;Otc0 z0G+@e-h3)_0$?H?&lyZ4;2CRuZ0@-GE-4g#a;JlnMbmMbWPcH~C}~mEdUw8Yajmvc z+P4eU0{95U{o3(ZMM{eKY%xZkyT*b27fG;GmLQ^LFnEGcrPCickXr_U_Q|L6t^MsE zQpapj`lxtCwBW~QC<0n6(ozJ?hg)m;VDEg)eYP=ny`{SVW7`L-?5wo_=8{ VgMp($0{{R300>D%PDHLkV1ft0fJ*=X literal 402 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0H>r5EZ;P6CAlk`w*PKr|3505KS(9$>x-WUTUZaSYKo zfAqpd!9xl>Y!B8vsIU@z$xICB mtnJ&QpXpYEfDi-(^>YXRg4W{~fJGeu0000-HI7IBY;8z$%%etAR34jfEWx?4=`T^GCDk6978nD zpS^UEm&uTa`NEk)3~P>atvR6M;nQ$K;qHN%4=*JI2hM%RtjJftx8EaoO@u*NYFI(q zn?pQvW*BZZ{8OdPG%qvXBBjs%knQIU4G&&)-{WaA-WF_sadxKhtIzY9nuG=BG)(AT z{7bM(bVXf<{fp<(1=qM6*&}anPq)9k){5~UC&#OFMyD%kwwjlY1_0fpTH+c}l9E`G zYL#4+3Zxi}42%qP4GeXS3_}b|txP~j+rYrez`&;cYzc~n-29Zxv`X9>d~cPW0D0fj L)z4*}Q$iB}idS`c diff --git a/graphics/door_anims/contest.png b/graphics/door_anims/contest.png index dc466be116c595fa1ceeed0f4542a215f7d211c3..8719b23ad4a989fea0a6a63f2261d8460621bcd8 100644 GIT binary patch delta 321 zcmV-H0lxmk1JMGI8Gi!+008Fy?~?!k05DKYR7DsmQvd(|-sbMT&E}l6-h+dSVq$wi zN@^)FT64YjVyy1}y@T$QbKYuV%|TLg#iX8JIZ6Nk0NhDLK~yM_&Co##gD?;U(7A%R z5Rc)~gUk`)z8izyLR`o|_JTJFvs6XFj^uN^G$!ACZMig&;qlfT$qQZrn$gL z(ULSkxzEy;Ue`64vBrsW!%t%QVLmH9qvo>!gCzI}M+9TMZb>#p3_Z^o^zNSJ?AiQ$n$vs?n7_$ TyLB{700000NkvXXu0mjf5N(pO literal 452 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0H>%Os~AO?ff1I$-}j60q#jv*T7 z&t7okYBmsHy|B~iyi$em!PuQ(=wG{hSuXIl~a0!x6Ck~xclFo z(gVBpC9p*uz1P8W+UsrOaxMj>DGtI5p^^Cd;Qn{G&yiU{S@yQ0Lh7USfVR%=7ci=$qdD@12m;QR<&g1>3>=Aw|}^EiTYC4*kV(vs=8u} z)wp5r@IIwvs^$bVm$3A9!dV{!Kmzb_As9!3xIC7lrS(jf8Q3zz(F%Dgr4c`Mp zn*bN;Gqe-kM=?tKm-i|5`3~DuN`_~VC8!c8{1H?M^^;5h literal 441 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0Hh4vCF+cYs0y$%%etAR34jfEWx?4=`T^GA??$IEHAP zKRe+p?_mX=)<{Mp#&?>}*IZEDHuqf{v&)r8^aWr4E|374xTJGN%GpHQuv+<(wIitQ-FqyyQ$54s*X z*hiP8oj$jwWs%AWFRMC+Hce(d6OkEFr_|kkPyZS6yQV!?E52>x5h*9$l0Sk@yicC2 z^#5tYP?50xlQCO^Fwk?VC9V-ADTyViR>?)FK#IZ0z{o(?z);u7FvP&r%EZjdz(U)= lz{Wt~$(69BShk-q={ diff --git a/graphics/door_anims/fallarbor_light_roof.png b/graphics/door_anims/fallarbor_light_roof.png index 4c81ba10e737a9ef27c55d401bca577134b96764..a4c959f8831a985f7279cde06d6b0dda4bb62eaa 100644 GIT binary patch delta 301 zcmV+|0n+}k1HA%}8Gi!+008Fy?~?!k05DKYR7DsmQr_mIw8e9joKky(L4$*fVq$wi zN@^)FT3W2EgT>ze%~Ix^G2VM1oMI_+#iU?vN;Uuh0LV#1K~yM_&CtsY!Y~X5;LOr) zP%{CJV1asrh7)kAnoF6Cj*t^@WrfZ_?YON7&lAFurB89H)PKLZcDpOL3CC^VHhs76 zxlQnG;5NOM@me!BTE=QU!E|};<)9jXuuxb8h_IL|ARk8x5VU8EIGiBDFF&KfERV2I zWDH08C=rzw`La|!W7_Mt`S=xJ z*&iwLn|1q1^Y%HnQ;zCAHruINoHsdBa<%E>6{$_vgng#_hw;r~^ayu#Sk%!lw`o`5 z5(USdhdSQQQhM{$SnJL14u{0onek1GWN?8Gi!+008Fy?~?!k05DKYR7DsmQvd(|-sbMT&E}l6-h+dSVq$wi zN@^)FT64YjVyy1}y@T$QbKYuV%|TLg#iX8JIZ6Nk0KrK_K~yM_#n8n39DfXRj8W!*b$mc|94tA| zae)1CB9HvmBzUYiSF8O~yQ`r+Po^vTu0WW0*UzZxPAqj{fZv`L)CnG_ScvNCo zunK75PwI!``x?xn!G9z8mjbWZP&S8Ktv5i0>%pHljI9<}8phTSEY{Do>t{T#pKYFh skkbWnr`FQL^&imBZ{d3A3jF8?-aRpK)BF=v3IG5A07*qoM6N<$g0l*Se*gdg literal 425 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0Hh>*a~@r+`8N$%%etAR34jfEWx?4=`T^G7fsWIEHAP zKYHOT?_mWV)(2}6^7f`J@44VuWbCfAwQFWWRrfvXkX#-U)xc^Vp-bu?zgIXjFwAv6 zY}B{-T;r)945uw3x^f;f{C?cg_+)Kp;p_~}8CvVuc1d%@+<+vbd6)CQ(?5B*=cKWZ1!32^?=#xKrnyHGLzTYu2{=S?@9?e0&= z(zOX+a*O}`+WDo|{jJu|&z)C);j(1a@~fAWzil|5FIatp>;H@P`>ZD2zD8wC3xJ+c zEpd$~Nl7e8wMs5Z1yT$~21W+D28Oyuh9L%~Rwiavrk2_U237_JcXr9lMbVI(pOTqY XiCe?k=SviU8W=oX{an^LB{Ts5POKvCk*}rXS0nnfl3$C7*!K zEpXHV9AO?ff1I$-}j5VGvjv*T7 z&t5pld00V&Eg}2`*WHy5oEW9Q-m_@@Bg_$bz?uET(%oP7{^&R&<>ddizT#(x#;?_@ zU1C+ZCh_&S_)gljY*__+%F3A}y9xm%$SlE;)#KKX)V6EQZ#{O<5qm<~stqdlw zj@r%tGrLZy-tCpUF9vB^d%C+C%&;PHVb$>iyZYV|NsB?oZjAhtgLGPq&XP?txEs^0K!Q`K~yM_#n8bG!!QT{Kz7Lp z86n7>!0`aJ$uF-IrtP=C?oeZ!MzPv_gM@Sc+2D-aEnVN?*|RIt8qJR*Op{~RBT_TT}FG$b#Zg7e@(v|@XG z@u+JBxaK}09G$Ch1|&nPkYVk?)Y^G&?P+f98Ksh!-wdH3@o@IsE_t002ovPDHLkV1nMDkG22+ literal 426 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0IM72~4hI-rn1a-v@uhz4Q>AO?ff1I$-}j61-6&Xirzgxy4r2!lc(&5 zLmqsdlQJV{ufJaHZvQ>M?C#q9-&j8N>=&Jl?e85yxU6OV_fC1=nl%$lD}Po3eWP09 z8c~vxSdwa$T$Bo=7>o>z40H_)b&U)|3{0&|%&m;gv<(cb3=Ej#`Oczf$jwj5OsmAL Up@?Z)At>NHUHx3vIVCg!0No&ubpQYW diff --git a/graphics/door_anims/lilycove_dept_store.png b/graphics/door_anims/lilycove_dept_store.png index 4f036c51db1cce8e59a6a6ce35f7560c15925720..7c64ab6da82eed8da704b662546b4b02ddad9b5c 100644 GIT binary patch delta 299 zcmV+`0o4Ak1G@r{8Gi!+008Fy?~?!k05DKYR7DsmQvd(|-sbMT&E}l6-h+dSVq$wi zN@^)FT64YjVyy1&=A_=ugVnTZ&74wm#iS7?mT&+70LDo~K~yM_)zHBWgD?yQ(9D9= z2|_0zU7!#}7&pAMy5; z*D{sX4xE-*w9NCd$g{mdEj|#D56pQ+>~l6LO^COY4#Bw#Vn+wAu=b4DS}PbCRdtHt zNqiN+tTxS_TLx9`7k28VZE}$|scl x{ta;$3h0Ugx+HS}D7Ya2g)|tTC=I`p&kJi%4I^GgaY+CG002ovPDHLkV1n6Zgs=br literal 430 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0IM!?^YBQ-MMP$%%etAR34jfEWx?4=`T^GLCt=IEHAP zzk1;yZ?gdp>xDNLJhjqJwlWqa2rU-<&v4El&R9x6ms_-PiagOE-K}1%9g2+lg21G45DW9rOU4jg^ z8O2%!6>&x%-VrPoY=&U@VDo&^S3cpqe8%_u1K)6fCzDua#2GUDh&V$!xX1@z7X3$o Ua2+mB00000Ne4wvM6N<$f+}Kn761SM literal 401 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0G+2VO0$cBWnD%(#)KYk_ w7?@g_SXddGY8x0>85kVi<9`=LLvDUbW?Cg~4VxZ*PXvXJr>mdKI;Vst0Py&PT>t<8 diff --git a/graphics/door_anims/mauville.png b/graphics/door_anims/mauville.png index 63167408ad65d2c4447ed7ad1cb220a02a51ea0f..fec5f344fba4ee8727b153750c52898ef5dff8f5 100644 GIT binary patch delta 301 zcmV+|0n+}k1HA%}8Gi!+008Fy?~?!k05DKYR7HEVz5oBT?(SOE)j_?qN`r%oVq$wi zN@^)FTGiFnq@=9o#rD;U-osI7A7p_Z(CdM_6CGYK(Mn|~_+h(K*TfTuQI%Q(w5 zyn*ANDBqibm`X-uz*KgDWf3U*eLq{?Z(@a6tuUXh+@^AyV!)C&0ab2wb$--Ymt_N{=>Qg=s5v!-9+T@v)00000NkvXXu0mjfr0tBG literal 432 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0G+-S#h6U4TLY$%%etAR34jfEWx?4=`T^GER89IEHAP zKRe+p?_mX=)<{Mp#&?>}*IZEDhu;c&>XRz4+3CmWjEqbwV+M1dweX(!Gat8uu zYd0`>oyW9lO=)SJiFgc$Q*6F-(3W`tTl9{8`du^OorLHdrijKTdmVDTSpH|V#;)D4 zdeZEm#;H|*n7E{wb+?$@a67qt%7^JcOMch1CwJ*Dj_~5&$!__NXD54M#j9XDeuG`1 zHPig`P6Pd|3fCO~mu9Lz|5h=vnNfh*TABAFu$ojztj5Ewj$&5RaJ(leB z^wY5%tb%o#d2_I3<}dtBJ{9MYNH2luk!102 Y0_M|E?x({8D*ylh07*qoM6N<$f}$C=tpET3 literal 509 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0Hn-ldI4&H{x5k`w*PKr|3505KS(9$>!8z`!W#>Ealo zasKQ@$Gm0(0oDta;@>4!TQ=wxP6%s0BGw%dXqIyzkiVgbanUc9sZ|X*MQ#5KFQ}DV z4Yih@cZ{vyK1AJdY3HjFkC%&Pd|M&4LT7WPy3qNYSk0C;!*kodEaE-x|7DJJgO01b zcVJA{u65P5`dyEz{d<}{4hVhrTaxJftW4DMo{Zr+!S@WzChyiI-|#kQt8zo?GyOllcFj*FdgwR4oOnL8&_!zL zq1~w`@0XfvSoQUU`^D-f&9)2kC!FWn6M9tF$!(Vg-wF1WN92~z4|_8I>i_vQw|++c zm9n}S*ZBJgKYk_7?@g_SXvnxYa19?85r<(i!DLXkei>9nO2EgL(R2y5}>&7boFyt I=akR{07nnK>;M1& diff --git a/graphics/door_anims/pacifidlog.png b/graphics/door_anims/pacifidlog.png index 3e05288255cf4fb19527b03c2878df97f06632ce..841c31658d649c60888ccb6ba2b517e797ccdb9f 100644 GIT binary patch delta 321 zcmV-H0lxmk1JMGI8Gi!+008Fy?~?!k05DKYR7C&)0N&=Lw7q+rq+)}MN?KwmVq$wi zN@^e=QtsxY?!{uwoH?X>7=uzVgM*7wYSnC2)-eD80NhDLK~yM_&Cs!N!!Qg5Q0ydW z0zwnWTp>xtQqlxAPABh?QCM&Q7ICi%GngPDosT*fX>$1u-hTlN`JovwrE8#Tu{CIh zR~Sr8KmiWW+M&O6)&OE}?FBIb`!q9bgJ{5NfXXBw4cz7!>HdfrG2RuA9X~sQ!e|?zrzLOfHm-^{Y=wbYRQNvc!e)WpD$QyjQeT) zQn>9vAi>DIdOAf~)fl;kt8v{+c;C+xkCU2H Tl_fKQ00000NkvXXu0mjfJF<;- literal 452 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0HnotH1JOa=-GBq#cnfoLFB0AesmJ-~bw$hhO_;uxZF z{_KT~y@w5WSOeA_I90pu0)v*xske#B4^o+qFI^QAHo>-WC1(zQ=^_{D#wP7cEI)bW zPq_Ws;5%ni&W1I6-1;snE2*n(Xi$$hY|`)DaloeCz)1bWoHVx^Gn83)17@-;X`Fvg zBFkUx@Qkp+TOYR`){0@9sBKYy-NJ8gHJj#|#eN^WuT46TeE;OjrjFj6K5;n*-aT9A zzuv09HD!jnMXR>Qe0_`S65lQt1pj!}pn9<3hNWxN)2NiC88I)}C)%x?KWBR3bdH+3 z;#I8KKctwieK6Il=KTNtGyA5)NoU>eZ7%})Q?2OC7#SED=o%R6 z8X1Ndm|B@wTA7$=8yHv_7&M$w^Fz^)o1c=IR*74~$BFYkfr8Z2)z4*}Q$iB}Hm9I~ diff --git a/graphics/door_anims/petalburg_gym.png b/graphics/door_anims/petalburg_gym.png new file mode 100644 index 0000000000000000000000000000000000000000..42a1e1dfde2db2157bd42c50b25674799c68eca1 GIT binary patch literal 289 zcmV++0p9+JP)KhL>^uRK(%$3ulnyX;06ya- zOzo5LhKS0Us^ypc=!N^yOYXRa4{(m*D*?Xj1*!#b8v&aEREt2{@bUlY=NmYPrGDU- nQ!N5s0yhVE3EJSPcl|s88&4S*v2toa00000NkvXXu0mjfj5&aT literal 0 HcmV?d00001 diff --git a/graphics/door_anims/poke_center.png b/graphics/door_anims/poke_center.png index 8658107149024abb90fd59b85dbae29fda13df90..8bf5cb146dd19441ed4d034c632a843feb8911e3 100644 GIT binary patch delta 288 zcmV+*0pI?k1F!;+8Gi!+008Fy?~?!k05DKYR7DsmQvd(|-sbMT&E}l6-h+dSVq$wi zN@^)FT64YjVyy1}y@T$QbKYuV%|TLg#iX8JIZ6Nk0J}*R< z1Gu20io^s~Ca}|`0F+29gp@THB@z{Q2I8|xf+bKo_|;RsE`PfFiJ2Rb0g{L`1KbS) zyQ|_R0Ad&*SK2{hjXWTA9{Vz8M(Ii5N$AO^&V7Gb3x0tdEk;m8i+C!_{Q`t|1lZ0P z8$1-nW`4zl>8d~5r|W!#6=1G?AFOSE|H5vKTr+uE5JY|BPgBK|P0000 z>o=#Mbc2%+gGp-+ufq1dN$g4q8YP9u_k85}=H&9e)XE6%nnoE@ z_W+l(HLrfZW;#+Mw)4D%^gf=$$#q9tUaqpgy?j+oi>O0Rt^B*1X&hY_j+gK2Zxq?* z-)45_?_0amziZn6t>0REjQyq#qsYYB<^e6HKd&sWowr76`n=}-wShoysFt`!l%yn< zq*^5xr2;7iBLgD?T?0d1Bf}5_Q!5ioD^nwF0|P4q1O08nuTV7P=BH$)RpQnV_j+|0 PD8xKn{an^LB{Ts5Hm8kG diff --git a/graphics/door_anims/pokemon_league.png b/graphics/door_anims/pokemon_league.png index cac740f561669701a81214107f4b3424fa7f3113..34419ac0ada256811ab19aece7d6f5b2fcea3344 100644 GIT binary patch delta 316 zcmV-C0mJ^i1Iz-D8Gi!+008Fy?~?!k05DKYR7DsmQuf7r?wnf9b19@+F@uAPVq$wi zN@^)FT7$*jVw|-9|L)%2#l^*>q^x`Y|8tR1rgi`T0M|)GK~yM_)zC2tgD?~Z;9MaW z@K&KGNV?Unq0*kCv(Po1XE~iYaH_|EtQkQqVSuYz2Xw7-6&Z1IFFcz>ZzEu zrPhVD3C3KtJ{bcjH9?9A;%n6PO^9<{CwPAs;^KXp9;TwLu@ZhIpAt)96A%vq0u%xQ zB;HIoiZ$d0Vl@O(K`sf12Lb(4KJP*Ks6Bwk?+A!x3Ax6wvw+;-b3QLXcx-WL))haSYKo zfAxYP*I@+_wgls}?g>l1*_OZ4i{*}UJi)o-d4}i4=v|@y0eeFA9!UQB=c44f;Oz}N zk9+LDMCy-OuIKt?_-hWc#NuZwLRI@GerJ80D*X7u<$2XhZuLsc;xswrz9M;T!=|uT z9ub0CUh^dTU5o2woa6mLQL%* zwqsMn{RhQ%`iyS{3#Z-wm=wK6rZ rGBnXPFt9Q(_`3a$0*Z#*{FKbJO57S+UZubP0l+XkK*mRX; diff --git a/graphics/door_anims/rustboro_gray.png b/graphics/door_anims/rustboro_gray.png index 2cf62b6dacfa9512b7ee585484155237b91cc865..99211c11a9641b89217ec37f97c6ff2b039671b1 100644 GIT binary patch delta 309 zcmV-50m}Zk1H}T68Gi!+008Fy?~?!k05DKYR7G>er2qf_-rnAR0001U#iU-u!}|aL0MJQ9K~yM_&C*>CgCGn5VD5x* z2e6R~47~t92avVbU!heNmhEv_4dDy4#x@#jE!1Tu-sr1oNz%x-WL)rcaSYKo zfA&%=U$X)aLqgwuKK=veStrCYG_%i`=)87IsMz$kg^|1uxwjlMn{_Sf?ddmLzM48L z&yHu_bn$BE<~^A+YNw_@*z-w>O($%{HN!nh#}=*VJ`lb~A#DAIS;72MG&Z=#SsYxH z(ZIw0mQhym^1~-Q&*li5SY4DjA@ywf=ao`_jRoeEGet;TdBnI}!&6}Gvx>6^BZ~|6 zaUSX^cYP?F6}O6`b2Zaf?%7JYM)T)<%ztM5Z~pf8Kl|d2#1^F2>ip~~Xf^o{B<>Vk zUH;RCammd;e>C2gM*#h%TH+c}l9E`GYL#4+3Zxi}42%qP4GeXS3_}b|txOH9j4ZSb m46Fer2qf_)z!VUw3M8jdxL|EVq$wi zN@^)FTFuqwi?r45=Dpt4ti7yitdwGN#iR;hAvOR20MJQ9K~yM_&C*>CgCGn5VD5x* z2e6R~47~t92avVbU!heNmhEv_4dDy4#x@#jE!1Tu-sr1oNz%AO?ff1I$-}j0>JFjv*T7 z&t8hx5W_X7(8qo!4#&6`TIHFp~En_m*R3v#v$GJ^g0OS5t@O z+40PqE?({2yeD%;?bP%Kdp=3A>4dGgX1GV`*rFBP2g3I#gstB&E0}+Z#s=3oi-U_Y z8hF^>GRi7me)xpv*&JaLtBVpRq@GRxyi)3~vA~>irU;2Ej~JJ0cnYk2R&n-VWO2bh z&O<%rt`CK?;#P5Vu4ekmJzFW)X#Sj!`Ol31&ENk1XJ6cr*n;$0ou6F=ttS70#GQhx z%YWK1F1h*VkH-7*2%z6oOI#yLQW8s2t&)pUffR$0fsui(fuXLEVTggLm8pT1v4ysQ lft7(lfzd`y6b-rgDVb@NxHT~5b4~>Xqo=E%%Q~loCIJ13ngIX+ diff --git a/graphics/door_anims/safari_zone.png b/graphics/door_anims/safari_zone.png index 89807f843f88cad27155dcd008a5f9c7f2fc6cb3..eae6a0e3e519dee004143f9dc4ba0e149691c7f4 100644 GIT binary patch delta 327 zcmV-N0l5Ck1J?qO8Gi!+008Fy?~?!k05DKYR7C&)0Osb+-rlsmy_}?+gM))wVq!r- zN@^)FT64YjVyy1H&F0O`q;tijL9~Mylxl3pMf?B&0OCnRK~yM_)sVpn0x=Lpr-k6j zGGr9-ymlZVES}>QAZF?i@sJjB_q4Uxi}RDXyWrwk2SOe{e}6K}r!{kfLnEx42Inh$ zblF;DYR$mD7Cmc?Fg!^ud?X<$%%etAR34jfEWx?4=`T^G9G!lIEHAP zzdGR{CzGLo>vFN|o0Gq9nb6!(>LbQ|VNNP%qIJP}C98-wbx+=N{*Tr@cofO*Bxhf5 zbY}VL6AjM7G3|`cwQEX_Moq~&dtjrOZkDfsU7>Exi5~u5!8F6RoGOF+la`h?3g=$x z+UZ@sNi5;*>`zAh3QPilJ3g!n&zQB8yM5Wg0QpxJHXY@#pTn>BM47>`#dYH==`{?o zO3?@WxNP#m&)R8Z*yy#*epZ|)@4Wt}PHd0V1ir6a|EKzElzTsCx-Hpo{O$K#wphdF zcQVD(xdhWVBx@Qcu+FG$RXQ@WW}dR~zukq0Cu{=xR<*=6q9i4;B-JXpC>2OC7#SED z=o%R68X1Ndm|B?{SeY7W8yHv_7zpV;e}JMPH$NpatrE9}er2qf_?(Wsz-n6u|l!JqdVq$wi zN@^)FS^xk50001-q?~($dtz#0Qd&{~000Ye(r zA~tn^>IOc0HVx(C%>)jznFDkPstfd`GYGtgR@%gy@js9+ynjIHFE$)8N3n~k#Ay|? z77b0x1^8uupyLHV6|ptuGQF_n2*dHv*cqz=M(nN;_`n;Xf4GQq@9qIj**ixV9FLHJ zI3(Z;Lx8bf0kXCc8o>MIMvA!@@vnM%kZbHvF9WDc6Z{G;!Fo_Z@NGxr3PF8}}l07*qoM6N<$ Ef+e_whyVZp literal 435 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0H{j^}rS4giG&k`w*PKr|3505KS(9$>x-WSsVNaSYKo zfA+#b-a`r^Yzbi*apEgdJNO=?RWux#E$$_C{_D=hGKSf^I>gfjD)`r4IkNa4`=?fM zjlV~yDo>kn&anB${p7qwi%mg6J9-b--4eP!|nM` zXkU37wLJ1G&|9h{t`Q|Ei6yC4$wjF^iowXh$UxV?P}j&X#K6?b)X>VnLfgQ=%D_Od g{_YnP4Y~O#nQ4`{H6$pddVoUE)78&qol`;+0Qeb`NdN!< diff --git a/graphics/door_anims/sootopolis_peaked_roof.png b/graphics/door_anims/sootopolis_peaked_roof.png index b4ccfb5f993ba33e06842e571e7cfb1813b871f5..7d8ea1f33e1710294ddbb02bdc8084127df55687 100644 GIT binary patch delta 306 zcmV-20nPri1HuB38Gi!+008Fy?~?!k05DKYR7G>er2qf_?(Wsz-n6u|l!JqdVq$wi zN@^)FS^xk50001-q?~($dtz#0Qd&{~000YeGj{qbeYWZzH=|4n+a07*qoM6N<$ Ef{~wn*#H0l literal 435 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0H{k)<<(_Hcs7ogGU8*)`Ib6BqR&cj%`uKS-RQ+3|AySILRjRYAW@p9aNme!MOO(?^+g(!2R#k|F-J~a8}LS z!MKWNUdtY?>bAo|3t6r1YhWYqJ_cJ)z4*}Q$iB}FRzdh diff --git a/graphics/door_anims/trainer_hill_lobby_elevator.png b/graphics/door_anims/trainer_hill_lobby_elevator.png index aeb7eaf26050aff021cc812dde0faf71a994fab5..bdd1c3b271d0d3c4ddd895e12fa82735e2f33258 100644 GIT binary patch delta 214 zcmcb^^qg^mWIZzj1H-fb?C_g1^}vu%3o-_)eQb|>+}g##%UOlyuf zh9t5#ee~lw;!y*Z_VQ9VmcTvVi9@$9LB&ZT=}W=^UD1|`SOI^arBk!d&b%YHEeB{l NgQu&X%Q~loCIE-4SabjY literal 348 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=0wfr|csbMpDVB6cUq=Rpjs4tz5?O(KrX+87 z7Y2SSBfG^w9(#$WuPgf#Mp0H{HEZs8exQ&*a-v@uhz4Q>AO?ff1I$-}j1o^5#}JM4 z$ve1Nd3G;sFgd2B;m|Rsk*RHSxq`sK3U*eWr%y|3_2*5Wt}M~iRP;H{PDEr0JM+zN z>qm=0&Aagv_0?^NS>!)D{*4m{k_~tJlj6JY`&l`&{HXJ%)83q z!L)tN6@O*tePCo*^IE^XaJs4_(01GbWneJ>!!2N19Pgg&ebxsLQ0F3HsQ~&?~ diff --git a/include/constants/metatile_labels.h b/include/constants/metatile_labels.h index 3c484e39a..ff10f52ee 100644 --- a/include/constants/metatile_labels.h +++ b/include/constants/metatile_labels.h @@ -99,6 +99,7 @@ #define METATILE_PetalburgGym_SlidingDoor_Frame2 0x21A #define METATILE_PetalburgGym_SlidingDoor_Frame3 0x21B #define METATILE_PetalburgGym_SlidingDoor_Frame4 0x21C +#define METATILE_PetalburgGym_Door 0x224 // gTileset_MossdeepGym from R/S #define METATILE_RS_MossdeepGym_RedArrow_Right 0x204 @@ -128,7 +129,6 @@ // gTileset_BattleFrontier #define METATILE_BattleFrontier_Door_Elevator 0x20E -#define METATILE_BattleFrontier_Door_Corridor 0x224 #define METATILE_BattleFrontier_Door_MultiCorridor 0x2AD #define METATILE_BattleFrontier_CorridorOpenDoor_Top 0x207 #define METATILE_BattleFrontier_CorridorOpenDoor_Bottom 0x20F diff --git a/spritesheet_rules.mk b/spritesheet_rules.mk index 9fb184638..87293669c 100644 --- a/spritesheet_rules.mk +++ b/spritesheet_rules.mk @@ -674,3 +674,6 @@ $(FLDEFFGFXDIR)/secret_power_tree.4bpp: %.4bpp: %.png $(FLDEFFGFXDIR)/record_mix_lights.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 4 -mheight 1 + +graphics/door_anims/battle_tower_multi_corridor.4bpp: %.4bpp: %.png + $(GFX) $< $@ -mwidth 2 -mheight 4 diff --git a/src/field_door.c b/src/field_door.c index fa813a053..70d10b753 100644 --- a/src/field_door.c +++ b/src/field_door.c @@ -74,7 +74,7 @@ static const u8 sDoorAnimTiles_PokemonLeague[] = INCBIN_U8("graphics/door_anims/ static const u16 sDoorNullPalette20[16] = {}; static const u8 sDoorAnimTiles_Pacifidlog[] = INCBIN_U8("graphics/door_anims/pacifidlog.4bpp"); static const u16 sDoorNullPalette21[16] = {}; -static const u8 sDoorAnimTiles_BattleTowerCorridor[] = INCBIN_U8("graphics/door_anims/battle_tower_corridor.4bpp"); +static const u8 sDoorAnimTiles_PetalburgGym[] = INCBIN_U8("graphics/door_anims/petalburg_gym.4bpp"); static const u16 sDoorNullPalette22[16] = {}; static const u8 sDoorAnimTiles_CyclingRoad[] = INCBIN_U8("graphics/door_anims/cycling_road.4bpp"); static const u16 sDoorNullPalette23[16] = {}; @@ -190,7 +190,7 @@ static const u8 sDoorAnimPalettes_Mauville[] = {7, 7, 7, 7, 7, 7, 7, 7}; static const u8 sDoorAnimPalettes_Verdanturf[] = {6, 6, 5, 5, 5, 5, 5, 5}; static const u8 sDoorAnimPalettes_LilycoveWooden[] = {5, 5, 5, 5, 5, 5, 5, 5}; static const u8 sDoorAnimPalettes_Contest[] = {1, 1, 1, 1, 1, 1, 1, 1}; -static const u8 sDoorAnimPalettes_BattleTowerCorridor[] = {6, 6, 6, 6, 6, 6, 6, 6}; +static const u8 sDoorAnimPalettes_PetalburgGym[] = {6, 6, 6, 6, 6, 6, 6, 6}; static const u8 sDoorAnimPalettes_CyclingRoad[] = {7, 7, 7, 7, 7, 7, 7, 7}; static const u8 sDoorAnimPalettes_LilycoveDeptStore[] = {5, 5, 5, 5, 5, 5, 5, 5}; static const u8 sDoorAnimPalettes_SafariZone[] = {9, 9, 9, 9, 9, 9, 9, 9}; @@ -244,7 +244,7 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] = {METATILE_Sootopolis_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Sootopolis, sDoorAnimPalettes_Sootopolis}, {METATILE_EverGrande_Door_PokemonLeague, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_PokemonLeague, sDoorAnimPalettes_PokemonLeague}, {METATILE_Pacifidlog_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Pacifidlog, sDoorAnimPalettes_Pacifidlog}, - {METATILE_BattleFrontier_Door_Corridor, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_BattleTowerCorridor, sDoorAnimPalettes_BattleTowerCorridor}, + {METATILE_PetalburgGym_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_PetalburgGym, sDoorAnimPalettes_PetalburgGym}, {METATILE_Mauville_Door_CyclingRoad, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_CyclingRoad, sDoorAnimPalettes_CyclingRoad}, {METATILE_Lilycove_Door_DeptStore, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStore, sDoorAnimPalettes_LilycoveDeptStore}, {METATILE_Lilycove_Door_SafariZone, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_SafariZone, sDoorAnimPalettes_SafariZone}, From c2dc4a5dea22c12ee4d84898215c28d84b5d49fb Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 18 May 2022 12:41:46 -0400 Subject: [PATCH 29/65] Some field door comments --- .../{unknown.png => unused_battle_frontier.png} | Bin src/field_door.c | 11 ++++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) rename graphics/door_anims/{unknown.png => unused_battle_frontier.png} (100%) diff --git a/graphics/door_anims/unknown.png b/graphics/door_anims/unused_battle_frontier.png similarity index 100% rename from graphics/door_anims/unknown.png rename to graphics/door_anims/unused_battle_frontier.png diff --git a/src/field_door.c b/src/field_door.c index 70d10b753..756d0dabf 100644 --- a/src/field_door.c +++ b/src/field_door.c @@ -98,7 +98,7 @@ static const u8 sDoorAnimTiles_BattleTowerOld[] = INCBIN_U8("graphics/door_anims static const u16 sDoorNullPalette32[16] = {}; static const u8 sDoorAnimTiles_BattleTowerElevator[] = INCBIN_U8("graphics/door_anims/battle_tower_elevator.4bpp"); static const u16 sDoorNullPalette33[16] = {}; -static const u8 sDoorAnimTiles_34[] = INCBIN_U8("graphics/door_anims/unknown.4bpp"); +static const u8 sDoorAnimTiles_UnusedBattleFrontier[] = INCBIN_U8("graphics/door_anims/unused_battle_frontier.4bpp"); static const u16 sDoorNullPalette34[16] = {}; static const u8 sDoorAnimTiles_BattleDome[] = INCBIN_U8("graphics/door_anims/battle_dome.4bpp"); static const u16 sDoorNullPalette35[16] = {}; @@ -202,7 +202,7 @@ static const u8 sDoorAnimPalettes_AbandonedShipRoom[] = {7, 7, 7, 7, 7, 7, 7, 7} static const u8 sDoorAnimPalettes_LilycoveDeptStoreElevator[] = {6, 6, 7, 7, 7, 7, 7, 7}; static const u8 sDoorAnimPalettes_BattleTowerOld[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_BattleTowerElevator[] = {7, 7, 7, 7, 7, 7, 7, 7}; -static const u8 sDoorAnimPalettes_34[] = {9, 9, 9, 9, 9, 9, 9, 9}; +static const u8 sDoorAnimPalettes_UnusedBattleFrontier[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_BattleDome[] = {1, 1, 1, 1, 1, 1, 1, 1}; static const u8 sDoorAnimPalettes_BattleFactory[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_BattleTower[] = {0, 0, 0, 0, 0, 0, 0, 0}; @@ -256,7 +256,9 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] = {METATILE_Shop_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStoreElevator, sDoorAnimPalettes_LilycoveDeptStoreElevator}, {METATILE_Dewford_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerOld, sDoorAnimPalettes_BattleTowerOld}, {METATILE_BattleFrontier_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerElevator, sDoorAnimPalettes_BattleTowerElevator}, - {0x3B0, /* TODO: Missing metatile ID */ DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_34, sDoorAnimPalettes_34}, + // The metatile for this door doesn't seem to correspond to a door in any Emerald tileset. Given the surrounding door animations, it was likely cut from the Battle Frontier. + // From the palettes array we know it uses palette 9, and the door's shadow looks correct using either the Battle Tent or Battle Frontier Outside's 9th palette. + {0x3B0, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_UnusedBattleFrontier, sDoorAnimPalettes_UnusedBattleFrontier}, {METATILE_BattleFrontierOutsideWest_Door_BattleDome, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleDome, sDoorAnimPalettes_BattleDome}, {METATILE_BattleFrontierOutsideWest_Door_BattleFactory, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleFactory, sDoorAnimPalettes_BattleFactory}, {METATILE_BattleFrontierOutsideEast_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTower, sDoorAnimPalettes_BattleTower}, @@ -278,6 +280,9 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] = {}, }; +// NOTE: The tiles of a door's animation must be copied to VRAM because they are not already part of any given tileset. +// This means that if there are any pre-existing tiles in this copied region that are visible when the door +// animation is played they will be overwritten. #define DOOR_TILE_START_SIZE1 (NUM_TILES_TOTAL - 8) #define DOOR_TILE_START_SIZE2 (NUM_TILES_TOTAL - 16) From 91baf086386aada0ffd33212f211738a74943c9a Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 18 May 2022 22:11:51 -0400 Subject: [PATCH 30/65] Generalize usage of castformPalette --- src/battle_gfx_sfx_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 2a690d129..ff391b24e 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -590,7 +590,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId) if (species == SPECIES_CASTFORM) { paletteOffset = 0x100 + battlerId * 16; - LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]); + LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette); LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20); } @@ -653,7 +653,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId) if (species == SPECIES_CASTFORM) { paletteOffset = 0x100 + battlerId * 16; - LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]); + LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette); LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20); } @@ -973,7 +973,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform) if (targetSpecies == SPECIES_CASTFORM) { gSprites[gBattlerSpriteIds[battlerAtk]].anims = gMonFrontAnimsPtrTable[targetSpecies]; - LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]); + LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette); LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerDef]], paletteOffset, 32); } From c8e08edbae06a71d237e0006bb74729c71b2f9b8 Mon Sep 17 00:00:00 2001 From: sneed Date: Mon, 23 May 2022 19:10:24 +0300 Subject: [PATCH 31/65] rename item1 and item2 in BaseStats --- include/pokemon.h | 4 +- src/data/pokemon/base_stats.h | 1548 ++++++++++++++++----------------- src/pokemon.c | 12 +- 3 files changed, 782 insertions(+), 782 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 8039a4fdd..94a31bbe7 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -212,8 +212,8 @@ struct BaseStats /* 0x0A */ u16 evYield_Speed:2; /* 0x0B */ u16 evYield_SpAttack:2; /* 0x0B */ u16 evYield_SpDefense:2; - /* 0x0C */ u16 item1; - /* 0x0E */ u16 item2; + /* 0x0C */ u16 itemCommon; + /* 0x0E */ u16 itemRare; /* 0x10 */ u8 genderRatio; /* 0x11 */ u8 eggCycles; /* 0x12 */ u8 friendship; diff --git a/src/data/pokemon/base_stats.h b/src/data/pokemon/base_stats.h index d851dfbe1..6b6ab12aa 100644 --- a/src/data/pokemon/base_stats.h +++ b/src/data/pokemon/base_stats.h @@ -20,8 +20,8 @@ .evYield_Speed = 2, \ .evYield_SpAttack = 2, \ .evYield_SpDefense = 2, \ - .item1 = ITEM_NONE, \ - .item2 = ITEM_NONE, \ + .itemCommon = ITEM_NONE, \ + .itemRare = ITEM_NONE, \ .genderRatio = MON_GENDERLESS, \ .eggCycles = 120, \ .friendship = 0, \ @@ -56,8 +56,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -88,8 +88,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -120,8 +120,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -152,8 +152,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -184,8 +184,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -216,8 +216,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -248,8 +248,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -280,8 +280,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -312,8 +312,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -344,8 +344,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -376,8 +376,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -408,8 +408,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_SILVER_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SILVER_POWDER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -440,8 +440,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -472,8 +472,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -504,8 +504,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_POISON_BARB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_POISON_BARB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -536,8 +536,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -568,8 +568,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -600,8 +600,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -632,8 +632,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -664,8 +664,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -696,8 +696,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -728,8 +728,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SHARP_BEAK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SHARP_BEAK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -760,8 +760,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -792,8 +792,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -824,8 +824,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_ORAN_BERRY, - .item2 = ITEM_LIGHT_BALL, + .itemCommon = ITEM_ORAN_BERRY, + .itemRare = ITEM_LIGHT_BALL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -856,8 +856,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -888,8 +888,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_QUICK_CLAW, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_QUICK_CLAW, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -920,8 +920,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_QUICK_CLAW, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_QUICK_CLAW, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -952,8 +952,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -984,8 +984,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -1016,8 +1016,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -1048,8 +1048,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 20, .friendship = 70, @@ -1080,8 +1080,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 20, .friendship = 70, @@ -1112,8 +1112,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 20, .friendship = 70, @@ -1144,8 +1144,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LEPPA_BERRY, - .item2 = ITEM_MOON_STONE, + .itemCommon = ITEM_LEPPA_BERRY, + .itemRare = ITEM_MOON_STONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 140, @@ -1176,8 +1176,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LEPPA_BERRY, - .item2 = ITEM_MOON_STONE, + .itemCommon = ITEM_LEPPA_BERRY, + .itemRare = ITEM_MOON_STONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 140, @@ -1208,8 +1208,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -1240,8 +1240,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -1272,8 +1272,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 70, @@ -1304,8 +1304,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 70, @@ -1336,8 +1336,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -1368,8 +1368,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -1400,8 +1400,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1432,8 +1432,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1464,8 +1464,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1496,8 +1496,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_TINY_MUSHROOM, - .item2 = ITEM_BIG_MUSHROOM, + .itemCommon = ITEM_TINY_MUSHROOM, + .itemRare = ITEM_BIG_MUSHROOM, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1528,8 +1528,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_TINY_MUSHROOM, - .item2 = ITEM_BIG_MUSHROOM, + .itemCommon = ITEM_TINY_MUSHROOM, + .itemRare = ITEM_BIG_MUSHROOM, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1560,8 +1560,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1592,8 +1592,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1624,8 +1624,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1656,8 +1656,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1688,8 +1688,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1720,8 +1720,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1752,8 +1752,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1784,8 +1784,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1816,8 +1816,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1848,8 +1848,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1880,8 +1880,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -1912,8 +1912,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -1944,8 +1944,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1976,8 +1976,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2008,8 +2008,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2040,8 +2040,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_TWISTED_SPOON, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_TWISTED_SPOON, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2072,8 +2072,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_TWISTED_SPOON, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_TWISTED_SPOON, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2104,8 +2104,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_TWISTED_SPOON, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_TWISTED_SPOON, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2136,8 +2136,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2168,8 +2168,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2200,8 +2200,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2232,8 +2232,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2264,8 +2264,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2296,8 +2296,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2328,8 +2328,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2360,8 +2360,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2392,8 +2392,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_EVERSTONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_EVERSTONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -2424,8 +2424,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_EVERSTONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_EVERSTONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -2456,8 +2456,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_EVERSTONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_EVERSTONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -2488,8 +2488,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2520,8 +2520,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2552,8 +2552,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2584,8 +2584,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2616,8 +2616,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -2648,8 +2648,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -2680,8 +2680,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_STICK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_STICK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2712,8 +2712,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SHARP_BEAK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SHARP_BEAK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2744,8 +2744,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SHARP_BEAK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SHARP_BEAK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2776,8 +2776,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2808,8 +2808,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2840,8 +2840,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NUGGET, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NUGGET, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2872,8 +2872,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NUGGET, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NUGGET, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2904,8 +2904,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_PEARL, - .item2 = ITEM_BIG_PEARL, + .itemCommon = ITEM_PEARL, + .itemRare = ITEM_BIG_PEARL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2936,8 +2936,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_PEARL, - .item2 = ITEM_BIG_PEARL, + .itemCommon = ITEM_PEARL, + .itemRare = ITEM_BIG_PEARL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2968,8 +2968,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3000,8 +3000,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3032,8 +3032,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3064,8 +3064,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -3096,8 +3096,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3128,8 +3128,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3160,8 +3160,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3192,8 +3192,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3224,8 +3224,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -3256,8 +3256,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -3288,8 +3288,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3320,8 +3320,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3352,8 +3352,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_THICK_CLUB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_THICK_CLUB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3384,8 +3384,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_THICK_CLUB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_THICK_CLUB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3416,8 +3416,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 25, .friendship = 70, @@ -3448,8 +3448,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 25, .friendship = 70, @@ -3480,8 +3480,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3512,8 +3512,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SMOKE_BALL, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SMOKE_BALL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3544,8 +3544,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SMOKE_BALL, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SMOKE_BALL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3576,8 +3576,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3608,8 +3608,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3640,8 +3640,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_LUCKY_EGG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LUCKY_EGG, .genderRatio = MON_FEMALE, .eggCycles = 40, .friendship = 140, @@ -3672,8 +3672,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3704,8 +3704,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -3736,8 +3736,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3768,8 +3768,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3800,8 +3800,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3832,8 +3832,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3864,8 +3864,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_STARDUST, - .item2 = ITEM_STAR_PIECE, + .itemCommon = ITEM_STARDUST, + .itemRare = ITEM_STAR_PIECE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -3896,8 +3896,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_STARDUST, - .item2 = ITEM_STAR_PIECE, + .itemCommon = ITEM_STARDUST, + .itemRare = ITEM_STAR_PIECE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -3928,8 +3928,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_LEPPA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LEPPA_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -3960,8 +3960,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -3992,8 +3992,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_ASPEAR_BERRY, - .item2 = ITEM_ASPEAR_BERRY, + .itemCommon = ITEM_ASPEAR_BERRY, + .itemRare = ITEM_ASPEAR_BERRY, .genderRatio = MON_FEMALE, .eggCycles = 25, .friendship = 70, @@ -4024,8 +4024,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 25, .friendship = 70, @@ -4056,8 +4056,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 25, .friendship = 70, @@ -4088,8 +4088,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -4120,8 +4120,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 20, .friendship = 70, @@ -4152,8 +4152,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 5, .friendship = 70, @@ -4184,8 +4184,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 5, .friendship = 70, @@ -4216,8 +4216,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 70, @@ -4248,8 +4248,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_POWDER, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -4280,8 +4280,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4312,8 +4312,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4344,8 +4344,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4376,8 +4376,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4408,8 +4408,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -4440,8 +4440,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -4472,8 +4472,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -4504,8 +4504,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -4536,8 +4536,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -4568,8 +4568,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4600,8 +4600,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LEFTOVERS, - .item2 = ITEM_LEFTOVERS, + .itemCommon = ITEM_LEFTOVERS, + .itemRare = ITEM_LEFTOVERS, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 40, .friendship = 70, @@ -4632,8 +4632,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -4664,8 +4664,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -4696,8 +4696,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -4728,8 +4728,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -4760,8 +4760,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -4792,8 +4792,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -4824,8 +4824,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -4856,8 +4856,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LUM_BERRY, - .item2 = ITEM_LUM_BERRY, + .itemCommon = ITEM_LUM_BERRY, + .itemRare = ITEM_LUM_BERRY, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 100, @@ -4888,8 +4888,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -4920,8 +4920,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -4952,8 +4952,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -4984,8 +4984,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5016,8 +5016,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5048,8 +5048,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5080,8 +5080,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5112,8 +5112,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5144,8 +5144,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5176,8 +5176,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5208,8 +5208,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_ORAN_BERRY, - .item2 = ITEM_SITRUS_BERRY, + .itemCommon = ITEM_ORAN_BERRY, + .itemRare = ITEM_SITRUS_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5240,8 +5240,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5272,8 +5272,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5304,8 +5304,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5336,8 +5336,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5368,8 +5368,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5400,8 +5400,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5432,8 +5432,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5464,8 +5464,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_YELLOW_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_YELLOW_SHARD, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5496,8 +5496,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_YELLOW_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_YELLOW_SHARD, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5528,8 +5528,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -5560,8 +5560,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_LEPPA_BERRY, - .item2 = ITEM_MOON_STONE, + .itemCommon = ITEM_LEPPA_BERRY, + .itemRare = ITEM_MOON_STONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 140, @@ -5592,8 +5592,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 70, @@ -5624,8 +5624,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 10, .friendship = 70, @@ -5656,8 +5656,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 10, .friendship = 70, @@ -5688,8 +5688,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5720,8 +5720,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5752,8 +5752,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5784,8 +5784,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5816,8 +5816,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5848,8 +5848,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5880,8 +5880,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -5912,8 +5912,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -5944,8 +5944,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5976,8 +5976,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6008,8 +6008,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6040,8 +6040,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6072,8 +6072,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6104,8 +6104,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6136,8 +6136,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6168,8 +6168,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6200,8 +6200,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6232,8 +6232,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6264,8 +6264,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6296,8 +6296,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -6328,8 +6328,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 35, @@ -6360,8 +6360,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -6392,8 +6392,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6424,8 +6424,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -6456,8 +6456,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 40, .friendship = 70, @@ -6488,8 +6488,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6520,8 +6520,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_PERSIM_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_PERSIM_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6552,8 +6552,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6584,8 +6584,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6616,8 +6616,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6648,8 +6648,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6680,8 +6680,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -6712,8 +6712,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -6744,8 +6744,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -6776,8 +6776,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6808,8 +6808,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -6840,8 +6840,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_ORAN_BERRY, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_ORAN_BERRY, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6872,8 +6872,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -6904,8 +6904,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_QUICK_CLAW, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_QUICK_CLAW, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -6936,8 +6936,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6968,8 +6968,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7000,8 +7000,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7032,8 +7032,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7064,8 +7064,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7096,8 +7096,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7128,8 +7128,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_RED_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_RED_SHARD, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -7160,8 +7160,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7192,8 +7192,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7224,8 +7224,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7256,8 +7256,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -7288,8 +7288,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -7320,8 +7320,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -7352,8 +7352,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -7384,8 +7384,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7416,8 +7416,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7448,8 +7448,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7480,8 +7480,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -7512,8 +7512,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7544,8 +7544,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7576,8 +7576,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 25, .friendship = 70, @@ -7608,8 +7608,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 25, .friendship = 70, @@ -7640,8 +7640,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_ASPEAR_BERRY, - .item2 = ITEM_ASPEAR_BERRY, + .itemCommon = ITEM_ASPEAR_BERRY, + .itemRare = ITEM_ASPEAR_BERRY, .genderRatio = MON_FEMALE, .eggCycles = 25, .friendship = 70, @@ -7672,8 +7672,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 25, .friendship = 70, @@ -7704,8 +7704,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 25, .friendship = 70, @@ -7736,8 +7736,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_MOOMOO_MILK, - .item2 = ITEM_MOOMOO_MILK, + .itemCommon = ITEM_MOOMOO_MILK, + .itemRare = ITEM_MOOMOO_MILK, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -7768,8 +7768,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_LUCKY_EGG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LUCKY_EGG, .genderRatio = MON_FEMALE, .eggCycles = 40, .friendship = 140, @@ -7800,8 +7800,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -7832,8 +7832,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -7864,8 +7864,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -7896,8 +7896,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -7928,8 +7928,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -7960,8 +7960,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -7992,8 +7992,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -8024,8 +8024,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_SACRED_ASH, - .item2 = ITEM_SACRED_ASH, + .itemCommon = ITEM_SACRED_ASH, + .itemRare = ITEM_SACRED_ASH, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -8056,8 +8056,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LUM_BERRY, - .item2 = ITEM_LUM_BERRY, + .itemCommon = ITEM_LUM_BERRY, + .itemRare = ITEM_LUM_BERRY, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 100, @@ -8138,8 +8138,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8170,8 +8170,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8202,8 +8202,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8234,8 +8234,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8266,8 +8266,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8298,8 +8298,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8330,8 +8330,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8362,8 +8362,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8394,8 +8394,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8426,8 +8426,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_PECHA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_PECHA_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8458,8 +8458,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_PECHA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_PECHA_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8490,8 +8490,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8522,8 +8522,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_ORAN_BERRY, - .item2 = ITEM_SITRUS_BERRY, + .itemCommon = ITEM_ORAN_BERRY, + .itemRare = ITEM_SITRUS_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8554,8 +8554,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8586,8 +8586,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8618,8 +8618,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SILVER_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SILVER_POWDER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8650,8 +8650,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8682,8 +8682,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_SILVER_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SILVER_POWDER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8714,8 +8714,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8746,8 +8746,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8778,8 +8778,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8810,8 +8810,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8842,8 +8842,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8874,8 +8874,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8906,8 +8906,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8938,8 +8938,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8970,8 +8970,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 15, .friendship = 70, @@ -9002,8 +9002,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9034,8 +9034,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9066,8 +9066,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9098,8 +9098,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9130,8 +9130,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_CHESTO_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_CHESTO_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9162,8 +9162,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9194,8 +9194,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9226,8 +9226,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9258,8 +9258,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_SILVER_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SILVER_POWDER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9290,8 +9290,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 70, @@ -9322,8 +9322,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 70, @@ -9354,8 +9354,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_LEPPA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LEPPA_BERRY, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 15, .friendship = 70, @@ -9386,8 +9386,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_LEPPA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LEPPA_BERRY, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 15, .friendship = 70, @@ -9418,8 +9418,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_PERSIM_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_PERSIM_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9450,8 +9450,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -9482,8 +9482,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -9514,8 +9514,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9546,8 +9546,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9578,8 +9578,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -9610,8 +9610,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9642,8 +9642,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9674,8 +9674,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_HEART_SCALE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_HEART_SCALE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -9706,8 +9706,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9738,8 +9738,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9770,8 +9770,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9802,8 +9802,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9834,8 +9834,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -9866,8 +9866,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -9898,8 +9898,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SOFT_SAND, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SOFT_SAND, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9930,8 +9930,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9962,8 +9962,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9994,8 +9994,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -10026,8 +10026,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -10058,8 +10058,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10090,8 +10090,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10122,8 +10122,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10154,8 +10154,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10186,8 +10186,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10218,8 +10218,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10250,8 +10250,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10282,8 +10282,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_POISON_BARB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_POISON_BARB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -10314,8 +10314,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_POISON_BARB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_POISON_BARB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -10346,8 +10346,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10378,8 +10378,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NEVER_MELT_ICE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NEVER_MELT_ICE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10410,8 +10410,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_MOON_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_MOON_STONE, .genderRatio = MON_GENDERLESS, .eggCycles = 25, .friendship = 70, @@ -10442,8 +10442,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SUN_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SUN_STONE, .genderRatio = MON_GENDERLESS, .eggCycles = 25, .friendship = 70, @@ -10474,8 +10474,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 70, @@ -10506,8 +10506,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10538,8 +10538,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10570,8 +10570,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10602,8 +10602,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10634,8 +10634,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10666,8 +10666,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10698,8 +10698,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10730,8 +10730,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10762,8 +10762,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10794,8 +10794,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10826,8 +10826,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -10858,8 +10858,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -10890,8 +10890,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_POISON_BARB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_POISON_BARB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10922,8 +10922,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -10954,8 +10954,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -10986,8 +10986,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -11018,8 +11018,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_BIG_PEARL, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_BIG_PEARL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11050,8 +11050,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_BIG_PEARL, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_BIG_PEARL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11082,8 +11082,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -11114,8 +11114,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_CHESTO_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_CHESTO_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11146,8 +11146,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_CHESTO_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_CHESTO_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11178,8 +11178,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_CHESTO_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_CHESTO_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11210,8 +11210,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_BLUE_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_BLUE_SHARD, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11242,8 +11242,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11274,8 +11274,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11306,8 +11306,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -11338,8 +11338,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -11370,8 +11370,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -11402,8 +11402,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11434,8 +11434,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11466,8 +11466,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_GREEN_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_GREEN_SHARD, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 40, .friendship = 70, @@ -11498,8 +11498,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_HARD_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_HARD_STONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 35, .friendship = 35, @@ -11530,8 +11530,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_HARD_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_HARD_STONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 35, .friendship = 35, @@ -11562,8 +11562,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_HARD_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_HARD_STONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 35, .friendship = 35, @@ -11594,8 +11594,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_MYSTIC_WATER, - .item2 = ITEM_MYSTIC_WATER, + .itemCommon = ITEM_MYSTIC_WATER, + .itemRare = ITEM_MYSTIC_WATER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -11626,8 +11626,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 15, .friendship = 70, @@ -11658,8 +11658,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 15, .friendship = 70, @@ -11690,8 +11690,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -11722,8 +11722,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -11754,8 +11754,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -11786,8 +11786,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -11818,8 +11818,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -11850,8 +11850,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -11882,8 +11882,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -11914,8 +11914,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -11946,8 +11946,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -11978,8 +11978,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -12010,8 +12010,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 40, .friendship = 35, @@ -12042,8 +12042,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 40, .friendship = 35, @@ -12074,8 +12074,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 40, .friendship = 35, @@ -12106,8 +12106,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -12138,8 +12138,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -12170,8 +12170,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -12202,8 +12202,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -12234,8 +12234,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -12266,8 +12266,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -12298,8 +12298,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 120, .friendship = 90, @@ -12330,8 +12330,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 120, .friendship = 90, @@ -12362,8 +12362,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_STAR_PIECE, - .item2 = ITEM_STAR_PIECE, + .itemCommon = ITEM_STAR_PIECE, + .itemRare = ITEM_STAR_PIECE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 100, @@ -12394,8 +12394,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -12426,8 +12426,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, diff --git a/src/pokemon.c b/src/pokemon.c index 61125e362..0ee93bd5b 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6610,26 +6610,26 @@ void SetWildMonHeldItem(void) if (rnd < chanceNoItem) return; if (rnd < chanceCommon) - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1); + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon); else - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2); + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare); } } else { - if (gBaseStats[species].item1 == gBaseStats[species].item2 && gBaseStats[species].item1 != ITEM_NONE) + if (gBaseStats[species].itemCommon == gBaseStats[species].itemRare && gBaseStats[species].itemCommon != ITEM_NONE) { // Both held items are the same, 100% chance to hold item - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1); + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon); } else { if (rnd < chanceNoItem) return; if (rnd < chanceCommon) - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1); + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon); else - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2); + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare); } } } From c316b11739654d84003d72f493a7c3967d620798 Mon Sep 17 00:00:00 2001 From: sneed Date: Tue, 24 May 2022 00:53:09 +0300 Subject: [PATCH 32/65] chanceCommon to chanceNotRare --- src/pokemon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 0ee93bd5b..7cdad72e9 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6587,12 +6587,12 @@ void SetWildMonHeldItem(void) u16 rnd = Random() % 100; u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0); u16 chanceNoItem = 45; - u16 chanceCommon = 95; + u16 chanceNotRare = 95; if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG, 0) && GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES) { chanceNoItem = 20; - chanceCommon = 80; + chanceNotRare = 80; } if (gMapHeader.mapLayoutId == LAYOUT_ALTERING_CAVE) { @@ -6600,7 +6600,7 @@ void SetWildMonHeldItem(void) if (alteringCaveId != 0) { // In active Altering Cave, use special item list - if (rnd < chanceCommon) + if (rnd < chanceNotRare) return; SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &sAlteringCaveWildMonHeldItems[alteringCaveId].item); } @@ -6609,7 +6609,7 @@ void SetWildMonHeldItem(void) // In inactive Altering Cave, use normal items if (rnd < chanceNoItem) return; - if (rnd < chanceCommon) + if (rnd < chanceNotRare) SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon); else SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare); @@ -6626,7 +6626,7 @@ void SetWildMonHeldItem(void) { if (rnd < chanceNoItem) return; - if (rnd < chanceCommon) + if (rnd < chanceNotRare) SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon); else SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare); From 5c92062c23a1d00344a6d7478f31c7c05bbd659c Mon Sep 17 00:00:00 2001 From: sneed Date: Wed, 25 May 2022 08:37:36 +0300 Subject: [PATCH 33/65] Update pokemon_summary_screen.c --- src/pokemon_summary_screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 10c69a422..bbc8fef4c 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2439,7 +2439,7 @@ static void Task_ShowPowerAccWindow(u8 taskId) { if (data[0] < 0) { - if (sMonSummaryScreen->currPageIndex == 2) + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); } else @@ -2492,7 +2492,7 @@ static void Task_ShowAppealJamWindow(u8 taskId) { if (data[0] < 0) { - if (sMonSummaryScreen->currPageIndex == 3 && FuncIsActiveTask(PssScrollRight) == 0) + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES && FuncIsActiveTask(PssScrollRight) == 0) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); DrawContestMoveHearts(data[2]); } From a913191323287f2c27abbf2a524b492da5add3f0 Mon Sep 17 00:00:00 2001 From: sneed Date: Wed, 25 May 2022 16:07:54 +0300 Subject: [PATCH 34/65] Document DrawPagination --- src/pokemon_summary_screen.c | 64 ++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index bbc8fef4c..b2bcce6cb 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2314,69 +2314,69 @@ u8 GetMoveSlotToReplace(void) static void DrawPagination(void) // Updates the pagination dots at the top of the summary screen { - u16 *alloced = Alloc(32); + u16 *tilemap = Alloc(8 * PSS_PAGE_COUNT); u8 i; - for (i = 0; i < 4; i++) + for (i = 0; i < PSS_PAGE_COUNT; i++) { u8 j = i * 2; if (i < sMonSummaryScreen->minPageIndex) { - alloced[j + 0] = 0x40; - alloced[j + 1] = 0x40; - alloced[j + 8] = 0x50; - alloced[j + 9] = 0x50; + tilemap[j + 0] = 0x40; + tilemap[j + 1] = 0x40; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x50; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x50; } else if (i > sMonSummaryScreen->maxPageIndex) { - alloced[j + 0] = 0x4A; - alloced[j + 1] = 0x4A; - alloced[j + 8] = 0x5A; - alloced[j + 9] = 0x5A; + tilemap[j + 0] = 0x4A; + tilemap[j + 1] = 0x4A; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x5A; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x5A; } else if (i < sMonSummaryScreen->currPageIndex) { - alloced[j + 0] = 0x46; - alloced[j + 1] = 0x47; - alloced[j + 8] = 0x56; - alloced[j + 9] = 0x57; + tilemap[j + 0] = 0x46; + tilemap[j + 1] = 0x47; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x56; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x57; } else if (i == sMonSummaryScreen->currPageIndex) { if (i != sMonSummaryScreen->maxPageIndex) { - alloced[j + 0] = 0x41; - alloced[j + 1] = 0x42; - alloced[j + 8] = 0x51; - alloced[j + 9] = 0x52; + tilemap[j + 0] = 0x41; + tilemap[j + 1] = 0x42; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x51; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x52; } else { - alloced[j + 0] = 0x4B; - alloced[j + 1] = 0x4C; - alloced[j + 8] = 0x5B; - alloced[j + 9] = 0x5C; + tilemap[j + 0] = 0x4B; + tilemap[j + 1] = 0x4C; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x5B; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x5C; } } else if (i != sMonSummaryScreen->maxPageIndex) { - alloced[j + 0] = 0x43; - alloced[j + 1] = 0x44; - alloced[j + 8] = 0x53; - alloced[j + 9] = 0x54; + tilemap[j + 0] = 0x43; + tilemap[j + 1] = 0x44; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x53; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x54; } else { - alloced[j + 0] = 0x48; - alloced[j + 1] = 0x49; - alloced[j + 8] = 0x58; - alloced[j + 9] = 0x59; + tilemap[j + 0] = 0x48; + tilemap[j + 1] = 0x49; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x58; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x59; } } - CopyToBgTilemapBufferRect_ChangePalette(3, alloced, 11, 0, 8, 2, 16); + CopyToBgTilemapBufferRect_ChangePalette(3, tilemap, 11, 0, PSS_PAGE_COUNT * 2, 2, 16); ScheduleBgCopyTilemapToVram(3); - Free(alloced); + Free(tilemap); } static void ChangeTilemap(const struct TilemapCtrl *unkStruct, u16 *dest, u8 c, bool8 d) From 1cc59acca9583453c08828b693331eb15483457f Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Wed, 25 May 2022 17:46:48 +0100 Subject: [PATCH 35/65] Static assertion for size of save structs --- include/global.h | 4 ++++ src/ereader_helpers.c | 2 ++ src/hall_of_fame.c | 2 ++ src/recorded_battle.c | 2 ++ src/save.c | 6 ++++++ 5 files changed, 16 insertions(+) diff --git a/include/global.h b/include/global.h index 89f725176..60476b13f 100644 --- a/include/global.h +++ b/include/global.h @@ -135,6 +135,10 @@ #define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT) #define NUM_ADDITIONAL_PHRASE_BYTES ROUND_BITS_TO_BYTES(NUM_ADDITIONAL_PHRASES) +// This produces an error at compile-time if expr is zero. +// It looks like file.c:line: size of array `id' is negative +#define STATIC_ASSERT(expr, id) typedef char id[(expr) ? 1 : -1]; + struct Coords8 { s8 x; diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index ac6e0e1e1..cf3ca16c3 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -15,6 +15,8 @@ #include "constants/items.h" #include "constants/trainer_hill.h" +STATIC_ASSERT(sizeof(struct TrainerHillChallenge) <= SECTOR_DATA_SIZE, TrainerHillChallengeFreeSpace); + struct SendRecvMgr { bool8 isParent; diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index d134f2265..fe19ae77b 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -52,6 +52,8 @@ struct HallofFameTeam struct HallofFameMon mon[PARTY_SIZE]; }; +STATIC_ASSERT(sizeof(struct HallofFameTeam) * HALL_OF_FAME_MAX_TEAMS <= SECTOR_DATA_SIZE * NUM_HOF_SECTORS, HallOfFameFreeSpace); + struct HofGfx { u16 state; diff --git a/src/recorded_battle.c b/src/recorded_battle.c index fd2b3a06b..951572636 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -67,6 +67,8 @@ struct RecordedBattleSave u32 checksum; }; +STATIC_ASSERT(sizeof(struct RecordedBattleSave) <= SECTOR_DATA_SIZE, RecordedBattleSaveFreeSpace); + EWRAM_DATA u32 gRecordedBattleRngSeed = 0; EWRAM_DATA u32 gBattlePalaceMoveSelectionRngValue = 0; EWRAM_DATA static u8 sBattleRecords[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE] = {0}; diff --git a/src/save.c b/src/save.c index dafc20868..52cdaa5dd 100644 --- a/src/save.c +++ b/src/save.c @@ -73,6 +73,12 @@ struct SAVEBLOCK_CHUNK(struct PokemonStorage, 8), // SECTOR_ID_PKMN_STORAGE_END }; +// These will produce an error if a save struct is larger than the space +// alloted for it in the flash. +STATIC_ASSERT(sizeof(struct SaveBlock2) <= SECTOR_DATA_SIZE, SaveBlock2FreeSpace); +STATIC_ASSERT(sizeof(struct SaveBlock1) <= SECTOR_DATA_SIZE * (SECTOR_ID_SAVEBLOCK1_END - SECTOR_ID_SAVEBLOCK1_START + 1), SaveBlock1FreeSpace); +STATIC_ASSERT(sizeof(struct PokemonStorage) <= SECTOR_DATA_SIZE * (SECTOR_ID_PKMN_STORAGE_END - SECTOR_ID_PKMN_STORAGE_START + 1), PokemonStorageFreeSpace); + u16 gLastWrittenSector; u32 gLastSaveCounter; u16 gLastKnownGoodSector; From 75a44fdd796adbdf0cc4841d09fe4c9ad2066dec Mon Sep 17 00:00:00 2001 From: BlackShark Date: Fri, 27 May 2022 02:18:52 +0200 Subject: [PATCH 36/65] use more true & false constants --- src/battle_anim_ghost.c | 4 ++-- src/battle_anim_status_effects.c | 2 +- src/battle_interface.c | 4 ++-- src/battle_util.c | 2 +- src/berry_crush.c | 6 +++--- src/decoration.c | 4 ++-- src/field_message_box.c | 2 +- src/hall_of_fame.c | 6 +++--- src/intro.c | 4 ++-- src/item_menu.c | 2 +- src/mauville_old_man.c | 2 +- src/party_menu.c | 2 +- src/player_pc.c | 6 +++--- src/record_mixing.c | 2 +- src/slot_machine.c | 8 ++++---- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index 02b89b965..c004ae1da 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -653,9 +653,9 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId) startLine = 0; if (position == 1) - task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG1HOFS, 1); + task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG1HOFS, TRUE); else - task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG2HOFS, 1); + task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG2HOFS, TRUE); task->data[15]++; break; diff --git a/src/battle_anim_status_effects.c b/src/battle_anim_status_effects.c index 47ba00c90..f56d04ccd 100644 --- a/src/battle_anim_status_effects.c +++ b/src/battle_anim_status_effects.c @@ -549,7 +549,7 @@ void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId) gBattleAnimAttacker = battlerId; gBattleAnimTarget = battlerId; - LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, 0); + LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, FALSE); taskId = CreateTask(Task_DoStatusAnimation, 10); gTasks[taskId].data[0] = battlerId; } diff --git a/src/battle_interface.c b/src/battle_interface.c index 26209fe2d..12d367526 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -817,8 +817,8 @@ static void Debug_DrawNumber(s16 number, u16 *dest, bool8 unk) static void Debug_DrawNumberPair(s16 number1, s16 number2, u16 *arg2) { arg2[4] = 0x1E; - Debug_DrawNumber(number2, arg2, 0); - Debug_DrawNumber(number1, arg2 + 5, 1); + Debug_DrawNumber(number2, arg2, FALSE); + Debug_DrawNumber(number1, arg2 + 5, TRUE); } // Because the healthbox is too large to fit into one sprite, it is divided into two sprites. diff --git a/src/battle_util.c b/src/battle_util.c index 6bb6d9ae4..f34c39eb0 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1190,7 +1190,7 @@ u8 DoFieldEndTurnEffects(void) s32 j; for (j = i + 1; j < gBattlersCount; j++) { - if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], 0)) + if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE)) SwapTurnOrder(i, j); } } diff --git a/src/berry_crush.c b/src/berry_crush.c index e7a5df951..e6e2d8742 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -2254,7 +2254,7 @@ static u32 Cmd_PrintMessage(struct BerryCrushGame *game, u8 *args) switch (game->cmdState) { case 0: - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); if (args[1] & F_MSG_EXPAND) { StringExpandPlaceholders(gStringVar4, sMessages[args[0]]); @@ -3241,7 +3241,7 @@ static u32 Cmd_SaveGame(struct BerryCrushGame *game, u8 *args) case 2: if (!IsLinkTaskFinished()) return 0; - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, 0, 2, 1, 3); CopyWindowToVram(0, COPYWIN_FULL); CreateTask(Task_LinkFullSave, 0); @@ -3389,7 +3389,7 @@ static u32 Cmd_StopGame(struct BerryCrushGame *game, u8 *args) switch (game->cmdState) { case 0: - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); if (game->playAgainState == PLAY_AGAIN_NO_BERRIES) AddTextPrinterParameterized2(0, FONT_NORMAL, sMessages[MSG_NO_BERRIES], game->textSpeed, 0, 2, 1, 3); else diff --git a/src/decoration.c b/src/decoration.c index 7e102251a..547b05acf 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -826,7 +826,7 @@ static void ReturnToActionsMenuFromCategories(u8 taskId) { RemoveDecorationWindow(WINDOW_DECORATION_CATEGORIES); AddDecorationActionsWindow(); - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); PrintCurMainMenuDescription(); gTasks[taskId].func = HandleDecorationActionsMenuInput; } @@ -2664,7 +2664,7 @@ static void FieldCB_StopPuttingAwayDecorations(void) u8 taskId; FadeInFromBlack(); - DrawDialogueFrame(0, 1); + DrawDialogueFrame(0, TRUE); InitDecorationActionsWindow(); taskId = CreateTask(Task_ReinitializeDecorationMenuHandler, 8); gTasks[taskId].tState = 0; diff --git a/src/field_message_box.c b/src/field_message_box.c index 74afb5677..95d0a94c9 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -33,7 +33,7 @@ static void Task_DrawFieldMessage(u8 taskId) task->tState++; break; case 1: - DrawDialogueFrame(0, 1); + DrawDialogueFrame(0, TRUE); task->tState++; break; case 2: diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index fe19ae77b..a195bddcf 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -514,7 +514,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId) } *lastSavedTeam = *sHofMonPtr; - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); CopyWindowToVram(0, COPYWIN_FULL); gTasks[taskId].func = Task_Hof_TrySaveData; @@ -724,7 +724,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId) { FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); HallOfFame_PrintPlayerInfo(1, 2); - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_LeagueChamp, 0, NULL, 2, 1, 3); CopyWindowToVram(0, COPYWIN_FULL); gTasks[taskId].func = Task_Hof_ExitOnKeyPressed; @@ -1093,7 +1093,7 @@ static void Task_HofPC_HandleExit(u8 taskId) static void Task_HofPC_PrintDataIsCorrupted(u8 taskId) { HofPCTopBar_Print(gText_AButtonExit, 8, TRUE); - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_HOFCorrupted, 0, NULL, 2, 1, 3); CopyWindowToVram(0, COPYWIN_FULL); gTasks[taskId].func = Task_HofPC_ExitOnButtonPress; diff --git a/src/intro.c b/src/intro.c index 827ce80be..a1d0508f4 100644 --- a/src/intro.c +++ b/src/intro.c @@ -1848,7 +1848,7 @@ static void Task_Scene3_StartGroudon(u8 taskId) { gTasks[taskId].tState = 0; gTasks[taskId].func = Task_Scene3_Groudon; - ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, 0); + ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, FALSE); } #define tScreenX data[1] @@ -2058,7 +2058,7 @@ static void Task_Scene3_LoadKyogre(u8 taskId) gTasks[taskId].tDelay = 16; gTasks[taskId].tZoom = 256; PanFadeAndZoomScreen(gTasks[taskId].tScreenX, gTasks[taskId].tScreenY, gTasks[taskId].tZoom, 0); - ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, 0); + ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, FALSE); } static void Task_Scene3_Kyogre(u8 taskId) diff --git a/src/item_menu.c b/src/item_menu.c index 9eaca9597..cd0bc159d 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -1344,7 +1344,7 @@ static void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, bool16 skipEraseLis DrawPocketIndicatorSquare(newPocket, TRUE); FillBgTilemapBufferRect_Palette0(2, 11, 14, 2, 15, 16); ScheduleBgCopyTilemapToVram(2); - SetBagVisualPocketId(newPocket, 1); + SetBagVisualPocketId(newPocket, TRUE); RemoveBagSprite(ITEMMENUSPRITE_BALL); AddSwitchPocketRotatingBallSprite(deltaBagPocketId); SetTaskFuncWithFollowupFunc(taskId, Task_SwitchBagPocket, gTasks[taskId].func); diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 681a3dadf..8dbe8b485 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -445,7 +445,7 @@ static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 a1) static void DrawSongTextWindow(const u8 * str) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, str, 0, 1, 1, DisableTextPrinters); gDisableTextPrinters = TRUE; CopyWindowToVram(0, COPYWIN_FULL); diff --git a/src/party_menu.c b/src/party_menu.c index e15d001c6..cbe127bb9 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4969,7 +4969,7 @@ static void Task_TryLearnNewMoves(u8 taskId) { u16 learnMove; - if (WaitFanfare(0) && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))) + if (WaitFanfare(FALSE) && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))) { RemoveLevelUpStatsWindow(); learnMove = MonTryLearningNewMove(&gPlayerParty[gPartyMenu.slotId], TRUE); diff --git a/src/player_pc.c b/src/player_pc.c index bf8479ce1..a5ce89da4 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -518,7 +518,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var) static void ItemStorageMenuPrint(const u8 *textPtr) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, textPtr, 0, 1, 0, 0); } @@ -572,7 +572,7 @@ void CB2_PlayerPCExitBagMenu(void) static void ItemStorage_ReshowAfterBagMenu(void) { LoadMessageBoxAndBorderGfx(); - DrawDialogueFrame(0, 1); + DrawDialogueFrame(0, TRUE); InitItemStorageMenu(CreateTask(ItemStorage_HandleReturnToProcessInput, 0), 1); FadeInFromBlack(); } @@ -1241,7 +1241,7 @@ static void ItemStorage_ReturnToMenuSelect(u8 taskId) s16 *data = gTasks[taskId].data; if (!IsDma3ManagerBusyWithBgCopy()) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); // Select Withdraw/Toss by default depending on which was just exited if (!tInTossMenu) diff --git a/src/record_mixing.c b/src/record_mixing.c index 6efded838..4365f2cb3 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -285,7 +285,7 @@ static void ReceiveExchangePacket(u32 multiplayerId) static void PrintTextOnRecordMixing(const u8 *src) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, src, 0, 1, 0, NULL); CopyWindowToVram(0, COPYWIN_FULL); } diff --git a/src/slot_machine.c b/src/slot_machine.c index 1dfa026e5..828d0c161 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -1390,7 +1390,7 @@ static bool8 SlotTask_HandleBetInput(struct Task *task) // SLOTTASK_MSG_NEED_3_COINS static bool8 SlotTask_PrintMsg_Need3Coins(struct Task *task) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouDontHaveThreeCoins, 0, 1, 0, 0); CopyWindowToVram(0, COPYWIN_FULL); sSlotMachine->state = SLOTTASK_WAIT_MSG_NEED_3_COINS; @@ -1655,7 +1655,7 @@ static bool8 SlotTask_NoMatches(struct Task *task) // SLOTTASK_ASK_QUIT static bool8 SlotTask_AskQuit(struct Task *task) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, gText_QuitTheGame, 0, 1, 0, 0); CopyWindowToVram(0, COPYWIN_FULL); CreateYesNoMenuParameterized(0x15, 7, 0x214, 0x180, 0xE, 0xF); @@ -1687,7 +1687,7 @@ static bool8 SlotTask_HandleQuitInput(struct Task *task) // SLOTTASK_MSG_MAX_COINS static bool8 SlotTask_PrintMsg_MaxCoins(struct Task *task) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveGot9999Coins, 0, 1, 0, 0); CopyWindowToVram(0, COPYWIN_FULL); sSlotMachine->state = SLOTTASK_WAIT_MSG_MAX_COINS; @@ -1708,7 +1708,7 @@ static bool8 SlotTask_WaitMsg_MaxCoins(struct Task *task) // SLOTTASK_MSG_NO_MORE_COINS static bool8 SlotTask_PrintMsg_NoMoreCoins(struct Task *task) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveRunOutOfCoins, 0, 1, 0, 0); CopyWindowToVram(0, COPYWIN_FULL); sSlotMachine->state = SLOTTASK_WAIT_MSG_NO_MORE_COINS; From 5e6d8a77e43352487046631d6329a9c15254f7d0 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 21 May 2022 15:21:50 -0400 Subject: [PATCH 37/65] Document some generic argument names --- include/battle_anim.h | 6 +- include/battle_controllers.h | 14 +- include/battle_gfx_sfx_util.h | 2 +- include/battle_interface.h | 2 +- include/battle_setup.h | 2 +- include/battle_util.h | 2 +- include/digit_obj_util.h | 4 +- include/evolution_graphics.h | 2 +- include/fldeff_misc.h | 2 +- include/list_menu.h | 8 +- include/menu.h | 2 +- include/menu_helpers.h | 6 +- include/menu_specialized.h | 2 +- include/pokemon.h | 6 +- include/pokemon_storage_system.h | 4 +- include/pokenav.h | 12 +- include/trainer_card.h | 2 +- src/bard_music.c | 4 +- src/battle_anim_effects_3.c | 245 ++++++++++++++++++++----------- src/battle_controller_player.c | 30 ++-- src/battle_controllers.c | 26 ++-- src/battle_dome.c | 49 +++---- src/battle_gfx_sfx_util.c | 6 +- src/battle_interface.c | 64 ++++---- src/battle_pyramid.c | 12 +- src/evolution_graphics.c | 162 ++++++++++---------- src/list_menu.c | 8 +- src/menu_helpers.c | 47 +++--- src/mystery_gift_client.c | 2 +- src/pokeball.c | 48 +++--- src/pokemon.c | 4 +- src/pokemon_jump.c | 4 +- src/pokemon_storage_system.c | 4 +- src/pokenav_conditions.c | 4 +- src/rotating_tile_puzzle.c | 7 +- 35 files changed, 445 insertions(+), 359 deletions(-) diff --git a/include/battle_anim.h b/include/battle_anim.h index d8b2cd4db..9d1cf7be2 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -109,7 +109,7 @@ void *LoadPointerFromVars(s16 bottom, s16 top); void StorePointerInVars(s16 *bottom, s16 *top, const void *ptr); void InitPrioritiesForVisibleBattlers(void); void GetBattleAnimBg1Data(struct BattleAnimBgData*); -void GetBattleAnimBgData(struct BattleAnimBgData*, u32 arg1); +void GetBattleAnimBgData(struct BattleAnimBgData*, u32 bgId); u8 GetBattlerSpriteSubpriority(u8 battlerId); bool8 TranslateAnimHorizontalArc(struct Sprite *sprite); void TranslateSpriteLinearByIdFixedPoint(struct Sprite *sprite); @@ -181,7 +181,7 @@ enum u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId); bool8 IsBattlerSpritePresent(u8 battlerId); -void ClearBattleAnimBg(u32 arg0); +void ClearBattleAnimBg(u32 bgId); u8 GetAnimBattlerSpriteId(u8 wantedBattler); bool8 IsDoubleBattle(void); u8 GetBattleBgPaletteNum(void); @@ -213,7 +213,7 @@ u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes, // battle_anim_utility_funcs.c void InitStatsChangeAnimation(u8); -void StartMonScrollingBgMask(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *arg8, const u32 *arg9, const u32 *palette); +void StartMonScrollingBgMask(u8 taskId, int unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette); // battle_anim_effects_1.c void SetSpriteNextToMonHead(u8 battler, struct Sprite* sprite); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 9d9fba1b4..5b6ba30bd 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -222,7 +222,7 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId); void BtlController_EmitChooseAction(u8 bufferId, u8 action, u16 itemId); void BtlController_EmitYesNoBox(u8 bufferId); void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); -void BtlController_EmitChooseItem(u8 bufferId, u8* arg1); +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); @@ -233,11 +233,11 @@ 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 *c); // unused -void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2); -void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c); -void BtlController_EmitOneReturnValue(u8 bufferId, u16 arg1); -void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 b); +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 @@ -254,7 +254,7 @@ void BtlController_EmitHidePartyStatusSummary(u8 bufferId); void BtlController_EmitEndBounceEffect(u8 bufferId); void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible); void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument); -void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 record); +void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 mode, bool32 record); void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId); void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome); diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h index 383facd69..2a848e3d9 100644 --- a/include/battle_gfx_sfx_util.h +++ b/include/battle_gfx_sfx_util.h @@ -19,7 +19,7 @@ void DecompressTrainerBackPic(u16 backPicId, u8 battlerId); void BattleGfxSfxDummy3(u8 gender); void FreeTrainerFrontPicPalette(u16 frontPicId); bool8 BattleLoadAllHealthBoxesGfx(u8 state); -void LoadBattleBarGfx(u8 arg0); +void LoadBattleBarGfx(u8 unused); bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId); void ClearSpritesHealthboxAnimData(void); void CopyAllBattleSpritesInvisibilities(void); diff --git a/include/battle_interface.h b/include/battle_interface.h index 3145939d0..6cc02c3fc 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -74,7 +74,7 @@ void SwapHpBarsWithHpText(void); u8 CreatePartyStatusSummarySprites(u8 battler, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart); void Task_HidePartyStatusSummary(u8 taskId); void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId); -s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 arg3); +s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 unused); u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale); u8 GetHPBarLevel(s16 hp, s16 maxhp); diff --git a/include/battle_setup.h b/include/battle_setup.h index 8f78bba3c..ee2837927 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -28,7 +28,7 @@ void BattleSetup_StartLegendaryBattle(void); void StartGroudonKyogreBattle(void); void StartRegiBattle(void); u8 BattleSetup_GetTerrainId(void); -u8 GetSpecialBattleTransition(s32 arg0); +u8 GetSpecialBattleTransition(s32 id); void ChooseStarter(void); void ResetTrainerOpponentIds(void); void SetMapVarsToTrainer(void); diff --git a/include/battle_util.h b/include/battle_util.h index 914e44c04..d15d4583e 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -66,7 +66,7 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker); void PressurePPLoseOnUsingImprison(u8 attacker); void MarkAllBattlersForControllerExec(void); // unused void MarkBattlerForControllerExec(u8 battlerId); -void MarkBattlerReceivedLinkData(u8 arg0); +void MarkBattlerReceivedLinkData(u8 battlerId); void CancelMultiTurnMoves(u8 battlerId); bool8 WasUnableToUseMove(u8 battlerId); void PrepareStringBattle(u16 stringId, u8 battlerId); diff --git a/include/digit_obj_util.h b/include/digit_obj_util.h index aca97e2c7..4442fb0ec 100644 --- a/include/digit_obj_util.h +++ b/include/digit_obj_util.h @@ -18,9 +18,9 @@ struct DigitObjUtilTemplate bool32 DigitObjUtil_Init(u32 count); void DigitObjUtil_Free(void); bool32 DigitObjUtil_CreatePrinter(u32 id, s32 num, const struct DigitObjUtilTemplate *template); -void DigitObjUtil_PrintNumOn(u32 id, s32 arg1); +void DigitObjUtil_PrintNumOn(u32 id, s32 num); void DigitObjUtil_DeletePrinter(u32 id); -void DigitObjUtil_HideOrShow(u32 id, bool32 arg1); +void DigitObjUtil_HideOrShow(u32 id, bool32 hide); u8 GetTilesPerImage(u32 shape, u32 size); #endif // GUARD_DIGIT_OBJ_UTIL_H diff --git a/include/evolution_graphics.h b/include/evolution_graphics.h index 61051c69a..eab5c6eb7 100644 --- a/include/evolution_graphics.h +++ b/include/evolution_graphics.h @@ -3,7 +3,7 @@ void LoadEvoSparkleSpriteAndPal(void); -u8 EvolutionSparkles_SpiralUpward(u16 arg0); +u8 EvolutionSparkles_SpiralUpward(u16 palNum); u8 EvolutionSparkles_ArcDown(void); u8 EvolutionSparkles_CircleInward(void); u8 EvolutionSparkles_SprayAndFlash(u16 species); diff --git a/include/fldeff_misc.h b/include/fldeff_misc.h index 4acca7944..38dec23b0 100644 --- a/include/fldeff_misc.h +++ b/include/fldeff_misc.h @@ -22,7 +22,7 @@ void PlaySecretBaseMusicNoteMatSound(s16 metatileId); void DoSecretBaseGlitterMatSparkle(void); bool8 FldEff_SandPillar(void); void InteractWithShieldOrTVDecoration(void); -bool8 IsLargeBreakableDecoration(u16 arg0, u8 arg1); +bool8 IsLargeBreakableDecoration(u16 metatileId, bool8 checkBase); void FldEffPoison_Start(void); bool32 FldEffPoison_IsActive(void); void DoWateringBerryTreeAnim(void); diff --git a/include/list_menu.h b/include/list_menu.h index 1c18f3dff..e70a92bab 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -98,9 +98,9 @@ struct CursorStruct extern struct ScrollArrowsTemplate gTempScrollArrowTemplate; extern struct ListMenuTemplate gMultiuseListMenuTemplate; -s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 drawMode, u16 tileNum, u16 palNum); u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow); -u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow); +u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *rect, u16 scrollOffset, u16 selectedRow); s32 ListMenu_ProcessInput(u8 listTaskId); void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow); void RedrawListMenu(u8 listTaskId); @@ -111,10 +111,10 @@ void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId); void ListMenuGetScrollAndRow(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow); u16 ListMenuGetYCoordForPrintingArrowCursor(u8 listTaskId); void ListMenuOverrideSetColors(u8 cursorPal, u8 fillValue, u8 cursorShadowPal); -void ListMenuDefaultCursorMoveFunc(s32 arg0, u8 arg1, struct ListMenu *list); +void ListMenuDefaultCursorMoveFunc(s32 itemIndex, u8 onInit, struct ListMenu *list); s32 ListMenuGetUnkIndicatorsStructFields(u8 taskId, u8 field); void ListMenuSetUnkIndicatorsStructField(u8 taskId, u8 field, s32 value); -u8 AddScrollIndicatorArrowPair(const struct ScrollArrowsTemplate *arrowInfo, u16 *arg1); +u8 AddScrollIndicatorArrowPair(const struct ScrollArrowsTemplate *arrowInfo, u16 *scrollOffset); u8 AddScrollIndicatorArrowPairParameterized(u32 arrowType, s32 commonPos, s32 firstPos, s32 secondPos, s32 fullyDownThreshold, s32 tileTag, s32 palTag, u16 *currItemPtr); void RemoveScrollIndicatorArrowPair(u8 taskId); void Task_ScrollIndicatorArrowPairOnMainMenu(u8 taskId); diff --git a/include/menu.h b/include/menu.h index bf3f56aea..9a940a48a 100644 --- a/include/menu.h +++ b/include/menu.h @@ -56,7 +56,7 @@ void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram); void DisplayYesNoMenuDefaultYes(void); u32 GetPlayerTextSpeed(void); u8 GetPlayerTextSpeedDelay(void); -void Menu_LoadStdPalAt(u16 arg0); +void Menu_LoadStdPalAt(u16 offset); void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16)); void BgDmaFill(u32 bg, u8 a1, int a2, int a3); void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str); diff --git a/include/menu_helpers.h b/include/menu_helpers.h index 0e063e5c1..f9a418a93 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -18,11 +18,11 @@ struct YesNoFuncTable void ResetVramOamAndBgCntRegs(void); void ResetAllBgsCoordinates(void); void SetVBlankHBlankCallbacksToNull(void); -void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 arg2, u8 arg3, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc); +void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 tileNum, u8 paletteNum, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc); bool16 RunTextPrintersRetIsActive(u8 textPrinterId); void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *data); -void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo); -bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1); +void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 unused1, u8 unused2, u8 unused3, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo); +bool8 AdjustQuantityAccordingToDPadInput(s16 *quantity, u16 max); u8 GetLRKeysPressed(void); u8 GetLRKeysPressedAndHeld(void); bool8 IsHoldingItemAllowed(u16 itemId); diff --git a/include/menu_specialized.h b/include/menu_specialized.h index d1e30d4d6..10a211046 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -95,7 +95,7 @@ void ConditionGraph_Draw(struct ConditionGraph *graph); bool8 ConditionGraph_TryUpdate(struct ConditionGraph *graph); void ConditionGraph_Update(struct ConditionGraph *graph); void ConditionGraph_CalcPositions(u8 *conditions, struct UCoords16 *positions); -void ConditionGraph_SetNewPositions(struct ConditionGraph *graph, struct UCoords16 *arg1, struct UCoords16 *arg2); +void ConditionGraph_SetNewPositions(struct ConditionGraph *graph, struct UCoords16 *old, struct UCoords16 *new); // Condition menu bool8 ConditionMenu_UpdateMonEnter(struct ConditionGraph *graph, s16 *x); diff --git a/include/pokemon.h b/include/pokemon.h index 8039a4fdd..7885c2ac5 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -337,7 +337,7 @@ u8 GetBoxMonGender(struct BoxPokemon *boxMon); u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality); void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition); void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition); -void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition); +void SetMultiuseSpriteTemplateToTrainerFront(u16 trainerPicId, u8 battlerPosition); // These are full type signatures for GetMonData() and GetBoxMonData(), // but they are not used since some code erroneously omits the third arg. @@ -426,8 +426,8 @@ void SetWildMonHeldItem(void); bool8 IsMonShiny(struct Pokemon *mon); bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); const u8 *GetTrainerPartnerName(void); -void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); -void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); +void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 panMode); +void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 panModeAnimFlag); void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneFrame); void StopPokemonAnimationDelayTask(void); void BattleAnimateBackSprite(struct Sprite* sprite, u16 species); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index b7fca2331..eb25c0ff2 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -26,7 +26,7 @@ struct PokemonStorage extern struct PokemonStorage *gPokemonStoragePtr; -void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 arg2, u8 arg3, s32 bytesToBuffer); +void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 zero1, u8 zero2, s32 bytesToBuffer); u8 CountMonsInBox(u8 boxId); s16 GetFirstFreeBoxSpot(u8 boxId); u8 CountPartyAliveNonEggMonsExcept(u8 slotToIgnore); @@ -52,7 +52,7 @@ void ZeroBoxMonAt(u8 boxId, u8 boxPosition); void BoxMonAtToMon(u8 boxId, u8 boxPosition, struct Pokemon *dst); struct BoxPokemon *GetBoxedMonPtr(u8 boxId, u8 boxPosition); u8 *GetBoxNamePtr(u8 boxId); -s16 AdvanceStorageMonIndex(struct BoxPokemon *boxMons, u8 currIndex, u8 maxIndex, u8 arg3); +s16 AdvanceStorageMonIndex(struct BoxPokemon *boxMons, u8 currIndex, u8 maxIndex, u8 mode); bool8 CheckFreePokemonStorageSpace(void); bool32 CheckBoxMonSanityAt(u32 boxId, u32 boxPosition); u32 CountStorageNonEggMons(void); diff --git a/include/pokenav.h b/include/pokenav.h index d3edb1422..07beae957 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -356,10 +356,10 @@ void MatchCall_GetNameAndDesc(u32 idx, const u8 **desc, const u8 **name); // pokenav_main_menu.c bool32 InitPokenavMainMenu(void); void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size); -void RunMainMenuLoopedTask(u32 a0); +void RunMainMenuLoopedTask(u32 state); u32 IsActiveMenuLoopTaskActive(void); -void LoadLeftHeaderGfxForIndex(u32 arg0); -void ShowLeftHeaderGfx(u32 menugfxId, bool32 arg1, bool32 isOnRightSide); +void LoadLeftHeaderGfxForIndex(u32 menuGfxId); +void ShowLeftHeaderGfx(u32 menugfxId, bool32 isMain, bool32 isOnRightSide); void PokenavFadeScreen(s32 fadeType); bool32 AreLeftHeaderSpritesMoving(void); void InitBgTemplates(const struct BgTemplate *templates, int count); @@ -373,7 +373,7 @@ void PokenavCopyPalette(const u16 *a0, const u16 *a1, int a2, int a3, int a4, u1 void FadeToBlackExceptPrimary(void); struct Sprite *GetSpinningPokenavSprite(void); void HideSpinningPokenavSprite(void); -void UpdateRegionMapRightHeaderTiles(u32 arg0); +void UpdateRegionMapRightHeaderTiles(u32 menuGfxId); void HideMainOrSubMenuLeftHeader(u32 id, bool32 onRightSide); void SlideMenuHeaderUp(void); void PokenavFillPalette(u32 palIndex, u16 fillValue); @@ -417,8 +417,8 @@ int GetMatchCallTrainerPic(int index); const u8 *GetMatchCallFlavorText(int index, int textType); const u8 *GetMatchCallMessageText(int index, bool8 *newRematchRequest); u16 GetMatchCallOptionCursorPos(void); -u16 GetMatchCallOptionId(int arg0); -void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry * arg0, u8 *str); +u16 GetMatchCallOptionId(int optionId); +void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry *matchCallEntry, u8 *str); u8 GetMatchTableMapSectionId(int rematchIndex); int GetIndexDeltaOfNextCheckPageDown(int index); int GetIndexDeltaOfNextCheckPageUp(int index); diff --git a/include/trainer_card.h b/include/trainer_card.h index f5e73da83..f14335ae8 100644 --- a/include/trainer_card.h +++ b/include/trainer_card.h @@ -69,7 +69,7 @@ u32 CountPlayerTrainerStars(void); u8 GetTrainerCardStars(u8 cardId); void CopyTrainerCardData(struct TrainerCard *dst, struct TrainerCard *src, u8 gameVersion); void ShowPlayerTrainerCard(void (*callback)(void)); -void ShowTrainerCardInLink(u8 arg0, void (*callback)(void)); +void ShowTrainerCardInLink(u8 cardId, void (*callback)(void)); void TrainerCard_GenerateCardForLinkPlayer(struct TrainerCard *); #endif // GUARD_TRAINER_CARD_H diff --git a/src/bard_music.c b/src/bard_music.c index bdc5ac808..dd986371d 100644 --- a/src/bard_music.c +++ b/src/bard_music.c @@ -7,9 +7,9 @@ #include "data/bard_music/default_sound.h" #include "data/bard_music/length_table.h" -static s16 CalcWordPitch(int arg0, int songPos) +static s16 CalcWordPitch(int pitchIdx, int songPos) { - return sBardSoundPitchTables[arg0][songPos]; + return sBardSoundPitchTables[pitchIdx][songPos]; } const struct BardSound *GetWordSounds(u16 word) diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index f73393de4..fcd594db5 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -3717,6 +3717,26 @@ void AnimTask_SlideMonForFocusBand(u8 taskId) gTasks[taskId].func = AnimTask_SlideMonForFocusBand_Step1; } +#define IDX_ACTIVE_SPRITES 2 // Used by the sprite callback to modify the number of active sprites + +// Task data for AnimTask_SquishAndSweatDroplets +#define tState data[0] +#define tTimer data[1] +#define tActiveSprites data[IDX_ACTIVE_SPRITES] +#define tNumSquishes data[3] +#define tBaseX data[4] +#define tBaseY data[5] +#define tSubpriority data[6] +// data[7]-data[15] used by PrepareAffineAnimInTaskData +#define tBattlerSpriteId data[15] + +// Sprite data for AnimFacadeSweatDrop +#define sTimer data[0] +#define sVelocX data[1] +#define sVelocY data[2] +#define sTaskId data[3] +#define sActiveSpritesIdx data[4] + // Squishes the mon vertically and emits sweat droplets a few times. // arg 0: battler // arg 1: num squishes @@ -3728,20 +3748,20 @@ void AnimTask_SquishAndSweatDroplets(u8 taskId) if (!gBattleAnimArgs[1]) DestroyAnimVisualTask(taskId); - task->data[0] = 0; - task->data[1] = 0; - task->data[2] = 0; - task->data[3] = gBattleAnimArgs[1]; + task->tState = 0; + task->tTimer = 0; + task->tActiveSprites = 0; + task->tNumSquishes = gBattleAnimArgs[1]; if (gBattleAnimArgs[0] == ANIM_ATTACKER) battler = gBattleAnimAttacker; else battler = gBattleAnimTarget; - task->data[4] = GetBattlerSpriteCoord(battler, BATTLER_COORD_X); - task->data[5] = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y); - task->data[6] = GetBattlerSpriteSubpriority(battler); - task->data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); - PrepareAffineAnimInTaskData(task, task->data[15], gFacadeSquishAffineAnimCmds); + task->tBaseX = GetBattlerSpriteCoord(battler, BATTLER_COORD_X); + task->tBaseY = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y); + task->tSubpriority = GetBattlerSpriteSubpriority(battler); + task->tBattlerSpriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + PrepareAffineAnimInTaskData(task, task->tBattlerSpriteId, gFacadeSquishAffineAnimCmds); task->func = AnimTask_SquishAndSweatDroplets_Step; } @@ -3749,37 +3769,40 @@ static void AnimTask_SquishAndSweatDroplets_Step(u8 taskId) { struct Task *task = &gTasks[taskId]; - switch (task->data[0]) + switch (task->tState) { case 0: - task->data[1]++; - if (task->data[1] == 6) + task->tTimer++; + if (task->tTimer == 6) CreateSweatDroplets(taskId, TRUE); - if (task->data[1] == 18) + if (task->tTimer == 18) CreateSweatDroplets(taskId, FALSE); if (!RunAffineAnimFromTaskData(task)) { - if (--task->data[3] == 0) + if (--task->tNumSquishes == 0) { - task->data[0]++; + // Animation is finished + task->tState++; } else { - task->data[1] = 0; - PrepareAffineAnimInTaskData(task, task->data[15], gFacadeSquishAffineAnimCmds); + // Animation continues, more droplet sprites to create + task->tTimer = 0; + PrepareAffineAnimInTaskData(task, task->tBattlerSpriteId, gFacadeSquishAffineAnimCmds); } } break; case 1: - if (task->data[2] == 0) + // Wait for sprites to be destroyed before ending task + if (task->tActiveSprites == 0) DestroyAnimVisualTask(taskId); break; } } -static void CreateSweatDroplets(u8 taskId, bool8 arg1) +static void CreateSweatDroplets(u8 taskId, bool8 lowerDroplets) { u8 i; s8 xOffset, yOffset; @@ -3788,7 +3811,7 @@ static void CreateSweatDroplets(u8 taskId, bool8 arg1) s16 yCoords[2]; task = &gTasks[taskId]; - if (!arg1) + if (!lowerDroplets) { xOffset = 18; yOffset = -20; @@ -3799,39 +3822,54 @@ static void CreateSweatDroplets(u8 taskId, bool8 arg1) yOffset = 20; } - xCoords[0] = task->data[4] - xOffset; - xCoords[1] = task->data[4] - xOffset - 4; - xCoords[2] = task->data[4] + xOffset; - xCoords[3] = task->data[4] + xOffset + 4; - yCoords[0] = task->data[5] + yOffset; - yCoords[1] = task->data[5] + yOffset + 6; + xCoords[0] = task->tBaseX - xOffset; + xCoords[1] = task->tBaseX - xOffset - 4; + xCoords[2] = task->tBaseX + xOffset; + xCoords[3] = task->tBaseX + xOffset + 4; + yCoords[0] = task->tBaseY + yOffset; + yCoords[1] = task->tBaseY + yOffset + 6; for (i = 0; i < 4; i++) { - u8 spriteId = CreateSprite(&gFacadeSweatDropSpriteTemplate, xCoords[i], yCoords[i & 1], task->data[6] - 5); + u8 spriteId = CreateSprite(&gFacadeSweatDropSpriteTemplate, xCoords[i], yCoords[i & 1], task->tSubpriority - 5); if (spriteId != MAX_SPRITES) { - gSprites[spriteId].data[0] = 0; - gSprites[spriteId].data[1] = i < 2 ? -2 : 2; - gSprites[spriteId].data[2] = -1; - gSprites[spriteId].data[3] = taskId; - gSprites[spriteId].data[4] = 2; - task->data[2]++; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].sVelocX = i < 2 ? -2 : 2; // First two travel left, remaining travel right + gSprites[spriteId].sVelocY = -1; + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sActiveSpritesIdx = IDX_ACTIVE_SPRITES; + task->tActiveSprites++; } } } static void AnimFacadeSweatDrop(struct Sprite *sprite) { - sprite->x += sprite->data[1]; - sprite->y += sprite->data[2]; - if (++sprite->data[0] > 6) + sprite->x += sprite->sVelocX; + sprite->y += sprite->sVelocY; + if (++sprite->sTimer > 6) { - gTasks[sprite->data[3]].data[sprite->data[4]]--; + gTasks[sprite->sTaskId].data[sprite->sActiveSpritesIdx]--; DestroySprite(sprite); } } +#undef IDX_ACTIVE_SPRITES +#undef tState +#undef tTimer +#undef tActiveSprites +#undef tNumSquishes +#undef tBaseX +#undef tBaseY +#undef tSubpriority +#undef tBattlerSpriteId +#undef sTimer +#undef sVelocX +#undef sVelocY +#undef sTaskId +#undef sActiveSpritesIdx + // Blends the mon sprite's color with a rotating set of colors. // arg 0: battler // arg 1: duration @@ -3927,6 +3965,26 @@ static void AnimRoarNoiseLine_Step(struct Sprite *sprite) DestroyAnimSprite(sprite); } +#define IDX_ACTIVE_SPRITES 10 // Used by the sprite callback to modify the number of active sprites + +// Task data for AnimTask_GlareEyeDots +#define tState data[0] +#define tTimer data[1] +#define tPairNum data[2] +#define tPairMax data[5] +#define tDotOffset data[6] +#define tIsContest data[7] +#define tActiveSprites data[IDX_ACTIVE_SPRITES] +#define tStartX data[11] +#define tStartY data[12] +#define tEndX data[13] +#define tEndY data[14] + +// Sprite data for AnimGlareEyeDot +#define sTimer data[0] +#define sTaskId data[1] +#define sActiveSpritesIdx data[2] + // Makes a series of dots in a trail from the attacker to the target. // arg 0: unused void AnimTask_GlareEyeDots(u8 taskId) @@ -3935,25 +3993,25 @@ void AnimTask_GlareEyeDots(u8 taskId) if (IsContest()) { - task->data[5] = 8; - task->data[6] = 3; - task->data[7] = 1; + task->tPairMax = 8; + task->tDotOffset = 3; + task->tIsContest = TRUE; } else { - task->data[5] = 12; - task->data[6] = 3; - task->data[7] = 0; + task->tPairMax = 12; + task->tDotOffset = 3; + task->tIsContest = FALSE; } if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) - task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; + task->tStartX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; else - task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; + task->tStartX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; - task->data[12] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; - task->data[13] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); - task->data[14] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); + task->tStartY = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; + task->tEndX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + task->tEndY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); task->func = AnimTask_GlareEyeDots_Step; } @@ -3963,103 +4021,122 @@ static void AnimTask_GlareEyeDots_Step(u8 taskId) s16 x, y; struct Task *task = &gTasks[taskId]; - switch (task->data[0]) + switch (task->tState) { case 0: - if (++task->data[1] > 3) + // Wait to create next pair of dots + if (++task->tTimer > 3) { - task->data[1] = 0; + task->tTimer = 0; GetGlareEyeDotCoords( - task->data[11], - task->data[12], - task->data[13], - task->data[14], - task->data[5], - task->data[2], + task->tStartX, + task->tStartY, + task->tEndX, + task->tEndY, + task->tPairMax, + task->tPairNum, &x, &y); + // Create dot pair for (i = 0; i < 2; i++) { u8 spriteId = CreateSprite(&gGlareEyeDotSpriteTemplate, x, y, 35); if (spriteId != MAX_SPRITES) { - if (task->data[7] == 0) + if (!task->tIsContest) { if (i == 0) - gSprites[spriteId].x2 = gSprites[spriteId].y2 = -task->data[6]; + gSprites[spriteId].x2 = gSprites[spriteId].y2 = -task->tDotOffset; else - gSprites[spriteId].x2 = gSprites[spriteId].y2 = task->data[6]; + gSprites[spriteId].x2 = gSprites[spriteId].y2 = task->tDotOffset; } else { if (i == 0) { - gSprites[spriteId].x2 = -task->data[6]; - gSprites[spriteId].y2 = task->data[6]; + gSprites[spriteId].x2 = -task->tDotOffset; + gSprites[spriteId].y2 = task->tDotOffset; } else { - gSprites[spriteId].x2 = task->data[6]; - gSprites[spriteId].y2 = -task->data[6]; + gSprites[spriteId].x2 = task->tDotOffset; + gSprites[spriteId].y2 = -task->tDotOffset; } } - gSprites[spriteId].data[0] = 0; - gSprites[spriteId].data[1] = taskId; - gSprites[spriteId].data[2] = 10; - task->data[10]++; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sActiveSpritesIdx = IDX_ACTIVE_SPRITES; + task->tActiveSprites++; } } - if (task->data[2] == task->data[5]) - task->data[0]++; + if (task->tPairNum == task->tPairMax) + task->tState++; - task->data[2]++; + task->tPairNum++; } break; case 1: - if (task->data[10] == 0) + // Wait for sprites to be destroyed before ending task + if (task->tActiveSprites == 0) DestroyAnimVisualTask(taskId); break; } } -static void GetGlareEyeDotCoords(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4, u8 arg5, s16 *x, s16 *y) +static void GetGlareEyeDotCoords(s16 startX, s16 startY, s16 endX, s16 endY, u8 pairMax, u8 pairNum, s16 *x, s16 *y) { int x2; int y2; - if (arg5 == 0) + if (pairNum == 0) { - *x = arg0; - *y = arg1; + *x = startX; + *y = startY; return; } - if (arg5 >= arg4) + if (pairNum >= pairMax) { - *x = arg2; - *y = arg3; + *x = endX; + *y = endY; return; } - arg4--; - x2 = (arg0 << 8) + arg5 * (((arg2 - arg0) << 8) / arg4); - y2 = (arg1 << 8) + arg5 * (((arg3 - arg1) << 8) / arg4); + pairMax--; + x2 = (startX << 8) + pairNum * (((endX - startX) << 8) / pairMax); + y2 = (startY << 8) + pairNum * (((endY - startY) << 8) / pairMax); *x = x2 >> 8; *y = y2 >> 8; } static void AnimGlareEyeDot(struct Sprite *sprite) { - if (++sprite->data[0] > 36) + if (++sprite->sTimer > 36) { - gTasks[sprite->data[1]].data[sprite->data[2]]--; + gTasks[sprite->sTaskId].data[sprite->sActiveSpritesIdx]--; DestroySprite(sprite); } } +#undef IDX_ACTIVE_SPRITES +#undef tState +#undef tTimer +#undef tPairNum +#undef tPairMax +#undef tDotOffset +#undef tIsContest +#undef tActiveSprites +#undef tStartX +#undef tStartY +#undef tEndX +#undef tEndY +#undef sTimer +#undef sTaskId +#undef sActiveSpritesIdx + // Moves a pawprint in a straight line. // arg 0: initial x position // arg 1: initial y position diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 5b69030df..954192f0a 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -96,8 +96,8 @@ static void PlayerCmdEnd(void); static void PlayerBufferRunCommand(void); static void HandleInputChooseTarget(void); static void HandleInputChooseMove(void); -static void MoveSelectionCreateCursorAt(u8 cursorPos, u8 arg1); -static void MoveSelectionDestroyCursorAt(u8 cursorPos); +static void MoveSelectionCreateCursorAt(u8, u8); +static void MoveSelectionDestroyCursorAt(u8); static void MoveSelectionDisplayPpNumber(void); static void MoveSelectionDisplayPpString(void); static void MoveSelectionDisplayMoveType(void); @@ -106,18 +106,18 @@ static void HandleMoveSwitching(void); static void SwitchIn_HandleSoundAndEnd(void); static void WaitForMonSelection(void); static void CompleteWhenChoseItem(void); -static void Task_LaunchLvlUpAnim(u8 taskId); -static void Task_PrepareToGiveExpWithExpBar(u8 taskId); -static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); -static void Task_GiveExpWithExpBar(u8 taskId); -static void Task_UpdateLvlInHealthbox(u8 taskId); +static void Task_LaunchLvlUpAnim(u8); +static void Task_PrepareToGiveExpWithExpBar(u8); +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8); +static void Task_GiveExpWithExpBar(u8); +static void Task_UpdateLvlInHealthbox(u8); static void PrintLinkStandbyMsg(void); -static u32 CopyPlayerMonData(u8 monId, u8 *dst); -static void SetPlayerMonData(u8 monId); -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); +static u32 CopyPlayerMonData(u8, u8 *); +static void SetPlayerMonData(u8); +static void StartSendOutAnim(u8, bool8); static void DoSwitchOutAnimation(void); static void PlayerDoMoveAnimation(void); -static void Task_StartSendOutAnim(u8 taskId); +static void Task_StartSendOutAnim(u8); static void EndDrawPartyStatusSummary(void); static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = @@ -1507,11 +1507,11 @@ static void MoveSelectionDisplayMoveType(void) BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE); } -static void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) +static void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 baseTileNum) { u16 src[2]; - src[0] = arg1 + 1; - src[1] = arg1 + 2; + src[0] = baseTileNum + 1; + src[1] = baseTileNum + 2; CopyToBgTilemapBufferRect_ChangePalette(0, src, 9 * (cursorPosition & 1) + 1, 55 + (cursorPosition & 2), 1, 2, 0x11); CopyBgTilemapBufferToVram(0); @@ -1527,7 +1527,7 @@ static void MoveSelectionDestroyCursorAt(u8 cursorPosition) CopyBgTilemapBufferToVram(0); } -void ActionSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) +void ActionSelectionCreateCursorAt(u8 cursorPosition, u8 baseTileNum) { u16 src[2]; src[0] = 1; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 7d2717e2c..369f735f2 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -1168,13 +1168,13 @@ void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpN PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(*movePpData) + 4); } -void BtlController_EmitChooseItem(u8 bufferId, u8 *arg1) +void BtlController_EmitChooseItem(u8 bufferId, u8 *battlePartyOrder) { s32 i; sBattleBuffersTransferData[0] = CONTROLLER_OPENBAG; - for (i = 0; i < 3; i++) - sBattleBuffersTransferData[1 + i] = arg1[i]; + for (i = 0; i < PARTY_SIZE / 2; i++) + sBattleBuffersTransferData[1 + i] = battlePartyOrder[i]; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } @@ -1309,12 +1309,12 @@ void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 3); } -void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2) +void BtlController_EmitTwoReturnValues(u8 bufferId, u8 ret8, u16 ret16) { sBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES; - sBattleBuffersTransferData[1] = arg1; - sBattleBuffersTransferData[2] = arg2; - sBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8; + sBattleBuffersTransferData[1] = ret8; + sBattleBuffersTransferData[2] = ret16; + sBattleBuffersTransferData[3] = (ret16 & 0xFF00) >> 8; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } @@ -1329,20 +1329,20 @@ void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battleP PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 5); } -void BtlController_EmitOneReturnValue(u8 bufferId, u16 arg1) +void BtlController_EmitOneReturnValue(u8 bufferId, u16 ret) { sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE; - sBattleBuffersTransferData[1] = arg1; - sBattleBuffersTransferData[2] = (arg1 & 0xFF00) >> 8; + sBattleBuffersTransferData[1] = ret; + sBattleBuffersTransferData[2] = (ret & 0xFF00) >> 8; sBattleBuffersTransferData[3] = 0; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 b) +void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret) { sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE; - sBattleBuffersTransferData[1] = b; - sBattleBuffersTransferData[2] = (b & 0xFF00) >> 8; + sBattleBuffersTransferData[1] = ret; + sBattleBuffersTransferData[2] = (ret & 0xFF00) >> 8; sBattleBuffersTransferData[3] = 0; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } diff --git a/src/battle_dome.c b/src/battle_dome.c index aadd85afd..c9614e6fc 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -73,40 +73,39 @@ struct TourneyTreeLineSection #define tMode data[2] #define tPrevTaskId data[3] -// This file's functions. -static u8 GetDomeTrainerMonIvs(u16 trainerId); -static void SwapDomeTrainers(int id1, int id2, u16 *statsArray); -static void CalcDomeMonStats(u16 species, int level, int ivs, u8 evBits, u8 nature, int *stats); -static void CreateDomeOpponentMons(u16 tournamentTrainerId); -static int SelectOpponentMonsUsingPersonality(u16 tournamentTrainerId, bool8 arg1); -static int SelectOpponentMonsUsingOtId(u16 tournamentTrainerId, bool8 arg1); -static int GetTypeEffectivenessPoints(int move, int species, int arg2); -static int SelectOpponentMonsFromParty(int *arr, bool8 arg1); -static void Task_ShowTourneyInfoCard(u8 taskId); -static void Task_HandleInfoCardInput(u8 taskId); -static u8 Task_GetInfoCardInput(u8 taskId); +static u8 GetDomeTrainerMonIvs(u16); +static void SwapDomeTrainers(int, int, u16 *); +static void CalcDomeMonStats(u16, int, int, u8, u8, int *); +static void CreateDomeOpponentMons(u16); +static int SelectOpponentMonsUsingPersonality(u16, bool8); +static int SelectOpponentMonsUsingOtId(u16, bool8); +static int GetTypeEffectivenessPoints(int, int, int); +static int SelectOpponentMonsFromParty(int *, bool8); +static void Task_ShowTourneyInfoCard(u8); +static void Task_HandleInfoCardInput(u8); +static u8 Task_GetInfoCardInput(u8); static void SetFacilityTrainerAndMonPtrs(void); -static int TrainerIdToTournamentId(u16 trainerId); +static int TrainerIdToTournamentId(u16); static u16 TrainerIdOfPlayerOpponent(void); -static void Task_ShowTourneyTree(u8 taskId); -static void Task_HandleStaticTourneyTreeInput(u8 taskId); +static void Task_ShowTourneyTree(u8); +static void Task_HandleStaticTourneyTreeInput(u8); static void CB2_TourneyTree(void); static void VblankCb_TourneyInfoCard(void); -static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo); -static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId); +static void DisplayMatchInfoOnCard(u8, u8); +static void DisplayTrainerInfoOnCard(u8, u8); static int BufferDomeWinString(u8, u8*); static u8 GetDomeBrainTrainerPicId(void); static u8 GetDomeBrainTrainerClass(void); -static void CopyDomeBrainTrainerName(u8 *str); -static void CopyDomeTrainerName(u8 *str, u16 trainerId); +static void CopyDomeBrainTrainerName(u8 *); +static void CopyDomeTrainerName(u8 *, u16); static void HblankCb_TourneyTree(void); static void VblankCb_TourneyTree(void); -static u8 UpdateTourneyTreeCursor(u8 taskId); -static void DecideRoundWinners(u8 roundId); -static u8 GetOpposingNPCTournamentIdByRound(u8 tournamentId, u8); +static u8 UpdateTourneyTreeCursor(u8); +static void DecideRoundWinners(u8); +static u8 GetOpposingNPCTournamentIdByRound(u8, u8); static void DrawTourneyAdvancementLine(u8, u8); -static void SpriteCb_HorizontalScrollArrow(struct Sprite *sprite); -static void SpriteCb_VerticalScrollArrow(struct Sprite *sprite); +static void SpriteCb_HorizontalScrollArrow(struct Sprite *); +static void SpriteCb_VerticalScrollArrow(struct Sprite *); static void InitDomeChallenge(void); static void GetDomeData(void); static void SetDomeData(void); @@ -130,7 +129,6 @@ static void BufferLastDomeWinnerName(void); static void InitRandomTourneyTreeResults(void); static void InitDomeTrainers(void); -// EWRAM variables. EWRAM_DATA u32 gPlayerPartyLostHP = 0; // never read static EWRAM_DATA u32 sPlayerPartyMaxHP = 0; // never read static EWRAM_DATA struct TourneyTreeInfoCard *sInfoCard = {0}; @@ -2080,7 +2078,6 @@ static const u8 sTourneyTreeLineSectionArrayCounts[DOME_TOURNAMENT_TRAINERS_COUN {ARRAY_COUNT(sLineSectionTrainer16Round1), ARRAY_COUNT(sLineSectionTrainer16Round2), ARRAY_COUNT(sLineSectionTrainer16Semifinal), ARRAY_COUNT(sLineSectionTrainer16Final)}, }; -// code void CallBattleDomeFunction(void) { sBattleDomeFunctions[gSpecialVar_0x8004](); diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 2a690d129..d0981324f 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -353,12 +353,12 @@ void SpriteCB_WaitForBattlerBallReleaseAnim(struct Sprite *sprite) } } -static void UnusedDoBattleSpriteAffineAnim(struct Sprite *sprite, bool8 arg1) +static void UnusedDoBattleSpriteAffineAnim(struct Sprite *sprite, bool8 pointless) { sprite->animPaused = TRUE; sprite->callback = SpriteCallbackDummy; - if (!arg1) + if (!pointless) StartSpriteAffineAnim(sprite, 1); else StartSpriteAffineAnim(sprite, 1); @@ -783,7 +783,7 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state) return retVal; } -void LoadBattleBarGfx(u8 arg0) +void LoadBattleBarGfx(u8 unused) { LZDecompressWram(gBattleInterfaceGfx_BattleBar, gMonSpritesGfxPtr->barFontGfx); } diff --git a/src/battle_interface.c b/src/battle_interface.c index 26209fe2d..6d869df78 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -158,36 +158,36 @@ enum HEALTHBOX_GFX_FRAME_END_BAR, }; -static const u8 *GetHealthboxElementGfxPtr(u8 elementId); -static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId); +static const u8 *GetHealthboxElementGfxPtr(u8); +static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *, u32, u32, u32, u32 *); static void RemoveWindowOnHealthbox(u32 windowId); -static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent); -static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId); +static void UpdateHpTextInHealthboxInDoubles(u8, s16, u8); +static void UpdateStatusIconInHealthbox(u8); -static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 windowWidth); -static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth); -static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth); -static void FillHealthboxObject(void *dest, u32 arg1, u32 arg2); +static void TextIntoHealthboxObject(void *, u8 *, s32); +static void SafariTextIntoHealthboxObject(void *, u8 *, u32); +static void HpTextIntoHealthboxObject(void *, u8 *, u32); +static void FillHealthboxObject(void *, u32, u32); -static void Task_HidePartyStatusSummary_BattleStart_1(u8 taskId); -static void Task_HidePartyStatusSummary_BattleStart_2(u8 taskId); -static void Task_HidePartyStatusSummary_DuringBattle(u8 taskId); +static void Task_HidePartyStatusSummary_BattleStart_1(u8); +static void Task_HidePartyStatusSummary_BattleStart_2(u8); +static void Task_HidePartyStatusSummary_DuringBattle(u8); -static void SpriteCB_HealthBoxOther(struct Sprite *sprite); -static void SpriteCB_HealthBar(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBar_Enter(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBar_Exit(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBalls_Enter(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBalls_Exit(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBalls_OnSwitchout(struct Sprite *sprite); +static void SpriteCB_HealthBoxOther(struct Sprite *); +static void SpriteCB_HealthBar(struct Sprite *); +static void SpriteCB_StatusSummaryBar_Enter(struct Sprite *); +static void SpriteCB_StatusSummaryBar_Exit(struct Sprite *); +static void SpriteCB_StatusSummaryBalls_Enter(struct Sprite *); +static void SpriteCB_StatusSummaryBalls_Exit(struct Sprite *); +static void SpriteCB_StatusSummaryBalls_OnSwitchout(struct Sprite *); -static u8 GetStatusIconForBattlerId(u8 statusElementId, u8 battlerId); -static s32 CalcNewBarValue(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 arg4, u16 arg5); -static u8 GetScaledExpFraction(s32 currValue, s32 receivedValue, s32 maxValue, u8 scale); -static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar); -static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *currValue, u8 *arg4, u8 scale); -static void Debug_TestHealthBar_Helper(struct TestingBar *barInfo, s32 *arg1, u16 *arg2); +static u8 GetStatusIconForBattlerId(u8, u8); +static s32 CalcNewBarValue(s32, s32, s32, s32 *, u8, u16); +static u8 GetScaledExpFraction(s32, s32, s32, u8); +static void MoveBattleBarGraphically(u8, u8); +static u8 CalcBarFilledPixels(s32, s32, s32, s32 *, u8 *, u8); +static void Debug_TestHealthBar_Helper(struct TestingBar *, s32 *, u16 *); static const struct OamData sOamData_64x32 = { @@ -814,11 +814,11 @@ static void Debug_DrawNumber(s16 number, u16 *dest, bool8 unk) } // Unused -static void Debug_DrawNumberPair(s16 number1, s16 number2, u16 *arg2) +static void Debug_DrawNumberPair(s16 number1, s16 number2, u16 *dest) { - arg2[4] = 0x1E; - Debug_DrawNumber(number2, arg2, 0); - Debug_DrawNumber(number1, arg2 + 5, 1); + dest[4] = 0x1E; + Debug_DrawNumber(number2, dest, 0); + Debug_DrawNumber(number1, dest + 5, 1); } // Because the healthbox is too large to fit into one sprite, it is divided into two sprites. @@ -2453,19 +2453,19 @@ static s16 Debug_TestHealthBar(struct TestingBar *barInfo, s32 *currValue, u16 * return ret; } -static void Debug_TestHealthBar_Helper(struct TestingBar *barInfo, s32 *currValue, u16 *arg2) +static void Debug_TestHealthBar_Helper(struct TestingBar *barInfo, s32 *currValue, u16 *dest) { u8 sp8[6]; - u16 sp10[6]; + u16 src[6]; u8 i; CalcBarFilledPixels(barInfo->maxValue, barInfo->oldValue, barInfo->receivedValue, currValue, sp8, B_HEALTHBAR_PIXELS / 8); for (i = 0; i < 6; i++) - sp10[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + sp8[i]); + src[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + sp8[i]); - CpuCopy16(sp10, arg2, sizeof(sp10)); + CpuCopy16(src, dest, sizeof(src)); } static u8 GetScaledExpFraction(s32 oldValue, s32 receivedValue, s32 maxValue, u8 scale) diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 9039f60f2..b0bcdfd5e 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -83,18 +83,18 @@ static void ClearPyramidPartyHeldItems(void); static void SetPyramidFloorPalette(void); static void BattlePyramidStartMenu(void); static void RestorePyramidPlayerParty(void); -static void InitPyramidBagItems(u8 lvlMode); +static void InitPyramidBagItems(u8); static u8 GetPyramidFloorTemplateId(void); static u8 GetPostBattleDirectionHintTextIndex(int *, u8, u8); -static void Task_SetPyramidFloorPalette(u8 taskId); -static void MarkPyramidTrainerAsBattled(u16 trainerId); -static void GetPyramidFloorLayoutOffsets(u8 *layoutOffsets); +static void Task_SetPyramidFloorPalette(u8); +static void MarkPyramidTrainerAsBattled(u16); +static void GetPyramidFloorLayoutOffsets(u8 *); static void GetPyramidEntranceAndExitSquareIds(u8 *, u8 *); static void SetPyramidObjectPositionsUniformly(u8); static bool8 SetPyramidObjectPositionsInAndNearSquare(u8, u8); static bool8 SetPyramidObjectPositionsNearSquare(u8, u8); -static bool8 TrySetPyramidObjectEventPositionInSquare(u8 arg0, u8 *floorLayoutOffsets, u8 squareId, u8 objectEventId); -static bool8 TrySetPyramidObjectEventPositionAtCoords(bool8 objType, u8 x, u8 y, u8 *floorLayoutOffsets, u8 squareId, u8 objectEventId); +static bool8 TrySetPyramidObjectEventPositionInSquare(u8, u8 *, u8, u8); +static bool8 TrySetPyramidObjectEventPositionAtCoords(bool8, u8, u8, u8 *, u8, u8); // Const rom data. #define ABILITY_RANDOM 2 // For wild mons data. diff --git a/src/evolution_graphics.c b/src/evolution_graphics.c index 5d17cca84..a6b558195 100644 --- a/src/evolution_graphics.c +++ b/src/evolution_graphics.c @@ -92,11 +92,22 @@ static const struct SpriteTemplate sEvoSparkleSpriteTemplate = .callback = SpriteCB_Sparkle_Dummy }; -static const s16 sEvoSparkleMatrices[] = +static const u16 sEvoSparkleMatrices[] = { - 0x3C0, 0x380, 0x340, 0x300, 0x2C0, 0x280, 0x240, 0x200, 0x1C0, - 0x180, 0x140, 0x100, -4, 0x10, -3, 0x30, -2, 0x50, - -1, 0x70, 0x1, 0x70, 0x2, 0x50, 0x3, 0x30, 0x4, 0x10 + 0x3C0, 0x380, 0x340, 0x300, 0x2C0, 0x280, + 0x240, 0x200, 0x1C0, 0x180, 0x140, 0x100 +}; + +static const s16 sUnused[] = +{ + -4, 0x10, + -3, 0x30, + -2, 0x50, + -1, 0x70, + 1, 0x70, + 2, 0x50, + 3, 0x30, + 4, 0x10 }; static void SpriteCB_Sparkle_Dummy(struct Sprite *sprite) @@ -107,30 +118,33 @@ static void SpriteCB_Sparkle_Dummy(struct Sprite *sprite) static void SetEvoSparklesMatrices(void) { u16 i; - for (i = 0; i < 12; i++) - { + for (i = 0; i < ARRAY_COUNT(sEvoSparkleMatrices); i++) SetOamMatrix(20 + i, sEvoSparkleMatrices[i], 0, 0, sEvoSparkleMatrices[i]); - } } +#define sSpeed data[3] +#define sAmplitude data[5] +#define sTrigIdx data[6] +#define sTimer data[7] + static void SpriteCB_Sparkle_SpiralUpward(struct Sprite* sprite) { if (sprite->y > 8) { u8 matrixNum; - sprite->y = 88 - (sprite->data[7] * sprite->data[7]) / 80; - sprite->y2 = Sin((u8)(sprite->data[6]), sprite->data[5]) / 4; - sprite->x2 = Cos((u8)(sprite->data[6]), sprite->data[5]); - sprite->data[6] += 4; - if (sprite->data[7] & 1) - sprite->data[5]--; - sprite->data[7]++; + sprite->y = 88 - (sprite->sTimer * sprite->sTimer) / 80; + sprite->y2 = Sin((u8)sprite->sTrigIdx, sprite->sAmplitude) / 4; + sprite->x2 = Cos((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->sTrigIdx += 4; + if (sprite->sTimer & 1) + sprite->sAmplitude--; + sprite->sTimer++; if (sprite->y2 > 0) sprite->subpriority = 1; else sprite->subpriority = 20; - matrixNum = sprite->data[5] / 4 + 20; + matrixNum = sprite->sAmplitude / 4 + 20; if (matrixNum > 31) matrixNum = 31; sprite->oam.matrixNum = matrixNum; @@ -139,17 +153,17 @@ static void SpriteCB_Sparkle_SpiralUpward(struct Sprite* sprite) DestroySprite(sprite); } -static void CreateSparkle_SpiralUpward(u8 arg0) +static void CreateSparkle_SpiralUpward(u8 trigIdx) { - u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 88, 0); - if (spriteID != MAX_SPRITES) + u8 spriteId = CreateSprite(&sEvoSparkleSpriteTemplate, DISPLAY_WIDTH / 2, 88, 0); + if (spriteId != MAX_SPRITES) { - gSprites[spriteID].data[5] = 48; - gSprites[spriteID].data[6] = arg0; - gSprites[spriteID].data[7] = 0; - gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteID].oam.matrixNum = 31; - gSprites[spriteID].callback = SpriteCB_Sparkle_SpiralUpward; + gSprites[spriteId].sAmplitude = 48; + gSprites[spriteId].sTrigIdx = trigIdx; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 31; + gSprites[spriteId].callback = SpriteCB_Sparkle_SpiralUpward; } } @@ -157,85 +171,85 @@ static void SpriteCB_Sparkle_ArcDown(struct Sprite* sprite) { if (sprite->y < 88) { - sprite->y = 8 + (sprite->data[7] * sprite->data[7]) / 5; - sprite->y2 = Sin((u8)(sprite->data[6]), sprite->data[5]) / 4; - sprite->x2 = Cos((u8)(sprite->data[6]), sprite->data[5]); - sprite->data[5] = 8 + Sin((u8)(sprite->data[7] * 4), 40); - sprite->data[7]++; + sprite->y = 8 + (sprite->sTimer * sprite->sTimer) / 5; + sprite->y2 = Sin((u8)sprite->sTrigIdx, sprite->sAmplitude) / 4; + sprite->x2 = Cos((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->sAmplitude = 8 + Sin((u8)(sprite->sTimer * 4), 40); + sprite->sTimer++; } else DestroySprite(sprite); } -static void CreateSparkle_ArcDown(u8 arg0) +static void CreateSparkle_ArcDown(u8 trigIdx) { - u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 8, 0); - if (spriteID != MAX_SPRITES) + u8 spriteId = CreateSprite(&sEvoSparkleSpriteTemplate, DISPLAY_WIDTH / 2, 8, 0); + if (spriteId != MAX_SPRITES) { - gSprites[spriteID].data[5] = 8; - gSprites[spriteID].data[6] = arg0; - gSprites[spriteID].data[7] = 0; - gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteID].oam.matrixNum = 25; - gSprites[spriteID].subpriority = 1; - gSprites[spriteID].callback = SpriteCB_Sparkle_ArcDown; + gSprites[spriteId].sAmplitude = 8; + gSprites[spriteId].sTrigIdx = trigIdx; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 25; + gSprites[spriteId].subpriority = 1; + gSprites[spriteId].callback = SpriteCB_Sparkle_ArcDown; } } static void SpriteCB_Sparkle_CircleInward(struct Sprite* sprite) { - if (sprite->data[5] > 8) + if (sprite->sAmplitude > 8) { - sprite->y2 = Sin((u8)(sprite->data[6]), sprite->data[5]); - sprite->x2 = Cos((u8)(sprite->data[6]), sprite->data[5]); - sprite->data[5] -= sprite->data[3]; - sprite->data[6] += 4; + sprite->y2 = Sin((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->x2 = Cos((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->sAmplitude -= sprite->sSpeed; + sprite->sTrigIdx += 4; } else DestroySprite(sprite); } -static void CreateSparkle_CircleInward(u8 arg0, u8 arg1) +static void CreateSparkle_CircleInward(u8 trigIdx, u8 speed) { - u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); - if (spriteID != MAX_SPRITES) + u8 spriteId = CreateSprite(&sEvoSparkleSpriteTemplate, DISPLAY_WIDTH / 2, 56, 0); + if (spriteId != MAX_SPRITES) { - gSprites[spriteID].data[3] = arg1; - gSprites[spriteID].data[5] = 120; - gSprites[spriteID].data[6] = arg0; - gSprites[spriteID].data[7] = 0; - gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteID].oam.matrixNum = 31; - gSprites[spriteID].subpriority = 1; - gSprites[spriteID].callback = SpriteCB_Sparkle_CircleInward; + gSprites[spriteId].sSpeed = speed; + gSprites[spriteId].sAmplitude = 120; + gSprites[spriteId].sTrigIdx = trigIdx; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 31; + gSprites[spriteId].subpriority = 1; + gSprites[spriteId].callback = SpriteCB_Sparkle_CircleInward; } } static void SpriteCB_Sparkle_Spray(struct Sprite* sprite) { - if (!(sprite->data[7] & 3)) + if (!(sprite->sTimer & 3)) sprite->y++; - if (sprite->data[6] < 128) + if (sprite->sTrigIdx < 128) { u8 matrixNum; - sprite->y2 = -Sin((u8)(sprite->data[6]), sprite->data[5]); - sprite->x = 120 + (sprite->data[3] * sprite->data[7]) / 3; - sprite->data[6]++; - matrixNum = 31 - (sprite->data[6] * 12 / 128); - if (sprite->data[6] > 64) + sprite->y2 = -Sin((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->x = (DISPLAY_WIDTH / 2) + (sprite->sSpeed * sprite->sTimer) / 3; + sprite->sTrigIdx++; + matrixNum = 31 - (sprite->sTrigIdx * 12 / 128); + if (sprite->sTrigIdx > 64) sprite->subpriority = 1; else { sprite->invisible = FALSE; sprite->subpriority = 20; - if (sprite->data[6] > 112 && sprite->data[6] & 1) + if (sprite->sTrigIdx > 112 && sprite->sTrigIdx & 1) sprite->invisible = TRUE; } if (matrixNum < 20) matrixNum = 20; sprite->oam.matrixNum = matrixNum; - sprite->data[7]++; + sprite->sTimer++; } else DestroySprite(sprite); @@ -243,16 +257,16 @@ static void SpriteCB_Sparkle_Spray(struct Sprite* sprite) static void CreateSparkle_Spray(u8 id) { - u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); - if (spriteID != MAX_SPRITES) + u8 spriteId = CreateSprite(&sEvoSparkleSpriteTemplate, DISPLAY_WIDTH / 2, 56, 0); + if (spriteId != MAX_SPRITES) { - gSprites[spriteID].data[3] = 3 - (Random() % 7); - gSprites[spriteID].data[5] = 48 + (Random() & 0x3F); - gSprites[spriteID].data[7] = 0; - gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteID].oam.matrixNum = 31; - gSprites[spriteID].subpriority = 20; - gSprites[spriteID].callback = SpriteCB_Sparkle_Spray; + gSprites[spriteId].sSpeed = 3 - (Random() % 7); + gSprites[spriteId].sAmplitude = 48 + (Random() & 0x3F); + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 31; + gSprites[spriteId].subpriority = 20; + gSprites[spriteId].callback = SpriteCB_Sparkle_Spray; } } @@ -289,7 +303,7 @@ static void Task_Sparkles_SpiralUpward(u8 taskId) { u8 i; for (i = 0; i < 4; i++) - CreateSparkle_SpiralUpward((0x78 & gTasks[taskId].tTimer) * 2 + i * 64); + CreateSparkle_SpiralUpward((gTasks[taskId].tTimer & 120) * 2 + i * 64); } gTasks[taskId].tTimer++; } diff --git a/src/list_menu.c b/src/list_menu.c index ccb183891..8ba13a6cf 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -312,14 +312,14 @@ static void ListMenuDummyTask(u8 taskId) } -s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum) +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 drawMode, u16 tileNum, u16 palNum) { switch (sMysteryGiftLinkMenu.state) { case 0: default: sMysteryGiftLinkMenu.windowId = AddWindow(windowTemplate); - switch (arg2) + switch (drawMode) { case 2: LoadUserWindowBorderGfx(sMysteryGiftLinkMenu.windowId, tileNum, palNum); @@ -346,13 +346,13 @@ s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str } if (sMysteryGiftLinkMenu.state == 2) { - if (arg2 == 0) + if (drawMode == 0) { ClearWindowTilemap(sMysteryGiftLinkMenu.windowId); } else { - switch (arg2) + switch (drawMode) { case 0: // can never be reached, because of the if statement above ClearStdWindowAndFrame(sMysteryGiftLinkMenu.windowId, FALSE); diff --git a/src/menu_helpers.c b/src/menu_helpers.c index e9f3e571f..7decd695c 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -153,7 +153,7 @@ void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *data) gTasks[taskId].func = Task_CallYesOrNoCallback; } -void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo) +void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 unused1, u8 unused2, u8 unused3, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo) { CreateYesNoMenu(template, tileStart, palette, 0); sYesNo = *yesNo; @@ -176,17 +176,18 @@ static void Task_CallYesOrNoCallback(u8 taskId) } } -bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1) +// Returns TRUE if the quantity was changed, FALSE if it remained the same +bool8 AdjustQuantityAccordingToDPadInput(s16 *quantity, u16 max) { - s16 valBefore = (*arg0); + s16 valBefore = *quantity; - if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP) + if (JOY_REPEAT(DPAD_ANY) == DPAD_UP) { - (*arg0)++; - if ((*arg0) > arg1) - (*arg0) = 1; + (*quantity)++; + if (*quantity > max) + *quantity = 1; - if ((*arg0) == valBefore) + if (*quantity == valBefore) { return FALSE; } @@ -196,13 +197,13 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1) return TRUE; } } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN) { - (*arg0)--; - if ((*arg0) <= 0) - (*arg0) = arg1; + (*quantity)--; + if (*quantity <= 0) + *quantity = max; - if ((*arg0) == valBefore) + if (*quantity == valBefore) { return FALSE; } @@ -212,13 +213,13 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1) return TRUE; } } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT) { - (*arg0) += 10; - if ((*arg0) > arg1) - (*arg0) = arg1; + *quantity += 10; + if (*quantity > max) + *quantity = max; - if ((*arg0) == valBefore) + if (*quantity == valBefore) { return FALSE; } @@ -228,13 +229,13 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1) return TRUE; } } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT) { - (*arg0) -= 10; - if ((*arg0) <= 0) - (*arg0) = 1; + *quantity -= 10; + if (*quantity <= 0) + *quantity = 1; - if ((*arg0) == valBefore) + if (*quantity == valBefore) { return FALSE; } diff --git a/src/mystery_gift_client.c b/src/mystery_gift_client.c index adf3ce8a6..9405b133c 100644 --- a/src/mystery_gift_client.c +++ b/src/mystery_gift_client.c @@ -230,7 +230,7 @@ static u32 Client_Run(struct MysteryGiftClient * client) MysteryGift_TrySaveStamp(client->recvBuffer); break; case CLI_SAVE_RAM_SCRIPT: - InitRamScript_NoObjectEvent(client->recvBuffer, 1000); + InitRamScript_NoObjectEvent(client->recvBuffer, sizeof(struct RamScriptData)); break; case CLI_RECV_EREADER_TRAINER: memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, client->recvBuffer, sizeof(gSaveBlock2Ptr->frontier.ereaderTrainer)); diff --git a/src/pokeball.c b/src/pokeball.c index a9ccd42d6..cf7f49b7e 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -438,7 +438,7 @@ static void SpriteCB_BallThrow(struct Sprite *sprite) sprite->y2 = 0; sprite->data[5] = 0; ballId = ItemIdToBallId(GetBattlerPokeballItemId(opponentBattler)); - AnimateBallOpenParticles(sprite->x, sprite->y - 5, 1, 0x1C, ballId); + AnimateBallOpenParticles(sprite->x, sprite->y - 5, 1, 28, ballId); sprite->data[0] = LaunchBallFadeMonTask(FALSE, opponentBattler, 14, ballId); sprite->sBattler = opponentBattler; sprite->data[7] = noOfShakes; @@ -752,7 +752,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) StartSpriteAnim(sprite, 1); ballId = ItemIdToBallId(GetBattlerPokeballItemId(battlerId)); - AnimateBallOpenParticles(sprite->x, sprite->y - 5, 1, 0x1C, ballId); + AnimateBallOpenParticles(sprite->x, sprite->y - 5, 1, 28, ballId); sprite->data[0] = LaunchBallFadeMonTask(TRUE, sprite->sBattler, 14, ballId); sprite->callback = HandleBallAnimEnd; @@ -1000,14 +1000,14 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite) #undef sBattler -static u8 AnimateBallOpenParticlesForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d) +static u8 AnimateBallOpenParticlesForPokeball(u8 x, u8 y, u8 kindOfStars, u8 subpriority) { - return AnimateBallOpenParticles(x, y, kindOfStars, d, BALL_POKE); + return AnimateBallOpenParticles(x, y, kindOfStars, subpriority, BALL_POKE); } -static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 arg2) +static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes) { - return LaunchBallFadeMonTask(unFadeLater, battlerId, arg2, BALL_POKE); + return LaunchBallFadeMonTask(unFadeLater, battlerId, selectedPalettes, BALL_POKE); } // Pokeball in Birch intro, and when receiving via trade @@ -1041,24 +1041,24 @@ static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite) { if (sprite->data[1] == 0) { - u8 r5; - u8 r7 = sprite->data[0]; + u8 subpriority; + u8 spriteId = sprite->data[0]; u8 battlerId = sprite->data[2]; - u32 r4 = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); + u32 selectedPalettes = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); if (sprite->subpriority != 0) - r5 = sprite->subpriority - 1; + subpriority = sprite->subpriority - 1; else - r5 = 0; + subpriority = 0; StartSpriteAnim(sprite, 1); - AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, r5); - sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, r4); + AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, subpriority); + sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, selectedPalettes); sprite->callback = SpriteCB_ReleasedMonFlyOut; - gSprites[r7].invisible = FALSE; - StartSpriteAffineAnim(&gSprites[r7], BATTLER_AFFINE_EMERGE); - AnimateSprite(&gSprites[r7]); - gSprites[r7].data[1] = 0x1000; + gSprites[spriteId].invisible = FALSE; + StartSpriteAffineAnim(&gSprites[spriteId], BATTLER_AFFINE_EMERGE); + AnimateSprite(&gSprites[spriteId]); + gSprites[spriteId].data[1] = 0x1000; sprite->data[7] = 0; } else @@ -1134,19 +1134,19 @@ static void SpriteCB_TradePokeball(struct Sprite *sprite) { if (sprite->data[1] == 0) { - u8 r6; + u8 subpriority; u8 monSpriteId = sprite->data[0]; - u8 r8 = sprite->data[2]; - u32 r5 = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); + u8 battlerId = sprite->data[2]; + u32 selectedPalettes = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); if (sprite->subpriority != 0) - r6 = sprite->subpriority - 1; + subpriority = sprite->subpriority - 1; else - r6 = 0; + subpriority = 0; StartSpriteAnim(sprite, 1); - AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, r6); - sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, r8, r5); + AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, subpriority); + sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, selectedPalettes); sprite->callback = SpriteCB_TradePokeballSendOff; #ifdef BUGFIX // FIX: If this is used on a sprite that has previously had an affine animation, it will not diff --git a/src/pokemon.c b/src/pokemon.c index 61125e362..af5771a6a 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5379,10 +5379,10 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) return offset; } -static void BufferStatRoseMessage(s32 arg0) +static void BufferStatRoseMessage(s32 statIdx) { gBattlerTarget = gBattlerInMenuId; - StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[arg0]]); + StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[statIdx]]); StringCopy(gBattleTextBuff2, gText_StatRose); BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose); } diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index f6aa82391..e00f5dbc8 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -2205,7 +2205,7 @@ static bool32 AreLinkQueuesEmpty(void) return !gRfu.recvQueue.count && !gRfu.sendQueue.count; } -static int GetNumPlayersForBonus(u8 *arg0) +static int GetNumPlayersForBonus(u8 *atJumpPeak) { int i = 0; int flags = 0; @@ -2213,7 +2213,7 @@ static int GetNumPlayersForBonus(u8 *arg0) for (; i < MAX_RFU_PLAYERS; i++) { - if (arg0[i]) + if (atJumpPeak[i]) { flags |= 1 << i; count++; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 8bf12c2bd..e38d46c84 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -8476,11 +8476,11 @@ static void MultiMove_ClearIconFromBg(u8 x, u8 y) } } -static void MultiMove_InitMove(u16 x, u16 y, u16 arg2) +static void MultiMove_InitMove(u16 x, u16 y, u16 moveSteps) { sMultiMove->bgX = x; sMultiMove->bgY = y; - sMultiMove->bgMoveSteps = arg2; + sMultiMove->bgMoveSteps = moveSteps; } static u8 MultiMove_UpdateMove(void) diff --git a/src/pokenav_conditions.c b/src/pokenav_conditions.c index 94ed4e8d8..e0645bac0 100644 --- a/src/pokenav_conditions.c +++ b/src/pokenav_conditions.c @@ -332,7 +332,7 @@ u8 *CopyStringLeftAlignedToConditionData(u8 *dst, const u8 *src, s16 n) return dst; } -static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 arg3) +static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 skipPadding) { u16 boxId, monId, gender, species, level, lvlDigits; struct BoxPokemon *boxMon; @@ -412,7 +412,7 @@ static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 arg3) str_ = ConvertIntToDecimalStringN(str_, level, STR_CONV_MODE_LEFT_ALIGN, 3); lvlDigits = str_ - txtPtr; *(str_++) = CHAR_SPACE; - if (!arg3) + if (!skipPadding) { lvlDigits = 3 - lvlDigits; while (lvlDigits-- != 0) diff --git a/src/rotating_tile_puzzle.c b/src/rotating_tile_puzzle.c index 2e919f550..a95d8624e 100644 --- a/src/rotating_tile_puzzle.c +++ b/src/rotating_tile_puzzle.c @@ -81,14 +81,11 @@ static const u8 sMovement_FaceUp[] = MOVEMENT_ACTION_STEP_END }; -// This file's functions. -static void SaveRotatingTileObject(u8 eventTemplateId, u8 arg1); -static void TurnUnsavedRotatingTileObject(u8 eventTemplateId, u8 arg1); +static void SaveRotatingTileObject(u8, u8); +static void TurnUnsavedRotatingTileObject(u8, u8); -// EWRAM vars EWRAM_DATA static struct RotatingTilePuzzle *sRotatingTilePuzzle = NULL; -// code void InitRotatingTilePuzzle(bool8 isTrickHouse) { if (sRotatingTilePuzzle == NULL) From a8437493c1358f2bb7c95c4187569a12e726e13c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 31 May 2022 15:08:34 -0400 Subject: [PATCH 38/65] Document generic argument names in battle anim palettes --- data/battle_anim_scripts.s | 528 ++++++++++++++++---------------- include/battle_anim.h | 4 +- include/constants/battle_anim.h | 17 + src/battle_anim_effects_1.c | 4 +- src/battle_anim_effects_2.c | 2 +- src/battle_anim_ghost.c | 2 +- src/battle_anim_mons.c | 32 +- src/battle_anim_normal.c | 44 +-- src/battle_anim_throw.c | 2 +- src/battle_anim_utility_funcs.c | 14 +- 10 files changed, 335 insertions(+), 314 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 1cfc5230c..538286e15 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -763,7 +763,7 @@ Move_TAKE_DOWN: setalpha 12, 8 createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -24, 8, 23, 10, 40, 10 delay 35 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 10, RGB_BLACK, 0 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 4, -10, 0, ANIM_TARGET, 0 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET delay 1 @@ -783,14 +783,14 @@ Move_TAKE_DOWN: Move_DOUBLE_EDGE: loadspritegfx ANIM_TAG_IMPACT playsewithpan SE_M_SWIFT, SOUND_PAN_ATTACKER - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 4, 2, RGB_WHITE, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 4, 2, RGB_WHITE, 10, RGB_BLACK, 0 waitforvisualfinish delay 10 playsewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER, 8 createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 18, 6, 2, 4 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 16, 16, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 16, 16, RGB_WHITE createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 20, 0, 0, 4 delay 3 waitforvisualfinish @@ -802,7 +802,7 @@ Move_DOUBLE_EDGE: createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 0 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 4, 0, 12, 1 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 16, 0, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_WHITE waitforvisualfinish createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 0, 1 createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 1 @@ -860,7 +860,7 @@ Move_FIRE_BLAST: call FireBlastRing call FireBlastRing delay 24 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 3, 0, 8, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 0, 8, RGB_BLACK waitforvisualfinish delay 19 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 20, 1 @@ -882,7 +882,7 @@ Move_FIRE_BLAST: delay 3 call FireBlastCross waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 2, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 2, 8, 0, RGB_BLACK waitforvisualfinish end FireBlastRing: @@ -941,17 +941,17 @@ Move_MEGA_PUNCH: loadspritegfx ANIM_TAG_HANDS_AND_FEET monbg ANIM_TARGET delay 2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 0, 16, RGB_BLACK setalpha 12, 8 playsewithpan SE_M_MEGA_KICK, SOUND_PAN_TARGET createsprite gMegaPunchKickSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 50 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 7, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 7, RGB_WHITE delay 50 call SetImpactBackground createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 0 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 22, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 0, RGB_WHITE - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 0, RGB_WHITE + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish clearmonbg ANIM_TARGET @@ -984,18 +984,18 @@ Move_MEGA_KICK: loadspritegfx ANIM_TAG_HANDS_AND_FEET monbg ANIM_TARGET delay 2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 0, 16, RGB_BLACK setalpha 12, 8 playsewithpan SE_M_MEGA_KICK, SOUND_PAN_TARGET createsprite gMegaPunchKickSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 1, 50 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 7, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 7, RGB_WHITE delay 50 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET call SetImpactBackground createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 0 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 22, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 0, RGB_WHITE - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 0, RGB_WHITE + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -1054,21 +1054,21 @@ SonicBoomHit: Move_THUNDER_SHOCK: loadspritegfx ANIM_TAG_SPARK loadspritegfx ANIM_TAG_SPARK_2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 0, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 0, 6, RGB_BLACK waitforvisualfinish delay 10 createvisualtask AnimTask_ElectricBolt, 5, 0, -44, 0 playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_TARGET delay 9 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 0, 13, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 0, 13, RGB_BLACK waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 13, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 13, 0, RGB_BLACK waitforvisualfinish delay 20 call ElectricityEffect waitforvisualfinish delay 20 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 0, RGB_BLACK waitforvisualfinish end @@ -1076,7 +1076,7 @@ Move_THUNDERBOLT: loadspritegfx ANIM_TAG_SPARK loadspritegfx ANIM_TAG_SHOCK_3 loadspritegfx ANIM_TAG_SPARK_2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 0, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 0, 6, RGB_BLACK waitforvisualfinish delay 10 createvisualtask AnimTask_ElectricBolt, 5, 24, -52, 0 @@ -1088,9 +1088,9 @@ Move_THUNDERBOLT: createvisualtask AnimTask_ElectricBolt, 5, 0, -60, 1 playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_TARGET delay 9 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 0, 13, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 0, 13, RGB_BLACK waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 13, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 13, 0, RGB_BLACK waitforvisualfinish delay 20 createsprite gThunderboltOrbSpriteTemplate, ANIM_TARGET, 3, 44, 0, 0, 3 @@ -1104,20 +1104,20 @@ Move_THUNDERBOLT: createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 4, 0, 0, 16, 44, 224, 40, 2, -32765 playsewithpan SE_M_HYPER_BEAM, SOUND_PAN_TARGET delay 0 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 2, 2, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 2, 2, RGB_BLACK delay 6 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 6, RGB_BLACK delay 6 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 2, 2, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 2, 2, RGB_BLACK delay 6 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 6, RGB_BLACK waitforvisualfinish delay 20 waitplaysewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET, 19 call ElectricityEffect waitforvisualfinish delay 20 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 0, RGB_BLACK waitforvisualfinish end @@ -1125,7 +1125,7 @@ Move_THUNDER_WAVE: loadspritegfx ANIM_TAG_SPARK loadspritegfx ANIM_TAG_SPARK_2 loadspritegfx ANIM_TAG_SPARK_H - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 0, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 0, 6, RGB_BLACK waitforvisualfinish delay 10 createvisualtask AnimTask_ElectricBolt, 5, 0, -48, 0 @@ -1138,7 +1138,7 @@ Move_THUNDER_WAVE: delay 4 createsprite gThunderWaveSpriteTemplate, ANIM_TARGET, 2, -16, 16 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 0, RGB_BLACK waitforvisualfinish end @@ -1247,10 +1247,10 @@ Move_REVERSAL: loadspritegfx ANIM_TAG_HANDS_AND_FEET loadspritegfx ANIM_TAG_IMPACT playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 3, RGB_WHITE, 8, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 3, RGB_WHITE, 8, RGB_BLACK, 0 waitforvisualfinish delay 30 - createvisualtask AnimTask_BlendColorCycle, 2, 31, 3, 2, 0, 10, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 2, 0, 10, RGB_WHITE delay 10 playsewithpan SE_M_REVERSAL, SOUND_PAN_ATTACKER createsprite gReversalOrbSpriteTemplate, ANIM_ATTACKER, 2, 26, 0 @@ -1264,7 +1264,7 @@ Move_REVERSAL: createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 6, 4 delay 8 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_WHITE, 8, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_WHITE, 8, RGB_BLACK, 0 createsprite gFistFootSpriteTemplate, ANIM_TARGET, 4, 0, 0, 10, 1, 0 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0, 0, ANIM_TARGET, 1 createvisualtask AnimTask_ShakeTargetBasedOnMovePowerOrDmg, 5, FALSE, 1, 8, 1, 0 @@ -1348,7 +1348,7 @@ Move_PSYCH_UP: delay 4 playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER createvisualtask AnimTask_ScaleMonAndRestore, 5, -5, -5, 10, ANIM_ATTACKER, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 9, 2, 2, 10, 0, RGB_YELLOW + createvisualtask AnimTask_BlendBattleAnimPal, 9, F_PAL_ATTACKER, 2, 10, 0, RGB_YELLOW delay 30 clearmonbg ANIM_ATK_PARTNER blendoff @@ -1446,18 +1446,18 @@ FuryCutterRight: createsprite gCuttingSliceSpriteTemplate, ANIM_ATTACKER, 2, 40, -32, 1 goto FuryCutterContinue FuryCutterMedium: - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB(9, 8, 10), 4, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB(9, 8, 10), 4, RGB_BLACK, 0 goto FuryCutterContinue2 FuryCutterStrong: - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 3, RGB(9, 8, 10), 4, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 3, RGB(9, 8, 10), 4, RGB_BLACK, 0 goto FuryCutterContinue2 FuryCutterStrongest: - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 3, RGB(9, 8, 10), 4, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 3, RGB(9, 8, 10), 4, RGB_BLACK, 0 goto FuryCutterContinue2 Move_SELF_DESTRUCT: loadspritegfx ANIM_TAG_EXPLOSION - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 0, 9, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 0, 9, RGB_RED createvisualtask AnimTask_ShakeMon2, 5, 4, 6, 0, 38, 1 createvisualtask AnimTask_ShakeMon2, 5, 5, 6, 0, 38, 1 createvisualtask AnimTask_ShakeMon2, 5, 6, 6, 0, 38, 1 @@ -1466,7 +1466,7 @@ Move_SELF_DESTRUCT: call SelfDestructExplode call SelfDestructExplode waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 9, 0, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 9, 0, RGB_RED end SelfDestructExplode: playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_ATTACKER @@ -1623,7 +1623,7 @@ RisingWaterHitEffect: Move_EXPLOSION: loadspritegfx ANIM_TAG_EXPLOSION - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 8, 9, RGB(26, 8, 8), 8, RGB_BLACK, 8 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 8, 9, RGB(26, 8, 8), 8, RGB_BLACK, 8 createvisualtask AnimTask_ShakeMon2, 5, 4, 8, 0, 40, 1 createvisualtask AnimTask_ShakeMon2, 5, 5, 8, 0, 40, 1 createvisualtask AnimTask_ShakeMon2, 5, 6, 8, 0, 40, 1 @@ -1632,9 +1632,9 @@ Move_EXPLOSION: call Explosion1 call Explosion1 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 1, 16, 16, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 1, 16, 16, RGB_WHITE delay 50 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 3, 16, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 16, 0, RGB_WHITE end Explosion1: playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER @@ -1678,16 +1678,16 @@ Move_PROTECT: Move_DETECT: loadspritegfx ANIM_TAG_SPARKLE_4 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 9, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 9, RGB_BLACK waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 0, 9, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 0, 9, RGB_WHITE delay 18 playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER createsprite gSpinningSparkleSpriteTemplate, ANIM_ATTACKER, 13, 20, -20 waitforvisualfinish delay 10 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 9, 0, RGB_BLACK - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 2, 9, 0, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 9, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 2, 9, 0, RGB_WHITE waitforvisualfinish end @@ -1709,7 +1709,7 @@ Frustration_Continue: Frustration_Strongest: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_ShakeMon2, 5, ANIM_ATTACKER, 1, 0, 15, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 3, 0, 9, 31 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 3, 0, 9, RGB_RED waitforvisualfinish delay 20 playsewithpan SE_M_SWAGGER2, SOUND_PAN_ATTACKER @@ -1740,12 +1740,12 @@ Frustration_Strongest: createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 18, -18, ANIM_TARGET, 0 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 3, 9, 0, 31 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 3, 9, 0, RGB_RED goto Frustration_Continue Frustration_Strong: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_ShakeMon2, 5, ANIM_ATTACKER, 1, 0, 15, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 3, 0, 9, 31 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 3, 0, 9, RGB_RED waitforvisualfinish delay 20 playsewithpan SE_M_SWAGGER2, SOUND_PAN_ATTACKER @@ -1766,7 +1766,7 @@ Frustration_Strong: createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, -12, -6, ANIM_TARGET, 1 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 4, 0, 6, 1 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 3, 9, 0, 31 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 3, 9, 0, RGB_RED goto Frustration_Continue Frustration_Medium: playsewithpan SE_M_SWAGGER2, SOUND_PAN_ATTACKER @@ -1808,7 +1808,7 @@ Move_SAFEGUARD: createsprite gGuardRingSpriteTemplate, ANIM_ATTACKER, 2 waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 10, 0, 2, 0, 10, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATK_SIDE, 0, 2, 0, 10, RGB_WHITE waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff @@ -1864,13 +1864,13 @@ Move_GUILLOTINE: playsewithpan SE_M_VICEGRIP, SOUND_PAN_TARGET createsprite gGuillotineSpriteTemplate, ANIM_ATTACKER, 2, 0 createsprite gGuillotineSpriteTemplate, ANIM_ATTACKER, 2, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 16, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 16, RGB_BLACK delay 9 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 23, 1 delay 46 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 4, 0, 8, 1 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 0 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET waitforvisualfinish clearmonbg ANIM_DEF_PARTNER @@ -1900,7 +1900,7 @@ Move_PAY_DAY: Move_OUTRAGE: loadspritegfx ANIM_TAG_SMALL_EMBER loopsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER, 8, 3 - createvisualtask AnimTask_BlendColorCycle, 2, 7, 2, 5, 3, 8, RGB(14, 13, 0) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER | F_PAL_TARGET, 2, 5, 3, 8, RGB(14, 13, 0) createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 12, 6, 5, 4 delay 0 createsprite gOutrageFlameSpriteTemplate, ANIM_TARGET, 2, 0, 0, 30, 1280, 0, 3 @@ -1946,25 +1946,25 @@ Move_SPARK: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_SPARK_2 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 5, 5, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 5, 5, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 32, 24, 190, 12, ANIM_ATTACKER, 1, 0 delay 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 80, 24, 22, 12, ANIM_ATTACKER, 1, 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 156, 24, 121, 13, ANIM_ATTACKER, 1, 1 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 0, 0, RGB(31, 31, 22) delay 10 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 5, 5, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 5, 5, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 100, 24, 60, 10, ANIM_ATTACKER, 1, 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 170, 24, 42, 11, ANIM_ATTACKER, 1, 1 delay 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 238, 24, 165, 10, ANIM_ATTACKER, 1, 1 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 0, 0, RGB(31, 31, 22) delay 20 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 7, 7, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 7, 7, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 32, 12, 0, 20, 0, 0 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 32, 12, 64, 20, 1, 0 @@ -1976,14 +1976,14 @@ Move_SPARK: createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 16, 12, 224, 20, 2, 0 delay 4 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 0, 0, RGB(31, 31, 22) createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 4 delay 4 playsewithpan SE_M_HYPER_BEAM, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0, 0, ANIM_TARGET, 2 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 4, -31, 2, 0, 6, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, -31, 2, 0, 6, RGB(31, 31, 22) call ElectricityEffect waitforvisualfinish end @@ -2014,7 +2014,7 @@ Move_ATTRACT: createsprite gRedHeartRisingSpriteTemplate, ANIM_ATTACKER, 40, 112, 256, 90 createsprite gRedHeartRisingSpriteTemplate, ANIM_ATTACKER, 40, 200, 272, 90 delay 75 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 4, 4, 0, 10, RGB(31, 25, 27) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 4, 4, 0, 10, RGB(31, 25, 27) end Move_GROWTH: @@ -2024,7 +2024,7 @@ Move_GROWTH: waitforvisualfinish end GrowthEffect: - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB_WHITE playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER createvisualtask AnimTask_ScaleMonAndRestore, 5, -3, -3, 16, ANIM_ATTACKER, 0 return @@ -2084,12 +2084,12 @@ Move_MEAN_LOOK: loadspritegfx ANIM_TAG_EYE monbg ANIM_DEF_PARTNER playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 16, RGB_BLACK loopsewithpan SE_M_CONFUSE_RAY, SOUND_PAN_TARGET, 15, 4 waitplaysewithpan SE_M_LEER, SOUND_PAN_TARGET, 85 createsprite gMeanLookEyeSpriteTemplate, ANIM_ATTACKER, 2 delay 120 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_BLACK delay 30 clearmonbg ANIM_DEF_PARTNER waitforvisualfinish @@ -2229,7 +2229,7 @@ Move_ICY_WIND: loadspritegfx ANIM_TAG_ICE_CRYSTALS loadspritegfx ANIM_TAG_ICE_SPIKES monbg ANIM_DEF_PARTNER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 11, 4, 0, 4, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_ATK_SIDE, 4, 0, 4, RGB_BLACK fadetobg BG_ICE waitbgfadeout playsewithpan SE_M_ICY_WIND, 0 @@ -2246,7 +2246,7 @@ Move_ICY_WIND: clearmonbg ANIM_DEF_PARTNER restorebg waitbgfadeout - createvisualtask AnimTask_BlendBattleAnimPal, 10, 11, 4, 4, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_ATK_SIDE, 4, 4, 0, RGB_BLACK waitbgfadein end IcyWindSwirlingSnowballs: @@ -2601,9 +2601,9 @@ Move_EARTHQUAKE: createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 50 playsewithpan SE_M_EARTHQUAKE, 0 delay 10 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 delay 16 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 end Move_FISSURE: @@ -2614,11 +2614,11 @@ Move_FISSURE: delay 8 call FissureDirtPlumeFar delay 15 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 delay 15 call FissureDirtPlumeClose delay 15 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 delay 15 call FissureDirtPlumeFar delay 50 @@ -2846,7 +2846,7 @@ SkullBashAttack: playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER waitforvisualfinish playse SE_BANG - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 2, 0, 40, 1 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 10, 0, 40, 1 createsprite gFlashingHitSplatSpriteTemplate, ANIM_TARGET, 4, 0, 0, ANIM_TARGET, 0 @@ -2892,7 +2892,7 @@ Move_GLARE: createvisualtask AnimTask_GlareEyeDots, 5, 0 playsewithpan SE_M_PSYBEAM2, SOUND_PAN_ATTACKER waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 5, 1, 0, 0, 16, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_BG, 0, 0, 16, RGB_BLACK waitforvisualfinish createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, -16, -8 createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, 16, -8 @@ -2901,7 +2901,7 @@ Move_GLARE: delay 2 createvisualtask AnimTask_ShakeTargetInPattern, 3, 20, 1, FALSE waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 5, 1, 0, 16, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_BG, 0, 16, 0, RGB_BLACK end Move_BARRAGE: @@ -2926,17 +2926,17 @@ SkyAttackSetUp: jumpretfalse SkyAttackSetUpAgainstOpponent goto SkyAttackSetUpAgainstPartner SkyAttackSetUpAgainstOpponent: - createvisualtask AnimTask_BlendBattleAnimPal, 10, 27, 1, 0, 12, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_ATK_SIDE | F_PAL_DEF_PARTNER, 1, 0, 12, RGB_BLACK waitforvisualfinish delay 12 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 8, 0, RGB_BLACK createvisualtask AnimTask_HorizontalShake, 5, ANIM_ATTACKER, 2, 16 loopsewithpan SE_M_STAT_INCREASE, SOUND_PAN_ATTACKER, 4, 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 0, 15, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 0, 15, RGB_WHITE delay 20 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 15, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 15, 0, RGB_WHITE waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 25, 1, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_ATK_PARTNER | F_PAL_DEF_PARTNER, 1, 8, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -2945,13 +2945,13 @@ SkyAttackSetUpAgainstPartner: createvisualtask AnimTask_BlendBattleAnimPalExclude, 10, ANIM_TARGET, 1, 0, 12, RGB_BLACK waitforvisualfinish delay 12 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 8, 0, RGB_BLACK createvisualtask AnimTask_HorizontalShake, 5, ANIM_ATTACKER, 2, 16 playsewithpan SE_M_STAT_INCREASE, SOUND_PAN_ATTACKER delay 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 0, 15, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 0, 15, RGB_WHITE delay 20 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 15, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 15, 0, RGB_WHITE waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPalExclude, 10, 4, 1, 8, 0, RGB_BLACK waitforvisualfinish @@ -2963,7 +2963,7 @@ SkyAttackUnleash: loadspritegfx ANIM_TAG_BIRD call SetSkyBg monbg ANIM_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 0, 0, 16, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 0, 0, 16, RGB_WHITE delay 4 createvisualtask AnimTask_AttackerFadeToInvisible, 5, 0 waitforvisualfinish @@ -2975,7 +2975,7 @@ SkyAttackUnleash: delay 20 createvisualtask AnimTask_AttackerFadeFromInvisible, 5, 1 delay 2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 0, 15, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 0, 15, 0, RGB_WHITE waitforvisualfinish clearmonbg ANIM_ATTACKER call UnsetSkyBg @@ -3025,7 +3025,7 @@ Move_SUPER_FANG: createsprite gSuperFangSpriteTemplate, ANIM_TARGET, 2 playsewithpan SE_M_BITE, SOUND_PAN_TARGET delay 8 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB(31, 2, 2), 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB(31, 2, 2), 14, RGB_WHITE, 14 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 7, 12, 1 waitforvisualfinish blendoff @@ -3113,7 +3113,7 @@ Move_SPITE: playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER waitbgfadein monbg ANIM_DEF_PARTNER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 6, 0, 8, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 6, 0, 8, RGB_WHITE createvisualtask AnimTask_SpiteTargetShadow, 2 loopsewithpan SE_M_PSYBEAM, SOUND_PAN_TARGET, 20, 3 waitforvisualfinish @@ -3198,7 +3198,7 @@ Move_ENDURE: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect delay 8 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect delay 8 @@ -3332,9 +3332,9 @@ MagnitudeIntense: createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 0, 50 loopsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET, 8, 10 delay 10 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 delay 16 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 goto MagnitudeEnd Move_RAPID_SPIN: @@ -3361,7 +3361,7 @@ Move_MOONLIGHT: loadspritegfx ANIM_TAG_GREEN_SPARKLE loadspritegfx ANIM_TAG_BLUE_STAR setalpha 0, 16 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 16, RGB_BLACK waitforvisualfinish createsprite gMoonSpriteTemplate, ANIM_ATTACKER, 2, 120, 56 createvisualtask AnimTask_AlphaFadeIn, 3, 0, 16, 16, 0, 1 @@ -3484,12 +3484,12 @@ Move_HEAT_WAVE: Move_HAIL: loadspritegfx ANIM_TAG_HAIL loadspritegfx ANIM_TAG_ICE_CRYSTALS - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 3, 0, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 0, 6, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_Hail, 5 loopsewithpan SE_M_HAIL, 0, 8, 10 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 3, 6, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 6, 0, RGB_BLACK end Move_TORMENT: @@ -3567,7 +3567,7 @@ Move_CHARGE: loadspritegfx ANIM_TAG_ELECTRICITY monbg ANIM_ATTACKER setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 4, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 60, 2, 12 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER @@ -3591,7 +3591,7 @@ Move_CHARGE: createsprite gElectricPuffSpriteTemplate, ANIM_ATTACKER, 2, 0, -16, -16 playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 4, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 4, 0, RGB_BLACK clearmonbg ANIM_ATTACKER blendoff end @@ -3721,13 +3721,13 @@ BrickBreakNormal: playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET delay 20 createvisualtask AnimTask_WindUpLunge, 2, ANIM_ATTACKER, -24, 0, 24, 10, 24, 3 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 6, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 6, RGB_BLACK delay 37 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 1 createsprite gFistFootSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 10, 1, 0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 6, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 6, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET end @@ -3747,7 +3747,7 @@ BrickBreakShatteredWall: playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET delay 20 createvisualtask AnimTask_WindUpLunge, 2, ANIM_ATTACKER, -24, 0, 24, 10, 24, 3 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 6, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 6, RGB_BLACK delay 37 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 1 createsprite gFistFootSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 10, 1, 0 @@ -3759,7 +3759,7 @@ BrickBreakShatteredWall: createsprite gBrickBreakWallShardSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 3, 8, 12 playsewithpan SE_M_BRICK_BREAK, SOUND_PAN_TARGET waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 6, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 6, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET end @@ -3798,7 +3798,7 @@ Move_ENDEAVOR: Move_ERUPTION: loadspritegfx ANIM_TAG_WARM_ROCK - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 2, 0, 4, RGB_RED + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 2, 0, 4, RGB_RED waitforvisualfinish createvisualtask AnimTask_EruptionLaunchRocks, 2 waitplaysewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER, 60 @@ -3818,7 +3818,7 @@ Move_ERUPTION: createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 8, 60 loopsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET, 16, 12 delay 80 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 40, 31, 4, 4, 0, RGB_RED + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 40, F_PAL_BG | F_PAL_BATTLERS, 4, 4, 0, RGB_RED end Move_SKILL_SWAP: @@ -3873,13 +3873,13 @@ Move_CAMOUFLAGE: monbg ANIM_ATK_PARTNER splitbgprio ANIM_ATTACKER setalpha 16, 0 - createvisualtask AnimTask_SetCamouflageBlend, 5, 2, 3, 0, 14 + createvisualtask AnimTask_SetCamouflageBlend, 5, F_PAL_ATTACKER, 3, 0, 14 delay 16 createvisualtask AnimTask_AttackerFadeToInvisible, 2, 4 playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER waitforvisualfinish delay 8 - createvisualtask AnimTask_SetCamouflageBlend, 5, 2, 0, 0, 0 + createvisualtask AnimTask_SetCamouflageBlend, 5, F_PAL_ATTACKER, 0, 0, 0 waitforvisualfinish createvisualtask AnimTask_AttackerFadeFromInvisible, 2, 1 waitforvisualfinish @@ -3891,13 +3891,13 @@ Move_TAIL_GLOW: loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT monbg ANIM_ATTACKER setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 4, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 4, RGB_BLACK waitforvisualfinish createsprite gTailGlowOrbSpriteTemplate, ANIM_ATTACKER, 66, ANIM_ATTACKER delay 18 loopsewithpan SE_M_MORNING_SUN, SOUND_PAN_ATTACKER, 16, 6 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 4, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 4, 0, RGB_BLACK clearmonbg ANIM_ATTACKER blendoff delay 1 @@ -3955,15 +3955,15 @@ Move_MIST_BALL: waitforvisualfinish playsewithpan SE_M_SAND_ATTACK, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 10, 0 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 1, 1, RGB(23, 16, 31), 16, RGB_WHITE, 16 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 1, 1, RGB(23, 16, 31), 16, RGB_WHITE, 16 delay 0 playsewithpan SE_M_HAZE, 0 createvisualtask AnimTask_LoadMistTiles, 5 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 3, 0, 16, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 3, 0, 16, RGB_WHITE delay 8 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 4, 0, 70, 0 delay 70 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 16, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 16, 0, RGB_WHITE end Move_FEATHER_DANCE: @@ -4133,7 +4133,7 @@ Move_AROMATHERAPY: loadspritegfx ANIM_TAG_FLOWER loadspritegfx ANIM_TAG_THIN_RING loadspritegfx ANIM_TAG_SPARKLE_2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 0, 0, 7, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 0, 0, 7, RGB(13, 31, 12) delay 1 monbg ANIM_ATTACKER delay 1 @@ -4151,7 +4151,7 @@ Move_AROMATHERAPY: waitforvisualfinish clearmonbg ANIM_ATTACKER delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 0, 7, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 0, 7, 0, RGB(13, 31, 12) delay 1 playsewithpan SE_M_STAT_INCREASE, SOUND_PAN_ATTACKER createvisualtask AnimTask_StatusClearedEffect, 2, 1 @@ -4162,7 +4162,7 @@ Move_AROMATHERAPY: createsprite gSparklingStarsSpriteTemplate, ANIM_ATTACKER, 16, 12, -5, 0, 0, 32, 60, 1 waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 43, 3, 10, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG | F_PAL_ATK_SIDE | F_PAL_ANIM_1, 3, 10, 0, RGB(13, 31, 12) createsprite gBlendThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 16, 0, 0, 0, 1 waitforvisualfinish end @@ -4223,13 +4223,13 @@ Move_ODOR_SLEUTH: waitforvisualfinish clearmonbg ANIM_TARGET delay 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_WHITEALPHA, 16, RGB_WHITEALPHA, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_WHITEALPHA, 16, RGB_WHITEALPHA, 0 playsewithpan SE_M_LEER, SOUND_PAN_ATTACKER end Move_GRASS_WHISTLE: loadspritegfx ANIM_TAG_MUSIC_NOTES - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 4, RGB(18, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 4, RGB(18, 31, 12) waitforvisualfinish createvisualtask AnimTask_MusicNotesRainbowBlend, 2 waitforvisualfinish @@ -4260,19 +4260,19 @@ Move_GRASS_WHISTLE: delay 4 waitforvisualfinish createvisualtask AnimTask_MusicNotesClearRainbowBlend, 2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 4, 0, RGB(18, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 4, 0, RGB(18, 31, 12) waitforvisualfinish end Move_TICKLE: loadspritegfx ANIM_TAG_EYE_SPARKLE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 0, 0, 16, RGB_BLACK waitforvisualfinish createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, -16, -8 createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, 16, -8 playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 0, 16, 0, RGB_BLACK waitforvisualfinish delay 20 createvisualtask AnimTask_SwayMon, 3, 0, 6, 1280, 3, ANIM_ATTACKER @@ -4351,7 +4351,7 @@ Move_AERIAL_ACE: playsewithpan SE_M_RAZOR_WIND2, SOUND_PAN_ATTACKER delay 5 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 10, 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 10, RGB_BLACK, 0 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET waitforvisualfinish clearmonbg ANIM_TARGET @@ -4361,7 +4361,7 @@ Move_AERIAL_ACE: Move_IRON_DEFENSE: loopsewithpan SE_SHINY, SOUND_PAN_ATTACKER, 28, 2 createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 8, 2, RGB_WHITEALPHA, 14, RGB_WHITEALPHA, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 8, 2, RGB_WHITEALPHA, 14, RGB_WHITEALPHA, 0 waitforvisualfinish end @@ -4414,7 +4414,7 @@ Move_VOLT_TACKLE: loadspritegfx ANIM_TAG_ELECTRICITY monbg ANIM_ATTACKER setalpha 12, 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 0, 8, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 0, 8, RGB_BLACK waitforvisualfinish createsprite gVoltTackleOrbSlideSpriteTemplate, ANIM_ATTACKER, 1 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER @@ -4451,7 +4451,7 @@ Move_VOLT_TACKLE: delay 2 createsprite gElectricPuffSpriteTemplate, ANIM_ATTACKER, 2, 0, -16, -16 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 8, 0, RGB_BLACK waitforvisualfinish end @@ -4547,7 +4547,7 @@ Move_SHOCK_WAVE: loadspritegfx ANIM_TAG_LIGHTNING monbg ANIM_ATTACKER setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 4, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 20, 0, 2 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER @@ -4561,10 +4561,10 @@ Move_SHOCK_WAVE: playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET waitforvisualfinish createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 6, 18, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 5, 1, 3, 16, 0, RGB_WHITE - createvisualtask AnimTask_BlendBattleAnimPal, 5, 4, 0, 16, 16, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_BG, 3, 16, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_TARGET, 0, 16, 16, RGB_BLACK delay 4 - createvisualtask AnimTask_BlendBattleAnimPal, 5, 4, 0, 0, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_TARGET, 0, 0, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_ATTACKER blendoff @@ -4629,7 +4629,7 @@ Move_MIND_READER: createsprite gWhiteHaloSpriteTemplate, ANIM_ATTACKER, 5 delay 40 playsewithpan SE_M_LEER, SOUND_PAN_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 1, 1, 2, 0, 10, RGB_BLACK + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG, 1, 2, 0, 10, RGB_BLACK call MindReaderEyeSpikeEffect waitforvisualfinish clearmonbg ANIM_DEF_PARTNER @@ -4665,8 +4665,8 @@ Move_ICE_PUNCH: loadspritegfx ANIM_TAG_ICE_CRYSTALS loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_HANDS_AND_FEET - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 9, RGB(12, 26, 31) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 7, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 9, RGB(12, 26, 31) delay 20 playsewithpan SE_M_STRING_SHOT, SOUND_PAN_TARGET createsprite gIceCrystalSpiralInwardSmall, ANIM_ATTACKER, 2, 0 @@ -4688,9 +4688,9 @@ Move_ICE_PUNCH: delay 15 call IceCrystalEffectShort delay 5 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 9, 0, RGB(12, 26, 31) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 9, 0, RGB(12, 26, 31) waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 7, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -4712,7 +4712,7 @@ Move_CONFUSION: call SetPsychicBackground setalpha 8, 8 createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 10, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB_WHITE waitforvisualfinish playsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 15, 1 @@ -4729,7 +4729,7 @@ Move_PSYCHIC: call SetPsychicBackground setalpha 8, 8 createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 10, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, RGB(31, 23, 0) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB(31, 23, 0) waitforvisualfinish loopsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET, 10, 3 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 15, 1 @@ -4754,7 +4754,7 @@ FutureSight: call SetPsychicBackground setalpha 8, 8 playsewithpan SE_M_SUPERSONIC, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB_WHITE createvisualtask AnimTask_ScaleMonAndRestore, 5, -4, -4, 15, ANIM_ATTACKER, 1 waitforvisualfinish clearmonbg ANIM_ATK_PARTNER @@ -4767,7 +4767,7 @@ Move_THUNDER: waitbgfadeout createvisualtask AnimTask_StartSlidingBg, 5, -256, 0, 1, -1 waitbgfadein - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 16, RGB_BLACK delay 16 createvisualtask AnimTask_InvertScreenColor, 2, 257, 257, 257 playsewithpan SE_M_THUNDER_WAVE, SOUND_PAN_TARGET @@ -4811,7 +4811,7 @@ Move_THUNDER: delay 2 createvisualtask AnimTask_InvertScreenColor, 2, 257, 257, 257 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_TARGET, 2, 1, 2, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_TARGET, 2, F_PAL_BG, 2, 16, 0, RGB_BLACK waitforvisualfinish restorebg waitbgfadeout @@ -4825,7 +4825,7 @@ Move_THUNDER_PUNCH: loadspritegfx ANIM_TAG_LIGHTNING monbg ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 16, RGB_BLACK waitforvisualfinish playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET createsprite gFistFootSpriteTemplate, ANIM_TARGET, 4, 0, 0, 8, 1, 0 @@ -4845,7 +4845,7 @@ Move_THUNDER_PUNCH: createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 2 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_BLACK delay 20 waitforvisualfinish clearmonbg ANIM_TARGET @@ -4931,7 +4931,7 @@ Move_DRAGON_BREATH: delay 2 createsprite gDragonBreathFireSpriteTemplate, ANIM_TARGET, 2, 0, 0, 0, 0, 20 delay 2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 1, 0, 9, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 1, 0, 9, RGB_RED createsprite gDragonBreathFireSpriteTemplate, ANIM_TARGET, 2, 0, 0, 0, 0, 20 delay 2 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 21, 1 @@ -4951,7 +4951,7 @@ Move_DRAGON_BREATH: delay 2 createsprite gDragonBreathFireSpriteTemplate, ANIM_TARGET, 2, 0, 0, 0, 0, 20 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 1, 9, 0, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 1, 9, 0, RGB_RED waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -5135,7 +5135,7 @@ Move_SMOG: call SmogCloud delay 120 loopsewithpan SE_M_TOXIC, SOUND_PAN_TARGET, 18, 2 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(26, 0, 26) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(26, 0, 26) delay 10 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 15, 1 waitforvisualfinish @@ -5269,14 +5269,14 @@ Move_DRAGON_RAGE: Move_RAIN_DANCE: loadspritegfx ANIM_TAG_RAIN_DROPS playsewithpan SE_M_RAIN_DANCE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 2, 0, 4, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_CreateRaindrops, 2, 0, 3, 120 createvisualtask AnimTask_CreateRaindrops, 2, 0, 3, 120 delay 120 delay 30 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 2, 4, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 2, 4, 0, RGB_BLACK waitforvisualfinish end @@ -5347,7 +5347,7 @@ Move_ICE_BEAM: splitbgprio ANIM_TARGET setalpha 12, 8 loadspritegfx ANIM_TAG_ICE_CRYSTALS - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 7, RGB_BLACK waitforvisualfinish createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_BUBBLE_BEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 4, 4, 0, 10 createsprite gIceBeamOuterCrystalSpriteTemplate, ANIM_ATTACKER, 2, 20, 12, 0, 12, 20 @@ -5356,7 +5356,7 @@ Move_ICE_BEAM: call IceBeamCreateCrystals call IceBeamCreateCrystals call IceBeamCreateCrystals - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 4, -31, 0, 7, RGB(0, 20, 31) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_TARGET, -31, 0, 7, RGB(0, 20, 31) createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 25, 1 call IceBeamCreateCrystals call IceBeamCreateCrystals @@ -5372,9 +5372,9 @@ Move_ICE_BEAM: waitforvisualfinish delay 20 call IceCrystalEffectShort - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 4, 5, 7, 0, RGB(0, 20, 31) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_TARGET, 5, 7, 0, RGB(0, 20, 31) waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 7, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -5437,7 +5437,7 @@ SolarBeamEnd: SolarBeamSetUp: monbg ANIM_ATK_PARTNER setalpha 12, 8 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 1, 4, 0, 11, RGB(31, 31, 11) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 1, 4, 0, 11, RGB(31, 31, 11) playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call SolarBeamAbsorbEffect waitforvisualfinish @@ -5482,7 +5482,7 @@ SolarBeamUnleash: delay 4 createsprite gSolarBeamBigOrbSpriteTemplate, ANIM_TARGET, 3, 15, 0, 20, 1 delay 4 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 1, 0, 10, RGB(25, 31, 0) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 1, 0, 10, RGB(25, 31, 0) createsprite gSolarBeamBigOrbSpriteTemplate, ANIM_TARGET, 3, 15, 0, 20, 2 delay 4 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 65, 1 @@ -5497,7 +5497,7 @@ SolarBeamUnleash: call SolarBeamUnleash1 call SolarBeamUnleash1 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 1, 10, 0, RGB(25, 31, 0) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 1, 10, 0, RGB(25, 31, 0) call UnsetSolarBeamBg goto SolarBeamEnd SolarBeamUnleash1: @@ -5572,7 +5572,7 @@ BlizzardAgainstPlayer: Move_POWDER_SNOW: loadspritegfx ANIM_TAG_ICE_CRYSTALS monbg ANIM_DEF_PARTNER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 1, 0, 3, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 1, 0, 3, RGB_BLACK waitforvisualfinish panse SE_M_GUST, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 call PowderSnowSnowballs @@ -5584,7 +5584,7 @@ Move_POWDER_SNOW: waitforvisualfinish clearmonbg ANIM_DEF_PARTNER delay 20 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 1, 3, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 1, 3, 0, RGB_BLACK end PowderSnowSnowballs: createsprite gPowderSnowSnowballSpriteTemplate, ANIM_ATTACKER, 40, 0, 0, 0, 0, 56, 4, 4, 1 @@ -5665,7 +5665,7 @@ Move_SIGNAL_BEAM: call SignalBeamOrbs call SignalBeamOrbs createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 25, 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 4, 8, 5, RGB_RED, 8, RGB(1, 30, 0), 8 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_TARGET, 8, 5, RGB_RED, 8, RGB(1, 30, 0), 8 call SignalBeamOrbs call SignalBeamOrbs call SignalBeamOrbs @@ -5698,7 +5698,7 @@ Move_ABSORB: monbg ANIM_DEF_PARTNER splitbgprio_foes ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 4, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 4, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_M_ABSORB, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 2 @@ -5711,7 +5711,7 @@ Move_ABSORB: delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 4, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 4, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5751,7 +5751,7 @@ Move_MEGA_DRAIN: monbg ANIM_DEF_PARTNER splitbgprio_foes ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 8, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 8, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_M_ABSORB, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 1 @@ -5764,7 +5764,7 @@ Move_MEGA_DRAIN: delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 8, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 8, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5812,7 +5812,7 @@ Move_GIGA_DRAIN: monbg ANIM_DEF_PARTNER splitbgprio_foes ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 12, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 12, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_M_ABSORB, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 0 @@ -5825,7 +5825,7 @@ Move_GIGA_DRAIN: delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 12, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 12, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5891,14 +5891,14 @@ Move_LEECH_LIFE: delay 2 createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 5, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 7, RGB_BLACK waitforvisualfinish call AbsorbEffect waitforvisualfinish delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 7, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5906,7 +5906,7 @@ Move_LEECH_LIFE: Move_SYNTHESIS: loadspritegfx ANIM_TAG_SPARKLE_2 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 16, RGB(27, 31, 18) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 16, RGB(27, 31, 18) playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call GrantingStarsEffect waitforvisualfinish @@ -5948,7 +5948,7 @@ Move_SLUDGE: createsprite gSludgeProjectileSpriteTemplate, ANIM_TARGET, 2, 20, 0, 40, 0 waitforvisualfinish createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 5, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 1, 2, 0, 12, RGB(30, 0, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 1, 2, 0, 12, RGB(30, 0, 31) call PoisonBubblesEffect waitforvisualfinish end @@ -5966,7 +5966,7 @@ Move_SLUDGE_BOMB: call SludgeBombProjectile call SludgeBombProjectile createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 3, 0, 15, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 1, 2, 0, 12, RGB(30, 0, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 1, 2, 0, 12, RGB(30, 0, 31) createsprite gSludgeBombHitParticleSpriteTemplate, ANIM_TARGET, 2, 42, 27, 20 createsprite gSludgeBombHitParticleSpriteTemplate, ANIM_TARGET, 2, -27, 44, 20 createsprite gSludgeBombHitParticleSpriteTemplate, ANIM_TARGET, 2, 39, -28, 20 @@ -6010,7 +6010,7 @@ Move_ACID: delay 15 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 10, 1 createvisualtask AnimTask_ShakeMon2, 5, ANIM_DEF_PARTNER, 2, 0, 10, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 20, 2, 2, 0, 12, RGB(30, 0, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_DEF_SIDE, 2, 2, 0, 12, RGB(30, 0, 31) createsprite gAcidPoisonDropletSpriteTemplate, ANIM_TARGET, 2, 0, -22, 0, 15, 55 playsewithpan SE_M_BUBBLE, SOUND_PAN_TARGET delay 10 @@ -6060,7 +6060,7 @@ Move_BONE_CLUB: delay 12 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 1 createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 5, 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 7, 5, 1, RGB_BLACK, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_ATTACKER | F_PAL_TARGET, 5, 1, RGB_BLACK, 10, RGB_BLACK, 0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish clearmonbg ANIM_DEF_PARTNER @@ -6124,7 +6124,7 @@ MegahornContinue: createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -16, 4, 1, 4 waitforvisualfinish createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, -4, 1, 12, 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 7, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_ATTACKER | F_PAL_TARGET, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 delay 10 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 11 delay 3 @@ -6266,7 +6266,7 @@ Move_CRABHAMMER: createsprite gWaterHitSplatSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, ANIM_TARGET, 0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET delay 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB(13, 21, 31), 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB(13, 21, 31), 10, RGB_BLACK, 0 createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -24, 0, 0, 4 waitforvisualfinish delay 8 @@ -6362,14 +6362,14 @@ Move_WHIRLPOOL: splitbgprio ANIM_TARGET setalpha 12, 8 delay 0 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 0, 7, RGB(0, 13, 23) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 0, 7, RGB(0, 13, 23) playsewithpan SE_M_WHIRLPOOL, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 50, 1 call WhirlpoolEffect call WhirlpoolEffect call WhirlpoolEffect delay 12 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 7, 0, RGB(0, 13, 23) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 7, 0, RGB(0, 13, 23) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -6469,7 +6469,7 @@ Move_CROSS_CHOP: createsprite gCrossChopHandSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 1 delay 40 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_WHITE, 10, RGB_BLACK, 10 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_WHITE, 10, RGB_BLACK, 10 createsprite gCrossImpactSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 1, 20 createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 7, 0, 9, 1 waitforvisualfinish @@ -6721,7 +6721,7 @@ Move_SUNNY_DAY: loadspritegfx ANIM_TAG_SUNLIGHT monbg ANIM_ATK_PARTNER setalpha 13, 3 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 1, 0, 6, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 1, 0, 6, RGB_WHITE waitforvisualfinish panse_adjustnone SE_M_PETAL_DANCE, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +1, 0 call SunnyDayLightRay @@ -6729,7 +6729,7 @@ Move_SUNNY_DAY: call SunnyDayLightRay call SunnyDayLightRay waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 1, 6, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 1, 6, 0, RGB_WHITE waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff @@ -6929,7 +6929,7 @@ Move_MIST: call MistCloud call MistCloud delay 32 - createvisualtask AnimTask_BlendColorCycle, 2, 10, 8, 2, 0, 14, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATK_SIDE, 8, 2, 0, 14, RGB_WHITE waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff @@ -6945,9 +6945,9 @@ Move_HAZE: playsewithpan SE_M_HAZE, 0 createvisualtask AnimTask_HazeScrollingFog, 5 delay 30 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x780, 2, 0, 16, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BATTLERS_2, 2, 0, 16, RGB_BLACK delay 90 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x780, 1, 16, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BATTLERS_2, 1, 16, 0, RGB_BLACK end Move_FIRE_PUNCH: @@ -6956,7 +6956,7 @@ Move_FIRE_PUNCH: loadspritegfx ANIM_TAG_IMPACT monbg ANIM_DEF_PARTNER setalpha 12, 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 9, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 9, RGB_RED createsprite gFireSpiralInwardSpriteTemplate, ANIM_TARGET, 1, 0 createsprite gFireSpiralInwardSpriteTemplate, ANIM_TARGET, 1, 64 createsprite gFireSpiralInwardSpriteTemplate, ANIM_TARGET, 1, 128 @@ -6970,7 +6970,7 @@ Move_FIRE_PUNCH: delay 4 playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 9, 0, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 9, 0, RGB_RED waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -7099,7 +7099,7 @@ Move_POISON_GAS: createsprite gPoisonGasCloudSpriteTemplate, ANIM_TARGET, 0, 64, 0, 0, -32, -6, 4192, 1072, 0 delay 40 loopsewithpan SE_M_MIST, SOUND_PAN_TARGET, 28, 6 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 6, 2, 0, 12, RGB(26, 0, 26) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 6, 2, 0, 12, RGB(26, 0, 26) waitforvisualfinish blendoff clearmonbg ANIM_DEF_PARTNER @@ -7133,7 +7133,7 @@ Move_PSYBEAM: call PsybeamRings call PsybeamRings createvisualtask AnimTask_SwayMon, 5, 0, 6, 2048, 4, ANIM_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(31, 18, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(31, 18, 31) call PsybeamRings call PsybeamRings call PsybeamRings @@ -7158,7 +7158,7 @@ Move_HYPNOSIS: call HypnosisRings call HypnosisRings call HypnosisRings - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(31, 18, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(31, 18, 31) waitforvisualfinish delay 1 call UnsetPsychicBackground @@ -7178,7 +7178,7 @@ Move_PSYWAVE: createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_TELEPORT, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 9, 0, 10 call PsywaveRings call PsywaveRings - createvisualtask AnimTask_BlendColorCycle, 2, 4, 1, 4, 0, 12, RGB(31, 18, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 1, 4, 0, 12, RGB(31, 18, 31) call PsywaveRings call PsywaveRings call PsywaveRings @@ -7314,7 +7314,7 @@ Move_NIGHT_SHADE: createvisualtask AnimTask_NightShadeClone, 5, 85 delay 70 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 12, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 0, 2, 0, 13, RGB_BLACK + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 0, 2, 0, 13, RGB_BLACK waitforvisualfinish clearmonbg ANIM_ATTACKER delay 1 @@ -7376,7 +7376,7 @@ Move_FOCUS_ENERGY: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect delay 8 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_WHITE createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect delay 8 @@ -7389,7 +7389,7 @@ Move_BIDE: end BideSetUp: loopsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER, 9, 2 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 waitforvisualfinish end @@ -7399,7 +7399,7 @@ BideUnleash: monbg ANIM_DEF_PARTNER setalpha 12, 8 loopsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER, 9, 2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 waitforvisualfinish createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 24, 0, 0, 4 @@ -7418,7 +7418,7 @@ BideUnleash: delay 5 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 7 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 2, 11, 0, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 2, 11, 0, RGB_RED waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -7429,7 +7429,7 @@ Move_STRING_SHOT: loadspritegfx ANIM_TAG_WEB_THREAD monbg ANIM_DEF_PARTNER delay 0 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 0, 9, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, F_PAL_BG, 2, 0, 9, RGB_BLACK waitforvisualfinish loopsewithpan SE_M_STRING_SHOT, SOUND_PAN_ATTACKER, 9, 6 call StringShotThread @@ -7461,7 +7461,7 @@ Move_STRING_SHOT: clearmonbg ANIM_DEF_PARTNER delay 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 9, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, F_PAL_BG, 2, 9, 0, RGB_BLACK end StringShotThread: @@ -7474,7 +7474,7 @@ Move_SPIDER_WEB: loadspritegfx ANIM_TAG_WEB_THREAD monbg ANIM_DEF_PARTNER delay 0 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 0, 9, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, F_PAL_BG, 2, 0, 9, RGB_BLACK waitforvisualfinish splitbgprio ANIM_TARGET loopsewithpan SE_M_STRING_SHOT, SOUND_PAN_ATTACKER, 9, 6 @@ -7498,7 +7498,7 @@ Move_SPIDER_WEB: waitforvisualfinish clearmonbg ANIM_DEF_PARTNER delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 9, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, F_PAL_BG, 2, 9, 0, RGB_BLACK end SpiderWebThread: @@ -7566,7 +7566,7 @@ Move_RECOVER: monbg ANIM_ATK_PARTNER setalpha 12, 8 loopsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER, 13, 3 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 6, 0, 11, RGB(31, 31, 11) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 6, 0, 11, RGB(31, 31, 11) call RecoverAbsorbEffect call RecoverAbsorbEffect call RecoverAbsorbEffect @@ -7608,7 +7608,7 @@ Move_MIMIC: setarg 7, 0xFFFF waitforvisualfinish playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 11, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 11, RGB_WHITE waitforvisualfinish clearmonbg_static ANIM_DEF_PARTNER blendoff @@ -7655,7 +7655,7 @@ CurseGhost: createsprite gCurseGhostSpriteTemplate, ANIM_TARGET, 2 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 14, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 16, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -7673,7 +7673,7 @@ CurseStats: CurseStats1: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_DrawFallingWhiteLinesOnAttacker, 5 - createvisualtask AnimTask_BlendColorCycle, 5, 2, 4, 2, 0, 10, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 5, F_PAL_ATTACKER, 4, 2, 0, 10, RGB_RED return Move_SOFT_BOILED: @@ -7688,7 +7688,7 @@ Move_SOFT_BOILED: delay 120 delay 7 playsewithpan SE_M_HORN_ATTACK, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 10, 0, RGB(12, 24, 30) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 10, 0, RGB(12, 24, 30) createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 3, 31, 16, 0, 1 delay 8 createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 3, 31, 16, 0, 1 @@ -7703,7 +7703,7 @@ Move_HEAL_BELL: loadspritegfx ANIM_TAG_BELL loadspritegfx ANIM_TAG_MUSIC_NOTES_2 loadspritegfx ANIM_TAG_THIN_RING - createvisualtask AnimTask_BlendBattleAnimPal, 10, 10, 0, 0, 10, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATK_SIDE, 0, 0, 10, RGB_WHITE waitforvisualfinish createvisualtask AnimTask_LoadMusicNotesPals, 5 createsprite gBellSpriteTemplate, ANIM_ATTACKER, 2, 0, -24, 0, 1 @@ -7741,12 +7741,12 @@ Move_HEAL_BELL: loadspritegfx ANIM_TAG_THIN_RING playsewithpan SE_SHINY, SOUND_PAN_ATTACKER createvisualtask AnimTask_BlendBattleAnimPalExclude, 10, 4, 3, 10, 0, RGB(12, 24, 30) - createvisualtask AnimTask_BlendBattleAnimPal, 10, 10, 3, 10, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATK_SIDE, 3, 10, 0, RGB_WHITE createsprite gBlendThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 16, 0, 0, 0, 1 end HealBellRing: createvisualtask AnimTask_BlendBattleAnimPalExclude, 10, 4, 3, 8, 0, RGB(12, 24, 30) - createvisualtask AnimTask_BlendBattleAnimPal, 10, 10, 3, 2, 10, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATK_SIDE, 3, 2, 10, RGB_WHITE createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 40, 0, -24, 0, 1 playsewithpan SE_M_HEAL_BELL, SOUND_PAN_ATTACKER return @@ -7759,12 +7759,12 @@ Move_FAKE_OUT: createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 createvisualtask AnimTask_StretchTargetUp, 3 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 16, 0, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 16, 0, RGB_WHITE end Move_SCARY_FACE: loadspritegfx ANIM_TAG_EYE_SPARKLE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 27, 3, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_ATK_SIDE | F_PAL_DEF_PARTNER, 3, 0, 16, RGB_BLACK playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER waitforvisualfinish delay 10 @@ -7776,7 +7776,7 @@ Move_SCARY_FACE: waitforvisualfinish createvisualtask AnimTask_ShakeTargetInPattern, 3, 20, 1, FALSE playsewithpan SE_M_STRING_SHOT2, SOUND_PAN_TARGET - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 27, 3, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_ATK_SIDE | F_PAL_DEF_PARTNER, 3, 16, 0, RGB_BLACK waitforvisualfinish end @@ -7920,7 +7920,7 @@ PresentHeal: Move_BATON_PASS: loadspritegfx ANIM_TAG_POKEBALL playsewithpan SE_M_BATON_PASS, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 31, 1, 2, 0, 11, RGB(31, 22, 30) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_BATTLERS, 1, 2, 0, 11, RGB(31, 22, 30) createsprite gBatonPassPokeballSpriteTemplate, ANIM_ATTACKER, 2 end @@ -7946,13 +7946,13 @@ Move_PERISH_SONG: delay 20 panse SE_M_PERISH_SONG, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 delay 80 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 0, 16, RGB_BLACK createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 4, 0 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 5, 0 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 6, 0 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 7, 0 delay 100 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 16, 0, RGB_BLACK createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 4, 1 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 5, 1 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 6, 1 @@ -8027,7 +8027,7 @@ Move_TRI_ATTACK: delay 20 createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_TRI_ATTACK, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 6, 0, 7 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 16, RGB_BLACK delay 16 loadspritegfx ANIM_TAG_FIRE createsprite gLargeFlameScatterSpriteTemplate, ANIM_TARGET, 2, 0, 0, 30, 30, -1, 0 @@ -8063,7 +8063,7 @@ Move_TRI_ATTACK: waitforvisualfinish loadspritegfx ANIM_TAG_ICE_CRYSTALS call IceCrystalEffectShort - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_BLACK waitforvisualfinish end @@ -8149,7 +8149,7 @@ Move_TRICK: Move_WISH: loadspritegfx ANIM_TAG_GOLD_STARS loadspritegfx ANIM_TAG_SPARKLE_2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 10, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 0, 10, RGB_BLACK waitforvisualfinish panse_adjustall SE_M_REFLECT, SOUND_PAN_TARGET, SOUND_PAN_ATTACKER, -3, 0 createsprite gWishStarSpriteTemplate, ANIM_ATTACKER, 40 @@ -8158,19 +8158,19 @@ Move_WISH: loopsewithpan SE_M_HEAL_BELL, SOUND_PAN_ATTACKER, 16, 3 call GrantingStarsEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 10, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 10, 0, RGB_BLACK waitforvisualfinish end Move_STOCKPILE: loadspritegfx ANIM_TAG_GRAY_ORB playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 8, 1, 0, 12, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 8, 1, 0, 12, RGB_WHITE createvisualtask AnimTask_StockpileDeformMon, 5 call StockpileAbsorb call StockpileAbsorb waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 12, 0, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 0, 12, 0, RGB_WHITE end StockpileAbsorb: createsprite gStockpileAbsorptionOrbSpriteTemplate, ANIM_ATTACKER, 2, 55, 55, 13 @@ -8288,7 +8288,7 @@ Move_MORNING_SUN: loadspritegfx ANIM_TAG_BLUE_STAR createvisualtask AnimTask_MorningSunLightBeam, 5 delay 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 8, 0, 12, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 8, 0, 12, RGB_WHITE delay 14 call MorningSunStar call MorningSunStar @@ -8305,7 +8305,7 @@ Move_MORNING_SUN: call MorningSunStar call MorningSunStar call MorningSunStar - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 3, 12, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 3, 12, 0, RGB_WHITE waitforvisualfinish waitsound call HealingEffect @@ -8324,7 +8324,7 @@ Move_SWEET_SCENT: call SweetScentEffect createsprite gSweetScentPetalSpriteTemplate, ANIM_ATTACKER, 2, 55, 0 setpan SOUND_PAN_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 20, 1, 5, 5, 13, RGB(31, 21, 21) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_DEF_SIDE, 1, 5, 5, 13, RGB(31, 21, 21) call SweetScentEffect waitforvisualfinish end @@ -8355,7 +8355,7 @@ SweetScentEffect: Move_HYPER_BEAM: loadspritegfx ANIM_TAG_ORBS - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 0, 16, RGB_BLACK waitforvisualfinish delay 10 playsewithpan SE_M_HYPER_BEAM, SOUND_PAN_ATTACKER @@ -8371,7 +8371,7 @@ Move_HYPER_BEAM: call HyperBeamOrbs call HyperBeamOrbs createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 50, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 11, RGB(25, 25, 25) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 11, RGB(25, 25, 25) call HyperBeamOrbs call HyperBeamOrbs call HyperBeamOrbs @@ -8393,9 +8393,9 @@ Move_HYPER_BEAM: call HyperBeamOrbs call HyperBeamOrbs call HyperBeamOrbs - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 11, 0, RGB(25, 25, 25) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 11, 0, RGB(25, 25, 25) waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 16, 0, RGB_BLACK end HyperBeamOrbs: createsprite gHyperBeamOrbSpriteTemplate, ANIM_TARGET, 2 @@ -8450,17 +8450,17 @@ CreateFlatterConfetti: Move_ROLE_PLAY: monbg ANIM_ATK_PARTNER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 16, RGB_WHITE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 10, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 16, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 10, RGB_BLACK waitforvisualfinish playsewithpan SE_M_TRI_ATTACK, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_DETECT, SOUND_PAN_ATTACKER, 30 createvisualtask AnimTask_RolePlaySilhouette, 2 waitforvisualfinish clearmonbg ANIM_ATK_PARTNER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 16, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 16, 0, RGB_WHITE delay 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 10, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 10, 0, RGB_BLACK end Move_REFRESH: @@ -8473,7 +8473,7 @@ Move_REFRESH: call GrantingStarsEffect waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 10, 0, RGB(12, 24, 30) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 10, 0, RGB(12, 24, 30) createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0 end @@ -8485,13 +8485,13 @@ Move_BLAZE_KICK: setalpha 12, 8 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_TARGET createsprite gSpinningHandOrFootSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 30 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 7, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 7, RGB_WHITE delay 30 playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0, 0, ANIM_TARGET, 0 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 3, 0, 14, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 0, RGB_WHITE - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 0, RGB_WHITE + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 call FireSpreadEffect waitforvisualfinish clearmonbg ANIM_TARGET @@ -8510,7 +8510,7 @@ Move_HYPER_VOICE: end HyperVoiceEffect: - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 8, 0, RGB_YELLOW + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 8, 0, RGB_YELLOW createvisualtask AnimTask_ScaleMonAndRestore, 5, -5, -5, 5, ANIM_ATTACKER, 0 createsprite gHyperVoiceRingSpriteTemplate, ANIM_ATTACKER, 0, 45, 0, 0, 0, 0, 0, 1 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 6, 1 @@ -8521,14 +8521,14 @@ HyperVoiceEffect: Move_SAND_TOMB: loadspritegfx ANIM_TAG_MUD_SAND - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 0, 7, RGB(19, 17, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 0, 7, RGB(19, 17, 0) createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 43, 1 playsewithpan SE_M_SAND_TOMB, SOUND_PAN_TARGET call SandTombSwirlingDirt call SandTombSwirlingDirt call SandTombSwirlingDirt delay 22 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 7, 0, RGB(19, 17, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 7, 0, RGB(19, 17, 0) waitforvisualfinish end @@ -8627,7 +8627,7 @@ Move_DRAGON_CLAW: loadspritegfx ANIM_TAG_SMALL_EMBER loadspritegfx ANIM_TAG_CLAW_SLASH playsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 4, 0, 8, RGB(31, 19, 0) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 4, 0, 8, RGB(31, 19, 0) createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 15, 1 call DragonClawFireSpiral call DragonClawFireSpiral @@ -8664,7 +8664,7 @@ Move_DRAGON_CLAW: createsprite gFireSpinSpriteTemplate, ANIM_ATTACKER, 2, 0, 28, 512, 25, 16, 46, ANIM_ATTACKER delay 2 createsprite gFireSpinSpriteTemplate, ANIM_ATTACKER, 2, 0, 33, 464, 30, 15, -50, ANIM_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 4, 8, 0, RGB(31, 19, 0) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 4, 8, 0, RGB(31, 19, 0) waitforvisualfinish end DragonClawFireSpiral: @@ -8747,7 +8747,7 @@ Move_REVENGE: playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER createsprite gRevengeSmallScratchSpriteTemplate, ANIM_ATTACKER, 2, 10, -10 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 4, 2, 8, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 4, 2, 8, RGB_RED waitforvisualfinish unloadspritegfx ANIM_TAG_PURPLE_SCRATCH loadspritegfx ANIM_TAG_PURPLE_SWIPE @@ -8777,7 +8777,7 @@ Move_POISON_FANG: delay 10 createvisualtask AnimTask_ShakeMon, 3, ANIM_TARGET, 3, 0, 10, 1 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 4, 0, 4, 0, 12, RGB(26, 0, 26) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 0, 4, 0, 12, RGB(26, 0, 26) call PoisonBubblesEffect waitforvisualfinish end @@ -8793,7 +8793,7 @@ Move_FRENZY_PLANT: monbg ANIM_TARGET splitbgprio ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 2, 0, 5, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 2, 0, 5, RGB_BLACK waitforvisualfinish createsprite gFrenzyPlantRootSpriteTemplate, ANIM_ATTACKER, 2, 10, 8, 2, 0, 0, 100 playsewithpan SE_M_SCRATCH, SOUND_PAN_ATTACKER @@ -8841,7 +8841,7 @@ Move_FRENZY_PLANT: createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 10, ANIM_TARGET, 1 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 2, 5, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 2, 5, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -8983,7 +8983,7 @@ ReturnStrong: createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 6, 0, 8, 1 goto ReturnContinue ReturnStrongest: - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 0, 6, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 0, 6, RGB_BLACK waitforvisualfinish createsprite gVerticalDipSpriteTemplate, ANIM_ATTACKER, 2, 16, 1, ANIM_ATTACKER createvisualtask SoundTask_PlaySE2WithPanning, 5, SE_M_TAIL_WHIP, SOUND_PAN_ATTACKER @@ -9040,7 +9040,7 @@ ReturnStrongest: createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, -5, 3, ANIM_TARGET, 0 createvisualtask SoundTask_PlaySE1WithPanning, 5, SE_M_MEGA_KICK2, SOUND_PAN_TARGET waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 6, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 6, 0, RGB_BLACK goto ReturnContinue ReturnStrongestHit: createsprite gVerticalDipSpriteTemplate, ANIM_ATTACKER, 2, 4, 3, ANIM_ATTACKER @@ -9170,7 +9170,7 @@ Move_SILVER_WIND: createvisualtask AnimTask_StartSlidingBg, 5, 1536, 0, 0, -1 SilverWindContinue: delay 0 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 4, 4, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 4, 4, RGB_BLACK waitbgfadein createsprite gSilverWindBigSparkSpriteTemplate, ANIM_TARGET, 66, -32, 16, 0, 6, 2, 3, 1 createsprite gSilverWindBigSparkSpriteTemplate, ANIM_TARGET, 66, -8, 18, 64, 3, 2, 2, 1 @@ -9284,7 +9284,7 @@ Move_OVERHEAT: loadspritegfx ANIM_TAG_IMPACT monbg ANIM_DEF_PARTNER setalpha 12, 18 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 5, RGB(28, 0, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 5, RGB(28, 0, 0) waitforvisualfinish createvisualtask AnimTask_AllocBackupPalBuffer, 5 waitforvisualfinish @@ -9295,7 +9295,7 @@ Move_OVERHEAT: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_CopyPalUnfadedToBackup, 5, 1, 0 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 1, 0, 13, RGB(28, 0, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 1, 0, 13, RGB(28, 0, 0) createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 2, 0, 15, 1 waitforvisualfinish playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_ATTACKER @@ -9341,12 +9341,12 @@ Move_OVERHEAT: playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET createvisualtask AnimTask_CopyPalFadedToUnfaded, 5, 1 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, -1, 0, 13, RGB(18, 18, 18) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, -1, 0, 13, RGB(18, 18, 18) createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 3, 0, 15, 1 waitforvisualfinish createvisualtask AnimTask_CopyPalUnfadedFromBackup, 5, 0, 1 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 5, 0, RGB(28, 0, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 5, 0, RGB(28, 0, 0) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -9354,7 +9354,7 @@ Move_OVERHEAT: delay 15 createvisualtask AnimTask_CopyPalUnfadedFromBackup, 5, 1, 0 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 13, 0, RGB(18, 18, 18) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 0, 13, 0, RGB(18, 18, 18) waitforvisualfinish createvisualtask AnimTask_FreeBackupPalBuffer, 5 waitforvisualfinish @@ -9498,7 +9498,7 @@ Move_WATER_PULSE: monbg ANIM_TARGET splitbgprio ANIM_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 0, 7, RGB(0, 25, 28) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 0, 7, RGB(0, 25, 28) delay 10 createsprite gWaterPulseBubbleSpriteTemplate, ANIM_ATTACKER, 66, 100, 100, 8, 1, 20, 40, 0 createsprite gWaterPulseBubbleSpriteTemplate, ANIM_ATTACKER, 66, 20, 100, 16, 2, 10, 35, 1 @@ -9518,7 +9518,7 @@ Move_WATER_PULSE: delay 13 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 8, 18, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 7, 0, RGB(0, 25, 28) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 7, 0, RGB(0, 25, 28) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -9531,7 +9531,7 @@ Move_PSYCHO_BOOST: createvisualtask AnimTask_FadeScreenToWhite, 5 waitbgfadein delay 6 - createvisualtask AnimTask_BlendColorCycle, 2, 1, 2, 8, 0, 10, RGB_BLACK + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG, 2, 8, 0, 10, RGB_BLACK delay 0 splitbgprio ANIM_ATTACKER setalpha 8, 8 @@ -9558,7 +9558,7 @@ Move_KNOCK_OFF: playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET createsprite gKnockOffStrikeSpriteTemplate, ANIM_TARGET, 2, -16, -16 delay 8 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0, 0, ANIM_TARGET, 2 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -12, 10, 0, 3 @@ -9576,7 +9576,7 @@ Move_DOOM_DESIRE: delay 1 monbg ANIM_ATK_PARTNER createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, ANIM_TARGET, FALSE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 4, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 4, RGB_BLACK waitforvisualfinish setalpha 8, 8 playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER @@ -9584,7 +9584,7 @@ Move_DOOM_DESIRE: waitforvisualfinish delay 20 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, ANIM_TARGET, TRUE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 4, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 4, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff @@ -9836,7 +9836,7 @@ Move_WEATHER_BALL: waitforvisualfinish delay 15 playsewithpan SE_M_DETECT, 0 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 waitforvisualfinish createvisualtask AnimTask_GetWeather, 2 delay 1 @@ -10218,7 +10218,7 @@ UnsetSolarBeamBg: Status_Poison: loopsewithpan SE_M_TOXIC, SOUND_PAN_TARGET, 13, 6 createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 18, 2 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 12, RGB(30, 0, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 12, RGB(30, 0, 31) end Status_Confusion: @@ -10320,13 +10320,13 @@ General_StatsChange: General_SubstituteFade: monbg ANIM_ATTACKER createvisualtask AnimTask_SubstituteFadeToInvisible, 5 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 0, 0, 16, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 0, 0, 16, RGB_WHITE waitforvisualfinish delay 1 clearmonbg ANIM_ATTACKER delay 2 blendoff - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 0, 0, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 0, 0, 0, RGB_WHITE createvisualtask AnimTask_SwapMonSpriteToFromSubstitute, 2, TRUE end @@ -10389,13 +10389,13 @@ Status_Whirlpool: splitbgprio ANIM_TARGET setalpha 12, 8 delay 0 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 0, 7, RGB(0, 13, 23) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 0, 7, RGB(0, 13, 23) playsewithpan SE_M_WHIRLPOOL, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 30, 1 call WhirlpoolEffect call WhirlpoolEffect delay 12 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 7, 0, RGB(0, 13, 23) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 7, 0, RGB(0, 13, 23) waitforvisualfinish stopsound clearmonbg ANIM_DEF_PARTNER @@ -10420,13 +10420,13 @@ Status_Clamp: Status_SandTomb: loadspritegfx ANIM_TAG_MUD_SAND - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 0, 7, RGB(19, 17, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 0, 7, RGB(19, 17, 0) createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 30, 1 playsewithpan SE_M_SAND_TOMB, SOUND_PAN_TARGET call SandTombSwirlingDirt call SandTombSwirlingDirt delay 22 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 7, 0, RGB(19, 17, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 7, 0, RGB(19, 17, 0) waitforvisualfinish stopsound end @@ -10448,7 +10448,7 @@ General_HeldItemEffect: call GrantingStarsEffect waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 3, 7, 0, RGB(17, 31, 25) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 3, 7, 0, RGB(17, 31, 25) createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0 waitforvisualfinish end @@ -10492,11 +10492,11 @@ General_SmokeballEscape: end General_FocusBand: - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 2, 7, 0, 9, RGB_RED + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_ATTACKER, 7, 0, 9, RGB_RED playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_SlideMonForFocusBand, 5, 30, 128, 0, 1, 2, 0, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 2, 4, 9, 0, RGB_RED + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_ATTACKER, 4, 9, 0, RGB_RED waitforvisualfinish delay 6 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 0, 0, 0, 15 @@ -10505,13 +10505,13 @@ General_FocusBand: General_Rain: loadspritegfx ANIM_TAG_RAIN_DROPS playsewithpan SE_M_RAIN_DANCE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 2, 0, 4, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_CreateRaindrops, 2, 0, 3, 60 createvisualtask AnimTask_CreateRaindrops, 2, 0, 3, 60 delay 50 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 2, 4, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 2, 4, 0, RGB_BLACK waitforvisualfinish end @@ -10595,7 +10595,7 @@ General_FutureSightHit: General_DoomDesireHit: createvisualtask AnimTask_SetAnimTargetToBattlerTarget, 2 loadspritegfx ANIM_TAG_EXPLOSION - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 16, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 0, 16, RGB_WHITE waitforvisualfinish delay 10 createvisualtask AnimTask_DoomDesireLightBeam, 5 @@ -10622,7 +10622,7 @@ General_DoomDesireHit: playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 16, 16, 1, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 16, 0, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 16, 0, RGB_WHITE waitforvisualfinish end @@ -10631,7 +10631,7 @@ General_FocusPunchSetUp: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect delay 8 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect delay 8 @@ -10644,7 +10644,7 @@ General_IngrainHeal: loadspritegfx ANIM_TAG_BLUE_STAR monbg ANIM_DEF_PARTNER setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 4, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 4, RGB(13, 31, 12) waitforvisualfinish delay 3 call AbsorbEffect @@ -10652,7 +10652,7 @@ General_IngrainHeal: delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 4, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 4, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -10660,7 +10660,7 @@ General_IngrainHeal: General_WishHeal: loadspritegfx ANIM_TAG_SPARKLE_2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 10, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 0, 10, RGB_BLACK waitforvisualfinish playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call GrantingStarsEffect @@ -10669,7 +10669,7 @@ General_WishHeal: loadspritegfx ANIM_TAG_BLUE_STAR call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 10, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 10, 0, RGB_BLACK end SnatchMoveTrySwapFromSubstitute: diff --git a/include/battle_anim.h b/include/battle_anim.h index 9d1cf7be2..c42fa033b 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -118,7 +118,7 @@ void SetSpriteRotScale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation); void InitSpriteDataForLinearTranslation(struct Sprite *sprite); void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode); void SetBattlerSpriteYOffsetFromRotation(u8 spriteId); -u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, u8 targetPartner, u8 a6, u8 a7); +u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, bool8 attackerPartner, bool8 targetPartner, bool8 anim1, bool8 anim2); u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight); u8 AnimDummyReturnArg(u8 battler); s16 CloneBattlerSpriteWithBlend(u8); @@ -229,7 +229,7 @@ void DestroyAnimSpriteAfterTimer(struct Sprite *sprite); // battle_anim_smokescreen.c u8 SmokescreenImpact(s16 x, s16 y, u8 a3); -u32 UnpackSelectedBattleBgPalettes(s16); +u32 UnpackSelectedBattlePalettes(s16); u8 GetBattlerSpriteFinal_Y(u8, u16, u8); diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index 2ff9318be..00ad083eb 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -413,4 +413,21 @@ #define ANIM_WEATHER_SANDSTORM 3 #define ANIM_WEATHER_HAIL 4 +// Flags given to various functions to indicate which palettes to consider. +// Handled by UnpackSelectedBattlePalettes +#define F_PAL_BG (1 << 0) +#define F_PAL_ATTACKER (1 << 1) +#define F_PAL_TARGET (1 << 2) +#define F_PAL_ATK_PARTNER (1 << 3) +#define F_PAL_DEF_PARTNER (1 << 4) +#define F_PAL_ANIM_1 (1 << 5) // Palette set for GetBattleAnimBg1Data/GetBgDataForTransform. Only used (ineffectually?) by Aromatherapy. +#define F_PAL_ANIM_2 (1 << 6) // Palette set for GetBattleAnimBgData/GetBgDataForTransform. Unused. +#define F_PAL_ATK_SIDE (F_PAL_ATTACKER | F_PAL_ATK_PARTNER) +#define F_PAL_DEF_SIDE (F_PAL_TARGET | F_PAL_DEF_PARTNER) +#define F_PAL_BATTLERS (F_PAL_ATK_SIDE | F_PAL_DEF_SIDE) +// The below are only used by AnimTask_BlendBattleAnimPal to get battler sprite palettes by position rather than by role. +// It's redundant with F_PAL_BATTLERS, because they're only ever used together to refer to all the battlers at once. +#define F_PAL_BATTLERS_2 (1 << 7 | 1 << 8 | 1 << 9 | 1 << 10) + + #endif // GUARD_CONSTANTS_BATTLE_ANIM_H diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index d460b9236..76868342f 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -4343,7 +4343,7 @@ static void AnimLockOnTarget_Step4(struct Sprite* sprite) sprite->data[1] = 0; } - BlendPalettes(GetBattleBgPalettesMask(1, 1, 1, 1, 1, 0, 0), sprite->data[1], RGB(31, 31, 31)); + BlendPalettes(GetBattlePalettesMask(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE), sprite->data[1], RGB(31, 31, 31)); if (sprite->data[1] == 16) { int pal; @@ -4998,7 +4998,7 @@ static void AnimMoonlightSparkle_Step(struct Sprite* sprite) void AnimTask_MoonlightEndFade(u8 taskId) { - int a = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF; + int a = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) & 0xFFFF; int b; int c; int d; diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 101b255df..9764d5522 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -3116,7 +3116,7 @@ static void AnimTask_FakeOut_Step2(u8 taskId) { gTasks[taskId].data[11] = 0x88; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_LIGHTEN); - BlendPalettes(GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0), 16, RGB(31, 31, 31)); + BlendPalettes(GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), 16, RGB(31, 31, 31)); } else if (gTasks[taskId].data[10] > 4) { diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index 02b89b965..16af29860 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -1004,7 +1004,7 @@ static void AnimTask_CurseStretchingBlackBg_Step1(u8 taskId) right = DISPLAY_WIDTH; top = 0; bottom = 112; - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); BeginNormalPaletteFade(selectedPalettes, 0, 16, 16, RGB(0, 0, 0)); gTasks[taskId].func = AnimTask_CurseStretchingBlackBg_Step2; } diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index a03196ee1..cee50df3f 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -908,13 +908,17 @@ bool8 IsDoubleBattle(void) return IS_DOUBLE_BATTLE(); } +#define BG_ANIM_PAL_1 8 +#define BG_ANIM_PAL_2 9 +#define BG_ANIM_PAL_CONTEST 14 + void GetBattleAnimBg1Data(struct BattleAnimBgData *out) { if (IsContest()) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; - out->paletteId = 14; + out->paletteId = BG_ANIM_PAL_CONTEST; out->bgId = 1; out->tilesOffset = 0; out->unused = 0; @@ -923,7 +927,7 @@ void GetBattleAnimBg1Data(struct BattleAnimBgData *out) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; - out->paletteId = 8; + out->paletteId = BG_ANIM_PAL_1; out->bgId = 1; out->tilesOffset = 0x200; out->unused = 0; @@ -936,7 +940,7 @@ void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; - out->paletteId = 14; + out->paletteId = BG_ANIM_PAL_CONTEST; out->bgId = 1; out->tilesOffset = 0; out->unused = 0; @@ -949,7 +953,7 @@ void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; - out->paletteId = 9; + out->paletteId = BG_ANIM_PAL_2; out->bgId = 2; out->tilesOffset = 0x300; out->unused = 0; @@ -962,21 +966,21 @@ void GetBgDataForTransform(struct BattleAnimBgData *out, u8 battlerId) out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; if (IsContest()) { - out->paletteId = 14; + out->paletteId = BG_ANIM_PAL_CONTEST; out->bgId = 1; out->tilesOffset = 0; out->unused = 0; } else if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1) { - out->paletteId = 8; + out->paletteId = BG_ANIM_PAL_1; out->bgId = 1; out->tilesOffset = 0x200; out->unused = 0; } else { - out->paletteId = 9; + out->paletteId = BG_ANIM_PAL_2; out->bgId = 2; out->tilesOffset = 0x300; out->unused = 0; @@ -1401,7 +1405,7 @@ void SetGrayscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor) } } -u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, u8 targetPartner, u8 a6, u8 a7) +u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, bool8 attackerPartner, bool8 targetPartner, bool8 anim1, bool8 anim2) { u32 selectedPalettes = 0; u32 shift; @@ -1409,7 +1413,7 @@ u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 atta if (battleBackground) { if (!IsContest()) - selectedPalettes = 0xe; + selectedPalettes = 0xe; // Palettes 1, 2, and 3 else selectedPalettes = 1 << GetBattleBgPaletteNum(); } @@ -1439,17 +1443,17 @@ u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 atta selectedPalettes |= 1 << shift; } } - if (a6) + if (anim1) { if (!IsContest()) - selectedPalettes |= 0x100; + selectedPalettes |= 1 << BG_ANIM_PAL_1; else - selectedPalettes |= 0x4000; + selectedPalettes |= 1 << BG_ANIM_PAL_CONTEST; } - if (a7) + if (anim2) { if (!IsContest()) - selectedPalettes |= 0x200; + selectedPalettes |= 1 << BG_ANIM_PAL_2; } return selectedPalettes; } diff --git a/src/battle_anim_normal.c b/src/battle_anim_normal.c index ebf9a588f..a92428f83 100644 --- a/src/battle_anim_normal.c +++ b/src/battle_anim_normal.c @@ -304,7 +304,7 @@ static void AnimConfusionDuck_Step(struct Sprite *sprite) // arg 4: blend color static void AnimSimplePaletteBlend(struct Sprite *sprite) { - u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]); + u32 selectedPalettes = UnpackSelectedBattlePalettes(gBattleAnimArgs[0]); BeginNormalPaletteFade(selectedPalettes, gBattleAnimArgs[1], gBattleAnimArgs[2], gBattleAnimArgs[3], gBattleAnimArgs[4]); sprite->invisible = TRUE; sprite->callback = AnimSimplePaletteBlend_Step; @@ -312,23 +312,23 @@ static void AnimSimplePaletteBlend(struct Sprite *sprite) // Unpacks a bitfield and returns a bitmask of its selected palettes. // Bits 0-6 of the selector parameter result in the following palettes being selected: -// 0: battle background palettes (BG palettes 1, 2, and 3) -// 1: gBattleAnimAttacker OBJ palette -// 2: gBattleAnimTarget OBJ palette -// 3: gBattleAnimAttacker partner OBJ palette -// 4: gBattleAnimTarget partner OBJ palette -// 5: BG palette 4 -// 6: BG palette 5 -u32 UnpackSelectedBattleBgPalettes(s16 selector) +// 0: F_PAL_BG, battle background palettes (BG palettes 1, 2, and 3) +// 1: F_PAL_ATTACKER, gBattleAnimAttacker OBJ palette +// 2: F_PAL_TARGET, gBattleAnimTarget OBJ palette +// 3: F_PAL_ATK_PARTNER, gBattleAnimAttacker partner OBJ palette +// 4: F_PAL_DEF_PARTNER, gBattleAnimTarget partner OBJ palette +// 5: F_PAL_ANIM_1, BG palette 8 (or 14, if in Contest) +// 6: F_PAL_ANIM_2, BG palette 9 +u32 UnpackSelectedBattlePalettes(s16 selector) { - u8 battleBackground = selector & 1; - u8 attacker = (selector >> 1) & 1; - u8 target = (selector >> 2) & 1; - u8 attackerPartner = (selector >> 3) & 1; - u8 targetPartner = (selector >> 4) & 1; - u8 arg5 = (selector >> 5) & 1; - u8 arg6 = (selector >> 6) & 1; - return GetBattleBgPalettesMask(battleBackground, attacker, target, attackerPartner, targetPartner, arg5, arg6); + bool8 battleBackground = selector & 1; + bool8 attacker = (selector >> 1) & 1; + bool8 target = (selector >> 2) & 1; + bool8 attackerPartner = (selector >> 3) & 1; + bool8 targetPartner = (selector >> 4) & 1; + bool8 anim1 = (selector >> 5) & 1; + bool8 anim2 = (selector >> 6) & 1; + return GetBattlePalettesMask(battleBackground, attacker, target, attackerPartner, targetPartner, anim1, anim2); } static void AnimSimplePaletteBlend_Step(struct Sprite *sprite) @@ -350,7 +350,7 @@ static void AnimComplexPaletteBlend(struct Sprite *sprite) sprite->data[6] = gBattleAnimArgs[6]; sprite->data[7] = gBattleAnimArgs[0]; - selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]); + selectedPalettes = UnpackSelectedBattlePalettes(sprite->data[7]); BlendPalettes(selectedPalettes, gBattleAnimArgs[4], gBattleAnimArgs[3]); sprite->invisible = TRUE; sprite->callback = AnimComplexPaletteBlend_Step1; @@ -375,7 +375,7 @@ static void AnimComplexPaletteBlend_Step1(struct Sprite *sprite) return; } - selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]); + selectedPalettes = UnpackSelectedBattlePalettes(sprite->data[7]); if (sprite->data[1] & 0x100) BlendPalettes(selectedPalettes, sprite->data[4], sprite->data[3]); else @@ -392,7 +392,7 @@ static void AnimComplexPaletteBlend_Step2(struct Sprite *sprite) if (!gPaletteFade.active) { - selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]); + selectedPalettes = UnpackSelectedBattlePalettes(sprite->data[7]); BlendPalettes(selectedPalettes, 0, 0); DestroyAnimSprite(sprite); } @@ -442,7 +442,7 @@ void AnimTask_BlendColorCycle(u8 taskId) static void BlendColorCycle(u8 taskId, u8 startBlendAmount, u8 targetBlendAmount) { - u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gTasks[taskId].tPalSelector); + u32 selectedPalettes = UnpackSelectedBattlePalettes(gTasks[taskId].tPalSelector); BeginNormalPaletteFade( selectedPalettes, gTasks[taskId].tDelay, @@ -721,7 +721,7 @@ void AnimTask_InvertScreenColor(u8 taskId) u8 targetBattler = gBattleAnimTarget; if (gBattleAnimArgs[0] & 0x100) - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); if (gBattleAnimArgs[1] & 0x100) selectedPalettes |= (0x10000 << attackerBattler); diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index bf95a319c..fa06f1a1c 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -690,7 +690,7 @@ void AnimTask_SwitchOutBallEffect(u8 taskId) priority = gSprites[spriteId].oam.priority; subpriority = gSprites[spriteId].subpriority; gTasks[taskId].data[10] = AnimateBallOpenParticles(x, y + 32, priority, subpriority, ballId); - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); gTasks[taskId].data[11] = LaunchBallFadeMonTask(FALSE, gBattleAnimAttacker, selectedPalettes, ballId); gTasks[taskId].data[0]++; break; diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index e2c674c57..d33c0c184 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -47,7 +47,7 @@ const u8 gBattleAnimBgCntGet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFS void AnimTask_BlendBattleAnimPal(u8 taskId) { - u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]); + u32 selectedPalettes = UnpackSelectedBattlePalettes(gBattleAnimArgs[0]); selectedPalettes |= GetBattleMonSpritePalettesMask((gBattleAnimArgs[0] >> 7) & 1, (gBattleAnimArgs[0] >> 8) & 1, (gBattleAnimArgs[0] >> 9) & 1, @@ -62,7 +62,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId) u8 animBattlers[2]; animBattlers[1] = 0xFF; - selectedPalettes = UnpackSelectedBattleBgPalettes(1); + selectedPalettes = UnpackSelectedBattlePalettes(F_PAL_BG); switch (gBattleAnimArgs[0]) { case 2: @@ -105,7 +105,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId) void AnimTask_SetCamouflageBlend(u8 taskId) { - u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]); + u32 selectedPalettes = UnpackSelectedBattlePalettes(gBattleAnimArgs[0]); switch (gBattleTerrain) { case BATTLE_TERRAIN_GRASS: @@ -607,7 +607,7 @@ void AnimTask_Flash(u8 taskId) SetPalettesToColor(selectedPalettes, RGB_BLACK); gTasks[taskId].data[14] = selectedPalettes >> 16; - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF; + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) & 0xFFFF; SetPalettesToColor(selectedPalettes, RGB_WHITEALPHA); gTasks[taskId].data[15] = selectedPalettes; @@ -923,7 +923,7 @@ void AnimTask_CopyPalUnfadedToBackup(u8 taskId) if (gBattleAnimArgs[0] == 0) { - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); while ((selectedPalettes & 1) == 0) { selectedPalettes >>= 1; @@ -950,7 +950,7 @@ void AnimTask_CopyPalUnfadedFromBackup(u8 taskId) if (gBattleAnimArgs[0] == 0) { - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); while ((selectedPalettes & 1) == 0) { selectedPalettes >>= 1; @@ -977,7 +977,7 @@ void AnimTask_CopyPalFadedToUnfaded(u8 taskId) if (gBattleAnimArgs[0] == 0) { - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); while ((selectedPalettes & 1) == 0) { selectedPalettes >>= 1; From 380cb469197aee7c1495086e2da297342bea8fee Mon Sep 17 00:00:00 2001 From: sphericalice Date: Fri, 3 Jun 2022 15:04:52 +0100 Subject: [PATCH 39/65] Correct CreateRegionMapPlayerIcon's argument names Correct CreateRegionMapPlayerIcon's argument names in include/region_map.h --- include/region_map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/region_map.h b/include/region_map.h index 02d711afa..85793badc 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -99,7 +99,7 @@ u8 DoRegionMapInputCallback(void); bool8 UpdateRegionMapZoom(void); void FreeRegionMapIconResources(void); u16 GetRegionMapSecIdAt(u16 x, u16 y); -void CreateRegionMapPlayerIcon(u16 x, u16 y); +void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag); void CreateRegionMapCursor(u16 tileTag, u16 paletteTag); bool32 IsEventIslandMapSecId(u8 mapSecId); u8 *GetMapName(u8 *, u16, u16); From d03756dfd29e245bd80d729f40dc4a4410af0ba7 Mon Sep 17 00:00:00 2001 From: sphericalice Date: Fri, 3 Jun 2022 15:42:53 +0100 Subject: [PATCH 40/65] Use the TRY_FREE_AND_SET_NULL macro where appropriate --- src/battle_factory_screen.c | 3 +-- src/easy_chat.c | 9 +++------ src/field_region_map.c | 5 +---- src/hall_of_fame.c | 18 ++++++------------ src/pokemon_storage_system.c | 3 +-- src/pokenav.c | 3 +-- src/region_map.c | 6 +----- src/rotating_tile_puzzle.c | 3 +-- src/slot_machine.c | 24 ++++++++---------------- src/union_room_chat.c | 3 +-- 10 files changed, 24 insertions(+), 53 deletions(-) diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 787dc4740..88e934759 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -1131,8 +1131,7 @@ static void CB2_InitSelectScreen(void) switch (gMain.state) { case 0: - if (sFactorySelectMons != NULL) - FREE_AND_SET_NULL(sFactorySelectMons); + TRY_FREE_AND_SET_NULL(sFactorySelectMons); SetHBlankCallback(NULL); SetVBlankCallback(NULL); CpuFill32(0, (void *)VRAM, VRAM_SIZE); diff --git a/src/easy_chat.c b/src/easy_chat.c index 734fd4f18..4d6006f1c 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -1672,8 +1672,7 @@ static bool8 InitEasyChatScreenStruct(u8 type, u16 *words, u8 displayedPersonTyp static void FreeEasyChatScreenStruct(void) { - if (sEasyChatScreen != NULL) - FREE_AND_SET_NULL(sEasyChatScreen); + TRY_FREE_AND_SET_NULL(sEasyChatScreen); } // Returns the function ID of the action to take as a result of player's input. @@ -3075,8 +3074,7 @@ static bool8 LoadEasyChatScreen(void) static void FreeEasyChatScreenControl(void) { - if (sScreenControl) - FREE_AND_SET_NULL(sScreenControl); + TRY_FREE_AND_SET_NULL(sScreenControl); } static void StartEasyChatFunction(u16 funcId) @@ -5573,8 +5571,7 @@ static bool8 InitEasyChatScreenWordData(void) static void FreeEasyChatScreenWordData(void) { - if (sWordData) - FREE_AND_SET_NULL(sWordData); + TRY_FREE_AND_SET_NULL(sWordData); } static void SetUnlockedEasyChatGroups(void) diff --git a/src/field_region_map.c b/src/field_region_map.c index 26ae736a6..adf5e4ed7 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -192,10 +192,7 @@ static void FieldUpdateRegionMap(void) { FreeRegionMapIconResources(); SetMainCallback2(sFieldRegionMapHandler->callback); - if (sFieldRegionMapHandler != NULL) - { - FREE_AND_SET_NULL(sFieldRegionMapHandler); - } + TRY_FREE_AND_SET_NULL(sFieldRegionMapHandler); FreeAllWindowBuffers(); } break; diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index a195bddcf..38f096af8 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -529,10 +529,8 @@ static void Task_Hof_TrySaveData(u8 taskId) UnsetBgTilemapBuffer(3); FreeAllWindowBuffers(); - if (sHofGfxPtr != NULL) - FREE_AND_SET_NULL(sHofGfxPtr); - if (sHofMonPtr != NULL) - FREE_AND_SET_NULL(sHofMonPtr); + TRY_FREE_AND_SET_NULL(sHofGfxPtr); + TRY_FREE_AND_SET_NULL(sHofMonPtr); DestroyTask(taskId); } @@ -773,10 +771,8 @@ static void Task_Hof_HandleExit(u8 taskId) ResetBgsAndClearDma3BusyFlags(0); DestroyTask(taskId); - if (sHofGfxPtr != NULL) - FREE_AND_SET_NULL(sHofGfxPtr); - if (sHofMonPtr != NULL) - FREE_AND_SET_NULL(sHofMonPtr); + TRY_FREE_AND_SET_NULL(sHofGfxPtr); + TRY_FREE_AND_SET_NULL(sHofMonPtr); StartCredits(); } @@ -1081,10 +1077,8 @@ static void Task_HofPC_HandleExit(u8 taskId) ResetBgsAndClearDma3BusyFlags(0); DestroyTask(taskId); - if (sHofGfxPtr != NULL) - FREE_AND_SET_NULL(sHofGfxPtr); - if (sHofMonPtr != NULL) - FREE_AND_SET_NULL(sHofMonPtr); + TRY_FREE_AND_SET_NULL(sHofGfxPtr); + TRY_FREE_AND_SET_NULL(sHofMonPtr); ReturnFromHallOfFamePC(); } diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 8f80b0b37..a0eca498e 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -5417,8 +5417,7 @@ static bool32 WaitForWallpaperGfxLoad(void) if (IsDma3ManagerBusyWithBgCopy()) return FALSE; - if (sStorage->wallpaperTiles != NULL) - FREE_AND_SET_NULL(sStorage->wallpaperTiles); + TRY_FREE_AND_SET_NULL(sStorage->wallpaperTiles); return TRUE; } diff --git a/src/pokenav.c b/src/pokenav.c index f9a6614a8..04e87f38c 100644 --- a/src/pokenav.c +++ b/src/pokenav.c @@ -557,8 +557,7 @@ void *GetSubstructPtr(u32 index) void FreePokenavSubstruct(u32 index) { - if (gPokenavResources->substructPtrs[index] != NULL) - FREE_AND_SET_NULL(gPokenavResources->substructPtrs[index]); + TRY_FREE_AND_SET_NULL(gPokenavResources->substructPtrs[index]); } u32 GetPokenavMode(void) diff --git a/src/region_map.c b/src/region_map.c index 5b3b8b008..a4db1cb04 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -2024,11 +2024,7 @@ static void CB_ExitFlyMap(void) { SetMainCallback2(CB2_ReturnToPartyMenuFromFlyMap); } - if (sFlyMap != NULL) - { - free(sFlyMap); - sFlyMap = NULL; - } + TRY_FREE_AND_SET_NULL(sFlyMap); FreeAllWindowBuffers(); } break; diff --git a/src/rotating_tile_puzzle.c b/src/rotating_tile_puzzle.c index 2e919f550..b8912aa3d 100644 --- a/src/rotating_tile_puzzle.c +++ b/src/rotating_tile_puzzle.c @@ -101,8 +101,7 @@ void FreeRotatingTilePuzzle(void) { u8 id; - if (sRotatingTilePuzzle != NULL) - FREE_AND_SET_NULL(sRotatingTilePuzzle); + TRY_FREE_AND_SET_NULL(sRotatingTilePuzzle); id = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0); ObjectEventClearHeldMovementIfFinished(&gObjectEvents[id]); diff --git a/src/slot_machine.c b/src/slot_machine.c index 828d0c161..4796a5684 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -1756,14 +1756,10 @@ static bool8 SlotTask_FreeDataStructures(struct Task *task) FREE_AND_SET_NULL(sImageTable_DigitalDisplay_Number); FREE_AND_SET_NULL(sImageTable_DigitalDisplay_Pokeball); FREE_AND_SET_NULL(sImageTable_DigitalDisplay_DPad); - if (sImageTable_ReelTimePikachu != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimePikachu); - if (sImageTable_ReelTimeMachineAntennae != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae); - if (sImageTable_ReelTimeMachine != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimeMachine); - if (sImageTable_BrokenReelTimeMachine != NULL) - FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimePikachu); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachine); + TRY_FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine); FREE_AND_SET_NULL(sMenuGfx); FREE_AND_SET_NULL(sSelectedPikaPowerTile); FREE_AND_SET_NULL(sReelOverlay_Tilemap); @@ -4178,8 +4174,7 @@ static void CreateReelTimePikachuSprite(void) static void DestroyReelTimePikachuSprite(void) { DestroySprite(&gSprites[sSlotMachine->reelTimePikachuSpriteId]); - if (sImageTable_ReelTimePikachu != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimePikachu); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimePikachu); } static void SpriteCB_ReelTimePikachu(struct Sprite *sprite) @@ -4308,10 +4303,8 @@ static void DestroyReelTimeMachineSprites(void) for (i = 0; i < ARRAY_COUNT(sSlotMachine->reelTimeMachineSpriteIds); i++) DestroySprite(&gSprites[sSlotMachine->reelTimeMachineSpriteIds[i]]); - if (sImageTable_ReelTimeMachineAntennae != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae); - if (sImageTable_ReelTimeMachine != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimeMachine); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachine); for (i = 0; i < ARRAY_COUNT(sSlotMachine->reelTimeNumberSpriteIds); i++) DestroySprite(&gSprites[sSlotMachine->reelTimeNumberSpriteIds[i]]); @@ -4328,8 +4321,7 @@ static void DestroyReelTimeShadowSprites(void) static void DestroyBrokenReelTimeMachineSprite(void) { DestroySprite(&gSprites[sSlotMachine->reelTimeBrokenMachineSpriteId]); - if (sImageTable_BrokenReelTimeMachine != NULL) - FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine); + TRY_FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine); } #define sDelayTimer data[0] diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 9890bc1f8..f8513b9f4 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -2160,8 +2160,7 @@ static bool32 IsDisplaySubtask0Active(void) static void FreeDisplay(void) { FreeSprites(); - if (sDisplay) - FREE_AND_SET_NULL(sDisplay); + TRY_FREE_AND_SET_NULL(sDisplay); FreeAllWindowBuffers(); gScanlineEffect.state = 3; From 284e46927a3584ec6ffdc0be61f237fee3773b6a Mon Sep 17 00:00:00 2001 From: sphericalice Date: Fri, 3 Jun 2022 15:56:11 +0100 Subject: [PATCH 41/65] Use the FREE_AND_SET_NULL macro where appropriate --- src/battle_anim_utility_funcs.c | 3 +-- src/battle_main.c | 9 +++------ src/evolution_scene.c | 6 ++---- src/mystery_gift_client.c | 3 +-- src/mystery_gift_server.c | 3 +-- src/mystery_gift_view.c | 6 ++---- 6 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index e2c674c57..aae8d6b5d 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -594,8 +594,7 @@ static void StatsChangeAnimation_Step3(u8 taskId) if (gTasks[taskId].data[6] == 1) gSprites[gTasks[taskId].data[7]].oam.priority++; - Free(sAnimStatsChangeData); - sAnimStatsChangeData = NULL; + FREE_AND_SET_NULL(sAnimStatsChangeData); DestroyAnimVisualTask(taskId); break; } diff --git a/src/battle_main.c b/src/battle_main.c index 682849af7..f61d5eaae 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -1498,8 +1498,7 @@ static void CB2_PreInitMultiBattle(void) gBattleTypeFlags = *savedBattleTypeFlags; gMain.savedCallback = *savedCallback; SetMainCallback2(CB2_InitBattleInternal); - Free(sMultiPartnerPartyBuffer); - sMultiPartnerPartyBuffer = NULL; + FREE_AND_SET_NULL(sMultiPartnerPartyBuffer); } } else if (gReceivedRemoteLinkPlayers == 0) @@ -1507,8 +1506,7 @@ static void CB2_PreInitMultiBattle(void) gBattleTypeFlags = *savedBattleTypeFlags; gMain.savedCallback = *savedCallback; SetMainCallback2(CB2_InitBattleInternal); - Free(sMultiPartnerPartyBuffer); - sMultiPartnerPartyBuffer = NULL; + FREE_AND_SET_NULL(sMultiPartnerPartyBuffer); } break; } @@ -1544,8 +1542,7 @@ static void CB2_PreInitIngamePlayerPartnerBattle(void) gBattleTypeFlags = *savedBattleTypeFlags; gMain.savedCallback = *savedCallback; SetMainCallback2(CB2_InitBattleInternal); - Free(sMultiPartnerPartyBuffer); - sMultiPartnerPartyBuffer = NULL; + FREE_AND_SET_NULL(sMultiPartnerPartyBuffer); } break; } diff --git a/src/evolution_scene.c b/src/evolution_scene.c index bde11ddb5..eb458d39d 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -816,8 +816,7 @@ static void Task_EvolutionScene(u8 taskId) DestroyTask(taskId); FreeMonSpritesGfx(); - Free(sEvoStructPtr); - sEvoStructPtr = NULL; + FREE_AND_SET_NULL(sEvoStructPtr); FreeAllWindowBuffers(); SetMainCallback2(gCB2_AfterEvolution); } @@ -1223,8 +1222,7 @@ static void Task_TradeEvolutionScene(u8 taskId) if (!IsTextPrinterActive(0)) { DestroyTask(taskId); - Free(sEvoStructPtr); - sEvoStructPtr = NULL; + FREE_AND_SET_NULL(sEvoStructPtr); gTextFlags.useAlternateDownArrow = 0; SetMainCallback2(gCB2_AfterEvolution); } diff --git a/src/mystery_gift_client.c b/src/mystery_gift_client.c index adf3ce8a6..eeebec5d6 100644 --- a/src/mystery_gift_client.c +++ b/src/mystery_gift_client.c @@ -44,8 +44,7 @@ u32 MysteryGiftClient_Run(u16 * endVal) { *endVal = sClient->param; MysteryGiftClient_Free(sClient); - Free(sClient); - sClient = NULL; + FREE_AND_SET_NULL(sClient); } return result; } diff --git a/src/mystery_gift_server.c b/src/mystery_gift_server.c index 0e0acb642..891870659 100644 --- a/src/mystery_gift_server.c +++ b/src/mystery_gift_server.c @@ -44,8 +44,7 @@ u32 MysterGiftServer_Run(u16 * endVal) { *endVal = sServer->param; MysteryGiftServer_Free(sServer); - Free(sServer); - sServer = NULL; + FREE_AND_SET_NULL(sServer); } return result; } diff --git a/src/mystery_gift_view.c b/src/mystery_gift_view.c index 3047a219e..ff34c8853 100644 --- a/src/mystery_gift_view.c +++ b/src/mystery_gift_view.c @@ -207,8 +207,7 @@ void WonderCard_Destroy(void) if (sWonderCardData != NULL) { *sWonderCardData = (struct WonderCardData){}; - Free(sWonderCardData); - sWonderCardData = NULL; + FREE_AND_SET_NULL(sWonderCardData); } } @@ -660,8 +659,7 @@ void WonderNews_Destroy(void) if (sWonderNewsData != NULL) { *sWonderNewsData = (struct WonderNewsData){}; - Free(sWonderNewsData); - sWonderNewsData = NULL; + FREE_AND_SET_NULL(sWonderNewsData); } } From af6bf17930204aa140243cbbbfbf0ff25a8cc353 Mon Sep 17 00:00:00 2001 From: sneed Date: Fri, 3 Jun 2022 21:04:14 +0300 Subject: [PATCH 42/65] Include config.h in siirtc.c --- src/siirtc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/siirtc.c b/src/siirtc.c index 5f4fc0a23..0e598f717 100644 --- a/src/siirtc.c +++ b/src/siirtc.c @@ -4,6 +4,7 @@ #include "gba/gba.h" #include "siirtc.h" +#include "config.h" #define STATUS_INTFE 0x02 // frequency interrupt enable #define STATUS_INTME 0x08 // per-minute interrupt enable From 34438e6bc4537dda15f8f1a15e5e23553a2bc854 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 1 Jun 2022 12:41:57 -0400 Subject: [PATCH 43/65] Continue documenting generic arguments --- data/battle_anim_scripts.s | 18 +- gflib/bg.h | 2 +- gflib/sprite.c | 9 +- gflib/sprite.h | 2 +- gflib/text.c | 8 +- include/battle_anim.h | 18 +- include/battle_interface.h | 2 +- include/constants/battle_string_ids.h | 2 + include/contest.h | 8 +- include/decompress.h | 2 +- include/field_camera.h | 8 +- include/field_player_avatar.h | 42 ++-- include/field_special_scene.h | 8 +- include/fldeff.h | 4 +- include/fldeff_misc.h | 4 +- include/gba/m4a_internal.h | 2 +- include/intro_credits_graphics.h | 6 +- include/link.h | 2 +- include/main_menu.h | 2 +- include/mauville_old_man.h | 4 +- include/menu.h | 12 +- include/overworld.h | 6 +- include/pokeball.h | 4 +- include/pokemon.h | 4 +- include/pokenav.h | 2 +- include/scanline_effect.h | 2 +- include/trade.h | 4 +- src/battle_anim_effects_1.c | 92 ++++---- src/battle_anim_effects_3.c | 2 +- src/battle_anim_fire.c | 274 +++++++++++++--------- src/battle_anim_mons.c | 8 +- src/battle_anim_psychic.c | 4 +- src/battle_anim_smokescreen.c | 66 +++--- src/battle_anim_throw.c | 8 +- src/battle_dome.c | 99 ++++---- src/battle_interface.c | 36 +-- src/battle_message.c | 6 +- src/battle_script_commands.c | 2 +- src/berry_blender.c | 2 +- src/contest.c | 24 +- src/credits.c | 6 +- src/decompress.c | 6 +- src/dodrio_berry_picking.c | 6 +- src/event_object_movement.c | 16 +- src/field_camera.c | 6 +- src/field_player_avatar.c | 146 ++++++------ src/field_special_scene.c | 202 +++++++++------- src/field_specials.c | 56 ++--- src/field_weather.c | 6 +- src/field_weather_effect.c | 57 +++-- src/intro_credits_graphics.c | 3 +- src/item_use.c | 44 ++-- src/link.c | 12 +- src/main_menu.c | 39 ++-- src/mauville_old_man.c | 2 +- src/menu.c | 8 +- src/mystery_event_script.c | 35 +-- src/overworld.c | 6 +- src/palette.c | 56 ++--- src/player_pc.c | 108 ++++----- src/pokeball.c | 155 ++++++++----- src/pokedex.c | 12 +- src/pokedex_area_region_map.c | 4 +- src/pokemon.c | 10 +- src/pokemon_jump.c | 3 +- src/pokemon_summary_screen.c | 128 +++++------ src/pokenav.c | 10 +- src/pokenav_list.c | 318 +++++++++++++------------- src/slot_machine.c | 40 ++-- src/trade.c | 8 +- src/tv.c | 4 +- 71 files changed, 1246 insertions(+), 1076 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 538286e15..eff53de84 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -5031,17 +5031,17 @@ Move_LIGHT_SCREEN: end SpecialScreenSparkle: - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 23, 0, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 23, 0, ANIM_ATTACKER, TRUE delay 6 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 31, -8, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 31, -8, ANIM_ATTACKER, TRUE delay 5 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 30, 20, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 30, 20, ANIM_ATTACKER, TRUE delay 7 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, -15, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, -15, ANIM_ATTACKER, TRUE delay 6 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 20, 10, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 20, 10, ANIM_ATTACKER, TRUE delay 6 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, 18, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, 18, ANIM_ATTACKER, TRUE return Move_MIRROR_COAT: @@ -5064,11 +5064,11 @@ Move_REFLECT: waitplaysewithpan SE_M_REFLECT, SOUND_PAN_ATTACKER, 15 createsprite gReflectWallSpriteTemplate, ANIM_ATTACKER, 1, 40, 0, ANIM_TAG_BLUE_LIGHT_WALL delay 20 - createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 30, 0, ANIM_ATTACKER, 1 + createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 30, 0, ANIM_ATTACKER, TRUE delay 7 - createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 19, -12, ANIM_ATTACKER, 1 + createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 19, -12, ANIM_ATTACKER, TRUE delay 7 - createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, 20, ANIM_ATTACKER, 1 + createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, 20, ANIM_ATTACKER, TRUE waitforvisualfinish delay 1 blendoff diff --git a/gflib/bg.h b/gflib/bg.h index d8b5a5404..02ff07369 100644 --- a/gflib/bg.h +++ b/gflib/bg.h @@ -76,7 +76,7 @@ s32 ChangeBgY(u8 bg, s32 value, u8 op); s32 ChangeBgY_ScreenOff(u8 bg, s32 value, u8 op); s32 GetBgY(u8 bg); void SetBgAffine(u8 bg, s32 srcCenterX, s32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle); -u8 Unused_AdjustBgMosaic(u8 a1, u8 a2); +u8 Unused_AdjustBgMosaic(u8 val, u8 mode); void SetBgTilemapBuffer(u8 bg, void *tilemap); void UnsetBgTilemapBuffer(u8 bg); void* GetBgTilemapBuffer(u8 bg); diff --git a/gflib/sprite.c b/gflib/sprite.c index f05fe76f2..e5bf89063 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -94,7 +94,7 @@ static void ApplyAffineAnimFrame(u8 matrixNum, struct AffineAnimFrameCmd *frameC static u8 IndexOfSpriteTileTag(u16 tag); static void AllocSpriteTileRange(u16 tag, u16 start, u16 count); static void DoLoadSpritePalette(const u16 *src, u16 paletteOffset); -static void UpdateSpriteMatrixAnchorPos(struct Sprite* sprite, s32 a1, s32 a2); +static void UpdateSpriteMatrixAnchorPos(struct Sprite*, s32, s32); typedef void (*AnimFunc)(struct Sprite *); typedef void (*AnimCmdFunc)(struct Sprite *); @@ -632,14 +632,11 @@ void DestroySprite(struct Sprite *sprite) } } -void ResetOamRange(u8 a, u8 b) +void ResetOamRange(u8 start, u8 end) { u8 i; - - for (i = a; i < b; i++) - { + for (i = start; i < end; i++) gMain.oamBuffer[i] = *(struct OamData *)&gDummyOamData; - } } void LoadOam(void) diff --git a/gflib/sprite.h b/gflib/sprite.h index e53737981..f7ef16532 100644 --- a/gflib/sprite.h +++ b/gflib/sprite.h @@ -270,7 +270,7 @@ u8 CreateSpriteAtEnd(const struct SpriteTemplate *template, s16 x, s16 y, u8 sub u8 CreateInvisibleSprite(void (*callback)(struct Sprite *)); u8 CreateSpriteAndAnimate(const struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority); void DestroySprite(struct Sprite *sprite); -void ResetOamRange(u8 a, u8 b); +void ResetOamRange(u8 start, u8 end); void LoadOam(void); void SetOamMatrix(u8 matrixNum, u16 a, u16 b, u16 c, u16 d); void CalcCenterToCornerVec(struct Sprite *sprite, u8 shape, u8 size, u8 affineMode); diff --git a/gflib/text.c b/gflib/text.c index 557c11704..c400c0582 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -326,14 +326,14 @@ void RunTextPrinters(void) { if (sTextPrinters[i].active) { - u16 temp = RenderFont(&sTextPrinters[i]); - switch (temp) + u16 renderCmd = RenderFont(&sTextPrinters[i]); + switch (renderCmd) { case RENDER_PRINT: CopyWindowToVram(sTextPrinters[i].printerTemplate.windowId, COPYWIN_GFX); case RENDER_UPDATE: - if (sTextPrinters[i].callback != 0) - sTextPrinters[i].callback(&sTextPrinters[i].printerTemplate, temp); + if (sTextPrinters[i].callback != NULL) + sTextPrinters[i].callback(&sTextPrinters[i].printerTemplate, renderCmd); break; case RENDER_FINISH: sTextPrinters[i].active = FALSE; diff --git a/include/battle_anim.h b/include/battle_anim.h index c42fa033b..c98766ea8 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -62,7 +62,7 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) bool8 IsContest(void); s8 BattleAnimAdjustPanning(s8 pan); s8 BattleAnimAdjustPanning2(s8 pan); -s16 KeepPanInRange(s16 a, int oldPan); +s16 KeepPanInRange(s16 panArg, int oldPan); s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan); void RelocateBattleBgPal(u16 paletteNum, u16 *dest, u32 offset, bool8 largeScreen); void ResetBattleAnimBg(bool8); @@ -91,14 +91,14 @@ bool8 AnimTranslateLinear(struct Sprite *sprite); void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite); u8 GetBattlerSpriteCoord2(u8 battlerId, u8 attributeId); void InitAnimLinearTranslationWithSpeed(struct Sprite *sprite); -u16 ArcTan2Neg(s16 a, s16 b); -void TrySetSpriteRotScale(struct Sprite *sprite, bool8 a2, s16 xScale, s16 yScale, u16 rotation); +u16 ArcTan2Neg(s16 x, s16 y); +void TrySetSpriteRotScale(struct Sprite *sprite, bool8 recalcCenterVector, s16 xScale, s16 yScale, u16 rotation); void RunStoredCallbackWhenAffineAnimEnds(struct Sprite *sprite); void TranslateSpriteLinearAndFlicker(struct Sprite *sprite); void SetSpriteCoordsToAnimAttackerCoords(struct Sprite *sprite); void RunStoredCallbackWhenAnimEnds(struct Sprite *sprite); -void SetAnimSpriteInitialXOffset(struct Sprite *sprite, s16 a2); -s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 a2); +void SetAnimSpriteInitialXOffset(struct Sprite *sprite, s16 xOffset); +s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr); u8 GetBattlerYCoordWithElevation(u8 battlerId); void WaitAnimForDuration(struct Sprite *sprite); void AnimTravelDiagonally(struct Sprite *sprite); @@ -129,7 +129,7 @@ void AnimLoadCompressedBgGfx(u32, const u32*, u32); void UpdateAnimBg3ScreenSize(bool8); void TranslateSpriteInGrowingCircle(struct Sprite *); void SetBattlerSpriteYOffsetFromYScale(u8 spriteId); -void PrepareEruptAnimTaskData(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7); +void PrepareEruptAnimTaskData(struct Task *task, u8 spriteId, s16 xScaleStart, s16 yScaleStart, s16 xScaleEnd, s16 yScaleEnd, u16 duration); u8 UpdateEruptAnimTask(struct Task *task); void DestroyAnimSpriteAndDisableBlend(struct Sprite *); void AnimLoadCompressedBgTilemap(u32 bgId, const void *src); @@ -146,7 +146,7 @@ void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union Aff bool8 RunAffineAnimFromTaskData(struct Task *task); void AnimThrowProjectile(struct Sprite *sprite); void GetBgDataForTransform(struct BattleAnimBgData *dest, u8 battlerId); -u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm); +u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm); void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite); void TradeMenuBouncePartySprites(struct Sprite *sprite); void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); @@ -209,7 +209,7 @@ void AnimTask_HorizontalShake(u8 taskId); void TryShinyAnimation(u8 battler, struct Pokemon *mon); u8 ItemIdToBallId(u16 itemId); u8 AnimateBallOpenParticles(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballId); -u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes, u8 ballId); +u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 spritePalNum, u32 selectedPalettes, u8 ballId); // battle_anim_utility_funcs.c void InitStatsChangeAnimation(u8); @@ -227,7 +227,7 @@ void AnimWaterPulseRing(struct Sprite *sprite); void DestroyAnimSpriteAfterTimer(struct Sprite *sprite); // battle_anim_smokescreen.c -u8 SmokescreenImpact(s16 x, s16 y, u8 a3); +u8 SmokescreenImpact(s16 x, s16 y, bool8 persist); u32 UnpackSelectedBattlePalettes(s16); diff --git a/include/battle_interface.h b/include/battle_interface.h index 6cc02c3fc..c4816e8da 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -71,7 +71,7 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority); void InitBattlerHealthboxCoords(u8 battler); void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent); void SwapHpBarsWithHpText(void); -u8 CreatePartyStatusSummarySprites(u8 battler, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart); +u8 CreatePartyStatusSummarySprites(u8 battler, struct HpAndStatus *partyInfo, bool8 skipPlayer, bool8 isBattleStart); void Task_HidePartyStatusSummary(u8 taskId); void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId); s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 unused); diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index d5d0698b9..ae18b61ef 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -599,4 +599,6 @@ #define B_MSG_REF_DRAW 7 #define B_MSG_REF_COMMENCE_BATTLE 8 +#define NUM_TRAPPING_MOVES 6 + #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/include/contest.h b/include/contest.h index e7acb5a11..c5dc232d5 100644 --- a/include/contest.h +++ b/include/contest.h @@ -340,11 +340,11 @@ void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame); u8 GetContestEntryEligibility(struct Pokemon *pkmn); void CalculateRound1Points(u8 contestCategory); bool8 IsSpeciesNotUnown(u16 species); -bool8 Contest_IsMonsTurnDisabled(u8 a); +bool8 Contest_IsMonsTurnDisabled(u8 contestant); void SaveLinkContestResults(void); -void SortContestants(bool8 a); -void SetContestantEffectStringID(u8 a, u8 b); -void SetContestantEffectStringID2(u8 a, u8 b); +void SortContestants(bool8 useRanking); +void SetContestantEffectStringID(u8 contestant, u8 effectStringId); +void SetContestantEffectStringID2(u8 contestant, u8 effectStringId); void SetStartledString(u8 contestant, u8 jam); void MakeContestantNervous(u8 p); s8 Contest_GetMoveExcitement(u16 move); diff --git a/include/decompress.h b/include/decompress.h index 02412defb..14906211c 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -13,7 +13,7 @@ void LoadCompressedSpriteSheetOverrideBuffer(const struct CompressedSpriteSheet bool8 LoadCompressedSpriteSheetUsingHeap(const struct CompressedSpriteSheet* src); void LoadCompressedSpritePalette(const struct CompressedSpritePalette *src); -void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer); +void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *src, void *buffer); bool8 LoadCompressedSpritePaletteUsingHeap(const struct CompressedSpritePalette *src); void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void* buffer, s32 species); diff --git a/include/field_camera.h b/include/field_camera.h index b245fca84..6e8af1a53 100644 --- a/include/field_camera.h +++ b/include/field_camera.h @@ -17,14 +17,14 @@ extern u16 gTotalCameraPixelOffsetY; void DrawWholeMapView(void); void CurrentMapDrawMetatileAt(int x, int y); -void GetCameraOffsetWithPan(s16 *a0, s16 *a1); +void GetCameraOffsetWithPan(s16 *x, s16 *y); void DrawDoorMetatileAt(int x, int y, u16 *arr); void ResetFieldCamera(void); void ResetCameraUpdateInfo(void); -u32 InitCameraUpdateCallback(u8 a); +u32 InitCameraUpdateCallback(u8 trackedSpriteId); void CameraUpdate(void); -void SetCameraPanningCallback(void (*a)(void)); -void SetCameraPanning(s16 a, s16 b); +void SetCameraPanningCallback(void (*callback)(void)); +void SetCameraPanning(s16 horizontal, s16 vertical); void InstallCameraPanAheadCallback(void); void UpdateCameraPanning(void); void FieldUpdateBgTilemapScroll(void); diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index d382de08c..2bf2df269 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -11,29 +11,29 @@ void PlayerGetDestCoords(s16 *, s16 *); u8 GetPlayerFacingDirection(void); u8 GetPlayerMovementDirection(void); u8 PlayerGetCopyableMovement(void); -void PlayerWalkNormal(u8); -void PlayerWalkFast(u8); -void PlayerRideWaterCurrent(u8); -void PlayerWalkFaster(u8); -void PlayerOnBikeCollide(u8); -void PlayerFaceDirection(u8 a); -void PlayerTurnInPlace(u8 a); -void PlayerJumpLedge(u8 a); -void PlayerIdleWheelie(u8 a); -void PlayerStartWheelie(u8 a); -void PlayerEndWheelie(u8 a); -void PlayerStandingHoppingWheelie(u8 a); -void PlayerMovingHoppingWheelie(u8 a); -void PlayerLedgeHoppingWheelie(u8 a); -void PlayerAcroTurnJump(u8 a); -void PlayerSetAnimId(u8 a, u8 b); +void PlayerWalkNormal(u8 direction); +void PlayerWalkFast(u8 direction); +void PlayerRideWaterCurrent(u8 direction); +void PlayerWalkFaster(u8 direction); +void PlayerOnBikeCollide(u8 direction); +void PlayerFaceDirection(u8 direction); +void PlayerTurnInPlace(u8 direction); +void PlayerJumpLedge(u8 direction); +void PlayerIdleWheelie(u8 direction); +void PlayerStartWheelie(u8 direction); +void PlayerEndWheelie(u8 direction); +void PlayerStandingHoppingWheelie(u8 direction); +void PlayerMovingHoppingWheelie(u8 direction); +void PlayerLedgeHoppingWheelie(u8 direction); +void PlayerAcroTurnJump(u8 direction); +void PlayerSetAnimId(u8 movementActionId, u8 copyableMovement); bool8 IsPlayerCollidingWithFarawayIslandMew(u8 direction); void PlayerOnBikeCollideWithFarawayIslandMew(u8 direction); -u8 CheckForObjectEventCollision(struct ObjectEvent *a, s16 b, s16 c, u8 d, u8 e); +u8 CheckForObjectEventCollision(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior); u8 PlayerGetElevation(void); -void SetPlayerAvatarTransitionFlags(u16 a); +void SetPlayerAvatarTransitionFlags(u16 transitionFlags); void CancelPlayerForcedMovement(void); -void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d); +void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender); void PlayerFreeze(void); void StopPlayerAvatar(void); void SetSpinStartFacingDir(u8); @@ -41,8 +41,8 @@ void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr); u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8); void SetPlayerAvatarFieldMove(void); u8 GetPlayerAvatarGraphicsIdByCurrentState(void); -void SetPlayerAvatarStateMask(u8 a); -u8 GetPlayerAvatarGraphicsIdByStateId(u8 a); +void SetPlayerAvatarStateMask(u8 flags); +u8 GetPlayerAvatarGraphicsIdByStateId(u8 state); u8 GetJumpSpecialMovementAction(u32); bool8 PartyHasMonWithSurf(void); bool8 IsPlayerFacingSurfableFishableWater(void); diff --git a/include/field_special_scene.h b/include/field_special_scene.h index 3f701f41b..111723c83 100644 --- a/include/field_special_scene.h +++ b/include/field_special_scene.h @@ -1,14 +1,8 @@ #ifndef GUARD_FIELD_SPECIAL_SCENE_H #define GUARD_FIELD_SPECIAL_SCENE_H -s16 GetTruckCameraBobbingY(int a1); -s16 GetTruckBoxMovement(int a1); -void Task_Truck1(u8 taskId); -void Task_Truck2(u8 taskId); -void Task_Truck3(u8 taskId); -void Task_HandleTruckSequence(u8 taskId); void ExecuteTruckSequence(void); -void EndTruckSequence(u8); +void EndTruckSequence(u8 taskId); void FieldCB_ShowPortholeView(void); #endif // GUARD_FIELD_SPECIAL_SCENE_H diff --git a/include/fldeff.h b/include/fldeff.h index 597ce6f47..0ad0e3d60 100644 --- a/include/fldeff.h +++ b/include/fldeff.h @@ -25,8 +25,8 @@ void ChooseMonForSoftboiled(u8 taskId); // flash bool8 SetUpFieldMove_Flash(void); void CB2_DoChangeMap(void); -bool8 GetMapPairFadeToType(u8 a1, u8 a2); -bool8 GetMapPairFadeFromType(u8 a1, u8 a2); +bool8 GetMapPairFadeToType(u8 _fromType, u8 _toType); +bool8 GetMapPairFadeFromType(u8 _fromType, u8 _toType); // strength bool8 SetUpFieldMove_Strength(void); diff --git a/include/fldeff_misc.h b/include/fldeff_misc.h index 38dec23b0..61078466d 100644 --- a/include/fldeff_misc.h +++ b/include/fldeff_misc.h @@ -1,8 +1,8 @@ #ifndef GUARD_FLDEFF_MISC_H #define GUARD_FLDEFF_MISC_H -void ComputerScreenOpenEffect(u16 a0, u16 a1, u8 a2); -void ComputerScreenCloseEffect(u16 a0, u16 a1, u8 a2); +void ComputerScreenOpenEffect(u16 increment, u16 unused, u8 priority); +void ComputerScreenCloseEffect(u16 increment, u16 unused, u8 priority); bool8 IsComputerScreenOpenEffectActive(void); bool8 IsComputerScreenCloseEffectActive(void); bool8 SetUpFieldMove_SecretPower(void); diff --git a/include/gba/m4a_internal.h b/include/gba/m4a_internal.h index a057c2da6..40a25ba05 100644 --- a/include/gba/m4a_internal.h +++ b/include/gba/m4a_internal.h @@ -423,7 +423,7 @@ void Clear64byte(void *addr); void SoundInit(struct SoundInfo *soundInfo); void MPlayExtender(struct CgbChannel *cgbChans); void m4aSoundMode(u32 mode); -void MPlayOpen(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track, u8 a3); +void MPlayOpen(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *tracks, u8 trackCount); void CgbSound(void); void CgbOscOff(u8); void CgbModVol(struct CgbChannel *chan); diff --git a/include/intro_credits_graphics.h b/include/intro_credits_graphics.h index bed30ffe8..c6f4a73c5 100644 --- a/include/intro_credits_graphics.h +++ b/include/intro_credits_graphics.h @@ -33,11 +33,11 @@ extern const struct CompressedSpriteSheet gSpriteSheet_CreditsRivalBrendan[]; extern const struct CompressedSpriteSheet gSpriteSheet_CreditsRivalMay[]; extern const struct SpritePalette gSpritePalettes_Credits[]; -void LoadIntroPart2Graphics(u8 scene); -void SetIntroPart2BgCnt(u8 a); +void LoadIntroPart2Graphics(u8 scenery); +void SetIntroPart2BgCnt(u8 scenery); void LoadCreditsSceneGraphics(u8); void SetCreditsSceneBgCnt(u8); -u8 CreateBicycleBgAnimationTask(u8 a, u16 b, u16 c, u16 d); +u8 CreateBicycleBgAnimationTask(u8 mode, u16 bg1Speed, u16 bg2Speed, u16 bg3Speed); void CycleSceneryPalette(u8); u8 CreateIntroBrendanSprite(s16 x, s16 y); u8 CreateIntroMaySprite(s16 x, s16 y); diff --git a/include/link.h b/include/link.h index 96a76e120..120c25784 100644 --- a/include/link.h +++ b/include/link.h @@ -300,7 +300,7 @@ void LocalLinkPlayerToBlock(void); void LinkPlayerFromBlock(u32 who); bool32 Link_AnyPartnersPlayingFRLG_JP(void); void ResetLinkPlayerCount(void); -void SaveLinkPlayers(u8 a0); +void SaveLinkPlayers(u8 playerCount); void SetWirelessCommType0(void); bool32 IsLinkRecvQueueAtOverworldMax(void); diff --git a/include/main_menu.h b/include/main_menu.h index 1944f4ecc..5f92719d5 100644 --- a/include/main_menu.h +++ b/include/main_menu.h @@ -2,6 +2,6 @@ #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); #endif // GUARD_MAIN_MENU_H diff --git a/include/mauville_old_man.h b/include/mauville_old_man.h index b22294f1b..9e5986ee8 100644 --- a/include/mauville_old_man.h +++ b/include/mauville_old_man.h @@ -7,8 +7,8 @@ void SetMauvilleOldMan(void); u8 GetCurrentMauvilleOldMan(void); void SetMauvilleOldManObjEventGfx(void); void SanitizeMauvilleOldManForRuby(OldMan *dest); -void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 r1, u32 r6); -void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 unused, u32 a2); +void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language); +void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 version, u32 language); void ResetMauvilleOldManFlag(void); #endif // GUARD_MAUVILLE_OLD_MAN_H diff --git a/include/menu.h b/include/menu.h index 9a940a48a..c38e87cbd 100644 --- a/include/menu.h +++ b/include/menu.h @@ -57,8 +57,8 @@ void DisplayYesNoMenuDefaultYes(void); u32 GetPlayerTextSpeed(void); u8 GetPlayerTextSpeedDelay(void); void Menu_LoadStdPalAt(u16 offset); -void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16)); -void BgDmaFill(u32 bg, u8 a1, int a2, int a3); +void AddTextPrinterWithCallbackForMessage(bool8 canSpeedUp, void (*callback)(struct TextPrinterTemplate *, u16)); +void BgDmaFill(u32 bg, u8 value, int offset, int size); void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str); void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram); void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock); @@ -69,7 +69,7 @@ u8 InitMenuInUpperLeftCornerNormal(u8 windowId, u8 numItems, u8 initialCursorPos u8 Menu_GetCursorPos(void); s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); -void BlitMenuInfoIcon(u8 winId, u8 a2, u16 x, u16 y); +void BlitMenuInfoIcon(u8 windowId, u8 iconId, u16 x, u16 y); void ResetTempTileDataBuffers(void); void *DecompressAndCopyTileDataToVram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); bool8 FreeTempTileDataBuffersIfPossible(void); @@ -81,14 +81,14 @@ s8 ProcessMenuInput_other(void); void DoScheduledBgTilemapCopiesToVram(void); void ClearScheduledBgCopiesToVram(void); void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str); -void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 a2, u8 a3); +void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum); void PrintMenuActionTextsInUpperLeftCorner(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram); void *malloc_and_decompress(const void *src, u32 *sizeOut); u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode); void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); -void PrintMenuActionTexts(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8); -void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u8 itemCount2, const struct MenuAction *strs, const u8 *a8); +void PrintMenuActionTexts(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds); +void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *menuActions, const u8 *actionIds); u8 InitMenuActionGrid(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos); u8 ChangeMenuGridCursorPosition(s8 deltaX, s8 deltaY); u8 GetStartMenuWindowId(void); diff --git a/include/overworld.h b/include/overworld.h index b8794ea70..adaa6aad0 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -77,7 +77,7 @@ void SetWarpDestinationToMapWarp(s8 mapGroup, s8 mapNum, s8 warpId); void SetDynamicWarp(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId); void SetDynamicWarpWithCoords(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetWarpDestinationToDynamicWarp(u8 unused); -void SetWarpDestinationToHealLocation(u8 a1); +void SetWarpDestinationToHealLocation(u8 healLocationId); void SetWarpDestinationToLastHealLocation(void); void SetLastHealLocationWarp(u8 healLocationId); void UpdateEscapeWarp(s16 x, s16 y); @@ -86,7 +86,7 @@ void SetWarpDestinationToEscapeWarp(void); void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetWarpDestinationToFixedHoleWarp(s16 x, s16 y); -void SetContinueGameWarpToHealLocation(u8 a1); +void SetContinueGameWarpToHealLocation(u8 healLocationId); void SetContinueGameWarpToDynamicWarp(int unused); const struct MapConnection *GetMapConnection(u8 dir); bool8 SetDiveWarpEmerge(u16 x, u16 y); @@ -130,7 +130,7 @@ void CB1_Overworld(void); void CB2_OverworldBasic(void); void CB2_Overworld(void); void SetMainCallback1(void (*cb)(void)); -void SetUnusedCallback(void *a0); +void SetUnusedCallback(void *func); void CB2_NewGame(void); void CB2_WhiteOut(void); void CB2_LoadMap(void); diff --git a/include/pokeball.h b/include/pokeball.h index 297788db1..1149791b8 100644 --- a/include/pokeball.h +++ b/include/pokeball.h @@ -34,8 +34,8 @@ extern const struct SpriteTemplate gBallSpriteTemplates[]; #define POKEBALL_OPPONENT_SENDOUT 0xFE u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow); -void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battler, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species); -u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h); +void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 delay, u32 fadePalettes, u16 species); +u8 CreateTradePokeballSprite(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 delay, u32 fadePalettes); void StartHealthboxSlideIn(u8 battler); void DoHitAnimHealthboxEffect(u8 battler); void LoadBallGfx(u8 ballId); diff --git a/include/pokemon.h b/include/pokemon.h index 7885c2ac5..0da71e78e 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -381,11 +381,11 @@ u16 SpeciesToNationalPokedexNum(u16 species); u16 SpeciesToHoennPokedexNum(u16 species); u16 HoennToNationalOrder(u16 hoennNum); u16 SpeciesToCryId(u16 species); -void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4); +void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, bool8 isFrontPic); void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies); u8 GetPlayerFlankId(void); u16 GetLinkTrainerFlankId(u8 id); -s32 GetBattlerMultiplayerId(u16 a1); +s32 GetBattlerMultiplayerId(u16 id); u8 GetTrainerEncounterMusicId(u16 trainerOpponentId); u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex); void AdjustFriendship(struct Pokemon *mon, u8 event); diff --git a/include/pokenav.h b/include/pokenav.h index 07beae957..593c68489 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -412,7 +412,7 @@ int GetNumberRegistered(void); struct PokenavMatchCallEntry *GetMatchCallList(void); u16 GetMatchCallMapSec(int); bool32 ShouldDrawRematchPokeballIcon(int index); -void ClearRematchPokeballIcon(u16 windowId, u32 a1); +void ClearRematchPokeballIcon(u16 windowId, u32 tileOffset); int GetMatchCallTrainerPic(int index); const u8 *GetMatchCallFlavorText(int index, int textType); const u8 *GetMatchCallMessageText(int index, bool8 *newRematchRequest); diff --git a/include/scanline_effect.h b/include/scanline_effect.h index 5bd8b5546..ae534d969 100644 --- a/include/scanline_effect.h +++ b/include/scanline_effect.h @@ -43,6 +43,6 @@ void ScanlineEffect_Stop(void); void ScanlineEffect_Clear(void); void ScanlineEffect_SetParams(struct ScanlineEffectParams); void ScanlineEffect_InitHBlankDmaTransfer(void); -u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 a7); +u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 applyBattleBgOffsets); #endif // GUARD_SCANLINE_EFFECT_H diff --git a/include/trade.h b/include/trade.h index a0cb320a8..27b5ee8bd 100644 --- a/include/trade.h +++ b/include/trade.h @@ -12,8 +12,8 @@ extern const struct WindowTemplate gTradeEvolutionSceneYesNoWindowTemplate; s32 GetGameProgressForLinkTrade(void); void CB2_StartCreateTradeMenu(void); void CB2_LinkTrade(void); -int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData a0, u16, u16, u8); -int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData a0, struct RfuGameCompatibilityData a1, u16 a2, u16 a3, u8 a4, u16 a5, u8 a6); +int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 species2, u16 species, bool8 isEventLegal); +int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, bool8 isEventLegal); int CanSpinTradeMon(struct Pokemon*, u16); void InitTradeSequenceBgGpuRegs(void); void LinkTradeDrawWindow(void); diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 76868342f..cd9cb8b30 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -128,7 +128,7 @@ static void AnimHornHit_Step(struct Sprite *); static void AnimSuperFang(struct Sprite *); static void AnimWavyMusicNotes(struct Sprite *); static void AnimWavyMusicNotes_Step(struct Sprite *); -static void AnimWavyMusicNotesGetNextPos(s16, s16, s16 *, s16 *, s8); +static void AnimWavyMusicNotes_CalcVelocity(s16, s16, s16 *, s16 *, s8); static void AnimFlyingMusicNotes(struct Sprite *); static void AnimFlyingMusicNotes_Step(struct Sprite *); static void AnimBellyDrumHand(struct Sprite *); @@ -5279,79 +5279,87 @@ void AnimTask_MusicNotesClearRainbowBlend(u8 taskId) DestroyAnimVisualTask(taskId); } +#define sMoveTimer data[0] +#define sBlendTableIdx data[1] +#define sBlendTimer data[2] +#define sBlendCycleTime data[3] +#define sX data[4] +#define sY data[5] +#define sVelocX data[6] +#define sVelocY data[7] + static void AnimWavyMusicNotes(struct Sprite* sprite) { u8 index; - u8 a; - u8 b; + u8 x, y; SetSpriteCoordsToAnimAttackerCoords(sprite); StartSpriteAnim(sprite, gBattleAnimArgs[0]); if ((index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[gBattleAnimArgs[1]][0])) != 0xFF) sprite->oam.paletteNum = index; - sprite->data[1] = gBattleAnimArgs[1]; - sprite->data[2] = 0; - sprite->data[3] = gBattleAnimArgs[2]; + sprite->sBlendTableIdx = gBattleAnimArgs[1]; + sprite->sBlendTimer = 0; + sprite->sBlendCycleTime = gBattleAnimArgs[2]; if (IsContest()) { - a = 48; - b = 40; + x = 48; + y = 40; } else { - a = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); - b = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); + x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); } - sprite->data[4] = sprite->x << 4; - sprite->data[5] = sprite->y << 4; - AnimWavyMusicNotesGetNextPos(a - sprite->x, b - sprite->y, &sprite->data[6], &sprite->data[7], 40); + sprite->sX = sprite->x << 4; + sprite->sY = sprite->y << 4; + AnimWavyMusicNotes_CalcVelocity(x - sprite->x, y - sprite->y, &sprite->sVelocX, &sprite->sVelocY, 40); sprite->callback = AnimWavyMusicNotes_Step; } -static void AnimWavyMusicNotesGetNextPos(s16 a, s16 b, s16* c, s16* d, s8 e) +static void AnimWavyMusicNotes_CalcVelocity(s16 x, s16 y, s16* velocX, s16* velocY, s8 xSpeedFactor) { - int f; - int g; - if (a < 0) - e = -e; + int x2; + int time; + if (x < 0) + xSpeedFactor = -xSpeedFactor; - f = a << 8; - g = f / e; - if (g == 0) - g = 1; + x2 = x << 8; + time = x2 / xSpeedFactor; + if (time == 0) + time = 1; - *c = f / g; - *d = (b << 8) / g; + *velocX = x2 / time; + *velocY = (y << 8) / time; } static void AnimWavyMusicNotes_Step(struct Sprite* sprite) { - s16 y, yDelta; + s16 y, trigIdx; u8 index; - sprite->data[0]++; - yDelta = sprite->data[0] * 5 - ((sprite->data[0] * 5 / 256) << 8); - sprite->data[4] += sprite->data[6]; - sprite->data[5] += sprite->data[7]; - sprite->x = sprite->data[4] >> 4; - sprite->y = sprite->data[5] >> 4; - sprite->y2 = Sin(yDelta, 15); + sprite->sMoveTimer++; + trigIdx = sprite->sMoveTimer * 5 - ((sprite->sMoveTimer * 5 / 256) << 8); + sprite->sX += sprite->sVelocX; + sprite->sY += sprite->sVelocY; + sprite->x = sprite->sX >> 4; + sprite->y = sprite->sY >> 4; + sprite->y2 = Sin(trigIdx, 15); y = sprite->y; - if (sprite->x < -16 || sprite->x > 256 || y < -16 || y > 128) + if (sprite->x < -16 || sprite->x > DISPLAY_WIDTH + 16 || y < -16 || y > DISPLAY_HEIGHT - 32) { DestroySpriteAndMatrix(sprite); } else { - if (sprite->data[3] && ++sprite->data[2] > sprite->data[3]) + if (sprite->sBlendCycleTime && ++sprite->sBlendTimer > sprite->sBlendCycleTime) { - sprite->data[2] = 0; - if (++sprite->data[1] > 3) - sprite->data[1] = 0; + sprite->sBlendTimer = 0; + if (++sprite->sBlendTableIdx > (int)ARRAY_COUNT(gParticlesColorBlendTable) - 1) + sprite->sBlendTableIdx = 0; - index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[sprite->data[1]][0]); + index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[sprite->sBlendTableIdx][0]); if (index != 0xFF) sprite->oam.paletteNum = index; } @@ -5467,7 +5475,7 @@ void SetSpriteNextToMonHead(u8 battler, struct Sprite* sprite) static void AnimThoughtBubble(struct Sprite* sprite) { - u8 a; + u8 animNum; u8 battler; if (gBattleAnimArgs[0] == 0) battler = gBattleAnimAttacker; @@ -5475,10 +5483,10 @@ static void AnimThoughtBubble(struct Sprite* sprite) battler = gBattleAnimTarget; SetSpriteNextToMonHead(battler, sprite); - a = (GetBattlerSide(battler) == B_SIDE_PLAYER) ? 0 : 1; + animNum = (GetBattlerSide(battler) == B_SIDE_PLAYER) ? 0 : 1; sprite->data[0] = gBattleAnimArgs[1]; - sprite->data[1] = a + 2; - StartSpriteAnim(sprite, a); + sprite->data[1] = animNum + 2; + StartSpriteAnim(sprite, animNum); StoreSpriteCallbackInData6(sprite, AnimThoughtBubble_Step); sprite->callback = RunStoredCallbackWhenAnimEnds; } diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index fcd594db5..3b4f6729f 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -1213,7 +1213,7 @@ void AnimTask_SmokescreenImpact(u8 taskId) SmokescreenImpact( GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + 8, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + 8, - 0); + FALSE); DestroyAnimVisualTask(taskId); } diff --git a/src/battle_anim_fire.c b/src/battle_anim_fire.c index 8ecb60713..b523a3771 100644 --- a/src/battle_anim_fire.c +++ b/src/battle_anim_fire.c @@ -26,18 +26,18 @@ static void AnimFireCross(struct Sprite *); static void AnimFireSpiralOutward(struct Sprite *); static void AnimFireSpiralOutward_Step1(struct Sprite *); static void AnimFireSpiralOutward_Step2(struct Sprite *); -static void AnimTask_EruptionLaunchRocks_Step(u8 taskId); -static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3); +static void AnimTask_EruptionLaunchRocks_Step(u8); +static void CreateEruptionLaunchRocks(u8, u8, u8); static void AnimEruptionLaunchRock(struct Sprite *); -static u16 GetEruptionLaunchRockInitialYPos(u8 spriteId); -static void InitEruptionLaunchRockCoordData(struct Sprite *sprite, s16 x, s16 y); +static u16 GetEruptionLaunchRockInitialYPos(u8); +static void InitEruptionLaunchRockCoordData(struct Sprite *, s16, s16); static void UpdateEruptionLaunchRockPos(struct Sprite *); static void AnimEruptionFallingRock(struct Sprite *); static void AnimEruptionFallingRock_Step(struct Sprite *); static void AnimWillOWispOrb(struct Sprite *); static void AnimWillOWispOrb_Step(struct Sprite *); static void AnimWillOWispFire(struct Sprite *); -static void AnimTask_MoveHeatWaveTargets_Step(u8 taskId); +static void AnimTask_MoveHeatWaveTargets_Step(u8); static const union AnimCmd sAnim_FireSpiralSpread_0[] = { @@ -355,7 +355,7 @@ const struct SpriteTemplate gEruptionLaunchRockSpriteTemplate = .callback = AnimEruptionLaunchRock, }; -static const s16 sEruptionLaunchRockCoords[][2] = +static const s16 sEruptionLaunchRockSpeeds[][2] = { {-2, -5}, {-1, -1}, @@ -770,22 +770,43 @@ static void AnimFireSpiralOutward_Step2(struct Sprite *sprite) DestroyAnimSprite(sprite); } +#define IDX_ACTIVE_SPRITES 6 // Used by the sprite callback to modify the number of active sprites + +#define tState data[0] +#define tTimer1 data[1] +#define tTimer2 data[2] +#define tTimer3 data[3] +#define tAttackerY data[4] +#define tAttackerSide data[5] +#define tActiveSprites data[IDX_ACTIVE_SPRITES] +// data[8]-data[15] used by PrepareEruptAnimTaskData / UpdateEruptAnimTask +#define tAttackerSpriteId data[15] + +#define sSpeedDelay data[0] +#define sLaunchStage data[1] +#define sX data[2] +#define sY data[3] +#define sSpeedX data[4] +#define sSpeedY data[5] +#define sTaskId data[6] +#define sActiveSpritesIdx data[7] + // Animates first stage of Eruption where the attacker squishes and launches rocks away from themself void AnimTask_EruptionLaunchRocks(u8 taskId) { struct Task *task = &gTasks[taskId]; - task->data[15] = GetAnimBattlerSpriteId(ANIM_ATTACKER); + task->tAttackerSpriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); - task->data[0] = 0; - task->data[1] = 0; - task->data[2] = 0; - task->data[3] = 0; - task->data[4] = gSprites[task->data[15]].y; - task->data[5] = GetBattlerSide(gBattleAnimAttacker); - task->data[6] = 0; + task->tState = 0; + task->tTimer1 = 0; + task->tTimer2 = 0; + task->tTimer3 = 0; + task->tAttackerY = gSprites[task->tAttackerSpriteId].y; + task->tAttackerSide = GetBattlerSide(gBattleAnimAttacker); + task->tActiveSprites = 0; - PrepareBattlerSpriteForRotScale(task->data[15], ST_OAM_OBJ_NORMAL); + PrepareBattlerSpriteForRotScale(task->tAttackerSpriteId, ST_OAM_OBJ_NORMAL); task->func = AnimTask_EruptionLaunchRocks_Step; } @@ -794,102 +815,102 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) { struct Task *task = &gTasks[taskId]; - switch (task->data[0]) + switch (task->tState) { case 0: - PrepareEruptAnimTaskData(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 32); - task->data[0]++; + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0x100, 0x100, 0xE0, 0x200, 32); + task->tState++; case 1: - if (++task->data[1] > 1) + if (++task->tTimer1 > 1) { - task->data[1] = 0; + task->tTimer1 = 0; - if (++task->data[2] & 0x1) - gSprites[task->data[15]].x2 = 3; + if (++task->tTimer2 & 1) + gSprites[task->tAttackerSpriteId].x2 = 3; else - gSprites[task->data[15]].x2 = -3; + gSprites[task->tAttackerSpriteId].x2 = -3; } - if (task->data[5] != B_SIDE_PLAYER) + if (task->tAttackerSide != B_SIDE_PLAYER) { - if (++task->data[3] > 4) + if (++task->tTimer3 > 4) { - task->data[3] = 0; - gSprites[task->data[15]].y++; + task->tTimer3 = 0; + gSprites[task->tAttackerSpriteId].y++; } } if(!UpdateEruptAnimTask(task)) { - SetBattlerSpriteYOffsetFromYScale(task->data[15]); - gSprites[task->data[15]].x2 = 0; + SetBattlerSpriteYOffsetFromYScale(task->tAttackerSpriteId); + gSprites[task->tAttackerSpriteId].x2 = 0; - task->data[1] = 0; - task->data[2] = 0; - task->data[3] = 0; - task->data[0]++; + task->tTimer1 = 0; + task->tTimer2 = 0; + task->tTimer3 = 0; + task->tState++; } break; case 2: - if (++task->data[1] > 4) + if (++task->tTimer1 > 4) { - if (task->data[5] != B_SIDE_PLAYER) - PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xF0, 6); + if (task->tAttackerSide != B_SIDE_PLAYER) + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0xE0, 0x200, 0x180, 0xF0, 6); else - PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xC0, 6); + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0xE0, 0x200, 0x180, 0xC0, 6); - task->data[1] = 0; - task->data[0]++; + task->tTimer1 = 0; + task->tState++; } break; case 3: if (!UpdateEruptAnimTask(task)) { - CreateEruptionLaunchRocks(task->data[15], taskId, 6); - task->data[0]++; + CreateEruptionLaunchRocks(task->tAttackerSpriteId, taskId, IDX_ACTIVE_SPRITES); + task->tState++; } break; case 4: - if (++task->data[1] > 1) + if (++task->tTimer1 > 1) { - task->data[1] = 0; + task->tTimer1 = 0; - if (++task->data[2] & 1) - gSprites[task->data[15]].y2 += 3; + if (++task->tTimer2 & 1) + gSprites[task->tAttackerSpriteId].y2 += 3; else - gSprites[task->data[15]].y2 -= 3; + gSprites[task->tAttackerSpriteId].y2 -= 3; } - if (++task->data[3] > 0x18) + if (++task->tTimer3 > 24) { - if (task->data[5] != B_SIDE_PLAYER) - PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xF0, 0x100, 0x100, 8); + if (task->tAttackerSide != B_SIDE_PLAYER) + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0x180, 0xF0, 0x100, 0x100, 8); else - PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xC0, 0x100, 0x100, 8); + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0x180, 0xC0, 0x100, 0x100, 8); - if (task->data[2] & 1) - gSprites[task->data[15]].y2 -= 3; + if (task->tTimer2 & 1) + gSprites[task->tAttackerSpriteId].y2 -= 3; - task->data[1] = 0; - task->data[2] = 0; - task->data[3] = 0; - task->data[0]++; + task->tTimer1 = 0; + task->tTimer2 = 0; + task->tTimer3 = 0; + task->tState++; } break; case 5: - if (task->data[5] != B_SIDE_PLAYER) - gSprites[task->data[15]].y--; + if (task->tAttackerSide != B_SIDE_PLAYER) + gSprites[task->tAttackerSpriteId].y--; if (!UpdateEruptAnimTask(task)) { - gSprites[task->data[15]].y = task->data[4]; - ResetSpriteRotScale(task->data[15]); - task->data[2] = 0; - task->data[0]++; + gSprites[task->tAttackerSpriteId].y = task->tAttackerY; + ResetSpriteRotScale(task->tAttackerSpriteId); + task->tTimer2 = 0; + task->tState++; } break; case 6: - if (!task->data[6]) + if (task->tActiveSprites == 0) DestroyAnimVisualTask(taskId); break; default: @@ -897,7 +918,7 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) } } -static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3) +static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 activeSpritesIdx) { u16 i, j; s8 sign; @@ -907,12 +928,12 @@ static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3) if(!GetBattlerSide(gBattleAnimAttacker)) { - x -= 0xC; + x -= 12; sign = 1; } else { - x += 0x10; + x += 16; sign = -1; } @@ -920,18 +941,18 @@ static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3) { u8 spriteId = CreateSprite(&gEruptionLaunchRockSpriteTemplate, x, y, 2); - if (spriteId != 0x40) + if (spriteId != MAX_SPRITES) { gSprites[spriteId].oam.tileNum += j * 4 + 0x40; if (++j >= 5) j = 0; - InitEruptionLaunchRockCoordData(&gSprites[spriteId], sEruptionLaunchRockCoords[i][0] * sign, sEruptionLaunchRockCoords[i][1]); - gSprites[spriteId].data[6] = taskId; - gSprites[spriteId].data[7] = a3; + InitEruptionLaunchRockCoordData(&gSprites[spriteId], sEruptionLaunchRockSpeeds[i][0] * sign, sEruptionLaunchRockSpeeds[i][1]); + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sActiveSpritesIdx = activeSpritesIdx; - gTasks[taskId].data[a3]++; + gTasks[taskId].data[activeSpritesIdx]++; } } } @@ -942,7 +963,7 @@ static void AnimEruptionLaunchRock(struct Sprite *sprite) if (sprite->invisible) { - gTasks[sprite->data[6]].data[sprite->data[7]]--; + gTasks[sprite->sTaskId].data[sprite->sActiveSpritesIdx]--; DestroySprite(sprite); } } @@ -959,46 +980,71 @@ static u16 GetEruptionLaunchRockInitialYPos(u8 spriteId) return y; } -static void InitEruptionLaunchRockCoordData(struct Sprite *sprite, s16 x, s16 y) +static void InitEruptionLaunchRockCoordData(struct Sprite *sprite, s16 speedX, s16 speedY) { - sprite->data[0] = 0; - sprite->data[1] = 0; - sprite->data[2] = (u16)sprite->x * 8; - sprite->data[3] = (u16)sprite->y * 8; - sprite->data[4] = x * 8; - sprite->data[5] = y * 8; + sprite->sSpeedDelay = 0; + sprite->sLaunchStage = 0; + sprite->sX = (u16)sprite->x * 8; + sprite->sY = (u16)sprite->y * 8; + sprite->sSpeedX = speedX * 8; + sprite->sSpeedY = speedY * 8; } static void UpdateEruptionLaunchRockPos(struct Sprite *sprite) { - int var1; - if (++sprite->data[0] > 2) + int extraLaunchSpeed; + if (++sprite->sSpeedDelay > 2) { - sprite->data[0] = 0; - ++sprite->data[1]; - var1 = (u16)sprite->data[1] * (u16)sprite->data[1]; - sprite->data[3] += var1; + sprite->sSpeedDelay = 0; + ++sprite->sLaunchStage; + extraLaunchSpeed = (u16)sprite->sLaunchStage * (u16)sprite->sLaunchStage; + sprite->sY += extraLaunchSpeed; } - sprite->data[2] += sprite->data[4]; - sprite->x = sprite->data[2] >> 3; - sprite->data[3] += sprite->data[5]; - sprite->y = sprite->data[3] >> 3; + sprite->sX += sprite->sSpeedX; + sprite->x = sprite->sX >> 3; + sprite->sY += sprite->sSpeedY; + sprite->y = sprite->sY >> 3; - if (sprite->x < -8 || sprite->x > 0xf8 || sprite->y < -8 || sprite->y > 120) + if (sprite->x < -8 || sprite->x > DISPLAY_WIDTH + 8 || sprite->y < -8 || sprite->y > 120) sprite->invisible = TRUE; } +#undef IDX_ACTIVE_SPRITES +#undef tState +#undef tTimer1 +#undef tTimer2 +#undef tTimer3 +#undef tAttackerY +#undef tAttackerSide +#undef tActiveSprites +#undef tAttackerSpriteId +#undef sSpeedDelay +#undef sLaunchStage +#undef sX +#undef sY +#undef sSpeedX +#undef sSpeedY +#undef sTaskId +#undef sActiveSpritesIdx + +#define sState data[0] +#define sBounceTimer data[1] +#define sBounceDir data[2] +#define sEndTimer data[3] +#define sFallDelay data[6] +#define sTargetY data[7] + static void AnimEruptionFallingRock(struct Sprite *sprite) { sprite->x = gBattleAnimArgs[0]; sprite->y = gBattleAnimArgs[1]; - sprite->data[0] = 0; - sprite->data[1] = 0; - sprite->data[2] = 0; - sprite->data[6] = gBattleAnimArgs[2]; - sprite->data[7] = gBattleAnimArgs[3]; + sprite->sState = 0; + sprite->sBounceTimer = 0; + sprite->sBounceDir = 0; + sprite->sFallDelay = gBattleAnimArgs[2]; + sprite->sTargetY = gBattleAnimArgs[3]; sprite->oam.tileNum += gBattleAnimArgs[4] * 16; sprite->callback = AnimEruptionFallingRock_Step; @@ -1006,47 +1052,51 @@ static void AnimEruptionFallingRock(struct Sprite *sprite) static void AnimEruptionFallingRock_Step(struct Sprite *sprite) { - switch (sprite->data[0]) + switch (sprite->sState) { case 0: - if (sprite->data[6] != 0) + // Wait to begin falling + if (sprite->sFallDelay != 0) { - sprite->data[6]--; + sprite->sFallDelay--; return; } - sprite->data[0]++; + sprite->sState++; // fall through case 1: + // Rock is falling sprite->y += 8; - if (sprite->y >= sprite->data[7]) + if (sprite->y >= sprite->sTargetY) { - sprite->y = sprite->data[7]; - sprite->data[0]++; + sprite->y = sprite->sTargetY; + sprite->sState++; } break; case 2: - if (++sprite->data[1] > 1) + // Bounce up and down on landing spot + if (++sprite->sBounceTimer > 1) { - sprite->data[1] = 0; - if ((++sprite->data[2] & 1) != 0) - { + sprite->sBounceTimer = 0; + if ((++sprite->sBounceDir & 1) != 0) sprite->y2 = -3; - } else - { sprite->y2 = 3; - } } - if (++sprite->data[3] > 16) - { + if (++sprite->sEndTimer > 16) DestroyAnimSprite(sprite); - } break; } } +#undef sState +#undef sBounceTimer +#undef sBounceDir +#undef sEndTimer +#undef sFallDelay +#undef sTargetY + static void AnimWillOWispOrb(struct Sprite *sprite) { switch (sprite->data[0]) diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index cee50df3f..2fbe858d7 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -1365,14 +1365,14 @@ void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite) CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode); } -static u16 ArcTan2_(s16 a, s16 b) +static u16 ArcTan2_(s16 x, s16 y) { - return ArcTan2(a, b); + return ArcTan2(x, y); } -u16 ArcTan2Neg(s16 a, s16 b) +u16 ArcTan2Neg(s16 x, s16 y) { - u16 var = ArcTan2_(a, b); + u16 var = ArcTan2_(x, y); return -var; } diff --git a/src/battle_anim_psychic.c b/src/battle_anim_psychic.c index a7faa7658..aebf76cc0 100644 --- a/src/battle_anim_psychic.c +++ b/src/battle_anim_psychic.c @@ -583,9 +583,9 @@ static void AnimWallSparkle(struct Sprite *sprite) { if (sprite->data[0] == 0) { - int arg3 = gBattleAnimArgs[3]; + bool32 ignoreOffsets = gBattleAnimArgs[3]; bool8 respectMonPicOffsets = FALSE; - if (arg3 == 0) + if (!ignoreOffsets) respectMonPicOffsets = TRUE; if (!IsContest() && IsDoubleBattle()) diff --git a/src/battle_anim_smokescreen.c b/src/battle_anim_smokescreen.c index 0819796d2..c7be8d41c 100644 --- a/src/battle_anim_smokescreen.c +++ b/src/battle_anim_smokescreen.c @@ -7,8 +7,13 @@ #include "util.h" #include "constants/battle_palace.h" -static void SmokescreenImpact_Callback(struct Sprite *); -static void SpriteCB_DestroySprite(struct Sprite *sprite); +#define TAG_SMOKESCREEN 55019 + +#define PALTAG_SHADOW 55039 +#define GFXTAG_SHADOW 55129 + +static void SpriteCB_SmokescreenImpactMain(struct Sprite *); +static void SpriteCB_SmokescreenImpact(struct Sprite *); // The below data for smokescreen starts and ends with some data that belongs to battle_gfx_sfx_util.c @@ -43,12 +48,12 @@ const u8 gBattlePalaceNatureToMoveTarget[NUM_NATURES] = static const struct CompressedSpriteSheet sSmokescreenImpactSpriteSheet = { - .data = gSmokescreenImpactTiles, .size = 0x180, .tag = 55019 + .data = gSmokescreenImpactTiles, .size = 0x180, .tag = TAG_SMOKESCREEN }; static const struct CompressedSpritePalette sSmokescreenImpactSpritePalette = { - .data = gSmokescreenImpactPalette, .tag = 55019 + .data = gSmokescreenImpactPalette, .tag = TAG_SMOKESCREEN }; static const struct OamData sOamData_SmokescreenImpact = @@ -110,18 +115,18 @@ static const union AnimCmd *const sAnims_SmokescreenImpact[] = static const struct SpriteTemplate sSmokescreenImpactSpriteTemplate = { - .tileTag = 55019, - .paletteTag = 55019, + .tileTag = TAG_SMOKESCREEN, + .paletteTag = TAG_SMOKESCREEN, .oam = &sOamData_SmokescreenImpact, .anims = sAnims_SmokescreenImpact, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCB_DestroySprite + .callback = SpriteCB_SmokescreenImpact }; const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow = { - .data = gEnemyMonShadow_Gfx, .size = 0x80, .tag = 55129 + .data = gEnemyMonShadow_Gfx, .size = 0x80, .tag = GFXTAG_SHADOW }; static const struct OamData sOamData_EnemyShadow = @@ -143,8 +148,8 @@ static const struct OamData sOamData_EnemyShadow = const struct SpriteTemplate gSpriteTemplate_EnemyShadow = { - .tileTag = 55129, - .paletteTag = 55039, + .tileTag = GFXTAG_SHADOW, + .paletteTag = PALTAG_SHADOW, .oam = &sOamData_EnemyShadow, .anims = gDummySpriteAnimTable, .images = NULL, @@ -152,7 +157,12 @@ const struct SpriteTemplate gSpriteTemplate_EnemyShadow = .callback = SpriteCB_SetInvisible }; -u8 SmokescreenImpact(s16 x, s16 y, u8 a3) +#define sActiveSprites data[0] +#define sPersist data[1] + +#define sMainSpriteId data[0] + +u8 SmokescreenImpact(s16 x, s16 y, bool8 persist) { u8 mainSpriteId; u8 spriteId1, spriteId2, spriteId3, spriteId4; @@ -164,54 +174,58 @@ u8 SmokescreenImpact(s16 x, s16 y, u8 a3) LoadCompressedSpritePaletteUsingHeap(&sSmokescreenImpactSpritePalette); } - mainSpriteId = CreateInvisibleSpriteWithCallback(SmokescreenImpact_Callback); + mainSpriteId = CreateInvisibleSpriteWithCallback(SpriteCB_SmokescreenImpactMain); mainSprite = &gSprites[mainSpriteId]; - mainSprite->data[1] = a3; + mainSprite->sPersist = persist; + // Top left sprite spriteId1 = CreateSprite(&sSmokescreenImpactSpriteTemplate, x - 16, y - 16, 2); - gSprites[spriteId1].data[0] = mainSpriteId; - mainSprite->data[0]++; + gSprites[spriteId1].sMainSpriteId = mainSpriteId; + mainSprite->sActiveSprites++; AnimateSprite(&gSprites[spriteId1]); + // Top right sprite spriteId2 = CreateSprite(&sSmokescreenImpactSpriteTemplate, x, y - 16, 2); - gSprites[spriteId2].data[0] = mainSpriteId; - mainSprite->data[0]++; + gSprites[spriteId2].sMainSpriteId = mainSpriteId; + mainSprite->sActiveSprites++; StartSpriteAnim(&gSprites[spriteId2], 1); AnimateSprite(&gSprites[spriteId2]); + // Bottom left sprite spriteId3 = CreateSprite(&sSmokescreenImpactSpriteTemplate, x - 16, y, 2); - gSprites[spriteId3].data[0] = mainSpriteId; - mainSprite->data[0]++; + gSprites[spriteId3].sMainSpriteId = mainSpriteId; + mainSprite->sActiveSprites++; StartSpriteAnim(&gSprites[spriteId3], 2); AnimateSprite(&gSprites[spriteId3]); + // Bottom right sprite spriteId4 = CreateSprite(&sSmokescreenImpactSpriteTemplate, x, y, 2); - gSprites[spriteId4].data[0] = mainSpriteId; - mainSprite->data[0]++; + gSprites[spriteId4].sMainSpriteId = mainSpriteId; + mainSprite->sActiveSprites++; StartSpriteAnim(&gSprites[spriteId4], 3); AnimateSprite(&gSprites[spriteId4]); return mainSpriteId; } -static void SmokescreenImpact_Callback(struct Sprite *sprite) +static void SpriteCB_SmokescreenImpactMain(struct Sprite *sprite) { - if (!sprite->data[0]) + if (sprite->sActiveSprites == 0) { FreeSpriteTilesByTag(sSmokescreenImpactSpriteSheet.tag); FreeSpritePaletteByTag(sSmokescreenImpactSpritePalette.tag); - if (!sprite->data[1]) + if (!sprite->sPersist) DestroySprite(sprite); else sprite->callback = SpriteCallbackDummy; } } -static void SpriteCB_DestroySprite(struct Sprite *sprite) +static void SpriteCB_SmokescreenImpact(struct Sprite *sprite) { if (sprite->animEnded) { - gSprites[sprite->data[0]].data[0]--; + gSprites[sprite->sMainSpriteId].sActiveSprites--; DestroySprite(sprite); } } diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index fa06f1a1c..2f095a043 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -2018,24 +2018,24 @@ static void DestroyBallOpenAnimationParticle(struct Sprite *sprite) #define tPaletteHi data[11] #define tBallId data[15] -u8 LaunchBallFadeMonTask(bool8 unfadeLater, u8 battler, u32 selectedPalettes, u8 ballId) +u8 LaunchBallFadeMonTask(bool8 unfadeLater, u8 spritePalNum, u32 selectedPalettes, u8 ballId) { u8 taskId; taskId = CreateTask(Task_FadeMon_ToBallColor, 5); gTasks[taskId].tBallId = ballId; - gTasks[taskId].tPalOffset = battler; + gTasks[taskId].tPalOffset = spritePalNum; gTasks[taskId].tPaletteLo = selectedPalettes; gTasks[taskId].tPaletteHi = selectedPalettes >> 16; if (!unfadeLater) { - BlendPalette(battler * 16 + 0x100, 16, 0, gBallOpenFadeColors[ballId]); + BlendPalette(spritePalNum * 16 + 0x100, 16, 0, gBallOpenFadeColors[ballId]); gTasks[taskId].tdCoeff = 1; } else { - BlendPalette(battler * 16 + 0x100, 16, 16, gBallOpenFadeColors[ballId]); + BlendPalette(spritePalNum * 16 + 0x100, 16, 16, gBallOpenFadeColors[ballId]); gTasks[taskId].tCoeff = 16; gTasks[taskId].tdCoeff = -1; gTasks[taskId].func = Task_FadeMon_ToNormal; diff --git a/src/battle_dome.c b/src/battle_dome.c index c9614e6fc..2f86e707d 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -73,12 +73,16 @@ struct TourneyTreeLineSection #define tMode data[2] #define tPrevTaskId data[3] +#define EFFECTIVENESS_MODE_GOOD 0 +#define EFFECTIVENESS_MODE_BAD 1 +#define EFFECTIVENESS_MODE_AI_VS_AI 2 + static u8 GetDomeTrainerMonIvs(u16); static void SwapDomeTrainers(int, int, u16 *); static void CalcDomeMonStats(u16, int, int, u8, u8, int *); static void CreateDomeOpponentMons(u16); -static int SelectOpponentMonsUsingPersonality(u16, bool8); -static int SelectOpponentMonsUsingOtId(u16, bool8); +static int SelectOpponentMons_Good(u16, bool8); +static int SelectOpponentMons_Bad(u16, bool8); static int GetTypeEffectivenessPoints(int, int, int); static int SelectOpponentMonsFromParty(int *, bool8); static void Task_ShowTourneyInfoCard(u8); @@ -2589,28 +2593,33 @@ static void CreateDomeOpponentMons(u16 tournamentTrainerId) } } +// Returns a bitmask representing which 2 of the trainer's 3 pokemon to select. +// The choice is calculated solely depending on the type effectiveness of their +// movesets against the player's pokemon. +// There is a 50% chance of either a "good" or "bad" selection mode being used. +// In the good mode movesets are preferred which are more effective against the +// player, and in the bad mode the opposite is true. If all 3 pokemon tie, the +// other mode will be tried. If they tie again, the pokemon selection is random. int GetDomeTrainerSelectedMons(u16 tournamentTrainerId) { int selectedMonBits; if (Random() & 1) { - selectedMonBits = SelectOpponentMonsUsingPersonality(tournamentTrainerId, FALSE); + selectedMonBits = SelectOpponentMons_Good(tournamentTrainerId, FALSE); if (selectedMonBits == 0) - selectedMonBits = SelectOpponentMonsUsingOtId(tournamentTrainerId, TRUE); + selectedMonBits = SelectOpponentMons_Bad(tournamentTrainerId, TRUE); } else { - selectedMonBits = SelectOpponentMonsUsingOtId(tournamentTrainerId, FALSE); + selectedMonBits = SelectOpponentMons_Bad(tournamentTrainerId, FALSE); if (selectedMonBits == 0) - selectedMonBits = SelectOpponentMonsUsingPersonality(tournamentTrainerId, TRUE); + selectedMonBits = SelectOpponentMons_Good(tournamentTrainerId, TRUE); } return selectedMonBits; } -// Could probably use a better name once GetTypeEffectivenessPoints is clarified -// Personality seems to be used to select a different weighting system for type effectiveness points -static int SelectOpponentMonsUsingPersonality(u16 tournamentTrainerId, bool8 allowRandom) +static int SelectOpponentMons_Good(u16 tournamentTrainerId, bool8 allowRandom) { int i, moveId, playerMonId; int partyMovePoints[FRONTIER_PARTY_SIZE]; @@ -2625,12 +2634,12 @@ static int SelectOpponentMonsUsingPersonality(u16 tournamentTrainerId, bool8 all if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN) { partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId), - GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_PERSONALITY); + GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD); } else { partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId], - GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_PERSONALITY); + GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD); } } } @@ -2638,8 +2647,8 @@ static int SelectOpponentMonsUsingPersonality(u16 tournamentTrainerId, bool8 all return SelectOpponentMonsFromParty(partyMovePoints, allowRandom); } -// See above function, identical but uses MON_DATA_OT_ID -static int SelectOpponentMonsUsingOtId(u16 tournamentTrainerId, bool8 allowRandom) +// Identical to function above, but uses EFFECTIVENESS_MODE_BAD +static int SelectOpponentMons_Bad(u16 tournamentTrainerId, bool8 allowRandom) { int i, moveId, playerMonId; int partyMovePoints[FRONTIER_PARTY_SIZE]; @@ -2654,12 +2663,12 @@ static int SelectOpponentMonsUsingOtId(u16 tournamentTrainerId, bool8 allowRando if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN) { partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId), - GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_OT_ID); + GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD); } else { partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId], - GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_OT_ID); + GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD); } } } @@ -2732,7 +2741,7 @@ static int SelectOpponentMonsFromParty(int *partyMovePoints, bool8 allowRandom) #define TYPE_x2 40 #define TYPE_x4 80 -static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) +static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode) { int defType1, defType2, defAbility, moveType; int i = 0; @@ -2748,11 +2757,20 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) if (defAbility == ABILITY_LEVITATE && moveType == TYPE_GROUND) { - if (arg2 == 1) + // They likely meant to return here, as 8 is the number of points normally used in this mode for moves with no effect. + // Because there's no return the value instead gets interpreted by the switch, and the number of points becomes 0. + if (mode == EFFECTIVENESS_MODE_BAD) + { typePower = 8; + #ifdef BUGFIX + return; + #endif + } } else { + // Calculate a "type power" value to determine the benefit of using this type move against the target. + // This value will then be used to get the number of points to assign to the move. while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE) { if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) @@ -2764,33 +2782,30 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) { // BUG: the value of TYPE_x2 does not exist in gTypeEffectiveness, so if defAbility is ABILITY_WONDER_GUARD, the conditional always fails #ifndef BUGFIX - if (TYPE_EFFECT_DEF_TYPE(i) == defType1) - if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_x2) || defAbility != ABILITY_WONDER_GUARD) - typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10; - if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2) - if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_x2) || defAbility != ABILITY_WONDER_GUARD) - typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10; + #define WONDER_GUARD_EFFECTIVENESS TYPE_x2 #else + #define WONDER_GUARD_EFFECTIVENESS TYPE_MUL_SUPER_EFFECTIVE + #endif if (TYPE_EFFECT_DEF_TYPE(i) == defType1) - if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) || defAbility != ABILITY_WONDER_GUARD) + if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == WONDER_GUARD_EFFECTIVENESS) || defAbility != ABILITY_WONDER_GUARD) typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10; if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2) - if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) || defAbility != ABILITY_WONDER_GUARD) + if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == WONDER_GUARD_EFFECTIVENESS) || defAbility != ABILITY_WONDER_GUARD) typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10; - #endif } i += 3; } } - switch (arg2) + switch (mode) { - case 0: + case EFFECTIVENESS_MODE_GOOD: + // Weights moves that more effective. switch (typePower) { - case TYPE_x0_50: - case TYPE_x0_25: case TYPE_x0: + case TYPE_x0_25: + case TYPE_x0_50: default: typePower = 0; break; @@ -2805,22 +2820,24 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) break; } break; - case 1: + case EFFECTIVENESS_MODE_BAD: + // Weights moves that are less effective. + // Odd that there's no limit on this being used, even the Frontier Brain could end up using this. switch (typePower) { - default: - case TYPE_x1: - typePower = 0; + case TYPE_x0: + typePower = 8; break; case TYPE_x0_25: typePower = 4; break; - case TYPE_x0: - typePower = 8; - break; case TYPE_x0_50: typePower = 2; break; + default: + case TYPE_x1: + typePower = 0; + break; case TYPE_x2: typePower = -2; break; @@ -2829,7 +2846,9 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) break; } break; - case 2: + case EFFECTIVENESS_MODE_AI_VS_AI: + // Used as part of calculating the winner in a battle between two AIs. + // Weights moves that are more effective much more strongly in both directions. switch (typePower) { case TYPE_x0: @@ -5987,7 +6006,7 @@ static void DecideRoundWinners(u8 roundId) for (monId2 = 0; monId2 < FRONTIER_PARTY_SIZE; monId2++) { points1 += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentId1][monId1]].moves[moveSlot], - gFacilityTrainerMons[DOME_MONS[tournamentId2][monId2]].species, 2); + gFacilityTrainerMons[DOME_MONS[tournamentId2][monId2]].species, EFFECTIVENESS_MODE_AI_VS_AI); } } species = gFacilityTrainerMons[DOME_MONS[tournamentId1][monId1]].species; @@ -6010,7 +6029,7 @@ static void DecideRoundWinners(u8 roundId) for (monId2 = 0; monId2 < FRONTIER_PARTY_SIZE; monId2++) { points2 += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentId2][monId1]].moves[moveSlot], - gFacilityTrainerMons[DOME_MONS[tournamentId1][monId2]].species, 2); + gFacilityTrainerMons[DOME_MONS[tournamentId1][monId2]].species, EFFECTIVENESS_MODE_AI_VS_AI); } } species = gFacilityTrainerMons[DOME_MONS[tournamentId2][monId1]].species; diff --git a/src/battle_interface.c b/src/battle_interface.c index 6d869df78..dbcab4a9c 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -817,8 +817,8 @@ static void Debug_DrawNumber(s16 number, u16 *dest, bool8 unk) static void Debug_DrawNumberPair(s16 number1, s16 number2, u16 *dest) { dest[4] = 0x1E; - Debug_DrawNumber(number2, dest, 0); - Debug_DrawNumber(number1, dest + 5, 1); + Debug_DrawNumber(number2, dest, FALSE); + Debug_DrawNumber(number1, dest + 5, TRUE); } // Because the healthbox is too large to fit into one sprite, it is divided into two sprites. @@ -1420,7 +1420,7 @@ void SwapHpBarsWithHpText(void) #define tIsBattleStart data[10] #define tBlend data[15] -u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart) +u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, bool8 skipPlayer, bool8 isBattleStart) { bool8 isOpponent; s16 bar_X, bar_Y, bar_pos2_X, bar_data0; @@ -1429,7 +1429,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, u8 ballIconSpritesIds[PARTY_SIZE]; u8 taskId; - if (!arg2 || GetBattlerPosition(battlerId) != B_POSITION_OPPONENT_RIGHT) + if (!skipPlayer || GetBattlerPosition(battlerId) != B_POSITION_OPPONENT_RIGHT) { if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) { @@ -1442,7 +1442,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, { isOpponent = TRUE; - if (!arg2 || !IsDoubleBattle()) + if (!skipPlayer || !IsDoubleBattle()) bar_X = 104, bar_Y = 40; else bar_X = 104, bar_Y = 16; @@ -2383,7 +2383,7 @@ static s32 CalcNewBarValue(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *c return ret; } -static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *currValue, u8 *arg4, u8 scale) +static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *currValue, u8 *pixelsArray, u8 scale) { u8 pixels, filledPixels, totalPixels; u8 i; @@ -2397,7 +2397,7 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 totalPixels = scale * 8; for (i = 0; i < scale; i++) - arg4[i] = 0; + pixelsArray[i] = 0; if (maxValue < totalPixels) pixels = (*currValue * totalPixels / maxValue) >> 8; @@ -2408,7 +2408,7 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 if (filledPixels == 0 && newValue > 0) { - arg4[0] = 1; + pixelsArray[0] = 1; filledPixels = 1; } else @@ -2417,11 +2417,11 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 { if (pixels >= 8) { - arg4[i] = 8; + pixelsArray[i] = 8; } else { - arg4[i] = pixels; + pixelsArray[i] = pixels; break; } pixels -= 8; @@ -2433,7 +2433,7 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 // Unused // These two functions seem as if they were made for testing the health bar. -static s16 Debug_TestHealthBar(struct TestingBar *barInfo, s32 *currValue, u16 *arg2, s32 arg3) +static s16 Debug_TestHealthBar(struct TestingBar *barInfo, s32 *currValue, u16 *dest, s32 unused) { s16 ret, var; @@ -2441,29 +2441,29 @@ static s16 Debug_TestHealthBar(struct TestingBar *barInfo, s32 *currValue, u16 * barInfo->oldValue, barInfo->receivedValue, currValue, B_HEALTHBAR_PIXELS / 8, 1); - Debug_TestHealthBar_Helper(barInfo, currValue, arg2); + Debug_TestHealthBar_Helper(barInfo, currValue, dest); if (barInfo->maxValue < B_HEALTHBAR_PIXELS) var = *currValue >> 8; else var = *currValue; - DummiedOutFunction(barInfo->maxValue, var, arg3); + DummiedOutFunction(barInfo->maxValue, var, unused); return ret; } static void Debug_TestHealthBar_Helper(struct TestingBar *barInfo, s32 *currValue, u16 *dest) { - u8 sp8[6]; + u8 pixels[6]; u16 src[6]; u8 i; CalcBarFilledPixels(barInfo->maxValue, barInfo->oldValue, - barInfo->receivedValue, currValue, sp8, B_HEALTHBAR_PIXELS / 8); + barInfo->receivedValue, currValue, pixels, B_HEALTHBAR_PIXELS / 8); for (i = 0; i < 6; i++) - src[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + sp8[i]); + src[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + pixels[i]); CpuCopy16(src, dest, sizeof(src)); } @@ -2546,9 +2546,9 @@ static void RemoveWindowOnHealthbox(u32 windowId) RemoveWindow(windowId); } -static void FillHealthboxObject(void *dest, u32 arg1, u32 arg2) +static void FillHealthboxObject(void *dest, u32 valMult, u32 numTiles) { - CpuFill32(0x11111111 * arg1, dest, arg2 * TILE_SIZE_4BPP); + CpuFill32(0x11111111 * valMult, dest, numTiles * TILE_SIZE_4BPP); } static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth) diff --git a/src/battle_message.c b/src/battle_message.c index 9d1b88ba7..2776c952b 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1035,7 +1035,7 @@ const u16 gFirstTurnOfTwoStringIds[] = }; // Index copied from move's index in gTrappingMoves -const u16 gWrappedStringIds[] = +const u16 gWrappedStringIds[NUM_TRAPPING_MOVES] = { STRINGID_PKMNSQUEEZEDBYBIND, // MOVE_BIND STRINGID_PKMNWRAPPEDBY, // MOVE_WRAP @@ -1253,7 +1253,7 @@ const u16 gCaughtMonStringIds[] = [B_MSG_LANETTES_BOX_FULL] = STRINGID_PKMNBOXLANETTESPCFULL, }; -const u16 gTrappingMoves[] = +const u16 gTrappingMoves[NUM_TRAPPING_MOVES + 1] = { MOVE_BIND, MOVE_WRAP, @@ -1261,7 +1261,7 @@ const u16 gTrappingMoves[] = MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, - 0xFFFF + 0xFFFF // Never read }; const u8 gText_PkmnIsEvolving[] = _("What?\n{STR_VAR_1} is evolving!"); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3c8bbfdee..4f31f0f01 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2596,7 +2596,7 @@ void SetMoveEffect(bool8 primary, u8 certain) for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; ; gBattleCommunication[MULTISTRING_CHOOSER]++) { - if (gBattleCommunication[MULTISTRING_CHOOSER] > 4) + if (gBattleCommunication[MULTISTRING_CHOOSER] >= NUM_TRAPPING_MOVES - 1) break; if (gTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]] == gCurrentMove) break; diff --git a/src/berry_blender.c b/src/berry_blender.c index 27ea641ce..9e510f7b3 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -2238,7 +2238,7 @@ static void CB2_PlayBlender(void) UpdatePaletteFade(); } -static void Blender_DummiedOutFunc(s16 a0, s16 a1) +static void Blender_DummiedOutFunc(s16 bgX, s16 bgY) { } diff --git a/src/contest.c b/src/contest.c index ced9f90cd..68bb52114 100644 --- a/src/contest.c +++ b/src/contest.c @@ -93,7 +93,7 @@ static void Task_ContestReturnToField(u8); static void FieldCB_ContestReturnToField(void); static bool8 IsPlayerLinkLeader(void); static void PrintContestantTrainerName(u8); -static void PrintContestantTrainerNameWithColor(u8 a0, u8 a1); +static void PrintContestantTrainerNameWithColor(u8, u8); static void PrintContestantMonName(u8); static void PrintContestantMonNameWithColor(u8, u8); static u8 CreateJudgeSprite(void); @@ -3186,14 +3186,14 @@ static u16 GetMoveEffectSymbolTileOffset(u16 move, u8 contestant) return offset; } -static void PrintContestMoveDescription(u16 a) +static void PrintContestMoveDescription(u16 move) { u8 category; u16 categoryTile; u8 numHearts; // The contest category icon is implemented as a 5x2 group of tiles. - category = gContestMoves[a].contestCategory; + category = gContestMoves[move].contestCategory; if (category == CONTEST_CATEGORY_COOL) categoryTile = 0x4040; else if (category == CONTEST_CATEGORY_BEAUTY) @@ -3209,27 +3209,27 @@ static void PrintContestMoveDescription(u16 a) ContestBG_FillBoxWithIncrementingTile(0, categoryTile + 0x10, 0x0b, 0x20, 0x05, 0x01, 0x11, 0x01); // Appeal hearts - if (gContestEffects[gContestMoves[a].effect].appeal == 0xFF) + if (gContestEffects[gContestMoves[move].effect].appeal == 0xFF) numHearts = 0; else - numHearts = gContestEffects[gContestMoves[a].effect].appeal / 10; + numHearts = gContestEffects[gContestMoves[move].effect].appeal / 10; if (numHearts > MAX_CONTEST_MOVE_HEARTS) numHearts = MAX_CONTEST_MOVE_HEARTS; ContestBG_FillBoxWithTile(0, TILE_EMPTY_APPEAL_HEART, 0x15, 0x1f, MAX_CONTEST_MOVE_HEARTS, 0x01, 0x11); ContestBG_FillBoxWithTile(0, TILE_FILLED_APPEAL_HEART, 0x15, 0x1f, numHearts, 0x01, 0x11); // Jam hearts - if (gContestEffects[gContestMoves[a].effect].jam == 0xFF) + if (gContestEffects[gContestMoves[move].effect].jam == 0xFF) numHearts = 0; else - numHearts = gContestEffects[gContestMoves[a].effect].jam / 10; + numHearts = gContestEffects[gContestMoves[move].effect].jam / 10; if (numHearts > MAX_CONTEST_MOVE_HEARTS) numHearts = MAX_CONTEST_MOVE_HEARTS; ContestBG_FillBoxWithTile(0, TILE_EMPTY_JAM_HEART, 0x15, 0x20, MAX_CONTEST_MOVE_HEARTS, 0x01, 0x11); ContestBG_FillBoxWithTile(0, TILE_FILLED_JAM_HEART, 0x15, 0x20, numHearts, 0x01, 0x11); FillWindowPixelBuffer(WIN_MOVE_DESCRIPTION, PIXEL_FILL(0)); - Contest_PrintTextToBg0WindowStd(WIN_MOVE_DESCRIPTION, gContestEffectDescriptionPointers[gContestMoves[a].effect]); + Contest_PrintTextToBg0WindowStd(WIN_MOVE_DESCRIPTION, gContestEffectDescriptionPointers[gContestMoves[move].effect]); Contest_PrintTextToBg0WindowStd(WIN_SLASH, gText_Slash); } @@ -4537,14 +4537,14 @@ static void CalculateAppealMoveImpact(u8 contestant) eContestantStatus[contestant].contestantAnimTarget = i; } -void SetContestantEffectStringID(u8 a, u8 b) +void SetContestantEffectStringID(u8 contestant, u8 effectStringId) { - eContestantStatus[a].effectStringId = b; + eContestantStatus[contestant].effectStringId = effectStringId; } -void SetContestantEffectStringID2(u8 a, u8 b) +void SetContestantEffectStringID2(u8 contestant, u8 effectStringId) { - eContestantStatus[a].effectStringId2 = b; + eContestantStatus[contestant].effectStringId2 = effectStringId; } void SetStartledString(u8 contestant, u8 jam) diff --git a/src/credits.c b/src/credits.c index 43c8d6628..33362fb38 100644 --- a/src/credits.c +++ b/src/credits.c @@ -1285,18 +1285,18 @@ static void ResetCreditsTasks(u8 taskId) gIntroCredits_MovingSceneryState = INTROCRED_SCENERY_DESTROY; } -static void LoadTheEndScreen(u16 arg0, u16 arg1, u16 palOffset) +static void LoadTheEndScreen(u16 tileOffsetLoad, u16 tileOffsetWrite, u16 palOffset) { u16 baseTile; u16 i; - LZ77UnCompVram(sCreditsCopyrightEnd_Gfx, (void *)(VRAM + arg0)); + LZ77UnCompVram(sCreditsCopyrightEnd_Gfx, (void *)(VRAM + tileOffsetLoad)); LoadPalette(gIntroCopyright_Pal, palOffset, sizeof(gIntroCopyright_Pal)); baseTile = (palOffset / 16) << 12; for (i = 0; i < 32 * 32; i++) - ((u16 *) (VRAM + arg1))[i] = baseTile + 1; + ((u16 *) (VRAM + tileOffsetWrite))[i] = baseTile + 1; } static u16 GetLetterMapTile(u8 baseTiles) diff --git a/src/decompress.c b/src/decompress.c index b74d4e814..92c840a63 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -51,13 +51,13 @@ void LoadCompressedSpritePalette(const struct CompressedSpritePalette *src) LoadSpritePalette(&dest); } -void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer) +void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *src, void *buffer) { struct SpritePalette dest; - LZ77UnCompWram(a->data, buffer); + LZ77UnCompWram(src->data, buffer); dest.data = buffer; - dest.tag = a->tag; + dest.tag = src->tag; LoadSpritePalette(&dest); } diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 691ca6b2a..620fe59e5 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -2879,10 +2879,10 @@ static u8 TryGivePrize(void) return PRIZE_RECEIVED; } -static u32 IncrementWithLimit(u32 a, u32 max) +static u32 IncrementWithLimit(u32 num, u32 max) { - if (a < max) - return a + 1; + if (num < max) + return num + 1; else return max; } diff --git a/src/event_object_movement.c b/src/event_object_movement.c index eb699e89f..07ce2ed08 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -164,7 +164,7 @@ static void CreateLevitateMovementTask(struct ObjectEvent *); static void DestroyLevitateMovementTask(u8); static bool8 NpcTakeStep(struct Sprite *); static bool8 IsElevationMismatchAt(u8, s16, s16); -static bool8 AreElevationsCompatible(u8 a, u8 b); +static bool8 AreElevationsCompatible(u8, u8); static const struct SpriteFrameImage sPicTable_PechaBerryTree[]; @@ -7837,7 +7837,7 @@ void GroundEffect_FlowingWater(struct ObjectEvent *objEvent, struct Sprite *spri StartFieldEffectForObjectEvent(FLDEFF_FEET_IN_FLOWING_WATER, objEvent); } -static void (*const sGroundEffectTracksFuncs[])(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a) = { +static void (*const sGroundEffectTracksFuncs[])(struct ObjectEvent *objEvent, struct Sprite *sprite, bool8 isDeepSand) = { [TRACKS_NONE] = DoTracksGroundEffect_None, [TRACKS_FOOT] = DoTracksGroundEffect_Footprints, [TRACKS_BIKE_TIRE] = DoTracksGroundEffect_BikeTireTracks, @@ -7846,20 +7846,20 @@ static void (*const sGroundEffectTracksFuncs[])(struct ObjectEvent *objEvent, st void GroundEffect_SandTracks(struct ObjectEvent *objEvent, struct Sprite *sprite) { const struct ObjectEventGraphicsInfo *info = GetObjectEventGraphicsInfo(objEvent->graphicsId); - sGroundEffectTracksFuncs[info->tracks](objEvent, sprite, 0); + sGroundEffectTracksFuncs[info->tracks](objEvent, sprite, FALSE); } void GroundEffect_DeepSandTracks(struct ObjectEvent *objEvent, struct Sprite *sprite) { const struct ObjectEventGraphicsInfo *info = GetObjectEventGraphicsInfo(objEvent->graphicsId); - sGroundEffectTracksFuncs[info->tracks](objEvent, sprite, 1); + sGroundEffectTracksFuncs[info->tracks](objEvent, sprite, TRUE); } -static void DoTracksGroundEffect_None(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a) +static void DoTracksGroundEffect_None(struct ObjectEvent *objEvent, struct Sprite *sprite, bool8 isDeepSand) { } -static void DoTracksGroundEffect_Footprints(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a) +static void DoTracksGroundEffect_Footprints(struct ObjectEvent *objEvent, struct Sprite *sprite, bool8 isDeepSand) { // First half-word is a Field Effect script id. (gFieldEffectScriptPointers) u16 sandFootprints_FieldEffectData[2] = { @@ -7872,10 +7872,10 @@ static void DoTracksGroundEffect_Footprints(struct ObjectEvent *objEvent, struct gFieldEffectArguments[2] = 149; gFieldEffectArguments[3] = 2; gFieldEffectArguments[4] = objEvent->facingDirection; - FieldEffectStart(sandFootprints_FieldEffectData[a]); + FieldEffectStart(sandFootprints_FieldEffectData[isDeepSand]); } -static void DoTracksGroundEffect_BikeTireTracks(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a) +static void DoTracksGroundEffect_BikeTireTracks(struct ObjectEvent *objEvent, struct Sprite *sprite, bool8 isDeepSand) { // Specifies which bike track shape to show next. // For example, when the bike turns from up to right, it will show diff --git a/src/field_camera.c b/src/field_camera.c index 0a00dcbee..4ccf70db9 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -437,10 +437,10 @@ void SetCameraPanningCallback(void (*callback)(void)) sFieldCameraPanningCallback = callback; } -void SetCameraPanning(s16 a, s16 b) +void SetCameraPanning(s16 horizontal, s16 vertical) { - sHorizontalCameraPan = a; - sVerticalCameraPan = b + 32; + sHorizontalCameraPan = horizontal; + sVerticalCameraPan = vertical + 32; } void InstallCameraPanAheadCallback(void) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 964a62187..b374e132d 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -79,13 +79,13 @@ static bool8 TryPushBoulder(s16, s16, u8); static void CheckAcroBikeCollision(s16, s16, u8, u8 *); static void DoPlayerAvatarTransition(void); -static void PlayerAvatarTransition_Dummy(struct ObjectEvent *a); -static void PlayerAvatarTransition_Normal(struct ObjectEvent *a); -static void PlayerAvatarTransition_MachBike(struct ObjectEvent *a); -static void PlayerAvatarTransition_AcroBike(struct ObjectEvent *a); -static void PlayerAvatarTransition_Surfing(struct ObjectEvent *a); -static void PlayerAvatarTransition_Underwater(struct ObjectEvent *a); -static void PlayerAvatarTransition_ReturnToField(struct ObjectEvent *a); +static void PlayerAvatarTransition_Dummy(struct ObjectEvent *); +static void PlayerAvatarTransition_Normal(struct ObjectEvent *); +static void PlayerAvatarTransition_MachBike(struct ObjectEvent *); +static void PlayerAvatarTransition_AcroBike(struct ObjectEvent *); +static void PlayerAvatarTransition_Surfing(struct ObjectEvent *); +static void PlayerAvatarTransition_Underwater(struct ObjectEvent *); +static void PlayerAvatarTransition_ReturnToField(struct ObjectEvent *); static bool8 PlayerAnimIsMultiFrameStationary(void); static bool8 PlayerAnimIsMultiFrameStationaryAndStateNotTurning(void); @@ -96,51 +96,51 @@ static void PlayerRun(u8); static void PlayerNotOnBikeCollide(u8); static void PlayerNotOnBikeCollideWithFarawayIslandMew(u8); -static void PlayCollisionSoundIfNotFacingWarp(u8 a); +static void PlayCollisionSoundIfNotFacingWarp(u8); static void HideShowWarpArrow(struct ObjectEvent *); static void StartStrengthAnim(u8, u8); -static void Task_PushBoulder(u8 taskId); -static bool8 PushBoulder_Start(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject); -static bool8 PushBoulder_Move(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject); -static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject); +static void Task_PushBoulder(u8); +static bool8 PushBoulder_Start(struct Task *, struct ObjectEvent *, struct ObjectEvent *); +static bool8 PushBoulder_Move(struct Task *, struct ObjectEvent *, struct ObjectEvent *); +static bool8 PushBoulder_End(struct Task *, struct ObjectEvent *, struct ObjectEvent *); static void DoPlayerMatJump(void); -static void DoPlayerAvatarSecretBaseMatJump(u8 taskId); -static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct ObjectEvent *objectEvent); +static void DoPlayerAvatarSecretBaseMatJump(u8); +static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *, struct ObjectEvent *); static void DoPlayerMatSpin(void); -static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId); -static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct ObjectEvent *objectEvent); -static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct ObjectEvent *objectEvent); -static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct ObjectEvent *objectEvent); -static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct ObjectEvent *objectEvent); +static void PlayerAvatar_DoSecretBaseMatSpin(u8); +static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *, struct ObjectEvent *); +static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *, struct ObjectEvent *); +static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *, struct ObjectEvent *); +static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *, struct ObjectEvent *); static void CreateStopSurfingTask(u8); -static void Task_StopSurfingInit(u8 taskId); -static void Task_WaitStopSurfing(u8 taskId); +static void Task_StopSurfingInit(u8); +static void Task_WaitStopSurfing(u8); -static void Task_Fishing(u8 taskId); -static u8 Fishing_Init(struct Task *task); -static u8 Fishing_GetRodOut(struct Task *task); -static u8 Fishing_WaitBeforeDots(struct Task *task); -static u8 Fishing_InitDots(struct Task *task); -static u8 Fishing_ShowDots(struct Task *task); -static u8 Fishing_CheckForBite(struct Task *task); -static u8 Fishing_GotBite(struct Task *task); -static u8 Fishing_WaitForA(struct Task *task); -static u8 Fishing_CheckMoreDots(struct Task *task); -static u8 Fishing_MonOnHook(struct Task *task); -static u8 Fishing_StartEncounter(struct Task *task); -static u8 Fishing_NotEvenNibble(struct Task *task); -static u8 Fishing_GotAway(struct Task *task); -static u8 Fishing_NoMon(struct Task *task); -static u8 Fishing_PutRodAway(struct Task *task); -static u8 Fishing_EndNoMon(struct Task *task); +static void Task_Fishing(u8); +static u8 Fishing_Init(struct Task *); +static u8 Fishing_GetRodOut(struct Task *); +static u8 Fishing_WaitBeforeDots(struct Task *); +static u8 Fishing_InitDots(struct Task *); +static u8 Fishing_ShowDots(struct Task *); +static u8 Fishing_CheckForBite(struct Task *); +static u8 Fishing_GotBite(struct Task *); +static u8 Fishing_WaitForA(struct Task *); +static u8 Fishing_CheckMoreDots(struct Task *); +static u8 Fishing_MonOnHook(struct Task *); +static u8 Fishing_StartEncounter(struct Task *); +static u8 Fishing_NotEvenNibble(struct Task *); +static u8 Fishing_GotAway(struct Task *); +static u8 Fishing_NoMon(struct Task *); +static u8 Fishing_PutRodAway(struct Task *); +static u8 Fishing_EndNoMon(struct Task *); static void AlignFishingAnimationFrames(void); -static u8 TrySpinPlayerForWarp(struct ObjectEvent *object, s16 *a1); +static u8 TrySpinPlayerForWarp(struct ObjectEvent *, s16 *); static bool8 (*const sForcedMovementTestFuncs[NUM_FORCED_MOVEMENTS])(u8) = { @@ -1445,68 +1445,68 @@ static void HideShowWarpArrow(struct ObjectEvent *objectEvent) /* Strength */ -static void StartStrengthAnim(u8 a, u8 b) +#define tState data[0] +#define tBoulderObjId data[1] +#define tDirection data[2] + +static void StartStrengthAnim(u8 objectEventId, u8 direction) { u8 taskId = CreateTask(Task_PushBoulder, 0xFF); - gTasks[taskId].data[1] = a; - gTasks[taskId].data[2] = b; + gTasks[taskId].tBoulderObjId = objectEventId; + gTasks[taskId].tDirection = direction; Task_PushBoulder(taskId); } static void Task_PushBoulder(u8 taskId) { - while (sPushBoulderFuncs[gTasks[taskId].data[0]](&gTasks[taskId], + while (sPushBoulderFuncs[gTasks[taskId].tState](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId], - &gObjectEvents[gTasks[taskId].data[1]])) + &gObjectEvents[gTasks[taskId].tBoulderObjId])) ; } -static bool8 PushBoulder_Start(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) +static bool8 PushBoulder_Start(struct Task *task, struct ObjectEvent *player, struct ObjectEvent *boulder) { ScriptContext2_Enable(); gPlayerAvatar.preventStep = TRUE; - task->data[0]++; + task->tState++; return FALSE; } -static bool8 PushBoulder_Move(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) +static bool8 PushBoulder_Move(struct Task *task, struct ObjectEvent *player, struct ObjectEvent *boulder) { - if (ObjectEventIsHeldMovementActive(playerObject)) - { - ObjectEventClearHeldMovementIfFinished(playerObject); - } + if (ObjectEventIsHeldMovementActive(player)) + ObjectEventClearHeldMovementIfFinished(player); - if (ObjectEventIsHeldMovementActive(strengthObject)) - { - ObjectEventClearHeldMovementIfFinished(strengthObject); - } + if (ObjectEventIsHeldMovementActive(boulder)) + ObjectEventClearHeldMovementIfFinished(boulder); - if (!ObjectEventIsMovementOverridden(playerObject) - && !ObjectEventIsMovementOverridden(strengthObject)) + if (!ObjectEventIsMovementOverridden(player) + && !ObjectEventIsMovementOverridden(boulder)) { - ObjectEventClearHeldMovementIfFinished(playerObject); - ObjectEventClearHeldMovementIfFinished(strengthObject); - ObjectEventSetHeldMovement(playerObject, GetWalkInPlaceNormalMovementAction((u8)task->data[2])); - ObjectEventSetHeldMovement(strengthObject, GetWalkSlowMovementAction((u8)task->data[2])); - gFieldEffectArguments[0] = strengthObject->currentCoords.x; - gFieldEffectArguments[1] = strengthObject->currentCoords.y; - gFieldEffectArguments[2] = strengthObject->previousElevation; - gFieldEffectArguments[3] = gSprites[strengthObject->spriteId].oam.priority; + ObjectEventClearHeldMovementIfFinished(player); + ObjectEventClearHeldMovementIfFinished(boulder); + ObjectEventSetHeldMovement(player, GetWalkInPlaceNormalMovementAction((u8)task->tDirection)); + ObjectEventSetHeldMovement(boulder, GetWalkSlowMovementAction((u8)task->tDirection)); + gFieldEffectArguments[0] = boulder->currentCoords.x; + gFieldEffectArguments[1] = boulder->currentCoords.y; + gFieldEffectArguments[2] = boulder->previousElevation; + gFieldEffectArguments[3] = gSprites[boulder->spriteId].oam.priority; FieldEffectStart(FLDEFF_DUST); PlaySE(SE_M_STRENGTH); - task->data[0]++; + task->tState++; } return FALSE; } -static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) +static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *player, struct ObjectEvent *boulder) { - if (ObjectEventCheckHeldMovementStatus(playerObject) - && ObjectEventCheckHeldMovementStatus(strengthObject)) + if (ObjectEventCheckHeldMovementStatus(player) + && ObjectEventCheckHeldMovementStatus(boulder)) { - ObjectEventClearHeldMovementIfFinished(playerObject); - ObjectEventClearHeldMovementIfFinished(strengthObject); + ObjectEventClearHeldMovementIfFinished(player); + ObjectEventClearHeldMovementIfFinished(boulder); gPlayerAvatar.preventStep = FALSE; ScriptContext2_Disable(); DestroyTask(FindTaskIdByFunc(Task_PushBoulder)); @@ -1514,6 +1514,10 @@ static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *playerObject return FALSE; } +#undef tState +#undef tBoulderObjId +#undef tDirection + /* Some field effect */ static void DoPlayerMatJump(void) diff --git a/src/field_special_scene.c b/src/field_special_scene.c index d8b9eb05d..31e75613e 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -19,7 +19,19 @@ #include "constants/songs.h" #include "constants/metatile_labels.h" -#define SECONDS(value) ((signed) (60.0 * value + 0.5)) +// Most of the boxes in the moving truck are map tiles, with the +// exception of three boxes that are map events that jostle around +// while the truck is driving. In addition, their sprite's placement +// is slightly offset to make them look less perfectly stacked. +// Box 1 (LOCALID_TRUCK_BOX_TOP) +#define BOX1_X_OFFSET 3 +#define BOX1_Y_OFFSET 3 +// Box 2 (LOCALID_TRUCK_BOX_BOTTOM_L) +#define BOX2_X_OFFSET 0 +#define BOX2_Y_OFFSET -3 +// Box 3 (LOCALID_TRUCK_BOX_BOTTOM_R) +#define BOX3_X_OFFSET -3 +#define BOX3_Y_OFFSET 0 // porthole states enum @@ -30,8 +42,7 @@ enum EXIT_PORTHOLE, }; -//. rodata -static const s8 gTruckCamera_HorizontalTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, -1, -1, -1, 0}; +static const s8 sTruckCamera_HorizontalTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, -1, -1, -1, 0}; static const u8 sSSTidalSailEastMovementScript[] = { @@ -45,175 +56,194 @@ static const u8 sSSTidalSailWestMovementScript[] = MOVEMENT_ACTION_STEP_END }; -// .text static void Task_Truck3(u8); -s16 GetTruckCameraBobbingY(int a1) +static s16 GetTruckCameraBobbingY(int time) { - if (!(a1 % 120)) + if (!(time % 120)) return -1; - else if ((a1 % 10) <= 4) + else if ((time % 10) <= 4) return 1; return 0; } -s16 GetTruckBoxMovement(int a1) // for the box movement? +// Determines the frequency that the truck boxes bounce at. +// The return value of this function is multiplied and added +// to the boxes resting y offset, the result of which is that +// when it returns 0 they remain vertically still and when it +// returns -1 they jump upward. +// Box 1 has 30 added to the time so it jumps earlier, and +// box 2 has the return value multiplied by less, so it doesn't +// jump as high. +static s16 GetTruckBoxYMovement(int time) { - if (!((a1 + 120) % 180)) + if (!((time + 120) % 180)) return -1; return 0; } -void Task_Truck1(u8 taskId) +#define tTimer data[0] + +static void Task_Truck1(u8 taskId) { s16 *data = gTasks[taskId].data; s16 cameraXpan = 0, cameraYpan = 0; - s16 box1, box2, box3; + s16 yBox1, yBox2, yBox3; - box1 = GetTruckBoxMovement(data[0] + 30) * 4; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, box1 + 3); - box2 = GetTruckBoxMovement(data[0]) * 2; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, box2 - 3); - box3 = GetTruckBoxMovement(data[0]) * 4; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, box3); + yBox1 = GetTruckBoxYMovement(tTimer + 30) * 4; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + yBox1); + yBox2 = GetTruckBoxYMovement(tTimer) * 2; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + yBox2); + yBox3 = GetTruckBoxYMovement(tTimer) * 4; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + yBox3); - if (++data[0] == SECONDS(500)) // this will never run - data[0] = 0; // reset the timer if it gets stuck. + // Arbitrary timer limit that won't be reached + if (++tTimer == 30000) + tTimer = 0; - cameraYpan = GetTruckCameraBobbingY(data[0]); + cameraYpan = GetTruckCameraBobbingY(tTimer); SetCameraPanning(cameraXpan, cameraYpan); } -void Task_Truck2(u8 taskId) +#undef tTimer + +#define tTimerHorizontal data[0] +#define tMoveStep data[1] +#define tTimerVertical data[2] + +static void Task_Truck2(u8 taskId) { s16 *data = gTasks[taskId].data; - s16 cameraYpan; - s16 cameraXpan; - s16 box1; - s16 box2; - s16 box3; + s16 cameraYpan, cameraXpan; + s16 yBox1, yBox2, yBox3; - data[0]++; - data[2]++; + tTimerHorizontal++; + tTimerVertical++; - if (data[0] > 5) + if (tTimerHorizontal > 5) { - data[0] = 0; - data[1]++; + tTimerHorizontal = 0; + tMoveStep++; } - if ((u16)data[1] == 19) + if ((u16)tMoveStep == ARRAY_COUNT(sTruckCamera_HorizontalTable)) { + // Never reached, the task function is changed below before finishing the table DestroyTask(taskId); } else { - if (gTruckCamera_HorizontalTable[data[1]] == 2) + if (sTruckCamera_HorizontalTable[tMoveStep] == 2) gTasks[taskId].func = Task_Truck3; - cameraXpan = gTruckCamera_HorizontalTable[data[1]]; - cameraYpan = GetTruckCameraBobbingY(data[2]); + cameraXpan = sTruckCamera_HorizontalTable[tMoveStep]; + cameraYpan = GetTruckCameraBobbingY(tTimerVertical); SetCameraPanning(cameraXpan, cameraYpan); - box1 = GetTruckBoxMovement(data[2] + 30) * 4; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, box1 + 3); - box2 = GetTruckBoxMovement(data[2]) * 2; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, box2 - 3); - box3 = GetTruckBoxMovement(data[2]) * 4; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, box3); + yBox1 = GetTruckBoxYMovement(tTimerVertical + 30) * 4; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + yBox1); + yBox2 = GetTruckBoxYMovement(tTimerVertical) * 2; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + yBox2); + yBox3 = GetTruckBoxYMovement(tTimerVertical) * 4; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + yBox3); } } static void Task_Truck3(u8 taskId) { s16 *data = gTasks[taskId].data; - s16 cameraXpan; - s16 cameraYpan; + s16 cameraXpan, cameraYpan; - data[0]++; + tTimerHorizontal++; - if (data[0] > 5) + if (tTimerHorizontal > 5) { - data[0] = 0; - data[1]++; + tTimerHorizontal = 0; + tMoveStep++; } - if ((u16)data[1] == 19) + if ((u16)tMoveStep == ARRAY_COUNT(sTruckCamera_HorizontalTable)) { DestroyTask(taskId); } else { - cameraXpan = gTruckCamera_HorizontalTable[data[1]]; + cameraXpan = sTruckCamera_HorizontalTable[tMoveStep]; cameraYpan = 0; SetCameraPanning(cameraXpan, 0); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, cameraYpan + 3); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, cameraYpan - 3); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, cameraYpan); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + cameraYpan); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + cameraYpan); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + cameraYpan); } } -void Task_HandleTruckSequence(u8 taskId) +#undef tTimerHorizontal +#undef tMoveStep +#undef tTimerVertical + +#define tState data[0] +#define tTimer data[1] +#define tTaskId1 data[2] +#define tTaskId2 data[3] + +static void Task_HandleTruckSequence(u8 taskId) { s16 *data = gTasks[taskId].data; - switch (data[0]) + switch (tState) { - /* - Each case has a timer which is handled with data[1], incrementing - until it reaches the if function's condition, which sets the next task up. - */ case 0: - data[1]++; - if (data[1] == SECONDS(1.5)) + tTimer++; + if (tTimer == 90) { SetCameraPanningCallback(NULL); - data[1] = 0; // reset the timer. - data[2] = CreateTask(Task_Truck1, 0xA); - data[0] = 1; // run the next case. + tTimer = 0; + tTaskId1 = CreateTask(Task_Truck1, 0xA); + tState = 1; PlaySE(SE_TRUCK_MOVE); } break; case 1: - data[1]++; - if (data[1] == SECONDS(2.5)) + tTimer++; + if (tTimer == 150) { FadeInFromBlack(); - data[1] = 0; - data[0] = 2; + tTimer = 0; + tState = 2; } break; case 2: - data[1]++; - if (!gPaletteFade.active && data[1] > SECONDS(5)) + tTimer++; + if (!gPaletteFade.active && tTimer > 300) { - data[1] = 0; - DestroyTask(data[2]); - data[3] = CreateTask(Task_Truck2, 0xA); - data[0] = 3; + tTimer = 0; + DestroyTask(tTaskId1); + tTaskId2 = CreateTask(Task_Truck2, 0xA); + tState = 3; PlaySE(SE_TRUCK_STOP); } break; case 3: - if (!gTasks[data[3]].isActive) // is Truck2 no longer active (is Truck3 active?) + if (!gTasks[tTaskId2].isActive) { + // Task_Truck2 / Task_Truck3 has finished InstallCameraPanAheadCallback(); - data[1] = 0; - data[0] = 4; + tTimer = 0; + tState = 4; } break; case 4: - data[1]++; - if (data[1] == 90) + tTimer++; + if (tTimer == 90) { PlaySE(SE_TRUCK_UNLOAD); - data[1] = 0; - data[0] = 5; + tTimer = 0; + tState = 5; } break; case 5: - data[1]++; - if (data[1] == 120) + tTimer++; + if (tTimer == 120) { MapGridSetMetatileIdAt(4 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_InsideOfTruck_ExitLight_Top); MapGridSetMetatileIdAt(4 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_InsideOfTruck_ExitLight_Mid); @@ -242,9 +272,9 @@ void EndTruckSequence(u8 taskId) { if (!FuncIsActiveTask(Task_HandleTruckSequence)) { - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3, 3); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 0, -3); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3, 0); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET, BOX1_Y_OFFSET); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET, BOX2_Y_OFFSET); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET, BOX3_Y_OFFSET); } } @@ -259,7 +289,7 @@ bool8 TrySetPortholeWarpDestination(void) } else { - SetWarpDestination(mapGroup, mapNum, -1, x, y); + SetWarpDestination(mapGroup, mapNum, WARP_ID_NONE, x, y); return TRUE; } } diff --git a/src/field_specials.c b/src/field_specials.c index a4cdafafc..4ed2a2e03 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -90,44 +90,44 @@ void SetPlayerGotFirstFans(void); u16 GetNumFansOfPlayerInTrainerFanClub(void); static void RecordCyclingRoadResults(u32, u8); -static void LoadLinkPartnerObjectEventSpritePalette(u8 graphicsId, u8 localEventId, u8 paletteNum); -static void Task_PetalburgGymSlideOpenRoomDoors(u8 taskId); -static void PetalburgGymSetDoorMetatiles(u8 roomNumber, u16 metatileId); +static void LoadLinkPartnerObjectEventSpritePalette(u8, u8, u8); +static void Task_PetalburgGymSlideOpenRoomDoors(u8); +static void PetalburgGymSetDoorMetatiles(u8, u16); static void Task_PCTurnOnEffect(u8); static void PCTurnOnEffect_0(struct Task *); static void PCTurnOnEffect_1(s16, s8, s8); static void PCTurnOffEffect(void); static void Task_LotteryCornerComputerEffect(u8); static void LotteryCornerComputerEffect(struct Task *); -static void Task_ShakeCamera(u8 taskId); -static void StopCameraShake(u8 taskId); -static void Task_MoveElevator(u8 taskId); -static void MoveElevatorWindowLights(u16 floorDelta, bool8 descending); -static void Task_MoveElevatorWindowLights(u8 taskId); -static void Task_ShowScrollableMultichoice(u8 taskId); -static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection); -static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection); +static void Task_ShakeCamera(u8); +static void StopCameraShake(u8); +static void Task_MoveElevator(u8); +static void MoveElevatorWindowLights(u16, bool8); +static void Task_MoveElevatorWindowLights(u8); +static void Task_ShowScrollableMultichoice(u8); +static void FillFrontierExchangeCornerWindowAndItemIcon(u16, u16); +static void ShowBattleFrontierTutorWindow(u8, u16); static void InitScrollableMultichoice(void); -static void ScrollableMultichoice_ProcessInput(u8 taskId); -static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId); -static void ScrollableMultichoice_MoveCursor(s32 itemIndex, bool8 onInit, struct ListMenu *list); -static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused); -static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection); -static void CloseScrollableMultichoice(u8 taskId); -static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId); -static void Task_ScrollableMultichoice_WaitReturnToList(u8 taskId); -static void Task_ScrollableMultichoice_ReturnToList(u8 taskId); -static void ShowFrontierExchangeCornerItemIcon(u16 item); -static void Task_DeoxysRockInteraction(u8 taskId); -static void ChangeDeoxysRockLevel(u8 a0); -static void WaitForDeoxysRockMovement(u8 taskId); -static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId); -static void Task_LoopWingFlapSE(u8 taskId); -static void Task_CloseBattlePikeCurtain(u8 taskId); +static void ScrollableMultichoice_ProcessInput(u8); +static void ScrollableMultichoice_UpdateScrollArrows(u8); +static void ScrollableMultichoice_MoveCursor(s32, bool8, struct ListMenu *); +static void HideFrontierExchangeCornerItemIcon(u16, u16); +static void ShowBattleFrontierTutorMoveDescription(u8, u16); +static void CloseScrollableMultichoice(u8); +static void ScrollableMultichoice_RemoveScrollArrows(u8); +static void Task_ScrollableMultichoice_WaitReturnToList(u8); +static void Task_ScrollableMultichoice_ReturnToList(u8); +static void ShowFrontierExchangeCornerItemIcon(u16); +static void Task_DeoxysRockInteraction(u8); +static void ChangeDeoxysRockLevel(u8); +static void WaitForDeoxysRockMovement(u8); +static void Task_LinkRetireStatusWithBattleTowerPartner(u8); +static void Task_LoopWingFlapSE(u8); +static void Task_CloseBattlePikeCurtain(u8); static u8 DidPlayerGetFirstFans(void); static void SetInitialFansOfPlayer(void); static u16 PlayerGainRandomTrainerFan(void); -static void BufferFanClubTrainerName_(struct LinkBattleRecords *linkRecords, u8 a, u8 b); +static void BufferFanClubTrainerName_(struct LinkBattleRecords *, u8, u8); void Special_ShowDiploma(void) { diff --git a/src/field_weather.c b/src/field_weather.c index cd3436441..a9d007e16 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -863,10 +863,10 @@ void LoadCustomWeatherSpritePalette(const u16 *palette) UpdateSpritePaletteWithWeather(gWeatherPtr->weatherPicSpritePalIndex); } -static void LoadDroughtWeatherPalette(u8 *gammaIndexPtr, u8 *a1) +static void LoadDroughtWeatherPalette(u8 *palsIndex, u8 *palsOffset) { - *gammaIndexPtr = 0x20; - *a1 = 0x20; + *palsIndex = 0x20; + *palsOffset = 0x20; } void ResetDroughtWeatherPaletteLoading(void) diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 2b87557c2..c10867062 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -14,11 +14,9 @@ #include "trig.h" #include "gpu_regs.h" -// EWRAM EWRAM_DATA static u8 gCurrentAbnormalWeather = 0; EWRAM_DATA static u16 gUnusedWeatherRelated = 0; -// CONST const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal"); const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal"); const u8 gWeatherFogDiagonalTiles[] = INCBIN_U8("graphics/weather/fog_diagonal.4bpp"); @@ -2427,34 +2425,39 @@ static void UpdateBubbleSprite(struct Sprite *sprite) //------------------------------------------------------------------------------ // Unused function. -static void UnusedSetCurrentAbnormalWeather(u32 a0, u32 a1) +static void UnusedSetCurrentAbnormalWeather(u32 weather, u32 unknown) { - gCurrentAbnormalWeather = a0; - gUnusedWeatherRelated = a1; + gCurrentAbnormalWeather = weather; + gUnusedWeatherRelated = unknown; } +#define tState data[0] +#define tWeatherA data[1] +#define tWeatherB data[2] +#define tDelay data[15] + static void Task_DoAbnormalWeather(u8 taskId) { s16 *data = gTasks[taskId].data; - switch (data[0]) + switch (tState) { case 0: - if (data[15]-- <= 0) + if (tDelay-- <= 0) { - SetNextWeather(data[1]); - gCurrentAbnormalWeather = data[1]; - data[15] = 600; - data[0]++; + SetNextWeather(tWeatherA); + gCurrentAbnormalWeather = tWeatherA; + tDelay = 600; + tState++; } break; case 1: - if (data[15]-- <= 0) + if (tDelay-- <= 0) { - SetNextWeather(data[2]); - gCurrentAbnormalWeather = data[2]; - data[15] = 600; - data[0] = 0; + SetNextWeather(tWeatherB); + gCurrentAbnormalWeather = tWeatherB; + tDelay = 600; + tState = 0; } break; } @@ -2465,25 +2468,33 @@ static void CreateAbnormalWeatherTask(void) u8 taskId = CreateTask(Task_DoAbnormalWeather, 0); s16 *data = gTasks[taskId].data; - data[15] = 600; + tDelay = 600; if (gCurrentAbnormalWeather == WEATHER_DOWNPOUR) { - data[1] = WEATHER_DROUGHT; - data[2] = WEATHER_DOWNPOUR; + // Currently Downpour, next will be Drought + tWeatherA = WEATHER_DROUGHT; + tWeatherB = WEATHER_DOWNPOUR; } else if (gCurrentAbnormalWeather == WEATHER_DROUGHT) { - data[1] = WEATHER_DOWNPOUR; - data[2] = WEATHER_DROUGHT; + // Currently Drought, next will be Downpour + tWeatherA = WEATHER_DOWNPOUR; + tWeatherB = WEATHER_DROUGHT; } else { + // Default to starting with Downpour gCurrentAbnormalWeather = WEATHER_DOWNPOUR; - data[1] = WEATHER_DROUGHT; - data[2] = WEATHER_DOWNPOUR; + tWeatherA = WEATHER_DROUGHT; + tWeatherB = WEATHER_DOWNPOUR; } } +#undef tState +#undef tWeatherA +#undef tWeatherB +#undef tDelay + static u8 TranslateWeatherNum(u8); static void UpdateRainCounter(u8, u8); diff --git a/src/intro_credits_graphics.c b/src/intro_credits_graphics.c index e7039e02b..0942e82f1 100644 --- a/src/intro_credits_graphics.c +++ b/src/intro_credits_graphics.c @@ -757,10 +757,9 @@ void LoadIntroPart2Graphics(u8 scenery) gReservedSpritePaletteCount = 8; } -// Note: This is only called with a=1. +// Note: This is only called with scenery=1. void SetIntroPart2BgCnt(u8 scenery) { - // Only called with scenery = 1 switch (scenery) { default: diff --git a/src/item_use.c b/src/item_use.c index c03ede61b..af8f2504f 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -42,33 +42,33 @@ #include "constants/items.h" #include "constants/songs.h" -static void SetUpItemUseCallback(u8 taskId); +static void SetUpItemUseCallback(u8); static void FieldCB_UseItemOnField(void); -static void Task_CallItemUseOnFieldCallback(u8 taskId); -static void Task_UseItemfinder(u8 taskId); -static void Task_CloseItemfinderMessage(u8 taskId); -static void Task_HiddenItemNearby(u8 taskId); -static void Task_StandingOnHiddenItem(u8 taskId); +static void Task_CallItemUseOnFieldCallback(u8); +static void Task_UseItemfinder(u8); +static void Task_CloseItemfinderMessage(u8); +static void Task_HiddenItemNearby(u8); +static void Task_StandingOnHiddenItem(u8); static bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8); -static u8 GetDirectionToHiddenItem(s16 distanceX, s16 distanceY); -static void PlayerFaceHiddenItem(u8 a); -static void CheckForHiddenItemsInMapConnection(u8 taskId); -static void Task_OpenRegisteredPokeblockCase(u8 taskId); -static void ItemUseOnFieldCB_Bike(u8 taskId); +static u8 GetDirectionToHiddenItem(s16, s16); +static void PlayerFaceHiddenItem(u8); +static void CheckForHiddenItemsInMapConnection(u8); +static void Task_OpenRegisteredPokeblockCase(u8); +static void ItemUseOnFieldCB_Bike(u8); static void ItemUseOnFieldCB_Rod(u8); static void ItemUseOnFieldCB_Itemfinder(u8); -static void ItemUseOnFieldCB_Berry(u8 taskId); -static void ItemUseOnFieldCB_WailmerPailBerry(u8 taskId); -static void ItemUseOnFieldCB_WailmerPailSudowoodo(u8 taskId); +static void ItemUseOnFieldCB_Berry(u8); +static void ItemUseOnFieldCB_WailmerPailBerry(u8); +static void ItemUseOnFieldCB_WailmerPailSudowoodo(u8); static bool8 TryToWaterSudowoodo(void); -static void BootUpSoundTMHM(u8 taskId); -static void Task_ShowTMHMContainedMessage(u8 taskId); -static void UseTMHMYesNo(u8 taskId); -static void UseTMHM(u8 taskId); -static void Task_StartUseRepel(u8 taskId); -static void Task_UseRepel(u8 taskId); -static void Task_CloseCantUseKeyItemMessage(u8 taskId); -static void SetDistanceOfClosestHiddenItem(u8 taskId, s16 x, s16 y); +static void BootUpSoundTMHM(u8); +static void Task_ShowTMHMContainedMessage(u8); +static void UseTMHMYesNo(u8); +static void UseTMHM(u8); +static void Task_StartUseRepel(u8); +static void Task_UseRepel(u8); +static void Task_CloseCantUseKeyItemMessage(u8); +static void SetDistanceOfClosestHiddenItem(u8, s16, s16); static void CB2_OpenPokeblockFromBag(void); // EWRAM variables diff --git a/src/link.c b/src/link.c index aa9a0d73d..e88cde55a 100644 --- a/src/link.c +++ b/src/link.c @@ -120,18 +120,18 @@ static EWRAM_DATA void *sLinkErrorBgTilemapBuffer = NULL; static void InitLocalLinkPlayer(void); static void VBlankCB_LinkError(void); static void CB2_LinkTest(void); -static void ProcessRecvCmds(u8 unused); +static void ProcessRecvCmds(u8); static void LinkCB_SendHeldKeys(void); static void ResetBlockSend(void); -static bool32 InitBlockSend(const void *src, size_t size); +static bool32 InitBlockSend(const void *, size_t); static void LinkCB_BlockSendBegin(void); static void LinkCB_BlockSend(void); static void LinkCB_BlockSendEnd(void); -static void SetBlockReceivedFlag(u8 who); -static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size); -static void LinkTest_PrintHex(u32 pos, u8 a0, u8 a1, u8 a2); +static void SetBlockReceivedFlag(u8); +static u16 LinkTestCalcBlockChecksum(const u16 *, u16); +static void LinkTest_PrintHex(u32, u8, u8, u8); static void LinkCB_RequestPlayerDataExchange(void); -static void Task_PrintTestData(u8 taskId); +static void Task_PrintTestData(u8); static void LinkCB_ReadyCloseLink(void); static void LinkCB_WaitCloseLink(void); diff --git a/src/main_menu.c b/src/main_menu.c index ed6158a9c..361118e54 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -198,7 +198,7 @@ static void NewGameBirchSpeech_ShowDialogueWindow(u8, u8); static void NewGameBirchSpeech_ClearWindow(u8); static void Task_NewGameBirchSpeech_ThisIsAPokemon(u8); static void Task_NewGameBirchSpeech_MainSpeech(u8); -static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *printer, u16 a); +static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *, u16); static void Task_NewGameBirchSpeech_AndYouAre(u8); static void Task_NewGameBirchSpeechSub_WaitForLotad(u8); static void Task_NewGameBirchSpeech_StartBirchLotadPlatformFade(u8); @@ -1371,7 +1371,7 @@ static void Task_NewGameBirchSpeechSub_InitPokeBall(u8 taskId) gSprites[spriteId].invisible = FALSE; gSprites[spriteId].data[0] = 0; - CreatePokeballSpriteToReleaseMon(spriteId, gSprites[spriteId].oam.paletteNum, 112, 58, 0, 0, 32, 0x0000FFFF, SPECIES_LOTAD); + CreatePokeballSpriteToReleaseMon(spriteId, gSprites[spriteId].oam.paletteNum, 112, 58, 0, 0, 32, PALETTES_BG, SPECIES_LOTAD); gTasks[taskId].func = Task_NewGameBirchSpeechSub_WaitForLotad; gTasks[sBirchSpeechMainTaskId].tTimer = 0; } @@ -2221,9 +2221,9 @@ static void ClearMainMenuWindowTilemap(const struct WindowTemplate *template) CopyBgTilemapBufferToVram(template->bg); } -static void NewGameBirchSpeech_ClearGenderWindowTilemap(u8 a, u8 b, u8 c, u8 d, u8 e, u8 unused) +static void NewGameBirchSpeech_ClearGenderWindowTilemap(u8 bg, u8 x, u8 y, u8 width, u8 height, u8 unused) { - FillBgTilemapBufferRect(a, 0, b + 0xFF, c + 0xFF, d + 2, e + 2, 2); + FillBgTilemapBufferRect(bg, 0, x + 255, y + 255, width + 2, height + 2, 2); } static void NewGameBirchSpeech_ClearGenderWindow(u8 windowId, bool8 copyToVram) @@ -2247,7 +2247,7 @@ static void NewGameBirchSpeech_ClearWindow(u8 windowId) CopyWindowToVram(windowId, COPYWIN_GFX); } -static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *printer, u16 a) +static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *printer, u16 renderCmd) { // Wait for Birch's "This is a Pokémon" text to reach the pause // Then start the PokéBall release (if it hasn't been started already) @@ -2273,21 +2273,22 @@ static void NewGameBirchSpeech_ShowDialogueWindow(u8 windowId, u8 copyToVram) CopyWindowToVram(windowId, 3); } -static void NewGameBirchSpeech_CreateDialogueWindowBorder(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f) +static void NewGameBirchSpeech_CreateDialogueWindowBorder(u8 bg, u8 x, u8 y, u8 width, u8 height, u8 palNum) { - FillBgTilemapBufferRect(a, 0xFD, b-2, c-1, 1, 1, f); - FillBgTilemapBufferRect(a, 0xFF, b-1, c-1, 1, 1, f); - FillBgTilemapBufferRect(a, 0x100, b, c-1, d, 1, f); - FillBgTilemapBufferRect(a, 0x101, b+d-1, c-1, 1, 1, f); - FillBgTilemapBufferRect(a, 0x102, b+d, c-1, 1, 1, f); - FillBgTilemapBufferRect(a, 0x103, b-2, c, 1, 5, f); - FillBgTilemapBufferRect(a, 0x105, b-1, c, d+1, 5, f); - FillBgTilemapBufferRect(a, 0x106, b+d, c, 1, 5, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0xFD), b-2, c+e, 1, 1, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0xFF), b-1, c+e, 1, 1, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0x100), b, c+e, d-1, 1, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0x101), b+d-1, c+e, 1, 1, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0x102), b+d, c+e, 1, 1, f); + FillBgTilemapBufferRect(bg, 0xFD, x-2, y-1, 1, 1, palNum); + FillBgTilemapBufferRect(bg, 0xFF, x-1, y-1, 1, 1, palNum); + FillBgTilemapBufferRect(bg, 0x100, x, y-1, width, 1, palNum); + FillBgTilemapBufferRect(bg, 0x101, x+width-1, y-1, 1, 1, palNum); + FillBgTilemapBufferRect(bg, 0x102, x+width, y-1, 1, 1, palNum); + FillBgTilemapBufferRect(bg, 0x103, x-2, y, 1, 5, palNum); + FillBgTilemapBufferRect(bg, 0x105, x-1, y, width+1, 5, palNum); + FillBgTilemapBufferRect(bg, 0x106, x+width, y, 1, 5, palNum); + + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0xFD), x-2, y+height, 1, 1, palNum); + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0xFF), x-1, y+height, 1, 1, palNum); + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0x100), x, y+height, width-1, 1, palNum); + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0x101), x+width-1, y+height, 1, 1, palNum); + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0x102), x+width, y+height, 1, 1, palNum); } static void Task_NewGameBirchSpeech_ReturnFromNamingScreenShowTextbox(u8 taskId) diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 681a3dadf..637bf2c7f 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -438,7 +438,7 @@ static void EnableTextPrinters(void) gDisableTextPrinters = FALSE; } -static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 a1) +static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 renderCmd) { gDisableTextPrinters = TRUE; } diff --git a/src/menu.c b/src/menu.c index 49baddded..c4540942b 100644 --- a/src/menu.c +++ b/src/menu.c @@ -542,9 +542,9 @@ void RemoveMapNamePopUpWindow(void) } } -void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16)) +void AddTextPrinterWithCallbackForMessage(bool8 canSpeedUp, void (*callback)(struct TextPrinterTemplate *, u16)) { - gTextFlags.canABSpeedUpPrint = a1; + gTextFlags.canABSpeedUpPrint = canSpeedUp; AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3); } @@ -1245,9 +1245,9 @@ static void PrintMenuActionGridText(u8 windowId, u8 fontId, u8 left, u8 top, u8 } // Unused -static void PrintMenuActionGridTextAtTop(u8 windowId, u8 fontId, u8 a2, u8 a3, u8 a4, u8 a5, const struct MenuAction *menuActions) +static void PrintMenuActionGridTextAtTop(u8 windowId, u8 fontId, u8 width, u8 height, u8 columns, u8 rows, const struct MenuAction *menuActions) { - PrintMenuActionGridText(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 0, a2, a3, a4, a5, menuActions); + PrintMenuActionGridText(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 0, width, height, columns, rows, menuActions); } void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *menuActions, const u8 *actionIds) diff --git a/src/mystery_event_script.c b/src/mystery_event_script.c index 5f08c6294..e0f789bcb 100644 --- a/src/mystery_event_script.c +++ b/src/mystery_event_script.c @@ -19,8 +19,8 @@ extern ScrCmdFunc gMysteryEventScriptCmdTable[]; extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[]; -#define LANGUAGE_MASK 0x1 -#define VERSION_MASK 0x200 +// 0x1 in FireRed, 0x2 in LeafGreen, 0x80 in Ruby, 0x100 in Sapphire +#define VERSION_MASK (1 << 9) #define mScriptBase data[0] #define mOffset data[1] @@ -29,18 +29,21 @@ extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[]; EWRAM_DATA static struct ScriptContext sMysteryEventScriptContext = {0}; -static bool32 CheckCompatibility(u16 a1, u32 a2, u16 a3, u32 a4) +static bool32 CheckCompatibility(u16 unk0, u32 unk1, u16 unk2, u32 version) { - if (!(a1 & LANGUAGE_MASK)) + // 0x1 in English FRLG, 0x2 in English RS, 0x4 in German RS + if (!(unk0 & 0x1)) return FALSE; - if (!(a2 & LANGUAGE_MASK)) + // Same as above + if (!(unk1 & 0x1)) return FALSE; - if (!(a3 & 0x4)) + // 0x1 in FRLG, 0x4 in RS + if (!(unk2 & 0x4)) return FALSE; - if (!(a4 & VERSION_MASK)) + if (!(version & VERSION_MASK)) return FALSE; return TRUE; @@ -174,18 +177,18 @@ bool8 MEScrCmd_end(struct ScriptContext *ctx) bool8 MEScrCmd_checkcompat(struct ScriptContext *ctx) { - u16 v1; - u32 v2; - u16 v3; - u32 v4; + u16 unk0; + u32 unk1; + u16 unk2; + u32 version; ctx->mOffset = ScriptReadWord(ctx); - v1 = ScriptReadHalfword(ctx); - v2 = ScriptReadWord(ctx); - v3 = ScriptReadHalfword(ctx); - v4 = ScriptReadWord(ctx); + unk0 = ScriptReadHalfword(ctx); + unk1 = ScriptReadWord(ctx); + unk2 = ScriptReadHalfword(ctx); + version = ScriptReadWord(ctx); - if (CheckCompatibility(v1, v2, v3, v4) == TRUE) + if (CheckCompatibility(unk0, unk1, unk2, version) == TRUE) ctx->mValid = TRUE; else SetIncompatible(); diff --git a/src/overworld.c b/src/overworld.c index ba6eaa167..dc7eda422 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -2477,9 +2477,9 @@ static u16 KeyInterCB_ReadButtons(u32 key) return LINK_KEY_CODE_EMPTY; } -static u16 GetDirectionForDpadKey(u16 a1) +static u16 GetDirectionForDpadKey(u16 key) { - switch (a1) + switch (key) { case LINK_KEY_CODE_DPAD_RIGHT: return FACING_RIGHT; @@ -2598,7 +2598,7 @@ static u16 KeyInterCB_Ready(u32 keyOrPlayerId) } } -static u16 KeyInterCB_SetReady(u32 a1) +static u16 KeyInterCB_SetReady(u32 key) { SetKeyInterceptCallback(KeyInterCB_Ready); return LINK_KEY_CODE_READY; diff --git a/src/palette.c b/src/palette.c index 9fec449bc..23ad02b73 100644 --- a/src/palette.c +++ b/src/palette.c @@ -237,63 +237,63 @@ static void PaletteStruct_Run(u8 a1, u32 *unkFlags) } } -static void PaletteStruct_Copy(struct PaletteStruct *a1, u32 *unkFlags) +static void PaletteStruct_Copy(struct PaletteStruct *palStruct, u32 *unkFlags) { s32 srcIndex; s32 srcCount; u8 i = 0; - u16 srcOffset = a1->srcIndex * a1->template->size; + u16 srcOffset = palStruct->srcIndex * palStruct->template->size; - if (!a1->template->pst_field_8_0) + if (!palStruct->template->pst_field_8_0) { - while (i < a1->template->size) + while (i < palStruct->template->size) { - gPlttBufferUnfaded[a1->destOffset] = a1->template->src[srcOffset]; - gPlttBufferFaded[a1->destOffset] = a1->template->src[srcOffset]; + gPlttBufferUnfaded[palStruct->destOffset] = palStruct->template->src[srcOffset]; + gPlttBufferFaded[palStruct->destOffset] = palStruct->template->src[srcOffset]; i++; - a1->destOffset++; + palStruct->destOffset++; srcOffset++; } } else { - while (i < a1->template->size) + while (i < palStruct->template->size) { - gPlttBufferFaded[a1->destOffset] = a1->template->src[srcOffset]; + gPlttBufferFaded[palStruct->destOffset] = palStruct->template->src[srcOffset]; i++; - a1->destOffset++; + palStruct->destOffset++; srcOffset++; } } - a1->destOffset = a1->baseDestOffset; - a1->countdown1 = a1->template->time1; - a1->srcIndex++; + palStruct->destOffset = palStruct->baseDestOffset; + palStruct->countdown1 = palStruct->template->time1; + palStruct->srcIndex++; - srcIndex = a1->srcIndex; - srcCount = a1->template->srcCount; + srcIndex = palStruct->srcIndex; + srcCount = palStruct->template->srcCount; if (srcIndex >= srcCount) { - if (a1->countdown2) - a1->countdown2--; - a1->srcIndex = 0; + if (palStruct->countdown2) + palStruct->countdown2--; + palStruct->srcIndex = 0; } - *unkFlags |= 1 << (a1->baseDestOffset >> 4); + *unkFlags |= 1 << (palStruct->baseDestOffset >> 4); } -static void PaletteStruct_Blend(struct PaletteStruct *a1, u32 *unkFlags) +static void PaletteStruct_Blend(struct PaletteStruct *palStruct, u32 *unkFlags) { - if (gPaletteFade.active && ((1 << (a1->baseDestOffset >> 4)) & gPaletteFade_selectedPalettes)) + if (gPaletteFade.active && ((1 << (palStruct->baseDestOffset >> 4)) & gPaletteFade_selectedPalettes)) { - if (!a1->template->pst_field_8_0) + if (!palStruct->template->pst_field_8_0) { if (gPaletteFade.delayCounter != gPaletteFade_delay) { BlendPalette( - a1->baseDestOffset, - a1->template->size, + palStruct->baseDestOffset, + palStruct->template->size, gPaletteFade.y, gPaletteFade.blendColor); } @@ -302,13 +302,13 @@ static void PaletteStruct_Blend(struct PaletteStruct *a1, u32 *unkFlags) { if (!gPaletteFade.delayCounter) { - if (a1->countdown1 != a1->template->time1) + if (palStruct->countdown1 != palStruct->template->time1) { - u32 srcOffset = a1->srcIndex * a1->template->size; + u32 srcOffset = palStruct->srcIndex * palStruct->template->size; u8 i; - for (i = 0; i < a1->template->size; i++) - gPlttBufferFaded[a1->baseDestOffset + i] = a1->template->src[srcOffset + i]; + for (i = 0; i < palStruct->template->size; i++) + gPlttBufferFaded[palStruct->baseDestOffset + i] = palStruct->template->src[srcOffset + i]; } } } diff --git a/src/player_pc.c b/src/player_pc.c index bf8479ce1..9e3d7b166 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -97,84 +97,84 @@ struct ItemStorageMenu u8 swapLineSpriteIds[SWAP_LINE_LENGTH]; }; -static void InitPlayerPCMenu(u8 taskId); -static void PlayerPCProcessMenuInput(u8 taskId); -static void InitItemStorageMenu(u8 taskId, u8 var); +static void InitPlayerPCMenu(u8); +static void PlayerPCProcessMenuInput(u8); +static void InitItemStorageMenu(u8, u8); static u8 GetMailboxMailCount(void); static void Mailbox_CompactMailList(void); -static void Mailbox_DrawMailboxMenu(u8 taskId); -static void Mailbox_ProcessInput(u8 taskId); -static void Mailbox_PrintWhatToDoWithPlayerMailText(u8 taskId); +static void Mailbox_DrawMailboxMenu(u8); +static void Mailbox_ProcessInput(u8); +static void Mailbox_PrintWhatToDoWithPlayerMailText(u8); static void Mailbox_ReturnToPlayerPC(u8); -static void Mailbox_PrintMailOptions(u8 taskId); -static void Mailbox_MailOptionsProcessInput(u8 taskId); +static void Mailbox_PrintMailOptions(u8); +static void Mailbox_MailOptionsProcessInput(u8); -static void PlayerPC_ItemStorage(u8 taskId); -static void PlayerPC_Mailbox(u8 taskId); -static void PlayerPC_Decoration(u8 var); -static void PlayerPC_TurnOff(u8 taskId); +static void PlayerPC_ItemStorage(u8); +static void PlayerPC_Mailbox(u8); +static void PlayerPC_Decoration(u8); +static void PlayerPC_TurnOff(u8); -static void Mailbox_DoMailMoveToBag(u8 taskId); -static void Mailbox_DoMailRead(u8 taskId); -static void Mailbox_MoveToBag(u8 taskId); -static void Mailbox_Give(u8 taskId); -static void Mailbox_Cancel(u8 taskId); +static void Mailbox_DoMailMoveToBag(u8); +static void Mailbox_DoMailRead(u8); +static void Mailbox_MoveToBag(u8); +static void Mailbox_Give(u8); +static void Mailbox_Cancel(u8); -static void Mailbox_CancelMoveToBag(u8 taskId); -static void Mailbox_HandleConfirmMoveToBag(u8 taskId); -static void Mailbox_AskConfirmMoveToBag(u8 taskId); -static void Mailbox_DoGiveMailPokeMenu(u8 taskId); -static void Mailbox_NoPokemonForMail(u8 taskId); +static void Mailbox_CancelMoveToBag(u8); +static void Mailbox_HandleConfirmMoveToBag(u8); +static void Mailbox_AskConfirmMoveToBag(u8); +static void Mailbox_DoGiveMailPokeMenu(u8); +static void Mailbox_NoPokemonForMail(u8); -static void Mailbox_FadeAndReadMail(u8 taskId); +static void Mailbox_FadeAndReadMail(u8); static void Mailbox_ReturnToFieldFromReadMail(void); static void Mailbox_ReshowAfterMail(void); -static void Mailbox_HandleReturnToProcessInput(u8 taskId); +static void Mailbox_HandleReturnToProcessInput(u8); static void Mailbox_UpdateMailListAfterDeposit(void); -static void ItemStorage_Withdraw(u8 taskId); -static void ItemStorage_Deposit(u8 taskId); -static void ItemStorage_Toss(u8 taskId); -static void ItemStorage_Exit(u8 taskId); -static void ItemStorage_TossItemYes(u8 taskId); -static void ItemStorage_TossItemNo(u8 taskId); +static void ItemStorage_Withdraw(u8); +static void ItemStorage_Deposit(u8); +static void ItemStorage_Toss(u8); +static void ItemStorage_Exit(u8); +static void ItemStorage_TossItemYes(u8); +static void ItemStorage_TossItemNo(u8); static void ItemStorageMenuPrint(const u8 *); -static void ItemStorageMenuProcessInput(u8 taskId); +static void ItemStorageMenuProcessInput(u8); static void SetPlayerPCListCount(u8); -static void ItemStorage_HandleReturnToProcessInput(u8 taskId); +static void ItemStorage_HandleReturnToProcessInput(u8); -static void ItemStorage_Enter(u8 taskId, bool8 toss); -static void ItemStorage_CreateListMenu(u8 taskId); -static void ItemStorage_ProcessInput(u8 taskId); -static void Task_ItemStorage_Deposit(u8 taskId); +static void ItemStorage_Enter(u8, bool8); +static void ItemStorage_CreateListMenu(u8); +static void ItemStorage_ProcessInput(u8); +static void Task_ItemStorage_Deposit(u8); static void ItemStorage_ReshowAfterBagMenu(void); -static void ItemStorage_DoItemWithdraw(u8 taskId); -static void ItemStorage_DoItemToss(u8 taskid); -static void ItemStorage_HandleQuantityRolling(u8 taskid); -static void ItemStorage_ExitItemList(u8 taskId); -static void ItemStorage_StartItemSwap(u8 taskId); -static void ItemStorage_DoItemAction(u8 taskId); -static void ItemStorage_FinishItemSwap(u8 taskId, bool8 a); -static void ItemStorage_HandleRemoveItem(u8 taskId); -static void ItemStorage_HandleErrorMessageInput(u8 taskId); -static void ItemStorage_ReturnToListInput(u8 taskId); +static void ItemStorage_DoItemWithdraw(u8); +static void ItemStorage_DoItemToss(u8); +static void ItemStorage_HandleQuantityRolling(u8); +static void ItemStorage_ExitItemList(u8); +static void ItemStorage_StartItemSwap(u8); +static void ItemStorage_DoItemAction(u8); +static void ItemStorage_FinishItemSwap(u8, bool8); +static void ItemStorage_HandleRemoveItem(u8); +static void ItemStorage_HandleErrorMessageInput(u8); +static void ItemStorage_ReturnToListInput(u8); static const u8* ItemStorage_GetMessage(u16); -static void CopyItemName_PlayerPC(u8 *string, u16 itemId); +static void CopyItemName_PlayerPC(u8 *, u16); static void ItemStorage_Init(void); -static void ItemStorage_DrawSwapArrow(u8 y, u8, u8 speed); +static void ItemStorage_DrawSwapArrow(u8, u8, u8); static void ItemStorage_RemoveWindow(u8); static void ItemStorage_UpdateSwapLinePos(u8); -static void ItemStorage_ProcessItemSwapInput(u8 taskId); +static void ItemStorage_ProcessItemSwapInput(u8); static void ItemStorage_EraseItemIcon(void); -static void ItemStorage_DrawItemIcon(u16 itemId); -static void ItemStorage_PrintDescription(s32 id); -static void ItemStorage_EraseMainMenu(u8 taskId); -static void ItemStorage_MoveCursor(s32 id, bool8 b, struct ListMenu * thisMenu); -static void ItemStorage_PrintMenuItem(u8 windowId, u32 id, u8 yOffset); +static void ItemStorage_DrawItemIcon(u16); +static void ItemStorage_PrintDescription(s32); +static void ItemStorage_EraseMainMenu(u8); +static void ItemStorage_MoveCursor(s32, bool8, struct ListMenu *); +static void ItemStorage_PrintMenuItem(u8, u32, u8); static EWRAM_DATA const u8 *sTopMenuOptionOrder = NULL; static EWRAM_DATA u8 sTopMenuNumOptions = 0; diff --git a/src/pokeball.c b/src/pokeball.c index cf7f49b7e..f203633a5 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -1005,32 +1005,45 @@ static u8 AnimateBallOpenParticlesForPokeball(u8 x, u8 y, u8 kindOfStars, u8 sub return AnimateBallOpenParticles(x, y, kindOfStars, subpriority, BALL_POKE); } -static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes) +static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 spritePalNum, u32 selectedPalettes) { - return LaunchBallFadeMonTask(unFadeLater, battlerId, selectedPalettes, BALL_POKE); + return LaunchBallFadeMonTask(unFadeLater, spritePalNum, selectedPalettes, BALL_POKE); } +// Sprite data for the pokemon +#define sSpecies data[7] + +// Sprite data for the pokeball +#define sMonSpriteId data[0] +#define sDelay data[1] +#define sMonPalNum data[2] +#define sFadePalsLo data[3] +#define sFadePalsHi data[4] +#define sFinalMonX data[5] +#define sFinalMonY data[6] +#define sTrigIdx data[7] + // Pokeball in Birch intro, and when receiving via trade -void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species) +void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 delay, u32 fadePalettes, u16 species) { u8 spriteId; - LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[0]); - LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[0]); - spriteId = CreateSprite(&gBallSpriteTemplates[0], x, y, subpriortiy); + LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[BALL_POKE]); + LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[BALL_POKE]); + spriteId = CreateSprite(&gBallSpriteTemplates[BALL_POKE], x, y, subpriortiy); - gSprites[spriteId].data[0] = monSpriteId; - gSprites[spriteId].data[5] = gSprites[monSpriteId].x; - gSprites[spriteId].data[6] = gSprites[monSpriteId].y; + gSprites[spriteId].sMonSpriteId = monSpriteId; + gSprites[spriteId].sFinalMonX = gSprites[monSpriteId].x; + gSprites[spriteId].sFinalMonY = gSprites[monSpriteId].y; gSprites[monSpriteId].x = x; gSprites[monSpriteId].y = y; - gSprites[monSpriteId].data[7] = species; + gSprites[monSpriteId].sSpecies = species; - gSprites[spriteId].data[1] = g; - gSprites[spriteId].data[2] = battlerId; - gSprites[spriteId].data[3] = h; - gSprites[spriteId].data[4] = h >> 0x10; + gSprites[spriteId].sDelay = delay; + gSprites[spriteId].sMonPalNum = monPalNum; + gSprites[spriteId].sFadePalsLo = fadePalettes; + gSprites[spriteId].sFadePalsHi = fadePalettes >> 16; gSprites[spriteId].oam.priority = oamPriority; gSprites[spriteId].callback = SpriteCB_PokeballReleaseMon; @@ -1039,12 +1052,12 @@ void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite) { - if (sprite->data[1] == 0) + if (sprite->sDelay == 0) { u8 subpriority; - u8 spriteId = sprite->data[0]; - u8 battlerId = sprite->data[2]; - u32 selectedPalettes = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); + u8 spriteId = sprite->sMonSpriteId; + u8 monPalNum = sprite->sMonPalNum; + u32 selectedPalettes = (u16)sprite->sFadePalsLo | ((u16)sprite->sFadePalsHi << 16); if (sprite->subpriority != 0) subpriority = sprite->subpriority - 1; @@ -1053,78 +1066,89 @@ static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite) StartSpriteAnim(sprite, 1); AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, subpriority); - sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, selectedPalettes); + // sDelay re-used to store task id but never read + sprite->sDelay = LaunchBallFadeMonTaskForPokeball(1, monPalNum, selectedPalettes); sprite->callback = SpriteCB_ReleasedMonFlyOut; gSprites[spriteId].invisible = FALSE; StartSpriteAffineAnim(&gSprites[spriteId], BATTLER_AFFINE_EMERGE); AnimateSprite(&gSprites[spriteId]); gSprites[spriteId].data[1] = 0x1000; - sprite->data[7] = 0; + sprite->sTrigIdx = 0; } else { - sprite->data[1]--; + sprite->sDelay--; } } static void SpriteCB_ReleasedMonFlyOut(struct Sprite *sprite) { - bool8 r12 = FALSE; - bool8 r6 = FALSE; - u8 monSpriteId = sprite->data[0]; - u16 var1; - u16 var2; + bool8 emergeAnimFinished = FALSE; + bool8 atFinalPosition = FALSE; + u8 monSpriteId = sprite->sMonSpriteId; + u16 x, y; if (sprite->animEnded) sprite->invisible = TRUE; + if (gSprites[monSpriteId].affineAnimEnded) { StartSpriteAffineAnim(&gSprites[monSpriteId], BATTLER_AFFINE_NORMAL); - r12 = TRUE; + emergeAnimFinished = TRUE; } - var1 = (sprite->data[5] - sprite->x) * sprite->data[7] / 128 + sprite->x; - var2 = (sprite->data[6] - sprite->y) * sprite->data[7] / 128 + sprite->y; - gSprites[monSpriteId].x = var1; - gSprites[monSpriteId].y = var2; - if (sprite->data[7] < 128) - { - s16 sine = -(gSineTable[(u8)sprite->data[7]] / 8); - sprite->data[7] += 4; + x = (sprite->sFinalMonX - sprite->x) * sprite->sTrigIdx / 128 + sprite->x; + y = (sprite->sFinalMonY - sprite->y) * sprite->sTrigIdx / 128 + sprite->y; + gSprites[monSpriteId].x = x; + gSprites[monSpriteId].y = y; + + if (sprite->sTrigIdx < 128) + { + s16 sine = -(gSineTable[(u8)sprite->sTrigIdx] / 8); + + sprite->sTrigIdx += 4; gSprites[monSpriteId].x2 = sine; gSprites[monSpriteId].y2 = sine; } else { - gSprites[monSpriteId].x = sprite->data[5]; - gSprites[monSpriteId].y = sprite->data[6]; + gSprites[monSpriteId].x = sprite->sFinalMonX; + gSprites[monSpriteId].y = sprite->sFinalMonY; gSprites[monSpriteId].x2 = 0; gSprites[monSpriteId].y2 = 0; - r6 = TRUE; + atFinalPosition = TRUE; } - if (sprite->animEnded && r12 && r6) + if (sprite->animEnded && emergeAnimFinished && atFinalPosition) { - if (gSprites[monSpriteId].data[7] == SPECIES_EGG) - DoMonFrontSpriteAnimation(&gSprites[monSpriteId], gSprites[monSpriteId].data[7], TRUE, 0); + if (gSprites[monSpriteId].sSpecies == SPECIES_EGG) + DoMonFrontSpriteAnimation(&gSprites[monSpriteId], gSprites[monSpriteId].sSpecies, TRUE, 0); else - DoMonFrontSpriteAnimation(&gSprites[monSpriteId], gSprites[monSpriteId].data[7], FALSE, 0); + DoMonFrontSpriteAnimation(&gSprites[monSpriteId], gSprites[monSpriteId].sSpecies, FALSE, 0); DestroySpriteAndFreeResources(sprite); } } -u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h) +#undef sSpecies +#undef sFinalMonX +#undef sFinalMonY +#undef sTrigIdx + + +#define sTimer data[5] + +u8 CreateTradePokeballSprite(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 delay, u32 fadePalettes) { u8 spriteId; - LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[0]); - LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[0]); - spriteId = CreateSprite(&gBallSpriteTemplates[0], x, y, subPriority); - gSprites[spriteId].data[0] = a; - gSprites[spriteId].data[1] = g; - gSprites[spriteId].data[2] = b; - gSprites[spriteId].data[3] = h; - gSprites[spriteId].data[4] = h >> 16; + LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[BALL_POKE]); + LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[BALL_POKE]); + spriteId = CreateSprite(&gBallSpriteTemplates[BALL_POKE], x, y, subPriority); + gSprites[spriteId].sMonSpriteId = monSpriteId; + gSprites[spriteId].sDelay = delay; + gSprites[spriteId].sMonPalNum = monPalNum; + gSprites[spriteId].sFadePalsLo = fadePalettes; + gSprites[spriteId].sFadePalsHi = fadePalettes >> 16; gSprites[spriteId].oam.priority = oamPriority; gSprites[spriteId].callback = SpriteCB_TradePokeball; return spriteId; @@ -1132,12 +1156,12 @@ u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPrior static void SpriteCB_TradePokeball(struct Sprite *sprite) { - if (sprite->data[1] == 0) + if (sprite->sDelay == 0) { u8 subpriority; - u8 monSpriteId = sprite->data[0]; - u8 battlerId = sprite->data[2]; - u32 selectedPalettes = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); + u8 monSpriteId = sprite->sMonSpriteId; + u8 monPalNum = sprite->sMonPalNum; + u32 selectedPalettes = (u16)sprite->sFadePalsLo | ((u16)sprite->sFadePalsHi << 16); if (sprite->subpriority != 0) subpriority = sprite->subpriority - 1; @@ -1146,7 +1170,8 @@ static void SpriteCB_TradePokeball(struct Sprite *sprite) StartSpriteAnim(sprite, 1); AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, subpriority); - sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, selectedPalettes); + // sDelay re-used to store task id but never read + sprite->sDelay = LaunchBallFadeMonTaskForPokeball(1, monPalNum, selectedPalettes); sprite->callback = SpriteCB_TradePokeballSendOff; #ifdef BUGFIX // FIX: If this is used on a sprite that has previously had an affine animation, it will not @@ -1159,7 +1184,7 @@ static void SpriteCB_TradePokeball(struct Sprite *sprite) } else { - sprite->data[1]--; + sprite->sDelay--; } } @@ -1167,15 +1192,16 @@ static void SpriteCB_TradePokeballSendOff(struct Sprite *sprite) { u8 monSpriteId; - sprite->data[5]++; - if (sprite->data[5] == 11) + sprite->sTimer++; + if (sprite->sTimer == 11) PlaySE(SE_BALL_TRADE); - monSpriteId = sprite->data[0]; + + monSpriteId = sprite->sMonSpriteId; if (gSprites[monSpriteId].affineAnimEnded) { StartSpriteAnim(sprite, 2); gSprites[monSpriteId].invisible = TRUE; - sprite->data[5] = 0; + sprite->sTimer = 0; sprite->callback = SpriteCB_TradePokeballEnd; } else @@ -1191,6 +1217,13 @@ static void SpriteCB_TradePokeballEnd(struct Sprite *sprite) sprite->callback = SpriteCallbackDummy; } +#undef sMonSpriteId +#undef sDelay +#undef sMonPalNum +#undef sFadePalsLo +#undef sFadePalsHi +#undef sTimer + static void Unref_DestroySpriteAndFreeResources(struct Sprite *sprite) { DestroySpriteAndFreeResources(sprite); diff --git a/src/pokedex.c b/src/pokedex.c index 206782e59..b247c8c8d 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4428,37 +4428,37 @@ bool16 HasAllMons(void) return TRUE; } -static void ResetOtherVideoRegisters(u16 a) +static void ResetOtherVideoRegisters(u16 regBits) { - if (!(a & DISPCNT_BG0_ON)) + if (!(regBits & DISPCNT_BG0_ON)) { ClearGpuRegBits(0, DISPCNT_BG0_ON); SetGpuReg(REG_OFFSET_BG0CNT, 0); SetGpuReg(REG_OFFSET_BG0HOFS, 0); SetGpuReg(REG_OFFSET_BG0VOFS, 0); } - if (!(a & DISPCNT_BG1_ON)) + if (!(regBits & DISPCNT_BG1_ON)) { ClearGpuRegBits(0, DISPCNT_BG1_ON); SetGpuReg(REG_OFFSET_BG1CNT, 0); SetGpuReg(REG_OFFSET_BG1HOFS, 0); SetGpuReg(REG_OFFSET_BG1VOFS, 0); } - if (!(a & DISPCNT_BG2_ON)) + if (!(regBits & DISPCNT_BG2_ON)) { ClearGpuRegBits(0, DISPCNT_BG2_ON); SetGpuReg(REG_OFFSET_BG2CNT, 0); SetGpuReg(REG_OFFSET_BG2HOFS, 0); SetGpuReg(REG_OFFSET_BG2VOFS, 0); } - if (!(a & DISPCNT_BG3_ON)) + if (!(regBits & DISPCNT_BG3_ON)) { ClearGpuRegBits(0, DISPCNT_BG3_ON); SetGpuReg(REG_OFFSET_BG3CNT, 0); SetGpuReg(REG_OFFSET_BG3HOFS, 0); SetGpuReg(REG_OFFSET_BG3VOFS, 0); } - if (!(a & DISPCNT_OBJ_ON)) + if (!(regBits & DISPCNT_OBJ_ON)) { ClearGpuRegBits(0, DISPCNT_OBJ_ON); ResetSpriteData(); diff --git a/src/pokedex_area_region_map.c b/src/pokedex_area_region_map.c index 4926c019d..ff32f8eef 100644 --- a/src/pokedex_area_region_map.c +++ b/src/pokedex_area_region_map.c @@ -63,7 +63,7 @@ void FreePokedexAreaMapBgNum(void) TRY_FREE_AND_SET_NULL(sPokedexAreaMapBgNum); } -void PokedexAreaMapChangeBgY(u32 a0) +void PokedexAreaMapChangeBgY(u32 move) { - ChangeBgY(*sPokedexAreaMapBgNum, a0 * 0x100, BG_COORD_SET); + ChangeBgY(*sPokedexAreaMapBgNum, move * 0x100, BG_COORD_SET); } diff --git a/src/pokemon.c b/src/pokemon.c index af5771a6a..db0febe26 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5798,13 +5798,13 @@ u16 GetLinkTrainerFlankId(u8 linkPlayerId) return flankId; } -s32 GetBattlerMultiplayerId(u16 a1) +s32 GetBattlerMultiplayerId(u16 id) { - s32 id; - for (id = 0; id < MAX_LINK_PLAYERS; id++) - if (gLinkPlayers[id].id == a1) + s32 multiplayerId; + for (multiplayerId = 0; multiplayerId < MAX_LINK_PLAYERS; multiplayerId++) + if (gLinkPlayers[multiplayerId].id == id) break; - return id; + return multiplayerId; } u8 GetTrainerEncounterMusicId(u16 trainerOpponentId) diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index e00f5dbc8..32333ee67 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -3612,7 +3612,6 @@ static u32 AddMessageWindow(u32 left, u32 top, u32 width, u32 height) static void CreatePokeJumpYesNoMenu(u16 left, u16 top, u8 cursorPos) { struct WindowTemplate window; - u8 a = cursorPos; window.bg = BG_INTERFACE; window.tilemapLeft = left; @@ -3622,7 +3621,7 @@ static void CreatePokeJumpYesNoMenu(u16 left, u16 top, u8 cursorPos) window.paletteNum = 2; window.baseBlock = 0x2B; - CreateYesNoMenu(&window, 1, 0xD, a); + CreateYesNoMenu(&window, 1, 0xD, cursorPos); } // "Points" for jump score and "times" for number of jumps in a row diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 10c69a422..e33e79460 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -195,62 +195,62 @@ static bool8 LoadGraphics(void); static void CB2_InitSummaryScreen(void); static void InitBGs(void); static bool8 DecompressGraphics(void); -static void CopyMonToSummaryStruct(struct Pokemon* a); -static bool8 ExtractMonDataToSummaryStruct(struct Pokemon* a); +static void CopyMonToSummaryStruct(struct Pokemon*); +static bool8 ExtractMonDataToSummaryStruct(struct Pokemon*); static void SetDefaultTilemaps(void); -static void CloseSummaryScreen(u8 taskId); -static void Task_HandleInput(u8 taskId); -static void ChangeSummaryPokemon(u8 taskId, s8 a); -static void Task_ChangeSummaryMon(u8 taskId); -static s8 AdvanceMonIndex(s8 delta); -static s8 AdvanceMultiBattleMonIndex(s8 delta); -static bool8 IsValidToViewInMulti(struct Pokemon* mon); -static void ChangePage(u8 taskId, s8 a); -static void PssScrollRight(u8 taskId); -static void PssScrollRightEnd(u8 taskId); -static void PssScrollLeft(u8 taskId); -static void PssScrollLeftEnd(u8 taskId); +static void CloseSummaryScreen(u8); +static void Task_HandleInput(u8); +static void ChangeSummaryPokemon(u8, s8); +static void Task_ChangeSummaryMon(u8); +static s8 AdvanceMonIndex(s8); +static s8 AdvanceMultiBattleMonIndex(s8); +static bool8 IsValidToViewInMulti(struct Pokemon*); +static void ChangePage(u8, s8); +static void PssScrollRight(u8); +static void PssScrollRightEnd(u8); +static void PssScrollLeft(u8); +static void PssScrollLeftEnd(u8); static void TryDrawExperienceProgressBar(void); -static void SwitchToMoveSelection(u8 taskId); -static void Task_HandleInput_MoveSelect(u8 taskId); +static void SwitchToMoveSelection(u8); +static void Task_HandleInput_MoveSelect(u8); static bool8 HasMoreThanOneMove(void); -static void ChangeSelectedMove(s16 *taskData, s8 direction, u8 *moveIndexPtr); -static void CloseMoveSelectMode(u8 taskId); -static void SwitchToMovePositionSwitchMode(u8 a); -static void Task_HandleInput_MovePositionSwitch(u8 taskId); -static void ExitMovePositionSwitchMode(u8 taskId, bool8 swapMoves); -static void SwapMonMoves(struct Pokemon *mon, u8 moveIndex1, u8 moveIndex2); -static void SwapBoxMonMoves(struct BoxPokemon *mon, u8 moveIndex1, u8 moveIndex2); -static void Task_SetHandleReplaceMoveInput(u8 taskId); -static void Task_HandleReplaceMoveInput(u8 taskId); +static void ChangeSelectedMove(s16 *, s8, u8 *); +static void CloseMoveSelectMode(u8); +static void SwitchToMovePositionSwitchMode(u8); +static void Task_HandleInput_MovePositionSwitch(u8); +static void ExitMovePositionSwitchMode(u8, bool8); +static void SwapMonMoves(struct Pokemon *, u8, u8); +static void SwapBoxMonMoves(struct BoxPokemon *, u8, u8); +static void Task_SetHandleReplaceMoveInput(u8); +static void Task_HandleReplaceMoveInput(u8); static bool8 CanReplaceMove(void); -static void ShowCantForgetHMsWindow(u8 taskId); -static void Task_HandleInputCantForgetHMsMoves(u8 taskId); +static void ShowCantForgetHMsWindow(u8); +static void Task_HandleInputCantForgetHMsMoves(u8); static void DrawPagination(void); -static void HandlePowerAccTilemap(u16 a, s16 b); -static void Task_ShowPowerAccWindow(u8 taskId); -static void HandleAppealJamTilemap(u16 a, s16 b, u16 c); -static void Task_ShowAppealJamWindow(u8 taskId); -static void HandleStatusTilemap(u16 a, s16 b); -static void Task_ShowStatusWindow(u8 taskId); -static void TilemapFiveMovesDisplay(u16 *dst, u16 palette, bool8 remove); -static void DrawPokerusCuredSymbol(struct Pokemon* mon); -static void DrawExperienceProgressBar(struct Pokemon* mon); -static void DrawContestMoveHearts(u16 move); +static void HandlePowerAccTilemap(u16, s16); +static void Task_ShowPowerAccWindow(u8); +static void HandleAppealJamTilemap(u16, s16, u16); +static void Task_ShowAppealJamWindow(u8); +static void HandleStatusTilemap(u16, s16); +static void Task_ShowStatusWindow(u8); +static void TilemapFiveMovesDisplay(u16 *, u16, bool8); +static void DrawPokerusCuredSymbol(struct Pokemon*); +static void DrawExperienceProgressBar(struct Pokemon*); +static void DrawContestMoveHearts(u16); static void LimitEggSummaryPageDisplay(void); static void ResetWindows(void); static void PrintMonInfo(void); static void PrintNotEggInfo(void); static void PrintEggInfo(void); -static void PrintGenderSymbol(struct Pokemon *mon, u16 a); +static void PrintGenderSymbol(struct Pokemon *, u16); static void PrintPageNamesAndStats(void); -static void PutPageWindowTilemaps(u8 a); -static void ClearPageWindowTilemaps(u8 a); -static void RemoveWindowByIndex(u8 a); -static void PrintPageSpecificText(u8 a); -static void CreateTextPrinterTask(u8 a); +static void PutPageWindowTilemaps(u8); +static void ClearPageWindowTilemaps(u8); +static void RemoveWindowByIndex(u8); +static void PrintPageSpecificText(u8); +static void CreateTextPrinterTask(u8); static void PrintInfoPageText(void); -static void Task_PrintInfoPage(u8 taskId); +static void Task_PrintInfoPage(u8); static void PrintMonOTName(void); static void PrintMonOTID(void); static void PrintMonAbilityName(void); @@ -258,7 +258,7 @@ static void PrintMonAbilityDescription(void); static void BufferMonTrainerMemo(void); static void PrintMonTrainerMemo(void); static void BufferNatureString(void); -static void GetMetLevelString(u8 *a); +static void GetMetLevelString(u8 *); static bool8 DoesMonOTMatchOwner(void); static bool8 DidMonComeFromGBAGames(void); static bool8 IsInGamePartnerMon(void); @@ -266,7 +266,7 @@ static void PrintEggOTName(void); static void PrintEggOTID(void); static void PrintEggState(void); static void PrintEggMemo(void); -static void Task_PrintSkillsPage(u8 taskId); +static void Task_PrintSkillsPage(u8); static void PrintHeldItemName(void); static void PrintSkillsPageText(void); static void PrintRibbonCount(void); @@ -276,18 +276,18 @@ static void BufferRightColumnStats(void); static void PrintRightColumnStats(void); static void PrintExpPointsNextLevel(void); static void PrintBattleMoves(void); -static void Task_PrintBattleMoves(u8 taskId); -static void PrintMoveNameAndPP(u8 a); +static void Task_PrintBattleMoves(u8); +static void PrintMoveNameAndPP(u8); static void PrintContestMoves(void); -static void Task_PrintContestMoves(u8 taskId); -static void PrintContestMoveDescription(u8 a); -static void PrintMoveDetails(u16 a); +static void Task_PrintContestMoves(u8); +static void PrintContestMoveDescription(u8); +static void PrintMoveDetails(u16); static void PrintNewMoveDetailsOrCancelText(void); static void AddAndFillMoveNamesWindow(void); -static void SwapMovesNamesPP(u8 moveIndex1, u8 moveIndex2); +static void SwapMovesNamesPP(u8, u8); static void PrintHMMovesCantBeForgotten(void); static void ResetSpriteIds(void); -static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible); +static void SetSpriteInvisibility(u8, bool8); static void HidePageSpecificSprites(void); static void SetTypeIcons(void); static void CreateMoveTypeIcons(void); @@ -295,20 +295,20 @@ static void SetMonTypeIcons(void); static void SetMoveTypeIcons(void); static void SetContestMoveTypeIcons(void); static void SetNewMoveTypeIcon(void); -static void SwapMovesTypeSprites(u8 moveIndex1, u8 moveIndex2); -static u8 LoadMonGfxAndSprite(struct Pokemon *a, s16 *b); -static u8 CreateMonSprite(struct Pokemon *unused); +static void SwapMovesTypeSprites(u8, u8); +static u8 LoadMonGfxAndSprite(struct Pokemon *, s16 *); +static u8 CreateMonSprite(struct Pokemon *); static void SpriteCB_Pokemon(struct Sprite *); static void StopPokemonAnimations(void); -static void CreateMonMarkingsSprite(struct Pokemon *mon); -static void RemoveAndCreateMonMarkingsSprite(struct Pokemon *mon); -static void CreateCaughtBallSprite(struct Pokemon *mon); +static void CreateMonMarkingsSprite(struct Pokemon *); +static void RemoveAndCreateMonMarkingsSprite(struct Pokemon *); +static void CreateCaughtBallSprite(struct Pokemon *); static void CreateSetStatusSprite(void); -static void CreateMoveSelectorSprites(u8 idArrayStart); -static void SpriteCb_MoveSelector(struct Sprite *sprite); -static void DestroyMoveSelectorSprites(u8 firstArrayId); -static void SetMainMoveSelectorColor(u8 whichColor); -static void KeepMoveSelectorVisible(u8 firstSpriteId); +static void CreateMoveSelectorSprites(u8); +static void SpriteCb_MoveSelector(struct Sprite *); +static void DestroyMoveSelectorSprites(u8); +static void SetMainMoveSelectorColor(u8); +static void KeepMoveSelectorVisible(u8); static void SummaryScreen_DestroyAnimDelayTask(void); // const rom data diff --git a/src/pokenav.c b/src/pokenav.c index f9a6614a8..5e8727c64 100644 --- a/src/pokenav.c +++ b/src/pokenav.c @@ -37,16 +37,16 @@ struct PokenavCallbacks static u32 GetCurrentMenuCB(void); static u32 IsActiveMenuLoopTaskActive_(void); -static bool32 SetActivePokenavMenu(u32 menuId); +static bool32 SetActivePokenavMenu(u32); static bool32 AnyMonHasRibbon(void); -static void InitPokenavResources(struct PokenavResources *a0); +static void InitPokenavResources(struct PokenavResources *); static void InitKeys_(void); static void FreePokenavResources(void); static void VBlankCB_Pokenav(void); static void CB2_Pokenav(void); -static void Task_RunLoopedTask_LinkMode(u8 a0); -static void Task_RunLoopedTask(u8 taskId); -static void Task_Pokenav(u8 taskId); +static void Task_RunLoopedTask_LinkMode(u8); +static void Task_RunLoopedTask(u8); +static void Task_Pokenav(u8); static void CB2_InitPokenavForTutorial(void); const struct PokenavCallbacks PokenavMenuCallbacks[15] = diff --git a/src/pokenav_list.c b/src/pokenav_list.c index bdba1d2c0..350a78504 100644 --- a/src/pokenav_list.c +++ b/src/pokenav_list.c @@ -40,7 +40,7 @@ struct PokenavListWindowState { struct PokenavListSub { struct PokenavListMenuWindow listWindow; - u32 unk10; + u32 printStart; u32 printIndex; u32 itemSize; void * listPtr; @@ -59,7 +59,7 @@ struct PokenavListSub struct PokenavList { - struct PokenavListSub list; + struct PokenavListSub sub; u8 tilemapBuffer[BG_SCREEN_SIZE]; struct PokenavListWindowState windowState; s32 eraseIndex; @@ -100,12 +100,12 @@ static EWRAM_DATA u32 sMoveWindowDownIndex = 0; // Read, but pointlessly bool32 CreatePokenavList(const struct BgTemplate *bgTemplate, struct PokenavListTemplate *listTemplate, s32 tileOffset) { - struct PokenavList *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_LIST, sizeof(struct PokenavList)); - if (structPtr == NULL) + struct PokenavList *list = AllocSubstruct(POKENAV_SUBSTRUCT_LIST, sizeof(struct PokenavList)); + if (list == NULL) return FALSE; - InitPokenavListWindowState(&structPtr->windowState, listTemplate); - if (!CopyPokenavListMenuTemplate(&structPtr->list, bgTemplate, listTemplate, tileOffset)) + InitPokenavListWindowState(&list->windowState, listTemplate); + if (!CopyPokenavListMenuTemplate(&list->sub, bgTemplate, listTemplate, tileOffset)) return FALSE; CreateLoopedTask(LoopedTask_CreatePokenavList, 6); @@ -119,31 +119,31 @@ bool32 IsCreatePokenavListTaskActive(void) void DestroyPokenavList(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - DestroyListArrows(&structPtr->list); - RemoveWindow(structPtr->list.listWindow.windowId); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + DestroyListArrows(&list->sub); + RemoveWindow(list->sub.listWindow.windowId); FreePokenavSubstruct(POKENAV_SUBSTRUCT_LIST); } static u32 LoopedTask_CreatePokenavList(s32 state) { - struct PokenavList *structPtr; + struct PokenavList *list; if (IsDma3ManagerBusyWithBgCopy()) return LT_PAUSE; - structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); switch (state) { case 0: - InitPokenavListBg(structPtr); + InitPokenavListBg(list); return LT_INC_AND_PAUSE; case 1: - InitPokenavListWindow(&structPtr->list.listWindow); + InitPokenavListWindow(&list->sub.listWindow); return LT_INC_AND_PAUSE; case 2: - InitListItems(&structPtr->windowState, &structPtr->list); + InitListItems(&list->windowState, &list->sub); return LT_INC_AND_PAUSE; case 3: if (IsPrintListItemsTaskActive()) @@ -156,24 +156,24 @@ static u32 LoopedTask_CreatePokenavList(s32 state) return LT_INC_AND_CONTINUE; } case 4: - CreateListArrowSprites(&structPtr->windowState, &structPtr->list); + CreateListArrowSprites(&list->windowState, &list->sub); return LT_FINISH; default: return LT_FINISH; } } -static void InitPokenavListBg(struct PokenavList *a0) +static void InitPokenavListBg(struct PokenavList *list) { - u16 tileNum = (a0->list.listWindow.fillValue << 12) | a0->list.listWindow.tileOffset; - BgDmaFill(a0->list.listWindow.bg, PIXEL_FILL(1), a0->list.listWindow.tileOffset, 1); - BgDmaFill(a0->list.listWindow.bg, PIXEL_FILL(4), a0->list.listWindow.tileOffset + 1, 1); - SetBgTilemapBuffer(a0->list.listWindow.bg, a0->tilemapBuffer); - FillBgTilemapBufferRect_Palette0(a0->list.listWindow.bg, tileNum, 0, 0, 32, 32); - ChangeBgY(a0->list.listWindow.bg, 0, BG_COORD_SET); - ChangeBgX(a0->list.listWindow.bg, 0, BG_COORD_SET); - ChangeBgY(a0->list.listWindow.bg, a0->list.listWindow.y << 11, BG_COORD_SUB); - CopyBgTilemapBufferToVram(a0->list.listWindow.bg); + u16 tileNum = (list->sub.listWindow.fillValue << 12) | list->sub.listWindow.tileOffset; + BgDmaFill(list->sub.listWindow.bg, PIXEL_FILL(1), list->sub.listWindow.tileOffset, 1); + BgDmaFill(list->sub.listWindow.bg, PIXEL_FILL(4), list->sub.listWindow.tileOffset + 1, 1); + SetBgTilemapBuffer(list->sub.listWindow.bg, list->tilemapBuffer); + FillBgTilemapBufferRect_Palette0(list->sub.listWindow.bg, tileNum, 0, 0, 32, 32); + ChangeBgY(list->sub.listWindow.bg, 0, BG_COORD_SET); + ChangeBgX(list->sub.listWindow.bg, 0, BG_COORD_SET); + ChangeBgY(list->sub.listWindow.bg, list->sub.listWindow.y << 11, BG_COORD_SUB); + CopyBgTilemapBufferToVram(list->sub.listWindow.bg); } static void InitPokenavListWindow(struct PokenavListMenuWindow *listWindow) @@ -183,16 +183,16 @@ static void InitPokenavListWindow(struct PokenavListMenuWindow *listWindow) CopyWindowToVram(listWindow->windowId, COPYWIN_MAP); } -static void InitListItems(struct PokenavListWindowState *windowState, struct PokenavListSub *a1) +static void InitListItems(struct PokenavListWindowState *windowState, struct PokenavListSub *subPtr) { s32 numToPrint = windowState->listLength - windowState->windowTopIndex; if (numToPrint > windowState->entriesOnscreen) numToPrint = windowState->entriesOnscreen; - PrintListItems(windowState->listPtr, windowState->windowTopIndex, numToPrint, windowState->listItemSize, 0, a1); + PrintListItems(windowState->listPtr, windowState->windowTopIndex, numToPrint, windowState->listItemSize, 0, subPtr); } -static void PrintListItems(void * listPtr, u32 topIndex, u32 numItems, u32 itemSize, u32 a4, struct PokenavListSub *list) +static void PrintListItems(void * listPtr, u32 topIndex, u32 numItems, u32 itemSize, u32 printStart, struct PokenavListSub *list) { if (numItems == 0) return; @@ -202,7 +202,7 @@ static void PrintListItems(void * listPtr, u32 topIndex, u32 numItems, u32 itemS list->listWindow.numPrinted = 0; list->listWindow.numToPrint = numItems; list->printIndex = topIndex; - list->unk10 = a4; + list->printStart = printStart; CreateLoopedTask(LoopedTask_PrintListItems, 5); } @@ -214,31 +214,31 @@ static bool32 IsPrintListItemsTaskActive(void) static u32 LoopedTask_PrintListItems(s32 state) { u32 row; - struct PokenavListSub *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListSub *listSub = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); switch (state) { case 0: - row = (structPtr->listWindow.unkA + structPtr->listWindow.numPrinted + structPtr->unk10) & 0xF; - structPtr->bufferItemFunc(structPtr->listPtr, structPtr->itemTextBuffer); - if (structPtr->iconDrawFunc != NULL) - structPtr->iconDrawFunc(structPtr->listWindow.windowId, structPtr->printIndex, row); + row = (listSub->listWindow.unkA + listSub->listWindow.numPrinted + listSub->printStart) & 0xF; + listSub->bufferItemFunc(listSub->listPtr, listSub->itemTextBuffer); + if (listSub->iconDrawFunc != NULL) + listSub->iconDrawFunc(listSub->listWindow.windowId, listSub->printIndex, row); - AddTextPrinterParameterized(structPtr->listWindow.windowId, structPtr->listWindow.fontId, structPtr->itemTextBuffer, 8, (row << 4) + 1, TEXT_SKIP_DRAW, NULL); - if (++structPtr->listWindow.numPrinted >= structPtr->listWindow.numToPrint) + AddTextPrinterParameterized(listSub->listWindow.windowId, listSub->listWindow.fontId, listSub->itemTextBuffer, 8, (row << 4) + 1, TEXT_SKIP_DRAW, NULL); + if (++listSub->listWindow.numPrinted >= listSub->listWindow.numToPrint) { // Finished printing items. If icons were being drawn, draw the // window tilemap and graphics. Otherwise just do the graphics - if (structPtr->iconDrawFunc != NULL) - CopyWindowToVram(structPtr->listWindow.windowId, COPYWIN_FULL); + if (listSub->iconDrawFunc != NULL) + CopyWindowToVram(listSub->listWindow.windowId, COPYWIN_FULL); else - CopyWindowToVram(structPtr->listWindow.windowId, COPYWIN_GFX); + CopyWindowToVram(listSub->listWindow.windowId, COPYWIN_GFX); return LT_INC_AND_PAUSE; } else { - structPtr->listPtr += structPtr->itemSize; - structPtr->printIndex++; + listSub->listPtr += listSub->itemSize; + listSub->printIndex++; return LT_CONTINUE; } case 1: @@ -251,42 +251,42 @@ static u32 LoopedTask_PrintListItems(s32 state) static bool32 ShouldShowUpArrow(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - return (structPtr->windowState.windowTopIndex != 0); + return (list->windowState.windowTopIndex != 0); } static bool32 ShouldShowDownArrow(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - struct PokenavListWindowState *subPtr = &structPtr->windowState; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListWindowState *windowState = &list->windowState; - return (subPtr->windowTopIndex + subPtr->entriesOnscreen < subPtr->listLength); + return (windowState->windowTopIndex + windowState->entriesOnscreen < windowState->listLength); } static void MoveListWindow(s32 delta, bool32 printItems) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - struct PokenavListWindowState *subPtr = &structPtr->windowState; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListWindowState *windowState = &list->windowState; if (delta < 0) { - if (subPtr->windowTopIndex + delta < 0) - delta = -1 * subPtr->windowTopIndex; + if (windowState->windowTopIndex + delta < 0) + delta = -1 * windowState->windowTopIndex; if (printItems) - PrintListItems(subPtr->listPtr, subPtr->windowTopIndex + delta, delta * -1, subPtr->listItemSize, delta, &structPtr->list); + PrintListItems(windowState->listPtr, windowState->windowTopIndex + delta, delta * -1, windowState->listItemSize, delta, &list->sub); } else if (printItems) { - s32 index = sMoveWindowDownIndex = subPtr->windowTopIndex + subPtr->entriesOnscreen; - if (index + delta >= subPtr->listLength) - delta = subPtr->listLength - index; + s32 index = sMoveWindowDownIndex = windowState->windowTopIndex + windowState->entriesOnscreen; + if (index + delta >= windowState->listLength) + delta = windowState->listLength - index; - PrintListItems(subPtr->listPtr, index, delta, subPtr->listItemSize, subPtr->entriesOnscreen, &structPtr->list); + PrintListItems(windowState->listPtr, index, delta, windowState->listItemSize, windowState->entriesOnscreen, &list->sub); } - CreateMoveListWindowTask(delta, &structPtr->list); - subPtr->windowTopIndex += delta; + CreateMoveListWindowTask(delta, &list->sub); + windowState->windowTopIndex += delta; } static void CreateMoveListWindowTask(s32 delta, struct PokenavListSub *list) @@ -305,8 +305,8 @@ static u32 LoopedTask_MoveListWindow(s32 state) { s32 oldY, newY; bool32 finished; - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - struct PokenavListSub *subPtr = &structPtr->list; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListSub *subPtr = &list->sub; switch (state) { @@ -342,23 +342,23 @@ static u32 LoopedTask_MoveListWindow(s32 state) bool32 PokenavList_IsMoveWindowTaskActive(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - return IsLoopedTaskActive(structPtr->list.loopedTaskId); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + return IsLoopedTaskActive(list->sub.loopedTaskId); } static struct PokenavListWindowState *GetPokenavListWindowState(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - return &structPtr->windowState; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + return &list->windowState; } int PokenavList_MoveCursorUp(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); - if (structPtr->selectedIndexOffset != 0) + if (windowState->selectedIndexOffset != 0) { - structPtr->selectedIndexOffset--; + windowState->selectedIndexOffset--; return 1; } if (ShouldShowUpArrow()) @@ -371,13 +371,13 @@ int PokenavList_MoveCursorUp(void) int PokenavList_MoveCursorDown(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); - if (structPtr->windowTopIndex + structPtr->selectedIndexOffset >= structPtr->listLength - 1) + if (windowState->windowTopIndex + windowState->selectedIndexOffset >= windowState->listLength - 1) return 0; - if (structPtr->selectedIndexOffset < structPtr->entriesOnscreen - 1) + if (windowState->selectedIndexOffset < windowState->entriesOnscreen - 1) { - structPtr->selectedIndexOffset++; + windowState->selectedIndexOffset++; return 1; } if (ShouldShowDownArrow()) @@ -391,20 +391,20 @@ int PokenavList_MoveCursorDown(void) int PokenavList_PageUp(void) { s32 scroll; - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); if (ShouldShowUpArrow()) { - if (structPtr->windowTopIndex >= structPtr->entriesOnscreen) - scroll = structPtr->entriesOnscreen; + if (windowState->windowTopIndex >= windowState->entriesOnscreen) + scroll = windowState->entriesOnscreen; else - scroll = structPtr->windowTopIndex; + scroll = windowState->windowTopIndex; MoveListWindow(scroll * -1, TRUE); return 2; } - else if (structPtr->selectedIndexOffset != 0) + else if (windowState->selectedIndexOffset != 0) { - structPtr->selectedIndexOffset = 0; + windowState->selectedIndexOffset = 0; return 1; } return 0; @@ -412,112 +412,112 @@ int PokenavList_PageUp(void) int PokenavList_PageDown(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); if (ShouldShowDownArrow()) { - s32 windowBottomIndex = structPtr->windowTopIndex + structPtr->entriesOnscreen; - s32 scroll = structPtr->entriesOffscreen - structPtr->windowTopIndex; + s32 windowBottomIndex = windowState->windowTopIndex + windowState->entriesOnscreen; + s32 scroll = windowState->entriesOffscreen - windowState->windowTopIndex; - if (windowBottomIndex <= structPtr->entriesOffscreen) - scroll = structPtr->entriesOnscreen; + if (windowBottomIndex <= windowState->entriesOffscreen) + scroll = windowState->entriesOnscreen; MoveListWindow(scroll, TRUE); return 2; } else { s32 cursor, lastVisibleIndex; - if (structPtr->listLength >= structPtr->entriesOnscreen) + if (windowState->listLength >= windowState->entriesOnscreen) { - cursor = structPtr->selectedIndexOffset; - lastVisibleIndex = structPtr->entriesOnscreen; + cursor = windowState->selectedIndexOffset; + lastVisibleIndex = windowState->entriesOnscreen; } else { - cursor = structPtr->selectedIndexOffset; - lastVisibleIndex = structPtr->listLength; + cursor = windowState->selectedIndexOffset; + lastVisibleIndex = windowState->listLength; } lastVisibleIndex -= 1; if (cursor >= lastVisibleIndex) return 0; - structPtr->selectedIndexOffset = lastVisibleIndex; + windowState->selectedIndexOffset = lastVisibleIndex; return 1; } } u32 PokenavList_GetSelectedIndex(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); - return structPtr->windowTopIndex + structPtr->selectedIndexOffset; + return windowState->windowTopIndex + windowState->selectedIndexOffset; } u32 PokenavList_GetTopIndex(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); - return structPtr->windowTopIndex; + return windowState->windowTopIndex; } void PokenavList_EraseListForCheckPage(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - structPtr->eraseIndex = 0; - structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_EraseListForCheckPage, 6); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list->eraseIndex = 0; + list->loopedTaskId = CreateLoopedTask(LoopedTask_EraseListForCheckPage, 6); } void PrintCheckPageInfo(s16 delta) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - structPtr->windowState.windowTopIndex += delta; - structPtr->eraseIndex = 0; - structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_PrintCheckPageInfo, 6); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list->windowState.windowTopIndex += delta; + list->eraseIndex = 0; + list->loopedTaskId = CreateLoopedTask(LoopedTask_PrintCheckPageInfo, 6); } void PokenavList_ReshowListFromCheckPage(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - structPtr->eraseIndex = 0; - structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_ReshowListFromCheckPage, 6); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list->eraseIndex = 0; + list->loopedTaskId = CreateLoopedTask(LoopedTask_ReshowListFromCheckPage, 6); } bool32 PokenavList_IsTaskActive(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - return IsLoopedTaskActive(structPtr->loopedTaskId); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + return IsLoopedTaskActive(list->loopedTaskId); } void PokenavList_DrawCurrentItemIcon(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - struct PokenavListWindowState *subPtr = &structPtr->windowState; - structPtr->list.iconDrawFunc(structPtr->list.listWindow.windowId, subPtr->windowTopIndex + subPtr->selectedIndexOffset, (structPtr->list.listWindow.unkA + subPtr->selectedIndexOffset) & 0xF); - CopyWindowToVram(structPtr->list.listWindow.windowId, COPYWIN_MAP); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListWindowState *windowState = &list->windowState; + list->sub.iconDrawFunc(list->sub.listWindow.windowId, windowState->windowTopIndex + windowState->selectedIndexOffset, (list->sub.listWindow.unkA + windowState->selectedIndexOffset) & 0xF); + CopyWindowToVram(list->sub.listWindow.windowId, COPYWIN_MAP); } static u32 LoopedTask_EraseListForCheckPage(s32 state) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); switch (state) { case 0: - ToggleListArrows(&structPtr->list, 1); + ToggleListArrows(&list->sub, 1); // fall-through case 1: - if (structPtr->eraseIndex != structPtr->windowState.selectedIndexOffset) - EraseListEntry(&structPtr->list.listWindow, structPtr->eraseIndex, 1); + if (list->eraseIndex != list->windowState.selectedIndexOffset) + EraseListEntry(&list->sub.listWindow, list->eraseIndex, 1); - structPtr->eraseIndex++; + list->eraseIndex++; return LT_INC_AND_PAUSE; case 2: if (!IsDma3ManagerBusyWithBgCopy()) { - if (structPtr->eraseIndex != structPtr->windowState.entriesOnscreen) + if (list->eraseIndex != list->windowState.entriesOnscreen) return LT_SET_STATE(1); - if (structPtr->windowState.selectedIndexOffset != 0) - EraseListEntry(&structPtr->list.listWindow, structPtr->eraseIndex, structPtr->windowState.selectedIndexOffset); + if (list->windowState.selectedIndexOffset != 0) + EraseListEntry(&list->sub.listWindow, list->eraseIndex, list->windowState.selectedIndexOffset); return LT_INC_AND_PAUSE; } @@ -525,9 +525,9 @@ static u32 LoopedTask_EraseListForCheckPage(s32 state) case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - if (structPtr->windowState.selectedIndexOffset != 0) + if (list->windowState.selectedIndexOffset != 0) { - MoveListWindow(structPtr->windowState.selectedIndexOffset, FALSE); + MoveListWindow(list->windowState.selectedIndexOffset, FALSE); return LT_INC_AND_PAUSE; } return LT_FINISH; @@ -537,7 +537,7 @@ static u32 LoopedTask_EraseListForCheckPage(s32 state) if (PokenavList_IsMoveWindowTaskActive()) return LT_PAUSE; - structPtr->windowState.selectedIndexOffset = 0; + list->windowState.selectedIndexOffset = 0; return LT_FINISH; } return LT_FINISH; @@ -545,35 +545,35 @@ static u32 LoopedTask_EraseListForCheckPage(s32 state) static u32 LoopedTask_PrintCheckPageInfo(s32 state) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); if (IsDma3ManagerBusyWithBgCopy()) return LT_PAUSE; switch (state) { case 0: - PrintCheckPageTrainerName(&structPtr->windowState, &structPtr->list); + PrintCheckPageTrainerName(&list->windowState, &list->sub); break; case 1: - PrintMatchCallFieldNames(&structPtr->list, 0); + PrintMatchCallFieldNames(&list->sub, 0); break; case 2: - PrintMatchCallFlavorText(&structPtr->windowState, &structPtr->list, CHECK_PAGE_STRATEGY); + PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_STRATEGY); break; case 3: - PrintMatchCallFieldNames(&structPtr->list, 1); + PrintMatchCallFieldNames(&list->sub, 1); break; case 4: - PrintMatchCallFlavorText(&structPtr->windowState, &structPtr->list, CHECK_PAGE_POKEMON); + PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_POKEMON); break; case 5: - PrintMatchCallFieldNames(&structPtr->list, 2); + PrintMatchCallFieldNames(&list->sub, 2); break; case 6: - PrintMatchCallFlavorText(&structPtr->windowState, &structPtr->list, CHECK_PAGE_INTRO_1); + PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_INTRO_1); break; case 7: - PrintMatchCallFlavorText(&structPtr->windowState, &structPtr->list, CHECK_PAGE_INTRO_2); + PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_INTRO_2); break; default: return LT_FINISH; @@ -583,30 +583,30 @@ static u32 LoopedTask_PrintCheckPageInfo(s32 state) static u32 LoopedTask_ReshowListFromCheckPage(s32 state) { - struct PokenavList *structPtr; + struct PokenavList *list; struct PokenavListWindowState *windowState; - struct PokenavListSub *subPtr0; + struct PokenavListSub *subPtr; s32 r5, *ptr; if (IsDma3ManagerBusyWithBgCopy()) return LT_PAUSE; - structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - windowState = &structPtr->windowState; - subPtr0 = &structPtr->list; + list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + windowState = &list->windowState; + subPtr = &list->sub; switch (state) { case 0: // Rewrite the name of the trainer whose check page was just being viewed. // This is done to erase the red background it had. - PrintMatchCallListTrainerName(windowState, subPtr0); + PrintMatchCallListTrainerName(windowState, subPtr); return LT_INC_AND_PAUSE; case 1: - ptr = &structPtr->eraseIndex; - if (++(*ptr) < structPtr->windowState.entriesOnscreen) + ptr = &list->eraseIndex; + if (++(*ptr) < list->windowState.entriesOnscreen) { - EraseListEntry(&subPtr0->listWindow, *ptr, 1); + EraseListEntry(&subPtr->listWindow, *ptr, 1); return LT_PAUSE; } @@ -617,7 +617,7 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) { s32 r4 = windowState->windowTopIndex; r5 = -r4; - EraseListEntry(&subPtr0->listWindow, r5, r4); + EraseListEntry(&subPtr->listWindow, r5, r4); windowState->selectedIndexOffset = r4; *ptr = r5; return LT_INC_AND_PAUSE; @@ -629,7 +629,7 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) { s32 r4 = windowState->windowTopIndex + windowState->entriesOnscreen - windowState->listLength; r5 = -r4; - EraseListEntry(&subPtr0->listWindow, r5, r4); + EraseListEntry(&subPtr->listWindow, r5, r4); windowState->selectedIndexOffset = r4; *ptr = r5; return LT_INC_AND_PAUSE; @@ -637,55 +637,55 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) } return LT_SET_STATE(4); case 2: - MoveListWindow(structPtr->eraseIndex, FALSE); + MoveListWindow(list->eraseIndex, FALSE); return LT_INC_AND_PAUSE; case 3: if (!PokenavList_IsMoveWindowTaskActive()) { - structPtr->eraseIndex = 0; + list->eraseIndex = 0; return LT_INC_AND_CONTINUE; } return LT_PAUSE; case 4: - PrintListItems(windowState->listPtr, windowState->windowTopIndex + structPtr->eraseIndex, 1, windowState->listItemSize, structPtr->eraseIndex, &structPtr->list); + PrintListItems(windowState->listPtr, windowState->windowTopIndex + list->eraseIndex, 1, windowState->listItemSize, list->eraseIndex, &list->sub); return LT_INC_AND_PAUSE; case 5: if (IsPrintListItemsTaskActive()) return LT_PAUSE; - if (++structPtr->eraseIndex >= windowState->listLength || structPtr->eraseIndex >= windowState->entriesOnscreen) + if (++list->eraseIndex >= windowState->listLength || list->eraseIndex >= windowState->entriesOnscreen) return LT_INC_AND_CONTINUE; return LT_SET_STATE(4); case 6: - ToggleListArrows(subPtr0, 0); + ToggleListArrows(subPtr, 0); return LT_FINISH; } return LT_FINISH; } -static void EraseListEntry(struct PokenavListMenuWindow *listWindow, s32 a1, s32 a2) +static void EraseListEntry(struct PokenavListMenuWindow *listWindow, s32 offset, s32 entries) { u8 *tileData = (u8*)GetWindowAttribute(listWindow->windowId, WINDOW_TILE_DATA); u32 width = listWindow->width * 64; - a1 = (listWindow->unkA + a1) & 0xF; - if (a1 + a2 <= 16) + offset = (listWindow->unkA + offset) & 0xF; + if (offset + entries <= 16) { - CpuFastFill8(PIXEL_FILL(1), tileData + a1 * width, a2 * width); + CpuFastFill8(PIXEL_FILL(1), tileData + offset * width, entries * width); CopyWindowToVram(listWindow->windowId, COPYWIN_GFX); } else { - u32 v3 = 16 - a1; - u32 v4 = a2 - v3; + u32 v3 = 16 - offset; + u32 v4 = entries - v3; - CpuFastFill8(PIXEL_FILL(1), tileData + a1 * width, v3 * width); + CpuFastFill8(PIXEL_FILL(1), tileData + offset * width, v3 * width); CpuFastFill8(PIXEL_FILL(1), tileData, v4 * width); CopyWindowToVram(listWindow->windowId, COPYWIN_GFX); } - for (a2--; a2 != -1; a1 = (a1 + 1) & 0xF, a2--) - ClearRematchPokeballIcon(listWindow->windowId, a1); + for (entries--; entries != -1; offset = (offset + 1) & 0xF, entries--) + ClearRematchPokeballIcon(listWindow->windowId, offset); CopyWindowToVram(listWindow->windowId, COPYWIN_MAP); } @@ -744,7 +744,7 @@ static void PrintMatchCallFieldNames(struct PokenavListSub *list, u32 fieldId) CopyWindowRectToVram(list->listWindow.windowId, COPYWIN_GFX, 0, top << 1, list->listWindow.width, 2); } -static void PrintMatchCallFlavorText(struct PokenavListWindowState *a0, struct PokenavListSub *list, u32 checkPageEntry) +static void PrintMatchCallFlavorText(struct PokenavListWindowState *windowState, struct PokenavListSub *list, u32 checkPageEntry) { // lines 1, 3, and 5 are the field names printed by PrintMatchCallFieldNames static const u8 lineOffsets[CHECK_PAGE_ENTRY_COUNT] = { @@ -755,7 +755,7 @@ static void PrintMatchCallFlavorText(struct PokenavListWindowState *a0, struct P }; u32 r6 = (list->listWindow.unkA + lineOffsets[checkPageEntry]) & 0xF; - const u8 *str = GetMatchCallFlavorText(a0->windowTopIndex, checkPageEntry); + const u8 *str = GetMatchCallFlavorText(windowState->windowTopIndex, checkPageEntry); if (str != NULL) { @@ -894,8 +894,8 @@ static void ToggleListArrows(struct PokenavListSub *list, bool32 invisible) static void SpriteCB_RightArrow(struct Sprite *sprite) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - sprite->y2 = structPtr->windowState.selectedIndexOffset << 4; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + sprite->y2 = list->windowState.selectedIndexOffset << 4; } #define sTimer data[0] @@ -940,9 +940,9 @@ static void SpriteCB_UpArrow(struct Sprite *sprite) void PokenavList_ToggleVerticalArrows(bool32 invisible) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - structPtr->list.upArrow->sInvisible = invisible; - structPtr->list.downArrow->sInvisible = invisible; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list->sub.upArrow->sInvisible = invisible; + list->sub.downArrow->sInvisible = invisible; } #undef sTimer diff --git a/src/slot_machine.c b/src/slot_machine.c index 1dfa026e5..60b53f5a4 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -3865,21 +3865,15 @@ static void ReelTime_EndFailure(struct Task *task) static void LoadReelTimeWindowTilemap(s16 a0, s16 a1) { s16 i; - for (i = 4; i < 15; i++) - { LoadBgTilemap(1, &sReelTimeWindow_Tilemap[a1 + (i - 4) * 20], 2, 32 * i + a0); - } } static void ClearReelTimeWindowTilemap(s16 a0) { u8 i; - for (i = 4; i < 15; i++) - { LoadBgTilemap(1, sEmptyTilemap, 2, 32 * i + a0); - } } #undef tState @@ -4116,32 +4110,44 @@ static void CreateCreditPayoutNumberSprites(void) CreateCoinNumberSprite(x, 23, TRUE, i); } -static void CreateCoinNumberSprite(s16 x, s16 y, bool8 isPayout, s16 a3) +#define sIsPayout data[0] +#define sDigitMin data[1] +#define sDigitMax data[2] +#define sCurNum data[3] // Only used to determine whether the sprite has already been updated to show the correct digit + +static void CreateCoinNumberSprite(s16 x, s16 y, bool8 isPayout, s16 digitMult) { struct Sprite *sprite = &gSprites[CreateSprite(&sSpriteTemplate_CoinNumber, x, y, 13)]; sprite->oam.priority = 2; - sprite->data[0] = isPayout; - sprite->data[1] = a3; - sprite->data[2] = a3 * 10; - sprite->data[3] = -1; + sprite->sIsPayout = isPayout; + sprite->sDigitMin = digitMult; + sprite->sDigitMax = digitMult * 10; + sprite->sCurNum = -1; } static void SpriteCB_CoinNumber(struct Sprite *sprite) { u16 tag = sSlotMachine->coins; - if (sprite->data[0]) + if (sprite->sIsPayout) tag = sSlotMachine->payout; - if (sprite->data[3] != tag) + if (sprite->sCurNum != tag) { - sprite->data[3] = tag; - tag %= (u16)sprite->data[2]; - tag /= (u16)sprite->data[1]; - tag += 7; + // Convert total to current digit + sprite->sCurNum = tag; + tag %= (u16)sprite->sDigitMax; + tag /= (u16)sprite->sDigitMin; + + tag += GFXTAG_NUM_0; sprite->sheetTileStart = GetSpriteTileStartByTag(tag); SetSpriteSheetFrameTileNum(sprite); } } +#undef sIsPayout +#undef sDigitMin +#undef sDigitMax +#undef sCurNum + static void CreateReelBackgroundSprite(void) { u8 spriteId = CreateSprite(&sSpriteTemplate_ReelBackground, 88, 72, 15); diff --git a/src/trade.c b/src/trade.c index dd0851bbd..5e311f313 100644 --- a/src/trade.c +++ b/src/trade.c @@ -2435,7 +2435,7 @@ static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isEventLegal) return FALSE; } -int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isEventLegal) +int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, bool8 isEventLegal) { bool8 playerHasNationalDex = player.hasNationalDex; bool8 playerIsChampion = player.isChampion; @@ -2496,7 +2496,7 @@ int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct Rf return UR_TRADE_MSG_NONE; } -int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 species2, u16 species, u8 isEventLegal) +int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 species2, u16 species, bool8 isEventLegal) { bool8 hasNationalDex = player.hasNationalDex; @@ -3744,7 +3744,7 @@ static bool8 AnimateTradeSequenceCable(void) gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].x2 = 0; gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].y2 = 0; StartSpriteAnim(&gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]], 0); - CreatePokeballSpriteToReleaseMon(sTradeData->monSpriteIds[TRADE_PARTNER], gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].oam.paletteNum, 120, 84, 2, 1, 20, 0xFFFFF, sTradeData->monSpecies[TRADE_PARTNER]); + CreatePokeballSpriteToReleaseMon(sTradeData->monSpriteIds[TRADE_PARTNER], gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].oam.paletteNum, 120, 84, 2, 1, 20, PALETTES_BG | (0xF << 16), sTradeData->monSpecies[TRADE_PARTNER]); FreeSpriteOamMatrix(&gSprites[sTradeData->bouncingPokeballSpriteId]); DestroySprite(&gSprites[sTradeData->bouncingPokeballSpriteId]); sTradeData->state++; @@ -4244,7 +4244,7 @@ static bool8 AnimateTradeSequenceWireless(void) gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].x2 = 0; gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].y2 = 0; StartSpriteAnim(&gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]], 0); - CreatePokeballSpriteToReleaseMon(sTradeData->monSpriteIds[TRADE_PARTNER], gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].oam.paletteNum, 120, 84, 2, 1, 20, 0xFFFFF, sTradeData->monSpecies[TRADE_PARTNER]); + CreatePokeballSpriteToReleaseMon(sTradeData->monSpriteIds[TRADE_PARTNER], gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].oam.paletteNum, 120, 84, 2, 1, 20, PALETTES_BG | (0xF << 16), sTradeData->monSpecies[TRADE_PARTNER]); FreeSpriteOamMatrix(&gSprites[sTradeData->bouncingPokeballSpriteId]); DestroySprite(&gSprites[sTradeData->bouncingPokeballSpriteId]); sTradeData->state++; diff --git a/src/tv.c b/src/tv.c index b9d064026..2c8233a2f 100644 --- a/src/tv.c +++ b/src/tv.c @@ -1449,7 +1449,7 @@ static void InterviewAfter_BravoTrainerPokemonProfile(void) } } -void BravoTrainerPokemonProfile_BeforeInterview1(u16 a0) +void BravoTrainerPokemonProfile_BeforeInterview1(u16 move) { TVShow *show = &gSaveBlock1Ptr->tvShows[LAST_TVSHOW_IDX]; InterviewBefore_BravoTrainerPkmnProfile(); @@ -1457,7 +1457,7 @@ void BravoTrainerPokemonProfile_BeforeInterview1(u16 a0) if (sCurTVShowSlot != -1) { DeleteTVShowInArrayByIdx(gSaveBlock1Ptr->tvShows, LAST_TVSHOW_IDX); - show->bravoTrainer.move = a0; + show->bravoTrainer.move = move; show->bravoTrainer.kind = TVSHOW_BRAVO_TRAINER_POKEMON_PROFILE; } } From bc2dbd772ea61afe228683e4c83b6cbd82b21b70 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 3 Jun 2022 16:18:34 -0400 Subject: [PATCH 44/65] Add warning to NUM_OBJ_EVENT_GFX --- include/constants/event_objects.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index 6b99f19bd..8278c6a66 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -241,6 +241,15 @@ #define OBJ_EVENT_GFX_LUGIA 237 #define OBJ_EVENT_GFX_HOOH 238 +// NOTE: By default, the max value for NUM_OBJ_EVENT_GFX is 239. +// +// Object event graphics ids are 1 byte in size (max value of 255), and the dynamic +// graphics ids that start after NUM_OBJ_EVENT_GFX reach this limit. No graphics id +// uses the value 239 itself, so removing the "+ 1" in OBJ_EVENT_GFX_VARS would +// allow increasing NUM_OBJ_EVENT_GFX to 240. There are also a handful of unused +// object graphics that can be removed. If more graphics are needed, anything that +// stores graphics ids will need to be increased in size. See wiki entry below: +// https://github.com/pret/pokeemerald/wiki/Feature-Branches#overworld-expansion #define NUM_OBJ_EVENT_GFX 239 From ceaff148f743ca8520e01554188c70b450c54f36 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 9 Jun 2022 10:52:19 -0400 Subject: [PATCH 45/65] Shift to multiply --- src/battle_anim_effects_1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index cd9cb8b30..c590572b9 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -5324,13 +5324,13 @@ static void AnimWavyMusicNotes_CalcVelocity(s16 x, s16 y, s16* velocX, s16* velo if (x < 0) xSpeedFactor = -xSpeedFactor; - x2 = x << 8; + x2 = x * 256; time = x2 / xSpeedFactor; if (time == 0) time = 1; *velocX = x2 / time; - *velocY = (y << 8) / time; + *velocY = (y * 256) / time; } static void AnimWavyMusicNotes_Step(struct Sprite* sprite) From 7143865f6f7dd8c17077111eac49a8972fb31399 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 6 Jun 2022 15:15:46 -0400 Subject: [PATCH 46/65] Add some battle frontier constant usage --- include/constants/battle_frontier.h | 10 +++ include/constants/battle_pike.h | 2 + include/constants/battle_pyramid.h | 7 ++ include/constants/battle_tent.h | 6 ++ include/constants/union_room.h | 2 + include/global.h | 2 +- src/battle_dome.c | 2 +- src/battle_factory.c | 44 ++++++----- src/battle_pike.c | 24 +++--- src/battle_pyramid.c | 78 +++++++++---------- src/battle_pyramid_bag.c | 6 +- src/battle_tent.c | 40 +++++----- src/battle_tower.c | 66 +++++++++------- .../battle_pyramid_open_level_wild_mons.h | 2 +- src/frontier_util.c | 17 ++-- src/map_name_popup.c | 5 +- src/mystery_gift_client.c | 2 +- src/party_menu.c | 6 +- src/pokemon.c | 2 +- src/start_menu.c | 7 +- src/union_room.c | 2 +- 21 files changed, 189 insertions(+), 143 deletions(-) diff --git a/include/constants/battle_frontier.h b/include/constants/battle_frontier.h index b6d15e6b2..6cfdc7931 100644 --- a/include/constants/battle_frontier.h +++ b/include/constants/battle_frontier.h @@ -1,6 +1,8 @@ #ifndef GUARD_CONSTANTS_BATTLE_FRONTIER_H #define GUARD_CONSTANTS_BATTLE_FRONTIER_H +#include "constants/pokemon.h" + #define FRONTIER_CHALLENGE(facility, mode) ((facility << 8) + mode) // Battle Frontier facility ids. @@ -46,6 +48,14 @@ #define MAX_BATTLE_FRONTIER_POINTS 9999 #define MAX_STREAK 9999 +#define FRONTIER_MAX_LEVEL_50 50 +#define FRONTIER_MIN_LEVEL_OPEN 60 +#define FRONTIER_MAX_LEVEL_OPEN MAX_LEVEL + +// This is the default number of battles (or floors, in Battle Pyramid) per challenge. +// There are 2 facilities that differ: Battle Dome (DOME_ROUNDS_COUNT) and Battle Pike (NUM_PIKE_ROOMS). +#define FRONTIER_STAGES_PER_CHALLENGE 7 + // These sets of facility ids would be redundant if the order was consistent // The order is important for this set so that all the non-link records can be continuous #define RANKING_HALL_TOWER_SINGLES 0 diff --git a/include/constants/battle_pike.h b/include/constants/battle_pike.h index 76309436e..eebfd741a 100644 --- a/include/constants/battle_pike.h +++ b/include/constants/battle_pike.h @@ -1,6 +1,8 @@ #ifndef GUARD_CONSTANTS_BATTLE_PIKE_H #define GUARD_CONSTANTS_BATTLE_PIKE_H +#define NUM_PIKE_ROOMS 14 + #define PIKE_ROOM_SINGLE_BATTLE 0 #define PIKE_ROOM_HEAL_FULL 1 #define PIKE_ROOM_NPC 2 diff --git a/include/constants/battle_pyramid.h b/include/constants/battle_pyramid.h index ebb753882..297f3b1ff 100644 --- a/include/constants/battle_pyramid.h +++ b/include/constants/battle_pyramid.h @@ -14,6 +14,13 @@ #define HINT_EXIT_FAR_REMAINING_TRAINERS 7 #define HINT_EXIT_FAR_REMAINING_ITEMS 8 +#define MAX_PYRAMID_TRAINERS 8 + +// Each floor of the Battle Pyramid is 32x32 metatiles, subdivided into a 4x4 grid of 8x8 metatile squares +#define PYRAMID_FLOOR_SQUARES_WIDE 4 +#define PYRAMID_FLOOR_SQUARES_HIGH 4 +#define NUM_PYRAMID_FLOOR_SQUARES (PYRAMID_FLOOR_SQUARES_WIDE * PYRAMID_FLOOR_SQUARES_HIGH) + #define OBJ_TRAINERS 0 #define OBJ_ITEMS 1 diff --git a/include/constants/battle_tent.h b/include/constants/battle_tent.h index 666ada6bd..6f9989b7a 100644 --- a/include/constants/battle_tent.h +++ b/include/constants/battle_tent.h @@ -1,6 +1,12 @@ #ifndef GUARD_CONSTANTS_BATTLE_TENT_H #define GUARD_CONSTANTS_BATTLE_TENT_H +#define TENT_MIN_LEVEL 30 + +// The number of battles in each Battle Tent challenge. +// Battle Tent equivalent of FRONTIER_STAGES_PER_CHALLENGE. +#define TENT_STAGES_PER_CHALLENGE 3 + #define VERDANTURF_TENT_FUNC_INIT 0 #define VERDANTURF_TENT_FUNC_GET_PRIZE 1 #define VERDANTURF_TENT_FUNC_SET_PRIZE 2 diff --git a/include/constants/union_room.h b/include/constants/union_room.h index 6e08c9ebb..f47a8723f 100644 --- a/include/constants/union_room.h +++ b/include/constants/union_room.h @@ -11,6 +11,8 @@ #define UNION_ROOM_SPAWN_IN 1 #define UNION_ROOM_SPAWN_OUT 2 +#define UNION_ROOM_MAX_LEVEL 30 + #define ACTIVITY_NONE 0 #define ACTIVITY_BATTLE_SINGLE 1 #define ACTIVITY_BATTLE_DOUBLE 2 diff --git a/include/global.h b/include/global.h index 60476b13f..64af518ce 100644 --- a/include/global.h +++ b/include/global.h @@ -409,7 +409,7 @@ struct BattleFrontier /*0xE1A*/ u16 pyramidWinStreaks[FRONTIER_LVL_MODE_COUNT]; /*0xE1E*/ u16 pyramidRecordStreaks[FRONTIER_LVL_MODE_COUNT]; /*0xE22*/ u16 pyramidRandoms[4]; - /*0xE2A*/ u8 pyramidTrainerFlags; + /*0xE2A*/ u8 pyramidTrainerFlags; // 1 bit for each trainer (MAX_PYRAMID_TRAINERS) /*0xE2C*/ struct PyramidBag pyramidBag; /*0xE68*/ u8 pyramidLightRadius; /*0xE6A*/ u16 verdanturfTentPrize; diff --git a/src/battle_dome.c b/src/battle_dome.c index aadd85afd..5c18cff42 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -5847,7 +5847,7 @@ static void InitRandomTourneyTreeResults(void) DOME_TRAINERS[i].forfeited = FALSE; } - monLevel = 50; + monLevel = FRONTIER_MAX_LEVEL_50; for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) { monTypesBits = 0; diff --git a/src/battle_factory.c b/src/battle_factory.c index d88ed37f9..a68ef8180 100644 --- a/src/battle_factory.c +++ b/src/battle_factory.c @@ -12,15 +12,15 @@ #include "constants/battle_factory.h" #include "constants/battle_frontier.h" #include "constants/battle_frontier_mons.h" +#include "constants/battle_tent.h" #include "constants/frontier_util.h" #include "constants/layouts.h" #include "constants/trainers.h" #include "constants/moves.h" +#include "constants/items.h" -// IWRAM bss static bool8 sPerformedRentalSwap; -// This file's functions. static void InitFactoryChallenge(void); static void GetBattleFactoryData(void); static void SetBattleFactoryData(void); @@ -212,7 +212,7 @@ static void InitFactoryChallenge(void) } sPerformedRentalSwap = FALSE; - for (i = 0; i < 6; i++) + for (i = 0; i < ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons); i++) gSaveBlock2Ptr->frontier.rentalMons[i].monId = 0xFFFF; for (i = 0; i < FRONTIER_PARTY_SIZE; i++) gFrontierTempParty[i] = 0xFFFF; @@ -310,11 +310,12 @@ static void GenerateOpponentMons(void) u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u32 winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode]; - u32 challengeNum = winStreak / 7; + u32 challengeNum = winStreak / FRONTIER_STAGES_PER_CHALLENGE; gFacilityTrainers = gBattleFrontierTrainers; do { + // Choose a random trainer, ensuring no repeats in this challenge trainerId = GetRandomScaledFrontierTrainerId(challengeNum, gSaveBlock2Ptr->frontier.curChallengeBattleNum); for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++) { @@ -324,27 +325,32 @@ static void GenerateOpponentMons(void) } while (i != gSaveBlock2Ptr->frontier.curChallengeBattleNum); gTrainerBattleOpponent_A = trainerId; - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < FRONTIER_STAGES_PER_CHALLENGE - 1) gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = trainerId; i = 0; while (i != FRONTIER_PARTY_SIZE) { u16 monId = GetFactoryMonId(lvlMode, challengeNum, FALSE); + + // Unown (FRONTIER_MON_UNOWN) is forbidden on opponent Factory teams. if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN) continue; - for (j = 0; j < 6; j++) + // Ensure none of the opponent's pokemon are the same as the potential rental pokemon for the player + for (j = 0; j < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons); j++) { if (gFacilityTrainerMons[monId].species == gFacilityTrainerMons[gSaveBlock2Ptr->frontier.rentalMons[j].monId].species) break; } - if (j != 6) + if (j != (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons)) continue; + // "High tier" pokemon are only allowed on open level mode if (lvlMode == FRONTIER_LVL_50 && monId > FRONTIER_MONS_HIGH_TIER) continue; + // Ensure this species hasn't already been chosen for the opponent for (k = firstMonId; k < firstMonId + i; k++) { if (species[k] == gFacilityTrainerMons[monId].species) @@ -353,14 +359,16 @@ static void GenerateOpponentMons(void) if (k != firstMonId + i) continue; + // Ensure held items don't repeat on the opponent's team for (k = firstMonId; k < firstMonId + i; k++) { - if (heldItems[k] != 0 && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]) + if (heldItems[k] != ITEM_NONE && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]) break; } if (k != firstMonId + i) continue; + // Successful selection species[i] = gFacilityTrainerMons[monId].species; heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]; gFrontierTempParty[i] = monId; @@ -406,15 +414,15 @@ static void SetPlayerAndOpponentParties(void) if (gSaveBlock2Ptr->frontier.lvlMode == FRONTIER_LVL_TENT) { gFacilityTrainerMons = gSlateportBattleTentMons; - monLevel = 30; + monLevel = TENT_MIN_LEVEL; } else { gFacilityTrainerMons = gBattleFrontierMons; if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50) - monLevel = 100; + monLevel = FRONTIER_MAX_LEVEL_OPEN; else - monLevel = 50; + monLevel = FRONTIER_MAX_LEVEL_50; } if (gSpecialVar_0x8005 < 2) @@ -618,9 +626,9 @@ static void GetOpponentMostCommonMonType(void) // Determine which are the two most-common types. // The second most-common type is only updated if // its count is equal to the most-common type. - mostCommonTypes[0] = TYPE_NORMAL; - mostCommonTypes[1] = TYPE_NORMAL; - for (i = TYPE_FIGHTING; i < NUMBER_OF_MON_TYPES; i++) + mostCommonTypes[0] = 0; + mostCommonTypes[1] = 0; + for (i = 1; i < NUMBER_OF_MON_TYPES; i++) { if (typeCounts[mostCommonTypes[0]] < typeCounts[i]) mostCommonTypes[0] = i; @@ -765,15 +773,15 @@ void FillFactoryBrainParty(void) if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN) continue; - if (monLevel == 50 && monId > FRONTIER_MONS_HIGH_TIER) + if (monLevel == FRONTIER_MAX_LEVEL_50 && monId > FRONTIER_MONS_HIGH_TIER) continue; - for (j = 0; j < 6; j++) + for (j = 0; j < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons); j++) { if (monId == gSaveBlock2Ptr->frontier.rentalMons[j].monId) break; } - if (j != 6) + if (j != (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons)) continue; for (k = 0; k < i; k++) @@ -786,7 +794,7 @@ void FillFactoryBrainParty(void) for (k = 0; k < i; k++) { - if (heldItems[k] != 0 && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]) + if (heldItems[k] != ITEM_NONE && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]) break; } if (k != i) diff --git a/src/battle_pike.c b/src/battle_pike.c index 2b0cf6420..6c97c99fc 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -684,7 +684,7 @@ static void SetBattlePikeData(void) static void IsNextRoomFinal(void) { - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum > 14) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum > NUM_PIKE_ROOMS) gSpecialVar_Result = TRUE; else gSpecialVar_Result = FALSE; @@ -1117,20 +1117,20 @@ bool32 TryGenerateBattlePikeWildMon(bool8 checkKeenEyeIntimidate) if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50) { monLevel = GetHighestLevelInPlayerParty(); - if (monLevel < 60) + if (monLevel < FRONTIER_MIN_LEVEL_OPEN) { - monLevel = 60; + monLevel = FRONTIER_MIN_LEVEL_OPEN; } else { monLevel -= wildMons[headerId][pikeMonId].levelDelta; - if (monLevel < 60) - monLevel = 60; + if (monLevel < FRONTIER_MIN_LEVEL_OPEN) + monLevel = FRONTIER_MIN_LEVEL_OPEN; } } else { - monLevel = 50 - wildMons[headerId][pikeMonId].levelDelta; + monLevel = FRONTIER_MAX_LEVEL_50 - wildMons[headerId][pikeMonId].levelDelta; } if (checkKeenEyeIntimidate == TRUE && !CanEncounterWildMon(monLevel)) @@ -1395,7 +1395,7 @@ static void PrepareOneTrainer(bool8 difficult) battleNum = 6; lvlMode = gSaveBlock2Ptr->frontier.lvlMode; - challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / 14; + challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / NUM_PIKE_ROOMS; do { trainerId = GetRandomScaledFrontierTrainerId(challengeNum, battleNum); @@ -1409,7 +1409,7 @@ static void PrepareOneTrainer(bool8 difficult) gTrainerBattleOpponent_A = trainerId; gFacilityTrainers = gBattleFrontierTrainers; SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0); - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 14) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < NUM_PIKE_ROOMS) gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1] = gTrainerBattleOpponent_A; } @@ -1418,7 +1418,7 @@ static void PrepareTwoTrainers(void) int i; u16 trainerId; u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; - u16 challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / 14; + u16 challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / NUM_PIKE_ROOMS; gFacilityTrainers = gBattleFrontierTrainers; do @@ -1433,7 +1433,7 @@ static void PrepareTwoTrainers(void) gTrainerBattleOpponent_A = trainerId; SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0); - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum <= 14) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum <= NUM_PIKE_ROOMS) gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1] = gTrainerBattleOpponent_A; do @@ -1448,7 +1448,7 @@ static void PrepareTwoTrainers(void) gTrainerBattleOpponent_B = trainerId; SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_B, 1); - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 14) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < NUM_PIKE_ROOMS) gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 2] = gTrainerBattleOpponent_B; } @@ -1456,7 +1456,7 @@ static void ClearPikeTrainerIds(void) { u8 i; - for (i = 0; i < 14; i++) + for (i = 0; i < NUM_PIKE_ROOMS; i++) gSaveBlock2Ptr->frontier.trainerIds[i] = 0xFFFF; } diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 9039f60f2..bbd4c84dc 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -279,9 +279,9 @@ static const u8 sPyramidFloorTemplateOptions[][2] = {100, 15} }; -static const u8 sFloorTemplateOffsets[] = +static const u8 sFloorTemplateOffsets[FRONTIER_STAGES_PER_CHALLENGE] = { - 0, 4, 9, 14, 19, 24, 29, 0 + 0, 4, 9, 14, 19, 24, 29 }; static const u16 sPickupItemsLvl50[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] = @@ -406,7 +406,7 @@ static const u8 sPickupItemSlots[][2] = {100, 9}, }; -static const u8 sPickupItemOffsets[] = {0, 9, 18, 27, 36, 45, 54}; +static const u8 sPickupItemOffsets[FRONTIER_STAGES_PER_CHALLENGE] = {0, 9, 18, 27, 36, 45, 54}; static const struct PyramidTrainerEncounterMusic sTrainerClassEncounterMusic[54] = { @@ -963,7 +963,7 @@ static void SeedPyramidFloor(void) { int i; - for (i = 0; i < 4; i++) + for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.pyramidRandoms); i++) gSaveBlock2Ptr->frontier.pyramidRandoms[i] = Random(); gSaveBlock2Ptr->frontier.pyramidTrainerFlags = 0; @@ -977,7 +977,7 @@ static void SetPickupItem(void) u8 id; u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u32 floor = gSaveBlock2Ptr->frontier.curChallengeBattleNum; - u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7) % TOTAL_ROUNDS; + u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_ROUNDS; if (round >= TOTAL_ROUNDS) round = TOTAL_ROUNDS - 1; @@ -1016,8 +1016,8 @@ static void HidePyramidItem(void) { // Rather than using event flags to hide the item object event, // it moves them far off the map bounds. - events[i].x = 0x7FFF; - events[i].y = 0x7FFF; + events[i].x = SHRT_MAX; + events[i].y = SHRT_MAX; break; } i++; @@ -1063,7 +1063,7 @@ static void ShowPostBattleHintText(void) case HINT_REMAINING_ITEMS: for (i = 0; i < GetNumBattlePyramidObjectEvents(); i++) { - if (events[i].graphicsId == OBJ_EVENT_GFX_ITEM_BALL && events[i].x != 0x7FFF && events[i].y != 0x7FFF) + if (events[i].graphicsId == OBJ_EVENT_GFX_ITEM_BALL && events[i].x != SHRT_MAX && events[i].y != SHRT_MAX) textIndex++; } i = 1; @@ -1071,7 +1071,7 @@ static void ShowPostBattleHintText(void) case HINT_REMAINING_TRAINERS: id = GetPyramidFloorTemplateId(); textIndex = sPyramidFloorTemplates[id].numTrainers; - for (i = 0; i < 8; i++) + for (i = 0; i < MAX_PYRAMID_TRAINERS; i++) { if (gBitTable[i] & gSaveBlock2Ptr->frontier.pyramidTrainerFlags) textIndex--; @@ -1326,7 +1326,7 @@ static void MarkPyramidTrainerAsBattled(u16 trainerId) { int i; - for (i = 0; i < 8; i++) + for (i = 0; i < MAX_PYRAMID_TRAINERS; i++) { if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId) gSaveBlock2Ptr->frontier.pyramidTrainerFlags |= gBitTable[i]; @@ -1345,7 +1345,7 @@ void GenerateBattlePyramidWildMon(void) const struct PyramidWildMon *wildMons; u32 id; u32 lvl = gSaveBlock2Ptr->frontier.lvlMode; - u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / 7) % TOTAL_ROUNDS; + u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_ROUNDS; if (round >= TOTAL_ROUNDS) round = TOTAL_ROUNDS - 1; @@ -1488,13 +1488,13 @@ static u16 GetUniqueTrainerId(u8 objectEventId) int i; u16 trainerId; u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; - u32 challengeNum = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7; - u32 battleNum = gSaveBlock2Ptr->frontier.curChallengeBattleNum; - if (battleNum == 7) + u32 challengeNum = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; + u32 floor = gSaveBlock2Ptr->frontier.curChallengeBattleNum; + if (floor == FRONTIER_STAGES_PER_CHALLENGE) { do { - trainerId = GetRandomScaledFrontierTrainerId(challengeNum + 1, battleNum); + trainerId = GetRandomScaledFrontierTrainerId(challengeNum + 1, floor); for (i = 0; i < objectEventId; i++) { if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId) @@ -1506,7 +1506,7 @@ static u16 GetUniqueTrainerId(u8 objectEventId) { do { - trainerId = GetRandomScaledFrontierTrainerId(challengeNum, battleNum); + trainerId = GetRandomScaledFrontierTrainerId(challengeNum, floor); for (i = 0; i < objectEventId; i++) { if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId) @@ -1523,11 +1523,11 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio int y, x; int i; u8 entranceSquareId, exitSquareId; - u8 *floorLayoutOffsets = AllocZeroed(16); + u8 *floorLayoutOffsets = AllocZeroed(NUM_PYRAMID_FLOOR_SQUARES); GetPyramidFloorLayoutOffsets(floorLayoutOffsets); GetPyramidEntranceAndExitSquareIds(&entranceSquareId, &exitSquareId); - for (i = 0; i < 16; i++) + for (i = 0; i < NUM_PYRAMID_FLOOR_SQUARES; i++) { u16 *map; int yOffset, xOffset; @@ -1535,11 +1535,11 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio const u16 *layoutMap = mapLayout->map; gBackupMapLayout.map = backupMapData; - gBackupMapLayout.width = mapLayout->width * 4 + MAP_OFFSET_W; - gBackupMapLayout.height = mapLayout->height * 4 + MAP_OFFSET_H; + gBackupMapLayout.width = mapLayout->width * PYRAMID_FLOOR_SQUARES_WIDE + MAP_OFFSET_W; + gBackupMapLayout.height = mapLayout->height * PYRAMID_FLOOR_SQUARES_HIGH + MAP_OFFSET_H; map = backupMapData; - yOffset = ((i / 4 * mapLayout->height) + MAP_OFFSET) * gBackupMapLayout.width; - xOffset = (i % 4 * mapLayout->width) + MAP_OFFSET; + yOffset = ((i / PYRAMID_FLOOR_SQUARES_WIDE * mapLayout->height) + MAP_OFFSET) * gBackupMapLayout.width; + xOffset = (i % PYRAMID_FLOOR_SQUARES_WIDE * mapLayout->width) + MAP_OFFSET; map += yOffset + xOffset; for (y = 0; y < mapLayout->height; y++) { @@ -1553,8 +1553,8 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio { if (i == entranceSquareId && setPlayerPosition == FALSE) { - gSaveBlock1Ptr->pos.x = (mapLayout->width * (i % 4)) + x; - gSaveBlock1Ptr->pos.y = (mapLayout->height * (i / 4)) + y; + gSaveBlock1Ptr->pos.x = (mapLayout->width * (i % PYRAMID_FLOOR_SQUARES_WIDE)) + x; + gSaveBlock1Ptr->pos.y = (mapLayout->height * (i / PYRAMID_FLOOR_SQUARES_WIDE)) + y; } map[x] = (layoutMap[x] & (MAPGRID_ELEVATION_MASK | MAPGRID_COLLISION_MASK)) | METATILE_BattlePyramid_Floor; } @@ -1563,7 +1563,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio map[x] = layoutMap[x]; } } - map += MAP_OFFSET_W + (mapLayout->width * 4); + map += MAP_OFFSET_W + (mapLayout->width * PYRAMID_FLOOR_SQUARES_WIDE); layoutMap += mapLayout->width; } } @@ -1577,7 +1577,7 @@ void LoadBattlePyramidObjectEventTemplates(void) u8 id; u8 entranceSquareId, exitSquareId; - for (i = 0; i < 8; i++) + for (i = 0; i < MAX_PYRAMID_TRAINERS; i++) gSaveBlock2Ptr->frontier.trainerIds[i] = 0xFFFF; id = GetPyramidFloorTemplateId(); @@ -1633,13 +1633,13 @@ void LoadBattlePyramidFloorObjectEventScripts(void) static void GetPyramidEntranceAndExitSquareIds(u8 *entranceSquareId, u8 *exitSquareId) { - *entranceSquareId = gSaveBlock2Ptr->frontier.pyramidRandoms[3] % 16; - *exitSquareId = gSaveBlock2Ptr->frontier.pyramidRandoms[0] % 16; + *entranceSquareId = gSaveBlock2Ptr->frontier.pyramidRandoms[3] % NUM_PYRAMID_FLOOR_SQUARES; + *exitSquareId = gSaveBlock2Ptr->frontier.pyramidRandoms[0] % NUM_PYRAMID_FLOOR_SQUARES; if (*entranceSquareId == *exitSquareId) { - *entranceSquareId = (gSaveBlock2Ptr->frontier.pyramidRandoms[3] + 1 ) % 16; - *exitSquareId = (gSaveBlock2Ptr->frontier.pyramidRandoms[0] + 15) % 16; + *entranceSquareId = (gSaveBlock2Ptr->frontier.pyramidRandoms[3] + 1 ) % NUM_PYRAMID_FLOOR_SQUARES; + *exitSquareId = (gSaveBlock2Ptr->frontier.pyramidRandoms[0] + NUM_PYRAMID_FLOOR_SQUARES - 1) % NUM_PYRAMID_FLOOR_SQUARES; } } @@ -1651,10 +1651,10 @@ static void SetPyramidObjectPositionsUniformly(u8 objType) int squareId; u32 bits = 0; u8 id = GetPyramidFloorTemplateId(); - u8 *floorLayoutOffsets = AllocZeroed(16); + u8 *floorLayoutOffsets = AllocZeroed(NUM_PYRAMID_FLOOR_SQUARES); GetPyramidFloorLayoutOffsets(floorLayoutOffsets); - squareId = gSaveBlock2Ptr->frontier.pyramidRandoms[2] % 16; + squareId = gSaveBlock2Ptr->frontier.pyramidRandoms[2] % NUM_PYRAMID_FLOOR_SQUARES; if (objType == OBJ_TRAINERS) { numObjects = sPyramidFloorTemplates[id].numTrainers; @@ -1682,10 +1682,10 @@ static void SetPyramidObjectPositionsUniformly(u8 objType) if (gBitTable[squareId] & gSaveBlock2Ptr->frontier.pyramidRandoms[3]) bits |= 2; } - if (++squareId >= 16) + if (++squareId >= NUM_PYRAMID_FLOOR_SQUARES) squareId = 0; - if (squareId == gSaveBlock2Ptr->frontier.pyramidRandoms[2] % 16) + if (squareId == gSaveBlock2Ptr->frontier.pyramidRandoms[2] % NUM_PYRAMID_FLOOR_SQUARES) { if (bits & 1) bits |= 6; @@ -1709,7 +1709,7 @@ static bool8 SetPyramidObjectPositionsInAndNearSquare(u8 objType, u8 squareId) int numPlacedObjects = 0; int numObjects; u8 id = GetPyramidFloorTemplateId(); - u8 *floorLayoutOffsets = AllocZeroed(16); + u8 *floorLayoutOffsets = AllocZeroed(NUM_PYRAMID_FLOOR_SQUARES); GetPyramidFloorLayoutOffsets(floorLayoutOffsets); if (objType == OBJ_TRAINERS) @@ -1775,7 +1775,7 @@ static bool8 SetPyramidObjectPositionsNearSquare(u8 objType, u8 squareId) int r8 = 0; int numObjects; u8 id = GetPyramidFloorTemplateId(); - u8 *floorLayoutOffsets = AllocZeroed(16); + u8 *floorLayoutOffsets = AllocZeroed(NUM_PYRAMID_FLOOR_SQUARES); GetPyramidFloorLayoutOffsets(floorLayoutOffsets); if (objType == OBJ_TRAINERS) @@ -1900,7 +1900,7 @@ static void GetPyramidFloorLayoutOffsets(u8 *layoutOffsets) int rand = (gSaveBlock2Ptr->frontier.pyramidRandoms[0]) | (gSaveBlock2Ptr->frontier.pyramidRandoms[1] << 16); u8 id = GetPyramidFloorTemplateId(); - for (i = 0; i < 16; i++) + for (i = 0; i < NUM_PYRAMID_FLOOR_SQUARES; i++) { layoutOffsets[i] = sPyramidFloorTemplates[id].layoutOffsets[rand & 0x7]; rand >>= 3; @@ -1931,7 +1931,7 @@ u8 GetNumBattlePyramidObjectEvents(void) u8 i; struct ObjectEventTemplate *events = gSaveBlock1Ptr->objectEventTemplates; - for (i = 0; i < 16; i++) + for (i = 0; i < OBJECT_EVENTS_COUNT; i++) { if (events[i].localId == 0) break; @@ -1959,7 +1959,7 @@ u16 GetBattlePyramidPickupItemId(void) int rand; u32 i; u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; - int round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7); + int round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE); if (round >= TOTAL_ROUNDS) round = TOTAL_ROUNDS - 1; diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index d1b946146..66b4cd97d 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -1410,7 +1410,7 @@ void TryStoreHeldItemsInPyramidBag(void) 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)); - for (i = 0; i < 3; i++) + for (i = 0; i < FRONTIER_PARTY_SIZE; i++) { heldItem = GetMonData(&party[i], MON_DATA_HELD_ITEM); if (heldItem != ITEM_NONE && !AddBagItem(heldItem, 1)) @@ -1426,10 +1426,8 @@ void TryStoreHeldItemsInPyramidBag(void) } heldItem = ITEM_NONE; - for (i = 0; i < 3; i++) - { + for (i = 0; i < FRONTIER_PARTY_SIZE; i++) SetMonData(&party[i], MON_DATA_HELD_ITEM, &heldItem); - } gSpecialVar_Result = 0; Free(newItems); Free(newQuantities); diff --git a/src/battle_tent.c b/src/battle_tent.c index 53c91c871..dba9e6e8a 100644 --- a/src/battle_tent.c +++ b/src/battle_tent.c @@ -56,10 +56,8 @@ static void GenerateInitialRentalMons(void); * */ -// IWRAM bss -static u16 sRandMonSetId; +static u16 sRandMonId; -// const rom data void static (*const sVerdanturfTentFuncs[])(void) = { [VERDANTURF_TENT_FUNC_INIT] = InitVerdanturfTentChallenge, @@ -357,7 +355,7 @@ static void GenerateOpponentMons(void) const u16 *monSet; u16 species[FRONTIER_PARTY_SIZE]; u16 heldItems[FRONTIER_PARTY_SIZE]; - s32 monId = 0; + s32 numMons = 0; gFacilityTrainers = gSlateportBattleTentTrainers; gFacilityTrainerMons = gSlateportBattleTentMons; @@ -366,6 +364,7 @@ static void GenerateOpponentMons(void) { do { + // Choose a random trainer, ensuring no repeats in this challenge trainerId = Random() % NUM_BATTLE_TENT_TRAINERS; for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++) { @@ -376,48 +375,53 @@ static void GenerateOpponentMons(void) gTrainerBattleOpponent_A = trainerId; monSet = gFacilityTrainers[gTrainerBattleOpponent_A].monSet; - while (monSet[monId] != 0xFFFF) - monId++; - if (monId > 8) + while (monSet[numMons] != 0xFFFF) + numMons++; + if (numMons > 8) break; - monId = 0; + numMons = 0; } - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 2) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < TENT_STAGES_PER_CHALLENGE - 1) gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A; monSet = gFacilityTrainers[gTrainerBattleOpponent_A].monSet; i = 0; while (i != FRONTIER_PARTY_SIZE) { - sRandMonSetId = monSet[Random() % monId]; - for (j = 0; j < 6; j++) + sRandMonId = monSet[Random() % numMons]; + + // Ensure none of the opponent's pokemon are the same as the potential rental pokemon for the player + for (j = 0; j < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons); j++) { - if (gFacilityTrainerMons[sRandMonSetId].species == gFacilityTrainerMons[gSaveBlock2Ptr->frontier.rentalMons[j].monId].species) + if (gFacilityTrainerMons[sRandMonId].species == gFacilityTrainerMons[gSaveBlock2Ptr->frontier.rentalMons[j].monId].species) break; } - if (j != 6) + if (j != (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons)) continue; + // Ensure this species hasn't already been chosen for the opponent for (k = 0; k < i; k++) { - if (species[k] == gFacilityTrainerMons[sRandMonSetId].species) + if (species[k] == gFacilityTrainerMons[sRandMonId].species) break; } if (k != i) continue; + // Ensure held items don't repeat on the opponent's team for (k = 0; k < i; k++) { - if (heldItems[k] != 0 && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[sRandMonSetId].itemTableId]) + if (heldItems[k] != ITEM_NONE && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[sRandMonId].itemTableId]) break; } if (k != i) continue; - species[i] = gFacilityTrainerMons[sRandMonSetId].species; - heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[sRandMonSetId].itemTableId]; - gFrontierTempParty[i] = sRandMonSetId; + // Successful selection + species[i] = gFacilityTrainerMons[sRandMonId].species; + heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[sRandMonId].itemTableId]; + gFrontierTempParty[i] = sRandMonId; i++; } } diff --git a/src/battle_tower.c b/src/battle_tower.c index e652038ac..839b99b24 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -27,6 +27,7 @@ #include "constants/battle_dome.h" #include "constants/battle_frontier.h" #include "constants/battle_frontier_mons.h" +#include "constants/battle_tent.h" #include "constants/battle_tent_mons.h" #include "constants/battle_tent_trainers.h" #include "constants/battle_tower.h" @@ -1060,7 +1061,7 @@ static void SetNextFacilityOpponent(void) u16 id; u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u16 winStreak = GetCurrentFacilityWinStreak(); - u32 challengeNum = winStreak / 7; + u32 challengeNum = winStreak / FRONTIER_STAGES_PER_CHALLENGE; SetFacilityPtrsGetLevel(); if (battleMode == FRONTIER_MODE_MULTIS || battleMode == FRONTIER_MODE_LINK_MULTIS) @@ -1095,7 +1096,7 @@ static void SetNextFacilityOpponent(void) gTrainerBattleOpponent_A = id; SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0); - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum + 1 < 7) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum + 1 < FRONTIER_STAGES_PER_CHALLENGE) gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A; } } @@ -1107,7 +1108,7 @@ u16 GetRandomScaledFrontierTrainerId(u8 challengeNum, u8 battleNum) if (challengeNum <= 7) { - if (battleNum == 6) + if (battleNum == FRONTIER_STAGES_PER_CHALLENGE - 1) { // The last battle in each challenge has a jump in difficulty, pulls from a table with higher ranges trainerId = (sFrontierTrainerIdRangesHard[challengeNum][1] - sFrontierTrainerIdRangesHard[challengeNum][0]) + 1; @@ -1136,7 +1137,7 @@ static void GetRandomScaledFrontierTrainerIdRange(u8 challengeNum, u8 battleNum, if (challengeNum <= 7) { - if (battleNum == 6) + if (battleNum == FRONTIER_STAGES_PER_CHALLENGE - 1) { // The last battle in each challenge has a jump in difficulty, pulls from a table with higher ranges range = (sFrontierTrainerIdRangesHard[challengeNum][1] - sFrontierTrainerIdRangesHard[challengeNum][0]) + 1; @@ -1691,7 +1692,10 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) while (i != monCount) { u16 monId = monSet[Random() % bfMonCount]; - if ((level == 50 || level == 20) && monId > FRONTIER_MONS_HIGH_TIER) + + // "High tier" pokemon are only allowed on open level mode + // 20 is not a possible value for level here + if ((level == FRONTIER_MAX_LEVEL_50 || level == 20) && monId > FRONTIER_MONS_HIGH_TIER) continue; // Ensure this pokemon species isn't a duplicate. @@ -1767,9 +1771,9 @@ static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId) fixedIV = 9; if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50) - level = 100; + level = FRONTIER_MAX_LEVEL_OPEN; else - level = 50; + level = FRONTIER_MAX_LEVEL_50; for (i = 0; i != 3; i++) { @@ -1802,8 +1806,10 @@ u16 GetRandomFrontierMonFromSet(u16 trainerId) do { + // "High tier" pokemon are only allowed on open level mode + // 20 is not a possible value for level here monId = monSet[Random() % numMons]; - } while((level == 50 || level == 20) && monId > FRONTIER_MONS_HIGH_TIER); + } while((level == FRONTIER_MAX_LEVEL_50 || level == 20) && monId > FRONTIER_MONS_HIGH_TIER); return monId; } @@ -1831,11 +1837,11 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId) u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); // By mistake Battle Tower's Level 50 challenge number is used to determine the IVs for Battle Factory. #ifdef BUGFIX - u8 challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7; + u8 challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; #else - u8 challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][FRONTIER_LVL_50] / 7; + u8 challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][FRONTIER_LVL_50] / FRONTIER_STAGES_PER_CHALLENGE; #endif - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < FRONTIER_STAGES_PER_CHALLENGE - 1) fixedIV = GetFactoryMonFixedIV(challengeNum, FALSE); else fixedIV = GetFactoryMonFixedIV(challengeNum, TRUE); // Last trainer in challenge uses higher IVs @@ -1882,7 +1888,7 @@ static void FillFactoryTentTrainerParty(u16 trainerId, u8 firstMonId) { u8 i, j; u8 friendship; - u8 level = 30; + u8 level = TENT_MIN_LEVEL; u8 fixedIV = 0; u32 otID = T1_READ_32(gSaveBlock2Ptr->playerTrainerId); @@ -2043,7 +2049,7 @@ void DoSpecialTrainerBattle(void) break; case SPECIAL_BATTLE_EREADER: ZeroEnemyPartyMons(); - for (i = 0; i < 3; i++) + for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.ereaderTrainer.party); i++) CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i]); gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_EREADER_TRAINER; gTrainerBattleOpponent_A = 0; @@ -2189,7 +2195,7 @@ static void SaveTowerChallenge(void) { u16 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u16 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - s32 challengeNum = (signed)(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7); + s32 challengeNum = (signed)(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE); if (gSpecialVar_0x8005 == 0 && (challengeNum > 1 || gSaveBlock2Ptr->frontier.curChallengeBattleNum != 0)) SaveBattleTowerRecord(); @@ -2279,7 +2285,7 @@ static void LoadMultiPartnerCandidatesData(void) objEventTemplates = gSaveBlock1Ptr->objectEventTemplates; lvlMode = gSaveBlock2Ptr->frontier.lvlMode; battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL); species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL); level = SetFacilityPtrsGetLevel(); @@ -2338,7 +2344,7 @@ static void LoadMultiPartnerCandidatesData(void) for (i = 0; i < APPRENTICE_COUNT; i++) { if (gSaveBlock2Ptr->apprentices[i].lvlMode != 0 - && sApprenticeChallengeThreshold[gSaveBlock2Ptr->apprentices[i].numQuestions] / 7 <= challengeNum + && sApprenticeChallengeThreshold[gSaveBlock2Ptr->apprentices[i].numQuestions] / FRONTIER_STAGES_PER_CHALLENGE <= challengeNum && gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode) { k = 0; @@ -2377,7 +2383,7 @@ static void LoadMultiPartnerCandidatesData(void) checksum += record[j]; } - if (gSaveBlock2Ptr->frontier.towerRecords[i].winStreak / 7 <= challengeNum + if (gSaveBlock2Ptr->frontier.towerRecords[i].winStreak / FRONTIER_STAGES_PER_CHALLENGE <= challengeNum && gSaveBlock2Ptr->frontier.towerRecords[i].lvlMode == lvlMode && recordHasData && gSaveBlock2Ptr->frontier.towerRecords[i].checksum == checksum) @@ -2458,7 +2464,7 @@ static void ShowPartnerCandidateMessage(void) s32 monId; s32 level = SetFacilityPtrsGetLevel(); u16 winStreak = GetCurrentFacilityWinStreak(); - s32 challengeNum = winStreak / 7; + s32 challengeNum = winStreak / FRONTIER_STAGES_PER_CHALLENGE; s32 k = gSpecialVar_LastTalked - 2; s32 trainerId = gSaveBlock2Ptr->frontier.trainerIds[k]; @@ -2517,7 +2523,7 @@ static void ShowPartnerCandidateMessage(void) gSaveBlock2Ptr->frontier.trainerIds[18] = gFrontierTempParty[0]; gSaveBlock2Ptr->frontier.trainerIds[19] = gFrontierTempParty[1]; } - for (k = 0; k < 14; k++) + for (k = 0; k < FRONTIER_STAGES_PER_CHALLENGE * 2; k++) { while (1) { @@ -2576,7 +2582,7 @@ static void LoadLinkMultiOpponentsData(void) case 0: if (battleMode == FRONTIER_MODE_LINK_MULTIS) { - challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; if (IsLinkTaskFinished()) { SendBlock(BitmaskAllOtherLinkPlayers(), &challengeNum, sizeof(challengeNum)); @@ -2596,7 +2602,7 @@ static void LoadLinkMultiOpponentsData(void) challengeNum = gBlockRecvBuffer[0][0]; else challengeNum = gBlockRecvBuffer[1][0]; - for (i = 0; i < 14; i++) + for (i = 0; i < FRONTIER_STAGES_PER_CHALLENGE * 2; i++) { do { @@ -2840,7 +2846,7 @@ static void FillEReaderTrainerWithPlayerData(void) ereaderTrainer->winStreak = 1; j = 7; - for (i = 0; i < 6; i++) + for (i = 0; i < EASY_CHAT_BATTLE_WORDS_COUNT; i++) { ereaderTrainer->greeting[i] = gSaveBlock1Ptr->easyChatBattleStart[i]; ereaderTrainer->farewellPlayerLost[i] = j; @@ -2848,7 +2854,7 @@ static void FillEReaderTrainerWithPlayerData(void) j++; } - for (i = 0; i < 3; i++) + for (i = 0; i < (int)ARRAY_COUNT(ereaderTrainer->party); i++) ConvertPokemonToBattleTowerPokemon(&gPlayerParty[i], &ereaderTrainer->party[i]); SetEReaderTrainerChecksum(ereaderTrainer); @@ -3246,12 +3252,12 @@ u8 GetFrontierEnemyMonLevel(u8 lvlMode) { default: case FRONTIER_LVL_50: - level = 50; + level = FRONTIER_MAX_LEVEL_50; break; case FRONTIER_LVL_OPEN: level = GetHighestLevelInPlayerParty(); - if (level < 60) - level = 60; + if (level < FRONTIER_MIN_LEVEL_OPEN) + level = FRONTIER_MIN_LEVEL_OPEN; break; } @@ -3321,7 +3327,7 @@ static u16 GetBattleTentTrainerId(void) static u8 SetTentPtrsGetLevel(void) { - u8 level = 30; + u8 level = TENT_MIN_LEVEL; u32 facility = VarGet(VAR_FRONTIER_FACILITY); if (facility == FRONTIER_FACILITY_FACTORY) @@ -3346,8 +3352,8 @@ static u8 SetTentPtrsGetLevel(void) } level = GetHighestLevelInPlayerParty(); - if (level < 30) - level = 30; + if (level < TENT_MIN_LEVEL) + level = TENT_MIN_LEVEL; return level; } @@ -3369,7 +3375,7 @@ static void SetNextBattleTentOpponent(void) gTrainerBattleOpponent_A = trainerId; SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0); - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum + 1 < 3) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum + 1 < TENT_STAGES_PER_CHALLENGE) gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A; } diff --git a/src/data/battle_frontier/battle_pyramid_open_level_wild_mons.h b/src/data/battle_frontier/battle_pyramid_open_level_wild_mons.h index 8738b0de6..f09448b82 100644 --- a/src/data/battle_frontier/battle_pyramid_open_level_wild_mons.h +++ b/src/data/battle_frontier/battle_pyramid_open_level_wild_mons.h @@ -1038,7 +1038,7 @@ static const struct PyramidWildMon sOpenLevelWildMons_Round20[] = } }; -static const struct PyramidWildMon *const sOpenLevelWildMonPointers[] = +static const struct PyramidWildMon *const sOpenLevelWildMonPointers[TOTAL_ROUNDS] = { sOpenLevelWildMons_Round1, sOpenLevelWildMons_Round2, diff --git a/src/frontier_util.c b/src/frontier_util.c index 03d7b0cb5..a08ccad4f 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -29,6 +29,7 @@ #include "load_save.h" #include "battle_dome.h" #include "constants/battle_frontier.h" +#include "constants/battle_pike.h" #include "constants/frontier_util.h" #include "constants/trainers.h" #include "constants/game_stat.h" @@ -968,7 +969,7 @@ static void PrintHyphens(s32 y) s32 i; u8 text[37]; - for (i = 0; i < 36; i++) + for (i = 0; i < (int)ARRAY_COUNT(text) - 1; i++) text[i] = CHAR_HYPHEN; text[i] = EOS; @@ -1860,25 +1861,25 @@ static void GiveBattlePoints(void) switch (facility) { case FRONTIER_FACILITY_TOWER: - challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; break; case FRONTIER_FACILITY_DOME: challengeNum = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode]; break; case FRONTIER_FACILITY_PALACE: - challengeNum = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; break; case FRONTIER_FACILITY_ARENA: - challengeNum = gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; break; case FRONTIER_FACILITY_FACTORY: - challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; break; case FRONTIER_FACILITY_PIKE: - challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / 14; + challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / NUM_PIKE_ROOMS; break; case FRONTIER_FACILITY_PYRAMID: - challengeNum = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; break; } @@ -1982,7 +1983,7 @@ static void AppendIfValid(u16 species, u16 heldItem, u16 hp, u8 lvlMode, u8 monL if (gFrontierBannedSpecies[i] != 0xFFFF) return; - if (lvlMode == FRONTIER_LVL_50 && monLevel > 50) + if (lvlMode == FRONTIER_LVL_50 && monLevel > FRONTIER_MAX_LEVEL_50) return; for (i = 0; i < *count && speciesArray[i] != species; i++) diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 363f2bc06..9eaa035ca 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -12,6 +12,7 @@ #include "string_util.h" #include "task.h" #include "text.h" +#include "constants/battle_frontier.h" #include "constants/layouts.h" #include "constants/region_map_sections.h" #include "constants/weather.h" @@ -185,7 +186,7 @@ static const u8 sText_PyramidFloor6[] = _("PYRAMID FLOOR 6"); static const u8 sText_PyramidFloor7[] = _("PYRAMID FLOOR 7"); static const u8 sText_Pyramid[] = _("PYRAMID"); -static const u8 * const sBattlePyramid_MapHeaderStrings[] = +static const u8 * const sBattlePyramid_MapHeaderStrings[FRONTIER_STAGES_PER_CHALLENGE + 1] = { sText_PyramidFloor1, sText_PyramidFloor2, @@ -309,7 +310,7 @@ static void ShowMapNamePopUpWindow(void) if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP) { withoutPrefixPtr = &(mapDisplayHeader[3]); - mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[7]; + mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[FRONTIER_STAGES_PER_CHALLENGE]; } else { diff --git a/src/mystery_gift_client.c b/src/mystery_gift_client.c index eeebec5d6..bd177e6f8 100644 --- a/src/mystery_gift_client.c +++ b/src/mystery_gift_client.c @@ -202,7 +202,7 @@ static u32 Client_Run(struct MysteryGiftClient * client) MysteryGiftLink_InitSend(&client->link, MG_LINKID_GAME_DATA, client->sendBuffer, sizeof(struct MysteryGiftLinkGameData)); break; case CLI_LOAD_TOSS_RESPONSE: - // param here is set by MG_STATE_LINK_ASK_TOSS or MG_STATE_LINK_ASK_TOSS_UNRECEIVED + // param here is set by MG_STATE_CLIENT_ASK_TOSS or MG_STATE_CLIENT_ASK_TOSS_UNRECEIVED MysteryGiftClient_InitSendWord(client, MG_LINKID_RESPONSE, client->param); break; case CLI_SAVE_CARD: diff --git a/src/party_menu.c b/src/party_menu.c index cbe127bb9..016c359cb 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -5647,11 +5647,11 @@ static u8 GetBattleEntryLevelCap(void) case FACILITY_MULTI_OR_EREADER: return MAX_LEVEL; case FACILITY_UNION_ROOM: - return 30; + return UNION_ROOM_MAX_LEVEL; default: // Battle Frontier if (gSpecialVar_0x8004 == FRONTIER_LVL_50) - return 50; - return MAX_LEVEL; + return FRONTIER_MAX_LEVEL_50; + return FRONTIER_MAX_LEVEL_OPEN; } } diff --git a/src/pokemon.c b/src/pokemon.c index 7cdad72e9..b0bc41897 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2464,7 +2464,7 @@ void CreateBattleTowerMon_HandleLevel(struct Pokemon *mon, struct BattleTowerPok if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50) level = GetFrontierEnemyMonLevel(gSaveBlock2Ptr->frontier.lvlMode); else if (lvl50) - level = 50; + level = FRONTIER_MAX_LEVEL_50; else level = src->level; diff --git a/src/start_menu.c b/src/start_menu.c index 90230c3dd..11189ee83 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -42,9 +42,10 @@ #include "text_window.h" #include "trainer_card.h" #include "window.h" -#include "constants/songs.h" #include "union_room.h" +#include "constants/battle_frontier.h" #include "constants/rgb.h" +#include "constants/songs.h" // Menu actions enum @@ -138,7 +139,7 @@ static bool8 FieldCB_ReturnToFieldStartMenu(void); static const struct WindowTemplate sSafariBallsWindowTemplate = {0, 1, 1, 9, 4, 0xF, 8}; -static const u8* const sPyramidFloorNames[] = +static const u8* const sPyramidFloorNames[FRONTIER_STAGES_PER_CHALLENGE + 1] = { gText_Floor1, gText_Floor2, @@ -392,7 +393,7 @@ static void ShowSafariBallsWindow(void) static void ShowPyramidFloorWindow(void) { - if (gSaveBlock2Ptr->frontier.curChallengeBattleNum == 7) + if (gSaveBlock2Ptr->frontier.curChallengeBattleNum == FRONTIER_STAGES_PER_CHALLENGE) sBattlePyramidFloorWindowId = AddWindow(&sPyramidFloorWindowTemplate_1); else sBattlePyramidFloorWindowId = AddWindow(&sPyramidFloorWindowTemplate_2); diff --git a/src/union_room.c b/src/union_room.c index 9a743dbab..05b41a088 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -4318,7 +4318,7 @@ static bool32 HasAtLeastTwoMonsOfLevel30OrLower(void) for (i = 0; i < gPlayerPartyCount; i++) { - if (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) <= 30 + if (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) <= UNION_ROOM_MAX_LEVEL && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_EGG) count++; } From 7470a56d44fa05749c4832e7c18570978afc5163 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 9 Jun 2022 14:59:21 -0300 Subject: [PATCH 47/65] Untangled CheckPartnersMonForRibbons --- src/trade.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trade.c b/src/trade.c index df3cb4d33..25614c91a 100644 --- a/src/trade.c +++ b/src/trade.c @@ -4813,7 +4813,7 @@ static void CheckPartnersMonForRibbons(void) { u8 i; u8 numRibbons = 0; - for (i = 0; i < 12; i ++) + for (i = 0; i < (MON_DATA_UNUSED_RIBBONS - MON_DATA_CHAMPION_RIBBON); i ++) { numRibbons += GetMonData(&gEnemyParty[gSelectedTradeMonPositions[TRADE_PARTNER] % PARTY_SIZE], MON_DATA_CHAMPION_RIBBON + i); } From dec54e6e928217cdb6249fdad03d1b6492c7c7ff Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 9 Jun 2022 15:32:08 -0400 Subject: [PATCH 48/65] Additional constant usage --- data/maps/BattleFrontier_Lounge2/scripts.inc | 26 ++++++++-------- src/battle_pike.c | 8 ++--- src/battle_tower.c | 32 ++++++++++---------- src/frontier_util.c | 26 ++++++++-------- 4 files changed, 47 insertions(+), 45 deletions(-) diff --git a/data/maps/BattleFrontier_Lounge2/scripts.inc b/data/maps/BattleFrontier_Lounge2/scripts.inc index 8efc17293..12eda4a5e 100644 --- a/data/maps/BattleFrontier_Lounge2/scripts.inc +++ b/data/maps/BattleFrontier_Lounge2/scripts.inc @@ -22,18 +22,20 @@ BattleFrontier_Lounge2_EventScript_AlreadyMetManiac:: end BattleFrontier_Lounge2_EventScript_GiveAdvice:: - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 0, BattleFrontier_Lounge2_EventScript_BufferSingle - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 1, BattleFrontier_Lounge2_EventScript_BufferDouble - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 2, BattleFrontier_Lounge2_EventScript_BufferMulti - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 3, BattleFrontier_Lounge2_EventScript_BufferMultiLink - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 4, BattleFrontier_Lounge2_EventScript_BufferBattleDome - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 5, BattleFrontier_Lounge2_EventScript_BufferBattleFactory - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 6, BattleFrontier_Lounge2_EventScript_BufferBattlePalace - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 7, BattleFrontier_Lounge2_EventScript_BufferBattleArena - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 8, BattleFrontier_Lounge2_EventScript_BufferBattlePike - call_if_eq VAR_FRONTIER_MANIAC_FACILITY, 9, BattleFrontier_Lounge2_EventScript_BufferBattlePyramid - call_if_le VAR_FRONTIER_MANIAC_FACILITY, 3, BattleFrontier_Lounge2_EventScript_BattleTowerNews - call_if_ge VAR_FRONTIER_MANIAC_FACILITY, 4, BattleFrontier_Lounge2_EventScript_FacilityNews + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_SINGLES, BattleFrontier_Lounge2_EventScript_BufferSingle + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_DOUBLES, BattleFrontier_Lounge2_EventScript_BufferDouble + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_MULTIS, BattleFrontier_Lounge2_EventScript_BufferMulti + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_LINK, BattleFrontier_Lounge2_EventScript_BufferMultiLink + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_DOME, BattleFrontier_Lounge2_EventScript_BufferBattleDome + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_FACTORY, BattleFrontier_Lounge2_EventScript_BufferBattleFactory + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_PALACE, BattleFrontier_Lounge2_EventScript_BufferBattlePalace + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_ARENA, BattleFrontier_Lounge2_EventScript_BufferBattleArena + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_PIKE, BattleFrontier_Lounge2_EventScript_BufferBattlePike + call_if_eq VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_PYRAMID, BattleFrontier_Lounge2_EventScript_BufferBattlePyramid +@ <= FRONTIER_MANIAC_TOWER_LINK is any Battle Tower mode + call_if_le VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_TOWER_LINK, BattleFrontier_Lounge2_EventScript_BattleTowerNews +@ >= FRONTIER_MANIAC_DOME is any facility other than Battle Tower + call_if_ge VAR_FRONTIER_MANIAC_FACILITY, FRONTIER_MANIAC_DOME, BattleFrontier_Lounge2_EventScript_FacilityNews special ShowFrontierManiacMessage waitmessage waitbuttonpress diff --git a/src/battle_pike.c b/src/battle_pike.c index 6c97c99fc..433dd0a08 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -1158,11 +1158,11 @@ u8 GetBattlePikeWildMonHeaderId(void) u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u16 winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode]; - if (winStreak <= 280) + if (winStreak <= 20 * NUM_PIKE_ROOMS) headerId = 0; - else if (winStreak <= 560) + else if (winStreak <= 40 * NUM_PIKE_ROOMS) headerId = 1; - else if (winStreak <= 840) + else if (winStreak <= 60 * NUM_PIKE_ROOMS) headerId = 2; else headerId = 3; @@ -1392,7 +1392,7 @@ static void PrepareOneTrainer(bool8 difficult) if (!difficult) battleNum = 1; else - battleNum = 6; + battleNum = FRONTIER_STAGES_PER_CHALLENGE - 1; lvlMode = gSaveBlock2Ptr->frontier.lvlMode; challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / NUM_PIKE_ROOMS; diff --git a/src/battle_tower.c b/src/battle_tower.c index 839b99b24..354a087c4 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -1327,19 +1327,19 @@ void PutNewBattleTowerRecord(struct EmeraldBattleTowerRecord *newRecordEm) if (gSaveBlock2Ptr->frontier.towerRecords[i].trainerId[j] != newRecord->trainerId[j]) break; } - if (j == 4) + if (j == TRAINER_ID_LENGTH) { for (k = 0; k < PLAYER_NAME_LENGTH; k++) { - #ifdef BUGFIX - if (gSaveBlock2Ptr->frontier.towerRecords[i].name[k] != newRecord->name[k]) + // Incorrect index being used + #ifdef BUGFIX + #define INDEX k + #else + #define INDEX j + #endif + if (gSaveBlock2Ptr->frontier.towerRecords[i].name[INDEX] != newRecord->name[INDEX]) break; - if (newRecord->name[k] == EOS) - #else - if (gSaveBlock2Ptr->frontier.towerRecords[i].name[j] != newRecord->name[j]) - break; - if (newRecord->name[j] == EOS) - #endif + if (newRecord->name[INDEX] == EOS) { k = PLAYER_NAME_LENGTH; break; @@ -1635,7 +1635,7 @@ static void FillTentTrainerParty(u8 monsCount) static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) { s32 i, j; - u16 chosenMonIndices[4]; + u16 chosenMonIndices[MAX_FRONTIER_PARTY_SIZE]; u8 friendship = MAX_FRIENDSHIP; u8 level = SetFacilityPtrsGetLevel(); u8 fixedIV = 0; @@ -1651,7 +1651,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) } else if (trainerId == TRAINER_EREADER) { - for (i = firstMonId; i < firstMonId + 3; i++) + for (i = firstMonId; i < firstMonId + FRONTIER_PARTY_SIZE; i++) CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); return; } @@ -1676,7 +1676,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) else { // Apprentice. - for (i = firstMonId; i < firstMonId + 3; i++) + for (i = firstMonId; i < firstMonId + FRONTIER_PARTY_SIZE; i++) CreateApprenticeMon(&gEnemyParty[i], &gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE], i - firstMonId); return; } @@ -1775,7 +1775,7 @@ static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId) else level = FRONTIER_MAX_LEVEL_50; - for (i = 0; i != 3; i++) + for (i = 0; i != FRONTIER_PARTY_SIZE; i++) { CreateMonWithEVSpread(&gEnemyParty[firstMonId + i], apprentice->party[i].species, level, fixedIV, 8); friendship = MAX_FRIENDSHIP; @@ -1848,7 +1848,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId) } else if (trainerId == TRAINER_EREADER) { - for (i = firstMonId; i < firstMonId + 3; i++) + for (i = firstMonId; i < firstMonId + FRONTIER_PARTY_SIZE; i++) CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); return; } @@ -2743,8 +2743,8 @@ u16 GetCurrentBattleTowerWinStreak(u8 lvlMode, u8 battleMode) { u16 winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]; - if (winStreak > 9999) - return 9999; + if (winStreak > MAX_STREAK) + return MAX_STREAK; else return winStreak; } diff --git a/src/frontier_util.c b/src/frontier_util.c index a08ccad4f..545f48ac0 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -595,13 +595,13 @@ static const u8 sBattlePointAwards[][NUM_FRONTIER_FACILITIES][FRONTIER_MODE_COUN // First bit is has battled them before and not won yet, second bit is has battled them and won (obtained a Symbol) static const u16 sBattledBrainBitFlags[NUM_FRONTIER_FACILITIES][2] = { - [FRONTIER_FACILITY_TOWER] = {0x0001, 0x0002}, - [FRONTIER_FACILITY_DOME] = {0x0004, 0x0008}, - [FRONTIER_FACILITY_PALACE] = {0x0010, 0x0020}, - [FRONTIER_FACILITY_ARENA] = {0x0040, 0x0080}, - [FRONTIER_FACILITY_FACTORY] = {0x0100, 0x0200}, - [FRONTIER_FACILITY_PIKE] = {0x0400, 0x0800}, - [FRONTIER_FACILITY_PYRAMID] = {0x1000, 0x2000}, + [FRONTIER_FACILITY_TOWER] = {1 << 0, 1 << 1}, + [FRONTIER_FACILITY_DOME] = {1 << 2, 1 << 3}, + [FRONTIER_FACILITY_PALACE] = {1 << 4, 1 << 5}, + [FRONTIER_FACILITY_ARENA] = {1 << 6, 1 << 7}, + [FRONTIER_FACILITY_FACTORY] = {1 << 8, 1 << 9}, + [FRONTIER_FACILITY_PIKE] = {1 << 10, 1 << 11}, + [FRONTIER_FACILITY_PYRAMID] = {1 << 12, 1 << 13}, }; static void (* const sFrontierUtilFuncs[])(void) = @@ -636,8 +636,8 @@ static const struct WindowTemplate sFrontierResultsWindowTemplate = .bg = 0, .tilemapLeft = 1, .tilemapTop = 1, - .width = 0x1c, - .height = 0x12, + .width = 28, + .height = 18, .paletteNum = 15, .baseBlock = 1 }; @@ -647,7 +647,7 @@ static const struct WindowTemplate sLinkContestResultsWindowTemplate = .bg = 0, .tilemapLeft = 2, .tilemapTop = 2, - .width = 0x1a, + .width = 26, .height = 15, .paletteNum = 15, .baseBlock = 1 @@ -658,7 +658,7 @@ static const struct WindowTemplate sRankingHallRecordsWindowTemplate = .bg = 0, .tilemapLeft = 2, .tilemapTop = 1, - .width = 0x1a, + .width = 26, .height = 17, .paletteNum = 15, .baseBlock = 1 @@ -959,7 +959,7 @@ static bool8 IsWinStreakActive(u32 challenge) static void PrintAligned(const u8 *str, s32 y) { - s32 x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 224); + s32 x = GetStringCenterAlignXOffset(FONT_NORMAL, str, DISPLAY_WIDTH - 16); y = (y * 8) + 1; AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x, y, TEXT_SKIP_DRAW, NULL); } @@ -2345,7 +2345,7 @@ static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode) StringCopy(gStringVar1, sRecordsWindowChallengeTexts[hallFacilityId][0]); StringExpandPlaceholders(gStringVar4, sRecordsWindowChallengeTexts[hallFacilityId][1]); AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, 0, 1, TEXT_SKIP_DRAW, NULL); - x = GetStringRightAlignXOffset(FONT_NORMAL, sLevelModeText[lvlMode], 0xD0); + x = GetStringRightAlignXOffset(FONT_NORMAL, sLevelModeText[lvlMode], DISPLAY_WIDTH - 32); AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, sLevelModeText[lvlMode], x, 1, TEXT_SKIP_DRAW, NULL); if (hallFacilityId == RANKING_HALL_TOWER_LINK) { From 95f075ec905da35ff1bc97f70a92c13a5a218c9a Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 13 Jun 2022 15:01:04 -0400 Subject: [PATCH 49/65] Remove erroneous bugfix --- src/match_call.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/match_call.c b/src/match_call.c index de7f13416..8b25d5b44 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -33,6 +33,13 @@ #include "constants/songs.h" #include "constants/trainers.h" +// In this file only the values normally associated with Battle Pike and Factory are swapped. +// Note that this is *not* a bug, because they are properly swapped consistently in this file. +// There would only be an issue if anything in this file interacted with something expecting +// the usual value order, or vice versa. +#define MATCH_CALL_FACTORY FRONTIER_FACILITY_PIKE +#define MATCH_CALL_PIKE FRONTIER_FACILITY_FACTORY + // Each match call message has variables that can be populated randomly or // dependent on the trainer. The below are IDs for how to populate the vars // in a given message. @@ -1590,6 +1597,7 @@ static const struct MatchCallText *GetGeneralMatchCallText(int matchCallId, u8 * rand = Random(); if (!(rand & 1)) { + // Count the number of facilities with a win streak for (count = 0, i = 0; i < NUM_FRONTIER_FACILITIES; i++) { if (GetFrontierStreakInfo(i, &topic) > 1) @@ -1598,6 +1606,8 @@ static const struct MatchCallText *GetGeneralMatchCallText(int matchCallId, u8 * if (count) { + // At least one facility with a win streak + // Randomly choose one to have a call about count = Random() % count; for (i = 0; i < NUM_FRONTIER_FACILITIES; i++) { @@ -1807,15 +1817,15 @@ static void PopulateSpeciesFromTrainerParty(int matchCallId, u8 *destStr) StringCopy(destStr, speciesName); } -static const u8 *const sBattleFrontierFacilityNames[] = +static const u8 *const sBattleFrontierFacilityNames[NUM_FRONTIER_FACILITIES] = { - gText_BattleTower2, - gText_BattleDome, - gText_BattlePalace, - gText_BattleArena, - gText_BattlePike, - gText_BattleFactory, - gText_BattlePyramid, + [FRONTIER_FACILITY_TOWER] = gText_BattleTower2, + [FRONTIER_FACILITY_DOME] = gText_BattleDome, + [FRONTIER_FACILITY_PALACE] = gText_BattlePalace, + [FRONTIER_FACILITY_ARENA] = gText_BattleArena, + [MATCH_CALL_PIKE] = gText_BattlePike, + [MATCH_CALL_FACTORY] = gText_BattleFactory, + [FRONTIER_FACILITY_PYRAMID] = gText_BattlePyramid, }; static void PopulateBattleFrontierFacilityName(int matchCallId, u8 *destStr) @@ -1899,7 +1909,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) switch (facilityId) { case FRONTIER_FACILITY_DOME: - for (i = 0; i < 2; i++) + for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.domeRecordWinStreaks); i++) { for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++) { @@ -1909,11 +1919,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) } *topicTextId = GEN_TOPIC_B_DOME - 1; break; - #ifdef BUGFIX - case FRONTIER_FACILITY_PIKE: - #else - case FRONTIER_FACILITY_FACTORY: - #endif + case MATCH_CALL_PIKE: for (i = 0; i < FRONTIER_LVL_MODE_COUNT; i++) { if (streak < gSaveBlock2Ptr->frontier.pikeRecordStreaks[i]) @@ -1922,7 +1928,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) *topicTextId = GEN_TOPIC_B_PIKE - 1; break; case FRONTIER_FACILITY_TOWER: - for (i = 0; i < 4; i++) + for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.towerRecordWinStreaks); i++) { for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++) { @@ -1933,7 +1939,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) *topicTextId = GEN_TOPIC_STREAK_RECORD - 1; break; case FRONTIER_FACILITY_PALACE: - for (i = 0; i < 2; i++) + for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.palaceRecordWinStreaks); i++) { for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++) { @@ -1943,12 +1949,8 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) } *topicTextId = GEN_TOPIC_STREAK_RECORD - 1; break; - #ifdef BUGFIX - case FRONTIER_FACILITY_FACTORY: - #else - case FRONTIER_FACILITY_PIKE: - #endif - for (i = 0; i < 2; i++) + case MATCH_CALL_FACTORY: + for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.factoryRecordWinStreaks); i++) { for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++) { From 4660f8c88baeccf3ab0baba03e8f0b7430ed73df Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 14 Jun 2022 09:18:55 -0400 Subject: [PATCH 50/65] Document battle tower TV show --- data/text/tv.inc | 30 +++++------ include/constants/tv.h | 17 ++++++ include/event_scripts.h | 30 +++++------ src/easy_chat.c | 2 +- src/frontier_util.c | 60 +++++++++++----------- src/tv.c | 111 ++++++++++++++++++++-------------------- 6 files changed, 134 insertions(+), 116 deletions(-) diff --git a/data/text/tv.inc b/data/text/tv.inc index 68b842158..6cfc289d2 100644 --- a/data/text/tv.inc +++ b/data/text/tv.inc @@ -166,7 +166,7 @@ BattleFrontier_BattleTowerLobby_Text_LookingForwardToNextBattle:: .string "I'll be looking forward to your\n" .string "next battle!$" -gTVBravoTrainerBattleTowerText00:: +BravoTrainerBattleTower_Text_Intro:: .string "Yeah!\n" .string "It's BRAVO TRAINER time!\p" .string "Today, we're going to profile {STR_VAR_1},\n" @@ -174,12 +174,12 @@ gTVBravoTrainerBattleTowerText00:: .string "For the challenge, {STR_VAR_1} entered\n" .string "one wicked {STR_VAR_2}.$" -gTVBravoTrainerBattleTowerText01:: +BravoTrainerBattleTower_Text_NewRecord:: .string "The pair set a new record of {STR_VAR_2} wins\n" .string "in a row in {STR_VAR_1} competition!\l" .string "Bravo, TRAINER!$" -gTVBravoTrainerBattleTowerText02:: +BravoTrainerBattleTower_Text_Lost:: .string "The twosome finally succumbed to\n" .string "{STR_VAR_1} in match number {STR_VAR_2}.\l" .string "Nice try, TRAINER!\p" @@ -188,7 +188,7 @@ gTVBravoTrainerBattleTowerText02:: .string "We asked the TRAINER for impressions\n" .string "on the match with {STR_VAR_1}.$" -gTVBravoTrainerBattleTowerText03:: +BravoTrainerBattleTower_Text_Won:: .string "The twosome won it all by defeating\n" .string "{STR_VAR_1}'s {STR_VAR_2} thoroughly.\l" .string "Bravo, TRAINER!\p" @@ -197,7 +197,7 @@ gTVBravoTrainerBattleTowerText03:: .string "We asked the TRAINER for impressions\n" .string "on the moment of glory.$" -gTVBravoTrainerBattleTowerText04:: +BravoTrainerBattleTower_Text_LostFinal:: .string "After a string of wins, the pair finally\n" .string "succumbed to {STR_VAR_1}'s {STR_VAR_2},\l" .string "their final hurdle.\p" @@ -208,7 +208,7 @@ gTVBravoTrainerBattleTowerText04:: .string "We asked the TRAINER for impressions\n" .string "on battling the celebrity pair.$" -gTVBravoTrainerBattleTowerText05:: +BravoTrainerBattleTower_Text_Satisfied:: .string "This is what the TRAINER had to say:\n" .string "“I'm satisfied!”\p" .string "Now isn't that a refreshing reply?\n" @@ -218,7 +218,7 @@ gTVBravoTrainerBattleTowerText05:: .string "I found out exactly how satisfied\n" .string "when I heard the TRAINER say this:$" -gTVBravoTrainerBattleTowerText06:: +BravoTrainerBattleTower_Text_Unsatisfied:: .string "This is what the TRAINER had to say:\n" .string "“I'm not satisfied…”\p" .string "Our TRAINER was obviously a little down\n" @@ -228,22 +228,22 @@ gTVBravoTrainerBattleTowerText06:: .string "Anyway, I found out how dissatisfied\n" .string "our TRAINER was when I heard this:$" -gTVBravoTrainerBattleTowerText07:: +BravoTrainerBattleTower_Text_None1:: .string "None$" -gTVBravoTrainerBattleTowerText08:: +BravoTrainerBattleTower_Text_None2:: .string "None$" -gTVBravoTrainerBattleTowerText09:: +BravoTrainerBattleTower_Text_None3:: .string "None$" -gTVBravoTrainerBattleTowerText10:: +BravoTrainerBattleTower_Text_None4:: .string "None$" -gTVBravoTrainerBattleTowerText11:: +BravoTrainerBattleTower_Text_Response:: .string "“{STR_VAR_1}.”$" -gTVBravoTrainerBattleTowerText12:: +BravoTrainerBattleTower_Text_ResponseSatisfied:: .string "“{STR_VAR_1}.”\n" .string "Now isn't that great?\p" .string "It really expresses {STR_VAR_2}'s joy,\n" @@ -252,7 +252,7 @@ gTVBravoTrainerBattleTowerText12:: .string "end… It really was what you'd call\l" .string "“{STR_VAR_1}”!$" -gTVBravoTrainerBattleTowerText13:: +BravoTrainerBattleTower_Text_ResponseUnsatisfied:: .string "“{STR_VAR_1}.”\n" .string "Now isn't that fitting?\p" .string "That battle with {STR_VAR_3} at the\n" @@ -261,7 +261,7 @@ gTVBravoTrainerBattleTowerText13:: .string "{STR_VAR_2}'s disappointment comes across\n" .string "loud and clear, I'd say!$" -gTVBravoTrainerBattleTowerText14:: +BravoTrainerBattleTower_Text_Outro:: .string "Bravo, {STR_VAR_1}!\n" .string "Bravo, {STR_VAR_2}!\p" .string "I hope we can count on seeing\n" diff --git a/include/constants/tv.h b/include/constants/tv.h index 4c8dd4fa8..87748a31d 100644 --- a/include/constants/tv.h +++ b/include/constants/tv.h @@ -274,4 +274,21 @@ #define SMARTSHOPPER_NUM_ITEMS 3 +// TV Show states for Bravo Trainer's Battle Tower interview +#define BRAVOTOWER_STATE_INTRO 0 +#define BRAVOTOWER_STATE_NEW_RECORD 1 +#define BRAVOTOWER_STATE_LOST 2 +#define BRAVOTOWER_STATE_WON 3 +#define BRAVOTOWER_STATE_LOST_FINAL 4 +#define BRAVOTOWER_STATE_SATISFIED 5 +#define BRAVOTOWER_STATE_UNSATISFIED 6 +#define BRAVOTOWER_STATE_UNUSED_1 7 +#define BRAVOTOWER_STATE_UNUSED_2 8 +#define BRAVOTOWER_STATE_UNUSED_3 9 +#define BRAVOTOWER_STATE_UNUSED_4 10 +#define BRAVOTOWER_STATE_RESPONSE 11 +#define BRAVOTOWER_STATE_RESPONSE_SATISFIED 12 +#define BRAVOTOWER_STATE_RESPONSE_UNSATISFIED 13 +#define BRAVOTOWER_STATE_OUTRO 14 + #endif //GUARD_CONSTANTS_TV_H diff --git a/include/event_scripts.h b/include/event_scripts.h index a19d4553a..4e0a88f82 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -21,21 +21,21 @@ extern const u8 gTVBravoTrainerText05[]; extern const u8 gTVBravoTrainerText06[]; extern const u8 gTVBravoTrainerText07[]; extern const u8 gTVBravoTrainerText08[]; -extern const u8 gTVBravoTrainerBattleTowerText00[]; -extern const u8 gTVBravoTrainerBattleTowerText01[]; -extern const u8 gTVBravoTrainerBattleTowerText02[]; -extern const u8 gTVBravoTrainerBattleTowerText03[]; -extern const u8 gTVBravoTrainerBattleTowerText04[]; -extern const u8 gTVBravoTrainerBattleTowerText05[]; -extern const u8 gTVBravoTrainerBattleTowerText06[]; -extern const u8 gTVBravoTrainerBattleTowerText07[]; -extern const u8 gTVBravoTrainerBattleTowerText08[]; -extern const u8 gTVBravoTrainerBattleTowerText09[]; -extern const u8 gTVBravoTrainerBattleTowerText10[]; -extern const u8 gTVBravoTrainerBattleTowerText11[]; -extern const u8 gTVBravoTrainerBattleTowerText12[]; -extern const u8 gTVBravoTrainerBattleTowerText13[]; -extern const u8 gTVBravoTrainerBattleTowerText14[]; +extern const u8 BravoTrainerBattleTower_Text_Intro[]; +extern const u8 BravoTrainerBattleTower_Text_NewRecord[]; +extern const u8 BravoTrainerBattleTower_Text_Lost[]; +extern const u8 BravoTrainerBattleTower_Text_Won[]; +extern const u8 BravoTrainerBattleTower_Text_LostFinal[]; +extern const u8 BravoTrainerBattleTower_Text_Satisfied[]; +extern const u8 BravoTrainerBattleTower_Text_Unsatisfied[]; +extern const u8 BravoTrainerBattleTower_Text_None1[]; +extern const u8 BravoTrainerBattleTower_Text_None2[]; +extern const u8 BravoTrainerBattleTower_Text_None3[]; +extern const u8 BravoTrainerBattleTower_Text_None4[]; +extern const u8 BravoTrainerBattleTower_Text_Response[]; +extern const u8 BravoTrainerBattleTower_Text_ResponseSatisfied[]; +extern const u8 BravoTrainerBattleTower_Text_ResponseUnsatisfied[]; +extern const u8 BravoTrainerBattleTower_Text_Outro[]; extern const u8 gTVFanClubOpinionsText00[]; extern const u8 gTVFanClubOpinionsText01[]; extern const u8 gTVFanClubOpinionsText02[]; diff --git a/src/easy_chat.c b/src/easy_chat.c index 4d6006f1c..2bbd16cb2 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -1492,7 +1492,7 @@ void ShowEasyChatScreen(void) displayedPersonType = EASY_CHAT_PERSON_REPORTER_MALE; break; case EASY_CHAT_TYPE_BATTLE_TOWER_INTERVIEW: - words = gSaveBlock1Ptr->tvShows[gSpecialVar_0x8005].fanclubOpinions.words18; + words = gSaveBlock1Ptr->tvShows[gSpecialVar_0x8005].bravoTrainerTower.words; displayedPersonType = EASY_CHAT_PERSON_REPORTER_FEMALE; break; case EASY_CHAT_TYPE_GOOD_SAYING: diff --git a/src/frontier_util.c b/src/frontier_util.c index 545f48ac0..f5dde452f 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -500,94 +500,94 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ static const u8 sBattlePointAwards[][NUM_FRONTIER_FACILITIES][FRONTIER_MODE_COUNT] = { { - {1, 2, 3, 3}, {1, 1, 0, 0}, {4, 5, 0, 0}, {1, 0, 0, 0}, {3, 4, 0, 0}, {1, 0, 0, 0}, {5, 0, 0, 0} + {1, 2, 3, 3}, {1, 1}, {4, 5}, {1}, {3, 4}, {1}, {5} }, { - {2, 3, 4, 4}, {1, 1, 0, 0}, {4, 5, 0, 0}, {1, 0, 0, 0}, {3, 4, 0, 0}, {1, 0, 0, 0}, {5, 0, 0, 0} + {2, 3, 4, 4}, {1, 1}, {4, 5}, {1}, {3, 4}, {1}, {5} }, { - {3, 4, 5, 5}, {2, 2, 0, 0}, {5, 6, 0, 0}, {1, 0, 0, 0}, {4, 5, 0, 0}, {2, 0, 0, 0}, {6, 0, 0, 0} + {3, 4, 5, 5}, {2, 2}, {5, 6}, {1}, {4, 5}, {2}, {6} }, { - {4, 5, 6, 6}, {2, 2, 0, 0}, {5, 6, 0, 0}, {2, 0, 0, 0}, {4, 5, 0, 0}, {2, 0, 0, 0}, {6, 0, 0, 0} + {4, 5, 6, 6}, {2, 2}, {5, 6}, {2}, {4, 5}, {2}, {6} }, { - {5, 6, 7, 7}, {3, 3, 0, 0}, {6, 7, 0, 0}, {2, 0, 0, 0}, {5, 6, 0, 0}, {2, 0, 0, 0}, {7, 0, 0, 0} + {5, 6, 7, 7}, {3, 3}, {6, 7}, {2}, {5, 6}, {2}, {7} }, { - {6, 7, 8, 8}, {3, 3, 0, 0}, {6, 7, 0, 0}, {2, 0, 0, 0}, {5, 6, 0, 0}, {4, 0, 0, 0}, {7, 0, 0, 0} + {6, 7, 8, 8}, {3, 3}, {6, 7}, {2}, {5, 6}, {4}, {7} }, { - {7, 8, 9, 9}, {4, 4, 0, 0}, {7, 8, 0, 0}, {3, 0, 0, 0}, {6, 7, 0, 0}, {4, 0, 0, 0}, {8, 0, 0, 0} + {7, 8, 9, 9}, {4, 4}, {7, 8}, {3}, {6, 7}, {4}, {8} }, { - {8, 9, 10, 10}, {4, 4, 0, 0}, {7, 8, 0, 0}, {3, 0, 0, 0},{6, 7, 0, 0}, {4, 0, 0, 0}, {8, 0, 0, 0} + {8, 9, 10, 10}, {4, 4}, {7, 8}, {3},{6, 7}, {4}, {8} }, { - {9, 10, 11, 11}, {5, 5, 0, 0}, {8, 9, 0, 0}, {4, 0, 0, 0}, {7, 8, 0, 0}, {8, 0, 0, 0}, {9, 0, 0, 0} + {9, 10, 11, 11}, {5, 5}, {8, 9}, {4}, {7, 8}, {8}, {9} }, { - {10, 11, 12, 12}, {5, 5, 0, 0}, {8, 9, 0, 0}, {4, 0, 0, 0}, {7, 8, 0, 0}, {8, 0, 0, 0}, {9, 0, 0, 0} + {10, 11, 12, 12}, {5, 5}, {8, 9}, {4}, {7, 8}, {8}, {9} }, { - {11, 12, 13, 13}, {6, 6, 0, 0}, {9, 10, 0, 0}, {5, 0, 0,0}, {8, 9, 0, 0}, {8, 0, 0, 0}, {10, 0, 0, 0} + {11, 12, 13, 13}, {6, 6}, {9, 10}, {5,0}, {8, 9}, {8}, {10} }, { - {12, 13, 14, 14}, {6, 6, 0, 0}, {9, 10, 0, 0}, {6, 0, 0,0}, {8, 9, 0, 0}, {8, 0, 0, 0}, {10, 0, 0, 0} + {12, 13, 14, 14}, {6, 6}, {9, 10}, {6,0}, {8, 9}, {8}, {10} }, { - {13, 14, 15, 15}, {7, 7, 0, 0}, {10, 11, 0, 0}, {7, 0, 0, 0}, {9, 10, 0, 0}, {10, 0, 0, 0}, {11, 0, 0, 0} + {13, 14, 15, 15}, {7, 7}, {10, 11}, {7}, {9, 10}, {10}, {11} }, { - {14, 15, 15, 15}, {7, 7, 0, 0}, {10, 11, 0, 0}, {8, 0, 0, 0}, {9, 10, 0, 0}, {10, 0, 0, 0}, {11, 0, 0, 0} + {14, 15, 15, 15}, {7, 7}, {10, 11}, {8}, {9, 10}, {10}, {11} }, { - {15, 15, 15, 15}, {8, 8, 0, 0}, {11, 12, 0, 0}, {9, 0, 0, 0}, {10, 11, 0, 0}, {10, 0, 0, 0}, {12, 0, 0, 0} + {15, 15, 15, 15}, {8, 8}, {11, 12}, {9}, {10, 11}, {10}, {12} }, { - {15, 15, 15, 15}, {8, 8, 0, 0}, {11, 12, 0, 0}, {10, 0, 0, 0}, {10, 11, 0, 0}, {10, 0, 0, 0}, {12, 0, 0, 0} + {15, 15, 15, 15}, {8, 8}, {11, 12}, {10}, {10, 11}, {10}, {12} }, { - {15, 15, 15, 15}, {9, 9, 0, 0}, {12, 13, 0, 0}, {11, 0, 0, 0}, {11, 12, 0, 0}, {12, 0, 0, 0}, {13, 0, 0, 0} + {15, 15, 15, 15}, {9, 9}, {12, 13}, {11}, {11, 12}, {12}, {13} }, { - {15, 15, 15, 15}, {9, 9, 0, 0}, {12, 13, 0, 0}, {12, 0, 0, 0}, {11, 12, 0, 0}, {12, 0, 0, 0}, {13, 0, 0, 0} + {15, 15, 15, 15}, {9, 9}, {12, 13}, {12}, {11, 12}, {12}, {13} }, { - {15, 15, 15, 15}, {10, 10, 0, 0}, {13, 14, 0, 0}, {13, 0, 0, 0}, {12, 13, 0, 0}, {12, 0, 0, 0}, {14, 0, 0, 0} + {15, 15, 15, 15}, {10, 10}, {13, 14}, {13}, {12, 13}, {12}, {14} }, { - {15, 15, 15, 15}, {10, 10, 0, 0}, {13, 14, 0, 0}, {14, 0, 0, 0}, {12, 13, 0, 0}, {12, 0, 0, 0}, {14, 0, 0, 0} + {15, 15, 15, 15}, {10, 10}, {13, 14}, {14}, {12, 13}, {12}, {14} }, { - {15, 15, 15, 15}, {11, 11, 0, 0}, {14, 15, 0, 0}, {15, 0, 0, 0}, {13, 14, 0, 0}, {12, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {11, 11}, {14, 15}, {15}, {13, 14}, {12}, {15} }, { - {15, 15, 15, 15}, {11, 11, 0, 0}, {14, 15, 0, 0}, {15, 0, 0, 0}, {13, 14, 0, 0}, {14, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {11, 11}, {14, 15}, {15}, {13, 14}, {14}, {15} }, { - {15, 15, 15, 15}, {12, 12, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {14, 15, 0, 0}, {14, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {12, 12}, {15, 15}, {15}, {14, 15}, {14}, {15} }, { - {15, 15, 15, 15}, {12, 12, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {14, 15, 0, 0}, {14, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {12, 12}, {15, 15}, {15}, {14, 15}, {14}, {15} }, { - {15, 15, 15, 15}, {13, 13, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {14, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {13, 13}, {15, 15}, {15}, {15, 15}, {14}, {15} }, { - {15, 15, 15, 15}, {13, 13, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {13, 13}, {15, 15}, {15}, {15, 15}, {15}, {15} }, { - {15, 15, 15, 15}, {14, 14, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {14, 14}, {15, 15}, {15}, {15, 15}, {15}, {15} }, { - {15, 15, 15, 15}, {14, 14, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {14, 14}, {15, 15}, {15}, {15, 15}, {15}, {15} }, { - {15, 15, 15, 15}, {15, 15, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {15, 15}, {15, 15}, {15}, {15, 15}, {15}, {15} }, { - {15, 15, 15, 15}, {15, 15, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 15, 0, 0}, {15, 0, 0, 0}, {15, 0, 0, 0} + {15, 15, 15, 15}, {15, 15}, {15, 15}, {15}, {15, 15}, {15}, {15} }, }; diff --git a/src/tv.c b/src/tv.c index 5cca91ff7..ec36a3ff0 100644 --- a/src/tv.c +++ b/src/tv.c @@ -373,21 +373,21 @@ static const u8 *const sTV3CheersForPokeblocksTextGroup[] = { }; static const u8 *const sTVBravoTrainerBattleTowerTextGroup[] = { - gTVBravoTrainerBattleTowerText00, - gTVBravoTrainerBattleTowerText01, - gTVBravoTrainerBattleTowerText02, - gTVBravoTrainerBattleTowerText03, - gTVBravoTrainerBattleTowerText04, - gTVBravoTrainerBattleTowerText05, - gTVBravoTrainerBattleTowerText06, - gTVBravoTrainerBattleTowerText07, - gTVBravoTrainerBattleTowerText08, - gTVBravoTrainerBattleTowerText09, - gTVBravoTrainerBattleTowerText10, - gTVBravoTrainerBattleTowerText11, - gTVBravoTrainerBattleTowerText12, - gTVBravoTrainerBattleTowerText13, - gTVBravoTrainerBattleTowerText14 + [BRAVOTOWER_STATE_INTRO] = BravoTrainerBattleTower_Text_Intro, + [BRAVOTOWER_STATE_NEW_RECORD] = BravoTrainerBattleTower_Text_NewRecord, + [BRAVOTOWER_STATE_LOST] = BravoTrainerBattleTower_Text_Lost, + [BRAVOTOWER_STATE_WON] = BravoTrainerBattleTower_Text_Won, + [BRAVOTOWER_STATE_LOST_FINAL] = BravoTrainerBattleTower_Text_LostFinal, + [BRAVOTOWER_STATE_SATISFIED] = BravoTrainerBattleTower_Text_Satisfied, + [BRAVOTOWER_STATE_UNSATISFIED] = BravoTrainerBattleTower_Text_Unsatisfied, + [BRAVOTOWER_STATE_UNUSED_1] = BravoTrainerBattleTower_Text_None1, + [BRAVOTOWER_STATE_UNUSED_2] = BravoTrainerBattleTower_Text_None2, + [BRAVOTOWER_STATE_UNUSED_3] = BravoTrainerBattleTower_Text_None3, + [BRAVOTOWER_STATE_UNUSED_4] = BravoTrainerBattleTower_Text_None4, + [BRAVOTOWER_STATE_RESPONSE] = BravoTrainerBattleTower_Text_Response, + [BRAVOTOWER_STATE_RESPONSE_SATISFIED] = BravoTrainerBattleTower_Text_ResponseSatisfied, + [BRAVOTOWER_STATE_RESPONSE_UNSATISFIED] = BravoTrainerBattleTower_Text_ResponseUnsatisfied, + [BRAVOTOWER_STATE_OUTRO] = BravoTrainerBattleTower_Text_Outro }; static const u8 *const sTVContestLiveUpdatesTextGroup[] = { @@ -1490,9 +1490,9 @@ static void InterviewAfter_BravoTrainerBattleTowerProfile(void) show->bravoTrainerTower.numFights = GetCurrentBattleTowerWinStreak(gSaveBlock2Ptr->frontier.towerLvlMode, 0); show->bravoTrainerTower.wonTheChallenge = gSaveBlock2Ptr->frontier.towerBattleOutcome; if (gSaveBlock2Ptr->frontier.towerLvlMode == FRONTIER_LVL_50) - show->bravoTrainerTower.btLevel = 50; + show->bravoTrainerTower.btLevel = FRONTIER_MAX_LEVEL_50; else - show->bravoTrainerTower.btLevel = 100; + show->bravoTrainerTower.btLevel = FRONTIER_MAX_LEVEL_OPEN; show->bravoTrainerTower.interviewResponse = gSpecialVar_0x8004; StorePlayerIdInNormalShow(show); show->bravoTrainerTower.language = gGameLanguage; @@ -4371,6 +4371,9 @@ static void DoTVShowBravoTrainerPokemonProfile(void) ShowFieldMessage(sTVBravoTrainerTextGroup[state]); } +// This is the TV show triggered by accepting the reporter's interview in the lobby of Battle Tower. +// The reporter had asked the player if they were satisfied or not with the challenge, and then asked +// for a one word Easy Chat description of their feelings about the challenge. static void DoTVShowBravoTrainerBattleTower(void) { TVShow *show; @@ -4381,85 +4384,83 @@ static void DoTVShowBravoTrainerBattleTower(void) state = sTVShowState; switch(state) { - case 0: + case BRAVOTOWER_STATE_INTRO: TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.trainerName, show->bravoTrainerTower.language); StringCopy(gStringVar2, gSpeciesNames[show->bravoTrainerTower.species]); - if (show->bravoTrainerTower.numFights >= 7) - sTVShowState = 1; + if (show->bravoTrainerTower.numFights >= FRONTIER_STAGES_PER_CHALLENGE) + sTVShowState = BRAVOTOWER_STATE_NEW_RECORD; else - sTVShowState = 2; + sTVShowState = BRAVOTOWER_STATE_LOST; break; - case 1: - if (show->bravoTrainerTower.btLevel == 50) - { + case BRAVOTOWER_STATE_NEW_RECORD: + // The TV show states a "new record" was achieved as long as all the battles in the challenge were attempted, + // regardless of any previous records or whether the final battle was won or lost. + if (show->bravoTrainerTower.btLevel == FRONTIER_MAX_LEVEL_50) StringCopy(gStringVar1, gText_Lv50); - } else - { StringCopy(gStringVar1, gText_OpenLevel); - } ConvertIntToDecimalString(1, show->bravoTrainerTower.numFights); if (show->bravoTrainerTower.wonTheChallenge == TRUE) - sTVShowState = 3; + sTVShowState = BRAVOTOWER_STATE_WON; else - sTVShowState = 4; + sTVShowState = BRAVOTOWER_STATE_LOST_FINAL; break; - case 2: + case BRAVOTOWER_STATE_LOST: TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); ConvertIntToDecimalString(1, show->bravoTrainerTower.numFights + 1); if (show->bravoTrainerTower.interviewResponse == 0) - sTVShowState = 5; + sTVShowState = BRAVOTOWER_STATE_SATISFIED; else - sTVShowState = 6; + sTVShowState = BRAVOTOWER_STATE_UNSATISFIED; break; - case 3: + case BRAVOTOWER_STATE_WON: TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); StringCopy(gStringVar2, gSpeciesNames[show->bravoTrainerTower.defeatedSpecies]); if (show->bravoTrainerTower.interviewResponse == 0) - sTVShowState = 5; + sTVShowState = BRAVOTOWER_STATE_SATISFIED; else - sTVShowState = 6; + sTVShowState = BRAVOTOWER_STATE_UNSATISFIED; break; - case 4: + case BRAVOTOWER_STATE_LOST_FINAL: TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); StringCopy(gStringVar2, gSpeciesNames[show->bravoTrainerTower.defeatedSpecies]); if (show->bravoTrainerTower.interviewResponse == 0) - sTVShowState = 5; + sTVShowState = BRAVOTOWER_STATE_SATISFIED; else - sTVShowState = 6; + sTVShowState = BRAVOTOWER_STATE_UNSATISFIED; break; - case 5: + case BRAVOTOWER_STATE_SATISFIED: TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); - sTVShowState = 11; + sTVShowState = BRAVOTOWER_STATE_RESPONSE; break; - case 6: + case BRAVOTOWER_STATE_UNSATISFIED: TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); - sTVShowState = 11; + sTVShowState = BRAVOTOWER_STATE_RESPONSE; break; - case 7: - sTVShowState = 11; + case BRAVOTOWER_STATE_UNUSED_1: + sTVShowState = BRAVOTOWER_STATE_RESPONSE; break; - case 8: - case 9: - case 10: + case BRAVOTOWER_STATE_UNUSED_2: + case BRAVOTOWER_STATE_UNUSED_3: + case BRAVOTOWER_STATE_UNUSED_4: TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.trainerName, show->bravoTrainerTower.language); - sTVShowState = 11; + sTVShowState = BRAVOTOWER_STATE_RESPONSE; break; - case 11: + case BRAVOTOWER_STATE_RESPONSE: CopyEasyChatWord(gStringVar1, show->bravoTrainerTower.words[0]); if (show->bravoTrainerTower.interviewResponse == 0) - sTVShowState = 12; + sTVShowState = BRAVOTOWER_STATE_RESPONSE_SATISFIED; else - sTVShowState = 13; + sTVShowState = BRAVOTOWER_STATE_RESPONSE_UNSATISFIED; break; - case 12: - case 13: + case BRAVOTOWER_STATE_RESPONSE_SATISFIED: + case BRAVOTOWER_STATE_RESPONSE_UNSATISFIED: CopyEasyChatWord(gStringVar1, show->bravoTrainerTower.words[0]); TVShowConvertInternationalString(gStringVar2, show->bravoTrainerTower.trainerName, show->bravoTrainerTower.language); TVShowConvertInternationalString(gStringVar3, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); - sTVShowState = 14; + sTVShowState = BRAVOTOWER_STATE_OUTRO; break; - case 14: + case BRAVOTOWER_STATE_OUTRO: TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.trainerName, show->bravoTrainerTower.language); StringCopy(gStringVar2, gSpeciesNames[show->bravoTrainerTower.species]); TVShowDone(); From e48341f7fcd7dba2aaf352ece4e7e24c16eef043 Mon Sep 17 00:00:00 2001 From: Simply BLG <61010688+SimplyBLGDev@users.noreply.github.com> Date: Fri, 17 Jun 2022 11:52:54 -0300 Subject: [PATCH 51/65] Format newlines in contest_string.inc Some of the strings declared in contest_string.inc were poorly formatted, containing newline characters in the middle of the string, opposing the format used by every string in data/text, I just updated them to match the format, making it more readable. --- data/text/contest_strings.inc | 135 ++++++++++++++++++++++------------ 1 file changed, 90 insertions(+), 45 deletions(-) diff --git a/data/text/contest_strings.inc b/data/text/contest_strings.inc index e57e76a52..23de25af6 100644 --- a/data/text/contest_strings.inc +++ b/data/text/contest_strings.inc @@ -4,145 +4,190 @@ gText_HighlyAppealingMove:: .string "A highly appealing move.$" gText_UserMoreEasilyStartled:: - .string "After this move, the user is\nmore easily startled.$" + .string "After this move, the user is\n" + .string "more easily startled.$" gText_GreatAppealButNoMoreToEnd:: - .string "Makes a great appeal, but\nallows no more to the end.$" + .string "Makes a great appeal, but\n" + .string "allows no more to the end.$" gText_UsedRepeatedlyWithoutBoringJudge:: .string "Can be repeatedly used\nwithout boring the JUDGE.$" gText_AvoidStartledByOthersOnce:: - .string "Can avoid being startled\nby others once.$" + .string "Can avoid being startled\n" + .string "by others once.$" gText_AvoidStartledByOthers:: - .string "Can avoid being startled\nby others.$" + .string "Can avoid being startled\n" + .string "by others.$" gText_AvoidStartledByOthersLittle:: - .string "Can avoid being startled\nby others a little.$" + .string "Can avoid being startled\n" + .string "by others a little.$" gText_UserLessLikelyStartled:: - .string "After this move, the user is\nless likely to be startled.$" + .string "After this move, the user is\n" + .string "less likely to be startled.$" gText_SlightlyStartleFrontMon:: - .string "Slightly startles the\nPOKéMON in front.$" + .string "Slightly startles the\n" + .string "POKéMON in front.$" gText_SlightlyStartleAppealed:: - .string "Slightly startles those\nthat have made appeals.$" + .string "Slightly startles those\n" + .string "that have made appeals.$" gText_StartleAppealedBeforeUser:: - .string "Startles the POKéMON that\nappealed before the user.$" + .string "Startles the POKéMON that\n" + .string "appealed before the user.$" gText_StartleAllAppealed:: - .string "Startles all POKéMON that\nhave done their appeals.$" + .string "Startles all POKéMON that\n" + .string "have done their appeals.$" gText_BadlyStartleFrontMon:: - .string "Badly startles the\nPOKéMON in front.$" + .string "Badly startles the\n" + .string "POKéMON in front.$" gText_BadlyStartleAppealed:: - .string "Badly startles those that\nhave made appeals.$" + .string "Badly startles those that\n" + .string "have made appeals.$" gText_StartleAppealedBeforeUser2:: - .string "Startles the POKéMON that\nappealed before the user.$" + .string "Startles the POKéMON that\n" + .string "appealed before the user.$" gText_StartleAllAppealed2:: - .string "Startles all POKéMON that\nhave done their appeals.$" + .string "Startles all POKéMON that\n" + .string "have done their appeals.$" gText_ShiftJudgesAttentionFromOthers:: - .string "Shifts the JUDGE's\nattention from others.$" + .string "Shifts the JUDGE's\n" + .string "attention from others.$" gText_StartleMonHasJudgesAttention:: - .string "Startles the POKéMON that\nhas the JUDGE's attention.$" + .string "Startles the POKéMON that\n" + .string "has the JUDGE's attention.$" gText_JamOthersMissesTurn:: - .string "Jams the others, and misses\none turn of appeals.$" + .string "Jams the others, and misses\n" + .string "one turn of appeals.$" gText_StartleMonsMadeSameTypeAppeal:: - .string "Startles POKéMON that\nmade a same-type appeal.$" + .string "Startles POKéMON that\n" + .string "made a same-type appeal.$" gText_BadlyStartleCoolAppeals:: - .string "Badly startles POKéMON\nthat made COOL appeals.$" + .string "Badly startles POKéMON\n" + .string "that made COOL appeals.$" gText_BadlyStartleBeautyAppeals:: - .string "Badly startles POKéMON\nthat made BEAUTY appeals.$" + .string "Badly startles POKéMON\n" + .string "that made BEAUTY appeals.$" gText_BadlyStartleCuteAppeals:: - .string "Badly startles POKéMON\nthat made CUTE appeals.$" + .string "Badly startles POKéMON\n" + .string "that made CUTE appeals.$" gText_BadlyStartleSmartAppeals:: - .string "Badly startles POKéMON\nthat made SMART appeals.$" + .string "Badly startles POKéMON\n" + .string "that made SMART appeals.$" gText_BadlyStartleToughAppeals:: - .string "Badly startles POKéMON\nthat made TOUGH appeals.$" + .string "Badly startles POKéMON\n" + .string "that made TOUGH appeals.$" gText_MakeMonAfterUserNervous:: - .string "Makes one POKéMON after\nthe user nervous.$" + .string "Makes one POKéMON after\n" + .string "the user nervous.$" gText_MakeAllMonsAfterUserNervous:: - .string "Makes all POKéMON after\nthe user nervous.$" + .string "Makes all POKéMON after\n" + .string "the user nervous.$" gText_WorsenConditionOfThoseMadeAppeals:: - .string "Worsens the condition of\nthose that made appeals.$" + .string "Worsens the condition of\n" + .string "those that made appeals.$" gText_BadlyStartleMonsGoodCondition:: - .string "Badly startles POKéMON in\ngood condition.$" + .string "Badly startles POKéMON in\n" + .string "good condition.$" gText_AppealGreatIfPerformedFirst:: - .string "The appeal works great if\nperformed first.$" + .string "The appeal works great if\n" + .string "performed first.$" gText_AppealGreatIfPerformedLast:: - .string "The appeal works great if\nperformed last.$" + .string "The appeal works great if\n" + .string "performed last.$" gText_AppealAsGoodAsThoseBeforeIt:: - .string "Makes the appeal as good\nas those before it.$" + .string "Makes the appeal as good\n" + .string "as those before it.$" gText_AppealAsGoodAsOneBeforeIt:: - .string "Makes the appeal as good\nas the one before it.$" + .string "Makes the appeal as good\n" + .string "as the one before it.$" gText_AppealBetterLaterItsPerformed:: - .string "The appeal works better\nthe later it is performed.$" + .string "The appeal works better\n" + .string "the later it is performed.$" gText_AppealVariesDependingOnTiming:: .string "The appeal's quality varies\ndepending on its timing.$" gText_WorksWellIfSameTypeAsBefore:: - .string "Works well if it's the same\ntype as the one before.$" + .string "Works well if it's the same\n" + .string "type as the one before.$" gText_WorksWellIfDifferentTypeAsBefore:: - .string "Works well if different in\ntype than the one before.$" + .string "Works well if different in\n" + .string "type than the one before.$" gText_AffectedByAppealInFront:: - .string "Affected by how well the\nappeal in front goes.$" + .string "Affected by how well the\n" + .string "appeal in front goes.$" gText_UpsConditionHelpsPreventNervousness:: - .string "Ups the user's condition.\nHelps prevent nervousness.$" + .string "Ups the user's condition.\n" + .string "Helps prevent nervousness.$" gText_AppealWorksWellIfConditionGood:: - .string "The appeal works well if the\nuser's condition is good.$" + .string "The appeal works well if the\n" + .string "user's condition is good.$" gText_NextAppealMadeEarlier:: - .string "The next appeal can be\nmade earlier next turn.$" + .string "The next appeal can be\n" + .string "made earlier next turn.$" gText_NextAppealMadeLater:: - .string "The next appeal can be\nmade later next turn.$" + .string "The next appeal can be\n" + .string "made later next turn.$" gText_TurnOrderMoreEasilyScrambled:: - .string "Makes the next turn's order\nmore easily scrambled.$" + .string "Makes the next turn's order\n" + .string "more easily scrambled.$" gText_ScrambleOrderOfNextAppeals:: - .string "Scrambles the order of\nappeals on the next turn.$" + .string "Scrambles the order of\n" + .string "appeals on the next turn.$" gText_AppealExcitesAudienceInAnyContest:: - .string "An appeal that excites the\naudience in any CONTEST.$" + .string "An appeal that excites the\n" + .string "audience in any CONTEST.$" gText_BadlyStartlesMonsGoodAppeals:: - .string "Badly startles all POKéMON\nthat made good appeals.$" + .string "Badly startles all POKéMON\n" + .string "that made good appeals.$" gText_AppealBestMoreCrowdExcited:: - .string "The appeal works best the\nmore the crowd is excited.$" + .string "The appeal works best the\n" + .string "more the crowd is excited.$" gText_TemporarilyStopCrowdExcited:: - .string "Temporarily stops the\ncrowd from growing excited.$" + .string "Temporarily stops the\n" + .string "crowd from growing excited.$" @ Unused move names From 1860b61fe35941d7c8a15266e6e4a2689eb1ed62 Mon Sep 17 00:00:00 2001 From: Simply BLG <61010688+SimplyBLGDev@users.noreply.github.com> Date: Fri, 17 Jun 2022 12:05:32 -0300 Subject: [PATCH 52/65] Corrected two missing newlines --- data/text/contest_strings.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/text/contest_strings.inc b/data/text/contest_strings.inc index 23de25af6..948c19922 100644 --- a/data/text/contest_strings.inc +++ b/data/text/contest_strings.inc @@ -12,7 +12,8 @@ gText_GreatAppealButNoMoreToEnd:: .string "allows no more to the end.$" gText_UsedRepeatedlyWithoutBoringJudge:: - .string "Can be repeatedly used\nwithout boring the JUDGE.$" + .string "Can be repeatedly used\n" + .string "without boring the JUDGE.$" gText_AvoidStartledByOthersOnce:: .string "Can avoid being startled\n" @@ -135,7 +136,8 @@ gText_AppealBetterLaterItsPerformed:: .string "the later it is performed.$" gText_AppealVariesDependingOnTiming:: - .string "The appeal's quality varies\ndepending on its timing.$" + .string "The appeal's quality varies\n" + .string "depending on its timing.$" gText_WorksWellIfSameTypeAsBefore:: .string "Works well if it's the same\n" From 380cc8615b3c33191e4aa6de059bcbb76220fc1f Mon Sep 17 00:00:00 2001 From: Simply BLG <61010688+SimplyBLGDev@users.noreply.github.com> Date: Fri, 17 Jun 2022 14:22:31 -0300 Subject: [PATCH 53/65] Format newlines in pc_transfer.inc --- data/text/pc_transfer.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/text/pc_transfer.inc b/data/text/pc_transfer.inc index 53a82c8f1..3fa255340 100644 --- a/data/text/pc_transfer.inc +++ b/data/text/pc_transfer.inc @@ -5,7 +5,8 @@ gText_PkmnTransferredSomeonesPC:: .string "BOX “{STR_VAR_1}.”$" gText_PkmnTransferredLanettesPC:: - .string "{STR_VAR_2} was transferred to\nLANETTE'S PC.\p" + .string "{STR_VAR_2} was transferred to\n" + .string "LANETTE'S PC.\p" .string "It was placed in \n" .string "BOX “{STR_VAR_1}.”$" From 324a157b3497405dc41c5988fa04ccdf70da95b7 Mon Sep 17 00:00:00 2001 From: Simply BLG <61010688+SimplyBLGDev@users.noreply.github.com> Date: Fri, 17 Jun 2022 15:21:12 -0300 Subject: [PATCH 54/65] Format newlines in surf.inc One of the strings declared in surf.inc was poorly formatted. ## Description Some of the strings declared in surf.inc contained newline characters in the middle of the .string line, opposing the format used by every string in the `data/text` directory, I just updated them to match the format, making it more readable. --- data/text/surf.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/text/surf.inc b/data/text/surf.inc index 453a3d5b1..13854f7aa 100644 --- a/data/text/surf.inc +++ b/data/text/surf.inc @@ -1,5 +1,6 @@ gText_WantToUseSurf:: - .string "The water is dyed a deep blue…\nWould you like to SURF?$" + .string "The water is dyed a deep blue…\n" + .string "Would you like to SURF?$" gText_PlayerUsedSurf:: .string "{STR_VAR_1} used SURF!$" From e42498ab40f72a136a20c277442a209d00701934 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Fri, 17 Jun 2022 18:06:37 -0300 Subject: [PATCH 55/65] Add bugfix from bugs_and_glitches.md to BUGFIX Item flicker fix now in `BUGFIX` Supersedes and resolves #1680 Fixes #1215 Fixes #1514 --- src/item_menu_icons.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index b1e163499..c436f0feb 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -544,7 +544,20 @@ void AddBagItemIconSprite(u16 itemId, u8 id) void RemoveBagItemIconSprite(u8 id) { - RemoveBagSprite(id + ITEMMENUSPRITE_ITEM); + #ifdef BUGFIX + u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_ITEM]; + + if (spriteId[id ^ 1] != SPRITE_NONE) + gSprites[spriteId[id ^ 1]].invisible = TRUE; + + if (spriteId[id] != SPRITE_NONE) + { + DestroySpriteAndFreeResources(&gSprites[spriteId[id]]); + spriteId[id] = SPRITE_NONE; + } + #else + RemoveBagSprite(id + ITEMMENUSPRITE_ITEM); + #endif } void CreateItemMenuSwapLine(void) From b17fb2ff569ef27070c4fa9dbd67532cd640a260 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Fri, 17 Jun 2022 18:07:46 -0300 Subject: [PATCH 56/65] Delete bugs_and_glitches.md --- docs/bugs_and_glitches.md | 51 --------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 docs/bugs_and_glitches.md diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md deleted file mode 100644 index ce06c1489..000000000 --- a/docs/bugs_and_glitches.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Bugs and Glitches - -These are known bugs and glitches in the original Pokémon Emerald game: code that clearly does not work as intended, or that only works in limited circumstances but has the possibility to fail or crash. Defining the `BUGFIX` and `UBFIX` preprocessor variables will fix some of these automatically. `UBFIX` will already be defined for MODERN builds. - -Fixes are written in the `diff` format. If you've used Git before, this should look familiar: - -```diff - this is some code --delete red - lines -+add green + lines -``` - -## Contents - -- [Scrolling through items in the bag causes the image to flicker](#scrolling-through-items-in-the-bag-causes-the-image-to-flicker) - - -## Scrolling through items in the bag causes the image to flicker - -**Fix:** Add the following function to [src/item_menu_icons.c](https://github.com/pret/pokeemerald/blob/master/src/item_menu_icons.c): -```diff -+void HideBagItemIconSprite(u8 id) -+{ -+ u8 *spriteId = &gBagMenu->spriteId[10]; -+ if (spriteId[id] != 0xFF) -+ { -+ gSprites[spriteId[id]].invisible = TRUE; -+ } -+} - -``` - -and its corresponding declaration in [include/item_menu_icons.h](https://github.com/pret/pokeemerald/blob/master/include/item_menu_icons.h): - -```diff -+void HideBagItemIconSprite(u8 id); - -``` - -Then edit `BagMenu_MoveCursorCallback` in [src/item_menu.c](https://github.com/pret/pokeemerald/blob/master/src/item_menu.c): - -```diff - ... -{ -- RemoveBagItemIconSprite(1 ^ gBagMenu->itemIconSlot); -+ HideBagItemIconSprite(gBagMenu->itemIconSlot ^ 1); -+ RemoveBagItemIconSprite(gBagMenu->itemIconSlot); - if (itemIndex != LIST_CANCEL) - ... -``` From b885e01b39b0e17acd1b23305143f8218c9ecd47 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Fri, 17 Jun 2022 18:16:14 -0300 Subject: [PATCH 57/65] Update src/item_menu_icons.c Co-authored-by: sneed <56992013+Sneed69@users.noreply.github.com> --- src/item_menu_icons.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index c436f0feb..d06f90809 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -544,20 +544,20 @@ void AddBagItemIconSprite(u16 itemId, u8 id) void RemoveBagItemIconSprite(u8 id) { - #ifdef BUGFIX - u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_ITEM]; +#ifdef BUGFIX + u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_ITEM]; - if (spriteId[id ^ 1] != SPRITE_NONE) - gSprites[spriteId[id ^ 1]].invisible = TRUE; +if (spriteId[id ^ 1] != SPRITE_NONE) + gSprites[spriteId[id ^ 1]].invisible = TRUE; - if (spriteId[id] != SPRITE_NONE) - { - DestroySpriteAndFreeResources(&gSprites[spriteId[id]]); - spriteId[id] = SPRITE_NONE; - } - #else - RemoveBagSprite(id + ITEMMENUSPRITE_ITEM); - #endif +if (spriteId[id] != SPRITE_NONE) +{ + DestroySpriteAndFreeResources(&gSprites[spriteId[id]]); + spriteId[id] = SPRITE_NONE; +} +#else + RemoveBagSprite(id + ITEMMENUSPRITE_ITEM); +#endif } void CreateItemMenuSwapLine(void) From d7ab1ba58896287ca83509d94b7b51c26b49b880 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Fri, 17 Jun 2022 18:22:47 -0300 Subject: [PATCH 58/65] Fix formatting --- src/item_menu_icons.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index d06f90809..24f0db242 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -547,14 +547,14 @@ void RemoveBagItemIconSprite(u8 id) #ifdef BUGFIX u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_ITEM]; -if (spriteId[id ^ 1] != SPRITE_NONE) - gSprites[spriteId[id ^ 1]].invisible = TRUE; + if (spriteId[id ^ 1] != SPRITE_NONE) + gSprites[spriteId[id ^ 1]].invisible = TRUE; -if (spriteId[id] != SPRITE_NONE) -{ - DestroySpriteAndFreeResources(&gSprites[spriteId[id]]); - spriteId[id] = SPRITE_NONE; -} + if (spriteId[id] != SPRITE_NONE) + { + DestroySpriteAndFreeResources(&gSprites[spriteId[id]]); + spriteId[id] = SPRITE_NONE; + } #else RemoveBagSprite(id + ITEMMENUSPRITE_ITEM); #endif From f02ea58a683b3617f306f5529ec269ee3c9ec6b9 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Fri, 17 Jun 2022 18:32:46 -0300 Subject: [PATCH 59/65] Add comment description of this bugfix --- src/item_menu_icons.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index 24f0db242..5ac44f5ad 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -544,6 +544,8 @@ void AddBagItemIconSprite(u16 itemId, u8 id) void RemoveBagItemIconSprite(u8 id) { +// BUG: For one frame, the item you scroll to in the Bag menu +// will have an incorrect palette and may be seen as a flicker. #ifdef BUGFIX u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_ITEM]; From 7a6b417b8e2b34a5ea4081ad3ccd0860810ebe6e Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 17 Jun 2022 15:47:56 -0400 Subject: [PATCH 60/65] Remove UBFIX related to task destruction --- src/battle_anim_sound_tasks.c | 16 ++++++++++------ src/battle_factory_screen.c | 7 +------ src/battle_transition.c | 4 +--- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c index 6b14d3863..f329ea210 100644 --- a/src/battle_anim_sound_tasks.c +++ b/src/battle_anim_sound_tasks.c @@ -135,10 +135,12 @@ void SoundTask_PlayCryHighPitch(u8 taskId) { if (gBattleAnimArgs[0] == ANIM_ATTACKER) species = gContestResources->moveAnim->species; - #ifndef UBFIX + // Destroying the task twice (here and at end of function) + // results in an incorrect value for gAnimVisualTaskCount + #ifndef BUGFIX else - DestroyAnimVisualTask(taskId); // UB: task gets destroyed twice. - #endif + DestroyAnimVisualTask(taskId); + #endif } else { @@ -181,10 +183,12 @@ void SoundTask_PlayDoubleCry(u8 taskId) { if (gBattleAnimArgs[0] == ANIM_ATTACKER) species = gContestResources->moveAnim->species; - #ifndef UBFIX + // Destroying the task twice (here and at end of function) + // results in an incorrect value for gAnimVisualTaskCount + #ifndef BUGFIX else - DestroyAnimVisualTask(taskId); // UB: task gets destroyed twice. - #endif + DestroyAnimVisualTask(taskId); + #endif } else { diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 88e934759..14c63b7b8 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -4220,17 +4220,12 @@ static void Task_OpenMonPic(u8 taskId) return; break; default: - #ifndef UBFIX DestroyTask(taskId); - #endif - // UB: Should not use the task after it has been deleted. + // Accessing data of destroyed task. Task data isn't reset until a new task needs that task id. if (gTasks[taskId].tIsSwapScreen == TRUE) Swap_CreateMonSprite(); else Select_CreateMonSprite(); - #ifdef UBFIX - DestroyTask(taskId); - #endif return; } task->tState++; diff --git a/src/battle_transition.c b/src/battle_transition.c index 1e421b5e4..c523cbe7b 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -4762,10 +4762,8 @@ static bool8 FrontierSquaresScroll_End(struct Task *task) BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); DestroyTask(FindTaskIdByFunc(task->func)); + task->tState++; // Changing value of a destroyed task -#ifndef UBFIX - task->tState++; // UB: changing value of a destroyed task -#endif return FALSE; } From 23e9455e0a6c1ed9f115149f5a3fe78cf0a4e2ba Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Fri, 17 Jun 2022 21:52:58 -0400 Subject: [PATCH 61/65] document design oddity, use constants, correct comment --- src/battle_ai_switch_items.c | 51 ++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 6ded48467..9c9bc4eef 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -2,6 +2,7 @@ #include "battle.h" #include "battle_anim.h" #include "battle_controllers.h" +#include "battle_main.h" #include "data.h" #include "pokemon.h" #include "random.h" @@ -66,13 +67,13 @@ static bool8 ShouldSwitchIfWonderGuard(void) if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) - firstId = 0, lastId = 3; + firstId = 0, lastId = PARTY_SIZE / 2; else - firstId = 3, lastId = 6; + firstId = PARTY_SIZE / 2, lastId = PARTY_SIZE; } else { - firstId = 0, lastId = 6; + firstId = 0, lastId = PARTY_SIZE; } if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) @@ -162,13 +163,13 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) - firstId = 0, lastId = 3; + firstId = 0, lastId = PARTY_SIZE / 2; else - firstId = 3, lastId = 6; + firstId = PARTY_SIZE / 2, lastId = PARTY_SIZE; } else { - firstId = 0, lastId = 6; + firstId = 0, lastId = PARTY_SIZE; } if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) @@ -357,13 +358,13 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent) if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == 0) - firstId = 0, lastId = 3; + firstId = 0, lastId = PARTY_SIZE / 2; else - firstId = 3, lastId = 6; + firstId = PARTY_SIZE / 2, lastId = PARTY_SIZE; } else { - firstId = 0, lastId = 6; + firstId = 0, lastId = PARTY_SIZE; } if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) @@ -468,13 +469,13 @@ static bool8 ShouldSwitch(void) if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) - firstId = 0, lastId = 3; + firstId = 0, lastId = PARTY_SIZE / 2; else - firstId = 3, lastId = 6; + firstId = PARTY_SIZE / 2, lastId = PARTY_SIZE; } else { - firstId = 0, lastId = 6; + firstId = 0, lastId = PARTY_SIZE; } if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) @@ -559,13 +560,13 @@ void AI_TrySwitchOrUseItem(void) if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) - firstId = 0, lastId = 3; + firstId = 0, lastId = PARTY_SIZE / 2; else - firstId = 3, lastId = 6; + firstId = PARTY_SIZE / 2, lastId = PARTY_SIZE; } else { - firstId = 0, lastId = 6; + firstId = 0, lastId = PARTY_SIZE; } for (monToSwitchId = firstId; monToSwitchId < lastId; monToSwitchId++) @@ -615,10 +616,10 @@ static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8 { // Check type1. if (TYPE_EFFECT_DEF_TYPE(i) == defType1) - *var = (*var * TYPE_EFFECT_MULTIPLIER(i)) / 10; + *var = (*var * TYPE_EFFECT_MULTIPLIER(i)) / TYPE_MUL_NORMAL; // Check type2. if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2) - *var = (*var * TYPE_EFFECT_MULTIPLIER(i)) / 10; + *var = (*var * TYPE_EFFECT_MULTIPLIER(i)) / TYPE_MUL_NORMAL; } i += 3; } @@ -627,7 +628,7 @@ static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8 u8 GetMostSuitableMonToSwitchInto(void) { u8 opposingBattler; - u8 bestDmg; // Note : should be changed to u32 for obvious reasons. + u8 bestDmg; // Note: should be changed to s32 since it is also used for the actual damage done later u8 bestMonId; u8 battlerIn1, battlerIn2; s32 firstId; @@ -665,13 +666,13 @@ u8 GetMostSuitableMonToSwitchInto(void) if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) - firstId = 0, lastId = 3; + firstId = 0, lastId = PARTY_SIZE / 2; else - firstId = 3, lastId = 6; + firstId = PARTY_SIZE / 2, lastId = PARTY_SIZE; } else { - firstId = 0, lastId = 6; + firstId = 0, lastId = PARTY_SIZE; } if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) @@ -683,7 +684,7 @@ u8 GetMostSuitableMonToSwitchInto(void) while (invalidMons != 0x3F) // All mons are invalid. { - bestDmg = 0; + bestDmg = ; bestMonId = 6; // Find the mon whose type is the most suitable offensively. for (i = firstId; i < lastId; i++) @@ -699,9 +700,13 @@ u8 GetMostSuitableMonToSwitchInto(void) { u8 type1 = gBaseStats[species].type1; u8 type2 = gBaseStats[species].type2; - u8 typeDmg = 10; + u8 typeDmg = TYPE_MUL_NORMAL; ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type1, type1, type2, &typeDmg); ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type2, type1, type2, &typeDmg); + + /* Possible bug: this comparison gives the type that takes the most damage, when + a "good" AI would want to select the type that takes the least damage. Unknown if this + is a legitimate mistake or if it's an intentional, if weird, design choice*/ if (bestDmg < typeDmg) { bestDmg = typeDmg; From d3c8346a676cec0a0e18f0acb4a9b4c8b418dde6 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Fri, 17 Jun 2022 21:58:56 -0400 Subject: [PATCH 62/65] fix type, add bugfix --- src/battle_ai_switch_items.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 9c9bc4eef..c87271722 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -628,7 +628,11 @@ static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8 u8 GetMostSuitableMonToSwitchInto(void) { u8 opposingBattler; +#ifdef BUGFIX + s32 bestDmg; +#else u8 bestDmg; // Note: should be changed to s32 since it is also used for the actual damage done later +#endif u8 bestMonId; u8 battlerIn1, battlerIn2; s32 firstId; @@ -684,8 +688,8 @@ u8 GetMostSuitableMonToSwitchInto(void) while (invalidMons != 0x3F) // All mons are invalid. { - bestDmg = ; - bestMonId = 6; + bestDmg = TYPE_MUL_NO_EFFECT; + bestMonId = PARTY_SIZE; // Find the mon whose type is the most suitable offensively. for (i = firstId; i < lastId; i++) { @@ -706,7 +710,7 @@ u8 GetMostSuitableMonToSwitchInto(void) /* Possible bug: this comparison gives the type that takes the most damage, when a "good" AI would want to select the type that takes the least damage. Unknown if this - is a legitimate mistake or if it's an intentional, if weird, design choice*/ + is a legitimate mistake or if it's an intentional, if weird, design choice */ if (bestDmg < typeDmg) { bestDmg = typeDmg; From c8e6d69fdcacab404ae69cbefe7c318e7c363c54 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Sat, 18 Jun 2022 11:49:13 -0300 Subject: [PATCH 63/65] Format newline in BattleBattleFrontier_BattlePikeLobby/scripts.inc One of the strings declared in BattleFrontier_BattlePikeLobby/scripts.inc was poorly formatted. --- data/maps/BattleFrontier_BattlePikeLobby/scripts.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc b/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc index 320e12d99..3e729e212 100644 --- a/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc @@ -364,7 +364,8 @@ BattleFrontier_BattlePikeLobby_Text_AwardYouTheseBattlePoints2: @ Unused BattleFrontier_BattlePikeLobby_Text_ReachedBattlePointLimit: .string "You appear to have reached the limit\n" - .string "for Battle Points…\pPlease exchange some Battle Points\n" + .string "for Battle Points…\p" + .string "Please exchange some Battle Points\n" .string "for prizes, then return…$" BattleFrontier_BattlePikeLobby_Text_FailedToSaveBeforeQuitting: From 3de23b332a7e67e0748bdb469b059f718fb8c029 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Sat, 18 Jun 2022 21:51:05 -0300 Subject: [PATCH 64/65] Supplant https://github.com/pret/pokeemerald/pull/1579 --- data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc index 406ab46ae..def903b1d 100644 --- a/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc +++ b/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc @@ -5,6 +5,10 @@ .set LOCALID_PLAYER, 13 .set LOCALID_OPPONENT, 15 +.set NO_DRAW, 0 +.set DRAW_TRAINER, 1 +.set DRAW_TUCKER, 2 + BattleFrontier_BattleDomeBattleRoom_MapScripts:: map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattleDomeBattleRoom_OnTransition map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleDomeBattleRoom_OnFrame @@ -12,10 +16,6 @@ BattleFrontier_BattleDomeBattleRoom_MapScripts:: map_script MAP_SCRIPT_ON_RESUME, BattleFrontier_BattleDomeBattleRoom_OnResume .byte 0 - .set NO_DRAW, 0 - .set DRAW_TRAINER, 1 - .set DRAW_TUCKER, 2 - BattleFrontier_BattleDomeBattleRoom_OnTransition: dome_setopponentgfx frontier_get FRONTIER_DATA_BATTLE_NUM From 5d7140fa83ab5745ce0f56841c66805fab59f149 Mon Sep 17 00:00:00 2001 From: sphericalice Date: Sun, 19 Jun 2022 13:33:47 +0100 Subject: [PATCH 65/65] Fix missing COPYWIN_FULL constant use --- src/main_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main_menu.c b/src/main_menu.c index a69f73d17..d11784133 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -2270,7 +2270,7 @@ static void NewGameBirchSpeech_ShowDialogueWindow(u8 windowId, u8 copyToVram) FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); PutWindowTilemap(windowId); if (copyToVram == TRUE) - CopyWindowToVram(windowId, 3); + CopyWindowToVram(windowId, COPYWIN_FULL); } static void NewGameBirchSpeech_CreateDialogueWindowBorder(u8 bg, u8 x, u8 y, u8 width, u8 height, u8 palNum)