Implement/match Ambulance::Tickle (#1021)

This commit is contained in:
Christian Semmler 2024-06-12 09:13:52 -04:00 committed by GitHub
parent ebc200bea3
commit 1f360929cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 166 additions and 118 deletions

View file

@ -127,7 +127,7 @@ class LegoOmni : public MxOmni {
ViewLODListManager* GetViewLODListManager() { return m_viewLODListManager; } ViewLODListManager* GetViewLODListManager() { return m_viewLODListManager; }
LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoWorld* GetCurrentWorld() { return m_currentWorld; }
LegoNavController* GetNavController() { return m_navController; } LegoNavController* GetNavController() { return m_navController; }
LegoPathActor* GetCurrentActor() { return m_currentActor; } LegoPathActor* GetUserActor() { return m_userActor; }
LegoPlantManager* GetPlantManager() { return m_plantManager; } LegoPlantManager* GetPlantManager() { return m_plantManager; }
LegoAnimationManager* GetAnimationManager() { return m_animationManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; }
LegoBuildingManager* GetBuildingManager() { return m_buildingManager; } LegoBuildingManager* GetBuildingManager() { return m_buildingManager; }
@ -139,7 +139,7 @@ class LegoOmni : public MxOmni {
LegoWorldList* GetWorldList() { return m_worldList; } LegoWorldList* GetWorldList() { return m_worldList; }
inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; } inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; }
inline void SetCurrentActor(LegoPathActor* p_currentActor) { m_currentActor = p_currentActor; } inline void SetUserActor(LegoPathActor* p_userActor) { m_userActor = p_userActor; }
inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; }
inline void SetExit(MxBool p_exit) { m_exit = p_exit; } inline void SetExit(MxBool p_exit) { m_exit = p_exit; }
inline MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) inline MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction)
@ -162,7 +162,7 @@ class LegoOmni : public MxOmni {
LegoWorld* m_currentWorld; // 0x7c LegoWorld* m_currentWorld; // 0x7c
MxBool m_exit; // 0x80 MxBool m_exit; // 0x80
LegoNavController* m_navController; // 0x84 LegoNavController* m_navController; // 0x84
LegoPathActor* m_currentActor; // 0x88 LegoPathActor* m_userActor; // 0x88
LegoCharacterManager* m_characterManager; // 0x8c LegoCharacterManager* m_characterManager; // 0x8c
LegoPlantManager* m_plantManager; // 0x90 LegoPlantManager* m_plantManager; // 0x90
LegoAnimationManager* m_animationManager; // 0x94 LegoAnimationManager* m_animationManager; // 0x94

View file

@ -40,7 +40,7 @@ LegoControlManager* ControlManager();
LegoGameState* GameState(); LegoGameState* GameState();
LegoAnimationManager* AnimationManager(); LegoAnimationManager* AnimationManager();
LegoNavController* NavController(); LegoNavController* NavController();
LegoPathActor* CurrentActor(); LegoPathActor* UserActor();
LegoWorld* CurrentWorld(); LegoWorld* CurrentWorld();
LegoCharacterManager* CharacterManager(); LegoCharacterManager* CharacterManager();
ViewManager* GetViewManager(); ViewManager* GetViewManager();
@ -51,7 +51,7 @@ ViewLODListManager* GetViewLODListManager();
void FUN_10015820(MxBool p_disable, MxU16 p_flags); void FUN_10015820(MxBool p_disable, MxU16 p_flags);
LegoROI* FindROI(const char* p_name); LegoROI* FindROI(const char* p_name);
void SetROIVisible(const char* p_name, MxBool p_visible); void SetROIVisible(const char* p_name, MxBool p_visible);
void SetCurrentActor(LegoPathActor* p_currentActor); void SetUserActor(LegoPathActor* p_userActor);
MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction); MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction);
void DeleteAction(); void DeleteAction();
LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid);

View file

@ -149,7 +149,7 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
} }
else if (objectId == IsleScript::c_hho027en_RunAnim) { else if (objectId == IsleScript::c_hho027en_RunAnim) {
m_state->m_unk0x08 = 1; m_state->m_unk0x08 = 1;
CurrentWorld()->PlaceActor(CurrentActor()); CurrentWorld()->PlaceActor(UserActor());
HandleClick(); HandleClick();
m_unk0x172 = 0; m_unk0x172 = 0;
TickleManager()->RegisterClient(this, 40000); TickleManager()->RegisterClient(this, 40000);
@ -173,7 +173,7 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
} }
} }
else if (objectId == IsleScript::c_hpz055pa_RunAnim || objectId == IsleScript::c_hpz057ma_RunAnim) { else if (objectId == IsleScript::c_hpz055pa_RunAnim || objectId == IsleScript::c_hpz057ma_RunAnim) {
CurrentWorld()->PlaceActor(CurrentActor()); CurrentWorld()->PlaceActor(UserActor());
HandleClick(); HandleClick();
SpawnPlayer(LegoGameState::e_pizzeriaExterior, TRUE, 0); SpawnPlayer(LegoGameState::e_pizzeriaExterior, TRUE, 0);
m_unk0x172 = 0; m_unk0x172 = 0;
@ -197,7 +197,7 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
} }
} }
else if (objectId == IsleScript::c_hps117bd_RunAnim) { else if (objectId == IsleScript::c_hps117bd_RunAnim) {
CurrentWorld()->PlaceActor(CurrentActor()); CurrentWorld()->PlaceActor(UserActor());
HandleClick(); HandleClick();
SpawnPlayer(LegoGameState::e_unk33, TRUE, 0); SpawnPlayer(LegoGameState::e_unk33, TRUE, 0);
m_unk0x172 = 0; m_unk0x172 = 0;
@ -245,12 +245,12 @@ MxLong Ambulance::HandleClick()
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_ambulance); ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_ambulance);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
m_time = Timer()->GetTime(); m_time = Timer()->GetTime();
m_unk0x16a = CurrentActor()->GetActorId(); m_unk0x16a = UserActor()->GetActorId();
Enter(); Enter();
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_AmbulanceDashboard, NULL); InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_AmbulanceDashboard, NULL);
@ -294,10 +294,58 @@ void Ambulance::FUN_10037060()
// TODO // TODO
} }
// STUB: LEGO1 0x10037160 // FUNCTION: LEGO1 0x10037160
// FUNCTION: BETA10 0x100237df
MxResult Ambulance::Tickle() MxResult Ambulance::Tickle()
{ {
// TODO if (m_unk0x172 == 0) {
m_unk0x172 = 1;
}
else if (m_lastAction == IsleScript::c_noneIsle) {
IsleScript::Script objectId;
switch ((rand() % 12) + 1) {
case 1:
objectId = IsleScript::c_ham034ra_PlayWav;
break;
case 2:
objectId = IsleScript::c_ham035ra_PlayWav;
break;
case 3:
objectId = IsleScript::c_ham036ra_PlayWav;
break;
case 4:
objectId = IsleScript::c_hpz037ma_PlayWav;
break;
case 5:
objectId = IsleScript::c_sns078pa_PlayWav;
break;
case 6:
objectId = IsleScript::c_ham039ra_PlayWav;
break;
case 7:
objectId = IsleScript::c_ham040cl_PlayWav;
break;
case 8:
objectId = IsleScript::c_ham041cl_PlayWav;
break;
case 9:
objectId = IsleScript::c_ham042cl_PlayWav;
break;
case 10:
objectId = IsleScript::c_ham043cl_PlayWav;
break;
case 11:
objectId = IsleScript::c_ham044cl_PlayWav;
break;
case 12:
objectId = IsleScript::c_ham045cl_PlayWav;
break;
}
PlayAction(objectId);
}
return SUCCESS; return SUCCESS;
} }

View file

@ -28,8 +28,8 @@ MxLong InfoCenterEntity::VTable0x50(MxParam& p_param)
{ {
switch (GameState()->GetCurrentAct()) { switch (GameState()->GetCurrentAct()) {
case LegoGameState::Act::e_act1: { case LegoGameState::Act::e_act1: {
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);
@ -70,8 +70,8 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param)
if (state->GetUnknown18() != 8) { if (state->GetUnknown18() != 8) {
state->SetUnknown18(0); state->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);
@ -94,8 +94,8 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param)
if (act1State->GetUnknown18() != 10) { if (act1State->GetUnknown18() != 10) {
act1State->SetUnknown18(0); act1State->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);
@ -118,8 +118,8 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param)
if (state->GetUnknown18() != 10) { if (state->GetUnknown18() != 10) {
state->SetUnknown18(0); state->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);
@ -140,8 +140,8 @@ MxLong BeachHouseEntity::VTable0x50(MxParam& p_param)
Act1State* state = (Act1State*) GameState()->GetState("Act1State"); Act1State* state = (Act1State*) GameState()->GetState("Act1State");
state->SetUnknown18(0); state->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);
@ -161,8 +161,8 @@ MxLong RaceStandsEntity::VTable0x50(MxParam& p_param)
Act1State* state = (Act1State*) GameState()->GetState("Act1State"); Act1State* state = (Act1State*) GameState()->GetState("Act1State");
state->SetUnknown18(0); state->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);

View file

@ -77,8 +77,8 @@ void Helicopter::Exit()
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
GameState()->SetCurrentArea(LegoGameState::e_copter); GameState()->SetCurrentArea(LegoGameState::e_copter);
if (CurrentActor() && CurrentActor()->IsA("IslePathActor")) { if (UserActor() && UserActor()->IsA("IslePathActor")) {
((IslePathActor*) CurrentActor()) ((IslePathActor*) UserActor())
->SpawnPlayer( ->SpawnPlayer(
LegoGameState::e_unk55, LegoGameState::e_unk55,
TRUE, TRUE,
@ -115,9 +115,9 @@ MxLong Helicopter::HandleClick()
AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->FUN_1005f6d0(FALSE);
if (CurrentActor()) { if (UserActor()) {
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
} }

View file

@ -75,9 +75,9 @@ MxLong IslePathActor::Notify(MxParam& p_param)
void IslePathActor::Enter() void IslePathActor::Enter()
{ {
m_roi->SetVisibility(FALSE); m_roi->SetVisibility(FALSE);
if (CurrentActor() != this) { if (UserActor() != this) {
m_previousVel = NavController()->GetMaxLinearVel(); m_previousVel = NavController()->GetMaxLinearVel();
m_previousActor = CurrentActor(); m_previousActor = UserActor();
if (m_previousActor) { if (m_previousActor) {
m_previousActor->ResetWorldTransform(FALSE); m_previousActor->ResetWorldTransform(FALSE);
m_previousActor->SetUserNavFlag(FALSE); m_previousActor->SetUserNavFlag(FALSE);
@ -91,7 +91,7 @@ void IslePathActor::Enter()
NavController()->ResetMaxLinearVel(m_maxLinearVel); NavController()->ResetMaxLinearVel(m_maxLinearVel);
SetCurrentActor(this); SetUserActor(this);
FUN_1001b660(); FUN_1001b660();
FUN_10010c30(); FUN_10010c30();
} }
@ -110,7 +110,7 @@ void IslePathActor::Exit()
SetUserNavFlag(FALSE); SetUserNavFlag(FALSE);
if (m_previousActor != NULL) { if (m_previousActor != NULL) {
SetCurrentActor(m_previousActor); SetUserActor(m_previousActor);
NavController()->ResetMaxLinearVel(m_previousVel); NavController()->ResetMaxLinearVel(m_previousVel);
m_previousActor->ResetWorldTransform(TRUE); m_previousActor->ResetWorldTransform(TRUE);
m_previousActor->SetUserNavFlag(TRUE); m_previousActor->SetUserNavFlag(TRUE);

View file

@ -37,8 +37,8 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param)
return 1; return 1;
} }
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
((Isle*) FindWorld(*g_isleScript, 0))->SetDestLocation(LegoGameState::e_jukeboxw); ((Isle*) FindWorld(*g_isleScript, 0))->SetDestLocation(LegoGameState::e_jukeboxw);

View file

@ -49,9 +49,9 @@ void Pizzeria::CreateState()
undefined4 Pizzeria::HandleClick() undefined4 Pizzeria::HandleClick()
{ {
if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) { if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) {
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
if (!CurrentActor()->IsA("SkateBoard")) { if (!UserActor()->IsA("SkateBoard")) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
} }

View file

@ -84,13 +84,13 @@ MxLong SkateBoard::HandleClick()
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_skateboard); ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_skateboard);
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE); TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE);
if (GameState()->GetActorId() != CurrentActor()->GetActorId()) { if (GameState()->GetActorId() != UserActor()->GetActorId()) {
if (!CurrentActor()->IsA("SkateBoard")) { if (!UserActor()->IsA("SkateBoard")) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
} }
} }
if (!CurrentActor()->IsA("SkateBoard")) { if (!UserActor()->IsA("SkateBoard")) {
Enter(); Enter();
InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_SkateDashboard, NULL); InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_SkateDashboard, NULL);
GetCurrentAction().SetObjectId(-1); GetCurrentAction().SetObjectId(-1);
@ -154,7 +154,7 @@ void SkateBoard::ActivateSceneActions()
if (!m_act1state->m_unk0x022) { if (!m_act1state->m_unk0x022) {
m_act1state->m_unk0x022 = TRUE; m_act1state->m_unk0x022 = TRUE;
MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World()); MxMatrix mat(UserActor()->GetROI()->GetLocal2World());
mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.2, mat[2][2] * 2.5); mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.2, mat[2][2] * 2.5);
AnimationManager() AnimationManager()

View file

@ -998,7 +998,7 @@ MxResult LegoAnimationManager::FUN_100605e0(
FUN_100648f0(tranInfo, m_unk0x404); FUN_100648f0(tranInfo, m_unk0x404);
} }
else if (p_unk0x0a) { else if (p_unk0x0a) {
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
if (actor != NULL) { if (actor != NULL) {
actor->SetState(4); actor->SetState(4);
@ -1435,7 +1435,7 @@ MxResult LegoAnimationManager::Tickle()
return SUCCESS; return SUCCESS;
} }
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
LegoROI* roi; LegoROI* roi;
if (actor == NULL || (roi = actor->GetROI()) == NULL) { if (actor == NULL || (roi = actor->GetROI()) == NULL) {
@ -1658,7 +1658,7 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info)
LegoEntityListCursor cursor(entityList); LegoEntityListCursor cursor(entityList);
LegoEntity* entity; LegoEntity* entity;
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
while (cursor.Next(entity)) { while (cursor.Next(entity)) {
if (entity != actor && entity->IsA("LegoPathActor")) { if (entity != actor && entity->IsA("LegoPathActor")) {
@ -1861,7 +1861,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
if (world != NULL) { if (world != NULL) {
PurgeExtra(FALSE); PurgeExtra(FALSE);
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
if (actor == NULL || actor->GetWorldSpeed() <= 20.0f) { if (actor == NULL || actor->GetWorldSpeed() <= 20.0f) {
MxU32 i; MxU32 i;
for (i = 0; i < m_numAllowedExtras && m_extras[i].m_roi != NULL; i++) { for (i = 0; i < m_numAllowedExtras && m_extras[i].m_roi != NULL; i++) {
@ -2478,7 +2478,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
{ {
MxU32 local2c = 12; MxU32 local2c = 12;
float destScale = ((rand() * 0.5) / 32767.0) + 0.25; float destScale = ((rand() * 0.5) / 32767.0) + 0.25;
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
if (actor == NULL) { if (actor == NULL) {
return FALSE; return FALSE;
@ -2760,7 +2760,7 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x
m_unk0x43c = viewROI->GetLocal2World(); m_unk0x43c = viewROI->GetLocal2World();
p_tranInfo->m_unk0x2c = m_unk0x43c; p_tranInfo->m_unk0x2c = m_unk0x43c;
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
if (actor != NULL) { if (actor != NULL) {
actor->SetState(4); actor->SetState(4);
actor->SetWorldSpeed(0.0f); actor->SetWorldSpeed(0.0f);

View file

@ -426,7 +426,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6b0(MxLong p_time)
MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time)
{ {
LegoROI* viewROI = VideoManager()->GetViewROI(); LegoROI* viewROI = VideoManager()->GetViewROI();
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
if (m_tranInfo != NULL && m_tranInfo->m_unk0x14 && m_tranInfo->m_location != -1 && actor != NULL) { if (m_tranInfo != NULL && m_tranInfo->m_unk0x14 && m_tranInfo->m_location != -1 && actor != NULL) {
if (m_unk0x64 != NULL) { if (m_unk0x64 != NULL) {

View file

@ -171,8 +171,8 @@ void LegoGameState::SetActor(MxU8 p_actorId)
m_actorId = p_actorId; m_actorId = p_actorId;
} }
LegoPathActor* oldActor = CurrentActor(); LegoPathActor* oldActor = UserActor();
SetCurrentActor(NULL); SetUserActor(NULL);
IslePathActor* newActor = new IslePathActor(); IslePathActor* newActor = new IslePathActor();
const char* actorName = LegoActor::GetActorName(m_actorId); const char* actorName = LegoActor::GetActorName(m_actorId);
@ -192,14 +192,14 @@ void LegoGameState::SetActor(MxU8 p_actorId)
} }
newActor->ClearFlag(0x02); newActor->ClearFlag(0x02);
SetCurrentActor(newActor); SetUserActor(newActor);
} }
// FUNCTION: LEGO1 0x10039910 // FUNCTION: LEGO1 0x10039910
void LegoGameState::RemoveActor() void LegoGameState::RemoveActor()
{ {
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
SetCurrentActor(NULL); SetUserActor(NULL);
delete actor; delete actor;
m_actorId = 0; m_actorId = 0;
} }
@ -208,7 +208,7 @@ void LegoGameState::RemoveActor()
void LegoGameState::ResetROI() void LegoGameState::ResetROI()
{ {
if (m_actorId) { if (m_actorId) {
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
if (actor) { if (actor) {
LegoROI* roi = actor->GetROI(); LegoROI* roi = actor->GetROI();
@ -887,7 +887,7 @@ void LegoGameState::SwitchArea(Area p_area)
case e_garadoor: case e_garadoor:
LoadIsle(); LoadIsle();
VariableTable()->SetVariable("VISIBILITY", "Hide Gas"); VariableTable()->SetVariable("VISIBILITY", "Hide Gas");
CurrentActor()->ResetWorldTransform(FALSE); UserActor()->ResetWorldTransform(FALSE);
NavController()->UpdateLocation(59); // LCAMZG1 in g_cameraLocations NavController()->UpdateLocation(59); // LCAMZG1 in g_cameraLocations
VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f); VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f);
InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_GaraDoor, NULL); InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_GaraDoor, NULL);
@ -901,11 +901,11 @@ void LegoGameState::SwitchArea(Area p_area)
} }
else { else {
SetCameraControllerFromIsle(); SetCameraControllerFromIsle();
CurrentActor()->ResetWorldTransform(TRUE); UserActor()->ResetWorldTransform(TRUE);
AnimationManager()->Resume(); AnimationManager()->Resume();
} }
((IslePathActor*) CurrentActor()) ((IslePathActor*) UserActor())
->SpawnPlayer( ->SpawnPlayer(
p_area, p_area,
TRUE, TRUE,
@ -920,9 +920,9 @@ void LegoGameState::SwitchArea(Area p_area)
case e_unk33: case e_unk33:
LoadIsle(); LoadIsle();
SetCameraControllerFromIsle(); SetCameraControllerFromIsle();
CurrentActor()->ResetWorldTransform(TRUE); UserActor()->ResetWorldTransform(TRUE);
AnimationManager()->Resume(); AnimationManager()->Resume();
((IslePathActor*) CurrentActor()) ((IslePathActor*) UserActor())
->SpawnPlayer( ->SpawnPlayer(
p_area, p_area,
TRUE, TRUE,

View file

@ -467,8 +467,8 @@ MxBool FUN_1003ef60()
GameState()->m_currentArea != LegoGameState::e_elevdown && GameState()->m_currentArea != LegoGameState::e_elevdown &&
GameState()->m_currentArea != LegoGameState::e_garadoor && GameState()->m_currentArea != LegoGameState::e_garadoor &&
GameState()->m_currentArea != LegoGameState::e_polidoor) { GameState()->m_currentArea != LegoGameState::e_polidoor) {
if (CurrentActor() == NULL || !CurrentActor()->IsA("TowTrack")) { if (UserActor() == NULL || !UserActor()->IsA("TowTrack")) {
if (CurrentActor() == NULL || !CurrentActor()->IsA("Ambulance")) { if (UserActor() == NULL || !UserActor()->IsA("Ambulance")) {
MxU32 unk0x18 = act1State->GetUnknown18(); MxU32 unk0x18 = act1State->GetUnknown18();
if (unk0x18 != 10 && unk0x18 != 8 && unk0x18 != 3) { if (unk0x18 != 10 && unk0x18 != 8 && unk0x18 != 3) {

View file

@ -67,9 +67,9 @@ LegoNavController* NavController()
} }
// FUNCTION: LEGO1 0x10015790 // FUNCTION: LEGO1 0x10015790
LegoPathActor* CurrentActor() LegoPathActor* UserActor()
{ {
return LegoOmni::GetInstance()->GetCurrentActor(); return LegoOmni::GetInstance()->GetUserActor();
} }
// FUNCTION: LEGO1 0x100157a0 // FUNCTION: LEGO1 0x100157a0
@ -137,9 +137,9 @@ void SetROIVisible(const char* p_name, MxBool p_visible)
} }
// FUNCTION: LEGO1 0x10015880 // FUNCTION: LEGO1 0x10015880
void SetCurrentActor(LegoPathActor* p_currentActor) void SetUserActor(LegoPathActor* p_userActor)
{ {
LegoOmni::GetInstance()->SetCurrentActor(p_currentActor); LegoOmni::GetInstance()->SetUserActor(p_userActor);
} }
// FUNCTION: LEGO1 0x10015890 // FUNCTION: LEGO1 0x10015890

View file

@ -705,7 +705,7 @@ void LegoWorld::Enable(MxBool p_enable)
else if (!p_enable && m_set0xd0.empty()) { else if (!p_enable && m_set0xd0.empty()) {
MxPresenter* presenter; MxPresenter* presenter;
LegoPathController* controller; LegoPathController* controller;
LegoPathActor* actor = CurrentActor(); LegoPathActor* actor = UserActor();
if (actor) { if (actor) {
RemoveActor(actor); RemoveActor(actor);

View file

@ -65,7 +65,7 @@ void LegoOmni::Init()
m_worldList = NULL; m_worldList = NULL;
m_currentWorld = NULL; m_currentWorld = NULL;
m_exit = FALSE; m_exit = FALSE;
m_currentActor = NULL; m_userActor = NULL;
m_characterManager = NULL; m_characterManager = NULL;
m_plantManager = NULL; m_plantManager = NULL;
m_gameState = NULL; m_gameState = NULL;

View file

@ -554,7 +554,7 @@ void LegoPathActor::ParseAction(char* p_extra)
if (KeyValueStringParse(value, g_strPERMIT_NAVIGATE, p_extra)) { if (KeyValueStringParse(value, g_strPERMIT_NAVIGATE, p_extra)) {
SetUserNavFlag(TRUE); SetUserNavFlag(TRUE);
NavController()->ResetMaxLinearVel(m_worldSpeed); NavController()->ResetMaxLinearVel(m_worldSpeed);
SetCurrentActor(this); SetUserActor(this);
} }
char* token; char* token;

View file

@ -61,9 +61,9 @@ MxResult LegoRace::Create(MxDSAction& p_dsAction)
if (result == SUCCESS) { if (result == SUCCESS) {
m_act1State = (Act1State*) GameState()->GetState("Act1State"); m_act1State = (Act1State*) GameState()->GetState("Act1State");
ControlManager()->Register(this); ControlManager()->Register(this);
m_pathActor = CurrentActor(); m_pathActor = UserActor();
m_pathActor->SetWorldSpeed(0); m_pathActor->SetWorldSpeed(0);
SetCurrentActor(NULL); SetUserActor(NULL);
} }
return result; return result;
@ -74,7 +74,7 @@ LegoRace::~LegoRace()
{ {
g_unk0x100f119c = FALSE; g_unk0x100f119c = FALSE;
if (m_pathActor) { if (m_pathActor) {
SetCurrentActor(m_pathActor); SetUserActor(m_pathActor);
NavController()->ResetMaxLinearVel(m_pathActor->GetMaxLinearVel()); NavController()->ResetMaxLinearVel(m_pathActor->GetMaxLinearVel());
m_pathActor = NULL; m_pathActor = NULL;
} }
@ -118,7 +118,7 @@ MxLong LegoRace::Notify(MxParam& p_param)
void LegoRace::Enable(MxBool p_enable) void LegoRace::Enable(MxBool p_enable)
{ {
if (GetUnknown0xd0Empty() != p_enable && !p_enable) { if (GetUnknown0xd0Empty() != p_enable && !p_enable) {
Remove(CurrentActor()); Remove(UserActor());
MxU8 oldActorId = GameState()->GetActorId(); MxU8 oldActorId = GameState()->GetActorId();
GameState()->RemoveActor(); GameState()->RemoveActor();

View file

@ -131,7 +131,7 @@ void GasStation::ReadyWorld()
PlayMusic(JukeboxScript::c_JBMusic2); PlayMusic(JukeboxScript::c_JBMusic2);
m_trackLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "TrackLed_Bitmap"); m_trackLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "TrackLed_Bitmap");
m_currentActorId = CurrentActor()->GetActorId(); m_currentActorId = UserActor()->GetActorId();
switch (m_currentActorId) { switch (m_currentActorId) {
case LegoActor::c_pepper: case LegoActor::c_pepper:

View file

@ -144,11 +144,11 @@ void Hospital::ReadyWorld()
m_copLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "CopLed_Bitmap"); m_copLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "CopLed_Bitmap");
m_pizzaLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "PizzaLed_Bitmap"); m_pizzaLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "PizzaLed_Bitmap");
if (CurrentActor() == NULL) { if (UserActor() == NULL) {
m_currentActorId = LegoActor::c_laura; m_currentActorId = LegoActor::c_laura;
} }
else { else {
m_currentActorId = CurrentActor()->GetActorId(); m_currentActorId = UserActor()->GetActorId();
} }
switch (m_currentActorId) { switch (m_currentActorId) {

View file

@ -82,8 +82,8 @@ Isle::~Isle()
InputManager()->ClearWorld(); InputManager()->ClearWorld();
} }
if (CurrentActor() != NULL) { if (UserActor() != NULL) {
VTable0x6c(CurrentActor()); VTable0x6c(UserActor());
} }
NotificationManager()->Unregister(this); NotificationManager()->Unregister(this);
@ -157,7 +157,7 @@ MxLong Isle::Notify(MxParam& p_param)
case c_notificationEndAnim: case c_notificationEndAnim:
switch (m_act1state->m_unk0x018) { switch (m_act1state->m_unk0x018) {
case 4: case 4:
result = CurrentActor()->Notify(p_param); result = UserActor()->Notify(p_param);
break; break;
case 8: case 8:
result = m_towtrack->Notify(p_param); result = m_towtrack->Notify(p_param);
@ -473,11 +473,11 @@ MxLong Isle::HandleType19Notification(MxType19NotificationParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
if (CurrentActor() != NULL) { if (UserActor() != NULL) {
if (CurrentActor() == m_dunebuggy) { if (UserActor() == m_dunebuggy) {
result = m_dunebuggy->Notify(p_param); result = m_dunebuggy->Notify(p_param);
} }
else if (CurrentActor() == m_motocycle) { else if (UserActor() == m_motocycle) {
result = m_motocycle->Notify(p_param); result = m_motocycle->Notify(p_param);
} }
} }
@ -544,9 +544,9 @@ void Isle::Enable(MxBool p_enable)
VideoManager()->ResetPalette(FALSE); VideoManager()->ResetPalette(FALSE);
m_act1state->FUN_10034d00(); m_act1state->FUN_10034d00();
if (CurrentActor() != NULL && CurrentActor()->GetActorId() != LegoActor::c_none) { if (UserActor() != NULL && UserActor()->GetActorId() != LegoActor::c_none) {
// TODO: Match, most likely an inline function // TODO: Match, most likely an inline function
MxS32 targetEntityId = (CurrentActor()->GetActorId() == 1) + 250; MxS32 targetEntityId = (UserActor()->GetActorId() == 1) + 250;
if (targetEntityId != -1) { if (targetEntityId != -1) {
InvokeAction(Extra::e_start, *g_isleScript, targetEntityId, NULL); InvokeAction(Extra::e_start, *g_isleScript, targetEntityId, NULL);
@ -575,8 +575,8 @@ void Isle::Enable(MxBool p_enable)
} }
} }
if (CurrentActor() != NULL && CurrentActor()->IsA("Jetski")) { if (UserActor() != NULL && UserActor()->IsA("Jetski")) {
IslePathActor* actor = (IslePathActor*) CurrentActor(); IslePathActor* actor = (IslePathActor*) UserActor();
actor->SpawnPlayer( actor->SpawnPlayer(
LegoGameState::e_unk45, LegoGameState::e_unk45,
FALSE, FALSE,
@ -599,7 +599,7 @@ void Isle::Enable(MxBool p_enable)
m_act1state->m_unk0x018 = 5; m_act1state->m_unk0x018 = 5;
} }
PlaceActor(CurrentActor()); PlaceActor(UserActor());
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
@ -622,7 +622,7 @@ void Isle::Enable(MxBool p_enable)
SetIsWorldActive(FALSE); SetIsWorldActive(FALSE);
break; break;
case LegoGameState::e_bike: case LegoGameState::e_bike:
PlaceActor(CurrentActor()); PlaceActor(UserActor());
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
@ -635,7 +635,7 @@ void Isle::Enable(MxBool p_enable)
#endif #endif
break; break;
case LegoGameState::e_dunecar: case LegoGameState::e_dunecar:
PlaceActor(CurrentActor()); PlaceActor(UserActor());
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
@ -648,7 +648,7 @@ void Isle::Enable(MxBool p_enable)
#endif #endif
break; break;
case LegoGameState::e_motocycle: case LegoGameState::e_motocycle:
PlaceActor(CurrentActor()); PlaceActor(UserActor());
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
@ -661,7 +661,7 @@ void Isle::Enable(MxBool p_enable)
#endif #endif
break; break;
case LegoGameState::e_copter: case LegoGameState::e_copter:
PlaceActor(CurrentActor()); PlaceActor(UserActor());
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
@ -674,7 +674,7 @@ void Isle::Enable(MxBool p_enable)
#endif #endif
break; break;
case LegoGameState::e_skateboard: case LegoGameState::e_skateboard:
PlaceActor(CurrentActor()); PlaceActor(UserActor());
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
@ -687,7 +687,7 @@ void Isle::Enable(MxBool p_enable)
#endif #endif
break; break;
case LegoGameState::e_jetski: case LegoGameState::e_jetski:
PlaceActor(CurrentActor()); PlaceActor(UserActor());
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
@ -714,7 +714,7 @@ void Isle::Enable(MxBool p_enable)
AnimationManager()->FUN_10064740(NULL); AnimationManager()->FUN_10064740(NULL);
} }
else if (GameState()->m_currentArea == LegoGameState::e_unk66) { else if (GameState()->m_currentArea == LegoGameState::e_unk66) {
Mx3DPointFloat position(CurrentActor()->GetROI()->GetWorldPosition()); Mx3DPointFloat position(UserActor()->GetROI()->GetWorldPosition());
Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f); Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f);
((Vector3&) sub).Sub(position); ((Vector3&) sub).Sub(position);
@ -730,7 +730,7 @@ void Isle::Enable(MxBool p_enable)
} }
break; break;
case 5: { case 5: {
((IslePathActor*) CurrentActor()) ((IslePathActor*) UserActor())
->SpawnPlayer( ->SpawnPlayer(
LegoGameState::e_jetrace2, LegoGameState::e_jetrace2,
FALSE, FALSE,
@ -763,7 +763,7 @@ void Isle::Enable(MxBool p_enable)
} }
case 6: { case 6: {
GameState()->m_currentArea = LegoGameState::e_carraceExterior; GameState()->m_currentArea = LegoGameState::e_carraceExterior;
((IslePathActor*) CurrentActor()) ((IslePathActor*) UserActor())
->SpawnPlayer( ->SpawnPlayer(
LegoGameState::e_unk21, LegoGameState::e_unk21,
FALSE, FALSE,
@ -813,7 +813,7 @@ void Isle::Enable(MxBool p_enable)
break; break;
case 11: case 11:
m_act1state->m_unk0x018 = 0; m_act1state->m_unk0x018 = 0;
((IslePathActor*) CurrentActor()) ((IslePathActor*) UserActor())
->SpawnPlayer( ->SpawnPlayer(
LegoGameState::e_jukeboxExterior, LegoGameState::e_jukeboxExterior,
TRUE, TRUE,
@ -863,9 +863,9 @@ void Isle::FUN_10032620()
switch (GameState()->m_currentArea) { switch (GameState()->m_currentArea) {
case LegoGameState::e_unk66: { case LegoGameState::e_unk66: {
MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World()); MxMatrix mat(UserActor()->GetROI()->GetLocal2World());
LegoPathBoundary* boundary = CurrentActor()->GetBoundary(); LegoPathBoundary* boundary = UserActor()->GetBoundary();
((IslePathActor*) CurrentActor())->VTable0xec(mat, boundary, TRUE); ((IslePathActor*) UserActor())->VTable0xec(mat, boundary, TRUE);
break; break;
} }
case LegoGameState::e_unk4: case LegoGameState::e_unk4:
@ -878,7 +878,7 @@ void Isle::FUN_10032620()
case LegoGameState::e_hospitalExterior: case LegoGameState::e_hospitalExterior:
case LegoGameState::e_unk31: case LegoGameState::e_unk31:
case LegoGameState::e_policeExterior: case LegoGameState::e_policeExterior:
((IslePathActor*) CurrentActor()) ((IslePathActor*) UserActor())
->SpawnPlayer( ->SpawnPlayer(
GameState()->m_currentArea, GameState()->m_currentArea,
TRUE, TRUE,
@ -1188,19 +1188,19 @@ MxBool Isle::Escape()
switch (m_act1state->m_unk0x018) { switch (m_act1state->m_unk0x018) {
case 3: case 3:
if (CurrentActor() != NULL) { if (UserActor() != NULL) {
m_pizza->FUN_10038380(); m_pizza->FUN_10038380();
m_pizza->FUN_100382b0(); m_pizza->FUN_100382b0();
} }
break; break;
case 8: case 8:
if (CurrentActor() != NULL && !CurrentActor()->IsA("TowTrack")) { if (UserActor() != NULL && !UserActor()->IsA("TowTrack")) {
m_towtrack->FUN_1004db10(); m_towtrack->FUN_1004db10();
m_towtrack->FUN_1004dbe0(); m_towtrack->FUN_1004dbe0();
} }
break; break;
case 10: case 10:
if (CurrentActor() != NULL && !CurrentActor()->IsA("Ambulance")) { if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) {
m_ambulance->StopActions(); m_ambulance->StopActions();
m_ambulance->FUN_10037250(); m_ambulance->FUN_10037250();
} }
@ -1217,9 +1217,9 @@ MxBool Isle::Escape()
AnimationManager()->FUN_10061010(FALSE); AnimationManager()->FUN_10061010(FALSE);
DeleteObjects(&m_atom, IsleScript::c_sba001bu_RunAnim, IsleScript::c_FNS018EN_Wav_518); DeleteObjects(&m_atom, IsleScript::c_sba001bu_RunAnim, IsleScript::c_FNS018EN_Wav_518);
if (CurrentActor()) { if (UserActor()) {
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
m_skateboard->SetUnknown0x160(FALSE); m_skateboard->SetUnknown0x160(FALSE);
} }
} }
@ -1241,21 +1241,21 @@ MxBool Isle::Escape()
void Isle::FUN_10033350() void Isle::FUN_10033350()
{ {
if (m_act1state->m_unk0x018 == 10) { if (m_act1state->m_unk0x018 == 10) {
if (CurrentActor() != NULL && !CurrentActor()->IsA("Ambulance")) { if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) {
m_ambulance->StopActions(); m_ambulance->StopActions();
m_ambulance->FUN_10037250(); m_ambulance->FUN_10037250();
} }
} }
if (m_act1state->m_unk0x018 == 8) { if (m_act1state->m_unk0x018 == 8) {
if (CurrentActor() != NULL && !CurrentActor()->IsA("TowTrack")) { if (UserActor() != NULL && !UserActor()->IsA("TowTrack")) {
m_towtrack->FUN_1004db10(); m_towtrack->FUN_1004db10();
m_towtrack->FUN_1004dbe0(); m_towtrack->FUN_1004dbe0();
} }
} }
if (m_act1state->m_unk0x018 == 3) { if (m_act1state->m_unk0x018 == 3) {
if (CurrentActor() != NULL) { if (UserActor() != NULL) {
m_pizza->FUN_10038380(); m_pizza->FUN_10038380();
m_pizza->FUN_100382b0(); m_pizza->FUN_100382b0();
} }
@ -1263,9 +1263,9 @@ void Isle::FUN_10033350()
AnimationManager()->FUN_10061010(FALSE); AnimationManager()->FUN_10061010(FALSE);
if (CurrentActor()) { if (UserActor()) {
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) CurrentActor())->Exit(); ((IslePathActor*) UserActor())->Exit();
m_skateboard->SetUnknown0x160(FALSE); m_skateboard->SetUnknown0x160(FALSE);
} }
} }

View file

@ -26,8 +26,8 @@ LegoAct2::~LegoAct2()
FUN_10051900(); FUN_10051900();
InputManager()->UnRegister(this); InputManager()->UnRegister(this);
if (CurrentActor()) { if (UserActor()) {
Remove(CurrentActor()); Remove(UserActor());
} }
NotificationManager()->Unregister(this); NotificationManager()->Unregister(this);

View file

@ -230,7 +230,7 @@ void PoliceState::FUN_1005ea40()
return; return;
} }
switch (CurrentActor()->GetActorId()) { switch (UserActor()->GetActorId()) {
case LegoActor::c_nick: case LegoActor::c_nick:
policeScript = PoliceScript::c_nps002la_RunAnim; policeScript = PoliceScript::c_nps002la_RunAnim;
m_policeScript = policeScript; m_policeScript = policeScript;