[ZoneBuilder] IGfxWorld and IclipMap_t fixes
This commit is contained in:
parent
ec37ab6714
commit
e93831319f
@ -240,7 +240,6 @@ namespace Components
|
|||||||
|
|
||||||
void AssetHandler::OffsetToAlias(Utils::Stream::Offset* offset)
|
void AssetHandler::OffsetToAlias(Utils::Stream::Offset* offset)
|
||||||
{
|
{
|
||||||
// Same here, reinterpret the value, as we're operating inside the game's environment
|
|
||||||
void* pointer = (*Game::g_streamBlocks)[offset->getUnpackedBlock()].data + offset->getUnpackedOffset();
|
void* pointer = (*Game::g_streamBlocks)[offset->getUnpackedBlock()].data + offset->getUnpackedOffset();
|
||||||
|
|
||||||
if (AssetHandler::Relocations.find(pointer) != AssetHandler::Relocations.end())
|
if (AssetHandler::Relocations.find(pointer) != AssetHandler::Relocations.end())
|
||||||
@ -249,10 +248,6 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
offset->pointer = *reinterpret_cast<void**>(pointer);
|
offset->pointer = *reinterpret_cast<void**>(pointer);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
Game::XAssetHeader zob{ offset->pointer };
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetHandler::ZoneSave(Game::XAsset asset, ZoneBuilder::Zone* builder)
|
void AssetHandler::ZoneSave(Game::XAsset asset, ZoneBuilder::Zone* builder)
|
||||||
|
@ -146,7 +146,7 @@ namespace Assets
|
|||||||
if (asset->sceneEntCellBits)
|
if (asset->sceneEntCellBits)
|
||||||
{
|
{
|
||||||
buffer->align(Utils::Stream::ALIGN_4);
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
buffer->save(asset->sceneEntCellBits, 2048, asset->cellCount);
|
buffer->save(asset->sceneEntCellBits, 1, asset->cellCount << 11);
|
||||||
Utils::Stream::ClearPointer(&dest->sceneEntCellBits);
|
Utils::Stream::ClearPointer(&dest->sceneEntCellBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,12 +166,12 @@ namespace Assets
|
|||||||
Game::GfxImage** imageDest = buffer->dest<Game::GfxImage*>();
|
Game::GfxImage** imageDest = buffer->dest<Game::GfxImage*>();
|
||||||
buffer->saveArray(asset->reflectionImages, asset->reflectionProbeCount);
|
buffer->saveArray(asset->reflectionImages, asset->reflectionProbeCount);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < asset->reflectionProbeCount; i++)
|
for (unsigned int i = 0; i < asset->reflectionProbeCount; ++i)
|
||||||
{
|
{
|
||||||
imageDest[i] = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->reflectionImages[i]->name).image;
|
imageDest[i] = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->reflectionImages[i]->name).image;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Stream::ClearPointer(asset->reflectionImages);
|
Utils::Stream::ClearPointer(&dest->reflectionImages);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->reflectionProbes)
|
if (asset->reflectionProbes)
|
||||||
@ -205,7 +205,7 @@ namespace Assets
|
|||||||
Game::GfxLightmapArray* lightmapArrayDestTable = buffer->dest<Game::GfxLightmapArray>();
|
Game::GfxLightmapArray* lightmapArrayDestTable = buffer->dest<Game::GfxLightmapArray>();
|
||||||
buffer->saveArray(asset->lightmaps, asset->lightmapCount);
|
buffer->saveArray(asset->lightmaps, asset->lightmapCount);
|
||||||
|
|
||||||
for (int i = 0; i < asset->lightmapCount; i++)
|
for (int i = 0; i < asset->lightmapCount; ++i)
|
||||||
{
|
{
|
||||||
Game::GfxLightmapArray* lightmapArrayDest = &lightmapArrayDestTable[i];
|
Game::GfxLightmapArray* lightmapArrayDest = &lightmapArrayDestTable[i];
|
||||||
Game::GfxLightmapArray* lightmapArray = &asset->lightmaps[i];
|
Game::GfxLightmapArray* lightmapArray = &asset->lightmaps[i];
|
||||||
@ -221,7 +221,7 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Stream::ClearPointer(asset->reflectionImages);
|
Utils::Stream::ClearPointer(&dest->lightmaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->pushBlock(Game::XFILE_BLOCK_RUNTIME);
|
buffer->pushBlock(Game::XFILE_BLOCK_RUNTIME);
|
||||||
@ -256,13 +256,12 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
if (asset->vd.vertices)
|
if (asset->vd.vertices)
|
||||||
{
|
{
|
||||||
|
AssertSize(Game::GfxWorldVertex, 44);
|
||||||
|
|
||||||
buffer->align(Utils::Stream::ALIGN_4);
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
buffer->saveArray(asset->vd.vertices, asset->vertexCount);
|
buffer->saveArray(asset->vd.vertices, asset->vertexCount);
|
||||||
Utils::Stream::ClearPointer(&dest->vd.vertices);
|
Utils::Stream::ClearPointer(&dest->vd.vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this one has no if statement on purpouse
|
|
||||||
buffer->save(&asset->vd.worldVb, 1, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// saveGfxWorldVertexLayerData
|
// saveGfxWorldVertexLayerData
|
||||||
@ -274,8 +273,6 @@ namespace Assets
|
|||||||
buffer->saveArray(asset->vld.data, asset->vertexLayerDataSize);
|
buffer->saveArray(asset->vld.data, asset->vertexLayerDataSize);
|
||||||
Utils::Stream::ClearPointer(&dest->vld.data);
|
Utils::Stream::ClearPointer(&dest->vld.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->save(&asset->vld.layerVb, 1, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->indices)
|
if (asset->indices)
|
||||||
@ -295,7 +292,7 @@ namespace Assets
|
|||||||
if (asset->rowDataStart)
|
if (asset->rowDataStart)
|
||||||
{
|
{
|
||||||
buffer->align(Utils::Stream::ALIGN_2);
|
buffer->align(Utils::Stream::ALIGN_2);
|
||||||
buffer->saveArray(asset->rowDataStart, (asset->maxs[asset->rowAxis] - asset->mins[asset->rowAxis]) + 2);
|
buffer->saveArray(asset->rowDataStart, (asset->maxs[asset->rowAxis] - asset->mins[asset->rowAxis]) + 1);
|
||||||
Utils::Stream::ClearPointer(&dest->rowDataStart);
|
Utils::Stream::ClearPointer(&dest->rowDataStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +550,7 @@ namespace Assets
|
|||||||
|
|
||||||
this->saveGfxWorldDpvsPlanes(asset, &asset->dpvsPlanes, &dest->dpvsPlanes, builder);
|
this->saveGfxWorldDpvsPlanes(asset, &asset->dpvsPlanes, &dest->dpvsPlanes, builder);
|
||||||
|
|
||||||
uint32_t cellCount = asset->dpvsPlanes.cellCount;
|
int cellCount = asset->dpvsPlanes.cellCount;
|
||||||
|
|
||||||
if (asset->aabbTreeCounts)
|
if (asset->aabbTreeCounts)
|
||||||
{
|
{
|
||||||
@ -572,7 +569,7 @@ namespace Assets
|
|||||||
Game::GfxCellTree* destCellTreeTable = buffer->dest<Game::GfxCellTree>();
|
Game::GfxCellTree* destCellTreeTable = buffer->dest<Game::GfxCellTree>();
|
||||||
buffer->saveArray(asset->aabbTrees, cellCount);
|
buffer->saveArray(asset->aabbTrees, cellCount);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < cellCount; ++i)
|
for (int i = 0; i < cellCount; ++i)
|
||||||
{
|
{
|
||||||
Game::GfxCellTree* destCellTree = &destCellTreeTable[i];
|
Game::GfxCellTree* destCellTree = &destCellTreeTable[i];
|
||||||
Game::GfxCellTree* cellTree = &asset->aabbTrees[i];
|
Game::GfxCellTree* cellTree = &asset->aabbTrees[i];
|
||||||
@ -614,7 +611,6 @@ namespace Assets
|
|||||||
|
|
||||||
Utils::Stream::ClearPointer(&destCellTree->aabbTree);
|
Utils::Stream::ClearPointer(&destCellTree->aabbTree);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Stream::ClearPointer(&dest->aabbTrees);
|
Utils::Stream::ClearPointer(&dest->aabbTrees);
|
||||||
@ -628,7 +624,7 @@ namespace Assets
|
|||||||
Game::GfxCell* destCellTable = buffer->dest<Game::GfxCell>();
|
Game::GfxCell* destCellTable = buffer->dest<Game::GfxCell>();
|
||||||
buffer->saveArray(asset->cells, cellCount);
|
buffer->saveArray(asset->cells, cellCount);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < cellCount; ++i)
|
for (int i = 0; i < cellCount; ++i)
|
||||||
{
|
{
|
||||||
Game::GfxCell* destCell = &destCellTable[i];
|
Game::GfxCell* destCell = &destCellTable[i];
|
||||||
Game::GfxCell* cell = &asset->cells[i];
|
Game::GfxCell* cell = &asset->cells[i];
|
||||||
|
@ -29,9 +29,9 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
builder->storePointer(asset->cPlanes);
|
builder->storePointer(asset->cPlanes);
|
||||||
|
|
||||||
buffer->align(Utils::Stream::ALIGN_4);
|
|
||||||
buffer->saveArray(asset->cPlanes, asset->numCPlanes);
|
buffer->saveArray(asset->cPlanes, asset->numCPlanes);
|
||||||
Utils::Stream::ClearPointer(&dest->cPlanes);
|
Utils::Stream::ClearPointer(&dest->cPlanes);
|
||||||
}
|
}
|
||||||
@ -93,9 +93,9 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
builder->storePointer(sides[i].side);
|
builder->storePointer(sides[i].side);
|
||||||
|
|
||||||
buffer->align(Utils::Stream::ALIGN_4);
|
|
||||||
buffer->save(sides[i].side);
|
buffer->save(sides[i].side);
|
||||||
Utils::Stream::ClearPointer(&sides[i].side);
|
Utils::Stream::ClearPointer(&sides[i].side);
|
||||||
}
|
}
|
||||||
@ -130,9 +130,9 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
builder->storePointer(nodes[i].plane);
|
builder->storePointer(nodes[i].plane);
|
||||||
|
|
||||||
buffer->align(Utils::Stream::ALIGN_4);
|
|
||||||
buffer->save(nodes[i].plane);
|
buffer->save(nodes[i].plane);
|
||||||
Utils::Stream::ClearPointer(&nodes[i].plane);
|
Utils::Stream::ClearPointer(&nodes[i].plane);
|
||||||
}
|
}
|
||||||
@ -178,9 +178,9 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
buffer->align(Utils::Stream::ALIGN_2);
|
||||||
builder->storePointer(node[i].data.brushes);
|
builder->storePointer(node[i].data.brushes);
|
||||||
|
|
||||||
buffer->align(Utils::Stream::ALIGN_2);
|
|
||||||
buffer->saveArray(node[i].data.brushes, node[i].leafBrushCount);
|
buffer->saveArray(node[i].data.brushes, node[i].leafBrushCount);
|
||||||
Utils::Stream::ClearPointer(&node[i].data.brushes);
|
Utils::Stream::ClearPointer(&node[i].data.brushes);
|
||||||
}
|
}
|
||||||
@ -254,9 +254,9 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
builder->storePointer(border[i].borders);
|
builder->storePointer(border[i].borders);
|
||||||
|
|
||||||
buffer->align(Utils::Stream::ALIGN_4);
|
|
||||||
buffer->save(border[i].borders);
|
buffer->save(border[i].borders);
|
||||||
Utils::Stream::ClearPointer(&border[i].borders);
|
Utils::Stream::ClearPointer(&border[i].borders);
|
||||||
}
|
}
|
||||||
@ -302,11 +302,11 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
builder->storePointer(brushes[i].brushSide);
|
|
||||||
|
|
||||||
AssertSize(Game::cbrushside_t, 8);
|
AssertSize(Game::cbrushside_t, 8);
|
||||||
|
|
||||||
buffer->align(Utils::Stream::ALIGN_4);
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
|
builder->storePointer(brushes[i].brushSide);
|
||||||
|
|
||||||
Game::cbrushside_t* side = buffer->dest<Game::cbrushside_t>();
|
Game::cbrushside_t* side = buffer->dest<Game::cbrushside_t>();
|
||||||
buffer->save(brushes[i].brushSide);
|
buffer->save(brushes[i].brushSide);
|
||||||
|
|
||||||
@ -318,9 +318,9 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
builder->storePointer(brushes[i].brushSide->side);
|
builder->storePointer(brushes[i].brushSide->side);
|
||||||
|
|
||||||
buffer->align(Utils::Stream::ALIGN_4);
|
|
||||||
buffer->save(brushes[i].brushSide->side);
|
buffer->save(brushes[i].brushSide->side);
|
||||||
Utils::Stream::ClearPointer(&side->side);
|
Utils::Stream::ClearPointer(&side->side);
|
||||||
}
|
}
|
||||||
|
@ -2948,7 +2948,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
GfxPortalWritable writable;
|
GfxPortalWritable writable;
|
||||||
DpvsPlane plane;
|
DpvsPlane plane;
|
||||||
float(*vertices)[3];
|
vec3_t* vertices;
|
||||||
char unknown[2];
|
char unknown[2];
|
||||||
char vertexCount;
|
char vertexCount;
|
||||||
float hullAxis[2][3];
|
float hullAxis[2][3];
|
||||||
|
Loading…
Reference in New Issue
Block a user