Fix
This commit is contained in:
parent
52add9ef91
commit
aaf9325f07
@ -129,13 +129,14 @@ namespace Components
|
|||||||
|
|
||||||
if (!surfs->surfaces)
|
if (!surfs->surfaces)
|
||||||
{
|
{
|
||||||
|
Assert_Offset(Game::XModelLodInfo, partBits, 12);
|
||||||
Game::XModelSurfs* newSurfs = ModelSurfs::LoadXModelSurfaces(surfs->name);
|
Game::XModelSurfs* newSurfs = ModelSurfs::LoadXModelSurfaces(surfs->name);
|
||||||
|
|
||||||
surfs->surfaces = newSurfs->surfaces;
|
surfs->surfaces = newSurfs->surfaces;
|
||||||
surfs->numSurfaces = newSurfs->numSurfaces;
|
surfs->numSurfaces = newSurfs->numSurfaces;
|
||||||
|
|
||||||
model->lods[i].surfs = newSurfs->surfaces;
|
model->lods[i].surfs = newSurfs->surfaces;
|
||||||
std::memcpy(model->lods[i].pad3, newSurfs->pad, 24);
|
std::memcpy(model->lods[i].partBits, newSurfs->pad, 24);
|
||||||
|
|
||||||
short numSurfs = static_cast<short>(newSurfs->numSurfaces);
|
short numSurfs = static_cast<short>(newSurfs->numSurfaces);
|
||||||
model->lods[i].numSurfs = numSurfs;
|
model->lods[i].numSurfs = numSurfs;
|
||||||
|
@ -93,8 +93,10 @@ namespace Components
|
|||||||
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
|
Assert_Offset(Game::XModelLodInfo, partBits, 12);
|
||||||
|
|
||||||
std::memcpy(&model->lods[i], &xmodel[72 + (i * 56)], 12);
|
std::memcpy(&model->lods[i], &xmodel[72 + (i * 56)], 12);
|
||||||
std::memcpy(&model->lods[i].pad3, &xmodel[72 + (i * 56) + 16], 32);
|
std::memcpy(&model->lods[i].partBits, &xmodel[72 + (i * 56) + 16], 32);
|
||||||
|
|
||||||
std::memcpy(reinterpret_cast<char*>(&model) + (size - 4) - (i * 4), &xmodel[72 + (i * 56) + 12], 4);
|
std::memcpy(reinterpret_cast<char*>(&model) + (size - 4) - (i * 4), &xmodel[72 + (i * 56) + 12], 4);
|
||||||
}
|
}
|
||||||
|
@ -1425,8 +1425,8 @@ namespace Game
|
|||||||
short numSurfs; // +4
|
short numSurfs; // +4
|
||||||
short maxSurfs;// +6
|
short maxSurfs;// +6
|
||||||
XModelSurfs* surfaces; // +8
|
XModelSurfs* surfaces; // +8
|
||||||
int partBits[4];
|
int partBits[4]; // +12
|
||||||
char pad3[8]; // +12
|
char pad3[8];
|
||||||
XSurface* surfs;
|
XSurface* surfs;
|
||||||
char pad4[4];
|
char pad4[4];
|
||||||
};
|
};
|
||||||
|
@ -141,6 +141,7 @@ using namespace std::literals;
|
|||||||
#define CLIENT_CONFIG "iw4x_config.cfg"
|
#define CLIENT_CONFIG "iw4x_config.cfg"
|
||||||
|
|
||||||
#define Assert_Size(x, size) static_assert(sizeof(x) == size, STRINGIZE(x) " structure has an invalid size.")
|
#define Assert_Size(x, size) static_assert(sizeof(x) == size, STRINGIZE(x) " structure has an invalid size.")
|
||||||
|
#define Assert_Offset(x, y, offset) static_assert(offsetof(x, y) == offset, STRINGIZE(x) "::" STRINGIZE(y) " is not at the right offset.")
|
||||||
|
|
||||||
// Resource stuff
|
// Resource stuff
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
Loading…
Reference in New Issue
Block a user