Skip to content

Commit b522b8a

Browse files
xZisefloriandotorg
andauthored
Lego path struct (#1750)
* Clear unknowns in `LegoPathStruct` * Clear unknowns cam animations * Improve path struct trigger names --------- Co-authored-by: Florian Kaiser <[email protected]>
1 parent 3b29806 commit b522b8a

File tree

8 files changed

+36
-36
lines changed

8 files changed

+36
-36
lines changed

LEGO1/lego/legoomni/include/legopathstruct.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ class LegoPathStruct : public LegoPathStructBase {
7373
public:
7474
enum Trigger {
7575
c_camAnim = 'C',
76-
c_d = 'D',
77-
c_e = 'E',
78-
c_g = 'G',
79-
c_h = 'H',
76+
c_waypoint = 'D',
77+
c_deleteAction = 'E',
78+
c_nothing = 'G',
79+
c_hideAnim = 'H',
8080
c_music = 'M',
81-
c_s = 'S',
82-
c_w = 'W'
81+
c_specialMissionWaypointAndAction = 'S',
82+
c_missionFinalWaypoint = 'W'
8383
};
8484

8585
// FUNCTION: LEGO1 0x100473a0
@@ -94,8 +94,8 @@ class LegoPathStruct : public LegoPathStructBase {
9494
void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; }
9595

9696
private:
97-
MxBool HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_bool);
98-
void FUN_1001bc40(const char* p_name, MxU32 p_data, MxBool p_bool);
97+
MxBool HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_invertDirection);
98+
void HandleAction(const char* p_name, MxU32 p_data, MxBool p_start);
9999
void PlayMusic(MxBool p_direction, MxU32 p_data);
100100

101101
LegoWorld* m_world; // 0x0c

LEGO1/lego/legoomni/src/actors/ambulance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
315315
PlayAction(IsleScript::c_Avo915In_PlayWav);
316316
}
317317
}
318-
else if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x131 && m_atBeachTask == 0) {
318+
else if (p_param.GetTrigger() == LegoPathStruct::c_specialMissionWaypointAndAction && p_param.GetData() == 0x131 && m_atBeachTask == 0) {
319319
m_atBeachTask = 1;
320320
m_taskState = Ambulance::e_waiting;
321321

LEGO1/lego/legoomni/src/actors/pizza.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
281281
if (m_state->m_state == PizzaMissionState::e_delivering) {
282282
MxLong time = Timer()->GetTime() - m_mission->m_startTime;
283283

284-
if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x12e &&
284+
if (p_param.GetTrigger() == LegoPathStruct::c_specialMissionWaypointAndAction && p_param.GetData() == 0x12e &&
285285
GameState()->GetActorId() == LegoActor::c_pepper) {
286286
m_state->m_state = PizzaMissionState::e_arrivedAtDestination;
287287
m_state->SetPlayedAction(SndanimScript::c_TRS302_OpenJailDoor);
@@ -303,7 +303,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
303303
(p_param.GetData() == 0x33 && GameState()->GetActorId() == LegoActor::c_papa) ||
304304
((p_param.GetData() == 0x08 || p_param.GetData() == 0x09) && GameState()->GetActorId() == LegoActor::c_nick) ||
305305
(p_param.GetData() == 0x0b && GameState()->GetActorId() == LegoActor::c_laura)
306-
)) || (p_param.GetTrigger() == LegoPathStruct::c_w && p_param.GetData() == 0x169 && GameState()->GetActorId() == LegoActor::c_nick)) {
306+
)) || (p_param.GetTrigger() == LegoPathStruct::c_missionFinalWaypoint && p_param.GetData() == 0x169 && GameState()->GetActorId() == LegoActor::c_nick)) {
307307
IsleScript::Script action;
308308

309309
if (time < m_mission->GetRedFinishTime()) {
@@ -353,7 +353,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
353353

354354
MxTrace("Pizza mission: ending\n");
355355
}
356-
else if (p_param.GetTrigger() == LegoPathStruct::c_w) {
356+
else if (p_param.GetTrigger() == LegoPathStruct::c_missionFinalWaypoint) {
357357
if (p_param.GetData() == 0x15e && GameState()->GetActorId() == LegoActor::c_pepper) {
358358
if (!m_playedLocationAnimation) {
359359
m_playedLocationAnimation = TRUE;

LEGO1/lego/legoomni/src/actors/towtrack.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
300300

301301
if (m_state->m_state == TowTrackMissionState::e_hookedUp &&
302302
((p_param.GetTrigger() == LegoPathStruct::c_camAnim && (p_param.GetData() == 9 || p_param.GetData() == 8)) ||
303-
(p_param.GetTrigger() == LegoPathStruct::c_w && p_param.GetData() == 0x169))) {
303+
(p_param.GetTrigger() == LegoPathStruct::c_missionFinalWaypoint && p_param.GetData() == 0x169))) {
304304
m_state->m_state = TowTrackMissionState::e_none;
305305

306306
MxLong time = Timer()->GetTime() - m_state->m_startTime;
@@ -327,7 +327,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
327327
Leave();
328328
PlayFinalAnimation(IsleScript::c_wrt060bm_RunAnim);
329329
}
330-
else if (p_param.GetTrigger() == LegoPathStruct::c_w && m_state->m_state == TowTrackMissionState::e_started) {
330+
else if (p_param.GetTrigger() == LegoPathStruct::c_missionFinalWaypoint && m_state->m_state == TowTrackMissionState::e_started) {
331331
if (p_param.GetData() == 0x15f) {
332332
if (m_treeBlockageTriggered == 0) {
333333
m_treeBlockageTriggered = 1;

LEGO1/lego/legoomni/src/paths/legopathstruct.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@ DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14)
1919
extern MxU32 g_isleFlags;
2020

2121
// GLOBAL: LEGO1 0x100f119c
22-
MxBool g_unk0x100f119c = FALSE;
22+
MxBool g_triggerHandlingIgnoreDirection = FALSE;
2323

2424
// FUNCTION: LEGO1 0x1001b700
2525
void LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data)
2626
{
27-
if (!HandleTrigger(p_actor, p_direction, p_data, FALSE) && g_unk0x100f119c) {
27+
if (!HandleTrigger(p_actor, p_direction, p_data, FALSE) && g_triggerHandlingIgnoreDirection) {
2828
HandleTrigger(p_actor, p_direction, p_data, TRUE);
2929
}
3030
}
3131

3232
// FUNCTION: LEGO1 0x1001b740
3333
// FUNCTION: BETA10 0x100c26c5
34-
MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_bool)
34+
MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_invertDirection)
3535
{
3636
MxBool triggered = FALSE;
37-
MxBool bool2 = p_bool ? !p_direction : p_direction;
37+
MxBool actualDirection = p_invertDirection ? !p_direction : p_direction;
3838

39-
MxU32 flags = bool2 ? c_bit5 : c_bit6;
39+
MxU32 flags = actualDirection ? c_bit5 : c_bit6;
4040
flags |= p_actor->GetCameraFlag() ? c_bit1 : (c_bit2 | c_bit3 | c_bit4);
4141

4242
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,
4545
switch (m_name[2]) {
4646
case c_camAnim:
4747
if (g_isleFlags & Isle::c_playCamAnims) {
48-
PlayCamAnim(p_actor, bool2, p_data, TRUE);
48+
PlayCamAnim(p_actor, actualDirection, p_data, TRUE);
4949
}
5050
break;
51-
case c_d: {
51+
case c_waypoint: {
5252
p_actor->SetLastPathStruct(p_data);
5353

5454
LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data);
@@ -60,12 +60,12 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
6060
}
6161
break;
6262
}
63-
case c_e:
64-
FUN_1001bc40(m_name, p_data, !(p_bool == FALSE));
63+
case c_deleteAction:
64+
HandleAction(m_name, p_data, !(p_invertDirection == FALSE));
6565
break;
66-
case c_g:
66+
case c_nothing:
6767
break;
68-
case c_h: {
68+
case c_hideAnim: {
6969
LegoHideAnimPresenter* presenter = m_world->GetHideAnimPresenter();
7070
if (presenter != NULL) {
7171
presenter->ApplyVisibility(p_data * 100);
@@ -77,7 +77,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
7777
PlayMusic(p_direction, p_data);
7878
}
7979
break;
80-
case c_s: {
80+
case c_specialMissionWaypointAndAction: {
8181
LegoWorld* world = CurrentWorld();
8282
if (world != NULL) {
8383
LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data);
@@ -87,10 +87,10 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
8787
}
8888
}
8989

90-
FUN_1001bc40(m_name, p_data, p_bool == FALSE);
90+
HandleAction(m_name, p_data, p_invertDirection == FALSE);
9191
break;
9292
}
93-
case c_w: {
93+
case c_missionFinalWaypoint: {
9494
LegoWorld* world = CurrentWorld();
9595
if (world != NULL) {
9696
LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data);
@@ -106,13 +106,13 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
106106

107107
// FUNCTION: LEGO1 0x1001bc40
108108
// FUNCTION: BETA10 0x100c2a6c
109-
void LegoPathStruct::FUN_1001bc40(const char* p_name, MxU32 p_data, MxBool p_bool)
109+
void LegoPathStruct::HandleAction(const char* p_name, MxU32 p_data, MxBool p_start)
110110
{
111111
MxDSAction action;
112112
action.SetObjectId(p_data);
113113
action.SetAtomId(m_atomId);
114114

115-
if (p_bool) {
115+
if (p_start) {
116116
action.SetUnknown24(-1);
117117
Start(&action);
118118
}

LEGO1/lego/legoomni/src/race/carrace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
189189
{
190190
MxLong result = 0;
191191

192-
if (p_param.GetTrigger() == LegoPathStruct::c_d) {
192+
if (p_param.GetTrigger() == LegoPathStruct::c_waypoint) {
193193
MxEntity* sender = (MxEntity*) p_param.GetSender();
194194
MxS32 paramData = p_param.GetData();
195195

LEGO1/lego/legoomni/src/race/jetskirace.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "scripts.h"
2424

2525
// Defined in legopathstruct.cpp
26-
extern MxBool g_unk0x100f119c;
26+
extern MxBool g_triggerHandlingIgnoreDirection;
2727

2828
// Defined in jetski.cpp
2929
extern const char* g_varJSFRNTY5;
@@ -70,7 +70,7 @@ MxResult JetskiRace::Create(MxDSAction& p_dsAction)
7070
InvokeAction(Extra::e_start, m_atomId, raceCarDashboardStreamId, NULL);
7171
InvokeAction(Extra::e_start, m_atomId, JetraceScript::c_JetskiDashboard, NULL);
7272

73-
g_unk0x100f119c = TRUE;
73+
g_triggerHandlingIgnoreDirection = TRUE;
7474

7575
return result;
7676
}
@@ -158,7 +158,7 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
158158
MxLong result = 0;
159159
MxEntity* sender = (MxEntity*) p_param.GetSender();
160160

161-
if (p_param.GetTrigger() == LegoPathStruct::c_d) {
161+
if (p_param.GetTrigger() == LegoPathStruct::c_waypoint) {
162162
MxS32 paramData = p_param.GetData();
163163

164164
switch (sender->GetEntityId()) {

LEGO1/lego/legoomni/src/race/legorace.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ DECOMP_SIZE_ASSERT(RaceState::Entry, 0x06)
1212
DECOMP_SIZE_ASSERT(RaceState, 0x2c)
1313

1414
// Defined in legopathstruct.cpp
15-
extern MxBool g_unk0x100f119c;
15+
extern MxBool g_triggerHandlingIgnoreDirection;
1616

1717
// FUNCTION: LEGO1 0x10015aa0
1818
LegoRace::LegoRace()
@@ -56,7 +56,7 @@ MxResult LegoRace::Create(MxDSAction& p_dsAction)
5656
// FUNCTION: BETA10 0x100c7ab5
5757
LegoRace::~LegoRace()
5858
{
59-
g_unk0x100f119c = FALSE;
59+
g_triggerHandlingIgnoreDirection = FALSE;
6060
if (m_pathActor) {
6161
SetUserActor(m_pathActor);
6262
NavController()->ResetMaxLinearVel(m_pathActor->GetMaxLinearVel());

0 commit comments

Comments
 (0)