2024-01-24 21:16:29 -05:00
|
|
|
#include "skateboard.h"
|
2023-10-07 11:30:04 -04:00
|
|
|
|
2023-09-10 08:01:39 -04:00
|
|
|
#include "decomp.h"
|
2024-05-01 07:36:58 -04:00
|
|
|
#include "isle.h"
|
2024-04-28 07:23:29 -04:00
|
|
|
#include "isle_actions.h"
|
2024-05-01 07:36:58 -04:00
|
|
|
#include "jukebox_actions.h"
|
|
|
|
#include "legoanimationmanager.h"
|
2024-05-03 12:19:12 -04:00
|
|
|
#include "legocontrolmanager.h"
|
2024-04-28 07:23:29 -04:00
|
|
|
#include "legoutils.h"
|
|
|
|
#include "misc.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "mxmisc.h"
|
2023-10-24 19:38:27 -04:00
|
|
|
#include "mxnotificationmanager.h"
|
2024-05-01 07:36:58 -04:00
|
|
|
#include "mxstillpresenter.h"
|
|
|
|
#include "mxtransitionmanager.h"
|
2024-04-28 07:23:29 -04:00
|
|
|
#include "pizza.h"
|
2024-05-04 08:06:32 -04:00
|
|
|
#include "scripts.h"
|
2023-09-10 08:01:39 -04:00
|
|
|
|
2024-03-22 21:30:58 -04:00
|
|
|
DECOMP_SIZE_ASSERT(SkateBoard, 0x168)
|
2023-09-10 08:01:39 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1000fd40
|
2023-06-29 04:10:08 -04:00
|
|
|
SkateBoard::SkateBoard()
|
|
|
|
{
|
2024-05-01 07:36:58 -04:00
|
|
|
m_unk0x160 = FALSE;
|
2024-06-06 11:45:37 -04:00
|
|
|
m_maxLinearVel = 15.0;
|
2024-04-28 07:23:29 -04:00
|
|
|
m_unk0x150 = 3.5;
|
|
|
|
m_unk0x148 = 1;
|
2023-09-10 08:01:39 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
NotificationManager()->Register(this);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
|
2024-04-28 07:23:29 -04:00
|
|
|
// FUNCTION: LEGO1 0x1000ff80
|
|
|
|
SkateBoard::~SkateBoard()
|
|
|
|
{
|
|
|
|
ControlManager()->Unregister(this);
|
|
|
|
NotificationManager()->Unregister(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10010000
|
2024-01-20 18:04:46 -05:00
|
|
|
MxResult SkateBoard::Create(MxDSAction& p_dsAction)
|
|
|
|
{
|
2024-04-28 07:23:29 -04:00
|
|
|
MxResult result = IslePathActor::Create(p_dsAction);
|
|
|
|
|
|
|
|
if (result == SUCCESS) {
|
|
|
|
m_world = CurrentWorld();
|
|
|
|
m_world->Add(this);
|
2024-05-01 07:49:47 -04:00
|
|
|
|
|
|
|
Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor);
|
|
|
|
if (pizza) {
|
|
|
|
pizza->SetSkateboard(this);
|
2024-04-28 07:23:29 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-04-28 07:23:29 -04:00
|
|
|
// FUNCTION: LEGO1 0x10010050
|
2024-06-06 11:45:37 -04:00
|
|
|
void SkateBoard::Exit()
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-05-01 07:36:58 -04:00
|
|
|
if (m_act1state->m_unk0x018 == 3) {
|
2024-04-28 07:23:29 -04:00
|
|
|
Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor);
|
|
|
|
pizza->FUN_10038380();
|
|
|
|
pizza->FUN_100382b0();
|
2024-05-01 07:36:58 -04:00
|
|
|
m_unk0x160 = FALSE;
|
2024-04-28 07:23:29 -04:00
|
|
|
}
|
2024-05-01 07:36:58 -04:00
|
|
|
|
2024-06-06 11:45:37 -04:00
|
|
|
IslePathActor::Exit();
|
2024-04-28 07:23:29 -04:00
|
|
|
GameState()->m_currentArea = LegoGameState::Area::e_skateboard;
|
|
|
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkateArms_Ctl);
|
|
|
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkatePizza_Bitmap);
|
|
|
|
ControlManager()->Unregister(this);
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-05-01 07:36:58 -04:00
|
|
|
// FUNCTION: LEGO1 0x100100e0
|
2024-05-30 09:54:24 -04:00
|
|
|
MxU32 SkateBoard::HandleClick()
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-05-01 07:36:58 -04:00
|
|
|
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
|
|
|
|
|
|
|
|
if (!FUN_1003ef60() && state->m_unk0x018 != 3) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
FUN_10015820(TRUE, 0);
|
|
|
|
|
|
|
|
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_skateboard);
|
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE);
|
|
|
|
|
|
|
|
if (GameState()->GetActorId() != CurrentActor()->GetActorId()) {
|
|
|
|
if (!CurrentActor()->IsA("SkateBoard")) {
|
2024-06-06 11:45:37 -04:00
|
|
|
((IslePathActor*) CurrentActor())->Exit();
|
2024-05-01 07:36:58 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!CurrentActor()->IsA("SkateBoard")) {
|
2024-06-06 11:45:37 -04:00
|
|
|
Enter();
|
2024-05-01 07:36:58 -04:00
|
|
|
InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_SkateDashboard, NULL);
|
|
|
|
GetCurrentAction().SetObjectId(-1);
|
|
|
|
ControlManager()->Register(this);
|
|
|
|
}
|
|
|
|
|
2024-05-18 15:20:05 -04:00
|
|
|
EnableScenePresentation(m_unk0x160);
|
2024-05-01 07:36:58 -04:00
|
|
|
|
|
|
|
Vector3 position = m_roi->GetWorldPosition();
|
|
|
|
AnimationManager()->FUN_10064670(&position);
|
|
|
|
AnimationManager()->FUN_10064740(&position);
|
|
|
|
return 1;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-04-28 07:23:29 -04:00
|
|
|
// FUNCTION: LEGO1 0x10010230
|
2024-05-30 09:54:24 -04:00
|
|
|
MxU32 SkateBoard::HandleControl(LegoControlManagerEvent& p_param)
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-04-28 07:23:29 -04:00
|
|
|
MxU32 result = 0;
|
|
|
|
|
2024-05-01 07:36:58 -04:00
|
|
|
if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == IsleScript::c_SkateArms_Ctl) {
|
2024-06-06 11:45:37 -04:00
|
|
|
Exit();
|
2024-04-28 07:23:29 -04:00
|
|
|
GameState()->m_currentArea = LegoGameState::Area::e_unk66;
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-05-01 07:36:58 -04:00
|
|
|
// FUNCTION: LEGO1 0x10010270
|
|
|
|
// FUNCTION: BETA10 0x100f5366
|
2024-05-18 15:20:05 -04:00
|
|
|
void SkateBoard::EnableScenePresentation(MxBool p_enable)
|
2024-05-01 07:36:58 -04:00
|
|
|
{
|
|
|
|
m_act1state = (Act1State*) GameState()->GetState("Act1State");
|
|
|
|
if (!m_act1state) {
|
|
|
|
m_act1state = (Act1State*) GameState()->CreateState("Act1State");
|
|
|
|
}
|
|
|
|
|
|
|
|
MxStillPresenter* presenter = (MxStillPresenter*) m_world->Find(*g_isleScript, IsleScript::c_SkatePizza_Bitmap);
|
|
|
|
if (presenter) {
|
|
|
|
presenter->Enable(p_enable);
|
|
|
|
}
|
|
|
|
else if (m_unk0x160) {
|
|
|
|
NotificationManager()->Send(this, MxNotificationParam(c_notificationType0, NULL));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100104f0
|
|
|
|
// FUNCTION: BETA10 0x100f5472
|
2024-01-20 18:04:46 -05:00
|
|
|
MxU32 SkateBoard::VTable0xd0()
|
|
|
|
{
|
2024-05-18 15:20:05 -04:00
|
|
|
EnableScenePresentation(m_unk0x160);
|
2024-05-01 07:36:58 -04:00
|
|
|
return 1;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
2024-03-17 13:01:47 -04:00
|
|
|
|
2024-05-01 07:36:58 -04:00
|
|
|
// FUNCTION: LEGO1 0x10010510
|
2024-05-18 15:20:05 -04:00
|
|
|
void SkateBoard::ActivateSceneActions()
|
2024-03-17 13:01:47 -04:00
|
|
|
{
|
2024-05-01 07:36:58 -04:00
|
|
|
if (m_act1state->m_unk0x018 != 3) {
|
|
|
|
PlayMusic(JukeboxScript::c_BeachBlvd_Music);
|
|
|
|
|
|
|
|
if (!m_act1state->m_unk0x022) {
|
|
|
|
m_act1state->m_unk0x022 = TRUE;
|
|
|
|
|
|
|
|
MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World());
|
|
|
|
mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.2, mat[2][2] * 2.5);
|
|
|
|
|
|
|
|
AnimationManager()
|
|
|
|
->FUN_10060dc0(IsleScript::c_sns008in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE);
|
|
|
|
}
|
|
|
|
}
|
2024-03-17 13:01:47 -04:00
|
|
|
}
|