mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:44:56 +00:00
Various CActorContraption fixes
This commit is contained in:
@@ -37,6 +37,9 @@ size_t ComputeBitstreamSize(size_t keyFrameCount, const std::vector<Channel>& ch
|
||||
static inline QuantizedRot QuantizeRotation(const Value& quat, atUint32 div) {
|
||||
float q = M_PIF / 2.0f / float(div);
|
||||
zeus::simd_floats f(quat.simd);
|
||||
assert(std::abs(f[1]) <= 1.f && "Out of range quat X component");
|
||||
assert(std::abs(f[2]) <= 1.f && "Out of range quat Y component");
|
||||
assert(std::abs(f[3]) <= 1.f && "Out of range quat Z component");
|
||||
return {{
|
||||
atInt32(std::asin(f[1]) / q),
|
||||
atInt32(std::asin(f[2]) / q),
|
||||
|
||||
@@ -23,7 +23,9 @@ struct QuantizedValue {
|
||||
atInt32 delta = std::abs(v[idx] - other.v[idx]);
|
||||
if (delta == 0)
|
||||
return 1;
|
||||
return int(std::ceil(std::log2(delta))) + 1;
|
||||
int ret = int(std::ceil(std::log2(delta))) + 1;
|
||||
assert(ret <= 24 && "Bad q value");
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
struct QuantizedRot {
|
||||
|
||||
@@ -597,6 +597,7 @@ ANIM::ANIM(const BlenderAction& act, const std::unordered_map<std::string, atInt
|
||||
if (sign == 0.f)
|
||||
sign = q.w() < 0.f ? -1.f : 1.f;
|
||||
q *= sign;
|
||||
q.normalize();
|
||||
rotVals.emplace_back(q.mSimd);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,8 +122,8 @@ std::unique_ptr<atUint8[]> PAK::Entry::getBuffer(const nod::Node& pak, atUint64&
|
||||
strm->read(&chunkSz, 2);
|
||||
chunkSz = hecl::SBig(chunkSz);
|
||||
strm->read(compBuf, chunkSz);
|
||||
size_t dsz = rem;
|
||||
lzokay::decompress(compBuf, chunkSz, bufCur, dsz);
|
||||
size_t dsz;
|
||||
lzokay::decompress(compBuf, chunkSz, bufCur, rem, dsz);
|
||||
bufCur += dsz;
|
||||
rem -= dsz;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ struct CameraHintTrigger : IScriptObject {
|
||||
Value<atVec3f> location;
|
||||
Value<atVec3f> orientation;
|
||||
Value<atVec3f> volume;
|
||||
Value<bool> unknown1;
|
||||
Value<bool> unknown2;
|
||||
Value<bool> unknown3;
|
||||
Value<bool> active;
|
||||
Value<bool> deactivateOnEntered;
|
||||
Value<bool> deactivateOnExited;
|
||||
};
|
||||
} // namespace DataSpec::DNAMP1
|
||||
|
||||
@@ -47,8 +47,8 @@ void MREA::StreamReader::nextBlock() {
|
||||
rem -= chunkSz;
|
||||
} else {
|
||||
m_source.readUBytesToBuf(m_compBuf.get(), chunkSz);
|
||||
size_t dsz = rem;
|
||||
lzokay::decompress(m_compBuf.get(), chunkSz, bufCur, dsz);
|
||||
size_t dsz;
|
||||
lzokay::decompress(m_compBuf.get(), chunkSz, bufCur, rem, dsz);
|
||||
bufCur += dsz;
|
||||
rem -= dsz;
|
||||
}
|
||||
|
||||
@@ -179,8 +179,8 @@ std::unique_ptr<atUint8[]> PAK::Entry::getBuffer(const nod::Node& pak, atUint64&
|
||||
while (rem) {
|
||||
atUint16 chunkSz = hecl::SBig(*(atUint16*)compBufCur);
|
||||
compBufCur += 2;
|
||||
size_t dsz = rem;
|
||||
lzokay::decompress(compBufCur, chunkSz, bufCur, dsz);
|
||||
size_t dsz;
|
||||
lzokay::decompress(compBufCur, chunkSz, bufCur, rem, dsz);
|
||||
compBufCur += chunkSz;
|
||||
bufCur += dsz;
|
||||
rem -= dsz;
|
||||
|
||||
Reference in New Issue
Block a user