implement LegoActorPresenter (#434)

* LegoActorPresenter

* Add ddtor

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-01-13 17:06:13 -05:00 committed by GitHub
parent 5b8ea35756
commit 8b34b38ac0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 0 deletions

View file

@ -60,6 +60,7 @@ add_library(lego1 SHARED
LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp
LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp
LEGO1/lego/legoomni/src/entity/legoactor.cpp LEGO1/lego/legoomni/src/entity/legoactor.cpp
LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp
LEGO1/lego/legoomni/src/entity/legoanimactor.cpp LEGO1/lego/legoomni/src/entity/legoanimactor.cpp
LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp
LEGO1/lego/legoomni/src/entity/legoentity.cpp LEGO1/lego/legoomni/src/entity/legoentity.cpp

View file

@ -7,6 +7,8 @@
// SIZE 0x50 // SIZE 0x50
class LegoActorPresenter : public LegoEntityPresenter { class LegoActorPresenter : public LegoEntityPresenter {
public: public:
virtual ~LegoActorPresenter() override{};
// FUNCTION: LEGO1 0x1000cb10 // FUNCTION: LEGO1 0x1000cb10
inline virtual const char* ClassName() const override // vtable+0x0c inline virtual const char* ClassName() const override // vtable+0x0c
{ {
@ -19,6 +21,13 @@ class LegoActorPresenter : public LegoEntityPresenter {
{ {
return !strcmp(p_name, LegoActorPresenter::ClassName()) || LegoEntityPresenter::IsA(p_name); return !strcmp(p_name, LegoActorPresenter::ClassName()) || LegoEntityPresenter::IsA(p_name);
} }
virtual void ReadyTickle() override; // vtable+0x18
virtual void StartingTickle() override; // vtable+0x1c
virtual void ParseExtra() override; // vtable+0x30
}; };
// SYNTHETIC: LEGO1 0x1000cc30
// LegoActorPresenter::`scalar deleting destructor'
#endif // LEGOACTORPRESENTER_H #endif // LEGOACTORPRESENTER_H

View file

@ -52,6 +52,8 @@ class LegoEntity : public MxEntity {
void FUN_10010c30(); void FUN_10010c30();
void SetLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direction, Mx3DPointFloat& p_up, MxBool); void SetLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direction, Mx3DPointFloat& p_up, MxBool);
inline LegoROI* GetROI() { return m_roi; }
protected: protected:
void Init(); void Init();
void SetWorld(); void SetWorld();

View file

@ -0,0 +1,39 @@
#include "legoactorpresenter.h"
#include "legoentity.h"
#include "legoomni.h"
// FUNCTION: LEGO1 0x10076c30
void LegoActorPresenter::ReadyTickle()
{
if (GetCurrentWorld()) {
m_objectBackend = (LegoEntity*) CreateEntityBackend("LegoActor");
if (m_objectBackend) {
SetBackendLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp());
m_objectBackend->Create(*m_action);
}
ProgressTickleState(TickleState_Starting);
}
}
// FUNCTION: LEGO1 0x10076c90
void LegoActorPresenter::StartingTickle()
{
if (m_objectBackend->GetROI()) {
ProgressTickleState(TickleState_Streaming);
ParseExtra();
}
}
// FUNCTION: LEGO1 0x10076cc0
void LegoActorPresenter::ParseExtra()
{
char buffer[512];
char* extraData = m_action->GetExtraData();
if (m_action->GetExtraLength()) {
memcpy(buffer, extraData, m_action->GetExtraLength());
buffer[m_action->GetExtraLength()] = 0;
m_objectBackend->ParseAction(buffer);
}
}