From 4d1609732bcf8618f367cb43e9d29f49fec5516b Mon Sep 17 00:00:00 2001 From: Joshua Smith Date: Sun, 27 Oct 2024 18:56:21 -0500 Subject: [PATCH] undo changes to animationElement/animationType fields --- gfx.c | 16 ++++++++-------- json.c | 6 +++--- options.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gfx.c b/gfx.c index f8589ca..99846e6 100644 --- a/gfx.c +++ b/gfx.c @@ -1327,8 +1327,8 @@ void ReadNtrAnimation(char *path, struct JsonToAnimationOptions *options) { options->sequenceData[i]->frameCount = data[offset] | (data[offset + 1] << 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]->animationType2 = data[offset + 6] | (data[offset + 7] << 8); + options->sequenceData[i]->animationElement = data[offset + 4] | (data[offset + 5] << 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); 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)); } - // 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 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 + 2] = options->sequenceData[i / 0x10]->loopStartFrame & 0xff; KBNAContents[i + 3] = options->sequenceData[i / 0x10]->loopStartFrame >> 8; - KBNAContents[i + 4] = options->sequenceData[i / 0x10]->animationType & 0xff; - KBNAContents[i + 5] = (options->sequenceData[i / 0x10]->animationType >> 8) & 0xff; - KBNAContents[i + 6] = options->sequenceData[i / 0x10]->animationType2 & 0xff; - KBNAContents[i + 7] = (options->sequenceData[i / 0x10]->animationType2 >> 8) & 0xff; + KBNAContents[i + 4] = options->sequenceData[i / 0x10]->animationElement & 0xff; + KBNAContents[i + 5] = (options->sequenceData[i / 0x10]->animationElement >> 8) & 0xff; + KBNAContents[i + 6] = options->sequenceData[i / 0x10]->animationType & 0xff; + KBNAContents[i + 7] = (options->sequenceData[i / 0x10]->animationType >> 8) & 0xff; KBNAContents[i + 8] = options->sequenceData[i / 0x10]->playbackMode & 0xff; KBNAContents[i + 9] = (options->sequenceData[i / 0x10]->playbackMode >> 8) & 0xff; KBNAContents[i + 10] = (options->sequenceData[i / 0x10]->playbackMode >> 16) & 0xff; diff --git a/json.c b/json.c index 772bcc9..12bc8a9 100644 --- a/json.c +++ b/json.c @@ -376,14 +376,14 @@ struct JsonToAnimationOptions *ParseNANRJson(char *path) cJSON *frameCount = cJSON_GetObjectItemCaseSensitive(sequence, "frameCount"); cJSON *loopStartFrame = cJSON_GetObjectItemCaseSensitive(sequence, "loopStartFrame"); + cJSON *animationElement = cJSON_GetObjectItemCaseSensitive(sequence, "animationElement"); cJSON *animationType = cJSON_GetObjectItemCaseSensitive(sequence, "animationType"); - cJSON *animationType2 = cJSON_GetObjectItemCaseSensitive(sequence, "animationType2"); cJSON *playbackMode = cJSON_GetObjectItemCaseSensitive(sequence, "playbackMode"); options->sequenceData[i]->frameCount = GetInt(frameCount); options->sequenceData[i]->loopStartFrame = GetInt(loopStartFrame); + options->sequenceData[i]->animationElement = GetInt(animationElement); options->sequenceData[i]->animationType = GetInt(animationType); - options->sequenceData[i]->animationType2 = GetInt(animationType2); options->sequenceData[i]->playbackMode = GetInt(playbackMode); 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_AddNumberToObject(sequence, "frameCount", options->sequenceData[i]->frameCount); 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, "animationType2", options->sequenceData[i]->animationType2); cJSON_AddNumberToObject(sequence, "playbackMode", options->sequenceData[i]->playbackMode); cJSON *frameData = cJSON_AddArrayToObject(sequence, "frameData"); diff --git a/options.h b/options.h index d0870ea..867a204 100644 --- a/options.h +++ b/options.h @@ -123,8 +123,8 @@ struct FrameData { struct SequenceData { short frameCount; short loopStartFrame; + short animationElement; short animationType; - short animationType2; int playbackMode; struct FrameData **frameData; };