[IclipMap_t] Small fixes, stuff is still broken

This commit is contained in:
momo5502 2016-12-21 20:11:27 +01:00
parent 079f05d6eb
commit 9505d8cbe4
2 changed files with 29 additions and 29 deletions

View File

@ -154,6 +154,8 @@ namespace Assets
if (asset->cLeafBrushNodes) if (asset->cLeafBrushNodes)
{ {
AssertSize(Game::cLeafBrushNode_t, 20);
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
Game::cLeafBrushNode_t* node = buffer->dest<Game::cLeafBrushNode_t>(); Game::cLeafBrushNode_t* node = buffer->dest<Game::cLeafBrushNode_t>();
buffer->saveArray(asset->cLeafBrushNodes, asset->numCLeafBrushNodes); buffer->saveArray(asset->cLeafBrushNodes, asset->numCLeafBrushNodes);
@ -162,19 +164,19 @@ namespace Assets
{ {
if (node[i].leafBrushCount > 0) if (node[i].leafBrushCount > 0)
{ {
if (node[i].data.leaf.brushes) if (node[i].data.brushes)
{ {
if (builder->hasPointer(node[i].data.leaf.brushes)) if (builder->hasPointer(node[i].data.brushes))
{ {
node[i].data.leaf.brushes = builder->getPointer(node[i].data.leaf.brushes); node[i].data.brushes = builder->getPointer(node[i].data.brushes);
} }
else else
{ {
builder->storePointer(node[i].data.leaf.brushes); builder->storePointer(node[i].data.brushes);
buffer->align(Utils::Stream::ALIGN_2); buffer->align(Utils::Stream::ALIGN_2);
buffer->saveArray(node[i].data.leaf.brushes, node[i].leafBrushCount); buffer->saveArray(node[i].data.brushes, node[i].leafBrushCount);
Utils::Stream::ClearPointer(&node[i].data.leaf.brushes); Utils::Stream::ClearPointer(&node[i].data.brushes);
} }
} }
} }
@ -452,7 +454,7 @@ namespace Assets
void IclipMap_t::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) void IclipMap_t::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
{ {
Game::clipMap_t* asset = header.clipMap; Game::clipMap_t* asset = header.clipMap;
for (int i = 0; i < asset->numStaticModels; i++) for (int i = 0; i < asset->numStaticModels; ++i)
{ {
Game::XModel* m = asset->staticModelList[i].xmodel; Game::XModel* m = asset->staticModelList[i].xmodel;
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, m->name); builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, m->name);
@ -460,14 +462,24 @@ namespace Assets
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)
{ {
for (int i = 0; i < asset->dynEntCount[j]; i++) Game::DynEntityDef* def = asset->dynEntDefList[j];
for (int i = 0; i < asset->dynEntCount[j]; ++i)
{ {
Game::XModel* m = asset->dynEntDefList[j][i].xModel; if (def[i].xModel)
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, m->name); {
Game::FxEffectDef* fx = asset->dynEntDefList[j][i].destroyFx; builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, def[i].xModel->name);
builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, fx->name); }
Game::PhysPreset* p = asset->dynEntDefList[j][i].physPreset;
builder->loadAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, p->name); if (def[i].destroyFx)
{
builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, def[i].destroyFx->name);
}
if (def[i].physPreset)
{
builder->loadAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, def[i].physPreset->name);
}
} }
} }
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MAP_ENTS, asset->name); builder->loadAsset(Game::XAssetType::ASSET_TYPE_MAP_ENTS, asset->name);

View File

@ -2294,30 +2294,18 @@ namespace Game
int leafBrushNode; int leafBrushNode;
}; };
struct cLeafBrushNodeLeaf struct cLeafBrushNodeLeaf_t
{ {
unsigned __int16 *brushes; unsigned __int16 *brushes;
}; };
struct cLeafBrushNodeChildren
{
float dist;
float range;
unsigned __int16 childOffset[6];
};
union cLeafBrushNodeData
{
cLeafBrushNodeLeaf leaf;
cLeafBrushNodeChildren children;
};
struct cLeafBrushNode_t struct cLeafBrushNode_t
{ {
char axis; char axis;
__int16 leafBrushCount; __int16 leafBrushCount;
int contents; int contents;
cLeafBrushNodeData data; cLeafBrushNodeLeaf_t data;
char pad[8];
}; };
struct cmodel_t struct cmodel_t