mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-10 18:21:14 +00:00
Some checks failed
CI / clang-format (push) Has been cancelled
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Has been cancelled
CI / C++ (push) Has been cancelled
Docker / Publish web port (push) Has been cancelled
CI / Release (push) Has been cancelled
97 lines
2.1 KiB
C++
97 lines
2.1 KiB
C++
#include "legomesh.h"
|
|
|
|
#include "misc/legostorage.h"
|
|
|
|
#include <SDL3/SDL_stdinc.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';
|
|
SDL_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';
|
|
SDL_strlwr(m_materialName);
|
|
}
|
|
|
|
return SUCCESS;
|
|
}
|