LegoOmni functions

This commit is contained in:
Misha 2023-12-16 11:15:01 -05:00
parent ec854c9308
commit f941679769
No known key found for this signature in database
GPG Key ID: 8441D12AEF33FED8
15 changed files with 276 additions and 48 deletions

View File

@ -224,6 +224,7 @@ add_library(lego1 SHARED
LEGO1/towtrackmissionstate.cpp LEGO1/towtrackmissionstate.cpp
LEGO1/viewmanager/viewmanager.cpp LEGO1/viewmanager/viewmanager.cpp
LEGO1/viewmanager/viewroi.cpp LEGO1/viewmanager/viewroi.cpp
LEGO1/lego3dview.cpp
) )
if (MINGW) if (MINGW)
target_compile_definitions(lego1 PRIVATE DIRECTINPUT_VERSION=0x0500) target_compile_definitions(lego1 PRIVATE DIRECTINPUT_VERSION=0x0500)

View File

@ -10,7 +10,7 @@ class Lego3DManager {
private: private:
int m_unk0x00; int m_unk0x00;
int m_unk0x04; int m_unk0x04;
Lego3DView* m_3dView; Lego3DView* m_3dView; // 0x08
}; };
#endif // LEGO3DMANAGER_H #endif // LEGO3DMANAGER_H

9
LEGO1/lego3dview.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "lego3dview.h"
#include "legoroi.h"
// STUB: LEGO1 0x1003dd70
LegoROI* Lego3DView::PickROI(MxLong p_a, MxLong p_b)
{
// TODO
return NULL;
}

View File

@ -2,10 +2,14 @@
#define LEGO3DVIEW_H #define LEGO3DVIEW_H
#include "viewmanager/viewmanager.h" #include "viewmanager/viewmanager.h"
#include "mxtypes.h"
class LegoROI;
class Lego3DView { class Lego3DView {
public: public:
inline ViewManager* GetViewManager() { return this->m_viewManager; } inline ViewManager* GetViewManager() { return this->m_viewManager; }
LegoROI* PickROI(MxLong p_a, MxLong p_b);
private: private:
char m_pad[0x88]; char m_pad[0x88];

View File

@ -8,10 +8,12 @@
#include "legoobjectfactory.h" #include "legoobjectfactory.h"
#include "legoplantmanager.h" #include "legoplantmanager.h"
#include "legosoundmanager.h" #include "legosoundmanager.h"
#include "legounksavedatawriter.h"
#include "legoutil.h" #include "legoutil.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "legoworld.h" #include "legoworld.h"
#include "legoworldlist.h" #include "legoworldlist.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h" #include "mxautolocker.h"
#include "mxbackgroundaudiomanager.h" #include "mxbackgroundaudiomanager.h"
#include "mxdsfile.h" #include "mxdsfile.h"
@ -173,7 +175,7 @@ IslePathActor* GetCurrentVehicle()
// FUNCTION: LEGO1 0x100157a0 // FUNCTION: LEGO1 0x100157a0
LegoWorld* GetCurrentWorld() LegoWorld* GetCurrentWorld()
{ {
return LegoOmni::GetInstance()->GetCurrentWorld(); return LegoOmni::GetInstance()->GetCurrentOmniWorld();
} }
// FUNCTION: LEGO1 0x100157e0 // FUNCTION: LEGO1 0x100157e0
@ -227,13 +229,15 @@ void PlayMusic(MxU32 p_index)
void FUN_1001a700() void FUN_1001a700()
{ {
// TODO // TODO
// This function seems to populate an unknown structure, and then calls 0x1001b230
} }
// STUB: LEGO1 0x1003dd70 // FUNCTION: LEGO1 0x1003dd70
LegoROI* PickROI(MxLong, MxLong) LegoROI* PickROI(MxLong p_a, MxLong p_b)
{ {
// TODO LegoVideoManager* vid = VideoManager();
return NULL; return vid->Get3DManager()->GetLego3DView()->PickROI(p_a, p_b);
} }
// STUB: LEGO1 0x1003ddc0 // STUB: LEGO1 0x1003ddc0
@ -379,10 +383,83 @@ void LegoOmni::Init()
m_transitionManager = NULL; m_transitionManager = NULL;
} }
// STUB: LEGO1 0x10058c30 // FUNCTION: LEGO1 0x10058c30
void LegoOmni::Destroy() void LegoOmni::Destroy()
{ {
// TODO MxAutoLocker lock(&this->m_criticalsection);
m_notificationManager->Unregister(this);
if (m_worldList) {
delete m_worldList;
m_worldList = NULL;
}
if (m_gameState) {
delete m_gameState;
m_gameState = NULL;
}
if (m_animationManager) {
delete m_animationManager;
m_animationManager = NULL;
}
if (m_saveDataWriter) {
delete m_saveDataWriter;
m_saveDataWriter = NULL;
}
if (m_plantManager) {
delete m_plantManager;
m_plantManager = NULL;
}
if (m_buildingManager) {
delete m_buildingManager;
m_buildingManager = NULL;
}
if (m_gifManager) {
delete m_gifManager;
m_gifManager = NULL;
}
if (m_unk0x6c) {
// delete m_unk0x6c; // TODO
m_unk0x6c = NULL;
}
if (m_inputMgr) {
delete m_inputMgr;
m_inputMgr = NULL;
}
if (m_inputMgr) {
delete m_inputMgr;
m_inputMgr = NULL;
}
// todo FUN_10046de0
if (m_bkgAudioManager) {
m_bkgAudioManager->Stop();
delete m_bkgAudioManager;
m_bkgAudioManager = NULL;
}
if (m_transitionManager) {
delete m_transitionManager;
m_transitionManager = NULL;
}
m_action.ClearAtom();
UnregisterScripts();
delete[] m_unk0x68;
MxOmni::Destroy();
} }
// FUNCTION: LEGO1 0x10058e70 // FUNCTION: LEGO1 0x10058e70
@ -527,11 +604,14 @@ MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction)
return FALSE; return FALSE;
} }
// STUB: LEGO1 0x1005b400 // FUNCTION: LEGO1 0x1005b400
int LegoOmni::GetCurrPathInfo(LegoPathBoundary**, int&) int LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, int& p_value)
{ {
// TODO if (GetCurrentWorld() == NULL) {
return 0; return -1;
}
return GetCurrentWorld()->GetCurrPathInfo(p_path, p_value);
} }
// FUNCTION: LEGO1 0x1005b560 // FUNCTION: LEGO1 0x1005b560
@ -551,11 +631,23 @@ MxResult LegoOmni::Start(MxDSAction* p_dsAction)
return result; return result;
} }
// STUB: LEGO1 0x1005b5f0 // FUNCTION: LEGO1 0x1005b5f0
MxLong LegoOmni::Notify(MxParam& p_param) MxLong LegoOmni::Notify(MxParam& p_param)
{ {
// TODO MxBool isCD = FALSE;
return 0;
if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAction &&
((MxActionNotificationParam&) p_param).GetAction()->GetAtomId() == *g_nocdSourceName) {
isCD = TRUE;
}
MxLong result = MxOmni::Notify(p_param);
if (isCD) {
// Exit the game if nocd.si ended
PostMessageA(m_windowHandle, WM_CLOSE, 0, 0);
}
return result;
} }
// FUNCTION: LEGO1 0x1005b640 // FUNCTION: LEGO1 0x1005b640

View File

@ -103,7 +103,7 @@ class LegoOmni : public MxOmni {
LegoInputManager* GetInputManager() { return m_inputMgr; } LegoInputManager* GetInputManager() { return m_inputMgr; }
GifManager* GetGifManager() { return m_gifManager; } GifManager* GetGifManager() { return m_gifManager; }
LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoWorld* GetCurrentOmniWorld() { return m_currentWorld; }
LegoNavController* GetNavController() { return m_navController; } LegoNavController* GetNavController() { return m_navController; }
IslePathActor* GetCurrentVehicle() { return m_currentVehicle; } IslePathActor* GetCurrentVehicle() { return m_currentVehicle; }
LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } LegoPlantManager* GetLegoPlantManager() { return m_plantManager; }
@ -115,24 +115,24 @@ class LegoOmni : public MxOmni {
MxDSAction& GetCurrentAction() { return m_action; } MxDSAction& GetCurrentAction() { return m_action; }
private: private:
undefined4 m_unk0x68; undefined4* m_unk0x68; // 0x68
undefined4 m_unk0x6c; undefined4 m_unk0x6c; // 0x6c
LegoInputManager* m_inputMgr; // 0x70 LegoInputManager* m_inputMgr; // 0x70
GifManager* m_gifManager; GifManager* m_gifManager; // 0x74
LegoWorldList* m_worldList; // 0x78 LegoWorldList* m_worldList; // 0x78
LegoWorld* m_currentWorld; LegoWorld* m_currentWorld; // 0x7c
MxBool m_unk0x80; MxBool m_unk0x80; // 0x80
LegoNavController* m_navController; // 0x84 LegoNavController* m_navController; // 0x84
IslePathActor* m_currentVehicle; // 0x88 IslePathActor* m_currentVehicle; // 0x88
LegoUnkSaveDataWriter* m_saveDataWriter; LegoUnkSaveDataWriter* m_saveDataWriter; // 0x8c
LegoPlantManager* m_plantManager; // 0x90 LegoPlantManager* m_plantManager; // 0x90
LegoAnimationManager* m_animationManager; LegoAnimationManager* m_animationManager; // 0x94
LegoBuildingManager* m_buildingManager; // 0x98 LegoBuildingManager* m_buildingManager; // 0x98
LegoGameState* m_gameState; // 0x9c LegoGameState* m_gameState; // 0x9c
MxDSAction m_action; MxDSAction m_action; // 0xa0
MxBackgroundAudioManager* m_bkgAudioManager; // 0x134 MxBackgroundAudioManager* m_bkgAudioManager; // 0x134
MxTransitionManager* m_transitionManager; // 0x138 MxTransitionManager* m_transitionManager; // 0x138
MxBool m_unk0x13c; MxBool m_unk0x13c; // 0x13c
}; };
__declspec(dllexport) MxBackgroundAudioManager* BackgroundAudioManager(); __declspec(dllexport) MxBackgroundAudioManager* BackgroundAudioManager();

View File

@ -91,6 +91,13 @@ void LegoWorld::FUN_1001fc80(IslePathActor* p_actor)
{ {
} }
// STUB: LEGO1 0x10020120
int LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, int& p_value)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10020220 // STUB: LEGO1 0x10020220
void LegoWorld::VTable0x58(MxCore* p_object) void LegoWorld::VTable0x58(MxCore* p_object)
{ {

View File

@ -8,6 +8,7 @@
#include "mxpresenterlist.h" #include "mxpresenterlist.h"
class IslePathActor; class IslePathActor;
class LegoPathBoundary;
// VTABLE: LEGO1 0x100d6280 // VTABLE: LEGO1 0x100d6280
// SIZE 0xf8 // SIZE 0xf8
@ -50,6 +51,7 @@ class LegoWorld : public LegoEntity {
MxBool FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up); MxBool FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up);
void FUN_10073400(); void FUN_10073400();
void FUN_10073430(); void FUN_10073430();
int GetCurrPathInfo(LegoPathBoundary** p_path, int& p_value);
protected: protected:
LegoPathControllerList m_list0x68; // 0x68 LegoPathControllerList m_list0x68; // 0x68

View File

@ -9,8 +9,20 @@ MxNotificationParam* MxActionNotificationParam::Clone()
return new MxActionNotificationParam(this->m_type, this->m_sender, this->m_action, this->m_realloc); return new MxActionNotificationParam(this->m_type, this->m_sender, this->m_action, this->m_realloc);
} }
// FUNCTION: LEGO1 0x100b0300
MxNotificationParam* MxStartActionNotificationParam::Clone()
{
return new MxEndActionNotificationParam(c_notificationStartAction, this->m_sender, this->m_action, this->m_realloc);
}
// FUNCTION: LEGO1 0x10051270 // FUNCTION: LEGO1 0x10051270
MxNotificationParam* MxEndActionNotificationParam::Clone() MxNotificationParam* MxEndActionNotificationParam::Clone()
{ {
return new MxEndActionNotificationParam(c_notificationEndAction, this->m_sender, this->m_action, this->m_realloc); return new MxEndActionNotificationParam(c_notificationEndAction, this->m_sender, this->m_action, this->m_realloc);
} }
// FUNCTION: LEGO1 0x100b04f0
MxNotificationParam* MxType4NotificationParam::Clone()
{
return new MxType4NotificationParam(this->m_sender, this->m_action, this->m_unk0x14);
}

View File

@ -50,6 +50,23 @@ class MxActionNotificationParam : public MxNotificationParam {
MxBool m_realloc; // 0x10 MxBool m_realloc; // 0x10
}; };
// VTABLE: LEGO1 0x100dc210
// SIZE 0x14
class MxStartActionNotificationParam : public MxActionNotificationParam {
public:
inline MxStartActionNotificationParam(
NotificationId p_type,
MxCore* p_sender,
MxDSAction* p_action,
MxBool p_reallocAction
)
: MxActionNotificationParam(p_type, p_sender, p_action, p_reallocAction)
{
}
virtual MxNotificationParam* Clone() override; // vtable+0x4
};
// VTABLE: LEGO1 0x100d8358 // VTABLE: LEGO1 0x100d8358
// SIZE 0x14 // SIZE 0x14
class MxEndActionNotificationParam : public MxActionNotificationParam { class MxEndActionNotificationParam : public MxActionNotificationParam {
@ -67,7 +84,32 @@ class MxEndActionNotificationParam : public MxActionNotificationParam {
virtual MxNotificationParam* Clone() override; // vtable+0x4 virtual MxNotificationParam* Clone() override; // vtable+0x4
}; };
// VTABLE: LEGO1 0x100dc208
// SIZE 0x18
class MxType4NotificationParam : public MxActionNotificationParam {
public:
inline MxType4NotificationParam(
MxCore* p_sender,
MxDSAction* p_action,
undefined4 p_unk0x14
)
: MxActionNotificationParam(TYPE4, p_sender, p_action, FALSE)
{
m_unk0x14 = p_unk0x14;
}
virtual MxNotificationParam* Clone() override; // vtable+0x4
private:
undefined4 m_unk0x14; // 0x14
};
// SYNTHETIC: LEGO1 0x100b0430
// MxStartActionNotificationParam::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x100513a0 // SYNTHETIC: LEGO1 0x100513a0
// MxEndActionNotificationParam::`scalar deleting destructor' // MxEndActionNotificationParam::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x100b05c0
// MxType4NotificationParam::`scalar deleting destructor'
#endif #endif

View File

@ -45,6 +45,8 @@ class MxDSObject : public MxCore {
inline void SetUnknown24(MxS16 p_unk0x24) { this->m_unk0x24 = p_unk0x24; } inline void SetUnknown24(MxS16 p_unk0x24) { this->m_unk0x24 = p_unk0x24; }
inline void SetUnknown28(undefined4 p_unk0x28) { this->m_unk0x28 = p_unk0x28; } inline void SetUnknown28(undefined4 p_unk0x28) { this->m_unk0x28 = p_unk0x28; }
inline void ClearAtom() { m_atomId.Clear(); }
private: private:
MxU32 m_sizeOnDisk; // 0x8 MxU32 m_sizeOnDisk; // 0x8
MxU16 m_type; // 0xc MxU16 m_type; // 0xc

View File

@ -1,5 +1,6 @@
#include "mxomni.h" #include "mxomni.h"
#include "mxactionnotificationparam.h"
#include "mxatomidcounter.h" #include "mxatomidcounter.h"
#include "mxautolocker.h" #include "mxautolocker.h"
#include "mxeventmanager.h" #include "mxeventmanager.h"
@ -7,6 +8,7 @@
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
#include "mxobjectfactory.h" #include "mxobjectfactory.h"
#include "mxomnicreateparam.h" #include "mxomnicreateparam.h"
#include "mxpresenter.h"
#include "mxsoundmanager.h" #include "mxsoundmanager.h"
#include "mxstreamer.h" #include "mxstreamer.h"
#include "mxticklemanager.h" #include "mxticklemanager.h"
@ -317,10 +319,46 @@ MxResult MxOmni::DeleteObject(MxDSAction& p_dsAction)
return FAILURE; return FAILURE;
} }
// STUB: LEGO1 0x100b00e0 // FUNCTION: LEGO1 0x100b00e0
void MxOmni::Vtable0x2c() MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p_action)
{ {
// TODO MxResult result = FAILURE;
MxPresenter* object = (MxPresenter*) m_objectFactory->Create(PresenterNameDispatch(p_action));
if (object == NULL) {
return result;
}
if (object->AddToManager() == SUCCESS) {
MxPresenter* sender = (MxPresenter*) p_action.GetUnknown28();
if (sender == NULL && (sender = (MxPresenter*) p_controller->FUN_100c1e70(p_action)) == NULL) {
if (p_action.GetOrigin() == NULL) {
p_action.SetOrigin(this);
}
object->SetCompositePresenter(NULL);
}
else {
p_action.SetOrigin(sender);
object->SetCompositePresenter((MxCompositePresenter*) sender);
}
if (object->StartAction(p_controller, &p_action) == SUCCESS) {
if (sender) {
NotificationManager()->Send(p_action.GetUnknown84(), &MxType4NotificationParam(this, &p_action, FALSE));
}
if (p_action.GetUnknown84()) {
NotificationManager()->Send(
p_action.GetUnknown84(),
&MxStartActionNotificationParam(c_notificationStartAction, this, &p_action, FALSE)
);
}
}
result = SUCCESS;
}
return result;
} }
// FUNCTION: LEGO1 0x100b0680 // FUNCTION: LEGO1 0x100b0680

View File

@ -22,6 +22,7 @@ class MxTimer;
class MxVariableTable; class MxVariableTable;
class MxVideoManager; class MxVideoManager;
class MxEntity; class MxEntity;
class MxStreamController;
// VTABLE: LEGO1 0x100dc168 // VTABLE: LEGO1 0x100dc168
// SIZE 0x68 // SIZE 0x68
@ -39,19 +40,19 @@ class MxOmni : public MxCore {
MxOmni(); MxOmni();
virtual ~MxOmni() override; virtual ~MxOmni() override;
virtual MxLong Notify(MxParam& p_param) override; // vtable+04 virtual MxLong Notify(MxParam& p_param) override; // vtable+04
virtual void Init(); // vtable+14 virtual void Init(); // vtable+14
virtual MxResult Create(MxOmniCreateParam& p_param); // vtable+18 virtual MxResult Create(MxOmniCreateParam& p_param); // vtable+18
virtual void Destroy(); // vtable+1c virtual void Destroy(); // vtable+1c
virtual MxResult Start(MxDSAction* p_dsAction); // vtable+20 virtual MxResult Start(MxDSAction* p_dsAction); // vtable+20
virtual MxResult DeleteObject(MxDSAction& p_dsAction); // vtable+24 virtual MxResult DeleteObject(MxDSAction& p_dsAction); // vtable+24
virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28 virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28
virtual void Vtable0x2c(); // vtable+2c virtual MxResult CreatePresenter(MxStreamController* p_controller, MxDSAction& p_action); // vtable+2c
virtual MxEntity* FindWorld(const char*, MxS32, MxPresenter*); // vtable+30 virtual MxEntity* FindWorld(const char*, MxS32, MxPresenter*); // vtable+30
virtual void NotifyCurrentEntity(MxNotificationParam* p_param); // vtable+34 virtual void NotifyCurrentEntity(MxNotificationParam* p_param); // vtable+34
virtual void StartTimer(); // vtable+38 virtual void StartTimer(); // vtable+38
virtual void StopTimer(); // vtable+3c virtual void StopTimer(); // vtable+3c
virtual MxBool IsTimerRunning(); // vtable+40 virtual MxBool IsTimerRunning(); // vtable+40
static void SetInstance(MxOmni* p_instance); static void SetInstance(MxOmni* p_instance);
HWND GetWindowHandle() const { return this->m_windowHandle; } HWND GetWindowHandle() const { return this->m_windowHandle; }
MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; } MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; }

View File

@ -140,6 +140,23 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
return FAILURE; return FAILURE;
} }
// FUNCTION: LEGO1 0x100c1e70
MxCore* MxStreamController::FUN_100c1e70(MxDSAction& p_obj)
{
MxAutoLocker locker(&m_criticalSection);
MxCore* result = NULL;
if (p_obj.GetObjectId() != -1)
{
MxDSAction* action = m_unk0x3c.Find(&p_obj, FALSE);
if (action != NULL)
{
result = (MxCore*)action->GetUnknown28();
}
}
return result;
}
// STUB: LEGO1 0x100c20d0 // STUB: LEGO1 0x100c20d0
MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj) MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj)
{ {

View File

@ -44,6 +44,7 @@ class MxStreamController : public MxCore {
MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val); MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val);
MxBool FUN_100c20d0(MxDSObject& p_obj); MxBool FUN_100c20d0(MxDSObject& p_obj);
MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval); MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval);
MxCore* FUN_100c1e70(MxDSAction& p_obj);
MxResult FUN_100c1f00(MxDSAction* p_action); MxResult FUN_100c1f00(MxDSAction* p_action);
inline MxAtomId& GetAtom() { return m_atom; }; inline MxAtomId& GetAtom() { return m_atom; };