Bootstrap LegoPlantManager, add plants data (#1038)

* Bootstrap LegoPlantManager, add plants data

* Naming

* Move

* Fix
This commit is contained in:
Christian Semmler
2024-06-17 14:11:27 -04:00
committed by GitHub
parent e4e0f4e4d3
commit 1a46d370ec
7 changed files with 2048 additions and 18 deletions

View File

@@ -18,7 +18,7 @@ DECOMP_SIZE_ASSERT(LegoBuildingInfo, 0x2c)
DECOMP_SIZE_ASSERT(LegoBuildingManager::AnimEntry, 0x14)
// GLOBAL: LEGO1 0x100f3410
const char* g_buildingInfoHausName[5] = {
const char* g_buildingInfoVariants[5] = {
"haus1",
"haus4",
"haus5",
@@ -238,7 +238,7 @@ LegoBuildingManager::LegoBuildingManager()
// FUNCTION: LEGO1 0x1002f960
LegoBuildingManager::~LegoBuildingManager()
{
delete g_customizeAnimFile;
delete[] g_customizeAnimFile;
}
// FUNCTION: LEGO1 0x1002f9d0
@@ -267,15 +267,15 @@ void LegoBuildingManager::FUN_1002fa00()
}
if (g_buildingManagerConfig <= 1) {
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoHausName[0]);
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[0]);
if (entity) {
entity->GetROI()->SetVisibility(TRUE);
m_unk0x09 = 0;
}
}
else {
for (i = 0; i < sizeOfArray(g_buildingInfoHausName); i++) {
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoHausName[i]);
for (i = 0; i < sizeOfArray(g_buildingInfoVariants); i++) {
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[i]);
if (entity) {
entity->GetROI()->SetVisibility(m_nextVariant == i);
}
@@ -289,7 +289,7 @@ void LegoBuildingManager::FUN_1002fa00()
// FUNCTION: BETA10 0x10063b88
void LegoBuildingManager::UpdatePosition(MxS32 p_index, LegoWorld* p_world)
{
LegoEntity* entity = (LegoEntity*) p_world->Find("MxEntity", g_buildingInfo[p_index].m_hausName);
LegoEntity* entity = (LegoEntity*) p_world->Find("MxEntity", g_buildingInfo[p_index].m_variant);
if (entity) {
entity->SetType(LegoEntity::e_building);
@@ -451,12 +451,12 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity)
if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_unk0x11 == -1) {
LegoROI* roi = p_entity->GetROI();
if (++m_nextVariant >= sizeOfArray(g_buildingInfoHausName)) {
if (++m_nextVariant >= sizeOfArray(g_buildingInfoVariants)) {
m_nextVariant = 0;
}
roi->SetVisibility(FALSE);
info->m_hausName = g_buildingInfoHausName[m_nextVariant];
info->m_variant = g_buildingInfoVariants[m_nextVariant];
UpdatePosition(12, CurrentWorld());
if (info->m_entity != NULL) {

View File

@@ -1,31 +1,43 @@
#include "legoplantmanager.h"
#include "legoentity.h"
#include "legoplants.h"
DECOMP_SIZE_ASSERT(LegoPlantManager, 0x2c)
// GLOBAL: LEGO1 0x100f3188
char* LegoPlantManager::g_customizeAnimFile = NULL;
// GLOBAL: LEGO1 0x10103180
LegoPlantInfo g_plantInfo[81];
// FUNCTION: LEGO1 0x10026220
LegoPlantManager::LegoPlantManager()
{
Init();
}
// STUB: LEGO1 0x100262c0
// FUNCTION: LEGO1 0x100262c0
LegoPlantManager::~LegoPlantManager()
{
// TODO
delete[] g_customizeAnimFile;
}
// STUB: LEGO1 0x10026330
// FUNCTION: LEGO1 0x10026330
// FUNCTION: BETA10 0x100c4f90
void LegoPlantManager::Init()
{
// TODO
for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) {
g_plantInfo[i] = g_plantInfoInit[i];
}
m_unk0x08 = -1;
m_unk0x0c = 0;
m_unk0x24 = 0;
}
// STUB: LEGO1 0x10026360
// FUNCTION: BETA10 0x100c5032
void LegoPlantManager::FUN_10026360(MxS32 p_scriptIndex)
{
// TODO
@@ -38,14 +50,18 @@ void LegoPlantManager::FUN_100263a0(undefined4 p_und)
}
// STUB: LEGO1 0x10026720
void LegoPlantManager::Write(LegoStorage* p_storage)
// FUNCTION: BETA10 0x100c5918
MxResult LegoPlantManager::Write(LegoStorage* p_storage)
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x100267b0
// FUNCTION: BETA10 0x100c5a76
MxResult LegoPlantManager::Read(LegoStorage* p_storage)
{
// TODO
return SUCCESS;
}
@@ -127,7 +143,6 @@ void LegoPlantManager::FUN_10026c50(LegoEntity* p_entity)
MxResult LegoPlantManager::Tickle()
{
// TODO
return 0;
}

File diff suppressed because it is too large Load Diff