From b8804bba87a9c3d5ad100118e3577717db398120 Mon Sep 17 00:00:00 2001 From: Arceveti <73617174+Arceveti@users.noreply.github.com> Date: Wed, 29 Sep 2021 21:25:36 -0700 Subject: [PATCH] Fix teleporting on poles --- src/game/object_helpers.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 4627e61e..e1d9040d 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -1852,13 +1852,12 @@ void spawn_mist_particles_with_sound(u32 soundMagic) { } void cur_obj_push_mario_away(f32 radius) { - f32 marioRelX = gMarioObject->oPosX - o->oPosX; - f32 marioRelZ = gMarioObject->oPosZ - o->oPosZ; + f32 marioRelX = (gMarioObject->oPosX - o->oPosX); + f32 marioRelZ = (gMarioObject->oPosZ - o->oPosZ); f32 marioDist = (sqr(marioRelX) + sqr(marioRelZ)); - if (marioDist < sqr(radius)) { - //! If this function pushes Mario out of bounds, it will trigger Mario's - // oob failsafe + marioDist = sqrtf(marioDist); + //! If this function pushes Mario out of bounds, it will trigger Mario's oob failsafe gMarioStates[0].pos[0] += (radius - marioDist) / radius * marioRelX; gMarioStates[0].pos[2] += (radius - marioDist) / radius * marioRelZ; }