From fb120299bbbf7c9f1cb00c1b10c90d43f5c7adf6 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 1 Apr 2015 17:39:20 -0500 Subject: [PATCH 1/3] Make polyobjects carry the same objects as conveyors for consistency --- src/p_polyobj.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 9c955c97..ae420171 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1043,9 +1043,10 @@ static void Polyobj_carryThings(polyobj_t *po, fixed_t dx, fixed_t dy) mo->lastlook = pomovecount; - // always push players even if not solid - if (!((mo->flags & MF_SOLID) || mo->player)) + // Don't scroll objects that aren't affected by gravity + if (mo->flags & MF_NOGRAVITY) continue; + // (The above check used to only move MF_SOLID objects, but that's inconsistent with conveyor behavior. -Red) if (mo->flags & MF_NOCLIP) continue; @@ -1097,9 +1098,11 @@ static INT32 Polyobj_clipThings(polyobj_t *po, line_t *line) for (; mo; mo = mo->bnext) { - // always push players even if not solid - if (!((mo->flags & MF_SOLID) || mo->player)) + + // Don't scroll objects that aren't affected by gravity + if (mo->flags & MF_NOGRAVITY) continue; + // (The above check used to only move MF_SOLID objects, but that's inconsistent with conveyor behavior. -Red) if (mo->flags & MF_NOCLIP) continue; @@ -1283,9 +1286,10 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, mo->lastlook = pomovecount; - // always push players even if not solid - if (!((mo->flags & MF_SOLID) || mo->player)) + // Don't scroll objects that aren't affected by gravity + if (mo->flags & MF_NOGRAVITY) continue; + // (The above check used to only move MF_SOLID objects, but that's inconsistent with conveyor behavior. -Red) if (mo->flags & MF_NOCLIP) continue; From 6616b030bb36b85f5bddf061cb6abd3ee360a50e Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 1 Apr 2015 18:15:46 -0500 Subject: [PATCH 2/3] 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; From 5a4d9f885b4fb1890c0d9257157f23457ce575fe Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 1 Apr 2015 20:41:53 -0500 Subject: [PATCH 3/3] Making RotateThings a bit nicer?? --- src/p_polyobj.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 30a245b8..19daf5d1 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1262,6 +1262,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, { static INT32 pomovecount = 10000; INT32 x, y; + angle_t deltafine = delta >> ANGLETOFINESHIFT; pomovecount++; @@ -1304,27 +1305,26 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, continue; { - 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); + fixed_t oldxoff, oldyoff, newxoff, newyoff; + fixed_t c, s; + + c = FINECOSINE(deltafine); + s = FINESINE(deltafine); oldxoff = mo->x-origin.x; oldyoff = mo->y-origin.y; if (mo->player) // Hack to fix players sliding off of spinning polys -Red { - angle_t temp; - angletoobj += delta; + fixed_t temp; - temp = angletoobj >> ANGLETOFINESHIFT; - oldxoff = FixedMul(FINECOSINE(temp), disttoobj); - oldyoff = FixedMul(FINESINE(temp), disttoobj); + temp = FixedMul(oldxoff, c)-FixedMul(oldyoff, s); + oldyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s); + oldxoff = temp; } - angletoobj += delta; - angletoobj >>= ANGLETOFINESHIFT; - newxoff = FixedMul(FINECOSINE(angletoobj), disttoobj); - newyoff = FixedMul(FINESINE(angletoobj), disttoobj); + newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s); + newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s); Polyobj_slideThing(mo, newxoff-oldxoff, newyoff-oldyoff);