isle-portable/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp
Nathan M Gilbert fca8f74bd8
Fix Annotations and LegoAnimActor class structure. (#710)
* Fix size annotations for legoomni
Fix structure and add placeholder annotations for LegoAnimActor and subclasses

* Fix LegoCarRaceActor constructor
Fix function name in LegoRaceCar

* Add size assertions for legoomni and fix sizes

* Various style fixes

* Use other marker so vtable.py doesn't compare

* Revert "Use other marker so vtable.py doesn't compare"

This reverts commit 608985cd73856598b95c15aed9f8f022645e9e7a.

* Fix copy/paste error

* Remove stale comment.

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
2024-03-22 21:30:58 -04:00

106 lines
2.2 KiB
C++

#include "legoentitypresenter.h"
#include "islepathactor.h"
#include "legovideomanager.h"
#include "misc.h"
DECOMP_SIZE_ASSERT(LegoEntityPresenter, 0x50)
// FUNCTION: LEGO1 0x10053440
LegoEntityPresenter::LegoEntityPresenter()
{
Init();
}
// FUNCTION: LEGO1 0x100535c0
void LegoEntityPresenter::Init()
{
m_entity = NULL;
}
// FUNCTION: LEGO1 0x100535d0
LegoEntityPresenter::~LegoEntityPresenter()
{
Destroy(TRUE);
}
// FUNCTION: LEGO1 0x10053630
undefined4 LegoEntityPresenter::SetEntity(LegoEntity* p_entity)
{
m_entity = p_entity;
return 0;
}
// FUNCTION: LEGO1 0x10053640
void LegoEntityPresenter::Destroy(MxBool p_fromDestructor)
{
if (VideoManager()) {
VideoManager()->UnregisterPresenter(*this);
}
Init();
}
// FUNCTION: LEGO1 0x10053670
void LegoEntityPresenter::Destroy()
{
Destroy(FALSE);
}
// FUNCTION: LEGO1 0x10053680
MxResult LegoEntityPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{
MxResult result = MxCompositePresenter::StartAction(p_controller, p_action);
if (VideoManager()) {
VideoManager()->RegisterPresenter(*this);
}
return result;
}
// FUNCTION: LEGO1 0x100536c0
void LegoEntityPresenter::ReadyTickle()
{
if (CurrentWorld()) {
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);
ParseExtra();
}
ProgressTickleState(e_starting);
}
}
// FUNCTION: LEGO1 0x10053720
void LegoEntityPresenter::RepeatingTickle()
{
if (m_list.empty()) {
EndAction();
}
}
// FUNCTION: LEGO1 0x10053730
void LegoEntityPresenter::SetEntityLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up)
{
if (m_entity) {
m_entity->SetLocation(p_location, p_direction, p_up, TRUE);
}
}
// FUNCTION: LEGO1 0x10053750
void LegoEntityPresenter::ParseExtra()
{
MxU16 extraLength;
char* extraData;
m_action->GetExtra(extraLength, extraData);
if (extraLength & MAXWORD) {
char extraCopy[512];
memcpy(extraCopy, extraData, extraLength & MAXWORD);
extraCopy[extraLength & MAXWORD] = '\0';
m_entity->ParseAction(extraCopy);
}
}