mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-22 16:04:17 +00:00
Fix float constants and conversions (#1279)
* Fix legoplants warnings, add BETA10 references * Fix warnings in various header files, improve match * Fix floats in legoactors.cpp * Fix `legolocations.cpp` * fix typo --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
@@ -444,6 +444,8 @@ MxS32 Act2Actor::VTable0xa0()
|
||||
{
|
||||
undefined4 newLocation;
|
||||
|
||||
assert(!m_grec);
|
||||
|
||||
CurrentWorld();
|
||||
MxU16 randomVal = rand() / (RAND_MAX / 2) + 1;
|
||||
|
||||
|
@@ -8,88 +8,88 @@ DECOMP_SIZE_ASSERT(LegoActorLOD, 0x58)
|
||||
|
||||
// GLOBAL: LEGO1 0x100da3b0
|
||||
LegoActorLOD g_actorLODs[] = {
|
||||
{"top", "top", 0, 0.000267, 0.780808, -0.01906, 0.951612, -0.461166, -0.002794, -0.299442, 0.4617,
|
||||
1.56441, 0.261321, 0, 0, 0, 0, 0, 1, 0, 1, 0},
|
||||
{"top", "top", 0, 0.000267f, 0.780808f, -0.01906f, 0.951612f, -0.461166f, -0.002794f, -0.299442f, 0.4617f,
|
||||
1.56441f, 0.261321f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f},
|
||||
{"body", "body", LegoActorLOD::c_flag1,
|
||||
0.00158332, 0.401828, -0.00048697,
|
||||
0.408071, -0.287507, 0.150419,
|
||||
-0.147452, 0.289219, 0.649774,
|
||||
0.14258, -0.00089, 0.436353,
|
||||
0.007277, 0, 0,
|
||||
1, 0, 1,
|
||||
0},
|
||||
0.00158332f, 0.401828f, -0.00048697f,
|
||||
0.408071f, -0.287507f, 0.150419f,
|
||||
-0.147452f, 0.289219f, 0.649774f,
|
||||
0.14258f, -0.00089f, 0.436353f,
|
||||
0.007277f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 1.0f,
|
||||
0.0f},
|
||||
{"infohat", "infohat", LegoActorLOD::c_flag2,
|
||||
0, -0.00938, -0.01955,
|
||||
0.35, -0.231822, -0.140237,
|
||||
-0.320954, 0.234149, 0.076968,
|
||||
0.249083, 0.000191, 1.519793,
|
||||
0.001767, 0, 0,
|
||||
1, 0, 1,
|
||||
0},
|
||||
0.0f, -0.00938f, -0.01955f,
|
||||
0.35f, -0.231822f, -0.140237f,
|
||||
-0.320954f, 0.234149f, 0.076968f,
|
||||
0.249083f, 0.000191f, 1.519793f,
|
||||
0.001767f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 1.0f,
|
||||
0.0f},
|
||||
{"infogron", "infogron", LegoActorLOD::c_flag2,
|
||||
0, 0.11477, 0.00042,
|
||||
0.26, -0.285558, -0.134391,
|
||||
-0.142231, 0.285507, 0.152986,
|
||||
0.143071, -0.00089, 0.436353,
|
||||
0.007277, 0, 0,
|
||||
1, 0, 1,
|
||||
0},
|
||||
0.0f, 0.11477f, 0.00042f,
|
||||
0.26f, -0.285558f, -0.134391f,
|
||||
-0.142231f, 0.285507f, 0.152986f,
|
||||
0.143071f, -0.00089f, 0.436353f,
|
||||
0.007277f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 1.0f,
|
||||
0.0f},
|
||||
{"head", "head", LegoActorLOD::c_flag1,
|
||||
0, -0.03006, 0,
|
||||
0.3, -0.189506, -0.209665,
|
||||
-0.189824, 0.189532, 0.228822,
|
||||
0.194945, -0.00105, 1.293115,
|
||||
0.001781, 0, 0,
|
||||
1, 0, 1,
|
||||
0},
|
||||
0.0f, -0.03006f, 0.0f,
|
||||
0.3f, -0.189506f, -0.209665f,
|
||||
-0.189824f, 0.189532f, 0.228822f,
|
||||
0.194945f, -0.00105f, 1.293115f,
|
||||
0.001781f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 1.0f,
|
||||
0.0f},
|
||||
{"arm-lft", "arm-lft", LegoActorLOD::c_flag2,
|
||||
-0.06815, -0.0973747, 0.0154655,
|
||||
0.237, -0.137931, -0.282775,
|
||||
-0.105316, 0.000989, 0.100221,
|
||||
0.140759, -0.225678, 0.963312,
|
||||
0.023286, -0.003031, -0.017187,
|
||||
0.999848, 0.173622, 0.984658,
|
||||
0.017453},
|
||||
-0.06815f, -0.0973747f, 0.0154655f,
|
||||
0.237f, -0.137931f, -0.282775f,
|
||||
-0.105316f, 0.000989f, 0.100221f,
|
||||
0.140759f, -0.225678f, 0.963312f,
|
||||
0.023286f, -0.003031f, -0.017187f,
|
||||
0.999848f, 0.173622f, 0.984658f,
|
||||
0.017453f},
|
||||
{"arm-rt", "arm-rt", LegoActorLOD::c_flag2,
|
||||
0.0680946, -0.097152, 0.0152722,
|
||||
0.237, 0.00141, -0.289604,
|
||||
-0.100831, 0.138786, 0.09291,
|
||||
0.145437, 0.223494, 0.963583,
|
||||
0.018302, 0, 0,
|
||||
1, -0.173648, 0.984808,
|
||||
0},
|
||||
0.0680946f, -0.097152f, 0.0152722f,
|
||||
0.237f, 0.00141f, -0.289604f,
|
||||
-0.100831f, 0.138786f, 0.09291f,
|
||||
0.145437f, 0.223494f, 0.963583f,
|
||||
0.018302f, 0.0f, 0.0f,
|
||||
1.0f, -0.173648f, 0.984808f,
|
||||
0.0f},
|
||||
{"claw-lft", "claw-lft", LegoActorLOD::c_flag2,
|
||||
0.000773381, -0.101422, -0.0237761,
|
||||
0.15, -0.089838, -0.246208,
|
||||
-0.117735, 0.091275, 0.000263,
|
||||
0.07215, -0.341869, 0.700355,
|
||||
0.092779, 0.000001, 0.000003,
|
||||
1, 0.190812, 0.981627,
|
||||
-0.000003},
|
||||
0.000773381f, -0.101422f, -0.0237761f,
|
||||
0.15f, -0.089838f, -0.246208f,
|
||||
-0.117735f, 0.091275f, 0.000263f,
|
||||
0.07215f, -0.341869f, 0.700355f,
|
||||
0.092779f, 0.000001f, 0.000003f,
|
||||
1.0f, 0.190812f, 0.981627f,
|
||||
-0.000003f},
|
||||
{"claw-rt", "claw-lft", LegoActorLOD::c_flag2,
|
||||
0.000773381, -0.101422, -0.0237761,
|
||||
0.15, -0.095016, -0.245349,
|
||||
-0.117979, 0.086528, 0.00067,
|
||||
0.069743, 0.343317, 0.69924,
|
||||
0.096123, 0.00606, -0.034369,
|
||||
0.999391, -0.190704, 0.981027,
|
||||
0.034894},
|
||||
0.000773381f, -0.101422f, -0.0237761f,
|
||||
0.15f, -0.095016f, -0.245349f,
|
||||
-0.117979f, 0.086528f, 0.00067f,
|
||||
0.069743f, 0.343317f, 0.69924f,
|
||||
0.096123f, 0.00606f, -0.034369f,
|
||||
0.999391f, -0.190704f, 0.981027f,
|
||||
0.034894f},
|
||||
{"leg-lft", "leg", LegoActorLOD::c_flag2,
|
||||
0.00433584, -0.177404, -0.0313928,
|
||||
0.33, -0.129782, -0.440428,
|
||||
-0.184207, 0.13817, 0.118415,
|
||||
0.122607, -0.156339, 0.436087,
|
||||
0.006822, 0, 0,
|
||||
1, 0, 1,
|
||||
0},
|
||||
0.00433584f, -0.177404f, -0.0313928f,
|
||||
0.33f, -0.129782f, -0.440428f,
|
||||
-0.184207f, 0.13817f, 0.118415f,
|
||||
0.122607f, -0.156339f, 0.436087f,
|
||||
0.006822f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 1.0f,
|
||||
0.0f},
|
||||
{"leg-rt", "leg", LegoActorLOD::c_flag2,
|
||||
0.00433584, -0.177404, -0.0313928,
|
||||
0.33, -0.132864, -0.437138,
|
||||
-0.183944, 0.134614, 0.12043,
|
||||
0.121888, 0.151154, 0.436296,
|
||||
0.007373, 0, 0,
|
||||
1, 0, 1,
|
||||
0}
|
||||
0.00433584f, -0.177404f, -0.0313928f,
|
||||
0.33f, -0.132864f, -0.437138f,
|
||||
-0.183944f, 0.134614f, 0.12043f,
|
||||
0.121888f, 0.151154f, 0.436296f,
|
||||
0.007373f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 1.0f,
|
||||
0.0f}
|
||||
};
|
||||
|
||||
// GLOBAL: LEGO1 0x100da778
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -183,6 +183,7 @@ void LegoAnimActor::ClearMaps()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1001c870
|
||||
// FUNCTION: BETA10 0x1003e7e4
|
||||
void LegoAnimActor::SetWorldSpeed(MxFloat p_worldSpeed)
|
||||
{
|
||||
if (p_worldSpeed < 0) {
|
||||
|
@@ -138,7 +138,7 @@ public:
|
||||
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);
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user