Lego entity implementation

This commit is contained in:
Misha 2023-12-26 13:21:30 -05:00
parent 17522b98d4
commit 028021a321
No known key found for this signature in database
GPG Key ID: 8441D12AEF33FED8
6 changed files with 79 additions and 6 deletions

View File

@ -19,6 +19,9 @@ const char* g_strWORLD = "WORLD";
// GLOBAL: LEGO1 0x10101f20
const char* g_strSOUND = "SOUND";
// GLOBAL: LEGO1 0x10101f58
const char* g_strOBJECT = "OBJECT";
// GLOBAL: LEGO1 0x10102040
const char* g_strACTION = "ACTION";

View File

@ -7,6 +7,7 @@ extern MxU32 g_mxcoreCount[101];
extern const char* g_parseExtraTokens;
extern const char* g_strWORLD;
extern const char* g_strSOUND;
extern const char* g_strOBJECT;
extern const char* g_strACTION;
extern const char* g_strVISIBILITY;

View File

@ -1,5 +1,6 @@
#include "legoentitypresenter.h"
#include "islepathactor.h"
#include "legoomni.h"
#include "legovideomanager.h"
@ -24,7 +25,7 @@ LegoEntityPresenter::~LegoEntityPresenter()
}
// FUNCTION: LEGO1 0x10053630
undefined4 LegoEntityPresenter::VTable0x6c(undefined4 p_unk0x4c)
undefined4 LegoEntityPresenter::VTable0x6c(IslePathActor* p_unk0x4c)
{
m_unk0x4c = p_unk0x4c;
return 0;
@ -45,3 +46,43 @@ 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()->AddPresenter(*this);
}
return result;
}
// STUB: LEGO1 0x100536c0
void LegoEntityPresenter::ReadyTickle()
{
// TODO
}
// FUNCTION: LEGO1 0x10053720
void LegoEntityPresenter::RepeatingTickle()
{
if (m_list.size() == 0) {
EndAction();
}
}
// 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_unk0x4c->ParseAction(data);
}
}

View File

@ -3,6 +3,8 @@
#include "mxcompositepresenter.h"
class IslePathActor;
// VTABLE: LEGO1 0x100d8398
// SIZE 0x50
class LegoEntityPresenter : public MxCompositePresenter {
@ -23,14 +25,18 @@ class LegoEntityPresenter : public MxCompositePresenter {
return !strcmp(p_name, LegoEntityPresenter::ClassName()) || MxCompositePresenter::IsA(p_name);
}
virtual void Destroy() override; // vtable+0x38
virtual void Init(); // vtable+0x68
virtual undefined4 VTable0x6c(undefined4 p_unk0x4c); // vtable+0x6c
virtual void ReadyTickle() override; // vtable+0x18
virtual void RepeatingTickle(); // vtable+0x24
virtual void ParseExtra(); // vtable+0x30
virtual void Destroy() override; // vtable+0x38
virtual MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c
virtual void Init(); // vtable+0x68
virtual undefined4 VTable0x6c(IslePathActor* p_unk0x4c); // vtable+0x6c
private:
void Destroy(MxBool p_fromDestructor);
undefined4 m_unk0x4c;
IslePathActor* m_unk0x4c;
};
#endif // LEGOENTITYPRESENTER_H

View File

@ -2,6 +2,7 @@
#include "decomp.h"
#include "define.h"
#include "legoobjectfactory.h"
#include "legoomni.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h"
@ -304,6 +305,27 @@ const char* PresenterNameDispatch(const MxDSAction& p_action)
return name;
}
// FUNCTION: LEGO1 0x100b5410
void MxPresenter::FUN_100b5410(const char* p_name)
{
char buffer[512];
char buffer2[512];
strcpy(buffer, p_name);
MxU16 extraLen = m_action->GetExtraLength();
buffer[0] = extraLen;
buffer[1] = extraLen >> 8;
if (extraLen) {
extraLen &= MAXWORD;
memcpy(buffer2 + 2, m_action->GetExtraData(), extraLen);
buffer2[extraLen + 2] = 0;
KeyValueStringParse(buffer, g_strOBJECT, buffer2 + 2);
}
ObjectFactory()->Create(buffer);
}
// FUNCTION: LEGO1 0x100b54c0
MxBool MxPresenter::IsEnabled()
{

View File

@ -64,7 +64,7 @@ class MxPresenter : public MxCore {
virtual MxResult PutData(); // vtable+0x4c
virtual MxBool IsHit(MxS32 p_x, MxS32 p_y); // vtable+0x50
__declspec(dllexport) virtual void Enable(MxBool p_enable); // vtable+0x54
void FUN_100b5410(const char* p_name);
MxBool IsEnabled();
inline MxS32 GetCurrentTickleState() const { return this->m_currentTickleState; }