mirror of https://github.com/AxioDL/metaforce.git
Signed read bug fix
This commit is contained in:
parent
7953ca4828
commit
e2f342d107
|
@ -471,6 +471,7 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
/* Generate Bitstream */
|
||||
sizeOut = ComputeBitstreamSize(keyFrameCount, channels);
|
||||
std::unique_ptr<atUint8[]> newData(new atUint8[sizeOut]);
|
||||
memset(newData.get(), 0, sizeOut);
|
||||
|
||||
lastVals = initVals;
|
||||
for (size_t f=0 ; f<keyFrameCount ; ++f)
|
||||
|
@ -479,7 +480,7 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
vit = lastVals.begin();
|
||||
for (const Channel& chan : channels)
|
||||
{
|
||||
const Value& val = (*kit++)[f];
|
||||
const Value& val = (*kit++)[f+1];
|
||||
QuantizedValue& last = *vit++;
|
||||
switch (chan.type)
|
||||
{
|
||||
|
|
|
@ -386,16 +386,17 @@ void ANIM::ANIM2::write(athena::io::IStreamWriter& writer) const
|
|||
size_t frameCount = 0;
|
||||
for (atUint32 frame : frames)
|
||||
{
|
||||
while (keyBmp.getBit(frame))
|
||||
++frame;
|
||||
if (!keyBmp.getBit(frame))
|
||||
{
|
||||
keyBmp.setBit(frame);
|
||||
frameCount = frame + 1;
|
||||
frameCount += 1;
|
||||
}
|
||||
}
|
||||
head.keyBitmapBitCount = frameCount;
|
||||
head.duration = frameCount * mainInterval;
|
||||
head.boneChannelCount = bones.size();
|
||||
|
||||
size_t keyframeCount = frames.size();
|
||||
size_t keyframeCount = frameCount - 1;
|
||||
std::vector<DNAANIM::Channel> qChannels = channels;
|
||||
DNAANIM::BitstreamWriter bsWriter;
|
||||
size_t bsSize;
|
||||
|
|
|
@ -77,38 +77,38 @@ struct ANIM : BigDNA
|
|||
Delete expl;
|
||||
Value<atUint32> id = 0;
|
||||
Value<atUint16> keyCount1 = 0;
|
||||
Value<atUint16> initRX = 0;
|
||||
Value<atInt16> initRX = 0;
|
||||
Value<atUint8> qRX = 0;
|
||||
Value<atUint16> initRY = 0;
|
||||
Value<atInt16> initRY = 0;
|
||||
Value<atUint8> qRY = 0;
|
||||
Value<atUint16> initRZ = 0;
|
||||
Value<atInt16> initRZ = 0;
|
||||
Value<atUint8> qRZ = 0;
|
||||
Value<atUint16> keyCount2 = 0;
|
||||
Value<atUint16> initTX = 0;
|
||||
Value<atInt16> initTX = 0;
|
||||
Value<atUint8> qTX = 0;
|
||||
Value<atUint16> initTY = 0;
|
||||
Value<atInt16> initTY = 0;
|
||||
Value<atUint8> qTY = 0;
|
||||
Value<atUint16> initTZ = 0;
|
||||
Value<atInt16> initTZ = 0;
|
||||
Value<atUint8> qTZ = 0;
|
||||
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{
|
||||
id = reader.readUint32Big();
|
||||
keyCount1 = reader.readUint16Big();
|
||||
initRX = reader.readUint16Big();
|
||||
initRX = reader.readInt16Big();
|
||||
qRX = reader.readUByte();
|
||||
initRY = reader.readUint16Big();
|
||||
initRY = reader.readInt16Big();
|
||||
qRY = reader.readUByte();
|
||||
initRZ = reader.readUint16Big();
|
||||
initRZ = reader.readInt16Big();
|
||||
qRZ = reader.readUByte();
|
||||
keyCount2 = reader.readUint16Big();
|
||||
if (keyCount2)
|
||||
{
|
||||
initTX = reader.readUint16Big();
|
||||
initTX = reader.readInt16Big();
|
||||
qTX = reader.readUByte();
|
||||
initTY = reader.readUint16Big();
|
||||
initTY = reader.readInt16Big();
|
||||
qTY = reader.readUByte();
|
||||
initTZ = reader.readUint16Big();
|
||||
initTZ = reader.readInt16Big();
|
||||
qTZ = reader.readUByte();
|
||||
}
|
||||
}
|
||||
|
@ -116,20 +116,20 @@ struct ANIM : BigDNA
|
|||
{
|
||||
writer.writeUint32Big(id);
|
||||
writer.writeUint16Big(keyCount1);
|
||||
writer.writeUint16Big(initRX);
|
||||
writer.writeInt16Big(initRX);
|
||||
writer.writeUByte(qRX);
|
||||
writer.writeUint16Big(initRY);
|
||||
writer.writeInt16Big(initRY);
|
||||
writer.writeUByte(qRY);
|
||||
writer.writeUint16Big(initRZ);
|
||||
writer.writeInt16Big(initRZ);
|
||||
writer.writeUByte(qRZ);
|
||||
writer.writeUint16Big(keyCount2);
|
||||
if (keyCount2)
|
||||
{
|
||||
writer.writeUint16Big(initTX);
|
||||
writer.writeInt16Big(initTX);
|
||||
writer.writeUByte(qTX);
|
||||
writer.writeUint16Big(initTY);
|
||||
writer.writeInt16Big(initTY);
|
||||
writer.writeUByte(qTY);
|
||||
writer.writeUint16Big(initTZ);
|
||||
writer.writeInt16Big(initTZ);
|
||||
writer.writeUByte(qTZ);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue