- Exhumed: pActor->s() in player.cpp and view.cpp.

This commit is contained in:
Christoph Oelckers 2021-12-23 17:05:32 +01:00
parent b6d04ffec0
commit b641da3959
2 changed files with 26 additions and 32 deletions

View file

@ -128,14 +128,13 @@ void feebtag(int x, int y, int z, sectortype* pSector, DExhumedActor **nSprite,
ExhumedSectIterator it(pSector);
while (auto pActor = it.Next())
{
auto pSprite = &pActor->s();
int nStat = pSprite->statnum;
int nStat = pActor->spr.statnum;
if (nStat >= 900 && !(pSprite->cstat & CSTAT_SPRITE_INVISIBLE))
if (nStat >= 900 && !(pActor->spr.cstat & CSTAT_SPRITE_INVISIBLE))
{
uint32_t xDiff = abs(pSprite->pos.X - x);
uint32_t yDiff = abs(pSprite->pos.Y - y);
int zDiff = pSprite->pos.Z - z;
uint32_t xDiff = abs(pActor->spr.pos.X - x);
uint32_t yDiff = abs(pActor->spr.pos.Y - y);
int zDiff = pActor->spr.pos.Z - z;
if (zDiff < 5120 && zDiff > -25600)
{
@ -212,8 +211,7 @@ void InitPlayerInventory(int nPlayer)
int GetPlayerFromActor(DExhumedActor* pActor)
{
auto pSprite = &pActor->s();
return RunData[pSprite->owner].nObjIndex;
return RunData[pActor->spr.owner].nObjIndex;
}
void RestartPlayer(int nPlayer)
@ -440,10 +438,9 @@ void StartDeathSeq(int nPlayer, int nVal)
FreeRa(nPlayer);
auto pActor = PlayerList[nPlayer].Actor();
auto pSprite = &pActor->s();
PlayerList[nPlayer].nHealth = 0;
int nLotag = pSprite->sector()->lotag;
int nLotag = pActor->spr.sector()->lotag;
if (nLotag > 0) {
runlist_SignalRun(nLotag - 1, nPlayer, &ExhumedAI::EnterSector);
@ -461,7 +458,7 @@ void StartDeathSeq(int nPlayer, int nVal)
if (nWeapon > kWeaponSword && nWeapon <= kWeaponRing)
{
auto pSector = pSprite->sector();
auto pSector = pActor->spr.sector();
if (pSector->pBelow != nullptr) {
pSector = pSector->pBelow;
}
@ -470,8 +467,8 @@ void StartDeathSeq(int nPlayer, int nVal)
ChangeActorSect(pGunActor, pSector);
auto pGunSprite = &pGunActor->s();
pGunSprite->pos.X = pSprite->pos.X;
pGunSprite->pos.Y = pSprite->pos.Y;
pGunSprite->pos.X = pActor->spr.pos.X;
pGunSprite->pos.Y = pActor->spr.pos.Y;
pGunSprite->pos.Z = pSector->floorz - 512;
ChangeActorStat(pGunActor, nGunLotag[nWeapon] + 900);
@ -490,11 +487,11 @@ void StartDeathSeq(int nPlayer, int nVal)
PlayerList[nPlayer].nInvisible = 0;
dVertPan[nPlayer] = 15;
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK;
pActor->spr.cstat &= ~CSTAT_SPRITE_BLOCK;
SetNewWeaponImmediate(nPlayer, -2);
if (pSprite->sector()->Damage <= 0)
if (pActor->spr.sector()->Damage <= 0)
{
PlayerList[nPlayer].nDeathType = nVal;
}
@ -505,7 +502,7 @@ void StartDeathSeq(int nPlayer, int nVal)
nVal *= 2;
if (nVal || !(pSprite->sector()->Flag & kSectUnderwater))
if (nVal || !(pActor->spr.sector()->Flag & kSectUnderwater))
{
PlayerList[nPlayer].nAction = nVal + 17;
}
@ -515,7 +512,7 @@ void StartDeathSeq(int nPlayer, int nVal)
PlayerList[nPlayer].nSeqSize = 0;
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
pActor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
if (nTotalPlayers == 1)
{
@ -563,10 +560,9 @@ int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount)
void SetPlayerMummified(int nPlayer, int bIsMummified)
{
DExhumedActor* pActor = PlayerList[nPlayer].pActor;
auto pSprite = &pActor->s();
pSprite->yvel = 0;
pSprite->xvel = 0;
pActor->spr.yvel = 0;
pActor->spr.xvel = 0;
PlayerList[nPlayer].bIsMummified = bIsMummified;

View file

@ -103,7 +103,6 @@ static void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int x, int
for (nTSprite = spritesortcnt-1, pTSprite = &tsprite[nTSprite]; nTSprite >= 0; nTSprite--, pTSprite--)
{
auto pActor = static_cast<DExhumedActor*>(pTSprite->ownerActor);
spritetype *pSprite = &pActor->s();
if (pTSprite->sector() != nullptr)
{
@ -123,16 +122,16 @@ static void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int x, int
pTSprite->pos.Z -= nTileY;
}
if (pSprite->statnum > 0)
if (pActor->spr.statnum > 0)
{
RunListEvent ev{};
ev.pTSprite = pTSprite;
runlist_SignalRun(pSprite->lotag - 1, nTSprite, &ExhumedAI::Draw, &ev);
runlist_SignalRun(pActor->spr.lotag - 1, nTSprite, &ExhumedAI::Draw, &ev);
if ((pSprite->statnum < 150) && (pSprite->cstat & CSTAT_SPRITE_BLOCK_ALL) && (pActor != pPlayerActor))
if ((pActor->spr.statnum < 150) && (pActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) && (pActor != pPlayerActor))
{
int xval = pSprite->pos.X - x;
int yval = pSprite->pos.Y - y;
int xval = pActor->spr.pos.X - x;
int yval = pActor->spr.pos.Y - y;
int vcos = bcos(nAngle);
int vsin = bsin(nAngle);
@ -218,13 +217,12 @@ void DrawView(double smoothRatio, bool sceneonly)
if (nSnakeCam >= 0 && !sceneonly)
{
DExhumedActor* pActor = SnakeList[nSnakeCam].pSprites[0];
auto pSprite = &pActor->s();
playerX = pSprite->pos.X;
playerY = pSprite->pos.Y;
playerZ = pSprite->pos.Z;
pSector = pSprite->sector();
nAngle = buildang(pSprite->ang);
playerX = pActor->spr.pos.X;
playerY = pActor->spr.pos.Y;
playerZ = pActor->spr.pos.Z;
pSector = pActor->spr.sector();
nAngle = buildang(pActor->spr.ang);
rotscrnang = buildang(0);
SetGreenPal();