Implement/match Isle::HandleClick (#690)

* Isle::HandleClick

* WIP

* Match
This commit is contained in:
Christian Semmler 2024-03-18 12:31:22 -04:00 committed by GitHub
parent 44f49a7a57
commit d96679ea9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 229 additions and 11 deletions

View file

@ -9,6 +9,12 @@
// SIZE 0x26c
class Act1State : public LegoState {
public:
enum ElevatorFloor {
c_floor1 = 1,
c_floor2,
c_floor3
};
enum {
e_unk953 = 953,
e_unk954 = 954,
@ -68,15 +74,17 @@ class Act1State : public LegoState {
MxBool SetFlag() override; // vtable+0x18
MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c
void FUN_10034660();
void FUN_100346a0();
void FUN_10034b60();
void FUN_10034d00();
inline MxU32 GetUnknown18() { return m_unk0x018; }
inline MxU32 GetUnknown1c() { return m_unk0x01c; }
inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; }
inline MxS16 GetUnknown21() { return m_unk0x021; }
inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x018 = p_unk0x18; }
inline void SetUnknown1c(MxU32 p_unk0x1c) { m_unk0x01c = p_unk0x1c; }
inline void SetElevatorFloor(ElevatorFloor p_elevFloor) { m_elevFloor = p_elevFloor; }
inline void SetUnknown21(MxS16 p_unk0x21) { m_unk0x021 = p_unk0x21; }
// SYNTHETIC: LEGO1 0x10033960
@ -92,10 +100,10 @@ class Act1State : public LegoState {
undefined m_unk0x012; // 0x012
MxS32 m_unk0x014; // 0x014
MxU32 m_unk0x018; // 0x018
MxU16 m_unk0x01c; // 0x01c
MxS16 m_elevFloor; // 0x01c
undefined m_unk0x01e; // 0x01e
MxBool m_unk0x01f; // 0x01f
undefined m_unk0x020; // 0x020
MxBool m_planeActive; // 0x020
undefined m_unk0x021; // 0x021
undefined m_unk0x022; // 0x022
undefined m_unk0x023; // 0x023

View file

@ -79,9 +79,10 @@ class Isle : public LegoWorld {
virtual void VTable0x6c(IslePathActor* p_actor); // vtable+6c
MxLong StopAction(MxParam& p_param);
MxLong HandleClick(MxParam& p_param);
MxLong HandleClick(LegoControlManagerEvent& p_param);
MxLong HandleType19Notification(MxParam& p_param);
MxLong HandleTransitionEnd();
void FUN_10031590();
void FUN_10032620();
void FUN_100330e0();
void FUN_10032d30(

View file

@ -8,9 +8,12 @@
class LegoBackgroundColor : public MxVariable {
public:
LegoBackgroundColor(const char* p_key, const char* p_value);
void SetValue(const char* p_colorString) override;
void SetLights(float p_r, float p_g, float p_b);
void SetLights();
void ToggleDayNight(MxBool);
void ToggleSkyColor();
private:
float m_h;

View file

@ -171,6 +171,7 @@ class LegoGameState {
inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; }
inline Username* GetPlayersIndex(MxS32 p_index) { return &m_players[p_index]; }
inline MxS16 GetPlayerCount() { return m_playerCount; }
inline LegoBackgroundColor* GetBackgroundColor() { return m_backgroundColor; }
void SetCurrentAct(Act p_currentAct);
void FindLoadedAct();

View file

@ -25,6 +25,7 @@ void FUN_1003ef00(MxBool);
void SetAppCursor(WPARAM p_wparam);
MxBool FUN_1003ef60();
MxBool RemoveFromWorld(MxAtomId& p_atomId1, MxS32 p_id1, MxAtomId& p_atomId2, MxS32 p_id2);
MxS32 FUN_1003f050(MxS32);
void SetLightPosition(MxU32);
LegoNamedTexture* ReadNamedTexture(LegoFile* p_file);
void FUN_1003f540(LegoFile* p_file, const char* p_filename);

View file

@ -12,13 +12,15 @@ MxS32 g_unk0x100f37f0[] = {
Act1State::e_unk955,
};
extern MxAtomId* g_isleScript;
// STUB: LEGO1 0x100334b0
Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x010(0)
{
m_unk0x01e = 0;
m_unk0x018 = 1;
m_unk0x010 = 0;
m_unk0x020 = 0;
m_planeActive = FALSE;
m_unk0x00e = 0;
m_unk0x01f = FALSE;
m_unk0x008 = g_unk0x100f37f0;
@ -30,7 +32,7 @@ Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x
m_unk0x160 = NULL;
m_unk0x1b0 = NULL;
m_unk0x021 = 1;
m_unk0x01c = 1;
m_elevFloor = Act1State::c_floor1;
m_unk0x00c = _countof(g_unk0x100f37f0);
m_unk0x1b4 = NULL;
m_unk0x1b8 = NULL;
@ -184,6 +186,21 @@ MxResult Act1State::VTable0x1c(LegoFile* p_legoFile)
return SUCCESS;
}
// STUB: LEGO1 0x10034660
void Act1State::FUN_10034660()
{
// TODO
}
// FUNCTION: LEGO1 0x100346a0
void Act1State::FUN_100346a0()
{
if (m_unk0x014 != -1) {
InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x014, NULL);
m_unk0x014 = -1;
}
}
// FUNCTION: LEGO1 0x100346d0
MxBool Act1State::SetFlag()
{

View file

@ -67,6 +67,18 @@ void LegoBackgroundColor::SetValue(const char* p_colorString)
delete[] colorStringCopy;
}
// STUB: LEGO1 0x1003c230
void LegoBackgroundColor::ToggleDayNight(MxBool)
{
// TODO
}
// STUB: LEGO1 0x1003c330
void LegoBackgroundColor::ToggleSkyColor()
{
// TODO
}
// STUB: LEGO1 0x1003c400
void LegoBackgroundColor::SetLights(float p_r, float p_g, float p_b)
{

View file

@ -291,6 +291,13 @@ MxBool FUN_1003ef60()
return TRUE;
}
// STUB: LEGO1 0x1003f050
MxS32 FUN_1003f050(MxS32)
{
// TODO
return 0;
}
// STUB: LEGO1 0x1003f0d0
void SetLightPosition(MxU32)
{

View file

@ -103,7 +103,7 @@ MxLong ElevatorBottom::HandleClick(LegoControlManagerEvent& p_param)
state = (Act1State*) gs->CreateState("Act1State");
}
state->SetUnknown1c(1);
state->SetElevatorFloor(Act1State::c_floor1);
m_destLocation = LegoGameState::e_elevride;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
VariableTable()->SetVariable(g_varCAMERALOCATION, "LCAMZI1,90");

View file

@ -137,7 +137,7 @@ MxLong Isle::Notify(MxParam& p_param)
}
break;
case c_notificationClick:
result = HandleClick(p_param);
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationType18:
switch (m_act1state->GetUnknown18()) {
@ -191,12 +191,180 @@ void Isle::ReadyWorld()
}
}
// STUB: LGEO1 0x10031030
MxLong Isle::HandleClick(MxParam& p_param)
// FUNCTION: LEGO1 0x10031030
MxLong Isle::HandleClick(LegoControlManagerEvent& p_param)
{
if (p_param.GetUnknown0x28() == 1) {
MxDSAction action;
switch (p_param.GetClickedObjectId()) {
case IsleScript::c_ElevRide_Info_Ctl:
m_act1state->m_unk0x018 = 2;
switch (m_act1state->m_elevFloor) {
case Act1State::c_floor1:
m_destLocation = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
case Act1State::c_floor2:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Elev2_1_Ride, NULL);
InputManager()->DisableInputProcessing();
break;
case Act1State::c_floor3:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Elev3_1_Ride, NULL);
InputManager()->DisableInputProcessing();
break;
}
m_act1state->m_elevFloor = Act1State::c_floor1;
break;
case IsleScript::c_ElevRide_Two_Ctl:
m_act1state->m_unk0x018 = 2;
switch (m_act1state->m_elevFloor) {
case Act1State::c_floor1:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Elev1_2_Ride, NULL);
InputManager()->DisableInputProcessing();
break;
case Act1State::c_floor2:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Floor2, NULL);
m_act1state->m_unk0x01e = 1;
break;
case Act1State::c_floor3:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Elev3_2_Ride, NULL);
InputManager()->DisableInputProcessing();
break;
}
m_act1state->m_elevFloor = Act1State::c_floor2;
break;
case IsleScript::c_ElevRide_Three_Ctl:
m_act1state->m_unk0x018 = 2;
switch (m_act1state->m_elevFloor) {
case Act1State::c_floor1:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Elev1_3_Ride, NULL);
InputManager()->DisableInputProcessing();
break;
case Act1State::c_floor2:
InputManager()->DisableInputProcessing();
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Elev2_3_Ride, NULL);
break;
case Act1State::c_floor3:
m_destLocation = LegoGameState::e_elevopen;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
}
m_act1state->m_elevFloor = Act1State::c_floor3;
break;
case IsleScript::c_ElevOpen_LeftArrow_Ctl:
case IsleScript::c_ElevDown_RightArrow_Ctl:
m_destLocation = LegoGameState::e_seaview;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
case IsleScript::c_ElevOpen_RightArrow_Ctl:
case IsleScript::c_ElevDown_LeftArrow_Ctl:
m_destLocation = LegoGameState::e_observe;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
case IsleScript::c_Observe_LeftArrow_Ctl:
m_act1state->FUN_100346a0();
m_radio.Stop();
case IsleScript::c_SeaView_RightArrow_Ctl:
m_destLocation = LegoGameState::e_elevopen;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
case IsleScript::c_Observe_RightArrow_Ctl:
m_act1state->FUN_100346a0();
m_radio.Stop();
case IsleScript::c_SeaView_LeftArrow_Ctl:
m_destLocation = LegoGameState::e_elevdown;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
case IsleScript::c_Observe_Plane_Ctl:
if (!m_act1state->m_planeActive) {
switch (rand() % 3) {
case 0:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_nic002pr_RunAnim, NULL);
break;
case 1:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_nic003pr_RunAnim, NULL);
break;
case 2:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_nic004pr_RunAnim, NULL);
break;
}
m_act1state->m_planeActive = TRUE;
}
break;
case IsleScript::c_Observe_Sun_Ctl:
GameState()->GetBackgroundColor()->ToggleDayNight(TRUE);
break;
case IsleScript::c_Observe_Moon_Ctl:
GameState()->GetBackgroundColor()->ToggleDayNight(FALSE);
break;
case IsleScript::c_Observe_SkyColor_Ctl:
GameState()->GetBackgroundColor()->ToggleSkyColor();
break;
case IsleScript::c_Observe_LCab_Ctl:
action.SetAtomId(*g_isleScript);
action.SetObjectId(IsleScript::c_Observe_Monkey_Flc);
action.SetUnknown24(0);
Start(&action);
break;
case IsleScript::c_Observe_RCab_Ctl:
FUN_10031590();
break;
case IsleScript::c_Observe_GlobeLArrow_Ctl:
FUN_1003f050(-1);
FUN_10031590();
break;
case IsleScript::c_Observe_GlobeRArrow_Ctl:
FUN_1003f050(1);
FUN_10031590();
break;
case IsleScript::c_Observe_Draw1_Ctl:
case IsleScript::c_Observe_Draw2_Ctl:
m_act1state->FUN_10034660();
break;
case IsleScript::c_ElevDown_Elevator_Ctl:
m_destLocation = LegoGameState::e_elevride2;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
case IsleScript::c_PoliDoor_LeftArrow_Ctl:
case IsleScript::c_PoliDoor_RightArrow_Ctl:
m_destLocation = LegoGameState::e_police;
VariableTable()->SetVariable("VISIBILITY", "Show Policsta");
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
case IsleScript::c_PoliDoor_Door_Ctl:
m_destLocation = LegoGameState::e_unk33;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
case IsleScript::c_GaraDoor_LeftArrow_Ctl:
case IsleScript::c_GaraDoor_RightArrow_Ctl:
m_destLocation = LegoGameState::e_garage;
VariableTable()->SetVariable("VISIBILITY", "Show Gas");
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
case IsleScript::c_GaraDoor_Door_Ctl:
m_destLocation = LegoGameState::e_unk28;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
}
}
return 0;
}
// STUB: LEGO1 0x10031590
void Isle::FUN_10031590()
{
// TODO
}
// STUB: LEGO1 0x100315f0
MxLong Isle::HandleType19Notification(MxParam& p_param)
{