mirror of
https://github.com/red031000/nitrogfx.git
synced 2025-06-18 13:15:35 -04:00
apply padding to the correct animation result index when results are reused between sequences
This commit is contained in:
parent
112fce2031
commit
17cb8623f4
8
gfx.c
8
gfx.c
@ -1516,6 +1516,7 @@ void WriteNtrAnimation(char *path, struct JsonToAnimationOptions *options)
|
||||
{
|
||||
int sequenceLen = 0;
|
||||
int resultIndex = 0;
|
||||
int lastNewResultIndex = -1;
|
||||
for (int j = 0; j < options->sequenceData[i]->frameCount; j++)
|
||||
{
|
||||
// check if the result has already been used
|
||||
@ -1532,6 +1533,7 @@ void WriteNtrAnimation(char *path, struct JsonToAnimationOptions *options)
|
||||
if (usedResults[resultIndex] == -1)
|
||||
{
|
||||
usedResults[resultIndex] = options->sequenceData[i]->frameData[j]->resultId;
|
||||
lastNewResultIndex = options->sequenceData[i]->frameData[j]->resultId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1547,11 +1549,11 @@ void WriteNtrAnimation(char *path, struct JsonToAnimationOptions *options)
|
||||
sequenceLen += 0x8;
|
||||
}
|
||||
}
|
||||
if (sequenceLen % 4 != 0)
|
||||
if (sequenceLen % 4 != 0 && lastNewResultIndex != -1)
|
||||
{
|
||||
totalSize += 0x02;
|
||||
// mark the last animationResult for the sequence as padded, this saves needing to check this again later
|
||||
options->animationResults[resultIndex]->padded = true;
|
||||
// mark the last new animationResult index for the sequence as padded, this saves needing to check this again later
|
||||
options->animationResults[lastNewResultIndex]->padded = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user