Implement a few legoworld methods (#430)

* Push changes

* Update legoworld.cpp

* Update legoworld.cpp

* Minor style fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha
2024-01-13 15:00:11 -05:00
committed by GitHub
parent 7d2629318c
commit c2da041f40
23 changed files with 120 additions and 51 deletions

View File

@@ -27,9 +27,9 @@ Helicopter::~Helicopter()
}
// FUNCTION: LEGO1 0x100032c0
MxResult Helicopter::Create(MxDSObject& p_dsObject)
MxResult Helicopter::Create(MxDSAction& p_dsAction)
{
MxResult result = IslePathActor::Create(p_dsObject);
MxResult result = IslePathActor::Create(p_dsAction);
LegoWorld* world = GetCurrentWorld();
SetWorld(world);
if (world->IsA("Act3")) {

View File

@@ -12,6 +12,12 @@ LegoControlManager::~LegoControlManager()
// TODO
}
// STUB: LEGO1 0x10028df0
void LegoControlManager::FUN_10028df0(MxPresenterList* p_presenterList)
{
// TODO
}
// STUB: LEGO1 0x10028e10
void LegoControlManager::Register(MxCore* p_listener)
{

View File

@@ -42,10 +42,10 @@ void LegoEntity::SetWorldTransform(const Vector3& p_loc, const Vector3& p_dir, c
}
// FUNCTION: LEGO1 0x100107e0
MxResult LegoEntity::Create(MxDSObject& p_dsObject)
MxResult LegoEntity::Create(MxDSAction& p_dsAction)
{
m_mxEntityId = p_dsObject.GetObjectId();
m_atom = p_dsObject.GetAtomId();
m_mxEntityId = p_dsAction.GetObjectId();
m_atom = p_dsAction.GetAtomId();
Init();
return SUCCESS;
}

View File

@@ -100,6 +100,12 @@ MxResult LegoPointOfViewController::Create(Lego3DView* p_lego3DView)
return SUCCESS;
}
// FUNCTION: LEGO1 0x100658a0
void LegoPointOfViewController::OnViewSize(int p_width, int p_height)
{
m_nav->SetControlMax(p_width, p_height);
}
// FUNCTION: LEGO1 0x100658c0
void LegoPointOfViewController::LeftDown(int p_x, int p_y)
{

View File

@@ -62,7 +62,7 @@ MxBool LegoRace::VTable0x64()
}
// STUB: LEGO1 0x10015ce0
MxResult LegoRace::Create(MxDSObject& p_dsObject)
MxResult LegoRace::Create(MxDSAction& p_dsAction)
{
// TODO
return SUCCESS;

View File

@@ -1,8 +1,10 @@
#include "legoworld.h"
#include "legocontrolmanager.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "legoutil.h"
#include "legovideomanager.h"
#include "mxactionnotificationparam.h"
#include "mxnotificationmanager.h"
#include "mxnotificationparam.h"
@@ -39,10 +41,28 @@ LegoWorld::~LegoWorld()
}
// STUB: LEGO1 0x1001e0b0
MxResult LegoWorld::SetAsCurrentWorld(MxDSObject& p_dsObject)
MxResult LegoWorld::Create(MxDSAction& p_dsAction)
{
// TODO
return SUCCESS;
MxEntity::Create(p_dsAction);
// TODO: Intitialize lists
if (VTable0x54()) {
if (p_dsAction.GetFlags() & MxDSAction::Flag_Enabled) {
if (GetCurrentWorld()) {
GetCurrentWorld()->VTable0x68(0);
}
SetCurrentWorld(this);
ControlManager()->FUN_10028df0(&m_list0xb8);
}
SetIsWorldActive(TRUE);
m_unk0xec = -1;
return SUCCESS;
}
return FAILURE;
}
// FUNCTION: LEGO1 0x1001f5e0
@@ -63,10 +83,37 @@ MxLong LegoWorld::Notify(MxParam& p_param)
return ret;
}
// STUB: LEGO1 0x1001f630
void LegoWorld::VTable0x54()
// FUNCTION: LEGO1 0x1001f630
LegoCameraController* LegoWorld::VTable0x54()
{
// TODO
MxBool success = FALSE;
if (!VideoManager()) {
goto done;
}
if (!(m_cameraController = new LegoCameraController())) {
goto done;
}
if (m_cameraController->Create() != SUCCESS) {
goto done;
}
m_cameraController->OnViewSize(
VideoManager()->GetVideoParam().GetRect().GetWidth(),
VideoManager()->GetVideoParam().GetRect().GetHeight()
);
success = TRUE;
done:
if (!success) {
if (m_cameraController) {
delete m_cameraController;
m_cameraController = NULL;
}
}
return m_cameraController;
}
// STUB: LEGO1 0x1001fc80

View File

@@ -13,7 +13,7 @@ Infocenter::~Infocenter()
}
// STUB: LEGO1 0x1006ed90
MxResult Infocenter::Create(MxDSObject& p_dsObject)
MxResult Infocenter::Create(MxDSAction& p_dsAction)
{
return FAILURE;
}

View File

@@ -39,9 +39,9 @@ Score::~Score()
}
// FUNCTION: LEGO1 0x100012a0
MxResult Score::Create(MxDSObject& p_dsObject)
MxResult Score::Create(MxDSAction& p_dsAction)
{
MxResult result = SetAsCurrentWorld(p_dsObject);
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
InputManager()->SetWorld(this);

View File

@@ -54,11 +54,11 @@ Isle::~Isle()
}
// FUNCTION: LEGO1 0x10030b20
MxResult Isle::Create(MxDSObject& p_dsObject)
MxResult Isle::Create(MxDSAction& p_dsAction)
{
GameState()->FUN_1003ceb0();
MxResult result = LegoWorld::SetAsCurrentWorld(p_dsObject);
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
ControlManager()->Register(this);
InputManager()->SetWorld(this);

View File

@@ -12,9 +12,9 @@ IslePathActor::IslePathActor()
}
// FUNCTION: LEGO1 0x1001a280
MxResult IslePathActor::Create(MxDSObject& p_dsObject)
MxResult IslePathActor::Create(MxDSAction& p_dsAction)
{
return MxEntity::Create(p_dsObject);
return MxEntity::Create(p_dsAction);
}
// STUB: LEGO1 0x1001a350

View File

@@ -216,6 +216,12 @@ MxDSAction& GetCurrentAction()
return LegoOmni::GetInstance()->GetCurrentAction();
}
// FUNCTION: LEGO1 0x100158f0
void SetCurrentWorld(LegoWorld* p_world)
{
LegoOmni::GetInstance()->SetWorld(p_world);
}
// FUNCTION: LEGO1 0x10015900
MxTransitionManager* TransitionManager()
{