- SW: Wrap calls that get PLAYER::PlayerNowPosition.

This commit is contained in:
Mitchell Richters 2022-11-20 20:23:16 +11:00 committed by Christoph Oelckers
parent 964557ab6b
commit a54d0f7639
21 changed files with 118 additions and 114 deletions

View file

@ -316,7 +316,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
// continue;
}
dist = (actor->spr.pos - pp->PlayerNowPosition).Length();
dist = (actor->spr.pos - pp->posGet()).Length();
if (dist < near_dist)
{
@ -342,7 +342,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
continue;
}
dist = (actor->spr.pos - pp->PlayerNowPosition).Length();
dist = (actor->spr.pos - pp->posGet()).Length();
DSWActor* plActor = pp->actor;

View file

@ -1022,7 +1022,7 @@ int DoBunnyQuickJump(DSWActor* actor)
if (pp == Player+myconnectindex)
{
choose_snd = StdRandomRange(2<<8)>>8;
if (FAFcansee(ActorVectOfTop(actor),actor->sector(),pp->PlayerNowPosition, pp->cursector) && Facing(actor, actor->user.targetActor))
if (FAFcansee(ActorVectOfTop(actor),actor->sector(),pp->posGet(), pp->cursector) && Facing(actor, actor->user.targetActor))
PlayerSound(fagsnds[choose_snd], v3df_doppler|v3df_follow|v3df_dontpan,pp);
}
}
@ -1037,7 +1037,7 @@ int DoBunnyQuickJump(DSWActor* actor)
if (pp == Player+myconnectindex)
{
choose_snd = StdRandomRange(3<<8)>>8;
if (FAFcansee(ActorVectOfTop(actor), actor->sector(), pp->PlayerNowPosition, pp->cursector) && Facing(actor, actor->user.targetActor))
if (FAFcansee(ActorVectOfTop(actor), actor->sector(), pp->posGet(), pp->cursector) && Facing(actor, actor->user.targetActor))
PlayerSound(straightsnds[choose_snd], v3df_doppler | v3df_follow | v3df_dontpan, pp);
}
}

View file

@ -811,7 +811,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
else // Otherwise just interpolate the player sprite
{
pp = tActor->user.PlayerP;
tsp->pos = interpolatedvalue(pp->PlayerPrevPosition, pp->PlayerNowPosition, interpfrac);
tsp->pos = interpolatedvalue(pp->PlayerPrevPosition, pp->posGet(), interpfrac);
tsp->angle = pp->angle.interpolatedang(interpfrac);
}
}
@ -965,7 +965,7 @@ void post_analyzesprites(tspriteArray& tsprites)
std::pair<DVector3, DAngle> GameInterface::GetCoordinates()
{
PLAYER* pp = Player + myconnectindex;
return std::make_pair(pp->PlayerNowPosition, pp->angle.ang);
return std::make_pair(pp->posGet(), pp->angle.ang);
}
//---------------------------------------------------------------------------
@ -1240,7 +1240,7 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly)
}
// Get initial player position, interpolating if required.
DVector3 tpos = interpolatedvalue(camerapp->PlayerPrevPosition, camerapp->PlayerNowPosition, interpfrac);
DVector3 tpos = interpolatedvalue(camerapp->PlayerPrevPosition, camerapp->posGet(), interpfrac);
if (SyncInput() || pp != Player+myconnectindex)
{
tang = camerapp->angle.interpolatedsum(interpfrac);
@ -1261,7 +1261,7 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly)
{
if (pp->sop_control && (!cl_sointerpolation || (CommEnabled && !pp->sop_remote)))
{
tpos = pp->PlayerNowPosition;
tpos = pp->posGet();
tang = pp->angle.ang;
}
tsect = pp->cursector;

View file

@ -741,6 +741,10 @@ struct PLAYER
{
PlayerNowPosition += val;
}
DVector3 posGet()
{
return PlayerNowPosition;
}
};
extern PLAYER Player[MAX_SW_PLAYERS_REG+1];
@ -1930,7 +1934,7 @@ inline bool SectorIsUnderwaterArea(sectortype* sect)
inline bool PlayerFacingRange(PLAYER* pp, DSWActor* a, DAngle range)
{
return absangle((a->spr.pos - pp->PlayerNowPosition).Angle(), pp->angle.ang) < range;
return absangle((a->spr.pos - pp->posGet()).Angle(), pp->angle.ang) < range;
}
inline bool FacingRange(DSWActor* a1, DSWActor* a2, DAngle range)

View file

@ -598,7 +598,7 @@ void JS_DrawCameras(PLAYER* pp, const DVector3& campos, double smoothratio)
// If player is dead still then update at MoveSkip4
// rate.
if (pp->PlayerNowPosition == pp->PlayerPrevPosition)
if (pp->posGet() == pp->PlayerPrevPosition)
DoCam = true;
@ -612,7 +612,7 @@ void JS_DrawCameras(PLAYER* pp, const DVector3& campos, double smoothratio)
if (TEST_BOOL11(camactor) && numplayers > 1)
{
drawroomstotile(cp->PlayerNowPosition, cp->angle.ang, cp->horizon.horiz, cp->cursector, mirror[cnt].campic, smoothratio);
drawroomstotile(cp->posGet(), cp->angle.ang, cp->horizon.horiz, cp->cursector, mirror[cnt].campic, smoothratio);
}
else
{

View file

@ -1256,7 +1256,7 @@ int PlayerInitChemBomb(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 8);
auto pos = pp->posGet().plusZ(pp->bob_z + 8);
// Spawn a shot
// Inserting and setting up variables
@ -1630,7 +1630,7 @@ int PlayerInitCaltrops(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 8);
auto pos = pp->posGet().plusZ(pp->bob_z + 8);
auto actorNew = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursector, pos, pp->angle.ang, (CHEMBOMB_VELOCITY + RandomRangeF(CHEMBOMB_VELOCITY)) / 2);

View file

@ -60,7 +60,7 @@ Collision MultiClipMove(PLAYER* pp, double zz, double floordist)
// move the box to position instead of using offset- this prevents small rounding errors
// allowing you to move through wall
DAngle ang = (pp->angle.ang + sop->clipbox_ang[i]);
DVector3 spos(pp->PlayerNowPosition, zz);
DVector3 spos(pp->posGet(), zz);
DVector2 vect = ang.ToVector() * sop->clipbox_vdist[i];
Collision coll;
@ -73,7 +73,7 @@ Collision MultiClipMove(PLAYER* pp, double zz, double floordist)
min_dist = 0;
min_ndx = i;
// ox is where it should be
opos[i].XY() = pp->PlayerNowPosition + ang.ToVector() * sop->clipbox_vdist[i];
opos[i].XY() = pp->posGet() + ang.ToVector() * sop->clipbox_vdist[i];
// spos.x is where it hit
pos[i].XY() = spos.XY();
@ -133,7 +133,7 @@ int MultiClipTurn(PLAYER* pp, DAngle new_ang, double zz, double floordist)
{
DAngle ang = new_ang + sop->clipbox_ang[i];
DVector3 spos(pp->PlayerNowPosition, zz);
DVector3 spos(pp->posGet(), zz);
DVector2 vect = ang.ToVector() * sop->clipbox_vdist[i];
Collision coll;

View file

@ -2392,7 +2392,7 @@ void InitPlayerSprite(PLAYER* pp)
COVER_SetReverb(0); // Turn off any echoing that may have been going before
pp->Reverb = 0;
auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, pp->PlayerNowPosition, pp->angle.ang);
auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, pp->posGet(), pp->angle.ang);
pp->actor = actor;
pp->pnum = pnum;
@ -2465,7 +2465,7 @@ void SpawnPlayerUnderSprite(PLAYER* pp)
int pnum = int(pp - Player);
pp->PlayerUnderActor = SpawnActor(STAT_PLAYER_UNDER0 + pnum,
NINJA_RUN_R0, nullptr, pp->cursector, pp->PlayerNowPosition, pp->angle.ang);
NINJA_RUN_R0, nullptr, pp->cursector, pp->posGet(), pp->angle.ang);
DSWActor* actor = pp->PlayerUnderActor;

View file

@ -58,7 +58,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang)
{
Player->posSet(DVector3(x,y,z));
Player->PlayerPrevPosition = Player->PlayerNowPosition;
Player->PlayerPrevPosition = Player->posGet();
if (ang != DAngle::fromDeg(INT_MIN))
{

View file

@ -1316,7 +1316,7 @@ void DoPlayerTeleportToSprite(PLAYER* pp, DVector3& pos, DAngle ang)
pp->PlayerPrevPosition = pos.plusZ(-PLAYER_HEIGHTF);
pp->PlayerOldPosition.XY() = pp->posXY();
updatesector(pp->PlayerNowPosition, &pp->cursector);
updatesector(pp->posGet(), &pp->cursector);
pp->Flags2 |= (PF2_TELEPORTED);
}
@ -1330,7 +1330,7 @@ void DoPlayerTeleportToOffset(PLAYER* pp)
{
pp->PlayerOldPosition.XY() = pp->PlayerPrevPosition.XY() = pp->posXY();
updatesector(pp->PlayerNowPosition, &pp->cursector);
updatesector(pp->posGet(), &pp->cursector);
pp->Flags2 |= (PF2_TELEPORTED);
}
@ -1401,7 +1401,7 @@ void DoPlayerWarpTeleporter(PLAYER* pp)
TAG 5 to 8 = random match locations
#endif
if ((act_warp = Warp(pp->PlayerNowPosition, &pp->cursector)) == nullptr)
if ((act_warp = Warp(pp->posGet(), &pp->cursector)) == nullptr)
{
return;
}
@ -1945,7 +1945,7 @@ void DoPlayerZrange(PLAYER* pp)
auto bakcstat = actor->spr.cstat;
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK);
FAFgetzrange(pp->PlayerNowPosition.plusZ(8), pp->cursector, &pp->hiz, &ceilhit, &pp->loz, &florhit, actor->clipdist - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
FAFgetzrange(pp->posGet().plusZ(8), pp->cursector, &pp->hiz, &ceilhit, &pp->loz, &florhit, actor->clipdist - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
actor->spr.cstat = bakcstat;
Collision ceilColl(ceilhit);
@ -2009,7 +2009,7 @@ void DoPlayerSlide(PLAYER* pp)
if (abs(pp->slide_vect.X) < 0.05 && abs(pp->slide_vect.Y) < 0.05)
pp->slide_vect.Zero();
push_ret = pushmove(pp->PlayerNowPosition, &pp->cursector, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
push_ret = pushmove(pp->posXY(), pp->posZget(), &pp->cursector, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0)
{
if (!(pp->Flags & PF_DEAD))
@ -2023,10 +2023,10 @@ void DoPlayerSlide(PLAYER* pp)
return;
}
Collision coll;
clipmove(pp->PlayerNowPosition, &pp->cursector, pp->slide_vect, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
clipmove(pp->posXY(), pp->posZget(), &pp->cursector, pp->slide_vect, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
PlayerCheckValidMove(pp);
push_ret = pushmove(pp->PlayerNowPosition, &pp->cursector, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
push_ret = pushmove(pp->posXY(), pp->posZget(), &pp->cursector, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0)
{
if (!(pp->Flags & PF_DEAD))
@ -2078,7 +2078,7 @@ void PlayerSectorBound(PLAYER* pp, double amt)
// called from DoPlayerMove() but can be called
// from anywhere it is needed
calcSlope(pp->cursector, pp->PlayerNowPosition, &cz, &fz);
calcSlope(pp->cursector, pp->posGet(), &cz, &fz);
if (pp->posZget() > fz - amt)
pp->posZset(fz - amt);
@ -2119,7 +2119,7 @@ void DoPlayerMove(PLAYER* pp)
DoPlayerTurn(pp, pp->input.avel, 1);
}
pp->PlayerOldPosition = pp->PlayerNowPosition;
pp->PlayerOldPosition = pp->posGet();
pp->lastcursector = pp->cursector;
if (PLAYER_MOVING(pp) == 0)
@ -2166,13 +2166,13 @@ void DoPlayerMove(PLAYER* pp)
pp->PlayerPrevPosition.XY() = pp->posXY();
}
pp->posAdd(pp->vect);
updatesector(pp->PlayerNowPosition, &sect);
updatesector(pp->posGet(), &sect);
if (sect != nullptr)
pp->cursector = sect;
}
else
{
push_ret = pushmove(pp->PlayerNowPosition, &pp->cursector, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
push_ret = pushmove(pp->posXY(), pp->posZget(), &pp->cursector, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
if (push_ret < 0)
{
@ -2194,13 +2194,13 @@ void DoPlayerMove(PLAYER* pp)
auto save_cstat = actor->spr.cstat;
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK);
Collision coll;
updatesector(pp->PlayerNowPosition, &pp->cursector);
clipmove(pp->PlayerNowPosition, &pp->cursector, pp->vect, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
updatesector(pp->posGet(), &pp->cursector);
clipmove(pp->posXY(), pp->posZget(), &pp->cursector, pp->vect, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
actor->spr.cstat = save_cstat;
PlayerCheckValidMove(pp);
push_ret = pushmove(pp->PlayerNowPosition, &pp->cursector, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
push_ret = pushmove(pp->posXY(), pp->posZget(), &pp->cursector, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
if (push_ret < 0)
{
@ -2222,7 +2222,7 @@ void DoPlayerMove(PLAYER* pp)
}
// check for warp - probably can remove from CeilingHit
if (WarpPlane(pp->PlayerNowPosition, &pp->cursector))
if (WarpPlane(pp->posGet(), &pp->cursector))
{
PlayerWarpUpdatePos(pp);
}
@ -2278,21 +2278,21 @@ void DoPlayerSectorUpdatePreMove(PLAYER* pp)
if ((pp->cursector->extra & SECTFX_DYNAMIC_AREA))
{
updatesectorz(pp->PlayerNowPosition, &sect);
updatesectorz(pp->posGet(), &sect);
if (sect == nullptr)
{
sect = pp->cursector;
updatesector(pp->PlayerNowPosition, &sect);
updatesector(pp->posGet(), &sect);
}
ASSERT(sect);
}
else if (FAF_ConnectArea(sect))
{
updatesectorz(pp->PlayerNowPosition, &sect);
updatesectorz(pp->posGet(), &sect);
if (sect == nullptr)
{
sect = pp->cursector;
updatesector(pp->PlayerNowPosition, &sect);
updatesector(pp->posGet(), &sect);
}
ASSERT(sect);
}
@ -2314,7 +2314,7 @@ void DoPlayerSectorUpdatePostMove(PLAYER* pp)
// need to do updatesectorz if in connect area
if (sect != nullptr && FAF_ConnectArea(sect))
{
updatesectorz(pp->PlayerNowPosition, &pp->cursector);
updatesectorz(pp->posGet(), &pp->cursector);
// can mess up if below
if (!pp->insector())
@ -2322,7 +2322,7 @@ void DoPlayerSectorUpdatePostMove(PLAYER* pp)
pp->setcursector(sect);
// adjust the posz to be in a sector
calcSlope(pp->cursector, pp->PlayerNowPosition, &cz, &fz);
calcSlope(pp->cursector, pp->posGet(), &cz, &fz);
if (pp->posZget() > fz)
pp->posZset(fz);
@ -2330,7 +2330,7 @@ void DoPlayerSectorUpdatePostMove(PLAYER* pp)
pp->posZset(cz);
// try again
updatesectorz(pp->PlayerNowPosition, &pp->cursector);
updatesectorz(pp->posGet(), &pp->cursector);
}
}
else
@ -2784,7 +2784,7 @@ void DoPlayerMoveVehicle(PLAYER* pp)
if (pp->sop->clipdist)
{
Collision coll;
clipmove(pp->PlayerNowPosition, &pp->cursector, pp->vect, pp->sop->clipdist, 4., floordist, CLIPMASK_PLAYER, actor->user.coll);
clipmove(pp->posXY(), pp->posZget(), &pp->cursector, pp->vect, pp->sop->clipdist, 4., floordist, CLIPMASK_PLAYER, actor->user.coll);
}
else
{
@ -3063,7 +3063,7 @@ void DoPlayerForceJump(PLAYER* pp)
pp->posZadd(pp->jump_speed * JUMP_FACTOR);
// if player gets to close the ceiling while jumping
//if (pp->PlayerNowPositionz < pp->hiz + Z(4))
//if (pp->posGet()z < pp->hiz + Z(4))
if (PlayerCeilingHit(pp, pp->hiz + 4))
{
// put player at the ceiling
@ -3494,11 +3494,11 @@ void DoPlayerClimb(PLAYER* pp)
if (FAF_ConnectArea(pp->cursector))
{
updatesectorz(pp->PlayerNowPosition, &pp->cursector);
updatesectorz(pp->posGet(), &pp->cursector);
LadderUpdate = true;
}
if (WarpPlane(pp->PlayerNowPosition, &pp->cursector))
if (WarpPlane(pp->posGet(), &pp->cursector))
{
PlayerWarpUpdatePos(pp);
LadderUpdate = true;
@ -3510,7 +3510,7 @@ void DoPlayerClimb(PLAYER* pp)
HitInfo near;
// constantly look for new ladder sector because of warping at any time
neartag(pp->PlayerNowPosition, pp->cursector, pp->angle.ang, near, 50., NT_Lotag | NT_Hitag | NT_NoSpriteCheck);
neartag(pp->posGet(), pp->cursector, pp->angle.ang, near, 50., NT_Lotag | NT_Hitag | NT_NoSpriteCheck);
if (near.hitWall)
{
@ -3753,7 +3753,7 @@ void PlayerWarpUpdatePos(PLAYER* pp)
if (Prediction)
return;
pp->PlayerPrevPosition = pp->PlayerNowPosition;
pp->PlayerPrevPosition = pp->posGet();
DoPlayerZrange(pp);
UpdatePlayerSprite(pp);
}
@ -3871,7 +3871,7 @@ bool PlayerOnLadder(PLAYER* pp)
if (Prediction)
return false;
neartag(pp->PlayerNowPosition, pp->cursector, pp->angle.ang, near, 64. + 48., NT_Lotag | NT_Hitag);
neartag(pp->posGet(), pp->cursector, pp->angle.ang, near, 64. + 48., NT_Lotag | NT_Hitag);
double dir = pp->vect.dot(pp->angle.ang.ToVector());
@ -3883,12 +3883,12 @@ bool PlayerOnLadder(PLAYER* pp)
for (i = 0; i < SIZ(angles); i++)
{
neartag(pp->PlayerNowPosition, pp->cursector, pp->angle.ang + angles[i], near, 37.5, NT_Lotag | NT_Hitag | NT_NoSpriteCheck);
neartag(pp->posGet(), pp->cursector, pp->angle.ang + angles[i], near, 37.5, NT_Lotag | NT_Hitag | NT_NoSpriteCheck);
if (near.hitWall == nullptr || near.hitpos.X < 6.25 || near.hitWall->lotag != TAG_WALL_CLIMB)
return false;
FAFhitscan(pp->PlayerNowPosition, pp->cursector, DVector3((pp->angle.ang + angles[i]).ToVector() * 1024, 0), hit, CLIPMASK_MISSILE);
FAFhitscan(pp->posGet(), pp->cursector, DVector3((pp->angle.ang + angles[i]).ToVector() * 1024, 0), hit, CLIPMASK_MISSILE);
if (hit.actor() != nullptr)
{
@ -4274,7 +4274,7 @@ void DoPlayerWarpToUnderwater(PLAYER* pp)
auto over = over_act->sector();
auto under = under_act->sector();
if (GetOverlapSector(pp->PlayerNowPosition, &over, &under) == 2)
if (GetOverlapSector(pp->posGet(), &over, &under) == 2)
{
pp->setcursector(under);
}
@ -4283,7 +4283,7 @@ void DoPlayerWarpToUnderwater(PLAYER* pp)
pp->posZset(under_act->sector()->ceilingz + 6);
pp->PlayerPrevPosition = pp->PlayerNowPosition;
pp->PlayerPrevPosition = pp->posGet();
DoPlayerZrange(pp);
return;
@ -4346,7 +4346,7 @@ void DoPlayerWarpToSurface(PLAYER* pp)
auto over = over_act->sector();
auto under = under_act->sector();
if (GetOverlapSector(pp->PlayerNowPosition, &over, &under))
if (GetOverlapSector(pp->posGet(), &over, &under))
{
pp->setcursector(over);
}
@ -4359,7 +4359,7 @@ void DoPlayerWarpToSurface(PLAYER* pp)
pp->posZadd(-pp->WadeDepth);
pp->PlayerPrevPosition = pp->PlayerNowPosition;
pp->PlayerPrevPosition = pp->posGet();
return;
}
@ -4692,7 +4692,7 @@ void DoPlayerDive(PLAYER* pp)
auto sect = pp->cursector;
// check for sector above to see if it is an underwater sector also
updatesectorz(DVector3(pp->PlayerNowPosition, pp->cursector->ceilingz - 8), &sect);
updatesectorz(DVector3(pp->posGet(), pp->cursector->ceilingz - 8), &sect);
if (!SectorIsUnderwaterArea(sect))
{
@ -4830,7 +4830,7 @@ void DoPlayerCurrent(PLAYER* pp)
auto vect = sectu->angle.ToVector() / 256. * sectu->speed * synctics; // 16384 >> 4 - Beware of clipmove's odd format for vect!
push_ret = pushmove(pp->PlayerNowPosition, &pp->cursector, pp->actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
push_ret = pushmove(pp->posXY(), pp->posZget(), &pp->cursector, pp->actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0)
{
if (!(pp->Flags & PF_DEAD))
@ -4846,10 +4846,10 @@ void DoPlayerCurrent(PLAYER* pp)
return;
}
Collision coll;
clipmove(pp->PlayerNowPosition, &pp->cursector, vect, pp->actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
clipmove(pp->posXY(), pp->posZget(), &pp->cursector, vect, pp->actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
PlayerCheckValidMove(pp);
pushmove(pp->PlayerNowPosition, &pp->cursector, pp->actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
pushmove(pp->posXY(), pp->posZget(), &pp->cursector, pp->actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0)
{
if (!(pp->Flags & PF_DEAD))
@ -5245,8 +5245,8 @@ void DoPlayerBeginOperate(PLAYER* pp)
pp->angle.oang = pp->angle.ang = sop->ang;
pp->posXY() = sop->pmid.XY();
updatesector(pp->PlayerNowPosition, &pp->cursector);
calcSlope(pp->cursector, pp->PlayerNowPosition, &cz, &fz);
updatesector(pp->posGet(), &pp->cursector);
calcSlope(pp->cursector, pp->posGet(), &cz, &fz);
pp->posZset(fz - PLAYER_HEIGHTF);
pp->Flags &= ~(PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL);
@ -5335,8 +5335,8 @@ void DoPlayerBeginRemoteOperate(PLAYER* pp, SECTOR_OBJECT* sop)
pp->angle.oang = pp->angle.ang = sop->ang;
pp->posXY() = sop->pmid.XY();
updatesector(pp->PlayerNowPosition, &pp->cursector);
calcSlope(pp->cursector, pp->PlayerNowPosition, &cz, &fz);
updatesector(pp->posGet(), &pp->cursector);
calcSlope(pp->cursector, pp->posGet(), &cz, &fz);
pp->posZset(fz - PLAYER_HEIGHTF);
pp->Flags &= ~(PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL);
@ -5395,7 +5395,7 @@ void PlayerToRemote(PLAYER* pp)
pp->remote.cursectp = pp->cursector;
pp->remote.lastcursectp = pp->lastcursector;
pp->remote.pos = pp->PlayerNowPosition;
pp->remote.pos = pp->posGet();
pp->remote.vect = pp->vect;
pp->remote.ovect = pp->ovect;
@ -6091,7 +6091,7 @@ void DoPlayerDeathFollowKiller(PLAYER* pp)
DSWActor* killer = pp->KillerActor;
if (killer)
{
if (FAFcansee(ActorVectOfTop(killer), killer->sector(), pp->PlayerNowPosition, pp->cursector))
if (FAFcansee(ActorVectOfTop(killer), killer->sector(), pp->posGet(), pp->cursector))
{
pp->angle.addadjustment(deltaangle(pp->angle.ang, (killer->spr.pos.XY() - pp->posXY()).Angle()) * (1. / 16.));
}
@ -6132,7 +6132,7 @@ void DoPlayerDeathCheckKeys(PLAYER* pp)
plActor->spr.picnum = plActor->user.State->Pic;
plActor->spr.scale = DVector2(PLAYER_NINJA_XREPEAT, PLAYER_NINJA_XREPEAT);
plActor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
plActor->spr.pos = pp->PlayerNowPosition.plusZ(PLAYER_HEIGHTF);
plActor->spr.pos = pp->posGet().plusZ(PLAYER_HEIGHTF);
plActor->spr.angle = pp->angle.ang;
DoSpawnTeleporterEffect(plActor);
@ -6307,7 +6307,7 @@ void DoPlayerDeathMoveHead(PLAYER* pp)
// try to stay in valid area - death sometimes throws you out of the map
auto sect = pp->cursector;
updatesector(pp->PlayerNowPosition, &sect);
updatesector(pp->posGet(), &sect);
if (sect == nullptr)
{
pp->cursector = pp->lv_sector;
@ -6818,7 +6818,7 @@ void MoveSkipSavePos(void)
{
pp = Player + pnum;
pp->PlayerPrevPosition = pp->PlayerNowPosition;
pp->PlayerPrevPosition = pp->posGet();
pp->obob_z = pp->bob_z;
pp->angle.backup();
pp->horizon.backup();
@ -7099,7 +7099,7 @@ void domovethings(void)
// auto tracking mode for single player multi-game
if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex)
{
Player[screenpeek].angle.settarget((Player[myconnectindex].PlayerNowPosition - Player[screenpeek].PlayerNowPosition).Angle());
Player[screenpeek].angle.settarget((Player[myconnectindex].posGet() - Player[screenpeek].posGet()).Angle());
}
if (!(pp->Flags & PF_DEAD))
@ -7174,8 +7174,8 @@ void InitAllPlayers(void)
// Initialize all [MAX_SW_PLAYERS] arrays here!
for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++)
{
pp->posSet(pfirst->PlayerNowPosition);
pp->PlayerPrevPosition = pfirst->PlayerNowPosition;
pp->posSet(pfirst->posGet());
pp->PlayerPrevPosition = pfirst->posGet();
pp->angle.ang = pp->angle.oang = pfirst->angle.ang;
pp->horizon.horiz = pp->horizon.ohoriz = pfirst->horizon.horiz;
pp->cursector = pfirst->cursector;
@ -7336,11 +7336,11 @@ void PlayerSpawnPosition(PLAYER* pp)
ASSERT(spawn_sprite != nullptr);
pp->posSet(spawn_sprite->spr.pos);
pp->PlayerPrevPosition = pp->PlayerNowPosition;
pp->PlayerPrevPosition = pp->posGet();
pp->angle.ang = pp->angle.oang = spawn_sprite->spr.angle;
pp->setcursector(spawn_sprite->sector());
calcSlope(pp->cursector, pp->PlayerNowPosition, &cz, &fz);
calcSlope(pp->cursector, pp->posGet(), &cz, &fz);
// if too close to the floor - stand up
if (pp->posZget() > fz - PLAYER_HEIGHTF)
{
@ -7400,7 +7400,7 @@ void InitMultiPlayerInfo(void)
continue;
}
auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, pp->PlayerNowPosition, pp->angle.ang);
auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, pp->posGet(), pp->angle.ang);
start0->clearUser();
start0->spr.picnum = ST1;
}

View file

@ -195,7 +195,7 @@ void QuakeViewChange(PLAYER* pp, DVector3& tpos, DAngle& tang)
SWStatIterator it(STAT_QUAKE_ON);
while ((actor = it.Next()))
{
auto dist = (pp->PlayerNowPosition - actor->spr.pos).Length();
auto dist = (pp->posGet() - actor->spr.pos).Length();
// shake whole level
if (QUAKE_TestDontTaper(actor))
@ -277,7 +277,7 @@ void SpawnQuake(sectortype* sect, const DVector3& pos, int tics, int amt, int ra
bool SetQuake(PLAYER* pp, short tics, short amt)
{
SpawnQuake(pp->cursector, pp->PlayerNowPosition, tics, amt, 30000);
SpawnQuake(pp->cursector, pp->posGet(), tics, amt, 30000);
return false;
}
@ -295,7 +295,7 @@ int SetGunQuake(DSWActor* actor)
int SetPlayerQuake(PLAYER* pp)
{
SpawnQuake(pp->cursector, pp->PlayerNowPosition, 40, 8, 40000);
SpawnQuake(pp->cursector, pp->posGet(), 40, 8, 40000);
return 0;
}

View file

@ -574,7 +574,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER*
}
if (arc.isReading())
{
w.PlayerPrevPosition = w.PlayerNowPosition;
w.PlayerPrevPosition = w.posGet();
w.ovect = w.vect;
w.obob_z = w.bob_z;
w.input = {};

View file

@ -1549,7 +1549,7 @@ int OperateSprite(DSWActor* actor, short player_is_operating)
{
pp = GlobPlayerP;
if (!FAFcansee(pp->PlayerNowPosition, pp->cursector, actor->spr.pos.plusZ(ActorSizeZ(actor) * -0.5), actor->sector()))
if (!FAFcansee(pp->posGet(), pp->cursector, actor->spr.pos.plusZ(ActorSizeZ(actor) * -0.5), actor->sector()))
return false;
}
@ -2140,7 +2140,7 @@ bool NearThings(PLAYER* pp)
return false;
}
neartag(pp->PlayerNowPosition, pp->cursector, pp->angle.ang, near, 64., NT_Lotag | NT_Hitag);
neartag(pp->posGet(), pp->cursector, pp->angle.ang, near, 64., NT_Lotag | NT_Hitag);
// hit a sprite? Check to see if it has sound info in it!
@ -2173,7 +2173,7 @@ bool NearThings(PLAYER* pp)
{
HitInfo hit{};
FAFhitscan(pp->PlayerNowPosition.plusZ(-30), pp->cursector, DVector3(pp->angle.ang.ToVector() * 1024, 0), hit, CLIPMASK_MISSILE);
FAFhitscan(pp->posGet().plusZ(-30), pp->cursector, DVector3(pp->angle.ang.ToVector() * 1024, 0), hit, CLIPMASK_MISSILE);
if (hit.hitSector == nullptr)
return false;
@ -2346,7 +2346,7 @@ int DoPlayerGrabStar(PLAYER* pp)
auto actor = StarQueue[i];
if (actor != nullptr)
{
if ((actor->spr.pos - pp->PlayerNowPosition).plusZ(12).Length() < 31.25)
if ((actor->spr.pos - pp->posGet()).plusZ(12).Length() < 31.25)
{
break;
}

View file

@ -122,7 +122,7 @@ short SoundDist(const DVector3& pos, int basedist)
double sqrdist;
extern short screenpeek;
double distance = (Player[screenpeek].PlayerNowPosition - pos).Length() * 16;
double distance = (Player[screenpeek].posGet() - pos).Length() * 16;
if (basedist < 0) // if basedist is negative
{
@ -374,7 +374,7 @@ static void UpdateAmbients()
if (sdist < 255 && amb->vocIndex.index() == DIGI_WHIPME)
{
PLAYER* pp = Player + screenpeek;
if (!FAFcansee(spot->spr.pos, spot->sector(), pp->PlayerNowPosition, pp->cursector))
if (!FAFcansee(spot->spr.pos, spot->sector(), pp->posGet(), pp->cursector))
{
sdist = 255;
}
@ -513,7 +513,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
if (pos != nullptr)
{
PLAYER* pp = Player + screenpeek;
FVector3 campos = GetSoundPos(pp->PlayerNowPosition);
FVector3 campos = GetSoundPos(pp->posGet());
DVector3 vPos = {};
bool pancheck = false;
@ -527,7 +527,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
}
else if (type == SOURCE_Actor || type == SOURCE_Player)
{
vPos = type == SOURCE_Actor ? ((DSWActor*)source)->spr.pos : ((PLAYER*)source)->PlayerNowPosition;
vPos = type == SOURCE_Actor ? ((DSWActor*)source)->spr.pos : ((PLAYER*)source)->posGet();
pancheck = true;
FVector3 npos = GetSoundPos(vPos);
@ -556,7 +556,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
// Can the ambient sound see the player? If not, tone it down some.
if ((chanflags & CHANF_LOOP))
{
if (!FAFcansee(vPos, spot->sector(), pp->PlayerNowPosition, pp->cursector))
if (!FAFcansee(vPos, spot->sector(), pp->posGet(), pp->cursector))
{
auto distvec = npos - campos;
npos = campos + distvec * 1.75f; // Play more quietly
@ -605,7 +605,7 @@ void GameInterface::UpdateSounds(void)
listener.angle = float(-tang.Radians());
listener.velocity.Zero();
listener.position = GetSoundPos(pp->PlayerNowPosition);
listener.position = GetSoundPos(pp->posGet());
listener.underwater = false;
// This should probably use a real environment instead of the pitch hacking in S_PlaySound3D.
// listenactor->waterlevel == 3;
@ -649,7 +649,7 @@ int _PlaySound(int num, DSWActor* actor, PLAYER* pp, const DVector3* const ppos,
}
else if (pp && !ppos)
{
pos = pp->PlayerNowPosition;
pos = pp->posGet();
pp = nullptr;
sourcetype = SOURCE_Unattached;
}

View file

@ -5147,7 +5147,7 @@ int DoGet(DSWActor* actor)
auto cstat_bak = actor->spr.cstat;
actor->spr.cstat |= (CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
can_see = FAFcansee(actor->spr.pos, actor->sector(), pp->PlayerNowPosition, pp->cursector);
can_see = FAFcansee(actor->spr.pos, actor->sector(), pp->posGet(), pp->cursector);
actor->spr.cstat = cstat_bak;
if (!can_see)

View file

@ -797,7 +797,7 @@ void BossHealthMeter(void)
DSWActor* actor = BossSpriteNum[i];
if (actor != nullptr && !bosswasseen[i])
{
if (cansee(ActorVectOfTop(actor), actor->sector(), pp->PlayerNowPosition.plusZ(-40), pp->cursector))
if (cansee(ActorVectOfTop(actor), actor->sector(), pp->posGet().plusZ(-40), pp->cursector))
{
if (i == 0 && !bosswasseen[0])
{

View file

@ -1735,7 +1735,7 @@ PlayerPart:
// prevents you from falling into map HOLEs created by moving
// Sectors and sprites around.
//if (!SO_EMPTY(sop))
updatesector(pp->PlayerNowPosition, &pp->cursector);
updatesector(pp->posGet(), &pp->cursector);
// in case you are in a whirlpool
// move perfectly with the ride in the z direction

View file

@ -106,7 +106,7 @@ void VisViewChange(PLAYER* pp, int *vis)
}
// save off the brightest vis that you can see
if (FAFcansee(pp->PlayerNowPosition, pp->cursector, pos, sectp))
if (FAFcansee(pp->posGet(), pp->cursector, pos, sectp))
{
if (VIS_VisCur(actor) < BrightestVis)
BrightestVis = VIS_VisCur(actor);

View file

@ -11594,7 +11594,7 @@ void InitSpellRing(PLAYER* pp)
for (missiles = 0, ang = ang_start; missiles < max_missiles; ang += ang_diff, missiles++)
{
auto actorNew = SpawnActor(STAT_MISSILE_SKIP4, FIREBALL1, s_Ring, pp->cursector, pp->PlayerNowPosition, ang, 0);
auto actorNew = SpawnActor(STAT_MISSILE_SKIP4, FIREBALL1, s_Ring, pp->cursector, pp->posGet(), ang, 0);
actorNew->spr.hitag = LUMINOUS; //Always full brightness
actorNew->vel.X = 31.25;
@ -11971,7 +11971,7 @@ void InitSpellNapalm(PLAYER* pp)
for (i = 0; i < SIZ(mp); i++)
{
auto actor = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, pp->cursector,
pp->PlayerNowPosition.plusZ(12), pp->angle.ang, NAPALM_VELOCITY*2);
pp->posGet().plusZ(12), pp->angle.ang, NAPALM_VELOCITY*2);
actor->spr.hitag = LUMINOUS; //Always full brightness
@ -12106,7 +12106,7 @@ int InitSpellMirv(PLAYER* pp)
if (!pp->insector())
return 0;
auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursector, pp->PlayerNowPosition.plusZ(12), pp->angle.ang, MIRV_VELOCITY);
auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursector, pp->posGet().plusZ(12), pp->angle.ang, MIRV_VELOCITY);
PlaySound(DIGI_MIRVWIZ, actorNew, v3df_follow);
@ -12250,12 +12250,12 @@ int InitSwordAttack(PLAYER* pp)
double dax = 1024., daz = 0;
DAngle daang = pp->angle.ang;
setFreeAimVelocity(dax, daz, pp->horizon.horiz, 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.));
FAFhitscan(pp->PlayerNowPosition, pp->cursector, DVector3(pp->angle.ang.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
FAFhitscan(pp->posGet(), pp->cursector, DVector3(pp->angle.ang.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
if (hit.hitSector == nullptr)
return 0;
if ((pp->PlayerNowPosition - hit.hitpos).Length() < 43.75)
if ((pp->posGet() - hit.hitpos).Length() < 43.75)
{
if (hit.actor() != nullptr)
@ -12428,12 +12428,12 @@ int InitFistAttack(PLAYER* pp)
double dax = 1024., daz = 0;
auto daang = pp->angle.ang;
setFreeAimVelocity(dax, daz, pp->horizon.horiz, 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.));
FAFhitscan(pp->PlayerNowPosition, pp->cursector, DVector3(pp->angle.ang.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
FAFhitscan(pp->posGet(), pp->cursector, DVector3(pp->angle.ang.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
if (hit.hitSector == nullptr)
return 0;
if ((pp->PlayerNowPosition - hit.hitpos).Length() < 43.75)
if ((pp->posGet() - hit.hitpos).Length() < 43.75)
{
if (hit.actor() != nullptr)
@ -12975,7 +12975,7 @@ int InitStar(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 8);
auto pos = pp->posGet().plusZ(pp->bob_z + 8);
// Spawn a shot
// Inserting and setting up variables
@ -13080,7 +13080,7 @@ void InitHeartAttack(PLAYER* pp)
return;
auto actorNew = SpawnActor(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursector,
pp->PlayerNowPosition.plusZ(12), pp->angle.ang, BLOOD_WORM_VELOCITY*2);
pp->posGet().plusZ(12), pp->angle.ang, BLOOD_WORM_VELOCITY*2);
actorNew->spr.hitag = LUMINOUS; //Always full brightness
@ -13223,7 +13223,7 @@ int InitShotgun(PLAYER* pp)
}
}
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z);
auto pos = pp->posGet().plusZ(pp->bob_z);
double dax = 1024.;
double daz = pos.Z;
@ -13378,7 +13378,7 @@ int InitLaser(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 8);
auto pos = pp->posGet().plusZ(pp->bob_z + 8);
// Spawn a shot
// Inserting and setting up variables
@ -13476,7 +13476,7 @@ int InitRail(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 11);
auto pos = pp->posGet().plusZ(pp->bob_z + 11);
// Spawn a shot
// Inserting and setting up variables
@ -13641,7 +13641,7 @@ int InitRocket(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 8);
auto pos = pp->posGet().plusZ(pp->bob_z + 8);
// Spawn a shot
// Inserting and setting up variables
@ -13748,7 +13748,7 @@ int InitBunnyRocket(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 8);
auto pos = pp->posGet().plusZ(pp->bob_z + 8);
// Spawn a shot
// Inserting and setting up variables
@ -13850,7 +13850,7 @@ int InitNuke(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 8);
auto pos = pp->posGet().plusZ(pp->bob_z + 8);
// Spawn a shot
// Inserting and setting up variables
@ -14034,7 +14034,7 @@ int InitMicro(PLAYER* pp)
angle = pp->angle.ang;
}
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 4 + RandomRange(20));
auto pos = pp->posGet().plusZ(pp->bob_z + 4 + RandomRange(20));
// Spawn a shot
// Inserting and setting up variables
@ -15226,7 +15226,7 @@ int InitTracerUzi(PLAYER* pp)
// Spawn a shot
// Inserting and setting up variables
auto actorNew = SpawnActor(STAT_MISSILE, 0, s_Tracer, pp->cursector, pp->PlayerNowPosition.plusZ(nz), pp->angle.ang, TRACER_VELOCITY);
auto actorNew = SpawnActor(STAT_MISSILE, 0, s_Tracer, pp->cursector, pp->posGet().plusZ(nz), pp->angle.ang, TRACER_VELOCITY);
actorNew->spr.hitag = LUMINOUS; //Always full brightness
SetOwner(pp->actor, actorNew);
@ -16662,7 +16662,7 @@ int InitGrenade(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 8);
auto pos = pp->posGet().plusZ(pp->bob_z + 8);
// Spawn a shot
// Inserting and setting up variables
@ -16800,7 +16800,7 @@ int InitMine(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 8);
auto pos = pp->posGet().plusZ(pp->bob_z + 8);
// Spawn a shot
// Inserting and setting up variables
@ -16931,7 +16931,7 @@ int InitFireball(PLAYER* pp)
if (!pp->insector())
return 0;
auto pos = pp->PlayerNowPosition.plusZ(pp->bob_z + 15);
auto pos = pp->posGet().plusZ(pp->bob_z + 15);
auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursector, pos, pp->angle.ang, FIREBALL_VELOCITY);

View file

@ -40,7 +40,7 @@ inline DAngle AngToSprite(DSWActor* actor, DSWActor* other)
inline DAngle AngToPlayer(PLAYER* player, DSWActor* other)
{
return (player->PlayerNowPosition - other->spr.pos).Angle();
return (player->posGet() - other->spr.pos).Angle();
}

View file

@ -787,7 +787,7 @@ void SpawnZombie(PLAYER* pp, DSWActor* weaponActor)
if (ownerActor == nullptr)
return;
auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->PlayerNowPosition, pp->angle.ang, 0);
auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->posGet(), pp->angle.ang, 0);
SetOwner(actorNew, ownerActor);
actorNew->spr.pal = actorNew->user.spal = ownerActor->user.spal;
actorNew->spr.angle = RandomAngle();