From de3e66016c3262c549b148110e280a57b9079c06 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Dec 2021 08:47:54 +0100 Subject: [PATCH] - removed the Actor() access method from Exhumed's player as well. --- source/games/exhumed/src/grenade.cpp | 6 +++--- source/games/exhumed/src/gun.cpp | 8 ++++---- source/games/exhumed/src/items.cpp | 10 +++++----- source/games/exhumed/src/map.cpp | 4 ++-- source/games/exhumed/src/move.cpp | 10 +++++----- source/games/exhumed/src/osdcmds.cpp | 2 +- source/games/exhumed/src/player.cpp | 16 ++++++++-------- source/games/exhumed/src/player.h | 3 +-- source/games/exhumed/src/ra.cpp | 6 +++--- source/games/exhumed/src/runlist.cpp | 2 +- source/games/exhumed/src/snake.cpp | 4 ++-- source/games/exhumed/src/sound.cpp | 4 ++-- source/games/exhumed/src/switch.cpp | 2 +- source/games/exhumed/src/view.cpp | 4 ++-- 14 files changed, 40 insertions(+), 41 deletions(-) diff --git a/source/games/exhumed/src/grenade.cpp b/source/games/exhumed/src/grenade.cpp index 2a75a49a8..ed1ef018e 100644 --- a/source/games/exhumed/src/grenade.cpp +++ b/source/games/exhumed/src/grenade.cpp @@ -53,7 +53,7 @@ void ThrowGrenade(int nPlayer, int, int, int ecx, int push1) return; DExhumedActor* pActor = PlayerList[nPlayer].pPlayerGrenade; - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; int nAngle = pPlayerActor->spr.ang; @@ -102,7 +102,7 @@ void BuildGrenade(int nPlayer) { auto pActor = insertActor(PlayerList[nPlayer].pPlayerViewSect, 201); - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; pActor->spr.pos.X = pPlayerActor->spr.pos.X; pActor->spr.pos.Y = pPlayerActor->spr.pos.Y; @@ -174,7 +174,7 @@ void ExplodeGrenade(DExhumedActor* pActor) if (pActor->nTurn < 0) { - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; int nAngle = pPlayerActor->spr.ang; pActor->spr.pos.Z = pPlayerActor->spr.pos.Z; diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index 0e3fc16a7..4d26ca7c6 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -243,7 +243,7 @@ void ResetSwordSeqs() Collision CheckCloseRange(int nPlayer, int *x, int *y, int *z, sectortype* *ppSector) { - auto pActor = PlayerList[nPlayer].Actor(); + auto pActor = PlayerList[nPlayer].pActor; int ang = pActor->spr.ang; int xVect = bcos(ang); @@ -318,7 +318,7 @@ void MoveWeapons(int nPlayer) if (!PlayerList[nPlayer].bIsFiring || (nSectFlag & kSectUnderwater)) nTemperature[nPlayer] = 0; - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; int nWeapon = PlayerList[nPlayer].nCurrentWeapon; if (nWeapon < -1) @@ -377,7 +377,7 @@ void MoveWeapons(int nPlayer) if (!WeaponCanFire(nPlayer)) { if (!dword_96E22) { - D3PlayFX(StaticSound[4], PlayerList[nPlayer].Actor()); + D3PlayFX(StaticSound[4], PlayerList[nPlayer].pActor); } } else @@ -951,7 +951,7 @@ void DrawWeapons(double smooth) } if (nWeapon < 0) { - nShade = PlayerList[nLocalPlayer].Actor()->spr.shade; + nShade = PlayerList[nLocalPlayer].pActor->spr.shade; } double const look_anghalf = PlayerList[nLocalPlayer].angle.look_anghalf(smooth); diff --git a/source/games/exhumed/src/items.cpp b/source/games/exhumed/src/items.cpp index abdd4b64c..868d1cf48 100644 --- a/source/games/exhumed/src/items.cpp +++ b/source/games/exhumed/src/items.cpp @@ -176,7 +176,7 @@ static bool UseEye(int nPlayer) if (PlayerList[nPlayer].nInvisible >= 0) PlayerList[nPlayer].nInvisible = 900; - auto pActor = PlayerList[nPlayer].Actor(); + auto pActor = PlayerList[nPlayer].pActor; pActor->spr.cstat |= CSTAT_SPRITE_INVISIBLE; @@ -199,7 +199,7 @@ static bool UseMask(int nPlayer) if (nPlayer == nLocalPlayer) { - D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].Actor()); + D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].pActor); } return true; } @@ -223,7 +223,7 @@ bool UseHeart(int nPlayer) if (nPlayer == nLocalPlayer) { ItemFlash(); - D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].Actor()); + D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].pActor); } return true; } @@ -239,7 +239,7 @@ bool UseScarab(int nPlayer) if (nPlayer == nLocalPlayer) { ItemFlash(); - D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].Actor()); + D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].pActor); } return true; } @@ -252,7 +252,7 @@ static bool UseHand(int nPlayer) if (nPlayer == nLocalPlayer) { ItemFlash(); - D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].Actor()); + D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].pActor); } return true; } diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index dcdb13c52..1007d369c 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -48,7 +48,7 @@ void DrawMap(double const smoothratio) { if (!nFreeze && automapMode != am_off) { - auto pPlayerActor = PlayerList[nLocalPlayer].Actor(); + auto pPlayerActor = PlayerList[nLocalPlayer].pActor; int x = pPlayerActor->spr.interpolatedx(smoothratio); int y = pPlayerActor->spr.interpolatedy(smoothratio); @@ -73,7 +73,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a { for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - auto pPlayerActor = PlayerList[i].Actor(); + auto pPlayerActor = PlayerList[i].pActor; int xvect = -bsin(a) * z; int yvect = -bcos(a) * z; diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 960445702..a83cf9914 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -352,7 +352,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis if (pSect2->Flag & kSectUnderwater) { - if (pActor == PlayerList[nLocalPlayer].Actor()) { + if (pActor == PlayerList[nLocalPlayer].pActor) { D3PlayFX(StaticSound[kSound2], pActor); } @@ -712,7 +712,7 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage) if (i >= nTotalPlayers) return nullptr; - pPlayerActor = PlayerList[i].Actor(); + pPlayerActor = PlayerList[i].pActor; if ((pPlayerActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) && (!(pPlayerActor->spr.cstat & CSTAT_SPRITE_INVISIBLE))) { @@ -1076,7 +1076,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel) Can cause local player sounds to play off-centre. TODO: Might need to be done elsewhere too? */ - auto pActor = PlayerList[nLocalPlayer].Actor(); + auto pActor = PlayerList[nLocalPlayer].pActor; initx = pActor->spr.pos.X; inity = pActor->spr.pos.Y; initz = pActor->spr.pos.Z; @@ -1093,7 +1093,7 @@ void SetQuake(DExhumedActor* pActor, int nVal) for (int i = 0; i < nTotalPlayers; i++) { - auto pPlayerActor = PlayerList[i].Actor(); + auto pPlayerActor = PlayerList[i].pActor; uint32_t xDiff = abs((int32_t)((pPlayerActor->spr.pos.X - x) >> 8)); @@ -1236,7 +1236,7 @@ int GetWallNormal(walltype* pWall) void WheresMyMouth(int nPlayer, vec3_t* pos, sectortype **sectnum) { - auto pActor = PlayerList[nPlayer].Actor(); + auto pActor = PlayerList[nPlayer].pActor; int height = GetActorHeight(pActor) >> 1; *sectnum = pActor->spr.sector(); diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 0d556037f..85f3ab6fe 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -37,7 +37,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) { Player *nPlayer = &PlayerList[nLocalPlayer]; - nPlayer->Actor()->spr.opos = nPlayer->Actor()->spr.pos = { x, y, z }; + nPlayer->pActor->spr.opos = nPlayer->pActor->spr.pos = { x, y, z }; if (ang != INT_MIN) { diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 85003f592..cf5ca61e6 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -217,7 +217,7 @@ int GetPlayerFromActor(DExhumedActor* pActor) void RestartPlayer(int nPlayer) { auto plr = &PlayerList[nPlayer]; - auto pActor = plr->Actor(); + auto pActor = plr->pActor; DExhumedActor* pDopSprite = plr->pDoppleSprite; DExhumedActor* floorsprt; @@ -431,7 +431,7 @@ void StartDeathSeq(int nPlayer, int nVal) { FreeRa(nPlayer); - auto pActor = PlayerList[nPlayer].Actor(); + auto pActor = PlayerList[nPlayer].pActor; PlayerList[nPlayer].nHealth = 0; int nLotag = pActor->spr.sector()->lotag; @@ -601,7 +601,7 @@ static void pickupMessage(int no) void UpdatePlayerSpriteAngle(Player* pPlayer) { inita = pPlayer->angle.ang.asbuild(); - if (pPlayer->Actor()) pPlayer->Actor()->spr.ang = inita; + if (pPlayer->pActor) pPlayer->pActor->spr.ang = inita; } void AIPlayer::Draw(RunListEvent* ev) @@ -618,7 +618,7 @@ void AIPlayer::RadialDamage(RunListEvent* ev) int nPlayer = RunData[ev->nRun].nObjIndex; assert(nPlayer >= 0 && nPlayer < kMaxPlayers); - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; if (PlayerList[nPlayer].nHealth <= 0) { @@ -633,7 +633,7 @@ void AIPlayer::Damage(RunListEvent* ev) { int nDamage = ev->nDamage; int nPlayer = RunData[ev->nRun].nObjIndex; - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; int nAction = PlayerList[nPlayer].nAction; DExhumedActor* pDopple = PlayerList[nPlayer].pDoppleSprite; @@ -743,7 +743,7 @@ void AIPlayer::Tick(RunListEvent* ev) int nPlayer = RunData[ev->nRun].nObjIndex; assert(nPlayer >= 0 && nPlayer < kMaxPlayers); - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; DExhumedActor* pDopple = PlayerList[nPlayer].pDoppleSprite; @@ -2477,7 +2477,7 @@ sectdone: // will invalidate nPlayerSprite RestartPlayer(nPlayer); - pPlayerActor = PlayerList[nPlayer].Actor(); + pPlayerActor = PlayerList[nPlayer].pActor; pDopple = PlayerList[nPlayer].pDoppleSprite; } else @@ -2756,7 +2756,7 @@ DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater) DEFINE_ACTION_FUNCTION(_ExhumedPlayer, GetAngle) { PARAM_SELF_STRUCT_PROLOGUE(Player); - ACTION_RETURN_INT(self->Actor()->spr.ang); + ACTION_RETURN_INT(self->pActor->spr.ang); } diff --git a/source/games/exhumed/src/player.h b/source/games/exhumed/src/player.h index 4eb110d3f..8e8cfb17e 100644 --- a/source/games/exhumed/src/player.h +++ b/source/games/exhumed/src/player.h @@ -54,8 +54,7 @@ struct PlayerSave struct Player { - DExhumedActor* Actor() { return pActor; } - TObjPtr pActor; + DExhumedActor* pActor; int16_t nHealth; int16_t nLives; int16_t nDouble; diff --git a/source/games/exhumed/src/ra.cpp b/source/games/exhumed/src/ra.cpp index 190c95cad..f045fcf23 100644 --- a/source/games/exhumed/src/ra.cpp +++ b/source/games/exhumed/src/ra.cpp @@ -85,7 +85,7 @@ void FreeRa(int nPlayer) void BuildRa(int nPlayer) { - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; auto pActor = insertActor(pPlayerActor->spr.sector(), 203); @@ -160,7 +160,7 @@ void MoveRaToEnemy(int nPlayer) } pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE; - pTarget = PlayerList[nPlayer].Actor(); + pTarget = PlayerList[nPlayer].pActor; } pActor->spr.pos.X = pTarget->spr.pos.X; @@ -261,7 +261,7 @@ void AIRa::Tick(RunListEvent* ev) { if (PlayerList[nPlayer].nAmmo[kWeaponRing] > 0) { - runlist_DamageEnemy(Ra[nPlayer].pTarget, PlayerList[Ra[nPlayer].nPlayer].Actor(), BulletInfo[kWeaponRing].nDamage); + runlist_DamageEnemy(Ra[nPlayer].pTarget, PlayerList[Ra[nPlayer].nPlayer].pActor, BulletInfo[kWeaponRing].nDamage); AddAmmo(nPlayer, kWeaponRing, -WeaponInfo[kWeaponRing].d); SetQuake(pActor, 100); } diff --git a/source/games/exhumed/src/runlist.cpp b/source/games/exhumed/src/runlist.cpp index 42cdaea6c..dc0b46be3 100644 --- a/source/games/exhumed/src/runlist.cpp +++ b/source/games/exhumed/src/runlist.cpp @@ -1728,7 +1728,7 @@ void runlist_DamageEnemy(DExhumedActor* pActor, DExhumedActor* pActor2, int nDam if (PlayerList[nPlayer].nTauntTimer <= 0) { // Do a taunt - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; auto pSector = pPlayerActor->spr.sector(); if (!(pSector->Flag & kSectUnderwater)) diff --git a/source/games/exhumed/src/snake.cpp b/source/games/exhumed/src/snake.cpp index 20689ec56..aca6b3045 100644 --- a/source/games/exhumed/src/snake.cpp +++ b/source/games/exhumed/src/snake.cpp @@ -129,7 +129,7 @@ void BuildSnake(int nPlayer, int zVal) zVal -= 1280; - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; auto pViewSect = PlayerList[nPlayer].pPlayerViewSect; int nPic = seq_GetSeqPicnum(kSeqSnakBody, 0, 0); @@ -258,7 +258,7 @@ void BuildSnake(int nPlayer, int zVal) DExhumedActor* FindSnakeEnemy(int nSnake) { int nPlayer = SnakeList[nSnake].nSnakePlayer; - auto pPlayerActor = PlayerList[nPlayer].Actor(); + auto pPlayerActor = PlayerList[nPlayer].pActor; DExhumedActor* pActor = SnakeList[nSnake].pSprites[0]; // CHECKME if (!pActor) return nullptr; diff --git a/source/games/exhumed/src/sound.cpp b/source/games/exhumed/src/sound.cpp index 477bad130..a58ca962b 100644 --- a/source/games/exhumed/src/sound.cpp +++ b/source/games/exhumed/src/sound.cpp @@ -640,7 +640,7 @@ void PlayFX2(int nSound, DExhumedActor* pActor, int sectf, EChanFlags chanflags, } // Nuke: added nSprite >= 0 check - if (pActor != PlayerList[nLocalPlayer].Actor() && pActor != nullptr && (pActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)) + if (pActor != PlayerList[nLocalPlayer].pActor && pActor != nullptr && (pActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)) nCreepyTimer = kCreepyCount; } @@ -684,7 +684,7 @@ void CheckAmbience(sectortype* sect) { if (sect == pSector2) { - amb = GetSoundPos(&PlayerList[0].Actor()->spr.pos); + amb = GetSoundPos(&PlayerList[0].pActor->spr.pos); } else { diff --git a/source/games/exhumed/src/switch.cpp b/source/games/exhumed/src/switch.cpp index 54731f1ed..b8dc2bdee 100644 --- a/source/games/exhumed/src/switch.cpp +++ b/source/games/exhumed/src/switch.cpp @@ -442,7 +442,7 @@ void AISWPressSector::Use(RunListEvent* ev) { if (SwitchData[nSwitch].nKeyMask) { - auto& pos = PlayerList[nPlayer].Actor()->spr.pos; + auto& pos = PlayerList[nPlayer].pActor->spr.pos; PlayFXAtXYZ(StaticSound[nSwitchSound], pos.X, pos.Y, 0, CHANF_LISTENERZ); StatusMessage(300, "YOU NEED THE KEY FOR THIS DOOR"); diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index a1c9cc856..2232dc7e6 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -83,7 +83,7 @@ static void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int x, int } } - auto pPlayerActor = PlayerList[nLocalPlayer].Actor(); + auto pPlayerActor = PlayerList[nLocalPlayer].pActor; int var_38 = 20; int var_2C = 30000; @@ -206,7 +206,7 @@ void DrawView(double smoothRatio, bool sceneonly) DoInterpolations(smoothRatio / 65536.); pm_smoothratio = (int)smoothRatio; - auto pPlayerActor = PlayerList[nLocalPlayer].Actor(); + auto pPlayerActor = PlayerList[nLocalPlayer].pActor; auto nPlayerOldCstat = pPlayerActor->spr.cstat; auto pDop = PlayerList[nLocalPlayer].pDoppleSprite; auto nDoppleOldCstat = pDop->spr.cstat;