Implement/match RotateY (#1152)

This commit is contained in:
Christian Semmler 2024-11-15 10:28:26 -07:00 committed by GitHub
parent 2e08748551
commit 62f09570b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 6 deletions

View File

@ -43,7 +43,7 @@ extern MxAtomId* g_isleScript;
LegoEntity* PickEntity(MxLong, MxLong);
LegoROI* PickROI(MxLong, MxLong);
LegoROI* PickParentROI(MxLong p_a, MxLong p_b);
void FUN_1003dde0(LegoROI* p_param1, MxFloat p_param2);
void RotateY(LegoROI* p_roi, MxFloat p_angle);
MxBool SpheresIntersect(const BoundingSphere& p_sphere1, const BoundingSphere& p_sphere2);
MxBool FUN_1003ded0(MxFloat p_param1[2], MxFloat p_param2[3], MxFloat p_param3[3]);
MxBool TransformWorldToScreen(const MxFloat p_world[3], MxFloat p_screen[4]);

View File

@ -553,7 +553,7 @@ MxResult LegoCarBuild::Tickle()
}
if (m_unk0x100 == 5 && m_unk0x110) {
FUN_1003dde0(m_unk0x110, g_unk0x100d65a4);
RotateY(m_unk0x110, g_unk0x100d65a4);
}
if (m_unk0x10a) {

View File

@ -65,11 +65,23 @@ LegoEntity* PickEntity(MxLong, MxLong)
return NULL;
}
// STUB: LEGO1 0x1003dde0
// STUB: BETA10 0x100d358e
void FUN_1003dde0(LegoROI* p_param1, MxFloat p_param2)
// FUNCTION: LEGO1 0x1003dde0
// FUNCTION: BETA10 0x100d358e
void RotateY(LegoROI* p_roi, MxFloat p_angle)
{
// TODO
MxMatrix mat;
const Matrix4& local2world = p_roi->GetLocal2World();
mat = local2world;
float fsin = sin(p_angle);
float fcos = cos(p_angle);
for (MxS32 i = 0; i < 3; i++) {
mat[i][0] = (local2world[i][0] * fcos) + (local2world[i][2] * fsin);
mat[i][2] = (local2world[i][2] * fcos) - (local2world[i][0] * fsin);
}
p_roi->WrappedSetLocalTransform(mat);
}
// FUNCTION: LEGO1 0x1003de80