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

This commit is contained in:
Mitchell Richters 2023-04-06 19:30:36 +10:00
parent 93fe699b78
commit 924ac25df1
3 changed files with 18 additions and 7 deletions

View file

@ -56,7 +56,7 @@ static int16_t SeqSize[kMaxSequences];
static int16_t SeqFlag[kMaxSequences]; // not used at all.
int16_t FrameSound[kMaxSEQFrames];
int16_t FrameSize[kMaxSEQFrames];
static int16_t FrameSize[kMaxSEQFrames];
static int16_t FrameBase[kMaxSEQFrames];
static int16_t FrameFlag[kMaxSEQFrames];
@ -212,6 +212,17 @@ int getSeqFrameFlags(const int nFrame)
//
//---------------------------------------------------------------------------
int getSeqFrameChunkCount(const int nFrame)
{
return FrameSize[nFrame];
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int seq_ReadSequence(const char *seqName)
{
const int16_t StartFrameCount = frames;
@ -439,7 +450,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset)
{
int16_t nFrame = nPilotLightBase + nPilotLightFrame;
int16_t nFrameBase = getSeqFrameChunk(nFrame);
int16_t nFrameSize = FrameSize[nFrame];
int16_t nFrameSize = getSeqFrameChunkCount(nFrame);
while (1)
{
@ -467,7 +478,7 @@ int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs,
{
int nFrame = getSeqFrame(nSeqOffset, dx);
int nFrameBase = getSeqFrameChunk(nFrame);
int nFrameSize = FrameSize[nFrame];
int nFrameSize = getSeqFrameChunkCount(nFrame);
int frameFlag = getSeqFrameFlags(nFrame);
while (1)
@ -571,7 +582,7 @@ int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal)
int16_t nFrame = getSeqFrame(nSeq + nSeqOffset, nVal);
int16_t nFrameBase = getSeqFrameChunk(nFrame);
int16_t nFrameSize = FrameSize[nFrame];
int16_t nFrameSize = getSeqFrameChunkCount(nFrame);
uint8_t nShade = pTSprite->shade;
auto nStat = pTSprite->cstat;
@ -635,7 +646,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
int edi = getSeqFrame(edx + val, nFrame);
int16_t nBase = getSeqFrameChunk(edi);
int16_t nSize = FrameSize[edi];
int16_t nSize = getSeqFrameChunkCount(edi);
int8_t shade = pTSprite->shade;

View file

@ -120,7 +120,6 @@ extern int16_t ChunkYpos[];
extern int16_t ChunkXpos[];
extern int16_t ChunkPict[];
extern int16_t ChunkFlag[];
extern int16_t FrameSize[];
void seq_LoadSequences();
@ -141,6 +140,7 @@ int getSeqFrame(const int nSeq, const int nFrame = 0);
int getSeqFrameCount(const int nSeq);
int getSeqFrameChunk(const int nFrame);
int getSeqFrameFlags(const int nFrame);
int getSeqFrameChunkCount(const int nFrame);
END_PS_NS

View file

@ -99,7 +99,7 @@ DEFINE_ACTION_FUNCTION(_Exhumed, GetStatusSequence)
frameindex += getSeqFrame(nSequence + nStatusSeqOffset);
if (numret > 0) ret[0].SetInt(getSeqFrameChunk(frameindex));
if (numret > 1) ret[1].SetInt(FrameSize[frameindex]);
if (numret > 1) ret[1].SetInt(getSeqFrameChunkCount(frameindex));
return min(numret, 2);
}