- Exhumed: Manual sweep for last replacements of player index for pointer.

This commit is contained in:
Mitchell Richters 2023-10-04 14:07:45 +11:00 committed by Christoph Oelckers
parent 9871bb4a73
commit 23dd0bab87
5 changed files with 19 additions and 17 deletions

View file

@ -1856,30 +1856,30 @@ void runlist_DamageEnemy(DExhumedActor* pActor, DExhumedActor* pActor2, int nDam
return;
}
int nPlayer = GetPlayerFromActor(pActor2);
const auto pPlayer = getPlayer(GetPlayerFromActor(pActor2));
// Due to the horrible setup we can award the kill to the player only here. Yuck!
Level.kills.player[nPlayer]++;
Level.kills.player[pPlayer->pnum]++;
getPlayer(nPlayer)->nTauntTimer--;
pPlayer->nTauntTimer--;
if (getPlayer(nPlayer)->nTauntTimer <= 0)
if (pPlayer->nTauntTimer <= 0)
{
// Do a taunt
auto pPlayerActor = getPlayer(nPlayer)->GetActor();
auto pPlayerActor = pPlayer->GetActor();
auto pSector = pPlayerActor->sector();
if (!(pSector->Flag & kSectUnderwater))
{
int ebx = 0x4000;
if (nPlayer == nLocalPlayer) {
if (pPlayer->pnum == nLocalPlayer) {
ebx = 0x6000;
}
D3PlayFX(StaticSound[kSoundTauntStart + (RandomSize(3) % 5)], getPlayer(nPlayer)->pDoppleSprite, ebx);
D3PlayFX(StaticSound[kSoundTauntStart + (RandomSize(3) % 5)], pPlayer->pDoppleSprite, ebx);
}
getPlayer(nPlayer)->nTauntTimer = RandomSize(3) + 3;
pPlayer->nTauntTimer = RandomSize(3) + 3;
}
}
}

View file

@ -508,7 +508,7 @@ void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqI
const auto pSector = pTSprite->sectp;
const double nFloorZ = pSector->floorz;
if (nFloorZ <= getPlayer(nLocalPlayer)->GetActor()->viewzoffset + getPlayer(nLocalPlayer)->GetActor()->spr.pos.Z)
if (nFloorZ <= getPlayer(nLocalPlayer)->GetActor()->getOffsetZ())
{
pTSprite->ownerActor = nullptr;
}

View file

@ -702,7 +702,9 @@ void UpdateCreepySounds()
nCreepyTimer--;
if (nCreepyTimer <= 0)
{
if (Level.kills.got < Level.kills.max && !(getPlayer(nLocalPlayer)->pPlayerViewSect->Flag & 0x2000))
const auto pPlayer = getPlayer(nLocalPlayer);
if (Level.kills.got < Level.kills.max && !(pPlayer->pPlayerViewSect->Flag & 0x2000))
{
const auto creepySeq = getSequence("creepy");
const auto seqFrameSound = creepySeq->frames[totalmoves % creepySeq->frames.Size()].sound;
@ -716,7 +718,7 @@ void UpdateCreepySounds()
if (totalmoves & 2)
adder.Y = -adder.Y;
auto sp = getPlayer(nLocalPlayer)->GetActor()->spr.pos + adder;
auto sp = pPlayer->GetActor()->spr.pos + adder;
creepy = GetSoundPos(sp);
auto soundid = FSoundID::fromInt((seqFrameSound & 0x1ff) + 1);

View file

@ -546,9 +546,9 @@ void AISWPressSector::Use(RunListEvent* ev)
int nChannel = SwitchData[nSwitch].nChannel;
int nLink = SwitchData[nSwitch].nLink;
int nPlayer = ev->nParam;
const auto pPlayer = getPlayer(ev->nParam);
if ((getPlayer(nPlayer)->keys & SwitchData[nSwitch].nKeyMask) == SwitchData[nSwitch].nKeyMask)
if ((pPlayer->keys & SwitchData[nSwitch].nKeyMask) == SwitchData[nSwitch].nKeyMask)
{
runlist_ChangeChannel(nChannel, LinkMap[nLink].v[sRunChannels[nChannel].c]);
}
@ -556,7 +556,7 @@ void AISWPressSector::Use(RunListEvent* ev)
{
if (SwitchData[nSwitch].nKeyMask)
{
PlayFXAtXYZ(StaticSound[nSwitchSound], getPlayer(nPlayer)->GetActor()->spr.pos, CHANF_LISTENERZ);
PlayFXAtXYZ(StaticSound[nSwitchSound], pPlayer->GetActor()->spr.pos, CHANF_LISTENERZ);
StatusMessage(300, GStrings("TXT_EX_NEEDKEY"));
}

View file

@ -107,11 +107,11 @@ void DrawView(double interpfrac, bool sceneonly)
{
nCamerapos = pPlayerActor->getRenderPos(interpfrac);
pSector = getPlayer(nLocalPlayer)->pPlayerViewSect;
pSector = pPlayer->pPlayerViewSect;
updatesector(nCamerapos, &pSector);
if (pSector == nullptr) pSector = getPlayer(nLocalPlayer)->pPlayerViewSect;
if (pSector == nullptr) pSector = pPlayer->pPlayerViewSect;
nCameraangles = getPlayer(nLocalPlayer)->Angles.getRenderAngles(interpfrac);
nCameraangles = pPlayer->Angles.getRenderAngles(interpfrac);
if (!bCamera)
{