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 "legovideomanager.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "misc.h"
|
2023-11-02 06:54:08 -04:00
|
|
|
|
2024-03-22 21:30:58 -04:00
|
|
|
DECOMP_SIZE_ASSERT(LegoEntityPresenter, 0x50)
|
2023-11-02 06:54:08 -04:00
|
|
|
|
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()
|
|
|
|
{
|
2024-02-02 12:18:46 -05:00
|
|
|
if (CurrentWorld()) {
|
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-17 11:53:53 -05:00
|
|
|
ProgressTickleState(e_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-03-03 20:34:55 -05:00
|
|
|
void LegoEntityPresenter::SetEntityLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& 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()
|
|
|
|
{
|
2024-02-29 13:15:20 -05:00
|
|
|
MxU16 extraLength;
|
|
|
|
char* extraData;
|
|
|
|
m_action->GetExtra(extraLength, extraData);
|
|
|
|
|
2024-08-17 11:56:25 -04:00
|
|
|
if (extraLength) {
|
2024-02-29 13:15:20 -05:00
|
|
|
char extraCopy[512];
|
2024-08-17 11:56:25 -04:00
|
|
|
memcpy(extraCopy, extraData, extraLength);
|
|
|
|
extraCopy[extraLength] = '\0';
|
2024-02-29 13:15:20 -05:00
|
|
|
|
|
|
|
m_entity->ParseAction(extraCopy);
|
2023-12-26 17:42:29 -05:00
|
|
|
}
|
|
|
|
}
|