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-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
|
|
|
|
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;
|
|
|
|
LegoCharacterMap::iterator it = m_characters->find(p_key);
|
|
|
|
|
|
|
|
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);
|
|
|
|
actor->FUN_100114e0(0);
|
|
|
|
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-01-16 14:33:03 -05:00
|
|
|
// STUB: 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
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
2024-02-13 18:34:14 -05:00
|
|
|
|
|
|
|
// STUB: 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
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
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;
|
|
|
|
MxS32 i, j;
|
|
|
|
|
|
|
|
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++) {
|
|
|
|
ViewLODList *lodList, *dupLodList;
|
|
|
|
LegoROI* childROI;
|
|
|
|
MxS32 lodSize;
|
|
|
|
const char* parentName;
|
|
|
|
char lodName[64];
|
|
|
|
|
2024-03-29 13:30:46 -04:00
|
|
|
LegoCharacterData::Part& part = data->m_parts[i];
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
lodList = lodManager->Lookup(parentName);
|
|
|
|
lodSize = lodList->Size();
|
|
|
|
sprintf(lodName, "%s%d", p_key, i);
|
|
|
|
dupLodList = lodManager->Create(lodName, lodSize);
|
|
|
|
|
|
|
|
for (j = 0; j < lodSize; j++) {
|
|
|
|
dupLodList->PushBack(((LegoLOD*) (*lodList)[j])->Clone(renderer));
|
|
|
|
}
|
|
|
|
|
|
|
|
lodList->Release();
|
|
|
|
lodList = dupLodList;
|
|
|
|
|
|
|
|
childROI = new LegoROI(renderer, lodList);
|
|
|
|
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-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-15 22:20:44 -04:00
|
|
|
// STUB: LEGO1 0x10084ec0
|
|
|
|
MxBool LegoCharacterManager::FUN_10084ec0(LegoROI* p_roi)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2024-03-06 14:12:20 -05:00
|
|
|
// STUB: LEGO1 0x10085140
|
2024-03-09 15:07:52 -05:00
|
|
|
MxU32 LegoCharacterManager::FUN_10085140(LegoROI*, MxBool)
|
2024-03-06 14:12:20 -05:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
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
|
|
|
|
|
|
|
// STUB: LEGO1 0x10085210
|
2024-03-29 13:30:46 -04:00
|
|
|
LegoROI* LegoCharacterManager::FUN_10085210(const char*, char*, undefined)
|
2024-02-25 12:04:30 -05:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10085a80
|
2024-03-29 13:30:46 -04:00
|
|
|
LegoROI* LegoCharacterManager::FUN_10085a80(char* p_und1, char* p_und2, undefined p_und3)
|
2024-02-25 12:04:30 -05:00
|
|
|
{
|
|
|
|
return FUN_10085210(p_und1, p_und2, p_und3);
|
|
|
|
}
|