Skip to content

Commit

Permalink
- Add DCoreActor pointer as PlayerAngles::pActor, setting and nul…
Browse files Browse the repository at this point in the history
…ling where the player's actor is set.
  • Loading branch information
mjr4077au committed Nov 26, 2022
1 parent b9c45b5 commit 76d6bd1
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/core/gameinput.cpp
Expand Up @@ -336,6 +336,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, P
("lookang", w.ZzLOOKANG)
("rotscrnang", w.ZzROTSCRNANG)
("spin", w.YawSpin)
("actor", w.pActor)
("inputdisabled", w.legacyDisabledYaw)
("horiz", w.ZzHORIZON)
("horizoff", w.ZzHORIZOFF)
Expand Down
3 changes: 3 additions & 0 deletions source/core/gameinput.h
Expand Up @@ -8,6 +8,9 @@

struct PlayerAngles
{
// Pointer to current player's actor.
DCoreActor* pActor;

friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, PlayerAngles* def);

// Prototypes for applying input.
Expand Down
1 change: 1 addition & 0 deletions source/games/blood/src/player.cpp
Expand Up @@ -801,6 +801,7 @@ void playerStart(int nPlayer, int bNewLevel)
auto actor = actSpawnSprite(pStartZone->sector, pStartZone->pos, 6, 1);
assert(actor->hasX());
pPlayer->actor = actor;
pPlayer->Angles.pActor = actor;
DUDEINFO* pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];
pPlayer->pDudeInfo = pDudeInfo;
playerSetRace(pPlayer, kModeHuman);
Expand Down
1 change: 1 addition & 0 deletions source/games/duke/src/premap.cpp
Expand Up @@ -621,6 +621,7 @@ void resetpspritevars(int g, const DVector3& startpos)
act->spr.pal = ps[j].palookup = ud.user_pals[j];

ps[j].actor = act;
ps[j].Angles.pActor = act;
ps[j].frag_ps = j;
act->SetOwner(act);

Expand Down
1 change: 1 addition & 0 deletions source/games/exhumed/src/init.cpp
Expand Up @@ -156,6 +156,7 @@ uint8_t LoadLevel(MapRecord* map)
for (i = 0; i < kMaxPlayers; i++)
{
PlayerList[i].pActor = nullptr;
PlayerList[i].Angles.pActor = nullptr;
}

g_visibility = 1024;
Expand Down
4 changes: 4 additions & 0 deletions source/games/exhumed/src/player.cpp
Expand Up @@ -181,6 +181,7 @@ void InitPlayer()
{
for (int i = 0; i < kMaxPlayers; i++) {
PlayerList[i].pActor = nullptr;
PlayerList[i].Angles.pActor = nullptr;
PlayerList[i].pPlayerPushSect = nullptr;
PlayerList[i].pPlayerViewSect = nullptr;
}
Expand Down Expand Up @@ -209,6 +210,7 @@ void InitPlayerInventory(int nPlayer)
PlayerList[nPlayer].nLives = kDefaultLives;

PlayerList[nPlayer].pActor = nullptr;
PlayerList[nPlayer].Angles.pActor = nullptr;
PlayerList[nPlayer].nRun = -1;

PlayerList[nPlayer].nPistolClip = 6;
Expand Down Expand Up @@ -260,6 +262,7 @@ void RestartPlayer(int nPlayer)
ChangeActorStat(pActor, 0);

plr->pActor = nullptr;
plr->Angles.pActor = nullptr;

DExhumedActor* pFloorSprite = plr->pPlayerFloorSprite;
if (pFloorSprite != nullptr) {
Expand Down Expand Up @@ -356,6 +359,7 @@ void RestartPlayer(int nPlayer)

plr->nSeqSize = 0;
plr->pActor = pActor;
plr->Angles.pActor = pActor;
plr->bIsMummified = false;

if (plr->invincibility >= 0) {
Expand Down
1 change: 1 addition & 0 deletions source/games/sw/src/game.cpp
Expand Up @@ -574,6 +574,7 @@ void TerminateLevel(void)
pp->DoPlayerAction = nullptr;

pp->actor = nullptr;
pp->Angles.pActor = nullptr;

pp->PlayerUnderActor = nullptr;

Expand Down
2 changes: 2 additions & 0 deletions source/games/sw/src/ninja.cpp
Expand Up @@ -2407,6 +2407,8 @@ void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos)
pp->actor = actor;
pp->pnum = pnum;

pp->Angles.pActor = actor;

actor->spr.cstat |= (CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
actor->spr.extra |= (SPRX_PLAYER_OR_ENEMY);
actor->spr.cstat &= ~(CSTAT_SPRITE_TRANSLUCENT);
Expand Down

0 comments on commit 76d6bd1

Please sign in to comment.