Names for race related or adjacent functions and variables (#1592)

* Names for race related or adjacent functions and variables

* fix formatting

* fix formatting
This commit is contained in:
Korbo
2025-06-27 18:08:45 -05:00
committed by GitHub
parent 056064f9d4
commit 16a94c725c
9 changed files with 48 additions and 45 deletions

View File

@@ -13,7 +13,7 @@ struct LegoPathEdgeContainer;
struct LegoOrientedEdge; struct LegoOrientedEdge;
class LegoWEEdge; class LegoWEEdge;
extern MxLong g_unk0x100f3308; extern MxLong g_timeLastHitSoundPlayed;
extern const char* g_strHIT_WALL_SOUND; extern const char* g_strHIT_WALL_SOUND;
// VTABLE: LEGO1 0x100d6e28 // VTABLE: LEGO1 0x100d6e28

View File

@@ -144,10 +144,10 @@ public:
MxResult VTable0x9c() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c
virtual void SetMaxLinearVelocity(float p_maxLinearVelocity); virtual void SetMaxLinearVelocity(float p_maxLinearVelocity);
virtual void FUN_10012ff0(float p_param); virtual void KickCamera(float p_param);
virtual MxU32 HandleSkeletonKicks(float p_param1); virtual MxU32 HandleSkeletonKicks(float p_param1);
static void FUN_10012de0(); static void InitYouCantStopSound();
static void InitSoundIndices(); static void InitSoundIndices();
// SYNTHETIC: LEGO1 0x10014240 // SYNTHETIC: LEGO1 0x10014240
@@ -155,7 +155,7 @@ public:
private: private:
undefined m_userState; // 0x54 undefined m_userState; // 0x54
float m_unk0x58; // 0x58 float m_kickStart; // 0x58
Mx3DPointFloat m_unk0x5c; // 0x5c Mx3DPointFloat m_unk0x5c; // 0x5c
// Names verified by BETA10 0x100cb4a9 // Names verified by BETA10 0x100cb4a9

View File

@@ -44,8 +44,11 @@ public:
Vector3& p_v3 Vector3& p_v3
) override; // vtable+0x6c ) override; // vtable+0x6c
void Animate(float p_time) override; // vtable+0x70 void Animate(float p_time) override; // vtable+0x70
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) void SwitchBoundary(
override; // vtable+0x98 LegoPathBoundary*& p_boundary,
LegoOrientedEdge*& p_edge,
float& p_unk0xe4
) override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c
// LegoCarRaceActor vtable // LegoCarRaceActor vtable
@@ -83,7 +86,7 @@ public:
protected: protected:
MxFloat m_unk0x08; // 0x08 MxFloat m_unk0x08; // 0x08
MxU8 m_unk0x0c; // 0x0c MxU8 m_animState; // 0x0c
// Could be a multiplier for the maximum speed when going straight // Could be a multiplier for the maximum speed when going straight
MxFloat m_unk0x10; // 0x10 MxFloat m_unk0x10; // 0x10

View File

@@ -36,7 +36,7 @@ const char* g_strHIT_WALL_SOUND = "HIT_WALL_SOUND";
// GLOBAL: LEGO1 0x100f3308 // GLOBAL: LEGO1 0x100f3308
// GLOBAL: BETA10 0x101f1e1c // GLOBAL: BETA10 0x101f1e1c
MxLong g_unk0x100f3308 = 0; MxLong g_timeLastHitSoundPlayed = 0;
// FUNCTION: LEGO1 0x1002d700 // FUNCTION: LEGO1 0x1002d700
// FUNCTION: BETA10 0x100ae6e0 // FUNCTION: BETA10 0x100ae6e0
@@ -291,8 +291,8 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
if (m_boundary == oldBoundary) { if (m_boundary == oldBoundary) {
MxLong time = Timer()->GetTime(); MxLong time = Timer()->GetTime();
if (time - g_unk0x100f3308 > 1000) { if (time - g_timeLastHitSoundPlayed > 1000) {
g_unk0x100f3308 = time; g_timeLastHitSoundPlayed = time;
const char* var = VariableTable()->GetVariable(g_strHIT_WALL_SOUND); const char* var = VariableTable()->GetVariable(g_strHIT_WALL_SOUND);
if (var && var[0] != 0) { if (var && var[0] != 0) {

View File

@@ -244,7 +244,7 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); NavController()->SetDeadZone(NavController()->GetDefaultDeadZone());
NavController()->SetTrackDefault(1); NavController()->SetTrackDefault(1);
LegoRaceCar::FUN_10012de0(); LegoRaceCar::InitYouCantStopSound();
m_raceState->m_unk0x28 = 2; m_raceState->m_unk0x28 = 2;
RaceState::Entry* raceState = m_raceState->GetState(GameState()->GetActorId()); RaceState::Entry* raceState = m_raceState->GetState(GameState()->GetActorId());
@@ -346,7 +346,7 @@ MxLong CarRace::HandleClick(LegoEventNotificationParam& p_param)
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); NavController()->SetDeadZone(NavController()->GetDefaultDeadZone());
NavController()->SetTrackDefault(1); NavController()->SetTrackDefault(1);
LegoRaceCar::FUN_10012de0(); LegoRaceCar::InitYouCantStopSound();
m_destLocation = LegoGameState::e_infomain; m_destLocation = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
GameState()->GetBackgroundColor()->SetValue("reset"); GameState()->GetBackgroundColor()->SetValue("reset");
@@ -358,7 +358,7 @@ MxLong CarRace::HandleClick(LegoEventNotificationParam& p_param)
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); NavController()->SetDeadZone(NavController()->GetDefaultDeadZone());
NavController()->SetTrackDefault(1); NavController()->SetTrackDefault(1);
LegoRaceCar::FUN_10012de0(); LegoRaceCar::InitYouCantStopSound();
m_destLocation = LegoGameState::e_carraceExterior; m_destLocation = LegoGameState::e_carraceExterior;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
GameState()->GetBackgroundColor()->SetValue("reset"); GameState()->GetBackgroundColor()->SetValue("reset");
@@ -422,7 +422,7 @@ MxBool CarRace::Escape()
NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); NavController()->SetDeadZone(NavController()->GetDefaultDeadZone());
NavController()->SetTrackDefault(1); NavController()->SetTrackDefault(1);
LegoRaceCar::FUN_10012de0(); LegoRaceCar::InitYouCantStopSound();
GameState()->GetBackgroundColor()->SetValue("reset"); GameState()->GetBackgroundColor()->SetValue("reset");
m_destLocation = LegoGameState::e_infomain; m_destLocation = LegoGameState::e_infomain;

View File

@@ -130,7 +130,7 @@ MxLong JetskiRace::HandleClick(LegoEventNotificationParam& p_param)
m_act1State->m_unk0x018 = 0; m_act1State->m_unk0x018 = 0;
VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_raceState, "");
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
LegoRaceCar::FUN_10012de0(); LegoRaceCar::InitYouCantStopSound();
m_destLocation = LegoGameState::e_jetraceExterior; m_destLocation = LegoGameState::e_jetraceExterior;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break; break;
@@ -138,7 +138,7 @@ MxLong JetskiRace::HandleClick(LegoEventNotificationParam& p_param)
m_act1State->m_unk0x018 = 0; m_act1State->m_unk0x018 = 0;
VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_raceState, "");
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
LegoRaceCar::FUN_10012de0(); LegoRaceCar::InitYouCantStopSound();
m_destLocation = LegoGameState::e_infomain; m_destLocation = LegoGameState::e_infomain;
result = 1; result = 1;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
@@ -191,7 +191,7 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_raceState, "");
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
LegoRaceCar::FUN_10012de0(); LegoRaceCar::InitYouCantStopSound();
m_raceState->m_unk0x28 = 2; m_raceState->m_unk0x28 = 2;
RaceState::Entry* raceStateEntry = m_raceState->GetState(GameState()->GetActorId()); RaceState::Entry* raceStateEntry = m_raceState->GetState(GameState()->GetActorId());
@@ -292,6 +292,6 @@ MxBool JetskiRace::Escape()
VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_raceState, "");
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
m_destLocation = LegoGameState::e_infomain; m_destLocation = LegoGameState::e_infomain;
LegoRaceCar::FUN_10012de0(); LegoRaceCar::InitYouCantStopSound();
return TRUE; return TRUE;
} }

View File

@@ -31,8 +31,8 @@ MxS32 LegoRaceActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3)
if (m_userNavFlag && result) { if (m_userNavFlag && result) {
MxLong time = Timer()->GetTime(); MxLong time = Timer()->GetTime();
if (time - g_unk0x100f3308 > 1000) { if (time - g_timeLastHitSoundPlayed > 1000) {
g_unk0x100f3308 = time; g_timeLastHitSoundPlayed = time;
const char* soundKey = VariableTable()->GetVariable(g_strHIT_ACTOR_SOUND); const char* soundKey = VariableTable()->GetVariable(g_strHIT_ACTOR_SOUND);
if (soundKey && *soundKey) { if (soundKey && *soundKey) {

View File

@@ -175,7 +175,7 @@ LegoRaceCar::LegoRaceCar()
m_skelKick1Anim = 0; m_skelKick1Anim = 0;
m_skelKick2Anim = 0; m_skelKick2Anim = 0;
m_unk0x5c.Clear(); m_unk0x5c.Clear();
m_unk0x58 = 0; m_kickStart = 0;
m_kick1B = 0; m_kick1B = 0;
m_kick2B = 0; m_kick2B = 0;
NotificationManager()->Register(this); NotificationManager()->Register(this);
@@ -198,10 +198,10 @@ MxLong LegoRaceCar::Notify(MxParam& p_param)
// Initialized at LEGO1 0x10012db0 // Initialized at LEGO1 0x10012db0
// GLOBAL: LEGO1 0x10102af0 // GLOBAL: LEGO1 0x10102af0
// GLOBAL: BETA10 0x102114c0 // GLOBAL: BETA10 0x102114c0
Mx3DPointFloat g_unk0x10102af0 = Mx3DPointFloat(0.0f, 2.0f, 0.0f); Mx3DPointFloat g_hitOffset = Mx3DPointFloat(0.0f, 2.0f, 0.0f);
// FUNCTION: LEGO1 0x10012de0 // FUNCTION: LEGO1 0x10012de0
void LegoRaceCar::FUN_10012de0() void LegoRaceCar::InitYouCantStopSound()
{ {
// Init to TRUE so we don't play "you can't stop in the middle of the race!" before the player ever moves // Init to TRUE so we don't play "you can't stop in the middle of the race!" before the player ever moves
g_playedYouCantStopSound = TRUE; g_playedYouCantStopSound = TRUE;
@@ -226,7 +226,7 @@ void LegoRaceCar::InitSoundIndices()
void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed) void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed)
{ {
if (!m_userNavFlag) { if (!m_userNavFlag) {
if (!LegoCarRaceActor::m_unk0x0c) { if (!LegoCarRaceActor::m_animState) {
m_maxLinearVel = p_worldSpeed; m_maxLinearVel = p_worldSpeed;
} }
LegoAnimActor::SetWorldSpeed(p_worldSpeed); LegoAnimActor::SetWorldSpeed(p_worldSpeed);
@@ -241,7 +241,7 @@ void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed)
void LegoRaceCar::SetMaxLinearVelocity(float p_maxLinearVelocity) void LegoRaceCar::SetMaxLinearVelocity(float p_maxLinearVelocity)
{ {
if (p_maxLinearVelocity < 0) { if (p_maxLinearVelocity < 0) {
LegoCarRaceActor::m_unk0x0c = 2; LegoCarRaceActor::m_animState = 2;
m_maxLinearVel = 0; m_maxLinearVel = 0;
SetWorldSpeed(0); SetWorldSpeed(0);
} }
@@ -296,7 +296,7 @@ void LegoRaceCar::ParseAction(char* p_extra)
// FUNCTION: LEGO1 0x10012ff0 // FUNCTION: LEGO1 0x10012ff0
// FUNCTION: BETA10 0x100cb60e // FUNCTION: BETA10 0x100cb60e
void LegoRaceCar::FUN_10012ff0(float p_param) void LegoRaceCar::KickCamera(float p_param)
{ {
LegoAnimActorStruct* a; // called `a` in BETA10 LegoAnimActorStruct* a; // called `a` in BETA10
float deltaTime; float deltaTime;
@@ -312,7 +312,7 @@ void LegoRaceCar::FUN_10012ff0(float p_param)
assert(a && a->GetAnimTreePtr() && a->GetAnimTreePtr()->GetCamAnim()); assert(a && a->GetAnimTreePtr() && a->GetAnimTreePtr()->GetCamAnim());
if (a->GetAnimTreePtr()) { if (a->GetAnimTreePtr()) {
deltaTime = p_param - m_unk0x58; deltaTime = p_param - m_kickStart;
if (a->GetDuration() <= deltaTime || deltaTime < 0.0) { if (a->GetDuration() <= deltaTime || deltaTime < 0.0) {
if (m_userState == LEGORACECAR_KICK1) { if (m_userState == LEGORACECAR_KICK1) {
@@ -387,7 +387,7 @@ MxU32 LegoRaceCar::HandleSkeletonKicks(float p_param1)
return FALSE; return FALSE;
} }
m_unk0x58 = p_param1; m_kickStart = p_param1;
SoundManager()->GetCacheSoundManager()->Play(g_soundSkel3, NULL, FALSE); SoundManager()->GetCacheSoundManager()->Play(g_soundSkel3, NULL, FALSE);
return TRUE; return TRUE;
@@ -398,7 +398,7 @@ MxU32 LegoRaceCar::HandleSkeletonKicks(float p_param1)
void LegoRaceCar::Animate(float p_time) void LegoRaceCar::Animate(float p_time)
{ {
if (m_userNavFlag && (m_userState == LEGORACECAR_KICK1 || m_userState == LEGORACECAR_KICK2)) { if (m_userNavFlag && (m_userState == LEGORACECAR_KICK1 || m_userState == LEGORACECAR_KICK2)) {
FUN_10012ff0(p_time); KickCamera(p_time);
return; return;
} }
@@ -410,7 +410,7 @@ void LegoRaceCar::Animate(float p_time)
} }
} }
if (LegoCarRaceActor::m_unk0x0c == 1) { if (LegoCarRaceActor::m_animState == 1) {
FUN_1005d4b0(); FUN_1005d4b0();
if (!m_userNavFlag) { if (!m_userNavFlag) {
@@ -468,7 +468,7 @@ MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool)
assert(roi); assert(roi);
matr = roi->GetLocal2World(); matr = roi->GetLocal2World();
Vector3(matr[3]) += g_unk0x10102af0; Vector3(matr[3]) += g_hitOffset;
roi->SetLocal2World(matr); roi->SetLocal2World(matr);
p_actor->SetActorState(c_two); p_actor->SetActorState(c_two);
@@ -513,7 +513,7 @@ MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool)
if (soundKey) { if (soundKey) {
SoundManager()->GetCacheSoundManager()->Play(soundKey, NULL, FALSE); SoundManager()->GetCacheSoundManager()->Play(soundKey, NULL, FALSE);
g_timeLastRaceCarSoundPlayed = g_unk0x100f3308 = time; g_timeLastRaceCarSoundPlayed = g_timeLastHitSoundPlayed = time;
} }
} }
@@ -579,7 +579,7 @@ void LegoJetski::InitSoundIndices()
void LegoJetski::SetWorldSpeed(MxFloat p_worldSpeed) void LegoJetski::SetWorldSpeed(MxFloat p_worldSpeed)
{ {
if (!m_userNavFlag) { if (!m_userNavFlag) {
if (!LegoCarRaceActor::m_unk0x0c) { if (!LegoCarRaceActor::m_animState) {
m_maxLinearVel = p_worldSpeed; m_maxLinearVel = p_worldSpeed;
} }
LegoAnimActor::SetWorldSpeed(p_worldSpeed); LegoAnimActor::SetWorldSpeed(p_worldSpeed);
@@ -594,7 +594,7 @@ void LegoJetski::SetWorldSpeed(MxFloat p_worldSpeed)
void LegoJetski::FUN_100136f0(float p_worldSpeed) void LegoJetski::FUN_100136f0(float p_worldSpeed)
{ {
if (p_worldSpeed < 0) { if (p_worldSpeed < 0) {
LegoCarRaceActor::m_unk0x0c = 2; LegoCarRaceActor::m_animState = 2;
m_maxLinearVel = 0; m_maxLinearVel = 0;
SetWorldSpeed(0); SetWorldSpeed(0);
} }
@@ -609,7 +609,7 @@ void LegoJetski::Animate(float p_time)
{ {
LegoJetskiRaceActor::Animate(p_time); LegoJetskiRaceActor::Animate(p_time);
if (LegoCarRaceActor::m_unk0x0c == 1) { if (LegoCarRaceActor::m_animState == 1) {
FUN_1005d4b0(); FUN_1005d4b0();
if (!m_userNavFlag) { if (!m_userNavFlag) {
@@ -682,7 +682,7 @@ MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool)
LegoROI* roi = p_actor->GetROI(); LegoROI* roi = p_actor->GetROI();
matr = roi->GetLocal2World(); matr = roi->GetLocal2World();
Vector3(matr[3]) += g_unk0x10102af0; Vector3(matr[3]) += g_hitOffset;
roi->SetLocal2World(matr); roi->SetLocal2World(matr);
p_actor->SetActorState(c_two); p_actor->SetActorState(c_two);
@@ -711,7 +711,7 @@ MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool)
if (soundKey) { if (soundKey) {
SoundManager()->GetCacheSoundManager()->Play(soundKey, NULL, FALSE); SoundManager()->GetCacheSoundManager()->Play(soundKey, NULL, FALSE);
g_timeLastJetskiSoundPlayed = g_unk0x100f3308 = time; g_timeLastJetskiSoundPlayed = g_timeLastHitSoundPlayed = time;
} }
} }

View File

@@ -44,7 +44,7 @@ LegoCarRaceActor::LegoCarRaceActor()
{ {
m_unk0x08 = 1.0f; m_unk0x08 = 1.0f;
m_unk0x70 = 0.0f; m_unk0x70 = 0.0f;
m_unk0x0c = 0; m_animState = 0;
m_maxLinearVel = 0.0f; m_maxLinearVel = 0.0f;
m_frequencyFactor = 1.0f; m_frequencyFactor = 1.0f;
m_unk0x1c = 0; m_unk0x1c = 0;
@@ -223,18 +223,18 @@ void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOriente
// FUNCTION: BETA10 0x100cdbae // FUNCTION: BETA10 0x100cdbae
void LegoCarRaceActor::Animate(float p_time) void LegoCarRaceActor::Animate(float p_time)
{ {
// m_unk0x0c is not an MxBool, there are places where it is set to 2 or higher // m_animState is not an MxBool, there are places where it is set to 2 or higher
if (m_unk0x0c == 0) { if (m_animState == 0) {
const char* value = VariableTable()->GetVariable(g_raceState); const char* value = VariableTable()->GetVariable(g_raceState);
if (strcmpi(value, g_racing) == 0) { if (strcmpi(value, g_racing) == 0) {
m_unk0x0c = 1; m_animState = 1;
m_lastTime = p_time - 1.0f; m_lastTime = p_time - 1.0f;
m_unk0x1c = p_time; m_unk0x1c = p_time;
} }
} }
if (m_unk0x0c == 1) { if (m_animState == 1) {
LegoAnimActor::Animate(p_time); LegoAnimActor::Animate(p_time);
} }
} }
@@ -398,10 +398,10 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
// FUNCTION: LEGO1 0x10081550 // FUNCTION: LEGO1 0x10081550
void LegoJetskiRaceActor::Animate(float p_time) void LegoJetskiRaceActor::Animate(float p_time)
{ {
if (m_unk0x0c == 0) { if (m_animState == 0) {
const LegoChar* raceState = VariableTable()->GetVariable(g_raceState); const LegoChar* raceState = VariableTable()->GetVariable(g_raceState);
if (!stricmp(raceState, g_racing)) { if (!stricmp(raceState, g_racing)) {
m_unk0x0c = 1; m_animState = 1;
m_lastTime = p_time - 1.0f; m_lastTime = p_time - 1.0f;
m_unk0x1c = p_time; m_unk0x1c = p_time;
} }
@@ -410,7 +410,7 @@ void LegoJetskiRaceActor::Animate(float p_time)
} }
} }
if (m_unk0x0c == 1) { if (m_animState == 1) {
LegoAnimActor::Animate(p_time); LegoAnimActor::Animate(p_time);
} }
} }