mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-26 01:44:19 +00:00
Implement LegoRaceCar::FUN_10012ff0(), refactoring (#1063)
* Implement `LegoRaceCar::FUN_10012ff0()`, refactor based on BETA10 * Add BETA10 annotations * Rename functions and variables based on BETA10 assertions * Address issues raised by linter * Rename variable, add BETA10 vtables * Rename legoracecar files to legoracers --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
@@ -1220,7 +1220,7 @@ void LegoAnimationManager::FUN_10061010(MxBool p_und)
|
||||
|
||||
if (tranInfo->m_presenter->GetPresenter() != NULL &&
|
||||
(anim = tranInfo->m_presenter->GetPresenter()->GetAnimation()) != NULL &&
|
||||
anim->GetScene() != NULL) {
|
||||
anim->GetCamAnim() != NULL) {
|
||||
if (flags & LegoTranInfo::c_bit2) {
|
||||
BackgroundAudioManager()->RaiseVolume();
|
||||
tranInfo->m_flags &= ~LegoTranInfo::c_bit2;
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#include "legopathactor.h"
|
||||
#include "legopathpresenter.h"
|
||||
#include "legophonemepresenter.h"
|
||||
#include "legoracecar.h"
|
||||
#include "legoracers.h"
|
||||
#include "legotexturepresenter.h"
|
||||
#include "legoworld.h"
|
||||
#include "legoworldpresenter.h"
|
||||
|
||||
@@ -73,8 +73,10 @@ LegoPathActor* UserActor()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100157a0
|
||||
// FUNCTION: BETA10 0x100e4a46
|
||||
LegoWorld* CurrentWorld()
|
||||
{
|
||||
assert(LegoOmni::GetInstance());
|
||||
return LegoOmni::GetInstance()->GetCurrentWorld();
|
||||
}
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@ void LegoCameraController::FUN_10012320(float p_angle)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100123e0
|
||||
// FUNCTION: BETA10 0x10068cb2
|
||||
void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32 p_und)
|
||||
{
|
||||
if (m_lego3DView != NULL) {
|
||||
|
||||
@@ -29,8 +29,10 @@ LegoAnimActorStruct::~LegoAnimActorStruct()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1001c130
|
||||
// FUNCTION: BETA10 0x1003df5f
|
||||
float LegoAnimActorStruct::GetDuration()
|
||||
{
|
||||
assert(m_AnimTreePtr);
|
||||
return m_AnimTreePtr->GetDuration();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "legoracecar.h"
|
||||
#include "legoracers.h"
|
||||
|
||||
#include "anim/legoanim.h"
|
||||
#include "define.h"
|
||||
#include "legocameracontroller.h"
|
||||
#include "legorace.h"
|
||||
#include "misc.h"
|
||||
#include "mxmisc.h"
|
||||
@@ -44,7 +46,7 @@ const EdgeReference* LegoRaceCar::g_pEdgeReferences = g_edgeReferences;
|
||||
// FUNCTION: LEGO1 0x10012950
|
||||
LegoRaceCar::LegoRaceCar()
|
||||
{
|
||||
m_unk0x54 = 0;
|
||||
m_userState = 0;
|
||||
m_unk0x70 = 0;
|
||||
m_unk0x74 = 0;
|
||||
m_unk0x5c.Clear();
|
||||
@@ -131,10 +133,60 @@ void LegoRaceCar::ParseAction(char* p_extra)
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10012ff0
|
||||
void LegoRaceCar::FUN_10012ff0(float)
|
||||
// FUNCTION: LEGO1 0x10012ff0
|
||||
// FUNCTION: BETA10 0x100cb60e
|
||||
void LegoRaceCar::FUN_10012ff0(float p_param)
|
||||
{
|
||||
// TODO
|
||||
LegoAnimActorStruct* a; // called `a` in BETA10
|
||||
float deltaTime;
|
||||
|
||||
if (m_userState == 2) {
|
||||
a = m_unk0x70;
|
||||
}
|
||||
else {
|
||||
// TODO: Possibly an enum?
|
||||
const char legoracecarKick2 = 4; // original name: LEGORACECAR_KICK2
|
||||
assert(m_userState == legoracecarKick2);
|
||||
a = m_unk0x74;
|
||||
}
|
||||
|
||||
assert(a && a->GetAnimTreePtr() && a->GetAnimTreePtr()->GetCamAnim());
|
||||
|
||||
if (a->GetAnimTreePtr()) {
|
||||
deltaTime = p_param - m_unk0x58;
|
||||
|
||||
if (a->GetDuration() <= deltaTime || deltaTime < 0.0) {
|
||||
if (m_userState == 2) {
|
||||
LegoEdge** edges = m_unk0x78->GetEdges();
|
||||
m_destEdge = (LegoUnknown100db7f4*) (edges[2]);
|
||||
m_boundary = m_unk0x78;
|
||||
}
|
||||
else {
|
||||
LegoEdge** edges = m_unk0x78->GetEdges();
|
||||
m_destEdge = (LegoUnknown100db7f4*) (edges[1]);
|
||||
m_boundary = m_unk0x7c;
|
||||
}
|
||||
|
||||
m_userState = 0;
|
||||
}
|
||||
else if (a->GetAnimTreePtr()->GetCamAnim()) {
|
||||
MxMatrix transformationMatrix;
|
||||
|
||||
LegoWorld* r = CurrentWorld(); // called `r` in BETA10
|
||||
assert(r);
|
||||
|
||||
transformationMatrix.SetIdentity();
|
||||
|
||||
// Possible bug in the original code: The first argument is not initialized
|
||||
a->GetAnimTreePtr()->GetCamAnim()->FUN_1009f490(deltaTime, transformationMatrix);
|
||||
|
||||
if (r->GetCamera()) {
|
||||
r->GetCamera()->FUN_100123e0(transformationMatrix, 0);
|
||||
}
|
||||
|
||||
m_roi->FUN_100a58f0(transformationMatrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10013130
|
||||
@@ -922,9 +922,9 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p
|
||||
}
|
||||
}
|
||||
|
||||
if (p_anim->GetScene() != NULL) {
|
||||
if (p_anim->GetCamAnim() != NULL) {
|
||||
MxMatrix transform(mat);
|
||||
p_anim->GetScene()->FUN_1009f490(p_time, transform);
|
||||
p_anim->GetCamAnim()->FUN_1009f490(p_time, transform);
|
||||
|
||||
if (m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) {
|
||||
m_currentWorld->GetCamera()->FUN_100123e0(transform, 0);
|
||||
|
||||
Reference in New Issue
Block a user