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()
|
|
|
|
{
|
2024-01-14 16:49:11 -05:00
|
|
|
m_entity = NULL;
|
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
|
2024-01-14 16:49:11 -05:00
|
|
|
undefined4 LegoEntityPresenter::SetEntity(LegoEntity* p_entity)
|
2023-11-02 06:54:08 -04:00
|
|
|
{
|
2024-01-14 16:49:11 -05:00
|
|
|
m_entity = p_entity;
|
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()) {
|
2024-01-14 16:49:11 -05:00
|
|
|
VideoManager()->UnregisterPresenter(*this);
|
2023-11-02 06:54:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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()) {
|
2024-01-14 16:49:11 -05:00
|
|
|
VideoManager()->RegisterPresenter(*this);
|
2023-12-26 17:42:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100536c0
|
|
|
|
void LegoEntityPresenter::ReadyTickle()
|
|
|
|
{
|
|
|
|
if (GetCurrentWorld()) {
|
2024-01-14 16:49:11 -05:00
|
|
|
m_entity = (LegoEntity*) MxPresenter::CreateEntity("LegoEntity");
|
|
|
|
if (m_entity) {
|
|
|
|
m_entity->Create(*m_action);
|
|
|
|
m_entity->SetLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), TRUE);
|
2023-12-26 17:42:29 -05:00
|
|
|
ParseExtra();
|
|
|
|
}
|
2024-01-11 10:02:55 -05:00
|
|
|
ProgressTickleState(TickleState_Starting);
|
2023-12-26 17:42:29 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10053720
|
|
|
|
void LegoEntityPresenter::RepeatingTickle()
|
|
|
|
{
|
|
|
|
if (m_list.empty()) {
|
|
|
|
EndAction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-26 19:45:48 -05:00
|
|
|
// FUNCTION: LEGO1 0x10053730
|
2024-01-14 16:49:11 -05:00
|
|
|
void LegoEntityPresenter::SetEntityLocation(
|
2024-01-12 19:34:38 -05:00
|
|
|
Mx3DPointFloat& p_location,
|
|
|
|
Mx3DPointFloat& p_direction,
|
|
|
|
Mx3DPointFloat& p_up
|
|
|
|
)
|
2023-12-26 19:45:48 -05:00
|
|
|
{
|
2024-01-14 16:49:11 -05:00
|
|
|
if (m_entity) {
|
|
|
|
m_entity->SetLocation(p_location, p_direction, p_up, TRUE);
|
2023-12-26 19:45:48 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
2024-01-14 16:49:11 -05:00
|
|
|
m_entity->ParseAction(data);
|
2023-12-26 17:42:29 -05:00
|
|
|
}
|
|
|
|
}
|