- Exhumed: batch of several s().

This commit is contained in:
Christoph Oelckers 2021-12-23 17:19:21 +01:00
parent 56bd9e7e27
commit 6f0e7e3784
5 changed files with 44 additions and 50 deletions

View file

@ -71,11 +71,10 @@ void precache()
ExhumedSpriteIterator it;
while (auto ac = it.Next())
{
auto sp = &ac->s();
int j = sp->picnum;
markTileForPrecache(j, sp->pal);
int j = ac->spr.picnum;
markTileForPrecache(j, ac->spr.pal);
if (picanm[j].sf & PICANM_ANIMTYPE_MASK)
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sp->pal);
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, ac->spr.pal);
}
precacheMarkedTiles();
}

View file

@ -129,8 +129,7 @@ void MoveRaToEnemy(int nPlayer)
if (pTarget)
{
auto pTargSprite = &pTarget->s();
if (!(pTargSprite->cstat & CSTAT_SPRITE_BLOCK_ALL) || pTargSprite->statnum == MAXSTATUS)
if (!(pTarget->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) || pTarget->spr.statnum == MAXSTATUS)
{
Ra[nPlayer].pTarget = nullptr;
if (nAction == 0 || nAction == 3) {
@ -143,8 +142,8 @@ void MoveRaToEnemy(int nPlayer)
}
else
{
if (pActor->spr.sector() != pTargSprite->sector()) {
ChangeActorSect(pActor, pTargSprite->sector());
if (pActor->spr.sector() != pTarget->spr.sector()) {
ChangeActorSect(pActor, pTarget->spr.sector());
}
}
}
@ -164,14 +163,13 @@ void MoveRaToEnemy(int nPlayer)
pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
pTarget = PlayerList[nPlayer].Actor();
}
auto pTargSprite = &pTarget->s();
pActor->spr.pos.X = pTarget->spr.pos.X;
pActor->spr.pos.Y = pTarget->spr.pos.Y;
pActor->spr.pos.Z = pTarget->spr.pos.Z - GetActorHeight(pTarget);
pActor->spr.pos.X = pTargSprite->pos.X;
pActor->spr.pos.Y = pTargSprite->pos.Y;
pActor->spr.pos.Z = pTargSprite->pos.Z - GetActorHeight(pTarget);
if (pActor->spr.sector() != pTargSprite->sector()) {
ChangeActorSect(pActor, pTargSprite->sector());
if (pActor->spr.sector() != pTarget->spr.sector()) {
ChangeActorSect(pActor, pTarget->spr.sector());
}
}

View file

@ -65,10 +65,10 @@ int nTalkTime = 0;
void InitSpiritHead()
{
nPixels = 0;
auto pSpiritSpr = &pSpiritSprite->s();
auto pSpiritSpr = pSpiritSprite;
nSpiritRepeatX = pSpiritSpr->xrepeat;
nSpiritRepeatY = pSpiritSpr->yrepeat;
nSpiritRepeatX = pSpiritSpr->spr.xrepeat;
nSpiritRepeatY = pSpiritSpr->spr.yrepeat;
tileLoad(kTileRamsesNormal); // Ramses Normal Head
@ -117,16 +117,16 @@ void InitSpiritHead()
}
pSpiritSpr->yrepeat = 140;
pSpiritSpr->xrepeat = 140;
pSpiritSpr->picnum = kTileRamsesWorkTile;
pSpiritSpr->spr.yrepeat = 140;
pSpiritSpr->spr.xrepeat = 140;
pSpiritSpr->spr.picnum = kTileRamsesWorkTile;
nHeadStage = 0;
// work tile is twice as big as the normal head size
Worktile = TileFiles.tileCreate(kTileRamsesWorkTile, kSpiritY * 2, kSpiritX * 2);
pSpiritSpr->cstat &= ~CSTAT_SPRITE_BLOCK;
pSpiritSpr->spr.cstat &= ~CSTAT_SPRITE_BLOCK;
nHeadTimeStart = PlayClock;
@ -195,7 +195,7 @@ void CopyHeadToWorkTile(int nTile)
void DoSpiritHead()
{
static int dimSectCount = 0;
auto pSpiritSpr = &pSpiritSprite->s();
auto pSpiritSpr = pSpiritSprite;
sPlayerInput[0].actions |= SB_CENTERVIEW;
TileFiles.InvalidateTile(kTileRamsesWorkTile);
@ -295,11 +295,11 @@ void DoSpiritHead()
case 1:
case 2:
UpdateSwirlies();
if (pSpiritSpr->shade > -127)
pSpiritSpr->shade--;
if (pSpiritSpr->spr.shade > -127)
pSpiritSpr->spr.shade--;
if (--dimSectCount < 0)
{
DimSector(pSpiritSpr->sector());
DimSector(pSpiritSpr->spr.sector());
dimSectCount = 5;
}
@ -379,17 +379,17 @@ void DoSpiritHead()
if (nHeadStage == 1)
{
if (pSpiritSpr->xrepeat > nSpiritRepeatX)
if (pSpiritSpr->spr.xrepeat > nSpiritRepeatX)
{
pSpiritSpr->xrepeat -= 2;
if (pSpiritSpr->xrepeat < nSpiritRepeatX)
pSpiritSpr->xrepeat = (uint8_t)nSpiritRepeatX;
pSpiritSpr->spr.xrepeat -= 2;
if (pSpiritSpr->spr.xrepeat < nSpiritRepeatX)
pSpiritSpr->spr.xrepeat = (uint8_t)nSpiritRepeatX;
}
if (pSpiritSpr->yrepeat > nSpiritRepeatY)
if (pSpiritSpr->spr.yrepeat > nSpiritRepeatY)
{
pSpiritSpr->yrepeat -= 2;
if (pSpiritSpr->yrepeat < nSpiritRepeatY)
pSpiritSpr->yrepeat = (uint8_t)nSpiritRepeatY;
pSpiritSpr->spr.yrepeat -= 2;
if (pSpiritSpr->spr.yrepeat < nSpiritRepeatY)
pSpiritSpr->spr.yrepeat = (uint8_t)nSpiritRepeatY;
}
int nCount = 0;
@ -425,8 +425,8 @@ void DoSpiritHead()
if (nCount < (15 * nPixels) / 16) {
SoundBigEntrance();
AddGlow(pSpiritSpr->sector(), 20);
AddFlash(pSpiritSpr->sector(), pSpiritSpr->pos.X, pSpiritSpr->pos.Y, pSpiritSpr->pos.Z, 128);
AddGlow(pSpiritSpr->spr.sector(), 20);
AddFlash(pSpiritSpr->spr.sector(), pSpiritSpr->spr.pos.X, pSpiritSpr->spr.pos.Y, pSpiritSpr->spr.pos.Z, 128);
nHeadStage = 3;
TintPalette(255, 255, 255);
CopyHeadToWorkTile(kTileRamsesNormal);

View file

@ -372,14 +372,13 @@ void AIScorp::Tick(RunListEvent* ev)
auto pSpiderActor = BuildSpider(nullptr, pActor->spr.pos.X, pActor->spr.pos.Y, pActor->spr.pos.Z, pActor->spr.sector(), pActor->spr.ang);
if (pSpiderActor)
{
auto pSpiderSprite = &pSpiderActor->s();
pSpiderSprite->ang = RandomSize(11);
pSpiderActor->spr.ang = RandomSize(11);
int nVel = RandomSize(5) + 1;
pSpiderSprite->xvel = bcos(pSpiderSprite->ang, -8) * nVel;
pSpiderSprite->yvel = bsin(pSpiderSprite->ang, -8) * nVel;
pSpiderSprite->zvel = (-(RandomSize(5) + 3)) << 8;
pSpiderActor->spr.xvel = bcos(pSpiderActor->spr.ang, -8) * nVel;
pSpiderActor->spr.yvel = bsin(pSpiderActor->spr.ang, -8) * nVel;
pSpiderActor->spr.zvel = (-(RandomSize(5) + 3)) << 8;
}
return;

View file

@ -97,8 +97,7 @@ void BuildSet(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, i
void BuildSoul(DExhumedActor* pSet)
{
auto pSetSprite = &pSet->s();
auto pActor = insertActor(pSetSprite->sector(), 0);
auto pActor = insertActor(pSet->spr.sector(), 0);
pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
pActor->spr.shade = -127;
@ -113,8 +112,8 @@ void BuildSoul(DExhumedActor* pSet)
pActor->spr.xvel = 0;
pActor->spr.yvel = 0;
pActor->spr.zvel = (-256) - RandomSize(10);
pActor->spr.pos.X = pSetSprite->pos.X;
pActor->spr.pos.Y = pSetSprite->pos.Y;
pActor->spr.pos.X = pSet->spr.pos.X;
pActor->spr.pos.Y = pSet->spr.pos.Y;
pActor->spr.pos.Z = (RandomSize(8) << 8) + 8192 + pActor->spr.sector()->ceilingz - GetActorHeight(pActor);
@ -152,15 +151,14 @@ void AISoul::Tick(RunListEvent* ev)
{
DExhumedActor* pSet = pActor->pTarget;
if (!pSet) return;
auto pSetSprite = &pSet->s();
pActor->spr.cstat = 0;
pActor->spr.yrepeat = 1;
pActor->spr.xrepeat = 1;
pActor->spr.pos.X = pSetSprite->pos.X;
pActor->spr.pos.Y = pSetSprite->pos.Y;
pActor->spr.pos.Z = pSetSprite->pos.Z - (GetActorHeight(pSet) >> 1);
ChangeActorSect(pActor, pSetSprite->sector());
pActor->spr.pos.X = pSet->spr.pos.X;
pActor->spr.pos.Y = pSet->spr.pos.Y;
pActor->spr.pos.Z = pSet->spr.pos.Z - (GetActorHeight(pSet) >> 1);
ChangeActorSect(pActor, pSet->spr.sector());
return;
}
}