Lego path struct (#1750)
Some checks failed
Analyze / ${{ matrix.who }} annotations (CONFIG) (push) Has been cancelled
Analyze / ${{ matrix.who }} annotations (ISLE) (push) Has been cancelled
Analyze / ${{ matrix.who }} annotations (LEGO1) (push) Has been cancelled
Build / Download original binaries (push) Has been cancelled
Build / Current ${{ matrix.toolchain.name }} (map[clang-tidy:true msys-env:mingw-w64-i686 msystem:mingw32 name:msys2 mingw32 shell:msys2 {0} werror:true]) (push) Has been cancelled
Build / Current ${{ matrix.toolchain.name }} (map[name:MSVC setup-cmake:true setup-msvc:true setup-ninja:true shell:sh]) (push) Has been cancelled
Build / MSVC 4.20 (push) Has been cancelled
Build / MSVC 4.20 (BETA10) (push) Has been cancelled
Format / C++ (push) Has been cancelled
Naming / C++ (push) Has been cancelled
Build / Verify decomp (push) Has been cancelled
Build / Upload artifacts (push) Has been cancelled

* Clear unknowns in `LegoPathStruct`

* Clear unknowns cam animations

* Improve path struct trigger names

---------

Co-authored-by: Florian Kaiser <mail@floriankaiser.org>
This commit is contained in:
Fabian Neundorf 2026-03-14 16:56:22 +01:00 committed by GitHub
parent 3b29806921
commit b522b8ac3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 36 additions and 36 deletions

View File

@ -73,13 +73,13 @@ class LegoPathStruct : public LegoPathStructBase {
public: public:
enum Trigger { enum Trigger {
c_camAnim = 'C', c_camAnim = 'C',
c_d = 'D', c_waypoint = 'D',
c_e = 'E', c_deleteAction = 'E',
c_g = 'G', c_nothing = 'G',
c_h = 'H', c_hideAnim = 'H',
c_music = 'M', c_music = 'M',
c_s = 'S', c_specialMissionWaypointAndAction = 'S',
c_w = 'W' c_missionFinalWaypoint = 'W'
}; };
// FUNCTION: LEGO1 0x100473a0 // FUNCTION: LEGO1 0x100473a0
@ -94,8 +94,8 @@ class LegoPathStruct : public LegoPathStructBase {
void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; } void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; }
private: private:
MxBool HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_bool); MxBool HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_invertDirection);
void FUN_1001bc40(const char* p_name, MxU32 p_data, MxBool p_bool); void HandleAction(const char* p_name, MxU32 p_data, MxBool p_start);
void PlayMusic(MxBool p_direction, MxU32 p_data); void PlayMusic(MxBool p_direction, MxU32 p_data);
LegoWorld* m_world; // 0x0c LegoWorld* m_world; // 0x0c

View File

@ -315,7 +315,7 @@ 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_atBeachTask == 0) { else if (p_param.GetTrigger() == LegoPathStruct::c_specialMissionWaypointAndAction && p_param.GetData() == 0x131 && m_atBeachTask == 0) {
m_atBeachTask = 1; m_atBeachTask = 1;
m_taskState = Ambulance::e_waiting; m_taskState = Ambulance::e_waiting;

View File

@ -281,7 +281,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
if (m_state->m_state == PizzaMissionState::e_delivering) { if (m_state->m_state == PizzaMissionState::e_delivering) {
MxLong time = Timer()->GetTime() - m_mission->m_startTime; MxLong time = Timer()->GetTime() - m_mission->m_startTime;
if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x12e && if (p_param.GetTrigger() == LegoPathStruct::c_specialMissionWaypointAndAction && p_param.GetData() == 0x12e &&
GameState()->GetActorId() == LegoActor::c_pepper) { GameState()->GetActorId() == LegoActor::c_pepper) {
m_state->m_state = PizzaMissionState::e_arrivedAtDestination; m_state->m_state = PizzaMissionState::e_arrivedAtDestination;
m_state->SetPlayedAction(SndanimScript::c_TRS302_OpenJailDoor); m_state->SetPlayedAction(SndanimScript::c_TRS302_OpenJailDoor);
@ -303,7 +303,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
(p_param.GetData() == 0x33 && GameState()->GetActorId() == LegoActor::c_papa) || (p_param.GetData() == 0x33 && GameState()->GetActorId() == LegoActor::c_papa) ||
((p_param.GetData() == 0x08 || p_param.GetData() == 0x09) && GameState()->GetActorId() == LegoActor::c_nick) || ((p_param.GetData() == 0x08 || p_param.GetData() == 0x09) && GameState()->GetActorId() == LegoActor::c_nick) ||
(p_param.GetData() == 0x0b && GameState()->GetActorId() == LegoActor::c_laura) (p_param.GetData() == 0x0b && GameState()->GetActorId() == LegoActor::c_laura)
)) || (p_param.GetTrigger() == LegoPathStruct::c_w && p_param.GetData() == 0x169 && GameState()->GetActorId() == LegoActor::c_nick)) { )) || (p_param.GetTrigger() == LegoPathStruct::c_missionFinalWaypoint && p_param.GetData() == 0x169 && GameState()->GetActorId() == LegoActor::c_nick)) {
IsleScript::Script action; IsleScript::Script action;
if (time < m_mission->GetRedFinishTime()) { if (time < m_mission->GetRedFinishTime()) {
@ -353,7 +353,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
MxTrace("Pizza mission: ending\n"); MxTrace("Pizza mission: ending\n");
} }
else if (p_param.GetTrigger() == LegoPathStruct::c_w) { else if (p_param.GetTrigger() == LegoPathStruct::c_missionFinalWaypoint) {
if (p_param.GetData() == 0x15e && GameState()->GetActorId() == LegoActor::c_pepper) { if (p_param.GetData() == 0x15e && GameState()->GetActorId() == LegoActor::c_pepper) {
if (!m_playedLocationAnimation) { if (!m_playedLocationAnimation) {
m_playedLocationAnimation = TRUE; m_playedLocationAnimation = TRUE;

View File

@ -300,7 +300,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
if (m_state->m_state == TowTrackMissionState::e_hookedUp && if (m_state->m_state == TowTrackMissionState::e_hookedUp &&
((p_param.GetTrigger() == LegoPathStruct::c_camAnim && (p_param.GetData() == 9 || p_param.GetData() == 8)) || ((p_param.GetTrigger() == LegoPathStruct::c_camAnim && (p_param.GetData() == 9 || p_param.GetData() == 8)) ||
(p_param.GetTrigger() == LegoPathStruct::c_w && p_param.GetData() == 0x169))) { (p_param.GetTrigger() == LegoPathStruct::c_missionFinalWaypoint && p_param.GetData() == 0x169))) {
m_state->m_state = TowTrackMissionState::e_none; m_state->m_state = TowTrackMissionState::e_none;
MxLong time = Timer()->GetTime() - m_state->m_startTime; MxLong time = Timer()->GetTime() - m_state->m_startTime;
@ -327,7 +327,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
Leave(); Leave();
PlayFinalAnimation(IsleScript::c_wrt060bm_RunAnim); PlayFinalAnimation(IsleScript::c_wrt060bm_RunAnim);
} }
else if (p_param.GetTrigger() == LegoPathStruct::c_w && m_state->m_state == TowTrackMissionState::e_started) { else if (p_param.GetTrigger() == LegoPathStruct::c_missionFinalWaypoint && m_state->m_state == TowTrackMissionState::e_started) {
if (p_param.GetData() == 0x15f) { if (p_param.GetData() == 0x15f) {
if (m_treeBlockageTriggered == 0) { if (m_treeBlockageTriggered == 0) {
m_treeBlockageTriggered = 1; m_treeBlockageTriggered = 1;

View File

@ -19,24 +19,24 @@ DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14)
extern MxU32 g_isleFlags; extern MxU32 g_isleFlags;
// GLOBAL: LEGO1 0x100f119c // GLOBAL: LEGO1 0x100f119c
MxBool g_unk0x100f119c = FALSE; MxBool g_triggerHandlingIgnoreDirection = FALSE;
// FUNCTION: LEGO1 0x1001b700 // FUNCTION: LEGO1 0x1001b700
void LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data) void LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data)
{ {
if (!HandleTrigger(p_actor, p_direction, p_data, FALSE) && g_unk0x100f119c) { if (!HandleTrigger(p_actor, p_direction, p_data, FALSE) && g_triggerHandlingIgnoreDirection) {
HandleTrigger(p_actor, p_direction, p_data, TRUE); HandleTrigger(p_actor, p_direction, p_data, TRUE);
} }
} }
// FUNCTION: LEGO1 0x1001b740 // FUNCTION: LEGO1 0x1001b740
// FUNCTION: BETA10 0x100c26c5 // FUNCTION: BETA10 0x100c26c5
MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_bool) MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_invertDirection)
{ {
MxBool triggered = FALSE; MxBool triggered = FALSE;
MxBool bool2 = p_bool ? !p_direction : p_direction; MxBool actualDirection = p_invertDirection ? !p_direction : p_direction;
MxU32 flags = bool2 ? c_bit5 : c_bit6; MxU32 flags = actualDirection ? c_bit5 : c_bit6;
flags |= p_actor->GetCameraFlag() ? c_bit1 : (c_bit2 | c_bit3 | c_bit4); flags |= p_actor->GetCameraFlag() ? c_bit1 : (c_bit2 | c_bit3 | c_bit4);
if ((m_flags & flags & (c_bit5 | c_bit6 | c_bit7)) && (m_flags & flags & (c_bit1 | c_bit2 | c_bit3 | c_bit4))) { if ((m_flags & flags & (c_bit5 | c_bit6 | c_bit7)) && (m_flags & flags & (c_bit1 | c_bit2 | c_bit3 | c_bit4))) {
@ -45,10 +45,10 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
switch (m_name[2]) { switch (m_name[2]) {
case c_camAnim: case c_camAnim:
if (g_isleFlags & Isle::c_playCamAnims) { if (g_isleFlags & Isle::c_playCamAnims) {
PlayCamAnim(p_actor, bool2, p_data, TRUE); PlayCamAnim(p_actor, actualDirection, p_data, TRUE);
} }
break; break;
case c_d: { case c_waypoint: {
p_actor->SetLastPathStruct(p_data); p_actor->SetLastPathStruct(p_data);
LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data); LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data);
@ -60,12 +60,12 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
} }
break; break;
} }
case c_e: case c_deleteAction:
FUN_1001bc40(m_name, p_data, !(p_bool == FALSE)); HandleAction(m_name, p_data, !(p_invertDirection == FALSE));
break; break;
case c_g: case c_nothing:
break; break;
case c_h: { case c_hideAnim: {
LegoHideAnimPresenter* presenter = m_world->GetHideAnimPresenter(); LegoHideAnimPresenter* presenter = m_world->GetHideAnimPresenter();
if (presenter != NULL) { if (presenter != NULL) {
presenter->ApplyVisibility(p_data * 100); presenter->ApplyVisibility(p_data * 100);
@ -77,7 +77,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
PlayMusic(p_direction, p_data); PlayMusic(p_direction, p_data);
} }
break; break;
case c_s: { case c_specialMissionWaypointAndAction: {
LegoWorld* world = CurrentWorld(); LegoWorld* world = CurrentWorld();
if (world != NULL) { if (world != NULL) {
LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data); LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data);
@ -87,10 +87,10 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
} }
} }
FUN_1001bc40(m_name, p_data, p_bool == FALSE); HandleAction(m_name, p_data, p_invertDirection == FALSE);
break; break;
} }
case c_w: { case c_missionFinalWaypoint: {
LegoWorld* world = CurrentWorld(); LegoWorld* world = CurrentWorld();
if (world != NULL) { if (world != NULL) {
LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data); LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data);
@ -106,13 +106,13 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
// FUNCTION: LEGO1 0x1001bc40 // FUNCTION: LEGO1 0x1001bc40
// FUNCTION: BETA10 0x100c2a6c // FUNCTION: BETA10 0x100c2a6c
void LegoPathStruct::FUN_1001bc40(const char* p_name, MxU32 p_data, MxBool p_bool) void LegoPathStruct::HandleAction(const char* p_name, MxU32 p_data, MxBool p_start)
{ {
MxDSAction action; MxDSAction action;
action.SetObjectId(p_data); action.SetObjectId(p_data);
action.SetAtomId(m_atomId); action.SetAtomId(m_atomId);
if (p_bool) { if (p_start) {
action.SetUnknown24(-1); action.SetUnknown24(-1);
Start(&action); Start(&action);
} }

View File

@ -189,7 +189,7 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
if (p_param.GetTrigger() == LegoPathStruct::c_d) { if (p_param.GetTrigger() == LegoPathStruct::c_waypoint) {
MxEntity* sender = (MxEntity*) p_param.GetSender(); MxEntity* sender = (MxEntity*) p_param.GetSender();
MxS32 paramData = p_param.GetData(); MxS32 paramData = p_param.GetData();

View File

@ -23,7 +23,7 @@
#include "scripts.h" #include "scripts.h"
// Defined in legopathstruct.cpp // Defined in legopathstruct.cpp
extern MxBool g_unk0x100f119c; extern MxBool g_triggerHandlingIgnoreDirection;
// Defined in jetski.cpp // Defined in jetski.cpp
extern const char* g_varJSFRNTY5; extern const char* g_varJSFRNTY5;
@ -70,7 +70,7 @@ MxResult JetskiRace::Create(MxDSAction& p_dsAction)
InvokeAction(Extra::e_start, m_atomId, raceCarDashboardStreamId, NULL); InvokeAction(Extra::e_start, m_atomId, raceCarDashboardStreamId, NULL);
InvokeAction(Extra::e_start, m_atomId, JetraceScript::c_JetskiDashboard, NULL); InvokeAction(Extra::e_start, m_atomId, JetraceScript::c_JetskiDashboard, NULL);
g_unk0x100f119c = TRUE; g_triggerHandlingIgnoreDirection = TRUE;
return result; return result;
} }
@ -158,7 +158,7 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
MxLong result = 0; MxLong result = 0;
MxEntity* sender = (MxEntity*) p_param.GetSender(); MxEntity* sender = (MxEntity*) p_param.GetSender();
if (p_param.GetTrigger() == LegoPathStruct::c_d) { if (p_param.GetTrigger() == LegoPathStruct::c_waypoint) {
MxS32 paramData = p_param.GetData(); MxS32 paramData = p_param.GetData();
switch (sender->GetEntityId()) { switch (sender->GetEntityId()) {

View File

@ -12,7 +12,7 @@ DECOMP_SIZE_ASSERT(RaceState::Entry, 0x06)
DECOMP_SIZE_ASSERT(RaceState, 0x2c) DECOMP_SIZE_ASSERT(RaceState, 0x2c)
// Defined in legopathstruct.cpp // Defined in legopathstruct.cpp
extern MxBool g_unk0x100f119c; extern MxBool g_triggerHandlingIgnoreDirection;
// FUNCTION: LEGO1 0x10015aa0 // FUNCTION: LEGO1 0x10015aa0
LegoRace::LegoRace() LegoRace::LegoRace()
@ -56,7 +56,7 @@ MxResult LegoRace::Create(MxDSAction& p_dsAction)
// FUNCTION: BETA10 0x100c7ab5 // FUNCTION: BETA10 0x100c7ab5
LegoRace::~LegoRace() LegoRace::~LegoRace()
{ {
g_unk0x100f119c = FALSE; g_triggerHandlingIgnoreDirection = FALSE;
if (m_pathActor) { if (m_pathActor) {
SetUserActor(m_pathActor); SetUserActor(m_pathActor);
NavController()->ResetMaxLinearVel(m_pathActor->GetMaxLinearVel()); NavController()->ResetMaxLinearVel(m_pathActor->GetMaxLinearVel());