- Exhumed: Wrap all access to FrameFlag[] array and make static.

This commit is contained in:
Mitchell Richters 2023-04-06 19:08:39 +10:00
parent 3e38d01e4b
commit 93fe699b78
14 changed files with 28 additions and 30 deletions

View file

@ -122,7 +122,7 @@ void AIAnubis::Tick(RunListEvent* ev)
const int nAction = ap->nAction; const int nAction = ap->nAction;
const int nSeq = getSeqFromId(kSeqAnubis, AnubisSeq[nAction].a); const int nSeq = getSeqFromId(kSeqAnubis, AnubisSeq[nAction].a);
const int nFrame = getSeqFrame(nSeq, ap->nFrame); const int nFrame = getSeqFrame(nSeq, ap->nFrame);
const int nFlag = FrameFlag[nFrame]; const int nFlag = getSeqFrameFlags(nFrame);
bool bVal = false; bool bVal = false;
if (nAction < 11) if (nAction < 11)

View file

@ -802,7 +802,7 @@ void AIBullet::Tick(RunListEvent* ev)
int nSeq = getSeqFromId(BulletList[nBullet].nSeq); int nSeq = getSeqFromId(BulletList[nBullet].nSeq);
DExhumedActor* pActor = BulletList[nBullet].pActor; DExhumedActor* pActor = BulletList[nBullet].pActor;
int nFlag = FrameFlag[getSeqFrame(nSeq, BulletList[nBullet].nFrame)]; int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, BulletList[nBullet].nFrame));
seq_MoveSequence(pActor, nSeq, BulletList[nBullet].nFrame); seq_MoveSequence(pActor, nSeq, BulletList[nBullet].nFrame);

View file

@ -645,7 +645,7 @@ void MoveWeapons(int nPlayer)
loc_flag: loc_flag:
// loc_27001 // loc_27001
int nFrameFlag = seq_GetFrameFlag(var_3C, pPlayer->nSeqSize2); int nFrameFlag = getSeqFrameFlags(getSeqFrame(var_3C, pPlayer->nSeqSize2));
if (((!(nSectFlag & kSectUnderwater)) || nWeapon == kWeaponRing) && (nFrameFlag & 4)) if (((!(nSectFlag & kSectUnderwater)) || nWeapon == kWeaponRing) && (nFrameFlag & 4))
{ {

View file

@ -218,7 +218,7 @@ void AILavaDude::Tick(RunListEvent* ev)
pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
int var_38 = pActor->nFrame; int var_38 = pActor->nFrame;
int nFlag = FrameFlag[getSeqFrame(nSeq, var_38)]; int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, var_38));
int var_1C = 0; int var_1C = 0;

View file

@ -211,7 +211,7 @@ void AILion::Tick(RunListEvent* ev)
bVal = true; bVal = true;
} }
int nFlag = FrameFlag[getSeqFrame(nSeq, pActor->nFrame)]; int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame));
DExhumedActor* pTarget = pActor->pTarget; DExhumedActor* pTarget = pActor->pTarget;
auto nMov = MoveCreatureWithCaution(pActor); auto nMov = MoveCreatureWithCaution(pActor);

View file

@ -144,7 +144,7 @@ void AIMummy::Tick(RunListEvent* ev)
pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame); pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
int nFrame = getSeqFrame(nSeq, pActor->nFrame); int nFrame = getSeqFrame(nSeq, pActor->nFrame);
int nFrameFlag = FrameFlag[nFrame]; int nFrameFlag = getSeqFrameFlags(nFrame);
seq_MoveSequence(pActor, nSeq, pActor->nFrame); seq_MoveSequence(pActor, nSeq, pActor->nFrame);

View file

@ -1252,7 +1252,7 @@ void AIQueen::Tick(RunListEvent* ev)
bVal = true; bVal = true;
} }
int nFlag = FrameFlag[getSeqFrame(nSeq, QueenList[nQueen].nFrame)]; int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, QueenList[nQueen].nFrame));
if (pActor != nullptr) if (pActor != nullptr)
{ {

View file

@ -215,7 +215,7 @@ void AIRex::Tick(RunListEvent* ev)
} }
} }
int nFlag = FrameFlag[getSeqFrame(nSeq, pActor->nFrame)]; int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame));
DExhumedActor* pTarget = pActor->pTarget; DExhumedActor* pTarget = pActor->pTarget;

View file

@ -223,7 +223,7 @@ void AIRoach::Tick(RunListEvent* ev)
pActor->nFrame = 0; pActor->nFrame = 0;
} }
int nFlag = FrameFlag[getSeqFrame(nSeq, pActor->nFrame)]; int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame));
DExhumedActor* pTarget = pActor->pTarget; DExhumedActor* pTarget = pActor->pTarget;
if (nAction > 5) { if (nAction > 5) {

View file

@ -219,7 +219,7 @@ void AIScorp::Tick(RunListEvent* ev)
bVal = true; bVal = true;
} }
int nFlag = FrameFlag[getSeqFrame(nSeq, pActor->nFrame)]; int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame));
pTarget = pActor->pTarget; pTarget = pActor->pTarget;
switch (nAction) switch (nAction)

View file

@ -58,7 +58,7 @@ static int16_t SeqFlag[kMaxSequences]; // not used at all.
int16_t FrameSound[kMaxSEQFrames]; int16_t FrameSound[kMaxSEQFrames];
int16_t FrameSize[kMaxSEQFrames]; int16_t FrameSize[kMaxSEQFrames];
static int16_t FrameBase[kMaxSEQFrames]; static int16_t FrameBase[kMaxSEQFrames];
int16_t FrameFlag[kMaxSEQFrames]; static int16_t FrameFlag[kMaxSEQFrames];
int16_t ChunkYpos[kMaxSEQChunks]; int16_t ChunkYpos[kMaxSEQChunks];
int16_t ChunkXpos[kMaxSEQChunks]; int16_t ChunkXpos[kMaxSEQChunks];
@ -201,6 +201,17 @@ int getSeqFrameChunk(const int nFrame)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int getSeqFrameFlags(const int nFrame)
{
return FrameFlag[nFrame];
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int seq_ReadSequence(const char *seqName) int seq_ReadSequence(const char *seqName)
{ {
const int16_t StartFrameCount = frames; const int16_t StartFrameCount = frames;
@ -420,17 +431,6 @@ void seq_LoadSequences()
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int16_t seq_GetFrameFlag(int16_t val, int16_t nFrame)
{
return FrameFlag[getSeqFrame(val, nFrame)];
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void seq_DrawPilotLightSeq(double xOffset, double yOffset) void seq_DrawPilotLightSeq(double xOffset, double yOffset)
{ {
auto pSect = PlayerList[nLocalPlayer].pPlayerViewSect; auto pSect = PlayerList[nLocalPlayer].pPlayerViewSect;
@ -468,7 +468,7 @@ int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs,
int nFrame = getSeqFrame(nSeqOffset, dx); int nFrame = getSeqFrame(nSeqOffset, dx);
int nFrameBase = getSeqFrameChunk(nFrame); int nFrameBase = getSeqFrameChunk(nFrame);
int nFrameSize = FrameSize[nFrame]; int nFrameSize = FrameSize[nFrame];
int frameFlag = FrameFlag[nFrame]; int frameFlag = getSeqFrameFlags(nFrame);
while (1) while (1)
{ {
@ -585,7 +585,7 @@ int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal)
nStat &= ~(CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_YFLIP); nStat &= ~(CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_YFLIP);
} }
if (FrameFlag[nFrame] & 4) { if (getSeqFrameFlags(nFrame) & 4) {
nShade -= 100; nShade -= 100;
} }
@ -639,7 +639,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
int8_t shade = pTSprite->shade; int8_t shade = pTSprite->shade;
if (FrameFlag[eax] & 4) if (getSeqFrameFlags(eax) & 4)
{ {
shade -= 100; shade -= 100;
} }

View file

@ -110,8 +110,6 @@ struct actionSeq
extern int16_t frames; extern int16_t frames;
extern int16_t FrameFlag[];
extern int16_t nShadowWidth; extern int16_t nShadowWidth;
extern int16_t nFlameHeight; extern int16_t nFlameHeight;
@ -134,7 +132,6 @@ 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_DrawStatusSequence(int16_t nSequence, uint16_t edx, int16_t ebx);
int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs, int nShade, int nPal, DAngle angle, bool align = false); int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs, int nShade, int nPal, DAngle angle, bool align = false);
int16_t seq_GetFrameFlag(int16_t val, int16_t nFrame);
int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx); int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx);
int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal); int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal);
void seq_DrawPilotLightSeq(double xOffset, double yOffset); void seq_DrawPilotLightSeq(double xOffset, double yOffset);
@ -143,6 +140,7 @@ 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);
int getSeqFrameChunk(const int nFrame); int getSeqFrameChunk(const int nFrame);
int getSeqFrameFlags(const int nFrame);
END_PS_NS END_PS_NS

View file

@ -287,7 +287,7 @@ void AISet::Tick(RunListEvent* ev)
bVal = true; bVal = true;
} }
int nFlag = FrameFlag[getSeqFrame(nSeq, pActor->nFrame)]; int nFlag = getSeqFrameFlags(getSeqFrame(nSeq, pActor->nFrame));
DExhumedActor* pTarget = pActor->pTarget; DExhumedActor* pTarget = pActor->pTarget;
if (pTarget && nAction < 10) if (pTarget && nAction < 10)

View file

@ -123,7 +123,7 @@ void AISpider::Tick(RunListEvent* ev)
seq_MoveSequence(spp, nSeq, spp->nFrame); seq_MoveSequence(spp, nSeq, spp->nFrame);
int nFrameFlag = FrameFlag[getSeqFrame(nSeq, spp->nFrame)]; int nFrameFlag = getSeqFrameFlags(getSeqFrame(nSeq, spp->nFrame));
spp->nFrame++; spp->nFrame++;
if (spp->nFrame >= getSeqFrameCount(nSeq)) { if (spp->nFrame >= getSeqFrameCount(nSeq)) {