Merge remote-tracking branch 'isle/master'

This commit is contained in:
Christian Semmler 2025-06-26 11:32:59 -07:00
commit eaeccdb77d
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C
3 changed files with 74 additions and 62 deletions

View File

@ -11,6 +11,12 @@ class MxEndActionNotificationParam;
// SIZE 0x24 // SIZE 0x24
class AmbulanceMissionState : public LegoState { class AmbulanceMissionState : public LegoState {
public: public:
enum {
e_ready = 0,
e_enteredAmbulance = 1,
e_prepareAmbulance = 2,
};
AmbulanceMissionState(); AmbulanceMissionState();
// FUNCTION: LEGO1 0x10037440 // FUNCTION: LEGO1 0x10037440
@ -125,18 +131,18 @@ class AmbulanceMissionState : public LegoState {
// SYNTHETIC: LEGO1 0x100376c0 // SYNTHETIC: LEGO1 0x100376c0
// AmbulanceMissionState::`scalar deleting destructor' // AmbulanceMissionState::`scalar deleting destructor'
undefined4 m_unk0x08; // 0x08 MxU32 m_state; // 0x08
MxLong m_startTime; // 0x0c MxLong m_startTime; // 0x0c
MxS16 m_peScore; // 0x10 MxS16 m_peScore; // 0x10
MxS16 m_maScore; // 0x12 MxS16 m_maScore; // 0x12
MxS16 m_paScore; // 0x14 MxS16 m_paScore; // 0x14
MxS16 m_niScore; // 0x16 MxS16 m_niScore; // 0x16
MxS16 m_laScore; // 0x18 MxS16 m_laScore; // 0x18
MxS16 m_peHighScore; // 0x1a MxS16 m_peHighScore; // 0x1a
MxS16 m_maHighScore; // 0x1c MxS16 m_maHighScore; // 0x1c
MxS16 m_paHighScore; // 0x1e MxS16 m_paHighScore; // 0x1e
MxS16 m_niHighScore; // 0x20 MxS16 m_niHighScore; // 0x20
MxS16 m_laHighScore; // 0x22 MxS16 m_laHighScore; // 0x22
}; };
// VTABLE: LEGO1 0x100d71a8 // VTABLE: LEGO1 0x100d71a8
@ -177,15 +183,21 @@ class Ambulance : public IslePathActor {
virtual MxLong HandleEndAction(MxEndActionNotificationParam& p_param); // vtable+0xf4 virtual MxLong HandleEndAction(MxEndActionNotificationParam& p_param); // vtable+0xf4
void CreateState(); void CreateState();
void FUN_10036e60(); void Init();
void ActivateSceneActions(); void ActivateSceneActions();
void StopActions(); void StopActions();
void FUN_10037250(); void Reset();
// SYNTHETIC: LEGO1 0x10036130 // SYNTHETIC: LEGO1 0x10036130
// Ambulance::`scalar deleting destructor' // Ambulance::`scalar deleting destructor'
private: private:
enum {
e_none = 0,
e_waiting = 1,
e_finished = 3,
};
void PlayAnimation(IsleScript::Script p_objectId); void PlayAnimation(IsleScript::Script p_objectId);
void PlayFinalAnimation(IsleScript::Script p_objectId); void PlayFinalAnimation(IsleScript::Script p_objectId);
void StopAction(IsleScript::Script p_objectId); void StopAction(IsleScript::Script p_objectId);
@ -196,9 +208,9 @@ class Ambulance : public IslePathActor {
AmbulanceMissionState* m_state; // 0x164 AmbulanceMissionState* m_state; // 0x164
MxS16 m_unk0x168; // 0x168 MxS16 m_unk0x168; // 0x168
MxS16 m_actorId; // 0x16a MxS16 m_actorId; // 0x16a
MxS16 m_unk0x16c; // 0x16c MxS16 m_atPoliceTask; // 0x16c
MxS16 m_unk0x16e; // 0x16e MxS16 m_atBeachTask; // 0x16e
MxS16 m_unk0x170; // 0x170 MxS16 m_taskState; // 0x170
MxS16 m_unk0x172; // 0x172 MxS16 m_unk0x172; // 0x172
IsleScript::Script m_lastAction; // 0x174 IsleScript::Script m_lastAction; // 0x174
IsleScript::Script m_lastAnimation; // 0x178 IsleScript::Script m_lastAnimation; // 0x178

View File

@ -40,9 +40,9 @@ Ambulance::Ambulance()
m_state = NULL; m_state = NULL;
m_unk0x168 = 0; m_unk0x168 = 0;
m_actorId = -1; m_actorId = -1;
m_unk0x16c = 0; m_atPoliceTask = 0;
m_unk0x16e = 0; m_atBeachTask = 0;
m_unk0x170 = 0; m_taskState = Ambulance::e_none;
m_lastAction = IsleScript::c_noneIsle; m_lastAction = IsleScript::c_noneIsle;
m_unk0x172 = 0; m_unk0x172 = 0;
m_lastAnimation = IsleScript::c_noneIsle; m_lastAnimation = IsleScript::c_noneIsle;
@ -73,7 +73,7 @@ MxResult Ambulance::Create(MxDSAction& p_dsAction)
m_state = (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState"); m_state = (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
if (!m_state) { if (!m_state) {
m_state = new AmbulanceMissionState(); m_state = new AmbulanceMissionState();
m_state->m_unk0x08 = 0; m_state->m_state = AmbulanceMissionState::e_ready;
GameState()->RegisterState(m_state); GameState()->RegisterState(m_state);
} }
} }
@ -173,25 +173,25 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
m_lastAction = IsleScript::c_noneIsle; m_lastAction = IsleScript::c_noneIsle;
} }
else if (objectId == IsleScript::c_hho027en_RunAnim) { else if (objectId == IsleScript::c_hho027en_RunAnim) {
m_state->m_unk0x08 = 1; m_state->m_state = AmbulanceMissionState::e_enteredAmbulance;
CurrentWorld()->PlaceActor(UserActor()); CurrentWorld()->PlaceActor(UserActor());
HandleClick(); HandleClick();
m_unk0x172 = 0; m_unk0x172 = 0;
TickleManager()->RegisterClient(this, 40000); TickleManager()->RegisterClient(this, 40000);
} }
else if (objectId == IsleScript::c_hpz047pe_RunAnim || objectId == IsleScript::c_hpz048pe_RunAnim || objectId == IsleScript::c_hpz049bd_RunAnim || objectId == IsleScript::c_hpz053pa_RunAnim) { else if (objectId == IsleScript::c_hpz047pe_RunAnim || objectId == IsleScript::c_hpz048pe_RunAnim || objectId == IsleScript::c_hpz049bd_RunAnim || objectId == IsleScript::c_hpz053pa_RunAnim) {
if (m_unk0x170 == 3) { if (m_taskState == Ambulance::e_finished) {
PlayAnimation(IsleScript::c_hpz055pa_RunAnim); PlayAnimation(IsleScript::c_hpz055pa_RunAnim);
m_unk0x170 = 0; m_taskState = Ambulance::e_none;
} }
else { else {
PlayAnimation(IsleScript::c_hpz053pa_RunAnim); PlayAnimation(IsleScript::c_hpz053pa_RunAnim);
} }
} }
else if (objectId == IsleScript::c_hpz050bd_RunAnim || objectId == IsleScript::c_hpz052ma_RunAnim) { else if (objectId == IsleScript::c_hpz050bd_RunAnim || objectId == IsleScript::c_hpz052ma_RunAnim) {
if (m_unk0x170 == 3) { if (m_taskState == Ambulance::e_finished) {
PlayAnimation(IsleScript::c_hpz057ma_RunAnim); PlayAnimation(IsleScript::c_hpz057ma_RunAnim);
m_unk0x170 = 0; m_taskState = Ambulance::e_none;
} }
else { else {
PlayAnimation(IsleScript::c_hpz052ma_RunAnim); PlayAnimation(IsleScript::c_hpz052ma_RunAnim);
@ -204,18 +204,18 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
m_unk0x172 = 0; m_unk0x172 = 0;
TickleManager()->RegisterClient(this, 40000); TickleManager()->RegisterClient(this, 40000);
if (m_unk0x16c != 0) { if (m_atPoliceTask != 0) {
StopActions(); StopActions();
} }
} }
else if (objectId == IsleScript::c_hps116bd_RunAnim || objectId == IsleScript::c_hps118re_RunAnim) { else if (objectId == IsleScript::c_hps116bd_RunAnim || objectId == IsleScript::c_hps118re_RunAnim) {
if (objectId == IsleScript::c_hps116bd_RunAnim && m_unk0x170 != 3) { if (objectId == IsleScript::c_hps116bd_RunAnim && m_taskState != Ambulance::e_finished) {
PlayAction(IsleScript::c_Avo923In_PlayWav); PlayAction(IsleScript::c_Avo923In_PlayWav);
} }
if (m_unk0x170 == 3) { if (m_taskState == Ambulance::e_finished) {
PlayAnimation(IsleScript::c_hps117bd_RunAnim); PlayAnimation(IsleScript::c_hps117bd_RunAnim);
m_unk0x170 = 0; m_taskState = Ambulance::e_none;
} }
else { else {
PlayAnimation(IsleScript::c_hps118re_RunAnim); PlayAnimation(IsleScript::c_hps118re_RunAnim);
@ -228,12 +228,12 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
m_unk0x172 = 0; m_unk0x172 = 0;
TickleManager()->RegisterClient(this, 40000); TickleManager()->RegisterClient(this, 40000);
if (m_unk0x16e != 0) { if (m_atBeachTask != 0) {
StopActions(); StopActions();
} }
} }
else if (objectId == IsleScript::c_hho142cl_RunAnim || objectId == IsleScript::c_hho143cl_RunAnim || objectId == IsleScript::c_hho144cl_RunAnim) { else if (objectId == IsleScript::c_hho142cl_RunAnim || objectId == IsleScript::c_hho143cl_RunAnim || objectId == IsleScript::c_hho144cl_RunAnim) {
FUN_10037250(); Reset();
} }
} }
@ -244,18 +244,18 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
// FUNCTION: BETA10 0x100230bf // FUNCTION: BETA10 0x100230bf
MxLong Ambulance::HandleButtonDown(LegoControlManagerNotificationParam& p_param) MxLong Ambulance::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
{ {
if (m_unk0x170 == 1) { if (m_taskState == Ambulance::e_waiting) {
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
if (roi != NULL && !SDL_strcasecmp(roi->GetName(), "ps-gate")) { if (roi != NULL && !SDL_strcasecmp(roi->GetName(), "ps-gate")) {
m_unk0x170 = 3; m_taskState = Ambulance::e_finished;
return 1; return 1;
} }
roi = PickRootROI(p_param.GetX(), p_param.GetY()); roi = PickRootROI(p_param.GetX(), p_param.GetY());
if (roi != NULL && !SDL_strcasecmp(roi->GetName(), "gd")) { if (roi != NULL && !SDL_strcasecmp(roi->GetName(), "gd")) {
m_unk0x170 = 3; m_taskState = Ambulance::e_finished;
return 1; return 1;
} }
} }
@ -273,9 +273,9 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
} }
if (p_param.GetTrigger() == LegoPathStruct::c_camAnim && p_param.GetData() == 0x0b) { if (p_param.GetTrigger() == LegoPathStruct::c_camAnim && p_param.GetData() == 0x0b) {
if (m_unk0x16e != 0) { if (m_atBeachTask != 0) {
if (m_unk0x16c != 0) { if (m_atPoliceTask != 0) {
m_state->m_unk0x08 = 2; m_state->m_state = AmbulanceMissionState::e_prepareAmbulance;
if (m_lastAction != IsleScript::c_noneIsle) { if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
@ -300,7 +300,7 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
return 0; return 0;
} }
if (m_unk0x16e != 0) { if (m_atBeachTask != 0) {
if (m_lastAction != IsleScript::c_noneIsle) { if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
} }
@ -310,7 +310,7 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
} }
} }
if (m_unk0x16c != 0) { if (m_atPoliceTask != 0) {
if (m_lastAction != IsleScript::c_noneIsle) { if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
} }
@ -318,9 +318,9 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
PlayAction(IsleScript::c_Avo915In_PlayWav); PlayAction(IsleScript::c_Avo915In_PlayWav);
} }
} }
else if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x131 && m_unk0x16e == 0) { else if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x131 && m_atBeachTask == 0) {
m_unk0x16e = 1; m_atBeachTask = 1;
m_unk0x170 = 1; m_taskState = Ambulance::e_waiting;
if (m_lastAction != IsleScript::c_noneIsle) { if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
@ -348,9 +348,9 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
break; break;
} }
} }
else if (p_param.GetTrigger() == LegoPathStruct::c_camAnim && (p_param.GetData() == 0x22 || p_param.GetData() == 0x23 || p_param.GetData() == 0x24) && m_unk0x16c == 0) { else if (p_param.GetTrigger() == LegoPathStruct::c_camAnim && (p_param.GetData() == 0x22 || p_param.GetData() == 0x23 || p_param.GetData() == 0x24) && m_atPoliceTask == 0) {
m_unk0x16c = 1; m_atPoliceTask = 1;
m_unk0x170 = 1; m_taskState = Ambulance::e_waiting;
if (m_lastAction != IsleScript::c_noneIsle) { if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
@ -371,7 +371,7 @@ MxLong Ambulance::HandleClick()
return 1; return 1;
} }
if (m_state->m_unk0x08 == 2) { if (m_state->m_state == AmbulanceMissionState::e_prepareAmbulance) {
return 1; return 1;
} }
@ -390,7 +390,7 @@ MxLong Ambulance::HandleClick()
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_AmbulanceDashboard, NULL); InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_AmbulanceDashboard, NULL);
ControlManager()->Register(this); ControlManager()->Register(this);
if (m_state->m_unk0x08 == 1) { if (m_state->m_state == AmbulanceMissionState::e_enteredAmbulance) {
SpawnPlayer(LegoGameState::e_hospitalExited, TRUE, 0); SpawnPlayer(LegoGameState::e_hospitalExited, TRUE, 0);
m_state->m_startTime = Timer()->GetTime(); m_state->m_startTime = Timer()->GetTime();
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_pns018rd_RunAnim, NULL); InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_pns018rd_RunAnim, NULL);
@ -401,9 +401,9 @@ MxLong Ambulance::HandleClick()
// FUNCTION: LEGO1 0x10036e60 // FUNCTION: LEGO1 0x10036e60
// FUNCTION: BETA10 0x100236bb // FUNCTION: BETA10 0x100236bb
void Ambulance::FUN_10036e60() void Ambulance::Init()
{ {
m_state->m_unk0x08 = 2; m_state->m_state = AmbulanceMissionState::e_prepareAmbulance;
PlayAnimation(IsleScript::c_hho027en_RunAnim); PlayAnimation(IsleScript::c_hho027en_RunAnim);
m_lastAction = IsleScript::c_noneIsle; m_lastAction = IsleScript::c_noneIsle;
m_lastAnimation = IsleScript::c_noneIsle; m_lastAnimation = IsleScript::c_noneIsle;
@ -414,7 +414,7 @@ void Ambulance::Exit()
{ {
GameState()->m_currentArea = LegoGameState::e_hospitalExterior; GameState()->m_currentArea = LegoGameState::e_hospitalExterior;
StopActions(); StopActions();
FUN_10037250(); Reset();
Leave(); Leave();
} }
@ -470,11 +470,11 @@ void Ambulance::ActivateSceneActions()
{ {
PlayMusic(JukeboxScript::c_Hospital_Music); PlayMusic(JukeboxScript::c_Hospital_Music);
if (m_state->m_unk0x08 == 1) { if (m_state->m_state == AmbulanceMissionState::e_enteredAmbulance) {
m_state->m_unk0x08 = 0; m_state->m_state = AmbulanceMissionState::e_ready;
PlayAction(IsleScript::c_ham033cl_PlayWav); PlayAction(IsleScript::c_ham033cl_PlayWav);
} }
else if (m_unk0x16c != 0 && m_unk0x16e != 0) { else if (m_atPoliceTask != 0 && m_atBeachTask != 0) {
IsleScript::Script objectId; IsleScript::Script objectId;
switch (SDL_rand(2)) { switch (SDL_rand(2)) {
@ -574,14 +574,14 @@ void Ambulance::StopActions()
} }
// FUNCTION: LEGO1 0x10037250 // FUNCTION: LEGO1 0x10037250
void Ambulance::FUN_10037250() void Ambulance::Reset()
{ {
StopAction(m_lastAction); StopAction(m_lastAction);
BackgroundAudioManager()->RaiseVolume(); BackgroundAudioManager()->RaiseVolume();
((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 0; ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 0;
m_state->m_unk0x08 = 0; m_state->m_state = AmbulanceMissionState::e_ready;
m_unk0x16e = 0; m_atBeachTask = 0;
m_unk0x16c = 0; m_atPoliceTask = 0;
g_isleFlags |= Isle::c_playMusic; g_isleFlags |= Isle::c_playMusic;
AnimationManager()->EnableCamAnims(TRUE); AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE); AnimationManager()->FUN_1005f6d0(TRUE);
@ -629,7 +629,7 @@ void Ambulance::PlayAction(IsleScript::Script p_objectId)
// FUNCTION: LEGO1 0x100373a0 // FUNCTION: LEGO1 0x100373a0
AmbulanceMissionState::AmbulanceMissionState() AmbulanceMissionState::AmbulanceMissionState()
{ {
m_unk0x08 = 0; m_state = AmbulanceMissionState::e_ready;
m_startTime = 0; m_startTime = 0;
m_peScore = 0; m_peScore = 0;
m_maScore = 0; m_maScore = 0;

View File

@ -810,7 +810,7 @@ void Isle::Enable(MxBool p_enable)
AnimationManager()->EnableCamAnims(FALSE); AnimationManager()->EnableCamAnims(FALSE);
g_isleFlags &= ~c_playMusic; g_isleFlags &= ~c_playMusic;
m_ambulance->FUN_10036e60(); m_ambulance->Init();
break; break;
case 11: case 11:
m_act1state->m_unk0x018 = 0; m_act1state->m_unk0x018 = 0;
@ -1209,7 +1209,7 @@ MxBool Isle::Escape()
case 10: case 10:
if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) { if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) {
m_ambulance->StopActions(); m_ambulance->StopActions();
m_ambulance->FUN_10037250(); m_ambulance->Reset();
} }
break; break;
} }
@ -1250,7 +1250,7 @@ void Isle::FUN_10033350()
if (m_act1state->m_unk0x018 == 10) { if (m_act1state->m_unk0x018 == 10) {
if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) { if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) {
m_ambulance->StopActions(); m_ambulance->StopActions();
m_ambulance->FUN_10037250(); m_ambulance->Reset();
} }
} }