- Exhumed: Move PlayerInput::pTarget to Player struct.

This commit is contained in:
Mitchell Richters 2023-03-13 20:10:47 +11:00
parent c1f52b1137
commit c73ee5f848
8 changed files with 9 additions and 20 deletions

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -32,7 +32,6 @@ enum {
// 32 bytes
struct PlayerInput
{
TObjPtr<DExhumedActor*> pTarget;
DVector2 vel;
uint16_t buttons;
float nAngle;

View file

@ -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;
}
//---------------------------------------------------------------------------

View file

@ -101,6 +101,7 @@ struct Player
TObjPtr<DExhumedActor*> pPlayerGrenade;
TObjPtr<DExhumedActor*> pPlayerFloorSprite;
TObjPtr<DExhumedActor*> pDoppleSprite;
TObjPtr<DExhumedActor*> pTarget;
};

View file

@ -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)

View file

@ -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();