mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- Exhumed: Tidy up some picnum accesses.
This commit is contained in:
parent
d7161a7368
commit
b4502626fa
18 changed files with 34 additions and 63 deletions
|
@ -132,7 +132,7 @@ void AIAnubis::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
playFrameSound(ap, seqFrame);
|
playFrameSound(ap, seqFrame);
|
||||||
|
|
||||||
ap->spr.picnum = seqFrame.chunks[0].picnum;
|
ap->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
ap->nFrame++;
|
ap->nFrame++;
|
||||||
|
|
||||||
if (ap->nFrame >= anubisSeq.Size())
|
if (ap->nFrame >= anubisSeq.Size())
|
||||||
|
|
|
@ -90,7 +90,7 @@ void AIFishLimb::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
const auto& fishSeq = getSequence(pActor->nSeqFile, pActor->nCount);
|
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);
|
Gravity(pActor);
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ void AIFish::Tick(RunListEvent* ev)
|
||||||
const auto& fishSeq = getSequence(pActor->nSeqFile, FishSeq[nAction].nSeqId);
|
const auto& fishSeq = getSequence(pActor->nSeqFile, FishSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = fishSeq[pActor->nFrame];
|
const auto& seqFrame = fishSeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ void AIGrenade::Tick(RunListEvent* ev)
|
||||||
const auto& seqFrame = grenadeSeq[pActor->nHealth >> 8];
|
const auto& seqFrame = grenadeSeq[pActor->nHealth >> 8];
|
||||||
|
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
pActor->nIndex2--;
|
pActor->nIndex2--;
|
||||||
if (!pActor->nIndex2)
|
if (!pActor->nIndex2)
|
||||||
|
|
|
@ -218,7 +218,7 @@ void AILavaDude::Tick(RunListEvent* ev)
|
||||||
const auto& lavadudeSeq = getSequence(pActor->nSeqFile, LavadudeSeq[nAction].nSeqId);
|
const auto& lavadudeSeq = getSequence(pActor->nSeqFile, LavadudeSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = lavadudeSeq[pActor->nFrame];
|
const auto& seqFrame = lavadudeSeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
int var_1C = 0;
|
int var_1C = 0;
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ void AILion::Tick(RunListEvent* ev)
|
||||||
const auto& lionSeq = getSequence(pActor->nSeqFile, LionSeq[nAction].nSeqId);
|
const auto& lionSeq = getSequence(pActor->nSeqFile, LionSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = lionSeq[pActor->nFrame];
|
const auto& seqFrame = lionSeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ void AIMummy::Tick(RunListEvent* ev)
|
||||||
const auto& mummySeq = getSequence(pActor->nSeqFile, MummySeq[nAction].nSeqId);
|
const auto& mummySeq = getSequence(pActor->nSeqFile, MummySeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = mummySeq[pActor->nFrame];
|
const auto& seqFrame = mummySeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
|
|
|
@ -1962,7 +1962,7 @@ void AIObject::Tick(RunListEvent* ev)
|
||||||
if (++pActor->nFrame >= nSeqFrames.Size())
|
if (++pActor->nFrame >= nSeqFrames.Size())
|
||||||
pActor->nFrame = 0;
|
pActor->nFrame = 0;
|
||||||
|
|
||||||
pActor->spr.picnum = nSeqFrames[pActor->nFrame].chunks[0].picnum;
|
pActor->spr.picnum = nSeqFrames[pActor->nFrame].getFirstPicnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pActor->nHealth >= 0) {
|
if (pActor->nHealth >= 0) {
|
||||||
|
|
|
@ -546,7 +546,7 @@ void AIQueenEgg::Tick(RunListEvent* ev)
|
||||||
const auto& eggSeq = getSequence(pActor->nSeqFile, EggSeq[nAction].nSeqId);
|
const auto& eggSeq = getSequence(pActor->nSeqFile, EggSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = eggSeq[pEgg->nFrame];
|
const auto& seqFrame = eggSeq[pEgg->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
if (nAction != 4)
|
if (nAction != 4)
|
||||||
{
|
{
|
||||||
|
@ -807,7 +807,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
QueenHead.nFrame++;
|
QueenHead.nFrame++;
|
||||||
if (QueenHead.nFrame >= queenSeq.Size())
|
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& queenSeq = getSequence(pActor->nSeqFile, QueenSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = queenSeq[QueenList[nQueen].nFrame];
|
const auto& seqFrame = queenSeq[QueenList[nQueen].nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ void AIRa::Tick(RunListEvent* ev)
|
||||||
bool bVal = false;
|
bool bVal = false;
|
||||||
|
|
||||||
Ra[nPlayer].pTarget = PlayerList[nPlayer].pTarget;
|
Ra[nPlayer].pTarget = PlayerList[nPlayer].pTarget;
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
if (Ra[nPlayer].nAction)
|
if (Ra[nPlayer].nAction)
|
||||||
{
|
{
|
||||||
|
|
|
@ -249,7 +249,7 @@ void AIRat::Tick(RunListEvent* ev)
|
||||||
const auto& ratSeq = getSequence(pActor->nSeqFile, RatSeq[nAction].nSeqId);
|
const auto& ratSeq = getSequence(pActor->nSeqFile, RatSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = ratSeq[pActor->nFrame];
|
const auto& seqFrame = ratSeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ void AIRex::Tick(RunListEvent* ev)
|
||||||
const auto& rexSeq = getSequence(pActor->nSeqFile, RexSeq[nAction].nSeqId);
|
const auto& rexSeq = getSequence(pActor->nSeqFile, RexSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = rexSeq[pActor->nFrame];
|
const auto& seqFrame = rexSeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
int ecx = 2;
|
int ecx = 2;
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ void AIRoach::Tick(RunListEvent* ev)
|
||||||
const auto& roachSeq = getSequence(pActor->nSeqFile, RoachSeq[nAction].nSeqId);
|
const auto& roachSeq = getSequence(pActor->nSeqFile, RoachSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = roachSeq[pActor->nFrame];
|
const auto& seqFrame = roachSeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
pActor->nFrame++;
|
pActor->nFrame++;
|
||||||
|
|
|
@ -210,7 +210,7 @@ void AIScorp::Tick(RunListEvent* ev)
|
||||||
const auto& scorpSeq = getSequence(pActor->nSeqFile, ScorpSeq[nAction].nSeqId);
|
const auto& scorpSeq = getSequence(pActor->nSeqFile, ScorpSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = scorpSeq[pActor->nFrame];
|
const auto& seqFrame = scorpSeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
pActor->nFrame++;
|
pActor->nFrame++;
|
||||||
|
|
|
@ -594,22 +594,9 @@ int seq_ReadSequence(const char *seqName)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
int seq_GetFirstSeqPicnum(int nSeq)
|
|
||||||
{
|
|
||||||
return getSeqFrameChunkPicnum(getSeqFrameChunk(getSeqFrame(getSeqFromId(nSeq))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void seq_LoadSequences()
|
void seq_LoadSequences()
|
||||||
{
|
{
|
||||||
int i;
|
for (unsigned i = 0; i < kMaxSEQFiles; i++)
|
||||||
|
|
||||||
for (i = 0; i < kMaxSEQFiles; i++)
|
|
||||||
{
|
{
|
||||||
SeqOffsets[i] = sequences;
|
SeqOffsets[i] = sequences;
|
||||||
|
|
||||||
|
@ -638,21 +625,20 @@ void seq_LoadSequences()
|
||||||
fclose(f);
|
fclose(f);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nShadowPic = seq_GetFirstSeqPicnum(kSeqShadow);
|
nShadowPic = getSequence("shadow")[0].getFirstPicnum();
|
||||||
nShadowWidth = tileWidth(nShadowPic);
|
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();
|
nPilotLightCount = getSequence("flamer", 3).Size();
|
||||||
nPilotLightFrame = 0;
|
nPilotLightFrame = 0;
|
||||||
|
|
||||||
nFontFirstChar = seq_GetFirstSeqPicnum(kSeqFont2);
|
const auto& fontSeq = getSequence("font2");
|
||||||
|
nFontFirstChar = fontSeq[0].getFirstPicnum();
|
||||||
|
|
||||||
int16_t nSize = getSeqFrameCount(getSeqFromId(kSeqFont2));
|
for (unsigned i = 0; i < fontSeq.Size(); i++)
|
||||||
|
|
||||||
for (i = 0; i < nSize; i++)
|
|
||||||
{
|
{
|
||||||
auto tex = tileGetTexture(nFontFirstChar + i);
|
auto tex = tileGetTexture(nFontFirstChar + i);
|
||||||
tex->SetOffsets(0, 0);
|
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)
|
int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx)
|
||||||
{
|
{
|
||||||
return getSeqFrameChunkPicnum(getSeqFrameChunk(getSeqFrame(getSeqFromId(nSeq, edx))));
|
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;
|
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;
|
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;
|
pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT;
|
||||||
|
|
|
@ -121,6 +121,11 @@ struct SeqFrame
|
||||||
int16_t sound;
|
int16_t sound;
|
||||||
int16_t flags;
|
int16_t flags;
|
||||||
TArray<SeqFrameChunk> chunks;
|
TArray<SeqFrameChunk> chunks;
|
||||||
|
|
||||||
|
const int getFirstPicnum() const
|
||||||
|
{
|
||||||
|
return chunks[0].picnum;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using SeqFrameArray = TArray<SeqFrame>;
|
using SeqFrameArray = TArray<SeqFrame>;
|
||||||
|
@ -133,18 +138,14 @@ extern int16_t nPilotLightFrame;
|
||||||
extern int16_t nPilotLightCount;
|
extern int16_t nPilotLightCount;
|
||||||
|
|
||||||
void seq_LoadSequences();
|
void seq_LoadSequences();
|
||||||
int seq_GetFrameSound(int val, int edx);
|
|
||||||
void seq_MoveSequence(DExhumedActor* actor, int16_t nSeq, int16_t nFrame);
|
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_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_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_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int frameIndex);
|
||||||
void seq_DrawPilotLightSeq(double xOffset, double yOffset);
|
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 getSeqFromId(const int nSeqFileId, const int nSeq = 0);
|
||||||
int getSeqFrame(const int nSeq, const int nFrame = 0);
|
int getSeqFrame(const int nSeq, const int nFrame = 0);
|
||||||
int getSeqFrameCount(const int nSeq);
|
int getSeqFrameCount(const int nSeq);
|
||||||
|
|
|
@ -273,7 +273,7 @@ void AISet::Tick(RunListEvent* ev)
|
||||||
const auto& setSeq = getSequence(pActor->nSeqFile, SetSeq[nAction].nSeqId);
|
const auto& setSeq = getSequence(pActor->nSeqFile, SetSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = setSeq[pActor->nFrame];
|
const auto& seqFrame = setSeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
if (nAction == 3)
|
if (nAction == 3)
|
||||||
|
|
|
@ -122,7 +122,7 @@ void AISpider::Tick(RunListEvent* ev)
|
||||||
const auto& spiderSeq = getSequence(spp->nSeqFile, SpiderSeq[nAction].nSeqId);
|
const auto& spiderSeq = getSequence(spp->nSeqFile, SpiderSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = spiderSeq[spp->nFrame];
|
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);
|
playFrameSound(spp, seqFrame);
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ void AIWasp::Tick(RunListEvent* ev)
|
||||||
const auto& waspSeq = getSequence(pActor->nSeqFile, WaspSeq[nAction].nSeqId);
|
const auto& waspSeq = getSequence(pActor->nSeqFile, WaspSeq[nAction].nSeqId);
|
||||||
const auto& seqFrame = waspSeq[pActor->nFrame];
|
const auto& seqFrame = waspSeq[pActor->nFrame];
|
||||||
|
|
||||||
pActor->spr.picnum = seqFrame.chunks[0].picnum;
|
pActor->spr.picnum = seqFrame.getFirstPicnum();
|
||||||
|
|
||||||
playFrameSound(pActor, seqFrame);
|
playFrameSound(pActor, seqFrame);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue