2024-03-09 15:07:52 -05:00
|
|
|
#include "legocharactermanager.h"
|
2023-10-24 19:38:27 -04:00
|
|
|
|
2024-03-19 14:23:34 -04:00
|
|
|
#include "legoanimactor.h"
|
2024-03-22 13:40:19 -04:00
|
|
|
#include "legocharacters.h"
|
2023-10-12 12:18:24 -04:00
|
|
|
#include "legogamestate.h"
|
2024-03-19 14:23:34 -04:00
|
|
|
#include "legovideomanager.h"
|
|
|
|
#include "misc.h"
|
2024-03-22 13:40:19 -04:00
|
|
|
#include "misc/legocontainer.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "mxmisc.h"
|
2024-03-22 13:40:19 -04:00
|
|
|
#include "realtime/realtime.h"
|
|
|
|
#include "roi/legolod.h"
|
2024-01-22 10:18:46 -05:00
|
|
|
#include "roi/legoroi.h"
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2024-04-02 08:04:17 -04:00
|
|
|
#include <vec.h>
|
|
|
|
|
2024-03-19 14:23:34 -04:00
|
|
|
DECOMP_SIZE_ASSERT(LegoCharacter, 0x08)
|
2024-03-09 15:07:52 -05:00
|
|
|
DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08)
|
2024-02-21 15:30:02 -05:00
|
|
|
|
|
|
|
// GLOBAL: LEGO1 0x100fc4e4
|
2024-03-09 15:07:52 -05:00
|
|
|
char* LegoCharacterManager::g_customizeAnimFile = NULL;
|
2024-02-21 15:30:02 -05:00
|
|
|
|
2024-03-29 14:34:50 -04:00
|
|
|
// GLOBAL: LEGO1 0x100fc4d8
|
|
|
|
MxU32 g_unk0x100fc4d8 = 50;
|
|
|
|
|
|
|
|
// GLOBAL: LEGO1 0x100fc4dc
|
|
|
|
MxU32 g_unk0x100fc4dc = 66;
|
|
|
|
|
2024-04-17 07:52:59 -04:00
|
|
|
// GLOBAL: LEGO1 0x100fc4e8
|
|
|
|
MxU32 g_unk0x100fc4e8 = 0;
|
|
|
|
|
2024-04-05 09:57:20 -04:00
|
|
|
// GLOBAL: LEGO1 0x100fc4ec
|
|
|
|
MxU32 g_unk0x100fc4ec = 2;
|
|
|
|
|
2024-03-31 10:05:38 -04:00
|
|
|
// GLOBAL: LEGO1 0x100fc4f0
|
|
|
|
MxU32 g_unk0x100fc4f0 = 0;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x10104f20
|
2024-03-22 13:40:19 -04:00
|
|
|
LegoCharacterData g_characterData[66];
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2024-02-21 15:30:02 -05:00
|
|
|
// FUNCTION: LEGO1 0x10082a20
|
2024-03-09 15:07:52 -05:00
|
|
|
LegoCharacterManager::LegoCharacterManager()
|
2024-02-10 20:52:16 -05:00
|
|
|
{
|
2024-03-19 14:23:34 -04:00
|
|
|
m_characters = new LegoCharacterMap();
|
2024-03-22 13:40:19 -04:00
|
|
|
Init();
|
2024-02-21 15:30:02 -05:00
|
|
|
|
|
|
|
m_customizeAnimFile = new CustomizeAnimFileVariable("CUSTOMIZE_ANIM_FILE");
|
|
|
|
VariableTable()->SetVariable(m_customizeAnimFile);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10083270
|
2024-03-22 13:40:19 -04:00
|
|
|
void LegoCharacterManager::Init()
|
2024-02-21 15:30:02 -05:00
|
|
|
{
|
2024-03-22 13:40:19 -04:00
|
|
|
for (MxS32 i = 0; i < _countof(g_characterData); i++) {
|
|
|
|
g_characterData[i] = g_characterDataInit[i];
|
2024-02-21 15:30:02 -05:00
|
|
|
}
|
2024-02-10 20:52:16 -05:00
|
|
|
}
|
|
|
|
|
2024-03-29 10:41:12 -04:00
|
|
|
// FUNCTION: LEGO1 0x100832a0
|
2024-03-09 15:07:52 -05:00
|
|
|
void LegoCharacterManager::FUN_100832a0()
|
2024-02-05 12:35:26 -05:00
|
|
|
{
|
2024-03-29 13:30:46 -04:00
|
|
|
for (MxS32 i = 0; i < _countof(g_characterData); i++) {
|
|
|
|
LegoCharacterData* data = GetData(g_characterData[i].m_name);
|
2024-03-29 10:41:12 -04:00
|
|
|
|
|
|
|
if (data != NULL) {
|
|
|
|
LegoExtraActor* actor = data->m_actor;
|
|
|
|
|
|
|
|
if (actor != NULL && actor->IsA("LegoExtraActor")) {
|
|
|
|
LegoROI* roi = g_characterData[i].m_roi;
|
2024-03-29 13:30:31 -04:00
|
|
|
MxU32 refCount = GetRefCount(roi);
|
2024-03-29 10:41:12 -04:00
|
|
|
|
2024-03-29 13:30:31 -04:00
|
|
|
while (refCount != 0) {
|
2024-03-29 10:41:12 -04:00
|
|
|
FUN_10083db0(roi);
|
2024-03-29 13:30:31 -04:00
|
|
|
refCount = GetRefCount(roi);
|
2024-03-29 10:41:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-02-05 12:35:26 -05:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10083310
|
2024-03-22 13:40:19 -04:00
|
|
|
MxResult LegoCharacterManager::Write(LegoStorage* p_storage)
|
2023-10-12 12:18:24 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxResult result = FAILURE;
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
for (MxS32 i = 0; i < _countof(g_characterData); i++) {
|
2024-03-22 13:40:19 -04:00
|
|
|
LegoCharacterData* data = &g_characterData[i];
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_unk0x0c, sizeof(data->m_unk0x0c)) != SUCCESS) {
|
|
|
|
goto done;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_unk0x10, sizeof(data->m_unk0x10)) != SUCCESS) {
|
|
|
|
goto done;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_unk0x14, sizeof(data->m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_parts[1].m_unk0x08, sizeof(data->m_parts[1].m_unk0x08)) != SUCCESS) {
|
|
|
|
goto done;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_parts[1].m_unk0x14, sizeof(data->m_parts[1].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_parts[2].m_unk0x14, sizeof(data->m_parts[2].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_parts[4].m_unk0x14, sizeof(data->m_parts[4].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_parts[5].m_unk0x14, sizeof(data->m_parts[5].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_parts[8].m_unk0x14, sizeof(data->m_parts[8].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-03-22 13:40:19 -04:00
|
|
|
if (p_storage->Write(&data->m_parts[9].m_unk0x14, sizeof(data->m_parts[9].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
2023-10-24 19:38:27 -04:00
|
|
|
}
|
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
|
2024-03-22 13:40:19 -04:00
|
|
|
result = SUCCESS;
|
|
|
|
|
|
|
|
done:
|
2023-10-24 19:38:27 -04:00
|
|
|
return result;
|
2023-10-12 12:18:24 -04:00
|
|
|
}
|
2024-01-16 14:33:03 -05:00
|
|
|
|
2024-03-22 13:40:19 -04:00
|
|
|
// FUNCTION: LEGO1 0x100833f0
|
|
|
|
MxResult LegoCharacterManager::Read(LegoStorage* p_storage)
|
2024-02-27 15:04:17 -05:00
|
|
|
{
|
2024-03-22 13:40:19 -04:00
|
|
|
MxResult result = FAILURE;
|
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
for (MxS32 i = 0; i < _countof(g_characterData); i++) {
|
2024-03-22 13:40:19 -04:00
|
|
|
LegoCharacterData* data = &g_characterData[i];
|
|
|
|
|
|
|
|
if (p_storage->Read(&data->m_unk0x0c, sizeof(data->m_unk0x0c)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (p_storage->Read(&data->m_unk0x10, sizeof(data->m_unk0x10)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (p_storage->Read(&data->m_unk0x14, sizeof(data->m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (p_storage->Read(&data->m_parts[1].m_unk0x08, sizeof(data->m_parts[1].m_unk0x08)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (p_storage->Read(&data->m_parts[1].m_unk0x14, sizeof(data->m_parts[1].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (p_storage->Read(&data->m_parts[2].m_unk0x14, sizeof(data->m_parts[2].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (p_storage->Read(&data->m_parts[4].m_unk0x14, sizeof(data->m_parts[4].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (p_storage->Read(&data->m_parts[5].m_unk0x14, sizeof(data->m_parts[5].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (p_storage->Read(&data->m_parts[8].m_unk0x14, sizeof(data->m_parts[8].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (p_storage->Read(&data->m_parts[9].m_unk0x14, sizeof(data->m_parts[9].m_unk0x14)) != SUCCESS) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
result = SUCCESS;
|
|
|
|
|
|
|
|
done:
|
|
|
|
return result;
|
2024-02-27 15:04:17 -05:00
|
|
|
}
|
|
|
|
|
2024-03-19 14:23:34 -04:00
|
|
|
// FUNCTION: LEGO1 0x10083500
|
|
|
|
LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity)
|
2024-01-22 10:18:46 -05:00
|
|
|
{
|
2024-03-19 14:23:34 -04:00
|
|
|
LegoCharacter* character = NULL;
|
2024-04-19 08:30:36 -04:00
|
|
|
LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_key));
|
2024-03-19 14:23:34 -04:00
|
|
|
|
|
|
|
if (it != m_characters->end()) {
|
|
|
|
character = (*it).second;
|
|
|
|
character->AddRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (character == NULL) {
|
|
|
|
LegoROI* roi = CreateROI(p_key);
|
2024-03-23 13:06:31 -04:00
|
|
|
|
|
|
|
if (roi == NULL) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2024-03-19 14:44:42 -04:00
|
|
|
roi->SetVisibility(FALSE);
|
2024-03-19 14:23:34 -04:00
|
|
|
|
|
|
|
if (roi != NULL) {
|
|
|
|
character = new LegoCharacter(roi);
|
|
|
|
char* key = new char[strlen(p_key) + 1];
|
|
|
|
|
|
|
|
if (key != NULL) {
|
|
|
|
strcpy(key, p_key);
|
|
|
|
(*m_characters)[key] = character;
|
|
|
|
VideoManager()->Get3DManager()->Add(*roi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
VideoManager()->Get3DManager()->Remove(*character->m_roi);
|
|
|
|
VideoManager()->Get3DManager()->Add(*character->m_roi);
|
|
|
|
}
|
|
|
|
|
2024-03-23 13:06:31 -04:00
|
|
|
done:
|
2024-03-19 14:23:34 -04:00
|
|
|
if (character != NULL) {
|
|
|
|
if (p_createEntity && character->m_roi->GetEntity() == NULL) {
|
2024-03-23 10:09:20 -04:00
|
|
|
LegoExtraActor* actor = new LegoExtraActor();
|
2024-03-19 14:23:34 -04:00
|
|
|
|
|
|
|
actor->SetROI(character->m_roi, FALSE, FALSE);
|
2024-04-26 10:03:13 -04:00
|
|
|
actor->SetType(LegoEntity::e_character);
|
2024-03-19 14:23:34 -04:00
|
|
|
actor->SetFlag(LegoActor::c_bit2);
|
2024-03-29 13:30:46 -04:00
|
|
|
GetData(p_key)->m_actor = actor;
|
2024-03-19 14:23:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return character->m_roi;
|
|
|
|
}
|
|
|
|
|
2024-01-22 10:18:46 -05:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2024-03-29 13:30:31 -04:00
|
|
|
// FUNCTION: LEGO1 0x10083bc0
|
|
|
|
MxU32 LegoCharacterManager::GetRefCount(LegoROI* p_roi)
|
2024-03-29 10:41:12 -04:00
|
|
|
{
|
2024-03-29 13:30:31 -04:00
|
|
|
LegoCharacterMap::iterator it;
|
|
|
|
|
|
|
|
for (it = m_characters->begin(); it != m_characters->end(); it++) {
|
|
|
|
LegoCharacter* character = (*it).second;
|
|
|
|
LegoROI* roi = character->m_roi;
|
|
|
|
|
|
|
|
if (roi == p_roi) {
|
|
|
|
return character->m_refCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-29 10:41:12 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-04-19 08:30:36 -04:00
|
|
|
// FUNCTION: LEGO1 0x10083c30
|
2024-04-17 11:03:17 -04:00
|
|
|
// FUNCTION: BETA10 0x10074701
|
|
|
|
void LegoCharacterManager::FUN_10083c30(const char* p_name)
|
|
|
|
{
|
2024-04-19 08:30:36 -04:00
|
|
|
LegoCharacter* character = NULL;
|
|
|
|
LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_name));
|
|
|
|
|
|
|
|
if (it != m_characters->end()) {
|
|
|
|
character = (*it).second;
|
|
|
|
|
|
|
|
if (character->RemoveRef() == 0) {
|
|
|
|
LegoCharacterData* data = GetData(p_name);
|
|
|
|
LegoEntity* entity = character->m_roi->GetEntity();
|
|
|
|
|
|
|
|
if (entity != NULL) {
|
|
|
|
entity->SetROI(NULL, FALSE, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoveROI(character->m_roi);
|
|
|
|
|
|
|
|
delete[] (*it).first;
|
|
|
|
delete (*it).second;
|
|
|
|
|
|
|
|
m_characters->erase(it);
|
|
|
|
|
|
|
|
if (data != NULL) {
|
|
|
|
if (data->m_actor != NULL) {
|
|
|
|
data->m_actor->ClearFlag(LegoEntity::c_bit2);
|
|
|
|
delete data->m_actor;
|
|
|
|
}
|
|
|
|
else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) {
|
|
|
|
entity->ClearFlag(LegoEntity::c_bit2);
|
|
|
|
delete entity;
|
|
|
|
}
|
|
|
|
|
|
|
|
data->m_roi = NULL;
|
|
|
|
data->m_actor = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-04-17 11:03:17 -04:00
|
|
|
}
|
|
|
|
|
2024-04-06 12:11:13 -04:00
|
|
|
// FUNCTION: LEGO1 0x10083db0
|
2024-03-09 15:07:52 -05:00
|
|
|
void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi)
|
2024-01-16 14:33:03 -05:00
|
|
|
{
|
2024-04-06 12:11:13 -04:00
|
|
|
LegoCharacter* character = NULL;
|
|
|
|
LegoCharacterMap::iterator it;
|
|
|
|
|
|
|
|
for (it = m_characters->begin(); it != m_characters->end(); it++) {
|
|
|
|
character = (*it).second;
|
|
|
|
|
|
|
|
if (character->m_roi == p_roi) {
|
|
|
|
if (character->RemoveRef() == 0) {
|
|
|
|
LegoCharacterData* data = GetData(character->m_roi->GetName());
|
|
|
|
LegoEntity* entity = character->m_roi->GetEntity();
|
|
|
|
|
|
|
|
if (entity != NULL) {
|
|
|
|
entity->SetROI(NULL, FALSE, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoveROI(character->m_roi);
|
|
|
|
|
2024-04-19 08:30:36 -04:00
|
|
|
delete[] (*it).first;
|
2024-04-06 12:11:13 -04:00
|
|
|
delete (*it).second;
|
|
|
|
|
|
|
|
m_characters->erase(it);
|
|
|
|
|
|
|
|
if (data != NULL) {
|
|
|
|
if (data->m_actor != NULL) {
|
|
|
|
data->m_actor->ClearFlag(LegoEntity::c_bit2);
|
|
|
|
delete data->m_actor;
|
|
|
|
}
|
|
|
|
else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) {
|
|
|
|
entity->ClearFlag(LegoEntity::c_bit2);
|
|
|
|
delete entity;
|
|
|
|
}
|
|
|
|
|
|
|
|
data->m_roi = NULL;
|
|
|
|
data->m_actor = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2024-01-16 14:33:03 -05:00
|
|
|
}
|
2024-02-13 18:34:14 -05:00
|
|
|
|
2024-04-06 11:46:40 -04:00
|
|
|
// FUNCTION: LEGO1 0x10083f10
|
2024-03-09 15:07:52 -05:00
|
|
|
void LegoCharacterManager::FUN_10083f10(LegoROI* p_roi)
|
2024-02-13 18:34:14 -05:00
|
|
|
{
|
2024-04-06 11:46:40 -04:00
|
|
|
LegoCharacter* character = NULL;
|
|
|
|
LegoCharacterMap::iterator it;
|
|
|
|
|
|
|
|
for (it = m_characters->begin(); it != m_characters->end(); it++) {
|
|
|
|
character = (*it).second;
|
|
|
|
|
|
|
|
if (character->m_roi == p_roi) {
|
|
|
|
if (character->RemoveRef() == 0) {
|
|
|
|
LegoEntity* entity = character->m_roi->GetEntity();
|
|
|
|
|
|
|
|
if (entity != NULL) {
|
|
|
|
entity->SetROI(NULL, FALSE, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoveROI(character->m_roi);
|
|
|
|
|
2024-04-19 08:30:36 -04:00
|
|
|
delete[] (*it).first;
|
2024-04-06 11:46:40 -04:00
|
|
|
delete (*it).second;
|
|
|
|
|
|
|
|
m_characters->erase(it);
|
|
|
|
|
|
|
|
if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) {
|
|
|
|
entity->ClearFlag(LegoEntity::c_bit2);
|
|
|
|
delete entity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10084010
|
|
|
|
void LegoCharacterManager::RemoveROI(LegoROI* p_roi)
|
|
|
|
{
|
|
|
|
VideoManager()->Get3DManager()->Remove(*p_roi);
|
2024-02-13 18:34:14 -05:00
|
|
|
}
|
2024-02-21 15:30:02 -05:00
|
|
|
|
2024-03-22 13:40:19 -04:00
|
|
|
// FUNCTION: LEGO1 0x10084030
|
2024-03-19 14:23:34 -04:00
|
|
|
LegoROI* LegoCharacterManager::CreateROI(const char* p_key)
|
|
|
|
{
|
2024-03-22 13:40:19 -04:00
|
|
|
MxBool success = FALSE;
|
|
|
|
LegoROI* roi = NULL;
|
|
|
|
BoundingSphere boundingSphere;
|
|
|
|
BoundingBox boundingBox;
|
|
|
|
MxMatrix mat;
|
|
|
|
CompoundObject* comp;
|
2024-04-05 09:57:20 -04:00
|
|
|
MxS32 i;
|
2024-03-22 13:40:19 -04:00
|
|
|
|
|
|
|
Tgl::Renderer* renderer = VideoManager()->GetRenderer();
|
|
|
|
ViewLODListManager* lodManager = GetViewLODListManager();
|
|
|
|
LegoTextureContainer* textureContainer = TextureContainer();
|
2024-03-29 13:30:46 -04:00
|
|
|
LegoCharacterData* data = GetData(p_key);
|
2024-03-22 13:40:19 -04:00
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
if (data == NULL) {
|
2024-03-22 13:40:19 -04:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmpi(p_key, "pep")) {
|
2024-03-29 13:30:46 -04:00
|
|
|
LegoCharacterData* pepper = GetData("pepper");
|
2024-03-22 13:40:19 -04:00
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
data->m_unk0x0c = pepper->m_unk0x0c;
|
|
|
|
data->m_unk0x10 = pepper->m_unk0x10;
|
|
|
|
data->m_unk0x14 = pepper->m_unk0x14;
|
2024-03-22 13:40:19 -04:00
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
for (i = 0; i < _countof(data->m_parts); i++) {
|
|
|
|
data->m_parts[i] = pepper->m_parts[i];
|
2024-03-22 13:40:19 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
roi = new LegoROI(renderer);
|
|
|
|
roi->SetName(p_key);
|
|
|
|
|
|
|
|
boundingSphere.Center()[0] = g_characterLODs[0].m_boundingSphere[0];
|
|
|
|
boundingSphere.Center()[1] = g_characterLODs[0].m_boundingSphere[1];
|
|
|
|
boundingSphere.Center()[2] = g_characterLODs[0].m_boundingSphere[2];
|
|
|
|
boundingSphere.Radius() = g_characterLODs[0].m_boundingSphere[3];
|
|
|
|
roi->SetBoundingSphere(boundingSphere);
|
|
|
|
|
|
|
|
boundingBox.Min()[0] = g_characterLODs[0].m_boundingBox[0];
|
|
|
|
boundingBox.Min()[1] = g_characterLODs[0].m_boundingBox[1];
|
|
|
|
boundingBox.Min()[2] = g_characterLODs[0].m_boundingBox[2];
|
|
|
|
boundingBox.Max()[0] = g_characterLODs[0].m_boundingBox[3];
|
|
|
|
boundingBox.Max()[1] = g_characterLODs[0].m_boundingBox[4];
|
|
|
|
boundingBox.Max()[2] = g_characterLODs[0].m_boundingBox[5];
|
|
|
|
roi->SetUnknown0x80(boundingBox);
|
|
|
|
|
|
|
|
comp = new CompoundObject();
|
|
|
|
roi->SetComp(comp);
|
|
|
|
|
|
|
|
for (i = 0; i < _countof(g_characterLODs) - 1; i++) {
|
2024-04-05 09:57:20 -04:00
|
|
|
char lodName[256];
|
2024-03-29 13:30:46 -04:00
|
|
|
LegoCharacterData::Part& part = data->m_parts[i];
|
2024-03-22 13:40:19 -04:00
|
|
|
|
2024-04-05 09:57:20 -04:00
|
|
|
const char* parentName;
|
2024-03-22 13:40:19 -04:00
|
|
|
if (i == 0 || i == 1) {
|
|
|
|
parentName = part.m_unk0x04[part.m_unk0x00[part.m_unk0x08]];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
parentName = g_characterLODs[i + 1].m_parentName;
|
|
|
|
}
|
|
|
|
|
2024-04-05 09:57:20 -04:00
|
|
|
ViewLODList* lodList = lodManager->Lookup(parentName);
|
|
|
|
MxS32 lodSize = lodList->Size();
|
2024-03-22 13:40:19 -04:00
|
|
|
sprintf(lodName, "%s%d", p_key, i);
|
2024-04-05 09:57:20 -04:00
|
|
|
ViewLODList* dupLodList = lodManager->Create(lodName, lodSize);
|
2024-03-22 13:40:19 -04:00
|
|
|
|
2024-04-05 09:57:20 -04:00
|
|
|
for (MxS32 j = 0; j < lodSize; j++) {
|
|
|
|
LegoLOD* lod = (LegoLOD*) (*lodList)[j];
|
|
|
|
LegoLOD* clone = lod->Clone(renderer);
|
|
|
|
dupLodList->PushBack(clone);
|
2024-03-22 13:40:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
lodList->Release();
|
|
|
|
lodList = dupLodList;
|
|
|
|
|
2024-04-05 09:57:20 -04:00
|
|
|
LegoROI* childROI = new LegoROI(renderer, lodList);
|
2024-03-22 13:40:19 -04:00
|
|
|
lodList->Release();
|
|
|
|
|
|
|
|
childROI->SetName(g_characterLODs[i + 1].m_name);
|
|
|
|
childROI->SetParentROI(roi);
|
|
|
|
|
|
|
|
BoundingSphere childBoundingSphere;
|
|
|
|
childBoundingSphere.Center()[0] = g_characterLODs[i + 1].m_boundingSphere[0];
|
|
|
|
childBoundingSphere.Center()[1] = g_characterLODs[i + 1].m_boundingSphere[1];
|
|
|
|
childBoundingSphere.Center()[2] = g_characterLODs[i + 1].m_boundingSphere[2];
|
|
|
|
childBoundingSphere.Radius() = g_characterLODs[i + 1].m_boundingSphere[3];
|
|
|
|
childROI->SetBoundingSphere(childBoundingSphere);
|
|
|
|
|
|
|
|
BoundingBox childBoundingBox;
|
|
|
|
childBoundingBox.Min()[0] = g_characterLODs[i + 1].m_boundingBox[0];
|
|
|
|
childBoundingBox.Min()[1] = g_characterLODs[i + 1].m_boundingBox[1];
|
|
|
|
childBoundingBox.Min()[2] = g_characterLODs[i + 1].m_boundingBox[2];
|
|
|
|
childBoundingBox.Max()[0] = g_characterLODs[i + 1].m_boundingBox[3];
|
|
|
|
childBoundingBox.Max()[1] = g_characterLODs[i + 1].m_boundingBox[4];
|
|
|
|
childBoundingBox.Max()[2] = g_characterLODs[i + 1].m_boundingBox[5];
|
|
|
|
childROI->SetUnknown0x80(childBoundingBox);
|
|
|
|
|
|
|
|
CalcLocalTransform(
|
|
|
|
Mx3DPointFloat(g_characterLODs[i + 1].m_position),
|
|
|
|
Mx3DPointFloat(g_characterLODs[i + 1].m_direction),
|
|
|
|
Mx3DPointFloat(g_characterLODs[i + 1].m_up),
|
|
|
|
mat
|
|
|
|
);
|
|
|
|
childROI->WrappedSetLocalTransform(mat);
|
|
|
|
|
|
|
|
if (g_characterLODs[i + 1].m_flags & LegoCharacterLOD::c_flag1 &&
|
|
|
|
(i != 0 || part.m_unk0x00[part.m_unk0x08] != 0)) {
|
|
|
|
|
|
|
|
LegoTextureInfo* textureInfo = textureContainer->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]);
|
|
|
|
|
|
|
|
if (textureInfo != NULL) {
|
|
|
|
childROI->FUN_100a9210(textureInfo);
|
|
|
|
childROI->FUN_100a9170(1.0F, 1.0F, 1.0F, 0.0F);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (g_characterLODs[i + 1].m_flags & LegoCharacterLOD::c_flag2 || (i == 0 && part.m_unk0x00[part.m_unk0x08] == 0)) {
|
|
|
|
LegoFloat red, green, blue, alpha;
|
|
|
|
childROI->FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
|
|
|
|
childROI->FUN_100a9170(red, green, blue, alpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
comp->push_back(childROI);
|
|
|
|
}
|
|
|
|
|
|
|
|
CalcLocalTransform(
|
|
|
|
Mx3DPointFloat(g_characterLODs[0].m_position),
|
|
|
|
Mx3DPointFloat(g_characterLODs[0].m_direction),
|
|
|
|
Mx3DPointFloat(g_characterLODs[0].m_up),
|
|
|
|
mat
|
|
|
|
);
|
|
|
|
roi->WrappedSetLocalTransform(mat);
|
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
data->m_roi = roi;
|
2024-03-22 13:40:19 -04:00
|
|
|
success = TRUE;
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (!success && roi != NULL) {
|
|
|
|
delete roi;
|
|
|
|
roi = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return roi;
|
2024-03-19 14:23:34 -04:00
|
|
|
}
|
|
|
|
|
2024-04-17 07:52:59 -04:00
|
|
|
// FUNCTION: LEGO1 0x100849a0
|
|
|
|
// FUNCTION: BETA10 0x10075b51
|
|
|
|
MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo)
|
2024-04-16 10:07:13 -04:00
|
|
|
{
|
2024-04-17 07:52:59 -04:00
|
|
|
LegoResult result = SUCCESS;
|
|
|
|
LegoROI* head = FindChildROI(p_roi, g_characterLODs[4].m_name);
|
|
|
|
|
|
|
|
if (head != NULL) {
|
|
|
|
char lodName[256];
|
|
|
|
|
|
|
|
ViewLODList* lodList = GetViewLODListManager()->Lookup(g_characterLODs[4].m_parentName);
|
|
|
|
MxS32 lodSize = lodList->Size();
|
|
|
|
sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_unk0x100fc4e8++);
|
|
|
|
ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
|
|
|
|
|
|
|
|
Tgl::Renderer* renderer = VideoManager()->GetRenderer();
|
|
|
|
|
|
|
|
if (p_textureInfo == NULL) {
|
|
|
|
LegoCharacterData* info = GetData(p_roi->GetName());
|
|
|
|
LegoCharacterData::Part& part = info->m_parts[3];
|
|
|
|
p_textureInfo = TextureContainer()->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (MxS32 i = 0; i < lodSize; i++) {
|
|
|
|
LegoLOD* lod = (LegoLOD*) (*lodList)[i];
|
|
|
|
LegoLOD* clone = lod->Clone(renderer);
|
|
|
|
|
|
|
|
if (p_textureInfo != NULL) {
|
|
|
|
clone->FUN_100aad70(p_textureInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
dupLodList->PushBack(clone);
|
|
|
|
}
|
|
|
|
|
|
|
|
lodList->Release();
|
|
|
|
lodList = dupLodList;
|
|
|
|
|
|
|
|
if (head->GetUnknown0xe0() >= 0) {
|
|
|
|
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->FUN_100a66a0(head);
|
|
|
|
}
|
|
|
|
|
|
|
|
head->SetLODList(lodList);
|
|
|
|
lodList->Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
return head != NULL;
|
2024-04-16 10:07:13 -04:00
|
|
|
}
|
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
// FUNCTION: LEGO1 0x10084c00
|
|
|
|
MxBool LegoCharacterManager::Exists(const char* p_key)
|
2024-02-27 10:13:00 -05:00
|
|
|
{
|
2024-03-29 13:30:46 -04:00
|
|
|
for (MxU32 i = 0; i < _countof(g_characterData); i++) {
|
|
|
|
if (!strcmpi(g_characterData[i].m_name, p_key)) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-27 10:13:00 -05:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
// FUNCTION: LEGO1 0x10084c40
|
|
|
|
LegoExtraActor* LegoCharacterManager::GetActor(const char* p_key)
|
2024-03-23 10:09:20 -04:00
|
|
|
{
|
2024-03-29 13:30:46 -04:00
|
|
|
LegoCharacterData* data = GetData(p_key);
|
|
|
|
|
|
|
|
if (data != NULL) {
|
|
|
|
return data->m_actor;
|
|
|
|
}
|
|
|
|
|
2024-03-23 10:09:20 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-23 13:06:31 -04:00
|
|
|
|
2024-03-22 13:40:19 -04:00
|
|
|
// FUNCTION: LEGO1 0x10084c60
|
2024-03-29 13:30:46 -04:00
|
|
|
LegoCharacterData* LegoCharacterManager::GetData(const char* p_key)
|
2024-03-19 14:23:34 -04:00
|
|
|
{
|
2024-03-22 13:40:19 -04:00
|
|
|
MxU32 i;
|
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
for (i = 0; i < _countof(g_characterData); i++) {
|
2024-03-22 13:40:19 -04:00
|
|
|
if (!strcmpi(g_characterData[i].m_name, p_key)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i < _countof(g_characterData)) {
|
|
|
|
return &g_characterData[i];
|
|
|
|
}
|
|
|
|
|
2024-03-19 14:23:34 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2024-03-29 14:34:50 -04:00
|
|
|
// FUNCTION: LEGO1 0x10084cb0
|
|
|
|
LegoCharacterData* LegoCharacterManager::GetData(LegoROI* p_roi)
|
|
|
|
{
|
|
|
|
MxU32 i;
|
|
|
|
|
|
|
|
for (i = 0; i < _countof(g_characterData); i++) {
|
|
|
|
if (g_characterData[i].m_roi == p_roi) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i < _countof(g_characterData)) {
|
|
|
|
return &g_characterData[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2024-04-06 08:08:38 -04:00
|
|
|
// FUNCTION: LEGO1 0x10084cf0
|
2024-04-17 07:52:59 -04:00
|
|
|
// FUNCTION: BETA10 0x10075fe2
|
|
|
|
LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name)
|
2024-03-15 22:20:44 -04:00
|
|
|
{
|
2024-04-06 08:08:38 -04:00
|
|
|
const CompoundObject* comp = p_roi->GetComp();
|
|
|
|
|
|
|
|
#ifdef COMPAT_MODE
|
|
|
|
for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) {
|
|
|
|
#else
|
|
|
|
for (CompoundObject::iterator it = comp->begin(); !(it == comp->end()); it++) {
|
|
|
|
#endif
|
|
|
|
LegoROI* roi = (LegoROI*) *it;
|
|
|
|
|
|
|
|
if (!strcmpi(p_name, roi->GetName())) {
|
|
|
|
return roi;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-05 09:57:20 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10084ec0
|
2024-04-21 10:41:38 -04:00
|
|
|
MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi)
|
2024-04-05 09:57:20 -04:00
|
|
|
{
|
|
|
|
LegoCharacterData* data = GetData(p_roi->GetName());
|
|
|
|
|
|
|
|
if (data == NULL) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
LegoCharacterData::Part& part = data->m_parts[1];
|
|
|
|
|
|
|
|
part.m_unk0x08++;
|
|
|
|
MxU8 unk0x00 = part.m_unk0x00[part.m_unk0x08];
|
|
|
|
|
|
|
|
if (unk0x00 == 0xff) {
|
|
|
|
part.m_unk0x08 = 0;
|
|
|
|
unk0x00 = part.m_unk0x00[part.m_unk0x08];
|
|
|
|
}
|
|
|
|
|
2024-04-21 10:41:38 -04:00
|
|
|
LegoROI* childROI = FindChildROI(p_roi, g_characterLODs[2].m_name);
|
2024-04-05 09:57:20 -04:00
|
|
|
|
|
|
|
if (childROI != NULL) {
|
|
|
|
char lodName[256];
|
|
|
|
|
|
|
|
ViewLODList* lodList = GetViewLODListManager()->Lookup(part.m_unk0x04[unk0x00]);
|
|
|
|
MxS32 lodSize = lodList->Size();
|
|
|
|
sprintf(lodName, "%s%d", p_roi->GetName(), g_unk0x100fc4ec++);
|
|
|
|
ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
|
|
|
|
|
|
|
|
Tgl::Renderer* renderer = VideoManager()->GetRenderer();
|
|
|
|
LegoFloat red, green, blue, alpha;
|
|
|
|
LegoROI::FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
|
|
|
|
|
|
|
|
for (MxS32 i = 0; i < lodSize; i++) {
|
|
|
|
LegoLOD* lod = (LegoLOD*) (*lodList)[i];
|
|
|
|
LegoLOD* clone = lod->Clone(renderer);
|
|
|
|
clone->FUN_100aacb0(red, green, blue, alpha);
|
|
|
|
dupLodList->PushBack(clone);
|
|
|
|
}
|
|
|
|
|
|
|
|
lodList->Release();
|
|
|
|
lodList = dupLodList;
|
|
|
|
|
|
|
|
if (childROI->GetUnknown0xe0() >= 0) {
|
|
|
|
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->FUN_100a66a0(childROI);
|
|
|
|
}
|
|
|
|
|
|
|
|
childROI->SetLODList(lodList);
|
|
|
|
lodList->Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2024-03-15 22:20:44 -04:00
|
|
|
}
|
|
|
|
|
2024-03-29 14:34:50 -04:00
|
|
|
// FUNCTION: LEGO1 0x10085140
|
|
|
|
MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und)
|
2024-03-06 14:12:20 -05:00
|
|
|
{
|
2024-03-29 14:34:50 -04:00
|
|
|
LegoCharacterData* data = GetData(p_roi);
|
|
|
|
|
|
|
|
if (p_und) {
|
|
|
|
return data->m_unk0x14 + g_unk0x100fc4dc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data != NULL) {
|
|
|
|
return data->m_unk0x0c + g_unk0x100fc4d8;
|
|
|
|
}
|
|
|
|
|
2024-03-06 14:12:20 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-02-21 15:30:02 -05:00
|
|
|
// FUNCTION: LEGO1 0x100851a0
|
2024-03-09 15:07:52 -05:00
|
|
|
void LegoCharacterManager::SetCustomizeAnimFile(const char* p_value)
|
2024-02-21 15:30:02 -05:00
|
|
|
{
|
|
|
|
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-02-25 12:04:30 -05:00
|
|
|
|
2024-03-31 10:05:38 -04:00
|
|
|
// FUNCTION: LEGO1 0x10085210
|
|
|
|
LegoROI* LegoCharacterManager::FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity)
|
2024-02-25 12:04:30 -05:00
|
|
|
{
|
2024-03-31 10:05:38 -04:00
|
|
|
LegoROI* roi = NULL;
|
|
|
|
|
|
|
|
MxMatrix mat;
|
|
|
|
Tgl::Renderer* renderer = VideoManager()->GetRenderer();
|
|
|
|
ViewLODListManager* lodManager = GetViewLODListManager();
|
|
|
|
LegoTextureContainer* textureContainer = TextureContainer();
|
|
|
|
ViewLODList* lodList = lodManager->Lookup(p_lodName);
|
|
|
|
|
|
|
|
if (lodList == NULL || lodList->Size() == 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
roi = new LegoROI(renderer, lodList);
|
|
|
|
|
|
|
|
const char* name;
|
|
|
|
char buf[20];
|
|
|
|
|
|
|
|
if (p_name != NULL) {
|
|
|
|
name = p_name;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(buf, "autoROI_%d", g_unk0x100fc4f0++);
|
|
|
|
name = buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
roi->SetName(name);
|
|
|
|
lodList->Release();
|
|
|
|
|
|
|
|
if (roi != NULL && FUN_10085870(roi) != SUCCESS) {
|
|
|
|
delete roi;
|
|
|
|
roi = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (roi != NULL) {
|
|
|
|
roi->SetVisibility(FALSE);
|
|
|
|
|
|
|
|
LegoCharacter* character = new LegoCharacter(roi);
|
|
|
|
char* key = new char[strlen(name) + 1];
|
|
|
|
|
|
|
|
if (key != NULL) {
|
|
|
|
strcpy(key, name);
|
|
|
|
(*m_characters)[key] = character;
|
|
|
|
VideoManager()->Get3DManager()->Add(*roi);
|
|
|
|
|
|
|
|
if (p_createEntity && roi->GetEntity() == NULL) {
|
|
|
|
LegoEntity* entity = new LegoEntity();
|
|
|
|
|
|
|
|
entity->SetROI(roi, FALSE, FALSE);
|
2024-04-26 10:03:13 -04:00
|
|
|
entity->SetType(LegoEntity::e_unk4);
|
2024-03-31 10:05:38 -04:00
|
|
|
entity->SetFlag(LegoActor::c_bit2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return roi;
|
|
|
|
}
|
|
|
|
|
2024-04-02 08:04:17 -04:00
|
|
|
// FUNCTION: LEGO1 0x10085870
|
2024-03-31 10:05:38 -04:00
|
|
|
MxResult LegoCharacterManager::FUN_10085870(LegoROI* p_roi)
|
|
|
|
{
|
2024-04-02 08:04:17 -04:00
|
|
|
MxResult result = FAILURE;
|
|
|
|
|
|
|
|
BoundingSphere boundingSphere;
|
|
|
|
BoundingBox boundingBox;
|
|
|
|
|
|
|
|
const Tgl::MeshBuilder* meshBuilder = ((ViewLOD*) p_roi->GetLOD(0))->GetMeshBuilder();
|
|
|
|
|
|
|
|
if (meshBuilder != NULL) {
|
|
|
|
float min[3], max[3];
|
|
|
|
|
|
|
|
FILLVEC3(min, 88888.0);
|
|
|
|
FILLVEC3(max, -88888.0);
|
|
|
|
meshBuilder->GetBoundingBox(min, max);
|
|
|
|
|
|
|
|
float center[3];
|
|
|
|
center[0] = (min[0] + max[0]) / 2.0f;
|
|
|
|
center[1] = (min[1] + max[1]) / 2.0f;
|
|
|
|
center[2] = (min[2] + max[2]) / 2.0f;
|
|
|
|
SET3(boundingSphere.Center(), center);
|
|
|
|
|
|
|
|
float radius[3];
|
|
|
|
VMV3(radius, max, min);
|
|
|
|
boundingSphere.Radius() = sqrt(NORMSQRD3(radius)) / 2.0;
|
|
|
|
|
|
|
|
p_roi->SetBoundingSphere(boundingSphere);
|
|
|
|
|
|
|
|
SET3(boundingBox.Min(), min);
|
|
|
|
SET3(boundingBox.Max(), max);
|
|
|
|
|
|
|
|
p_roi->SetUnknown0x80(boundingBox);
|
|
|
|
|
|
|
|
p_roi->VTable0x14();
|
|
|
|
|
|
|
|
result = SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2024-02-25 12:04:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10085a80
|
2024-03-31 10:05:38 -04:00
|
|
|
LegoROI* LegoCharacterManager::FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity)
|
2024-02-25 12:04:30 -05:00
|
|
|
{
|
2024-03-31 10:05:38 -04:00
|
|
|
return FUN_10085210(p_name, p_lodName, p_createEntity);
|
2024-02-25 12:04:30 -05:00
|
|
|
}
|