diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 29ab58fcc..3353cfb68 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -63,7 +63,6 @@ IMPLEMENT_POINTERS_END size_t MarkMove(); size_t MarkBullets(); -size_t MarkInput(); size_t MarkItems(); size_t MarkLighting(); size_t MarkObjects(); @@ -77,7 +76,6 @@ size_t MarkRunlist(); static void markgcroots() { MarkBullets(); - MarkInput(); MarkItems(); MarkLighting(); MarkObjects(); @@ -484,11 +482,10 @@ void GameInterface::Ticker() if (oldactions & SB_CENTERVIEW) sPlayerInput[nLocalPlayer].actions |= SB_CENTERVIEW; sPlayerInput[nLocalPlayer].buttons = lLocalCodes; - sPlayerInput[nLocalPlayer].pTarget = bestTarget; sPlayerInput[nLocalPlayer].nAngle = localInput.avel; sPlayerInput[nLocalPlayer].pan = localInput.horz; - Ra[nLocalPlayer].pTarget = bestTarget; + PlayerList[nLocalPlayer].pTarget = Ra[nLocalPlayer].pTarget = bestTarget; lLocalCodes = 0; diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index 66c24dcc3..09b92fbda 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -838,9 +838,9 @@ loc_flag: nHeight += h; DExhumedActor* target = nullptr; - if (sPlayerInput[nPlayer].pTarget != nullptr && Autoaim(nPlayer)) + if (PlayerList[nPlayer].pTarget != nullptr && Autoaim(nPlayer)) { - DExhumedActor* t = sPlayerInput[nPlayer].pTarget; + DExhumedActor* t = PlayerList[nPlayer].pTarget; // only autoaim if target is in front of the player. assert(t->sector()); DAngle angletotarget = (t->spr.pos - pPlayerActor->spr.pos).Angle(); diff --git a/source/games/exhumed/src/input.cpp b/source/games/exhumed/src/input.cpp index 3cfcc1c99..988eba81f 100644 --- a/source/games/exhumed/src/input.cpp +++ b/source/games/exhumed/src/input.cpp @@ -33,15 +33,6 @@ PlayerInput sPlayerInput[kMaxPlayers]; // //--------------------------------------------------------------------------- -size_t MarkInput() -{ - for (auto& p : sPlayerInput) - { - GC::Mark(p.pTarget); - } - return kMaxPlayers; -} - void ClearSpaceBar(int nPlayer) { sPlayerInput[nPlayer].actions &= SB_OPEN; diff --git a/source/games/exhumed/src/input.h b/source/games/exhumed/src/input.h index 1934ced84..5a3d11d50 100644 --- a/source/games/exhumed/src/input.h +++ b/source/games/exhumed/src/input.h @@ -32,7 +32,6 @@ enum { // 32 bytes struct PlayerInput { - TObjPtr pTarget; DVector2 vel; uint16_t buttons; float nAngle; diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 7a3a8115a..28898942f 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -100,9 +100,10 @@ size_t MarkPlayers() GC::Mark(p.pDoppleSprite); GC::Mark(p.pPlayerFloorSprite); GC::Mark(p.pPlayerGrenade); + GC::Mark(p.pTarget); } GC::MarkArray(nNetStartSprite, kMaxPlayers); - return 5 * kMaxPlayers; + return 6 * kMaxPlayers; } //--------------------------------------------------------------------------- diff --git a/source/games/exhumed/src/player.h b/source/games/exhumed/src/player.h index d7480b149..149a7f35f 100644 --- a/source/games/exhumed/src/player.h +++ b/source/games/exhumed/src/player.h @@ -101,6 +101,7 @@ struct Player TObjPtr pPlayerGrenade; TObjPtr pPlayerFloorSprite; TObjPtr pDoppleSprite; + TObjPtr pTarget; }; diff --git a/source/games/exhumed/src/ra.cpp b/source/games/exhumed/src/ra.cpp index 9b58331ba..b6d2ef290 100644 --- a/source/games/exhumed/src/ra.cpp +++ b/source/games/exhumed/src/ra.cpp @@ -216,7 +216,7 @@ void AIRa::Tick(RunListEvent* ev) bool bVal = false; - Ra[nPlayer].pTarget = sPlayerInput[nPlayer].pTarget; + Ra[nPlayer].pTarget = PlayerList[nPlayer].pTarget; pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, Ra[nPlayer].nFrame); if (Ra[nPlayer].nAction) diff --git a/source/games/exhumed/src/snake.cpp b/source/games/exhumed/src/snake.cpp index b962c915a..27ca006e4 100644 --- a/source/games/exhumed/src/snake.cpp +++ b/source/games/exhumed/src/snake.cpp @@ -191,9 +191,9 @@ void BuildSnake(int nPlayer, double zVal) if (hitactor && hitactor->spr.statnum >= 90 && hitactor->spr.statnum <= 199) { pTarget = hitactor; } - else if (sPlayerInput[nPlayer].pTarget != nullptr) + else if (PlayerList[nPlayer].pTarget != nullptr) { - pTarget = sPlayerInput[nPlayer].pTarget; + pTarget = PlayerList[nPlayer].pTarget; } int nSnake = GrabSnake();