mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-27 02:14:18 +00:00
Implement/match Motocycle, consistent notification names (#1037)
* Implement/match Motocycle, consistent notification names * Format * Fix * Fix return types * Fix return type * Fix annotations * Rename function
This commit is contained in:
committed by
GitHub
parent
68023379d8
commit
e4e0f4e4d3
@@ -139,16 +139,16 @@ MxLong Ambulance::Notify(MxParam& p_param)
|
||||
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationButtonDown:
|
||||
result = HandleButtonDown((LegoControlManagerEvent&) p_param);
|
||||
result = HandleButtonDown((LegoControlManagerNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationClick:
|
||||
result = HandleClick();
|
||||
break;
|
||||
case c_notificationControl:
|
||||
result = HandleControl((LegoControlManagerEvent&) p_param);
|
||||
result = HandleControl((LegoControlManagerNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationPathStruct:
|
||||
result = HandlePathStruct((LegoPathStructEvent&) p_param);
|
||||
result = HandlePathStruct((LegoPathStructNotificationParam&) p_param);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
|
||||
|
||||
// FUNCTION: LEGO1 0x100367c0
|
||||
// FUNCTION: BETA10 0x100230bf
|
||||
MxLong Ambulance::HandleButtonDown(LegoControlManagerEvent& p_param)
|
||||
MxLong Ambulance::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
if (m_unk0x170 == 1) {
|
||||
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
|
||||
@@ -266,7 +266,7 @@ MxLong Ambulance::HandleButtonDown(LegoControlManagerEvent& p_param)
|
||||
|
||||
// FUNCTION: LEGO1 0x10036860
|
||||
// FUNCTION: BETA10 0x100231bf
|
||||
MxLong Ambulance::HandlePathStruct(LegoPathStructEvent& p_param)
|
||||
MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
{
|
||||
// 0x168 corresponds to the path at the gas station
|
||||
if (p_param.GetData() == 0x168) {
|
||||
@@ -437,7 +437,7 @@ void Ambulance::Leave()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10036f90
|
||||
MxLong Ambulance::HandleControl(LegoControlManagerEvent& p_param)
|
||||
MxLong Ambulance::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
MxLong result = 0;
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ MxLong Bike::HandleClick()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10076aa0
|
||||
MxLong Bike::HandleControl(LegoControlManagerEvent& p_param)
|
||||
MxLong Bike::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
MxLong result = 0;
|
||||
|
||||
|
||||
@@ -38,14 +38,14 @@ MxLong DuneBuggy::HandleClick()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100681b0
|
||||
MxLong DuneBuggy::HandleControl(LegoControlManagerEvent& p_param)
|
||||
MxLong DuneBuggy::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10068270
|
||||
MxLong DuneBuggy::HandlePathStruct(LegoPathStructEvent& p_param)
|
||||
MxLong DuneBuggy::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@@ -152,7 +152,7 @@ MxLong Helicopter::HandleClick()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100035e0
|
||||
MxLong Helicopter::HandleControl(LegoControlManagerEvent& p_param)
|
||||
MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
MxU32 ret = 0;
|
||||
MxAtomId script;
|
||||
|
||||
@@ -37,19 +37,19 @@ MxLong IsleActor::Notify(MxParam& p_param)
|
||||
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationButtonUp:
|
||||
result = HandleButtonUp((MxNotificationParam&) p_param);
|
||||
result = HandleButtonUp((LegoControlManagerNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationButtonDown:
|
||||
result = HandleButtonDown((MxNotificationParam&) p_param);
|
||||
result = HandleButtonDown((LegoControlManagerNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationClick:
|
||||
result = HandleClick();
|
||||
break;
|
||||
case c_notificationEndAnim:
|
||||
result = VTable0x70();
|
||||
result = HandleEndAnim();
|
||||
break;
|
||||
case c_notificationPathStruct:
|
||||
result = VTable0x80(p_param);
|
||||
result = HandlePathStruct((LegoPathStructNotificationParam&) p_param);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,13 +58,13 @@ MxLong IslePathActor::Notify(MxParam& p_param)
|
||||
result = HandleClick();
|
||||
break;
|
||||
case c_notificationControl:
|
||||
result = HandleControl((LegoControlManagerEvent&) p_param);
|
||||
result = HandleControl((LegoControlManagerNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationEndAnim:
|
||||
result = HandleEndAnim((LegoEndAnimNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationPathStruct:
|
||||
result = HandlePathStruct((LegoPathStructEvent&) p_param);
|
||||
result = HandlePathStruct((LegoPathStructNotificationParam&) p_param);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ MxLong Jetski::HandleClick()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007e8e0
|
||||
MxLong Jetski::HandleControl(LegoControlManagerEvent& p_param)
|
||||
MxLong Jetski::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@@ -1,58 +1,163 @@
|
||||
#include "motocycle.h"
|
||||
#include "motorcycle.h"
|
||||
|
||||
#include "isle.h"
|
||||
#include "isle_actions.h"
|
||||
#include "jukebox_actions.h"
|
||||
#include "legoanimationmanager.h"
|
||||
#include "legocontrolmanager.h"
|
||||
#include "legonavcontroller.h"
|
||||
#include "legopathstruct.h"
|
||||
#include "legoutils.h"
|
||||
#include "legovariables.h"
|
||||
#include "legoworld.h"
|
||||
#include "misc.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxtimer.h"
|
||||
#include "mxtransitionmanager.h"
|
||||
#include "mxvariabletable.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(Motocycle, 0x16c)
|
||||
|
||||
// FUNCTION: LEGO1 0x100357b0
|
||||
Motocycle::Motocycle()
|
||||
{
|
||||
this->m_maxLinearVel = 40.0;
|
||||
this->m_unk0x150 = 1.75;
|
||||
this->m_unk0x148 = 1;
|
||||
this->m_unk0x164 = 1.0;
|
||||
m_maxLinearVel = 40.0;
|
||||
m_unk0x150 = 1.75;
|
||||
m_unk0x148 = 1;
|
||||
m_fuel = 1.0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10035a40
|
||||
// FUNCTION: LEGO1 0x10035a40
|
||||
MxResult Motocycle::Create(MxDSAction& p_dsAction)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
MxResult result = IslePathActor::Create(p_dsAction);
|
||||
m_world = CurrentWorld();
|
||||
|
||||
if (m_world) {
|
||||
m_world->Add(this);
|
||||
}
|
||||
|
||||
VariableTable()->SetVariable(g_varMOTOFUEL, "1.0");
|
||||
m_fuel = 1.0;
|
||||
m_time = Timer()->GetTime();
|
||||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10035ad0
|
||||
void Motocycle::VTable0x70(float p_float)
|
||||
// FUNCTION: LEGO1 0x10035ad0
|
||||
void Motocycle::VTable0x70(float p_time)
|
||||
{
|
||||
// TODO
|
||||
IslePathActor::VTable0x70(p_time);
|
||||
|
||||
if (UserActor() == this) {
|
||||
char buf[200];
|
||||
float speed = abs(m_worldSpeed);
|
||||
float maxLinearVel = NavController()->GetMaxLinearVel();
|
||||
|
||||
sprintf(buf, "%g", speed / maxLinearVel);
|
||||
VariableTable()->SetVariable(g_varMOTOSPEED, buf);
|
||||
|
||||
m_fuel += (p_time - m_time) * -3.333333333e-06f;
|
||||
if (m_fuel < 0) {
|
||||
m_fuel = 0;
|
||||
}
|
||||
|
||||
m_time = p_time;
|
||||
|
||||
sprintf(buf, "%g", m_fuel);
|
||||
VariableTable()->SetVariable(g_varMOTOFUEL, buf);
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10035bc0
|
||||
// FUNCTION: LEGO1 0x10035bc0
|
||||
void Motocycle::Exit()
|
||||
{
|
||||
// TODO
|
||||
IslePathActor::Exit();
|
||||
GameState()->m_currentArea = LegoGameState::e_motocycle;
|
||||
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeDashboard_Bitmap);
|
||||
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeArms_Ctl);
|
||||
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeInfo_Ctl);
|
||||
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeSpeedMeter);
|
||||
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeFuelMeter);
|
||||
ControlManager()->Unregister(this);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10035c50
|
||||
// FUNCTION: LEGO1 0x10035c50
|
||||
MxLong Motocycle::HandleClick()
|
||||
{
|
||||
// TODO
|
||||
if (!FUN_1003ef60()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
FUN_10015820(TRUE, 0);
|
||||
|
||||
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_motocycle);
|
||||
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE);
|
||||
|
||||
if (GameState()->GetActorId() != UserActor()->GetActorId()) {
|
||||
((IslePathActor*) UserActor())->Exit();
|
||||
}
|
||||
|
||||
m_time = Timer()->GetTime();
|
||||
|
||||
Enter();
|
||||
InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_MotoBikeDashboard, NULL);
|
||||
GetCurrentAction().SetObjectId(-1);
|
||||
|
||||
Vector3 position = m_roi->GetWorldPosition();
|
||||
AnimationManager()->FUN_10064670(&position);
|
||||
AnimationManager()->FUN_10064740(&position);
|
||||
ControlManager()->Register(this);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10035d70
|
||||
MxLong Motocycle::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
MxLong result = 0;
|
||||
|
||||
if (p_param.GetUnknown0x28() == 1) {
|
||||
switch (p_param.GetClickedObjectId()) {
|
||||
case IsleScript::c_MotoBikeArms_Ctl:
|
||||
Exit();
|
||||
GameState()->m_currentArea = LegoGameState::e_unk66;
|
||||
result = 1;
|
||||
break;
|
||||
case IsleScript::c_MotoBikeInfo_Ctl:
|
||||
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain);
|
||||
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
||||
Exit();
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10035df0
|
||||
MxLong Motocycle::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
{
|
||||
// 0x168 corresponds to the path at the gas station
|
||||
if (p_param.GetData() == 0x168) {
|
||||
m_fuel = 1.0f;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10035d70
|
||||
MxLong Motocycle::HandleControl(LegoControlManagerEvent& p_param)
|
||||
// FUNCTION: LEGO1 0x10035e10
|
||||
void Motocycle::ActivateSceneActions()
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
PlayMusic(JukeboxScript::c_PoliceStation_Music);
|
||||
|
||||
// STUB: LEGO1 0x10035df0
|
||||
MxLong Motocycle::HandlePathStruct(LegoPathStructEvent& p_param)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
Act1State* act1state = (Act1State*) GameState()->GetState("Act1State");
|
||||
if (!act1state->m_unk0x022) {
|
||||
act1state->m_unk0x022 = TRUE;
|
||||
|
||||
// STUB: LEGO1 0x10035e10
|
||||
void Motocycle::FUN_10035e10()
|
||||
{
|
||||
// TODO
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,14 +72,14 @@ void Pizza::FUN_10038380()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100383f0
|
||||
undefined4 Pizza::HandleClick()
|
||||
MxLong Pizza::HandleClick()
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100384f0
|
||||
undefined4 Pizza::VTable0x80(MxParam&)
|
||||
MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam&)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
@@ -93,7 +93,7 @@ MxResult Pizza::Tickle()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10038b10
|
||||
undefined4 Pizza::HandleEndAction(MxEndActionNotificationParam&)
|
||||
MxLong Pizza::HandleEndAction(MxEndActionNotificationParam&)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@@ -46,7 +46,7 @@ void Pizzeria::CreateState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10017a50
|
||||
undefined4 Pizzeria::HandleClick()
|
||||
MxLong Pizzeria::HandleClick()
|
||||
{
|
||||
if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) {
|
||||
if (UserActor()->GetActorId() != GameState()->GetActorId()) {
|
||||
|
||||
@@ -91,7 +91,7 @@ MxLong Radio::Notify(MxParam& p_param)
|
||||
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationControl:
|
||||
result = HandleControl((LegoControlManagerEvent&) p_param);
|
||||
result = HandleControl((LegoControlManagerNotificationParam&) p_param);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ void Radio::Stop()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1002cbc0
|
||||
MxLong Radio::HandleControl(LegoControlManagerEvent& p_param)
|
||||
MxLong Radio::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
MxDSAction action; // Unused
|
||||
MxS32 objectId = p_param.GetClickedObjectId();
|
||||
|
||||
@@ -106,7 +106,7 @@ MxLong SkateBoard::HandleClick()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10010230
|
||||
MxLong SkateBoard::HandleControl(LegoControlManagerEvent& p_param)
|
||||
MxLong SkateBoard::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
MxU32 result = 0;
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ MxLong TowTrack::HandleEndAnim(LegoEndAnimNotificationParam& p_param)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004d330
|
||||
MxLong TowTrack::HandlePathStruct(LegoPathStructEvent& p_param)
|
||||
MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
@@ -109,7 +109,7 @@ void TowTrack::Exit()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004d9e0
|
||||
MxLong TowTrack::HandleControl(LegoControlManagerEvent& p_param)
|
||||
MxLong TowTrack::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user