2023-06-29 04:10:08 -04:00
|
|
|
#include "legoentitypresenter.h"
|
|
|
|
|
2023-12-26 17:42:29 -05:00
|
|
|
#include "islepathactor.h"
|
2023-11-02 06:54:08 -04:00
|
|
|
#include "legoomni.h"
|
|
|
|
#include "legovideomanager.h"
|
|
|
|
|
|
|
|
DECOMP_SIZE_ASSERT(LegoEntityPresenter, 0x50);
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10053440
|
2023-06-29 04:10:08 -04:00
|
|
|
LegoEntityPresenter::LegoEntityPresenter()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
Init();
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100535c0
|
2023-11-02 06:54:08 -04:00
|
|
|
void LegoEntityPresenter::Init()
|
|
|
|
{
|
2023-12-26 17:42:29 -05:00
|
|
|
m_objectBackend = 0;
|
2023-11-02 06:54:08 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100535d0
|
2023-06-29 04:10:08 -04:00
|
|
|
LegoEntityPresenter::~LegoEntityPresenter()
|
|
|
|
{
|
2023-11-02 06:54:08 -04:00
|
|
|
Destroy(TRUE);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10053630
|
2023-12-26 17:42:29 -05:00
|
|
|
undefined4 LegoEntityPresenter::SetBackend(LegoEntity* p_backend)
|
2023-11-02 06:54:08 -04:00
|
|
|
{
|
2023-12-26 17:42:29 -05:00
|
|
|
m_objectBackend = p_backend;
|
2023-11-02 06:54:08 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10053640
|
2023-11-02 06:54:08 -04:00
|
|
|
void LegoEntityPresenter::Destroy(MxBool p_fromDestructor)
|
|
|
|
{
|
|
|
|
if (VideoManager()) {
|
|
|
|
VideoManager()->RemovePresenter(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10053670
|
2023-11-02 06:54:08 -04:00
|
|
|
void LegoEntityPresenter::Destroy()
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2023-11-02 06:54:08 -04:00
|
|
|
Destroy(FALSE);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2023-12-26 17:42:29 -05:00
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10053680
|
|
|
|
MxResult LegoEntityPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
|
|
|
|
{
|
|
|
|
MxResult result = MxCompositePresenter::StartAction(p_controller, p_action);
|
|
|
|
|
|
|
|
if (VideoManager()) {
|
|
|
|
VideoManager()->AddPresenter(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100536c0
|
|
|
|
void LegoEntityPresenter::ReadyTickle()
|
|
|
|
{
|
|
|
|
if (GetCurrentWorld()) {
|
|
|
|
m_objectBackend = (LegoEntity*) MxPresenter::CreateEntityBackend("LegoEntity");
|
|
|
|
if (m_objectBackend) {
|
|
|
|
m_objectBackend->Create(*m_action);
|
|
|
|
m_objectBackend->SetLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), TRUE);
|
|
|
|
ParseExtra();
|
|
|
|
}
|
|
|
|
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
|
|
|
|
m_currentTickleState = TickleState_Starting;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10053720
|
|
|
|
void LegoEntityPresenter::RepeatingTickle()
|
|
|
|
{
|
|
|
|
if (m_list.empty()) {
|
|
|
|
EndAction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-26 19:45:48 -05:00
|
|
|
// FUNCTION: LEGO1 0x10053730
|
|
|
|
void LegoEntityPresenter::SetBackendLocation(Vector3Data& p_location, Vector3Data& p_direction, Vector3Data& p_up)
|
|
|
|
{
|
|
|
|
if (m_objectBackend) {
|
|
|
|
m_objectBackend->SetLocation(p_location, p_direction, p_up, TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-26 17:42:29 -05:00
|
|
|
// FUNCTION: LEGO1 0x10053750
|
|
|
|
void LegoEntityPresenter::ParseExtra()
|
|
|
|
{
|
|
|
|
char data[512];
|
|
|
|
MxU16 len = m_action->GetExtraLength();
|
|
|
|
if (len) {
|
|
|
|
memcpy(data, m_action->GetExtraData(), len);
|
|
|
|
data[len] = 0;
|
|
|
|
|
|
|
|
len &= MAXWORD;
|
|
|
|
m_objectBackend->ParseAction(data);
|
|
|
|
}
|
|
|
|
}
|