From 6616b030bb36b85f5bddf061cb6abd3ee360a50e Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 1 Apr 2015 18:15:46 -0500 Subject: [PATCH] Replace the old spinny polyobject player drifty hack thing with a new one that actually works --- src/p_polyobj.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index ae420171..30a245b8 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1304,13 +1304,21 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, continue; { - fixed_t newxoff, newyoff; + fixed_t newxoff, newyoff, oldxoff, oldyoff; angle_t angletoobj = R_PointToAngle2(origin.x, origin.y, mo->x, mo->y); fixed_t disttoobj = R_PointToDist2(origin.x, origin.y, mo->x, mo->y); + oldxoff = mo->x-origin.x; + oldyoff = mo->y-origin.y; + if (mo->player) // Hack to fix players sliding off of spinning polys -Red { - disttoobj = FixedMul(disttoobj, 0xfe40); + angle_t temp; + angletoobj += delta; + + temp = angletoobj >> ANGLETOFINESHIFT; + oldxoff = FixedMul(FINECOSINE(temp), disttoobj); + oldyoff = FixedMul(FINESINE(temp), disttoobj); } angletoobj += delta; @@ -1318,7 +1326,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, newxoff = FixedMul(FINECOSINE(angletoobj), disttoobj); newyoff = FixedMul(FINESINE(angletoobj), disttoobj); - Polyobj_slideThing(mo, origin.x+newxoff-mo->x, origin.y+newyoff-mo->y); + Polyobj_slideThing(mo, newxoff-oldxoff, newyoff-oldyoff); if (turnthings == 2 || (turnthings == 1 && !mo->player)) { mo->angle += delta;