- Exhumed: Tidy up some picnum accesses.

This commit is contained in:
Mitchell Richters 2023-04-15 20:25:40 +10:00
parent d7161a7368
commit b4502626fa
18 changed files with 34 additions and 63 deletions

View file

@ -132,7 +132,7 @@ void AIAnubis::Tick(RunListEvent* ev)
playFrameSound(ap, seqFrame);
ap->spr.picnum = seqFrame.chunks[0].picnum;
ap->spr.picnum = seqFrame.getFirstPicnum();
ap->nFrame++;
if (ap->nFrame >= anubisSeq.Size())

View file

@ -90,7 +90,7 @@ void AIFishLimb::Tick(RunListEvent* ev)
const auto& fishSeq = getSequence(pActor->nSeqFile, pActor->nCount);
pActor->spr.picnum = fishSeq[pActor->nFrame].chunks[0].picnum;
pActor->spr.picnum = fishSeq[pActor->nFrame].getFirstPicnum();
Gravity(pActor);
@ -362,7 +362,7 @@ void AIFish::Tick(RunListEvent* ev)
const auto& fishSeq = getSequence(pActor->nSeqFile, FishSeq[nAction].nSeqId);
const auto& seqFrame = fishSeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
playFrameSound(pActor, seqFrame);

View file

@ -262,7 +262,7 @@ void AIGrenade::Tick(RunListEvent* ev)
const auto& seqFrame = grenadeSeq[pActor->nHealth >> 8];
playFrameSound(pActor, seqFrame);
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
pActor->nIndex2--;
if (!pActor->nIndex2)

View file

@ -218,7 +218,7 @@ void AILavaDude::Tick(RunListEvent* ev)
const auto& lavadudeSeq = getSequence(pActor->nSeqFile, LavadudeSeq[nAction].nSeqId);
const auto& seqFrame = lavadudeSeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
int var_1C = 0;

View file

@ -203,7 +203,7 @@ void AILion::Tick(RunListEvent* ev)
const auto& lionSeq = getSequence(pActor->nSeqFile, LionSeq[nAction].nSeqId);
const auto& seqFrame = lionSeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
playFrameSound(pActor, seqFrame);

View file

@ -144,7 +144,7 @@ void AIMummy::Tick(RunListEvent* ev)
const auto& mummySeq = getSequence(pActor->nSeqFile, MummySeq[nAction].nSeqId);
const auto& seqFrame = mummySeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
playFrameSound(pActor, seqFrame);

View file

@ -1962,7 +1962,7 @@ void AIObject::Tick(RunListEvent* ev)
if (++pActor->nFrame >= nSeqFrames.Size())
pActor->nFrame = 0;
pActor->spr.picnum = nSeqFrames[pActor->nFrame].chunks[0].picnum;
pActor->spr.picnum = nSeqFrames[pActor->nFrame].getFirstPicnum();
}
if (pActor->nHealth >= 0) {

View file

@ -546,7 +546,7 @@ void AIQueenEgg::Tick(RunListEvent* ev)
const auto& eggSeq = getSequence(pActor->nSeqFile, EggSeq[nAction].nSeqId);
const auto& seqFrame = eggSeq[pEgg->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
if (nAction != 4)
{
@ -807,7 +807,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
playFrameSound(pActor, seqFrame);
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
QueenHead.nFrame++;
if (QueenHead.nFrame >= queenSeq.Size())
@ -1238,7 +1238,7 @@ void AIQueen::Tick(RunListEvent* ev)
const auto& queenSeq = getSequence(pActor->nSeqFile, QueenSeq[nAction].nSeqId);
const auto& seqFrame = queenSeq[QueenList[nQueen].nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
playFrameSound(pActor, seqFrame);

View file

@ -219,7 +219,7 @@ void AIRa::Tick(RunListEvent* ev)
bool bVal = false;
Ra[nPlayer].pTarget = PlayerList[nPlayer].pTarget;
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
if (Ra[nPlayer].nAction)
{

View file

@ -249,7 +249,7 @@ void AIRat::Tick(RunListEvent* ev)
const auto& ratSeq = getSequence(pActor->nSeqFile, RatSeq[nAction].nSeqId);
const auto& seqFrame = ratSeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
playFrameSound(pActor, seqFrame);

View file

@ -195,7 +195,7 @@ void AIRex::Tick(RunListEvent* ev)
const auto& rexSeq = getSequence(pActor->nSeqFile, RexSeq[nAction].nSeqId);
const auto& seqFrame = rexSeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
int ecx = 2;

View file

@ -215,7 +215,7 @@ void AIRoach::Tick(RunListEvent* ev)
const auto& roachSeq = getSequence(pActor->nSeqFile, RoachSeq[nAction].nSeqId);
const auto& seqFrame = roachSeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
playFrameSound(pActor, seqFrame);
pActor->nFrame++;

View file

@ -210,7 +210,7 @@ void AIScorp::Tick(RunListEvent* ev)
const auto& scorpSeq = getSequence(pActor->nSeqFile, ScorpSeq[nAction].nSeqId);
const auto& seqFrame = scorpSeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
playFrameSound(pActor, seqFrame);
pActor->nFrame++;

View file

@ -594,22 +594,9 @@ int seq_ReadSequence(const char *seqName)
//
//---------------------------------------------------------------------------
int seq_GetFirstSeqPicnum(int nSeq)
{
return getSeqFrameChunkPicnum(getSeqFrameChunk(getSeqFrame(getSeqFromId(nSeq))));
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void seq_LoadSequences()
{
int i;
for (i = 0; i < kMaxSEQFiles; i++)
for (unsigned i = 0; i < kMaxSEQFiles; i++)
{
SeqOffsets[i] = sequences;
@ -638,21 +625,20 @@ void seq_LoadSequences()
fclose(f);
#endif
nShadowPic = seq_GetFirstSeqPicnum(kSeqShadow);
nShadowPic = getSequence("shadow")[0].getFirstPicnum();
nShadowWidth = tileWidth(nShadowPic);
nFlameHeight = tileHeight(seq_GetFirstSeqPicnum(kSeqFirePoof));
nFlameHeight = tileHeight(getSequence("firepoof")[0].getFirstPicnum());
nBackgroundPic = seq_GetFirstSeqPicnum(kSeqBackgrnd);
nBackgroundPic = getSequence("backgrnd")[0].getFirstPicnum();
nPilotLightCount = getSequence("flamer", 3).Size();
nPilotLightFrame = 0;
nFontFirstChar = seq_GetFirstSeqPicnum(kSeqFont2);
const auto& fontSeq = getSequence("font2");
nFontFirstChar = fontSeq[0].getFirstPicnum();
int16_t nSize = getSeqFrameCount(getSeqFromId(kSeqFont2));
for (i = 0; i < nSize; i++)
for (unsigned i = 0; i < fontSeq.Size(); i++)
{
auto tex = tileGetTexture(nFontFirstChar + i);
tex->SetOffsets(0, 0);
@ -723,11 +709,6 @@ void seq_DrawGunSequence(const SeqFrameArray& weapSeq, int16_t frameIndex, doubl
}
}
int seq_GetFrameSound(int val, int edx)
{
return getSeqFrameSound(getSeqFrame(val, edx));
}
//---------------------------------------------------------------------------
//
//
@ -780,17 +761,6 @@ void playFrameSound(DExhumedActor* actor, const SeqFrame& seqFrame)
//
//---------------------------------------------------------------------------
int seq_GetSeqPicnum2(int16_t nSeq, int16_t nFrame)
{
return getSeqFrameChunkPicnum(getSeqFrameChunk(getSeqFrame(nSeq, nFrame)));
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx)
{
return getSeqFrameChunkPicnum(getSeqFrameChunk(getSeqFrame(getSeqFromId(nSeq, edx))));
@ -912,7 +882,7 @@ void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqI
{
pTSprite->picnum = nShadowPic;
const auto nPict = drawFrame.chunks[0].picnum;
const auto nPict = drawFrame.getFirstPicnum();
const auto nScale = max(((tileWidth(nPict) << 5) / nShadowWidth) - int16_t((nFloorZ - pTSprite->pos.Z) * 2.), 1) * REPEAT_SCALE;
pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT;

View file

@ -121,6 +121,11 @@ struct SeqFrame
int16_t sound;
int16_t flags;
TArray<SeqFrameChunk> chunks;
const int getFirstPicnum() const
{
return chunks[0].picnum;
}
};
using SeqFrameArray = TArray<SeqFrame>;
@ -133,18 +138,14 @@ extern int16_t nPilotLightFrame;
extern int16_t nPilotLightCount;
void seq_LoadSequences();
int seq_GetFrameSound(int val, int edx);
void seq_MoveSequence(DExhumedActor* actor, int16_t nSeq, int16_t nFrame);
int seq_GetSeqPicnum2(int16_t nSeq, int16_t nFrame);
int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx);
void seq_DrawStatusSequence(int16_t nSequence, uint16_t edx, int16_t ebx);
void seq_DrawGunSequence(const SeqFrameArray& weapSeq, int16_t frameIndex, double xOffs, double yOffs, int nShade, int nPal, DAngle angle, bool align = false);
void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int16_t frameIndex, const int16_t nFlags);
void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int frameIndex);
void seq_DrawPilotLightSeq(double xOffset, double yOffset);
int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx);
int getSeqFromId(const int nSeqFileId, const int nSeq = 0);
int getSeqFrame(const int nSeq, const int nFrame = 0);
int getSeqFrameCount(const int nSeq);

View file

@ -273,7 +273,7 @@ void AISet::Tick(RunListEvent* ev)
const auto& setSeq = getSequence(pActor->nSeqFile, SetSeq[nAction].nSeqId);
const auto& seqFrame = setSeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
playFrameSound(pActor, seqFrame);
if (nAction == 3)

View file

@ -122,7 +122,7 @@ void AISpider::Tick(RunListEvent* ev)
const auto& spiderSeq = getSequence(spp->nSeqFile, SpiderSeq[nAction].nSeqId);
const auto& seqFrame = spiderSeq[spp->nFrame];
spp->spr.picnum = spp->nFrame < 9 ? seqFrame.chunks[0].picnum : -1;
spp->spr.picnum = spp->nFrame < 9 ? seqFrame.getFirstPicnum() : -1;
playFrameSound(spp, seqFrame);

View file

@ -218,7 +218,7 @@ void AIWasp::Tick(RunListEvent* ev)
const auto& waspSeq = getSequence(pActor->nSeqFile, WaspSeq[nAction].nSeqId);
const auto& seqFrame = waspSeq[pActor->nFrame];
pActor->spr.picnum = seqFrame.chunks[0].picnum;
pActor->spr.picnum = seqFrame.getFirstPicnum();
playFrameSound(pActor, seqFrame);