Implement/match Isle::Enable (#681)

* Implement/match Isle::Enable

* Fix order
This commit is contained in:
Christian Semmler
2024-03-16 14:20:44 -04:00
committed by GitHub
parent 70e8796af3
commit 0a4db65b24
24 changed files with 553 additions and 91 deletions

View File

@@ -267,6 +267,12 @@ MxBool Act1State::SetFlag()
return TRUE;
}
// STUB: LEGO1 0x10034b60
void Act1State::FUN_10034b60()
{
// TODO
}
// STUB: LEGO1 0x10034d00
void Act1State::FUN_10034d00()
{

View File

@@ -60,6 +60,12 @@ MxU32 Ambulance::VTable0xcc()
return 0;
}
// STUB: LEGO1 0x10036e60
void Ambulance::FUN_10036e60()
{
// TODO
}
// STUB: LEGO1 0x10036e90
void Ambulance::VTable0xe4()
{

View File

@@ -114,7 +114,7 @@ MxU32 Helicopter::VTable0xcc()
m_script = *g_isleScript;
AnimationManager()->FUN_10064670(FALSE);
VTable0xe8(0x29, TRUE, 7);
((Isle*) CurrentWorld())->SetUnknown13c(0x3c);
((Isle*) CurrentWorld())->SetUnknown13c(LegoGameState::e_unk60);
FUN_10015820(TRUE, 0);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, TRUE);
SetUnknownDC(4);
@@ -229,7 +229,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
break;
case 0x1c:
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
((Isle*) CurrentWorld())->SetUnknown13c(2);
((Isle*) CurrentWorld())->SetUnknown13c(LegoGameState::e_infomain);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
VTable0xe4();
}

View File

@@ -36,7 +36,7 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param)
CurrentActor()->VTable0xe4();
}
((Isle*) FindWorld(*g_isleScript, 0))->SetUnknown13c(0x35);
((Isle*) FindWorld(*g_isleScript, 0))->SetUnknown13c(LegoGameState::e_jukeboxw);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
return 1;
}

View File

@@ -69,3 +69,9 @@ MxU32 TowTrack::VTable0xd4(LegoControlManagerEvent& p_param)
// TODO
return 0;
}
// STUB: LEGO1 0x1004dab0
void TowTrack::FUN_1004dab0()
{
// TODO
}

View File

@@ -63,6 +63,12 @@ void LegoAnimationManager::FUN_1005f6d0(MxBool)
// TODO
}
// STUB: LEGO1 0x1005f700
void LegoAnimationManager::FUN_1005f700(MxBool)
{
// TODO
}
// FUNCTION: LEGO1 0x1005f720
MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex)
{
@@ -338,6 +344,14 @@ void LegoAnimationManager::FUN_100603c0()
// TODO
}
// STUB: LEGO1 0x10060dc0
undefined4 LegoAnimationManager::
FUN_10060dc0(undefined4, undefined4, undefined, undefined, undefined4, undefined, undefined, undefined, undefined)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10061010
void LegoAnimationManager::FUN_10061010(undefined4)
{
@@ -371,8 +385,20 @@ MxS8 LegoAnimationManager::FUN_10062360(char*)
return 0;
}
// STUB: LEGO1 0x100629b0
void LegoAnimationManager::FUN_100629b0(MxU32, MxBool)
{
// TODO
}
// STUB: LEGO1 0x10064670
void LegoAnimationManager::FUN_10064670(MxBool)
{
// TODO
}
// STUB: LEGO1 0x10064740
void LegoAnimationManager::FUN_10064740(MxBool)
{
// TODO
}

View File

@@ -64,7 +64,7 @@ MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_enti
void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender);
// FUNCTION: LEGO1 0x1003e430
void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender)
void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, MxS32 p_targetEntityId, LegoEntity* p_sender)
{
MxDSAction action;
action.SetAtomId(p_pAtom);

View File

@@ -90,7 +90,7 @@ Mx3DPointFloat LegoCameraController::GetWorldUp()
{
if (m_lego3DView && m_lego3DView->GetPointOfView()) {
Mx3DPointFloat vec;
vec = m_lego3DView->GetPointOfView()->GetWorldUp();
vec = Vector3(m_lego3DView->GetPointOfView()->GetWorldUp());
return Mx3DPointFloat(vec[0], vec[1], vec[2]);
}
else {
@@ -103,7 +103,7 @@ Mx3DPointFloat LegoCameraController::GetWorldLocation()
{
if (m_lego3DView && m_lego3DView->GetPointOfView()) {
Mx3DPointFloat vec;
vec = m_lego3DView->GetPointOfView()->GetWorldPosition();
vec = Vector3(m_lego3DView->GetPointOfView()->GetWorldPosition());
return Mx3DPointFloat(vec[0], vec[1] - m_entityOffsetUp, vec[2]);
}
else {
@@ -116,7 +116,7 @@ Mx3DPointFloat LegoCameraController::GetWorldDirection()
{
if (m_lego3DView && m_lego3DView->GetPointOfView()) {
Mx3DPointFloat vec;
vec = m_lego3DView->GetPointOfView()->GetWorldDirection();
vec = Vector3(m_lego3DView->GetPointOfView()->GetWorldDirection());
return Mx3DPointFloat(vec[0], vec[1], vec[2]);
}
else {

View File

@@ -266,6 +266,13 @@ done:
return m_cameraController;
}
// STUB: LEGO1 0x1001fa70
undefined4 LegoWorld::FUN_1001fa70(IslePathActor* p_actor)
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x1001fc80
void LegoWorld::FUN_1001fc80(IslePathActor* p_actor)
{

View File

@@ -383,6 +383,20 @@ MxResult LegoVideoManager::RealizePalette(MxPalette* p_pallete)
return SUCCESS;
}
// FUNCTION: LEGO1 0x1007c2d0
MxResult LegoVideoManager::ResetPalette(MxBool p_ignoreSkyColor)
{
MxResult result = FAILURE;
if (m_videoParam.GetPalette() != NULL) {
m_videoParam.GetPalette()->Reset(p_ignoreSkyColor);
m_displaySurface->SetPalette(m_videoParam.GetPalette());
result = SUCCESS;
}
return result;
}
// FUNCTION: LEGO1 0x1007c300
void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable)
{

View File

@@ -2,21 +2,36 @@
#include "act1state.h"
#include "ambulance.h"
#include "bike.h"
#include "carracestate.h"
#include "dunebuggy.h"
#include "helicopter.h"
#include "islepathactor.h"
#include "jetski.h"
#include "jetskiracestate.h"
#include "jukeboxentity.h"
#include "legoanimationmanager.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "legoutils.h"
#include "legovideomanager.h"
#include "misc.h"
#include "motocycle.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
#include "pizza.h"
#include "skateboard.h"
#include "towtrack.h"
#include <vec.h>
DECOMP_SIZE_ASSERT(Isle, 0x140);
// GLOBAL: LEGO1 0x100f1198
undefined4 g_unk0x100f1198 = 0x7f;
// FUNCTION: LEGO1 0x10030820
Isle::Isle()
{
@@ -33,7 +48,7 @@ Isle::Isle()
m_racecar = NULL;
m_jetski = NULL;
m_act1state = 0;
m_unk0x13c = 0;
m_unk0x13c = LegoGameState::e_undefined;
NotificationManager()->Register(this);
}
@@ -74,7 +89,7 @@ MxResult Isle::Create(MxDSAction& p_dsAction)
GameState()->StopArea(LegoGameState::e_act2main); // Looks like a bug
break;
case LegoGameState::e_actNotFound:
m_unk0x13c = 2;
m_unk0x13c = LegoGameState::e_infomain;
}
if (GameState()->GetCurrentArea() == LegoGameState::e_isle) {
@@ -184,7 +199,7 @@ MxLong Isle::HandleType19Notification(MxParam& p_param)
return 0;
}
// STUB: LEGO1 0x10031820
// FUNCTION: LEGO1 0x10031820
void Isle::Enable(MxBool p_enable)
{
if (m_set0xd0.empty() == p_enable) {
@@ -195,12 +210,329 @@ void Isle::Enable(MxBool p_enable)
m_radio.Initialize(p_enable);
if (p_enable) {
// TODO
FUN_100330e0();
VideoManager()->ResetPalette(FALSE);
m_act1state->FUN_10034d00();
if (CurrentActor() != NULL && CurrentActor()->GetActorId() != 0) {
// TODO: Match, most likely an inline function
MxS32 targetEntityId = (CurrentActor()->GetActorId() == 1) + 250;
if (targetEntityId != -1) {
InvokeAction(Extra::e_start, *g_isleScript, targetEntityId, NULL);
}
}
InputManager()->SetWorld(this);
GameState()->StopArea(LegoGameState::e_previousArea);
GameState()->m_previousArea = GameState()->m_currentArea;
FUN_1003ef00(TRUE);
if (m_act1state->m_unk0x018 == 0) {
MxU32 und[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
for (MxU32 i = 0; i < 5; i++) {
MxS32 und2 = rand() % 5;
for (MxU32 j = 0; j < _countof(und); j++) {
if (und[j] != 0 && und2-- == 0) {
AnimationManager()->FUN_100629b0(und[j], TRUE);
und[j] = 0;
break;
}
}
}
}
if (CurrentActor() != NULL && CurrentActor()->IsA("Jetski")) {
IslePathActor* actor = CurrentActor();
actor->VTable0xe8(0x2d, FALSE, 7);
actor->SetUnknownDC(0);
}
else {
FUN_10032620();
}
switch (GameState()->m_currentArea) {
case LegoGameState::e_elevride:
m_unk0x13c = LegoGameState::e_elevride;
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationTransitioned, NULL);
NotificationManager()->Send(this, &param);
}
#else
NotificationManager()->Send(this, &MxNotificationParam(c_notificationTransitioned, NULL));
#endif
SetIsWorldActive(FALSE);
break;
case LegoGameState::e_jetrace2:
if (((JetskiRaceState*) GameState()->GetState("JetskiRaceState"))->GetUnknown0x28() == 2) {
m_act1state->m_unk0x018 = 5;
}
FUN_1001fa70(CurrentActor());
SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE
{
LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0);
m_jetski->Notify(param);
}
#else
m_jetski->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0));
#endif
break;
case LegoGameState::e_garadoor:
m_unk0x13c = LegoGameState::e_garadoor;
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationTransitioned, NULL);
NotificationManager()->Send(this, &param);
}
#else
NotificationManager()->Send(this, &MxNotificationParam(c_notificationTransitioned, NULL));
#endif
SetIsWorldActive(FALSE);
break;
case LegoGameState::e_polidoor:
m_unk0x13c = LegoGameState::e_polidoor;
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationTransitioned, NULL);
NotificationManager()->Send(this, &param);
}
#else
NotificationManager()->Send(this, &MxNotificationParam(c_notificationTransitioned, NULL));
#endif
SetIsWorldActive(FALSE);
break;
case LegoGameState::e_unk57:
FUN_1001fa70(CurrentActor());
SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE
{
LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0);
m_bike->Notify(param);
}
#else
m_bike->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0));
#endif
break;
case LegoGameState::e_unk58:
FUN_1001fa70(CurrentActor());
SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE
{
LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0);
m_dunebuggy->Notify(param);
}
#else
m_dunebuggy->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0));
#endif
break;
case LegoGameState::e_unk59:
FUN_1001fa70(CurrentActor());
SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE
{
LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0);
m_motocycle->Notify(param);
}
#else
m_motocycle->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0));
#endif
break;
case LegoGameState::e_unk60:
FUN_1001fa70(CurrentActor());
SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE
{
LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0);
m_helicopter->Notify(param);
}
#else
m_helicopter->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0));
#endif
break;
case LegoGameState::e_unk61:
FUN_1001fa70(CurrentActor());
SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE
{
LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0);
m_skateboard->Notify(param);
}
#else
m_skateboard->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0));
#endif
break;
case LegoGameState::e_unk64:
FUN_1001fa70(CurrentActor());
SetIsWorldActive(TRUE);
#ifdef COMPAT_MODE
{
LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0);
m_jetski->Notify(param);
}
#else
m_jetski->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0));
#endif
break;
default:
InputManager()->SetCamera(m_cameraController);
SetIsWorldActive(TRUE);
break;
}
switch (m_act1state->m_unk0x018) {
case 0:
case 1:
m_act1state->m_unk0x018 = 0;
if (GameState()->m_currentArea == LegoGameState::e_pizzeriaExterior) {
AnimationManager()->FUN_10064740(FALSE);
}
else if (GameState()->m_currentArea == LegoGameState::e_unk66) {
Mx3DPointFloat position(CurrentActor()->GetROI()->GetWorldPosition());
Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f);
sub.Sub(&position);
if (NORMSQRD3(sub) < 1024.0f) {
AnimationManager()->FUN_10064740(FALSE);
}
Mx3DPointFloat sub2(98.874992f, 0.0f, -46.156292f);
sub2.Sub(&position);
if (NORMSQRD3(sub2) < 1024.0f) {
AnimationManager()->FUN_10064670(FALSE);
}
}
break;
case 5: {
CurrentActor()->VTable0xe8(0xf, FALSE, 7);
JetskiRaceState* raceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState");
if (raceState->GetUnknown0x28() == 2) {
undefined4 und = -1;
switch (raceState->GetState(GameState()->GetActorId())->GetUnknown0x02()) {
case 1:
und = 0x35e;
break;
case 2:
und = 0x35d;
break;
case 3:
und = 0x35c;
break;
}
AnimationManager()->FUN_10060dc0(und, 0, 1, 1, 0, 0, 0, 1, 0);
}
m_act1state->m_unk0x018 = 0;
FUN_1003ef00(FALSE);
AnimationManager()->FUN_10064670(FALSE);
break;
}
case 6: {
GameState()->m_currentArea = LegoGameState::e_carraceExterior;
CurrentActor()->VTable0xe8(0x15, FALSE, 7);
CarRaceState* raceState = (CarRaceState*) GameState()->GetState("CarRaceState");
if (raceState->GetUnknown0x28() == 2) {
undefined4 und = -1;
switch (raceState->GetState(GameState()->GetActorId())->GetUnknown0x02()) {
case 1:
und = 0x362;
break;
case 2:
und = 0x361;
break;
case 3:
und = 0x360;
break;
}
AnimationManager()->FUN_10060dc0(und, 0, 1, 1, 0, 0, 0, 1, 0);
}
m_act1state->m_unk0x018 = 0;
FUN_1003ef00(TRUE);
break;
}
case 7:
m_act1state->m_unk0x018 = 8;
AnimationManager()->FUN_1005f6d0(FALSE);
AnimationManager()->FUN_1005f700(FALSE);
g_unk0x100f1198 &= ~c_bit7;
m_towtrack->FUN_1004dab0();
break;
case 9:
m_act1state->m_unk0x018 = 10;
AnimationManager()->FUN_1005f6d0(FALSE);
AnimationManager()->FUN_1005f700(FALSE);
g_unk0x100f1198 &= ~c_bit7;
m_ambulance->FUN_10036e60();
break;
case 11:
m_act1state->m_unk0x018 = 0;
CurrentActor()->VTable0xe8(0x36, TRUE, 7);
GameState()->m_currentArea = LegoGameState::e_unk66;
FUN_1003ef00(TRUE);
m_jukebox->StartAction();
break;
}
SetAppCursor(0);
if (m_act1state->m_unk0x018 != 8 &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_elevride) &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_polidoor) &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_garadoor) &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_unk57) &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_unk58) &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_unk59) &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_unk60) &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_unk64) &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_unk61) &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_jetrace2)) {
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
SetROIUnknown0x0c("stretch", 0);
SetROIUnknown0x0c("bird", 0);
SetROIUnknown0x0c("rcred", 0);
SetROIUnknown0x0c("towtk", 0);
SetROIUnknown0x0c("pizpie", 0);
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
m_act1state->FUN_10034b60();
}
}
@@ -278,6 +610,12 @@ void Isle::VTable0x6c(IslePathActor* p_actor)
}
}
// STUB: LEGO1 0x100330e0
void Isle::FUN_100330e0()
{
// TODO
}
// STUB: LEGO1 0x10033180
MxBool Isle::VTable0x64()
{