diff options
-rw-r--r-- | INSTALL.md | 37 | ||||
-rw-r--r-- | data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc | 4 | ||||
-rw-r--r-- | data/maps/LittlerootTown_MaysHouse_2F/scripts.inc | 4 | ||||
-rw-r--r-- | data/scripts/pc.inc | 4 | ||||
-rw-r--r-- | include/battle_pyramid.h | 2 | ||||
-rwxr-xr-x | include/constants/event_object_movement.h | 16 | ||||
-rw-r--r-- | src/battle_pyramid.c | 2 | ||||
-rwxr-xr-x | src/data/object_events/object_event_anims.h | 32 | ||||
-rw-r--r-- | src/decoration_inventory.c | 2 | ||||
-rw-r--r-- | src/event_object_movement.c | 36 | ||||
-rw-r--r-- | src/field_specials.c | 6 | ||||
-rw-r--r-- | src/main_menu.c | 2 | ||||
-rw-r--r-- | src/menu.c | 8 | ||||
-rw-r--r-- | src/player_pc.c | 4 | ||||
-rw-r--r-- | src/pokemon.c | 2 | ||||
-rw-r--r-- | src/secret_base.c | 2 | ||||
-rw-r--r-- | src/trade.c | 2 | ||||
-rw-r--r-- | src/trader.c | 48 | ||||
-rwxr-xr-x | src/union_room_chat.c | 2 |
19 files changed, 94 insertions, 121 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 ``` <details> <summary><i>Note...</i></summary> @@ -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. </details> -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\\⁠_\<user>_**, where *\<user>* 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\\_\<user>_\Downloads** (the Downloads location for most users), enter this command: - - ```bash - cd Downloads - ``` - - <details> - <summary><i>Notes...</i></summary> - - > 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. - </details> - -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. 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/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/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/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/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/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/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, 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(); 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/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 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..040ee695b 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]; @@ -53,15 +53,25 @@ 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 < 4; i++) + for (i = 0; i < NUM_TRADER_ITEMS; i++) { s32 curWidth; if (trader->decorations[i] > NUM_DECORATIONS) @@ -72,17 +82,17 @@ void CreateAvailableDecorationsMenu(u8 taskId) windowWidth = curWidth; } windowTemplate.width = ConvertPixelWidthToTileWidth(windowWidth); - data[3] = AddWindow(&windowTemplate); - DrawStdFrameWithCustomTileAndPalette(data[3], FALSE, 0x214, 14); - for (i = 0; i < 4; i++) + 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], 5, 0); + AddTextPrinterParameterized(tWindowId, FONT_NORMAL, gText_Exit, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); + InitMenuInUpperLeftCornerNormal(tWindowId, NUM_TRADER_ITEMS + 1, 0); ScheduleBgCopyTilemapToVram(0); } @@ -90,17 +100,13 @@ 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]); - RemoveWindow(data[3]); + ClearStdWindowAndFrameToTransparent(tWindowId, FALSE); + ClearWindowTilemap(tWindowId); + RemoveWindow(tWindowId); ScheduleBgCopyTilemapToVram(0); DestroyTask(taskId); EnableBothScriptContexts(); @@ -116,7 +122,7 @@ void Task_HandleGetDecorationMenuInput(u8 taskId) case MENU_NOTHING_CHOSEN: break; case MENU_B_PRESSED: - case 4: + case NUM_TRADER_ITEMS: // EXIT PlaySE(SE_SELECT); Task_BufferDecorSelectionAndCloseWindow(taskId, 0); break; @@ -140,7 +146,7 @@ void DoesPlayerHaveNoDecorations(void) { u8 i; - for (i = 0; i < 8; i++) + for (i = 0; i < DECORCAT_COUNT; i++) { if (GetNumOwnedDecorationsInCategory(i)) { 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); } |