diff --git a/LEGO1/lego/sources/misc/legostorage.h b/LEGO1/lego/sources/misc/legostorage.h index 5de72303..553983fd 100644 --- a/LEGO1/lego/sources/misc/legostorage.h +++ b/LEGO1/lego/sources/misc/legostorage.h @@ -138,7 +138,7 @@ class LegoFile : public LegoStorage { const char* data = p_str.GetData(); LegoU32 fullLength = strlen(data); - LegoU16 limitedLength = fullLength; + LegoU16 limitedLength = (LegoU16) fullLength; Write(&limitedLength, sizeof(limitedLength)); Write((char*) data, (LegoS16) fullLength); diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index d7c19b76..1143b9d1 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -198,12 +198,12 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) { if (m_unk0x30 == c_bit1) { p_v = m_unk0x00; - p_v[3] = (1.0 - p_f) * acos((double) p_v[3]) * 2.0; + p_v[3] = (float) ((1.0 - p_f) * acos((double) p_v[3]) * 2.0); return p_v.NormalizeQuaternion(); } else if (m_unk0x30 == c_bit2) { p_v = m_unk0x18; - p_v[3] = p_f * acos((double) p_v[3]) * 2.0; + p_v[3] = (float) (p_f * acos((double) p_v[3]) * 2.0); return p_v.NormalizeQuaternion(); } else if (m_unk0x30 == (c_bit1 | c_bit2)) { @@ -225,7 +225,7 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) } for (i = 0; i < 4; i++) { - p_v[i] = m_unk0x00[i] * a + m_unk0x18[i] * b; + p_v[i] = (float) (m_unk0x00[i] * a + m_unk0x18[i] * b); } } else { @@ -237,7 +237,7 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) b = sin(p_f * 1.570796326794895); for (i = 0; i < 3; i++) { - p_v[i] = m_unk0x00[i] * a + p_v[i] * b; + p_v[i] = (float) (m_unk0x00[i] * a + p_v[i] * b); } } diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index b0ace048..2f52ce71 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -204,7 +204,7 @@ inline void Matrix4::ToQuaternion(Vector4& p_outQuat) { float trace = m_data[0][0] + m_data[1][1] + m_data[2][2]; if (trace > 0) { - trace = sqrt(trace + 1.0); + trace = (float) sqrt(trace + 1.0); p_outQuat[3] = trace * 0.5f; trace = 0.5f / trace; p_outQuat[0] = (m_data[2][1] - m_data[1][2]) * trace; @@ -228,7 +228,8 @@ inline void Matrix4::ToQuaternion(Vector4& p_outQuat) int next = rotateIndex[largest]; int nextNext = rotateIndex[next]; - float trace = sqrt(*Element(largest, largest) - (*Element(nextNext, nextNext) + *Element(next, next)) + 1.0); + float trace = + (float) (sqrt(*Element(largest, largest) - (*Element(nextNext, nextNext) + *Element(next, next)) + 1.0)); p_outQuat[largest] = trace * 0.5f; trace = 0.5f / trace; @@ -276,14 +277,14 @@ inline int Matrix4::FromQuaternion(const Vector4& p_vec) m_data[1][2] = v24 - v13; m_data[2][2] = 1.0f - (v18 + v17); - m_data[3][0] = 0; - m_data[3][1] = 0; - m_data[3][2] = 0; + m_data[3][0] = 0.0f; + m_data[3][1] = 0.0f; + m_data[3][2] = 0.0f; m_data[3][3] = 1.0f; - m_data[0][3] = 0; - m_data[1][3] = 0; - m_data[2][3] = 0; + m_data[0][3] = 0.0f; + m_data[1][3] = 0.0f; + m_data[2][3] = 0.0f; return 0; } diff --git a/LEGO1/tgl/tglvector.h b/LEGO1/tgl/tglvector.h index 8612724f..49d60c0a 100644 --- a/LEGO1/tgl/tglvector.h +++ b/LEGO1/tgl/tglvector.h @@ -10,15 +10,15 @@ namespace Tgl namespace Constant { -const float Pi = 3.14159265358979323846; +const double Pi = 3.14159265358979323846; }; -inline float DegreesToRadians(float degrees) +inline double DegreesToRadians(double degrees) { return Constant::Pi * (degrees / 180.0); } -inline float RadiansToDegrees(float radians) +inline double RadiansToDegrees(double radians) { return (radians / Constant::Pi) * 180.0; }