diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index ceb64416..3eece302 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -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]); diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index 0f6306fb..d981be73 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -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) { diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index c5e658a6..0fcece8a 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -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