mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-03-31 08:59:41 -04:00
Implement TowTrack::HandlePathStruct (#1081)
This commit is contained in:
parent
a6a241b09d
commit
7cf6c78d20
4 changed files with 145 additions and 25 deletions
LEGO1/lego/legoomni
|
@ -86,7 +86,7 @@ public:
|
|||
// AmbulanceMissionState::`scalar deleting destructor'
|
||||
|
||||
undefined4 m_unk0x08; // 0x08
|
||||
MxLong m_unk0x0c; // 0x0c
|
||||
MxLong m_startTime; // 0x0c
|
||||
MxS16 m_peScore; // 0x10
|
||||
MxS16 m_maScore; // 0x12
|
||||
MxS16 m_paScore; // 0x14
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
// TowTrackMissionState::`scalar deleting destructor'
|
||||
|
||||
undefined4 m_unk0x08; // 0x08
|
||||
MxLong m_unk0x0c; // 0x0c
|
||||
MxLong m_startTime; // 0x0c
|
||||
MxBool m_unk0x10; // 0x10
|
||||
MxS16 m_unk0x12; // 0x12
|
||||
MxS16 m_unk0x14; // 0x14
|
||||
|
@ -105,18 +105,19 @@ public:
|
|||
|
||||
private:
|
||||
void Leave();
|
||||
void PlayFinalAnimation(IsleScript::Script p_objectId);
|
||||
void PlayAction(IsleScript::Script p_objectId);
|
||||
|
||||
undefined4 m_unk0x160; // 0x160
|
||||
TowTrackMissionState* m_state; // 0x164
|
||||
MxS16 m_unk0x168; // 0x168
|
||||
MxS16 m_actorId; // 0x16a
|
||||
MxS16 m_unk0x16c; // 0x16c
|
||||
MxS16 m_unk0x16e; // 0x16e
|
||||
IsleScript::Script m_lastAction; // 0x170
|
||||
MxS32 m_unk0x174; // 0x174
|
||||
MxFloat m_fuel; // 0x178
|
||||
MxFloat m_time; // 0x17c
|
||||
undefined4 m_unk0x160; // 0x160
|
||||
TowTrackMissionState* m_state; // 0x164
|
||||
MxS16 m_unk0x168; // 0x168
|
||||
MxS16 m_actorId; // 0x16a
|
||||
MxS16 m_unk0x16c; // 0x16c
|
||||
MxS16 m_unk0x16e; // 0x16e
|
||||
IsleScript::Script m_lastAction; // 0x170
|
||||
IsleScript::Script m_lastAnimation; // 0x174
|
||||
MxFloat m_fuel; // 0x178
|
||||
MxFloat m_time; // 0x17c
|
||||
};
|
||||
|
||||
#endif // TOWTRACK_H
|
||||
|
|
|
@ -283,7 +283,7 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
|||
}
|
||||
|
||||
Leave();
|
||||
MxLong time = Timer()->GetTime() - m_state->m_unk0x0c;
|
||||
MxLong time = Timer()->GetTime() - m_state->m_startTime;
|
||||
|
||||
if (time < 300000) {
|
||||
m_state->UpdateScore(LegoState::e_red, m_actorId);
|
||||
|
@ -393,7 +393,7 @@ MxLong Ambulance::HandleClick()
|
|||
|
||||
if (m_state->m_unk0x08 == 1) {
|
||||
SpawnPlayer(LegoGameState::e_unk31, TRUE, 0);
|
||||
m_state->m_unk0x0c = Timer()->GetTime();
|
||||
m_state->m_startTime = Timer()->GetTime();
|
||||
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_pns018rd_RunAnim, NULL);
|
||||
}
|
||||
|
||||
|
@ -586,7 +586,7 @@ void Ambulance::FUN_10037250()
|
|||
g_isleFlags |= Isle::c_playMusic;
|
||||
AnimationManager()->EnableCamAnims(TRUE);
|
||||
AnimationManager()->FUN_1005f6d0(TRUE);
|
||||
m_state->m_unk0x0c = INT_MIN;
|
||||
m_state->m_startTime = INT_MIN;
|
||||
m_state = NULL;
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ void Ambulance::PlayAction(IsleScript::Script p_objectId)
|
|||
AmbulanceMissionState::AmbulanceMissionState()
|
||||
{
|
||||
m_unk0x08 = 0;
|
||||
m_unk0x0c = 0;
|
||||
m_startTime = 0;
|
||||
m_peScore = 0;
|
||||
m_maScore = 0;
|
||||
m_paScore = 0;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "legocontrolmanager.h"
|
||||
#include "legogamestate.h"
|
||||
#include "legonavcontroller.h"
|
||||
#include "legopathstruct.h"
|
||||
#include "legoutils.h"
|
||||
#include "legovariables.h"
|
||||
#include "legoworld.h"
|
||||
|
@ -33,7 +34,7 @@ TowTrack::TowTrack()
|
|||
m_unk0x16c = 0;
|
||||
m_lastAction = IsleScript::c_noneIsle;
|
||||
m_unk0x16e = 0;
|
||||
m_unk0x174 = -1;
|
||||
m_lastAnimation = IsleScript::c_noneIsle;
|
||||
m_maxLinearVel = 40.0;
|
||||
m_fuel = 1.0;
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ void TowTrack::VTable0x70(float p_time)
|
|||
sprintf(buf, "%g", m_fuel);
|
||||
VariableTable()->SetVariable(g_varTOWFUEL, buf);
|
||||
|
||||
if (p_time - m_state->m_unk0x0c > 100000.0f && m_state->m_unk0x08 == 1 && !m_state->m_unk0x10) {
|
||||
if (p_time - m_state->m_startTime > 100000.0f && m_state->m_unk0x08 == 1 && !m_state->m_unk0x10) {
|
||||
PlayAction(IsleScript::c_Avo909In_PlayWav);
|
||||
m_state->m_unk0x10 = TRUE;
|
||||
}
|
||||
|
@ -152,10 +153,120 @@ MxLong TowTrack::HandleEndAction(MxEndActionNotificationParam& p_param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004d330
|
||||
// FUNCTION: LEGO1 0x1004d330
|
||||
// FUNCTION: BETA10 0x100f74c0
|
||||
MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
MxDSAction action;
|
||||
|
||||
// 0x168 corresponds to the path at the gas station
|
||||
if (p_param.GetData() == 0x168) {
|
||||
m_fuel = 1.0f;
|
||||
}
|
||||
|
||||
if (UserActor() != this) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_state->m_unk0x08 == 2 &&
|
||||
((p_param.GetTrigger() == LegoPathStruct::c_camAnim && (p_param.GetData() == 9 || p_param.GetData() == 8)) ||
|
||||
(p_param.GetTrigger() == LegoPathStruct::c_w && p_param.GetData() == 0x169))) {
|
||||
m_state->m_unk0x08 = 0;
|
||||
|
||||
MxLong time = Timer()->GetTime() - m_state->m_startTime;
|
||||
Leave();
|
||||
|
||||
if (time < 200000) {
|
||||
PlayFinalAnimation(IsleScript::c_wgs083nu_RunAnim);
|
||||
}
|
||||
else if (time < 300000) {
|
||||
PlayFinalAnimation(IsleScript::c_wgs090nu_RunAnim);
|
||||
}
|
||||
else {
|
||||
PlayFinalAnimation(IsleScript::c_wgs097nu_RunAnim);
|
||||
}
|
||||
}
|
||||
else if (m_state->m_unk0x08 == 1 && p_param.GetTrigger() == LegoPathStruct::c_camAnim && p_param.GetData() == 0x37) {
|
||||
m_state->m_unk0x08 = 3;
|
||||
StopActions();
|
||||
|
||||
if (m_lastAction != IsleScript::c_noneIsle) {
|
||||
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
|
||||
}
|
||||
|
||||
Leave();
|
||||
PlayFinalAnimation(IsleScript::c_wrt060bm_RunAnim);
|
||||
}
|
||||
else if (p_param.GetTrigger() == LegoPathStruct::c_w && m_state->m_unk0x08 == 1) {
|
||||
if (p_param.GetData() == 0x15f) {
|
||||
if (m_unk0x16c == 0) {
|
||||
m_unk0x16c = 1;
|
||||
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_wns050p1_RunAnim, NULL);
|
||||
}
|
||||
}
|
||||
else if (p_param.GetData() == 0x160) {
|
||||
if (m_unk0x16e == 0) {
|
||||
m_unk0x16e = 1;
|
||||
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_wns046mg_RunAnim, NULL);
|
||||
}
|
||||
|
||||
if (!m_state->m_unk0x10 && m_lastAction == IsleScript::c_noneIsle) {
|
||||
if (m_actorId < LegoActor::c_pepper || m_actorId > LegoActor::c_laura) {
|
||||
m_actorId = LegoActor::c_laura;
|
||||
}
|
||||
|
||||
IsleScript::Script objectId;
|
||||
|
||||
switch (m_actorId) {
|
||||
case c_pepper:
|
||||
objectId = IsleScript::c_wns034na_PlayWav;
|
||||
break;
|
||||
case c_mama:
|
||||
switch ((rand() % 2) + 1) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns037na_PlayWav;
|
||||
break;
|
||||
case 2:
|
||||
objectId = IsleScript::c_wns038na_PlayWav;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case c_papa:
|
||||
switch ((rand() % 2) + 1) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns041na_PlayWav;
|
||||
break;
|
||||
case 2:
|
||||
objectId = IsleScript::c_wns042na_PlayWav;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case c_nick:
|
||||
switch ((rand() % 2) + 1) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns039na_PlayWav;
|
||||
break;
|
||||
case 2:
|
||||
objectId = IsleScript::c_wns040na_PlayWav;
|
||||
break;
|
||||
}
|
||||
case c_laura:
|
||||
switch ((rand() % 2) + 1) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns043na_PlayWav;
|
||||
break;
|
||||
case 2:
|
||||
objectId = IsleScript::c_wns044na_PlayWav;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
PlayAction(objectId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -196,8 +307,8 @@ MxLong TowTrack::HandleClick()
|
|||
else {
|
||||
SpawnPlayer(LegoGameState::e_unk28, TRUE, 0);
|
||||
m_lastAction = IsleScript::c_noneIsle;
|
||||
m_unk0x174 = -1;
|
||||
m_state->m_unk0x0c = Timer()->GetTime();
|
||||
m_lastAnimation = IsleScript::c_noneIsle;
|
||||
m_state->m_startTime = Timer()->GetTime();
|
||||
m_state->m_unk0x10 = FALSE;
|
||||
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_wns057rd_RunAnim, NULL);
|
||||
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_wns048p1_RunAnim, NULL);
|
||||
|
@ -313,17 +424,25 @@ void TowTrack::FUN_1004dbe0()
|
|||
g_isleFlags |= Isle::c_playMusic;
|
||||
AnimationManager()->EnableCamAnims(TRUE);
|
||||
AnimationManager()->FUN_1005f6d0(TRUE);
|
||||
m_state->m_unk0x0c = INT_MIN;
|
||||
m_state->m_startTime = INT_MIN;
|
||||
m_state->m_unk0x10 = FALSE;
|
||||
m_state = NULL;
|
||||
m_unk0x16c = 0;
|
||||
m_unk0x16e = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004dc80
|
||||
// FUNCTION: BETA10 0x100f86a0
|
||||
void TowTrack::PlayFinalAnimation(IsleScript::Script p_objectId)
|
||||
{
|
||||
AnimationManager()->FUN_10060dc0(p_objectId, NULL, TRUE, FALSE, NULL, FALSE, FALSE, FALSE, TRUE);
|
||||
m_lastAnimation = p_objectId;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004dcf0
|
||||
void TowTrack::PlayAction(IsleScript::Script p_objectId)
|
||||
{
|
||||
if (p_objectId != -1) {
|
||||
if (p_objectId != IsleScript::c_noneIsle) {
|
||||
InvokeAction(Extra::e_start, *g_isleScript, p_objectId, NULL);
|
||||
}
|
||||
|
||||
|
@ -339,7 +458,7 @@ TowTrackMissionState::TowTrackMissionState()
|
|||
m_unk0x16 = 0;
|
||||
m_unk0x08 = 0;
|
||||
m_unk0x18 = 0;
|
||||
m_unk0x0c = 0;
|
||||
m_startTime = 0;
|
||||
m_unk0x1a = 0;
|
||||
m_unk0x10 = FALSE;
|
||||
m_score1 = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue