Implement/match LegoAct2::Create (#1146)

This commit is contained in:
Christian Semmler 2024-11-11 10:48:45 -07:00 committed by GitHub
parent 6cda0d95c7
commit bebe780c77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 44 additions and 4 deletions

View File

@ -78,7 +78,7 @@ private:
undefined m_unk0x10c2; // 0x10c2 undefined m_unk0x10c2; // 0x10c2
undefined4 m_unk0x10c4; // 0x10c4 undefined4 m_unk0x10c4; // 0x10c4
undefined4 m_unk0x10c8; // 0x10c8 undefined4 m_unk0x10c8; // 0x10c8
undefined4 m_unk0x10cc; // 0x10cc LegoAct2State* m_gameState; // 0x10cc
undefined4 m_unk0x10d0; // 0x10d0 undefined4 m_unk0x10d0; // 0x10d0
char* m_unk0x10d4; // 0x10d4 char* m_unk0x10d4; // 0x10d4
undefined4 m_unk0x10d8; // 0x10d8 undefined4 m_unk0x10d8; // 0x10d8

View File

@ -1,6 +1,7 @@
#include "legoact2.h" #include "legoact2.h"
#include "legoanimationmanager.h" #include "legoanimationmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h" #include "legoinputmanager.h"
#include "misc.h" #include "misc.h"
#include "mxmisc.h" #include "mxmisc.h"
@ -40,11 +41,50 @@ LegoAct2::~LegoAct2()
NotificationManager()->Unregister(this); NotificationManager()->Unregister(this);
} }
// STUB: LEGO1 0x1004ff20 // FUNCTION: LEGO1 0x1004ff20
// FUNCTION: BETA10 0x1003a7ff
MxResult LegoAct2::Create(MxDSAction& p_dsAction) MxResult LegoAct2::Create(MxDSAction& p_dsAction)
{ {
// TODO GameState()->FindLoadedAct();
return SUCCESS;
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
AnimationManager()->EnableCamAnims(FALSE);
LegoGameState* gameState = GameState();
LegoAct2State* state = (LegoAct2State*) gameState->GetState("LegoAct2State");
if (state == NULL) {
state = (LegoAct2State*) gameState->CreateState("LegoAct2State");
}
m_gameState = state;
m_gameState->m_unk0x08 = 0;
switch (GameState()->GetLoadedAct()) {
case LegoGameState::e_act2:
GameState()->StopArea(LegoGameState::e_infomain);
GameState()->StopArea(LegoGameState::e_act2main);
break;
case LegoGameState::e_act3:
GameState()->StopArea(LegoGameState::e_infomain);
GameState()->StopArea(LegoGameState::e_act3script);
break;
case LegoGameState::e_act1:
case LegoGameState::e_actNotFound:
GameState()->StopArea(LegoGameState::e_undefined);
if (GameState()->GetPreviousArea() == LegoGameState::e_infomain) {
GameState()->StopArea(LegoGameState::e_isle);
}
}
GameState()->m_currentArea = LegoGameState::e_act2main;
GameState()->SetCurrentAct(LegoGameState::e_act2);
InputManager()->Register(this);
GameState()->SetDirty(TRUE);
}
return result;
} }
// STUB: LEGO1 0x10050040 // STUB: LEGO1 0x10050040