mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-27 02:14:18 +00:00
Implement the rest of the SkateBoard class (#873)
* Implement SkateBoard::~SkateBoard() * Implement SkateBoard::VTable0xd4 * Implement SkateBoard::Create() - one typecast is still not clear * Add SkateBoard::VTable0xe4() * apply clang-format * Apply clang-format to legocontrolmanager.h * Address review comments * 57 percent match * 63 percent * 82 percent match * previous 86 was bugged, unfortunately * 85 percent on FUN_10010270 * 92 percent FUN_10010270 * 69 percent VTable0xcc * 73 percent VTable0xcc * more progress, not quite there yet * minor 10010510 improvement * 100 % on FUN_10010510 * slowly making progress on SkateBoard::VTable0xcc (broken decomp) * getting closer, now only wrong registers * 89 percent VTable0xcc * 92 percent * 95 % VTable0xcc * Changes, see comment --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com> Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
#include "skateboard.h"
|
||||
|
||||
#include "act1state.h"
|
||||
#include "decomp.h"
|
||||
#include "isle.h"
|
||||
#include "isle_actions.h"
|
||||
#include "jukebox_actions.h"
|
||||
#include "legoanimationmanager.h"
|
||||
#include "legoutils.h"
|
||||
#include "misc.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxnotificationmanager.h"
|
||||
#include "mxstillpresenter.h"
|
||||
#include "mxtransitionmanager.h"
|
||||
#include "pizza.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(SkateBoard, 0x168)
|
||||
@@ -13,7 +19,7 @@ DECOMP_SIZE_ASSERT(SkateBoard, 0x168)
|
||||
// FUNCTION: LEGO1 0x1000fd40
|
||||
SkateBoard::SkateBoard()
|
||||
{
|
||||
m_unk0x160 = 0;
|
||||
m_unk0x160 = FALSE;
|
||||
m_unk0x13c = 15.0;
|
||||
m_unk0x150 = 3.5;
|
||||
m_unk0x148 = 1;
|
||||
@@ -49,13 +55,13 @@ MxResult SkateBoard::Create(MxDSAction& p_dsAction)
|
||||
// FUNCTION: LEGO1 0x10010050
|
||||
void SkateBoard::VTable0xe4()
|
||||
{
|
||||
// TODO: Work out what kind of structure this points to
|
||||
if (*(int*) (m_unk0x164 + 0x18) == 3) {
|
||||
if (m_act1state->m_unk0x018 == 3) {
|
||||
Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor);
|
||||
pizza->FUN_10038380();
|
||||
pizza->FUN_100382b0();
|
||||
m_unk0x160 = 0;
|
||||
m_unk0x160 = FALSE;
|
||||
}
|
||||
|
||||
IslePathActor::VTable0xe4();
|
||||
GameState()->m_currentArea = LegoGameState::Area::e_skateboard;
|
||||
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkateArms_Ctl);
|
||||
@@ -63,11 +69,39 @@ void SkateBoard::VTable0xe4()
|
||||
ControlManager()->Unregister(this);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100100e0
|
||||
// FUNCTION: LEGO1 0x100100e0
|
||||
MxU32 SkateBoard::VTable0xcc()
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
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")) {
|
||||
CurrentActor()->VTable0xe4();
|
||||
}
|
||||
}
|
||||
|
||||
if (!CurrentActor()->IsA("SkateBoard")) {
|
||||
VTable0xe0();
|
||||
InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_SkateDashboard, NULL);
|
||||
GetCurrentAction().SetObjectId(-1);
|
||||
ControlManager()->Register(this);
|
||||
}
|
||||
|
||||
FUN_10010270(m_unk0x160);
|
||||
|
||||
Vector3 position = m_roi->GetWorldPosition();
|
||||
AnimationManager()->FUN_10064670(&position);
|
||||
AnimationManager()->FUN_10064740(&position);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10010230
|
||||
@@ -75,7 +109,7 @@ MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param)
|
||||
{
|
||||
MxU32 result = 0;
|
||||
|
||||
if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == 0xc3) {
|
||||
if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == IsleScript::c_SkateArms_Ctl) {
|
||||
VTable0xe4();
|
||||
GameState()->m_currentArea = LegoGameState::Area::e_unk66;
|
||||
result = 1;
|
||||
@@ -84,15 +118,46 @@ MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param)
|
||||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100104f0
|
||||
MxU32 SkateBoard::VTable0xd0()
|
||||
// FUNCTION: LEGO1 0x10010270
|
||||
// FUNCTION: BETA10 0x100f5366
|
||||
void SkateBoard::FUN_10010270(MxBool p_enable)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10010510
|
||||
// FUNCTION: LEGO1 0x100104f0
|
||||
// FUNCTION: BETA10 0x100f5472
|
||||
MxU32 SkateBoard::VTable0xd0()
|
||||
{
|
||||
FUN_10010270(m_unk0x160);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10010510
|
||||
void SkateBoard::FUN_10010510()
|
||||
{
|
||||
// TODO
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user