Implement/match LegoCharacterManager::FUN_100849a0 (#813)

This commit is contained in:
Christian Semmler 2024-04-17 07:52:59 -04:00 committed by GitHub
parent 11410890cd
commit a64bb4d460
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 66 additions and 8 deletions

View file

@ -61,7 +61,7 @@ class LegoCharacterManager {
MxU32 GetRefCount(LegoROI* p_roi);
void FUN_10083db0(LegoROI* p_roi);
void FUN_10083f10(LegoROI* p_roi);
MxU32 FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo);
MxBool FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo);
LegoExtraActor* GetActor(const char* p_key);
LegoCharacterData* GetData(const char* p_key);
LegoCharacterData* GetData(LegoROI* p_roi);
@ -75,7 +75,7 @@ class LegoCharacterManager {
private:
LegoROI* CreateROI(const char* p_key);
void RemoveROI(LegoROI* p_roi);
LegoROI* FUN_10084cf0(LegoROI* p_roi, const char* p_name);
LegoROI* FindChildROI(LegoROI* p_roi, const char* p_name);
MxResult FUN_10085870(LegoROI* p_roi);
static char* g_customizeAnimFile;

View file

@ -25,6 +25,9 @@ MxU32 g_unk0x100fc4d8 = 50;
// GLOBAL: LEGO1 0x100fc4dc
MxU32 g_unk0x100fc4dc = 66;
// GLOBAL: LEGO1 0x100fc4e8
MxU32 g_unk0x100fc4e8 = 0;
// GLOBAL: LEGO1 0x100fc4ec
MxU32 g_unk0x100fc4ec = 2;
@ -469,11 +472,52 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key)
return roi;
}
// STUB: LEGO1 0x100849a0
MxU32 LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo)
// FUNCTION: LEGO1 0x100849a0
// FUNCTION: BETA10 0x10075b51
MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo)
{
// TODO
return 0;
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;
}
// FUNCTION: LEGO1 0x10084c00
@ -537,7 +581,8 @@ LegoCharacterData* LegoCharacterManager::GetData(LegoROI* p_roi)
}
// FUNCTION: LEGO1 0x10084cf0
LegoROI* LegoCharacterManager::FUN_10084cf0(LegoROI* p_roi, const char* p_name)
// FUNCTION: BETA10 0x10075fe2
LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name)
{
const CompoundObject* comp = p_roi->GetComp();
@ -575,7 +620,7 @@ MxBool LegoCharacterManager::FUN_10084ec0(LegoROI* p_roi)
unk0x00 = part.m_unk0x00[part.m_unk0x08];
}
LegoROI* childROI = FUN_10084cf0(p_roi, g_characterLODs[1].m_name);
LegoROI* childROI = FindChildROI(p_roi, g_characterLODs[1].m_name);
if (childROI != NULL) {
char lodName[256];

View file

@ -350,6 +350,18 @@ LegoResult LegoLOD::FUN_100aad00(LegoTextureInfo* p_textureInfo)
return SUCCESS;
}
// FUNCTION: LEGO1 0x100aad70
LegoResult LegoLOD::FUN_100aad70(LegoTextureInfo* p_textureInfo)
{
for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) {
if (m_melems[i].m_unk0x04) {
LegoTextureInfo::SetGroupTexture(m_melems[i].m_tglMesh, p_textureInfo);
}
}
return SUCCESS;
}
// FUNCTION: LEGO1 0x100aae20
LegoBool LegoLOD::FUN_100aae20(const LegoChar* p_name)
{

View file

@ -31,6 +31,7 @@ class LegoLOD : public ViewLOD {
LegoLOD* Clone(Tgl::Renderer* p_renderer);
LegoResult FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult FUN_100aad00(LegoTextureInfo* p_textureInfo);
LegoResult FUN_100aad70(LegoTextureInfo* p_textureInfo);
static LegoBool FUN_100aae20(const LegoChar* p_name);