From dfce7f15489de5e94d9476dc76e33e2b60672130 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 1 Apr 2021 09:45:17 -0600 Subject: [PATCH 01/52] add auto read signposts --- data/event_scripts.s | 4 + .../primary/general/metatile_attributes.bin | Bin 1024 -> 1024 bytes include/constants/metatile_behaviors.h | 2 +- include/event_scripts.h | 2 + include/field_control_avatar.h | 1 + include/field_message_box.h | 2 + include/metatile_behavior.h | 1 + include/script.h | 8 ++ include/text_window.h | 1 + src/field_control_avatar.c | 124 +++++++++++++++++- src/field_message_box.c | 10 +- src/metatile_behavior.c | 8 +- src/overworld.c | 1 + src/scrcmd.c | 2 + src/script.c | 35 +++++ src/text_window.c | 9 ++ 16 files changed, 206 insertions(+), 4 deletions(-) diff --git a/data/event_scripts.s b/data/event_scripts.s index 8039be6876..886c55f71c 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -690,6 +690,10 @@ EventScript_BackupMrBrineyLocation:: @ 8271E95 .include "data/scripts/rival_graphics.inc" .include "data/scripts/set_gym_trainers.inc" +EventScript_CancelMessageBox:: + release + end + Common_EventScript_ShowBagIsFull:: @ 8272054 msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT release diff --git a/data/tilesets/primary/general/metatile_attributes.bin b/data/tilesets/primary/general/metatile_attributes.bin index d9cd29016d792fb568494dbf2f820100081a14f8..af9326451d561c4103afe500c5ae8c7656092fc6 100644 GIT binary patch delta 21 ZcmZqRXy9OH00Y^H?D~wd8_iEL0{|lp1I_>d delta 21 YcmZqRXy9OHfPjhY`iu-4%}+7|03liflmGw# diff --git a/include/constants/metatile_behaviors.h b/include/constants/metatile_behaviors.h index 94cb0ffcaa..cd2f70fe0f 100755 --- a/include/constants/metatile_behaviors.h +++ b/include/constants/metatile_behaviors.h @@ -30,7 +30,7 @@ #define MB_UNUSED_SOOTOPOLIS_DEEP_WATER_2 0x1A #define MB_STAIRS_OUTSIDE_ABANDONED_SHIP 0x1B #define MB_SHOAL_CAVE_ENTRANCE 0x1C -#define MB_UNUSED_1D 0x1D +#define MB_SIGNPOST 0x1D #define MB_UNUSED_1E 0x1E #define MB_UNUSED_1F 0x1F #define MB_ICE 0x20 diff --git a/include/event_scripts.h b/include/event_scripts.h index 79ef0ea142..eff980f138 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -610,4 +610,6 @@ extern const u8 EventScript_TradeCenter_Chair0[]; extern const u8 EventScript_ConfirmLeaveTradeRoom[]; extern const u8 EventScript_TerminateLink[]; +extern const u8 EventScript_CancelMessageBox[]; + #endif // GUARD_EVENT_SCRIPTS_H diff --git a/include/field_control_avatar.h b/include/field_control_avatar.h index 17e5afb63e..e6c90e8e5b 100644 --- a/include/field_control_avatar.h +++ b/include/field_control_avatar.h @@ -40,5 +40,6 @@ u8 TrySetDiveWarp(void); const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction); u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position); void ClearPoisonStepCounter(void); +void FieldInput_HandleCancelSignpost(struct FieldInput *input); #endif // GUARD_FIELDCONTROLAVATAR_H diff --git a/include/field_message_box.h b/include/field_message_box.h index 34b3324e72..eed6c7a9c0 100644 --- a/include/field_message_box.h +++ b/include/field_message_box.h @@ -19,4 +19,6 @@ u8 GetFieldMessageBoxMode(void); void StopFieldMessage(void); void InitFieldMessageBox(void); +extern u8 gWalkAwayFromSignInhibitTimer; + #endif // GUARD_FIELD_MESSAGE_BOX_H diff --git a/include/metatile_behavior.h b/include/metatile_behavior.h index d4bd9e6832..886422e63e 100644 --- a/include/metatile_behavior.h +++ b/include/metatile_behavior.h @@ -145,5 +145,6 @@ bool8 MetatileBehavior_IsQuestionnaire(u8); bool8 MetatileBehavior_IsLongGrass_Duplicate(u8); bool8 MetatileBehavior_IsLongGrassSouthEdge(u8); bool8 MetatileBehavior_IsTrainerHillTimer(u8); +bool8 MetatileBehavior_IsSignpost(u8 mb); #endif // GUARD_METATILE_BEHAVIOR diff --git a/include/script.h b/include/script.h index 63f6f5aef9..92309eb653 100644 --- a/include/script.h +++ b/include/script.h @@ -62,4 +62,12 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize); // srccmd.h void SetMovingNpcId(u16 npcId); +// auto read signs +void SetWalkingIntoSignVars(void); +void MsgSetSignPost(void); +void ResetFacingNpcOrSignPostVars(void); +bool32 IsMsgSignPost(void); +bool32 CanWalkAwayToCancelMsgBox(void); +void ClearMsgBoxCancelableState(void); + #endif // GUARD_SCRIPT_H diff --git a/include/text_window.h b/include/text_window.h index 7bdcacd17c..d6bf83e0b3 100644 --- a/include/text_window.h +++ b/include/text_window.h @@ -23,5 +23,6 @@ void rbox_fill_rectangle(u8 windowId); const u16 *GetTextWindowPalette(u8 id); const u16 *GetOverworldTextboxPalettePtr(void); void sub_8098C6C(u8 bg, u16 destOffset, u8 palOffset); +void LoadSignPostWindowFrameGfx(void); #endif // GUARD_TEXT_WINDOW_H diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 6ec280fd0d..16e334f429 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -9,6 +9,7 @@ #include "event_scripts.h" #include "fieldmap.h" #include "field_control_avatar.h" +#include "field_message_box.h" #include "field_player_avatar.h" #include "field_poison.h" #include "field_screen_effect.h" @@ -41,6 +42,13 @@ static EWRAM_DATA u16 sPreviousPlayerMetatileBehavior = 0; u8 gSelectedObjectEvent; +#define SIGNPOST_POKECENTER 0 +#define SIGNPOST_POKEMART 1 +#define SIGNPOST_INDIGO_1 2 +#define SIGNPOST_INDIGO_2 3 +#define SIGNPOST_SCRIPTED 240 +#define SIGNPOST_NA 255 + static void GetPlayerPosition(struct MapPosition *); static void GetInFrontOfPlayerPosition(struct MapPosition *); static u16 GetPlayerCurMetatileBehavior(int); @@ -69,6 +77,10 @@ static bool8 TryStartMiscWalkingScripts(u16); static bool8 TryStartStepCountScript(u16); static void UpdateFriendshipStepCounter(void); static bool8 UpdatePoisonStepCounter(void); +static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection); +static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection); +static u8 GetFacingSignpostType(u16 metatileBehvaior, u8 direction); +static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position); void FieldClearPlayerInput(struct FieldInput *input) { @@ -140,7 +152,8 @@ int ProcessPlayerFieldInput(struct FieldInput *input) gSpecialVar_LastTalked = 0; gSelectedObjectEvent = 0; - + + ResetFacingNpcOrSignPostVars(); playerDirection = GetPlayerFacingDirection(); GetPlayerPosition(&position); metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); @@ -160,6 +173,20 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (TryStartStepBasedScript(&position, metatileBehavior, playerDirection) == TRUE) return TRUE; } + + if (input->checkStandardWildEncounter) + { + if (input->dpadDirection == 0 || input->dpadDirection == playerDirection) + { + GetInFrontOfPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) + return TRUE; + GetPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + } + } + if (input->checkStandardWildEncounter && CheckStandardWildEncounter(metatileBehavior) == TRUE) return TRUE; if (input->heldDirection && input->dpadDirection == playerDirection) @@ -170,6 +197,13 @@ int ProcessPlayerFieldInput(struct FieldInput *input) GetInFrontOfPlayerPosition(&position); metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + + if (input->heldDirection && input->dpadDirection == playerDirection) + { + if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) + return TRUE; + } + if (input->pressedAButton && TryStartInteractionScript(&position, metatileBehavior, playerDirection) == TRUE) return TRUE; @@ -1005,3 +1039,91 @@ int SetCableClubWarp(void) SetupWarp(&gMapHeader, GetWarpEventAtMapPosition(&gMapHeader, &position), &position); return 0; } + +// auto read signposts +// signposts +static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 metatileBehavior, u8 playerDirection) +{ + u8 signpostType; + const u8 *script; + + if (JOY_HELD(DPAD_LEFT | DPAD_RIGHT)) + return FALSE; + if (playerDirection != DIR_NORTH) + return FALSE; + + switch (GetFacingSignpostType(metatileBehavior, playerDirection)) + { + /* leaving this commented out for examples of custom signpost types + case SIGNPOST_POKECENTER: + SetUpWalkIntoSignScript(EventScript_PokecenterSign, playerDirection); + return TRUE; + case SIGNPOST_POKEMART: + SetUpWalkIntoSignScript(EventScript_PokemartSign, playerDirection); + return TRUE;*/ + case SIGNPOST_SCRIPTED: + script = GetSignpostScriptAtMapPosition(position); + if (script == NULL) + return FALSE; + SetUpWalkIntoSignScript(script, playerDirection); + return TRUE; + default: + return FALSE; + } +} + +static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection) +{ + /*if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, playerDirection) == TRUE) + return SIGNPOST_POKECENTER; + if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, playerDirection) == TRUE) + return SIGNPOST_POKEMART;*/ + + if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE) + return SIGNPOST_SCRIPTED; + + return SIGNPOST_NA; +} + +static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection) +{ + gSpecialVar_Facing = playerDirection; + ScriptContext1_SetupScript(script); + SetWalkingIntoSignVars(); + MsgSetSignPost(); +} + +static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position) +{ + const struct BgEvent *event = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); + if (event == NULL) + return NULL; + if (event->bgUnion.script != NULL) + return event->bgUnion.script; + return EventScript_TestSignpostMsg; +} + +void FieldInput_HandleCancelSignpost(struct FieldInput *input) +{ + if (ScriptContext1_IsScriptSetUp() == TRUE) + { + if (gWalkAwayFromSignInhibitTimer != 0) + { + gWalkAwayFromSignInhibitTimer--; + } + else if (CanWalkAwayToCancelMsgBox() == TRUE) + { + //ClearMsgBoxCancelableState(); + if (input->dpadDirection != 0 && GetPlayerFacingDirection() != input->dpadDirection) + { + ScriptContext1_SetupScript(EventScript_CancelMessageBox); + ScriptContext2_Enable(); + } + else if (input->pressedStartButton) + { + ScriptContext1_SetupScript(EventScript_CancelMessageBox); + ScriptContext2_Enable(); + } + } + } +} diff --git a/src/field_message_box.c b/src/field_message_box.c index 69d470b84e..9bb1bd52c4 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -5,8 +5,11 @@ #include "text.h" #include "match_call.h" #include "field_message_box.h" +#include "text_window.h" +#include "script.h" static EWRAM_DATA u8 sFieldMessageBoxMode = 0; +EWRAM_DATA u8 gWalkAwayFromSignInhibitTimer = 0; static void ExpandStringAndStartDrawFieldMessage(const u8*, bool32); static void StartDrawFieldMessage(void); @@ -29,7 +32,12 @@ static void Task_DrawFieldMessage(u8 taskId) switch (task->tState) { case 0: - LoadMessageBoxAndBorderGfx(); + if (IsMsgSignPost()) + LoadSignPostWindowFrameGfx(); + else + LoadMessageBoxAndBorderGfx(); + task->tState++; + break; task->tState++; break; case 1: diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index 2a9304a4d8..4656e94b0f 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -39,7 +39,7 @@ static const u8 sTileBitAttributes[] = [MB_UNUSED_SOOTOPOLIS_DEEP_WATER_2] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE), [MB_STAIRS_OUTSIDE_ABANDONED_SHIP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_SHOAL_CAVE_ENTRANCE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), - [MB_UNUSED_1D] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE), + [MB_SIGNPOST] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE), [MB_UNUSED_1E] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE), [MB_UNUSED_1F] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE), [MB_ICE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), @@ -1495,3 +1495,9 @@ bool8 MetatileBehavior_IsTrainerHillTimer(u8 metatileBehavior) else return FALSE; } + +bool8 MetatileBehavior_IsSignpost(u8 mb) +{ + return (mb == MB_SIGNPOST); +} + diff --git a/src/overworld.c b/src/overworld.c index 9d5e40fb37..7082eb078c 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1422,6 +1422,7 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys) UpdatePlayerAvatarTransitionState(); FieldClearPlayerInput(&inputStruct); FieldGetPlayerInput(&inputStruct, newKeys, heldKeys); + FieldInput_HandleCancelSignpost(&inputStruct); if (!ScriptContext2_IsEnabled()) { if (ProcessPlayerFieldInput(&inputStruct) == 1) diff --git a/src/scrcmd.c b/src/scrcmd.c index 7dc02b6a8f..710a58c246 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1248,6 +1248,7 @@ bool8 ScrCmd_releaseall(struct ScriptContext *ctx) ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]); ScriptMovement_UnfreezeObjectEvents(); UnfreezeObjectEvents(); + ClearMsgBoxCancelableState(); return FALSE; } @@ -1262,6 +1263,7 @@ bool8 ScrCmd_release(struct ScriptContext *ctx) ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]); ScriptMovement_UnfreezeObjectEvents(); UnfreezeObjectEvents(); + ClearMsgBoxCancelableState(); return FALSE; } diff --git a/src/script.c b/src/script.c index 726c065439..977298f833 100644 --- a/src/script.c +++ b/src/script.c @@ -3,6 +3,7 @@ #include "event_data.h" #include "mevent.h" #include "util.h" +#include "field_message_box.h" #include "constants/map_scripts.h" #define RAM_SCRIPT_MAGIC 51 @@ -19,6 +20,8 @@ static u8 sScriptContext1Status; static struct ScriptContext sScriptContext1; static struct ScriptContext sScriptContext2; static bool8 sScriptContext2Enabled; +static u8 sMsgIsSignPost; +static u8 sMsgBoxIsCancelable; extern ScrCmdFunc gScriptCmdTable[]; extern ScrCmdFunc gScriptCmdTableEnd[]; @@ -444,3 +447,35 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize) scriptSize = sizeof(gSaveBlock1Ptr->ramScript.data.script); InitRamScript(script, scriptSize, 0xFF, 0xFF, 0xFF); } + +// auto read signposts +void SetWalkingIntoSignVars(void) +{ + gWalkAwayFromSignInhibitTimer = 6; + sMsgBoxIsCancelable = TRUE; +} + +bool32 IsMsgSignPost(void) +{ + return sMsgIsSignPost; +} + +void ResetFacingNpcOrSignPostVars(void) +{ + sMsgIsSignPost = FALSE; +} + +void MsgSetSignPost(void) +{ + sMsgIsSignPost = TRUE; +} + +void ClearMsgBoxCancelableState(void) +{ + sMsgBoxIsCancelable = FALSE; +} + +bool32 CanWalkAwayToCancelMsgBox(void) +{ + return sMsgBoxIsCancelable; +} diff --git a/src/text_window.c b/src/text_window.c index 864bd08316..7d59ce2d35 100644 --- a/src/text_window.c +++ b/src/text_window.c @@ -5,6 +5,7 @@ #include "palette.h" #include "bg.h" #include "graphics.h" +#include "menu.h" // const rom data const u8 gTextWindowFrame1_Gfx[] = INCBIN_U8("graphics/text_window/1.4bpp"); @@ -195,3 +196,11 @@ void sub_8098C6C(u8 bg, u16 destOffset, u8 palOffset) LoadBgTiles(bg, sWindowFrames[gSaveBlock2Ptr->optionsWindowFrameType].tiles, 0x120, destOffset); LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, palOffset, 0x20); } + +void LoadSignPostWindowFrameGfx(void) +{ + // TODO signpost msgbox frames + //LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUnknown_8470B0C, 0x260, destOffset); + //LoadPalette(GetWindowFrameTilesPal(1), palIdx, 32); + LoadMessageBoxAndBorderGfx(); +} From 7bb81150999f6585e3e6eeb8c4bc22c42e27893f Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Fri, 3 Mar 2023 09:08:05 -0500 Subject: [PATCH 02/52] add start menu funcs, credit deokishisu --- data/event_scripts.s | 1 + data/specials.inc | 1 + src/field_control_avatar.c | 12 ++++++++++++ src/field_specials.c | 7 +++++++ 4 files changed, 21 insertions(+) diff --git a/data/event_scripts.s b/data/event_scripts.s index 886c55f71c..3d2a9b2a81 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -691,6 +691,7 @@ EventScript_BackupMrBrineyLocation:: @ 8271E95 .include "data/scripts/set_gym_trainers.inc" EventScript_CancelMessageBox:: + special DoPicboxCancel release end diff --git a/data/specials.inc b/data/specials.inc index 620fae369b..9c23506d20 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -535,3 +535,4 @@ gSpecials:: @ 81DBA64 def_special RemoveRecordsWindow def_special CloseDeptStoreElevatorWindow def_special TrySetBattleTowerLinkType + def_special DoPicboxCancel diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 16e334f429..6547855610 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -1103,6 +1103,16 @@ static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position) return EventScript_TestSignpostMsg; } +static void Task_OpenStartMenu(u8 taskId) +{ + if (!ArePlayerFieldControlsLocked()) + { + PlaySE(SE_WIN_OPEN); + ShowStartMenu(); + DestroyTask(taskId); + } +} + void FieldInput_HandleCancelSignpost(struct FieldInput *input) { if (ScriptContext1_IsScriptSetUp() == TRUE) @@ -1123,6 +1133,8 @@ void FieldInput_HandleCancelSignpost(struct FieldInput *input) { ScriptContext1_SetupScript(EventScript_CancelMessageBox); ScriptContext2_Enable(); + if (!FuncIsActiveTask(Task_OpenStartMenu)) + CreateTask(Task_OpenStartMenu, 8); } } } diff --git a/src/field_specials.c b/src/field_specials.c index 86be21edac..93e5c0d1c1 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -4376,3 +4376,10 @@ u8 Script_TryGainNewFanFromCounter(void) { return TryGainNewFanFromCounter(gSpecialVar_0x8004); } + +void DoPicboxCancel(void) +{ + u8 t = EOS; + AddTextPrinterParameterized(0, FONT_NORMAL, &t, 0, 1, 0, NULL); + ScriptMenu_HidePokemonPic(); +} From b43e0e07f73f57c143e0935d0d06f1b469383307 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Mon, 15 Jul 2024 21:45:34 -0700 Subject: [PATCH 03/52] Add config to disable OW_AUTO_SIGNPOST --- include/config/overworld.h | 1 + include/constants/metatile_behaviors.h | 4 ++++ src/metatile_behavior.c | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/include/config/overworld.h b/include/config/overworld.h index b666426996..8d9a46e0b8 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -3,6 +3,7 @@ // Movement config #define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors. +#define OW_AUTO_SIGNPOST FALSE // When the tile that the player is facing has MB_SIGNPOST, the player will automatically read the signpoost. // Other settings #define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. diff --git a/include/constants/metatile_behaviors.h b/include/constants/metatile_behaviors.h index 05ee34110d..56df442bb8 100755 --- a/include/constants/metatile_behaviors.h +++ b/include/constants/metatile_behaviors.h @@ -30,7 +30,11 @@ #define MB_UNUSED_SOOTOPOLIS_DEEP_WATER_2 0x1A #define MB_STAIRS_OUTSIDE_ABANDONED_SHIP 0x1B #define MB_SHOAL_CAVE_ENTRANCE 0x1C +#if OW_AUTO_SIGNPOST == TRUE #define MB_SIGNPOST 0x1D +#else +#define MB_UNUSED_1D 0x1D +#endif #define MB_UNUSED_1E 0x1E #define MB_UNUSED_1F 0x1F #define MB_ICE 0x20 diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index e8abdf5fd8..e5c72b127c 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -125,7 +125,9 @@ static const u8 sTileBitAttributes[NUM_METATILE_BEHAVIORS] = [MB_ISOLATED_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED, [MB_VERTICAL_RAIL] = TILE_FLAG_UNUSED, [MB_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED, +#if OW_AUTO_SIGNPOST == TRUE [MB_SIGNPOST] = TILE_FLAG_UNUSED, +#endif }; bool8 MetatileBehavior_IsATile(u8 metatileBehavior) @@ -1404,6 +1406,10 @@ bool8 MetatileBehavior_IsTrainerHillTimer(u8 metatileBehavior) bool8 MetatileBehavior_IsSignpost(u8 mb) { +#if OW_AUTO_SIGNPOST == TRUE return (mb == MB_SIGNPOST); +#else + return FALSE; +#endif } From 8445d44fb6b628d0fb1c812e0250eeac6a87005a Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Mon, 15 Jul 2024 21:48:24 -0700 Subject: [PATCH 04/52] Renamed DoPicboxCancel to UseBlankMessageToCancelPokemonPic --- data/event_scripts.s | 2 +- data/specials.inc | 2 +- include/config/overworld.h | 2 +- src/field_specials.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/event_scripts.s b/data/event_scripts.s index 1778472823..2d1b0d1bea 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -694,7 +694,7 @@ EventScript_BackupMrBrineyLocation:: .include "data/scripts/set_gym_trainers.inc" EventScript_CancelMessageBox:: - special DoPicboxCancel + special UseBlankMessageToCancelPokemonPic release end diff --git a/data/specials.inc b/data/specials.inc index 2779b1fe0c..044d794bc8 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -554,4 +554,4 @@ gSpecials:: def_special Script_GetChosenMonDefensiveEVs def_special Script_GetChosenMonOffensiveIVs def_special Script_GetChosenMonDefensiveIVs - def_special DoPicboxCancel + def_special UseBlankMessageToCancelPokemonPic diff --git a/include/config/overworld.h b/include/config/overworld.h index 8d9a46e0b8..412ced44e6 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -3,7 +3,7 @@ // Movement config #define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors. -#define OW_AUTO_SIGNPOST FALSE // When the tile that the player is facing has MB_SIGNPOST, the player will automatically read the signpoost. +#define OW_AUTO_SIGNPOST FALSE // When enabled, if the tile that the player is facing has MB_SIGNPOST, the player will automatically read the signpost. // Other settings #define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. diff --git a/src/field_specials.c b/src/field_specials.c index d247a4da80..e37a61f4df 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -4267,7 +4267,7 @@ void PreparePartyForSkyBattle(void) CompactPartySlots(); } -void DoPicboxCancel(void) +void UseBlankMessageToCancelPokemonPic(void) { u8 t = EOS; AddTextPrinterParameterized(0, FONT_NORMAL, &t, 0, 1, 0, NULL); From b54cf221d8098cc0a1d53ec5adb867db7d324cd3 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Mon, 15 Jul 2024 22:13:33 -0700 Subject: [PATCH 05/52] Renamed and refactored FieldInput_HandleCancelSignpost into CancelSignPostMessageBox --- include/config/overworld.h | 2 +- include/event_scripts.h | 7 ++-- include/field_control_avatar.h | 2 +- src/field_control_avatar.c | 59 ++++++++++++++++++++-------------- src/overworld.c | 2 +- 5 files changed, 41 insertions(+), 31 deletions(-) diff --git a/include/config/overworld.h b/include/config/overworld.h index 412ced44e6..aeaf88be58 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -3,7 +3,7 @@ // Movement config #define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors. -#define OW_AUTO_SIGNPOST FALSE // When enabled, if the tile that the player is facing has MB_SIGNPOST, the player will automatically read the signpost. +#define OW_AUTO_SIGNPOST TRUE // When enabled, if the tile that the player is facing has MB_SIGNPOST, the player will automatically read the signpost. // Other settings #define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. diff --git a/include/event_scripts.h b/include/event_scripts.h index 7b7ce54e67..f66e52866d 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -28,6 +28,9 @@ extern const u8 EventScript_FollowerFaceUp[]; extern const u8 EventScript_FollowerFaceResult[]; extern const u8 EnterPokeballMovement[]; +extern const u8 Common_Movement_FollowerSafeStart[]; +extern const u8 Common_Movement_FollowerSafeEnd[]; + extern const u8 EventScript_TestSignpostMsg[]; extern const u8 EventScript_TryGetTrainerScript[]; extern const u8 EventScript_StartTrainerApproach[]; @@ -643,10 +646,6 @@ extern const u8 VSSeeker_Text_BatteryNotChargedNeedXSteps[]; extern const u8 VSSeeker_Text_NoTrainersWithinRange[]; extern const u8 VSSeeker_Text_TrainersNotReady[]; extern const u8 EventScript_VsSeekerChargingDone[]; - -extern const u8 Common_Movement_FollowerSafeStart[]; -extern const u8 Common_Movement_FollowerSafeEnd[]; - extern const u8 EventScript_CancelMessageBox[]; #endif // GUARD_EVENT_SCRIPTS_H diff --git a/include/field_control_avatar.h b/include/field_control_avatar.h index 994b4b6712..cbee293a31 100644 --- a/include/field_control_avatar.h +++ b/include/field_control_avatar.h @@ -34,6 +34,6 @@ u8 TrySetDiveWarp(void); const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction); const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position); void ClearPoisonStepCounter(void); -void FieldInput_HandleCancelSignpost(struct FieldInput *input); +void CancelSignPostMessageBox(struct FieldInput *input); #endif // GUARD_FIELDCONTROLAVATAR_H diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 044c1c1779..85bbb4cf2b 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -1167,29 +1167,40 @@ static void Task_OpenStartMenu(u8 taskId) } } -void FieldInput_HandleCancelSignpost(struct FieldInput *input) +bool32 IsDpadPushedToTurnOrMovePlayer(struct FieldInput *input) { - if (ScriptContext_IsEnabled() == TRUE) - { - if (gWalkAwayFromSignInhibitTimer != 0) - { - gWalkAwayFromSignInhibitTimer--; - } - else if (CanWalkAwayToCancelMsgBox() == TRUE) - { - //ClearMsgBoxCancelableState(); - if (input->dpadDirection != 0 && GetPlayerFacingDirection() != input->dpadDirection) - { - ScriptContext_SetupScript(EventScript_CancelMessageBox); - LockPlayerFieldControls(); - } - else if (input->pressedStartButton) - { - ScriptContext_SetupScript(EventScript_CancelMessageBox); - LockPlayerFieldControls(); - if (!FuncIsActiveTask(Task_OpenStartMenu)) - CreateTask(Task_OpenStartMenu, 8); - } - } - } + return (input->dpadDirection != 0 && GetPlayerFacingDirection() != input->dpadDirection); +} + +void CancelSignPostMessageBox(struct FieldInput *input) +{ + if (!ScriptContext_IsEnabled()) + return; + + if (gWalkAwayFromSignInhibitTimer) + { + gWalkAwayFromSignInhibitTimer--; + return; + } + + if (!CanWalkAwayToCancelMsgBox()) + return; + + if (IsDpadPushedToTurnOrMovePlayer(input)) + { + ScriptContext_SetupScript(EventScript_CancelMessageBox); + LockPlayerFieldControls(); + return; + } + + if (!input->pressedStartButton) + return; + + ScriptContext_SetupScript(EventScript_CancelMessageBox); + LockPlayerFieldControls(); + + if (FuncIsActiveTask(Task_OpenStartMenu)) + return; + + CreateTask(Task_OpenStartMenu, 8); } diff --git a/src/overworld.c b/src/overworld.c index 2d787b3cea..866ba27e8e 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1489,7 +1489,7 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys) UpdatePlayerAvatarTransitionState(); FieldClearPlayerInput(&inputStruct); FieldGetPlayerInput(&inputStruct, newKeys, heldKeys); - FieldInput_HandleCancelSignpost(&inputStruct); + CancelSignPostMessageBox(&inputStruct); if (!ArePlayerFieldControlsLocked()) { if (ProcessPlayerFieldInput(&inputStruct) == 1) From 1ae615651d38513ea90953a6cad857f7bb898cdc Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Mon, 15 Jul 2024 22:33:31 -0700 Subject: [PATCH 06/52] Renamed gWalkAwayFromSignInhibitTimer to gWalkAwayFromSignpostTimer --- include/field_message_box.h | 2 +- src/field_control_avatar.c | 4 ++-- src/field_message_box.c | 2 +- src/script.c | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/field_message_box.h b/include/field_message_box.h index eed6c7a9c0..810ac0fc20 100644 --- a/include/field_message_box.h +++ b/include/field_message_box.h @@ -19,6 +19,6 @@ u8 GetFieldMessageBoxMode(void); void StopFieldMessage(void); void InitFieldMessageBox(void); -extern u8 gWalkAwayFromSignInhibitTimer; +extern u8 gWalkAwayFromSignpostTimer; #endif // GUARD_FIELD_MESSAGE_BOX_H diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 85bbb4cf2b..3c8e7a206e 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -1177,9 +1177,9 @@ void CancelSignPostMessageBox(struct FieldInput *input) if (!ScriptContext_IsEnabled()) return; - if (gWalkAwayFromSignInhibitTimer) + if (gWalkAwayFromSignpostTimer) { - gWalkAwayFromSignInhibitTimer--; + gWalkAwayFromSignpostTimer--; return; } diff --git a/src/field_message_box.c b/src/field_message_box.c index 730c569416..9d07ce24dc 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -9,7 +9,7 @@ #include "script.h" static EWRAM_DATA u8 sFieldMessageBoxMode = 0; -EWRAM_DATA u8 gWalkAwayFromSignInhibitTimer = 0; +EWRAM_DATA u8 gWalkAwayFromSignpostTimer = 0; static void ExpandStringAndStartDrawFieldMessage(const u8 *, bool32); static void StartDrawFieldMessage(void); diff --git a/src/script.c b/src/script.c index 03ce886364..6188b5070c 100644 --- a/src/script.c +++ b/src/script.c @@ -505,10 +505,11 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize) #endif //FREE_MYSTERY_EVENT_BUFFERS } -// auto read signposts +#define WALK_AWAY_SIGNPOST_FRAMES 6 + void SetWalkingIntoSignVars(void) { - gWalkAwayFromSignInhibitTimer = 6; + gWalkAwayFromSignpostTimer = 6; sMsgBoxIsCancelable = TRUE; } From 61eff23d8965d228ebf62e36b9b100e151900812 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Mon, 15 Jul 2024 22:57:29 -0700 Subject: [PATCH 07/52] Moved menu defines to header file Added FRLG signpost border Started working on LoadSignPostWindowFrameGfx --- graphics/text_window/signpost.png | Bin 0 -> 219 bytes include/menu.h | 7 +++++++ src/menu.c | 6 ------ src/script.c | 2 +- src/text_window.c | 8 ++++---- 5 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 graphics/text_window/signpost.png diff --git a/graphics/text_window/signpost.png b/graphics/text_window/signpost.png new file mode 100644 index 0000000000000000000000000000000000000000..a37c7d17c4a73d12d8b5394dea0950293ea801fd GIT binary patch literal 219 zcmeAS@N?(olHy`uVBq!ia0vp^8bGYT!VDxQHLDu~DT4r?5ZB_fOaA}=pOlnz_3GJY z9321m7Awr*nDT9kVbIwnN5283&YryoM9;o~7+J;DcCYzn0QIJMx;TbtOiWHtVEpjk zol*Wk)BlSMAs={z8aV$sirMfB+kDUa{w~yEL-qIF<{SsF?=Ej-34edj+=Nw->Hq%# zwIA~%9P4tLBIdHNM9A=o9O>a=W7C<~ru9Q!twU9D0cV}UjAIuV7%py!nV|a3jvZ(t NgQu&X%Q~loCIEb?Sgim6 literal 0 HcmV?d00001 diff --git a/include/menu.h b/include/menu.h index fac4ef1b65..42bd69d45c 100644 --- a/include/menu.h +++ b/include/menu.h @@ -5,6 +5,13 @@ #include "text.h" #include "window.h" +#define DLG_WINDOW_PALETTE_NUM 15 +#define DLG_WINDOW_BASE_TILE_NUM 0x200 +#define STD_WINDOW_PALETTE_NUM 14 +#define STD_WINDOW_PALETTE_SIZE PLTT_SIZEOF(10) +#define STD_WINDOW_BASE_TILE_NUM 0x214 + + #define MENU_NOTHING_CHOSEN -2 #define MENU_B_PRESSED -1 diff --git a/src/menu.c b/src/menu.c index ff1970c3f1..1012a6b290 100644 --- a/src/menu.c +++ b/src/menu.c @@ -23,12 +23,6 @@ #include "config/overworld.h" #include "constants/songs.h" -#define DLG_WINDOW_PALETTE_NUM 15 -#define DLG_WINDOW_BASE_TILE_NUM 0x200 -#define STD_WINDOW_PALETTE_NUM 14 -#define STD_WINDOW_PALETTE_SIZE PLTT_SIZEOF(10) -#define STD_WINDOW_BASE_TILE_NUM 0x214 - struct MenuInfoIcon { u8 width; diff --git a/src/script.c b/src/script.c index 6188b5070c..98d679cd9f 100644 --- a/src/script.c +++ b/src/script.c @@ -509,7 +509,7 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize) void SetWalkingIntoSignVars(void) { - gWalkAwayFromSignpostTimer = 6; + gWalkAwayFromSignpostTimer = WALK_AWAY_SIGNPOST_FRAMES; sMsgBoxIsCancelable = TRUE; } diff --git a/src/text_window.c b/src/text_window.c index d1e604d343..3cc3f7d47b 100644 --- a/src/text_window.c +++ b/src/text_window.c @@ -82,6 +82,8 @@ static const struct TilesPal sWindowFrames[WINDOW_FRAMES_COUNT] = {sTextWindowFrame20_Gfx, sTextWindowFrame20_Pal} }; +const u16 gSignpostWindow_Gfx[] = INCBIN_U16("graphics/text_window/signpost.4bpp"); + // code const struct TilesPal *GetWindowFrameTilesPal(u8 id) { @@ -199,8 +201,6 @@ void LoadUserWindowBorderGfxOnBg(u8 bg, u16 destOffset, u8 palOffset) void LoadSignPostWindowFrameGfx(void) { - // TODO signpost msgbox frames - //LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUnknown_8470B0C, 0x260, destOffset); - //LoadPalette(GetWindowFrameTilesPal(1), palIdx, 32); - LoadMessageBoxAndBorderGfx(); + LoadBgTiles(GetWindowAttribute(0, WINDOW_BG), gSignpostWindow_Gfx, 0x260, DLG_WINDOW_BASE_TILE_NUM); + LoadPalette(GetTextWindowPalette(1), BG_PLTT_ID(DLG_WINDOW_PALETTE_NUM), PLTT_SIZE_4BPP); } From a0c5e5511c0aae9a5a8374c98c6fbf5b4d65d99f Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Wed, 24 Jul 2024 19:41:36 -0700 Subject: [PATCH 08/52] Added gSignPostWindow_Gfx Added LoadSignBoxGfx Add LoadSignPostWindowFrameGfx --- graphics/text_window/signpost.bin | Bin 0 -> 1200 bytes graphics/text_window/signpost.png | Bin 219 -> 164 bytes include/graphics.h | 3 ++- include/text_window.h | 1 + src/field_message_box.c | 2 +- src/graphics.c | 1 + src/menu.c | 6 ++++++ src/text_window.c | 13 ++++++------- 8 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 graphics/text_window/signpost.bin diff --git a/graphics/text_window/signpost.bin b/graphics/text_window/signpost.bin new file mode 100644 index 0000000000000000000000000000000000000000..6358e199db9cfc27b69dbb01b2c4b385350aee9b GIT binary patch literal 1200 zcmeH@u?+wq48xK%pbq{2Ubvx5NVR7#28KB>2VM^lLNt_VV_`R3zI@m+mC;beI-pJj AfdBvi literal 0 HcmV?d00001 diff --git a/graphics/text_window/signpost.png b/graphics/text_window/signpost.png index a37c7d17c4a73d12d8b5394dea0950293ea801fd..89e667df9265b6bd81c68962a043a68db42b2997 100644 GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^7C_9w!VDziE-5wuDT4r?5ZC_<|AFA#xqI2g)j%#)z4*}Q$iB}UTi1x literal 219 zcmeAS@N?(olHy`uVBq!ia0vp^8bGYT!VDxQHLDu~DT4r?5ZB_fOaA}=pOlnz_3GJY z9321m7Awr*nDT9kVbIwnN5283&YryoM9;o~7+J;DcCYzn0QIJMx;TbtOiWHtVEpjk zol*Wk)BlSMAs={z8aV$sirMfB+kDUa{w~yEL-qIF<{SsF?=Ej-34edj+=Nw->Hq%# zwIA~%9P4tLBIdHNM9A=o9O>a=W7C<~ru9Q!twU9D0cV}UjAIuV7%py!nV|a3jvZ(t NgQu&X%Q~loCIEb?Sgim6 diff --git a/include/graphics.h b/include/graphics.h index fc60c29ebf..2da00d9804 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2,8 +2,9 @@ #define GUARD_GRAPHICS_H // overworld -extern const u32 gMessageBox_Gfx[]; extern const u16 gMessageBox_Pal[]; +extern const u32 gMessageBox_Gfx[]; +extern const u32 gSignpostWindow_Gfx[]; // pokeballs extern const u32 gBallGfx_Poke[]; diff --git a/include/text_window.h b/include/text_window.h index 4e26c70a90..a292d1309e 100644 --- a/include/text_window.h +++ b/include/text_window.h @@ -14,6 +14,7 @@ extern const u16 gTextWindowFrame1_Pal[]; const struct TilesPal *GetWindowFrameTilesPal(u8 id); void LoadMessageBoxGfx(u8 windowId, u16 destOffset, u8 palOffset); +void LoadSignBoxGfx(u8 windowId, u16 destOffset, u8 palOffset); void LoadWindowGfx(u8 windowId, u8 frameId, u16 destOffset, u8 palOffset); void LoadUserWindowBorderGfx(u8 windowId, u16 destOffset, u8 palOffset); void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset); diff --git a/src/field_message_box.c b/src/field_message_box.c index 9d07ce24dc..4f50699a6a 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -41,7 +41,7 @@ static void Task_DrawFieldMessage(u8 taskId) task->tState++; break; case 1: - DrawDialogueFrame(0, TRUE); + DrawDialogueFrame(0, TRUE); task->tState++; break; case 2: diff --git a/src/graphics.c b/src/graphics.c index 58c629fbc9..4efd17db09 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1984,6 +1984,7 @@ const u16 gTradeMenuMonBox_Tilemap[] = INCBIN_U16("graphics/trade/menu_mon_box.b const u16 gMessageBox_Pal[] = INCBIN_U16("graphics/text_window/message_box.gbapal"); const u8 gMessageBox_Gfx[] = INCBIN_U8("graphics/text_window/message_box.4bpp"); +const u8 gSignpostWindow_Gfx[] = INCBIN_U8("graphics/text_window/signpost.4bpp"); const u32 gWallpaperIcon_Cross[] = INCBIN_U32("graphics/pokemon_storage/wallpapers/icons/cross.4bpp.lz"); const u32 gWallpaperIcon_Bolt[] = INCBIN_U32("graphics/pokemon_storage/wallpapers/icons/bolt.4bpp.lz"); diff --git a/src/menu.c b/src/menu.c index 1012a6b290..ecb8dd20d6 100644 --- a/src/menu.c +++ b/src/menu.c @@ -214,6 +214,12 @@ void LoadMessageBoxAndBorderGfx(void) LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(STD_WINDOW_PALETTE_NUM)); } +void LoadSignPostWindowFrameGfx(void) +{ + LoadSignBoxGfx(0, DLG_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(DLG_WINDOW_PALETTE_NUM)); + //LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(STD_WINDOW_PALETTE_NUM)); +} + void DrawDialogueFrame(u8 windowId, bool8 copyToVram) { CallWindowFunction(windowId, WindowFunc_DrawDialogueFrame); diff --git a/src/text_window.c b/src/text_window.c index 3cc3f7d47b..6423867205 100644 --- a/src/text_window.c +++ b/src/text_window.c @@ -82,8 +82,6 @@ static const struct TilesPal sWindowFrames[WINDOW_FRAMES_COUNT] = {sTextWindowFrame20_Gfx, sTextWindowFrame20_Pal} }; -const u16 gSignpostWindow_Gfx[] = INCBIN_U16("graphics/text_window/signpost.4bpp"); - // code const struct TilesPal *GetWindowFrameTilesPal(u8 id) { @@ -99,6 +97,12 @@ void LoadMessageBoxGfx(u8 windowId, u16 destOffset, u8 palOffset) LoadPalette(GetOverworldTextboxPalettePtr(), palOffset, PLTT_SIZE_4BPP); } +void LoadSignBoxGfx(u8 windowId, u16 destOffset, u8 palOffset) +{ + LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gSignpostWindow_Gfx, 0x1C0, destOffset); + LoadPalette(GetOverworldTextboxPalettePtr(), palOffset, PLTT_SIZE_4BPP); +} + void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset) { LoadUserWindowBorderGfx(windowId, destOffset, palOffset); @@ -199,8 +203,3 @@ void LoadUserWindowBorderGfxOnBg(u8 bg, u16 destOffset, u8 palOffset) LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, palOffset, PLTT_SIZE_4BPP); } -void LoadSignPostWindowFrameGfx(void) -{ - LoadBgTiles(GetWindowAttribute(0, WINDOW_BG), gSignpostWindow_Gfx, 0x260, DLG_WINDOW_BASE_TILE_NUM); - LoadPalette(GetTextWindowPalette(1), BG_PLTT_ID(DLG_WINDOW_PALETTE_NUM), PLTT_SIZE_4BPP); -} From 389f4e4180a1960c19cca9679a48bf34b42e3942 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Wed, 24 Jul 2024 20:58:18 -0700 Subject: [PATCH 09/52] Worked with ShinyDragonHunter to get signpost working --- graphics/text_window/signpost.png | Bin 164 -> 193 bytes src/menu.c | 126 +++++++++++++++++++++++++++++- src/text_window.c | 2 +- 3 files changed, 125 insertions(+), 3 deletions(-) diff --git a/graphics/text_window/signpost.png b/graphics/text_window/signpost.png index 89e667df9265b6bd81c68962a043a68db42b2997..45ab7c6764b4561cf091f05101e60c4c242c35db 100644 GIT binary patch literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^8bHj!!VDxUYZhbxDT4r?5ZB_fOaA}=pOlnz_3GJY z9321m7Awr*nDT9kVbIwnN5283&YryoM9;o~7+J;DcCYzn0QGVfctjR6Fz_7#VaBQ2 ze9}Ncb59q?5RRG22@OpD{_ig5W@2PEauEH)&uHK%AiaWV^@I0!6&QqBHXck%6urao iU* literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^7C_9w!VDziE-5wuDT4r?5ZC_<|AFA#xqI2g)j%#)z4*}Q$iB}UTi1x diff --git a/src/menu.c b/src/menu.c index ecb8dd20d6..6cb9c05492 100644 --- a/src/menu.c +++ b/src/menu.c @@ -17,6 +17,7 @@ #include "sound.h" #include "string_util.h" #include "strings.h" +#include "script.h" #include "task.h" #include "text_window.h" #include "window.h" @@ -48,6 +49,7 @@ struct Menu static u16 AddWindowParameterized(u8, u8, u8, u8, u8, u8, u16); static void WindowFunc_DrawStandardFrame(u8, u8, u8, u8, u8, u8); +static void WindowFunc_DrawSignFrame(u8, u8, u8, u8, u8, u8); static void WindowFunc_DrawDialogueFrame(u8, u8, u8, u8, u8, u8); static void WindowFunc_ClearStdWindowAndFrame(u8, u8, u8, u8, u8, u8); static void WindowFunc_ClearDialogWindowAndFrame(u8, u8, u8, u8, u8, u8); @@ -216,13 +218,133 @@ void LoadMessageBoxAndBorderGfx(void) void LoadSignPostWindowFrameGfx(void) { + Menu_LoadStdPal(); LoadSignBoxGfx(0, DLG_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(DLG_WINDOW_PALETTE_NUM)); - //LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(STD_WINDOW_PALETTE_NUM)); + LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(STD_WINDOW_PALETTE_NUM)); +} + +static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +{ + // Top left + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 0, + tilemapLeft - 2, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 1, + tilemapLeft - 1, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 2, + tilemapLeft - 2, + tilemapTop, + 1, + 4, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 3, + tilemapLeft - 1, + tilemapTop, + 1, + 4, + DLG_WINDOW_PALETTE_NUM); + + // Bottom left + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0), + tilemapLeft - 2, + tilemapTop + 4, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1), + tilemapLeft - 1, + tilemapTop + 4, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + + // Top + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 4, + tilemapLeft, + tilemapTop - 1, + 26, + 1, + DLG_WINDOW_PALETTE_NUM); + + // Top right + FillBgTilemapBufferRect(bg, + BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0), + tilemapLeft + 27, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1), + tilemapLeft + 26, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 2), + tilemapLeft + 27, + tilemapTop, + 1, + 4, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 3), + tilemapLeft + 26, + tilemapTop, + 1, + 4, + DLG_WINDOW_PALETTE_NUM); + + // Bottom right + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0)), + tilemapLeft + 27, + tilemapTop + 4, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1)), + tilemapLeft + 26, + tilemapTop + 4, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + + // Bottom + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 4), + tilemapLeft, + tilemapTop + 4, + 26, + 1, + DLG_WINDOW_PALETTE_NUM); +} + +static inline void *GetWindowFunc_DialogueFrame(void) +{ + return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); + } void DrawDialogueFrame(u8 windowId, bool8 copyToVram) { - CallWindowFunction(windowId, WindowFunc_DrawDialogueFrame); + CallWindowFunction(windowId, GetWindowFunc_DialogueFrame()); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); PutWindowTilemap(windowId); if (copyToVram == TRUE) diff --git a/src/text_window.c b/src/text_window.c index 6423867205..6c02797fe3 100644 --- a/src/text_window.c +++ b/src/text_window.c @@ -100,7 +100,7 @@ void LoadMessageBoxGfx(u8 windowId, u16 destOffset, u8 palOffset) void LoadSignBoxGfx(u8 windowId, u16 destOffset, u8 palOffset) { LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gSignpostWindow_Gfx, 0x1C0, destOffset); - LoadPalette(GetOverworldTextboxPalettePtr(), palOffset, PLTT_SIZE_4BPP); + LoadPalette(GetTextWindowPalette(1), palOffset, PLTT_SIZE_4BPP); } void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset) From 614b7f862e1a9b4fd7bef09c9ecc412e2438265d Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Wed, 24 Jul 2024 22:21:00 -0700 Subject: [PATCH 10/52] Working version of interactable signpost msgbox --- src/field_control_avatar.c | 16 ++++++++++++++-- src/menu.c | 12 +----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 3c8e7a206e..df77f798ce 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -82,6 +82,7 @@ static void UpdateLetsGoEvolutionTracker(void); static bool8 UpdatePoisonStepCounter(void); #endif // OW_POISON_DAMAGE static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection); +static void SetMsgSignPostAndVarFacing(u32 playerDirection); static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection); static u8 GetFacingSignpostType(u16 metatileBehvaior, u8 direction); static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position); @@ -379,6 +380,9 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position if (bgEvent->bgUnion.script == NULL) return EventScript_TestSignpostMsg; + if (GetFacingSignpostType(metatileBehavior, direction) != SIGNPOST_NA) + SetMsgSignPostAndVarFacing(direction); + switch (bgEvent->kind) { case BG_EVENT_PLAYER_FACING_ANY: @@ -1133,18 +1137,26 @@ static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection) if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, playerDirection) == TRUE) return SIGNPOST_POKEMART;*/ + DebugPrintf("behavior is %d",metatileBehavior); + if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE) return SIGNPOST_SCRIPTED; return SIGNPOST_NA; } +static void SetMsgSignPostAndVarFacing(u32 playerDirection) +{ + DebugPrintf("test"); + MsgSetSignPost(); + gSpecialVar_Facing = playerDirection; +} + static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection) { - gSpecialVar_Facing = playerDirection; ScriptContext_SetupScript(script); SetWalkingIntoSignVars(); - MsgSetSignPost(); + SetMsgSignPostAndVarFacing(playerDirection); } static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position) diff --git a/src/menu.c b/src/menu.c index 6cb9c05492..620c4d13e1 100644 --- a/src/menu.c +++ b/src/menu.c @@ -225,7 +225,6 @@ void LoadSignPostWindowFrameGfx(void) static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { - // Top left FillBgTilemapBufferRect(bg, DLG_WINDOW_BASE_TILE_NUM + 0, tilemapLeft - 2, @@ -254,8 +253,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi 1, 4, DLG_WINDOW_PALETTE_NUM); - - // Bottom left FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0), tilemapLeft - 2, @@ -270,8 +267,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi 1, 1, DLG_WINDOW_PALETTE_NUM); - - // Top FillBgTilemapBufferRect(bg, DLG_WINDOW_BASE_TILE_NUM + 4, tilemapLeft, @@ -279,8 +274,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi 26, 1, DLG_WINDOW_PALETTE_NUM); - - // Top right FillBgTilemapBufferRect(bg, BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0), tilemapLeft + 27, @@ -309,8 +302,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi 1, 4, DLG_WINDOW_PALETTE_NUM); - - // Bottom right FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0)), tilemapLeft + 27, @@ -325,8 +316,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi 1, 1, DLG_WINDOW_PALETTE_NUM); - - // Bottom FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 4), tilemapLeft, @@ -338,6 +327,7 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi static inline void *GetWindowFunc_DialogueFrame(void) { + DebugPrintf("test %d",IsMsgSignPost()); return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); } From fd69ef339c5ea1578e52f22cc51ff338cb77abb1 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 25 Jul 2024 19:33:07 -0700 Subject: [PATCH 11/52] Got pokemart and pokecenter changes working --- include/constants/metatile_behaviors.h | 4 +++- include/event_scripts.h | 3 +++ include/metatile_behavior.h | 2 ++ src/field_control_avatar.c | 18 +++++++----------- src/menu.c | 1 - src/metatile_behavior.c | 18 ++++++++++++++++++ 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/include/constants/metatile_behaviors.h b/include/constants/metatile_behaviors.h index 56df442bb8..808fa49df7 100755 --- a/include/constants/metatile_behaviors.h +++ b/include/constants/metatile_behaviors.h @@ -32,11 +32,13 @@ #define MB_SHOAL_CAVE_ENTRANCE 0x1C #if OW_AUTO_SIGNPOST == TRUE #define MB_SIGNPOST 0x1D +#define MB_SIGNPOST_POKECENTER 0x1E +#define MB_SIGNPOST_POKEMART 0x1F #else #define MB_UNUSED_1D 0x1D -#endif #define MB_UNUSED_1E 0x1E #define MB_UNUSED_1F 0x1F +#endif #define MB_ICE 0x20 #define MB_SAND 0x21 #define MB_SEAWEED 0x22 diff --git a/include/event_scripts.h b/include/event_scripts.h index f66e52866d..f23f52cb12 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -648,4 +648,7 @@ extern const u8 VSSeeker_Text_TrainersNotReady[]; extern const u8 EventScript_VsSeekerChargingDone[]; extern const u8 EventScript_CancelMessageBox[]; +extern const u8 Common_EventScript_ShowPokemonCenterSign[]; +extern const u8 Common_EventScript_ShowPokemartSign[]; + #endif // GUARD_EVENT_SCRIPTS_H diff --git a/include/metatile_behavior.h b/include/metatile_behavior.h index 74f0beca74..0c4622adaf 100644 --- a/include/metatile_behavior.h +++ b/include/metatile_behavior.h @@ -149,5 +149,7 @@ bool8 MetatileBehavior_IsLongGrass_Duplicate(u8); bool8 MetatileBehavior_IsLongGrassSouthEdge(u8); bool8 MetatileBehavior_IsTrainerHillTimer(u8); bool8 MetatileBehavior_IsSignpost(u8 mb); +bool8 MetatileBehavior_IsPokemonCenterSign(u8 mb); +bool8 MetatileBehavior_IsPokeMartSign(u8 mb); #endif // GUARD_METATILE_BEHAVIOR_H diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index df77f798ce..880eb8d59e 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -1112,13 +1112,12 @@ static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 me switch (GetFacingSignpostType(metatileBehavior, playerDirection)) { - /* leaving this commented out for examples of custom signpost types case SIGNPOST_POKECENTER: - SetUpWalkIntoSignScript(EventScript_PokecenterSign, playerDirection); + SetUpWalkIntoSignScript(Common_EventScript_ShowPokemonCenterSign, playerDirection); return TRUE; case SIGNPOST_POKEMART: - SetUpWalkIntoSignScript(EventScript_PokemartSign, playerDirection); - return TRUE;*/ + SetUpWalkIntoSignScript(Common_EventScript_ShowPokemartSign, playerDirection); + return TRUE; case SIGNPOST_SCRIPTED: script = GetSignpostScriptAtMapPosition(position); if (script == NULL) @@ -1132,12 +1131,10 @@ static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 me static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection) { - /*if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, playerDirection) == TRUE) + if (MetatileBehavior_IsPokemonCenterSign(metatileBehavior) == TRUE) return SIGNPOST_POKECENTER; - if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, playerDirection) == TRUE) - return SIGNPOST_POKEMART;*/ - - DebugPrintf("behavior is %d",metatileBehavior); + if (MetatileBehavior_IsPokeMartSign(metatileBehavior) == TRUE) + return SIGNPOST_POKEMART; if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE) return SIGNPOST_SCRIPTED; @@ -1147,7 +1144,7 @@ static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection) static void SetMsgSignPostAndVarFacing(u32 playerDirection) { - DebugPrintf("test"); + SetWalkingIntoSignVars(); MsgSetSignPost(); gSpecialVar_Facing = playerDirection; } @@ -1155,7 +1152,6 @@ static void SetMsgSignPostAndVarFacing(u32 playerDirection) static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection) { ScriptContext_SetupScript(script); - SetWalkingIntoSignVars(); SetMsgSignPostAndVarFacing(playerDirection); } diff --git a/src/menu.c b/src/menu.c index 620c4d13e1..2679e0a336 100644 --- a/src/menu.c +++ b/src/menu.c @@ -327,7 +327,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi static inline void *GetWindowFunc_DialogueFrame(void) { - DebugPrintf("test %d",IsMsgSignPost()); return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); } diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index e5c72b127c..601e2660af 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -1413,3 +1413,21 @@ bool8 MetatileBehavior_IsSignpost(u8 mb) #endif } +bool8 MetatileBehavior_IsPokemonCenterSign(u8 mb) +{ +#if OW_AUTO_SIGNPOST == TRUE + return (mb == MB_SIGNPOST_POKECENTER); +#else + return FALSE; +#endif +} + +bool8 MetatileBehavior_IsPokeMartSign(u8 mb) +{ +#if OW_AUTO_SIGNPOST == TRUE + return (mb == MB_SIGNPOST_POKEMART); +#else + return FALSE; +#endif +} + From b5c58e53de13ccf5d1142638f0320d9bec88153a Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 25 Jul 2024 19:35:28 -0700 Subject: [PATCH 12/52] Removed all comments --- include/script.h | 1 - src/field_control_avatar.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/include/script.h b/include/script.h index eba18ec35f..48d1f6c0ec 100644 --- a/include/script.h +++ b/include/script.h @@ -63,7 +63,6 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize); // srccmd.h void SetMovingNpcId(u16 npcId); -// auto read signs void SetWalkingIntoSignVars(void); void MsgSetSignPost(void); void ResetFacingNpcOrSignPostVars(void); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 880eb8d59e..049305db86 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -1099,8 +1099,6 @@ int SetCableClubWarp(void) return 0; } -// auto read signposts -// signposts static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 metatileBehavior, u8 playerDirection) { const u8 *script; From c6f89d199667cf9cf1ac877964fa81395ac5649b Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 25 Jul 2024 19:36:33 -0700 Subject: [PATCH 13/52] Removed swap file --- .swp | Bin 4096 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .swp diff --git a/.swp b/.swp deleted file mode 100644 index 5e1b894bdd178ae6540706061764e60b34548a85..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmYc?2=nw+u+%eP00IFJ0Rc=L3=9RuX)rEc+Ql{4JH$Ug*U};^%+=Hkui8<`(GVC7 zfq@DE&QN0`LvU7CR#H?D7786Ghm6`g8UmvsFd71*Aut*OqaiRF0;3@?8UmvsFaRL{ E06$R)(EtDd From 2a5f384e6688acaac4ea3d0db464eface40f86da Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 25 Jul 2024 19:44:26 -0700 Subject: [PATCH 14/52] Added metatile behaviors to mart and center signs --- .../primary/general/metatile_attributes.bin | Bin 1024 -> 1024 bytes include/constants/metatile_behaviors.h | 4 ++-- src/metatile_behavior.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/tilesets/primary/general/metatile_attributes.bin b/data/tilesets/primary/general/metatile_attributes.bin index af9326451d561c4103afe500c5ae8c7656092fc6..95b03cbdffe43d189b8b49eadb9fb2e9b8c1db62 100644 GIT binary patch delta 21 ccmZqRXyBO8!YnT!Ke64GSx!K1<8e!706 Date: Thu, 25 Jul 2024 20:23:04 -0700 Subject: [PATCH 15/52] Revert metatile behavior --- .../primary/general/metatile_attributes.bin | Bin 1024 -> 1024 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/tilesets/primary/general/metatile_attributes.bin b/data/tilesets/primary/general/metatile_attributes.bin index 95b03cbdffe43d189b8b49eadb9fb2e9b8c1db62..d9cd29016d792fb568494dbf2f820100081a14f8 100644 GIT binary patch delta 35 jcmZqRXy9OHfPjhY`iu+{&3%~}1Q;f^+k&W#$1RxwUG4@X delta 35 ncmZqRXy9OH00Y^H?D~wd6U}{@ Date: Thu, 25 Jul 2024 20:34:14 -0700 Subject: [PATCH 16/52] Clean up files --- include/config/overworld.h | 2 +- include/event_scripts.h | 1 - include/graphics.h | 4 ++-- include/menu.h | 1 - include/metatile_behavior.h | 6 +++--- src/field_control_avatar.c | 20 ++++++++------------ src/metatile_behavior.c | 6 +++--- 7 files changed, 17 insertions(+), 23 deletions(-) diff --git a/include/config/overworld.h b/include/config/overworld.h index aeaf88be58..292743a211 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -3,7 +3,7 @@ // Movement config #define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors. -#define OW_AUTO_SIGNPOST TRUE // When enabled, if the tile that the player is facing has MB_SIGNPOST, the player will automatically read the signpost. +#define OW_AUTO_SIGNPOST TRUE // When enabled, if the tile that the player is facing has MB_SIGNPOST, MB_POKEMART_SIGN, or MB_POKEMON_CENTER_SIGN, the player will automatically read the signpost. // Other settings #define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. diff --git a/include/event_scripts.h b/include/event_scripts.h index f23f52cb12..7ec15d4548 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -647,7 +647,6 @@ extern const u8 VSSeeker_Text_NoTrainersWithinRange[]; extern const u8 VSSeeker_Text_TrainersNotReady[]; extern const u8 EventScript_VsSeekerChargingDone[]; extern const u8 EventScript_CancelMessageBox[]; - extern const u8 Common_EventScript_ShowPokemonCenterSign[]; extern const u8 Common_EventScript_ShowPokemartSign[]; diff --git a/include/graphics.h b/include/graphics.h index 2da00d9804..e58ee7bf50 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2,9 +2,9 @@ #define GUARD_GRAPHICS_H // overworld -extern const u16 gMessageBox_Pal[]; -extern const u32 gMessageBox_Gfx[]; extern const u32 gSignpostWindow_Gfx[]; +extern const u32 gMessageBox_Gfx[]; +extern const u16 gMessageBox_Pal[]; // pokeballs extern const u32 gBallGfx_Poke[]; diff --git a/include/menu.h b/include/menu.h index 42bd69d45c..d2190fb854 100644 --- a/include/menu.h +++ b/include/menu.h @@ -11,7 +11,6 @@ #define STD_WINDOW_PALETTE_SIZE PLTT_SIZEOF(10) #define STD_WINDOW_BASE_TILE_NUM 0x214 - #define MENU_NOTHING_CHOSEN -2 #define MENU_B_PRESSED -1 diff --git a/include/metatile_behavior.h b/include/metatile_behavior.h index 0c4622adaf..d49dc2459a 100644 --- a/include/metatile_behavior.h +++ b/include/metatile_behavior.h @@ -148,8 +148,8 @@ bool8 MetatileBehavior_IsQuestionnaire(u8); bool8 MetatileBehavior_IsLongGrass_Duplicate(u8); bool8 MetatileBehavior_IsLongGrassSouthEdge(u8); bool8 MetatileBehavior_IsTrainerHillTimer(u8); -bool8 MetatileBehavior_IsSignpost(u8 mb); -bool8 MetatileBehavior_IsPokemonCenterSign(u8 mb); -bool8 MetatileBehavior_IsPokeMartSign(u8 mb); +bool32 MetatileBehavior_IsSignpost(u32 mb); +bool32 MetatileBehavior_IsPokemonCenterSign(u32 mb); +bool32 MetatileBehavior_IsPokeMartSign(u32 mb); #endif // GUARD_METATILE_BEHAVIOR_H diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 049305db86..7972be7a11 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -35,6 +35,7 @@ #include "constants/event_objects.h" #include "constants/field_poison.h" #include "constants/map_types.h" +#include "constants/metatile_behaviors.h" #include "constants/songs.h" #include "constants/trainer_hill.h" @@ -43,12 +44,7 @@ static EWRAM_DATA u16 sPrevMetatileBehavior = 0; u8 gSelectedObjectEvent; -#define SIGNPOST_POKECENTER 0 -#define SIGNPOST_POKEMART 1 -#define SIGNPOST_INDIGO_1 2 -#define SIGNPOST_INDIGO_2 3 -#define SIGNPOST_SCRIPTED 240 -#define SIGNPOST_NA 255 +#define SIGNPOST_NA 0 static void GetPlayerPosition(struct MapPosition *); static void GetInFrontOfPlayerPosition(struct MapPosition *); @@ -1110,13 +1106,13 @@ static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 me switch (GetFacingSignpostType(metatileBehavior, playerDirection)) { - case SIGNPOST_POKECENTER: + case MB_POKEMON_CENTER_SIGN: SetUpWalkIntoSignScript(Common_EventScript_ShowPokemonCenterSign, playerDirection); return TRUE; - case SIGNPOST_POKEMART: + case MB_POKEMART_SIGN: SetUpWalkIntoSignScript(Common_EventScript_ShowPokemartSign, playerDirection); return TRUE; - case SIGNPOST_SCRIPTED: + case MB_SIGNPOST: script = GetSignpostScriptAtMapPosition(position); if (script == NULL) return FALSE; @@ -1130,12 +1126,12 @@ static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 me static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection) { if (MetatileBehavior_IsPokemonCenterSign(metatileBehavior) == TRUE) - return SIGNPOST_POKECENTER; + return MB_POKEMON_CENTER_SIGN; if (MetatileBehavior_IsPokeMartSign(metatileBehavior) == TRUE) - return SIGNPOST_POKEMART; + return MB_POKEMART_SIGN; if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE) - return SIGNPOST_SCRIPTED; + return MB_SIGNPOST; return SIGNPOST_NA; } diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index 88bca9f0de..fcf8b64fd1 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -1404,7 +1404,7 @@ bool8 MetatileBehavior_IsTrainerHillTimer(u8 metatileBehavior) return FALSE; } -bool8 MetatileBehavior_IsSignpost(u8 mb) +bool32 MetatileBehavior_IsSignpost(u32 mb) { #if OW_AUTO_SIGNPOST == TRUE return (mb == MB_SIGNPOST); @@ -1413,7 +1413,7 @@ bool8 MetatileBehavior_IsSignpost(u8 mb) #endif } -bool8 MetatileBehavior_IsPokemonCenterSign(u8 mb) +bool32 MetatileBehavior_IsPokemonCenterSign(u32 mb) { #if OW_AUTO_SIGNPOST == TRUE return (mb == MB_POKEMON_CENTER_SIGN); @@ -1422,7 +1422,7 @@ bool8 MetatileBehavior_IsPokemonCenterSign(u8 mb) #endif } -bool8 MetatileBehavior_IsPokeMartSign(u8 mb) +bool32 MetatileBehavior_IsPokeMartSign(u32 mb) { #if OW_AUTO_SIGNPOST == TRUE return (mb == MB_POKEMART_SIGN); From 02cdbb3c7daeee4e1843adf2b39abf790a97e9ab Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 25 Jul 2024 21:07:11 -0700 Subject: [PATCH 17/52] Cleaned up field_control_avatar --- log2.txt | 0 src/field_control_avatar.c | 54 +++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 27 deletions(-) delete mode 100644 log2.txt diff --git a/log2.txt b/log2.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 7972be7a11..85e9f2cfb4 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -44,7 +44,7 @@ static EWRAM_DATA u16 sPrevMetatileBehavior = 0; u8 gSelectedObjectEvent; -#define SIGNPOST_NA 0 +#define NOT_SIGNPOST 0 static void GetPlayerPosition(struct MapPosition *); static void GetInFrontOfPlayerPosition(struct MapPosition *); @@ -77,10 +77,10 @@ static void UpdateLetsGoEvolutionTracker(void); #if OW_POISON_DAMAGE < GEN_5 static bool8 UpdatePoisonStepCounter(void); #endif // OW_POISON_DAMAGE -static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection); +static bool32 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u32 metatileBehavior, u32 playerDirection); static void SetMsgSignPostAndVarFacing(u32 playerDirection); -static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection); -static u8 GetFacingSignpostType(u16 metatileBehvaior, u8 direction); +static void SetUpWalkIntoSignScript(const u8 *script, u32 playerDirection); +static u32 GetFacingSignpostType(u16 metatileBehvaior, u32 direction); static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position); void FieldClearPlayerInput(struct FieldInput *input) @@ -183,18 +183,18 @@ int ProcessPlayerFieldInput(struct FieldInput *input) return TRUE; } - if (input->checkStandardWildEncounter) - { - if (input->dpadDirection == 0 || input->dpadDirection == playerDirection) - { - GetInFrontOfPlayerPosition(&position); - metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) - return TRUE; - GetPlayerPosition(&position); - metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - } - } + if (input->checkStandardWildEncounter) + { + if (input->dpadDirection == 0 || input->dpadDirection == playerDirection) + { + GetInFrontOfPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) + return TRUE; + GetPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + } + } if (input->checkStandardWildEncounter && CheckStandardWildEncounter(metatileBehavior) == TRUE) return TRUE; @@ -376,7 +376,7 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position if (bgEvent->bgUnion.script == NULL) return EventScript_TestSignpostMsg; - if (GetFacingSignpostType(metatileBehavior, direction) != SIGNPOST_NA) + if (GetFacingSignpostType(metatileBehavior, direction) != NOT_SIGNPOST) SetMsgSignPostAndVarFacing(direction); switch (bgEvent->kind) @@ -1095,7 +1095,7 @@ int SetCableClubWarp(void) return 0; } -static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 metatileBehavior, u8 playerDirection) +static bool32 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u32 metatileBehavior, u32 playerDirection) { const u8 *script; @@ -1123,7 +1123,7 @@ static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 me } } -static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection) +static u32 GetFacingSignpostType(u16 metatileBehavior, u32 playerDirection) { if (MetatileBehavior_IsPokemonCenterSign(metatileBehavior) == TRUE) return MB_POKEMON_CENTER_SIGN; @@ -1133,7 +1133,7 @@ static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection) if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE) return MB_SIGNPOST; - return SIGNPOST_NA; + return NOT_SIGNPOST; } static void SetMsgSignPostAndVarFacing(u32 playerDirection) @@ -1143,7 +1143,7 @@ static void SetMsgSignPostAndVarFacing(u32 playerDirection) gSpecialVar_Facing = playerDirection; } -static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection) +static void SetUpWalkIntoSignScript(const u8 *script, u32 playerDirection) { ScriptContext_SetupScript(script); SetMsgSignPostAndVarFacing(playerDirection); @@ -1161,12 +1161,12 @@ static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position) static void Task_OpenStartMenu(u8 taskId) { - if (!ArePlayerFieldControlsLocked()) - { - PlaySE(SE_WIN_OPEN); - ShowStartMenu(); - DestroyTask(taskId); - } + if (ArePlayerFieldControlsLocked()) + return; + + PlaySE(SE_WIN_OPEN); + ShowStartMenu(); + DestroyTask(taskId); } bool32 IsDpadPushedToTurnOrMovePlayer(struct FieldInput *input) From f362f6e754c52ebd6e9c8f6e15ae376f3bd9884a Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 25 Jul 2024 21:22:08 -0700 Subject: [PATCH 18/52] Cleaned up metatile behavior --- src/menu.c | 2 +- src/metatile_behavior.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/menu.c b/src/menu.c index 2679e0a336..c58f72f3e5 100644 --- a/src/menu.c +++ b/src/menu.c @@ -50,6 +50,7 @@ struct Menu static u16 AddWindowParameterized(u8, u8, u8, u8, u8, u8, u16); static void WindowFunc_DrawStandardFrame(u8, u8, u8, u8, u8, u8); static void WindowFunc_DrawSignFrame(u8, u8, u8, u8, u8, u8); +static inline void *GetWindowFunc_DialogueFrame(void); static void WindowFunc_DrawDialogueFrame(u8, u8, u8, u8, u8, u8); static void WindowFunc_ClearStdWindowAndFrame(u8, u8, u8, u8, u8, u8); static void WindowFunc_ClearDialogWindowAndFrame(u8, u8, u8, u8, u8, u8); @@ -328,7 +329,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi static inline void *GetWindowFunc_DialogueFrame(void) { return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); - } void DrawDialogueFrame(u8 windowId, bool8 copyToVram) diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index fcf8b64fd1..1212457d24 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -127,6 +127,8 @@ static const u8 sTileBitAttributes[NUM_METATILE_BEHAVIORS] = [MB_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED, #if OW_AUTO_SIGNPOST == TRUE [MB_SIGNPOST] = TILE_FLAG_UNUSED, + [MB_POKEMON_CENTER_SIGN] = TILE_FLAG_UNUSED, + [MB_POKEMART_SIGN] = TILE_FLAG_UNUSED, #endif }; From 59c2eeac215a8748933815d2248c064428def099 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Fri, 26 Jul 2024 21:22:29 -0700 Subject: [PATCH 19/52] Default signpost config is off --- include/config/overworld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/overworld.h b/include/config/overworld.h index 292743a211..c740bf4853 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -3,7 +3,7 @@ // Movement config #define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors. -#define OW_AUTO_SIGNPOST TRUE // When enabled, if the tile that the player is facing has MB_SIGNPOST, MB_POKEMART_SIGN, or MB_POKEMON_CENTER_SIGN, the player will automatically read the signpost. +#define OW_AUTO_SIGNPOST FALSE // When enabled, if the tile that the player is facing has MB_SIGNPOST, MB_POKEMART_SIGN, or MB_POKEMON_CENTER_SIGN, the player will automatically read the signpost. // Other settings #define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. From 587ffeeb97a53b8ae1123d46690e45af503c37b9 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Fri, 26 Jul 2024 21:31:04 -0700 Subject: [PATCH 20/52] Fixed tabs --- src/field_control_avatar.c | 86 ++++++++-------- src/field_message_box.c | 2 +- src/menu.c | 200 ++++++++++++++++++------------------- src/metatile_behavior.c | 6 +- 4 files changed, 147 insertions(+), 147 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 85e9f2cfb4..92e9df1c54 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -183,18 +183,18 @@ int ProcessPlayerFieldInput(struct FieldInput *input) return TRUE; } - if (input->checkStandardWildEncounter) - { - if (input->dpadDirection == 0 || input->dpadDirection == playerDirection) - { - GetInFrontOfPlayerPosition(&position); - metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) - return TRUE; - GetPlayerPosition(&position); - metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - } - } + if (input->checkStandardWildEncounter) + { + if (input->dpadDirection == 0 || input->dpadDirection == playerDirection) + { + GetInFrontOfPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) + return TRUE; + GetPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + } + } if (input->checkStandardWildEncounter && CheckStandardWildEncounter(metatileBehavior) == TRUE) return TRUE; @@ -376,8 +376,8 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position if (bgEvent->bgUnion.script == NULL) return EventScript_TestSignpostMsg; - if (GetFacingSignpostType(metatileBehavior, direction) != NOT_SIGNPOST) - SetMsgSignPostAndVarFacing(direction); + if (GetFacingSignpostType(metatileBehavior, direction) != NOT_SIGNPOST) + SetMsgSignPostAndVarFacing(direction); switch (bgEvent->kind) { @@ -1146,7 +1146,7 @@ static void SetMsgSignPostAndVarFacing(u32 playerDirection) static void SetUpWalkIntoSignScript(const u8 *script, u32 playerDirection) { ScriptContext_SetupScript(script); - SetMsgSignPostAndVarFacing(playerDirection); + SetMsgSignPostAndVarFacing(playerDirection); } static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position) @@ -1161,48 +1161,48 @@ static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position) static void Task_OpenStartMenu(u8 taskId) { - if (ArePlayerFieldControlsLocked()) - return; + if (ArePlayerFieldControlsLocked()) + return; - PlaySE(SE_WIN_OPEN); - ShowStartMenu(); - DestroyTask(taskId); + PlaySE(SE_WIN_OPEN); + ShowStartMenu(); + DestroyTask(taskId); } bool32 IsDpadPushedToTurnOrMovePlayer(struct FieldInput *input) { - return (input->dpadDirection != 0 && GetPlayerFacingDirection() != input->dpadDirection); + return (input->dpadDirection != 0 && GetPlayerFacingDirection() != input->dpadDirection); } void CancelSignPostMessageBox(struct FieldInput *input) { - if (!ScriptContext_IsEnabled()) - return; + if (!ScriptContext_IsEnabled()) + return; - if (gWalkAwayFromSignpostTimer) - { - gWalkAwayFromSignpostTimer--; - return; - } + if (gWalkAwayFromSignpostTimer) + { + gWalkAwayFromSignpostTimer--; + return; + } - if (!CanWalkAwayToCancelMsgBox()) - return; + if (!CanWalkAwayToCancelMsgBox()) + return; - if (IsDpadPushedToTurnOrMovePlayer(input)) - { - ScriptContext_SetupScript(EventScript_CancelMessageBox); - LockPlayerFieldControls(); - return; - } + if (IsDpadPushedToTurnOrMovePlayer(input)) + { + ScriptContext_SetupScript(EventScript_CancelMessageBox); + LockPlayerFieldControls(); + return; + } - if (!input->pressedStartButton) - return; + if (!input->pressedStartButton) + return; - ScriptContext_SetupScript(EventScript_CancelMessageBox); - LockPlayerFieldControls(); + ScriptContext_SetupScript(EventScript_CancelMessageBox); + LockPlayerFieldControls(); - if (FuncIsActiveTask(Task_OpenStartMenu)) - return; + if (FuncIsActiveTask(Task_OpenStartMenu)) + return; - CreateTask(Task_OpenStartMenu, 8); + CreateTask(Task_OpenStartMenu, 8); } diff --git a/src/field_message_box.c b/src/field_message_box.c index 4f50699a6a..9d07ce24dc 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -41,7 +41,7 @@ static void Task_DrawFieldMessage(u8 taskId) task->tState++; break; case 1: - DrawDialogueFrame(0, TRUE); + DrawDialogueFrame(0, TRUE); task->tState++; break; case 2: diff --git a/src/menu.c b/src/menu.c index c58f72f3e5..441c80250e 100644 --- a/src/menu.c +++ b/src/menu.c @@ -219,116 +219,116 @@ void LoadMessageBoxAndBorderGfx(void) void LoadSignPostWindowFrameGfx(void) { - Menu_LoadStdPal(); + Menu_LoadStdPal(); LoadSignBoxGfx(0, DLG_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(DLG_WINDOW_PALETTE_NUM)); LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(STD_WINDOW_PALETTE_NUM)); } static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { - FillBgTilemapBufferRect(bg, - DLG_WINDOW_BASE_TILE_NUM + 0, - tilemapLeft - 2, - tilemapTop - 1, - 1, - 1, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - DLG_WINDOW_BASE_TILE_NUM + 1, - tilemapLeft - 1, - tilemapTop - 1, - 1, - 1, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - DLG_WINDOW_BASE_TILE_NUM + 2, - tilemapLeft - 2, - tilemapTop, - 1, - 4, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - DLG_WINDOW_BASE_TILE_NUM + 3, - tilemapLeft - 1, - tilemapTop, - 1, - 4, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0), - tilemapLeft - 2, - tilemapTop + 4, - 1, - 1, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1), - tilemapLeft - 1, - tilemapTop + 4, - 1, - 1, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - DLG_WINDOW_BASE_TILE_NUM + 4, - tilemapLeft, - tilemapTop - 1, - 26, - 1, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0), - tilemapLeft + 27, - tilemapTop - 1, - 1, - 1, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1), - tilemapLeft + 26, - tilemapTop - 1, - 1, - 1, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 2), - tilemapLeft + 27, - tilemapTop, - 1, - 4, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 3), - tilemapLeft + 26, - tilemapTop, - 1, - 4, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0)), - tilemapLeft + 27, - tilemapTop + 4, - 1, - 1, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1)), - tilemapLeft + 26, - tilemapTop + 4, - 1, - 1, - DLG_WINDOW_PALETTE_NUM); - FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 4), - tilemapLeft, - tilemapTop + 4, - 26, - 1, - DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 0, + tilemapLeft - 2, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 1, + tilemapLeft - 1, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 2, + tilemapLeft - 2, + tilemapTop, + 1, + 4, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 3, + tilemapLeft - 1, + tilemapTop, + 1, + 4, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0), + tilemapLeft - 2, + tilemapTop + 4, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1), + tilemapLeft - 1, + tilemapTop + 4, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 4, + tilemapLeft, + tilemapTop - 1, + 26, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0), + tilemapLeft + 27, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1), + tilemapLeft + 26, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 2), + tilemapLeft + 27, + tilemapTop, + 1, + 4, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 3), + tilemapLeft + 26, + tilemapTop, + 1, + 4, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0)), + tilemapLeft + 27, + tilemapTop + 4, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1)), + tilemapLeft + 26, + tilemapTop + 4, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 4), + tilemapLeft, + tilemapTop + 4, + 26, + 1, + DLG_WINDOW_PALETTE_NUM); } static inline void *GetWindowFunc_DialogueFrame(void) { - return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); + return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); } void DrawDialogueFrame(u8 windowId, bool8 copyToVram) diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index 1212457d24..fc7e3a9326 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -1411,7 +1411,7 @@ bool32 MetatileBehavior_IsSignpost(u32 mb) #if OW_AUTO_SIGNPOST == TRUE return (mb == MB_SIGNPOST); #else - return FALSE; + return FALSE; #endif } @@ -1420,7 +1420,7 @@ bool32 MetatileBehavior_IsPokemonCenterSign(u32 mb) #if OW_AUTO_SIGNPOST == TRUE return (mb == MB_POKEMON_CENTER_SIGN); #else - return FALSE; + return FALSE; #endif } @@ -1429,7 +1429,7 @@ bool32 MetatileBehavior_IsPokeMartSign(u32 mb) #if OW_AUTO_SIGNPOST == TRUE return (mb == MB_POKEMART_SIGN); #else - return FALSE; + return FALSE; #endif } From 31fc49734a1770d4c27f10efebb58069a15fb23b Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 07:34:33 -0700 Subject: [PATCH 21/52] Removed preproc from src/metatile_behavior.c per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044\#discussion_r1693914236 --- src/metatile_behavior.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index fc7e3a9326..d16194ec2b 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -1408,28 +1408,17 @@ bool8 MetatileBehavior_IsTrainerHillTimer(u8 metatileBehavior) bool32 MetatileBehavior_IsSignpost(u32 mb) { -#if OW_AUTO_SIGNPOST == TRUE return (mb == MB_SIGNPOST); -#else - return FALSE; -#endif } bool32 MetatileBehavior_IsPokemonCenterSign(u32 mb) { -#if OW_AUTO_SIGNPOST == TRUE return (mb == MB_POKEMON_CENTER_SIGN); -#else - return FALSE; -#endif } bool32 MetatileBehavior_IsPokeMartSign(u32 mb) { -#if OW_AUTO_SIGNPOST == TRUE return (mb == MB_POKEMART_SIGN); -#else - return FALSE; #endif } From 1ad3ba1f329604bf575f3c99f13ccfca812c62d3 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 10:58:51 -0700 Subject: [PATCH 22/52] Fixed compilations errors with abgcc --- include/constants/metatile_behaviors.h | 6 ------ src/metatile_behavior.c | 1 - 2 files changed, 7 deletions(-) diff --git a/include/constants/metatile_behaviors.h b/include/constants/metatile_behaviors.h index 7f2bb9df78..780e452531 100755 --- a/include/constants/metatile_behaviors.h +++ b/include/constants/metatile_behaviors.h @@ -30,15 +30,9 @@ #define MB_UNUSED_SOOTOPOLIS_DEEP_WATER_2 0x1A #define MB_STAIRS_OUTSIDE_ABANDONED_SHIP 0x1B #define MB_SHOAL_CAVE_ENTRANCE 0x1C -#if OW_AUTO_SIGNPOST == TRUE #define MB_SIGNPOST 0x1D #define MB_POKEMON_CENTER_SIGN 0x1E #define MB_POKEMART_SIGN 0x1F -#else -#define MB_UNUSED_1D 0x1D -#define MB_UNUSED_1E 0x1E -#define MB_UNUSED_1F 0x1F -#endif #define MB_ICE 0x20 #define MB_SAND 0x21 #define MB_SEAWEED 0x22 diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index d16194ec2b..eb602b9d22 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -1419,6 +1419,5 @@ bool32 MetatileBehavior_IsPokemonCenterSign(u32 mb) bool32 MetatileBehavior_IsPokeMartSign(u32 mb) { return (mb == MB_POKEMART_SIGN); -#endif } From 0a997fa6ca84dbb2c810eb5bcc08f3adcdeb9259 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 14:57:53 -0700 Subject: [PATCH 23/52] Moved follower scripts back to original position https://github.com/rh-hideout/pokeemerald-expansion/pull/5044/files\#r1694003538 --- include/event_scripts.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/event_scripts.h b/include/event_scripts.h index 7ec15d4548..2923ae9331 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -28,9 +28,6 @@ extern const u8 EventScript_FollowerFaceUp[]; extern const u8 EventScript_FollowerFaceResult[]; extern const u8 EnterPokeballMovement[]; -extern const u8 Common_Movement_FollowerSafeStart[]; -extern const u8 Common_Movement_FollowerSafeEnd[]; - extern const u8 EventScript_TestSignpostMsg[]; extern const u8 EventScript_TryGetTrainerScript[]; extern const u8 EventScript_StartTrainerApproach[]; @@ -646,6 +643,10 @@ extern const u8 VSSeeker_Text_BatteryNotChargedNeedXSteps[]; extern const u8 VSSeeker_Text_NoTrainersWithinRange[]; extern const u8 VSSeeker_Text_TrainersNotReady[]; extern const u8 EventScript_VsSeekerChargingDone[]; + +extern const u8 Common_Movement_FollowerSafeStart[]; +extern const u8 Common_Movement_FollowerSafeEnd[]; + extern const u8 EventScript_CancelMessageBox[]; extern const u8 Common_EventScript_ShowPokemonCenterSign[]; extern const u8 Common_EventScript_ShowPokemartSign[]; From d21d23b52ccd50f1961ebe0ac3c5299692da69cb Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 14:59:36 -0700 Subject: [PATCH 24/52] Removed extra spaces per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044/files\#r1694003572 --- src/field_control_avatar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 92e9df1c54..aaeb2a6b14 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -44,7 +44,7 @@ static EWRAM_DATA u16 sPrevMetatileBehavior = 0; u8 gSelectedObjectEvent; -#define NOT_SIGNPOST 0 +#define NOT_SIGNPOST 0 static void GetPlayerPosition(struct MapPosition *); static void GetInFrontOfPlayerPosition(struct MapPosition *); From b66678248364f134e32f07b7608d816c57f0e4cb Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 15:01:33 -0700 Subject: [PATCH 25/52] Nested conditions per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044/files\#r1694003628 --- src/field_control_avatar.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index aaeb2a6b14..244b3d2de8 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -207,9 +207,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) GetInFrontOfPlayerPosition(&position); metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - if (input->heldDirection && input->dpadDirection == playerDirection) - { - if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) + if (input->heldDirection && (input->dpadDirection == playerDirection) && if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE)) return TRUE; } From e360d3bd73184725c66c674648a3734ed2a4f1cf Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 15:02:15 -0700 Subject: [PATCH 26/52] Removed extra newline per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044/files\#r1694003683 --- src/field_control_avatar.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 244b3d2de8..b6d9298c47 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -1127,7 +1127,6 @@ static u32 GetFacingSignpostType(u16 metatileBehavior, u32 playerDirection) return MB_POKEMON_CENTER_SIGN; if (MetatileBehavior_IsPokeMartSign(metatileBehavior) == TRUE) return MB_POKEMART_SIGN; - if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE) return MB_SIGNPOST; From 3c4aaf53f8442adc7aa4240abd6f213d12026f0e Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 15:03:03 -0700 Subject: [PATCH 27/52] Removed unneeded preproc per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044/files\#r1694003941 --- src/metatile_behavior.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index eb602b9d22..8b8c4898f5 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -125,11 +125,9 @@ static const u8 sTileBitAttributes[NUM_METATILE_BEHAVIORS] = [MB_ISOLATED_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED, [MB_VERTICAL_RAIL] = TILE_FLAG_UNUSED, [MB_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED, -#if OW_AUTO_SIGNPOST == TRUE [MB_SIGNPOST] = TILE_FLAG_UNUSED, [MB_POKEMON_CENTER_SIGN] = TILE_FLAG_UNUSED, [MB_POKEMART_SIGN] = TILE_FLAG_UNUSED, -#endif }; bool8 MetatileBehavior_IsATile(u8 metatileBehavior) From fccecf038f697f80efb74040e22b8afd5c350410 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 15:03:45 -0700 Subject: [PATCH 28/52] Removed extra newline per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044/files\#r1694003876 --- src/metatile_behavior.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index 8b8c4898f5..903b0a64eb 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -1418,4 +1418,3 @@ bool32 MetatileBehavior_IsPokeMartSign(u32 mb) { return (mb == MB_POKEMART_SIGN); } - From 4f03ba98bebf4b04908927e82dc0dcc84e5f133d Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 15:05:49 -0700 Subject: [PATCH 29/52] Removed extra newline per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044/files\#r1694004015 --- src/text_window.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/text_window.c b/src/text_window.c index 6c02797fe3..efd087977e 100644 --- a/src/text_window.c +++ b/src/text_window.c @@ -202,4 +202,3 @@ void LoadUserWindowBorderGfxOnBg(u8 bg, u16 destOffset, u8 palOffset) LoadBgTiles(bg, sWindowFrames[gSaveBlock2Ptr->optionsWindowFrameType].tiles, 0x120, destOffset); LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, palOffset, PLTT_SIZE_4BPP); } - From 5bb1730394b81b6e63faa7ad3f6015fd9535080d Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 15:07:50 -0700 Subject: [PATCH 30/52] Fixed if statement compilation --- src/field_control_avatar.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index b6d9298c47..1699a6daa2 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -207,9 +207,8 @@ int ProcessPlayerFieldInput(struct FieldInput *input) GetInFrontOfPlayerPosition(&position); metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - if (input->heldDirection && (input->dpadDirection == playerDirection) && if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE)) + if (input->heldDirection && (input->dpadDirection == playerDirection) && (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE)) return TRUE; - } if (input->pressedAButton && TryStartInteractionScript(&position, metatileBehavior, playerDirection) == TRUE) return TRUE; From 1ac4d195c22070f5026e72727788dac4e18cb53e Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 15:17:32 -0700 Subject: [PATCH 31/52] Changed mb to MetatileBehavior per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044\#discussion_r1694003941 --- src/metatile_behavior.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index 903b0a64eb..8923e633da 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -1404,17 +1404,17 @@ bool8 MetatileBehavior_IsTrainerHillTimer(u8 metatileBehavior) return FALSE; } -bool32 MetatileBehavior_IsSignpost(u32 mb) +bool32 MetatileBehavior_IsSignpost(u32 metatileBehavior) { - return (mb == MB_SIGNPOST); + return (metatileBehavior == MB_SIGNPOST); } -bool32 MetatileBehavior_IsPokemonCenterSign(u32 mb) +bool32 MetatileBehavior_IsPokemonCenterSign(u32 metatileBehavior) { - return (mb == MB_POKEMON_CENTER_SIGN); + return (metatileBehavior == MB_POKEMON_CENTER_SIGN); } -bool32 MetatileBehavior_IsPokeMartSign(u32 mb) +bool32 MetatileBehavior_IsPokeMartSign(u32 metatileBehavior) { - return (mb == MB_POKEMART_SIGN); + return (metatileBehavior == MB_POKEMART_SIGN); } From fb53297e644a069065b433d343724df4553a3d9d Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 15:45:48 -0700 Subject: [PATCH 32/52] Added documentation around OW_AUTO_SIGNPOST --- include/config/overworld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/overworld.h b/include/config/overworld.h index c740bf4853..0dd9afda76 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -3,7 +3,7 @@ // Movement config #define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors. -#define OW_AUTO_SIGNPOST FALSE // When enabled, if the tile that the player is facing has MB_SIGNPOST, MB_POKEMART_SIGN, or MB_POKEMON_CENTER_SIGN, the player will automatically read the signpost. +#define OW_AUTO_SIGNPOST FALSE // When enabled, if the tile that the player is facing has MB_SIGNPOST, MB_POKEMART_SIGN, or MB_POKEMON_CENTER_SIGN, the player will automatically read the signpost, as seen in FRLG. // Other settings #define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. From 91255a6054cd3b1127e17b5f2f1e03dcab366b43 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 27 Jul 2024 15:49:22 -0700 Subject: [PATCH 33/52] Removed mb labels --- include/metatile_behavior.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/metatile_behavior.h b/include/metatile_behavior.h index d49dc2459a..5bb95bc18e 100644 --- a/include/metatile_behavior.h +++ b/include/metatile_behavior.h @@ -148,8 +148,8 @@ bool8 MetatileBehavior_IsQuestionnaire(u8); bool8 MetatileBehavior_IsLongGrass_Duplicate(u8); bool8 MetatileBehavior_IsLongGrassSouthEdge(u8); bool8 MetatileBehavior_IsTrainerHillTimer(u8); -bool32 MetatileBehavior_IsSignpost(u32 mb); -bool32 MetatileBehavior_IsPokemonCenterSign(u32 mb); -bool32 MetatileBehavior_IsPokeMartSign(u32 mb); +bool32 MetatileBehavior_IsSignpost(u32); +bool32 MetatileBehavior_IsPokemonCenterSign(u32); +bool32 MetatileBehavior_IsPokeMartSign(u32); #endif // GUARD_METATILE_BEHAVIOR_H From 0a55a7f40bd8ed14b71e6a8dfbb24da0121d83e4 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sun, 11 Aug 2024 17:29:09 -0700 Subject: [PATCH 34/52] Combined if statements per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044\#discussion_r1712962988 --- src/field_control_avatar.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 1699a6daa2..584c319595 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -183,18 +183,15 @@ int ProcessPlayerFieldInput(struct FieldInput *input) return TRUE; } - if (input->checkStandardWildEncounter) - { - if (input->dpadDirection == 0 || input->dpadDirection == playerDirection) - { - GetInFrontOfPlayerPosition(&position); - metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) - return TRUE; - GetPlayerPosition(&position); - metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - } - } + if ((input->checkStandardWildEncounter) && ((input->dpadDirection == 0) || input->dpadDirection == playerDirection)) + { + GetInFrontOfPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) + return TRUE; + GetPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + } if (input->checkStandardWildEncounter && CheckStandardWildEncounter(metatileBehavior) == TRUE) return TRUE; From cb779498811f9c9a7d48bffd2a434abb2967d37d Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sun, 11 Aug 2024 17:30:59 -0700 Subject: [PATCH 35/52] Fixed identation per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044\#discussion_r1712963035 --- src/field_control_avatar.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 584c319595..c9163c1a7e 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -183,15 +183,15 @@ int ProcessPlayerFieldInput(struct FieldInput *input) return TRUE; } - if ((input->checkStandardWildEncounter) && ((input->dpadDirection == 0) || input->dpadDirection == playerDirection)) - { - GetInFrontOfPlayerPosition(&position); - metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) - return TRUE; - GetPlayerPosition(&position); - metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); - } + if ((input->checkStandardWildEncounter) && ((input->dpadDirection == 0) || input->dpadDirection == playerDirection)) + { + GetInFrontOfPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE) + return TRUE; + GetPlayerPosition(&position); + metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); + } if (input->checkStandardWildEncounter && CheckStandardWildEncounter(metatileBehavior) == TRUE) return TRUE; @@ -205,7 +205,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); if (input->heldDirection && (input->dpadDirection == playerDirection) && (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE)) - return TRUE; + return TRUE; if (input->pressedAButton && TryStartInteractionScript(&position, metatileBehavior, playerDirection) == TRUE) return TRUE; From b39258ebced39d8cf858c8f5551619fa5e5a271f Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sun, 11 Aug 2024 17:36:01 -0700 Subject: [PATCH 36/52] Combined conditions per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044\#discussion_r1712963093 --- src/field_control_avatar.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index c9163c1a7e..40992feae6 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -1093,9 +1093,7 @@ static bool32 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u32 m { const u8 *script; - if (JOY_HELD(DPAD_LEFT | DPAD_RIGHT)) - return FALSE; - if (playerDirection != DIR_NORTH) + if ((JOY_HELD(DPAD_LEFT | DPAD_RIGHT)) || (playerDirection != DIR_NORTH)) return FALSE; switch (GetFacingSignpostType(metatileBehavior, playerDirection)) From 846e8a29daadc96035944250dde9b391e8fe2846 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sun, 11 Aug 2024 17:49:07 -0700 Subject: [PATCH 37/52] Removed IsMsgSignPost per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044\#discussion_r1712963672 --- include/script.h | 4 +++- src/field_message_box.c | 2 +- src/menu.c | 2 +- src/script.c | 9 ++------- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/script.h b/include/script.h index 48d1f6c0ec..fc50c9d424 100644 --- a/include/script.h +++ b/include/script.h @@ -63,10 +63,12 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize); // srccmd.h void SetMovingNpcId(u16 npcId); +extern u8 sMsgIsSignPost; +extern u8 sMsgBoxIsCancelable; + void SetWalkingIntoSignVars(void); void MsgSetSignPost(void); void ResetFacingNpcOrSignPostVars(void); -bool32 IsMsgSignPost(void); bool32 CanWalkAwayToCancelMsgBox(void); void ClearMsgBoxCancelableState(void); diff --git a/src/field_message_box.c b/src/field_message_box.c index 9d07ce24dc..c0fc1004e9 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -32,7 +32,7 @@ static void Task_DrawFieldMessage(u8 taskId) switch (task->tState) { case 0: - if (IsMsgSignPost()) + if (sMsgIsSignPost) LoadSignPostWindowFrameGfx(); else LoadMessageBoxAndBorderGfx(); diff --git a/src/menu.c b/src/menu.c index 441c80250e..20b8c4dd97 100644 --- a/src/menu.c +++ b/src/menu.c @@ -328,7 +328,7 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi static inline void *GetWindowFunc_DialogueFrame(void) { - return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); + return (sMsgIsSignPost ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); } void DrawDialogueFrame(u8 windowId, bool8 copyToVram) diff --git a/src/script.c b/src/script.c index 98d679cd9f..632af41ff4 100644 --- a/src/script.c +++ b/src/script.c @@ -27,8 +27,8 @@ static u8 sGlobalScriptContextStatus; static struct ScriptContext sGlobalScriptContext; static struct ScriptContext sImmediateScriptContext; static bool8 sLockFieldControls; -static u8 sMsgIsSignPost; -static u8 sMsgBoxIsCancelable; +EWRAM_DATA u8 sMsgIsSignPost = FALSE; +EWRAM_DATA u8 sMsgBoxIsCancelable = FALSE; extern ScrCmdFunc gScriptCmdTable[]; extern ScrCmdFunc gScriptCmdTableEnd[]; @@ -513,11 +513,6 @@ void SetWalkingIntoSignVars(void) sMsgBoxIsCancelable = TRUE; } -bool32 IsMsgSignPost(void) -{ - return sMsgIsSignPost; -} - void ResetFacingNpcOrSignPostVars(void) { sMsgIsSignPost = FALSE; From c3c433439e2f5745782b01ef42e6915783dd5655 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sun, 11 Aug 2024 18:01:52 -0700 Subject: [PATCH 38/52] Removed ClearMsgBoxCancelableState per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044\#discussion_r1712963672 --- include/script.h | 3 --- src/field_control_avatar.c | 4 ++-- src/scrcmd.c | 4 ++-- src/script.c | 15 --------------- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/include/script.h b/include/script.h index fc50c9d424..a8e7656d51 100644 --- a/include/script.h +++ b/include/script.h @@ -67,9 +67,6 @@ extern u8 sMsgIsSignPost; extern u8 sMsgBoxIsCancelable; void SetWalkingIntoSignVars(void); -void MsgSetSignPost(void); -void ResetFacingNpcOrSignPostVars(void); bool32 CanWalkAwayToCancelMsgBox(void); -void ClearMsgBoxCancelableState(void); #endif // GUARD_SCRIPT_H diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 40992feae6..6144ca7af0 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -162,7 +162,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) gSpecialVar_LastTalked = 0; gSelectedObjectEvent = 0; - ResetFacingNpcOrSignPostVars(); + sMsgIsSignPost = FALSE; playerDirection = GetPlayerFacingDirection(); GetPlayerPosition(&position); metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); @@ -1130,7 +1130,7 @@ static u32 GetFacingSignpostType(u16 metatileBehavior, u32 playerDirection) static void SetMsgSignPostAndVarFacing(u32 playerDirection) { SetWalkingIntoSignVars(); - MsgSetSignPost(); + sMsgIsSignPost = TRUE; gSpecialVar_Facing = playerDirection; } diff --git a/src/scrcmd.c b/src/scrcmd.c index e1d6202a04..69c9d961b6 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1290,7 +1290,7 @@ bool8 ScrCmd_releaseall(struct ScriptContext *ctx) ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]); ScriptMovement_UnfreezeObjectEvents(); UnfreezeObjectEvents(); - ClearMsgBoxCancelableState(); + sMsgBoxIsCancelable = FALSE; return FALSE; } @@ -1309,7 +1309,7 @@ bool8 ScrCmd_release(struct ScriptContext *ctx) ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]); ScriptMovement_UnfreezeObjectEvents(); UnfreezeObjectEvents(); - ClearMsgBoxCancelableState(); + sMsgBoxIsCancelable = FALSE; return FALSE; } diff --git a/src/script.c b/src/script.c index 632af41ff4..7945b57ea9 100644 --- a/src/script.c +++ b/src/script.c @@ -513,21 +513,6 @@ void SetWalkingIntoSignVars(void) sMsgBoxIsCancelable = TRUE; } -void ResetFacingNpcOrSignPostVars(void) -{ - sMsgIsSignPost = FALSE; -} - -void MsgSetSignPost(void) -{ - sMsgIsSignPost = TRUE; -} - -void ClearMsgBoxCancelableState(void) -{ - sMsgBoxIsCancelable = FALSE; -} - bool32 CanWalkAwayToCancelMsgBox(void) { return sMsgBoxIsCancelable; From 4387b6ef708b88cffbe4660e7df6574cfabd6409 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sun, 11 Aug 2024 18:10:18 -0700 Subject: [PATCH 39/52] Removed SetWalkingIntoSignVars per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044\#discussion_r1712963824 --- include/field_control_avatar.h | 3 +++ include/script.h | 3 --- src/field_control_avatar.c | 9 ++++----- src/script.c | 12 ------------ 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/include/field_control_avatar.h b/include/field_control_avatar.h index cbee293a31..da23fe4336 100644 --- a/include/field_control_avatar.h +++ b/include/field_control_avatar.h @@ -36,4 +36,7 @@ const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position); void ClearPoisonStepCounter(void); void CancelSignPostMessageBox(struct FieldInput *input); +#define NOT_SIGNPOST 0 +#define WALK_AWAY_SIGNPOST_FRAMES 6 + #endif // GUARD_FIELDCONTROLAVATAR_H diff --git a/include/script.h b/include/script.h index a8e7656d51..9c778c395d 100644 --- a/include/script.h +++ b/include/script.h @@ -66,7 +66,4 @@ void SetMovingNpcId(u16 npcId); extern u8 sMsgIsSignPost; extern u8 sMsgBoxIsCancelable; -void SetWalkingIntoSignVars(void); -bool32 CanWalkAwayToCancelMsgBox(void); - #endif // GUARD_SCRIPT_H diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 6144ca7af0..05060825fa 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -44,8 +44,6 @@ static EWRAM_DATA u16 sPrevMetatileBehavior = 0; u8 gSelectedObjectEvent; -#define NOT_SIGNPOST 0 - static void GetPlayerPosition(struct MapPosition *); static void GetInFrontOfPlayerPosition(struct MapPosition *); static u16 GetPlayerCurMetatileBehavior(int); @@ -1129,7 +1127,8 @@ static u32 GetFacingSignpostType(u16 metatileBehavior, u32 playerDirection) static void SetMsgSignPostAndVarFacing(u32 playerDirection) { - SetWalkingIntoSignVars(); + gWalkAwayFromSignpostTimer = WALK_AWAY_SIGNPOST_FRAMES; + sMsgBoxIsCancelable = TRUE; sMsgIsSignPost = TRUE; gSpecialVar_Facing = playerDirection; } @@ -1176,8 +1175,8 @@ void CancelSignPostMessageBox(struct FieldInput *input) return; } - if (!CanWalkAwayToCancelMsgBox()) - return; + if (!sMsgBoxIsCancelable) + return; if (IsDpadPushedToTurnOrMovePlayer(input)) { diff --git a/src/script.c b/src/script.c index 7945b57ea9..276163bbb6 100644 --- a/src/script.c +++ b/src/script.c @@ -505,15 +505,3 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize) #endif //FREE_MYSTERY_EVENT_BUFFERS } -#define WALK_AWAY_SIGNPOST_FRAMES 6 - -void SetWalkingIntoSignVars(void) -{ - gWalkAwayFromSignpostTimer = WALK_AWAY_SIGNPOST_FRAMES; - sMsgBoxIsCancelable = TRUE; -} - -bool32 CanWalkAwayToCancelMsgBox(void) -{ - return sMsgBoxIsCancelable; -} From 30cc06785d5906750fd945fce8a482af2298da02 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Mon, 12 Aug 2024 06:55:33 -0700 Subject: [PATCH 40/52] Fixed global variable naming conventions --- include/script.h | 4 ++-- src/field_control_avatar.c | 8 ++++---- src/field_message_box.c | 2 +- src/menu.c | 2 +- src/scrcmd.c | 4 ++-- src/script.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/script.h b/include/script.h index 9c778c395d..1f3c4f7afb 100644 --- a/include/script.h +++ b/include/script.h @@ -63,7 +63,7 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize); // srccmd.h void SetMovingNpcId(u16 npcId); -extern u8 sMsgIsSignPost; -extern u8 sMsgBoxIsCancelable; +extern u8 gMsgIsSignPost; +extern u8 gMsgBoxIsCancelable; #endif // GUARD_SCRIPT_H diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 05060825fa..b64301e670 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -160,7 +160,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) gSpecialVar_LastTalked = 0; gSelectedObjectEvent = 0; - sMsgIsSignPost = FALSE; + gMsgIsSignPost = FALSE; playerDirection = GetPlayerFacingDirection(); GetPlayerPosition(&position); metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); @@ -1128,8 +1128,8 @@ static u32 GetFacingSignpostType(u16 metatileBehavior, u32 playerDirection) static void SetMsgSignPostAndVarFacing(u32 playerDirection) { gWalkAwayFromSignpostTimer = WALK_AWAY_SIGNPOST_FRAMES; - sMsgBoxIsCancelable = TRUE; - sMsgIsSignPost = TRUE; + gMsgBoxIsCancelable = TRUE; + gMsgIsSignPost = TRUE; gSpecialVar_Facing = playerDirection; } @@ -1175,7 +1175,7 @@ void CancelSignPostMessageBox(struct FieldInput *input) return; } - if (!sMsgBoxIsCancelable) + if (!gMsgBoxIsCancelable) return; if (IsDpadPushedToTurnOrMovePlayer(input)) diff --git a/src/field_message_box.c b/src/field_message_box.c index c0fc1004e9..569f067caa 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -32,7 +32,7 @@ static void Task_DrawFieldMessage(u8 taskId) switch (task->tState) { case 0: - if (sMsgIsSignPost) + if (gMsgIsSignPost) LoadSignPostWindowFrameGfx(); else LoadMessageBoxAndBorderGfx(); diff --git a/src/menu.c b/src/menu.c index 20b8c4dd97..d9b331a8b2 100644 --- a/src/menu.c +++ b/src/menu.c @@ -328,7 +328,7 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi static inline void *GetWindowFunc_DialogueFrame(void) { - return (sMsgIsSignPost ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); + return (gMsgIsSignPost ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame); } void DrawDialogueFrame(u8 windowId, bool8 copyToVram) diff --git a/src/scrcmd.c b/src/scrcmd.c index 69c9d961b6..23b42b7acd 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1290,7 +1290,7 @@ bool8 ScrCmd_releaseall(struct ScriptContext *ctx) ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]); ScriptMovement_UnfreezeObjectEvents(); UnfreezeObjectEvents(); - sMsgBoxIsCancelable = FALSE; + gMsgBoxIsCancelable = FALSE; return FALSE; } @@ -1309,7 +1309,7 @@ bool8 ScrCmd_release(struct ScriptContext *ctx) ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]); ScriptMovement_UnfreezeObjectEvents(); UnfreezeObjectEvents(); - sMsgBoxIsCancelable = FALSE; + gMsgBoxIsCancelable = FALSE; return FALSE; } diff --git a/src/script.c b/src/script.c index 276163bbb6..7b1af3d542 100644 --- a/src/script.c +++ b/src/script.c @@ -27,8 +27,8 @@ static u8 sGlobalScriptContextStatus; static struct ScriptContext sGlobalScriptContext; static struct ScriptContext sImmediateScriptContext; static bool8 sLockFieldControls; -EWRAM_DATA u8 sMsgIsSignPost = FALSE; -EWRAM_DATA u8 sMsgBoxIsCancelable = FALSE; +EWRAM_DATA u8 gMsgIsSignPost = FALSE; +EWRAM_DATA u8 gMsgBoxIsCancelable = FALSE; extern ScrCmdFunc gScriptCmdTable[]; extern ScrCmdFunc gScriptCmdTableEnd[]; From fbea1e7e7eb43c762d0da472620eb36fbfb3dd97 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sat, 14 Sep 2024 08:16:20 +0200 Subject: [PATCH 41/52] Fixes Defog used by the wrong side when there is a Substitue and Screen (#5381) --- src/battle_script_commands.c | 7 ++++++- test/battle/move_effect/defog.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 76c39377a1..bfb7eec56d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8637,6 +8637,10 @@ static void RemoveAllTerrains(void) BattleScriptPushCursor(); \ gBattlescriptCurrInstr = battlescript; \ } \ + else \ + { \ + gBattlerAttacker = saveBattler; \ + } \ return TRUE; \ } \ } @@ -8651,9 +8655,9 @@ static bool32 TryDefogClear(u32 battlerAtk, bool32 clear) struct SideTimer *sideTimer = &gSideTimers[i]; u32 *sideStatuses = &gSideStatuses[i]; - gBattlerAttacker = i; // For correct battle string. Ally's / Foe's if (GetBattlerSide(battlerAtk) != i) { + gBattlerAttacker = i; // For correct battle string. Ally's / Foe's DEFOG_CLEAR(SIDE_STATUS_REFLECT, reflectTimer, BattleScript_SideStatusWoreOffReturn, MOVE_REFLECT); DEFOG_CLEAR(SIDE_STATUS_LIGHTSCREEN, lightscreenTimer, BattleScript_SideStatusWoreOffReturn, MOVE_LIGHT_SCREEN); DEFOG_CLEAR(SIDE_STATUS_MIST, mistTimer, BattleScript_SideStatusWoreOffReturn, MOVE_MIST); @@ -8662,6 +8666,7 @@ static bool32 TryDefogClear(u32 battlerAtk, bool32 clear) } if (B_DEFOG_EFFECT_CLEARING >= GEN_6) { + gBattlerAttacker = i; // For correct battle string. Ally's / Foe's DEFOG_CLEAR(SIDE_STATUS_SPIKES, spikesAmount, BattleScript_SpikesDefog, 0); DEFOG_CLEAR(SIDE_STATUS_STEALTH_ROCK, stealthRockAmount, BattleScript_StealthRockDefog, 0); DEFOG_CLEAR(SIDE_STATUS_TOXIC_SPIKES, toxicSpikesAmount, BattleScript_ToxicSpikesDefog, 0); diff --git a/test/battle/move_effect/defog.c b/test/battle/move_effect/defog.c index 80d500d2ee..ab6d647a97 100644 --- a/test/battle/move_effect/defog.c +++ b/test/battle/move_effect/defog.c @@ -383,3 +383,21 @@ DOUBLE_BATTLE_TEST("Defog lowers evasiveness by 1 and removes everything it can" } } } + +SINGLE_BATTLE_TEST("Defog is used on the correct side if opposing mon is behind a substitute with Screen up") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_LIGHT_SCREEN); } + TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_DEFOG); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_LIGHT_SCREEN, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, opponent); + MESSAGE("Wobbuffet used Defog!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_DEFOG, player); + MESSAGE("Foe Wobbuffet's evasiveness fell!"); + MESSAGE("Foe's Light Screen wore off!"); + } +} From f6319d8446616e22450f45d28fa2b0f9b3ff83b7 Mon Sep 17 00:00:00 2001 From: Sadfish the Sad Date: Sun, 15 Sep 2024 02:22:40 -0400 Subject: [PATCH 42/52] new animations for many moves more details in description (#5367) New: Me First, Zippy Zap, Splishy Splash, Floaty Fall, Pika Papow, Bouncy Bubble, Buzzy Buzz, Sizzly Slide, Glitzy Glow, Baddy Bad, Sappy Seed, Freezy Frost, Sparkly Swirl, Veevee Volley, Snap Trap, Astral Barrage, Burning Bulwark Updated: Aura Sphere, Dark Void, Spirit Shackle Fixed: Springtide Storm, Bleakwind Storm, Wildbolt Storm, Sandsear Storm, Clangorous Soul(Blaze) --- data/battle_anim_scripts.s | 572 ++++++++++++++++-- .../sprites/spirit_shackle_arrow.png | Bin 236 -> 341 bytes include/battle_anim.h | 3 + src/battle_anim_bug.c | 3 +- src/battle_anim_effects_1.c | 4 +- src/battle_anim_effects_3.c | 11 + src/battle_anim_fight.c | 6 +- src/battle_anim_flying.c | 5 +- src/battle_anim_mon_movement.c | 16 +- src/battle_anim_new.c | 79 ++- src/battle_anim_rock.c | 31 +- 11 files changed, 607 insertions(+), 123 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 296de004ac..14f9a3f592 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -691,6 +691,32 @@ gBattleAnimMove_LuckyChant:: end gBattleAnimMove_MeFirst:: + loadspritegfx ANIM_TAG_ORBS + loadspritegfx ANIM_TAG_FINGER + loadspritegfx ANIM_TAG_THOUGHT_BUBBLE + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_ORBS, 0, 12, 12, 0x7FAF + setalpha 11, 5 + monbg_static ANIM_DEF_PARTNER + splitbgprio_all + createsprite gThoughtBubbleSpriteTemplate, ANIM_ATTACKER, 11, 0, 100 + playsewithpan SE_M_METRONOME, SOUND_PAN_ATTACKER + delay 6 + createsprite gMetronomeFingerSpriteTemplate, ANIM_ATTACKER, 12, 0 + delay 24 + loopsewithpan SE_M_TAIL_WHIP, SOUND_PAN_ATTACKER, 22, 3 + waitforvisualfinish + panse SE_M_MINIMIZE, SOUND_PAN_TARGET, SOUND_PAN_ATTACKER, -3, 0 + createvisualtask AnimTask_ShrinkTargetCopy, 5, 128, 24 + delay 15 + createsprite gMimicOrbSpriteTemplate, ANIM_TARGET, 2, -12, 24 + delay 10 + setarg 7, 0xFFFF + waitforvisualfinish + playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 11, RGB_WHITE + waitforvisualfinish + clearmonbg_static ANIM_DEF_PARTNER + blendoff end gBattleAnimMove_Copycat:: @@ -1092,8 +1118,8 @@ gBattleAnimMove_ForcePalm:: end gBattleAnimMove_AuraSphere:: - loadspritegfx ANIM_TAG_METEOR - loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT + loadspritegfx ANIM_TAG_IMPACT_2 + loadspritegfx ANIM_TAG_LEER monbg ANIM_ATK_PARTNER splitbgprio ANIM_ATTACKER setalpha 12, 8 @@ -3600,17 +3626,18 @@ gBattleAnimMove_DarkVoid:: waitbgfadein createvisualtask AnimTask_DestinyBondWhiteShadow, 5, 0, 0x30 loopsewithpan SE_M_CONFUSE_RAY, SOUND_PAN_ATTACKER, 5, 2 - delay 0x30 - createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0xfd00, 0x15, 0, 0x70 @Last is speed - createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_DEF_PARTNER, 0xfd00, 0x15, 0, 0x70 @Last is speed - delay 0x40 + delay 48 + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, -768, 21, 0, 112 @Last is duration + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_DEF_PARTNER, -768, 21, 0, 112 @Last is duration + delay 64 invisible ANIM_TARGET invisible ANIM_DEF_PARTNER - createsprite gDarkVoidPurpleStarsTemplate, ANIM_ATTACKER, 2, 0, 0, 1, 0, 0x20, 0x3c + createsprite gDarkVoidPurpleStarsTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 0, 32, 60 + createsprite gDarkVoidPurpleStarsTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_DEF_PARTNER, 0, 32, 60 waitforvisualfinish createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0, 16 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_DEF_PARTNER, 0, 16 - delay 0x20 + delay 32 call UnsetPsychicBg visible ANIM_TARGET visible ANIM_DEF_PARTNER @@ -9827,27 +9854,25 @@ gBattleAnimMove_BanefulBunker:: gBattleAnimMove_SpiritShackle:: loadspritegfx ANIM_TAG_SPIRIT_ARROW @Arrow - loadspritegfx ANIM_TAG_CHAIN_LINK @Chain - monbg ANIM_DEF_PARTNER - splitbgprio ANIM_TARGET - setalpha 12, 8 - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x10, 0x0 - waitforvisualfinish + loadspritegfx ANIM_TAG_PURPLE_CHAIN + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_PURPLE_CHAIN, 0, 9, 9, RGB_BLACK + monbg ANIM_TARGET playsewithpan SE_M_RAZOR_WIND2, SOUND_PAN_ATTACKER - createsprite gSpiritShackleArrowTemplate, ANIM_TARGET, 2, 0x10, 0x0, 0x0, 0x0, 0xf - delay 0x8 + createsprite gSpiritShackleArrowTemplate, ANIM_TARGET, 2, 16, 0, 0, 0, 15 + delay 8 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 10, 1 waitforvisualfinish - loopsewithpan SE_SHINY, SOUND_PAN_ATTACKER, 0x1c, 0x2 - createsprite gSpiritShackleChainTemplate, ANIM_TARGET, 2, 0xfff0, 0xfff0 - delay 0x4 - createsprite gSpiritShackleChainTemplate, ANIM_TARGET, 2, 0xfff0, 0x0 - delay 0x4 - createsprite gSpiritShackleChainTemplate, ANIM_TARGET, 2, 0xfff0, 0x10 + loopsewithpan SE_M_SCRATCH, SOUND_PAN_TARGET, 6, 2 + createsprite gChainBindingSpriteTemplate, ANIM_TARGET, 4, 0, 16, 0, 1 + delay 7 + createsprite gChainBindingSpriteTemplate, ANIM_TARGET, 2, 0, 8, 1, 1 + delay 3 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 8, 1 + delay 20 + setarg 7, 0xFFFF + playsewithpan SE_M_BIND, SOUND_PAN_TARGET waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x10, 0x0, 0x0 - waitforvisualfinish - clearmonbg ANIM_DEF_PARTNER + clearmonbg ANIM_TARGET blendoff end @@ -12621,43 +12646,385 @@ PhotonGeyserBeam: return gBattleAnimMove_ZippyZap:: - end @to do: + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT + loadspritegfx ANIM_TAG_SPARK_2 + monbg ANIM_ATK_PARTNER + setalpha 12, 8 + playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER + createsprite gGrowingShockWaveOrbSpriteTemplate, ANIM_ATTACKER, 2 @electric circle + waitforvisualfinish + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 24, 6, 1, 5 + createvisualtask AnimTask_TraceMonBlended, 2, 0, 4, 7, 3 + playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER + delay 4 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, 0, 0, ANIM_TARGET, 1 + call ElectricityEffect + playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET + waitforvisualfinish + clearmonbg ANIM_ATK_PARTNER + blendoff + waitforvisualfinish + end gBattleAnimMove_SplishySplash:: - end @to do: + loadspritegfx ANIM_TAG_SPARK_2 + createvisualtask AnimTask_CreateSurfWave, 2, ANIM_SURF_PAL_SURF + delay 24 + panse SE_M_SURF, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 + waitforvisualfinish + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 10, 1 + call ElectricityEffect + end gBattleAnimMove_FloatyFall:: - end @to do: + loadspritegfx ANIM_TAG_ROUND_SHADOW + loadspritegfx ANIM_TAG_IMPACT + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_ROUND_SHADOW, 0, 12, 12, RGB_YELLOW + monbg ANIM_DEF_PARTNER + setalpha 12, 8 + playsewithpan SE_M_FLY, SOUND_PAN_ATTACKER + createsprite gFlyBallUpSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 13, 336 + waitforvisualfinish + playsewithpan SE_M_DOUBLE_TEAM, SOUND_PAN_ATTACKER + createsprite gFlyBallAttackSpriteTemplate, ANIM_ATTACKER, 2, 20, FALSE + delay 20 + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 0 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 6, 0, 8, 1 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + blendoff + waitforvisualfinish + end gBattleAnimMove_PikaPapow:: - end @to do: + createvisualtask AnimTask_GetReturnPowerLevel, 2 + delay 2 + jumpreteq 0, gBattleAnimMove_ThunderShock + jumpreteq 1, gBattleAnimMove_ShockWave + jumpreteq 2, gBattleAnimMove_Thunderbolt + jumpreteq 3, gBattleAnimMove_Thunder gBattleAnimMove_BouncyBubble:: - end @to do: + loadspritegfx ANIM_TAG_BUBBLE + loadspritegfx ANIM_TAG_SMALL_BUBBLES + loadspritegfx ANIM_TAG_ORBS + loadspritegfx ANIM_TAG_BLUE_STAR + loadspritegfx ANIM_TAG_IMPACT + monbg ANIM_TARGET + splitbgprio ANIM_TARGET + setalpha 12, 8 + delay 1 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 12, RGB(13, 12, 31) + waitforvisualfinish + playsewithpan SE_M_ABSORB, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 0 + delay 2 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 5, 1 + waitforvisualfinish + call WaterBubblesEffectLong + call GigaDrainAbsorbEffect + waitforvisualfinish + delay 15 + call HealingEffect + waitforvisualfinish + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 12, 0, RGB(13, 12, 31) + waitforvisualfinish + clearmonbg ANIM_TARGET + blendoff + end gBattleAnimMove_BuzzyBuzz:: - end @to do: + loadspritegfx ANIM_TAG_ELECTRIC_ORBS + loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT + loadspritegfx ANIM_TAG_SPARK + loadspritegfx ANIM_TAG_LIGHTNING + loadspritegfx ANIM_TAG_SHOCK_3 + loadspritegfx ANIM_TAG_SPARK_2 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 0, 6, RGB_BLACK + waitforvisualfinish + createsprite gSpriteTemplate_SpiritBreakChargeBall, ANIM_TARGET, 1, ANIM_TARGET + delay 10 + createvisualtask AnimTask_ElectricBolt, 5, 24, -52, 0 + playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_TARGET + delay 7 + createvisualtask AnimTask_ElectricBolt, 5, -24, -52, 0 + playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_TARGET + delay 7 + createvisualtask AnimTask_ElectricBolt, 5, 0, -60, 1 + playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_TARGET + delay 9 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 0, 13, RGB_BLACK + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 13, 0, RGB_BLACK + waitforvisualfinish + delay 20 + waitplaysewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET, 19 + call ElectricityEffect + waitforvisualfinish + delay 20 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 0, RGB_BLACK + waitforvisualfinish + end gBattleAnimMove_SizzlySlide:: - end @to do: + loadspritegfx ANIM_TAG_SMALL_EMBER + loadspritegfx ANIM_TAG_IMPACT + monbg ANIM_ATK_PARTNER + setalpha 12, 8 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 0 + playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 4 + playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 8 + playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 12 + playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 16 + playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 20 + playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 24 + playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER + waitforvisualfinish + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 24, 6, 1, 5 + createvisualtask AnimTask_TraceMonBlended, 2, 0, 4, 7, 3 + playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER + delay 4 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, 0, 0, ANIM_TARGET, 1 + createvisualtask AnimTask_BlendMonInAndOut, 3, ANIM_TARGET, RGB_RED, 12, 1, 1 + playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_TARGET + call FireSpreadEffect + delay 7 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 9 + waitforvisualfinish + clearmonbg ANIM_ATK_PARTNER + end gBattleAnimMove_GlitzyGlow:: - end @to do: + loadspritegfx ANIM_TAG_THIN_RING @hypervoice ring + loadspritegfx ANIM_TAG_SPARK_2 @yellow color + loadspritegfx ANIM_TAG_WATER_ORB @blue color + loadspritegfx ANIM_TAG_POISON_BUBBLE @violet color + loadspritegfx ANIM_TAG_SMALL_EMBER @flame wheel particle + loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_CIRCLE_OF_LIGHT, 0, 12, 12, 0x289F + monbg ANIM_DEF_PARTNER + splitbgprio_foes ANIM_TARGET + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 1, 0, 12, 0 @Darken + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsprite gGrowingShockWaveOrbSpriteTemplate, ANIM_ATTACKER, 0, 0 + delay 18 + panse SE_M_SCREECH, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 0 + createsprite gSynchronoiseVioletRingTemplate, ANIM_ATTACKER, 0, 25, 0, 0, 0, 0, 0, 1 + delay 1 + createsprite gSynchronoiseBlueRingTemplate, ANIM_ATTACKER, 0, 25, 0, 0, 0, 0, 0, 1 + delay 1 + createsprite gSynchronoiseYellowRingTemplate, ANIM_ATTACKER, 0, 25, 0, 0, 0, 0, 0, 1 + delay 36 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 6, 1 + createvisualtask AnimTask_ShakeBattleTerrain, 2, 1, 0, 6, 1 + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 1, 12, 0, 0 @Darken + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + blendoff + delay 1 + unloadspritegfx ANIM_TAG_THIN_RING @hypervoice ring + unloadspritegfx ANIM_TAG_SPARK_2 @yellow color + unloadspritegfx ANIM_TAG_WATER_ORB @blue color + unloadspritegfx ANIM_TAG_POISON_BUBBLE @violet color + unloadspritegfx ANIM_TAG_SMALL_EMBER @flame wheel particle + unloadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT + waitforvisualfinish + goto gBattleAnimMove_LightScreen gBattleAnimMove_BaddyBad:: - end @to do: + loadspritegfx ANIM_TAG_STRAIGHT_BEAM + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_STRAIGHT_BEAM, 0, 14, 14, RGB_BLACK + monbg ANIM_ATTACKER + splitbgprio ANIM_ATTACKER + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + fadetobg BG_DARK + waitbgfadein + delay 10 + playsewithpan SE_M_LEER, SOUND_PAN_ATTACKER + createvisualtask AnimTask_NightShadeClone, 5, 133 + delay 10 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 6, 0, 16, RGB_BLACK + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 4, 0, 96, 1 + panse SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 0 + call PhotonGeyserBeam + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 1, 16, 0, RGB_BLACK + waitforvisualfinish + delay 1 + restorebg + waitbgfadein + waitforvisualfinish + clearmonbg ANIM_ATTACKER + unloadspritegfx ANIM_TAG_STRAIGHT_BEAM + waitforvisualfinish + goto gBattleAnimMove_Reflect gBattleAnimMove_SappySeed:: - end @to do: + loadspritegfx ANIM_TAG_SPROUT + loadspritegfx ANIM_TAG_SEED + playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 4, 0, 40, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 20, ANIM_TARGET, 1 + delay 2 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 20, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 10, ANIM_TARGET, 1 + delay 2 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 20, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 10, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 1 + delay 2 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 20, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 10, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -10, ANIM_TARGET, 1 + delay 2 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 20, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 10, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -10, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -20, ANIM_TARGET, 1 + delay 2 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 20, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 10, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -10, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -20, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -30, ANIM_TARGET, 1 + delay 2 + call FullBeanstalk + call FallingSeeds + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + call FullBeanstalk + waitforvisualfinish + end +FullBeanstalk: + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 20, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 10, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -10, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -20, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -30, ANIM_TARGET, 1 + createsprite gSproutGrowSpriteTemplate, ANIM_ATTACKER, 3, 0, -40, ANIM_TARGET, 1 + delay 2 + return +FallingSeeds: + createsprite gFallingSeedSpriteTemplate, ANIM_TARGET, 2, -20, 0, -10, 0 + playsewithpan SE_M_POISON_POWDER, SOUND_PAN_TARGET + createsprite gFallingSeedSpriteTemplate, ANIM_TARGET, 2, 28, 0, 10, 0 + playsewithpan SE_M_POISON_POWDER, SOUND_PAN_TARGET + createsprite gFallingSeedSpriteTemplate, ANIM_TARGET, 2, -10, 0, -5, 0 + playsewithpan SE_M_POISON_POWDER, SOUND_PAN_TARGET + createsprite gFallingSeedSpriteTemplate, ANIM_TARGET, 2, 10, 0, 6, 0 + playsewithpan SE_M_POISON_POWDER, SOUND_PAN_TARGET + createsprite gFallingSeedSpriteTemplate, ANIM_TARGET, 2, 24, 0, 10, 0 + playsewithpan SE_M_POISON_POWDER, SOUND_PAN_TARGET + createsprite gFallingSeedSpriteTemplate, ANIM_TARGET, 2, -32, 0, -10, 0 + playsewithpan SE_M_POISON_POWDER, SOUND_PAN_TARGET + createsprite gFallingSeedSpriteTemplate, ANIM_TARGET, 2, -20, 0, -10, 0 + playsewithpan SE_M_POISON_POWDER, SOUND_PAN_TARGET + createsprite gFallingSeedSpriteTemplate, ANIM_TARGET, 2, 30, 0, 10, 0 + playsewithpan SE_M_POISON_POWDER, SOUND_PAN_TARGET + return gBattleAnimMove_FreezyFrost:: - end @to do: + loadspritegfx ANIM_TAG_ICICLE_SPEAR + loadspritegfx ANIM_TAG_ICE_SPIKES + loadspritegfx ANIM_TAG_IMPACT + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_ICICLE_SPEAR, 0, 0, 12, RGB_BLACK + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_ICE_SPIKES, 0, 0, 12, RGB_BLACK + waitforvisualfinish + call FreezyFrostHitEffect + call FreezyFrostHitEffect + call FreezyFrostHitEffect + call FreezyFrostHitEffect + waitforvisualfinish + call IceSpikesEffectLong + waitforvisualfinish + end +FreezyFrostHitEffect: + createsprite gFreezyFrostRisingSpearSpriteTemplate ANIM_TARGET, 2, ANIM_TARGET, -4, 16 + playsewithpan SE_M_ROCK_THROW SOUND_PAN_TARGET + delay 1 + createsprite gFreezyFrostRisingSpearSpriteTemplate ANIM_TARGET, 2, ANIM_TARGET, 4109, 16 + playsewithpan SE_M_ROCK_THROW SOUND_PAN_TARGET + delay 1 + createsprite gFreezyFrostRisingSpearSpriteTemplate ANIM_TARGET, 2, ANIM_TARGET, 4, 16 + playsewithpan SE_M_ROCK_THROW SOUND_PAN_TARGET + delay 1 + createsprite gFreezyFrostRisingSpearSpriteTemplate ANIM_TARGET, 2, ANIM_TARGET, -16, 16 + playsewithpan SE_M_ROCK_THROW SOUND_PAN_TARGET + delay 1 + return gBattleAnimMove_SparklySwirl:: - end @to do: + loadspritegfx ANIM_TAG_GUST + loadspritegfx ANIM_TAG_PINK_PETAL + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_GUST, 0, 15, 15, RGB(31, 21, 21) + monbg ANIM_DEF_PARTNER + splitbgprio ANIM_TARGET + playsewithpan SE_M_GUST, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 47, 1 + call HurricaneGust + call PinkPetalVortex + call HurricaneGust + call PinkPetalVortex + call HurricaneGust + call PinkPetalVortex + waitforvisualfinish + stopsound + clearmonbg ANIM_TARGET + end +PinkPetalVortex: + createsprite gPinkPetalVortexTemplate, ANIM_TARGET, 2, 0, 28, 528, 30, 13, 50, 1 + delay 2 + createsprite gPinkPetalVortexTemplate, ANIM_TARGET, 2, 0, 32, 480, 20, 16, -46, 1 + delay 2 + createsprite gPinkPetalVortexTemplate, ANIM_TARGET, 2, 0, 33, 576, 20, 8, 42, 1 + delay 2 + createsprite gPinkPetalVortexTemplate, ANIM_TARGET, 2, 0, 31, 400, 25, 11, -42, 1 + delay 2 + createsprite gPinkPetalVortexTemplate, ANIM_TARGET, 2, 0, 28, 512, 25, 16, 46, 1 + delay 2 + createsprite gPinkPetalVortexTemplate, ANIM_TARGET, 2, 0, 33, 464, 30, 15, -50, 1 + delay 2 + return gBattleAnimMove_VeeveeVolley:: - end @to do: + createvisualtask AnimTask_GetReturnPowerLevel, 2 + delay 2 + jumpreteq 0, gBattleAnimMove_Tackle + jumpreteq 1, gBattleAnimMove_Headbutt + jumpreteq 2, gBattleAnimMove_TakeDown + jumpreteq 3, gBattleAnimMove_DoubleEdge gBattleAnimMove_DoubleIronBash:: loadspritegfx ANIM_TAG_GUST @@ -13004,6 +13371,9 @@ gBattleAnimMove_ClangorousSoul:: createsprite gClangorousSoulRedFistTemplate, ANIM_ATTACKER, 2, 0x10, 0, 0, 0, 10, ANIM_ATTACKER, ANIM_LEFT_FIST, 1 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish + unloadspritegfx ANIM_TAG_HORSESHOE_SIDE_FIST + unloadspritegfx ANIM_TAG_SPARKLE_2 @stars + waitforvisualfinish loadspritegfx ANIM_TAG_THIN_RING @ring playsewithpan SE_SHINY, SOUND_PAN_ATTACKER createsprite gClangorousSoulRedRingTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x0, 0x0 @@ -13104,8 +13474,31 @@ gBattleAnimMove_DrumBeating:: blendoff end -gBattleAnimMove_SnapTrap:: @ placeholder - goto gBattleAnimMove_Bite +gBattleAnimMove_SnapTrap:: + loadspritegfx ANIM_TAG_LEAF @leaves + loadspritegfx ANIM_TAG_FLOWER @flowers + loadspritegfx ANIM_TAG_SHARP_TEETH + loadspritegfx ANIM_TAG_IMPACT + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_SHARP_TEETH, 0, 10, 10, 0x0688 + monbg ANIM_TARGET + setalpha 12, 8 + playsewithpan SE_M_BITE, SOUND_PAN_TARGET + createsprite gSharpTeethSpriteTemplate, ANIM_ATTACKER, 2, 0, -32, 0, 0, 819, 10 + createsprite gSharpTeethSpriteTemplate, ANIM_ATTACKER, 2, 0, 32, 4, 0, -819, 10 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 6, 1 + playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET + delay 10 + playsewithpan SE_M_RAZOR_WIND2, SOUND_PAN_ATTACKER + createsprite gTropKickLeavesTemplate, ANIM_TARGET, 1, 0, 10, 192, 176, 40 + createsprite gTropKickLeavesTemplate, ANIM_TARGET, 1, 0, 10, -192, 240, 40 + createsprite gTropKickLeavesTemplate, ANIM_TARGET, 1, 0, 10, 192, -160, 40 + createsprite gTropKickLeavesTemplate, ANIM_TARGET, 1, 0, 10, -192, -112, 40 + createsprite gTropKickLeavesTemplate, ANIM_TARGET, 1, 0, 10, 160, 48, 40 + createsprite gTropKickLeavesTemplate, ANIM_TARGET, 1, 0, 10, -224, -32, 40 + createsprite gTropKickLeavesTemplate, ANIM_TARGET, 1, 0, 10, 112, -128, 40 + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + end gBattleAnimMove_PyroBall:: loadspritegfx ANIM_TAG_FLAT_ROCK @@ -14848,7 +15241,44 @@ gBattleAnimMove_GlacialLance:: gBattleAnimMove_AstralBarrage:: - goto gBattleAnimMove_ShadowBall + loadspritegfx ANIM_TAG_FLAT_ROCK + loadspritegfx ANIM_TAG_ICE_CRYSTALS + loadspritegfx ANIM_TAG_GHOSTLY_SPIRIT + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_FLAT_ROCK, 0x0, 0xA, 0xA, RGB(2, 1, 4) + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_ICE_CRYSTALS, 0x0, 0xA, 0xA, RGB(2, 1, 4) + monbg ANIM_ATK_PARTNER + splitbgprio ANIM_ATTACKER + setalpha 12, 8 + fadetobg BG_GHOST + waitbgfadein + createsprite gShakeMonOrTerrainSpriteTemplate, ANIM_ATTACKER, 2, 4, 1, 180, 1 + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 20, 0, 5 + createsprite gSuperpowerRockSpriteTemplate, ANIM_ATTACKER, 41, 200, 96, 1, 120 + delay 8 + createsprite gSuperpowerRockSpriteTemplate, ANIM_ATTACKER, 41, 20, 248, 4, 112 + delay 8 + createsprite gSuperpowerRockSpriteTemplate, ANIM_ATTACKER, 41, 130, 160, 2, 104 + delay 8 + createsprite gSuperpowerRockSpriteTemplate, ANIM_ATTACKER, 41, 160, 192, 0, 96 + delay 8 + createsprite gSuperpowerRockSpriteTemplate, ANIM_ATTACKER, 41, 60, 288, 3, 88 + delay 74 + panse SE_M_BLIZZARD, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 + call BlizzardIceCrystals + call BlizzardIceCrystals + playsewithpan SE_M_BLIZZARD2, SOUND_PAN_TARGET + waitforvisualfinish + playsewithpan SE_M_NIGHTMARE, SOUND_PAN_TARGET + createspriteontargets gCurseGhostSpriteTemplate, ANIM_TARGET, 3, 2, 8, -5, ANIM_TARGET, 0 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 8, 0, 16, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 8, 0, 16, 1 + waitforvisualfinish + clearmonbg ANIM_ATK_PARTNER + restorebg + waitbgfadein + blendoff + delay 1 + end @Credits to Skeli @@ -14995,8 +15425,9 @@ gBattleAnimMove_SpringtideStorm:: loadspritegfx ANIM_TAG_GUST loadspritegfx ANIM_TAG_RED_HEART playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtaskontargets AnimTask_ShakeMon2, 2, 0, ANIM_TARGET, 0, 4, 0x58, 1 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_TARGET, 0x2, 0x6, 0x0, 0xB, 0x7ADF + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 88, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 1, 0, 88, 1 + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_TARGET | F_PAL_DEF_PARTNER), 2, 6, 0, 11, 0x7ADF call HurricaneGustCentered call SpringtideStormHeartSwirl call HurricaneGustCentered @@ -15565,8 +15996,9 @@ gBattleAnimMove_BleakwindStorm:: loadspritegfx ANIM_TAG_GUST loadspritegfx ANIM_TAG_ICE_CRYSTALS playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtaskontargets AnimTask_ShakeMon2, 2, 0, ANIM_TARGET, 0, 4, 0x58, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x7FFF + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 88, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 1, 0, 88, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 10, (F_PAL_TARGET | F_PAL_DEF_PARTNER), 4, 0, 11, 0x7FFF call HurricaneGustCentered call BleakwindStormIceSwirl call HurricaneGustCentered @@ -15581,7 +16013,7 @@ gBattleAnimMove_BleakwindStorm:: call BleakwindStormIceSwirl waitforvisualfinish stopsound - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x7FFF + createvisualtask AnimTask_BlendBattleAnimPal, 10, (F_PAL_TARGET | F_PAL_DEF_PARTNER), 1, 11, 0, 0x7FFF waitforvisualfinish end BleakwindStormIceSwirl: @@ -15605,11 +16037,12 @@ gBattleAnimMove_WildboltStorm:: loadspritegfx ANIM_TAG_SPARK_2 fadetobg BG_MAX_LIGHTNING waitbgfadeout - createvisualtask AnimTask_StartSlidingBg, 0x5, 0xff00, 0x0, 0x1, 0xffff + createvisualtask AnimTask_StartSlidingBg, 5, -256, 0, 1, 0xffff waitbgfadein playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtaskontargets AnimTask_ShakeMon2, 2, 0, ANIM_TARGET, 0, 4, 0x58, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x07FE + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 88, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 1, 0, 88, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 10, (F_PAL_TARGET | F_PAL_DEF_PARTNER), 4, 0, 11, 0x07FE call HurricaneGustCentered call WildboltStormSparkSwirl call HurricaneGustCentered @@ -15624,7 +16057,7 @@ gBattleAnimMove_WildboltStorm:: call WildboltStormSparkSwirl waitforvisualfinish stopsound - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x07FE + createvisualtask AnimTask_BlendBattleAnimPal, 10, (F_PAL_TARGET | F_PAL_DEF_PARTNER), 1, 11, 0, 0x07FE call UnsetPsychicBg waitforvisualfinish end @@ -15650,8 +16083,9 @@ gBattleAnimMove_SandsearStorm:: loadspritegfx ANIM_TAG_SMALL_EMBER createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_GUST, 0x0, 0xA, 0xA, 0x190B playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtaskontargets AnimTask_ShakeMon2, 2, 0, ANIM_TARGET, 0, 4, 0x58, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x1F + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 88, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 1, 0, 88, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 10, (F_PAL_TARGET | F_PAL_DEF_PARTNER), 4, 0, 11, 0x1F call HurricaneGustCentered call SandsearStormFireSpin call HurricaneGustCentered @@ -15666,7 +16100,7 @@ gBattleAnimMove_SandsearStorm:: call SandsearStormFireSpin waitforvisualfinish stopsound - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x1F + createvisualtask AnimTask_BlendBattleAnimPal, 10, (F_PAL_TARGET | F_PAL_DEF_PARTNER), 1, 11, 0, 0x1F waitforvisualfinish end @@ -15997,7 +16431,30 @@ ChillyReceptionSnowballs: return gBattleAnimMove_BurningBulwark:: - goto gBattleAnimMove_Protect + loadspritegfx ANIM_TAG_PROTECT @protect + loadspritegfx ANIM_TAG_SMALL_EMBER @fire + monbg ANIM_ATK_PARTNER + splitbgprio ANIM_ATTACKER + waitplaysewithpan SE_M_REFLECT, SOUND_PAN_ATTACKER 16 + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_PROTECT, 0, 13, 13, 0x015B + createsprite gProtectSpriteTemplate, ANIM_ATTACKER, 2, 24, 0, 90 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 0 + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 4 + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 8 + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 12 + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 16 + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 20 + delay 2 + createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 56, 24 + createvisualtask AnimTask_BlendMonInAndOut, 3, ANIM_ATTACKER, RGB_RED, 10, 0, 2 + waitforvisualfinish + clearmonbg ANIM_ATK_PARTNER + end gBattleAnimMove_AlluringVoice:: loadspritegfx ANIM_TAG_THIN_RING @@ -27667,8 +28124,8 @@ Status_Thunder_Cage: @ TODO goto gBattleAnimMove_ThunderCage -Status_Snap_Trap: @ placeholder - goto gBattleAnimMove_Bite +Status_Snap_Trap: + goto gBattleAnimMove_SnapTrap Status_SandTomb: loadspritegfx ANIM_TAG_MUD_SAND @@ -33004,6 +33461,9 @@ gBattleAnimMove_ClangorousSoulblaze:: createsprite gClangorousSoulRedFistTemplate, ANIM_ATTACKER, 2, 0x10, 0x0, 0x0, 0x0, 0xa, ANIM_ATTACKER, ANIM_LEFT_FIST, 0x1 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish + unloadspritegfx ANIM_TAG_HORSESHOE_SIDE_FIST + unloadspritegfx ANIM_TAG_SPARKLE_2 @stars + waitforvisualfinish loadspritegfx ANIM_TAG_THIN_RING @ring playsewithpan SE_SHINY, SOUND_PAN_ATTACKER createsprite gClangorousSoulRedRingTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x0, 0x0 diff --git a/graphics/battle_anims/sprites/spirit_shackle_arrow.png b/graphics/battle_anims/sprites/spirit_shackle_arrow.png index ff86f33d21cd4f83c7f7419eeb578c540ef8a41c..cc520e6b5d5ee4dcee9822c660335933ce2823b4 100644 GIT binary patch delta 301 zcmaFEc$H~_N`sf3r=1Ueo4brGY19+2JsTth?3y^w370~qErTVAC~|>cZIUl zA_ZeTlfu>|4}nTJN(%hkfilKGHiK7#raX{hNq6*hWMJ6X&;2Kn705RT@CkAK|Nnon zmc)`JOaAv|olWry3JRLjtoi?5^S!-EAgv4&-301)N^ukenT$!^?k@kAvVS@XxH6+Io;h1!ZR!y3Yq+_aqY)8Z`3vjPR`>S1C5#JFUj8a%kk^oV_FH}*$V&{Ku6{1-oD!MK`G1mcNgc!giEjVv)%W`{-~zw)=gkJnm3z84 zhE&W+PFTP(W$H98h0iy=yt$btusV5rALR~U<#N6l(lLGUDh(c9Uk5<}efLm72`Qy += gBattleAnimArgs[1]; diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index ed2e7457f6..8c2d73ff80 100644 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -1281,6 +1281,17 @@ const struct SpriteTemplate gTeraCrystalSpreadSpriteTemplate = .callback = AnimTask_TeraCrystalShatter, }; +const struct SpriteTemplate gPinkPetalVortexTemplate = +{ + .tileTag = ANIM_TAG_PINK_PETAL, + .paletteTag = ANIM_TAG_PINK_PETAL, + .oam = &gOamData_AffineOff_ObjNormal_8x8, + .anims = gSweetScentPetalAnimCmdTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimParticleInVortex +}; + // Task data for AnimTask_TeraCrystalShatter #define tCounter data[0] #define tDX data[6] diff --git a/src/battle_anim_fight.c b/src/battle_anim_fight.c index e150a2a57d..ed18e89f9b 100644 --- a/src/battle_anim_fight.c +++ b/src/battle_anim_fight.c @@ -414,9 +414,9 @@ const struct SpriteTemplate gPalmSpriteTemplate = const struct SpriteTemplate gAuraSphereBlast = { - .tileTag = ANIM_TAG_CIRCLE_OF_LIGHT, - .paletteTag = ANIM_TAG_CIRCLE_OF_LIGHT, - .oam = &gOamData_AffineOff_ObjNormal_64x64, + .tileTag = ANIM_TAG_IMPACT_2, + .paletteTag = ANIM_TAG_IMPACT_2, + .oam = &gOamData_AffineNormal_ObjNormal_32x32, .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 1fd587fa4c..7d21624495 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -359,7 +359,10 @@ const struct SpriteTemplate gSkyAttackBirdSpriteTemplate = // same as AnimEllipticalGust but centered on targets static void AnimEllipticalGustCentered(struct Sprite *sprite) { - InitSpritePosToAnimTargetsCentre(sprite, FALSE); + if (IsDoubleBattle()) + InitSpritePosToAnimTargetsCentre(sprite, FALSE); + else + InitSpritePosToAnimTarget(sprite, FALSE); sprite->y += 20; sprite->data[1] = 191; sprite->callback = AnimEllipticalGust_Step; diff --git a/src/battle_anim_mon_movement.c b/src/battle_anim_mon_movement.c index 051524a689..04fd111a84 100644 --- a/src/battle_anim_mon_movement.c +++ b/src/battle_anim_mon_movement.c @@ -487,11 +487,7 @@ static void ReverseVerticalDipDirection(struct Sprite *sprite) // arg 2: duration static void SlideMonToOriginalPos(struct Sprite *sprite) { - u32 monSpriteId; - if (!gBattleAnimArgs[0]) - monSpriteId = gBattlerSpriteIds[gBattleAnimAttacker]; - else - monSpriteId = gBattlerSpriteIds[gBattleAnimTarget]; + u32 monSpriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); sprite->data[0] = gBattleAnimArgs[2]; sprite->data[1] = gSprites[monSpriteId].x + gSprites[monSpriteId].x2; @@ -554,15 +550,9 @@ static void SlideMonToOriginalPos_Step(struct Sprite *sprite) // arg 4: duration static void SlideMonToOffset(struct Sprite *sprite) { - u8 battler; - u8 monSpriteId; - if (!gBattleAnimArgs[0]) - battler = gBattleAnimAttacker; - else - battler = gBattleAnimTarget; + u8 monSpriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); - monSpriteId = gBattlerSpriteIds[battler]; - if (GetBattlerSide(battler) != B_SIDE_PLAYER) + if (GetBattlerSide(gBattleAnimArgs[0]) != B_SIDE_PLAYER) { gBattleAnimArgs[1] = -gBattleAnimArgs[1]; if (gBattleAnimArgs[3] == 1) diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 4cadfaaffd..50bb83305f 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -99,7 +99,6 @@ static void SpriteCB_GlacialLance_Step1(struct Sprite* sprite); static void SpriteCB_GlacialLance_Step2(struct Sprite* sprite); static void SpriteCB_GlacialLance(struct Sprite* sprite); static void SpriteCB_TripleArrowKick(struct Sprite* sprite); -static void AnimMakingItRain(struct Sprite *sprite); // const data // general @@ -2176,18 +2175,7 @@ const struct SpriteTemplate gSpiritShackleArrowTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimSonicBoomProjectile -}; - -const struct SpriteTemplate gSpiritShackleChainTemplate = -{ - .tileTag = ANIM_TAG_CHAIN_LINK, - .paletteTag = ANIM_TAG_CHAIN_LINK, - .oam = &gOamData_AffineOff_ObjNormal_32x16, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimThunderWave + .callback = AnimTranslateStinger }; //darkest lariat @@ -7235,18 +7223,6 @@ const struct SpriteTemplate gBitterBladeImpactTemplate = .callback = AnimClawSlash }; -// Make It Rain -const struct SpriteTemplate gMakingItRainTemplate = -{ - .tileTag = ANIM_TAG_COIN, - .paletteTag = ANIM_TAG_COIN, - .oam = &gOamData_AffineNormal_ObjNormal_16x16, - .anims = gCoinAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimMakingItRain, -}; - const struct SpriteTemplate gRedExplosionSpriteTemplate = { .tileTag = ANIM_TAG_RED_EXPLOSION, @@ -7280,6 +7256,39 @@ const struct SpriteTemplate gMoonUpSpriteTemplate = .callback = AnimWeatherBallUp, }; +const union AnimCmd gSproutAnimCmds[] = +{ + ANIMCMD_FRAME(96, 5), + ANIMCMD_END, +}; + +const union AnimCmd *const gSproutAnimTable[] = +{ + gSproutAnimCmds, +}; + +const struct SpriteTemplate gSproutGrowSpriteTemplate = +{ + .tileTag = ANIM_TAG_SPROUT, + .paletteTag = ANIM_TAG_SPROUT, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gSproutAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimSpriteOnMonPos, +}; + +const struct SpriteTemplate gFreezyFrostRisingSpearSpriteTemplate = +{ + .tileTag = ANIM_TAG_ICICLE_SPEAR, + .paletteTag = ANIM_TAG_ICICLE_SPEAR, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_GeyserTarget +}; + // functions //general void AnimTask_IsTargetPartner(u8 taskId) @@ -9266,26 +9275,6 @@ void AnimTask_StickySyrup(u8 taskId) DestroyAnimVisualTask(taskId); } -static void AnimMakingItRain(struct Sprite *sprite) -{ - if (gBattleAnimArgs[3] != 0) - SetAverageBattlerPositions(gBattleAnimTarget, FALSE, &sprite->x, &sprite->y); //coin shower on target - - sprite->x += gBattleAnimArgs[0]; - sprite->y += 14; - StartSpriteAnim(sprite, gBattleAnimArgs[1]); - AnimateSprite(sprite); - sprite->data[0] = 0; - sprite->data[1] = 0; - sprite->data[2] = 4; - sprite->data[3] = 16; - sprite->data[4] = -70; - sprite->data[5] = gBattleAnimArgs[2]; - StoreSpriteCallbackInData6(sprite, AnimFallingRock_Step); - sprite->callback = TranslateSpriteInEllipse; - sprite->callback(sprite); -} - void AnimTask_RandomBool(u8 taskId) { if (RandomPercentage(RNG_NONE, 50)) diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index 5aa14ffa34..b6239ca063 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -349,6 +349,28 @@ const struct SpriteTemplate gSeedFlareGreenWavesTemplate = .callback = AnimFlyingSandCrescent }; +const struct SpriteTemplate gMakingItRainTemplate = +{ + .tileTag = ANIM_TAG_COIN, + .paletteTag = ANIM_TAG_COIN, + .oam = &gOamData_AffineNormal_ObjNormal_16x16, + .anims = gCoinAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimFallingRock, +}; + +const struct SpriteTemplate gFallingSeedSpriteTemplate = +{ + .tileTag = ANIM_TAG_SEED, + .paletteTag = ANIM_TAG_SEED, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimFallingRock, +}; + static void AnimStealthRock(struct Sprite *sprite) { s16 x, y; @@ -456,7 +478,14 @@ void AnimRockFragment(struct Sprite *sprite) // Swirls particle in vortex. Used for moves like Fire Spin or Sand Tomb void AnimParticleInVortex(struct Sprite *sprite) { - InitSpritePosToAnimBattler(gBattleAnimArgs[6], sprite, FALSE); + if (IsDoubleBattle() //got a little lazy here will fix later + && (gAnimMoveIndex == MOVE_BLEAKWIND_STORM + || gAnimMoveIndex == MOVE_SANDSEAR_STORM + || gAnimMoveIndex == MOVE_SPRINGTIDE_STORM + || gAnimMoveIndex == MOVE_WILDBOLT_STORM)) + InitSpritePosToAnimTargetsCentre(sprite, FALSE); + else + InitSpritePosToAnimTarget(sprite, FALSE); sprite->data[0] = gBattleAnimArgs[3]; sprite->data[1] = gBattleAnimArgs[2]; sprite->data[2] = gBattleAnimArgs[4]; From 25e9ca2ac66b1f87ad5ca4ca3b50166ab2c8a9ed Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 15 Sep 2024 08:24:26 +0200 Subject: [PATCH 43/52] Cleaned up a bit of code with GetBattlerPartyData (#5378) * rename GetBattlerPartyData --- include/battle.h | 8 ++++---- src/battle_anim_mons.c | 6 +----- src/battle_debug.c | 7 +------ src/battle_message.c | 9 ++------- src/battle_script_commands.c | 5 +---- src/battle_tv.c | 13 ++----------- src/pokeball.c | 8 ++------ src/type_icons.c | 2 +- 8 files changed, 14 insertions(+), 44 deletions(-) diff --git a/include/battle.h b/include/battle.h index 66f8531ae7..7ccbcfbfe4 100644 --- a/include/battle.h +++ b/include/battle.h @@ -1153,11 +1153,10 @@ static inline u32 GetBattlerSide(u32 battler) return GetBattlerPosition(battler) & BIT_SIDE; } -static inline struct Pokemon* GetBattlerData(u32 battlerId) +static inline struct Pokemon* GetPartyBattlerData(u32 battler) { - u32 index = gBattlerPartyIndexes[battlerId]; - - return (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) ? &gEnemyParty[index] : &gPlayerParty[index]; + u32 index = gBattlerPartyIndexes[battler]; + return (GetBattlerSide(battler) == B_SIDE_OPPONENT) ? &gEnemyParty[index] : &gPlayerParty[index]; } static inline struct Pokemon *GetSideParty(u32 side) @@ -1176,3 +1175,4 @@ static inline bool32 IsDoubleBattle(void) } #endif // GUARD_BATTLE_H + diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index e0b4820409..dec12e0dc6 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -116,11 +116,7 @@ u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType) } else { - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) - mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]]; - else - mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]]; - + mon = GetPartyBattlerData(battlerId); illusionMon = GetIllusionMonPtr(battlerId); if (illusionMon != NULL) mon = illusionMon; diff --git a/src/battle_debug.c b/src/battle_debug.c index b088aa73ba..a5421a932b 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -2269,14 +2269,9 @@ static void UpdateMonData(struct BattleDebugMenu *data) { if (data->battlerWasChanged[i]) { - struct Pokemon *mon; + struct Pokemon *mon = GetPartyBattlerData(i); struct BattlePokemon *battleMon = &gBattleMons[i]; - if (GetBattlerSide(i) == B_SIDE_PLAYER) - mon = &gPlayerParty[gBattlerPartyIndexes[i]]; - else - mon = &gEnemyParty[gBattlerPartyIndexes[i]]; - SetMonData(mon, MON_DATA_HELD_ITEM, &battleMon->item); SetMonData(mon, MON_DATA_STATUS, &battleMon->status1); SetMonData(mon, MON_DATA_HP, &battleMon->hp); diff --git a/src/battle_message.c b/src/battle_message.c index 7c009f5a73..727091cec6 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -3091,14 +3091,9 @@ static const u8 *TryGetStatusString(u8 *src) static void GetBattlerNick(u32 battler, u8 *dst) { - struct Pokemon *mon, *illusionMon; + struct Pokemon *illusionMon = GetIllusionMonPtr(battler); + struct Pokemon *mon = GetPartyBattlerData(battler); - if (GetBattlerSide(battler) == B_SIDE_PLAYER) - mon = &gPlayerParty[gBattlerPartyIndexes[battler]]; - else - mon = &gEnemyParty[gBattlerPartyIndexes[battler]]; - - illusionMon = GetIllusionMonPtr(battler); if (illusionMon != NULL) mon = illusionMon; GetMonData(mon, MON_DATA_NICKNAME, dst); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bfb7eec56d..283f42a23b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9877,10 +9877,7 @@ static void Cmd_various(void) case VARIOUS_HANDLE_FORM_CHANGE: { VARIOUS_ARGS(u8 case_); - if (GetBattlerSide(battler) == B_SIDE_OPPONENT) - mon = &gEnemyParty[gBattlerPartyIndexes[battler]]; - else - mon = &gPlayerParty[gBattlerPartyIndexes[battler]]; + mon = GetPartyBattlerData(battler); // Change species. if (cmd->case_ == 0) diff --git a/src/battle_tv.c b/src/battle_tv.c index 24d573d0bf..22e5ab1c31 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -338,17 +338,8 @@ void BattleTv_SetDataBasedOnString(u16 stringId) defSide = GetBattlerSide(gBattlerTarget); effSide = GetBattlerSide(gEffectBattler); scriptingSide = GetBattlerSide(gBattleMsgDataPtr->scrActive); - - if (atkSide == B_SIDE_PLAYER) - atkMon = &gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]]; - else - atkMon = &gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]]; - - if (defSide == B_SIDE_PLAYER) - defMon = &gPlayerParty[gBattlerPartyIndexes[gBattlerTarget]]; - else - defMon = &gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]]; - + atkMon = GetPartyBattlerData(gBattlerAttacker); + defMon = GetPartyBattlerData(gBattlerTarget); moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, gBattleMsgDataPtr->currentMove); if (moveSlot >= MAX_MON_MOVES && IsNotSpecialBattleString(stringId) && stringId > BATTLESTRINGS_TABLE_START) diff --git a/src/pokeball.c b/src/pokeball.c index 914455af5a..21557d973a 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -1571,12 +1571,8 @@ void FreeBallGfx(u8 ballId) static u16 GetBattlerPokeballItemId(u8 battlerId) { - struct Pokemon *mon, *illusionMon; - - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) - mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]]; - else - mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]]; + struct Pokemon *illusionMon; + struct Pokemon *mon = GetPartyBattlerData(battlerId); illusionMon = GetIllusionMonPtr(battlerId); if (illusionMon != NULL) diff --git a/src/type_icons.c b/src/type_icons.c index 361312ab91..41fa102bb9 100644 --- a/src/type_icons.c +++ b/src/type_icons.c @@ -291,7 +291,7 @@ static bool32 UseDoubleBattleCoords(u32 position) static u32 GetMonPublicType(u32 battlerId, u32 typeNum) { - struct Pokemon* mon = GetBattlerData(battlerId); + struct Pokemon* mon = GetPartyBattlerData(battlerId); u32 monSpecies = GetMonData(mon,MON_DATA_SPECIES,NULL); struct Pokemon* monIllusion; u32 illusionSpecies; From 5cb1be7e5cff8a9a7afb349ce6b92175350759cf Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:58:56 +0200 Subject: [PATCH 44/52] Minor Gem check optimazation (#5401) Since the variable is only used once I removed it and replaced it with a direct call. Also the if statement is short enough to fit into one line. very ocd induced change but I couldn't look away. --- src/battle_main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index a4c55ce9b5..78e44956a4 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -6010,9 +6010,7 @@ void SetTypeBeforeUsingMove(u32 move, u32 battler) gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_SET; // Check if a gem should activate. - moveType = GetMoveType(move); - if (holdEffect == HOLD_EFFECT_GEMS - && moveType == ItemId_GetSecondaryId(heldItem)) + if (holdEffect == HOLD_EFFECT_GEMS && GetMoveType(move) == ItemId_GetSecondaryId(heldItem)) { gSpecialStatuses[battler].gemParam = GetBattlerHoldEffectParam(battler); gSpecialStatuses[battler].gemBoost = TRUE; From fee26e29f5f1b513ea887a0de390ad5c3dad6fe2 Mon Sep 17 00:00:00 2001 From: psf <77138753+pkmnsnfrn@users.noreply.github.com> Date: Thu, 19 Sep 2024 03:01:12 -0700 Subject: [PATCH 45/52] Add AUTO_SCROLL_TEXT and NUM_FRAMES_AUTO_SCROLL_DELAY (#5054) * Added AUTO_SCROLL_TEXT * Moved NUM_FRAMES_AUTO_SCROLL_DELAY * Moved NUM_FRAMES_AUTO_SCROLL_DELAY per https://github.com/rh-hideout/pokeemerald-expansion/pull/5054/files#r1698268265 * Apply suggestions from https://github.com/rh-hideout/pokeemerald-expansion/pull/5054/files#r1698268524 Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Added ability to skip text with button press per https://github.com/rh-hideout/pokeemerald-expansion/pull/5054\#issuecomment-2267100771 * Update gflib/text.h per https://github.com/rh-hideout/pokeemerald-expansion/pull/5054#issuecomment-2274402891 * Update text.h * Fixed alignment per https://github.com/rh-hideout/pokeemerald-expansion/pull/5054/files\#r1711780606 * Moved NUM_FRAMES_AUTO_SCROLL_DELAY * Update gflib/text.c Co-authored-by: Bassoonian --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian --- gflib/text.c | 34 +++++++++++++++++++++------------- include/config/general.h | 3 +++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/gflib/text.c b/gflib/text.c index 59c6e3f4e8..e2adba1cdb 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -932,8 +932,9 @@ bool32 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->autoScrollDelay == 49) + if (subStruct->autoScrollDelay == NUM_FRAMES_AUTO_SCROLL_DELAY) { + subStruct->autoScrollDelay = 0; return TRUE; } else @@ -943,21 +944,29 @@ bool32 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) } } +void SetResultWithButtonPress(bool32 *result) +{ + if (JOY_NEW(A_BUTTON | B_BUTTON)) + { + *result = TRUE; + PlaySE(SE_SELECT); + } +} + bool32 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) { bool32 result = FALSE; - if (gTextFlags.autoScroll != 0) + if (gTextFlags.autoScroll != 0 || AUTO_SCROLL_TEXT) { result = TextPrinterWaitAutoMode(textPrinter); + + if (AUTO_SCROLL_TEXT) + SetResultWithButtonPress(&result); } else { TextPrinterDrawDownArrow(textPrinter); - if (JOY_NEW(A_BUTTON | B_BUTTON)) - { - result = TRUE; - PlaySE(SE_SELECT); - } + SetResultWithButtonPress(&result); } return result; } @@ -965,17 +974,16 @@ bool32 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) bool32 TextPrinterWait(struct TextPrinter *textPrinter) { bool32 result = FALSE; - if (gTextFlags.autoScroll != 0) + if (gTextFlags.autoScroll != 0 || AUTO_SCROLL_TEXT) { result = TextPrinterWaitAutoMode(textPrinter); + + if (AUTO_SCROLL_TEXT) + SetResultWithButtonPress(&result); } else { - if (JOY_NEW(A_BUTTON | B_BUTTON)) - { - result = TRUE; - PlaySE(SE_SELECT); - } + SetResultWithButtonPress(&result); } return result; } diff --git a/include/config/general.h b/include/config/general.h index dc39f4919a..ac338a1f50 100644 --- a/include/config/general.h +++ b/include/config/general.h @@ -72,6 +72,9 @@ #define SUMMARY_SCREEN_NATURE_COLORS TRUE // If TRUE, nature-based stat boosts and reductions will be red and blue in the summary screen. #define HQ_RANDOM TRUE // If TRUE, replaces the default RNG with an implementation of SFC32 RNG. May break code that relies on RNG. #define COMPETITIVE_PARTY_SYNTAX TRUE // If TRUE, parties are defined in "competitive syntax". +#define AUTO_SCROLL_TEXT FALSE // If TRUE, text will automatically scroll to the next line after NUM_FRAMES_AUTO_SCROLL_DELAY. Players can still press A_BUTTON or B_BUTTON to scroll on their own. +#define NUM_FRAMES_AUTO_SCROLL_DELAY 49 + // Measurement system constants to be used for UNITS #define UNITS_IMPERIAL 0 // Inches, feet, pounds From f0bd3c57daa2a32eca39e01b8f10c92d85d8e4bf Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 19 Sep 2024 05:45:11 -0700 Subject: [PATCH 46/52] Fixed spacing per https://github.com/rh-hideout/pokeemerald-expansion/pull/5044\#pullrequestreview-2315029773 --- src/field_control_avatar.c | 8 ++++---- src/field_message_box.c | 2 +- src/scrcmd.c | 2 +- src/script.c | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index bad5974f16..cc1f95753c 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -161,7 +161,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) gSpecialVar_LastTalked = 0; gSelectedObjectEvent = 0; - gMsgIsSignPost = FALSE; + gMsgIsSignPost = FALSE; playerDirection = GetPlayerFacingDirection(); GetPlayerPosition(&position); metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y); @@ -1122,7 +1122,7 @@ static void SetMsgSignPostAndVarFacing(u32 playerDirection) { gWalkAwayFromSignpostTimer = WALK_AWAY_SIGNPOST_FRAMES; gMsgBoxIsCancelable = TRUE; - gMsgIsSignPost = TRUE; + gMsgIsSignPost = TRUE; gSpecialVar_Facing = playerDirection; } @@ -1168,8 +1168,8 @@ void CancelSignPostMessageBox(struct FieldInput *input) return; } - if (!gMsgBoxIsCancelable) - return; + if (!gMsgBoxIsCancelable) + return; if (IsDpadPushedToTurnOrMovePlayer(input)) { diff --git a/src/field_message_box.c b/src/field_message_box.c index 569f067caa..47c728f74d 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -32,7 +32,7 @@ static void Task_DrawFieldMessage(u8 taskId) switch (task->tState) { case 0: - if (gMsgIsSignPost) + if (gMsgIsSignPost) LoadSignPostWindowFrameGfx(); else LoadMessageBoxAndBorderGfx(); diff --git a/src/scrcmd.c b/src/scrcmd.c index dbe5fa5ee6..86be73404c 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1310,7 +1310,7 @@ bool8 ScrCmd_release(struct ScriptContext *ctx) ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]); ScriptMovement_UnfreezeObjectEvents(); UnfreezeObjectEvents(); - gMsgBoxIsCancelable = FALSE; + gMsgBoxIsCancelable = FALSE; return FALSE; } diff --git a/src/script.c b/src/script.c index 7b1af3d542..e6e2aa264d 100644 --- a/src/script.c +++ b/src/script.c @@ -504,4 +504,3 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize) InitRamScript(script, scriptSize, MAP_GROUP(UNDEFINED), MAP_NUM(UNDEFINED), NO_OBJECT); #endif //FREE_MYSTERY_EVENT_BUFFERS } - From 64d4d7e570c85c00f653132c3ac27ffae126040a Mon Sep 17 00:00:00 2001 From: Rose Silicon Date: Thu, 19 Sep 2024 12:03:13 -0400 Subject: [PATCH 47/52] Simplify HP Logic (#5403) --- src/pokemon.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index d76d1df58c..faa1a65aef 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1800,29 +1800,19 @@ void CalculateMonStats(struct Pokemon *mon) CALC_STAT(baseSpAttack, spAttackIV, spAttackEV, STAT_SPATK, MON_DATA_SPATK) CALC_STAT(baseSpDefense, spDefenseIV, spDefenseEV, STAT_SPDEF, MON_DATA_SPDEF) - if (species == SPECIES_SHEDINJA) - { - if (currentHP != 0 || oldMaxHP == 0) - currentHP = 1; - else - return; - } - else - { - if (currentHP == 0 && oldMaxHP == 0) - currentHP = newMaxHP; - else if (currentHP != 0) - { - if (newMaxHP > oldMaxHP) - currentHP += newMaxHP - oldMaxHP; - if (currentHP <= 0) - currentHP = 1; - if (currentHP > newMaxHP) - currentHP = newMaxHP; - } - else - return; - } + // Since a pokemon's maxHP data could either not have + // been initialized at this point or this pokemon is + // just fainted, the check for oldMaxHP is important. + if (currentHP == 0 && oldMaxHP != 0) + return; + + // Only add to currentHP if newMaxHP went up. + if (newMaxHP > oldMaxHP) + currentHP += newMaxHP - oldMaxHP; + + // Ensure currentHP does not surpass newMaxHP. + if (currentHP > newMaxHP) + currentHP = newMaxHP; SetMonData(mon, MON_DATA_HP, ¤tHP); } From 4cd23a377db84f20d5520dc32e4115da1a202a89 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Fri, 20 Sep 2024 12:19:45 -0400 Subject: [PATCH 48/52] anger shell use saveattacker (#5409) * anger shell use saveattacker * tabs instead of spaces * add BattleScript_RestoreAttackerButItFailed for anger shell failure * Update data/battle_scripts_1.s Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> --------- Co-authored-by: ghoulslash Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> --- data/battle_scripts_1.s | 8 +++++++- src/battle_util.c | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 9af9d7fd27..a7295d9b53 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4724,6 +4724,9 @@ BattleScript_ButItFailed:: resultmessage waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd +BattleScript_RestoreAttackerButItFailed: + restoreattacker + goto BattleScript_ButItFailed BattleScript_NotAffected:: pause B_WAIT_TIME_SHORT @@ -6460,12 +6463,14 @@ BattleScript_SeedSowerActivates:: return BattleScript_AngerShellActivates:: + saveattacker + copybyte gBattlerAttacker, gBattlerTarget call BattleScript_AbilityPopUp jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_AngerShellTryDef jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_AngerShellTryDef jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_SPEED, MAX_STAT_STAGE, BattleScript_AngerShellTryDef jumpifstat BS_TARGET, CMP_GREATER_THAN, STAT_DEF, MIN_STAT_STAGE, BattleScript_AngerShellTryDef - jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPDEF, MIN_STAT_STAGE, BattleScript_ButItFailed + jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPDEF, MIN_STAT_STAGE, BattleScript_RestoreAttackerButItFailed BattleScript_AngerShellTryDef:: setbyte sSTAT_ANIM_PLAYED, FALSE modifybattlerstatstage BS_ATTACKER, STAT_DEF, DECREASE, 1, BattleScript_AngerShellTrySpDef, ANIM_ON @@ -6479,6 +6484,7 @@ BattleScript_AngerShellTrySpAtk: BattleScript_AngerShellTrySpeed: modifybattlerstatstage BS_ATTACKER, STAT_SPEED, INCREASE, 1, BattleScript_AngerShellRet, ANIM_ON BattleScript_AngerShellRet: + restoreattacker return BattleScript_WindPowerActivates:: diff --git a/src/battle_util.c b/src/battle_util.c index 035a2c981c..83af21cdcf 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5936,7 +5936,6 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 && HadMoreThanHalfHpNowDoesnt(gBattlerTarget) && !(TestIfSheerForceAffected(gBattlerAttacker, gCurrentMove))) { - gBattlerAttacker = gBattlerTarget; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_AngerShellActivates; effect++; From d1bb7770d30e8a97b6dca8418a27d89b9715debb Mon Sep 17 00:00:00 2001 From: Frank DeBlasio <35279583+fdeblasio@users.noreply.github.com> Date: Sat, 21 Sep 2024 14:44:25 -0400 Subject: [PATCH 49/52] Converted berry and PokeBlock strings to COMPOUND_STRINGs (#5324) * Converted bag pocket names to COMPOUND_STRINGs * Converted berry-related text to COMPOUND_STRINGs * Converted PokeBlock-related text to COMPOUND_STRINGs * Added indexes to BerryFirmnessStrings * Updated call to sBerryFirmnessStrings * Changed gText to sText --- include/strings.h | 44 --------------------------------- src/berry_tag_screen.c | 34 +++++++++++++++---------- src/pokeblock.c | 51 +++++++++++++++++++++----------------- src/pokeblock_feed.c | 10 +++++--- src/strings.c | 56 ++++-------------------------------------- 5 files changed, 61 insertions(+), 134 deletions(-) diff --git a/include/strings.h b/include/strings.h index 041f43d05b..8a035eb251 100644 --- a/include/strings.h +++ b/include/strings.h @@ -62,15 +62,6 @@ extern const u8 gText_MultiLink[]; extern const u8 gText_Single[]; extern const u8 gText_Double[]; -extern const u8 gText_Spicy[]; -extern const u8 gText_Dry[]; -extern const u8 gText_Sweet[]; -extern const u8 gText_Bitter[]; -extern const u8 gText_Sour[]; - -extern const u8 gText_StowCase[]; -extern const u8 gText_LvVar1[]; - extern const u8 gText_Spicy2[]; extern const u8 gText_Dry2[]; extern const u8 gText_Sweet2[]; @@ -117,9 +108,6 @@ extern const u8 gText_NoDecorationsInUse[]; extern const u8 gText_Exit[]; extern const u8 gText_Cancel[]; -extern const u8 gText_ThrowAwayVar1[]; -extern const u8 gText_Var1ThrownAway[]; - extern const u8 gText_Color161Shadow161[]; extern const u8 gText_GoBackPrevMenu[]; extern const u8 gText_CantPlaceInRoom[]; @@ -184,25 +172,6 @@ extern const u8 gText_Coins[]; extern const u8 gText_Silver[]; extern const u8 gText_Gold[]; -extern const u8 gText_Var1AteTheVar2[]; -extern const u8 gText_Var1HappilyAteVar2[]; -extern const u8 gText_Var1DisdainfullyAteVar2[]; - -extern const u8 gText_RedPokeblock[]; -extern const u8 gText_BluePokeblock[]; -extern const u8 gText_PinkPokeblock[]; -extern const u8 gText_GreenPokeblock[]; -extern const u8 gText_YellowPokeblock[]; -extern const u8 gText_PurplePokeblock[]; -extern const u8 gText_IndigoPokeblock[]; -extern const u8 gText_BrownPokeblock[]; -extern const u8 gText_LiteBluePokeblock[]; -extern const u8 gText_OlivePokeblock[]; -extern const u8 gText_GrayPokeblock[]; -extern const u8 gText_BlackPokeblock[]; -extern const u8 gText_WhitePokeblock[]; -extern const u8 gText_GoldPokeblock[]; - extern const u8 gMenuText_Use[]; extern const u8 gMenuText_Toss[]; extern const u8 gMenuText_Give[]; @@ -334,19 +303,6 @@ extern const u8 gText_LoadingEvent[]; extern const u8 gText_DontRemoveCableTurnOff[]; extern const u8 gText_LinkStandby2[]; -// berry tag screen text -extern const u8 gBerryFirmnessString_VerySoft[]; -extern const u8 gBerryFirmnessString_Soft[]; -extern const u8 gBerryFirmnessString_Hard[]; -extern const u8 gBerryFirmnessString_VeryHard[]; -extern const u8 gBerryFirmnessString_SuperHard[]; -extern const u8 gText_BerryTag[]; -extern const u8 gText_NumberVar1Var2[]; -extern const u8 gText_SizeSlash[]; -extern const u8 gText_Var1DotVar2[]; -extern const u8 gText_ThreeMarks[]; -extern const u8 gText_FirmSlash[]; - // item menu screen text extern const u8 gText_CloseBag[]; extern const u8 gText_NumberItem_HM[]; diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c index c6eb731845..fcd322ce33 100644 --- a/src/berry_tag_screen.c +++ b/src/berry_tag_screen.c @@ -143,11 +143,12 @@ static const struct WindowTemplate sWindowTemplates[] = static const u8 *const sBerryFirmnessStrings[] = { - gBerryFirmnessString_VerySoft, - gBerryFirmnessString_Soft, - gBerryFirmnessString_Hard, - gBerryFirmnessString_VeryHard, - gBerryFirmnessString_SuperHard + [BERRY_FIRMNESS_UNKNOWN] = COMPOUND_STRING("???"), + [BERRY_FIRMNESS_VERY_SOFT] = COMPOUND_STRING("Very soft"), + [BERRY_FIRMNESS_SOFT] = COMPOUND_STRING("Soft"), + [BERRY_FIRMNESS_HARD] = COMPOUND_STRING("Hard"), + [BERRY_FIRMNESS_VERY_HARD] = COMPOUND_STRING("Very hard"), + [BERRY_FIRMNESS_SUPER_HARD] = COMPOUND_STRING("Super hard") }; // this file's functions @@ -172,6 +173,13 @@ static void Task_DisplayAnotherBerry(u8 taskId); static void TryChangeDisplayedBerry(u8 taskId, s8 toMove); static void HandleBagCursorPositionChange(s8 toMove); +static const u8 sText_SizeSlash[] = _("SIZE /"); +static const u8 sText_FirmSlash[] = _("FIRM /"); +static const u8 sText_Var1DotVar2[] = _("{STR_VAR_1}.{STR_VAR_2}”"); +static const u8 sText_NumberVar1Var2[] = _("{NO}{STR_VAR_1} {STR_VAR_2}"); +static const u8 sText_BerryTag[] = _("BERRY TAG"); +static const u8 sText_ThreeMarks[] = _("???"); + // code void DoBerryTagScreen(void) { @@ -386,7 +394,7 @@ static void AddBerryTagTextToBg0(void) { memcpy(GetBgTilemapBuffer(0), sBerryTag->tilemapBuffers[2], sizeof(sBerryTag->tilemapBuffers[2])); FillWindowPixelBuffer(WIN_BERRY_TAG, PIXEL_FILL(15)); - PrintTextInBerryTagScreen(WIN_BERRY_TAG, gText_BerryTag, GetStringCenterAlignXOffset(FONT_NORMAL, gText_BerryTag, 0x40), 1, 0, 1); + PrintTextInBerryTagScreen(WIN_BERRY_TAG, sText_BerryTag, GetStringCenterAlignXOffset(FONT_NORMAL, sText_BerryTag, 0x40), 1, 0, 1); PutWindowTilemap(WIN_BERRY_TAG); ScheduleBgCopyTilemapToVram(0); } @@ -405,14 +413,14 @@ static void PrintBerryNumberAndName(void) const struct Berry *berry = GetBerryInfo(sBerryTag->berryId); ConvertIntToDecimalStringN(gStringVar1, sBerryTag->berryId, STR_CONV_MODE_LEADING_ZEROS, 2); StringCopy(gStringVar2, berry->name); - StringExpandPlaceholders(gStringVar4, gText_NumberVar1Var2); + StringExpandPlaceholders(gStringVar4, sText_NumberVar1Var2); PrintTextInBerryTagScreen(WIN_BERRY_NAME, gStringVar4, 0, 1, 0, 0); } static void PrintBerrySize(void) { const struct Berry *berry = GetBerryInfo(sBerryTag->berryId); - AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gText_SizeSlash, 0, 1, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, sText_SizeSlash, 0, 1, TEXT_SKIP_DRAW, NULL); if (berry->size != 0) { u32 inches, fraction; @@ -425,23 +433,23 @@ static void PrintBerrySize(void) ConvertIntToDecimalStringN(gStringVar1, inches, STR_CONV_MODE_LEFT_ALIGN, 2); ConvertIntToDecimalStringN(gStringVar2, fraction, STR_CONV_MODE_LEFT_ALIGN, 2); - StringExpandPlaceholders(gStringVar4, gText_Var1DotVar2); + StringExpandPlaceholders(gStringVar4, sText_Var1DotVar2); AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gStringVar4, 0x28, 1, 0, NULL); } else { - AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gText_ThreeMarks, 0x28, 1, 0, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, sText_ThreeMarks, 0x28, 1, 0, NULL); } } static void PrintBerryFirmness(void) { const struct Berry *berry = GetBerryInfo(sBerryTag->berryId); - AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gText_FirmSlash, 0, 0x11, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, sText_FirmSlash, 0, 0x11, TEXT_SKIP_DRAW, NULL); if (berry->firmness != 0) - AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, sBerryFirmnessStrings[berry->firmness - 1], 0x28, 0x11, 0, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, sBerryFirmnessStrings[berry->firmness], 0x28, 0x11, 0, NULL); else - AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gText_ThreeMarks, 0x28, 0x11, 0, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, sText_ThreeMarks, 0x28, 0x11, 0, NULL); } static void PrintBerryDescription1(void) diff --git a/src/pokeblock.c b/src/pokeblock.c index e01e821f7e..b68fe16ce3 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -130,6 +130,11 @@ static void ReturnToPokeblockCaseOnField(void); static void CreateTossPokeblockYesNoMenu(u8); static void TossPokeblock(u8); +static const u8 sText_StowCase[] = _("Stow CASE."); +static const u8 sText_LvVar1[] = _("{LV}{STR_VAR_1}"); +static const u8 sText_ThrowAwayVar1[] = _("Throw away this\n{STR_VAR_1}?"); +static const u8 sText_Var1ThrownAway[] = _("The {STR_VAR_1}\nwas thrown away."); + EWRAM_DATA static struct PokeblockSavedData sSavedPokeblockData = {0}; EWRAM_DATA static struct PokeblockMenuStruct *sPokeblockMenu = NULL; @@ -197,20 +202,20 @@ static const struct BgTemplate sBgTemplatesForPokeblockMenu[] = const u8 *const gPokeblockNames[] = { [PBLOCK_CLR_NONE] = NULL, - [PBLOCK_CLR_RED] = gText_RedPokeblock, - [PBLOCK_CLR_BLUE] = gText_BluePokeblock, - [PBLOCK_CLR_PINK] = gText_PinkPokeblock, - [PBLOCK_CLR_GREEN] = gText_GreenPokeblock, - [PBLOCK_CLR_YELLOW] = gText_YellowPokeblock, - [PBLOCK_CLR_PURPLE] = gText_PurplePokeblock, - [PBLOCK_CLR_INDIGO] = gText_IndigoPokeblock, - [PBLOCK_CLR_BROWN] = gText_BrownPokeblock, - [PBLOCK_CLR_LITE_BLUE] = gText_LiteBluePokeblock, - [PBLOCK_CLR_OLIVE] = gText_OlivePokeblock, - [PBLOCK_CLR_GRAY] = gText_GrayPokeblock, - [PBLOCK_CLR_BLACK] = gText_BlackPokeblock, - [PBLOCK_CLR_WHITE] = gText_WhitePokeblock, - [PBLOCK_CLR_GOLD] = gText_GoldPokeblock + [PBLOCK_CLR_RED] = COMPOUND_STRING("RED {POKEBLOCK}"), + [PBLOCK_CLR_BLUE] = COMPOUND_STRING("BLUE {POKEBLOCK}"), + [PBLOCK_CLR_PINK] = COMPOUND_STRING("PINK {POKEBLOCK}"), + [PBLOCK_CLR_GREEN] = COMPOUND_STRING("GREEN {POKEBLOCK}"), + [PBLOCK_CLR_YELLOW] = COMPOUND_STRING("YELLOW {POKEBLOCK}"), + [PBLOCK_CLR_PURPLE] = COMPOUND_STRING("PURPLE {POKEBLOCK}"), + [PBLOCK_CLR_INDIGO] = COMPOUND_STRING("INDIGO {POKEBLOCK}"), + [PBLOCK_CLR_BROWN] = COMPOUND_STRING("BROWN {POKEBLOCK}"), + [PBLOCK_CLR_LITE_BLUE] = COMPOUND_STRING("LITEBLUE {POKEBLOCK}"), + [PBLOCK_CLR_OLIVE] = COMPOUND_STRING("OLIVE {POKEBLOCK}"), + [PBLOCK_CLR_GRAY] = COMPOUND_STRING("GRAY {POKEBLOCK}"), + [PBLOCK_CLR_BLACK] = COMPOUND_STRING("BLACK {POKEBLOCK}"), + [PBLOCK_CLR_WHITE] = COMPOUND_STRING("WHITE {POKEBLOCK}"), + [PBLOCK_CLR_GOLD] = COMPOUND_STRING("GOLD {POKEBLOCK}") }; static const struct MenuAction sPokeblockMenuActions[] = @@ -702,11 +707,11 @@ static void DrawPokeblockMenuTitleText(void) const u8 *itemName = ItemId_GetName(ITEM_POKEBLOCK_CASE); PrintOnPokeblockWindow(WIN_TITLE, itemName, GetStringCenterAlignXOffset(FONT_NORMAL, itemName, 0x48)); - PrintOnPokeblockWindow(WIN_SPICY, gText_Spicy, 0); - PrintOnPokeblockWindow(WIN_DRY, gText_Dry, 0); - PrintOnPokeblockWindow(WIN_SWEET, gText_Sweet, 0); - PrintOnPokeblockWindow(WIN_BITTER, gText_Bitter, 0); - PrintOnPokeblockWindow(WIN_SOUR, gText_Sour, 0); + PrintOnPokeblockWindow(WIN_SPICY, COMPOUND_STRING("SPICY"), 0); + PrintOnPokeblockWindow(WIN_DRY, COMPOUND_STRING("DRY"), 0); + PrintOnPokeblockWindow(WIN_SWEET, COMPOUND_STRING("SWEET"), 0); + PrintOnPokeblockWindow(WIN_BITTER, COMPOUND_STRING("BITTER"), 0); + PrintOnPokeblockWindow(WIN_SOUR, COMPOUND_STRING("SOUR"), 0); for (i = 0; i < WIN_ACTIONS_TALL; i++) PutWindowTilemap(i); @@ -723,7 +728,7 @@ static void UpdatePokeblockList(void) sPokeblockMenu->items[i].id = i; } - StringCopy(sPokeblockMenu->menuItemsStrings[i], gText_StowCase); + StringCopy(sPokeblockMenu->menuItemsStrings[i], sText_StowCase); sPokeblockMenu->items[i].name = sPokeblockMenu->menuItemsStrings[i]; sPokeblockMenu->items[i].id = LIST_CANCEL; @@ -744,7 +749,7 @@ static void PutPokeblockListMenuString(u8 *dst, u16 pkblId) *(txtPtr++) = CHAR_BLOCK_1; ConvertIntToDecimalStringN(gStringVar1, GetHighestPokeblocksFlavorLevel(pkblock), STR_CONV_MODE_LEFT_ALIGN, 3); - StringExpandPlaceholders(txtPtr, gText_LvVar1); + StringExpandPlaceholders(txtPtr, sText_LvVar1); } static void MovePokeblockMenuCursor(s32 pkblId, bool8 onInit, struct ListMenu *list) @@ -1203,7 +1208,7 @@ static void PokeblockAction_Toss(u8 taskId) ClearStdWindowAndFrameToTransparent(tWindowId, FALSE); StringCopy(gStringVar1, gPokeblockNames[gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId].color]); - StringExpandPlaceholders(gStringVar4, gText_ThrowAwayVar1); + StringExpandPlaceholders(gStringVar4, sText_ThrowAwayVar1); DisplayMessageAndContinueTask(taskId, WIN_TOSS_MSG, 10, 13, FONT_NORMAL, GetPlayerTextSpeedDelay(), gStringVar4, CreateTossPokeblockYesNoMenu); } @@ -1214,7 +1219,7 @@ static void CreateTossPokeblockYesNoMenu(u8 taskId) static void TossedPokeblockMessage(u8 taskId) { - StringExpandPlaceholders(gStringVar4, gText_Var1ThrownAway); + StringExpandPlaceholders(gStringVar4, sText_Var1ThrownAway); DisplayMessageAndContinueTask(taskId, WIN_TOSS_MSG, 10, 13, FONT_NORMAL, GetPlayerTextSpeedDelay(), gStringVar4, TossPokeblock); } diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c index f31896a4cb..f79f35a781 100644 --- a/src/pokeblock_feed.c +++ b/src/pokeblock_feed.c @@ -96,6 +96,10 @@ static u8 CreatePokeblockCaseSpriteForFeeding(void); static u8 CreateMonSprite(struct Pokemon *); static void SpriteCB_ThrownPokeblock(struct Sprite *); +static const u8 sText_Var1AteTheVar2[] = _("{STR_VAR_1} ate the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}"); +static const u8 sText_Var1HappilyAteVar2[] = _("{STR_VAR_1} happily ate the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}"); +static const u8 sText_Var1DisdainfullyAteVar2[] = _("{STR_VAR_1} disdainfully ate the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}"); + EWRAM_DATA static struct PokeblockFeed *sPokeblockFeed = NULL; EWRAM_DATA static struct CompressedSpritePalette sPokeblockSpritePal = {0}; @@ -792,11 +796,11 @@ static void Task_PrintAtePokeblockMessage(u8 taskId) PokeblockCopyName(pokeblock, gStringVar2); if (gPokeblockGain == 0) - StringExpandPlaceholders(gStringVar4, gText_Var1AteTheVar2); + StringExpandPlaceholders(gStringVar4, sText_Var1AteTheVar2); else if (gPokeblockGain > 0) - StringExpandPlaceholders(gStringVar4, gText_Var1HappilyAteVar2); + StringExpandPlaceholders(gStringVar4, sText_Var1HappilyAteVar2); else - StringExpandPlaceholders(gStringVar4, gText_Var1DisdainfullyAteVar2); + StringExpandPlaceholders(gStringVar4, sText_Var1DisdainfullyAteVar2); gTextFlags.canABSpeedUpPrint = TRUE; AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY); diff --git a/src/strings.c b/src/strings.c index 6009dbf5e6..3f21f86c47 100644 --- a/src/strings.c +++ b/src/strings.c @@ -141,7 +141,6 @@ const u8 gText_Store[] = _("STORE"); const u8 gMenuText_Check[] = _("CHECK"); const u8 gText_None[] = _("NONE"); const u8 gMenuText_Deselect[] = _("DESELECT"); -const u8 gText_ThreeMarks[] = _("???"); const u8 gText_FiveMarks[] = _("?????"); const u8 gText_Slash[] = _("/"); const u8 gText_OneDash[] = _("-"); @@ -224,64 +223,19 @@ const u8 *const gPyramidBagMenu_ReturnToStrings[] = }; const u8 gText_ReturnToVar1[] = _("Return to\n{STR_VAR_1}."); -const u8 gText_ItemsPocket[] = _("ITEMS"); -const u8 gText_PokeBallsPocket[] = _("POKé BALLS"); -const u8 gText_TMHMPocket[] = _("TMs & HMs"); -const u8 gText_BerriesPocket[] = _("BERRIES"); -const u8 gText_KeyItemsPocket[] = _("KEY ITEMS"); const u8 *const gPocketNamesStringsTable[] = { - [ITEMS_POCKET] = gText_ItemsPocket, - [BALLS_POCKET] = gText_PokeBallsPocket, - [TMHM_POCKET] = gText_TMHMPocket, - [BERRIES_POCKET] = gText_BerriesPocket, - [KEYITEMS_POCKET] = gText_KeyItemsPocket + [ITEMS_POCKET] = COMPOUND_STRING("ITEMS"), + [BALLS_POCKET] = COMPOUND_STRING("POKé BALLS"), + [TMHM_POCKET] = COMPOUND_STRING("TMs & HMs"), + [BERRIES_POCKET] = COMPOUND_STRING("BERRIES"), + [KEYITEMS_POCKET] = COMPOUND_STRING("KEY ITEMS") }; const u8 gText_NumberItem_TMBerry[] = _("{NO}{STR_VAR_1}{CLEAR 0x07}{STR_VAR_2}"); const u8 gText_NumberItem_HM[] = _("{CLEAR_TO 0x11}{STR_VAR_1}{CLEAR 0x05}{STR_VAR_2}"); -const u8 gText_SizeSlash[] = _("SIZE /"); -const u8 gText_FirmSlash[] = _("FIRM /"); -const u8 gText_Var1DotVar2[] = _("{STR_VAR_1}.{STR_VAR_2}”"); -// Berry firmness strings -const u8 gBerryFirmnessString_VerySoft[] = _("Very soft"); -const u8 gBerryFirmnessString_Soft[] = _("Soft"); -const u8 gBerryFirmnessString_Hard[] = _("Hard"); -const u8 gBerryFirmnessString_VeryHard[] = _("Very hard"); -const u8 gBerryFirmnessString_SuperHard[] = _("Super hard"); - -const u8 gText_NumberVar1Var2[] = _("{NO}{STR_VAR_1} {STR_VAR_2}"); -const u8 gText_BerryTag[] = _("BERRY TAG"); -const u8 gText_RedPokeblock[] = _("RED {POKEBLOCK}"); -const u8 gText_BluePokeblock[] = _("BLUE {POKEBLOCK}"); -const u8 gText_PinkPokeblock[] = _("PINK {POKEBLOCK}"); -const u8 gText_GreenPokeblock[] = _("GREEN {POKEBLOCK}"); -const u8 gText_YellowPokeblock[] = _("YELLOW {POKEBLOCK}"); -const u8 gText_PurplePokeblock[] = _("PURPLE {POKEBLOCK}"); -const u8 gText_IndigoPokeblock[] = _("INDIGO {POKEBLOCK}"); -const u8 gText_BrownPokeblock[] = _("BROWN {POKEBLOCK}"); -const u8 gText_LiteBluePokeblock[] = _("LITEBLUE {POKEBLOCK}"); -const u8 gText_OlivePokeblock[] = _("OLIVE {POKEBLOCK}"); -const u8 gText_GrayPokeblock[] = _("GRAY {POKEBLOCK}"); -const u8 gText_BlackPokeblock[] = _("BLACK {POKEBLOCK}"); -const u8 gText_WhitePokeblock[] = _("WHITE {POKEBLOCK}"); -const u8 gText_GoldPokeblock[] = _("GOLD {POKEBLOCK}"); -const u8 gText_Spicy[] = _("SPICY"); -const u8 gText_Dry[] = _("DRY"); -const u8 gText_Sweet[] = _("SWEET"); -const u8 gText_Bitter[] = _("BITTER"); -const u8 gText_Sour[] = _("SOUR"); -const u8 gText_Tasty[] = _("TASTY"); // Unused -const u8 gText_Feel[] = _("FEEL"); // Unused -const u8 gText_StowCase[] = _("Stow CASE."); -const u8 gText_LvVar1[] = _("{LV}{STR_VAR_1}"); -const u8 gText_ThrowAwayVar1[] = _("Throw away this\n{STR_VAR_1}?"); -const u8 gText_Var1ThrownAway[] = _("The {STR_VAR_1}\nwas thrown away."); -const u8 gText_Var1AteTheVar2[] = _("{STR_VAR_1} ate the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}"); -const u8 gText_Var1HappilyAteVar2[] = _("{STR_VAR_1} happily ate the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}"); -const u8 gText_Var1DisdainfullyAteVar2[] = _("{STR_VAR_1} disdainfully ate the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}"); const u8 gText_ShopBuy[] = _("BUY"); const u8 gText_ShopSell[] = _("SELL"); const u8 gText_ShopQuit[] = _("QUIT"); From 1ba0875654d8c9cc94da276d5dab2bf08b5734af Mon Sep 17 00:00:00 2001 From: Frank DeBlasio <35279583+fdeblasio@users.noreply.github.com> Date: Sun, 22 Sep 2024 03:54:01 -0400 Subject: [PATCH 50/52] Removed FRONTIER_BRAIN_SPRITES and updated TRAINER_SPRITE, TRAINER_BACK_SPRITE, and TRAINER_CLASS (#5166) * Removed FRONTIER_BRAIN_SPRITES * Updated TRAINER_SPRITE and TRAINER_BACK_SPRITE * Updated TRAINER_CLASS macro * Removed FRONTIER_BRAIN_TEXTS * Turned Frontier Brain text to COMPOUND_STRINGs * Removed frontier_brain.inc from event_scripts.s * Addressed front sprite comment * Addressed backsprite comments --- data/event_scripts.s | 1 - data/text/frontier_brain.inc | 108 ---------------- include/strings.h | 30 ----- src/battle_main.c | 134 ++++++++++---------- src/data/graphics/trainers.h | 230 +++++++++++++++++------------------ src/frontier_util.c | 128 +++++++++++++++---- 6 files changed, 288 insertions(+), 343 deletions(-) delete mode 100644 data/text/frontier_brain.inc diff --git a/data/event_scripts.s b/data/event_scripts.s index d7e82eb95c..2ef99d34fb 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1148,6 +1148,5 @@ EventScript_VsSeekerChargingDone:: .include "data/scripts/trainer_hill.inc" .include "data/scripts/test_signpost.inc" .include "data/scripts/follower.inc" - .include "data/text/frontier_brain.inc" .include "data/text/save.inc" .include "data/text/birch_speech.inc" diff --git a/data/text/frontier_brain.inc b/data/text/frontier_brain.inc deleted file mode 100644 index 1292f2a564..0000000000 --- a/data/text/frontier_brain.inc +++ /dev/null @@ -1,108 +0,0 @@ -@ Battle Tower -gText_AnabelWonSilver:: - .string "It's very disappointing…$" - -gText_AnabelDefeatSilver:: - .string "Okay, I understand…$" - -gText_AnabelWonGold:: - .string "I'm terribly sorry…$" - -gText_AnabelDefeatGold:: - .string "Thank you…$" - -@ Battle Dome -gText_TuckerWonSilver:: - .string "Ahahaha! Aren't you embarrassed?\n" - .string "Everyone's watching!$" - -gText_TuckerDefeatSilver:: - .string "Grr…\n" - .string "What the…$" - -gText_TuckerWonGold:: - .string "My DOME ACE title isn't just for show!$" - -gText_TuckerDefeatGold:: - .string "Ahahaha!\n" - .string "You're inspiring!$" - -@ Battle Factory -gText_NolandWonSilver:: - .string "Way to work!\n" - .string "That was a good lesson, eh?$" - -gText_NolandDefeatSilver:: - .string "Good job!\n" - .string "You know what you're doing!$" - -gText_NolandWonGold:: - .string "Hey, hey, hey!\n" - .string "You're finished already?$" - -gText_NolandDefeatGold:: - .string "What happened here?$" - -@ Battle Pike -gText_LucyWonSilver:: - .string "Humph…$" - -gText_LucyDefeatSilver:: - .string "Urk…$" - -gText_LucyWonGold:: - .string "Hah!$" - -gText_LucyDefeatGold:: - .string "Darn!$" - -@ Battle Arena -gText_GretaWonSilver:: - .string "Oh, come on!\n" - .string "You have to try harder than that!$" - -gText_GretaDefeatSilver:: - .string "No way!\n" - .string "Good job!$" - -gText_GretaWonGold:: - .string "Heheh!\n" - .string "What did you expect?$" - -gText_GretaDefeatGold:: - .string "Huh?\n" - .string "Are you serious?!$" - -@ Battle Palace -gText_SpenserWonSilver:: - .string "Your POKéMON are wimpy because\n" - .string "you're wimpy as a TRAINER!$" - -gText_SpenserDefeatSilver:: - .string "Ah…\n" - .string "Now this is something else…$" - -gText_SpenserWonGold:: - .string "Gwahahaha!\n" - .string "My brethren, we have nothing to fear!$" - -gText_SpenserDefeatGold:: - .string "Gwah!\n" - .string "Hahahaha!$" - -@ Battle Pyramid -gText_BrandonWonSilver:: - .string "Hey! What's wrong with you!\n" - .string "Let's see some effort! Get up!$" - -gText_BrandonDefeatSilver:: - .string "That's it! You've done great!\n" - .string "You've worked hard for this!$" - -gText_BrandonWonGold:: - .string "Hey! Don't you give up now!\n" - .string "Get up! Don't lose faith in yourself!$" - -gText_BrandonDefeatGold:: - .string "That's it! You've done it!\n" - .string "You kept working for this!$" diff --git a/include/strings.h b/include/strings.h index 8a035eb251..84f87ff491 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1219,36 +1219,6 @@ extern const u8 gText_FrontierFacilityRoomsCleared[]; extern const u8 gText_FrontierFacilityKOsStreak[]; extern const u8 gText_FrontierFacilityFloorsCleared[]; -// Frontier Brain -extern const u8 gText_AnabelWonSilver[]; -extern const u8 gText_TuckerWonSilver[]; -extern const u8 gText_SpenserWonSilver[]; -extern const u8 gText_GretaWonSilver[]; -extern const u8 gText_NolandWonSilver[]; -extern const u8 gText_LucyWonSilver[]; -extern const u8 gText_BrandonWonSilver[]; -extern const u8 gText_AnabelDefeatSilver[]; -extern const u8 gText_TuckerDefeatSilver[]; -extern const u8 gText_SpenserDefeatSilver[]; -extern const u8 gText_GretaDefeatSilver[]; -extern const u8 gText_NolandDefeatSilver[]; -extern const u8 gText_LucyDefeatSilver[]; -extern const u8 gText_BrandonDefeatSilver[]; -extern const u8 gText_AnabelWonGold[]; -extern const u8 gText_TuckerWonGold[]; -extern const u8 gText_SpenserWonGold[]; -extern const u8 gText_GretaWonGold[]; -extern const u8 gText_NolandWonGold[]; -extern const u8 gText_LucyWonGold[]; -extern const u8 gText_BrandonWonGold[]; -extern const u8 gText_AnabelDefeatGold[]; -extern const u8 gText_TuckerDefeatGold[]; -extern const u8 gText_SpenserDefeatGold[]; -extern const u8 gText_GretaDefeatGold[]; -extern const u8 gText_NolandDefeatGold[]; -extern const u8 gText_LucyDefeatGold[]; -extern const u8 gText_BrandonDefeatGold[]; - // Battle Tower. extern const u8 BattleFrontier_BattleTowerMultiPartnerRoom_Text_Apprentice1Intro[]; extern const u8 BattleFrontier_BattleTowerMultiPartnerRoom_Text_Apprentice1Mon1[]; diff --git a/src/battle_main.c b/src/battle_main.c index 78e44956a4..c7f6eeafda 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -304,7 +304,7 @@ static const s8 sCenterToCornerVecXs[8] ={-32, -16, -16, -32, -32}; // extra args are money and ball #define TRAINER_CLASS(trainerClass, trainerName, ...) \ - [TRAINER_CLASS_##trainerClass] = \ + [trainerClass] = \ { \ .name = _(trainerName), \ .money = DEFAULT(5, __VA_ARGS__), \ @@ -313,72 +313,72 @@ static const s8 sCenterToCornerVecXs[8] ={-32, -16, -16, -32, -32}; const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT] = { - TRAINER_CLASS(PKMN_TRAINER_1, "{PKMN} TRAINER"), - TRAINER_CLASS(PKMN_TRAINER_2, "{PKMN} TRAINER"), - TRAINER_CLASS(HIKER, "HIKER", 10), - TRAINER_CLASS(TEAM_AQUA, "TEAM AQUA"), - TRAINER_CLASS(PKMN_BREEDER, "{PKMN} BREEDER", 10, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? ITEM_HEAL_BALL : ITEM_FRIEND_BALL), - TRAINER_CLASS(COOLTRAINER, "COOLTRAINER", 12, ITEM_ULTRA_BALL), - TRAINER_CLASS(BIRD_KEEPER, "BIRD KEEPER", 8), - TRAINER_CLASS(COLLECTOR, "COLLECTOR", 15, ITEM_PREMIER_BALL), - TRAINER_CLASS(SWIMMER_M, "SWIMMER♂", 2, ITEM_DIVE_BALL), - TRAINER_CLASS(TEAM_MAGMA, "TEAM MAGMA"), - TRAINER_CLASS(EXPERT, "EXPERT", 10), - TRAINER_CLASS(AQUA_ADMIN, "AQUA ADMIN", 10), - TRAINER_CLASS(BLACK_BELT, "BLACK BELT", 8, ITEM_ULTRA_BALL), - TRAINER_CLASS(AQUA_LEADER, "AQUA LEADER", 20, ITEM_MASTER_BALL), - TRAINER_CLASS(HEX_MANIAC, "HEX MANIAC", 6), - TRAINER_CLASS(AROMA_LADY, "AROMA LADY", 10), - TRAINER_CLASS(RUIN_MANIAC, "RUIN MANIAC", 15), - TRAINER_CLASS(INTERVIEWER, "INTERVIEWER", 12), - TRAINER_CLASS(TUBER_F, "TUBER", 1), - TRAINER_CLASS(TUBER_M, "TUBER", 1), - TRAINER_CLASS(LADY, "LADY", 50), - TRAINER_CLASS(BEAUTY, "BEAUTY", 20), - TRAINER_CLASS(RICH_BOY, "RICH BOY", 50), - TRAINER_CLASS(POKEMANIAC, "POKéMANIAC", 15), - TRAINER_CLASS(GUITARIST, "GUITARIST", 8), - TRAINER_CLASS(KINDLER, "KINDLER", 8), - TRAINER_CLASS(CAMPER, "CAMPER", 4), - TRAINER_CLASS(PICNICKER, "PICNICKER", 4), - TRAINER_CLASS(BUG_MANIAC, "BUG MANIAC", 15), - TRAINER_CLASS(PSYCHIC, "PSYCHIC", 6), - TRAINER_CLASS(GENTLEMAN, "GENTLEMAN", 20, ITEM_LUXURY_BALL), - TRAINER_CLASS(ELITE_FOUR, "ELITE FOUR", 25, ITEM_ULTRA_BALL), - TRAINER_CLASS(LEADER, "LEADER", 25), - TRAINER_CLASS(SCHOOL_KID, "SCHOOL KID"), - TRAINER_CLASS(SR_AND_JR, "SR. AND JR.", 4), - TRAINER_CLASS(WINSTRATE, "WINSTRATE", 10), - TRAINER_CLASS(POKEFAN, "POKéFAN", 20), - TRAINER_CLASS(YOUNGSTER, "YOUNGSTER", 4), - TRAINER_CLASS(CHAMPION, "CHAMPION", 50), - TRAINER_CLASS(FISHERMAN, "FISHERMAN", 10, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? ITEM_DIVE_BALL : ITEM_LURE_BALL), - TRAINER_CLASS(TRIATHLETE, "TRIATHLETE", 10), - TRAINER_CLASS(DRAGON_TAMER, "DRAGON TAMER", 12), - TRAINER_CLASS(NINJA_BOY, "NINJA BOY", 3), - TRAINER_CLASS(BATTLE_GIRL, "BATTLE GIRL", 6), - TRAINER_CLASS(PARASOL_LADY, "PARASOL LADY", 10), - TRAINER_CLASS(SWIMMER_F, "SWIMMER♀", 2, ITEM_DIVE_BALL), - TRAINER_CLASS(TWINS, "TWINS", 3), - TRAINER_CLASS(SAILOR, "SAILOR", 8), - TRAINER_CLASS(COOLTRAINER_2, "COOLTRAINER", 5, ITEM_ULTRA_BALL), - TRAINER_CLASS(MAGMA_ADMIN, "MAGMA ADMIN", 10), - TRAINER_CLASS(RIVAL, "{PKMN} TRAINER", 15), - TRAINER_CLASS(BUG_CATCHER, "BUG CATCHER", 4), - TRAINER_CLASS(PKMN_RANGER, "{PKMN} RANGER", 12), - TRAINER_CLASS(MAGMA_LEADER, "MAGMA LEADER", 20, ITEM_MASTER_BALL), - TRAINER_CLASS(LASS, "LASS", 4), - TRAINER_CLASS(YOUNG_COUPLE, "YOUNG COUPLE", 8), - TRAINER_CLASS(OLD_COUPLE, "OLD COUPLE", 10), - TRAINER_CLASS(SIS_AND_BRO, "SIS AND BRO", 3), - TRAINER_CLASS(SALON_MAIDEN, "SALON MAIDEN"), - TRAINER_CLASS(DOME_ACE, "DOME ACE"), - TRAINER_CLASS(PALACE_MAVEN, "PALACE MAVEN"), - TRAINER_CLASS(ARENA_TYCOON, "ARENA TYCOON"), - TRAINER_CLASS(FACTORY_HEAD, "FACTORY HEAD"), - TRAINER_CLASS(PIKE_QUEEN, "PIKE QUEEN"), - TRAINER_CLASS(PYRAMID_KING, "PYRAMID KING"), - TRAINER_CLASS(RS_PROTAG, "{PKMN} TRAINER"), + TRAINER_CLASS(TRAINER_CLASS_PKMN_TRAINER_1, "{PKMN} TRAINER"), + TRAINER_CLASS(TRAINER_CLASS_PKMN_TRAINER_2, "{PKMN} TRAINER"), + TRAINER_CLASS(TRAINER_CLASS_HIKER, "HIKER", 10), + TRAINER_CLASS(TRAINER_CLASS_TEAM_AQUA, "TEAM AQUA"), + TRAINER_CLASS(TRAINER_CLASS_PKMN_BREEDER, "{PKMN} BREEDER", 10, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? ITEM_HEAL_BALL : ITEM_FRIEND_BALL), + TRAINER_CLASS(TRAINER_CLASS_COOLTRAINER, "COOLTRAINER", 12, ITEM_ULTRA_BALL), + TRAINER_CLASS(TRAINER_CLASS_BIRD_KEEPER, "BIRD KEEPER", 8), + TRAINER_CLASS(TRAINER_CLASS_COLLECTOR, "COLLECTOR", 15, ITEM_PREMIER_BALL), + TRAINER_CLASS(TRAINER_CLASS_SWIMMER_M, "SWIMMER♂", 2, ITEM_DIVE_BALL), + TRAINER_CLASS(TRAINER_CLASS_TEAM_MAGMA, "TEAM MAGMA"), + TRAINER_CLASS(TRAINER_CLASS_EXPERT, "EXPERT", 10), + TRAINER_CLASS(TRAINER_CLASS_AQUA_ADMIN, "AQUA ADMIN", 10), + TRAINER_CLASS(TRAINER_CLASS_BLACK_BELT, "BLACK BELT", 8, ITEM_ULTRA_BALL), + TRAINER_CLASS(TRAINER_CLASS_AQUA_LEADER, "AQUA LEADER", 20, ITEM_MASTER_BALL), + TRAINER_CLASS(TRAINER_CLASS_HEX_MANIAC, "HEX MANIAC", 6), + TRAINER_CLASS(TRAINER_CLASS_AROMA_LADY, "AROMA LADY", 10), + TRAINER_CLASS(TRAINER_CLASS_RUIN_MANIAC, "RUIN MANIAC", 15), + TRAINER_CLASS(TRAINER_CLASS_INTERVIEWER, "INTERVIEWER", 12), + TRAINER_CLASS(TRAINER_CLASS_TUBER_F, "TUBER", 1), + TRAINER_CLASS(TRAINER_CLASS_TUBER_M, "TUBER", 1), + TRAINER_CLASS(TRAINER_CLASS_LADY, "LADY", 50), + TRAINER_CLASS(TRAINER_CLASS_BEAUTY, "BEAUTY", 20), + TRAINER_CLASS(TRAINER_CLASS_RICH_BOY, "RICH BOY", 50), + TRAINER_CLASS(TRAINER_CLASS_POKEMANIAC, "POKéMANIAC", 15), + TRAINER_CLASS(TRAINER_CLASS_GUITARIST, "GUITARIST", 8), + TRAINER_CLASS(TRAINER_CLASS_KINDLER, "KINDLER", 8), + TRAINER_CLASS(TRAINER_CLASS_CAMPER, "CAMPER", 4), + TRAINER_CLASS(TRAINER_CLASS_PICNICKER, "PICNICKER", 4), + TRAINER_CLASS(TRAINER_CLASS_BUG_MANIAC, "BUG MANIAC", 15), + TRAINER_CLASS(TRAINER_CLASS_PSYCHIC, "PSYCHIC", 6), + TRAINER_CLASS(TRAINER_CLASS_GENTLEMAN, "GENTLEMAN", 20, ITEM_LUXURY_BALL), + TRAINER_CLASS(TRAINER_CLASS_ELITE_FOUR, "ELITE FOUR", 25, ITEM_ULTRA_BALL), + TRAINER_CLASS(TRAINER_CLASS_LEADER, "LEADER", 25), + TRAINER_CLASS(TRAINER_CLASS_SCHOOL_KID, "SCHOOL KID"), + TRAINER_CLASS(TRAINER_CLASS_SR_AND_JR, "SR. AND JR.", 4), + TRAINER_CLASS(TRAINER_CLASS_WINSTRATE, "WINSTRATE", 10), + TRAINER_CLASS(TRAINER_CLASS_POKEFAN, "POKéFAN", 20), + TRAINER_CLASS(TRAINER_CLASS_YOUNGSTER, "YOUNGSTER", 4), + TRAINER_CLASS(TRAINER_CLASS_CHAMPION, "CHAMPION", 50), + TRAINER_CLASS(TRAINER_CLASS_FISHERMAN, "FISHERMAN", 10, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? ITEM_DIVE_BALL : ITEM_LURE_BALL), + TRAINER_CLASS(TRAINER_CLASS_TRIATHLETE, "TRIATHLETE", 10), + TRAINER_CLASS(TRAINER_CLASS_DRAGON_TAMER, "DRAGON TAMER", 12), + TRAINER_CLASS(TRAINER_CLASS_NINJA_BOY, "NINJA BOY", 3), + TRAINER_CLASS(TRAINER_CLASS_BATTLE_GIRL, "BATTLE GIRL", 6), + TRAINER_CLASS(TRAINER_CLASS_PARASOL_LADY, "PARASOL LADY", 10), + TRAINER_CLASS(TRAINER_CLASS_SWIMMER_F, "SWIMMER♀", 2, ITEM_DIVE_BALL), + TRAINER_CLASS(TRAINER_CLASS_TWINS, "TWINS", 3), + TRAINER_CLASS(TRAINER_CLASS_SAILOR, "SAILOR", 8), + TRAINER_CLASS(TRAINER_CLASS_COOLTRAINER_2, "COOLTRAINER", 5, ITEM_ULTRA_BALL), + TRAINER_CLASS(TRAINER_CLASS_MAGMA_ADMIN, "MAGMA ADMIN", 10), + TRAINER_CLASS(TRAINER_CLASS_RIVAL, "{PKMN} TRAINER", 15), + TRAINER_CLASS(TRAINER_CLASS_BUG_CATCHER, "BUG CATCHER", 4), + TRAINER_CLASS(TRAINER_CLASS_PKMN_RANGER, "{PKMN} RANGER", 12), + TRAINER_CLASS(TRAINER_CLASS_MAGMA_LEADER, "MAGMA LEADER", 20, ITEM_MASTER_BALL), + TRAINER_CLASS(TRAINER_CLASS_LASS, "LASS", 4), + TRAINER_CLASS(TRAINER_CLASS_YOUNG_COUPLE, "YOUNG COUPLE", 8), + TRAINER_CLASS(TRAINER_CLASS_OLD_COUPLE, "OLD COUPLE", 10), + TRAINER_CLASS(TRAINER_CLASS_SIS_AND_BRO, "SIS AND BRO", 3), + TRAINER_CLASS(TRAINER_CLASS_SALON_MAIDEN, "SALON MAIDEN"), + TRAINER_CLASS(TRAINER_CLASS_DOME_ACE, "DOME ACE"), + TRAINER_CLASS(TRAINER_CLASS_PALACE_MAVEN, "PALACE MAVEN"), + TRAINER_CLASS(TRAINER_CLASS_ARENA_TYCOON, "ARENA TYCOON"), + TRAINER_CLASS(TRAINER_CLASS_FACTORY_HEAD, "FACTORY HEAD"), + TRAINER_CLASS(TRAINER_CLASS_PIKE_QUEEN, "PIKE QUEEN"), + TRAINER_CLASS(TRAINER_CLASS_PYRAMID_KING, "PYRAMID KING"), + TRAINER_CLASS(TRAINER_CLASS_RS_PROTAG, "{PKMN} TRAINER"), }; static void (* const sTurnActionsFuncsTable[])(void) = diff --git a/src/data/graphics/trainers.h b/src/data/graphics/trainers.h index 2a7baf1bc8..613e5fcb14 100644 --- a/src/data/graphics/trainers.h +++ b/src/data/graphics/trainers.h @@ -297,110 +297,110 @@ const u32 gTrainerBackPicPalette_Leaf[] = INCBIN_U32("graphics/trainers/back_pic // gTrainerFrontPic/gTrainerPalette pointers, (e.g "gTrainerFrontPic_Hiker" and "gTrainerPalette_Hiker"). // The last three parameters control the X and Y coordinates and rotation of the mugshot on the screen. // They default to 0, 0, and 0x200 which are default values used by the majority of the game's trainer sprites. -#define TRAINER_SPRITE(trainerPic, file, ...) \ - [TRAINER_PIC_##trainerPic] = \ - { \ - .frontPic = {gTrainerFrontPic_##file, TRAINER_PIC_SIZE, TRAINER_PIC_##trainerPic},\ - .palette = {gTrainerPalette_##file, TRAINER_PIC_##trainerPic}, \ - .mugshotCoords = {DEFAULT(0, __VA_ARGS__), DEFAULT_2(0, __VA_ARGS__)}, \ - .mugshotRotation = DEFAULT_3(0x200, __VA_ARGS__), \ +#define TRAINER_SPRITE(trainerPic, picFile, paletteFile, ...) \ + [trainerPic] = \ + { \ + .frontPic = {picFile, TRAINER_PIC_SIZE, trainerPic}, \ + .palette = {paletteFile, trainerPic}, \ + .mugshotCoords = {DEFAULT(0, __VA_ARGS__), DEFAULT_2(0, __VA_ARGS__)}, \ + .mugshotRotation = DEFAULT_3(0x200, __VA_ARGS__), \ } const struct TrainerSprite gTrainerSprites[] = { - TRAINER_SPRITE(HIKER, Hiker), - TRAINER_SPRITE(AQUA_GRUNT_M, AquaGruntM), - TRAINER_SPRITE(POKEMON_BREEDER_F, PokemonBreederF), - TRAINER_SPRITE(COOLTRAINER_M, CoolTrainerM), - TRAINER_SPRITE(BIRD_KEEPER, BirdKeeper), - TRAINER_SPRITE(COLLECTOR, Collector), - TRAINER_SPRITE(AQUA_GRUNT_F, AquaGruntF), - TRAINER_SPRITE(SWIMMER_M, SwimmerM), - TRAINER_SPRITE(MAGMA_GRUNT_M, MagmaGruntM), - TRAINER_SPRITE(EXPERT_M, ExpertM), - TRAINER_SPRITE(AQUA_ADMIN_M, AquaAdminM), - TRAINER_SPRITE(BLACK_BELT, BlackBelt), - TRAINER_SPRITE(AQUA_ADMIN_F, AquaAdminF), - TRAINER_SPRITE(AQUA_LEADER_ARCHIE, AquaLeaderArchie), - TRAINER_SPRITE(HEX_MANIAC, HexManiac), - TRAINER_SPRITE(AROMA_LADY, AromaLady), - TRAINER_SPRITE(RUIN_MANIAC, RuinManiac), - TRAINER_SPRITE(INTERVIEWER, Interviewer), - TRAINER_SPRITE(TUBER_F, TuberF), - TRAINER_SPRITE(TUBER_M, TuberM), - TRAINER_SPRITE(COOLTRAINER_F, CoolTrainerF), - TRAINER_SPRITE(LADY, Lady), - TRAINER_SPRITE(BEAUTY, Beauty), - TRAINER_SPRITE(RICH_BOY, RichBoy), - TRAINER_SPRITE(EXPERT_F, ExpertF), - TRAINER_SPRITE(POKEMANIAC, Pokemaniac), - TRAINER_SPRITE(MAGMA_GRUNT_F, MagmaGruntF), - TRAINER_SPRITE(GUITARIST, Guitarist), - TRAINER_SPRITE(KINDLER, Kindler), - TRAINER_SPRITE(CAMPER, Camper), - TRAINER_SPRITE(PICNICKER, Picnicker), - TRAINER_SPRITE(BUG_MANIAC, BugManiac), - TRAINER_SPRITE(POKEMON_BREEDER_M, PokemonBreederM), - TRAINER_SPRITE(PSYCHIC_M, PsychicM), - TRAINER_SPRITE(PSYCHIC_F, PsychicF), - TRAINER_SPRITE(GENTLEMAN, Gentleman), - TRAINER_SPRITE(ELITE_FOUR_SIDNEY, EliteFourSidney), - TRAINER_SPRITE(ELITE_FOUR_PHOEBE, EliteFourPhoebe), - TRAINER_SPRITE(ELITE_FOUR_GLACIA, EliteFourGlacia, -4, 4, 0x1B0), - TRAINER_SPRITE(ELITE_FOUR_DRAKE, EliteFourDrake, 0, 5, 0x1A0), - TRAINER_SPRITE(LEADER_ROXANNE, LeaderRoxanne), - TRAINER_SPRITE(LEADER_BRAWLY, LeaderBrawly), - TRAINER_SPRITE(LEADER_WATTSON, LeaderWattson), - TRAINER_SPRITE(LEADER_FLANNERY, LeaderFlannery), - TRAINER_SPRITE(LEADER_NORMAN, LeaderNorman), - TRAINER_SPRITE(LEADER_WINONA, LeaderWinona), - TRAINER_SPRITE(LEADER_TATE_AND_LIZA, LeaderTateAndLiza), - TRAINER_SPRITE(LEADER_JUAN, LeaderJuan), - TRAINER_SPRITE(SCHOOL_KID_M, SchoolKidM), - TRAINER_SPRITE(SCHOOL_KID_F, SchoolKidF), - TRAINER_SPRITE(SR_AND_JR, SrAndJr), - TRAINER_SPRITE(POKEFAN_M, PokefanM), - TRAINER_SPRITE(POKEFAN_F, PokefanF), - TRAINER_SPRITE(YOUNGSTER, Youngster), - TRAINER_SPRITE(CHAMPION_WALLACE, ChampionWallace, -8, 7, 0x188), - TRAINER_SPRITE(FISHERMAN, Fisherman), - TRAINER_SPRITE(CYCLING_TRIATHLETE_M, CyclingTriathleteM), - TRAINER_SPRITE(CYCLING_TRIATHLETE_F, CyclingTriathleteF), - TRAINER_SPRITE(RUNNING_TRIATHLETE_M, RunningTriathleteM), - TRAINER_SPRITE(RUNNING_TRIATHLETE_F, RunningTriathleteF), - TRAINER_SPRITE(SWIMMING_TRIATHLETE_M, SwimmingTriathleteM), - TRAINER_SPRITE(SWIMMING_TRIATHLETE_F, SwimmingTriathleteF), - TRAINER_SPRITE(DRAGON_TAMER, DragonTamer), - TRAINER_SPRITE(NINJA_BOY, NinjaBoy), - TRAINER_SPRITE(BATTLE_GIRL, BattleGirl), - TRAINER_SPRITE(PARASOL_LADY, ParasolLady), - TRAINER_SPRITE(SWIMMER_F, SwimmerF), - TRAINER_SPRITE(TWINS, Twins), - TRAINER_SPRITE(SAILOR, Sailor), - TRAINER_SPRITE(MAGMA_ADMIN, MagmaAdmin), - TRAINER_SPRITE(WALLY, Wally), - TRAINER_SPRITE(BRENDAN, Brendan), - TRAINER_SPRITE(MAY, May), - TRAINER_SPRITE(BUG_CATCHER, BugCatcher), - TRAINER_SPRITE(POKEMON_RANGER_M, PokemonRangerM), - TRAINER_SPRITE(POKEMON_RANGER_F, PokemonRangerF), - TRAINER_SPRITE(MAGMA_LEADER_MAXIE, MagmaLeaderMaxie), - TRAINER_SPRITE(LASS, Lass), - TRAINER_SPRITE(YOUNG_COUPLE, YoungCouple), - TRAINER_SPRITE(OLD_COUPLE, OldCouple), - TRAINER_SPRITE(SIS_AND_BRO, SisAndBro), - TRAINER_SPRITE(STEVEN, Steven, 0, 7, 0x188), - TRAINER_SPRITE(SALON_MAIDEN_ANABEL, SalonMaidenAnabel), - TRAINER_SPRITE(DOME_ACE_TUCKER, DomeAceTucker), - TRAINER_SPRITE(PALACE_MAVEN_SPENSER, PalaceMavenSpenser), - TRAINER_SPRITE(ARENA_TYCOON_GRETA, ArenaTycoonGreta), - TRAINER_SPRITE(FACTORY_HEAD_NOLAND, FactoryHeadNoland), - TRAINER_SPRITE(PIKE_QUEEN_LUCY, PikeQueenLucy), - TRAINER_SPRITE(PYRAMID_KING_BRANDON, PyramidKingBrandon), - TRAINER_SPRITE(RED, Red), - TRAINER_SPRITE(LEAF, Leaf), - TRAINER_SPRITE(RS_BRENDAN, RubySapphireBrendan), - TRAINER_SPRITE(RS_MAY, RubySapphireMay), + TRAINER_SPRITE(TRAINER_PIC_HIKER, gTrainerFrontPic_Hiker, gTrainerPalette_Hiker), + TRAINER_SPRITE(TRAINER_PIC_AQUA_GRUNT_M, gTrainerFrontPic_AquaGruntM, gTrainerPalette_AquaGruntM), + TRAINER_SPRITE(TRAINER_PIC_POKEMON_BREEDER_F, gTrainerFrontPic_PokemonBreederF, gTrainerPalette_PokemonBreederF), + TRAINER_SPRITE(TRAINER_PIC_COOLTRAINER_M, gTrainerFrontPic_CoolTrainerM, gTrainerPalette_CoolTrainerM), + TRAINER_SPRITE(TRAINER_PIC_BIRD_KEEPER, gTrainerFrontPic_BirdKeeper, gTrainerPalette_BirdKeeper), + TRAINER_SPRITE(TRAINER_PIC_COLLECTOR, gTrainerFrontPic_Collector, gTrainerPalette_Collector), + TRAINER_SPRITE(TRAINER_PIC_AQUA_GRUNT_F, gTrainerFrontPic_AquaGruntF, gTrainerPalette_AquaGruntF), + TRAINER_SPRITE(TRAINER_PIC_SWIMMER_M, gTrainerFrontPic_SwimmerM, gTrainerPalette_SwimmerM), + TRAINER_SPRITE(TRAINER_PIC_MAGMA_GRUNT_M, gTrainerFrontPic_MagmaGruntM, gTrainerPalette_MagmaGruntM), + TRAINER_SPRITE(TRAINER_PIC_EXPERT_M, gTrainerFrontPic_ExpertM, gTrainerPalette_ExpertM), + TRAINER_SPRITE(TRAINER_PIC_AQUA_ADMIN_M, gTrainerFrontPic_AquaAdminM, gTrainerPalette_AquaAdminM), + TRAINER_SPRITE(TRAINER_PIC_BLACK_BELT, gTrainerFrontPic_BlackBelt, gTrainerPalette_BlackBelt), + TRAINER_SPRITE(TRAINER_PIC_AQUA_ADMIN_F, gTrainerFrontPic_AquaAdminF, gTrainerPalette_AquaAdminF), + TRAINER_SPRITE(TRAINER_PIC_AQUA_LEADER_ARCHIE, gTrainerFrontPic_AquaLeaderArchie, gTrainerPalette_AquaLeaderArchie), + TRAINER_SPRITE(TRAINER_PIC_HEX_MANIAC, gTrainerFrontPic_HexManiac, gTrainerPalette_HexManiac), + TRAINER_SPRITE(TRAINER_PIC_AROMA_LADY, gTrainerFrontPic_AromaLady, gTrainerPalette_AromaLady), + TRAINER_SPRITE(TRAINER_PIC_RUIN_MANIAC, gTrainerFrontPic_RuinManiac, gTrainerPalette_RuinManiac), + TRAINER_SPRITE(TRAINER_PIC_INTERVIEWER, gTrainerFrontPic_Interviewer, gTrainerPalette_Interviewer), + TRAINER_SPRITE(TRAINER_PIC_TUBER_F, gTrainerFrontPic_TuberF, gTrainerPalette_TuberF), + TRAINER_SPRITE(TRAINER_PIC_TUBER_M, gTrainerFrontPic_TuberM, gTrainerPalette_TuberM), + TRAINER_SPRITE(TRAINER_PIC_COOLTRAINER_F, gTrainerFrontPic_CoolTrainerF, gTrainerPalette_CoolTrainerF), + TRAINER_SPRITE(TRAINER_PIC_LADY, gTrainerFrontPic_Lady, gTrainerPalette_Lady), + TRAINER_SPRITE(TRAINER_PIC_BEAUTY, gTrainerFrontPic_Beauty, gTrainerPalette_Beauty), + TRAINER_SPRITE(TRAINER_PIC_RICH_BOY, gTrainerFrontPic_RichBoy, gTrainerPalette_RichBoy), + TRAINER_SPRITE(TRAINER_PIC_EXPERT_F, gTrainerFrontPic_ExpertF, gTrainerPalette_ExpertF), + TRAINER_SPRITE(TRAINER_PIC_POKEMANIAC, gTrainerFrontPic_Pokemaniac, gTrainerPalette_Pokemaniac), + TRAINER_SPRITE(TRAINER_PIC_MAGMA_GRUNT_F, gTrainerFrontPic_MagmaGruntF, gTrainerPalette_MagmaGruntF), + TRAINER_SPRITE(TRAINER_PIC_GUITARIST, gTrainerFrontPic_Guitarist, gTrainerPalette_Guitarist), + TRAINER_SPRITE(TRAINER_PIC_KINDLER, gTrainerFrontPic_Kindler, gTrainerPalette_Kindler), + TRAINER_SPRITE(TRAINER_PIC_CAMPER, gTrainerFrontPic_Camper, gTrainerPalette_Camper), + TRAINER_SPRITE(TRAINER_PIC_PICNICKER, gTrainerFrontPic_Picnicker, gTrainerPalette_Picnicker), + TRAINER_SPRITE(TRAINER_PIC_BUG_MANIAC, gTrainerFrontPic_BugManiac, gTrainerPalette_BugManiac), + TRAINER_SPRITE(TRAINER_PIC_POKEMON_BREEDER_M, gTrainerFrontPic_PokemonBreederM, gTrainerPalette_PokemonBreederM), + TRAINER_SPRITE(TRAINER_PIC_PSYCHIC_M, gTrainerFrontPic_PsychicM, gTrainerPalette_PsychicM), + TRAINER_SPRITE(TRAINER_PIC_PSYCHIC_F, gTrainerFrontPic_PsychicF, gTrainerPalette_PsychicF), + TRAINER_SPRITE(TRAINER_PIC_GENTLEMAN, gTrainerFrontPic_Gentleman, gTrainerPalette_Gentleman), + TRAINER_SPRITE(TRAINER_PIC_ELITE_FOUR_SIDNEY, gTrainerFrontPic_EliteFourSidney, gTrainerPalette_EliteFourSidney), + TRAINER_SPRITE(TRAINER_PIC_ELITE_FOUR_PHOEBE, gTrainerFrontPic_EliteFourPhoebe, gTrainerPalette_EliteFourPhoebe), + TRAINER_SPRITE(TRAINER_PIC_ELITE_FOUR_GLACIA, gTrainerFrontPic_EliteFourGlacia, gTrainerPalette_EliteFourGlacia, -4, 4, 0x1B0), + TRAINER_SPRITE(TRAINER_PIC_ELITE_FOUR_DRAKE, gTrainerFrontPic_EliteFourDrake, gTrainerPalette_EliteFourDrake, 0, 5, 0x1A0), + TRAINER_SPRITE(TRAINER_PIC_LEADER_ROXANNE, gTrainerFrontPic_LeaderRoxanne, gTrainerPalette_LeaderRoxanne), + TRAINER_SPRITE(TRAINER_PIC_LEADER_BRAWLY, gTrainerFrontPic_LeaderBrawly, gTrainerPalette_LeaderBrawly), + TRAINER_SPRITE(TRAINER_PIC_LEADER_WATTSON, gTrainerFrontPic_LeaderWattson, gTrainerPalette_LeaderWattson), + TRAINER_SPRITE(TRAINER_PIC_LEADER_FLANNERY, gTrainerFrontPic_LeaderFlannery, gTrainerPalette_LeaderFlannery), + TRAINER_SPRITE(TRAINER_PIC_LEADER_NORMAN, gTrainerFrontPic_LeaderNorman, gTrainerPalette_LeaderNorman), + TRAINER_SPRITE(TRAINER_PIC_LEADER_WINONA, gTrainerFrontPic_LeaderWinona, gTrainerPalette_LeaderWinona), + TRAINER_SPRITE(TRAINER_PIC_LEADER_TATE_AND_LIZA, gTrainerFrontPic_LeaderTateAndLiza, gTrainerPalette_LeaderTateAndLiza), + TRAINER_SPRITE(TRAINER_PIC_LEADER_JUAN, gTrainerFrontPic_LeaderJuan, gTrainerPalette_LeaderJuan), + TRAINER_SPRITE(TRAINER_PIC_SCHOOL_KID_M, gTrainerFrontPic_SchoolKidM, gTrainerPalette_SchoolKidM), + TRAINER_SPRITE(TRAINER_PIC_SCHOOL_KID_F, gTrainerFrontPic_SchoolKidF, gTrainerPalette_SchoolKidF), + TRAINER_SPRITE(TRAINER_PIC_SR_AND_JR, gTrainerFrontPic_SrAndJr, gTrainerPalette_SrAndJr), + TRAINER_SPRITE(TRAINER_PIC_POKEFAN_M, gTrainerFrontPic_PokefanM, gTrainerPalette_PokefanM), + TRAINER_SPRITE(TRAINER_PIC_POKEFAN_F, gTrainerFrontPic_PokefanF, gTrainerPalette_PokefanF), + TRAINER_SPRITE(TRAINER_PIC_YOUNGSTER, gTrainerFrontPic_Youngster, gTrainerPalette_Youngster), + TRAINER_SPRITE(TRAINER_PIC_CHAMPION_WALLACE, gTrainerFrontPic_ChampionWallace, gTrainerPalette_ChampionWallace, -8, 7, 0x188), + TRAINER_SPRITE(TRAINER_PIC_FISHERMAN, gTrainerFrontPic_Fisherman, gTrainerPalette_Fisherman), + TRAINER_SPRITE(TRAINER_PIC_CYCLING_TRIATHLETE_M, gTrainerFrontPic_CyclingTriathleteM, gTrainerPalette_CyclingTriathleteM), + TRAINER_SPRITE(TRAINER_PIC_CYCLING_TRIATHLETE_F, gTrainerFrontPic_CyclingTriathleteF, gTrainerPalette_CyclingTriathleteF), + TRAINER_SPRITE(TRAINER_PIC_RUNNING_TRIATHLETE_M, gTrainerFrontPic_RunningTriathleteM, gTrainerPalette_RunningTriathleteM), + TRAINER_SPRITE(TRAINER_PIC_RUNNING_TRIATHLETE_F, gTrainerFrontPic_RunningTriathleteF, gTrainerPalette_RunningTriathleteF), + TRAINER_SPRITE(TRAINER_PIC_SWIMMING_TRIATHLETE_M, gTrainerFrontPic_SwimmingTriathleteM, gTrainerPalette_SwimmingTriathleteM), + TRAINER_SPRITE(TRAINER_PIC_SWIMMING_TRIATHLETE_F, gTrainerFrontPic_SwimmingTriathleteF, gTrainerPalette_SwimmingTriathleteF), + TRAINER_SPRITE(TRAINER_PIC_DRAGON_TAMER, gTrainerFrontPic_DragonTamer, gTrainerPalette_DragonTamer), + TRAINER_SPRITE(TRAINER_PIC_NINJA_BOY, gTrainerFrontPic_NinjaBoy, gTrainerPalette_NinjaBoy), + TRAINER_SPRITE(TRAINER_PIC_BATTLE_GIRL, gTrainerFrontPic_BattleGirl, gTrainerPalette_BattleGirl), + TRAINER_SPRITE(TRAINER_PIC_PARASOL_LADY, gTrainerFrontPic_ParasolLady, gTrainerPalette_ParasolLady), + TRAINER_SPRITE(TRAINER_PIC_SWIMMER_F, gTrainerFrontPic_SwimmerF, gTrainerPalette_SwimmerF), + TRAINER_SPRITE(TRAINER_PIC_TWINS, gTrainerFrontPic_Twins, gTrainerPalette_Twins), + TRAINER_SPRITE(TRAINER_PIC_SAILOR, gTrainerFrontPic_Sailor, gTrainerPalette_Sailor), + TRAINER_SPRITE(TRAINER_PIC_MAGMA_ADMIN, gTrainerFrontPic_MagmaAdmin, gTrainerPalette_MagmaAdmin), + TRAINER_SPRITE(TRAINER_PIC_WALLY, gTrainerFrontPic_Wally, gTrainerPalette_Wally), + TRAINER_SPRITE(TRAINER_PIC_BRENDAN, gTrainerFrontPic_Brendan, gTrainerPalette_Brendan), + TRAINER_SPRITE(TRAINER_PIC_MAY, gTrainerFrontPic_May, gTrainerPalette_May), + TRAINER_SPRITE(TRAINER_PIC_BUG_CATCHER, gTrainerFrontPic_BugCatcher, gTrainerPalette_BugCatcher), + TRAINER_SPRITE(TRAINER_PIC_POKEMON_RANGER_M, gTrainerFrontPic_PokemonRangerM, gTrainerPalette_PokemonRangerM), + TRAINER_SPRITE(TRAINER_PIC_POKEMON_RANGER_F, gTrainerFrontPic_PokemonRangerF, gTrainerPalette_PokemonRangerF), + TRAINER_SPRITE(TRAINER_PIC_MAGMA_LEADER_MAXIE, gTrainerFrontPic_MagmaLeaderMaxie, gTrainerPalette_MagmaLeaderMaxie), + TRAINER_SPRITE(TRAINER_PIC_LASS, gTrainerFrontPic_Lass, gTrainerPalette_Lass), + TRAINER_SPRITE(TRAINER_PIC_YOUNG_COUPLE, gTrainerFrontPic_YoungCouple, gTrainerPalette_YoungCouple), + TRAINER_SPRITE(TRAINER_PIC_OLD_COUPLE, gTrainerFrontPic_OldCouple, gTrainerPalette_OldCouple), + TRAINER_SPRITE(TRAINER_PIC_SIS_AND_BRO, gTrainerFrontPic_SisAndBro, gTrainerPalette_SisAndBro), + TRAINER_SPRITE(TRAINER_PIC_STEVEN, gTrainerFrontPic_Steven, gTrainerPalette_Steven, 0, 7, 0x188), + TRAINER_SPRITE(TRAINER_PIC_SALON_MAIDEN_ANABEL, gTrainerFrontPic_SalonMaidenAnabel, gTrainerPalette_SalonMaidenAnabel), + TRAINER_SPRITE(TRAINER_PIC_DOME_ACE_TUCKER, gTrainerFrontPic_DomeAceTucker, gTrainerPalette_DomeAceTucker), + TRAINER_SPRITE(TRAINER_PIC_PALACE_MAVEN_SPENSER, gTrainerFrontPic_PalaceMavenSpenser, gTrainerPalette_PalaceMavenSpenser), + TRAINER_SPRITE(TRAINER_PIC_ARENA_TYCOON_GRETA, gTrainerFrontPic_ArenaTycoonGreta, gTrainerPalette_ArenaTycoonGreta), + TRAINER_SPRITE(TRAINER_PIC_FACTORY_HEAD_NOLAND, gTrainerFrontPic_FactoryHeadNoland, gTrainerPalette_FactoryHeadNoland), + TRAINER_SPRITE(TRAINER_PIC_PIKE_QUEEN_LUCY, gTrainerFrontPic_PikeQueenLucy, gTrainerPalette_PikeQueenLucy), + TRAINER_SPRITE(TRAINER_PIC_PYRAMID_KING_BRANDON, gTrainerFrontPic_PyramidKingBrandon, gTrainerPalette_PyramidKingBrandon), + TRAINER_SPRITE(TRAINER_PIC_RED, gTrainerFrontPic_Red, gTrainerPalette_Red), + TRAINER_SPRITE(TRAINER_PIC_LEAF, gTrainerFrontPic_Leaf, gTrainerPalette_Leaf), + TRAINER_SPRITE(TRAINER_PIC_RS_BRENDAN, gTrainerFrontPic_RubySapphireBrendan, gTrainerPalette_RubySapphireBrendan), + TRAINER_SPRITE(TRAINER_PIC_RS_MAY, gTrainerFrontPic_RubySapphireMay, gTrainerPalette_RubySapphireMay), }; static const union AnimCmd sAnimCmd_Hoenn[] = @@ -526,23 +526,23 @@ const struct SpriteFrameImage gTrainerBackPicTable_Steven[] = // .backPic goes functionally unused, since none of these pics are compressed // and the place they would get extracted to gets overwritten later anyway // the casts are so they'll play nice with the strict struct definition -#define TRAINER_BACK_SPRITE(trainerPic, yOffset, sprite, pal, anim) \ - [TRAINER_BACK_PIC_##trainerPic] = \ - { \ - .coordinates = {.size = 8, .y_offset = yOffset}, \ - .backPic = {(const u32 *)gTrainerBackPic_##sprite, TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_##sprite), TRAINER_BACK_PIC_##trainerPic}, \ - .palette = {gTrainer##pal, TRAINER_BACK_PIC_##trainerPic}, \ - .animation = sBackAnims_##anim, \ +#define TRAINER_BACK_SPRITE(trainerPic, yOffset, sprite, table, pal, anim) \ + [trainerPic] = \ + { \ + .coordinates = {.size = 8, .y_offset = yOffset}, \ + .backPic = {(const u32 *)sprite, TRAINER_PIC_SIZE * ARRAY_COUNT(table), trainerPic}, \ + .palette = {pal, trainerPic}, \ + .animation = anim, \ } const struct TrainerBacksprite gTrainerBacksprites[] = { - TRAINER_BACK_SPRITE(BRENDAN, 4, Brendan, Palette_Brendan, Hoenn), - TRAINER_BACK_SPRITE(MAY, 4, May, Palette_May, Hoenn), - TRAINER_BACK_SPRITE(RED, 5, Red, BackPicPalette_Red, Kanto), - TRAINER_BACK_SPRITE(LEAF, 5, Leaf, BackPicPalette_Leaf, Kanto), - TRAINER_BACK_SPRITE(RUBY_SAPPHIRE_BRENDAN, 4, RubySapphireBrendan, Palette_RubySapphireBrendan, Hoenn), - TRAINER_BACK_SPRITE(RUBY_SAPPHIRE_MAY, 4, RubySapphireMay, Palette_RubySapphireMay, Hoenn), - TRAINER_BACK_SPRITE(WALLY, 4, Wally, Palette_Wally, Hoenn), - TRAINER_BACK_SPRITE(STEVEN, 4, Steven, Palette_Steven, Hoenn), + TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_BRENDAN, 4, gTrainerBackPic_Brendan, gTrainerBackPicTable_Brendan, gTrainerPalette_Brendan, sBackAnims_Hoenn), + TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_MAY, 4, gTrainerBackPic_May, gTrainerBackPicTable_May, gTrainerPalette_May, sBackAnims_Hoenn), + TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_RED, 5, gTrainerBackPic_Red, gTrainerBackPicTable_Red, gTrainerBackPicPalette_Red, sBackAnims_Kanto), + TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_LEAF, 5, gTrainerBackPic_Leaf, gTrainerBackPicTable_Leaf, gTrainerBackPicPalette_Leaf, sBackAnims_Kanto), + TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN, 4, gTrainerBackPic_RubySapphireBrendan, gTrainerBackPicTable_RubySapphireBrendan, gTrainerPalette_RubySapphireBrendan, sBackAnims_Hoenn), + TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY, 4, gTrainerBackPic_RubySapphireMay, gTrainerBackPicTable_RubySapphireMay, gTrainerPalette_RubySapphireMay, sBackAnims_Hoenn), + TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_WALLY, 4, gTrainerBackPic_Wally, gTrainerBackPicTable_Wally, gTrainerPalette_Wally, sBackAnims_Hoenn), + TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_STEVEN, 4, gTrainerBackPic_Steven, gTrainerBackPicTable_Steven, gTrainerPalette_Steven, sBackAnims_Hoenn), }; diff --git a/src/frontier_util.c b/src/frontier_util.c index b9d4f29e32..4424676644 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -94,71 +94,155 @@ static void ShowPyramidResultsWindow(void); static void ShowLinkContestResultsWindow(void); static void CopyFrontierBrainText(bool8 playerWonText); -#define FRONTIER_BRAIN_SPRITES(Brain) \ - .trainerId = TRAINER_##Brain, \ - .objEventGfx = OBJ_EVENT_GFX_##Brain - -#define FRONTIER_BRAIN_TEXTS(Brain) \ - .lostTexts = {gText_##Brain##DefeatSilver, gText_##Brain##DefeatGold}, \ - .wonTexts = {gText_##Brain##WonSilver, gText_##Brain##WonGold} - // battledBit: Flags to change the conversation when the Frontier Brain is encountered for a battle // First bit is has battled them before and not won yet, second bit is has battled them and won (obtained a Symbol) const struct FrontierBrain gFrontierBrainInfo[NUM_FRONTIER_FACILITIES] = { [FRONTIER_FACILITY_TOWER] = { - FRONTIER_BRAIN_SPRITES(ANABEL), + .trainerId = TRAINER_ANABEL, + .objEventGfx = OBJ_EVENT_GFX_ANABEL, .isFemale = TRUE, - FRONTIER_BRAIN_TEXTS(Anabel), + .lostTexts = { + COMPOUND_STRING("Okay, I understand…"), //Silver + COMPOUND_STRING("Thank you…") //Gold + }, + .wonTexts = { + COMPOUND_STRING("It's very disappointing…"), //Silver + COMPOUND_STRING("I'm terribly sorry…") //Gold + }, .battledBit = {1 << 0, 1 << 1}, .streakAppearances = {35, 70, 35, 1}, }, [FRONTIER_FACILITY_DOME] = { - FRONTIER_BRAIN_SPRITES(TUCKER), + .trainerId = TRAINER_TUCKER, + .objEventGfx = OBJ_EVENT_GFX_TUCKER, .isFemale = FALSE, - FRONTIER_BRAIN_TEXTS(Tucker), + .lostTexts = { + COMPOUND_STRING( + "Grr…\n" + "What the…"), //Silver + COMPOUND_STRING( + "Ahahaha!\n" + "You're inspiring!") //Gold + }, + .wonTexts = { + COMPOUND_STRING( + "Ahahaha! Aren't you embarrassed?\n" + "Everyone's watching!"), //Silver + COMPOUND_STRING("My DOME ACE title isn't just for show!") //Gold + }, .battledBit = {1 << 2, 1 << 3}, .streakAppearances = {1, 2, 5, 0}, }, [FRONTIER_FACILITY_PALACE] = { - FRONTIER_BRAIN_SPRITES(SPENSER), + .trainerId = TRAINER_SPENSER, + .objEventGfx = OBJ_EVENT_GFX_SPENSER, .isFemale = FALSE, - FRONTIER_BRAIN_TEXTS(Spenser), + .lostTexts = { + COMPOUND_STRING( + "Ah…\n" + "Now this is something else…"), //Silver + COMPOUND_STRING( + "Gwah!\n" + "Hahahaha!") //Gold + }, + .wonTexts = { + COMPOUND_STRING( + "Your POKéMON are wimpy because\n" + "you're wimpy as a TRAINER!"), //Silver + COMPOUND_STRING( + "Gwahahaha!\n" + "My brethren, we have nothing to fear!") //Gold + }, .battledBit = {1 << 4, 1 << 5}, .streakAppearances = {21, 42, 21, 1}, }, [FRONTIER_FACILITY_ARENA] = { - FRONTIER_BRAIN_SPRITES(GRETA), + .trainerId = TRAINER_GRETA, + .objEventGfx = OBJ_EVENT_GFX_GRETA, .isFemale = TRUE, - FRONTIER_BRAIN_TEXTS(Greta), + .lostTexts = { + COMPOUND_STRING( + "No way!\n" + "Good job!"), //Silver + COMPOUND_STRING( + "Huh?\n" + "Are you serious?!") //Gold + }, + .wonTexts = { + COMPOUND_STRING( + "Oh, come on!\n" + "You have to try harder than that!"), //Silver + COMPOUND_STRING( + "Heheh!\n" + "What did you expect?") //Gold + }, .battledBit = {1 << 6, 1 << 7}, .streakAppearances = {28, 56, 28, 1}, }, [FRONTIER_FACILITY_FACTORY] = { - FRONTIER_BRAIN_SPRITES(NOLAND), + .trainerId = TRAINER_NOLAND, + .objEventGfx = OBJ_EVENT_GFX_NOLAND, .isFemale = FALSE, - FRONTIER_BRAIN_TEXTS(Noland), + .lostTexts = { + COMPOUND_STRING( + "Good job!\n" + "You know what you're doing!"), //Silver + COMPOUND_STRING("What happened here?") //Gold + }, + .wonTexts = { + COMPOUND_STRING( + "Way to work!\n" + "That was a good lesson, eh?"), //Silver + COMPOUND_STRING( + "Hey, hey, hey!\n" + "You're finished already?") //Gold + }, .battledBit = {1 << 8, 1 << 9}, .streakAppearances = {21, 42, 21, 1}, }, [FRONTIER_FACILITY_PIKE] = { - FRONTIER_BRAIN_SPRITES(LUCY), + .trainerId = TRAINER_LUCY, + .objEventGfx = OBJ_EVENT_GFX_LUCY, .isFemale = TRUE, - FRONTIER_BRAIN_TEXTS(Lucy), + .lostTexts = { + COMPOUND_STRING("Urk…"), //Silver + COMPOUND_STRING("Darn!") //Gold + }, + .wonTexts = { + COMPOUND_STRING("Humph…"), //Silver + COMPOUND_STRING("Hah!") //Gold + }, .battledBit = {1 << 10, 1 << 11}, .streakAppearances = {28, 140, 56, 1}, }, [FRONTIER_FACILITY_PYRAMID] = { - FRONTIER_BRAIN_SPRITES(BRANDON), + .trainerId = TRAINER_BRANDON, + .objEventGfx = OBJ_EVENT_GFX_BRANDON, .isFemale = FALSE, - FRONTIER_BRAIN_TEXTS(Brandon), + .lostTexts = { + COMPOUND_STRING( + "That's it! You've done great!\n" + "You've worked hard for this!"), //Silver + COMPOUND_STRING( + "That's it! You've done it!\n" + "You kept working for this!") //Gold + }, + .wonTexts = { + COMPOUND_STRING( + "Hey! What's wrong with you!\n" + "Let's see some effort! Get up!"), //Silver + COMPOUND_STRING( + "Hey! Don't you give up now!\n" + "Get up! Don't lose faith in yourself!") //Gold + }, .battledBit = {1 << 12, 1 << 13}, .streakAppearances = {21, 70, 35, 0}, }, From 60e2c0f859bebfbbf9d5f6cfcd79e6e899cac0dc Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sun, 22 Sep 2024 12:05:45 +0200 Subject: [PATCH 51/52] Merge item description branch history (#5419) * Recreated ghoul's item_desc_header branch Fixed tabs vs spaces Fixing whitespace * Fixed item in header not showing on maximum flash level * Fixed item icon being affected by thunderstorms * Shops now set the obtained item flag. * Fixed build * fix seashore house * better soda pop fix, thx asparagus * fix item icon showing in battle pyramid * fix hiding item desc in battle pyramid --------- Co-authored-by: Eduardo Quezada D'Ottone Co-authored-by: ghoulslash --- data/battle_scripts_1.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a7295d9b53..04784ccdac 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4725,8 +4725,8 @@ BattleScript_ButItFailed:: waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd BattleScript_RestoreAttackerButItFailed: - restoreattacker - goto BattleScript_ButItFailed + restoreattacker + goto BattleScript_ButItFailed BattleScript_NotAffected:: pause B_WAIT_TIME_SHORT From b924461ae3e48a3138cb07eb913279c3917d7c6d Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 22 Sep 2024 16:41:26 +0200 Subject: [PATCH 52/52] Clean up Unseen Fist Check (#5420) * Clean up Unseedn Fist Check * fix compiling --- src/battle_util.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 83af21cdcf..a54e8a12c8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8541,13 +8541,9 @@ bool32 IsBattlerProtected(u32 battlerAtk, u32 battlerDef, u32 move) if (gProtectStructs[battlerDef].maxGuarded && IsMoveBlockedByMaxGuard(move)) return TRUE; - // Protective Pads doesn't stop Unseen Fist from bypassing Protect effects, so IsMoveMakingContact() isn't used here. - // This means extra logic is needed to handle Shell Side Arm. - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_UNSEEN_FIST - && (gMovesInfo[move].makesContact - || (gMovesInfo[move].effect == EFFECT_SHELL_SIDE_ARM - && gBattleStruct->shellSideArmCategory[battlerAtk][battlerDef] == DAMAGE_CATEGORY_PHYSICAL)) - && !gProtectStructs[battlerDef].maxGuarded) // Max Guard cannot be bypassed by Unseen Fist + if (!gProtectStructs[battlerDef].maxGuarded // Max Guard cannot be bypassed by Unseen Fist + && IsMoveMakingContact(move, gBattlerAttacker) + && GetBattlerAbility(gBattlerAttacker) == ABILITY_UNSEEN_FIST) return FALSE; else if (gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_CRAFTY_SHIELD && IS_MOVE_STATUS(move))