From 078bae09faf99e2ff555aa2b39c8071aac52f894 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 21 Mar 2024 21:08:21 -0400 Subject: [PATCH] Add LegoCharacterLOD --- LEGO1/lego/legoomni/include/legocharacters.h | 20 +++++ .../src/common/legocharactermanager.cpp | 28 +++--- .../legoomni/src/common/legocharacters.cpp | 87 +++++++++++++++++++ 3 files changed, 117 insertions(+), 18 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocharacters.h b/LEGO1/lego/legoomni/include/legocharacters.h index 1db139dd..ea89f10e 100644 --- a/LEGO1/lego/legoomni/include/legocharacters.h +++ b/LEGO1/lego/legoomni/include/legocharacters.h @@ -27,4 +27,24 @@ struct LegoCharacterData { Part m_parts[10]; // 0x18 }; +// SIZE 0x58 +struct LegoCharacterLOD { + enum { + c_flag1 = 0x01, + c_flag2 = 0x02 + }; + + const char* m_name; // 0x00 + const char* m_parentName; // 0x04 + MxU8 m_flags; // 0x08 + float m_boundingSphere[4]; // 0x0c + float m_boundingBox[6]; // 0x1c + float m_position[3]; // 0x34 + float m_direction[3]; // 0x40 + float m_up[3]; // 0x4c +}; + +extern LegoCharacterData g_characterDataInit[66]; +extern LegoCharacterLOD g_characterLODs[11]; + #endif // LEGOCHARACTERS_H diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 1df9f5d8..240477bd 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -11,20 +11,12 @@ DECOMP_SIZE_ASSERT(LegoCharacter, 0x08) DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08) -// GLOBAL: LEGO1 0x100da3bc -float g_roiBoundingSphere[] = {0.000267, 0.78080797, -0.01906, 0.951612}; - -// GLOBAL: LEGO1 0x100da3cc -float g_roiBoundingBox[] = {-0.46116599, -0.002794, -0.29944199, 0.46169999, 1.56441, 0.261321}; - // GLOBAL: LEGO1 0x100fc4e4 char* LegoCharacterManager::g_customizeAnimFile = NULL; // GLOBAL: LEGO1 0x10104f20 LegoCharacterData g_characterData[66]; -extern LegoCharacterData g_characterDataInit[66]; - // FUNCTION: LEGO1 0x10082a20 LegoCharacterManager::LegoCharacterManager() { @@ -235,19 +227,19 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) roi = new LegoROI(renderer); roi->SetName(p_key); - boundingSphere.Center()[0] = g_roiBoundingSphere[0]; - boundingSphere.Center()[1] = g_roiBoundingSphere[1]; - boundingSphere.Center()[2] = g_roiBoundingSphere[2]; - boundingSphere.Radius() = g_roiBoundingSphere[3]; + boundingSphere.Center()[0] = g_characterLODs[0].m_boundingSphere[0]; + boundingSphere.Center()[1] = g_characterLODs[0].m_boundingSphere[1]; + boundingSphere.Center()[2] = g_characterLODs[0].m_boundingSphere[2]; + boundingSphere.Radius() = g_characterLODs[0].m_boundingSphere[3]; roi->SetBoundingSphere(boundingSphere); - boundingBox.Min()[0] = g_roiBoundingBox[0]; - boundingBox.Min()[1] = g_roiBoundingBox[1]; - boundingBox.Min()[2] = g_roiBoundingBox[2]; - boundingBox.Max()[0] = g_roiBoundingBox[3]; - boundingBox.Max()[1] = g_roiBoundingBox[4]; - boundingBox.Max()[2] = g_roiBoundingBox[5]; + boundingBox.Min()[0] = g_characterLODs[0].m_boundingBox[0]; + boundingBox.Min()[1] = g_characterLODs[0].m_boundingBox[1]; + boundingBox.Min()[2] = g_characterLODs[0].m_boundingBox[2]; + boundingBox.Max()[0] = g_characterLODs[0].m_boundingBox[3]; + boundingBox.Max()[1] = g_characterLODs[0].m_boundingBox[4]; + boundingBox.Max()[2] = g_characterLODs[0].m_boundingBox[5]; roi->SetUnknown0x80(boundingBox); diff --git a/LEGO1/lego/legoomni/src/common/legocharacters.cpp b/LEGO1/lego/legoomni/src/common/legocharacters.cpp index 98179d78..1bcd20db 100644 --- a/LEGO1/lego/legoomni/src/common/legocharacters.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharacters.cpp @@ -2,6 +2,93 @@ DECOMP_SIZE_ASSERT(LegoCharacterData, 0x108) DECOMP_SIZE_ASSERT(LegoCharacterData::Part, 0x18) +DECOMP_SIZE_ASSERT(LegoCharacterLOD, 0x58) + +// GLOBAL: LEGO1 0x100da3b0 +LegoCharacterLOD g_characterLODs[] = { + {"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}, + {"body", "body", LegoCharacterLOD::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}, + {"infohat", "infohat", LegoCharacterLOD::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}, + {"infogron", "infogron", LegoCharacterLOD::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}, + {"head", "head", LegoCharacterLOD::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}, + {"arm-lft", "arm-lft", LegoCharacterLOD::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}, + {"arm-rt", "arm-rt", LegoCharacterLOD::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}, + {"claw-lft", "claw-lft", LegoCharacterLOD::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}, + {"claw-rt", "claw-lft", LegoCharacterLOD::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}, + {"leg-lft", "leg", LegoCharacterLOD::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}, + {"leg-rt", "leg", LegoCharacterLOD::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} +}; // GLOBAL: LEGO1 0x100da778 MxS8 g_unk0x100da778[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1};