mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-30 14:21:51 +00:00
Merge branch 'polyobject-scroll-hotfix' into 'next'
Polyobject scroll hotfix Things fixed: * Polyobjects should now carry the same thing types as conveyors (notable example; they'll now carry Crawlas when they wouldn't before) * The drifting issue with players on spinning polyobjects should be fixed. (I swapped in the old bad hack for a new hack that should work like it's supposed to) See merge request !6
This commit is contained in:
commit
3d59e337ac
1 changed files with 27 additions and 15 deletions
|
@ -1043,9 +1043,10 @@ static void Polyobj_carryThings(polyobj_t *po, fixed_t dx, fixed_t dy)
|
||||||
|
|
||||||
mo->lastlook = pomovecount;
|
mo->lastlook = pomovecount;
|
||||||
|
|
||||||
// always push players even if not solid
|
// Don't scroll objects that aren't affected by gravity
|
||||||
if (!((mo->flags & MF_SOLID) || mo->player))
|
if (mo->flags & MF_NOGRAVITY)
|
||||||
continue;
|
continue;
|
||||||
|
// (The above check used to only move MF_SOLID objects, but that's inconsistent with conveyor behavior. -Red)
|
||||||
|
|
||||||
if (mo->flags & MF_NOCLIP)
|
if (mo->flags & MF_NOCLIP)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1097,9 +1098,11 @@ static INT32 Polyobj_clipThings(polyobj_t *po, line_t *line)
|
||||||
|
|
||||||
for (; mo; mo = mo->bnext)
|
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;
|
continue;
|
||||||
|
// (The above check used to only move MF_SOLID objects, but that's inconsistent with conveyor behavior. -Red)
|
||||||
|
|
||||||
if (mo->flags & MF_NOCLIP)
|
if (mo->flags & MF_NOCLIP)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1259,6 +1262,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
|
||||||
{
|
{
|
||||||
static INT32 pomovecount = 10000;
|
static INT32 pomovecount = 10000;
|
||||||
INT32 x, y;
|
INT32 x, y;
|
||||||
|
angle_t deltafine = delta >> ANGLETOFINESHIFT;
|
||||||
|
|
||||||
pomovecount++;
|
pomovecount++;
|
||||||
|
|
||||||
|
@ -1283,9 +1287,10 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
|
||||||
|
|
||||||
mo->lastlook = pomovecount;
|
mo->lastlook = pomovecount;
|
||||||
|
|
||||||
// always push players even if not solid
|
// Don't scroll objects that aren't affected by gravity
|
||||||
if (!((mo->flags & MF_SOLID) || mo->player))
|
if (mo->flags & MF_NOGRAVITY)
|
||||||
continue;
|
continue;
|
||||||
|
// (The above check used to only move MF_SOLID objects, but that's inconsistent with conveyor behavior. -Red)
|
||||||
|
|
||||||
if (mo->flags & MF_NOCLIP)
|
if (mo->flags & MF_NOCLIP)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1300,21 +1305,28 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
{
|
{
|
||||||
fixed_t newxoff, newyoff;
|
fixed_t oldxoff, oldyoff, newxoff, newyoff;
|
||||||
angle_t angletoobj = R_PointToAngle2(origin.x, origin.y, mo->x, mo->y);
|
fixed_t c, s;
|
||||||
fixed_t disttoobj = R_PointToDist2(origin.x, origin.y, mo->x, mo->y);
|
|
||||||
|
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
|
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;
|
newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s);
|
||||||
angletoobj >>= ANGLETOFINESHIFT;
|
newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s);
|
||||||
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)) {
|
if (turnthings == 2 || (turnthings == 1 && !mo->player)) {
|
||||||
mo->angle += delta;
|
mo->angle += delta;
|
||||||
|
|
Loading…
Reference in a new issue