begin LegoLocomotionAnimPresenter (#474)

* LegoLocomotionAnimPresenter

* Fix game startup

* Fixes

* Add size assert

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-01-21 09:58:15 -05:00 committed by GitHub
parent b4bc0e51c9
commit 3f35302e76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 84 additions and 22 deletions

View file

@ -42,7 +42,7 @@ class LegoAnimPresenter : public MxVideoPresenter {
// 6 more virtual functions here // 6 more virtual functions here
private: protected:
void Init(); void Init();
void Destroy(MxBool p_fromDestructor); void Destroy(MxBool p_fromDestructor);

View file

@ -4,9 +4,11 @@
#include "legoloopinganimpresenter.h" #include "legoloopinganimpresenter.h"
// VTABLE: LEGO1 0x100d9170 // VTABLE: LEGO1 0x100d9170
// SIZE 0xd8
class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter { class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter {
public: public:
LegoLocomotionAnimPresenter(); LegoLocomotionAnimPresenter();
virtual ~LegoLocomotionAnimPresenter() override;
// FUNCTION: LEGO1 0x1006ce50 // FUNCTION: LEGO1 0x1006ce50
inline const char* ClassName() const override // vtable+0xc inline const char* ClassName() const override // vtable+0xc
@ -35,6 +37,14 @@ class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter {
private: private:
void Init(); void Init();
void Destroy(MxBool p_fromDestructor);
undefined4 m_unk0xc0; // 0xc0
undefined4* m_unk0xc4; // 0xc4
MxCore* m_unk0xc8; // 0xc8
MxS32 m_unk0xcc; // 0xcc
MxS32 m_unk0xd0; // 0xd0
undefined2 m_unk0xd4; // 0xd4
}; };
#endif // LEGOLOCOMOTIONANIMPRESENTER_H #endif // LEGOLOCOMOTIONANIMPRESENTER_H

View file

@ -6,6 +6,7 @@
#include "mxcompositepresenter.h" #include "mxcompositepresenter.h"
#include "mxdsanim.h" #include "mxdsanim.h"
#include "mxstreamchunk.h" #include "mxstreamchunk.h"
#include "mxvideomanager.h"
DECOMP_SIZE_ASSERT(LegoAnimPresenter, 0xc0) DECOMP_SIZE_ASSERT(LegoAnimPresenter, 0xc0)
DECOMP_SIZE_ASSERT(LegoAnimClassBase, 0x08) DECOMP_SIZE_ASSERT(LegoAnimClassBase, 0x08)
@ -161,11 +162,10 @@ void LegoAnimPresenter::DoneTickle()
// TODO // TODO
} }
// STUB: LEGO1 0x1006b8d0 // FUNCTION: LEGO1 0x1006b8d0
MxResult LegoAnimPresenter::AddToManager() MxResult LegoAnimPresenter::AddToManager()
{ {
// TODO return MxVideoPresenter::AddToManager();
return SUCCESS;
} }
// FUNCTION: LEGO1 0x1006b8e0 // FUNCTION: LEGO1 0x1006b8e0

View file

@ -1,63 +1,115 @@
#include "legolocomotionanimpresenter.h" #include "legolocomotionanimpresenter.h"
#include "legoomni.h"
#include "legoworld.h"
DECOMP_SIZE_ASSERT(LegoLocomotionAnimPresenter, 0xd8)
// FUNCTION: LEGO1 0x1006cdd0 // FUNCTION: LEGO1 0x1006cdd0
LegoLocomotionAnimPresenter::LegoLocomotionAnimPresenter() LegoLocomotionAnimPresenter::LegoLocomotionAnimPresenter()
{ {
Init(); Init();
} }
// STUB: LEGO1 0x1006d0b0 // FUNCTION: LEGO1 0x1006d050
void LegoLocomotionAnimPresenter::Init() LegoLocomotionAnimPresenter::~LegoLocomotionAnimPresenter()
{ {
// TODO Destroy(TRUE);
} }
// STUB: LEGO1 0x1006d140 // FUNCTION: LEGO1 0x1006d0b0
void LegoLocomotionAnimPresenter::Init()
{
m_unk0xc0 = 0;
m_unk0xc4 = 0;
m_unk0xcc = -1;
m_unk0xd0 = -1;
m_unk0xc8 = 0;
m_unk0xd4 = 0;
}
// FUNCTION: LEGO1 0x1006d0e0
void LegoLocomotionAnimPresenter::Destroy(MxBool p_fromDestructor)
{
m_criticalSection.Enter();
if (m_unk0xc4) {
delete[] m_unk0xc4;
}
if (m_unk0xc8) {
delete m_unk0xc8;
}
m_unk0x68 = 0;
Init();
m_criticalSection.Leave();
if (!p_fromDestructor) {
LegoAnimPresenter::Destroy();
}
}
// FUNCTION: LEGO1 0x1006d140
MxResult LegoLocomotionAnimPresenter::VTable0x88(MxStreamChunk* p_chunk) MxResult LegoLocomotionAnimPresenter::VTable0x88(MxStreamChunk* p_chunk)
{ {
// TODO MxResult result = LegoAnimPresenter::VTable0x88(p_chunk);
return SUCCESS; return result == SUCCESS ? SUCCESS : result;
} }
// STUB: LEGO1 0x1006d160 // STUB: LEGO1 0x1006d160
MxResult LegoLocomotionAnimPresenter::AddToManager() MxResult LegoLocomotionAnimPresenter::AddToManager()
{ {
// TODO return MxVideoPresenter::AddToManager();
return SUCCESS;
} }
// STUB: LEGO1 0x1006d5b0 // FUNCTION: LEGO1 0x1006d5b0
void LegoLocomotionAnimPresenter::Destroy() void LegoLocomotionAnimPresenter::Destroy()
{ {
// TODO Destroy(FALSE);
} }
// STUB: LEGO1 0x1006d5c0 // FUNCTION: LEGO1 0x1006d5c0
void LegoLocomotionAnimPresenter::PutFrame() void LegoLocomotionAnimPresenter::PutFrame()
{ {
// TODO // Empty
} }
// STUB: LEGO1 0x1006d5d0 // FUNCTION: LEGO1 0x1006d5d0
void LegoLocomotionAnimPresenter::ReadyTickle() void LegoLocomotionAnimPresenter::ReadyTickle()
{ {
// TODO LegoAnimPresenter::ReadyTickle();
if (m_currentWorld != NULL && m_currentTickleState == e_starting) {
m_currentWorld->VTable0x58(this);
if (m_compositePresenter != NULL) {
SendToCompositePresenter(Lego());
}
m_unk0xd4++;
}
} }
// STUB: LEGO1 0x1006d610 // STUB: LEGO1 0x1006d610
void LegoLocomotionAnimPresenter::StartingTickle() void LegoLocomotionAnimPresenter::StartingTickle()
{ {
// TODO // TODO
EndAction();
} }
// STUB: LEGO1 0x1006d660 // FUNCTION: LEGO1 0x1006d660
void LegoLocomotionAnimPresenter::StreamingTickle() void LegoLocomotionAnimPresenter::StreamingTickle()
{ {
// TODO if (m_unk0xd4 == 0) {
EndAction();
}
} }
// STUB: LEGO1 0x1006d670 // FUNCTION: LEGO1 0x1006d670
void LegoLocomotionAnimPresenter::EndAction() void LegoLocomotionAnimPresenter::EndAction()
{ {
// TODO if (m_action) {
MxVideoPresenter::EndAction();
}
} }