mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-25 17:34:05 +00:00
Implement most of JetskiRace, add BETA10 annotations (#1149)
* Implement most of `JetskiRace`, add BETA10 annotations * Fix declaration order issue * Clean up FUN_10012de0 * Fix regression * Address review comments * Address another review comment --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
@@ -21,7 +21,7 @@ MxBackgroundAudioManager::MxBackgroundAudioManager()
|
||||
m_unk0xa0 = 0;
|
||||
m_unk0x138 = 0;
|
||||
m_tickleState = MxPresenter::e_idle;
|
||||
m_unk0x140 = 0;
|
||||
m_speed = 0;
|
||||
m_targetVolume = 0;
|
||||
m_unk0x148 = 0;
|
||||
m_enabled = FALSE;
|
||||
@@ -128,8 +128,8 @@ void MxBackgroundAudioManager::FUN_1007ef40()
|
||||
|
||||
volume = m_unk0x138->GetVolume();
|
||||
if (volume < compare) {
|
||||
if (m_unk0x140 + m_unk0x138->GetVolume() <= compare) {
|
||||
compare = m_unk0x140 + m_unk0x138->GetVolume();
|
||||
if (m_speed + m_unk0x138->GetVolume() <= compare) {
|
||||
compare = m_speed + m_unk0x138->GetVolume();
|
||||
}
|
||||
|
||||
m_unk0x138->SetVolume(compare);
|
||||
@@ -150,8 +150,8 @@ void MxBackgroundAudioManager::FUN_1007ef40()
|
||||
DeleteObject(*m_unk0xa0->GetAction());
|
||||
}
|
||||
else {
|
||||
if (m_unk0xa0->GetVolume() - m_unk0x140 > 0) {
|
||||
volume = m_unk0xa0->GetVolume() - m_unk0x140;
|
||||
if (m_unk0xa0->GetVolume() - m_speed > 0) {
|
||||
volume = m_unk0xa0->GetVolume() - m_speed;
|
||||
}
|
||||
else {
|
||||
volume = 0;
|
||||
@@ -178,11 +178,11 @@ void MxBackgroundAudioManager::FadeInOrFadeOut()
|
||||
}
|
||||
|
||||
if (volume < compare) {
|
||||
volume = Min(volume + m_unk0x140, compare);
|
||||
volume = Min(volume + m_speed, compare);
|
||||
m_unk0xa0->SetVolume(volume);
|
||||
}
|
||||
else if (compare < volume) {
|
||||
volume = Max(volume - m_unk0x140, compare);
|
||||
volume = Max(volume - m_speed, compare);
|
||||
m_unk0xa0->SetVolume(volume);
|
||||
}
|
||||
else {
|
||||
@@ -238,12 +238,15 @@ void MxBackgroundAudioManager::StopAction(MxParam& p_param)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007f2f0
|
||||
// FUNCTION: BETA10 0x100e90fc
|
||||
MxResult MxBackgroundAudioManager::PlayMusic(
|
||||
MxDSAction& p_action,
|
||||
undefined4 p_unk0x140,
|
||||
undefined4 p_speed,
|
||||
MxPresenter::TickleState p_tickleState
|
||||
)
|
||||
{
|
||||
assert(p_speed > 0);
|
||||
|
||||
if (!m_enabled) {
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -267,7 +270,7 @@ MxResult MxBackgroundAudioManager::PlayMusic(
|
||||
|
||||
if (result == SUCCESS) {
|
||||
m_tickleState = p_tickleState;
|
||||
m_unk0x140 = p_unk0x140;
|
||||
m_speed = p_speed;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -307,7 +310,7 @@ void MxBackgroundAudioManager::LowerVolume()
|
||||
if (m_tickleState == 0) {
|
||||
m_tickleState = MxPresenter::e_starting;
|
||||
}
|
||||
m_unk0x140 = 20;
|
||||
m_speed = 20;
|
||||
}
|
||||
m_unk0x148++;
|
||||
}
|
||||
@@ -321,7 +324,7 @@ void MxBackgroundAudioManager::RaiseVolume()
|
||||
if (m_tickleState == 0) {
|
||||
m_tickleState = MxPresenter::e_starting;
|
||||
}
|
||||
m_unk0x140 = 10;
|
||||
m_speed = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,7 +345,7 @@ void MxBackgroundAudioManager::Enable(MxBool p_enable)
|
||||
// FUNCTION: BETA10 0x100e95ee
|
||||
undefined4 MxBackgroundAudioManager::FUN_1007f610(
|
||||
MxPresenter* p_unk0x138,
|
||||
MxS32 p_unk0x140,
|
||||
MxS32 p_speed,
|
||||
MxPresenter::TickleState p_tickleState
|
||||
)
|
||||
|
||||
@@ -352,7 +355,7 @@ undefined4 MxBackgroundAudioManager::FUN_1007f610(
|
||||
|
||||
((MxCompositePresenter*) m_unk0x138)->VTable0x60(NULL);
|
||||
|
||||
m_unk0x140 = p_unk0x140;
|
||||
m_speed = p_speed;
|
||||
m_tickleState = p_tickleState;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -63,8 +63,10 @@ LegoGameState* GameState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015770
|
||||
// FUNCTION: BETA10 0x100e4971
|
||||
LegoAnimationManager* AnimationManager()
|
||||
{
|
||||
assert(LegoOmni::GetInstance());
|
||||
return LegoOmni::GetInstance()->GetAnimationManager();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,15 +42,17 @@ LegoWorld::LegoWorld() : m_list0x68(TRUE)
|
||||
m_entityList = NULL;
|
||||
m_cacheSoundList = NULL;
|
||||
m_destroyed = FALSE;
|
||||
m_hideAnimPresenter = NULL;
|
||||
m_hideAnim = NULL;
|
||||
m_worldStarted = FALSE;
|
||||
|
||||
NotificationManager()->Register(this);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1001d670
|
||||
// FUNCTION: BETA10 0x10017530
|
||||
MxBool LegoWorld::VTable0x5c()
|
||||
{
|
||||
// The BETA10 match could also be LegoWorld::Escape(), only the child classes might be able to tell
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -245,6 +247,7 @@ MxLong LegoWorld::Notify(MxParam& p_param)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1001f630
|
||||
// FUNCTION: BETA10 0x100d9fc2
|
||||
LegoCameraController* LegoWorld::VTable0x54()
|
||||
{
|
||||
MxBool success = FALSE;
|
||||
@@ -413,6 +416,7 @@ MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_boundaries, MxS32& p_nu
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10020220
|
||||
// FUNCTION: BETA10 0x100da90b
|
||||
void LegoWorld::Add(MxCore* p_object)
|
||||
{
|
||||
if (p_object && !p_object->IsA("LegoWorld") && !p_object->IsA("LegoWorldPresenter")) {
|
||||
@@ -443,7 +447,8 @@ void LegoWorld::Add(MxCore* p_object)
|
||||
|
||||
m_entityList->Append((LegoEntity*) p_object);
|
||||
}
|
||||
else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") || p_object->IsA("LegoLoopingAnimPresenter")) {
|
||||
else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") ||
|
||||
p_object->IsA("LegoLoopingAnimPresenter")) {
|
||||
MxPresenterListCursor cursor(&m_animPresenters);
|
||||
|
||||
if (cursor.Find((MxPresenter*) p_object)) {
|
||||
@@ -454,7 +459,7 @@ void LegoWorld::Add(MxCore* p_object)
|
||||
m_animPresenters.Append(((MxPresenter*) p_object));
|
||||
|
||||
if (p_object->IsA("LegoHideAnimPresenter")) {
|
||||
m_hideAnimPresenter = (LegoHideAnimPresenter*) p_object;
|
||||
m_hideAnim = (LegoHideAnimPresenter*) p_object;
|
||||
}
|
||||
}
|
||||
else if (p_object->IsA("LegoCacheSound")) {
|
||||
@@ -497,7 +502,8 @@ void LegoWorld::Remove(MxCore* p_object)
|
||||
((MxControlPresenter*) p_object)->VTable0x68(TRUE);
|
||||
}
|
||||
}
|
||||
else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") || p_object->IsA("LegoLoopingAnimPresenter")) {
|
||||
else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") ||
|
||||
p_object->IsA("LegoLoopingAnimPresenter")) {
|
||||
MxPresenterListCursor cursor(&m_animPresenters);
|
||||
|
||||
if (cursor.Find((MxPresenter*) p_object)) {
|
||||
@@ -505,7 +511,7 @@ void LegoWorld::Remove(MxCore* p_object)
|
||||
}
|
||||
|
||||
if (p_object->IsA("LegoHideAnimPresenter")) {
|
||||
m_hideAnimPresenter = NULL;
|
||||
m_hideAnim = NULL;
|
||||
}
|
||||
}
|
||||
else if (p_object->IsA("MxEntity")) {
|
||||
@@ -654,6 +660,7 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10021a70
|
||||
// FUNCTION: BETA10 0x100db758
|
||||
void LegoWorld::Enable(MxBool p_enable)
|
||||
{
|
||||
if (p_enable && !m_set0xd0.empty()) {
|
||||
|
||||
@@ -19,6 +19,7 @@ DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14)
|
||||
extern MxU32 g_isleFlags;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f119c
|
||||
// GLOBAL: BETA10 0x100f119c
|
||||
MxBool g_unk0x100f119c = FALSE;
|
||||
|
||||
// FUNCTION: LEGO1 0x1001b700
|
||||
|
||||
@@ -1,28 +1,154 @@
|
||||
#include "jetskirace.h"
|
||||
|
||||
#include "actions/jetrace_actions.h"
|
||||
#include "actions/jetski_actions.h"
|
||||
#include "actions/jukebox_actions.h"
|
||||
#include "dunebuggy.h"
|
||||
#include "isle.h"
|
||||
#include "legoanimationmanager.h"
|
||||
#include "legocontrolmanager.h"
|
||||
#include "legohideanimpresenter.h"
|
||||
#include "legomain.h"
|
||||
#include "legopathstruct.h"
|
||||
#include "legoracers.h"
|
||||
#include "legoracespecial.h"
|
||||
#include "legoutils.h"
|
||||
#include "misc.h"
|
||||
#include "mxactionnotificationparam.h"
|
||||
#include "mxbackgroundaudiomanager.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxstillpresenter.h"
|
||||
#include "mxtransitionmanager.h"
|
||||
#include "mxvariabletable.h"
|
||||
#include "scripts.h"
|
||||
|
||||
// Defined in legopathstruct.cpp
|
||||
extern MxBool g_unk0x100f119c;
|
||||
|
||||
// Defined in jetski.cpp
|
||||
extern const char* g_varJSFRNTY5;
|
||||
extern const char* g_varJSWNSHY5;
|
||||
|
||||
// Defined in legoracespecial.cpp
|
||||
extern const char* g_raceState;
|
||||
extern const char* g_racing;
|
||||
|
||||
// Defined in legopathactor.cpp
|
||||
extern const char* g_strHIT_WALL_SOUND;
|
||||
|
||||
DECOMP_SIZE_ASSERT(JetskiRace, 0x144)
|
||||
|
||||
// STUB: LEGO1 0x100162c0
|
||||
// FUNCTION: LEGO1 0x100162c0
|
||||
// FUNCTION: BETA10 0x100c7e6f
|
||||
MxResult JetskiRace::Create(MxDSAction& p_dsAction)
|
||||
{
|
||||
return SUCCESS;
|
||||
MxResult result = LegoRace::Create(p_dsAction);
|
||||
|
||||
GameState()->m_currentArea = LegoGameState::e_jetrace;
|
||||
GameState()->StopArea(LegoGameState::e_undefined);
|
||||
LegoGameState* gameState = GameState();
|
||||
RaceState* jetskiRaceState = (RaceState*) gameState->GetState("JetskiRaceState");
|
||||
|
||||
if (!jetskiRaceState) {
|
||||
jetskiRaceState = (RaceState*) gameState->CreateState("JetskiRaceState");
|
||||
}
|
||||
|
||||
m_raceState = jetskiRaceState;
|
||||
|
||||
if (!jetskiRaceState) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_raceState->m_unk0x28 = 1;
|
||||
m_unk0x130.SetLeft(397);
|
||||
m_unk0x130.SetTop(317);
|
||||
m_unk0x130.SetRight(543);
|
||||
m_unk0x130.SetBottom(333);
|
||||
LegoRaceCar::FUN_10013670();
|
||||
InvokeAction(
|
||||
Extra::e_start,
|
||||
m_atomId,
|
||||
DuneBuggy::GetColorOffset(g_varJSFRNTY5) + (DuneBuggy::GetColorOffset(g_varJSWNSHY5) * 5 + 0xf) * 2,
|
||||
NULL
|
||||
);
|
||||
InvokeAction(Extra::e_start, m_atomId, JetraceScript::c_JetskiDashboard, NULL);
|
||||
g_unk0x100f119c = TRUE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100163b0
|
||||
// FUNCTION: LEGO1 0x100163b0
|
||||
// FUNCTION: BETA10 0x100c7f10
|
||||
void JetskiRace::ReadyWorld()
|
||||
{
|
||||
assert(m_hideAnim);
|
||||
LegoWorld::ReadyWorld();
|
||||
m_hideAnim->FUN_1006db40(0);
|
||||
|
||||
MxDSAction action;
|
||||
action.SetAtomId(*g_jukeboxScript);
|
||||
action.SetObjectId(JukeboxScript::c_JetskiRace_Music);
|
||||
BackgroundAudioManager()->PlayMusic(action, 5, MxPresenter::e_repeating);
|
||||
|
||||
AnimationManager()->Resume();
|
||||
|
||||
m_unk0x128 = (MxStillPresenter*) Find("MxPresenter", "JetskiLocator2");
|
||||
m_unk0x128->SetPosition(m_unk0x130.GetLeft(), m_unk0x130.GetTop());
|
||||
m_unk0x12c = (MxStillPresenter*) Find("MxPresenter", "JetskiLocator3");
|
||||
m_unk0x12c->SetPosition(m_unk0x130.GetLeft(), m_unk0x130.GetTop());
|
||||
|
||||
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
||||
|
||||
VariableTable()->SetVariable("DISTANCE", "0.036");
|
||||
|
||||
InvokeAction(Extra::e_start, *g_jetraceScript, JetraceScript::c_AirHorn_PlayWav, NULL);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10016520
|
||||
MxLong JetskiRace::HandleEndAction(MxEndActionNotificationParam&)
|
||||
// FUNCTION: LEGO1 0x10016520
|
||||
MxLong JetskiRace::HandleEndAction(MxEndActionNotificationParam& p_param)
|
||||
{
|
||||
return 0;
|
||||
MxLong result = 0;
|
||||
|
||||
if ((p_param.GetAction()) && (p_param.GetAction()->GetObjectId() == JetraceScript::c_AirHorn_PlayWav)) {
|
||||
m_unk0x110[0]->Mute(FALSE);
|
||||
m_unk0x110[1]->Mute(FALSE);
|
||||
m_unk0x110[2]->Mute(FALSE);
|
||||
|
||||
VariableTable()->SetVariable(g_raceState, g_racing);
|
||||
result = 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100165a0
|
||||
MxLong JetskiRace::HandleClick(LegoEventNotificationParam&)
|
||||
// FUNCTION: LEGO1 0x100165a0
|
||||
MxLong JetskiRace::HandleClick(LegoEventNotificationParam& p_param)
|
||||
{
|
||||
return 0;
|
||||
MxLong result = 0;
|
||||
if (((LegoControlManagerNotificationParam*) &p_param)->m_unk0x28 == 1) {
|
||||
switch (((LegoControlManagerNotificationParam*) &p_param)->m_clickedObjectId) {
|
||||
case JetraceScript::c_JetskiArms_Ctl:
|
||||
m_act1State->m_unk0x018 = 0;
|
||||
VariableTable()->SetVariable(g_raceState, "");
|
||||
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
|
||||
LegoRaceCar::FUN_10012de0();
|
||||
m_destLocation = LegoGameState::e_jetraceExterior;
|
||||
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
||||
break;
|
||||
case JetraceScript::c_JetskiInfo_Ctl:
|
||||
m_act1State->m_unk0x018 = 0;
|
||||
VariableTable()->SetVariable(g_raceState, "");
|
||||
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
|
||||
LegoRaceCar::FUN_10012de0();
|
||||
m_destLocation = LegoGameState::e_infomain;
|
||||
result = 1;
|
||||
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100166a0
|
||||
@@ -31,8 +157,15 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam&)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10016a10
|
||||
// FUNCTION: LEGO1 0x10016a10
|
||||
MxBool JetskiRace::Escape()
|
||||
{
|
||||
AnimationManager()->FUN_10061010(FALSE);
|
||||
DeleteObjects(&m_atomId, 500, 999);
|
||||
m_act1State->m_unk0x018 = 0;
|
||||
VariableTable()->SetVariable(g_raceState, "");
|
||||
VariableTable()->SetVariable(g_strHIT_WALL_SOUND, "");
|
||||
m_destLocation = LegoGameState::e_infomain;
|
||||
LegoRaceCar::FUN_10012de0();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@ LegoRace::LegoRace()
|
||||
m_unk0x104 = 0;
|
||||
m_unk0x108 = 0;
|
||||
m_unk0x10c = 0;
|
||||
m_unk0x140 = 0;
|
||||
m_unk0x110 = 0;
|
||||
m_unk0x114 = 0;
|
||||
m_unk0x118 = 0;
|
||||
m_raceState = NULL;
|
||||
m_unk0x110[0] = NULL;
|
||||
m_unk0x110[1] = NULL;
|
||||
m_unk0x110[2] = NULL;
|
||||
m_unk0x128 = 0;
|
||||
m_unk0x12c = 0;
|
||||
m_pathActor = 0;
|
||||
@@ -54,6 +54,7 @@ MxBool LegoRace::Escape()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015ce0
|
||||
// FUNCTION: BETA10 0x100c7a71
|
||||
MxResult LegoRace::Create(MxDSAction& p_dsAction)
|
||||
{
|
||||
MxResult result = LegoWorld::Create(p_dsAction);
|
||||
@@ -150,6 +151,7 @@ RaceState::RaceState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10016140
|
||||
// FUNCTION: BETA10 0x100c7d9f
|
||||
MxResult RaceState::Serialize(LegoFile* p_file)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
|
||||
@@ -21,6 +21,12 @@ DECOMP_SIZE_ASSERT(EdgeReference, 0x08)
|
||||
DECOMP_SIZE_ASSERT(SkeletonKickPhase, 0x10)
|
||||
DECOMP_SIZE_ASSERT(LegoRaceCar, 0x200)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0bac
|
||||
static undefined4 g_unk0x100f0bac = 0;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0bb0
|
||||
static undefined4 g_unk0x100f0bb0 = 0;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0a20
|
||||
// GLOBAL: BETA10 0x101f5e34
|
||||
EdgeReference LegoRaceCar::g_skBMap[] = {
|
||||
@@ -166,6 +172,14 @@ MxLong LegoRaceCar::Notify(MxParam& p_param)
|
||||
return LegoRaceMap::Notify(p_param);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012de0
|
||||
void LegoRaceCar::FUN_10012de0()
|
||||
{
|
||||
g_unk0x100f0b8c = TRUE;
|
||||
g_timeLastSoundPlayed = 0;
|
||||
g_unk0x100f0b88 = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012e60
|
||||
// FUNCTION: BETA10 0x100cb191
|
||||
void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed)
|
||||
@@ -513,6 +527,16 @@ MxResult LegoRaceCar::VTable0x9c()
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10013670
|
||||
void LegoRaceCar::FUN_10013670()
|
||||
{
|
||||
g_unk0x100f0bac = (rand() & 0xc) >> 2;
|
||||
|
||||
// Inlining the `rand()` causes this function to mismatch
|
||||
MxU32 uVar1 = rand();
|
||||
g_unk0x100f0bb0 = uVar1 % 0xc >> 2;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10014500
|
||||
// FUNCTION: BETA10 0x100cd5e0
|
||||
MxU32 LegoRaceCar::VTable0x6c(
|
||||
|
||||
Reference in New Issue
Block a user