From 16ccb0e06eb283c7f0313ae4208f65477a8767ba Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Sun, 15 Jun 2025 19:31:19 +0200 Subject: [PATCH 1/4] Name locations after exiting buildings/vehicles (#1564) * Hospital * Infocenter * Garage * Police * Jetski Build * Racecar Build * Any vehicle --- LEGO1/lego/legoomni/include/legogamestate.h | 14 +++++------ LEGO1/lego/legoomni/src/actors/ambulance.cpp | 8 +++---- LEGO1/lego/legoomni/src/actors/bike.cpp | 2 +- LEGO1/lego/legoomni/src/actors/dunebuggy.cpp | 2 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 2 +- .../legoomni/src/actors/islepathactor.cpp | 14 +++++------ LEGO1/lego/legoomni/src/actors/jetski.cpp | 2 +- LEGO1/lego/legoomni/src/actors/motorcycle.cpp | 2 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 2 +- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 6 ++--- .../lego/legoomni/src/build/legocarbuild.cpp | 4 ++-- .../legoomni/src/common/legogamestate.cpp | 14 +++++------ LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 6 ++--- .../legoomni/src/worlds/infocenterdoor.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 24 +++++++++---------- 16 files changed, 53 insertions(+), 53 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index b6a236b9..1eec40a6 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -67,7 +67,7 @@ class LegoGameState { e_isle, e_infomain, e_infodoor, - e_unk4, + e_infocenterExited, e_elevbott, e_elevride, e_elevride2, @@ -80,10 +80,10 @@ class LegoGameState { e_jetrace, e_jetrace2, e_jetraceExterior, - e_unk17, + e_jetskibuildExited, e_carrace, e_carraceExterior, - e_unk20, + e_racecarbuildExited, e_unk21, e_pizzeriaExterior, e_unk23, @@ -91,12 +91,12 @@ class LegoGameState { e_garageExterior, e_garage, e_garadoor, - e_unk28, + e_garageExited, e_hospitalExterior, e_hospital, - e_unk31, + e_hospitalExited, e_policeExterior, - e_unk33, + e_policeExited, e_police, e_polidoor, e_copterbuild, @@ -129,7 +129,7 @@ class LegoGameState { e_towtrack, e_jetski, - e_unk66 = 66 + e_vehicleExited = 66 }; // SIZE 0x0e diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index eb1b7c8c..22c1e701 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -221,7 +221,7 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param) else if (objectId == IsleScript::c_hps117bd_RunAnim) { CurrentWorld()->PlaceActor(UserActor()); HandleClick(); - SpawnPlayer(LegoGameState::e_unk33, TRUE, 0); + SpawnPlayer(LegoGameState::e_policeExited, TRUE, 0); m_unk0x172 = 0; TickleManager()->RegisterClient(this, 40000); @@ -388,7 +388,7 @@ MxLong Ambulance::HandleClick() ControlManager()->Register(this); if (m_state->m_unk0x08 == 1) { - SpawnPlayer(LegoGameState::e_unk31, TRUE, 0); + SpawnPlayer(LegoGameState::e_hospitalExited, TRUE, 0); m_state->m_startTime = Timer()->GetTime(); InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_pns018rd_RunAnim, NULL); } @@ -441,14 +441,14 @@ MxLong Ambulance::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case IsleScript::c_AmbulanceArms_Ctl: Exit(); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; result = 1; break; case IsleScript::c_AmbulanceInfo_Ctl: ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); Exit(); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; result = 1; break; case IsleScript::c_AmbulanceHorn_Ctl: diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 1bb67774..0d480ad0 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -85,7 +85,7 @@ MxLong Bike::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case IsleScript::c_BikeArms_Ctl: Exit(); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; result = 1; break; case IsleScript::c_BikeInfo_Ctl: diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index 778a65a8..e475b6a6 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -125,7 +125,7 @@ MxLong DuneBuggy::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case IsleScript::c_DuneCarArms_Ctl: Exit(); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; result = 1; break; case IsleScript::c_DuneCarInfo_Ctl: diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 1f695e08..bf9eb9d0 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -203,7 +203,7 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) } Exit(); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; result = 1; break; case IsleScript::c_Helicopter_TakeOff_Ctl: { diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 1055d58d..fbd57206 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -148,7 +148,7 @@ void IslePathActor::Exit() } m_previousActor->SetActorState(c_initial); - GameState()->m_currentArea = LegoGameState::Area::e_unk66; + GameState()->m_currentArea = LegoGameState::Area::e_vehicleExited; } FUN_1001b660(); @@ -199,7 +199,7 @@ void IslePathActor::RegisterSpawnLocations() JukeboxScript::c_Quiet_Audio ); g_spawnLocations[3] = SpawnLocation( - LegoGameState::e_unk4, + LegoGameState::e_infocenterExited, g_isleScript, 0, "int46", @@ -223,7 +223,7 @@ void IslePathActor::RegisterSpawnLocations() JukeboxScript::c_Beach_Music ); g_spawnLocations[5] = SpawnLocation( - LegoGameState::e_unk17, + LegoGameState::e_jetskibuildExited, g_isleScript, 0, "EDG00_46", @@ -259,7 +259,7 @@ void IslePathActor::RegisterSpawnLocations() JukeboxScript::c_CentralNorthRoad_Music ); g_spawnLocations[8] = SpawnLocation( - LegoGameState::e_unk20, + LegoGameState::e_racecarbuildExited, g_isleScript, 0, "INT16", @@ -295,7 +295,7 @@ void IslePathActor::RegisterSpawnLocations() JukeboxScript::c_GarageArea_Music ); g_spawnLocations[11] = SpawnLocation( - LegoGameState::e_unk28, + LegoGameState::e_garageExited, g_isleScript, 0, "INT24", @@ -319,7 +319,7 @@ void IslePathActor::RegisterSpawnLocations() JukeboxScript::c_Hospital_Music ); g_spawnLocations[13] = SpawnLocation( - LegoGameState::e_unk31, + LegoGameState::e_hospitalExited, g_isleScript, 0, "EDG02_28", @@ -343,7 +343,7 @@ void IslePathActor::RegisterSpawnLocations() JukeboxScript::c_PoliceStation_Music ); g_spawnLocations[15] = SpawnLocation( - LegoGameState::e_unk33, + LegoGameState::e_policeExited, g_isleScript, 0, "EDG02_64", diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index bf183014..3e049920 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -143,7 +143,7 @@ MxLong Jetski::HandleControl(LegoControlManagerNotificationParam& p_param) Exit(); ((IslePathActor*) UserActor()) ->SpawnPlayer(LegoGameState::e_jetraceExterior, TRUE, c_spawnBit1 | c_playMusic | c_spawnBit3); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; return 1; case IsleScript::c_JetskiInfo_Ctl: ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain); diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index 877ebf21..1ada7611 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -119,7 +119,7 @@ MxLong Motocycle::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case IsleScript::c_MotoBikeArms_Ctl: Exit(); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; result = 1; break; case IsleScript::c_MotoBikeInfo_Ctl: diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 5aafe1be..18d2810d 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -112,7 +112,7 @@ MxLong SkateBoard::HandleControl(LegoControlManagerNotificationParam& p_param) if (p_param.m_unk0x28 == 1 && p_param.m_clickedObjectId == IsleScript::c_SkateArms_Ctl) { Exit(); - GameState()->m_currentArea = LegoGameState::Area::e_unk66; + GameState()->m_currentArea = LegoGameState::Area::e_vehicleExited; result = 1; } diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 5ff5697e..7d8a8975 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -435,7 +435,7 @@ MxLong TowTrack::HandleClick() FindROI("rcred")->SetVisibility(FALSE); } else { - SpawnPlayer(LegoGameState::e_unk28, TRUE, 0); + SpawnPlayer(LegoGameState::e_garageExited, TRUE, 0); m_lastAction = IsleScript::c_noneIsle; m_lastAnimation = IsleScript::c_noneIsle; m_state->m_startTime = Timer()->GetTime(); @@ -486,14 +486,14 @@ MxLong TowTrack::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case IsleScript::c_TowTrackArms_Ctl: Exit(); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; result = 1; break; case IsleScript::c_TowInfo_Ctl: ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); Exit(); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; result = 1; break; case IsleScript::c_TowHorn_Ctl: diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index c56914dc..6876d199 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -784,11 +784,11 @@ void LegoCarBuild::FUN_100243a0() TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE); break; case Jetski_Actor: - m_destLocation = LegoGameState::Area::e_unk17; + m_destLocation = LegoGameState::Area::e_jetskibuildExited; TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE); break; case RaceCar_Actor: - m_destLocation = LegoGameState::Area::e_unk20; + m_destLocation = LegoGameState::Area::e_racecarbuildExited; TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE); } } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 6425d1f7..99648947 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -868,17 +868,17 @@ void LegoGameState::SwitchArea(Area p_area) VideoManager()->SetUnk0x554(TRUE); InvokeAction(Extra::ActionType::e_opendisk, *g_infodoorScript, InfodoorScript::c__StartUp, NULL); break; - case e_unk4: + case e_infocenterExited: case e_jetrace2: case e_jetraceExterior: - case e_unk17: + case e_jetskibuildExited: case e_carraceExterior: - case e_unk20: + case e_racecarbuildExited: case e_unk21: case e_pizzeriaExterior: case e_garageExterior: case e_hospitalExterior: - case e_unk31: + case e_hospitalExited: case e_policeExterior: case e_bike: case e_dunecar: @@ -886,7 +886,7 @@ void LegoGameState::SwitchArea(Area p_area) case e_copter: case e_skateboard: case e_jetski: - case e_unk66: + case e_vehicleExited: LoadIsle(); break; case e_elevbott: @@ -948,7 +948,7 @@ void LegoGameState::SwitchArea(Area p_area) VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f); InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_GaraDoor, NULL); break; - case e_unk28: { + case e_garageExited: { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); LoadIsle(); @@ -973,7 +973,7 @@ void LegoGameState::SwitchArea(Area p_area) VideoManager()->SetUnk0x554(TRUE); InvokeAction(Extra::ActionType::e_opendisk, *g_hospitalScript, HospitalScript::c__StartUp, NULL); break; - case e_unk33: + case e_policeExited: LoadIsle(); SetCameraControllerFromIsle(); UserActor()->ResetWorldTransform(TRUE); diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index a084bffd..024683b3 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -329,7 +329,7 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) case GasStationState::e_afterAcceptingQuest: m_state->m_state = GasStationState::e_beforeExitingForQuest; ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 7; - m_destLocation = LegoGameState::e_unk28; + m_destLocation = LegoGameState::e_garageExited; m_radio.Stop(); BackgroundAudioManager()->Stop(); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index e37a3c77..4aa4b5a8 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -369,7 +369,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) case HospitalState::e_exitToFront: if (m_unk0x128 == 0) { m_unk0x128 = 1; - m_destLocation = LegoGameState::e_unk31; + m_destLocation = LegoGameState::e_hospitalExited; DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); @@ -421,7 +421,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param) act1State->m_unk0x018 = 9; - m_destLocation = LegoGameState::e_unk31; + m_destLocation = LegoGameState::e_hospitalExited; DeleteObjects( &m_atomId, HospitalScript::c_hho002cl_RunAnim, @@ -590,7 +590,7 @@ MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param) else if (m_unk0x128 == 0) { m_unk0x128 = 1; m_hospitalState->m_state = HospitalState::e_exitImmediately; - m_destLocation = LegoGameState::e_unk31; + m_destLocation = LegoGameState::e_hospitalExited; DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index 9931523f..c546744a 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -119,7 +119,7 @@ MxLong InfocenterDoor::HandleControl(LegoControlManagerNotificationParam& p_para if (GameState()->GetActorId() != LegoActor::c_none) { InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); if (state->HasRegistered()) { - m_destLocation = LegoGameState::e_unk4; + m_destLocation = LegoGameState::e_infocenterExited; } else { MxDSAction action; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 9d3eb8e7..1aa352fe 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -430,7 +430,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case IsleScript::c_PoliDoor_Door_Ctl: - m_destLocation = LegoGameState::e_unk33; + m_destLocation = LegoGameState::e_policeExited; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case IsleScript::c_GaraDoor_LeftArrow_Ctl: @@ -440,7 +440,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case IsleScript::c_GaraDoor_Door_Ctl: - m_destLocation = LegoGameState::e_unk28; + m_destLocation = LegoGameState::e_garageExited; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; } @@ -712,7 +712,7 @@ void Isle::Enable(MxBool p_enable) if (GameState()->m_currentArea == LegoGameState::e_pizzeriaExterior) { AnimationManager()->FUN_10064740(NULL); } - else if (GameState()->m_currentArea == LegoGameState::e_unk66) { + else if (GameState()->m_currentArea == LegoGameState::e_vehicleExited) { Mx3DPointFloat position(UserActor()->GetROI()->GetWorldPosition()); Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f); @@ -820,7 +820,7 @@ void Isle::Enable(MxBool p_enable) TRUE, IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 ); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; EnableAnimations(TRUE); m_jukebox->StartAction(); break; @@ -863,21 +863,21 @@ void Isle::FUN_10032620() VideoManager()->Get3DManager()->SetFrustrum(90.0, 0.1, 250.0); switch (GameState()->m_currentArea) { - case LegoGameState::e_unk66: { + case LegoGameState::e_vehicleExited: { MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); LegoPathBoundary* boundary = UserActor()->GetBoundary(); ((IslePathActor*) UserActor())->VTable0xec(mat, boundary, TRUE); break; } - case LegoGameState::e_unk4: + case LegoGameState::e_infocenterExited: case LegoGameState::e_jetraceExterior: - case LegoGameState::e_unk17: + case LegoGameState::e_jetskibuildExited: case LegoGameState::e_carraceExterior: - case LegoGameState::e_unk20: + case LegoGameState::e_racecarbuildExited: case LegoGameState::e_pizzeriaExterior: case LegoGameState::e_garageExterior: case LegoGameState::e_hospitalExterior: - case LegoGameState::e_unk31: + case LegoGameState::e_hospitalExited: case LegoGameState::e_policeExterior: ((IslePathActor*) UserActor()) ->SpawnPlayer( @@ -885,7 +885,7 @@ void Isle::FUN_10032620() TRUE, IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 ); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; break; } } @@ -955,7 +955,7 @@ MxLong Isle::HandleTransitionEnd() VariableTable()->SetVariable("VISIBILITY", "Hide Gas"); FUN_10032d30(IsleScript::c_GaraDoor_Background_Bitmap, JukeboxScript::c_JBMusic2, "LCAMZG1,90", FALSE); break; - case LegoGameState::e_unk28: + case LegoGameState::e_garageExited: GameState()->SwitchArea(m_destLocation); GameState()->StopArea(LegoGameState::e_previousArea); m_destLocation = LegoGameState::e_undefined; @@ -965,7 +965,7 @@ MxLong Isle::HandleTransitionEnd() SetAppCursor(e_cursorArrow); SetIsWorldActive(TRUE); break; - case LegoGameState::e_unk33: + case LegoGameState::e_policeExited: GameState()->SwitchArea(m_destLocation); GameState()->StopArea(LegoGameState::e_previousArea); m_destLocation = LegoGameState::e_undefined; From fd3f08f4c4be3baff037113d9325c78740157519 Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Mon, 16 Jun 2025 23:08:17 +0200 Subject: [PATCH 2/4] Clear unknowns in `LegoBuildingInfo` and `LegoBuildingManager` (#1566) * Clear unknowns in `LegoBuildingInfo` and `LegoBuildingManager` * Name remaining unknown in `LegoBuildingManager` --- .../legoomni/include/legobuildingmanager.h | 38 +++--- LEGO1/lego/legoomni/src/actors/act2actor.cpp | 28 ++-- LEGO1/lego/legoomni/src/actors/act3actors.cpp | 6 +- .../src/common/legobuildingmanager.cpp | 129 +++++++++--------- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/act3.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 2 +- 7 files changed, 107 insertions(+), 102 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index bac64396..3d251c98 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -26,10 +26,10 @@ struct LegoBuildingInfo { MxU32 m_sound; // 0x08 MxU32 m_move; // 0x0c MxU8 m_mood; // 0x10 - MxS8 m_unk0x11; // 0x11 - MxS8 m_initialUnk0x11; // 0x12 - initial value loaded to m_unk0x11 + MxS8 m_counter; // 0x11 + MxS8 m_initialCounter; // 0x12 - initial value loaded to m_counter MxU8 m_flags; // 0x13 - float m_unk0x14; // 0x14 + float m_adjustedY; // 0x14 const char* m_boundaryName; // 0x18 float m_x; // 0x1c float m_y; // 0x20 @@ -46,7 +46,7 @@ class LegoBuildingManager : public MxCore { LegoEntity* m_entity; // 0x00 LegoROI* m_roi; // 0x04 MxLong m_time; // 0x08 - float m_unk0x0c; // 0x0c + float m_y; // 0x0c MxBool m_muted; // 0x10 }; @@ -79,16 +79,16 @@ class LegoBuildingManager : public MxCore { MxBool SwitchMood(LegoEntity* p_entity); MxU32 GetAnimationId(LegoEntity* p_entity); MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state); - MxBool FUN_10030000(LegoEntity* p_entity); - MxBool FUN_10030030(MxS32 p_index); - MxBool FUN_10030110(LegoBuildingInfo* p_data); - void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28); - void FUN_10030590(); + MxBool DecrementCounter(LegoEntity* p_entity); + MxBool DecrementCounter(MxS32 p_index); + MxBool DecrementCounter(LegoBuildingInfo* p_data); + void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_hideAfterAnimation); + void ClearCounters(); void AdjustHeight(MxS32 p_index); - MxResult FUN_10030630(); + MxResult DetermineBoundaries(); LegoBuildingInfo* GetInfoArray(MxS32& p_length); - void FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust); - void FUN_10030800(); + void AdjustCounter(LegoEntity* p_entity, MxS32 p_adjust); + void SetInitialCounters(); static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } @@ -100,13 +100,13 @@ class LegoBuildingManager : public MxCore { static MxS32 g_maxMove[16]; static MxU32 g_maxSound; - MxU8 m_nextVariant; // 0x08 - MxBool m_unk0x09; // 0x09 - AnimEntry* m_entries[5]; // 0x0c - MxS8 m_numEntries; // 0x20 - LegoCacheSound* m_sound; // 0x24 - MxBool m_unk0x28; // 0x28 - LegoWorld* m_world; // 0x2c + MxU8 m_nextVariant; // 0x08 + MxBool m_boundariesDetermined; // 0x09 + AnimEntry* m_entries[5]; // 0x0c + MxS8 m_numEntries; // 0x20 + LegoCacheSound* m_sound; // 0x24 + MxBool m_hideAfterAnimation; // 0x28 + LegoWorld* m_world; // 0x2c }; #endif // LEGOBUILDINGMANAGER_H diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index 91e6cc29..bf531641 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -718,11 +718,11 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) switch (m_unk0x1d) { case 0: - if (buildingInfo[12].m_unk0x11) { + if (buildingInfo[12].m_counter) { result = buildingInfo[12].m_entity; *p_param = TRUE; } - else if (buildingInfo[14].m_unk0x11) { + else if (buildingInfo[14].m_counter) { result = buildingInfo[14].m_entity; *p_param = TRUE; } @@ -736,7 +736,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } break; case 1: - if (buildingInfo[13].m_unk0x11) { + if (buildingInfo[13].m_counter) { result = buildingInfo[13].m_entity; *p_param = TRUE; } @@ -750,11 +750,11 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } break; case 2: - if (buildingInfo[9].m_unk0x11) { + if (buildingInfo[9].m_counter) { result = buildingInfo[9].m_entity; *p_param = TRUE; } - else if (buildingInfo[11].m_unk0x11) { + else if (buildingInfo[11].m_counter) { result = buildingInfo[11].m_entity; *p_param = TRUE; } @@ -768,15 +768,15 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } break; case 3: - if (buildingInfo[7].m_unk0x11) { + if (buildingInfo[7].m_counter) { result = buildingInfo[7].m_entity; *p_param = TRUE; } - else if (buildingInfo[8].m_unk0x11) { + else if (buildingInfo[8].m_counter) { result = buildingInfo[8].m_entity; *p_param = TRUE; } - else if (buildingInfo[3].m_unk0x11) { + else if (buildingInfo[3].m_counter) { result = buildingInfo[3].m_entity; *p_param = TRUE; } @@ -790,11 +790,11 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } break; case 4: - if (buildingInfo[5].m_unk0x11) { + if (buildingInfo[5].m_counter) { result = buildingInfo[5].m_entity; *p_param = TRUE; } - else if (buildingInfo[10].m_unk0x11) { + else if (buildingInfo[10].m_counter) { result = buildingInfo[10].m_entity; *p_param = TRUE; } @@ -808,7 +808,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } break; case 5: - if (buildingInfo[4].m_unk0x11) { + if (buildingInfo[4].m_counter) { result = buildingInfo[4].m_entity; *p_param = TRUE; } @@ -822,7 +822,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } break; case 6: - if (buildingInfo[2].m_unk0x11) { + if (buildingInfo[2].m_counter) { result = buildingInfo[2].m_entity; *p_param = TRUE; } @@ -836,7 +836,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) } break; case 7: - if (buildingInfo[6].m_unk0x11) { + if (buildingInfo[6].m_counter) { result = buildingInfo[6].m_entity; *p_param = TRUE; } @@ -861,7 +861,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) return result; } - if (buildingInfo[15].m_unk0x11) { + if (buildingInfo[15].m_counter) { result = buildingInfo[15].m_entity; *p_param = TRUE; } diff --git a/LEGO1/lego/legoomni/src/actors/act3actors.cpp b/LEGO1/lego/legoomni/src/actors/act3actors.cpp index b4836be1..1bd13278 100644 --- a/LEGO1/lego/legoomni/src/actors/act3actors.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3actors.cpp @@ -653,8 +653,8 @@ void Act3Brickster::Animate(float p_time) assert(SoundManager()->GetCacheSoundManager()); SoundManager()->GetCacheSoundManager()->Play("thpt", NULL, FALSE); - while (m_bInfo->m_unk0x11 > 0 || m_bInfo->m_unk0x11 == -1) { - if (!BuildingManager()->FUN_10030110(m_bInfo)) { + while (m_bInfo->m_counter > 0 || m_bInfo->m_counter == -1) { + if (!BuildingManager()->DecrementCounter(m_bInfo)) { break; } } @@ -865,7 +865,7 @@ MxResult Act3Brickster::FUN_100417c0() float local124; for (MxS32 i = 0; i < length; i++) { - if (bInfo[i].m_unk0x11 < 0 && bInfo[i].m_boundary != NULL && bInfo[i].m_entity != NULL && i != 0 && + if (bInfo[i].m_counter < 0 && bInfo[i].m_boundary != NULL && bInfo[i].m_entity != NULL && i != 0 && (local120 == -1 || i != 15)) { Mx3DPointFloat local188(bInfo[i].m_x, bInfo[i].m_y, bInfo[i].m_z); diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index c13c22ae..d46b8a49 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -253,10 +253,10 @@ void LegoBuildingManager::Init() } m_nextVariant = 0; - m_unk0x09 = FALSE; + m_boundariesDetermined = FALSE; m_numEntries = 0; m_sound = NULL; - m_unk0x28 = FALSE; + m_hideAfterAnimation = FALSE; } // FUNCTION: LEGO1 0x1002fa00 @@ -274,7 +274,7 @@ void LegoBuildingManager::LoadWorldInfo() LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[0]); if (entity) { entity->GetROI()->SetVisibility(TRUE); - m_unk0x09 = FALSE; + m_boundariesDetermined = FALSE; } } else { @@ -286,7 +286,7 @@ void LegoBuildingManager::LoadWorldInfo() } } - m_unk0x09 = FALSE; + m_boundariesDetermined = FALSE; } // FUNCTION: LEGO1 0x1002fa90 @@ -301,7 +301,7 @@ void LegoBuildingManager::CreateBuilding(MxS32 p_index, LegoWorld* p_world) LegoROI* roi = entity->GetROI(); AdjustHeight(p_index); MxMatrix mat = roi->GetLocal2World(); - mat[3][1] = g_buildingInfo[p_index].m_unk0x14; + mat[3][1] = g_buildingInfo[p_index].m_adjustedY; roi->UpdateTransformationRelativeToParent(mat); VideoManager()->Get3DManager()->Moved(*roi); } @@ -316,7 +316,7 @@ void LegoBuildingManager::Reset() g_buildingInfo[i].m_entity = NULL; } - m_unk0x09 = FALSE; + m_boundariesDetermined = FALSE; for (i = 0; i < m_numEntries; i++) { delete m_entries[i]; @@ -343,7 +343,7 @@ MxResult LegoBuildingManager::Write(LegoStorage* p_storage) if (p_storage->Write(&info->m_mood, sizeof(MxU8)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_initialUnk0x11, sizeof(MxS8)) != SUCCESS) { + if (p_storage->Write(&info->m_initialCounter, sizeof(MxS8)) != SUCCESS) { goto done; } } @@ -376,11 +376,11 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage) if (p_storage->Read(&info->m_mood, sizeof(MxU8)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_unk0x11, sizeof(MxS8)) != SUCCESS) { + if (p_storage->Read(&info->m_counter, sizeof(MxS8)) != SUCCESS) { goto done; } - info->m_initialUnk0x11 = info->m_unk0x11; + info->m_initialCounter = info->m_counter; AdjustHeight(i); } @@ -402,15 +402,15 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage) // FUNCTION: BETA10 0x10063f1a void LegoBuildingManager::AdjustHeight(MxS32 p_index) { - if (g_buildingInfo[p_index].m_unk0x11 > 0) { - float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; - g_buildingInfo[p_index].m_unk0x14 = - g_buildingInfoInit[p_index].m_unk0x14 - value * g_buildingInfoDownshiftScale[p_index]; + if (g_buildingInfo[p_index].m_counter > 0) { + float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_counter; + g_buildingInfo[p_index].m_adjustedY = + g_buildingInfoInit[p_index].m_adjustedY - value * g_buildingInfoDownshiftScale[p_index]; } - else if (g_buildingInfo[p_index].m_unk0x11 == 0) { - float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; - g_buildingInfo[p_index].m_unk0x14 = - g_buildingInfoInit[p_index].m_unk0x14 - value * g_buildingInfoDownshiftScale[p_index]; + else if (g_buildingInfo[p_index].m_counter == 0) { + float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_counter; + g_buildingInfo[p_index].m_adjustedY = + g_buildingInfoInit[p_index].m_adjustedY - value * g_buildingInfoDownshiftScale[p_index]; if (g_buildingInfo[p_index].m_entity != NULL) { LegoROI* roi = g_buildingInfo[p_index].m_entity->GetROI(); @@ -420,7 +420,7 @@ void LegoBuildingManager::AdjustHeight(MxS32 p_index) } } else { - g_buildingInfo[p_index].m_unk0x14 = g_buildingInfoInit[p_index].m_unk0x14; + g_buildingInfo[p_index].m_adjustedY = g_buildingInfoInit[p_index].m_adjustedY; } } @@ -453,7 +453,7 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity) LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_unk0x11 == -1) { + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_counter == -1) { LegoROI* roi = p_entity->GetROI(); if (++m_nextVariant >= sizeOfArray(g_buildingInfoVariants)) { m_nextVariant = 0; @@ -587,7 +587,7 @@ void LegoBuildingManager::SetCustomizeAnimFile(const char* p_value) } // FUNCTION: LEGO1 0x10030000 -MxBool LegoBuildingManager::FUN_10030000(LegoEntity* p_entity) +MxBool LegoBuildingManager::DecrementCounter(LegoEntity* p_entity) { LegoBuildingInfo* info = GetInfo(p_entity); @@ -595,7 +595,7 @@ MxBool LegoBuildingManager::FUN_10030000(LegoEntity* p_entity) return FALSE; } - return FUN_10030030(info - g_buildingInfo); + return DecrementCounter(info - g_buildingInfo); } inline LegoBuildingInfo* GetBuildingInfo(MxS32 p_index) @@ -608,7 +608,7 @@ inline LegoBuildingInfo* GetBuildingInfo(MxS32 p_index) } // FUNCTION: LEGO1 0x10030030 -MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index) +MxBool LegoBuildingManager::DecrementCounter(MxS32 p_index) { if (p_index >= sizeOfArray(g_buildingInfo)) { return FALSE; @@ -621,25 +621,25 @@ MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index) MxBool result = TRUE; - if (info->m_unk0x11 < 0) { - info->m_unk0x11 = g_buildingInfoDownshift[p_index]; + if (info->m_counter < 0) { + info->m_counter = g_buildingInfoDownshift[p_index]; } - if (info->m_unk0x11 <= 0) { + if (info->m_counter <= 0) { result = FALSE; } else { LegoROI* roi = info->m_entity->GetROI(); - info->m_unk0x11 -= 2; - if (info->m_unk0x11 == 1) { - info->m_unk0x11 = 0; + info->m_counter -= 2; + if (info->m_counter == 1) { + info->m_counter = 0; roi->SetVisibility(FALSE); } else { AdjustHeight(p_index); MxMatrix mat = roi->GetLocal2World(); - mat[3][1] = g_buildingInfo[p_index].m_unk0x14; + mat[3][1] = g_buildingInfo[p_index].m_adjustedY; roi->UpdateTransformationRelativeToParent(mat); VideoManager()->Get3DManager()->Moved(*roi); } @@ -649,11 +649,11 @@ MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index) } // FUNCTION: LEGO1 0x10030110 -MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data) +MxBool LegoBuildingManager::DecrementCounter(LegoBuildingInfo* p_data) { for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { if (&g_buildingInfo[i] == p_data) { - return FUN_10030030(i); + return DecrementCounter(i); } } @@ -661,7 +661,12 @@ MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data) } // FUNCTION: LEGO1 0x10030150 -void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28) +void LegoBuildingManager::ScheduleAnimation( + LegoEntity* p_entity, + MxLong p_length, + MxBool p_haveSound, + MxBool p_hideAfterAnimation +) { m_world = CurrentWorld(); @@ -671,7 +676,7 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_lengt } if (m_numEntries == 0) { - m_unk0x28 = p_unk0x28; + m_hideAfterAnimation = p_hideAfterAnimation; TickleManager()->RegisterClient(this, 50); } @@ -685,9 +690,9 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_lengt time += p_length; entry->m_time = time + 1000; - entry->m_unk0x0c = entry->m_roi->GetWorldPosition()[1]; + entry->m_y = entry->m_roi->GetWorldPosition()[1]; entry->m_muted = p_haveSound == FALSE; - FUN_100307b0(p_entity, -2); + AdjustCounter(p_entity, -2); } // FUNCTION: LEGO1 0x10030220 @@ -724,33 +729,33 @@ MxResult LegoBuildingManager::Tickle() MxMatrix local48; MxMatrix locald8; - MxMatrix local120(entry->m_roi->GetLocal2World()); - Mx3DPointFloat local134(local120[3]); + MxMatrix transformationMatrix(entry->m_roi->GetLocal2World()); + Mx3DPointFloat position(transformationMatrix[3]); - ZEROVEC3(local120[3]); + ZEROVEC3(transformationMatrix[3]); locald8.SetIdentity(); - local48 = local120; + local48 = transformationMatrix; - local134[1] = sin(((entry->m_time - time) * 10) * 0.0062831999f) * 0.4 + (entry->m_unk0x0c -= 0.05); - SET3(local120[3], local134); + position[1] = sin(((entry->m_time - time) * 10) * 0.0062831999f) * 0.4 + (entry->m_y -= 0.05); + SET3(transformationMatrix[3], position); - entry->m_roi->UpdateTransformationRelativeToParent(local120); + entry->m_roi->UpdateTransformationRelativeToParent(transformationMatrix); VideoManager()->Get3DManager()->Moved(*entry->m_roi); if (entry->m_time < time) { LegoBuildingInfo* info = GetInfo(entry->m_entity); - if (info->m_unk0x11 && !m_unk0x28) { + if (info->m_counter && !m_hideAfterAnimation) { MxS32 index = info - g_buildingInfo; AdjustHeight(index); MxMatrix mat = entry->m_roi->GetLocal2World(); - mat[3][1] = g_buildingInfo[index].m_unk0x14; + mat[3][1] = g_buildingInfo[index].m_adjustedY; entry->m_roi->UpdateTransformationRelativeToParent(mat); VideoManager()->Get3DManager()->Moved(*entry->m_roi); } else { - info->m_unk0x11 = 0; + info->m_counter = 0; entry->m_roi->SetVisibility(FALSE); } @@ -774,17 +779,17 @@ MxResult LegoBuildingManager::Tickle() // FUNCTION: LEGO1 0x10030590 // FUNCTION: BETA10 0x1006474c -void LegoBuildingManager::FUN_10030590() +void LegoBuildingManager::ClearCounters() { for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { - g_buildingInfo[i].m_unk0x11 = -1; - g_buildingInfo[i].m_initialUnk0x11 = -1; + g_buildingInfo[i].m_counter = -1; + g_buildingInfo[i].m_initialCounter = -1; AdjustHeight(i); if (g_buildingInfo[i].m_entity != NULL) { LegoROI* roi = g_buildingInfo[i].m_entity->GetROI(); MxMatrix mat = roi->GetLocal2World(); - mat[3][1] = g_buildingInfo[i].m_unk0x14; + mat[3][1] = g_buildingInfo[i].m_adjustedY; roi->UpdateTransformationRelativeToParent(mat); VideoManager()->Get3DManager()->Moved(*roi); } @@ -793,7 +798,7 @@ void LegoBuildingManager::FUN_10030590() // FUNCTION: LEGO1 0x10030630 // FUNCTION: BETA10 0x100648ab -MxResult LegoBuildingManager::FUN_10030630() +MxResult LegoBuildingManager::DetermineBoundaries() { LegoWorld* world = CurrentWorld(); @@ -859,7 +864,7 @@ MxResult LegoBuildingManager::FUN_10030630() } } - m_unk0x09 = TRUE; + m_boundariesDetermined = TRUE; return SUCCESS; } @@ -867,8 +872,8 @@ MxResult LegoBuildingManager::FUN_10030630() // FUNCTION: BETA10 0x10064db9 LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length) { - if (!m_unk0x09) { - FUN_10030630(); + if (!m_boundariesDetermined) { + DetermineBoundaries(); } p_length = sizeOfArray(g_buildingInfo); @@ -876,28 +881,28 @@ LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length) } // FUNCTION: LEGO1 0x100307b0 -void LegoBuildingManager::FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust) +void LegoBuildingManager::AdjustCounter(LegoEntity* p_entity, MxS32 p_adjust) { LegoBuildingInfo* info = GetInfo(p_entity); if (info != NULL) { - if (info->m_unk0x11 < 0) { - info->m_unk0x11 = g_buildingInfoDownshift[info - g_buildingInfo]; + if (info->m_counter < 0) { + info->m_counter = g_buildingInfoDownshift[info - g_buildingInfo]; } - if (info->m_unk0x11 > 0) { - info->m_unk0x11 += p_adjust; - if (info->m_unk0x11 <= 1 && p_adjust < 0) { - info->m_unk0x11 = 0; + if (info->m_counter > 0) { + info->m_counter += p_adjust; + if (info->m_counter <= 1 && p_adjust < 0) { + info->m_counter = 0; } } } } // FUNCTION: LEGO1 0x10030800 -void LegoBuildingManager::FUN_10030800() +void LegoBuildingManager::SetInitialCounters() { for (MxU32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { - g_buildingInfo[i].m_initialUnk0x11 = g_buildingInfo[i].m_unk0x11; + g_buildingInfo[i].m_initialCounter = g_buildingInfo[i].m_counter; } } diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 34192c72..467d65d8 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -503,7 +503,7 @@ MxLong LegoEntity::Notify(MxParam& p_param) PlantManager()->DecrementCounter(this); break; case e_building: - BuildingManager()->FUN_10030000(this); + BuildingManager()->DecrementCounter(this); break; case e_autoROI: break; diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index cc6b08e8..48aacd92 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -588,7 +588,7 @@ MxLong Act3::Notify(MxParam& p_param) m_unk0x421e = 0; while (--length >= 0) { - if (info[length].m_unk0x11 < 0 && info[length].m_boundary != NULL && + if (info[length].m_counter < 0 && info[length].m_boundary != NULL && info[length].m_entity != NULL) { m_unk0x421e++; } @@ -665,7 +665,7 @@ MxLong Act3::HandleTransitionEnd() void Act3::ReadyWorld() { PlantManager()->SetInitialCounters(); - BuildingManager()->FUN_10030800(); + BuildingManager()->SetInitialCounters(); AnimationManager()->FUN_1005f6d0(FALSE); VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 125.0f); diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 9daa9550..8a41663e 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -1386,7 +1386,7 @@ void Infocenter::Reset() } PlantManager()->ClearCounters(); - BuildingManager()->FUN_10030590(); + BuildingManager()->ClearCounters(); AnimationManager()->Reset(FALSE); CharacterManager()->ReleaseAllActors(); GameState()->SetCurrentAct(LegoGameState::e_act1); From 0b46acab542feb889130e87e6d8af75d668772d0 Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Tue, 17 Jun 2025 18:42:59 +0200 Subject: [PATCH 3/4] Name `m_unk0x21` as `GetUseAlias` in `LegoMesh` (#1567) --- LEGO1/lego/sources/roi/legolod.cpp | 4 ++-- LEGO1/lego/sources/shape/legomesh.cpp | 4 ++-- LEGO1/lego/sources/shape/legomesh.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/sources/roi/legolod.cpp b/LEGO1/lego/sources/roi/legolod.cpp index f4845dec..2291a3e7 100644 --- a/LEGO1/lego/sources/roi/legolod.cpp +++ b/LEGO1/lego/sources/roi/legolod.cpp @@ -211,7 +211,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text m_melems[meshIndex].m_tglMesh->SetShadingModel(shadingModel); if (textureName != NULL) { - if (mesh->GetUnknown0x21()) { + if (mesh->GetUseAlias()) { LegoROI::GetPaletteEntries(textureName, paletteEntries, sizeOfArray(paletteEntries)); } @@ -231,7 +231,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text LegoFloat blue = 1.0F; LegoFloat alpha = 0.0F; - if (mesh->GetUnknown0x21()) { + if (mesh->GetUseAlias()) { LegoROI::GetRGBAColor(materialName, red, green, blue, alpha); } else { diff --git a/LEGO1/lego/sources/shape/legomesh.cpp b/LEGO1/lego/sources/shape/legomesh.cpp index 537bbbe8..69dee797 100644 --- a/LEGO1/lego/sources/shape/legomesh.cpp +++ b/LEGO1/lego/sources/shape/legomesh.cpp @@ -15,7 +15,7 @@ LegoMesh::LegoMesh() m_unk0x0d = 0; m_unk0x10 = NULL; m_unk0x20 = 0; - m_unk0x21 = FALSE; + m_useAlias = FALSE; m_materialName = NULL; } @@ -55,7 +55,7 @@ LegoResult LegoMesh::Read(LegoStorage* p_storage) if ((result = p_storage->Read(&m_unk0x20, sizeof(undefined))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_unk0x21, sizeof(LegoU8))) != SUCCESS) { + if ((result = p_storage->Read(&m_useAlias, sizeof(LegoU8))) != SUCCESS) { return result; } diff --git a/LEGO1/lego/sources/shape/legomesh.h b/LEGO1/lego/sources/shape/legomesh.h index da1b1a27..3092d7e4 100644 --- a/LEGO1/lego/sources/shape/legomesh.h +++ b/LEGO1/lego/sources/shape/legomesh.h @@ -56,7 +56,7 @@ class LegoMesh { LegoU8 GetUnknown0x0d() { return m_unk0x0d; } const LegoChar* GetTextureName() { return m_textureName; } const LegoChar* GetMaterialName() { return m_materialName; } - LegoBool GetUnknown0x21() { return m_unk0x21; } + LegoBool GetUseAlias() { return m_useAlias; } LegoResult Read(LegoStorage* p_storage); // SYNTHETIC: LEGO1 0x100d3840 @@ -72,7 +72,7 @@ class LegoMesh { LegoChar* m_textureName; // 0x18 LegoChar* m_materialName; // 0x1c undefined m_unk0x20; // 0x20 - unused - LegoBool m_unk0x21; // 0x21 + LegoBool m_useAlias; // 0x21 }; #endif // __LEGOMESH_H From f48e9475526295da6da04d7091c3964ee6c0c80a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 17 Jun 2025 10:33:14 -0700 Subject: [PATCH 4/4] BETA only assertion in Act3Ammo::Create (#1568) --- LEGO1/lego/legoomni/src/actors/act3ammo.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp index 06330fb2..04e0e93c 100644 --- a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp @@ -70,7 +70,9 @@ MxResult Act3Ammo::Remove() // FUNCTION: BETA10 0x1001d8b3 MxResult Act3Ammo::Create(Act3* p_world, MxU32 p_isPizza, MxS32 p_index) { +#ifdef BETA10 assert(m_ammoFlag); +#endif char name[12]; if (p_isPizza) {