- SW: Remove PLAYER::posGet().

This commit is contained in:
Mitchell Richters 2022-11-23 20:59:15 +11:00 committed by Christoph Oelckers
parent be06582062
commit 703db0e3c3
20 changed files with 89 additions and 104 deletions

View file

@ -316,7 +316,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
// continue;
}
dist = (actor->spr.pos - pp->posGet()).Length();
dist = (actor->spr.pos - pp->actor->getPosWithOffsetZ()).Length();
if (dist < near_dist)
{
@ -342,7 +342,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
continue;
}
dist = (actor->spr.pos - pp->posGet()).Length();
dist = (actor->spr.pos - pp->actor->getPosWithOffsetZ()).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->posGet(), pp->cursector) && Facing(actor, actor->user.targetActor))
if (FAFcansee(ActorVectOfTop(actor),actor->sector(),pp->actor->getPosWithOffsetZ(), 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->posGet(), pp->cursector) && Facing(actor, actor->user.targetActor))
if (FAFcansee(ActorVectOfTop(actor), actor->sector(), pp->actor->getPosWithOffsetZ(), 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->posprevGet(), pp->posGet(), interpfrac);
tsp->pos = pp->actor->getRenderPos(interpfrac);
tsp->angle = pp->angle.interpolatedang(interpfrac);
}
}
@ -1262,7 +1262,7 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly)
{
if (pp->sop_control && (!cl_sointerpolation || (CommEnabled && !pp->sop_remote)))
{
tpos = pp->posGet();
tpos = pp->actor->getPosWithOffsetZ();
tang = pp->angle.ang;
}
tsect = pp->cursector;

View file

@ -1891,20 +1891,6 @@ struct PLAYER
}
DVector3 posGet()
{
return actor->spr.pos.plusZ(actor->viewzoffset);
}
void posprevSet(const DVector3& val)
{
actor->opos = val.plusZ(-actor->viewzoffset);
}
DVector3 posprevGet()
{
return actor->opos.plusZ(actor->viewzoffset);
}
DVector2& posoldXY()
{
return PlayerOldPosition.XY();
@ -1986,7 +1972,7 @@ inline bool SectorIsUnderwaterArea(sectortype* sect)
inline bool PlayerFacingRange(PLAYER* pp, DSWActor* a, DAngle range)
{
return absangle((a->spr.pos - pp->posGet()).Angle(), pp->angle.ang) < range;
return absangle((a->spr.pos.XY() - pp->actor->spr.pos.XY()).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->posGet() == pp->posprevGet())
if (pp->actor->spr.pos == pp->actor->opos)
DoCam = true;
@ -612,7 +612,7 @@ void JS_DrawCameras(PLAYER* pp, const DVector3& campos, double smoothratio)
if (TEST_BOOL11(camactor) && numplayers > 1)
{
drawroomstotile(cp->posGet(), cp->angle.ang, cp->horizon.horiz, cp->cursector, mirror[cnt].campic, smoothratio);
drawroomstotile(cp->actor->getPosWithOffsetZ(), 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->posGet().plusZ(pp->bob_z + 8);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 8);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet(), zz);
DVector3 spos(pp->actor->getPosWithOffsetZ(), 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->posGet() + ang.ToVector() * sop->clipbox_vdist[i];
opos[i].XY() = pp->actor->getPosWithOffsetZ() + 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->posGet(), zz);
DVector3 spos(pp->actor->getPosWithOffsetZ(), zz);
DVector2 vect = ang.ToVector() * sop->clipbox_vdist[i];
Collision coll;

View file

@ -2475,7 +2475,7 @@ void SpawnPlayerUnderSprite(PLAYER* pp)
int pnum = int(pp - Player);
pp->PlayerUnderActor = SpawnActor(STAT_PLAYER_UNDER0 + pnum,
NINJA_RUN_R0, nullptr, pp->cursector, pp->posGet(), pp->angle.ang);
NINJA_RUN_R0, nullptr, pp->cursector, pp->actor->getPosWithOffsetZ(), pp->angle.ang);
DSWActor* actor = pp->PlayerUnderActor;

View file

@ -1316,7 +1316,7 @@ void DoPlayerTeleportToSprite(PLAYER* pp, DVector3& pos, DAngle ang)
pp->actor->backuppos();
pp->posoldXY() = pp->actor->spr.pos.XY();
updatesector(pp->posGet(), &pp->cursector);
updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector);
pp->Flags2 |= (PF2_TELEPORTED);
}
@ -1331,7 +1331,7 @@ void DoPlayerTeleportToOffset(PLAYER* pp)
pp->posoldXY() = pp->actor->spr.pos.XY();
pp->actor->backupvec2();
updatesector(pp->posGet(), &pp->cursector);
updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector);
pp->Flags2 |= (PF2_TELEPORTED);
}
@ -1920,7 +1920,7 @@ void DoPlayerZrange(PLAYER* pp)
auto bakcstat = actor->spr.cstat;
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK);
FAFgetzrange(pp->posGet().plusZ(8), pp->cursector, &pp->hiz, &ceilhit, &pp->loz, &florhit, actor->clipdist - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
FAFgetzrange(pp->actor->getPosWithOffsetZ().plusZ(8), pp->cursector, &pp->hiz, &ceilhit, &pp->loz, &florhit, actor->clipdist - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
actor->spr.cstat = bakcstat;
Collision ceilColl(ceilhit);
@ -2053,7 +2053,7 @@ void PlayerSectorBound(PLAYER* pp, double amt)
// called from DoPlayerMove() but can be called
// from anywhere it is needed
calcSlope(pp->cursector, pp->posGet(), &cz, &fz);
calcSlope(pp->cursector, pp->actor->getPosWithOffsetZ(), &cz, &fz);
pp->belowFloorZ(fz - amt);
pp->aboveCeilZ(cz + amt);
@ -2090,7 +2090,7 @@ void DoPlayerMove(PLAYER* pp)
DoPlayerTurn(pp, pp->input.avel, 1);
}
pp->posoldSet(pp->posGet());
pp->posoldSet(pp->actor->getPosWithOffsetZ());
pp->lastcursector = pp->cursector;
if (PLAYER_MOVING(pp) == 0)
@ -2137,7 +2137,7 @@ void DoPlayerMove(PLAYER* pp)
actor->backupvec2();
}
actor->spr.pos.XY() += pp->vect;
updatesector(pp->posGet(), &sect);
updatesector(pp->actor->getPosWithOffsetZ(), &sect);
if (sect != nullptr)
pp->cursector = sect;
}
@ -2165,7 +2165,7 @@ void DoPlayerMove(PLAYER* pp)
auto save_cstat = actor->spr.cstat;
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK);
Collision coll;
updatesector(pp->posGet(), &pp->cursector);
updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector);
clipmove(pp->actor->spr.pos.XY(), pp->actor->getOffsetZ(), &pp->cursector, pp->vect, actor->clipdist, pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
actor->spr.cstat = save_cstat;
@ -2243,21 +2243,21 @@ void DoPlayerSectorUpdatePreMove(PLAYER* pp)
if ((pp->cursector->extra & SECTFX_DYNAMIC_AREA))
{
updatesectorz(pp->posGet(), &sect);
updatesectorz(pp->actor->getPosWithOffsetZ(), &sect);
if (sect == nullptr)
{
sect = pp->cursector;
updatesector(pp->posGet(), &sect);
updatesector(pp->actor->getPosWithOffsetZ(), &sect);
}
ASSERT(sect);
}
else if (FAF_ConnectArea(sect))
{
updatesectorz(pp->posGet(), &sect);
updatesectorz(pp->actor->getPosWithOffsetZ(), &sect);
if (sect == nullptr)
{
sect = pp->cursector;
updatesector(pp->posGet(), &sect);
updatesector(pp->actor->getPosWithOffsetZ(), &sect);
}
ASSERT(sect);
}
@ -2279,7 +2279,7 @@ void DoPlayerSectorUpdatePostMove(PLAYER* pp)
// need to do updatesectorz if in connect area
if (sect != nullptr && FAF_ConnectArea(sect))
{
updatesectorz(pp->posGet(), &pp->cursector);
updatesectorz(pp->actor->getPosWithOffsetZ(), &pp->cursector);
// can mess up if below
if (!pp->insector())
@ -2287,12 +2287,12 @@ void DoPlayerSectorUpdatePostMove(PLAYER* pp)
pp->setcursector(sect);
// adjust the posz to be in a sector
calcSlope(pp->cursector, pp->posGet(), &cz, &fz);
calcSlope(pp->cursector, pp->actor->getPosWithOffsetZ(), &cz, &fz);
pp->belowFloorZ(fz);
pp->aboveCeilZ(cz);
// try again
updatesectorz(pp->posGet(), &pp->cursector);
updatesectorz(pp->actor->getPosWithOffsetZ(), &pp->cursector);
}
}
else
@ -3393,7 +3393,7 @@ void DoPlayerClimb(PLAYER* pp)
if (FAF_ConnectArea(pp->cursector))
{
updatesectorz(pp->posGet(), &pp->cursector);
updatesectorz(pp->actor->getPosWithOffsetZ(), &pp->cursector);
LadderUpdate = true;
}
@ -3409,7 +3409,7 @@ void DoPlayerClimb(PLAYER* pp)
HitInfo near;
// constantly look for new ladder sector because of warping at any time
neartag(pp->posGet(), pp->cursector, pp->angle.ang, near, 50., NT_Lotag | NT_Hitag | NT_NoSpriteCheck);
neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->angle.ang, near, 50., NT_Lotag | NT_Hitag | NT_NoSpriteCheck);
if (near.hitWall)
{
@ -3652,7 +3652,7 @@ void PlayerWarpUpdatePos(PLAYER* pp)
if (Prediction)
return;
pp->posprevSet(pp->posGet());
pp->actor->backuppos();
DoPlayerZrange(pp);
UpdatePlayerSprite(pp);
}
@ -3762,7 +3762,7 @@ bool PlayerOnLadder(PLAYER* pp)
if (Prediction)
return false;
neartag(pp->posGet(), pp->cursector, pp->angle.ang, near, 64. + 48., NT_Lotag | NT_Hitag);
neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->angle.ang, near, 64. + 48., NT_Lotag | NT_Hitag);
double dir = pp->vect.dot(pp->angle.ang.ToVector());
@ -3774,12 +3774,12 @@ bool PlayerOnLadder(PLAYER* pp)
for (i = 0; i < SIZ(angles); i++)
{
neartag(pp->posGet(), pp->cursector, pp->angle.ang + angles[i], near, 37.5, NT_Lotag | NT_Hitag | NT_NoSpriteCheck);
neartag(pp->actor->getPosWithOffsetZ(), 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->posGet(), pp->cursector, DVector3((pp->angle.ang + angles[i]).ToVector() * 1024, 0), hit, CLIPMASK_MISSILE);
FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3((pp->angle.ang + angles[i]).ToVector() * 1024, 0), hit, CLIPMASK_MISSILE);
if (hit.actor() != nullptr)
{
@ -4165,7 +4165,7 @@ void DoPlayerWarpToUnderwater(PLAYER* pp)
auto over = over_act->sector();
auto under = under_act->sector();
if (GetOverlapSector(pp->posGet(), &over, &under) == 2)
if (GetOverlapSector(pp->actor->getPosWithOffsetZ(), &over, &under) == 2)
{
pp->setcursector(under);
}
@ -4174,7 +4174,7 @@ void DoPlayerWarpToUnderwater(PLAYER* pp)
plActor->spr.pos.Z = under_act->sector()->ceilingz + 6 - plActor->viewzoffset;
pp->posprevSet(pp->posGet());
plActor->backuppos();
DoPlayerZrange(pp);
return;
@ -4237,7 +4237,7 @@ void DoPlayerWarpToSurface(PLAYER* pp)
auto over = over_act->sector();
auto under = under_act->sector();
if (GetOverlapSector(pp->posGet(), &over, &under))
if (GetOverlapSector(pp->actor->getPosWithOffsetZ(), &over, &under))
{
pp->setcursector(over);
}
@ -4250,7 +4250,7 @@ void DoPlayerWarpToSurface(PLAYER* pp)
plActor->spr.pos.Z -= pp->WadeDepth;
pp->posprevSet(pp->posGet());
plActor->backuppos();
return;
}
@ -4583,7 +4583,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->posGet(), pp->cursector->ceilingz - 8), &sect);
updatesectorz(DVector3(pp->actor->getPosWithOffsetZ(), pp->cursector->ceilingz - 8), &sect);
if (!SectorIsUnderwaterArea(sect))
{
@ -5130,8 +5130,8 @@ void DoPlayerBeginOperate(PLAYER* pp)
pp->angle.oang = pp->angle.ang = sop->ang;
pp->actor->spr.pos.XY() = sop->pmid.XY();
updatesector(pp->posGet(), &pp->cursector);
calcSlope(pp->cursector, pp->posGet(), &cz, &fz);
updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector);
calcSlope(pp->cursector, pp->actor->getPosWithOffsetZ(), &cz, &fz);
pp->setHeightAndZ(fz, PLAYER_HEIGHTF);
pp->Flags &= ~(PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL);
@ -5220,8 +5220,8 @@ void DoPlayerBeginRemoteOperate(PLAYER* pp, SECTOR_OBJECT* sop)
pp->angle.oang = pp->angle.ang = sop->ang;
pp->actor->spr.pos.XY() = sop->pmid.XY();
updatesector(pp->posGet(), &pp->cursector);
calcSlope(pp->cursector, pp->posGet(), &cz, &fz);
updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector);
calcSlope(pp->cursector, pp->actor->getPosWithOffsetZ(), &cz, &fz);
pp->setHeightAndZ(fz, PLAYER_HEIGHTF);
pp->Flags &= ~(PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL);
@ -5280,7 +5280,7 @@ void PlayerToRemote(PLAYER* pp)
pp->remote.cursectp = pp->cursector;
pp->remote.lastcursectp = pp->lastcursector;
pp->remote.pos = pp->posGet();
pp->remote.pos = pp->actor->getPosWithOffsetZ();
pp->remote.vect = pp->vect;
pp->remote.ovect = pp->ovect;
@ -5972,7 +5972,7 @@ void DoPlayerDeathFollowKiller(PLAYER* pp)
DSWActor* killer = pp->KillerActor;
if (killer)
{
if (FAFcansee(ActorVectOfTop(killer), killer->sector(), pp->posGet(), pp->cursector))
if (FAFcansee(ActorVectOfTop(killer), killer->sector(), pp->actor->getPosWithOffsetZ(), pp->cursector))
{
pp->angle.addadjustment(deltaangle(pp->angle.ang, (killer->spr.pos.XY() - pp->actor->spr.pos.XY()).Angle()) * (1. / 16.));
}
@ -6183,7 +6183,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->posGet(), &sect);
updatesector(pp->actor->getPosWithOffsetZ(), &sect);
if (sect == nullptr)
{
pp->cursector = pp->lv_sector;
@ -6697,7 +6697,7 @@ void MoveSkipSavePos(void)
{
pp = Player + pnum;
pp->posprevSet(pp->posGet());
pp->actor->backuppos();
pp->obob_z = pp->bob_z;
pp->angle.backup();
pp->horizon.backup();
@ -6978,7 +6978,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].posGet() - Player[screenpeek].posGet()).Angle());
Player[screenpeek].angle.settarget((Player[myconnectindex].actor->spr.pos.XY() - Player[screenpeek].actor->spr.pos.XY()).Angle());
}
if (!(pp->Flags & PF_DEAD))

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->posGet() - actor->spr.pos).Length();
auto dist = (pp->actor->getPosWithOffsetZ() - 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->posGet(), tics, amt, 30000);
SpawnQuake(pp->cursector, pp->actor->getPosWithOffsetZ(), tics, amt, 30000);
return false;
}
@ -295,7 +295,7 @@ int SetGunQuake(DSWActor* actor)
int SetPlayerQuake(PLAYER* pp)
{
SpawnQuake(pp->cursector, pp->posGet(), 40, 8, 40000);
SpawnQuake(pp->cursector, pp->actor->getPosWithOffsetZ(), 40, 8, 40000);
return 0;
}

View file

@ -571,7 +571,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER*
}
if (arc.isReading())
{
w.posprevSet(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->posGet(), pp->cursector, actor->spr.pos.plusZ(ActorSizeZ(actor) * -0.5), actor->sector()))
if (!FAFcansee(pp->actor->getPosWithOffsetZ(), 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->posGet(), pp->cursector, pp->angle.ang, near, 64., NT_Lotag | NT_Hitag);
neartag(pp->actor->getPosWithOffsetZ(), 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->posGet().plusZ(-30), pp->cursector, DVector3(pp->angle.ang.ToVector() * 1024, 0), hit, CLIPMASK_MISSILE);
FAFhitscan(pp->actor->getPosWithOffsetZ().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->posGet()).plusZ(12).Length() < 31.25)
if ((actor->spr.pos - pp->actor->getPosWithOffsetZ()).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].posGet() - pos).Length() * 16;
double distance = (Player[screenpeek].actor->getPosWithOffsetZ() - 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->posGet(), pp->cursector))
if (!FAFcansee(spot->spr.pos, spot->sector(), pp->actor->getPosWithOffsetZ(), 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->actor ? pp->posGet() : DVector3());
FVector3 campos = GetSoundPos(pp->actor ? pp->actor->getPosWithOffsetZ() : DVector3());
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)->posGet();
vPos = type == SOURCE_Actor ? ((DSWActor*)source)->spr.pos : ((PLAYER*)source)->actor->getPosWithOffsetZ();
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->posGet(), pp->cursector))
if (!FAFcansee(vPos, spot->sector(), pp->actor->getPosWithOffsetZ(), 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->actor ? pp->posGet() : DVector3());
listener.position = GetSoundPos(pp->actor ? pp->actor->getPosWithOffsetZ() : DVector3());
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->posGet();
pos = pp->actor->getPosWithOffsetZ();
pp = nullptr;
sourcetype = SOURCE_Unattached;
}

View file

@ -5148,7 +5148,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->posGet(), pp->cursector);
can_see = FAFcansee(actor->spr.pos, actor->sector(), pp->actor->getPosWithOffsetZ(), 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->posGet().plusZ(-40), pp->cursector))
if (cansee(ActorVectOfTop(actor), actor->sector(), pp->actor->getPosWithOffsetZ().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->posGet(), &pp->cursector);
updatesector(pp->actor->getPosWithOffsetZ(), &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->posGet(), pp->cursector, pos, sectp))
if (FAFcansee(pp->actor->getPosWithOffsetZ(), 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->posGet(), ang, 0);
auto actorNew = SpawnActor(STAT_MISSILE_SKIP4, FIREBALL1, s_Ring, pp->cursector, pp->actor->getPosWithOffsetZ(), 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->posGet().plusZ(12), pp->angle.ang, NAPALM_VELOCITY*2);
pp->actor->getPosWithOffsetZ().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->posGet().plusZ(12), pp->angle.ang, MIRV_VELOCITY);
auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursector, pp->actor->getPosWithOffsetZ().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->posGet(), pp->cursector, DVector3(pp->angle.ang.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3(pp->angle.ang.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
if (hit.hitSector == nullptr)
return 0;
if ((pp->posGet() - hit.hitpos).Length() < 43.75)
if ((pp->actor->getPosWithOffsetZ() - 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->posGet(), pp->cursector, DVector3(pp->angle.ang.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3(pp->angle.ang.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
if (hit.hitSector == nullptr)
return 0;
if ((pp->posGet() - hit.hitpos).Length() < 43.75)
if ((pp->actor->getPosWithOffsetZ() - 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->posGet().plusZ(pp->bob_z + 8);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(12), pp->angle.ang, BLOOD_WORM_VELOCITY*2);
pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 8);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 11);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 8);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 8);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 8);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 4 + RandomRange(20));
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(nz), pp->angle.ang, TRACER_VELOCITY);
auto actorNew = SpawnActor(STAT_MISSILE, 0, s_Tracer, pp->cursector, pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 8);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 8);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet().plusZ(pp->bob_z + 15);
auto pos = pp->actor->getPosWithOffsetZ().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->posGet() - other->spr.pos).Angle();
return (player->actor->getPosWithOffsetZ() - 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->posGet(), pp->angle.ang, 0);
auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->actor->getPosWithOffsetZ(), pp->angle.ang, 0);
SetOwner(actorNew, ownerActor);
actorNew->spr.pal = actorNew->user.spal = ownerActor->user.spal;
actorNew->spr.angle = RandomAngle();