mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Clear unknowns in LegoAnimPresenter
and related classes (#1565)
* Clear unknowns in `LegoAnimPresenter` and related classes * Update LEGO1/lego/legoomni/include/legoanimpresenter.h --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
@@ -47,8 +47,8 @@ void LegoAnimPresenter::Init()
|
||||
m_anim = NULL;
|
||||
m_roiMap = NULL;
|
||||
m_roiMapSize = 0;
|
||||
m_unk0x74 = NULL;
|
||||
m_unk0x70 = NULL;
|
||||
m_managedActors = NULL;
|
||||
m_sceneROIs = NULL;
|
||||
m_unk0x78 = NULL;
|
||||
m_flags = 0;
|
||||
m_unk0xa8.Clear();
|
||||
@@ -81,13 +81,13 @@ void LegoAnimPresenter::Destroy(MxBool p_fromDestructor)
|
||||
delete[] m_roiMap;
|
||||
}
|
||||
|
||||
if (m_unk0x70 != NULL) {
|
||||
delete m_unk0x70;
|
||||
if (m_sceneROIs != NULL) {
|
||||
delete m_sceneROIs;
|
||||
}
|
||||
|
||||
if (m_unk0x74 != NULL) {
|
||||
if (m_managedActors != NULL) {
|
||||
FUN_1006aa60();
|
||||
delete m_unk0x74;
|
||||
delete m_managedActors;
|
||||
}
|
||||
|
||||
if (m_unk0x78 != NULL) {
|
||||
@@ -214,13 +214,13 @@ LegoChar* LegoAnimPresenter::FUN_10069150(const LegoChar* p_und1)
|
||||
// FUNCTION: LEGO1 0x100692b0
|
||||
void LegoAnimPresenter::FUN_100692b0()
|
||||
{
|
||||
m_unk0x74 = new LegoROIList();
|
||||
m_managedActors = new LegoROIList();
|
||||
|
||||
if (m_unk0x74) {
|
||||
if (m_managedActors) {
|
||||
LegoU32 numActors = m_anim->GetNumActors();
|
||||
|
||||
for (LegoU32 i = 0; i < numActors; i++) {
|
||||
LegoChar* str = FUN_100697c0(m_anim->GetActorName(i), NULL);
|
||||
LegoChar* str = GetVariableOrIdentity(m_anim->GetActorName(i), NULL);
|
||||
undefined4 unk0x04 = m_anim->GetActorUnknown0x04(i);
|
||||
LegoROI* roi = NULL;
|
||||
|
||||
@@ -280,7 +280,7 @@ void LegoAnimPresenter::FUN_100692b0()
|
||||
}
|
||||
|
||||
if (roi != NULL) {
|
||||
m_unk0x74->Append(roi);
|
||||
m_managedActors->Append(roi);
|
||||
}
|
||||
|
||||
delete[] str;
|
||||
@@ -292,9 +292,9 @@ void LegoAnimPresenter::FUN_100692b0()
|
||||
// FUNCTION: BETA10 0x1004f359
|
||||
void LegoAnimPresenter::FUN_100695c0()
|
||||
{
|
||||
m_unk0x70 = new LegoROIList();
|
||||
m_sceneROIs = new LegoROIList();
|
||||
|
||||
if (m_unk0x70) {
|
||||
if (m_sceneROIs) {
|
||||
const CompoundObject& rois = VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->GetROIs();
|
||||
LegoU32 numActors = m_anim->GetNumActors();
|
||||
|
||||
@@ -324,23 +324,23 @@ void LegoAnimPresenter::FUN_100695c0()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100697c0
|
||||
LegoChar* LegoAnimPresenter::FUN_100697c0(const LegoChar* p_und1, const LegoChar* p_und2)
|
||||
LegoChar* LegoAnimPresenter::GetVariableOrIdentity(const LegoChar* p_varName, const LegoChar* p_prefix)
|
||||
{
|
||||
const LegoChar* str = p_und1;
|
||||
const char* var = VariableTable()->GetVariable(p_und1);
|
||||
const LegoChar* str = p_varName;
|
||||
const char* var = VariableTable()->GetVariable(p_varName);
|
||||
|
||||
if (*var) {
|
||||
str = var;
|
||||
}
|
||||
|
||||
LegoU32 len = strlen(str) + (p_und2 ? strlen(p_und2) : 0) + 2;
|
||||
LegoU32 len = strlen(str) + (p_prefix ? strlen(p_prefix) : 0) + 2;
|
||||
LegoChar* result = new LegoChar[len];
|
||||
|
||||
if (result != NULL) {
|
||||
*result = '\0';
|
||||
|
||||
if (p_und2) {
|
||||
strcpy(result, p_und2);
|
||||
if (p_prefix) {
|
||||
strcpy(result, p_prefix);
|
||||
strcat(result, ":");
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_rois, const Leg
|
||||
LegoBool result = FALSE;
|
||||
|
||||
LegoChar* str;
|
||||
if (*(str = FUN_100697c0(p_und2, NULL)) == '*') {
|
||||
if (*(str = GetVariableOrIdentity(p_und2, NULL)) == '*') {
|
||||
LegoChar* tmp = FUN_10069150(str);
|
||||
delete[] str;
|
||||
str = tmp;
|
||||
@@ -369,7 +369,7 @@ LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_rois, const Leg
|
||||
|
||||
if (name != NULL) {
|
||||
if (!strcmpi(name, str)) {
|
||||
m_unk0x70->Append(roi);
|
||||
m_sceneROIs->Append(roi);
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -382,20 +382,20 @@ LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_rois, const Leg
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100699e0
|
||||
LegoROI* LegoAnimPresenter::FUN_100699e0(const LegoChar* p_und)
|
||||
LegoROI* LegoAnimPresenter::FindROI(const LegoChar* p_name)
|
||||
{
|
||||
LegoROIListCursor cursor(m_unk0x70);
|
||||
LegoROIListCursor cursor(m_sceneROIs);
|
||||
LegoROI* roi;
|
||||
|
||||
while (cursor.Next(roi)) {
|
||||
LegoChar* und = FUN_100697c0(roi->GetName(), NULL);
|
||||
LegoChar* nameOrVar = GetVariableOrIdentity(roi->GetName(), NULL);
|
||||
|
||||
if (und != NULL && !strcmpi(und, p_und)) {
|
||||
delete[] und;
|
||||
if (nameOrVar != NULL && !strcmpi(nameOrVar, p_name)) {
|
||||
delete[] nameOrVar;
|
||||
return roi;
|
||||
}
|
||||
|
||||
delete[] und;
|
||||
delete[] nameOrVar;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -410,7 +410,7 @@ void LegoAnimPresenter::FUN_10069b10()
|
||||
memset(m_unk0x8c, 0, m_unk0x94 * sizeof(*m_unk0x8c));
|
||||
}
|
||||
|
||||
FUN_1006a3c0(anims, m_anim->GetRoot(), NULL);
|
||||
UpdateStructMapAndROIIndex(anims, m_anim->GetRoot(), NULL);
|
||||
|
||||
if (m_roiMap != NULL) {
|
||||
delete[] m_roiMap;
|
||||
@@ -443,7 +443,7 @@ void LegoAnimPresenter::FUN_10069b10()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1006a3c0
|
||||
void LegoAnimPresenter::FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi)
|
||||
void LegoAnimPresenter::UpdateStructMapAndROIIndex(LegoAnimStructMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi)
|
||||
{
|
||||
LegoROI* roi = p_roi;
|
||||
LegoChar* und = NULL;
|
||||
@@ -456,27 +456,27 @@ void LegoAnimPresenter::FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_n
|
||||
name = und2 = FUN_10069150(name);
|
||||
}
|
||||
|
||||
und = FUN_100697c0(name, p_roi != NULL ? p_roi->GetName() : NULL);
|
||||
und = GetVariableOrIdentity(name, p_roi != NULL ? p_roi->GetName() : NULL);
|
||||
|
||||
if (p_roi == NULL) {
|
||||
roi = FUN_100699e0(und);
|
||||
roi = FindROI(und);
|
||||
|
||||
if (roi != NULL) {
|
||||
FUN_1006a4f0(p_map, data, und, roi);
|
||||
UpdateStructMapAndROIIndexForNode(p_map, data, und, roi);
|
||||
}
|
||||
else {
|
||||
data->SetUnknown0x20(0);
|
||||
data->SetROIIndex(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
LegoROI* child = p_roi->FindChildROI(name, p_roi);
|
||||
|
||||
if (child != NULL) {
|
||||
FUN_1006a4f0(p_map, data, und, child);
|
||||
UpdateStructMapAndROIIndexForNode(p_map, data, und, child);
|
||||
}
|
||||
else {
|
||||
if (FUN_100699e0(name) != NULL) {
|
||||
FUN_1006a3c0(p_map, p_node, NULL);
|
||||
if (FindROI(name) != NULL) {
|
||||
UpdateStructMapAndROIIndex(p_map, p_node, NULL);
|
||||
delete[] und;
|
||||
delete[] und2;
|
||||
return;
|
||||
@@ -490,12 +490,12 @@ void LegoAnimPresenter::FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_n
|
||||
|
||||
MxS32 count = p_node->GetNumChildren();
|
||||
for (MxS32 i = 0; i < count; i++) {
|
||||
FUN_1006a3c0(p_map, p_node->GetChild(i), roi);
|
||||
UpdateStructMapAndROIIndex(p_map, p_node->GetChild(i), roi);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1006a4f0
|
||||
void LegoAnimPresenter::FUN_1006a4f0(
|
||||
void LegoAnimPresenter::UpdateStructMapAndROIIndexForNode(
|
||||
LegoAnimStructMap& p_map,
|
||||
LegoAnimNodeData* p_data,
|
||||
const LegoChar* p_und,
|
||||
@@ -510,7 +510,7 @@ void LegoAnimPresenter::FUN_1006a4f0(
|
||||
animStruct.m_index = p_map.size() + 1;
|
||||
animStruct.m_roi = p_roi;
|
||||
|
||||
p_data->SetUnknown0x20(animStruct.m_index);
|
||||
p_data->SetROIIndex(animStruct.m_index);
|
||||
|
||||
LegoChar* und = new LegoChar[strlen(p_und) + 1];
|
||||
strcpy(und, p_und);
|
||||
@@ -518,7 +518,7 @@ void LegoAnimPresenter::FUN_1006a4f0(
|
||||
p_map[und] = animStruct;
|
||||
}
|
||||
else {
|
||||
p_data->SetUnknown0x20((*it).second.m_index);
|
||||
p_data->SetROIIndex((*it).second.m_index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ void LegoAnimPresenter::FUN_1006a4f0(
|
||||
// FUNCTION: BETA10 0x1004feee
|
||||
void LegoAnimPresenter::FUN_1006aa60()
|
||||
{
|
||||
LegoROIListCursor cursor(m_unk0x74);
|
||||
LegoROIListCursor cursor(m_managedActors);
|
||||
LegoROI* roi;
|
||||
|
||||
while (cursor.Next(roi)) {
|
||||
@@ -542,10 +542,10 @@ void LegoAnimPresenter::FUN_1006aa60()
|
||||
void LegoAnimPresenter::FUN_1006ab70()
|
||||
{
|
||||
if (m_unk0x96) {
|
||||
AnimationManager()->FUN_10063270(m_unk0x74, this);
|
||||
AnimationManager()->FUN_10063270(m_managedActors, this);
|
||||
}
|
||||
else {
|
||||
AnimationManager()->FUN_10063780(m_unk0x74);
|
||||
AnimationManager()->FUN_10063780(m_managedActors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,10 +565,10 @@ MxBool LegoAnimPresenter::FUN_1006abb0(LegoTreeNode* p_node, LegoROI* p_roi)
|
||||
MxS32 i, count;
|
||||
|
||||
if (name != NULL && *name != '-') {
|
||||
und = FUN_100697c0(name, p_roi != NULL ? p_roi->GetName() : NULL);
|
||||
und = GetVariableOrIdentity(name, p_roi != NULL ? p_roi->GetName() : NULL);
|
||||
|
||||
if (p_roi == NULL) {
|
||||
roi = FUN_100699e0(und);
|
||||
roi = FindROI(und);
|
||||
|
||||
if (roi == NULL) {
|
||||
goto done;
|
||||
@@ -578,7 +578,7 @@ MxBool LegoAnimPresenter::FUN_1006abb0(LegoTreeNode* p_node, LegoROI* p_roi)
|
||||
LegoROI* child = p_roi->FindChildROI(name, p_roi);
|
||||
|
||||
if (child == NULL) {
|
||||
if (FUN_100699e0(name) != NULL) {
|
||||
if (FindROI(name) != NULL) {
|
||||
if (FUN_1006abb0(p_node, NULL)) {
|
||||
result = TRUE;
|
||||
}
|
||||
@@ -828,9 +828,9 @@ void LegoAnimPresenter::StartingTickle()
|
||||
VTable0x8c();
|
||||
|
||||
done:
|
||||
if (m_unk0x70 != NULL) {
|
||||
delete m_unk0x70;
|
||||
m_unk0x70 = NULL;
|
||||
if (m_sceneROIs != NULL) {
|
||||
delete m_sceneROIs;
|
||||
m_sceneROIs = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -893,7 +893,7 @@ void LegoAnimPresenter::FUN_1006b900(LegoAnim* p_anim, MxLong p_time, Matrix4* p
|
||||
mat = *p_matrix;
|
||||
}
|
||||
else {
|
||||
LegoROI* roi = m_roiMap[data->GetUnknown0x20()];
|
||||
LegoROI* roi = m_roiMap[data->GetROIIndex()];
|
||||
|
||||
if (roi != NULL) {
|
||||
mat = roi->GetLocal2World();
|
||||
@@ -918,7 +918,7 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p
|
||||
mat = *p_matrix;
|
||||
}
|
||||
else {
|
||||
LegoROI* roi = m_roiMap[data->GetUnknown0x20()];
|
||||
LegoROI* roi = m_roiMap[data->GetROIIndex()];
|
||||
|
||||
if (roi != NULL) {
|
||||
mat = roi->GetLocal2World();
|
||||
|
Reference in New Issue
Block a user