[IXModel] Correctly load coll surfs

This commit is contained in:
momo5502 2017-01-02 19:31:32 +01:00
parent 2c7b7f6d87
commit 45c49d4171
2 changed files with 20 additions and 9 deletions

View File

@ -166,9 +166,9 @@ namespace Assets
for (int i = 0; i < model->numColSurfs; ++i) for (int i = 0; i < model->numColSurfs; ++i)
{ {
if (model->colSurf[i].tris) if (model->colSurf[i].collTris)
{ {
model->colSurf[i].tris = reader.read(48, model->colSurf[i].count); model->colSurf[i].collTris = reader.readArray<Game::XModelCollTri_s>(model->colSurf[i].numCollTris);
} }
} }
} }
@ -355,12 +355,12 @@ namespace Assets
Game::XModelCollSurf* destColSurf = &destColSurfs[i]; Game::XModelCollSurf* destColSurf = &destColSurfs[i];
Game::XModelCollSurf* colSurf = &asset->colSurf[i]; Game::XModelCollSurf* colSurf = &asset->colSurf[i];
if (colSurf->tris) if (colSurf->collTris)
{ {
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
buffer->save(colSurf->tris, 48, colSurf->count); buffer->save(colSurf->collTris, 48, colSurf->numCollTris);
Utils::Stream::ClearPointer(&destColSurf->tris); Utils::Stream::ClearPointer(&destColSurf->collTris);
} }
} }

View File

@ -1676,12 +1676,23 @@ namespace Game
float transWeight; float transWeight;
}; };
struct XModelCollTri_s
{
float plane[4];
float svec[4];
float tvec[4];
};
struct XModelCollSurf struct XModelCollSurf
{ {
void* tris; // +0, sizeof 48 XModelCollTri_s *collTris;
int count; // +4 int numCollTris;
char pad[36]; // +8 float mins[3];
}; // +44 float maxs[3];
int boneIdx;
int contents;
int surfFlags;
};
struct PhysPreset struct PhysPreset
{ {