Fix a bug in LegoNavController, improve accuracy (#1254)

* Fix a bug in `LegoNavController`, improve accuracy

* Fix
This commit is contained in:
Christian Semmler
2024-12-21 15:17:45 -07:00
committed by GitHub
parent fe2a65c8da
commit a987533ba1

View File

@@ -718,10 +718,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
LegoROI* roi = CharacterManager()->GetActorROI(CharacterManager()->GetActorName(g_unk0x100f66cc), TRUE); LegoROI* roi = CharacterManager()->GetActorROI(CharacterManager()->GetActorName(g_unk0x100f66cc), TRUE);
if (roi != NULL) { if (roi != NULL) {
MxMatrix mat; MxMatrix mat;
ViewROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); ViewROI* viewRoi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
const float* position = roi->GetWorldPosition(); const float* position = viewRoi->GetWorldPosition();
const float* direction = roi->GetWorldDirection(); const float* direction = viewRoi->GetWorldDirection();
const float* up = roi->GetWorldUp(); const float* up = viewRoi->GetWorldUp();
CalcLocalTransform(position, direction, up, mat); CalcLocalTransform(position, direction, up, mat);
mat.TranslateBy(direction[0] * 2.0f, direction[1] - 1.0, direction[2] * 2.0f); mat.TranslateBy(direction[0] * 2.0f, direction[1] - 1.0, direction[2] * 2.0f);
roi->UpdateTransformationRelativeToParent(mat); roi->UpdateTransformationRelativeToParent(mat);
@@ -744,12 +744,12 @@ MxLong LegoNavController::Notify(MxParam& p_param)
VideoManager()->ToggleFPS(g_fpsEnabled); VideoManager()->ToggleFPS(g_fpsEnabled);
if (g_fpsEnabled) { if (g_fpsEnabled) {
g_fpsEnabled = FALSE; g_fpsEnabled = FALSE;
m_unk0x5d = FALSE;
} }
else { else {
g_fpsEnabled = TRUE; g_fpsEnabled = TRUE;
m_unk0x5d = FALSE;
} }
default:
m_unk0x5d = FALSE;
break; break;
case '0': case '0':
case '1': case '1':
@@ -772,7 +772,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
else if (g_locationCalcStep) { else if (g_locationCalcStep) {
if (g_locationCalcStep == 1) { if (g_locationCalcStep == 1) {
// Calculate base offset into g_locations // Calculate base offset into g_locations
g_nextLocation = (key - '0') * 5; g_nextLocation = (key - '0') * 10;
g_locationCalcStep = 2; g_locationCalcStep = 2;
} }
else { else {
@@ -1018,9 +1018,6 @@ MxLong LegoNavController::Notify(MxParam& p_param)
case 0xbd: case 0xbd:
g_unk0x100f66bc = LegoAnimationManager::e_unk1; g_unk0x100f66bc = LegoAnimationManager::e_unk1;
break; break;
default:
m_unk0x5d = FALSE;
break;
} }
} }
else { else {