From 7ee921e9dae948713f94c5f286855e3001f05a3f Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 4 Apr 2024 16:17:48 -0400 Subject: [PATCH 1/2] Added BUGFIX for groundEffectsOnMove when the player stops Surfing --- src/field_player_avatar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 04aa5383bdfe..1f0708af2219 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -1663,6 +1663,10 @@ static void Task_WaitStopSurfing(u8 taskId) gPlayerAvatar.preventStep = FALSE; UnlockPlayerFieldControls(); DestroySprite(&gSprites[playerObjEvent->fieldEffectSpriteId]); +#ifdef BUGFIX + // If this is not defined but the player steps into grass from surfing, they will appear over the grass instead of in the grass. + playerObjEvent->triggerGroundEffectsOnMove = TRUE; +#endif DestroyTask(taskId); } } From 71b8d2039732554235cee49f765d0a0dd7f03dff Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 4 Apr 2024 16:21:34 -0400 Subject: [PATCH 2/2] Replaced magic numbers regarding triggerGroundEffectsOnMove to TRUE / FALSE --- src/event_object_movement.c | 4 ++-- src/field_effect.c | 2 +- src/overworld.c | 4 ++-- src/trainer_see.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 5a746579d4ac..ece1bfa63153 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -8077,7 +8077,7 @@ static void DoGroundEffects_OnSpawn(struct ObjectEvent *objEvent, struct Sprite GetAllGroundEffectFlags_OnSpawn(objEvent, &flags); SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite); DoFlaggedGroundEffects(objEvent, sprite, flags); - objEvent->triggerGroundEffectsOnMove = 0; + objEvent->triggerGroundEffectsOnMove = FALSE; objEvent->disableCoveringGroundEffects = 0; } } @@ -8094,7 +8094,7 @@ static void DoGroundEffects_OnBeginStep(struct ObjectEvent *objEvent, struct Spr SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite); filters_out_some_ground_effects(objEvent, &flags); DoFlaggedGroundEffects(objEvent, sprite, flags); - objEvent->triggerGroundEffectsOnMove = 0; + objEvent->triggerGroundEffectsOnMove = FALSE; objEvent->disableCoveringGroundEffects = 0; } } diff --git a/src/field_effect.c b/src/field_effect.c index 9ef70a16553c..d907c3f16da3 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -2496,7 +2496,7 @@ static void TeleportWarpInFieldEffect_SpinEnter(struct Task *task) if (task->data[13] == 0) { task->data[13]++; - objectEvent->triggerGroundEffectsOnMove = 1; + objectEvent->triggerGroundEffectsOnMove = TRUE; sprite->subspriteMode = task->data[14]; } } else diff --git a/src/overworld.c b/src/overworld.c index 2e01a2e52f96..e1cb0a1cad74 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -3050,7 +3050,7 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing) { if (facing > FACING_FORCED_RIGHT) { - objEvent->triggerGroundEffectsOnMove = 1; + objEvent->triggerGroundEffectsOnMove = TRUE; } else { @@ -3199,7 +3199,7 @@ static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion) sprite = &gSprites[objEvent->spriteId]; sprite->coordOffsetEnabled = TRUE; sprite->data[0] = linkPlayerId; - objEvent->triggerGroundEffectsOnMove = 0; + objEvent->triggerGroundEffectsOnMove = FALSE; } } diff --git a/src/trainer_see.c b/src/trainer_see.c index 88f9215f7703..51cc64f4a07e 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -595,7 +595,7 @@ static bool8 JumpInPlaceBuriedTrainer(u8 taskId, struct Task *task, struct Objec if (gSprites[task->tOutOfAshSpriteId].animCmdIndex == 2) { trainerObj->fixedPriority = 0; - trainerObj->triggerGroundEffectsOnMove = 1; + trainerObj->triggerGroundEffectsOnMove = TRUE; sprite = &gSprites[trainerObj->spriteId]; sprite->oam.priority = 2;