[XModel] Adapt structure

This commit is contained in:
momo5502 2016-12-20 18:15:28 +01:00
parent 8ec4369ba3
commit 1c82e29871
4 changed files with 16 additions and 16 deletions

View File

@ -1,6 +1,6 @@
#include <STDInclude.hpp>
#define IW4X_MODEL_VERSION 1
#define IW4X_MODEL_VERSION 2
namespace Assets
{
@ -91,12 +91,13 @@ namespace Assets
surface->deformed = reader.read<char>();
surface->streamHandle = reader.read<unsigned char>();
surface->flags = reader.read<unsigned short>();
surface->something = reader.read<short>();
surface->something2 = reader.read<int>();
surface->partBits[0] = reader.read<int>();
surface->partBits[1] = reader.read<int>();
surface->partBits[2] = reader.read<int>();
surface->partBits[3] = reader.read<int>();
surface->pad2 = reader.read<char>();
surface->pad3 = reader.read<int>();
surface->baseTriIndex = reader.read<unsigned __int16>();
surface->baseVertIndex = reader.read<unsigned __int16>();
surface->numVertices = reader.read<unsigned short>();
surface->numPrimitives = reader.read<unsigned short>();

View File

@ -132,7 +132,7 @@ namespace Components
std::memcpy(&tempSurfaces[i], source, 12);
std::memcpy(&tempSurfaces[i].indexBuffer, source + 16, 20);
std::memcpy(&tempSurfaces[i].numCT, source + 40, 8);
std::memcpy(&tempSurfaces[i].something, source + 52, 24);
std::memcpy(&tempSurfaces[i].partBits, source + 52, 24);
tempSurfaces[i].streamHandle = 0xFF; // Fake handle for buffer interception
}
@ -164,7 +164,7 @@ namespace Components
surfs->numSurfaces = newSurfs->numSurfaces;
model->lods[i].surfs = newSurfs->surfaces;
std::memcpy(&model->lods[i].partBits, newSurfs->pad, 24);
std::memcpy(&model->lods[i].partBits, newSurfs->partBits, 24);
short numSurfs = static_cast<short>(newSurfs->numSurfaces);
model->lods[i].numSurfs = numSurfs;

View File

@ -167,7 +167,7 @@ namespace Components
std::memcpy(&tempSurfaces[i], source, 12);
std::memcpy(&tempSurfaces[i].indexBuffer, source + 16, 20);
std::memcpy(&tempSurfaces[i].numCT, source + 40, 8);
std::memcpy(&tempSurfaces[i].something, source + 52, 24);
std::memcpy(&tempSurfaces[i].partBits, source + 52, 24);
if (Zones::ZoneVersion >= 332)
{

View File

@ -1472,8 +1472,8 @@ namespace Game
unsigned short numVertices; // +2
unsigned short numPrimitives; // +4
unsigned char streamHandle; // something to do with buffers, +6
char pad2; // +7
int pad3; // +8
unsigned __int16 baseTriIndex;
unsigned __int16 baseVertIndex;
Face* indexBuffer; // +12
short blendNum1; // +16
short blendNum2; // +18
@ -1483,10 +1483,8 @@ namespace Game
GfxPackedVertex* vertexBuffer; // +28
int numCT; // +32
XRigidVertList* ct; // +36
short something;
unsigned short flags;
int something2;
char pad5[16]; // +40
int partBits[4];
char pad5[8]; // +40
// pad5 matches XModelSurfaces pad
// total size, 64
};
@ -1496,7 +1494,8 @@ namespace Game
const char* name;
XSurface* surfaces;
int numSurfaces;
char pad[24];
int partBits[4];
char pad[8];
};
struct XModelLodInfo