Implement/match ViewManager::RemoveAll (#616)

* Implement/match ViewManager::RemoveAll

* Use const_iterator

* const

* Naming
This commit is contained in:
Christian Semmler 2024-03-02 14:26:19 -05:00 committed by GitHub
parent 6de17cf1b6
commit de5cd98b76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 52 additions and 18 deletions

View file

@ -65,7 +65,7 @@ protected:
void FUN_100692b0();
void FUN_100695c0();
LegoChar* FUN_100697c0(const LegoChar* p_und1, const LegoChar* p_und2);
LegoBool FUN_100698b0(const CompoundObject& p_und1, const LegoChar* p_und2);
LegoBool FUN_100698b0(const CompoundObject& p_rois, const LegoChar* p_und2);
void FUN_10069b10();
LegoBool FUN_1006aba0();
LegoBool FUN_1006abb0(LegoTreeNode*, undefined4);

View file

@ -547,7 +547,7 @@ void LegoWorld::Enable(MxBool p_enable)
while (cursor.Next(entity)) {
if (entity->GetROI()) {
entity->GetROI()->SetUnknown0x104(entity);
GetViewManager()->AddToUnknown0x08(entity->GetROI());
GetViewManager()->Add(entity->GetROI());
}
}
}

View file

@ -829,10 +829,10 @@ void LegoOmni::DeleteObject(MxDSAction& p_dsAction)
LegoROI* LegoOmni::FindROI(const char* p_name)
{
ViewManager* viewManager = GetVideoManager()->Get3DManager()->GetLego3DView()->GetViewManager();
CompoundObject& unk0x08 = viewManager->GetUnknown0x08();
const CompoundObject& rois = viewManager->GetROIs();
if (p_name != NULL && *p_name != '\0' && unk0x08.size() > 0) {
for (CompoundObject::iterator it = unk0x08.begin(); it != unk0x08.end(); it++) {
if (p_name != NULL && *p_name != '\0' && rois.size() > 0) {
for (CompoundObject::const_iterator it = rois.begin(); it != rois.end(); it++) {
LegoROI* roi = (LegoROI*) *it;
const char* name = roi->GetName();

View file

@ -218,11 +218,11 @@ void LegoAnimPresenter::FUN_100695c0()
m_unk0x70 = new LegoROIList();
if (m_unk0x70) {
CompoundObject& unk0x08 = VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->GetUnknown0x08();
const CompoundObject& rois = VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->GetROIs();
LegoU32 numActors = m_anim->GetNumActors();
for (LegoU32 i = 0; i < numActors; i++) {
if (FUN_100698b0(unk0x08, m_anim->GetActorName(i)) == FALSE) {
if (FUN_100698b0(rois, m_anim->GetActorName(i)) == FALSE) {
undefined4 unk0x04 = m_anim->GetActorUnknown0x04(i);
if (unk0x04 == 5 || unk0x04 == 6) {
@ -239,7 +239,7 @@ void LegoAnimPresenter::FUN_100695c0()
strlwr(dest);
UnkSaveDataWriter()->FUN_10085210(str, dest, 0);
FUN_100698b0(unk0x08, str);
FUN_100698b0(rois, str);
}
}
}
@ -274,7 +274,7 @@ LegoChar* LegoAnimPresenter::FUN_100697c0(const LegoChar* p_und1, const LegoChar
}
// FUNCTION: LEGO1 0x100698b0
LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_und1, const LegoChar* p_und2)
LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_rois, const LegoChar* p_und2)
{
LegoBool result = FALSE;
@ -285,8 +285,8 @@ LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_und1, const Leg
str = tmp;
}
if (str != NULL && *str != '\0' && p_und1.size() > 0) {
for (CompoundObject::const_iterator it = p_und1.begin(); it != p_und1.end(); it++) {
if (str != NULL && *str != '\0' && p_rois.size() > 0) {
for (CompoundObject::const_iterator it = p_rois.begin(); it != p_rois.end(); it++) {
LegoROI* roi = (LegoROI*) *it;
const char* name = roi->GetName();

View file

@ -32,8 +32,39 @@ ViewManager::~ViewManager()
SetPOVSource(NULL);
}
// STUB: LEGO1 0x100a64d0
void ViewManager::RemoveAll(ViewROI*)
// FUNCTION: LEGO1 0x100a64d0
void ViewManager::RemoveAll(ViewROI* p_roi)
{
if (p_roi == NULL) {
for (CompoundObject::iterator it = rois.begin(); !(it == rois.end()); it++) {
ViewROI* roi = (ViewROI*) *it;
RemoveAll(roi);
}
rois.erase(rois.begin(), rois.end());
}
else {
if (p_roi->GetUnknown0xe0() >= 0) {
FUN_100a66a0(p_roi);
}
p_roi->SetUnknown0xe0(-1);
const CompoundObject* comp = p_roi->GetComp();
if (comp != NULL) {
for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) {
ViewROI* roi = (ViewROI*) *it;
if (roi != NULL) {
RemoveAll(roi);
}
}
}
}
}
// STUB: LEGO1 0x100a66a0
void ViewManager::FUN_100a66a0(ViewROI* p_roi)
{
// TODO
}

View file

@ -21,8 +21,8 @@ public:
ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view);
virtual ~ViewManager();
void RemoveAll(ViewROI*);
void RemoveAll(ViewROI* p_roi);
void FUN_100a66a0(ViewROI* p_roi);
void SetPOVSource(const OrientableROI* point_of_view);
void SetResolution(int width, int height);
void SetFrustrum(float fov, float front, float back);
@ -31,13 +31,13 @@ public:
// SYNTHETIC: LEGO1 0x100a6000
// ViewManager::`scalar deleting destructor'
inline CompoundObject& GetUnknown0x08() { return unk0x08; }
inline const CompoundObject& GetROIs() { return rois; }
inline void AddToUnknown0x08(ViewROI* p_roi) { unk0x08.push_back(p_roi); }
inline void Add(ViewROI* p_roi) { rois.push_back(p_roi); }
private:
Tgl::Group* scene; // 0x04
CompoundObject unk0x08; // 0x08
CompoundObject rois; // 0x08
RealtimeView rt_view; // 0x14
ROIList visible_rois; // 0x18
float unk0x28; // 0x28

View file

@ -56,6 +56,9 @@ public:
virtual const Tgl::Group* GetGeometry() const; // vtable+0x34
virtual Tgl::Group* GetGeometry(); // vtable+0x30
inline int GetUnknown0xe0() { return m_unk0xe0; }
inline void SetUnknown0xe0(int p_unk0xe0) { m_unk0xe0 = p_unk0xe0; }
static undefined SetUnk101013d8(undefined p_flag);
protected: