From dfce7f15489de5e94d9476dc76e33e2b60672130 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 1 Apr 2021 09:45:17 -0600 Subject: [PATCH 01/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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 f0bd3c57daa2a32eca39e01b8f10c92d85d8e4bf Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 19 Sep 2024 05:45:11 -0700 Subject: [PATCH 41/41] 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 } -