mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 08:54:15 +00:00
Clear unknowns in LegoAnimActorStruct and LegoAnimActor (#1673)
This commit is contained in:
@@ -8,13 +8,13 @@ class LegoAnim;
|
|||||||
|
|
||||||
// SIZE 0x20
|
// SIZE 0x20
|
||||||
struct LegoAnimActorStruct {
|
struct LegoAnimActorStruct {
|
||||||
LegoAnimActorStruct(float p_unk0x00, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs);
|
LegoAnimActorStruct(float p_worldSpeed, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs);
|
||||||
~LegoAnimActorStruct();
|
~LegoAnimActorStruct();
|
||||||
|
|
||||||
float GetDuration();
|
float GetDuration();
|
||||||
|
|
||||||
// FUNCTION: BETA10 0x1000fb10
|
// FUNCTION: BETA10 0x1000fb10
|
||||||
float GetUnknown0x00() { return m_unk0x00; }
|
float GetWorldSpeed() { return m_worldSpeed; }
|
||||||
|
|
||||||
// FUNCTION: BETA10 0x10012210
|
// FUNCTION: BETA10 0x10012210
|
||||||
LegoAnim* GetAnimTreePtr() { return m_AnimTreePtr; }
|
LegoAnim* GetAnimTreePtr() { return m_AnimTreePtr; }
|
||||||
@@ -23,7 +23,7 @@ struct LegoAnimActorStruct {
|
|||||||
LegoROI** GetROIMap() { return m_roiMap; }
|
LegoROI** GetROIMap() { return m_roiMap; }
|
||||||
|
|
||||||
// TODO: Possibly private
|
// TODO: Possibly private
|
||||||
float m_unk0x00; // 0x00
|
float m_worldSpeed; // 0x00
|
||||||
LegoAnim* m_AnimTreePtr; // 0x04
|
LegoAnim* m_AnimTreePtr; // 0x04
|
||||||
LegoROI** m_roiMap; // 0x08
|
LegoROI** m_roiMap; // 0x08
|
||||||
MxU32 m_numROIs; // 0x0c
|
MxU32 m_numROIs; // 0x0c
|
||||||
@@ -47,9 +47,14 @@ public:
|
|||||||
void Animate(float p_time) override; // vtable+0x70
|
void Animate(float p_time) override; // vtable+0x70
|
||||||
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
|
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
|
||||||
|
|
||||||
virtual MxResult FUN_1001c1f0(float& p_und);
|
virtual MxResult GetTimeInCycle(float& p_timeInCycle);
|
||||||
virtual MxResult FUN_1001c360(float, Matrix4& p_transform);
|
virtual MxResult AnimateWithTransform(float p_time, Matrix4& p_transform);
|
||||||
virtual MxResult FUN_1001c450(LegoAnim* p_AnimTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs);
|
virtual MxResult CreateAnimActorStruct(
|
||||||
|
LegoAnim* p_AnimTreePtr,
|
||||||
|
float p_worldSpeed,
|
||||||
|
LegoROI** p_roiMap,
|
||||||
|
MxU32 p_numROIs
|
||||||
|
);
|
||||||
virtual void ClearMaps();
|
virtual void ClearMaps();
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1000fba0
|
// FUNCTION: LEGO1 0x1000fba0
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public:
|
|||||||
|
|
||||||
void ParseAction(char* p_extra) override; // vtable+0x20
|
void ParseAction(char* p_extra) override; // vtable+0x20
|
||||||
|
|
||||||
MxResult FUN_1001c360(float p_und, Matrix4& p_transform) override;
|
MxResult AnimateWithTransform(float p_time, Matrix4& p_transform) override;
|
||||||
|
|
||||||
virtual void FUN_10071c80(Vector3& p_vec);
|
virtual void FUN_10071c80(Vector3& p_vec);
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
|
|||||||
void Act2Actor::FUN_10018980()
|
void Act2Actor::FUN_10018980()
|
||||||
{
|
{
|
||||||
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
|
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
|
||||||
if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
|
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
|
||||||
m_shootAnim = m_animMaps[i];
|
m_shootAnim = m_animMaps[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ void Act3Cop::ParseAction(char* p_extra)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < m_animMaps.size(); i++) {
|
for (i = 0; i < m_animMaps.size(); i++) {
|
||||||
if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
|
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
|
||||||
m_eatAnim = m_animMaps[i];
|
m_eatAnim = m_animMaps[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,7 +558,7 @@ void Act3Brickster::ParseAction(char* p_extra)
|
|||||||
((Act3*) m_world)->SetBrickster(this);
|
((Act3*) m_world)->SetBrickster(this);
|
||||||
|
|
||||||
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
|
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
|
||||||
if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
|
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
|
||||||
m_shootAnim = m_animMaps[i];
|
m_shootAnim = m_animMaps[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,14 @@ DECOMP_SIZE_ASSERT(LegoAnimActorStruct, 0x20)
|
|||||||
|
|
||||||
// FUNCTION: LEGO1 0x1001bf80
|
// FUNCTION: LEGO1 0x1001bf80
|
||||||
// FUNCTION: BETA10 0x1003dc10
|
// FUNCTION: BETA10 0x1003dc10
|
||||||
LegoAnimActorStruct::LegoAnimActorStruct(float p_unk0x00, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs)
|
LegoAnimActorStruct::LegoAnimActorStruct(
|
||||||
|
float p_worldSpeed,
|
||||||
|
LegoAnim* p_AnimTreePtr,
|
||||||
|
LegoROI** p_roiMap,
|
||||||
|
MxU32 p_numROIs
|
||||||
|
)
|
||||||
{
|
{
|
||||||
m_unk0x00 = p_unk0x00;
|
m_worldSpeed = p_worldSpeed;
|
||||||
m_AnimTreePtr = p_AnimTreePtr;
|
m_AnimTreePtr = p_AnimTreePtr;
|
||||||
m_roiMap = p_roiMap;
|
m_roiMap = p_roiMap;
|
||||||
m_numROIs = p_numROIs;
|
m_numROIs = p_numROIs;
|
||||||
@@ -50,22 +55,22 @@ LegoAnimActor::~LegoAnimActor()
|
|||||||
|
|
||||||
// FUNCTION: LEGO1 0x1001c1f0
|
// FUNCTION: LEGO1 0x1001c1f0
|
||||||
// FUNCTION: BETA10 0x1003f240
|
// FUNCTION: BETA10 0x1003f240
|
||||||
MxResult LegoAnimActor::FUN_1001c1f0(float& p_und)
|
MxResult LegoAnimActor::GetTimeInCycle(float& p_timeInCycle)
|
||||||
{
|
{
|
||||||
float duration = (float) m_animMaps[m_curAnim]->m_AnimTreePtr->GetDuration();
|
float duration = (float) m_animMaps[m_curAnim]->m_AnimTreePtr->GetDuration();
|
||||||
p_und = m_actorTime - duration * ((MxS32) (m_actorTime / duration));
|
p_timeInCycle = m_actorTime - duration * ((MxS32) (m_actorTime / duration));
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1001c240
|
// FUNCTION: LEGO1 0x1001c240
|
||||||
void LegoAnimActor::VTable0x74(Matrix4& p_transform)
|
void LegoAnimActor::VTable0x74(Matrix4& p_transform)
|
||||||
{
|
{
|
||||||
float und;
|
float timeInCycle;
|
||||||
LegoPathActor::VTable0x74(p_transform);
|
LegoPathActor::VTable0x74(p_transform);
|
||||||
|
|
||||||
if (m_curAnim >= 0) {
|
if (m_curAnim >= 0) {
|
||||||
FUN_1001c1f0(und);
|
GetTimeInCycle(timeInCycle);
|
||||||
FUN_1001c360(und, p_transform);
|
AnimateWithTransform(timeInCycle, p_transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,10 +86,10 @@ void LegoAnimActor::Animate(float p_time)
|
|||||||
|
|
||||||
if (m_actorState == c_initial && !m_userNavFlag && m_worldSpeed <= 0) {
|
if (m_actorState == c_initial && !m_userNavFlag && m_worldSpeed <= 0) {
|
||||||
if (m_curAnim >= 0) {
|
if (m_curAnim >= 0) {
|
||||||
MxMatrix matrix(m_unk0xec);
|
MxMatrix transform(m_unk0xec);
|
||||||
float f;
|
float timeInCycle;
|
||||||
FUN_1001c1f0(f);
|
GetTimeInCycle(timeInCycle);
|
||||||
FUN_1001c360(f, matrix);
|
AnimateWithTransform(timeInCycle, transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastTime = m_actorTime = p_time;
|
m_lastTime = m_actorTime = p_time;
|
||||||
@@ -96,9 +101,9 @@ void LegoAnimActor::Animate(float p_time)
|
|||||||
|
|
||||||
// FUNCTION: LEGO1 0x1001c360
|
// FUNCTION: LEGO1 0x1001c360
|
||||||
// FUNCTION: BETA10 0x1003e2d3
|
// FUNCTION: BETA10 0x1003e2d3
|
||||||
MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform)
|
MxResult LegoAnimActor::AnimateWithTransform(float p_time, Matrix4& p_transform)
|
||||||
{
|
{
|
||||||
if (p_und >= 0) {
|
if (p_time >= 0) {
|
||||||
assert((m_curAnim >= 0) && (m_curAnim < m_animMaps.size()));
|
assert((m_curAnim >= 0) && (m_curAnim < m_animMaps.size()));
|
||||||
|
|
||||||
LegoROI** roiMap = m_animMaps[m_curAnim]->m_roiMap;
|
LegoROI** roiMap = m_animMaps[m_curAnim]->m_roiMap;
|
||||||
@@ -133,7 +138,7 @@ MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (MxS32 j = 0; j < n->GetNumChildren(); j++) {
|
for (MxS32 j = 0; j < n->GetNumChildren(); j++) {
|
||||||
LegoROI::ApplyAnimationTransformation(n->GetChild(j), p_transform, p_und, roiMap);
|
LegoROI::ApplyAnimationTransformation(n->GetChild(j), p_transform, p_time, roiMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_cameraFlag) {
|
if (m_cameraFlag) {
|
||||||
@@ -150,15 +155,20 @@ MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform)
|
|||||||
|
|
||||||
// FUNCTION: LEGO1 0x1001c450
|
// FUNCTION: LEGO1 0x1001c450
|
||||||
// FUNCTION: BETA10 0x1003e590
|
// FUNCTION: BETA10 0x1003e590
|
||||||
MxResult LegoAnimActor::FUN_1001c450(LegoAnim* p_AnimTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs)
|
MxResult LegoAnimActor::CreateAnimActorStruct(
|
||||||
|
LegoAnim* p_AnimTreePtr,
|
||||||
|
float p_worldSpeed,
|
||||||
|
LegoROI** p_roiMap,
|
||||||
|
MxU32 p_numROIs
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// the capitalization of `p_AnimTreePtr` was taken from BETA10
|
// the capitalization of `p_AnimTreePtr` was taken from BETA10
|
||||||
assert(p_AnimTreePtr && p_roiMap);
|
assert(p_AnimTreePtr && p_roiMap);
|
||||||
|
|
||||||
LegoAnimActorStruct* laas = new LegoAnimActorStruct(p_unk0x00, p_AnimTreePtr, p_roiMap, p_numROIs);
|
LegoAnimActorStruct* laas = new LegoAnimActorStruct(p_worldSpeed, p_AnimTreePtr, p_roiMap, p_numROIs);
|
||||||
|
|
||||||
for (vector<LegoAnimActorStruct*>::iterator it = m_animMaps.begin(); it != m_animMaps.end(); it++) {
|
for (vector<LegoAnimActorStruct*>::iterator it = m_animMaps.begin(); it != m_animMaps.end(); it++) {
|
||||||
if (p_unk0x00 < (*it)->m_unk0x00) {
|
if (p_worldSpeed < (*it)->m_worldSpeed) {
|
||||||
m_animMaps.insert(it, laas);
|
m_animMaps.insert(it, laas);
|
||||||
SetWorldSpeed(m_worldSpeed);
|
SetWorldSpeed(m_worldSpeed);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
@@ -196,12 +206,12 @@ void LegoAnimActor::SetWorldSpeed(MxFloat p_worldSpeed)
|
|||||||
if (m_animMaps.size() > 0) {
|
if (m_animMaps.size() > 0) {
|
||||||
m_curAnim = 0;
|
m_curAnim = 0;
|
||||||
|
|
||||||
if (m_worldSpeed >= m_animMaps[m_animMaps.size() - 1]->m_unk0x00) {
|
if (m_worldSpeed >= m_animMaps[m_animMaps.size() - 1]->m_worldSpeed) {
|
||||||
m_curAnim = m_animMaps.size() - 1;
|
m_curAnim = m_animMaps.size() - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (MxU32 i = 0; i < m_animMaps.size(); i++) {
|
for (MxU32 i = 0; i < m_animMaps.size(); i++) {
|
||||||
if (m_worldSpeed <= m_animMaps[i]->m_unk0x00) {
|
if (m_worldSpeed <= m_animMaps[i]->m_worldSpeed) {
|
||||||
m_curAnim = i;
|
m_curAnim = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ inline void LegoExtraActor::FUN_1002ad8a()
|
|||||||
m_assAnimP->FUN_1006d680(this, -20.0f);
|
m_assAnimP->FUN_1006d680(this, -20.0f);
|
||||||
|
|
||||||
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
|
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
|
||||||
if (m_animMaps[i]->GetUnknown0x00() == -20.0f) {
|
if (m_animMaps[i]->GetWorldSpeed() == -20.0f) {
|
||||||
m_assAnim = new LegoAnimActorStruct(*m_animMaps[i]);
|
m_assAnim = new LegoAnimActorStruct(*m_animMaps[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ inline void LegoExtraActor::FUN_1002ad8a()
|
|||||||
m_disAnimP->FUN_1006d680(this, -21.0f);
|
m_disAnimP->FUN_1006d680(this, -21.0f);
|
||||||
|
|
||||||
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
|
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
|
||||||
if (m_animMaps[i]->GetUnknown0x00() == -21.0f) {
|
if (m_animMaps[i]->GetWorldSpeed() == -21.0f) {
|
||||||
m_disAnim = new LegoAnimActorStruct(*m_animMaps[i]);
|
m_disAnim = new LegoAnimActorStruct(*m_animMaps[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -410,7 +410,7 @@ void LegoExtraActor::VTable0xc4()
|
|||||||
if (b) {
|
if (b) {
|
||||||
float duration = m_animMaps[m_curAnim]->GetDuration();
|
float duration = m_animMaps[m_curAnim]->GetDuration();
|
||||||
MxMatrix matrix(m_unk0xec);
|
MxMatrix matrix(m_unk0xec);
|
||||||
LegoAnimActor::FUN_1001c360(duration, matrix);
|
LegoAnimActor::AnimateWithTransform(duration, matrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,10 +268,10 @@ void LegoRaceCar::ParseAction(char* p_extra)
|
|||||||
MxS32 i;
|
MxS32 i;
|
||||||
|
|
||||||
for (i = 0; i < m_animMaps.size(); i++) {
|
for (i = 0; i < m_animMaps.size(); i++) {
|
||||||
if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
|
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
|
||||||
m_skelKick1Anim = m_animMaps[i];
|
m_skelKick1Anim = m_animMaps[i];
|
||||||
}
|
}
|
||||||
else if (m_animMaps[i]->GetUnknown0x00() == -2.0f) {
|
else if (m_animMaps[i]->GetWorldSpeed() == -2.0f) {
|
||||||
m_skelKick2Anim = m_animMaps[i];
|
m_skelKick2Anim = m_animMaps[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ RaceSkel::~RaceSkel()
|
|||||||
|
|
||||||
// FUNCTION: LEGO1 0x10071b50
|
// FUNCTION: LEGO1 0x10071b50
|
||||||
// FUNCTION: BETA10 0x100f13cf
|
// FUNCTION: BETA10 0x100f13cf
|
||||||
MxResult RaceSkel::FUN_1001c360(float p_und, Matrix4& p_transform)
|
MxResult RaceSkel::AnimateWithTransform(float p_time, Matrix4& p_transform)
|
||||||
{
|
{
|
||||||
p_transform[3][0] = -630.0f;
|
p_transform[3][0] = -630.0f;
|
||||||
p_transform[3][1] = -4.688f;
|
p_transform[3][1] = -4.688f;
|
||||||
p_transform[3][2] = 323.0f;
|
p_transform[3][2] = 323.0f;
|
||||||
|
|
||||||
m_animPosition = p_und;
|
m_animPosition = p_time;
|
||||||
|
|
||||||
return LegoAnimActor::FUN_1001c360(p_und, p_transform);
|
return LegoAnimActor::AnimateWithTransform(p_time, p_transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10071b90
|
// FUNCTION: LEGO1 0x10071b90
|
||||||
|
|||||||
@@ -1435,7 +1435,7 @@ void LegoLocomotionAnimPresenter::FUN_1006d680(LegoAnimActor* p_actor, MxFloat p
|
|||||||
|
|
||||||
if (m_roiMap != NULL) {
|
if (m_roiMap != NULL) {
|
||||||
m_roiMapList->Append(m_roiMap);
|
m_roiMapList->Append(m_roiMap);
|
||||||
p_actor->FUN_1001c450(m_anim, p_value, m_roiMap, m_roiMapSize);
|
p_actor->CreateAnimActorStruct(m_anim, p_value, m_roiMap, m_roiMapSize);
|
||||||
m_roiMap = NULL;
|
m_roiMap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user