Implement/match Bike (#1036)

This commit is contained in:
Christian Semmler 2024-06-16 09:54:40 -04:00 committed by GitHub
parent d869d565c2
commit 68023379d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 72 additions and 14 deletions

View file

@ -28,7 +28,7 @@ class Bike : public IslePathActor {
MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4
void Exit() override; // vtable+0xe4
void FUN_10076b60();
void ActivateSceneActions();
// SYNTHETIC: LEGO1 0x10076880
// Bike::`scalar deleting destructor'

View file

@ -1,11 +1,16 @@
#include "bike.h"
#include "isle.h"
#include "isle_actions.h"
#include "jukebox_actions.h"
#include "legoanimationmanager.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoutils.h"
#include "legoworld.h"
#include "misc.h"
#include "mxsoundpresenter.h"
#include "mxtransitionmanager.h"
#include "scripts.h"
DECOMP_SIZE_ASSERT(Bike, 0x164)
@ -13,9 +18,9 @@ DECOMP_SIZE_ASSERT(Bike, 0x164)
// FUNCTION: LEGO1 0x10076670
Bike::Bike()
{
this->m_maxLinearVel = 20.0;
this->m_unk0x150 = 3.0;
this->m_unk0x148 = 1;
m_maxLinearVel = 20.0;
m_unk0x150 = 3.0;
m_unk0x148 = 1;
}
// FUNCTION: LEGO1 0x100768f0
@ -44,22 +49,75 @@ void Bike::Exit()
ControlManager()->Unregister(this);
}
// STUB: LEGO1 0x100769a0
// FUNCTION: LEGO1 0x100769a0
MxLong Bike::HandleClick()
{
// TODO
return 0;
if (FUN_1003ef60()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
FUN_10015820(TRUE, 0);
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_bike);
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE);
if (GameState()->GetActorId() != UserActor()->GetActorId()) {
((IslePathActor*) UserActor())->Exit();
}
Enter();
InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_BikeDashboard, NULL);
GetCurrentAction().SetObjectId(-1);
Vector3 position = m_roi->GetWorldPosition();
AnimationManager()->FUN_10064670(&position);
AnimationManager()->FUN_10064740(&position);
ControlManager()->Register(this);
}
return 1;
}
// STUB: LEGO1 0x10076aa0
// FUNCTION: LEGO1 0x10076aa0
MxLong Bike::HandleControl(LegoControlManagerEvent& p_param)
{
// TODO
return 0;
MxLong result = 0;
if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
case IsleScript::c_BikeArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
result = 1;
break;
case IsleScript::c_BikeInfo_Ctl:
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
Exit();
result = 1;
break;
case IsleScript::c_BikeHorn_Ctl:
MxSoundPresenter* presenter =
(MxSoundPresenter*) CurrentWorld()->Find("MxSoundPresenter", "BikeHorn_Sound");
presenter->Enable(p_param.GetUnknown0x28());
break;
}
}
return result;
}
// STUB: LEGO1 0x10076b60
void Bike::FUN_10076b60()
// FUNCTION: LEGO1 0x10076b60
void Bike::ActivateSceneActions()
{
// TODO
PlayMusic(JukeboxScript::c_InformationCenter_Music);
Act1State* act1state = (Act1State*) GameState()->GetState("Act1State");
if (!act1state->m_unk0x022) {
act1state->m_unk0x022 = TRUE;
MxMatrix mat(UserActor()->GetROI()->GetLocal2World());
mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.7, mat[2][2] * 2.5);
AnimationManager()
->FUN_10060dc0(IsleScript::c_sns006in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE);
}
}

View file

@ -990,7 +990,7 @@ MxLong Isle::HandleTransitionEnd()
FUN_10032d30(IsleScript::c_BikeDashboard_Bitmap, JukeboxScript::c_MusicTheme1, NULL, TRUE);
if (!m_act1state->m_unk0x01f) {
m_bike->FUN_10076b60();
m_bike->ActivateSceneActions();
}
break;
case LegoGameState::e_dunecar: