Implement/match remaining LegoHideAnimPresenter functions (#923)

* Implement/match remaining LegoHideAnimPresenter functions

* Fix type

* Fix marker

* Fix type
This commit is contained in:
Christian Semmler
2024-05-14 14:50:37 -04:00
committed by GitHub
parent e4a899350e
commit 29a0e32739
6 changed files with 188 additions and 22 deletions

View File

@@ -402,7 +402,7 @@ LegoROI* LegoAnimPresenter::FUN_100699e0(const LegoChar* p_und)
// FUNCTION: LEGO1 0x10069b10
void LegoAnimPresenter::FUN_10069b10()
{
LegoAnimPresenterMap map;
LegoAnimStructMap map;
if (m_unk0x8c != NULL) {
memset(m_unk0x8c, 0, m_unk0x94 * sizeof(*m_unk0x8c));
@@ -419,7 +419,7 @@ void LegoAnimPresenter::FUN_10069b10()
m_roiMap = new LegoROI*[map.size() + 1];
memset(m_roiMap, 0, (map.size() + 1) * sizeof(*m_roiMap));
for (LegoAnimPresenterMap::iterator it = map.begin(); it != map.end();) {
for (LegoAnimStructMap::iterator it = map.begin(); it != map.end();) {
MxU32 index = (*it).second.m_index;
m_roiMap[index] = (*it).second.m_roi;
@@ -441,7 +441,7 @@ void LegoAnimPresenter::FUN_10069b10()
}
// FUNCTION: LEGO1 0x1006a3c0
void LegoAnimPresenter::FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi)
void LegoAnimPresenter::FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi)
{
LegoROI* roi = p_roi;
LegoChar* und = NULL;
@@ -494,13 +494,13 @@ void LegoAnimPresenter::FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode*
// FUNCTION: LEGO1 0x1006a4f0
void LegoAnimPresenter::FUN_1006a4f0(
LegoAnimPresenterMap& p_map,
LegoAnimStructMap& p_map,
LegoAnimNodeData* p_data,
const LegoChar* p_und,
LegoROI* p_roi
)
{
LegoAnimPresenterMap::iterator it;
LegoAnimStructMap::iterator it;
it = p_map.find(p_und);
if (it == p_map.end()) {

View File

@@ -1,10 +1,12 @@
#include "legohideanimpresenter.h"
#include "anim/legoanim.h"
#include "legomain.h"
#include "legoworld.h"
#include "misc.h"
DECOMP_SIZE_ASSERT(LegoHideAnimPresenter, 0xc4)
DECOMP_SIZE_ASSERT(LegoHideAnimStruct, 0x08)
// FUNCTION: LEGO1 0x1006d7e0
LegoHideAnimPresenter::LegoHideAnimPresenter()
@@ -31,7 +33,7 @@ LegoHideAnimPresenter::~LegoHideAnimPresenter()
// FUNCTION: LEGO1 0x1006da50
void LegoHideAnimPresenter::Init()
{
m_unk0xc0 = NULL;
m_boundaryMap = NULL;
}
// FUNCTION: LEGO1 0x1006da60
@@ -39,8 +41,8 @@ void LegoHideAnimPresenter::Destroy(MxBool p_fromDestructor)
{
m_criticalSection.Enter();
if (m_unk0xc0) {
delete m_unk0xc0;
if (m_boundaryMap) {
delete[] m_boundaryMap;
}
Init();
@@ -96,18 +98,119 @@ void LegoHideAnimPresenter::StartingTickle()
}
}
// STUB: LEGO1 0x1006db40
// FUNCTION: LEGO1 0x1006db40
// FUNCTION: BETA10 0x100531ab
void LegoHideAnimPresenter::FUN_1006db40(undefined4)
void LegoHideAnimPresenter::FUN_1006db40(LegoTime p_time)
{
// TODO
FUN_1006db60(m_anim->GetRoot(), p_time);
}
// STUB: LEGO1 0x1006dc10
// FUNCTION: LEGO1 0x1006db60
// FUNCTION: BETA10 0x100531de
void LegoHideAnimPresenter::FUN_1006db60(LegoTreeNode* p_node, LegoTime p_time)
{
LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData();
MxBool newB = FALSE;
MxBool previousB = FALSE;
if (m_roiMap != NULL) {
LegoROI* roi = m_roiMap[data->GetUnknown0x20()];
if (roi != NULL) {
newB = data->FUN_100a0990(p_time);
previousB = roi->GetVisibility();
roi->SetVisibility(newB);
}
}
if (m_boundaryMap != NULL) {
LegoPathBoundary* boundary = m_boundaryMap[data->GetUnknown0x22()];
if (boundary != NULL) {
newB = data->FUN_100a0990(p_time);
boundary->GetFlag0x10();
// TODO: Match
boundary->SetFlag0x10(newB);
}
}
for (MxS32 i = 0; i < p_node->GetNumChildren(); i++) {
FUN_1006db60(p_node->GetChild(i), p_time);
}
}
// FUNCTION: LEGO1 0x1006dc10
// FUNCTION: BETA10 0x100532fd
void LegoHideAnimPresenter::FUN_1006dc10()
{
// TODO
LegoHideAnimStructMap map;
FUN_1006e3f0(map, m_anim->GetRoot());
if (m_boundaryMap != NULL) {
delete[] m_boundaryMap;
}
m_boundaryMap = new LegoPathBoundary*[map.size() + 1];
m_boundaryMap[0] = NULL;
for (LegoHideAnimStructMap::iterator it = map.begin(); !(it == map.end()); it++) {
m_boundaryMap[(*it).second.m_index] = (*it).second.m_boundary;
delete[] const_cast<char*>((*it).first);
}
}
// FUNCTION: LEGO1 0x1006e3f0
// FUNCTION: BETA10 0x1005345e
void LegoHideAnimPresenter::FUN_1006e3f0(LegoHideAnimStructMap& p_map, LegoTreeNode* p_node)
{
LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData();
const char* name = data->GetName();
if (name != NULL) {
LegoPathBoundary* boundary = m_currentWorld->FindPathBoundary(name);
if (boundary != NULL) {
FUN_1006e470(p_map, data, name, boundary);
}
else {
data->SetUnknown0x22(0);
}
}
MxS32 count = p_node->GetNumChildren();
for (MxS32 i = 0; i < count; i++) {
FUN_1006e3f0(p_map, p_node->GetChild(i));
}
}
// FUNCTION: LEGO1 0x1006e470
// FUNCTION: BETA10 0x10053520
void LegoHideAnimPresenter::FUN_1006e470(
LegoHideAnimStructMap& p_map,
LegoAnimNodeData* p_data,
const char* p_name,
LegoPathBoundary* p_boundary
)
{
LegoHideAnimStructMap::iterator it;
it = p_map.find(p_name);
if (it == p_map.end()) {
LegoHideAnimStruct animStruct;
animStruct.m_index = p_map.size() + 1;
animStruct.m_boundary = p_boundary;
p_data->SetUnknown0x22(animStruct.m_index);
char* name = new char[strlen(p_name) + 1];
strcpy(name, p_name);
p_map[name] = animStruct;
}
else {
p_data->SetUnknown0x22((*it).second.m_index);
}
}
// FUNCTION: LEGO1 0x1006e9e0