diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index a7a821d1..8a8c7902 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -52,11 +52,11 @@ public: MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state); LegoPlantInfo* GetInfoArray(MxS32& p_length); LegoEntity* CreatePlant(MxS32 p_index, LegoWorld* p_world, LegoOmni::World p_worldId); - MxBool FUN_10026c50(LegoEntity* p_entity); + MxBool DecrementCounter(LegoEntity* p_entity); void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length); MxResult FUN_10026410(); - void FUN_10027120(); - void FUN_10027200(); + void ClearCounters(); + void SetInitialCounters(); static void SetCustomizeAnimFile(const char* p_value); @@ -68,10 +68,10 @@ public: private: void RemovePlant(MxS32 p_index, LegoOmni::World p_worldId); - void FUN_10026860(MxS32 p_index); + void AdjustHeight(MxS32 p_index); LegoPlantInfo* GetInfo(LegoEntity* p_entity); - MxBool FUN_10026c80(MxS32 p_index); - void FUN_100271b0(LegoEntity* p_entity, MxS32 p_adjust); + MxBool DecrementCounter(MxS32 p_index); + void AdjustCounter(LegoEntity* p_entity, MxS32 p_adjust); static char* g_customizeAnimFile; static MxS32 g_maxMove[4]; diff --git a/LEGO1/lego/legoomni/include/legoplants.h b/LEGO1/lego/legoomni/include/legoplants.h index 1b26b0e8..9d20d1a9 100644 --- a/LEGO1/lego/legoomni/include/legoplants.h +++ b/LEGO1/lego/legoomni/include/legoplants.h @@ -41,8 +41,8 @@ struct LegoPlantInfo { MxU32 m_move; // 0x10 MxU8 m_mood; // 0x14 MxU8 m_color; // 0x15 - see enum for possible values - MxS8 m_unk0x16; // 0x16 - MxS8 m_initialUnk0x16; // 0x17 - initial value loaded to m_unk0x16 + MxS8 m_counter; // 0x16 + MxS8 m_initialCounter; // 0x17 - initial value loaded to m_counter const char* m_name; // 0x18 undefined4 m_unk0x1c; // 0x1c float m_x; // 0x20 diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index d6af311e..91e6cc29 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -728,7 +728,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } else { for (i = 0; g_unk0x100f0f30[i] != -1; i++) { - if (plantInfo[g_unk0x100f0f30[i]].m_unk0x16) { + if (plantInfo[g_unk0x100f0f30[i]].m_counter) { result = plantInfo[g_unk0x100f0f30[i]].m_entity; break; } @@ -742,7 +742,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } else { for (i = 0; g_unk0x100f0f50[i] != -1; i++) { - if (plantInfo[g_unk0x100f0f50[i]].m_unk0x16) { + if (plantInfo[g_unk0x100f0f50[i]].m_counter) { result = plantInfo[g_unk0x100f0f50[i]].m_entity; break; } @@ -760,7 +760,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } else { for (i = 0; g_unk0x100f0f90[i] != -1; i++) { - if (plantInfo[g_unk0x100f0f90[i]].m_unk0x16) { + if (plantInfo[g_unk0x100f0f90[i]].m_counter) { result = plantInfo[g_unk0x100f0f90[i]].m_entity; break; } @@ -782,7 +782,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } else { for (i = 0; g_unk0x100f0fa8[i] != -1; i++) { - if (plantInfo[g_unk0x100f0fa8[i]].m_unk0x16) { + if (plantInfo[g_unk0x100f0fa8[i]].m_counter) { result = plantInfo[g_unk0x100f0fa8[i]].m_entity; break; } @@ -800,7 +800,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } else { for (i = 0; g_unk0x100f0fb8[i] != -1; i++) { - if (plantInfo[g_unk0x100f0fb8[i]].m_unk0x16) { + if (plantInfo[g_unk0x100f0fb8[i]].m_counter) { result = plantInfo[g_unk0x100f0fb8[i]].m_entity; break; } @@ -814,7 +814,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } else { for (i = 0; g_unk0x100f0fe8[i] != -1; i++) { - if (plantInfo[g_unk0x100f0fe8[i]].m_unk0x16) { + if (plantInfo[g_unk0x100f0fe8[i]].m_counter) { result = plantInfo[g_unk0x100f0fe8[i]].m_entity; break; } @@ -828,7 +828,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } else { for (i = 0; g_unk0x100f1000[i] != -1; i++) { - if (plantInfo[g_unk0x100f1000[i]].m_unk0x16) { + if (plantInfo[g_unk0x100f1000[i]].m_counter) { result = plantInfo[g_unk0x100f1000[i]].m_entity; break; } @@ -842,7 +842,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } else { for (i = 0; g_unk0x100f1018[i] != -1; i++) { - if (plantInfo[g_unk0x100f1018[i]].m_unk0x16) { + if (plantInfo[g_unk0x100f1018[i]].m_counter) { result = plantInfo[g_unk0x100f1018[i]].m_entity; break; } @@ -851,7 +851,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) break; case 8: for (i = 0; g_unk0x100f1030[i] != -1; i++) { - if (plantInfo[g_unk0x100f1030[i]].m_unk0x16) { + if (plantInfo[g_unk0x100f1030[i]].m_counter) { result = plantInfo[g_unk0x100f1030[i]].m_entity; break; } diff --git a/LEGO1/lego/legoomni/src/actors/act3actors.cpp b/LEGO1/lego/legoomni/src/actors/act3actors.cpp index 6ffffb7b..b4836be1 100644 --- a/LEGO1/lego/legoomni/src/actors/act3actors.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3actors.cpp @@ -607,8 +607,8 @@ void Act3Brickster::Animate(float p_time) assert(m_shootAnim && m_pInfo); if (m_unk0x50 < p_time) { - while (m_pInfo->m_unk0x16) { - PlantManager()->FUN_10026c50(m_pInfo->m_entity); + while (m_pInfo->m_counter) { + PlantManager()->DecrementCounter(m_pInfo->m_entity); } assert(SoundManager()->GetCacheSoundManager()); diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 56e6916e..ca587de2 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -31,10 +31,10 @@ const char* g_plantLodNames[4][5] = { }; // GLOBAL: LEGO1 0x100f16b0 -float g_unk0x100f16b0[] = {0.1f, 0.7f, 0.5f, 0.9f}; +float g_heightPerCount[] = {0.1f, 0.7f, 0.5f, 0.9f}; // GLOBAL: LEGO1 0x100f16c0 -MxU8 g_unk0x100f16c0[] = {1, 2, 2, 3}; +MxU8 g_counters[] = {1, 2, 2, 3}; // GLOBAL: LEGO1 0x100f315c MxU32 LegoPlantManager::g_maxSound = 8; @@ -217,7 +217,7 @@ LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, Leg if (p_index < sizeOfArray(g_plantInfo)) { MxU32 world = 1 << (MxU8) p_worldId; - if (g_plantInfo[p_index].m_worlds & world && g_plantInfo[p_index].m_unk0x16 != 0) { + if (g_plantInfo[p_index].m_worlds & world && g_plantInfo[p_index].m_counter != 0) { if (g_plantInfo[p_index].m_entity == NULL) { char name[256]; char lodName[256]; @@ -285,7 +285,7 @@ MxResult LegoPlantManager::Write(LegoStorage* p_storage) if (p_storage->Write(&info->m_color, sizeof(info->m_color)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_initialUnk0x16, sizeof(info->m_initialUnk0x16)) != SUCCESS) { + if (p_storage->Write(&info->m_initialCounter, sizeof(info->m_initialCounter)) != SUCCESS) { goto done; } } @@ -320,12 +320,12 @@ MxResult LegoPlantManager::Read(LegoStorage* p_storage) if (p_storage->Read(&info->m_color, sizeof(MxU8)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_unk0x16, sizeof(MxS8)) != SUCCESS) { + if (p_storage->Read(&info->m_counter, sizeof(MxS8)) != SUCCESS) { goto done; } - info->m_initialUnk0x16 = info->m_unk0x16; - FUN_10026860(i); + info->m_initialCounter = info->m_counter; + AdjustHeight(i); } result = SUCCESS; @@ -336,13 +336,13 @@ done: // FUNCTION: LEGO1 0x10026860 // FUNCTION: BETA10 0x100c5be0 -void LegoPlantManager::FUN_10026860(MxS32 p_index) +void LegoPlantManager::AdjustHeight(MxS32 p_index) { MxU8 variant = g_plantInfo[p_index].m_variant; - if (g_plantInfo[p_index].m_unk0x16 >= 0) { - float value = g_unk0x100f16c0[variant] - g_plantInfo[p_index].m_unk0x16; - g_plantInfo[p_index].m_position[1] = g_plantInfoInit[p_index].m_position[1] - value * g_unk0x100f16b0[variant]; + if (g_plantInfo[p_index].m_counter >= 0) { + float value = g_counters[variant] - g_plantInfo[p_index].m_counter; + g_plantInfo[p_index].m_position[1] = g_plantInfoInit[p_index].m_position[1] - value * g_heightPerCount[variant]; } else { g_plantInfo[p_index].m_position[1] = g_plantInfoInit[p_index].m_position[1]; @@ -410,7 +410,7 @@ MxBool LegoPlantManager::SwitchVariant(LegoEntity* p_entity) { LegoPlantInfo* info = GetInfo(p_entity); - if (info == NULL || info->m_unk0x16 != -1) { + if (info == NULL || info->m_counter != -1) { return FALSE; } @@ -550,7 +550,7 @@ void LegoPlantManager::SetCustomizeAnimFile(const char* p_value) // FUNCTION: LEGO1 0x10026c50 // FUNCTION: BETA10 0x100c6349 -MxBool LegoPlantManager::FUN_10026c50(LegoEntity* p_entity) +MxBool LegoPlantManager::DecrementCounter(LegoEntity* p_entity) { LegoPlantInfo* info = GetInfo(p_entity); @@ -558,12 +558,12 @@ MxBool LegoPlantManager::FUN_10026c50(LegoEntity* p_entity) return FALSE; } - return FUN_10026c80(info - g_plantInfo); + return DecrementCounter(info - g_plantInfo); } // FUNCTION: LEGO1 0x10026c80 // FUNCTION: BETA10 0x100c63eb -MxBool LegoPlantManager::FUN_10026c80(MxS32 p_index) +MxBool LegoPlantManager::DecrementCounter(MxS32 p_index) { if (p_index >= sizeOfArray(g_plantInfo)) { return FALSE; @@ -577,23 +577,23 @@ MxBool LegoPlantManager::FUN_10026c80(MxS32 p_index) MxBool result = TRUE; - if (info->m_unk0x16 < 0) { - info->m_unk0x16 = g_unk0x100f16c0[info->m_variant]; + if (info->m_counter < 0) { + info->m_counter = g_counters[info->m_variant]; } - if (info->m_unk0x16 > 0) { + if (info->m_counter > 0) { LegoROI* roi = info->m_entity->GetROI(); - info->m_unk0x16--; + info->m_counter--; - if (info->m_unk0x16 == 1) { - info->m_unk0x16 = 0; + if (info->m_counter == 1) { + info->m_counter = 0; } - if (info->m_unk0x16 == 0) { + if (info->m_counter == 0) { roi->SetVisibility(FALSE); } else { - FUN_10026860(info - g_plantInfo); + AdjustHeight(info - g_plantInfo); info->m_entity->SetLocation(info->m_position, info->m_direction, info->m_up, FALSE); } } @@ -623,7 +623,7 @@ void LegoPlantManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_length) time += p_length; entry->m_time = time + 1000; - FUN_100271b0(p_entity, -1); + AdjustCounter(p_entity, -1); } // FUNCTION: LEGO1 0x10026e00 @@ -672,11 +672,11 @@ MxResult LegoPlantManager::Tickle() if (entry->m_time < time) { LegoPlantInfo* info = GetInfo(entry->m_entity); - if (info->m_unk0x16 == 0) { + if (info->m_counter == 0) { entry->m_roi->SetVisibility(FALSE); } else { - FUN_10026860(info - g_plantInfo); + AdjustHeight(info - g_plantInfo); info->m_entity->SetLocation(info->m_position, info->m_direction, info->m_up, FALSE); } @@ -699,14 +699,14 @@ MxResult LegoPlantManager::Tickle() } // FUNCTION: LEGO1 0x10027120 -void LegoPlantManager::FUN_10027120() +void LegoPlantManager::ClearCounters() { LegoWorld* world = CurrentWorld(); for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) { - g_plantInfo[i].m_unk0x16 = -1; - g_plantInfo[i].m_initialUnk0x16 = -1; - FUN_10026860(i); + g_plantInfo[i].m_counter = -1; + g_plantInfo[i].m_initialCounter = -1; + AdjustHeight(i); if (g_plantInfo[i].m_entity != NULL) { g_plantInfo[i].m_entity->SetLocation( @@ -720,28 +720,28 @@ void LegoPlantManager::FUN_10027120() } // FUNCTION: LEGO1 0x100271b0 -void LegoPlantManager::FUN_100271b0(LegoEntity* p_entity, MxS32 p_adjust) +void LegoPlantManager::AdjustCounter(LegoEntity* p_entity, MxS32 p_adjust) { LegoPlantInfo* info = GetInfo(p_entity); if (info != NULL) { - if (info->m_unk0x16 < 0) { - info->m_unk0x16 = g_unk0x100f16c0[info->m_variant]; + if (info->m_counter < 0) { + info->m_counter = g_counters[info->m_variant]; } - if (info->m_unk0x16 > 0) { - info->m_unk0x16 += p_adjust; - if (info->m_unk0x16 <= 1 && p_adjust < 0) { - info->m_unk0x16 = 0; + if (info->m_counter > 0) { + info->m_counter += p_adjust; + if (info->m_counter <= 1 && p_adjust < 0) { + info->m_counter = 0; } } } } // FUNCTION: LEGO1 0x10027200 -void LegoPlantManager::FUN_10027200() +void LegoPlantManager::SetInitialCounters() { for (MxU32 i = 0; i < sizeOfArray(g_plantInfo); i++) { - g_plantInfo[i].m_initialUnk0x16 = g_plantInfo[i].m_unk0x16; + g_plantInfo[i].m_initialCounter = g_plantInfo[i].m_counter; } } diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index d697907e..34192c72 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -500,7 +500,7 @@ MxLong LegoEntity::Notify(MxParam& p_param) case e_unk1: break; case e_plant: - PlantManager()->FUN_10026c50(this); + PlantManager()->DecrementCounter(this); break; case e_building: BuildingManager()->FUN_10030000(this); diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index daee3b2d..cc6b08e8 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -664,7 +664,7 @@ MxLong Act3::HandleTransitionEnd() // FUNCTION: LEGO1 0x10073270 void Act3::ReadyWorld() { - PlantManager()->FUN_10027200(); + PlantManager()->SetInitialCounters(); BuildingManager()->FUN_10030800(); AnimationManager()->FUN_1005f6d0(FALSE); VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 125.0f); diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 5cc9138c..9daa9550 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -1385,7 +1385,7 @@ void Infocenter::Reset() break; } - PlantManager()->FUN_10027120(); + PlantManager()->ClearCounters(); BuildingManager()->FUN_10030590(); AnimationManager()->Reset(FALSE); CharacterManager()->ReleaseAllActors();