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
7 changed files with 66 additions and 10 deletions

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);
}
}
}