- add_int_ppos_XY

This commit is contained in:
Christoph Oelckers 2022-08-20 12:57:02 +02:00
parent 8ff62c5a07
commit 72869304ea
5 changed files with 11 additions and 14 deletions

View file

@ -614,6 +614,10 @@ struct PLAYER
{
__int_ppos.Z += z;
}
void add_int_ppos_XY(vec2_t z)
{
__int_ppos.XY() += z;
}
DSWActor* actor; // this may not be a TObjPtr!
TObjPtr<DSWActor*> lowActor, highActor;

View file

@ -111,8 +111,7 @@ Collision MultiClipMove(PLAYER* pp, int z, int floor_dist)
}
// put posx and y off from offset
pp->__int_ppos.X += pos[min_ndx].X - opos[min_ndx].X;
pp->__int_ppos.Y += pos[min_ndx].Y - opos[min_ndx].Y;
pp->add_int_ppos_XY({ pos[min_ndx].X - opos[min_ndx].X, pos[min_ndx].Y - opos[min_ndx].Y });
return min_ret;
}
@ -201,8 +200,7 @@ int RectClipMove(PLAYER* pp, int *qx, int *qy)
//Given the 4 points: x[4], y[4]
if (testquadinsect(&point_num, xy, pp->cursector))
{
pp->__int_ppos.X += (pp->vect.X>>14);
pp->__int_ppos.Y += (pp->vect.Y>>14);
pp->add_int_ppos_XY({ (pp->vect.X >> 14), (pp->vect.Y >> 14) });
return true;
}
@ -218,8 +216,7 @@ int RectClipMove(PLAYER* pp, int *qx, int *qy)
}
if (testquadinsect(&point_num, xy, pp->cursector))
{
pp->__int_ppos.X -= (pp->vect.Y>>15);
pp->__int_ppos.Y += (pp->vect.X>>15);
pp->add_int_ppos_XY({ -(pp->vect.Y >> 15), (pp->vect.X >> 15) });
}
return false;
@ -234,8 +231,7 @@ int RectClipMove(PLAYER* pp, int *qx, int *qy)
}
if (testquadinsect(&point_num, xy, pp->cursector))
{
pp->__int_ppos.X += (pp->vect.Y>>15);
pp->__int_ppos.Y -= (pp->vect.X>>15);
pp->add_int_ppos_XY({ (pp->vect.Y >> 15), -(pp->vect.X >> 15) });
}
return false;

View file

@ -2038,8 +2038,7 @@ void DoPlayerMove(PLAYER* pp)
{
pp->__int_popos.XY() = pp->int_ppos().XY();
}
pp->__int_ppos.X += pp->vect.X >> 14;
pp->__int_ppos.Y += pp->vect.Y >> 14;
pp->add_int_ppos_XY({ pp->vect.X >> 14, pp->vect.Y >> 14 });
updatesector(pp->int_ppos().X, pp->int_ppos().Y, &sect);
if (sect != nullptr)
pp->cursector = sect;

View file

@ -1469,8 +1469,7 @@ void PreMapCombineFloors(void)
{
if (itsect == dasect)
{
pp->__int_ppos.X += dx;
pp->__int_ppos.Y += dy;
pp->add_int_ppos_XY({ dx, dy });
pp->__int_popos.X = pp->__int_poldpos.X = pp->__int_ppos.X;
pp->__int_popos.Y = pp->__int_poldpos.Y = pp->__int_ppos.Y;
break;

View file

@ -1520,8 +1520,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, int nx, int ny)
pp->RevolveDeltaAng = nullAngle;
}
pp->__int_ppos.X += nx;
pp->__int_ppos.Y += ny;
pp->add_int_ppos_XY({ nx, ny });
if ((sop->flags & SOBJ_DONT_ROTATE))
{