Cleanup to the optimized animations

This commit is contained in:
yaz0r 2025-06-21 23:07:06 -07:00
parent 612b702790
commit 24c7d8fa23
5 changed files with 16 additions and 15 deletions

View File

@ -41,7 +41,6 @@ int SetAnimObjet(int frame, sAnimation* pAnimation, sBody* body)
if(body->m_flags & INFO_OPTIMISE)
{
body->m_groups[i].m_state.m_rotateDelta = keyframe.m_groups[i].m_rotateDelta;
body->m_groups[i].m_state.m_padding = keyframe.m_groups[i].m_padding;
}
}
@ -855,9 +854,9 @@ s16 SetInterAnimObjet(int frame, sAnimation* pAnim, sBody* pBody)
}
{
point3dStruct& state = pBody->m_groups[i].m_state.m_rotateDelta;
point3dStruct& previousState = pPreviousKeyframe->m_groups[i].m_rotateDelta;
point3dStruct& nextState = pKeyframe->m_groups[i].m_rotateDelta;
point3dStruct& state = pBody->m_groups[i].m_state.m_rotateDelta.value();
point3dStruct& previousState = pPreviousKeyframe->m_groups[i].m_rotateDelta.value();
point3dStruct& nextState = pKeyframe->m_groups[i].m_rotateDelta.value();
PatchInterAngle(&state.x, previousState.x, nextState.x, bp, bx);
PatchInterAngle(&state.y, previousState.y, nextState.y, bp, bx);

View File

@ -4,6 +4,7 @@
#include <vector>
#include <string>
#include <format>
#include <optional>
#endif
#ifdef __APPLE__

View File

@ -141,10 +141,11 @@ sAnimation* createAnimationFromPtr(void* ptr, int size)
pGroup->m_delta.y = READ_LE_S16(animPtr); animPtr += 2;
pGroup->m_delta.z = READ_LE_S16(animPtr); animPtr += 2;
if (bUseOptim) {
pGroup->m_rotateDelta.x = READ_LE_S16(animPtr); animPtr += 2;
pGroup->m_rotateDelta.y = READ_LE_S16(animPtr); animPtr += 2;
pGroup->m_rotateDelta.z = READ_LE_S16(animPtr); animPtr += 2;
pGroup->m_padding = READ_LE_S16(animPtr); animPtr += 2;
pGroup->m_rotateDelta.emplace();
pGroup->m_rotateDelta.value().x = READ_LE_S16(animPtr); animPtr += 2;
pGroup->m_rotateDelta.value().y = READ_LE_S16(animPtr); animPtr += 2;
pGroup->m_rotateDelta.value().z = READ_LE_S16(animPtr); animPtr += 2;
animPtr += 2;
}
}
}
@ -215,10 +216,11 @@ sBody* createBodyFromPtr(void* ptr)
newBody->m_groups[i].m_state.m_delta.x = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
newBody->m_groups[i].m_state.m_delta.y = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
newBody->m_groups[i].m_state.m_delta.z = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
newBody->m_groups[i].m_state.m_rotateDelta.x = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
newBody->m_groups[i].m_state.m_rotateDelta.y = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
newBody->m_groups[i].m_state.m_rotateDelta.z = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
newBody->m_groups[i].m_state.m_padding = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
newBody->m_groups[i].m_state.m_rotateDelta.emplace();
newBody->m_groups[i].m_state.m_rotateDelta.value().x = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
newBody->m_groups[i].m_state.m_rotateDelta.value().y = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
newBody->m_groups[i].m_state.m_rotateDelta.value().z = READ_LE_S16(bodyBuffer); bodyBuffer += 2;
bodyBuffer += 2;
}
}
else

View File

@ -344,7 +344,7 @@ int AnimNuage(int x,int y,int z,int alpha,int beta,int gamma, sBody* pBody)
break;
}
InitGroupeRot(pGroup[0].m_state.m_rotateDelta.x, pGroup[0].m_state.m_rotateDelta.y, pGroup[0].m_state.m_rotateDelta.z);
InitGroupeRot(pGroup->m_state.m_rotateDelta.value().x, pGroup->m_state.m_rotateDelta.value().y, pGroup->m_state.m_rotateDelta.value().z);
RotateGroupeOptimise(pGroup);
}
}

View File

@ -504,8 +504,7 @@ struct sGroupState
s16 m_type; // 0
point3dStruct m_delta; // 2
// (AITD2+) if Info_optimise
point3dStruct m_rotateDelta; // 8
s16 m_padding;
std::optional<point3dStruct> m_rotateDelta; // 8
// 8 / 0x10
};