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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 120 additions and 51 deletions

View file

@ -37,7 +37,7 @@ class Helicopter : public IslePathActor {
return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name);
}
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void VTable0x70(float p_float) override; // vtable+0x70
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
virtual MxU32 VTable0xcc() override; // vtable+0xcc

View file

@ -26,7 +26,7 @@ class Infocenter : public LegoWorld {
return !strcmp(p_name, Infocenter::ClassName()) || LegoWorld::IsA(p_name);
}
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual void VTable0x50() override; // vtable+0x50
virtual MxBool VTable0x5c() override; // vtable+0x5c
virtual MxBool VTable0x64() override; // vtable+0x64

View file

@ -40,7 +40,7 @@ class Isle : public LegoWorld {
return !strcmp(p_name, Isle::ClassName()) || LegoWorld::IsA(p_name);
}
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual void VTable0x50() override; // vtable+50
virtual void VTable0x58(MxCore* p_object) override; // vtable+58
// FUNCTION: LEGO1 0x10030900

View file

@ -28,7 +28,7 @@ class IslePathActor : public LegoPathActor {
return !strcmp(p_name, IslePathActor::ClassName()) || LegoPathActor::IsA(p_name);
}
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
// FUNCTION: LEGO1 0x10002e70
virtual MxU32 VTable0xcc() { return 0; } // vtable+0xcc
// FUNCTION: LEGO1 0x10002df0

View file

@ -2,6 +2,7 @@
#define LEGOCONTROLMANAGER_H
#include "mxcore.h"
#include "mxpresenterlist.h"
// VTABLE: LEGO1 0x100d6a80
class LegoControlManager : public MxCore {
@ -24,6 +25,7 @@ class LegoControlManager : public MxCore {
return !strcmp(p_name, LegoControlManager::ClassName()) || MxCore::IsA(p_name);
}
void FUN_10028df0(MxPresenterList* p_presenterList);
void Register(MxCore* p_listener);
void Unregister(MxCore* p_listener);
};

View file

@ -32,7 +32,7 @@ class LegoEntity : public MxEntity {
return !strcmp(p_name, LegoEntity::ClassName()) || MxEntity::IsA(p_name);
}
virtual MxResult Create(MxDSObject& p_dsObject); // vtable+0x18
virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18
virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c
virtual void ParseAction(char*); // vtable+0x20
virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24

View file

@ -116,7 +116,7 @@ class LegoOmni : public MxOmni {
MxDSAction& GetCurrentAction() { return m_action; }
inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; }
inline void SetWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; }
inline void SetExit(MxBool p_exit) { m_exit = p_exit; };
private:
@ -167,5 +167,6 @@ void SetIsWorldActive(MxBool p_isWorldActive);
void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last);
void RegisterScripts();
void UnregisterScripts();
void SetCurrentWorld(LegoWorld* p_world);
#endif // LEGOOMNI_H

View file

@ -83,6 +83,7 @@ class LegoPointOfViewController : public LegoMouseController {
virtual void SetEntity(LegoEntity* p_entity); // vtable+0x2c
MxResult Create(Lego3DView* p_lego3DView);
void OnViewSize(int p_width, int p_height);
inline LegoEntity* GetEntity() { return m_entity; }

View file

@ -28,7 +28,7 @@ class LegoRace : public LegoWorld {
return !strcmp(p_name, LegoRace::ClassName()) || LegoWorld::IsA(p_name);
}
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual MxBool VTable0x5c() override; // vtable+0x5c
virtual MxBool VTable0x64() override; // vtable+0x64
virtual void VTable0x68(MxBool p_add) override; // vtable+0x68

View file

@ -33,20 +33,20 @@ class LegoWorld : public LegoEntity {
return !strcmp(p_name, LegoWorld::ClassName()) || LegoEntity::IsA(p_name);
}
virtual void VTable0x50(); // vtable+50
virtual void VTable0x54(); // vtable+54
virtual void VTable0x58(MxCore* p_object); // vtable+58
virtual MxBool VTable0x5c(); // vtable+5c
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual void VTable0x50(); // vtable+0x50
virtual LegoCameraController* VTable0x54(); // vtable+0x54
virtual void VTable0x58(MxCore* p_object); // vtable+0x58
virtual MxBool VTable0x5c(); // vtable+0x5c
// FUNCTION: LEGO1 0x100010a0
virtual void VTable0x60() {} // vtable+60
virtual MxBool VTable0x64(); // vtable+64
virtual void VTable0x68(MxBool p_add); // vtable+68
virtual void VTable0x60() {} // vtable+0x60
virtual MxBool VTable0x64(); // vtable+0x64
virtual void VTable0x68(MxBool p_add); // vtable+0x68
inline LegoCameraController* GetCamera() { return m_camera; }
inline LegoCameraController* GetCamera() { return m_cameraController; }
inline undefined4 GetUnknown0xec() { return m_unk0xec; }
undefined FUN_100220e0();
MxResult SetAsCurrentWorld(MxDSObject& p_dsObject);
void EndAction(MxCore* p_object);
void FUN_1001fc80(IslePathActor* p_actor);
MxBool FUN_100727e0(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up);
@ -58,7 +58,7 @@ class LegoWorld : public LegoEntity {
protected:
LegoPathControllerList m_list0x68; // 0x68
MxPresenterList m_list0x80; // 0x80
LegoCameraController* m_camera; // 0x98
LegoCameraController* m_cameraController; // 0x98
undefined m_unk0x9c[0x1c]; // 0x9c
MxPresenterList m_list0xb8; // 0xb8
undefined m_unk0xd0[0x1c]; // 0xd0

View file

@ -31,7 +31,7 @@ class Score : public LegoWorld {
// SYNTHETIC: LEGO1 0x100011e0
// Score::`scalar deleting destructor'
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+18
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+18
virtual void VTable0x50() override; // vtable+50
virtual MxBool VTable0x5c() override; // vtable+5c
virtual MxBool VTable0x64() override; // vtable+64

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
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()
{

View file

@ -4,7 +4,7 @@
#include "decomp.h"
#include "mxatomid.h"
#include "mxcore.h"
#include "mxdsobject.h"
#include "mxdsaction.h"
#include "mxtypes.h"
// VTABLE: LEGO1 0x100d5390
@ -38,10 +38,10 @@ class MxEntity : public MxCore {
return SUCCESS;
}; // vtable+0x14
inline MxResult Create(MxDSObject& p_dsObject)
inline MxResult Create(MxDSAction& p_dsAction)
{
m_mxEntityId = p_dsObject.GetObjectId();
m_atom = p_dsObject.GetAtomId();
m_mxEntityId = p_dsAction.GetObjectId();
m_atom = p_dsAction.GetAtomId();
return SUCCESS;
}