Clear unknowns in LegoBuildingInfo and LegoBuildingManager (#1566)

* Clear unknowns in `LegoBuildingInfo` and `LegoBuildingManager`

* Name remaining unknown in `LegoBuildingManager`
This commit is contained in:
Fabian Neundorf 2025-06-16 23:08:17 +02:00 committed by GitHub
parent 16ccb0e06e
commit fd3f08f4c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 107 additions and 102 deletions

View File

@ -26,10 +26,10 @@ struct LegoBuildingInfo {
MxU32 m_sound; // 0x08 MxU32 m_sound; // 0x08
MxU32 m_move; // 0x0c MxU32 m_move; // 0x0c
MxU8 m_mood; // 0x10 MxU8 m_mood; // 0x10
MxS8 m_unk0x11; // 0x11 MxS8 m_counter; // 0x11
MxS8 m_initialUnk0x11; // 0x12 - initial value loaded to m_unk0x11 MxS8 m_initialCounter; // 0x12 - initial value loaded to m_counter
MxU8 m_flags; // 0x13 MxU8 m_flags; // 0x13
float m_unk0x14; // 0x14 float m_adjustedY; // 0x14
const char* m_boundaryName; // 0x18 const char* m_boundaryName; // 0x18
float m_x; // 0x1c float m_x; // 0x1c
float m_y; // 0x20 float m_y; // 0x20
@ -46,7 +46,7 @@ public:
LegoEntity* m_entity; // 0x00 LegoEntity* m_entity; // 0x00
LegoROI* m_roi; // 0x04 LegoROI* m_roi; // 0x04
MxLong m_time; // 0x08 MxLong m_time; // 0x08
float m_unk0x0c; // 0x0c float m_y; // 0x0c
MxBool m_muted; // 0x10 MxBool m_muted; // 0x10
}; };
@ -79,16 +79,16 @@ public:
MxBool SwitchMood(LegoEntity* p_entity); MxBool SwitchMood(LegoEntity* p_entity);
MxU32 GetAnimationId(LegoEntity* p_entity); MxU32 GetAnimationId(LegoEntity* p_entity);
MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state); MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state);
MxBool FUN_10030000(LegoEntity* p_entity); MxBool DecrementCounter(LegoEntity* p_entity);
MxBool FUN_10030030(MxS32 p_index); MxBool DecrementCounter(MxS32 p_index);
MxBool FUN_10030110(LegoBuildingInfo* p_data); MxBool DecrementCounter(LegoBuildingInfo* p_data);
void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28); void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_hideAfterAnimation);
void FUN_10030590(); void ClearCounters();
void AdjustHeight(MxS32 p_index); void AdjustHeight(MxS32 p_index);
MxResult FUN_10030630(); MxResult DetermineBoundaries();
LegoBuildingInfo* GetInfoArray(MxS32& p_length); LegoBuildingInfo* GetInfoArray(MxS32& p_length);
void FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust); void AdjustCounter(LegoEntity* p_entity, MxS32 p_adjust);
void FUN_10030800(); void SetInitialCounters();
static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; }
@ -100,13 +100,13 @@ private:
static MxS32 g_maxMove[16]; static MxS32 g_maxMove[16];
static MxU32 g_maxSound; static MxU32 g_maxSound;
MxU8 m_nextVariant; // 0x08 MxU8 m_nextVariant; // 0x08
MxBool m_unk0x09; // 0x09 MxBool m_boundariesDetermined; // 0x09
AnimEntry* m_entries[5]; // 0x0c AnimEntry* m_entries[5]; // 0x0c
MxS8 m_numEntries; // 0x20 MxS8 m_numEntries; // 0x20
LegoCacheSound* m_sound; // 0x24 LegoCacheSound* m_sound; // 0x24
MxBool m_unk0x28; // 0x28 MxBool m_hideAfterAnimation; // 0x28
LegoWorld* m_world; // 0x2c LegoWorld* m_world; // 0x2c
}; };
#endif // LEGOBUILDINGMANAGER_H #endif // LEGOBUILDINGMANAGER_H

View File

@ -718,11 +718,11 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
switch (m_unk0x1d) { switch (m_unk0x1d) {
case 0: case 0:
if (buildingInfo[12].m_unk0x11) { if (buildingInfo[12].m_counter) {
result = buildingInfo[12].m_entity; result = buildingInfo[12].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[14].m_unk0x11) { else if (buildingInfo[14].m_counter) {
result = buildingInfo[14].m_entity; result = buildingInfo[14].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
@ -736,7 +736,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
} }
break; break;
case 1: case 1:
if (buildingInfo[13].m_unk0x11) { if (buildingInfo[13].m_counter) {
result = buildingInfo[13].m_entity; result = buildingInfo[13].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
@ -750,11 +750,11 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
} }
break; break;
case 2: case 2:
if (buildingInfo[9].m_unk0x11) { if (buildingInfo[9].m_counter) {
result = buildingInfo[9].m_entity; result = buildingInfo[9].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[11].m_unk0x11) { else if (buildingInfo[11].m_counter) {
result = buildingInfo[11].m_entity; result = buildingInfo[11].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
@ -768,15 +768,15 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
} }
break; break;
case 3: case 3:
if (buildingInfo[7].m_unk0x11) { if (buildingInfo[7].m_counter) {
result = buildingInfo[7].m_entity; result = buildingInfo[7].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[8].m_unk0x11) { else if (buildingInfo[8].m_counter) {
result = buildingInfo[8].m_entity; result = buildingInfo[8].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[3].m_unk0x11) { else if (buildingInfo[3].m_counter) {
result = buildingInfo[3].m_entity; result = buildingInfo[3].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
@ -790,11 +790,11 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
} }
break; break;
case 4: case 4:
if (buildingInfo[5].m_unk0x11) { if (buildingInfo[5].m_counter) {
result = buildingInfo[5].m_entity; result = buildingInfo[5].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[10].m_unk0x11) { else if (buildingInfo[10].m_counter) {
result = buildingInfo[10].m_entity; result = buildingInfo[10].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
@ -808,7 +808,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
} }
break; break;
case 5: case 5:
if (buildingInfo[4].m_unk0x11) { if (buildingInfo[4].m_counter) {
result = buildingInfo[4].m_entity; result = buildingInfo[4].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
@ -822,7 +822,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
} }
break; break;
case 6: case 6:
if (buildingInfo[2].m_unk0x11) { if (buildingInfo[2].m_counter) {
result = buildingInfo[2].m_entity; result = buildingInfo[2].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
@ -836,7 +836,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
} }
break; break;
case 7: case 7:
if (buildingInfo[6].m_unk0x11) { if (buildingInfo[6].m_counter) {
result = buildingInfo[6].m_entity; result = buildingInfo[6].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }
@ -861,7 +861,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
return result; return result;
} }
if (buildingInfo[15].m_unk0x11) { if (buildingInfo[15].m_counter) {
result = buildingInfo[15].m_entity; result = buildingInfo[15].m_entity;
*p_param = TRUE; *p_param = TRUE;
} }

View File

@ -653,8 +653,8 @@ void Act3Brickster::Animate(float p_time)
assert(SoundManager()->GetCacheSoundManager()); assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play("thpt", NULL, FALSE); SoundManager()->GetCacheSoundManager()->Play("thpt", NULL, FALSE);
while (m_bInfo->m_unk0x11 > 0 || m_bInfo->m_unk0x11 == -1) { while (m_bInfo->m_counter > 0 || m_bInfo->m_counter == -1) {
if (!BuildingManager()->FUN_10030110(m_bInfo)) { if (!BuildingManager()->DecrementCounter(m_bInfo)) {
break; break;
} }
} }
@ -865,7 +865,7 @@ MxResult Act3Brickster::FUN_100417c0()
float local124; float local124;
for (MxS32 i = 0; i < length; i++) { for (MxS32 i = 0; i < length; i++) {
if (bInfo[i].m_unk0x11 < 0 && bInfo[i].m_boundary != NULL && bInfo[i].m_entity != NULL && i != 0 && if (bInfo[i].m_counter < 0 && bInfo[i].m_boundary != NULL && bInfo[i].m_entity != NULL && i != 0 &&
(local120 == -1 || i != 15)) { (local120 == -1 || i != 15)) {
Mx3DPointFloat local188(bInfo[i].m_x, bInfo[i].m_y, bInfo[i].m_z); Mx3DPointFloat local188(bInfo[i].m_x, bInfo[i].m_y, bInfo[i].m_z);

View File

@ -253,10 +253,10 @@ void LegoBuildingManager::Init()
} }
m_nextVariant = 0; m_nextVariant = 0;
m_unk0x09 = FALSE; m_boundariesDetermined = FALSE;
m_numEntries = 0; m_numEntries = 0;
m_sound = NULL; m_sound = NULL;
m_unk0x28 = FALSE; m_hideAfterAnimation = FALSE;
} }
// FUNCTION: LEGO1 0x1002fa00 // FUNCTION: LEGO1 0x1002fa00
@ -274,7 +274,7 @@ void LegoBuildingManager::LoadWorldInfo()
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[0]); LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[0]);
if (entity) { if (entity) {
entity->GetROI()->SetVisibility(TRUE); entity->GetROI()->SetVisibility(TRUE);
m_unk0x09 = FALSE; m_boundariesDetermined = FALSE;
} }
} }
else { else {
@ -286,7 +286,7 @@ void LegoBuildingManager::LoadWorldInfo()
} }
} }
m_unk0x09 = FALSE; m_boundariesDetermined = FALSE;
} }
// FUNCTION: LEGO1 0x1002fa90 // FUNCTION: LEGO1 0x1002fa90
@ -301,7 +301,7 @@ void LegoBuildingManager::CreateBuilding(MxS32 p_index, LegoWorld* p_world)
LegoROI* roi = entity->GetROI(); LegoROI* roi = entity->GetROI();
AdjustHeight(p_index); AdjustHeight(p_index);
MxMatrix mat = roi->GetLocal2World(); MxMatrix mat = roi->GetLocal2World();
mat[3][1] = g_buildingInfo[p_index].m_unk0x14; mat[3][1] = g_buildingInfo[p_index].m_adjustedY;
roi->UpdateTransformationRelativeToParent(mat); roi->UpdateTransformationRelativeToParent(mat);
VideoManager()->Get3DManager()->Moved(*roi); VideoManager()->Get3DManager()->Moved(*roi);
} }
@ -316,7 +316,7 @@ void LegoBuildingManager::Reset()
g_buildingInfo[i].m_entity = NULL; g_buildingInfo[i].m_entity = NULL;
} }
m_unk0x09 = FALSE; m_boundariesDetermined = FALSE;
for (i = 0; i < m_numEntries; i++) { for (i = 0; i < m_numEntries; i++) {
delete m_entries[i]; delete m_entries[i];
@ -343,7 +343,7 @@ MxResult LegoBuildingManager::Write(LegoStorage* p_storage)
if (p_storage->Write(&info->m_mood, sizeof(MxU8)) != SUCCESS) { if (p_storage->Write(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
goto done; goto done;
} }
if (p_storage->Write(&info->m_initialUnk0x11, sizeof(MxS8)) != SUCCESS) { if (p_storage->Write(&info->m_initialCounter, sizeof(MxS8)) != SUCCESS) {
goto done; goto done;
} }
} }
@ -376,11 +376,11 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage)
if (p_storage->Read(&info->m_mood, sizeof(MxU8)) != SUCCESS) { if (p_storage->Read(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
goto done; goto done;
} }
if (p_storage->Read(&info->m_unk0x11, sizeof(MxS8)) != SUCCESS) { if (p_storage->Read(&info->m_counter, sizeof(MxS8)) != SUCCESS) {
goto done; goto done;
} }
info->m_initialUnk0x11 = info->m_unk0x11; info->m_initialCounter = info->m_counter;
AdjustHeight(i); AdjustHeight(i);
} }
@ -402,15 +402,15 @@ done:
// FUNCTION: BETA10 0x10063f1a // FUNCTION: BETA10 0x10063f1a
void LegoBuildingManager::AdjustHeight(MxS32 p_index) void LegoBuildingManager::AdjustHeight(MxS32 p_index)
{ {
if (g_buildingInfo[p_index].m_unk0x11 > 0) { if (g_buildingInfo[p_index].m_counter > 0) {
float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_counter;
g_buildingInfo[p_index].m_unk0x14 = g_buildingInfo[p_index].m_adjustedY =
g_buildingInfoInit[p_index].m_unk0x14 - value * g_buildingInfoDownshiftScale[p_index]; g_buildingInfoInit[p_index].m_adjustedY - value * g_buildingInfoDownshiftScale[p_index];
} }
else if (g_buildingInfo[p_index].m_unk0x11 == 0) { else if (g_buildingInfo[p_index].m_counter == 0) {
float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_counter;
g_buildingInfo[p_index].m_unk0x14 = g_buildingInfo[p_index].m_adjustedY =
g_buildingInfoInit[p_index].m_unk0x14 - value * g_buildingInfoDownshiftScale[p_index]; g_buildingInfoInit[p_index].m_adjustedY - value * g_buildingInfoDownshiftScale[p_index];
if (g_buildingInfo[p_index].m_entity != NULL) { if (g_buildingInfo[p_index].m_entity != NULL) {
LegoROI* roi = g_buildingInfo[p_index].m_entity->GetROI(); LegoROI* roi = g_buildingInfo[p_index].m_entity->GetROI();
@ -420,7 +420,7 @@ void LegoBuildingManager::AdjustHeight(MxS32 p_index)
} }
} }
else { else {
g_buildingInfo[p_index].m_unk0x14 = g_buildingInfoInit[p_index].m_unk0x14; g_buildingInfo[p_index].m_adjustedY = g_buildingInfoInit[p_index].m_adjustedY;
} }
} }
@ -453,7 +453,7 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity)
LegoBuildingInfo* info = GetInfo(p_entity); LegoBuildingInfo* info = GetInfo(p_entity);
if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_unk0x11 == -1) { if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_counter == -1) {
LegoROI* roi = p_entity->GetROI(); LegoROI* roi = p_entity->GetROI();
if (++m_nextVariant >= sizeOfArray(g_buildingInfoVariants)) { if (++m_nextVariant >= sizeOfArray(g_buildingInfoVariants)) {
m_nextVariant = 0; m_nextVariant = 0;
@ -587,7 +587,7 @@ void LegoBuildingManager::SetCustomizeAnimFile(const char* p_value)
} }
// FUNCTION: LEGO1 0x10030000 // FUNCTION: LEGO1 0x10030000
MxBool LegoBuildingManager::FUN_10030000(LegoEntity* p_entity) MxBool LegoBuildingManager::DecrementCounter(LegoEntity* p_entity)
{ {
LegoBuildingInfo* info = GetInfo(p_entity); LegoBuildingInfo* info = GetInfo(p_entity);
@ -595,7 +595,7 @@ MxBool LegoBuildingManager::FUN_10030000(LegoEntity* p_entity)
return FALSE; return FALSE;
} }
return FUN_10030030(info - g_buildingInfo); return DecrementCounter(info - g_buildingInfo);
} }
inline LegoBuildingInfo* GetBuildingInfo(MxS32 p_index) inline LegoBuildingInfo* GetBuildingInfo(MxS32 p_index)
@ -608,7 +608,7 @@ inline LegoBuildingInfo* GetBuildingInfo(MxS32 p_index)
} }
// FUNCTION: LEGO1 0x10030030 // FUNCTION: LEGO1 0x10030030
MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index) MxBool LegoBuildingManager::DecrementCounter(MxS32 p_index)
{ {
if (p_index >= sizeOfArray(g_buildingInfo)) { if (p_index >= sizeOfArray(g_buildingInfo)) {
return FALSE; return FALSE;
@ -621,25 +621,25 @@ MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index)
MxBool result = TRUE; MxBool result = TRUE;
if (info->m_unk0x11 < 0) { if (info->m_counter < 0) {
info->m_unk0x11 = g_buildingInfoDownshift[p_index]; info->m_counter = g_buildingInfoDownshift[p_index];
} }
if (info->m_unk0x11 <= 0) { if (info->m_counter <= 0) {
result = FALSE; result = FALSE;
} }
else { else {
LegoROI* roi = info->m_entity->GetROI(); LegoROI* roi = info->m_entity->GetROI();
info->m_unk0x11 -= 2; info->m_counter -= 2;
if (info->m_unk0x11 == 1) { if (info->m_counter == 1) {
info->m_unk0x11 = 0; info->m_counter = 0;
roi->SetVisibility(FALSE); roi->SetVisibility(FALSE);
} }
else { else {
AdjustHeight(p_index); AdjustHeight(p_index);
MxMatrix mat = roi->GetLocal2World(); MxMatrix mat = roi->GetLocal2World();
mat[3][1] = g_buildingInfo[p_index].m_unk0x14; mat[3][1] = g_buildingInfo[p_index].m_adjustedY;
roi->UpdateTransformationRelativeToParent(mat); roi->UpdateTransformationRelativeToParent(mat);
VideoManager()->Get3DManager()->Moved(*roi); VideoManager()->Get3DManager()->Moved(*roi);
} }
@ -649,11 +649,11 @@ MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index)
} }
// FUNCTION: LEGO1 0x10030110 // FUNCTION: LEGO1 0x10030110
MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data) MxBool LegoBuildingManager::DecrementCounter(LegoBuildingInfo* p_data)
{ {
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
if (&g_buildingInfo[i] == p_data) { if (&g_buildingInfo[i] == p_data) {
return FUN_10030030(i); return DecrementCounter(i);
} }
} }
@ -661,7 +661,12 @@ MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data)
} }
// FUNCTION: LEGO1 0x10030150 // FUNCTION: LEGO1 0x10030150
void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28) void LegoBuildingManager::ScheduleAnimation(
LegoEntity* p_entity,
MxLong p_length,
MxBool p_haveSound,
MxBool p_hideAfterAnimation
)
{ {
m_world = CurrentWorld(); m_world = CurrentWorld();
@ -671,7 +676,7 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_lengt
} }
if (m_numEntries == 0) { if (m_numEntries == 0) {
m_unk0x28 = p_unk0x28; m_hideAfterAnimation = p_hideAfterAnimation;
TickleManager()->RegisterClient(this, 50); TickleManager()->RegisterClient(this, 50);
} }
@ -685,9 +690,9 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_lengt
time += p_length; time += p_length;
entry->m_time = time + 1000; entry->m_time = time + 1000;
entry->m_unk0x0c = entry->m_roi->GetWorldPosition()[1]; entry->m_y = entry->m_roi->GetWorldPosition()[1];
entry->m_muted = p_haveSound == FALSE; entry->m_muted = p_haveSound == FALSE;
FUN_100307b0(p_entity, -2); AdjustCounter(p_entity, -2);
} }
// FUNCTION: LEGO1 0x10030220 // FUNCTION: LEGO1 0x10030220
@ -724,33 +729,33 @@ MxResult LegoBuildingManager::Tickle()
MxMatrix local48; MxMatrix local48;
MxMatrix locald8; MxMatrix locald8;
MxMatrix local120(entry->m_roi->GetLocal2World()); MxMatrix transformationMatrix(entry->m_roi->GetLocal2World());
Mx3DPointFloat local134(local120[3]); Mx3DPointFloat position(transformationMatrix[3]);
ZEROVEC3(local120[3]); ZEROVEC3(transformationMatrix[3]);
locald8.SetIdentity(); locald8.SetIdentity();
local48 = local120; local48 = transformationMatrix;
local134[1] = sin(((entry->m_time - time) * 10) * 0.0062831999f) * 0.4 + (entry->m_unk0x0c -= 0.05); position[1] = sin(((entry->m_time - time) * 10) * 0.0062831999f) * 0.4 + (entry->m_y -= 0.05);
SET3(local120[3], local134); SET3(transformationMatrix[3], position);
entry->m_roi->UpdateTransformationRelativeToParent(local120); entry->m_roi->UpdateTransformationRelativeToParent(transformationMatrix);
VideoManager()->Get3DManager()->Moved(*entry->m_roi); VideoManager()->Get3DManager()->Moved(*entry->m_roi);
if (entry->m_time < time) { if (entry->m_time < time) {
LegoBuildingInfo* info = GetInfo(entry->m_entity); LegoBuildingInfo* info = GetInfo(entry->m_entity);
if (info->m_unk0x11 && !m_unk0x28) { if (info->m_counter && !m_hideAfterAnimation) {
MxS32 index = info - g_buildingInfo; MxS32 index = info - g_buildingInfo;
AdjustHeight(index); AdjustHeight(index);
MxMatrix mat = entry->m_roi->GetLocal2World(); MxMatrix mat = entry->m_roi->GetLocal2World();
mat[3][1] = g_buildingInfo[index].m_unk0x14; mat[3][1] = g_buildingInfo[index].m_adjustedY;
entry->m_roi->UpdateTransformationRelativeToParent(mat); entry->m_roi->UpdateTransformationRelativeToParent(mat);
VideoManager()->Get3DManager()->Moved(*entry->m_roi); VideoManager()->Get3DManager()->Moved(*entry->m_roi);
} }
else { else {
info->m_unk0x11 = 0; info->m_counter = 0;
entry->m_roi->SetVisibility(FALSE); entry->m_roi->SetVisibility(FALSE);
} }
@ -774,17 +779,17 @@ MxResult LegoBuildingManager::Tickle()
// FUNCTION: LEGO1 0x10030590 // FUNCTION: LEGO1 0x10030590
// FUNCTION: BETA10 0x1006474c // FUNCTION: BETA10 0x1006474c
void LegoBuildingManager::FUN_10030590() void LegoBuildingManager::ClearCounters()
{ {
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
g_buildingInfo[i].m_unk0x11 = -1; g_buildingInfo[i].m_counter = -1;
g_buildingInfo[i].m_initialUnk0x11 = -1; g_buildingInfo[i].m_initialCounter = -1;
AdjustHeight(i); AdjustHeight(i);
if (g_buildingInfo[i].m_entity != NULL) { if (g_buildingInfo[i].m_entity != NULL) {
LegoROI* roi = g_buildingInfo[i].m_entity->GetROI(); LegoROI* roi = g_buildingInfo[i].m_entity->GetROI();
MxMatrix mat = roi->GetLocal2World(); MxMatrix mat = roi->GetLocal2World();
mat[3][1] = g_buildingInfo[i].m_unk0x14; mat[3][1] = g_buildingInfo[i].m_adjustedY;
roi->UpdateTransformationRelativeToParent(mat); roi->UpdateTransformationRelativeToParent(mat);
VideoManager()->Get3DManager()->Moved(*roi); VideoManager()->Get3DManager()->Moved(*roi);
} }
@ -793,7 +798,7 @@ void LegoBuildingManager::FUN_10030590()
// FUNCTION: LEGO1 0x10030630 // FUNCTION: LEGO1 0x10030630
// FUNCTION: BETA10 0x100648ab // FUNCTION: BETA10 0x100648ab
MxResult LegoBuildingManager::FUN_10030630() MxResult LegoBuildingManager::DetermineBoundaries()
{ {
LegoWorld* world = CurrentWorld(); LegoWorld* world = CurrentWorld();
@ -859,7 +864,7 @@ MxResult LegoBuildingManager::FUN_10030630()
} }
} }
m_unk0x09 = TRUE; m_boundariesDetermined = TRUE;
return SUCCESS; return SUCCESS;
} }
@ -867,8 +872,8 @@ MxResult LegoBuildingManager::FUN_10030630()
// FUNCTION: BETA10 0x10064db9 // FUNCTION: BETA10 0x10064db9
LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length) LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length)
{ {
if (!m_unk0x09) { if (!m_boundariesDetermined) {
FUN_10030630(); DetermineBoundaries();
} }
p_length = sizeOfArray(g_buildingInfo); p_length = sizeOfArray(g_buildingInfo);
@ -876,28 +881,28 @@ LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length)
} }
// FUNCTION: LEGO1 0x100307b0 // FUNCTION: LEGO1 0x100307b0
void LegoBuildingManager::FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust) void LegoBuildingManager::AdjustCounter(LegoEntity* p_entity, MxS32 p_adjust)
{ {
LegoBuildingInfo* info = GetInfo(p_entity); LegoBuildingInfo* info = GetInfo(p_entity);
if (info != NULL) { if (info != NULL) {
if (info->m_unk0x11 < 0) { if (info->m_counter < 0) {
info->m_unk0x11 = g_buildingInfoDownshift[info - g_buildingInfo]; info->m_counter = g_buildingInfoDownshift[info - g_buildingInfo];
} }
if (info->m_unk0x11 > 0) { if (info->m_counter > 0) {
info->m_unk0x11 += p_adjust; info->m_counter += p_adjust;
if (info->m_unk0x11 <= 1 && p_adjust < 0) { if (info->m_counter <= 1 && p_adjust < 0) {
info->m_unk0x11 = 0; info->m_counter = 0;
} }
} }
} }
} }
// FUNCTION: LEGO1 0x10030800 // FUNCTION: LEGO1 0x10030800
void LegoBuildingManager::FUN_10030800() void LegoBuildingManager::SetInitialCounters()
{ {
for (MxU32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { for (MxU32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
g_buildingInfo[i].m_initialUnk0x11 = g_buildingInfo[i].m_unk0x11; g_buildingInfo[i].m_initialCounter = g_buildingInfo[i].m_counter;
} }
} }

View File

@ -503,7 +503,7 @@ MxLong LegoEntity::Notify(MxParam& p_param)
PlantManager()->DecrementCounter(this); PlantManager()->DecrementCounter(this);
break; break;
case e_building: case e_building:
BuildingManager()->FUN_10030000(this); BuildingManager()->DecrementCounter(this);
break; break;
case e_autoROI: case e_autoROI:
break; break;

View File

@ -588,7 +588,7 @@ MxLong Act3::Notify(MxParam& p_param)
m_unk0x421e = 0; m_unk0x421e = 0;
while (--length >= 0) { while (--length >= 0) {
if (info[length].m_unk0x11 < 0 && info[length].m_boundary != NULL && if (info[length].m_counter < 0 && info[length].m_boundary != NULL &&
info[length].m_entity != NULL) { info[length].m_entity != NULL) {
m_unk0x421e++; m_unk0x421e++;
} }
@ -665,7 +665,7 @@ MxLong Act3::HandleTransitionEnd()
void Act3::ReadyWorld() void Act3::ReadyWorld()
{ {
PlantManager()->SetInitialCounters(); PlantManager()->SetInitialCounters();
BuildingManager()->FUN_10030800(); BuildingManager()->SetInitialCounters();
AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->FUN_1005f6d0(FALSE);
VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 125.0f); VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 125.0f);

View File

@ -1386,7 +1386,7 @@ void Infocenter::Reset()
} }
PlantManager()->ClearCounters(); PlantManager()->ClearCounters();
BuildingManager()->FUN_10030590(); BuildingManager()->ClearCounters();
AnimationManager()->Reset(FALSE); AnimationManager()->Reset(FALSE);
CharacterManager()->ReleaseAllActors(); CharacterManager()->ReleaseAllActors();
GameState()->SetCurrentAct(LegoGameState::e_act1); GameState()->SetCurrentAct(LegoGameState::e_act1);