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

This commit is contained in:
Mitchell Richters 2023-04-06 19:27:42 +10:00
parent 01148a8c29
commit 86c559ff1c
3 changed files with 18 additions and 9 deletions

View file

@ -63,7 +63,7 @@ static int16_t FrameFlag[kMaxSEQFrames];
static int16_t ChunkYpos[kMaxSEQChunks];
static int16_t ChunkXpos[kMaxSEQChunks];
static int16_t ChunkPict[kMaxSEQChunks];
int16_t ChunkFlag[kMaxSEQChunks];
static int16_t ChunkFlag[kMaxSEQChunks];
const char *SeqNames[kMaxSEQFiles] =
@ -256,6 +256,17 @@ int getSeqFrameChunkPicnum(const int nChunk)
//
//---------------------------------------------------------------------------
int getSeqFrameChunkFlags(const int nChunk)
{
return ChunkFlag[nChunk];
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int seq_ReadSequence(const char *seqName)
{
const int16_t StartFrameCount = frames;
@ -524,10 +535,10 @@ int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs,
int y = getSeqFrameChunkPosY(nFrameBase) + 100;
int stat = 0;
if (ChunkFlag[nFrameBase] & 1)
if (getSeqFrameChunkFlags(nFrameBase) & 1)
stat |= RS_XFLIPHUD;
if (ChunkFlag[nFrameBase] & 2)
if (getSeqFrameChunkFlags(nFrameBase) & 2)
stat |= RS_YFLIPHUD;
if (align) stat |= RS_ALIGN_R;
@ -637,7 +648,7 @@ int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal)
pTSprite->shade = nShade;
pTSprite->statnum = nFrameSize;
if (ChunkFlag[nFrameBase] & 1)
if (getSeqFrameChunkFlags(nFrameBase) & 1)
{
pTSprite->xoffset = (int8_t)getSeqFrameChunkPosX(nFrameBase);
pTSprite->cstat |= CSTAT_SPRITE_XFLIP;
@ -727,7 +738,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
tsp->clipdist = pTSprite->clipdist;
tsp->statnum = esi;
if (ChunkFlag[nBase] & 1)
if (getSeqFrameChunkFlags(nBase) & 1)
{
tsp->xoffset = (int8_t)getSeqFrameChunkPosX(nBase);
tsp->cstat |= CSTAT_SPRITE_XFLIP; // x-flipped

View file

@ -116,9 +116,6 @@ extern int16_t nFlameHeight;
extern int16_t nPilotLightFrame;
extern int16_t nPilotLightCount;
extern int16_t ChunkFlag[];
void seq_LoadSequences();
int seq_GetFrameSound(int val, int edx);
void seq_MoveSequence(DExhumedActor* actor, int16_t nSeq, int16_t nFrame);
@ -141,6 +138,7 @@ int getSeqFrameChunkCount(const int nFrame);
int getSeqFrameChunkPosX(const int nChunk);
int getSeqFrameChunkPosY(const int nChunk);
int getSeqFrameChunkPicnum(const int nChunk);
int getSeqFrameChunkFlags(const int nChunk);
END_PS_NS

View file

@ -73,7 +73,7 @@ struct ChunkFrame
auto ttex = tileGetTexture(getSeqFrameChunkPicnum(nFrameBase));
if (ttex) tex = ttex->GetID();
else tex.SetInvalid();
flags = ChunkFlag[nFrameBase];
flags = getSeqFrameChunkFlags(nFrameBase);
}
};