mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 17:04:17 +00:00
Implement/match LegoCarRaceActor::FUN_10080590 (#1070)
* Implement/match `LegoCarRaceActor::FUN_10080590` * Add vbtable annotations * disable formatter for assertion * Fix BETA10 annotations * Address review comments --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
@@ -67,8 +67,10 @@ LegoNavController* NavController()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015790
|
||||
// FUNCTION: BETA10 0x100e49ff
|
||||
LegoPathActor* UserActor()
|
||||
{
|
||||
assert(LegoOmni::GetInstance());
|
||||
return LegoOmni::GetInstance()->GetUserActor();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "legocarraceactor.h"
|
||||
|
||||
#include "geom/legounkown100db7f4.h"
|
||||
#include "legopathboundary.h"
|
||||
#include "misc.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxvariabletable.h"
|
||||
|
||||
@@ -10,6 +13,7 @@ DECOMP_SIZE_ASSERT(LegoCarRaceActor, 0x1a0)
|
||||
const char* g_fuel = "FUEL";
|
||||
|
||||
// FUNCTION: LEGO1 0x10080350
|
||||
// FUNCTION: BETA10 0x100cd6b0
|
||||
LegoCarRaceActor::LegoCarRaceActor()
|
||||
{
|
||||
m_unk0x08 = 1.0f;
|
||||
@@ -27,9 +31,57 @@ LegoCarRaceActor::LegoCarRaceActor()
|
||||
VariableTable()->SetVariable(g_fuel, "0.8");
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10080590
|
||||
void LegoCarRaceActor::FUN_10080590(float)
|
||||
// FUNCTION: LEGO1 0x10080590
|
||||
// FUNCTION: BETA10 0x100cd8cf
|
||||
void LegoCarRaceActor::FUN_10080590(float p_float)
|
||||
{
|
||||
MxFloat maxSpeed = m_maxLinearVel;
|
||||
Mx3DPointFloat destEdgeUnknownVector;
|
||||
Mx3DPointFloat worldDirection = Mx3DPointFloat(m_roi->GetWorldDirection());
|
||||
|
||||
m_destEdge->FUN_1002ddc0(*m_boundary, destEdgeUnknownVector);
|
||||
|
||||
if (abs(destEdgeUnknownVector.Dot(destEdgeUnknownVector.GetData(), worldDirection.GetData())) > 0.5) {
|
||||
maxSpeed *= m_unk0x10;
|
||||
}
|
||||
|
||||
MxS32 deltaUnk0x70;
|
||||
LegoPathActor* userActor = UserActor();
|
||||
|
||||
if (userActor) {
|
||||
// All known implementations of LegoPathActor->VTable0x5c() return LegoPathActor::m_unk0x70
|
||||
deltaUnk0x70 = m_unk0x70 - userActor->VTable0x5c();
|
||||
}
|
||||
else {
|
||||
deltaUnk0x70 = 0;
|
||||
}
|
||||
|
||||
if (deltaUnk0x70 > 1) {
|
||||
if (deltaUnk0x70 > 3) {
|
||||
deltaUnk0x70 = 3;
|
||||
}
|
||||
|
||||
maxSpeed *= (m_unk0x18 * (--deltaUnk0x70) * -0.25f + 1.0f);
|
||||
}
|
||||
else if (deltaUnk0x70 < -1) {
|
||||
maxSpeed *= 1.3;
|
||||
}
|
||||
|
||||
MxFloat deltaSpeed = maxSpeed - m_worldSpeed;
|
||||
MxFloat changeInSpeed = (p_float - m_unk0x1c) * m_unk0x14;
|
||||
m_unk0x1c = p_float;
|
||||
|
||||
if (deltaSpeed < 0.0f) {
|
||||
changeInSpeed = -changeInSpeed;
|
||||
}
|
||||
|
||||
MxFloat newWorldSpeed = changeInSpeed + m_worldSpeed;
|
||||
|
||||
if (newWorldSpeed > maxSpeed) {
|
||||
newWorldSpeed = maxSpeed;
|
||||
}
|
||||
|
||||
SetWorldSpeed(newWorldSpeed);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10080740
|
||||
@@ -37,10 +89,11 @@ void LegoCarRaceActor::VTable0x1c()
|
||||
{
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10080b40
|
||||
// FUNCTION: LEGO1 0x10080b40
|
||||
// FUNCTION: BETA10 0x100cdb3c
|
||||
void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
|
||||
{
|
||||
// TODO
|
||||
LegoPathActor::SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10080b70
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "raceskel.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <assert.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(RaceSkel, 0x178)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user