diff --git a/src/p_polyobj.c b/src/p_polyobj.c index bec59ae2f..e98c469b6 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; @@ -1259,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++; @@ -1283,9 +1287,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; @@ -1300,21 +1305,28 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, continue; { - fixed_t newxoff, newyoff; - 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 { - disttoobj = FixedMul(disttoobj, 0xfe40); + fixed_t temp; + + 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, 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;