Implement/match IslePathActor::SpawnPlayer (#884)

* Implement/match IslePathActor::SpawnPlayer

* Fix

* Fix

* Add skip

* Rename param
This commit is contained in:
Christian Semmler
2024-05-04 10:13:05 -04:00
committed by GitHub
parent 1b1d2ecde6
commit 45f9f54f21
14 changed files with 278 additions and 57 deletions

View File

@@ -66,17 +66,23 @@ void Helicopter::GetState()
void Helicopter::VTable0xe4()
{
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
VTable0xe8(LegoGameState::e_unk40, TRUE, 7);
SpawnPlayer(
LegoGameState::e_unk40,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
}
IslePathActor::VTable0xe4();
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
GameState()->SetCurrentArea(LegoGameState::e_copter);
if (CurrentActor()) {
if (CurrentActor()->IsA("IslePathActor")) {
((IslePathActor*) CurrentActor())->VTable0xe8(LegoGameState::e_unk55, TRUE, 7);
}
if (CurrentActor() && CurrentActor()->IsA("IslePathActor")) {
CurrentActor()->SpawnPlayer(
LegoGameState::e_unk55,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
}
}
@@ -118,7 +124,11 @@ MxU32 Helicopter::VTable0xcc()
case LegoGameState::e_act1:
m_script = *g_isleScript;
AnimationManager()->FUN_10064670(NULL);
VTable0xe8(LegoGameState::e_unk41, TRUE, 7);
SpawnPlayer(
LegoGameState::e_unk41,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_copter);
FUN_10015820(TRUE, 0);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, TRUE);
@@ -258,10 +268,18 @@ MxU32 Helicopter::VTable0xd8(LegoEndAnimNotificationParam& p_param)
case 1: {
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4);
VTable0xe8(LegoGameState::e_unk42, TRUE, 7);
SpawnPlayer(
LegoGameState::e_unk42,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
}
else {
VTable0xe8(LegoGameState::e_unk49, TRUE, 7);
SpawnPlayer(
LegoGameState::e_unk49,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
}
m_state->SetUnknown8(2);
@@ -295,10 +313,18 @@ MxU32 Helicopter::VTable0xd8(LegoEndAnimNotificationParam& p_param)
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0);
VTable0xe8(LegoGameState::e_unk41, TRUE, 7);
SpawnPlayer(
LegoGameState::e_unk41,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
}
else {
VTable0xe8(LegoGameState::e_unk48, TRUE, 7);
SpawnPlayer(
LegoGameState::e_unk48,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
}
m_state->SetUnknown8(0);

View File

@@ -1,14 +1,17 @@
#include "islepathactor.h"
#include "3dmanager/lego3dmanager.h"
#include "isle_actions.h"
#include "jukebox_actions.h"
#include "legoanimationmanager.h"
#include "legonavcontroller.h"
#include "legopathboundary.h"
#include "legoutils.h"
#include "legovehiclebuildstate.h"
#include "legovideomanager.h"
#include "legoworld.h"
#include "misc.h"
#include "mxbackgroundaudiomanager.h"
#include "mxnotificationparam.h"
#include "scripts.h"
@@ -16,7 +19,7 @@ DECOMP_SIZE_ASSERT(IslePathActor, 0x160)
DECOMP_SIZE_ASSERT(IslePathActor::SpawnLocation, 0x38)
// GLOBAL: LEGO1 0x10102b28
IslePathActor::SpawnLocation g_spawnLocations[29];
IslePathActor::SpawnLocation g_spawnLocations[IslePathActor::c_LOCATIONS_NUM];
// FUNCTION: LEGO1 0x1001a200
IslePathActor::IslePathActor()
@@ -452,11 +455,101 @@ void IslePathActor::RegisterSpawnLocations()
);
}
// STUB: LEGO1 0x1001b2a0
// FUNCTION: LEGO1 0x1001b2a0
// FUNCTION: BETA10 0x100369c6
void IslePathActor::VTable0xe8(LegoGameState::Area, MxBool, MxU8)
void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p_flags)
{
// TODO
MxS16 i;
for (i = 0; i < c_LOCATIONS_NUM && g_spawnLocations[i].m_area != p_area; i++) {
}
assert(i != c_LOCATIONS_NUM);
if (i != c_LOCATIONS_NUM) {
LegoWorld* world = FindWorld(*g_spawnLocations[i].m_script, g_spawnLocations[i].m_entityId);
assert(world);
if (m_world != NULL) {
m_world->FUN_1001fc80(this);
m_world->Remove(this);
VideoManager()->Get3DManager()->Remove(*m_roi);
}
m_world = world;
if (p_und) {
VTable0xe0();
}
m_world->FUN_1001f720(
this,
g_spawnLocations[i].m_path,
g_spawnLocations[i].m_src,
g_spawnLocations[i].m_srcScale,
g_spawnLocations[i].m_dest,
g_spawnLocations[i].m_destScale
);
if (GameState()->GetActorId() != m_actorId) {
m_world->Add(this);
}
LegoVehicleBuildState* state = NULL;
if (p_flags & c_spawnBit1) {
MxBool und = FALSE;
IsleScript::Script anim;
switch (g_spawnLocations[i].m_unk0x30) {
case 0x00:
case 0x44:
break;
case 0x0a:
state = (LegoVehicleBuildState*) GameState()->GetState("LegoDuneCarBuildState");
anim = IsleScript::c_igs008na_RunAnim;
break;
case 0x18:
state = (LegoVehicleBuildState*) GameState()->GetState("LegoJetskiBuildState");
anim = IsleScript::c_ijs006sn_RunAnim;
break;
case 0x23:
state = (LegoVehicleBuildState*) GameState()->GetState("LegoCopterBuildState");
anim = IsleScript::c_ips002ro_RunAnim;
break;
case 0x34:
state = (LegoVehicleBuildState*) GameState()->GetState("LegoRaceCarBuildState");
anim = IsleScript::c_irt007in_RunAnim;
break;
default:
und = TRUE;
break;
}
if (state != NULL && state->m_unk0x4d && !state->m_unk0x4e) {
if (AnimationManager()->FUN_10060dc0(anim, NULL, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE) ==
SUCCESS) {
state->m_unk0x4e = TRUE;
und = FALSE;
}
}
if (und) {
FUN_1003ecc0(this, 0, g_spawnLocations[i].m_unk0x30, TRUE);
}
}
if (m_cameraFlag) {
FUN_1003eda0();
}
if (p_flags & c_playMusic && g_spawnLocations[i].m_music != JukeboxScript::c_noneJukebox) {
MxDSAction action;
action.SetAtomId(*g_jukeboxScript);
action.SetObjectId(g_spawnLocations[i].m_music);
BackgroundAudioManager()->PlayMusic(action, 5, 4);
}
}
}
// FUNCTION: LEGO1 0x1001b5b0

View File

@@ -9,8 +9,8 @@ LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType)
{
this->m_className = p_classType;
this->m_unk0x4c = 0;
this->m_unk0x4d = 0;
this->m_unk0x4e = 0;
this->m_unk0x4d = FALSE;
this->m_unk0x4e = FALSE;
this->m_placedPartCount = 0;
}

View File

@@ -906,7 +906,11 @@ void LegoGameState::SwitchArea(Area p_area)
AnimationManager()->Resume();
}
CurrentActor()->VTable0xe8(p_area, TRUE, 7);
CurrentActor()->SpawnPlayer(
p_area,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
break;
}
case e_hospital:
@@ -918,7 +922,11 @@ void LegoGameState::SwitchArea(Area p_area)
SetCameraControllerFromIsle();
CurrentActor()->ResetWorldTransform(TRUE);
AnimationManager()->Resume();
CurrentActor()->VTable0xe8(p_area, TRUE, 7);
CurrentActor()->SpawnPlayer(
p_area,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
break;
case e_police:
VideoManager()->SetUnk0x554(TRUE);

View File

@@ -340,7 +340,15 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO
}
}
// STUB: LEGO1 0x1003ecc0
// FUNCTION: BETA10 0x100d4b38
void FUN_1003ecc0(IslePathActor* p_actor, undefined4, undefined4, MxBool)
{
// TODO
}
// FUNCTION: LEGO1 0x1003eda0
// FUNCTION: BETA10 0x100d4bf4
void FUN_1003eda0()
{
Mx3DPointFloat vec;

View File

@@ -272,6 +272,29 @@ done:
return m_cameraController;
}
// FUNCTION: LEGO1 0x1001f720
// FUNCTION: BETA10 0x100da24b
MxResult LegoWorld::FUN_1001f720(
IslePathActor* p_actor,
const char* p_path,
MxS32 p_src,
float p_srcScale,
MxS32 p_dest,
float p_destScale
)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathController* controller;
while (cursor.Next(controller)) {
if (controller->FUN_10045c20(p_actor, p_path, p_src, p_srcScale, p_dest, p_destScale) == SUCCESS) {
return SUCCESS;
}
}
return FAILURE;
}
// STUB: LEGO1 0x1001fa70
undefined4 LegoWorld::FUN_1001fa70(IslePathActor* p_actor)
{

View File

@@ -27,6 +27,20 @@ MxResult LegoPathController::Tickle()
return SUCCESS;
}
// STUB: LEGO1 0x10045c20
// FUNCTION: BETA10 0x100b6d80
MxResult LegoPathController::FUN_10045c20(
LegoPathActor* p_actor,
const char* p_path,
MxS32 p_src,
float p_srcScale,
MxS32 p_dest,
float p_destScale
)
{
return SUCCESS;
}
// STUB: LEGO1 0x10046770
undefined4 LegoPathController::FUN_10046770(LegoPathActor* p_actor)
{

View File

@@ -504,7 +504,11 @@ void Isle::Enable(MxBool p_enable)
if (CurrentActor() != NULL && CurrentActor()->IsA("Jetski")) {
IslePathActor* actor = CurrentActor();
actor->VTable0xe8(LegoGameState::e_unk45, FALSE, 7);
actor->SpawnPlayer(
LegoGameState::e_unk45,
FALSE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
actor->SetState(0);
}
else {
@@ -653,7 +657,11 @@ void Isle::Enable(MxBool p_enable)
}
break;
case 5: {
CurrentActor()->VTable0xe8(LegoGameState::e_jetrace2, FALSE, 7);
CurrentActor()->SpawnPlayer(
LegoGameState::e_jetrace2,
FALSE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
JetskiRaceState* raceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState");
if (raceState->GetUnknown0x28() == 2) {
@@ -681,7 +689,11 @@ void Isle::Enable(MxBool p_enable)
}
case 6: {
GameState()->m_currentArea = LegoGameState::e_carraceExterior;
CurrentActor()->VTable0xe8(LegoGameState::e_unk21, FALSE, 7);
CurrentActor()->SpawnPlayer(
LegoGameState::e_unk21,
FALSE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
CarRaceState* raceState = (CarRaceState*) GameState()->GetState("CarRaceState");
if (raceState->GetUnknown0x28() == 2) {
@@ -726,7 +738,11 @@ void Isle::Enable(MxBool p_enable)
break;
case 11:
m_act1state->m_unk0x018 = 0;
CurrentActor()->VTable0xe8(LegoGameState::e_unk54, TRUE, 7);
CurrentActor()->SpawnPlayer(
LegoGameState::e_unk54,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
GameState()->m_currentArea = LegoGameState::e_unk66;
FUN_1003ef00(TRUE);
m_jukebox->StartAction();
@@ -786,7 +802,11 @@ void Isle::FUN_10032620()
case LegoGameState::e_hospitalExterior:
case LegoGameState::e_unk31:
case LegoGameState::e_policeExterior:
CurrentActor()->VTable0xe8(GameState()->m_currentArea, TRUE, 7);
CurrentActor()->SpawnPlayer(
GameState()->m_currentArea,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
GameState()->m_currentArea = LegoGameState::e_unk66;
break;
}