2023-06-29 04:10:08 -04:00
|
|
|
#include "legoplantmanager.h"
|
|
|
|
|
2024-06-18 13:35:03 -04:00
|
|
|
#include "legocharactermanager.h"
|
2024-03-15 22:20:44 -04:00
|
|
|
#include "legoentity.h"
|
2024-06-17 14:11:27 -04:00
|
|
|
#include "legoplants.h"
|
2024-06-18 13:35:03 -04:00
|
|
|
#include "legoworld.h"
|
|
|
|
#include "misc.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2024-03-15 22:20:44 -04:00
|
|
|
|
2024-02-10 20:52:16 -05:00
|
|
|
DECOMP_SIZE_ASSERT(LegoPlantManager, 0x2c)
|
|
|
|
|
2024-06-18 13:35:03 -04:00
|
|
|
// GLOBAL: LEGO1 0x100f1660
|
|
|
|
const char* g_plantLodNames[4][5] = {
|
|
|
|
{"flwrwht", "flwrblk", "flwryel", "flwrred", "flwrgrn"},
|
|
|
|
{"treewht", "treeblk", "treeyel", "treered", "tree"},
|
|
|
|
{"bushwht", "bushblk", "bushyel", "bushred", "bush"},
|
|
|
|
{"palmwht", "palmblk", "palmyel", "palmred", "palm"}
|
|
|
|
};
|
|
|
|
|
2024-02-21 15:30:02 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f3188
|
|
|
|
char* LegoPlantManager::g_customizeAnimFile = NULL;
|
|
|
|
|
2024-06-17 14:11:27 -04:00
|
|
|
// GLOBAL: LEGO1 0x10103180
|
|
|
|
LegoPlantInfo g_plantInfo[81];
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10026220
|
2023-06-29 04:10:08 -04:00
|
|
|
LegoPlantManager::LegoPlantManager()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
Init();
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-06-17 14:11:27 -04:00
|
|
|
// FUNCTION: LEGO1 0x100262c0
|
2023-06-29 04:10:08 -04:00
|
|
|
LegoPlantManager::~LegoPlantManager()
|
|
|
|
{
|
2024-06-17 14:11:27 -04:00
|
|
|
delete[] g_customizeAnimFile;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-06-17 14:11:27 -04:00
|
|
|
// FUNCTION: LEGO1 0x10026330
|
|
|
|
// FUNCTION: BETA10 0x100c4f90
|
2023-11-21 03:44:45 -05:00
|
|
|
void LegoPlantManager::Init()
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2024-06-17 14:11:27 -04:00
|
|
|
for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) {
|
|
|
|
g_plantInfo[i] = g_plantInfoInit[i];
|
|
|
|
}
|
|
|
|
|
2024-06-18 13:35:03 -04:00
|
|
|
m_worldId = -1;
|
2024-06-17 14:11:27 -04:00
|
|
|
m_unk0x0c = 0;
|
|
|
|
m_unk0x24 = 0;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-06-18 13:35:03 -04:00
|
|
|
// FUNCTION: LEGO1 0x10026360
|
2024-06-17 14:11:27 -04:00
|
|
|
// FUNCTION: BETA10 0x100c5032
|
2024-06-18 13:35:03 -04:00
|
|
|
void LegoPlantManager::LoadWorldInfo(MxS32 p_worldId)
|
2024-01-12 17:27:07 -05:00
|
|
|
{
|
2024-06-18 13:35:03 -04:00
|
|
|
m_worldId = p_worldId;
|
|
|
|
LegoWorld* world = CurrentWorld();
|
|
|
|
|
|
|
|
for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) {
|
|
|
|
CreatePlant(i, world, p_worldId);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_unk0x0c = 0;
|
2024-01-12 17:27:07 -05:00
|
|
|
}
|
|
|
|
|
2024-01-27 11:48:50 -05:00
|
|
|
// STUB: LEGO1 0x100263a0
|
|
|
|
void LegoPlantManager::FUN_100263a0(undefined4 p_und)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
2024-06-18 13:35:03 -04:00
|
|
|
// FUNCTION: LEGO1 0x10026590
|
|
|
|
// FUNCTION: BETA10 0x100c561e
|
|
|
|
LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS32 p_worldId)
|
|
|
|
{
|
|
|
|
LegoEntity* entity = NULL;
|
|
|
|
|
|
|
|
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_entity == NULL) {
|
|
|
|
char name[256];
|
|
|
|
char lodName[256];
|
|
|
|
|
|
|
|
sprintf(name, "plant%d", p_index);
|
|
|
|
sprintf(lodName, "%s", g_plantLodNames[g_plantInfo[p_index].m_variant][g_plantInfo[p_index].m_color]);
|
|
|
|
|
|
|
|
LegoROI* roi = CharacterManager()->CreateAutoROI(name, lodName, TRUE);
|
|
|
|
roi->SetVisibility(TRUE);
|
|
|
|
|
|
|
|
entity = roi->GetEntity();
|
|
|
|
entity->SetLocation(
|
|
|
|
g_plantInfo[p_index].m_position,
|
|
|
|
g_plantInfo[p_index].m_direction,
|
|
|
|
g_plantInfo[p_index].m_up,
|
|
|
|
FALSE
|
|
|
|
);
|
|
|
|
entity->SetType(LegoEntity::e_plant);
|
|
|
|
g_plantInfo[p_index].m_entity = entity;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
entity = g_plantInfo[p_index].m_entity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return entity;
|
|
|
|
}
|
|
|
|
|
2024-02-27 15:04:17 -05:00
|
|
|
// STUB: LEGO1 0x10026720
|
2024-06-17 14:11:27 -04:00
|
|
|
// FUNCTION: BETA10 0x100c5918
|
|
|
|
MxResult LegoPlantManager::Write(LegoStorage* p_storage)
|
2024-02-27 15:04:17 -05:00
|
|
|
{
|
|
|
|
// TODO
|
2024-06-17 14:11:27 -04:00
|
|
|
return SUCCESS;
|
2024-02-27 15:04:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// STUB: LEGO1 0x100267b0
|
2024-06-17 14:11:27 -04:00
|
|
|
// FUNCTION: BETA10 0x100c5a76
|
2024-04-21 09:42:08 -04:00
|
|
|
MxResult LegoPlantManager::Read(LegoStorage* p_storage)
|
2024-02-27 15:04:17 -05:00
|
|
|
{
|
2024-06-17 14:11:27 -04:00
|
|
|
// TODO
|
2024-02-27 15:04:17 -05:00
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-06-05 13:40:44 -04:00
|
|
|
// STUB: LEGO1 0x10026920
|
|
|
|
MxBool LegoPlantManager::SwitchColor(LegoEntity* p_entity)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2024-03-15 22:20:44 -04:00
|
|
|
// STUB: LEGO1 0x100269e0
|
2024-06-05 13:40:44 -04:00
|
|
|
MxBool LegoPlantManager::SwitchVariant(LegoEntity* p_entity)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// STUB: LEGO1 0x10026ad0
|
|
|
|
MxBool LegoPlantManager::SwitchSound(LegoEntity* p_entity)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// STUB: LEGO1 0x10026b00
|
|
|
|
MxBool LegoPlantManager::SwitchMove(LegoEntity* p_entity)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// STUB: LEGO1 0x10026b40
|
|
|
|
MxBool LegoPlantManager::SwitchMood(LegoEntity* p_entity)
|
2024-03-15 22:20:44 -04:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2024-06-05 13:00:46 -04:00
|
|
|
// STUB: LEGO1 0x10026b70
|
|
|
|
MxU32 LegoPlantManager::FUN_10026b70(LegoEntity* p_entity)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-03-06 14:12:20 -05:00
|
|
|
// STUB: LEGO1 0x10026ba0
|
2024-06-05 13:00:46 -04:00
|
|
|
MxU32 LegoPlantManager::FUN_10026ba0(LegoEntity* p_entity, MxBool)
|
2024-03-06 14:12:20 -05:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-02-21 15:30:02 -05:00
|
|
|
// FUNCTION: LEGO1 0x10026be0
|
|
|
|
void LegoPlantManager::SetCustomizeAnimFile(const char* p_value)
|
|
|
|
{
|
|
|
|
if (g_customizeAnimFile != NULL) {
|
|
|
|
delete[] g_customizeAnimFile;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_value != NULL) {
|
|
|
|
g_customizeAnimFile = new char[strlen(p_value) + 1];
|
|
|
|
|
|
|
|
if (g_customizeAnimFile != NULL) {
|
|
|
|
strcpy(g_customizeAnimFile, p_value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
g_customizeAnimFile = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-06 13:59:38 -04:00
|
|
|
// STUB: LEGO1 0x10026c50
|
|
|
|
void LegoPlantManager::FUN_10026c50(LegoEntity* p_entity)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x10026e00
|
2023-11-21 03:44:45 -05:00
|
|
|
MxResult LegoPlantManager::Tickle()
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-11-21 03:44:45 -05:00
|
|
|
return 0;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2024-02-05 12:35:26 -05:00
|
|
|
|
|
|
|
// STUB: LEGO1 0x10027120
|
|
|
|
void LegoPlantManager::FUN_10027120()
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|