mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-10 18:21:16 +00:00
Some checks failed
Analyze / ${{ matrix.who }} annotations (CONFIG) (push) Has been cancelled
Analyze / ${{ matrix.who }} annotations (ISLE) (push) Has been cancelled
Analyze / ${{ matrix.who }} annotations (LEGO1) (push) Has been cancelled
Build / Download original binaries (push) Has been cancelled
Build / Current ${{ matrix.toolchain.name }} (map[clang-tidy:true msys-env:mingw-w64-i686 msystem:mingw32 name:msys2 mingw32 shell:msys2 {0} werror:true]) (push) Has been cancelled
Build / Current ${{ matrix.toolchain.name }} (map[name:MSVC setup-cmake:true setup-msvc:true setup-ninja:true shell:sh]) (push) Has been cancelled
Build / MSVC 4.20 (push) Has been cancelled
Build / MSVC 4.20 (BETA10) (push) Has been cancelled
Format / C++ (push) Has been cancelled
Naming / C++ (push) Has been cancelled
Build / Verify decomp (push) Has been cancelled
Build / Upload artifacts (push) Has been cancelled
* beta match LegoLOD, part 1 * Fix name collision for Ghidra * More LegoLOD matches * LegoMesh and LegoColor matches * Various matches * 73 % beta match on LegoLOD::Read * Fix LEGO1 regressions, improve match * 70.93 % on LEGO1 * 72.85 %, stack too small now * Cleanup * Cleanup --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
95 lines
2.0 KiB
C++
95 lines
2.0 KiB
C++
#include "legomesh.h"
|
|
|
|
#include "misc/legostorage.h"
|
|
|
|
DECOMP_SIZE_ASSERT(LegoMeshUnkComponent, 0x1c)
|
|
DECOMP_SIZE_ASSERT(LegoMesh, 0x24)
|
|
|
|
// FUNCTION: LEGO1 0x100d3810
|
|
// FUNCTION: BETA10 0x1018fd60
|
|
LegoMesh::LegoMesh()
|
|
{
|
|
m_alpha = 0.0F;
|
|
m_shading = e_flat;
|
|
m_unk0x14 = 0;
|
|
m_textureName = NULL;
|
|
m_unk0x0d = 0;
|
|
m_unk0x10 = NULL;
|
|
m_unk0x20 = 0;
|
|
m_useAlias = FALSE;
|
|
m_materialName = NULL;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100d3860
|
|
// FUNCTION: BETA10 0x1018fddb
|
|
LegoMesh::~LegoMesh()
|
|
{
|
|
if (m_textureName != NULL) {
|
|
delete[] m_textureName;
|
|
}
|
|
|
|
if (m_materialName != NULL) {
|
|
delete[] m_materialName;
|
|
}
|
|
|
|
if (m_unk0x10 != NULL) {
|
|
delete m_unk0x10;
|
|
}
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100d38f0
|
|
// FUNCTION: BETA10 0x1018ff5d
|
|
LegoResult LegoMesh::Read(LegoStorage* p_storage)
|
|
{
|
|
LegoResult result;
|
|
LegoU32 textureLength, materialLength;
|
|
if ((result = m_color.Read(p_storage)) != SUCCESS) {
|
|
return result;
|
|
}
|
|
if ((result = p_storage->Read(&m_alpha, sizeof(LegoFloat))) != SUCCESS) {
|
|
return result;
|
|
}
|
|
if ((result = p_storage->Read(&m_shading, sizeof(LegoU8))) != SUCCESS) {
|
|
return result;
|
|
}
|
|
if ((result = p_storage->Read(&m_unk0x0d, sizeof(LegoU8))) != SUCCESS) {
|
|
return result;
|
|
}
|
|
if ((result = p_storage->Read(&m_unk0x20, sizeof(undefined))) != SUCCESS) {
|
|
return result;
|
|
}
|
|
if ((result = p_storage->Read(&m_useAlias, sizeof(LegoU8))) != SUCCESS) {
|
|
return result;
|
|
}
|
|
|
|
if ((result = p_storage->Read(&textureLength, sizeof(LegoU32))) != SUCCESS) {
|
|
return result;
|
|
}
|
|
if (textureLength) {
|
|
m_textureName = new LegoChar[textureLength + 1];
|
|
|
|
if ((result = p_storage->Read(m_textureName, textureLength)) != SUCCESS) {
|
|
return result;
|
|
}
|
|
|
|
m_textureName[textureLength] = '\0';
|
|
strlwr(m_textureName);
|
|
}
|
|
|
|
if ((result = p_storage->Read(&materialLength, sizeof(LegoU32))) != SUCCESS) {
|
|
return result;
|
|
}
|
|
if (materialLength) {
|
|
m_materialName = new LegoChar[materialLength + 1];
|
|
|
|
if ((result = p_storage->Read(m_materialName, materialLength)) != SUCCESS) {
|
|
return result;
|
|
}
|
|
|
|
m_materialName[materialLength] = '\0';
|
|
strlwr(m_materialName);
|
|
}
|
|
|
|
return SUCCESS;
|
|
}
|