Implement/match LegoNavController::UpdateCameraLocation (#713)

* Implement/match LegoNavController::UpdateCameraLocation

* Add size assert
This commit is contained in:
Christian Semmler
2024-03-23 12:10:12 -04:00
committed by GitHub
parent 8b21e8136e
commit 18377c2f1f
6 changed files with 216 additions and 4 deletions

View File

@@ -1,11 +1,14 @@
#include "legonavcontroller.h"
#include "legocameralocations.h"
#include "legoinputmanager.h"
#include "legosoundmanager.h"
#include "legoutils.h"
#include "legovideomanager.h"
#include "misc.h"
#include "mxmisc.h"
#include "mxtimer.h"
#include "realtime/realtime.h"
#include <vec.h>
@@ -361,10 +364,42 @@ MxBool LegoNavController::CalculateNewPosDir(
return changed;
}
// STUB: LEGO1 0x10055500
void LegoNavController::UpdateCameraLocation(const char* p_location)
// FUNCTION: LEGO1 0x10055500
MxResult LegoNavController::UpdateCameraLocation(const char* p_location)
{
// TODO
MxResult result = FAILURE;
for (MxS32 i = 0; i < (MxS32) _countof(g_cameraLocations); i++) {
if (!strcmpi(p_location, g_cameraLocations[i].m_name)) {
MxMatrix mat;
LegoROI* viewROI = VideoManager()->GetViewROI();
CalcLocalTransform(
g_cameraLocations[i].m_position,
g_cameraLocations[i].m_direction,
g_cameraLocations[i].m_up,
mat
);
Mx3DPointFloat vec;
vec.Clear();
viewROI->FUN_100a5a30(vec);
viewROI->WrappedSetLocalTransform(mat);
VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->FUN_1002a410(
viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(),
viewROI->GetWorldUp(),
viewROI->GetWorldVelocity()
);
result = SUCCESS;
}
}
return result;
}
// STUB: LEGO1 0x10055620