- BuildCreatureChunk wrapper.

This commit is contained in:
Christoph Oelckers 2021-10-26 21:15:07 +02:00
parent 70a7656619
commit 331ba71473
4 changed files with 19 additions and 12 deletions

View file

@ -261,6 +261,13 @@ inline DExhumedActor* FindPlayer(DExhumedActor* nSprite, int nDistance, bool don
}
int BuildCreatureChunk(int nVal, int nPic);
DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial = false)
{
int s = pSrc->GetSpriteIndex();
if (bSpecial) s |= 0x4000;
int c = BuildCreatureChunk(s, nPic);
return c < 0 ? nullptr : &exhumedActors[c];
}
void BuildNear(int x, int y, int walldist, int nSector);
int PlotCourseToSprite(int nSprite1, int nSprite2);
inline int PlotCourseToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2)

View file

@ -225,7 +225,7 @@ void BlowChunks(DExhumedActor* pActor)
{
for (int i = 0; i < 4; i++)
{
BuildCreatureChunk(pActor->GetSpriteIndex(), seq_GetSeqPicnum(16, i + 41, 0));
BuildCreatureChunk(pActor, seq_GetSeqPicnum(16, i + 41, 0));
}
}
@ -242,7 +242,7 @@ void DestroyEgg(short nEgg)
{
for (int i = 0; i < 4; i++)
{
BuildCreatureChunk(pActor->GetSpriteIndex(), seq_GetSeqPicnum(kSeqQueenEgg, (i % 2) + 24, 0));
BuildCreatureChunk(pActor, seq_GetSeqPicnum(kSeqQueenEgg, (i % 2) + 24, 0));
}
}
@ -1410,18 +1410,18 @@ void AIQueen::Tick(RunListEvent* ev)
for (int i = 0; i < 20; i++)
{
short nChunkSprite = BuildCreatureChunk(pActor->GetSpriteIndex(), seq_GetSeqPicnum(kSeqQueen, 57, 0)) & 0xFFFF;
auto pChunkActor = BuildCreatureChunk(pActor, seq_GetSeqPicnum(kSeqQueen, 57, 0));
sprite[nChunkSprite].picnum = kQueenChunk + (i % 3);
sprite[nChunkSprite].xrepeat = 100;
sprite[nChunkSprite].yrepeat = 100;
pChunkActor->s().picnum = kQueenChunk + (i % 3);
pChunkActor->s().xrepeat = 100;
pChunkActor->s().yrepeat = 100;
}
short nChunkSprite = BuildCreatureChunk(pActor->GetSpriteIndex(), seq_GetSeqPicnum(kSeqQueen, 57, 0));
auto pChunkActor = BuildCreatureChunk(pActor, seq_GetSeqPicnum(kSeqQueen, 57, 0));
sprite[nChunkSprite].picnum = kTile3126;
sprite[nChunkSprite].yrepeat = 100;
sprite[nChunkSprite].xrepeat = 100;
pChunkActor->s().picnum = kTile3126;
pChunkActor->s().yrepeat = 100;
pChunkActor->s().xrepeat = 100;
PlayFXAtXYZ(
StaticSound[kSound40],

View file

@ -597,7 +597,7 @@ void AISet::Tick(RunListEvent* ev)
if (nFlag & 0x80)
{
pSprite->z -= GetActorHeight(pActor);
BuildCreatureChunk(pActor->GetSpriteIndex(), seq_GetSeqPicnum(kSeqSet, 76, 0));
BuildCreatureChunk(pActor, seq_GetSeqPicnum(kSeqSet, 76, 0));
pSprite->z += GetActorHeight(pActor);
}

View file

@ -404,7 +404,7 @@ void AISpider::Damage(RunListEvent* ev)
for (int i = 0; i < 7; i++)
{
BuildCreatureChunk(spp->GetSpriteIndex(), seq_GetSeqPicnum(kSeqSpider, i + 41, 0));
BuildCreatureChunk(spp, seq_GetSeqPicnum(kSeqSpider, i + 41, 0));
}
}
}