mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Implement/match DuneBuggy class (#1055)
* Implement/match DuneBuggy class * Fix name * Fix
This commit is contained in:

committed by
GitHub

parent
05fa715550
commit
d92fc97a58
@@ -24,22 +24,23 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
|
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
|
||||||
void VTable0x70(float p_float) override; // vtable+0x70
|
void VTable0x70(float p_time) override; // vtable+0x70
|
||||||
MxLong HandleClick() override; // vtable+0xcc
|
MxLong HandleClick() override; // vtable+0xcc
|
||||||
MxLong HandleControl(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4
|
MxLong HandleControl(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4
|
||||||
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param) override; // vtable+0xdc
|
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param) override; // vtable+0xdc
|
||||||
void Exit() override; // vtable+0xe4
|
void Exit() override; // vtable+0xe4
|
||||||
|
|
||||||
void FUN_10068350();
|
void ActivateSceneActions();
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x10067dc0
|
// SYNTHETIC: LEGO1 0x10067dc0
|
||||||
// DuneBuggy::`scalar deleting destructor'
|
// DuneBuggy::`scalar deleting destructor'
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO: Double check DuneBuggy field types
|
static MxS32 GetDashboardOffset(const char* p_variable);
|
||||||
undefined4 m_unk0x160;
|
|
||||||
MxFloat m_unk0x164;
|
MxS16 m_dashboard; // 0x160
|
||||||
undefined4 m_unk0x168;
|
MxFloat m_fuel; // 0x164
|
||||||
|
MxFloat m_time; // 0x168
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DUNEBUGGY_H
|
#endif // DUNEBUGGY_H
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "mxvariable.h"
|
#include "mxvariable.h"
|
||||||
|
|
||||||
|
extern const char* g_varDUNESPEED;
|
||||||
|
extern const char* g_varDUNEFUEL;
|
||||||
extern const char* g_varMOTOSPEED;
|
extern const char* g_varMOTOSPEED;
|
||||||
extern const char* g_varMOTOFUEL;
|
extern const char* g_varMOTOFUEL;
|
||||||
extern const char* g_varAMBULSPEED;
|
extern const char* g_varAMBULSPEED;
|
||||||
|
@@ -1,58 +1,201 @@
|
|||||||
#include "dunebuggy.h"
|
#include "dunebuggy.h"
|
||||||
|
|
||||||
#include "decomp.h"
|
#include "decomp.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 "mxsoundpresenter.h"
|
||||||
|
#include "mxtimer.h"
|
||||||
|
#include "mxtransitionmanager.h"
|
||||||
|
#include "mxvariabletable.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(DuneBuggy, 0x16c)
|
DECOMP_SIZE_ASSERT(DuneBuggy, 0x16c)
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f7660
|
||||||
|
// STRING: LEGO1 0x100f7634
|
||||||
|
const char* g_varDBFRFNY4 = "C_DBFRFNY4";
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10067bb0
|
// FUNCTION: LEGO1 0x10067bb0
|
||||||
DuneBuggy::DuneBuggy()
|
DuneBuggy::DuneBuggy()
|
||||||
{
|
{
|
||||||
this->m_maxLinearVel = 25.0;
|
m_maxLinearVel = 25.0;
|
||||||
this->m_unk0x164 = 1.0;
|
m_fuel = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10067e30
|
// FUNCTION: LEGO1 0x10067e30
|
||||||
MxResult DuneBuggy::Create(MxDSAction& p_dsAction)
|
MxResult DuneBuggy::Create(MxDSAction& p_dsAction)
|
||||||
{
|
{
|
||||||
// TODO
|
MxResult result = IslePathActor::Create(p_dsAction);
|
||||||
return SUCCESS;
|
m_world = CurrentWorld();
|
||||||
|
|
||||||
|
if (m_world) {
|
||||||
|
m_world->Add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
VariableTable()->SetVariable(g_varDUNEFUEL, "1.0");
|
||||||
|
m_fuel = 1.0;
|
||||||
|
m_time = Timer()->GetTime();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10067ec0
|
// FUNCTION: LEGO1 0x10067ec0
|
||||||
void DuneBuggy::VTable0x70(float p_float)
|
void DuneBuggy::VTable0x70(float p_time)
|
||||||
{
|
{
|
||||||
// TODO
|
IslePathActor::VTable0x70(p_time);
|
||||||
|
|
||||||
|
char buf[200];
|
||||||
|
float speed = abs(m_worldSpeed);
|
||||||
|
float maxLinearVel = NavController()->GetMaxLinearVel();
|
||||||
|
|
||||||
|
sprintf(buf, "%g", speed / maxLinearVel);
|
||||||
|
VariableTable()->SetVariable(g_varDUNESPEED, 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_varDUNEFUEL, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10067fa0
|
// FUNCTION: LEGO1 0x10067fa0
|
||||||
void DuneBuggy::Exit()
|
void DuneBuggy::Exit()
|
||||||
{
|
{
|
||||||
// TODO
|
IslePathActor::Exit();
|
||||||
|
GameState()->m_currentArea = LegoGameState::e_dunecar;
|
||||||
|
RemoveFromCurrentWorld(*g_isleScript, m_dashboard);
|
||||||
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_DuneCarArms_Ctl);
|
||||||
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_DuneCarHorn_Ctl);
|
||||||
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_DuneCarHorn_Sound);
|
||||||
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_DuneCarInfo_Ctl);
|
||||||
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_DuneCarSpeedMeter);
|
||||||
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_DuneCarFuelMeter);
|
||||||
|
ControlManager()->Unregister(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10068060
|
// FUNCTION: LEGO1 0x10068060
|
||||||
MxLong DuneBuggy::HandleClick()
|
MxLong DuneBuggy::HandleClick()
|
||||||
{
|
{
|
||||||
// TODO
|
if (!FUN_1003ef60()) {
|
||||||
return 0;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUN_10015820(TRUE, 0);
|
||||||
|
|
||||||
|
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_dunecar);
|
||||||
|
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE);
|
||||||
|
|
||||||
|
if (GameState()->GetActorId() != UserActor()->GetActorId()) {
|
||||||
|
((IslePathActor*) UserActor())->Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_time = Timer()->GetTime();
|
||||||
|
m_dashboard = IsleScript::c_DuneCarSpeedMeter + GetDashboardOffset(g_varDBFRFNY4);
|
||||||
|
|
||||||
|
InvokeAction(Extra::ActionType::e_start, *g_isleScript, m_dashboard, NULL);
|
||||||
|
InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_DuneCarDashboard, NULL);
|
||||||
|
GetCurrentAction().SetObjectId(-1);
|
||||||
|
|
||||||
|
Vector3 position = m_roi->GetWorldPosition();
|
||||||
|
AnimationManager()->FUN_10064670(&position);
|
||||||
|
AnimationManager()->FUN_10064740(&position);
|
||||||
|
Enter();
|
||||||
|
ControlManager()->Register(this);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100681b0
|
// FUNCTION: LEGO1 0x100681b0
|
||||||
MxLong DuneBuggy::HandleControl(LegoControlManagerNotificationParam& p_param)
|
MxLong DuneBuggy::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||||
{
|
{
|
||||||
// TODO
|
MxLong result = 0;
|
||||||
return 0;
|
|
||||||
|
if (p_param.GetUnknown0x28() == 1) {
|
||||||
|
switch (p_param.GetClickedObjectId()) {
|
||||||
|
case IsleScript::c_DuneCarArms_Ctl:
|
||||||
|
Exit();
|
||||||
|
GameState()->m_currentArea = LegoGameState::e_unk66;
|
||||||
|
result = 1;
|
||||||
|
break;
|
||||||
|
case IsleScript::c_DuneCarInfo_Ctl:
|
||||||
|
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain);
|
||||||
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
||||||
|
Exit();
|
||||||
|
result = 1;
|
||||||
|
break;
|
||||||
|
case IsleScript::c_DuneCarHorn_Ctl:
|
||||||
|
MxSoundPresenter* presenter =
|
||||||
|
(MxSoundPresenter*) CurrentWorld()->Find("MxSoundPresenter", "DuneCarHorn_Sound");
|
||||||
|
presenter->Enable(p_param.GetUnknown0x28());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10068270
|
// FUNCTION: LEGO1 0x10068270
|
||||||
MxLong DuneBuggy::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
MxLong DuneBuggy::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||||
{
|
{
|
||||||
// TODO
|
// 0x168 corresponds to the path at the gas station
|
||||||
|
if (p_param.GetData() == 0x168) {
|
||||||
|
m_fuel = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10068350
|
// FUNCTION: LEGO1 0x10068290
|
||||||
void DuneBuggy::FUN_10068350()
|
MxS32 DuneBuggy::GetDashboardOffset(const char* p_variable)
|
||||||
{
|
{
|
||||||
// TODO
|
MxS32 color = 1;
|
||||||
|
const char* colorName = VariableTable()->GetVariable(p_variable);
|
||||||
|
|
||||||
|
if (strcmpi(colorName, "lego green")) {
|
||||||
|
if (!strcmpi(colorName, "lego red")) {
|
||||||
|
color = 2;
|
||||||
|
}
|
||||||
|
else if (!strcmpi(colorName, "lego yellow")) {
|
||||||
|
color = 3;
|
||||||
|
}
|
||||||
|
else if (!strcmpi(colorName, "lego black")) {
|
||||||
|
color = 4;
|
||||||
|
}
|
||||||
|
else if (!strcmpi(colorName, "lego blue")) {
|
||||||
|
color = 5;
|
||||||
|
}
|
||||||
|
else if (!strcmpi(colorName, "lego white")) {
|
||||||
|
color = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x10068350
|
||||||
|
void DuneBuggy::ActivateSceneActions()
|
||||||
|
{
|
||||||
|
PlayMusic(JukeboxScript::c_GarageArea_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_sns005in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,14 @@ DECOMP_SIZE_ASSERT(CursorVariable, 0x24)
|
|||||||
DECOMP_SIZE_ASSERT(WhoAmIVariable, 0x24)
|
DECOMP_SIZE_ASSERT(WhoAmIVariable, 0x24)
|
||||||
DECOMP_SIZE_ASSERT(CustomizeAnimFileVariable, 0x24)
|
DECOMP_SIZE_ASSERT(CustomizeAnimFileVariable, 0x24)
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f7658
|
||||||
|
// STRING: LEGO1 0x100f764c
|
||||||
|
const char* g_varDUNESPEED = "duneSPEED";
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f765c
|
||||||
|
// STRING: LEGO1 0x100f7640
|
||||||
|
const char* g_varDUNEFUEL = "duneFUEL";
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x100f3994
|
// GLOBAL: LEGO1 0x100f3994
|
||||||
// STRING: LEGO1 0x100f3988
|
// STRING: LEGO1 0x100f3988
|
||||||
const char* g_varMOTOSPEED = "motoSPEED";
|
const char* g_varMOTOSPEED = "motoSPEED";
|
||||||
|
@@ -998,7 +998,7 @@ MxLong Isle::HandleTransitionEnd()
|
|||||||
FUN_10032d30(IsleScript::c_DuneCarFuelMeter, JukeboxScript::c_MusicTheme1, NULL, TRUE);
|
FUN_10032d30(IsleScript::c_DuneCarFuelMeter, JukeboxScript::c_MusicTheme1, NULL, TRUE);
|
||||||
|
|
||||||
if (!m_act1state->m_unk0x01f) {
|
if (!m_act1state->m_unk0x01f) {
|
||||||
m_dunebuggy->FUN_10068350();
|
m_dunebuggy->ActivateSceneActions();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LegoGameState::e_motocycle:
|
case LegoGameState::e_motocycle:
|
||||||
|
Reference in New Issue
Block a user