Implement LegoModelPresenter::ReadyTickle (#546)

* Implement LegoModelPresenter::ReadyTickle

* Update legoworld.h

* Fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-02-09 18:41:35 -05:00 committed by GitHub
parent 84af3e2158
commit 223b07ee3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 82 additions and 3 deletions

View file

@ -56,11 +56,14 @@ public:
virtual void VTable0x4c(); // vtable+0x4c
void FUN_10010c30();
void FUN_100114e0(MxU8 p_unk0x59);
void SetLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direction, Mx3DPointFloat& p_up, MxBool);
inline LegoROI* GetROI() { return m_roi; }
inline MxU8 GetFlags() { return m_flags; }
inline void SetFlags(MxU8 p_flags) { m_flags = p_flags; }
protected:
void Init();
void SetWorld();

View file

@ -35,6 +35,8 @@ public:
void SetEntityLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direction, Mx3DPointFloat& p_up);
inline LegoEntity* GetEntity() { return m_entity; }
// SYNTHETIC: LEGO1 0x100535a0
// LegoEntityPresenter::`scalar deleting destructor'

View file

@ -37,6 +37,8 @@ protected:
private:
AutoROI* m_unk0x64; // 0x64
MxBool m_addedToView; // 0x68
undefined4 LoadModel(MxStreamChunk* p_chunk);
};
#endif // LEGOMODELPRESENTER_H

View file

@ -163,6 +163,12 @@ void LegoEntity::VTable0x4c()
// TODO
}
// FUNCTION: LEGO1 0x100114e0
void LegoEntity::FUN_100114e0(MxU8 p_unk0x59)
{
m_unk0x59 = p_unk0x59;
}
// STUB: LEGO1 0x100114f0
MxLong LegoEntity::Notify(MxParam& p_param)
{

View file

@ -1,5 +1,11 @@
#include "legomodelpresenter.h"
#include "legoentity.h"
#include "legoentitypresenter.h"
#include "legoomni.h"
#include "legovideomanager.h"
#include "mxcompositepresenter.h"
// GLOBAL: LEGO1 0x100f7ae0
int g_modelPresenterConfig = 1;
@ -22,16 +28,76 @@ void LegoModelPresenter::Destroy(MxBool p_fromDestructor)
m_unk0x64 = 0;
m_addedToView = FALSE;
m_criticalSection.Leave();
if (!p_fromDestructor) {
MxVideoPresenter::Destroy(FALSE);
}
}
// STUB: LEGO1 0x10080050
void LegoModelPresenter::ReadyTickle()
// STUB: LEGO1 0x1007f6b0
undefined4 LegoModelPresenter::LoadModel(MxStreamChunk* p_chunk)
{
// TODO
SetTickleState(e_starting);
return 0;
}
// FUNCTION: LEGO1 0x10080050
void LegoModelPresenter::ReadyTickle()
{
if (m_compositePresenter != NULL && m_compositePresenter->IsA("LegoEntityPresenter") &&
m_compositePresenter->GetCurrentTickleState() <= e_ready) {
return;
}
ParseExtra();
if (m_unk0x64 != NULL) {
if (m_compositePresenter && m_compositePresenter->IsA("LegoEntityPresenter")) {
((LegoEntityPresenter*) m_compositePresenter)
->GetEntity()
->SetROI((LegoROI*) m_unk0x64, m_addedToView, TRUE);
((LegoEntityPresenter*) m_compositePresenter)
->GetEntity()
->SetFlags(
((LegoEntityPresenter*) m_compositePresenter)->GetEntity()->GetFlags() & ~LegoEntity::c_bit2
);
((LegoEntityPresenter*) m_compositePresenter)->GetEntity()->FUN_100114e0(0);
}
ParseExtra();
ProgressTickleState(e_starting);
EndAction();
}
else {
MxStreamChunk* chunk = m_subscriber->CurrentChunk();
if (chunk != NULL && chunk->GetTime() <= m_action->GetElapsedTime()) {
chunk = m_subscriber->NextChunk();
undefined4 und = LoadModel(chunk);
m_subscriber->DestroyChunk(chunk);
if (und == 0) {
VideoManager()->Get3DManager()->GetLego3DView()->Add(*m_unk0x64);
VideoManager()->Get3DManager()->GetLego3DView()->Moved(*m_unk0x64);
if (m_compositePresenter != NULL && m_compositePresenter->IsA("LegoEntityPresenter")) {
((LegoEntityPresenter*) m_compositePresenter)
->GetEntity()
->SetROI((LegoROI*) m_unk0x64, TRUE, TRUE);
((LegoEntityPresenter*) m_compositePresenter)
->GetEntity()
->SetFlags(
((LegoEntityPresenter*) m_compositePresenter)->GetEntity()->GetFlags() & ~LegoEntity::c_bit2
);
}
ParseExtra();
ProgressTickleState(e_starting);
}
EndAction();
}
}
}
// STUB: LEGO1 0x100801b0