From f5b668bfcd97dd17586bd2c9ae87ec8f74ae787f Mon Sep 17 00:00:00 2001 From: jonschz Date: Fri, 25 Oct 2024 17:53:05 +0200 Subject: [PATCH] Refactor LegoVehicleBuildState::m_animationState to enum --- LEGO1/lego/legoomni/include/legocarbuild.h | 24 ++++++++++--------- .../lego/legoomni/src/build/legocarbuild.cpp | 14 +++++------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index 51152bf6..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,17 +54,11 @@ class LegoVehicleBuildState : public LegoState { // * LegoJetskiBuildState MxString m_className; // 0x38 - // Known States: - // * 1 == enter(ing) build screen - // * 2 == ? - // * 3 == cutscene/dialogue - // * 4 == ? - // * 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; diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index 8727adac..48e6bb03 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -148,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(); @@ -555,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() @@ -625,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 { @@ -670,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: @@ -835,7 +835,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param) } assert(destWorld); - m_buildState->m_animationState = 6; + m_buildState->m_animationState = LegoVehicleBuildState::e_exiting; if (m_unk0x258->m_numberOfParts != m_unk0x258->m_placedPartCount) { FUN_100243a0(); @@ -887,7 +887,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param) 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); @@ -1061,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; }