undo changes to animationElement/animationType fields

This commit is contained in:
Joshua Smith 2024-10-27 18:56:21 -05:00
parent 4433b68feb
commit 4d1609732b
3 changed files with 12 additions and 12 deletions

16
gfx.c
View File

@ -1327,8 +1327,8 @@ void ReadNtrAnimation(char *path, struct JsonToAnimationOptions *options)
{ {
options->sequenceData[i]->frameCount = data[offset] | (data[offset + 1] << 8); options->sequenceData[i]->frameCount = data[offset] | (data[offset + 1] << 8);
options->sequenceData[i]->loopStartFrame = data[offset + 2] | (data[offset + 3] << 8); options->sequenceData[i]->loopStartFrame = data[offset + 2] | (data[offset + 3] << 8);
options->sequenceData[i]->animationType = data[offset + 4] | (data[offset + 5] << 8); options->sequenceData[i]->animationElement = data[offset + 4] | (data[offset + 5] << 8);
options->sequenceData[i]->animationType2 = data[offset + 6] | (data[offset + 7] << 8); options->sequenceData[i]->animationType = data[offset + 6] | (data[offset + 7] << 8);
options->sequenceData[i]->playbackMode = data[offset + 8] | (data[offset + 9] << 8) | (data[offset + 10] << 16) | (data[offset + 11] << 24); options->sequenceData[i]->playbackMode = data[offset + 8] | (data[offset + 9] << 8) | (data[offset + 10] << 16) | (data[offset + 11] << 24);
frameOffsets[i] = data[offset + 12] | (data[offset + 13] << 8) | (data[offset + 14] << 16) | (data[offset + 15] << 24); frameOffsets[i] = data[offset + 12] | (data[offset + 13] << 8) | (data[offset + 14] << 16) | (data[offset + 15] << 24);
@ -1402,12 +1402,12 @@ void ReadNtrAnimation(char *path, struct JsonToAnimationOptions *options)
options->animationResults[i] = malloc(sizeof(struct AnimationResults)); options->animationResults[i] = malloc(sizeof(struct AnimationResults));
} }
// store the animationType of the corresponding sequence as this result's resultType // store the animationElement of the corresponding sequence as this result's resultType
for (int i = 0; i < options->sequenceCount; i++) for (int i = 0; i < options->sequenceCount; i++)
{ {
for (int j = 0; j < options->sequenceData[i]->frameCount; j++) for (int j = 0; j < options->sequenceData[i]->frameCount; j++)
{ {
options->animationResults[options->sequenceData[i]->frameData[j]->resultId]->resultType = options->sequenceData[i]->animationType; options->animationResults[options->sequenceData[i]->frameData[j]->resultId]->resultType = options->sequenceData[i]->animationElement;
} }
} }
@ -1612,10 +1612,10 @@ void WriteNtrAnimation(char *path, struct JsonToAnimationOptions *options)
KBNAContents[i + 1] = options->sequenceData[i / 0x10]->frameCount >> 8; KBNAContents[i + 1] = options->sequenceData[i / 0x10]->frameCount >> 8;
KBNAContents[i + 2] = options->sequenceData[i / 0x10]->loopStartFrame & 0xff; KBNAContents[i + 2] = options->sequenceData[i / 0x10]->loopStartFrame & 0xff;
KBNAContents[i + 3] = options->sequenceData[i / 0x10]->loopStartFrame >> 8; KBNAContents[i + 3] = options->sequenceData[i / 0x10]->loopStartFrame >> 8;
KBNAContents[i + 4] = options->sequenceData[i / 0x10]->animationType & 0xff; KBNAContents[i + 4] = options->sequenceData[i / 0x10]->animationElement & 0xff;
KBNAContents[i + 5] = (options->sequenceData[i / 0x10]->animationType >> 8) & 0xff; KBNAContents[i + 5] = (options->sequenceData[i / 0x10]->animationElement >> 8) & 0xff;
KBNAContents[i + 6] = options->sequenceData[i / 0x10]->animationType2 & 0xff; KBNAContents[i + 6] = options->sequenceData[i / 0x10]->animationType & 0xff;
KBNAContents[i + 7] = (options->sequenceData[i / 0x10]->animationType2 >> 8) & 0xff; KBNAContents[i + 7] = (options->sequenceData[i / 0x10]->animationType >> 8) & 0xff;
KBNAContents[i + 8] = options->sequenceData[i / 0x10]->playbackMode & 0xff; KBNAContents[i + 8] = options->sequenceData[i / 0x10]->playbackMode & 0xff;
KBNAContents[i + 9] = (options->sequenceData[i / 0x10]->playbackMode >> 8) & 0xff; KBNAContents[i + 9] = (options->sequenceData[i / 0x10]->playbackMode >> 8) & 0xff;
KBNAContents[i + 10] = (options->sequenceData[i / 0x10]->playbackMode >> 16) & 0xff; KBNAContents[i + 10] = (options->sequenceData[i / 0x10]->playbackMode >> 16) & 0xff;

6
json.c
View File

@ -376,14 +376,14 @@ struct JsonToAnimationOptions *ParseNANRJson(char *path)
cJSON *frameCount = cJSON_GetObjectItemCaseSensitive(sequence, "frameCount"); cJSON *frameCount = cJSON_GetObjectItemCaseSensitive(sequence, "frameCount");
cJSON *loopStartFrame = cJSON_GetObjectItemCaseSensitive(sequence, "loopStartFrame"); cJSON *loopStartFrame = cJSON_GetObjectItemCaseSensitive(sequence, "loopStartFrame");
cJSON *animationElement = cJSON_GetObjectItemCaseSensitive(sequence, "animationElement");
cJSON *animationType = cJSON_GetObjectItemCaseSensitive(sequence, "animationType"); cJSON *animationType = cJSON_GetObjectItemCaseSensitive(sequence, "animationType");
cJSON *animationType2 = cJSON_GetObjectItemCaseSensitive(sequence, "animationType2");
cJSON *playbackMode = cJSON_GetObjectItemCaseSensitive(sequence, "playbackMode"); cJSON *playbackMode = cJSON_GetObjectItemCaseSensitive(sequence, "playbackMode");
options->sequenceData[i]->frameCount = GetInt(frameCount); options->sequenceData[i]->frameCount = GetInt(frameCount);
options->sequenceData[i]->loopStartFrame = GetInt(loopStartFrame); options->sequenceData[i]->loopStartFrame = GetInt(loopStartFrame);
options->sequenceData[i]->animationElement = GetInt(animationElement);
options->sequenceData[i]->animationType = GetInt(animationType); options->sequenceData[i]->animationType = GetInt(animationType);
options->sequenceData[i]->animationType2 = GetInt(animationType2);
options->sequenceData[i]->playbackMode = GetInt(playbackMode); options->sequenceData[i]->playbackMode = GetInt(playbackMode);
options->sequenceData[i]->frameData = malloc(sizeof(struct FrameData *) * options->sequenceData[i]->frameCount); options->sequenceData[i]->frameData = malloc(sizeof(struct FrameData *) * options->sequenceData[i]->frameCount);
@ -521,8 +521,8 @@ char *GetNANRJson(struct JsonToAnimationOptions *options)
cJSON *sequence = cJSON_CreateObject(); cJSON *sequence = cJSON_CreateObject();
cJSON_AddNumberToObject(sequence, "frameCount", options->sequenceData[i]->frameCount); cJSON_AddNumberToObject(sequence, "frameCount", options->sequenceData[i]->frameCount);
cJSON_AddNumberToObject(sequence, "loopStartFrame", options->sequenceData[i]->loopStartFrame); cJSON_AddNumberToObject(sequence, "loopStartFrame", options->sequenceData[i]->loopStartFrame);
cJSON_AddNumberToObject(sequence, "animationElement", options->sequenceData[i]->animationElement);
cJSON_AddNumberToObject(sequence, "animationType", options->sequenceData[i]->animationType); cJSON_AddNumberToObject(sequence, "animationType", options->sequenceData[i]->animationType);
cJSON_AddNumberToObject(sequence, "animationType2", options->sequenceData[i]->animationType2);
cJSON_AddNumberToObject(sequence, "playbackMode", options->sequenceData[i]->playbackMode); cJSON_AddNumberToObject(sequence, "playbackMode", options->sequenceData[i]->playbackMode);
cJSON *frameData = cJSON_AddArrayToObject(sequence, "frameData"); cJSON *frameData = cJSON_AddArrayToObject(sequence, "frameData");

View File

@ -123,8 +123,8 @@ struct FrameData {
struct SequenceData { struct SequenceData {
short frameCount; short frameCount;
short loopStartFrame; short loopStartFrame;
short animationElement;
short animationType; short animationType;
short animationType2;
int playbackMode; int playbackMode;
struct FrameData **frameData; struct FrameData **frameData;
}; };