Refactor LegoVehicleBuildState::m_animationState to enum

This commit is contained in:
jonschz 2024-10-25 17:53:05 +02:00
parent 63e5ee1df3
commit f5b668bfcd
2 changed files with 20 additions and 18 deletions

View File

@ -16,6 +16,14 @@ class MxActionNotificationParam;
// SIZE 0x50 // SIZE 0x50
class LegoVehicleBuildState : public LegoState { class LegoVehicleBuildState : public LegoState {
public: public:
enum AnimationState {
e_unknown0 = 0,
e_entering = 1,
e_unknown2 = 2,
e_cutscene = 3,
e_exiting = 6
};
LegoVehicleBuildState(const char* p_classType); LegoVehicleBuildState(const char* p_classType);
// FUNCTION: LEGO1 0x10025ff0 // FUNCTION: LEGO1 0x10025ff0
@ -46,17 +54,11 @@ class LegoVehicleBuildState : public LegoState {
// * LegoJetskiBuildState // * LegoJetskiBuildState
MxString m_className; // 0x38 MxString m_className; // 0x38
// Known States: AnimationState m_animationState; // 0x48
// * 1 == enter(ing) build screen undefined m_unk0x4c; // 0x4c
// * 2 == ? MxBool m_unk0x4d; // 0x4d
// * 3 == cutscene/dialogue MxBool m_unk0x4e; // 0x4e
// * 4 == ? MxU8 m_placedPartCount; // 0x4f
// * 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
}; };
typedef LegoVehicleBuildState LegoRaceCarBuildState; typedef LegoVehicleBuildState LegoRaceCarBuildState;

View File

@ -148,7 +148,7 @@ MxResult LegoCarBuild::Create(MxDSAction& p_dsAction)
GameState()->StopArea(LegoGameState::e_previousArea); GameState()->StopArea(LegoGameState::e_previousArea);
m_buildState->m_animationState = 1; m_buildState->m_animationState = LegoVehicleBuildState::e_entering;
m_unk0x100 = 0; m_unk0x100 = 0;
BackgroundAudioManager()->Stop(); BackgroundAudioManager()->Stop();
@ -555,7 +555,7 @@ MxLong LegoCarBuild::Notify(MxParam& p_param)
assert(m_buildState); assert(m_buildState);
if (((m_buildState->m_animationState != 4) && (m_buildState->m_animationState != 6)) && if (((m_buildState->m_animationState != 4) && (m_buildState->m_animationState != 6)) &&
(m_buildState->m_animationState != 2)) { (m_buildState->m_animationState != 2)) {
m_buildState->m_animationState = 0; m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0;
result = FUN_100244e0( result = FUN_100244e0(
((LegoEventNotificationParam&) p_param).GetX(), ((LegoEventNotificationParam&) p_param).GetX(),
((LegoEventNotificationParam&) p_param).GetY() ((LegoEventNotificationParam&) p_param).GetY()
@ -625,7 +625,7 @@ void LegoCarBuild::ReadyWorld()
if (BackgroundAudioManager()->GetEnabled()) { if (BackgroundAudioManager()->GetEnabled()) {
InvokeAction(Extra::ActionType::e_start, *g_jukeboxScript, FUN_10025ee0(m_unk0x330), NULL); 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()); NotificationManager()->Send(this, MxNotificationParam());
} }
else { else {
@ -670,7 +670,7 @@ undefined4 LegoCarBuild::FUN_10024480(MxActionNotificationParam* p_param)
switch (m_buildState->m_animationState) { switch (m_buildState->m_animationState) {
case 3: case 3:
BackgroundAudioManager()->RaiseVolume(); BackgroundAudioManager()->RaiseVolume();
m_buildState->m_animationState = 0; m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0;
result = 1; result = 1;
break; break;
case 6: case 6:
@ -835,7 +835,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param)
} }
assert(destWorld); assert(destWorld);
m_buildState->m_animationState = 6; m_buildState->m_animationState = LegoVehicleBuildState::e_exiting;
if (m_unk0x258->m_numberOfParts != m_unk0x258->m_placedPartCount) { if (m_unk0x258->m_numberOfParts != m_unk0x258->m_placedPartCount) {
FUN_100243a0(); FUN_100243a0();
@ -887,7 +887,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param)
void LegoCarBuild::FUN_10024ef0() void LegoCarBuild::FUN_10024ef0()
{ {
FUN_1003eda0(); FUN_1003eda0();
m_buildState->m_animationState = 3; m_buildState->m_animationState = LegoVehicleBuildState::e_cutscene;
FUN_10025720(FUN_10025d70()); FUN_10025720(FUN_10025d70());
m_buildState->m_unk0x4c += 1; m_buildState->m_unk0x4c += 1;
FUN_10015820(FALSE, 7); FUN_10015820(FALSE, 7);
@ -1061,7 +1061,7 @@ MxBool LegoCarBuild::Escape()
InvokeAction(Extra::ActionType::e_stop, *g_jukeboxScript, targetEntityId, NULL); InvokeAction(Extra::ActionType::e_stop, *g_jukeboxScript, targetEntityId, NULL);
DeleteObjects(&m_atomId, 500, 999); DeleteObjects(&m_atomId, 500, 999);
m_buildState->m_animationState = 0; m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0;
m_destLocation = LegoGameState::e_infomain; m_destLocation = LegoGameState::e_infomain;
return TRUE; return TRUE;
} }