From c38e157fdb3d0862040b7c03fb24810d50b35fab Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Fri, 25 Oct 2024 18:04:01 +0200 Subject: [PATCH] Implement LegoCarBuild functions, refactor BackgroundAudioManager (#1117) * Implement LegoCarBuild functions, refactor BackgroundAudioManager * Refactor LegoVehicleBuildState::m_animationState to enum --------- Co-authored-by: jonschz --- LEGO1/lego/legoomni/include/legocarbuild.h | 26 +-- .../legoomni/include/legocarbuildpresenter.h | 5 +- LEGO1/lego/legoomni/include/legomain.h | 3 + .../include/mxbackgroundaudiomanager.h | 17 +- .../legoomni/src/actors/islepathactor.cpp | 2 +- .../legoomni/src/actors/jukeboxentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/radio.cpp | 4 +- .../src/audio/mxbackgroundaudiomanager.cpp | 51 ++++-- .../lego/legoomni/src/build/legocarbuild.cpp | 162 ++++++++++++++++-- .../src/build/legocarbuildpresenter.cpp | 9 +- LEGO1/lego/legoomni/src/common/misc.cpp | 6 +- LEGO1/lego/legoomni/src/main/legomain.cpp | 1 + LEGO1/lego/legoomni/src/main/scripts.cpp | 1 + .../legoomni/src/paths/legopathstruct.cpp | 2 +- LEGO1/omni/include/mxdssound.h | 1 + LEGO1/omni/include/mxnotificationparam.h | 1 + LEGO1/omni/include/mxsoundmanager.h | 3 +- 17 files changed, 242 insertions(+), 54 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index 8e9e3922..0afb0824 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -16,6 +16,14 @@ class MxActionNotificationParam; // SIZE 0x50 class LegoVehicleBuildState : public LegoState { public: + enum AnimationState { + e_unknown0 = 0, + e_entering = 1, + e_unknown2 = 2, + e_cutscene = 3, + e_exiting = 6 + }; + LegoVehicleBuildState(const char* p_classType); // FUNCTION: LEGO1 0x10025ff0 @@ -46,15 +54,11 @@ class LegoVehicleBuildState : public LegoState { // * LegoJetskiBuildState MxString m_className; // 0x38 - // Known States: - // * 1 == enter(ing) build screen - // * 3 == cutscene/dialogue - // * 6 == exit(ing) build screen - MxU32 m_animationState; // 0x48 - undefined m_unk0x4c; // 0x4c - MxBool m_unk0x4d; // 0x4d - MxBool m_unk0x4e; // 0x4e - MxU8 m_placedPartCount; // 0x4f + AnimationState m_animationState; // 0x48 + undefined m_unk0x4c; // 0x4c + MxBool m_unk0x4d; // 0x4d + MxBool m_unk0x4e; // 0x4e + MxU8 m_placedPartCount; // 0x4f }; typedef LegoVehicleBuildState LegoRaceCarBuildState; @@ -114,7 +118,7 @@ class LegoCarBuild : public LegoWorld { undefined4 FUN_100246e0(MxLong p_x, MxLong p_y); MxS32 FUN_10024850(MxLong p_x, MxLong p_y); undefined4 FUN_10024890(LegoEventNotificationParam* p_param); - void FUN_10024c20(LegoEventNotificationParam* p_param); + undefined4 FUN_10024c20(LegoEventNotificationParam* p_param); void FUN_10024ef0(); void FUN_10024f50(); void FUN_10024f70(MxBool p_enabled); @@ -198,7 +202,7 @@ class LegoCarBuild : public LegoWorld { // variable name verified by BETA10 0x1006cba7 LegoGameState::Area m_destLocation; // 0x334 - undefined4 m_unk0x338; // 0x338 + MxPresenter* m_unk0x338; // 0x338 MxControlPresenter* m_unk0x33c; // 0x33c undefined4 m_unk0x340; // 0x340 undefined4 m_unk0x344; // 0x344 diff --git a/LEGO1/lego/legoomni/include/legocarbuildpresenter.h b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h index 52135bac..b1233ada 100644 --- a/LEGO1/lego/legoomni/include/legocarbuildpresenter.h +++ b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h @@ -75,7 +75,8 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { void FUN_10079a90(); MxBool StringEqualsPlatform(const LegoChar* p_string); MxBool StringEqualsShelf(const LegoChar* p_string); - MxBool FUN_10079cf0(const LegoChar* p_string); + MxBool StringEndsOnY(const LegoChar* p_string); + MxBool StringEndsOnZero(const LegoChar* p_string); // FUNCTION: BETA10 0x10070180 void SetUnknown0xbc(undefined2 p_unk0xbc) { m_unk0xbc = p_unk0xbc; } @@ -117,6 +118,8 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { // name verified by BETA10 0x10070d63 LegoChar* m_mainSourceId; // 0x14c + + friend class LegoCarBuild; }; #endif // LEGOCARBUILDPRESENTER_H diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 75df917d..182500c1 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -134,7 +134,10 @@ class LegoOmni : public MxOmni { LegoPlantManager* GetPlantManager() { return m_plantManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; } LegoBuildingManager* GetBuildingManager() { return m_buildingManager; } + + // FUNCTION: BETA10 0x100e52b0 LegoGameState* GetGameState() { return m_gameState; } + MxBackgroundAudioManager* GetBackgroundAudioManager() { return m_bkgAudioManager; } MxTransitionManager* GetTransitionManager() { return m_transitionManager; } MxDSAction& GetCurrentAction() { return m_action; } diff --git a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h index 20aa07bb..88bec8b1 100644 --- a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h +++ b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h @@ -3,6 +3,7 @@ #include "mxcore.h" #include "mxdsaction.h" +#include "mxpresenter.h" #include "mxtypes.h" class MxAudioPresenter; @@ -34,7 +35,7 @@ class MxBackgroundAudioManager : public MxCore { void StartAction(MxParam& p_param); void StopAction(MxParam& p_param); - MxResult PlayMusic(MxDSAction& p_action, undefined4 p_unk0x140, undefined4 p_unk0x13c); + MxResult PlayMusic(MxDSAction& p_action, undefined4 p_unk0x140, MxPresenter::TickleState p_tickleState); void FUN_1007ee70(); void FUN_1007ef40(); @@ -47,6 +48,7 @@ class MxBackgroundAudioManager : public MxCore { void Stop(); void LowerVolume(); void RaiseVolume(); + undefined4 FUN_1007f610(MxPresenter* p_unk0x138, MxS32 p_unk0x140, MxPresenter::TickleState p_tickleState); // SYNTHETIC: LEGO1 0x1007ec00 // MxBackgroundAudioManager::`scalar deleting destructor' @@ -60,11 +62,14 @@ class MxBackgroundAudioManager : public MxCore { MxAudioPresenter* m_unk0xa0; // 0xa0 MxDSAction m_action2; // 0xa4 MxAudioPresenter* m_unk0x138; // 0x138 - MxS32 m_unk0x13c; // 0x13c - MxS32 m_unk0x140; // 0x140 - MxS32 m_targetVolume; // 0x144 - MxS16 m_unk0x148; // 0x148 - MxAtomId m_script; // 0x14c + + // name is inferred from context + MxPresenter::TickleState m_tickleState; // 0x13c + + MxS32 m_unk0x140; // 0x140 + MxS32 m_targetVolume; // 0x144 + MxS16 m_unk0x148; // 0x148 + MxAtomId m_script; // 0x14c }; #endif // MXBACKGROUNDAUDIOMANAGER_H diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 2ab12451..4aafa214 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -600,7 +600,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 MxDSAction action; action.SetAtomId(*g_jukeboxScript); action.SetObjectId(g_spawnLocations[i].m_music); - BackgroundAudioManager()->PlayMusic(action, 5, 4); + BackgroundAudioManager()->PlayMusic(action, 5, MxPresenter::e_repeating); } } } diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index 6888ebfa..a504fcbc 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -92,7 +92,7 @@ void JukeBoxEntity::StartAction() BackgroundAudioManager()->Enable(TRUE); } - BackgroundAudioManager()->PlayMusic(action, 5, 4); + BackgroundAudioManager()->PlayMusic(action, 5, MxPresenter::e_repeating); } // FUNCTION: LEGO1 0x100860f0 diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index 8d267d5a..4704ca29 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -115,7 +115,7 @@ void Radio::Play() BackgroundAudioManager()->Enable(TRUE); } - BackgroundAudioManager()->PlayMusic(action, 3, 4); + BackgroundAudioManager()->PlayMusic(action, 3, MxPresenter::e_repeating); m_state->SetActive(TRUE); } } @@ -178,7 +178,7 @@ MxLong Radio::HandleEndAction(MxEndActionNotificationParam& p_param) action.SetObjectId(m_state->FUN_1002d090()); action.SetLoopCount(1); - BackgroundAudioManager()->PlayMusic(action, 3, 4); + BackgroundAudioManager()->PlayMusic(action, 3, MxPresenter::e_repeating); return 1; } diff --git a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp index 90d9df9b..d3e08256 100644 --- a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp @@ -20,7 +20,7 @@ MxBackgroundAudioManager::MxBackgroundAudioManager() NotificationManager()->Register(this); m_unk0xa0 = 0; m_unk0x138 = 0; - m_unk0x13c = 0; + m_tickleState = MxPresenter::e_idle; m_unk0x140 = 0; m_targetVolume = 0; m_unk0x148 = 0; @@ -81,7 +81,7 @@ void MxBackgroundAudioManager::DestroyMusic() // FUNCTION: LEGO1 0x1007ee40 MxResult MxBackgroundAudioManager::Tickle() { - switch (m_unk0x13c) { + switch (m_tickleState) { case MxPresenter::e_starting: FadeInOrFadeOut(); break; @@ -108,7 +108,7 @@ void MxBackgroundAudioManager::FUN_1007ee70() m_unk0x138 = NULL; m_action2.SetObjectId(-1); m_action2.SetAtomId(MxAtomId()); - m_unk0x13c = 0; + m_tickleState = MxPresenter::e_idle; } } @@ -141,7 +141,7 @@ void MxBackgroundAudioManager::FUN_1007ef40() m_unk0x138 = NULL; m_action2.SetObjectId(-1); m_action2.SetAtomId(MxAtomId()); - m_unk0x13c = 0; + m_tickleState = MxPresenter::e_idle; } } } @@ -187,11 +187,11 @@ void MxBackgroundAudioManager::FadeInOrFadeOut() } else { m_unk0xa0->SetVolume(volume); - m_unk0x13c = 0; + m_tickleState = MxPresenter::e_idle; } } else { - m_unk0x13c = 0; + m_tickleState = MxPresenter::e_idle; } } @@ -238,7 +238,11 @@ void MxBackgroundAudioManager::StopAction(MxParam& p_param) } // FUNCTION: LEGO1 0x1007f2f0 -MxResult MxBackgroundAudioManager::PlayMusic(MxDSAction& p_action, undefined4 p_unk0x140, undefined4 p_unk0x13c) +MxResult MxBackgroundAudioManager::PlayMusic( + MxDSAction& p_action, + undefined4 p_unk0x140, + MxPresenter::TickleState p_tickleState +) { if (!m_enabled) { return SUCCESS; @@ -262,7 +266,7 @@ MxResult MxBackgroundAudioManager::PlayMusic(MxDSAction& p_action, undefined4 p_ GetCurrentAction().SetUnknown24(action.GetUnknown24()); if (result == SUCCESS) { - m_unk0x13c = p_unk0x13c; + m_tickleState = p_tickleState; m_unk0x140 = p_unk0x140; } @@ -292,15 +296,15 @@ void MxBackgroundAudioManager::Stop() m_action1.SetAtomId(MxAtomId()); m_unk0x148 = 0; m_action1.SetObjectId(-1); - m_unk0x13c = 0; + m_tickleState = MxPresenter::e_idle; } // FUNCTION: LEGO1 0x1007f570 void MxBackgroundAudioManager::LowerVolume() { if (m_unk0x148 == 0) { - if (m_unk0x13c == 0) { - m_unk0x13c = 2; + if (m_tickleState == 0) { + m_tickleState = MxPresenter::e_starting; } m_unk0x140 = 20; } @@ -313,8 +317,8 @@ void MxBackgroundAudioManager::RaiseVolume() if (m_unk0x148 != 0) { m_unk0x148--; if (m_unk0x148 == 0) { - if (m_unk0x13c == 0) { - m_unk0x13c = 2; + if (m_tickleState == 0) { + m_tickleState = MxPresenter::e_starting; } m_unk0x140 = 10; } @@ -333,9 +337,28 @@ void MxBackgroundAudioManager::Enable(MxBool p_enable) } } +// FUNCTION: LEGO1 0x1007f610 +// FUNCTION: BETA10 0x100e95ee +undefined4 MxBackgroundAudioManager::FUN_1007f610( + MxPresenter* p_unk0x138, + MxS32 p_unk0x140, + MxPresenter::TickleState p_tickleState +) + +{ + m_unk0x138 = (MxAudioPresenter*) p_unk0x138; + m_targetVolume = ((MxDSSound*) m_unk0x138->GetAction())->GetVolume(); + + ((MxCompositePresenter*) m_unk0x138)->VTable0x60(NULL); + + m_unk0x140 = p_unk0x140; + m_tickleState = p_tickleState; + return 0; +} + // FUNCTION: LEGO1 0x1007f650 void MxBackgroundAudioManager::Init() { this->m_unk0xa0 = 0; - this->m_unk0x13c = 0; + this->m_tickleState = MxPresenter::e_idle; } diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index 4d5fcbdb..48e6bb03 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -1,9 +1,14 @@ #include "legocarbuild.h" +#include "dunebuggy.h" +#include "helicopter.h" +#include "jetski.h" +#include "jukebox_actions.h" #include "legocarbuildpresenter.h" #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" +#include "legosoundmanager.h" #include "legoutils.h" #include "misc.h" #include "mxactionnotificationparam.h" @@ -15,8 +20,10 @@ #include "mxstillpresenter.h" #include "mxticklemanager.h" #include "mxtransitionmanager.h" +#include "racecar.h" #include "scripts.h" +#include #include DECOMP_SIZE_ASSERT(LegoCarBuild, 0x34c) @@ -141,7 +148,7 @@ MxResult LegoCarBuild::Create(MxDSAction& p_dsAction) GameState()->StopArea(LegoGameState::e_previousArea); - m_buildState->m_animationState = 1; + m_buildState->m_animationState = LegoVehicleBuildState::e_entering; m_unk0x100 = 0; BackgroundAudioManager()->Stop(); @@ -548,7 +555,7 @@ MxLong LegoCarBuild::Notify(MxParam& p_param) assert(m_buildState); if (((m_buildState->m_animationState != 4) && (m_buildState->m_animationState != 6)) && (m_buildState->m_animationState != 2)) { - m_buildState->m_animationState = 0; + m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0; result = FUN_100244e0( ((LegoEventNotificationParam&) p_param).GetX(), ((LegoEventNotificationParam&) p_param).GetY() @@ -618,7 +625,7 @@ void LegoCarBuild::ReadyWorld() if (BackgroundAudioManager()->GetEnabled()) { InvokeAction(Extra::ActionType::e_start, *g_jukeboxScript, FUN_10025ee0(m_unk0x330), NULL); - m_buildState->m_animationState = 2; + m_buildState->m_animationState = LegoVehicleBuildState::e_unknown2; NotificationManager()->Send(this, MxNotificationParam()); } else { @@ -663,7 +670,7 @@ undefined4 LegoCarBuild::FUN_10024480(MxActionNotificationParam* p_param) switch (m_buildState->m_animationState) { case 3: BackgroundAudioManager()->RaiseVolume(); - m_buildState->m_animationState = 0; + m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0; result = 1; break; case 6: @@ -772,18 +779,115 @@ undefined4 LegoCarBuild::FUN_10024890(LegoEventNotificationParam* p_param) return 0; } -// STUB: LEGO1 0x10024c20 -// STUB: BETA10 0x1006db21 -void LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param) +// FUNCTION: LEGO1 0x10024c20 +// FUNCTION: BETA10 0x1006db21 +undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param) { - // TODO + LegoEntity* entity; + assert(m_buildState); + + switch (m_buildState->m_animationState) { + case 4: + entity = (LegoEntity*) Find(m_atomId, m_unk0x330); + + if (entity && entity->GetROI()) { + + // This function was changed between BETA10 and LEGO1. + // These lines looks like a relic from older code. + LegoWorld* destWorld = NULL; + destWorld = FindWorld(*g_isleScript, 0); + + Act1State* gameState = (Act1State*) GameState()->GetState("Act1State"); + + switch (GameState()->GetCurrentArea()) { + case LegoGameState::e_copterbuild: + if (gameState->m_helicopter) { + delete gameState->m_helicopter; + } + + gameState->m_helicopter = (Helicopter*) entity; + gameState->m_unk0x108.SetName(""); + break; + case LegoGameState::e_dunecarbuild: + if (gameState->m_dunebuggy) { + delete gameState->m_dunebuggy; + } + + gameState->m_dunebuggy = (DuneBuggy*) entity; + gameState->m_unk0x1bc.SetName(""); + break; + case LegoGameState::e_jetskibuild: + if (gameState->m_jetski) { + delete gameState->m_jetski; + } + + gameState->m_jetski = (Jetski*) entity; + gameState->m_unk0x164.SetName(""); + break; + case LegoGameState::e_racecarbuild: + if (gameState->m_racecar) { + delete gameState->m_racecar; + } + + gameState->m_racecar = (RaceCar*) entity; + gameState->m_unk0x210.SetName(""); + break; + } + + assert(destWorld); + m_buildState->m_animationState = LegoVehicleBuildState::e_exiting; + + if (m_unk0x258->m_numberOfParts != m_unk0x258->m_placedPartCount) { + FUN_100243a0(); + } + else { + FUN_10025720(5); + } + } + else { + MxNotificationParam param; + NotificationManager()->Send(this, param); + } + break; + case 2: + MxU32 jukeboxScript; + + switch (m_unk0x330) { + case 1: + jukeboxScript = JukeboxScript::c_HelicopterBuild_Music; + break; + case 2: + jukeboxScript = JukeboxScript::c_DuneCarBuild_Music; + break; + case 3: + jukeboxScript = JukeboxScript::c_JetskiBuild_Music; + break; + case 4: + jukeboxScript = JukeboxScript::c_RaceCarBuild_Music; + } + + m_unk0x338 = SoundManager()->FUN_100aebd0(*g_jukeboxScript, jukeboxScript); + + if (m_unk0x338) { + BackgroundAudioManager()->FUN_1007f610(m_unk0x338, 5, MxPresenter::e_repeating); + FUN_10024ef0(); + } + else { + MxNotificationParam p; + // In BETA10, NotificationManager->Send() also takes __FILE__ and __LINE__ arguments + NotificationManager()->Send(this, p); + } + break; + } + + return 1; } // FUNCTION: LEGO1 0x10024ef0 void LegoCarBuild::FUN_10024ef0() { FUN_1003eda0(); - m_buildState->m_animationState = 3; + m_buildState->m_animationState = LegoVehicleBuildState::e_cutscene; FUN_10025720(FUN_10025d70()); m_buildState->m_unk0x4c += 1; FUN_10015820(FALSE, 7); @@ -801,7 +905,7 @@ void LegoCarBuild::FUN_10024f50() // FUNCTION: BETA10 0x1006e002 void LegoCarBuild::FUN_10024f70(MxBool p_enabled) { - if (m_unk0x258->FUN_10079cf0(m_unk0x110->GetName())) { + if (m_unk0x258->StringEndsOnY(m_unk0x110->GetName())) { SetPresentersEnabled(p_enabled); } } @@ -832,11 +936,41 @@ void LegoCarBuild::TogglePresentersEnabled() m_Black_Ctl->Enable(!m_Black_Ctl->IsEnabled()); } -// STUB: LEGO1 0x100250e0 -// STUB: BETA10 0x1006e124 +// FUNCTION: LEGO1 0x100250e0 +// FUNCTION: BETA10 0x1006e124 void LegoCarBuild::FUN_100250e0(MxBool p_enabled) { - // TODO + if (m_unk0x258->StringEndsOnZero(m_unk0x110->GetName()) && m_Decals_Ctl) { + if (strnicmp(m_unk0x110->GetName(), "JSFRNT", strlen("JSFRNT")) == 0) { + m_Decal_Bitmap->Enable(p_enabled); + m_Decals_Ctl->Enable(p_enabled); + m_Decals_Ctl1->Enable(p_enabled); + m_Decals_Ctl2->Enable(p_enabled); + m_Decals_Ctl3->Enable(p_enabled); + } + else if (strnicmp(m_unk0x110->GetName(), "JSWNSH", strlen("JSWNSH")) == 0) { + m_Decal_Bitmap->Enable(p_enabled); + m_Decals_Ctl4->Enable(p_enabled); + m_Decals_Ctl5->Enable(p_enabled); + m_Decals_Ctl6->Enable(p_enabled); + m_Decals_Ctl7->Enable(p_enabled); + } + else if (strnicmp(m_unk0x110->GetName(), "RCBACK", strlen("RCBACK")) == 0) { + m_Decals_Ctl1->Enable(p_enabled); + } + else if (strnicmp(m_unk0x110->GetName(), "RCTAIL", strlen("RCTAIL")) == 0) { + m_Decals_Ctl2->Enable(p_enabled); + } + else if (m_Decals_Ctl1 && strnicmp(m_unk0x110->GetName(), "chljety", strlen("chljety")) == 0) { + m_Decals_Ctl1->Enable(p_enabled); + } + else if (m_Decals_Ctl2 && strnicmp(m_unk0x110->GetName(), "chrjety", strlen("chrjety")) == 0) { + m_Decals_Ctl2->Enable(p_enabled); + } + else if (m_Decals_Ctl) { + m_Decals_Ctl->Enable(p_enabled); + } + } } // STUB: LEGO1 0x10025450 @@ -927,7 +1061,7 @@ MxBool LegoCarBuild::Escape() InvokeAction(Extra::ActionType::e_stop, *g_jukeboxScript, targetEntityId, NULL); DeleteObjects(&m_atomId, 500, 999); - m_buildState->m_animationState = 0; + m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0; m_destLocation = LegoGameState::e_infomain; return TRUE; } diff --git a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp index 71d989dd..28cfbc53 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp @@ -615,11 +615,18 @@ MxBool LegoCarBuildAnimPresenter::PartIsPlaced(const LegoChar* p_name) // FUNCTION: LEGO1 0x10079cf0 // FUNCTION: BETA10 0x100727b3 -MxBool LegoCarBuildAnimPresenter::FUN_10079cf0(const LegoChar* p_string) +MxBool LegoCarBuildAnimPresenter::StringEndsOnY(const LegoChar* p_string) { return (p_string[strlen(p_string) - 2] == 'Y') || (p_string[strlen(p_string) - 2] == 'y'); } +// FUNCTION: LEGO1 0x10079d30 +// FUNCTION: BETA10 0x1007280e +MxBool LegoCarBuildAnimPresenter::StringEndsOnZero(const LegoChar* p_string) +{ + return (p_string[strlen(p_string) - 2] != '0'); +} + // FUNCTION: LEGO1 0x10079e20 // FUNCTION: BETA10 0x10072959 const BoundingSphere& LegoCarBuildAnimPresenter::FUN_10079e20() diff --git a/LEGO1/lego/legoomni/src/common/misc.cpp b/LEGO1/lego/legoomni/src/common/misc.cpp index dee4ac0e..f9c78e5d 100644 --- a/LEGO1/lego/legoomni/src/common/misc.cpp +++ b/LEGO1/lego/legoomni/src/common/misc.cpp @@ -53,8 +53,10 @@ LegoControlManager* ControlManager() } // FUNCTION: LEGO1 0x10015760 +// FUNCTION: BETA10 0x100e492a LegoGameState* GameState() { + assert(LegoOmni::GetInstance()); return LegoOmni::GetInstance()->GetGameState(); } @@ -166,8 +168,10 @@ void DeleteAction() } // FUNCTION: LEGO1 0x100158c0 +// FUNCTION: BETA10 0x100e4e18 LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid) { + assert(LegoOmni::GetInstance()); return LegoOmni::GetInstance()->FindWorld(p_atom, p_entityid); } @@ -196,7 +200,7 @@ void PlayMusic(JukeboxScript::Script p_script) action.SetAtomId(*g_jukeboxScript); action.SetObjectId(p_script); - LegoOmni::GetInstance()->GetBackgroundAudioManager()->PlayMusic(action, 5, 4); + LegoOmni::GetInstance()->GetBackgroundAudioManager()->PlayMusic(action, 5, MxPresenter::e_repeating); } // FUNCTION: LEGO1 0x100159c0 diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index 4244c5bb..2d39165d 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -357,6 +357,7 @@ void LegoOmni::RemoveWorld(const MxAtomId& p_atom, MxLong p_objectId) } // FUNCTION: LEGO1 0x1005b0c0 +// FUNCTION: BETA10 0x1008e827 LegoWorld* LegoOmni::FindWorld(const MxAtomId& p_atom, MxS32 p_entityid) { if (m_worldList) { diff --git a/LEGO1/lego/legoomni/src/main/scripts.cpp b/LEGO1/lego/legoomni/src/main/scripts.cpp index 32c3f86e..b5d7fe54 100644 --- a/LEGO1/lego/legoomni/src/main/scripts.cpp +++ b/LEGO1/lego/legoomni/src/main/scripts.cpp @@ -27,6 +27,7 @@ MxAtomId* g_jetraceScript = NULL; MxAtomId* g_jetracerScript = NULL; // GLOBAL: LEGO1 0x100f453c +// GLOBAL: BETA10 0x10211534 MxAtomId* g_isleScript = NULL; // GLOBAL: LEGO1 0x100f4540 diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp index 1a39478e..970402c8 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -161,6 +161,6 @@ void LegoPathStruct::PlayMusic(MxBool p_direction, MxU32 p_data) } if (action.GetObjectId() != -1) { - BackgroundAudioManager()->PlayMusic(action, 5, 4); + BackgroundAudioManager()->PlayMusic(action, 5, MxPresenter::e_repeating); } } diff --git a/LEGO1/omni/include/mxdssound.h b/LEGO1/omni/include/mxdssound.h index a0b81b4b..ae69e2d9 100644 --- a/LEGO1/omni/include/mxdssound.h +++ b/LEGO1/omni/include/mxdssound.h @@ -30,6 +30,7 @@ class MxDSSound : public MxDSMediaAction { void Deserialize(MxU8*& p_source, MxS16 p_unk0x24) override; // vtable+1c; MxDSAction* Clone() override; // vtable+2c; + // FUNCTION: BETA10 0x1008d060 MxS32 GetVolume() const { return m_volume; } // SYNTHETIC: LEGO1 0x100c9450 diff --git a/LEGO1/omni/include/mxnotificationparam.h b/LEGO1/omni/include/mxnotificationparam.h index bf1d589b..a5b30b24 100644 --- a/LEGO1/omni/include/mxnotificationparam.h +++ b/LEGO1/omni/include/mxnotificationparam.h @@ -39,6 +39,7 @@ enum NotificationId { // SIZE 0x0c class MxNotificationParam : public MxParam { public: + // FUNCTION: BETA10 0x100702d0 MxNotificationParam() : m_type(c_notificationType0), m_sender(NULL) {} // FUNCTION: BETA10 0x10013490 diff --git a/LEGO1/omni/include/mxsoundmanager.h b/LEGO1/omni/include/mxsoundmanager.h index 14bd3491..3d7c35c7 100644 --- a/LEGO1/omni/include/mxsoundmanager.h +++ b/LEGO1/omni/include/mxsoundmanager.h @@ -24,10 +24,11 @@ class MxSoundManager : public MxAudioManager { MxS32 GetAttenuation(MxU32 p_volume); + MxPresenter* FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId); + protected: void Init(); void Destroy(MxBool p_fromDestructor); - MxPresenter* FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId); LPDIRECTSOUND m_directSound; // 0x30 LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x34