Replaced sprite[] in some smaller functions

This commit is contained in:
Christoph Oelckers 2021-10-19 20:03:11 +02:00
parent df88b23f63
commit 2cece35902
5 changed files with 23 additions and 23 deletions

View file

@ -61,15 +61,14 @@ void precache()
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, wall[i].pal);
}
for (i = 0; i < kMaxSprites; i++)
ExhumedSpriteIterator it;
while (auto ac = it.Next())
{
if (sprite[i].statnum < kMaxStatus)
{
int j = sprite[i].picnum;
markTileForPrecache(j, sprite[i].pal);
if (picanm[j].sf & PICANM_ANIMTYPE_MASK)
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sprite[i].pal);
}
auto sp = &ac->s();
int j = sp->picnum;
markTileForPrecache(j, sp->pal);
if (picanm[j].sf & PICANM_ANIMTYPE_MASK)
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sp->pal);
}
precacheMarkedTiles();
}

View file

@ -189,13 +189,12 @@ void DoRedAlert(int nVal)
nRedTicks = 30;
}
int i;
StatIterator it(405);
while ((i = it.NextIndex()) >= 0)
ExhumedStatIterator it(405);
while (auto ac = it.Next())
{
if (nVal)
{
auto spri = &sprite[i];
auto spri = &ac->s();
PlayFXAtXYZ(StaticSound[kSoundAlarm], spri->x, spri->y, spri->z, spri->sectnum);
AddFlash(spri->sectnum, spri->x, spri->y, spri->z, 192);
}
@ -254,9 +253,10 @@ void GameMove(void)
{
FixPalette();
for (int i = 0; i < MAXSPRITES; i++)
ExhumedSpriteIterator it;
while (auto ac = it.Next())
{
sprite[i].backuploc();
ac->s().backuploc();
}
if (currentLevel->gameflags & LEVEL_EX_COUNTDOWN)

View file

@ -805,9 +805,10 @@ void ExamineSprites()
nNetStartSprites = 0;
nCurStartSprite = 0;
for (int nSprite = 0; nSprite < kMaxSprites; nSprite++)
ExhumedLinearSpriteIterator it;
while (auto ac = it.Next())
{
auto pSprite = &sprite[nSprite];
auto pSprite = &ac->s();
int nStatus = pSprite->statnum;
if (!nStatus)
@ -820,11 +821,11 @@ void ExamineSprites()
pSprite->lotag = 0;
pSprite->hitag = 0;
ProcessSpriteTag(nSprite, lotag, hitag);
ProcessSpriteTag(ac->GetSpriteIndex(), lotag, hitag);
}
else
{
changespritestat(nSprite, 0);
ChangeActorStat(ac, 0);
}
}
}

View file

@ -49,8 +49,8 @@ void DrawMap(double const smoothratio)
{
if (!nFreeze && automapMode != am_off)
{
int nPlayerSprite = PlayerList[nLocalPlayer].nSprite;
auto psp = &sprite[nPlayerSprite];
auto pPlayerActor = PlayerList[nLocalPlayer].Actor();
auto psp = &pPlayerActor->s();
int x = psp->interpolatedx(smoothratio);
int y = psp->interpolatedy(smoothratio);
@ -79,8 +79,8 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
int nPSprite = PlayerList[i].nSprite;
spritetype* pSprite = &sprite[nPSprite];
auto pPlayerActor = PlayerList[i].Actor();
spritetype* pSprite = &pPlayerActor->s();
int x1 = pSprite->x - x;
int y1 = pSprite->y - y;
int pa = (pSprite->ang - a) & 2047;

View file

@ -37,7 +37,7 @@ BEGIN_PS_NS
void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
{
Player *nPlayer = &PlayerList[nLocalPlayer];
spritetype *pSprite = &sprite[nPlayer->nSprite];
spritetype *pSprite = &nPlayer->Actor()->s();
pSprite->ox = pSprite->x = x;
pSprite->oy = pSprite->y = y;