- Duke: Ensure player_struct::GetActor() is exclusively used to get the player's actor.

This commit is contained in:
Mitchell Richters 2023-09-30 20:30:38 +10:00
parent 2755b17fd5
commit 6d6872fea7
9 changed files with 11 additions and 11 deletions

View file

@ -474,7 +474,7 @@ void thunder(void)
if (seen)
{
if (ps[screenpeek].actor->sector()->ceilingstat & CSTAT_SECTOR_SKY)
if (ps[screenpeek].GetActor()->sector()->ceilingstat & CSTAT_SECTOR_SKY)
{
g_relvisibility = 0;
if (krand() > 65000)

View file

@ -16,7 +16,7 @@ inline DDukeActor* player_struct::GetActor()
inline int player_struct::GetPlayerNum()
{
return actor->PlayerIndex();
return GetActor()->PlayerIndex();
}
DDukeActor* spawn(DDukeActor* spawner, PClassActor* pname);

View file

@ -905,7 +905,7 @@ CCMD(changewalltexture)
FTextureID tile = TexMan.CheckForTexture(argv[1], ETextureType::Any);
if (!tile.isValid()) tile = tileGetTextureID((int)strtol(argv[1], nullptr, 10));
HitInfoBase hit;
hitscan(ps[0].actor->spr.pos, ps[0].cursector, DVector3(ps[0].actor->spr.Angles.Yaw.ToVector(), 0) * 1024, hit, CLIPMASK1);
hitscan(ps[0].GetActor()->spr.pos, ps[0].cursector, DVector3(ps[0].GetActor()->spr.Angles.Yaw.ToVector(), 0) * 1024, hit, CLIPMASK1);
if (hit.hitWall)
{
hit.hitWall->setwalltexture(tile);

View file

@ -377,7 +377,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
DukeSectIterator it(ii);
while (auto act = it.Next())
{
if (act == ps[screenpeek].actor || (act->spr.cstat & CSTAT_SPRITE_INVISIBLE) || act->spr.cstat == CSTAT_SPRITE_BLOCK_ALL || act->spr.scale.X == 0) continue;
if (act == ps[screenpeek].GetActor() || (act->spr.cstat & CSTAT_SPRITE_INVISIBLE) || act->spr.cstat == CSTAT_SPRITE_BLOCK_ALL || act->spr.scale.X == 0) continue;
if ((act->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) != 0)
{

View file

@ -612,7 +612,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_I: // Read only, because this is very dangerous.
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].actor, sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].GetActor(), sActor, sPlayer);
break;
case PLAYER_ONE_PARALLAX_SECTNUM:

View file

@ -504,7 +504,7 @@ void footprints(int snum)
DDukeActor* fprint = spawn(actor, DukeFootprintsClass);
if (fprint)
{
fprint->spr.Angles.Yaw = p->actor->spr.Angles.Yaw;
fprint->spr.Angles.Yaw = p->GetActor()->spr.Angles.Yaw;
fprint->spr.pal = p->footprintpal;
fprint->spr.shade = (int8_t)p->footprintshade;
}
@ -1028,7 +1028,7 @@ int haslock(sectortype* sectp, int snum)
void purplelavacheck(player_struct* p)
{
auto pact = p->actor;
auto pact = p->GetActor();
if (p->spritebridge == 0 && pact->insector())
{
auto sect = pact->sector();

View file

@ -599,7 +599,7 @@ void resetpspritevars(int g, const DVector3& startpos, const DAngle startang)
act->spr.pal = ps[j].palookup = ud.user_pals[j];
ps[j].actor = act;
ps[j].Angles.initialize(ps[j].actor, (currentLevel->levelNumber & 1)? DAngle90 : -DAngle90);
ps[j].Angles.initialize(ps[j].GetActor(), (currentLevel->levelNumber & 1)? DAngle90 : -DAngle90);
ps[j].frag_ps = j;
act->SetOwner(act);

View file

@ -426,7 +426,7 @@ int S_PlaySound3D(FSoundID soundid, DDukeActor* actor, const DVector3& pos, int
if (!soundEngine->isValidSoundId(soundid) || !SoundEnabled() || actor == nullptr || !playrunning() ||
(pl->timebeforeexit > 0 && pl->timebeforeexit <= REALGAMETICSPERSEC * 3)) return -1;
if (flags & CHANF_LOCAL && actor != ps[screenpeek].actor && !ud.coop) return -1; // makes no sense...
if (flags & CHANF_LOCAL && actor != ps[screenpeek].GetActor() && !ud.coop) return -1; // makes no sense...
soundid = GetReplacementSound(soundid);
int userflags = S_GetUserFlags(soundid);

View file

@ -271,7 +271,7 @@ struct player_struct
sectortype* cursector;
sectortype* one_parallax_sectnum; // wall + sector references.
walltype* access_wall;
DDukeActor* actor;
DDukeActor* GetActor();
TObjPtr<DDukeActor*> actorsqu, wackedbyactor, on_crane, holoduke_on, somethingonplayer, access_spritenum, dummyplayersprite, newOwner;
short last_extra, subweapon;
@ -351,7 +351,7 @@ struct player_struct
// input stuff.
InputPacket input;
DDukeActor* GetActor();
DDukeActor* actor;
int GetPlayerNum();
void apply_seasick();