WIP VTable0x68

This commit is contained in:
Christian Semmler 2024-02-02 10:52:24 -05:00
parent a7acf8c607
commit 777f1b64ac
21 changed files with 257 additions and 51 deletions

View File

@ -27,9 +27,12 @@ class LegoAnimationManager : public MxCore {
return !strcmp(p_name, ClassName()) || MxCore::IsA(p_name);
}
void FUN_1005ee80(MxBool);
void FUN_1005ef10();
void FUN_1005f0b0();
void FUN_1005f6d0(MxBool);
void FUN_1005f720(undefined4);
void FUN_10061010(undefined4);
void FUN_10064670(MxBool);
static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig);

View File

@ -47,6 +47,7 @@ class LegoGameState {
void SetSomeEnumState(undefined4 p_state);
void FUN_1003ceb0();
void FUN_10039780(MxU8);
void FUN_10039940();
struct ScoreStruct {
void WriteScoreHistory();

View File

@ -28,6 +28,7 @@ class MxBackgroundAudioManager;
class MxDSFile;
class MxTransitionManager;
class ViewLODListManager;
class ViewManager;
extern MxAtomId* g_copterScript;
extern MxAtomId* g_dunecarScript;
@ -125,7 +126,7 @@ class LegoOmni : public MxOmni {
LegoUnkSaveDataWriter* GetUnkSaveDataWriter() { return m_saveDataWriter; }
inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; }
inline void SetWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; }
inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; }
inline void SetExit(MxBool p_exit) { m_exit = p_exit; }
inline void CloseMainWindow() { PostMessageA(m_windowHandle, WM_CLOSE, 0, 0); }
@ -164,14 +165,15 @@ LegoROI* PickROI(MxLong, MxLong);
LegoSoundManager* SoundManager();
MxTransitionManager* TransitionManager();
LegoVideoManager* VideoManager();
LegoAnimationManager* AnimationManager();
LegoNavController* NavController();
LegoBuildingManager* BuildingManager();
LegoControlManager* ControlManager();
IslePathActor* GetCurrentVehicle();
IslePathActor* CurrentVehicle();
ViewManager* GetViewManager();
LegoPlantManager* PlantManager();
LegoWorld* GetCurrentWorld();
LegoUnkSaveDataWriter* GetUnkSaveDataWriter();
LegoWorld* CurrentWorld();
LegoUnkSaveDataWriter* UnkSaveDataWriter();
GifManager* GetGifManager();
void FUN_10015820(MxBool p_disable, MxU16 p_flags);
void FUN_10015860(const char*, MxU8);

View File

@ -30,6 +30,8 @@ class LegoPathController : public MxCore {
virtual void VTable0x14(); // vtable+0x14
virtual void Destroy(); // vtable+0x18
void Enable(MxBool p_enable);
};
#endif // LEGOPATHCONTROLLER_H

View File

@ -5,6 +5,12 @@
#include "mxlist.h"
#include "mxtypes.h"
// VTABLE: LEGO1 0x100d6380
// class MxCollection<LegoPathController *>
// VTABLE: LEGO1 0x100d6398
// class MxList<LegoPathController *>
// VTABLE: LEGO1 0x100d6320
// class MxPtrList<LegoPathController>
@ -19,16 +25,20 @@ class LegoPathControllerList : public MxPtrList<LegoPathController> {
{
return p_a == p_b ? 0 : p_a < p_b ? -1 : 1;
} // vtable+0x14
// SYNTHETIC: LEGO1 0x1001d3d0
// LegoPathControllerList::`scalar deleting destructor'
};
// VTABLE: LEGO1 0x100d6380
// class MxCollection<LegoPathController *>
// VTABLE: LEGO1 0x100d6578
// class MxListCursor<LegoPathController *>
// VTABLE: LEGO1 0x100d6398
// class MxList<LegoPathController *>
// VTABLE: LEGO1 0x100d6548
// class MxPtrListCursor<LegoPathController>
// VTABLE: LEGO1 0x100d6560
// SIZE 0x10
class LegoPathControllerListCursor : public MxPtrListCursor<LegoPathController> {
public:
LegoPathControllerListCursor(LegoPathControllerList* p_list) : MxPtrListCursor<LegoPathController>(p_list){};
};
// TEMPLATE: LEGO1 0x1001d230
// MxCollection<LegoPathController *>::Compare
@ -48,6 +58,9 @@ class LegoPathControllerList : public MxPtrList<LegoPathController> {
// TEMPLATE: LEGO1 0x1001d3c0
// MxPtrList<LegoPathController>::Destroy
// SYNTHETIC: LEGO1 0x1001d3d0
// LegoPathControllerList::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1001d440
// MxPtrList<LegoPathController>::~MxPtrList<LegoPathController>
@ -63,4 +76,21 @@ class LegoPathControllerList : public MxPtrList<LegoPathController> {
// SYNTHETIC: LEGO1 0x1001d620
// LegoPathControllerList::~LegoPathControllerList
// SYNTHETIC: LEGO1 0x1001f830
// LegoPathControllerListCursor::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1001f8a0
// MxPtrListCursor<LegoPathController>::~MxPtrListCursor<LegoPathController>
// SYNTHETIC: LEGO1 0x1001f8f0
// MxListCursor<LegoPathController *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1001f960
// MxPtrListCursor<LegoPathController>::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1001f9d0
// MxListCursor<LegoPathController *>::~MxListCursor<LegoPathController *>
// LegoPathControllerListCursor::~LegoPathControllerListCursor
#endif // LEGOPATHCONTROLLERLIST_H

View File

@ -86,6 +86,7 @@ class LegoPointOfViewController : public LegoMouseController {
void OnViewSize(int p_width, int p_height);
inline LegoEntity* GetEntity() { return m_entity; }
inline LegoNavController* GetNavController() { return m_nav; }
protected:
void AffectPointOfView();

View File

@ -34,7 +34,7 @@ Helicopter::~Helicopter()
MxResult Helicopter::Create(MxDSAction& p_dsAction)
{
MxResult result = IslePathActor::Create(p_dsAction);
LegoWorld* world = GetCurrentWorld();
LegoWorld* world = CurrentWorld();
SetWorld(world);
if (world->IsA("Act3")) {
((Act3*) GetWorld())->SetUnkown420c(this);
@ -65,9 +65,9 @@ void Helicopter::VTable0xe4()
IslePathActor::VTable0xe4();
if (!GameState()->GetUnknown10()) {
GameState()->SetCurrentArea(0x3c);
if (GetCurrentVehicle()) {
if (GetCurrentVehicle()->IsA("IslePathActor")) {
((IslePathActor*) GetCurrentVehicle())->VTable0xe8(0x37, TRUE, 7);
if (CurrentVehicle()) {
if (CurrentVehicle()->IsA("IslePathActor")) {
((IslePathActor*) CurrentVehicle())->VTable0xe8(0x37, TRUE, 7);
}
}
}
@ -93,12 +93,12 @@ MxU32 Helicopter::VTable0xcc()
return 1;
}
if (!m_world) {
m_world = GetCurrentWorld();
m_world = CurrentWorld();
}
AnimationManager()->FUN_1005f6d0(FALSE);
if (GetCurrentVehicle()) {
if (GetCurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) {
GetCurrentVehicle()->VTable0xe4();
if (CurrentVehicle()) {
if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) {
CurrentVehicle()->VTable0xe4();
}
}
switch (GameState()->GetUnknown10()) {
@ -106,7 +106,7 @@ MxU32 Helicopter::VTable0xcc()
m_script = *g_isleScript;
AnimationManager()->FUN_10064670(FALSE);
VTable0xe8(0x29, TRUE, 7);
((Isle*) GetCurrentWorld())->SetUnknown13c(0x3c);
((Isle*) CurrentWorld())->SetUnknown13c(0x3c);
FUN_10015820(TRUE, 0);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, TRUE);
SetUnknownDC(4);
@ -146,7 +146,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
switch (p_param.GetClickedObjectId()) {
case 0x17:
if (*g_act3Script == script) {
((Act3*) GetCurrentWorld())->SetUnkown4270(2);
((Act3*) CurrentWorld())->SetUnkown4270(2);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
}
else if (m_state->GetUnkown8() != 0) {
@ -218,7 +218,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
break;
case 0x1c:
if (GameState()->GetUnknown10() == 0) {
((Isle*) GetCurrentWorld())->SetUnknown13c(2);
((Isle*) CurrentWorld())->SetUnknown13c(2);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
VTable0xe4();
}

View File

@ -113,6 +113,12 @@ void LegoGameState::FUN_10039780(MxU8)
// TODO
}
// STUB: LEGO1 0x10039940
void LegoGameState::FUN_10039940()
{
// TODO
}
// FUNCTION: LEGO1 0x10039980
MxResult LegoGameState::Save(MxULong p_slot)
{

View File

@ -6,7 +6,7 @@
// FUNCTION: LEGO1 0x10076c30
void LegoActorPresenter::ReadyTickle()
{
if (GetCurrentWorld()) {
if (CurrentWorld()) {
m_entity = (LegoEntity*) CreateEntity("LegoActor");
if (m_entity) {
SetEntityLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp());

View File

@ -55,7 +55,7 @@ void LegoEntity::Destroy(MxBool p_fromDestructor)
m_roi->SetUnknown0x104(NULL);
}
GetUnkSaveDataWriter()->FUN_10083db0(m_roi);
UnkSaveDataWriter()->FUN_10083db0(m_roi);
}
else {
VideoManager()->Get3DManager()->GetLego3DView()->Remove(*m_roi);
@ -70,7 +70,7 @@ void LegoEntity::Destroy(MxBool p_fromDestructor)
// FUNCTION: LEGO1 0x10010880
void LegoEntity::SetWorld()
{
LegoWorld* world = GetCurrentWorld();
LegoWorld* world = CurrentWorld();
if (world != NULL && world != (LegoWorld*) this) {
world->Add(this);
}
@ -91,7 +91,7 @@ void LegoEntity::SetLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direc
// FUNCTION: LEGO1 0x10010c30
void LegoEntity::FUN_10010c30()
{
LegoWorld* world = GetCurrentWorld();
LegoWorld* world = CurrentWorld();
if (m_cameraFlag && world && world->GetCamera() && m_roi) {
world->GetCamera()->FUN_100123e0(m_roi->GetLocal2World(), 1);

View File

@ -62,7 +62,7 @@ MxResult LegoEntityPresenter::StartAction(MxStreamController* p_controller, MxDS
// FUNCTION: LEGO1 0x100536c0
void LegoEntityPresenter::ReadyTickle()
{
if (GetCurrentWorld()) {
if (CurrentWorld()) {
m_entity = (LegoEntity*) MxPresenter::CreateEntity("LegoEntity");
if (m_entity) {
m_entity->Create(*m_action);

View File

@ -1,10 +1,13 @@
#include "legoworld.h"
#include "legoanimationmanager.h"
#include "legoanimpresenter.h"
#include "legobuildingmanager.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legolocomotionanimpresenter.h"
#include "legonavcontroller.h"
#include "legoomni.h"
#include "legoplantmanager.h"
#include "legosoundmanager.h"
@ -80,8 +83,8 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction)
}
if (p_dsAction.GetFlags() & MxDSAction::c_enabled) {
if (GetCurrentWorld()) {
GetCurrentWorld()->VTable0x68(0);
if (CurrentWorld()) {
CurrentWorld()->VTable0x68(0);
}
SetCurrentWorld(this);
@ -99,7 +102,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
{
m_destroyed = TRUE;
if (GetCurrentWorld() == this) {
if (CurrentWorld() == this) {
ControlManager()->FUN_10028df0(NULL);
SetCurrentWorld(NULL);
}
@ -513,10 +516,129 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
return NULL;
}
// STUB: LEGO1 0x10021a70
void LegoWorld::VTable0x68(MxBool p_add)
// FUNCTION: LEGO1 0x10021a70
void LegoWorld::VTable0x68(MxBool p_und)
{
// TODO
if (p_und) {
if (!m_set0xd0.empty() && CurrentWorld() != this) {
if (CurrentWorld()) {
AnimationManager()->FUN_10061010(0);
CurrentWorld()->VTable0x68(FALSE);
LegoEntityListCursor cursor(m_entityList);
LegoEntity* entity;
while (cursor.Next(entity)) {
if (entity->GetROI()) {
entity->GetROI()->SetUnknown0x104(entity);
GetViewManager()->GetUnknown0x08().push_back(entity->GetROI());
}
}
}
while (!m_set0xd0.empty()) {
MxCoreSet::iterator it = m_set0xa8.begin();
MxCore* object = *it;
if (object->IsA("MxPresenter")) {
((MxPresenter*) object)->Enable(TRUE);
}
else if (object->IsA("LegoPathController")) {
((LegoPathController*) object)->Enable(TRUE);
}
m_set0xd0.erase(it);
}
SetCurrentWorld(this);
ControlManager()->FUN_10028df0(&m_controlPresenters);
InputManager()->SetCamera(m_cameraController);
if (m_cameraController) {
InputManager()->Register(m_cameraController->GetNavController());
Lego()->SetNavController(m_cameraController->GetNavController());
}
if (m_unk0xec != -1) {
PlantManager()->FUN_10026360(m_unk0xec);
AnimationManager()->FUN_1005f720(m_unk0xec);
BuildingManager()->FUN_1002fa00();
AnimationManager()->FUN_1005f0b0();
}
GameState()->FUN_10039940();
SetIsWorldActive(TRUE);
return;
}
if (p_und)
return;
}
if (m_set0xd0.empty()) {
IslePathActor* vehicle = CurrentVehicle();
if (vehicle) {
FUN_1001fc80(vehicle);
}
AnimationManager()->FUN_1005ee80(FALSE);
m_set0xd0.insert(this);
if (m_unk0xec != -1) {
PlantManager()->FUN_100263a0(m_unk0xec);
BuildingManager()->FUN_1002fb30();
}
MxPresenterListCursor controlPresenterCursor(&m_controlPresenters);
MxPresenter* presenter;
while (controlPresenterCursor.Next(presenter)) {
if (presenter->IsEnabled()) {
m_set0xd0.insert(presenter);
presenter->Enable(FALSE);
}
}
for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) {
if ((*it)->IsA("LegoActionControlPresenter")) {
m_set0xd0.insert(*it);
((MxPresenter*) *it)->Enable(FALSE);
}
else if ((*it)->IsA("MxPresenter") && ((MxPresenter*) *it)->IsEnabled()) {
m_set0xd0.insert(*it);
((MxPresenter*) *it)->Enable(FALSE);
}
}
if (CurrentWorld() && CurrentWorld() == this) {
ControlManager()->FUN_10028df0(NULL);
Lego()->SetCurrentWorld(NULL);
}
if (InputManager()->GetCamera() == m_cameraController) {
InputManager()->ClearCamera();
}
if (m_cameraController) {
InputManager()->UnRegister(m_cameraController->GetNavController());
if (NavController() == m_cameraController->GetNavController()) {
Lego()->SetNavController(NULL);
}
}
LegoPathControllerListCursor pathControllerCursor(&m_list0x68);
LegoPathController* controller;
while (pathControllerCursor.Next(controller)) {
controller->Enable(FALSE);
m_set0xd0.insert(controller);
}
GetViewManager()->RemoveAll(NULL);
}
}
// FUNCTION: LEGO1 0x10022080

View File

@ -46,8 +46,8 @@ Isle::~Isle()
InputManager()->ClearWorld();
}
if (GetCurrentVehicle() != NULL) {
VTable0x6c(GetCurrentVehicle());
if (CurrentVehicle() != NULL) {
VTable0x6c(CurrentVehicle());
}
NotificationManager()->Unregister(this);
@ -121,7 +121,7 @@ MxLong Isle::Notify(MxParam& p_param)
case c_notificationType18:
switch (m_act1state->GetUnknown18()) {
case 4:
result = GetCurrentVehicle()->Notify(p_param);
result = CurrentVehicle()->Notify(p_param);
break;
case 8:
result = m_towtrack->Notify(p_param);

View File

@ -54,7 +54,7 @@ MxLong Radio::Notify(MxParam& p_param)
void Radio::Play()
{
if (!m_state->IsActive()) {
GetCurrentWorld();
CurrentWorld();
MxDSAction action;
action.SetObjectId(m_state->FUN_1002d090());
@ -75,7 +75,7 @@ void Radio::Play()
void Radio::Stop()
{
if (m_state->IsActive()) {
LegoWorld* world = GetCurrentWorld();
LegoWorld* world = CurrentWorld();
MxControlPresenter* presenter = (MxControlPresenter*) world->Find(world->GetAtom(), 18);
@ -103,12 +103,12 @@ MxLong Radio::HandleClick(LegoControlManagerEvent& p_param)
Play();
}
if (GetCurrentWorld()) {
if (CurrentWorld()) {
#ifdef COMPAT_MODE
MxNotificationParam param(c_notificationEndAction, this);
GetCurrentWorld()->Notify(param);
CurrentWorld()->Notify(param);
#else
GetCurrentWorld()->Notify(MxNotificationParam(c_notificationType0, this));
CurrentWorld()->Notify(MxNotificationParam(c_notificationType0, this));
#endif
}

View File

@ -22,6 +22,7 @@
#include "mxstreamer.h"
#include "mxticklemanager.h"
#include "mxtransitionmanager.h"
#include "viewmanager/viewmanager.h"
DECOMP_SIZE_ASSERT(LegoWorldList, 0x18);
DECOMP_SIZE_ASSERT(LegoWorldListCursor, 0x10);
@ -172,23 +173,29 @@ LegoNavController* NavController()
}
// FUNCTION: LEGO1 0x10015790
IslePathActor* GetCurrentVehicle()
IslePathActor* CurrentVehicle()
{
return LegoOmni::GetInstance()->GetCurrentVehicle();
}
// FUNCTION: LEGO1 0x100157a0
LegoWorld* GetCurrentWorld()
LegoWorld* CurrentWorld()
{
return LegoOmni::GetInstance()->GetCurrentWorld();
}
// FUNCTION: LEGO1 0x100157b0
LegoUnkSaveDataWriter* GetUnkSaveDataWriter()
LegoUnkSaveDataWriter* UnkSaveDataWriter()
{
return LegoOmni::GetInstance()->GetUnkSaveDataWriter();
}
// FUNCTION: LEGO1 0x100157c0
ViewManager* GetViewManager()
{
return VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager();
}
// FUNCTION: LEGO1 0x100157e0
LegoPlantManager* PlantManager()
{
@ -234,7 +241,7 @@ MxDSAction& GetCurrentAction()
// FUNCTION: LEGO1 0x100158f0
void SetCurrentWorld(LegoWorld* p_world)
{
LegoOmni::GetInstance()->SetWorld(p_world);
LegoOmni::GetInstance()->SetCurrentWorld(p_world);
}
// FUNCTION: LEGO1 0x10015900
@ -740,11 +747,11 @@ MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction)
// FUNCTION: LEGO1 0x1005b400
MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
{
if (::GetCurrentWorld() == NULL) {
if (::CurrentWorld() == NULL) {
return -1;
}
return ::GetCurrentWorld()->GetCurrPathInfo(p_path, p_value);
return ::CurrentWorld()->GetCurrPathInfo(p_path, p_value);
}
// FUNCTION: LEGO1 0x1005b4f0

View File

@ -24,3 +24,9 @@ MxResult LegoPathController::Tickle()
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10046be0
void LegoPathController::Enable(MxBool p_enable)
{
// TODO
}

View File

@ -21,9 +21,22 @@ LegoAnimationManager::~LegoAnimationManager()
// TODO
}
// STUB: LEGO1 0x1005ee80
void LegoAnimationManager::FUN_1005ee80(MxBool)
{
// TODO
}
// STUB: LEGO1 0x1005ef10
void LegoAnimationManager::FUN_1005ef10()
{
// TODO
}
// STUB: LEGO1 0x1005f0b0
void LegoAnimationManager::FUN_1005f0b0()
{
// TODO
}
// STUB: LEGO1 0x1005f130
@ -44,6 +57,12 @@ void LegoAnimationManager::FUN_1005f720(undefined4)
// TODO
}
// STUB: LEGO1 0x10061010
void LegoAnimationManager::FUN_10061010(undefined4)
{
// TODO
}
// STUB: LEGO1 0x100619f0
MxLong LegoAnimationManager::Notify(MxParam& p_param)
{

View File

@ -102,7 +102,7 @@ void LegoAnimPresenter::PutFrame()
// FUNCTION: LEGO1 0x1006b550
void LegoAnimPresenter::ReadyTickle()
{
m_currentWorld = GetCurrentWorld();
m_currentWorld = CurrentWorld();
if (m_currentWorld) {
MxStreamChunk* chunk = m_subscriber->CurrentChunk();

View File

@ -137,7 +137,7 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
TickleManager()->UnregisterClient(this);
if (p_notifyWorld) {
LegoWorld* world = GetCurrentWorld();
LegoWorld* world = CurrentWorld();
if (world) {
#ifdef COMPAT_MODE

View File

@ -1,5 +1,9 @@
#include "viewmanager.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(ViewManager, 0x1bc)
// STUB: LEGO1 0x100a5eb0
ViewManager::ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view)
{

View File

@ -20,8 +20,11 @@ class ViewManager {
// SYNTHETIC: LEGO1 0x100a6000
// ViewManager::`scalar deleting destructor'
inline CompoundObject& GetUnknown0x08() { return m_unk0x08; }
private:
undefined m_pad[0x1b8];
CompoundObject m_unk0x08; // 0x08
undefined m_pad[0x1cc]; // 0x14
};
#endif // VIEWMANAGER_H