- floatified PLAYER::Revolve

This commit is contained in:
Christoph Oelckers 2022-09-01 18:50:28 +02:00
parent cebdc653bb
commit 83adf5e88a
3 changed files with 7 additions and 32 deletions

View file

@ -651,7 +651,7 @@ struct PLAYER
int16_t recoil_ndx; int16_t recoil_ndx;
fixed_t recoil_ohorizoff, recoil_horizoff; fixed_t recoil_ohorizoff, recoil_horizoff;
vec3_t Revolve; DVector3 Revolve;
DAngle RevolveDeltaAng; DAngle RevolveDeltaAng;
DAngle RevolveAng; DAngle RevolveAng;

View file

@ -6987,8 +6987,7 @@ DEFINE_FIELD_X(SWPlayer, PLAYER, recoil_ohorizoff)
//DEFINE_FIELD_X(SWPlayer, PLAYER, oldposx) //DEFINE_FIELD_X(SWPlayer, PLAYER, oldposx)
//DEFINE_FIELD_X(SWPlayer, PLAYER, oldposy) //DEFINE_FIELD_X(SWPlayer, PLAYER, oldposy)
//DEFINE_FIELD_X(SWPlayer, PLAYER, oldposz) //DEFINE_FIELD_X(SWPlayer, PLAYER, oldposz)
//DEFINE_FIELD_X(SWPlayer, PLAYER, Revolve.X) //DEFINE_FIELD_X(SWPlayer, PLAYER, Revolve)
//DEFINE_FIELD_X(SWPlayer, PLAYER, Revolve.Y)
DEFINE_FIELD_X(SWPlayer, PLAYER, RevolveDeltaAng) DEFINE_FIELD_X(SWPlayer, PLAYER, RevolveDeltaAng)
DEFINE_FIELD_X(SWPlayer, PLAYER, pnum) DEFINE_FIELD_X(SWPlayer, PLAYER, pnum)
DEFINE_FIELD_X(SWPlayer, PLAYER, LadderSector) DEFINE_FIELD_X(SWPlayer, PLAYER, LadderSector)

View file

@ -696,28 +696,6 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop)
KillActor(BoundActor); KillActor(BoundActor);
} }
#if 0
// look for players on sector object
PLAYER* pp;
short pnum;
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
if (pp->posx > xlow && pp->posx < xhigh && pp->posy > ylow && pp->posy < yhigh)
{
pp->RevolveAng = pp->angle.ang;
pp->Revolve.X = pp->pos.X;
pp->Revolve.Y = pp->pos.Y;
pp->RevolveDeltaAng = nullAngle;
pp->Flags |= (PF_PLAYER_RIDING);
pp->sop_riding = sop;
}
}
#endif
// look through all sectors for whole sectors that are IN bounds // look through all sectors for whole sectors that are IN bounds
for (auto&sec: sector) for (auto&sec: sector)
{ {
@ -1497,8 +1475,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, int nx, int ny)
pp->Flags |= (PF_PLAYER_RIDING); pp->Flags |= (PF_PLAYER_RIDING);
pp->RevolveAng = pp->angle.ang; pp->RevolveAng = pp->angle.ang;
pp->Revolve.X = pp->int_ppos().X; pp->Revolve.XY() = pp->pos.XY();
pp->Revolve.Y = pp->int_ppos().Y;
// set the delta angle to 0 when moving // set the delta angle to 0 when moving
pp->RevolveDeltaAng = nullAngle; pp->RevolveDeltaAng = nullAngle;
@ -1520,8 +1497,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, int nx, int ny)
// moving then you // moving then you
// know where he was last // know where he was last
pp->RevolveAng = pp->angle.ang; pp->RevolveAng = pp->angle.ang;
pp->Revolve.X = pp->int_ppos().X; pp->Revolve.XY() = pp->pos.XY();
pp->Revolve.Y = pp->int_ppos().Y;
// set the delta angle to 0 when moving // set the delta angle to 0 when moving
pp->RevolveDeltaAng = nullAngle; pp->RevolveDeltaAng = nullAngle;
@ -1531,8 +1507,8 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, int nx, int ny)
// Player is NOT moving // Player is NOT moving
// Move saved x&y variables // Move saved x&y variables
pp->Revolve.X += nx; pp->Revolve.X += nx * inttoworld;
pp->Revolve.Y += ny; pp->Revolve.Y += ny * inttoworld;
// Last known angle is now adjusted by the delta angle // Last known angle is now adjusted by the delta angle
pp->RevolveAng = deltaangle(pp->RevolveDeltaAng, pp->angle.ang); pp->RevolveAng = deltaangle(pp->RevolveDeltaAng, pp->angle.ang);
@ -1541,7 +1517,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, int nx, int ny)
// increment Players delta angle // increment Players delta angle
pp->RevolveDeltaAng += GlobSpeedSO; pp->RevolveDeltaAng += GlobSpeedSO;
pp->pos.XY() = rotatepoint(sop->pmid.XY(), {pp->Revolve.X * inttoworld, pp->Revolve.Y * inttoworld}, pp->RevolveDeltaAng); pp->pos.XY() = rotatepoint(sop->pmid.XY(), pp->Revolve.XY(), pp->RevolveDeltaAng);
// THIS WAS CAUSING PROLEMS!!!! // THIS WAS CAUSING PROLEMS!!!!
// Sectors are still being manipulated so you can end up in a void (-1) sector // Sectors are still being manipulated so you can end up in a void (-1) sector