From 6a9f68872b0bc43d4f20298cdfaf1cc6b0aca9b9 Mon Sep 17 00:00:00 2001
From: Christian Semmler <mail@csemmler.com>
Date: Wed, 5 Jun 2024 12:11:46 -0400
Subject: [PATCH] Add enum for actor IDs (#993)

---
 LEGO1/lego/legoomni/include/legoactor.h       | 10 ++++++
 .../src/common/legoanimationmanager.cpp       |  8 ++---
 LEGO1/lego/legoomni/src/entity/legoentity.cpp | 12 +++----
 .../lego/legoomni/src/paths/legopathactor.cpp | 12 +++----
 LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 12 +++----
 LEGO1/lego/legoomni/src/worlds/hospital.cpp   | 34 +++++++++----------
 LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 12 +++----
 .../legoomni/src/worlds/infocenterdoor.cpp    |  2 +-
 LEGO1/lego/legoomni/src/worlds/isle.cpp       |  2 +-
 LEGO1/lego/legoomni/src/worlds/police.cpp     |  4 +--
 10 files changed, 59 insertions(+), 49 deletions(-)

diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h
index 026f5885..64f4aae3 100644
--- a/LEGO1/lego/legoomni/include/legoactor.h
+++ b/LEGO1/lego/legoomni/include/legoactor.h
@@ -10,6 +10,16 @@ class LegoCacheSound;
 // SIZE 0x78
 class LegoActor : public LegoEntity {
 public:
+	enum {
+		c_none = 0,
+		c_pepper,
+		c_mama,
+		c_papa,
+		c_nick,
+		c_laura,
+		c_brickster
+	};
+
 	LegoActor();
 	~LegoActor() override;
 
diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp
index f1915ef9..8b8b30fa 100644
--- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp
+++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp
@@ -1496,7 +1496,7 @@ MxResult LegoAnimationManager::Tickle()
 		MxU8 unk0x0c = 0;
 		MxU8 actorId = GameState()->GetActorId();
 
-		if (actorId <= 5) {
+		if (actorId <= LegoActor::c_laura) {
 			unk0x0c = g_unk0x100d8b28[actorId];
 		}
 
@@ -1762,7 +1762,7 @@ MxBool LegoAnimationManager::FUN_10062710(AnimInfo& p_info)
 	MxU8 und = 0;
 	MxU8 actorId = GameState()->GetActorId();
 
-	if (actorId <= 5) {
+	if (actorId <= LegoActor::c_laura) {
 		und = g_unk0x100d8b28[actorId];
 	}
 
@@ -2712,11 +2712,11 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position)
 	}
 
 	if (success) {
-		if (GameState()->GetActorId() != 2) {
+		if (GameState()->GetActorId() != LegoActor::c_mama) {
 			FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, rand() % 3 + 13, -1, rand() % 3, -1, 0.7f);
 		}
 
-		if (GameState()->GetActorId() != 3) {
+		if (GameState()->GetActorId() != LegoActor::c_papa) {
 			FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, rand() % 3 + 13, -1, rand() % 3, -1, 0.9f);
 		}
 
diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp
index de931cd2..cb426fac 100644
--- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp
+++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp
@@ -346,25 +346,25 @@ MxLong LegoEntity::Notify(MxParam& p_param)
 	}
 	else {
 		switch (GameState()->GetActorId()) {
-		case 1:
+		case LegoActor::c_pepper:
 			if (GameState()->GetCurrentAct() != LegoGameState::e_act2 &&
 				GameState()->GetCurrentAct() != LegoGameState::e_act3) {
 				VTable0x3c();
 			}
 			break;
-		case 2:
+		case LegoActor::c_mama:
 			VTable0x40();
 			break;
-		case 3:
+		case LegoActor::c_papa:
 			VTable0x44();
 			break;
-		case 4:
+		case LegoActor::c_nick:
 			VTable0x48(param.GetROI());
 			break;
-		case 5:
+		case LegoActor::c_laura:
 			VTable0x4c();
 			break;
-		case 6:
+		case LegoActor::c_brickster:
 			switch (m_type) {
 			case e_actor:
 			case e_unk1:
diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp
index 454f04fb..6990f1dd 100644
--- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp
+++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp
@@ -675,24 +675,24 @@ MxResult LegoPathActor::VTable0x9c()
 void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
 {
 	switch (GetActorId()) {
-	case 1:
+	case c_pepper:
 		p_und1 = TRUE;
 		p_und2 = 2;
 		break;
-	case 2:
+	case c_mama:
 		p_und1 = FALSE;
 		p_und2 = 1;
 		break;
-	case 3:
+	case c_papa:
 		p_und1 = TRUE;
 		p_und2 = 1;
 		break;
-	case 4:
-	case 6:
+	case c_nick:
+	case c_brickster:
 		p_und1 = TRUE;
 		p_und2 = rand() % p_und2 + 1;
 		break;
-	case 5:
+	case c_laura:
 		p_und1 = FALSE;
 		p_und2 = 2;
 		break;
diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp
index 82ef467b..10debbd7 100644
--- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp
+++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp
@@ -31,7 +31,7 @@ MxBool g_trackLedEnabled = FALSE;
 // FUNCTION: LEGO1 0x100046a0
 GasStation::GasStation()
 {
-	m_currentActorId = 0;
+	m_currentActorId = LegoActor::c_none;
 	m_state = NULL;
 	m_destLocation = LegoGameState::e_undefined;
 	m_trackLedBitmap = NULL;
@@ -134,7 +134,7 @@ void GasStation::ReadyWorld()
 	m_currentActorId = CurrentActor()->GetActorId();
 
 	switch (m_currentActorId) {
-	case 1:
+	case LegoActor::c_pepper:
 		switch (m_state->m_unk0x18) {
 		case 0:
 			m_state->m_unk0x14.m_unk0x00 = 5;
@@ -165,7 +165,7 @@ void GasStation::ReadyWorld()
 
 		FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
 		break;
-	case 2:
+	case LegoActor::c_mama:
 		switch (m_state->m_unk0x1a) {
 		case 0:
 			m_state->m_unk0x14.m_unk0x00 = 5;
@@ -191,7 +191,7 @@ void GasStation::ReadyWorld()
 
 		FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
 		break;
-	case 3:
+	case LegoActor::c_papa:
 		switch (m_state->m_unk0x1c) {
 		case 0:
 			m_state->m_unk0x14.m_unk0x00 = 5;
@@ -217,7 +217,7 @@ void GasStation::ReadyWorld()
 
 		FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
 		break;
-	case 4:
+	case LegoActor::c_nick:
 		switch (m_state->m_unk0x1e) {
 		case 0:
 			m_state->m_unk0x14.m_unk0x00 = 5;
@@ -243,7 +243,7 @@ void GasStation::ReadyWorld()
 
 		FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
 		break;
-	case 5:
+	case LegoActor::c_laura:
 		switch (m_state->m_unk0x20) {
 		case 0:
 			m_state->m_unk0x14.m_unk0x00 = 5;
diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp
index c715bcf6..8cd8ae92 100644
--- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp
+++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp
@@ -35,7 +35,7 @@ MxBool g_pizzaLedEnabled = FALSE;
 // FUNCTION: LEGO1 0x100745e0
 Hospital::Hospital()
 {
-	m_currentActorId = 0;
+	m_currentActorId = LegoActor::c_none;
 	m_unk0x100 = 0;
 	m_hospitalState = NULL;
 	m_unk0x108 = 0;
@@ -145,14 +145,14 @@ void Hospital::ReadyWorld()
 	m_pizzaLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "PizzaLed_Bitmap");
 
 	if (CurrentActor() == NULL) {
-		m_currentActorId = 5;
+		m_currentActorId = LegoActor::c_laura;
 	}
 	else {
 		m_currentActorId = CurrentActor()->GetActorId();
 	}
 
 	switch (m_currentActorId) {
-	case 1:
+	case LegoActor::c_pepper:
 		m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x0e;
 
 		if (m_hospitalState->m_unk0x0e < 5) {
@@ -160,7 +160,7 @@ void Hospital::ReadyWorld()
 		}
 
 		break;
-	case 2:
+	case LegoActor::c_mama:
 		m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x10;
 
 		if (m_hospitalState->m_unk0x10 < 5) {
@@ -168,7 +168,7 @@ void Hospital::ReadyWorld()
 		}
 
 		break;
-	case 3:
+	case LegoActor::c_papa:
 		m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x12;
 
 		if (m_hospitalState->m_unk0x12 < 5) {
@@ -176,7 +176,7 @@ void Hospital::ReadyWorld()
 		}
 
 		break;
-	case 4:
+	case LegoActor::c_nick:
 		m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x14;
 
 		if (m_hospitalState->m_unk0x14 < 5) {
@@ -184,7 +184,7 @@ void Hospital::ReadyWorld()
 		}
 
 		break;
-	case 5:
+	case LegoActor::c_laura:
 		m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x16;
 
 		if (m_hospitalState->m_unk0x16 < 5) {
@@ -269,7 +269,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
 		break;
 	case 11:
 		switch (m_currentActorId) {
-		case 1:
+		case LegoActor::c_pepper:
 			switch (m_hospitalState->m_unk0x0e) {
 			case 0:
 			case 1:
@@ -288,7 +288,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
 				break;
 			}
 			break;
-		case 2:
+		case LegoActor::c_mama:
 			switch (m_hospitalState->m_unk0x10) {
 			case 0:
 			case 1:
@@ -307,7 +307,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
 				break;
 			}
 			break;
-		case 3:
+		case LegoActor::c_papa:
 			switch (m_hospitalState->m_unk0x12) {
 			case 0:
 			case 1:
@@ -326,7 +326,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
 				break;
 			}
 			break;
-		case 4:
+		case LegoActor::c_nick:
 			switch (m_hospitalState->m_unk0x14) {
 			case 0:
 			case 1:
@@ -345,7 +345,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
 				break;
 			}
 			break;
-		case 5:
+		case LegoActor::c_laura:
 			switch (m_hospitalState->m_unk0x16) {
 			case 0:
 			case 1:
@@ -438,7 +438,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
 					}
 					else {
 						switch (m_currentActorId) {
-						case 1:
+						case LegoActor::c_pepper:
 							switch (m_hospitalState->m_unk0x0e) {
 							case 0:
 							case 1:
@@ -457,7 +457,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
 								break;
 							}
 							break;
-						case 2:
+						case LegoActor::c_mama:
 							switch (m_hospitalState->m_unk0x10) {
 							case 0:
 							case 1:
@@ -476,7 +476,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
 								break;
 							}
 							break;
-						case 3:
+						case LegoActor::c_papa:
 							switch (m_hospitalState->m_unk0x12) {
 							case 0:
 							case 1:
@@ -495,7 +495,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
 								break;
 							}
 							break;
-						case 4:
+						case LegoActor::c_nick:
 							switch (m_hospitalState->m_unk0x14) {
 							case 0:
 							case 1:
@@ -514,7 +514,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
 								break;
 							}
 							break;
-						case 5:
+						case LegoActor::c_laura:
 							switch (m_hospitalState->m_unk0x16) {
 							case 0:
 							case 1:
diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp
index f8a1426d..a2ae514f 100644
--- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp
+++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp
@@ -1047,7 +1047,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerEvent& p_param)
 					InputManager()->SetUnknown336(TRUE);
 					break;
 				case LegoGameState::e_unk4:
-					if (state->GetActorId()) {
+					if (state->GetActorId() != LegoActor::c_none) {
 						if (m_infocenterState->HasRegistered()) {
 							m_infocenterState->SetUnknown0x74(5);
 							m_destLocation = state->GetPreviousArea();
@@ -1336,23 +1336,23 @@ void Infocenter::UpdateFrameHot(MxBool p_display)
 		MxS32 x, y;
 
 		switch (GameState()->GetActorId()) {
-		case 1:
+		case LegoActor::c_pepper:
 			x = 302;
 			y = 81;
 			break;
-		case 2:
+		case LegoActor::c_mama:
 			x = 204;
 			y = 81;
 			break;
-		case 3:
+		case LegoActor::c_papa:
 			x = 253;
 			y = 81;
 			break;
-		case 4:
+		case LegoActor::c_nick:
 			x = 353;
 			y = 81;
 			break;
-		case 5:
+		case LegoActor::c_laura:
 			x = 399;
 			y = 81;
 			break;
diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp
index a4afe604..dde3e760 100644
--- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp
+++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp
@@ -114,7 +114,7 @@ MxLong InfocenterDoor::HandleControl(LegoControlManagerEvent& p_param)
 			result = 1;
 			break;
 		case InfodoorScript::c_Door_Ctl:
-			if (GameState()->GetActorId()) {
+			if (GameState()->GetActorId() != LegoActor::c_none) {
 				InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
 				if (state->HasRegistered()) {
 					m_destLocation = LegoGameState::e_unk4;
diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp
index 1e8ea520..806903af 100644
--- a/LEGO1/lego/legoomni/src/worlds/isle.cpp
+++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp
@@ -544,7 +544,7 @@ void Isle::Enable(MxBool p_enable)
 		VideoManager()->ResetPalette(FALSE);
 		m_act1state->FUN_10034d00();
 
-		if (CurrentActor() != NULL && CurrentActor()->GetActorId() != 0) {
+		if (CurrentActor() != NULL && CurrentActor()->GetActorId() != LegoActor::c_none) {
 			// TODO: Match, most likely an inline function
 			MxS32 targetEntityId = (CurrentActor()->GetActorId() == 1) + 250;
 
diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp
index a20f5163..0efbea20 100644
--- a/LEGO1/lego/legoomni/src/worlds/police.cpp
+++ b/LEGO1/lego/legoomni/src/worlds/police.cpp
@@ -231,11 +231,11 @@ void PoliceState::FUN_1005ea40()
 	}
 
 	switch (CurrentActor()->GetActorId()) {
-	case 4:
+	case LegoActor::c_nick:
 		policeScript = PoliceScript::c_nps002la_RunAnim;
 		m_policeScript = policeScript;
 		break;
-	case 5:
+	case LegoActor::c_laura:
 		policeScript = PoliceScript::c_nps001ni_RunAnim;
 		m_policeScript = policeScript;
 		break;