mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-10 18:21:16 +00:00
Clear unknowns in LegoRace and LegoRaceState (#1702)
Some checks are pending
Analyze / ${{ matrix.who }} annotations (CONFIG) (push) Waiting to run
Analyze / ${{ matrix.who }} annotations (ISLE) (push) Waiting to run
Analyze / ${{ matrix.who }} annotations (LEGO1) (push) Waiting to run
Build / Download original binaries (push) Waiting to run
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) Waiting to run
Build / Current ${{ matrix.toolchain.name }} (map[name:MSVC setup-cmake:true setup-msvc:true setup-ninja:true shell:sh]) (push) Waiting to run
Build / MSVC 4.20 (push) Waiting to run
Build / MSVC 4.20 (BETA10) (push) Waiting to run
Build / Verify decomp (push) Blocked by required conditions
Build / Upload artifacts (push) Blocked by required conditions
Format / C++ (push) Waiting to run
Naming / C++ (push) Waiting to run
Some checks are pending
Analyze / ${{ matrix.who }} annotations (CONFIG) (push) Waiting to run
Analyze / ${{ matrix.who }} annotations (ISLE) (push) Waiting to run
Analyze / ${{ matrix.who }} annotations (LEGO1) (push) Waiting to run
Build / Download original binaries (push) Waiting to run
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) Waiting to run
Build / Current ${{ matrix.toolchain.name }} (map[name:MSVC setup-cmake:true setup-msvc:true setup-ninja:true shell:sh]) (push) Waiting to run
Build / MSVC 4.20 (push) Waiting to run
Build / MSVC 4.20 (BETA10) (push) Waiting to run
Build / Verify decomp (push) Blocked by required conditions
Build / Upload artifacts (push) Blocked by required conditions
Format / C++ (push) Waiting to run
Naming / C++ (push) Waiting to run
This commit is contained in:
parent
36d760c686
commit
056bdfb0b8
@ -29,11 +29,11 @@ class RaceState : public LegoState {
|
||||
Entry()
|
||||
{
|
||||
m_id = 0;
|
||||
m_unk0x02 = 0;
|
||||
m_lastScore = 0;
|
||||
m_score = 0;
|
||||
}
|
||||
|
||||
MxS16 GetUnknown0x02() { return m_unk0x02; }
|
||||
MxS16 GetLastScore() { return m_lastScore; }
|
||||
|
||||
// FUNCTION: BETA10 0x10088970
|
||||
MxS16 GetHighScore() { return m_score; }
|
||||
@ -43,12 +43,12 @@ class RaceState : public LegoState {
|
||||
{
|
||||
if (p_storage->IsReadMode()) {
|
||||
p_storage->ReadU8(m_id);
|
||||
p_storage->ReadS16(m_unk0x02);
|
||||
p_storage->ReadS16(m_lastScore);
|
||||
p_storage->ReadS16(m_score);
|
||||
}
|
||||
else if (p_storage->IsWriteMode()) {
|
||||
p_storage->WriteU8(m_id);
|
||||
p_storage->WriteS16(m_unk0x02);
|
||||
p_storage->WriteS16(m_lastScore);
|
||||
p_storage->WriteS16(m_score);
|
||||
}
|
||||
else {
|
||||
@ -59,9 +59,15 @@ class RaceState : public LegoState {
|
||||
}
|
||||
|
||||
// TODO: Possibly private
|
||||
MxU8 m_id; // 0x00
|
||||
MxS16 m_unk0x02; // 0x02
|
||||
MxS16 m_score; // 0x04
|
||||
MxU8 m_id; // 0x00
|
||||
MxS16 m_lastScore; // 0x02
|
||||
MxS16 m_score; // 0x04
|
||||
};
|
||||
|
||||
enum {
|
||||
e_carrace = 0,
|
||||
e_jetrace = 1,
|
||||
e_finished = 2,
|
||||
};
|
||||
|
||||
RaceState();
|
||||
@ -94,8 +100,8 @@ class RaceState : public LegoState {
|
||||
|
||||
// TODO: Most likely getters/setters are not used according to BETA.
|
||||
|
||||
Entry m_state[5]; // 0x08
|
||||
undefined4 m_unk0x28; // 0x28
|
||||
Entry m_entries[5]; // 0x08
|
||||
MxU32 m_state; // 0x28
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100d5db0
|
||||
@ -147,9 +153,9 @@ class LegoRace : public LegoWorld {
|
||||
|
||||
// FUNCTION: LEGO1 0x1000dac0
|
||||
// FUNCTION: BETA10 0x100a87d0
|
||||
virtual void VTable0x7c(LegoRaceMap* p_map, MxU32 p_index) // vtable+0x7c
|
||||
virtual void SetMapLocator(LegoRaceMap* p_map, MxU32 p_index) // vtable+0x7c
|
||||
{
|
||||
m_maps[p_index] = p_map;
|
||||
m_mapsLocators[p_index] = p_map;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1000dae0
|
||||
@ -161,20 +167,20 @@ class LegoRace : public LegoWorld {
|
||||
// LegoRace::`scalar deleting destructor'
|
||||
|
||||
protected:
|
||||
MxS32 m_unk0xf8; // 0xf8
|
||||
MxS32 m_unk0xfc; // 0xfc
|
||||
MxS32 m_unk0x100; // 0x100
|
||||
MxS32 m_unk0x104; // 0x104
|
||||
MxS32 m_unk0x108; // 0x108
|
||||
MxS32 m_unk0x10c; // 0x10c
|
||||
LegoRaceMap* m_maps[3]; // 0x110
|
||||
LegoGameState::Area m_destLocation; // 0x11c
|
||||
LegoPathActor* m_pathActor; // 0x120
|
||||
Act1State* m_act1State; // 0x124
|
||||
MxStillPresenter* m_unk0x128; // 0x128
|
||||
MxStillPresenter* m_unk0x12c; // 0x12c
|
||||
MxRect32 m_unk0x130; // 0x130
|
||||
RaceState* m_raceState; // 0x140
|
||||
MxS32 m_playerLaps; // 0xf8
|
||||
MxS32 m_opponent1Laps; // 0xfc
|
||||
MxS32 m_opponent2Laps; // 0x100
|
||||
MxS32 m_playerLastPathStruct; // 0x104
|
||||
MxS32 m_opponent1LastPathStruct; // 0x108
|
||||
MxS32 m_opponent2LastPathStruct; // 0x10c
|
||||
LegoRaceMap* m_mapsLocators[3]; // 0x110
|
||||
LegoGameState::Area m_destLocation; // 0x11c
|
||||
LegoPathActor* m_pathActor; // 0x120
|
||||
Act1State* m_act1State; // 0x124
|
||||
MxStillPresenter* m_opponent1Locator; // 0x128
|
||||
MxStillPresenter* m_opponent2Locator; // 0x12c
|
||||
MxRect32 m_progressBarRect; // 0x130
|
||||
RaceState* m_raceState; // 0x140
|
||||
};
|
||||
|
||||
#endif // LEGORACE_H
|
||||
|
||||
@ -72,7 +72,7 @@ MxS32 g_unk0x100f0c7c = 2;
|
||||
CarRace::CarRace()
|
||||
{
|
||||
m_skeleton = NULL;
|
||||
m_unk0x130 = MxRect32(0x16c, 0x154, 0x1ec, 0x15e);
|
||||
m_progressBarRect = MxRect32(0x16c, 0x154, 0x1ec, 0x15e);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10016ce0
|
||||
@ -132,11 +132,11 @@ void CarRace::ReadyWorld()
|
||||
AnimationManager()
|
||||
->FUN_10060dc0(m_unk0x144, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, FALSE, TRUE);
|
||||
|
||||
m_unk0x128 = (MxStillPresenter*) Find("MxPresenter", "CarLocator2");
|
||||
m_unk0x128->SetPosition(m_unk0x130.GetLeft(), m_unk0x130.GetTop());
|
||||
m_opponent1Locator = (MxStillPresenter*) Find("MxPresenter", "CarLocator2");
|
||||
m_opponent1Locator->SetPosition(m_progressBarRect.GetLeft(), m_progressBarRect.GetTop());
|
||||
|
||||
m_unk0x12c = (MxStillPresenter*) Find("MxPresenter", "CarLocator3");
|
||||
m_unk0x12c->SetPosition(m_unk0x130.GetLeft(), m_unk0x130.GetTop());
|
||||
m_opponent2Locator = (MxStillPresenter*) Find("MxPresenter", "CarLocator3");
|
||||
m_opponent2Locator->SetPosition(m_progressBarRect.GetLeft(), m_progressBarRect.GetTop());
|
||||
VariableTable()->SetVariable("DISTANCE", "0.036");
|
||||
}
|
||||
|
||||
@ -155,9 +155,9 @@ MxLong CarRace::HandleEndAction(MxEndActionNotificationParam& p_param)
|
||||
result = 1;
|
||||
}
|
||||
else if (objectId == CarraceScript::c_irtx08ra_PlayWav && m_destLocation == LegoGameState::e_undefined) {
|
||||
m_maps[0]->Mute(FALSE);
|
||||
m_maps[1]->Mute(FALSE);
|
||||
m_maps[2]->Mute(FALSE);
|
||||
m_mapsLocators[0]->Mute(FALSE);
|
||||
m_mapsLocators[1]->Mute(FALSE);
|
||||
m_mapsLocators[2]->Mute(FALSE);
|
||||
|
||||
VariableTable()->SetVariable(g_raceState, g_racing);
|
||||
result = 1;
|
||||
@ -186,46 +186,50 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
|
||||
switch (sender->GetEntityId()) {
|
||||
case 10:
|
||||
if (paramData <= m_unk0x104 || paramData >= m_unk0x104 + 5) {
|
||||
if (paramData <= m_playerLastPathStruct || paramData >= m_playerLastPathStruct + 5) {
|
||||
break;
|
||||
}
|
||||
|
||||
m_unk0x104 = paramData;
|
||||
m_playerLastPathStruct = paramData;
|
||||
LegoChar buffer[20];
|
||||
sprintf(buffer, "%g", 0.036 + 0.928 * (m_unk0xf8 * 20.0 + m_unk0x104) / (g_unk0x100f0c7c * 20.0));
|
||||
sprintf(
|
||||
buffer,
|
||||
"%g",
|
||||
0.036 + 0.928 * (m_playerLaps * 20.0 + m_playerLastPathStruct) / (g_unk0x100f0c7c * 20.0)
|
||||
);
|
||||
VariableTable()->SetVariable("DISTANCE", buffer);
|
||||
|
||||
if (m_unk0x104 == 0x14) {
|
||||
m_unk0x104 = 0;
|
||||
m_unk0xf8++;
|
||||
if (m_playerLastPathStruct == 0x14) {
|
||||
m_playerLastPathStruct = 0;
|
||||
m_playerLaps++;
|
||||
|
||||
if (g_unk0x100f0c7c == m_unk0xf8) {
|
||||
if (g_unk0x100f0c7c == m_playerLaps) {
|
||||
VariableTable()->SetVariable(g_raceState, "");
|
||||
|
||||
m_maps[0]->Mute(TRUE);
|
||||
m_maps[1]->Mute(TRUE);
|
||||
m_maps[2]->Mute(TRUE);
|
||||
m_mapsLocators[0]->Mute(TRUE);
|
||||
m_mapsLocators[1]->Mute(TRUE);
|
||||
m_mapsLocators[2]->Mute(TRUE);
|
||||
|
||||
m_maps[0]->SetMaxLinearVel(-1.0);
|
||||
m_maps[1]->SetMaxLinearVel(-1.0);
|
||||
m_maps[2]->SetMaxLinearVel(-1.0);
|
||||
m_mapsLocators[0]->SetMaxLinearVel(-1.0);
|
||||
m_mapsLocators[1]->SetMaxLinearVel(-1.0);
|
||||
m_mapsLocators[2]->SetMaxLinearVel(-1.0);
|
||||
|
||||
RemoveActor(m_maps[1]);
|
||||
m_maps[1]->ClearMaps();
|
||||
RemoveActor(m_mapsLocators[1]);
|
||||
m_mapsLocators[1]->ClearMaps();
|
||||
|
||||
RemoveActor(m_maps[2]);
|
||||
m_maps[2]->ClearMaps();
|
||||
RemoveActor(m_mapsLocators[2]);
|
||||
m_mapsLocators[2]->ClearMaps();
|
||||
|
||||
MxS32 position;
|
||||
|
||||
if (m_unk0xfc < m_unk0xf8 && m_unk0x100 < m_unk0xf8) {
|
||||
if (m_opponent1Laps < m_playerLaps && m_opponent2Laps < m_playerLaps) {
|
||||
position = 3;
|
||||
m_unk0x148 = g_unk0x100d5d40[rand() % 3];
|
||||
m_unk0x14c = g_unk0x100d5d60[rand() % 3];
|
||||
}
|
||||
else if (m_unk0xfc < m_unk0xf8 || m_unk0x100 < m_unk0xf8) {
|
||||
else if (m_opponent1Laps < m_playerLaps || m_opponent2Laps < m_playerLaps) {
|
||||
position = 2;
|
||||
if (m_unk0xfc == g_unk0x100f0c7c) {
|
||||
if (m_opponent1Laps == g_unk0x100f0c7c) {
|
||||
m_unk0x148 = g_unk0x100d5d30[rand() % 4];
|
||||
m_unk0x14c = g_unk0x100d5d60[rand() % 3];
|
||||
}
|
||||
@ -246,10 +250,10 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
NavController()->SetDeadZone(NavController()->GetDefaultDeadZone());
|
||||
NavController()->SetTrackDefault(1);
|
||||
LegoRaceCar::InitYouCantStopSound();
|
||||
m_raceState->m_unk0x28 = 2;
|
||||
m_raceState->m_state = RaceState::e_finished;
|
||||
|
||||
RaceState::Entry* raceState = m_raceState->GetState(GameState()->GetActorId());
|
||||
raceState->m_unk0x02 = position;
|
||||
raceState->m_lastScore = position;
|
||||
|
||||
if (raceState->m_score < (MxS16) position) {
|
||||
raceState->m_score = position;
|
||||
@ -273,22 +277,22 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
|
||||
break;
|
||||
case 11:
|
||||
if (paramData <= m_unk0x108 || paramData >= m_unk0x108 + 5) {
|
||||
if (paramData <= m_opponent1LastPathStruct || paramData >= m_opponent1LastPathStruct + 5) {
|
||||
break;
|
||||
}
|
||||
|
||||
FUN_10017820(11, paramData);
|
||||
m_unk0x108 = paramData;
|
||||
m_opponent1LastPathStruct = paramData;
|
||||
|
||||
if (m_unk0x108 == 0x14) {
|
||||
m_unk0x108 = 0;
|
||||
m_unk0xfc++;
|
||||
if (m_opponent1LastPathStruct == 0x14) {
|
||||
m_opponent1LastPathStruct = 0;
|
||||
m_opponent1Laps++;
|
||||
|
||||
if (g_unk0x100f0c7c == m_unk0xfc) {
|
||||
m_maps[1]->SetMaxLinearVel(-1.0);
|
||||
RemoveActor(m_maps[1]);
|
||||
m_maps[1]->ClearMaps();
|
||||
m_maps[1]->GetROI()->SetVisibility(FALSE);
|
||||
if (g_unk0x100f0c7c == m_opponent1Laps) {
|
||||
m_mapsLocators[1]->SetMaxLinearVel(-1.0);
|
||||
RemoveActor(m_mapsLocators[1]);
|
||||
m_mapsLocators[1]->ClearMaps();
|
||||
m_mapsLocators[1]->GetROI()->SetVisibility(FALSE);
|
||||
|
||||
LegoROI* roi = FindROI("rcblack");
|
||||
|
||||
@ -300,23 +304,22 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
|
||||
break;
|
||||
case 12:
|
||||
if (paramData <= m_unk0x10c || paramData >= m_unk0x10c + 5) {
|
||||
if (paramData <= m_opponent2LastPathStruct || paramData >= m_opponent2LastPathStruct + 5) {
|
||||
break;
|
||||
}
|
||||
|
||||
FUN_10017820(12, paramData);
|
||||
m_opponent2LastPathStruct = paramData;
|
||||
|
||||
m_unk0x10c = paramData;
|
||||
if (m_opponent2LastPathStruct == 0x14) {
|
||||
m_opponent2LastPathStruct = 0;
|
||||
m_opponent2Laps++;
|
||||
|
||||
if (m_unk0x10c == 0x14) {
|
||||
m_unk0x10c = 0;
|
||||
m_unk0x100++;
|
||||
|
||||
if (g_unk0x100f0c7c == m_unk0x100) {
|
||||
m_maps[2]->SetMaxLinearVel(-1.0);
|
||||
RemoveActor(m_maps[2]);
|
||||
m_maps[2]->ClearMaps();
|
||||
m_maps[2]->GetROI()->SetVisibility(FALSE);
|
||||
if (g_unk0x100f0c7c == m_opponent2Laps) {
|
||||
m_mapsLocators[2]->SetMaxLinearVel(-1.0);
|
||||
RemoveActor(m_mapsLocators[2]);
|
||||
m_mapsLocators[2]->ClearMaps();
|
||||
m_mapsLocators[2]->GetROI()->SetVisibility(FALSE);
|
||||
|
||||
LegoROI* roi = FindROI("rcgreen");
|
||||
|
||||
@ -373,7 +376,7 @@ MxLong CarRace::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
// FUNCTION: BETA10 0x100c8f59
|
||||
MxLong CarRace::HandleType0Notification(MxNotificationParam&)
|
||||
{
|
||||
if (m_raceState->m_unk0x28 == 2) {
|
||||
if (m_raceState->m_state == RaceState::e_finished) {
|
||||
m_destLocation = LegoGameState::e_unk21;
|
||||
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
||||
}
|
||||
@ -389,19 +392,21 @@ void CarRace::FUN_10017820(MxS32 p_param1, MxS16 p_param2)
|
||||
MxS32 x, y;
|
||||
|
||||
if (p_param1 == 11) {
|
||||
presenter = m_unk0x128;
|
||||
local4 = m_unk0xfc;
|
||||
presenter = m_opponent1Locator;
|
||||
local4 = m_opponent1Laps;
|
||||
}
|
||||
else if (p_param1 == 12) {
|
||||
presenter = m_unk0x12c;
|
||||
local4 = m_unk0x100;
|
||||
presenter = m_opponent2Locator;
|
||||
local4 = m_opponent2Laps;
|
||||
}
|
||||
|
||||
if (presenter) {
|
||||
x = m_unk0x130.GetLeft() + 0.5 +
|
||||
(m_unk0x130.GetRight() - m_unk0x130.GetLeft() + 1) * (local4 * 20.0 + p_param2) / (g_unk0x100f0c7c * 20.0);
|
||||
y = m_unk0x130.GetTop() + 0.5 +
|
||||
(m_unk0x130.GetBottom() - m_unk0x130.GetTop() + 1) * (local4 * 20.0 + p_param2) / (g_unk0x100f0c7c * 20.0);
|
||||
x = m_progressBarRect.GetLeft() + 0.5 +
|
||||
(m_progressBarRect.GetRight() - m_progressBarRect.GetLeft() + 1) * (local4 * 20.0 + p_param2) /
|
||||
(g_unk0x100f0c7c * 20.0);
|
||||
y = m_progressBarRect.GetTop() + 0.5 +
|
||||
(m_progressBarRect.GetBottom() - m_progressBarRect.GetTop() + 1) * (local4 * 20.0 + p_param2) /
|
||||
(g_unk0x100f0c7c * 20.0);
|
||||
|
||||
presenter->SetPosition(x, y);
|
||||
}
|
||||
|
||||
@ -58,11 +58,11 @@ MxResult JetskiRace::Create(MxDSAction& p_dsAction)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_raceState->m_unk0x28 = 1;
|
||||
m_unk0x130.SetLeft(397);
|
||||
m_unk0x130.SetTop(317);
|
||||
m_unk0x130.SetRight(543);
|
||||
m_unk0x130.SetBottom(333);
|
||||
m_raceState->m_state = RaceState::e_jetrace;
|
||||
m_progressBarRect.SetLeft(397);
|
||||
m_progressBarRect.SetTop(317);
|
||||
m_progressBarRect.SetRight(543);
|
||||
m_progressBarRect.SetBottom(333);
|
||||
LegoJetski::InitSoundIndices();
|
||||
|
||||
MxS32 streamId =
|
||||
@ -90,10 +90,10 @@ void JetskiRace::ReadyWorld()
|
||||
|
||||
AnimationManager()->Resume();
|
||||
|
||||
m_unk0x128 = (MxStillPresenter*) Find("MxPresenter", "JetskiLocator2");
|
||||
m_unk0x128->SetPosition(m_unk0x130.GetLeft(), m_unk0x130.GetTop());
|
||||
m_unk0x12c = (MxStillPresenter*) Find("MxPresenter", "JetskiLocator3");
|
||||
m_unk0x12c->SetPosition(m_unk0x130.GetLeft(), m_unk0x130.GetTop());
|
||||
m_opponent1Locator = (MxStillPresenter*) Find("MxPresenter", "JetskiLocator2");
|
||||
m_opponent1Locator->SetPosition(m_progressBarRect.GetLeft(), m_progressBarRect.GetTop());
|
||||
m_opponent2Locator = (MxStillPresenter*) Find("MxPresenter", "JetskiLocator3");
|
||||
m_opponent2Locator->SetPosition(m_progressBarRect.GetLeft(), m_progressBarRect.GetTop());
|
||||
|
||||
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
||||
|
||||
@ -108,9 +108,9 @@ MxLong JetskiRace::HandleEndAction(MxEndActionNotificationParam& p_param)
|
||||
MxLong result = 0;
|
||||
|
||||
if ((p_param.GetAction()) && (p_param.GetAction()->GetObjectId() == JetraceScript::c_AirHorn_PlayWav)) {
|
||||
m_maps[0]->Mute(FALSE);
|
||||
m_maps[1]->Mute(FALSE);
|
||||
m_maps[2]->Mute(FALSE);
|
||||
m_mapsLocators[0]->Mute(FALSE);
|
||||
m_mapsLocators[1]->Mute(FALSE);
|
||||
m_mapsLocators[2]->Mute(FALSE);
|
||||
|
||||
VariableTable()->SetVariable(g_raceState, g_racing);
|
||||
result = 1;
|
||||
@ -163,26 +163,30 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
|
||||
switch (sender->GetEntityId()) {
|
||||
case 10:
|
||||
if (paramData <= m_unk0x104 || paramData >= m_unk0x104 + 5) {
|
||||
if (paramData <= m_playerLastPathStruct || paramData >= m_playerLastPathStruct + 5) {
|
||||
break;
|
||||
}
|
||||
|
||||
m_unk0x104 = paramData;
|
||||
m_playerLastPathStruct = paramData;
|
||||
LegoChar buffer[20];
|
||||
sprintf(buffer, "%g", 0.032 + 0.936 * (m_unk0xf8 * 20.0 + m_unk0x104) / (g_unk0x100f0c78 * 20.0));
|
||||
sprintf(
|
||||
buffer,
|
||||
"%g",
|
||||
0.032 + 0.936 * (m_playerLaps * 20.0 + m_playerLastPathStruct) / (g_unk0x100f0c78 * 20.0)
|
||||
);
|
||||
VariableTable()->SetVariable("DISTANCE", buffer);
|
||||
|
||||
if (m_unk0x104 == 0x14) {
|
||||
m_unk0x104 = 0;
|
||||
m_unk0xf8++;
|
||||
if (m_playerLastPathStruct == 0x14) {
|
||||
m_playerLastPathStruct = 0;
|
||||
m_playerLaps++;
|
||||
|
||||
if (g_unk0x100f0c78 == m_unk0xf8) {
|
||||
if (g_unk0x100f0c78 == m_playerLaps) {
|
||||
MxS32 position;
|
||||
|
||||
if (m_unk0xfc < m_unk0xf8 && m_unk0x100 < m_unk0xf8) {
|
||||
if (m_opponent1Laps < m_playerLaps && m_opponent2Laps < m_playerLaps) {
|
||||
position = 3;
|
||||
}
|
||||
else if (m_unk0xfc < m_unk0xf8 || m_unk0x100 < m_unk0xf8) {
|
||||
else if (m_opponent1Laps < m_playerLaps || m_opponent2Laps < m_playerLaps) {
|
||||
position = 2;
|
||||
}
|
||||
else {
|
||||
@ -192,10 +196,10 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
VariableTable()->SetVariable(g_raceState, "");
|
||||
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
|
||||
LegoRaceCar::InitYouCantStopSound();
|
||||
m_raceState->m_unk0x28 = 2;
|
||||
m_raceState->m_state = RaceState::e_finished;
|
||||
|
||||
RaceState::Entry* raceStateEntry = m_raceState->GetState(GameState()->GetActorId());
|
||||
raceStateEntry->m_unk0x02 = position;
|
||||
raceStateEntry->m_lastScore = position;
|
||||
|
||||
if (raceStateEntry->m_score < (MxS16) position) {
|
||||
raceStateEntry->m_score = position;
|
||||
@ -208,44 +212,44 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
|
||||
result = 1;
|
||||
}
|
||||
else if (m_unk0x104 == 0xf) {
|
||||
m_hideAnim->FUN_1006db40(m_unk0xf8 * 200 + 100);
|
||||
else if (m_playerLastPathStruct == 0xf) {
|
||||
m_hideAnim->FUN_1006db40(m_playerLaps * 200 + 100);
|
||||
result = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
case 11:
|
||||
if (paramData <= m_unk0x108 || paramData >= m_unk0x108 + 5) {
|
||||
if (paramData <= m_opponent1LastPathStruct || paramData >= m_opponent1LastPathStruct + 5) {
|
||||
break;
|
||||
}
|
||||
|
||||
FUN_10016930(11, paramData);
|
||||
m_unk0x108 = paramData;
|
||||
m_opponent1LastPathStruct = paramData;
|
||||
|
||||
if (m_unk0x108 == 0x14) {
|
||||
m_unk0x108 = 0;
|
||||
m_unk0xfc++;
|
||||
if (m_opponent1LastPathStruct == 0x14) {
|
||||
m_opponent1LastPathStruct = 0;
|
||||
m_opponent1Laps++;
|
||||
|
||||
if (g_unk0x100f0c78 == m_unk0xfc) {
|
||||
if (g_unk0x100f0c78 == m_opponent1Laps) {
|
||||
((LegoPathActor*) p_param.GetSender())->SetMaxLinearVel(0.1);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 12:
|
||||
if (paramData <= m_unk0x10c || paramData >= m_unk0x10c + 5) {
|
||||
if (paramData <= m_opponent2LastPathStruct || paramData >= m_opponent2LastPathStruct + 5) {
|
||||
break;
|
||||
}
|
||||
|
||||
FUN_10016930(12, paramData);
|
||||
|
||||
m_unk0x10c = paramData;
|
||||
m_opponent2LastPathStruct = paramData;
|
||||
|
||||
if (m_unk0x10c == 0x14) {
|
||||
m_unk0x10c = 0;
|
||||
m_unk0x100++;
|
||||
if (m_opponent2LastPathStruct == 0x14) {
|
||||
m_opponent2LastPathStruct = 0;
|
||||
m_opponent2Laps++;
|
||||
|
||||
if (g_unk0x100f0c78 == m_unk0x100) {
|
||||
if (g_unk0x100f0c78 == m_opponent2Laps) {
|
||||
((LegoPathActor*) p_param.GetSender())->SetMaxLinearVel(0.1);
|
||||
}
|
||||
}
|
||||
@ -265,19 +269,21 @@ void JetskiRace::FUN_10016930(MxS32 p_param1, MxS16 p_param2)
|
||||
MxS32 x, y;
|
||||
|
||||
if (p_param1 == 11) {
|
||||
presenter = m_unk0x128;
|
||||
local4 = m_unk0xfc;
|
||||
presenter = m_opponent1Locator;
|
||||
local4 = m_opponent1Laps;
|
||||
}
|
||||
else if (p_param1 == 12) {
|
||||
presenter = m_unk0x12c;
|
||||
local4 = m_unk0x100;
|
||||
presenter = m_opponent2Locator;
|
||||
local4 = m_opponent2Laps;
|
||||
}
|
||||
|
||||
if (presenter) {
|
||||
x = m_unk0x130.GetLeft() + 0.5 +
|
||||
(m_unk0x130.GetRight() - m_unk0x130.GetLeft() + 1) * (local4 * 20.0 + p_param2) / (g_unk0x100f0c78 * 20.0);
|
||||
y = m_unk0x130.GetTop() + 0.5 +
|
||||
(m_unk0x130.GetBottom() - m_unk0x130.GetTop() + 1) * (local4 * 20.0 + p_param2) / (g_unk0x100f0c78 * 20.0);
|
||||
x = m_progressBarRect.GetLeft() + 0.5 +
|
||||
(m_progressBarRect.GetRight() - m_progressBarRect.GetLeft() + 1) * (local4 * 20.0 + p_param2) /
|
||||
(g_unk0x100f0c78 * 20.0);
|
||||
y = m_progressBarRect.GetTop() + 0.5 +
|
||||
(m_progressBarRect.GetBottom() - m_progressBarRect.GetTop() + 1) * (local4 * 20.0 + p_param2) /
|
||||
(g_unk0x100f0c78 * 20.0);
|
||||
|
||||
presenter->SetPosition(x, y);
|
||||
}
|
||||
|
||||
@ -17,18 +17,18 @@ extern MxBool g_unk0x100f119c;
|
||||
// FUNCTION: LEGO1 0x10015aa0
|
||||
LegoRace::LegoRace()
|
||||
{
|
||||
m_unk0xf8 = 0;
|
||||
m_unk0xfc = 0;
|
||||
m_unk0x100 = 0;
|
||||
m_unk0x104 = 0;
|
||||
m_unk0x108 = 0;
|
||||
m_unk0x10c = 0;
|
||||
m_playerLaps = 0;
|
||||
m_opponent1Laps = 0;
|
||||
m_opponent2Laps = 0;
|
||||
m_playerLastPathStruct = 0;
|
||||
m_opponent1LastPathStruct = 0;
|
||||
m_opponent2LastPathStruct = 0;
|
||||
m_raceState = NULL;
|
||||
m_maps[0] = NULL;
|
||||
m_maps[1] = NULL;
|
||||
m_maps[2] = NULL;
|
||||
m_unk0x128 = 0;
|
||||
m_unk0x12c = 0;
|
||||
m_mapsLocators[0] = NULL;
|
||||
m_mapsLocators[1] = NULL;
|
||||
m_mapsLocators[2] = NULL;
|
||||
m_opponent1Locator = 0;
|
||||
m_opponent2Locator = 0;
|
||||
m_pathActor = 0;
|
||||
m_act1State = NULL;
|
||||
m_destLocation = LegoGameState::e_undefined;
|
||||
@ -116,22 +116,22 @@ void LegoRace::Enable(MxBool p_enable)
|
||||
// FUNCTION: LEGO1 0x10015f30
|
||||
RaceState::RaceState()
|
||||
{
|
||||
m_state[0].m_id = 1;
|
||||
m_state[0].m_unk0x02 = 0;
|
||||
m_state[0].m_score = 0;
|
||||
m_state[1].m_id = 2;
|
||||
m_state[1].m_unk0x02 = 0;
|
||||
m_state[1].m_score = 0;
|
||||
m_state[2].m_id = 3;
|
||||
m_state[2].m_unk0x02 = 0;
|
||||
m_state[2].m_score = 0;
|
||||
m_state[3].m_id = 4;
|
||||
m_state[3].m_unk0x02 = 0;
|
||||
m_state[3].m_score = 0;
|
||||
m_state[4].m_id = 5;
|
||||
m_state[4].m_unk0x02 = 0;
|
||||
m_state[4].m_score = 0;
|
||||
m_unk0x28 = 0;
|
||||
m_entries[0].m_id = 1;
|
||||
m_entries[0].m_lastScore = 0;
|
||||
m_entries[0].m_score = 0;
|
||||
m_entries[1].m_id = 2;
|
||||
m_entries[1].m_lastScore = 0;
|
||||
m_entries[1].m_score = 0;
|
||||
m_entries[2].m_id = 3;
|
||||
m_entries[2].m_lastScore = 0;
|
||||
m_entries[2].m_score = 0;
|
||||
m_entries[3].m_id = 4;
|
||||
m_entries[3].m_lastScore = 0;
|
||||
m_entries[3].m_score = 0;
|
||||
m_entries[4].m_id = 5;
|
||||
m_entries[4].m_lastScore = 0;
|
||||
m_entries[4].m_score = 0;
|
||||
m_state = RaceState::e_carrace;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10016140
|
||||
@ -141,7 +141,7 @@ MxResult RaceState::Serialize(LegoStorage* p_storage)
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
m_state[i].Serialize(p_storage);
|
||||
m_entries[i].Serialize(p_storage);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
@ -156,8 +156,8 @@ RaceState::Entry* RaceState::GetState(MxU8 p_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (m_state[i].m_id == p_id) {
|
||||
return m_state + i;
|
||||
if (m_entries[i].m_id == p_id) {
|
||||
return m_entries + i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ void LegoRaceCar::ParseAction(char* p_extra)
|
||||
LegoRace* currentWorld = (LegoRace*) CurrentWorld();
|
||||
|
||||
if (KeyValueStringParse(buffer, g_strCOMP, p_extra) && currentWorld) {
|
||||
currentWorld->VTable0x7c(this, atoi(buffer));
|
||||
currentWorld->SetMapLocator(this, atoi(buffer));
|
||||
}
|
||||
|
||||
if (m_userNavFlag) {
|
||||
@ -656,7 +656,7 @@ void LegoJetski::ParseAction(char* p_extra)
|
||||
JetskiRace* currentWorld = (JetskiRace*) CurrentWorld();
|
||||
|
||||
if (KeyValueStringParse(buffer, g_strCOMP, p_extra) && currentWorld) {
|
||||
currentWorld->VTable0x7c(this, atoi(buffer));
|
||||
currentWorld->SetMapLocator(this, atoi(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -594,7 +594,7 @@ void Isle::Enable(MxBool p_enable)
|
||||
SetIsWorldActive(FALSE);
|
||||
break;
|
||||
case LegoGameState::e_jetrace2:
|
||||
if (((JetskiRaceState*) GameState()->GetState("JetskiRaceState"))->m_unk0x28 == 2) {
|
||||
if (((JetskiRaceState*) GameState()->GetState("JetskiRaceState"))->m_state == RaceState::e_finished) {
|
||||
m_act1state->m_state = Act1State::e_transitionToJetski;
|
||||
}
|
||||
|
||||
@ -737,10 +737,10 @@ void Isle::Enable(MxBool p_enable)
|
||||
);
|
||||
JetskiRaceState* raceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState");
|
||||
|
||||
if (raceState->m_unk0x28 == 2) {
|
||||
if (raceState->m_state == RaceState::e_finished) {
|
||||
IsleScript::Script script = IsleScript::c_noneIsle;
|
||||
|
||||
switch (raceState->GetState(GameState()->GetActorId())->GetUnknown0x02()) {
|
||||
switch (raceState->GetState(GameState()->GetActorId())->GetLastScore()) {
|
||||
case 1:
|
||||
script = IsleScript::c_sjs014in_RunAnim;
|
||||
break;
|
||||
@ -771,10 +771,10 @@ void Isle::Enable(MxBool p_enable)
|
||||
);
|
||||
CarRaceState* raceState = (CarRaceState*) GameState()->GetState("CarRaceState");
|
||||
|
||||
if (raceState->m_unk0x28 == 2) {
|
||||
if (raceState->m_state == RaceState::e_finished) {
|
||||
IsleScript::Script script = IsleScript::c_noneIsle;
|
||||
|
||||
switch (raceState->GetState(GameState()->GetActorId())->GetUnknown0x02()) {
|
||||
switch (raceState->GetState(GameState()->GetActorId())->GetLastScore()) {
|
||||
case 1:
|
||||
script = IsleScript::c_srt003in_RunAnim;
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user