mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-05-01 18:13:57 +00:00
Lego path struct (#1750)
* 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:
parent
3b29806921
commit
b522b8ac3a
@ -73,13 +73,13 @@ class LegoPathStruct : public LegoPathStructBase {
|
||||
public:
|
||||
enum Trigger {
|
||||
c_camAnim = 'C',
|
||||
c_d = 'D',
|
||||
c_e = 'E',
|
||||
c_g = 'G',
|
||||
c_h = 'H',
|
||||
c_waypoint = 'D',
|
||||
c_deleteAction = 'E',
|
||||
c_nothing = 'G',
|
||||
c_hideAnim = 'H',
|
||||
c_music = 'M',
|
||||
c_s = 'S',
|
||||
c_w = 'W'
|
||||
c_specialMissionWaypointAndAction = 'S',
|
||||
c_missionFinalWaypoint = 'W'
|
||||
};
|
||||
|
||||
// FUNCTION: LEGO1 0x100473a0
|
||||
@ -94,8 +94,8 @@ class LegoPathStruct : public LegoPathStructBase {
|
||||
void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; }
|
||||
|
||||
private:
|
||||
MxBool HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_bool);
|
||||
void FUN_1001bc40(const char* p_name, MxU32 p_data, MxBool p_bool);
|
||||
MxBool HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_invertDirection);
|
||||
void HandleAction(const char* p_name, MxU32 p_data, MxBool p_start);
|
||||
void PlayMusic(MxBool p_direction, MxU32 p_data);
|
||||
|
||||
LegoWorld* m_world; // 0x0c
|
||||
|
||||
@ -315,7 +315,7 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
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_taskState = Ambulance::e_waiting;
|
||||
|
||||
|
||||
@ -281,7 +281,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
if (m_state->m_state == PizzaMissionState::e_delivering) {
|
||||
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) {
|
||||
m_state->m_state = PizzaMissionState::e_arrivedAtDestination;
|
||||
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() == 0x08 || p_param.GetData() == 0x09) && GameState()->GetActorId() == LegoActor::c_nick) ||
|
||||
(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;
|
||||
|
||||
if (time < m_mission->GetRedFinishTime()) {
|
||||
@ -353,7 +353,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
|
||||
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 (!m_playedLocationAnimation) {
|
||||
m_playedLocationAnimation = TRUE;
|
||||
|
||||
@ -300,7 +300,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
|
||||
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_w && p_param.GetData() == 0x169))) {
|
||||
(p_param.GetTrigger() == LegoPathStruct::c_missionFinalWaypoint && p_param.GetData() == 0x169))) {
|
||||
m_state->m_state = TowTrackMissionState::e_none;
|
||||
|
||||
MxLong time = Timer()->GetTime() - m_state->m_startTime;
|
||||
@ -327,7 +327,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
Leave();
|
||||
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 (m_treeBlockageTriggered == 0) {
|
||||
m_treeBlockageTriggered = 1;
|
||||
|
||||
@ -19,24 +19,24 @@ DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14)
|
||||
extern MxU32 g_isleFlags;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f119c
|
||||
MxBool g_unk0x100f119c = FALSE;
|
||||
MxBool g_triggerHandlingIgnoreDirection = FALSE;
|
||||
|
||||
// FUNCTION: LEGO1 0x1001b700
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1001b740
|
||||
// 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 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);
|
||||
|
||||
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]) {
|
||||
case c_camAnim:
|
||||
if (g_isleFlags & Isle::c_playCamAnims) {
|
||||
PlayCamAnim(p_actor, bool2, p_data, TRUE);
|
||||
PlayCamAnim(p_actor, actualDirection, p_data, TRUE);
|
||||
}
|
||||
break;
|
||||
case c_d: {
|
||||
case c_waypoint: {
|
||||
p_actor->SetLastPathStruct(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;
|
||||
}
|
||||
case c_e:
|
||||
FUN_1001bc40(m_name, p_data, !(p_bool == FALSE));
|
||||
case c_deleteAction:
|
||||
HandleAction(m_name, p_data, !(p_invertDirection == FALSE));
|
||||
break;
|
||||
case c_g:
|
||||
case c_nothing:
|
||||
break;
|
||||
case c_h: {
|
||||
case c_hideAnim: {
|
||||
LegoHideAnimPresenter* presenter = m_world->GetHideAnimPresenter();
|
||||
if (presenter != NULL) {
|
||||
presenter->ApplyVisibility(p_data * 100);
|
||||
@ -77,7 +77,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
|
||||
PlayMusic(p_direction, p_data);
|
||||
}
|
||||
break;
|
||||
case c_s: {
|
||||
case c_specialMissionWaypointAndAction: {
|
||||
LegoWorld* world = CurrentWorld();
|
||||
if (world != NULL) {
|
||||
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;
|
||||
}
|
||||
case c_w: {
|
||||
case c_missionFinalWaypoint: {
|
||||
LegoWorld* world = CurrentWorld();
|
||||
if (world != NULL) {
|
||||
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: 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;
|
||||
action.SetObjectId(p_data);
|
||||
action.SetAtomId(m_atomId);
|
||||
|
||||
if (p_bool) {
|
||||
if (p_start) {
|
||||
action.SetUnknown24(-1);
|
||||
Start(&action);
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
{
|
||||
MxLong result = 0;
|
||||
|
||||
if (p_param.GetTrigger() == LegoPathStruct::c_d) {
|
||||
if (p_param.GetTrigger() == LegoPathStruct::c_waypoint) {
|
||||
MxEntity* sender = (MxEntity*) p_param.GetSender();
|
||||
MxS32 paramData = p_param.GetData();
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include "scripts.h"
|
||||
|
||||
// Defined in legopathstruct.cpp
|
||||
extern MxBool g_unk0x100f119c;
|
||||
extern MxBool g_triggerHandlingIgnoreDirection;
|
||||
|
||||
// Defined in jetski.cpp
|
||||
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, JetraceScript::c_JetskiDashboard, NULL);
|
||||
|
||||
g_unk0x100f119c = TRUE;
|
||||
g_triggerHandlingIgnoreDirection = TRUE;
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -158,7 +158,7 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
MxLong result = 0;
|
||||
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();
|
||||
|
||||
switch (sender->GetEntityId()) {
|
||||
|
||||
@ -12,7 +12,7 @@ DECOMP_SIZE_ASSERT(RaceState::Entry, 0x06)
|
||||
DECOMP_SIZE_ASSERT(RaceState, 0x2c)
|
||||
|
||||
// Defined in legopathstruct.cpp
|
||||
extern MxBool g_unk0x100f119c;
|
||||
extern MxBool g_triggerHandlingIgnoreDirection;
|
||||
|
||||
// FUNCTION: LEGO1 0x10015aa0
|
||||
LegoRace::LegoRace()
|
||||
@ -56,7 +56,7 @@ MxResult LegoRace::Create(MxDSAction& p_dsAction)
|
||||
// FUNCTION: BETA10 0x100c7ab5
|
||||
LegoRace::~LegoRace()
|
||||
{
|
||||
g_unk0x100f119c = FALSE;
|
||||
g_triggerHandlingIgnoreDirection = FALSE;
|
||||
if (m_pathActor) {
|
||||
SetUserActor(m_pathActor);
|
||||
NavController()->ResetMaxLinearVel(m_pathActor->GetMaxLinearVel());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user