From bf660d76cfa65b3d9a243cfe68feb51dd14cd632 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Wed, 27 Dec 2023 19:20:39 -0500 Subject: [PATCH] fix limb framelist parsing * negative values mean "don't show cel", * there's always at least one frame, much like prop's stateCount --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 3f8cf31..f5b90e8 100644 --- a/index.js +++ b/index.js @@ -477,13 +477,13 @@ const decodeProp = (data) => { } const decodeLimb = (data, limb) => { + let frameCount = data.getUint8(0) + 1 limb.frames = [] - for (let iframe = 0; iframe < data.getUint8(0); iframe ++) { - limb.frames.push(data.getUint8(3 + iframe)) + for (let iframe = 0; iframe < frameCount; iframe ++) { + limb.frames.push(data.getInt8(3 + iframe)) } - const celOffsetsOff = 4 + limb.frames.length - // I don't understand this at all, but it seems to be correct? - const maxCelIndex = Math.max(...limb.frames) + 1 + const celOffsetsOff = 3 + frameCount + const maxCelIndex = Math.max(...limb.frames) limb.cels = [] for (let icel = 0; icel <= maxCelIndex; icel ++) { const celOff = data.getUint16(celOffsetsOff + (icel * 2), LE)