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; -}