Finish LegoPathPresenter (#721)

* Finish LegoPathPresenter

* Update legopathcontroller.cpp

* Fixes

* fix

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-03-24 17:30:04 -04:00 committed by GitHub
parent 3f6f59852f
commit 2e5d54c03e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 66 additions and 10 deletions

View file

@ -4,7 +4,9 @@
#include "decomp.h"
#include "legopathactor.h"
#include "mxcore.h"
class LegoPathBoundary;
class LegoWorld;
// VTABLE: LEGO1 0x100d7d60
// SIZE 0x40
@ -31,12 +33,13 @@ class LegoPathController : public MxCore {
// SYNTHETIC: LEGO1 0x10045740
// LegoPathController::`scalar deleting destructor'
virtual void VTable0x14(); // vtable+0x14
virtual void Destroy(); // vtable+0x18
virtual void VTable0x14(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger); // vtable+0x14
virtual void Destroy(); // vtable+0x18
undefined4 FUN_10046770(LegoPathActor* p_actor);
MxResult FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value);
void Enable(MxBool p_enable);
void FUN_10046bb0(LegoWorld* p_world);
private:
undefined4 m_unk0x08; // 0x08

View file

@ -39,7 +39,7 @@ class LegoPathPresenter : public MxMediaPresenter {
protected:
void Destroy(MxBool p_fromDestructor);
MxAtomId m_atomId; // 0x50
MxAtomId m_trigger; // 0x50
};
#endif // LEGOPATHPRESENTER_H

View file

@ -68,6 +68,7 @@ class LegoWorld : public LegoEntity {
void Remove(MxCore* p_object);
undefined4 FUN_1001fa70(IslePathActor* p_actor);
void FUN_1001fc80(IslePathActor* p_actor);
void AddPath(LegoPathController* p_controller);
MxResult GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value);
MxCore* Find(const char* p_class, const char* p_name);
MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId);

View file

@ -84,7 +84,7 @@ undefined4 g_unk0x100f66b4 = 0;
undefined4 g_unk0x100f66bc = 2;
// GLOBAL: LEGO1 0x100f66c0
char* g_debugPassword = "OGEL";
char g_debugPassword[] = "OGEL";
// GLOBAL: LEGO1 0x100f66c8
char* g_currentInput = g_debugPassword;

View file

@ -287,6 +287,13 @@ void LegoWorld::FUN_1001fc80(IslePathActor* p_actor)
}
}
// FUNCTION: LEGO1 0x1001ff80
void LegoWorld::AddPath(LegoPathController* p_controller)
{
p_controller->FUN_10046bb0(this);
m_list0x68.Append(p_controller);
}
// FUNCTION: LEGO1 0x10020120
MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
{

View file

@ -9,7 +9,7 @@ LegoPathController::LegoPathController()
}
// STUB: LEGO1 0x10045880
void LegoPathController::VTable0x14()
void LegoPathController::VTable0x14(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger)
{
// TODO
}
@ -39,6 +39,12 @@ MxResult LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_va
return SUCCESS;
}
// STUB: LEGO1 0x10046bb0
void LegoPathController::FUN_10046bb0(LegoWorld* p_world)
{
// TODO
}
// STUB: LEGO1 0x10046be0
void LegoPathController::Enable(MxBool p_enable)
{

View file

@ -3,9 +3,14 @@
#include "legovideomanager.h"
#include "misc.h"
#include "mxautolock.h"
#include "mxutilities.h"
DECOMP_SIZE_ASSERT(LegoPathPresenter, 0x54)
// STRING: LEGO1 0x10101ef0
// GLOBAL: LEGO1 0x101020c4
const char* g_triggersSource = "TRIGGERS_SOURCE";
// FUNCTION: LEGO1 0x100448d0
LegoPathPresenter::LegoPathPresenter()
{
@ -59,11 +64,31 @@ void LegoPathPresenter::Destroy()
Destroy(FALSE);
}
// STUB: LEGO1 0x10044c20
// FUNCTION: LEGO1 0x10044c20
void LegoPathPresenter::ReadyTickle()
{
// TODO
ProgressTickleState(e_starting); // Allow initialization process to continue
LegoWorld* currentWorld = CurrentWorld();
if (currentWorld) {
MxStreamChunk* chunk = m_subscriber->PopData();
if (chunk) {
LegoPathController* controller = new LegoPathController();
if (controller == NULL) {
EndAction();
}
else {
ParseExtra();
controller->VTable0x14(chunk->GetData(), m_action->GetLocation(), m_trigger);
currentWorld->AddPath(controller);
m_subscriber->FreeDataChunk(chunk);
ProgressTickleState(MxPresenter::e_starting);
}
}
}
}
// FUNCTION: LEGO1 0x10044d00
@ -90,8 +115,22 @@ void LegoPathPresenter::RepeatingTickle()
EndAction();
}
// STUB: LEGO1 0x10044d60
// FUNCTION: LEGO1 0x10044d60
void LegoPathPresenter::ParseExtra()
{
// TODO
MxU16 extraLength;
char* extraData;
m_action->GetExtra(extraLength, extraData);
if (extraLength & MAXWORD) {
char extraCopy[256], output[256];
memcpy(extraCopy, extraData, extraLength & MAXWORD);
extraCopy[extraLength & MAXWORD] = '\0';
strupr(extraCopy);
if (KeyValueStringParse(output, g_triggersSource, extraCopy) != FALSE) {
m_trigger = MxAtomId(output, e_lowerCase2);
}
}
}