Clear unknowns in LegoCarBuildAnimPresenter (#1683)

This commit is contained in:
Fabian Neundorf
2025-09-08 00:07:39 +02:00
committed by GitHub
parent e3b77fb50b
commit ef2d438a7d
3 changed files with 40 additions and 40 deletions

View File

@@ -21,10 +21,10 @@ public:
}; };
// SIZE 0x0c // SIZE 0x0c
struct UnknownListEntry { struct CarBuildPart {
// FUNCTION: LEGO1 0x100795c0 // FUNCTION: LEGO1 0x100795c0
// FUNCTION: BETA10 0x10073850 // FUNCTION: BETA10 0x10073850
UnknownListEntry() CarBuildPart()
{ {
m_name = NULL; m_name = NULL;
m_wiredName = NULL; m_wiredName = NULL;
@@ -74,7 +74,7 @@ public:
virtual MxResult Serialize(LegoStorage* p_storage); virtual MxResult Serialize(LegoStorage* p_storage);
void FUN_10079050(MxS16 p_index); void MakePartPlaced(MxS16 p_index);
void SwapNodesByName(LegoChar* p_param1, LegoChar* p_param2); void SwapNodesByName(LegoChar* p_param1, LegoChar* p_param2);
void InitBuildPlatform(); void InitBuildPlatform();
void HideBuildPartByName(LegoChar* p_param); void HideBuildPartByName(LegoChar* p_param);
@@ -83,7 +83,7 @@ public:
LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name); LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name);
void AddPartToBuildByName(const LegoChar* p_name); void AddPartToBuildByName(const LegoChar* p_name);
void RotateAroundYAxis(MxFloat p_angle); void RotateAroundYAxis(MxFloat p_angle);
MxBool FUN_10079c30(const LegoChar* p_name); MxBool IsNextPartToPlace(const LegoChar* p_name);
MxBool PartIsPlaced(const LegoChar* p_name); MxBool PartIsPlaced(const LegoChar* p_name);
void MoveShelfForward(); void MoveShelfForward();
MxBool StringEqualsPlatform(const LegoChar* p_string); MxBool StringEqualsPlatform(const LegoChar* p_string);
@@ -102,7 +102,7 @@ public:
MxBool StringEndsOnW(LegoChar* p_param); MxBool StringEndsOnW(LegoChar* p_param);
MxBool StringEndsOnYOrN(const LegoChar* p_string); MxBool StringEndsOnYOrN(const LegoChar* p_string);
const BoundingSphere& FUN_10079e20(); const BoundingSphere& GetTargetBoundingSphere();
// FUNCTION: BETA10 0x100703e0 // FUNCTION: BETA10 0x100703e0
const LegoChar* GetWiredNameOfLastPlacedPart() { return m_parts[m_placedPartCount].m_wiredName; } const LegoChar* GetWiredNameOfLastPlacedPart() { return m_parts[m_placedPartCount].m_wiredName; }
@@ -121,7 +121,7 @@ public:
// LegoCarBuildAnimPresenter::`scalar deleting destructor' // LegoCarBuildAnimPresenter::`scalar deleting destructor'
private: private:
void Beta10Inline0x100733d0(); void UpdateFlashingPartVisibility();
MxU16 m_shelfState; // 0xbc MxU16 m_shelfState; // 0xbc
@@ -136,16 +136,16 @@ private:
MxMatrix m_buildViewMatrix; // 0xe0 MxMatrix m_buildViewMatrix; // 0xe0
// variable name verified by BETA10 0x100719f0 // variable name verified by BETA10 0x100719f0
UnknownListEntry* m_parts; // 0x128 CarBuildPart* m_parts; // 0x128
MxFloat m_shelfFrameBuffer; // 0x12c MxFloat m_shelfFrameBuffer; // 0x12c
MxFloat m_shelfFrame; // 0x130 MxFloat m_shelfFrame; // 0x130
MxFloat m_shelfFrameMax; // 0x134 MxFloat m_shelfFrameMax; // 0x134
MxFloat m_shelfFrameInterval; // 0x138 MxFloat m_shelfFrameInterval; // 0x138
MxULong m_unk0x13c; // 0x13c MxULong m_flashingPartTimeState; // 0x13c
LegoEntity* m_carBuildEntity; // 0x140 LegoEntity* m_carBuildEntity; // 0x140
MxS32 m_unk0x144; // 0x144 MxS32 m_unk0x144; // 0x144
MxS32 m_unk0x148; // 0x148 MxS32 m_unk0x148; // 0x148
// name verified by BETA10 0x10070d63 // name verified by BETA10 0x10070d63
LegoChar* m_mainSourceId; // 0x14c LegoChar* m_mainSourceId; // 0x14c

View File

@@ -855,8 +855,8 @@ undefined4 LegoCarBuild::SelectPartFromMousePosition(MxLong p_x, MxLong p_y)
} }
} }
else { else {
if (m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) { if (m_animPresenter->IsNextPartToPlace(m_selectedPart->GetName())) {
m_unk0x114 = m_animPresenter->FUN_10079e20(); m_unk0x114 = m_animPresenter->GetTargetBoundingSphere();
} }
} }
@@ -902,7 +902,7 @@ undefined4 LegoCarBuild::FUN_100246e0(MxLong p_x, MxLong p_y)
m_PlaceBrick_Sound->Enable(TRUE); m_PlaceBrick_Sound->Enable(TRUE);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped);
} }
else if (m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) { else if (m_animPresenter->IsNextPartToPlace(m_selectedPart->GetName())) {
if (SpheresIntersect(m_unk0x114, m_selectedPart->GetWorldBoundingSphere())) { if (SpheresIntersect(m_unk0x114, m_selectedPart->GetWorldBoundingSphere())) {
m_PlaceBrick_Sound->Enable(FALSE); m_PlaceBrick_Sound->Enable(FALSE);
m_PlaceBrick_Sound->Enable(TRUE); m_PlaceBrick_Sound->Enable(TRUE);
@@ -1418,7 +1418,7 @@ void LegoCarBuild::FUN_10025450()
else { else {
const LegoChar* wiredName; const LegoChar* wiredName;
if (!m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) { if (!m_animPresenter->IsNextPartToPlace(m_selectedPart->GetName())) {
wiredName = m_animPresenter->GetWiredNameByPartName(m_selectedPart->GetName()); wiredName = m_animPresenter->GetWiredNameByPartName(m_selectedPart->GetName());
} }
else { else {

View File

@@ -16,7 +16,7 @@
#include "mxtimer.h" #include "mxtimer.h"
#include "realtime/realtime.h" #include "realtime/realtime.h"
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::UnknownListEntry, 0x0c) DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::CarBuildPart, 0x0c)
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150) DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150)
// FUNCTION: LEGO1 0x10078400 // FUNCTION: LEGO1 0x10078400
@@ -32,7 +32,7 @@ LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter()
m_shelfFrameBuffer = 0; m_shelfFrameBuffer = 0;
m_shelfFrameMax = 0; m_shelfFrameMax = 0;
m_shelfFrameInterval = 0; m_shelfFrameInterval = 0;
m_unk0x13c = 0; m_flashingPartTimeState = 0;
m_carBuildEntity = NULL; m_carBuildEntity = NULL;
m_unk0x144 = -1; m_unk0x144 = -1;
m_unk0x148 = -1; m_unk0x148 = -1;
@@ -60,28 +60,28 @@ LegoCarBuildAnimPresenter::~LegoCarBuildAnimPresenter()
} }
// FUNCTION: BETA10 0x100733d0 // FUNCTION: BETA10 0x100733d0
inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0() inline void LegoCarBuildAnimPresenter::UpdateFlashingPartVisibility()
{ {
MxLong time = Timer()->GetTime(); MxLong time = Timer()->GetTime();
MxLong bvar5; MxLong showFlashingPart;
if (m_unk0x13c < time) { if (m_flashingPartTimeState < time) {
bvar5 = FALSE; showFlashingPart = FALSE;
// I have no idea why this conditional is so convoluted // I have no idea why this conditional is so convoluted
if (m_unk0x13c & c_bit1) { if (m_flashingPartTimeState & c_bit1) {
bvar5 = TRUE; showFlashingPart = TRUE;
m_unk0x13c = time + 400; m_flashingPartTimeState = time + 400;
} }
else { else {
m_unk0x13c = time + 200; m_flashingPartTimeState = time + 200;
} }
if (bvar5) { if (showFlashingPart) {
m_unk0x13c &= ~c_bit1; m_flashingPartTimeState &= ~c_bit1;
} }
else { else {
m_unk0x13c |= c_bit1; m_flashingPartTimeState |= c_bit1;
} }
if (m_placedPartCount < m_numberOfParts) { if (m_placedPartCount < m_numberOfParts) {
@@ -96,7 +96,7 @@ inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0()
const LegoChar* name = roi->GetName(); const LegoChar* name = roi->GetName();
if (name && stricmp(wiredName, name) == 0) { if (name && stricmp(wiredName, name) == 0) {
if (bvar5) { if (showFlashingPart) {
roi->SetVisibility(TRUE); roi->SetVisibility(TRUE);
} }
else { else {
@@ -127,7 +127,7 @@ void LegoCarBuildAnimPresenter::PutFrame()
break; break;
} }
Beta10Inline0x100733d0(); UpdateFlashingPartVisibility();
} }
// FUNCTION: LEGO1 0x100788c0 // FUNCTION: LEGO1 0x100788c0
@@ -209,7 +209,7 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
} }
if (i < m_placedPartCount) { if (i < m_placedPartCount) {
FUN_10079050(i); MakePartPlaced(i);
ShowBuildPartByName(m_parts[i].m_name); ShowBuildPartByName(m_parts[i].m_name);
} }
@@ -316,7 +316,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage)
// FUNCTION: LEGO1 0x10079050 // FUNCTION: LEGO1 0x10079050
// FUNCTION: BETA10 0x1007151e // FUNCTION: BETA10 0x1007151e
void LegoCarBuildAnimPresenter::FUN_10079050(MxS16 p_index) void LegoCarBuildAnimPresenter::MakePartPlaced(MxS16 p_index)
{ {
SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name); SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name);
HideBuildPartByName(m_parts[p_index].m_wiredName); HideBuildPartByName(m_parts[p_index].m_wiredName);
@@ -382,7 +382,7 @@ void LegoCarBuildAnimPresenter::InitBuildPlatform()
} }
assert(m_numberOfParts); assert(m_numberOfParts);
m_parts = new UnknownListEntry[m_numberOfParts]; m_parts = new CarBuildPart[m_numberOfParts];
assert(m_parts); assert(m_parts);
// Go through and add the wired name of each part // Go through and add the wired name of each part
@@ -551,7 +551,7 @@ void LegoCarBuildAnimPresenter::AddPartToBuildByName(const LegoChar* p_name)
strcpy(m_parts[i].m_name, buffer); strcpy(m_parts[i].m_name, buffer);
Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId); Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId);
} }
FUN_10079050(m_placedPartCount); MakePartPlaced(m_placedPartCount);
m_placedPartCount++; m_placedPartCount++;
((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount); ((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount);
@@ -644,7 +644,7 @@ MxBool LegoCarBuildAnimPresenter::StringEqualsShelf(const LegoChar* p_string)
// FUNCTION: LEGO1 0x10079c30 // FUNCTION: LEGO1 0x10079c30
// FUNCTION: BETA10 0x100726a6 // FUNCTION: BETA10 0x100726a6
MxBool LegoCarBuildAnimPresenter::FUN_10079c30(const LegoChar* p_name) MxBool LegoCarBuildAnimPresenter::IsNextPartToPlace(const LegoChar* p_name)
{ {
if (PartIsPlaced(p_name)) { if (PartIsPlaced(p_name)) {
return FALSE; return FALSE;
@@ -708,7 +708,7 @@ void LegoCarBuildAnimPresenter::SetPartObjectIdByName(const LegoChar* p_name, Mx
// FUNCTION: LEGO1 0x10079e20 // FUNCTION: LEGO1 0x10079e20
// FUNCTION: BETA10 0x10072959 // FUNCTION: BETA10 0x10072959
const BoundingSphere& LegoCarBuildAnimPresenter::FUN_10079e20() const BoundingSphere& LegoCarBuildAnimPresenter::GetTargetBoundingSphere()
{ {
LegoROI* roi = m_carBuildEntity->GetROI(); LegoROI* roi = m_carBuildEntity->GetROI();
return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere(); return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere();