From 529223e3110870886250597e788eda1b23d00dd2 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 9 Sep 2016 10:16:54 -1000 Subject: [PATCH] ANIM3 Bitstream reader fixes --- Runtime/Character/CFBStreamedAnimReader.cpp | 4 +++- Runtime/Character/CFBStreamedAnimReader.hpp | 1 + Runtime/Character/CFBStreamedCompression.cpp | 2 ++ Runtime/Character/CModelData.hpp | 8 -------- Runtime/Character/CPoseAsTransforms.cpp | 7 +++++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Runtime/Character/CFBStreamedAnimReader.cpp b/Runtime/Character/CFBStreamedAnimReader.cpp index 11a20ad3e..8e8034718 100644 --- a/Runtime/Character/CFBStreamedAnimReader.cpp +++ b/Runtime/Character/CFBStreamedAnimReader.cpp @@ -21,6 +21,7 @@ void CFBStreamedAnimReaderTotals::Allocate(u32 chanCount) void CFBStreamedAnimReaderTotals::Initialize(const CFBStreamedCompression& source) { + x1c_curKey = 0; x20_calculated = false; const u8* chans = source.GetPerChannelHeaders(); u32 boneChanCount = *reinterpret_cast(chans); @@ -245,6 +246,7 @@ void CFBStreamedPairOfTotals::SetTime(CBitLevelLoader& loader, const CCharAnimTi if (prior != -1 && prior < Prior().x1c_curKey) { Prior().Initialize(*x0_source); + Next().Initialize(*x0_source); loader.Reset(); } @@ -260,8 +262,8 @@ void CFBStreamedPairOfTotals::SetTime(CBitLevelLoader& loader, const CCharAnimTi void CFBStreamedPairOfTotals::DoIncrement(CBitLevelLoader& loader) { - Prior().IncrementInto(loader, *x0_source, Next()); x10_nextSel ^= 1; + Prior().IncrementInto(loader, *x0_source, Next()); } u32 CBitLevelLoader::LoadUnsigned(u8 q) diff --git a/Runtime/Character/CFBStreamedAnimReader.hpp b/Runtime/Character/CFBStreamedAnimReader.hpp index 22cfae744..731ade424 100644 --- a/Runtime/Character/CFBStreamedAnimReader.hpp +++ b/Runtime/Character/CFBStreamedAnimReader.hpp @@ -80,6 +80,7 @@ public: u32 LoadUnsigned(u8 q); s32 LoadSigned(u8 q); bool LoadBool(); + size_t GetCurBit() const { return m_bitIdx; } }; class CSegIdToIndexConverter diff --git a/Runtime/Character/CFBStreamedCompression.cpp b/Runtime/Character/CFBStreamedCompression.cpp index 5e2f975b3..18eb74df0 100644 --- a/Runtime/Character/CFBStreamedCompression.cpp +++ b/Runtime/Character/CFBStreamedCompression.cpp @@ -182,6 +182,7 @@ u32 CFBStreamedCompression::ComputeBitstreamWords(const u8* chans) for (u32 c=0 ; c(chans) & 0xff; totalBits += *reinterpret_cast(chans + 0x4) & 0xff; totalBits += *reinterpret_cast(chans + 0x8) & 0xff; @@ -202,6 +203,7 @@ u32 CFBStreamedCompression::ComputeBitstreamWords(const u8* chans) for (u32 c=0 ; c(chans + 0x2); totalBits += *reinterpret_cast(chans + 0x5); totalBits += *reinterpret_cast(chans + 0x8); diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp index b6cdbea04..b2f822da6 100644 --- a/Runtime/Character/CModelData.hpp +++ b/Runtime/Character/CModelData.hpp @@ -87,14 +87,6 @@ class CModelData std::unique_ptr m_xrayModelInst; std::unique_ptr m_infraModelInst; - struct WeakModelInsts - { - std::weak_ptr m_normalModelInst; - std::weak_ptr m_xrayModelInst; - std::weak_ptr m_infraModelInst; - }; - std::vector m_weakInsts; - public: enum class EWhichModel { diff --git a/Runtime/Character/CPoseAsTransforms.cpp b/Runtime/Character/CPoseAsTransforms.cpp index 67b6d0c43..14e3fcf98 100644 --- a/Runtime/Character/CPoseAsTransforms.cpp +++ b/Runtime/Character/CPoseAsTransforms.cpp @@ -63,8 +63,11 @@ void CPoseAsTransforms::Insert(const CSegId& id, Transform& xfOut = xd0_transformArr[x0_nextId]; xfOut.m_originToAccum = zeus::CTransform(rotation, offset); xfOut.m_restPoseToAccum = xfOut.m_originToAccum * zeus::CTransform::Translate(-restOffset); - printf("INSBONE %d\n", int(id)); - xfOut.m_originToAccum.printMatrix(); + //if (id == 4) + //{ + // printf("INSBONE %d\n", int(id)); + // xfOut.m_originToAccum.printMatrix(); + //} std::pair& link = x8_links[id]; link.first = xd4_lastInserted;