Implement/match LegoAnimationManager::FUN_10062650 (#896)

* Implement/match LegoAnimationManager::FUN_10062650

* Shorten code
This commit is contained in:
Christian Semmler 2024-05-09 16:24:45 -04:00 committed by GitHub
parent 6a8fb3f46b
commit 556cbdaab3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 7 deletions

View file

@ -140,7 +140,7 @@ class LegoAnimationManager : public MxCore {
MxBool FUN_100623a0(AnimInfo& p_info);
MxBool ModelExists(AnimInfo& p_info, const char* p_name);
void FUN_10062580(AnimInfo& p_info);
MxBool FUN_10062650(Vector3&, float, LegoROI*);
MxBool FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi);
MxBool FUN_10062710(AnimInfo& p_info);
void FUN_10063aa0();
void FUN_10063d10();

View file

@ -1309,6 +1309,7 @@ MxU16 LegoAnimationManager::FUN_10062110(
if (direction.Dot(&direction, &p_direction) > 0.707) {
Mx3DPointFloat position(p_roi->GetWorldPosition());
// TODO: Fix call
((Vector3&) position).Sub(&p_position);
float len = position.LenSquared();
float min, max;
@ -1389,7 +1390,7 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info)
LegoEntityList* entityList = world->GetEntityList();
if (entityList != NULL) {
Mx3DPointFloat vec(p_info.m_unk0x10[0], p_info.m_unk0x10[1], p_info.m_unk0x10[2]);
Mx3DPointFloat position(p_info.m_unk0x10[0], p_info.m_unk0x10[1], p_info.m_unk0x10[2]);
float und = p_info.m_unk0x10[3];
LegoEntityListCursor cursor(entityList);
@ -1400,7 +1401,7 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info)
if (entity != actor && entity->IsA("LegoPathActor")) {
LegoROI* roi = entity->GetROI();
if (roi->GetVisibility() && FUN_10062650(vec, und, roi)) {
if (roi->GetVisibility() && FUN_10062650(position, und, roi)) {
if (!ModelExists(p_info, roi->GetName())) {
return TRUE;
}
@ -1467,11 +1468,28 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info)
}
}
// STUB: LEGO1 0x10062650
// FUNCTION: LEGO1 0x10062650
// FUNCTION: BETA10 0x100436e2
MxBool LegoAnimationManager::FUN_10062650(Vector3&, float, LegoROI*)
MxBool LegoAnimationManager::FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi)
{
if (p_roi != NULL) {
Mx3DPointFloat position(p_position);
// TODO: Fix call
((Vector3&) position).Sub(p_roi->GetWorldPosition());
float len = position.LenSquared();
if (len <= 0.0f) {
return TRUE;
}
len = sqrt(len);
if (p_roi->GetWorldBoundingSphere().Radius() + p_und >= len) {
return TRUE;
}
}
return FALSE;
}
// STUB: LEGO1 0x10062710

View file

@ -123,7 +123,7 @@ class Vector2 {
virtual void Add(Vector2* p_other) { AddImpl(p_other->m_data); } // vtable+0x48
// FUNCTION: LEGO1 0x100021f0
virtual void Sub(float* p_other) { SubImpl(p_other); } // vtable+0x58
virtual void Sub(const float* p_other) { SubImpl((float*) p_other); } // vtable+0x58
// FUNCTION: LEGO1 0x10002200
virtual void Sub(const Vector2* p_other) { SubImpl((float*) p_other->m_data); } // vtable+0x54