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

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

View File

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

View File

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

View File

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

View File

@@ -175,7 +175,7 @@ LegoRaceCar::LegoRaceCar()
m_skelKick1Anim = 0;
m_skelKick2Anim = 0;
m_unk0x5c.Clear();
m_unk0x58 = 0;
m_kickStart = 0;
m_kick1B = 0;
m_kick2B = 0;
NotificationManager()->Register(this);
@@ -198,10 +198,10 @@ MxLong LegoRaceCar::Notify(MxParam& p_param)
// Initialized at LEGO1 0x10012db0
// GLOBAL: LEGO1 0x10102af0
// 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
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
g_playedYouCantStopSound = TRUE;
@@ -226,7 +226,7 @@ void LegoRaceCar::InitSoundIndices()
void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed)
{
if (!m_userNavFlag) {
if (!LegoCarRaceActor::m_unk0x0c) {
if (!LegoCarRaceActor::m_animState) {
m_maxLinearVel = p_worldSpeed;
}
LegoAnimActor::SetWorldSpeed(p_worldSpeed);
@@ -241,7 +241,7 @@ void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed)
void LegoRaceCar::SetMaxLinearVelocity(float p_maxLinearVelocity)
{
if (p_maxLinearVelocity < 0) {
LegoCarRaceActor::m_unk0x0c = 2;
LegoCarRaceActor::m_animState = 2;
m_maxLinearVel = 0;
SetWorldSpeed(0);
}
@@ -296,7 +296,7 @@ void LegoRaceCar::ParseAction(char* p_extra)
// FUNCTION: LEGO1 0x10012ff0
// FUNCTION: BETA10 0x100cb60e
void LegoRaceCar::FUN_10012ff0(float p_param)
void LegoRaceCar::KickCamera(float p_param)
{
LegoAnimActorStruct* a; // called `a` in BETA10
float deltaTime;
@@ -312,7 +312,7 @@ void LegoRaceCar::FUN_10012ff0(float p_param)
assert(a && a->GetAnimTreePtr() && a->GetAnimTreePtr()->GetCamAnim());
if (a->GetAnimTreePtr()) {
deltaTime = p_param - m_unk0x58;
deltaTime = p_param - m_kickStart;
if (a->GetDuration() <= deltaTime || deltaTime < 0.0) {
if (m_userState == LEGORACECAR_KICK1) {
@@ -387,7 +387,7 @@ MxU32 LegoRaceCar::HandleSkeletonKicks(float p_param1)
return FALSE;
}
m_unk0x58 = p_param1;
m_kickStart = p_param1;
SoundManager()->GetCacheSoundManager()->Play(g_soundSkel3, NULL, FALSE);
return TRUE;
@@ -398,7 +398,7 @@ MxU32 LegoRaceCar::HandleSkeletonKicks(float p_param1)
void LegoRaceCar::Animate(float p_time)
{
if (m_userNavFlag && (m_userState == LEGORACECAR_KICK1 || m_userState == LEGORACECAR_KICK2)) {
FUN_10012ff0(p_time);
KickCamera(p_time);
return;
}
@@ -410,7 +410,7 @@ void LegoRaceCar::Animate(float p_time)
}
}
if (LegoCarRaceActor::m_unk0x0c == 1) {
if (LegoCarRaceActor::m_animState == 1) {
FUN_1005d4b0();
if (!m_userNavFlag) {
@@ -468,7 +468,7 @@ MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool)
assert(roi);
matr = roi->GetLocal2World();
Vector3(matr[3]) += g_unk0x10102af0;
Vector3(matr[3]) += g_hitOffset;
roi->SetLocal2World(matr);
p_actor->SetActorState(c_two);
@@ -513,7 +513,7 @@ MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool)
if (soundKey) {
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)
{
if (!m_userNavFlag) {
if (!LegoCarRaceActor::m_unk0x0c) {
if (!LegoCarRaceActor::m_animState) {
m_maxLinearVel = p_worldSpeed;
}
LegoAnimActor::SetWorldSpeed(p_worldSpeed);
@@ -594,7 +594,7 @@ void LegoJetski::SetWorldSpeed(MxFloat p_worldSpeed)
void LegoJetski::FUN_100136f0(float p_worldSpeed)
{
if (p_worldSpeed < 0) {
LegoCarRaceActor::m_unk0x0c = 2;
LegoCarRaceActor::m_animState = 2;
m_maxLinearVel = 0;
SetWorldSpeed(0);
}
@@ -609,7 +609,7 @@ void LegoJetski::Animate(float p_time)
{
LegoJetskiRaceActor::Animate(p_time);
if (LegoCarRaceActor::m_unk0x0c == 1) {
if (LegoCarRaceActor::m_animState == 1) {
FUN_1005d4b0();
if (!m_userNavFlag) {
@@ -682,7 +682,7 @@ MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool)
LegoROI* roi = p_actor->GetROI();
matr = roi->GetLocal2World();
Vector3(matr[3]) += g_unk0x10102af0;
Vector3(matr[3]) += g_hitOffset;
roi->SetLocal2World(matr);
p_actor->SetActorState(c_two);
@@ -711,7 +711,7 @@ MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool)
if (soundKey) {
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_unk0x70 = 0.0f;
m_unk0x0c = 0;
m_animState = 0;
m_maxLinearVel = 0.0f;
m_frequencyFactor = 1.0f;
m_unk0x1c = 0;
@@ -223,18 +223,18 @@ void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOriente
// FUNCTION: BETA10 0x100cdbae
void LegoCarRaceActor::Animate(float p_time)
{
// m_unk0x0c is not an MxBool, there are places where it is set to 2 or higher
if (m_unk0x0c == 0) {
// m_animState is not an MxBool, there are places where it is set to 2 or higher
if (m_animState == 0) {
const char* value = VariableTable()->GetVariable(g_raceState);
if (strcmpi(value, g_racing) == 0) {
m_unk0x0c = 1;
m_animState = 1;
m_lastTime = p_time - 1.0f;
m_unk0x1c = p_time;
}
}
if (m_unk0x0c == 1) {
if (m_animState == 1) {
LegoAnimActor::Animate(p_time);
}
}
@@ -398,10 +398,10 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
// FUNCTION: LEGO1 0x10081550
void LegoJetskiRaceActor::Animate(float p_time)
{
if (m_unk0x0c == 0) {
if (m_animState == 0) {
const LegoChar* raceState = VariableTable()->GetVariable(g_raceState);
if (!stricmp(raceState, g_racing)) {
m_unk0x0c = 1;
m_animState = 1;
m_lastTime = p_time - 1.0f;
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);
}
}