From 51bbbdd58820c03d6df0e88927fb2a29f848dee5 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 6 Nov 2016 14:03:51 +0100 Subject: [PATCH] Model stuff --- .../Modules/AssetInterfaces/IXModel.cpp | 24 +++++++++++++++---- src/Components/Modules/FileSystem.cpp | 5 ++++ src/Game/Structs.hpp | 5 ++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/Components/Modules/AssetInterfaces/IXModel.cpp b/src/Components/Modules/AssetInterfaces/IXModel.cpp index 55abc41b..ee76cd13 100644 --- a/src/Components/Modules/AssetInterfaces/IXModel.cpp +++ b/src/Components/Modules/AssetInterfaces/IXModel.cpp @@ -48,17 +48,26 @@ namespace Assets surf->surfaces = builder->GetAllocator()->AllocateArray(model->numSurfaces); surf->numSurfaces = model->numSurfaces; - ZeroMemory(&model->lods[0], sizeof(Game::XModelLodInfo)); - model->lods[0].numSurfs = model->numSurfaces; - model->lods[0].surfaces = surf; - model->numLods = 1; - // Reset surfaces in remaining lods for (unsigned int i = 1; i < 4; ++i) { ZeroMemory(&model->lods[i], sizeof(Game::XModelLodInfo)); } + model->lods[0].dist = reader.Read(); + model->lods[0].numSurfs = reader.Read(); + model->lods[0].maxSurfs = reader.Read(); + + model->lods[0].partBits[0] = reader.Read(); + model->lods[0].partBits[1] = reader.Read(); + model->lods[0].partBits[2] = reader.Read(); + model->lods[0].partBits[3] = reader.Read(); + + model->lods[0].numSurfs = model->numSurfaces; // This is needed in case we have more than 1 LOD + model->lods[0].surfaces = surf; + model->lods[0].surfs = surf->surfaces; + model->numLods = 1; + // Read surfaces for (int i = 0; i < surf->numSurfaces; ++i) { @@ -207,6 +216,11 @@ namespace Assets Game::XModel* dest = buffer->Dest(); buffer->Save(asset); + if(asset->name == "viewmodel_m40a3"s) + { + OutputDebugStringA(""); + } + buffer->PushBlock(Game::XFILE_BLOCK_VIRTUAL); if (asset->name) diff --git a/src/Components/Modules/FileSystem.cpp b/src/Components/Modules/FileSystem.cpp index 32e1f0f3..8331e824 100644 --- a/src/Components/Modules/FileSystem.cpp +++ b/src/Components/Modules/FileSystem.cpp @@ -165,6 +165,11 @@ namespace Components void FileSystem::RegisterFolders() { + if (ZoneBuilder::IsEnabled()) + { + FileSystem::RegisterFolder("zonedata"); + } + FileSystem::RegisterFolder("userraw"); } diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index 1e636b4f..0dcfc901 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -1419,11 +1419,12 @@ namespace Game struct XModelLodInfo { - char pad[4]; + float dist; short numSurfs; // +4 short maxSurfs;// +6 XModelSurfs* surfaces; // +8 - char pad3[24]; // +12 + int partBits[4]; + char pad3[8]; // +12 XSurface* surfs; char pad4[4]; };