mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- Add DCoreActor
pointer as PlayerAngles::pActor
, setting and nulling where the player's actor is set.
This commit is contained in:
parent
b9f5bb71cc
commit
60a97f781e
8 changed files with 16 additions and 0 deletions
|
@ -338,6 +338,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)
|
||||
|
|
|
@ -17,6 +17,9 @@ struct PlayerAngles
|
|||
// Prototypes for applying view.
|
||||
void doViewPitch(const DVector2& pos, DAngle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust = 1, bool const climbing = false);
|
||||
|
||||
// General methods.
|
||||
void setActor(DCoreActor* const actor) { pActor = actor; }
|
||||
|
||||
// Pitch methods.
|
||||
void lockPitch() { legacyDisabledPitch = true; }
|
||||
void unlockPitch() { legacyDisabledPitch = false; }
|
||||
|
@ -180,6 +183,8 @@ struct PlayerAngles
|
|||
void resetAdjustmentYaw() { legacyAdjustmentYaw = nullAngle; }
|
||||
|
||||
private:
|
||||
// Private data which should never be accessed publically.
|
||||
DCoreActor* pActor;
|
||||
|
||||
|
||||
// Legacy, to be removed.
|
||||
|
|
|
@ -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.setActor(actor);
|
||||
DUDEINFO* pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];
|
||||
pPlayer->pDudeInfo = pDudeInfo;
|
||||
playerSetRace(pPlayer, kModeHuman);
|
||||
|
|
|
@ -622,6 +622,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.setActor(act);
|
||||
ps[j].frag_ps = j;
|
||||
act->SetOwner(act);
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@ uint8_t LoadLevel(MapRecord* map)
|
|||
for (i = 0; i < kMaxPlayers; i++)
|
||||
{
|
||||
PlayerList[i].pActor = nullptr;
|
||||
PlayerList[i].Angles.setActor(nullptr);
|
||||
}
|
||||
|
||||
g_visibility = 1024;
|
||||
|
|
|
@ -181,6 +181,7 @@ void InitPlayer()
|
|||
{
|
||||
for (int i = 0; i < kMaxPlayers; i++) {
|
||||
PlayerList[i].pActor = nullptr;
|
||||
PlayerList[i].Angles.setActor(nullptr);
|
||||
PlayerList[i].pPlayerPushSect = nullptr;
|
||||
PlayerList[i].pPlayerViewSect = nullptr;
|
||||
}
|
||||
|
@ -209,6 +210,7 @@ void InitPlayerInventory(int nPlayer)
|
|||
PlayerList[nPlayer].nLives = kDefaultLives;
|
||||
|
||||
PlayerList[nPlayer].pActor = nullptr;
|
||||
PlayerList[nPlayer].Angles.setActor(nullptr);
|
||||
PlayerList[nPlayer].nRun = -1;
|
||||
|
||||
PlayerList[nPlayer].nPistolClip = 6;
|
||||
|
@ -260,6 +262,7 @@ void RestartPlayer(int nPlayer)
|
|||
ChangeActorStat(pActor, 0);
|
||||
|
||||
plr->pActor = nullptr;
|
||||
plr->Angles.setActor(nullptr);
|
||||
|
||||
DExhumedActor* pFloorSprite = plr->pPlayerFloorSprite;
|
||||
if (pFloorSprite != nullptr) {
|
||||
|
@ -356,6 +359,7 @@ void RestartPlayer(int nPlayer)
|
|||
|
||||
plr->nSeqSize = 0;
|
||||
plr->pActor = pActor;
|
||||
plr->Angles.setActor(pActor);
|
||||
plr->bIsMummified = false;
|
||||
|
||||
if (plr->invincibility >= 0) {
|
||||
|
|
|
@ -574,6 +574,7 @@ void TerminateLevel(void)
|
|||
pp->DoPlayerAction = nullptr;
|
||||
|
||||
pp->actor = nullptr;
|
||||
pp->Angles.setActor(nullptr);
|
||||
|
||||
pp->PlayerUnderActor = nullptr;
|
||||
|
||||
|
|
|
@ -2407,6 +2407,8 @@ void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos)
|
|||
pp->actor = actor;
|
||||
pp->pnum = pnum;
|
||||
|
||||
pp->Angles.setActor(actor);
|
||||
|
||||
actor->spr.cstat |= (CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
actor->spr.extra |= (SPRX_PLAYER_OR_ENEMY);
|
||||
actor->spr.cstat &= ~(CSTAT_SPRITE_TRANSLUCENT);
|
||||
|
|
Loading…
Reference in a new issue