Revert "[ZoneBuilder] Store inter-asset-related pointers"
This commit is contained in:
parent
4c1859e871
commit
d5e1c6a371
@ -126,13 +126,9 @@ namespace Assets
|
||||
AssertSize(Game::cplane_t, 20);
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
builder->storePointer(asset->planes);
|
||||
|
||||
for (int i = 0; i < world->planeCount; ++i)
|
||||
{
|
||||
builder->storePointer(&asset->planes[i]);
|
||||
buffer->save(&asset->planes[i]);
|
||||
}
|
||||
|
||||
buffer->saveArray(asset->planes, world->planeCount);
|
||||
Utils::Stream::ClearPointer(&dest->planes);
|
||||
}
|
||||
}
|
||||
@ -619,13 +615,9 @@ namespace Assets
|
||||
else
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_2);
|
||||
builder->storePointer(aabbTree->smodelIndexes);
|
||||
|
||||
for (unsigned short k = 0; k < aabbTree->smodelIndexCount; ++k)
|
||||
{
|
||||
builder->storePointer(&aabbTree->smodelIndexes[k]);
|
||||
buffer->save(&aabbTree->smodelIndexes[k]);
|
||||
}
|
||||
|
||||
buffer->saveArray(aabbTree->smodelIndexes, aabbTree->smodelIndexCount);
|
||||
Utils::Stream::ClearPointer(&destAabbTree->smodelIndexes);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ namespace Assets
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
builder->storePointer(side->side);
|
||||
buffer->save(side->side);
|
||||
|
||||
buffer->save(side->side, sizeof(Game::cplane_t));
|
||||
Utils::Stream::ClearPointer(&destSide->side);
|
||||
}
|
||||
}
|
||||
@ -67,13 +68,9 @@ namespace Assets
|
||||
else
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
builder->storePointer(brush->planes);
|
||||
|
||||
for (short i = 0; i < brush->brush.count; ++i)
|
||||
{
|
||||
builder->storePointer(&brush->planes[i]);
|
||||
buffer->save(&brush->planes[i]);
|
||||
}
|
||||
|
||||
buffer->save(brush->planes, sizeof(Game::cplane_t));
|
||||
Utils::Stream::ClearPointer(&destBrush->planes);
|
||||
}
|
||||
}
|
||||
|
@ -32,13 +32,9 @@ namespace Assets
|
||||
else
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
builder->storePointer(asset->cPlanes);
|
||||
|
||||
for (int i = 0; i < asset->numCPlanes; ++i)
|
||||
{
|
||||
builder->storePointer(&asset->cPlanes[i]);
|
||||
buffer->save(&asset->cPlanes[i]);
|
||||
}
|
||||
|
||||
buffer->saveArray(asset->cPlanes, asset->numCPlanes);
|
||||
Utils::Stream::ClearPointer(&dest->cPlanes);
|
||||
}
|
||||
|
||||
@ -51,9 +47,8 @@ namespace Assets
|
||||
AssertSize(Game::cStaticModel_t, 76);
|
||||
SaveLogEnter("cStaticModel_t");
|
||||
|
||||
// xmodel is already stored
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Utils::Stream::Offset mark = buffer->getOffset();
|
||||
Game::cStaticModel_t* destStaticModelList = buffer->dest<Game::cStaticModel_t>();
|
||||
buffer->saveArray(asset->staticModelList, asset->numStaticModels);
|
||||
|
||||
@ -209,13 +204,9 @@ namespace Assets
|
||||
else
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_2);
|
||||
builder->storePointer(node[i].data.brushes);
|
||||
|
||||
for (short j = 0; j < node[i].leafBrushCount; ++j)
|
||||
{
|
||||
builder->storePointer(&node[i].data.brushes[j]);
|
||||
buffer->save(&node[i].data.brushes[j]);
|
||||
}
|
||||
|
||||
buffer->saveArray(node[i].data.brushes, node[i].leafBrushCount);
|
||||
Utils::Stream::ClearPointer(&node[i].data.brushes);
|
||||
}
|
||||
}
|
||||
@ -436,7 +427,7 @@ namespace Assets
|
||||
|
||||
if (asset->mapEnts)
|
||||
{
|
||||
dest->mapEnts = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MAP_ENTS, asset->mapEnts->name).mapEnts;
|
||||
dest->mapEnts = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MAP_ENTS, asset->name).mapEnts;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
|
@ -374,14 +374,9 @@ namespace Components
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ZoneBuilder::Zone::storePointer(const void* pointer, Utils::Stream::Offset offset)
|
||||
{
|
||||
this->pointerMap[pointer] = offset.getPackedOffset();
|
||||
}
|
||||
|
||||
void ZoneBuilder::Zone::storePointer(const void* pointer)
|
||||
{
|
||||
this->storePointer(pointer, this->buffer.getOffset());
|
||||
this->pointerMap[pointer] = this->buffer.getPackedOffset();
|
||||
}
|
||||
|
||||
int ZoneBuilder::Zone::addScriptString(std::string str)
|
||||
|
@ -20,7 +20,6 @@ namespace Components
|
||||
|
||||
bool hasPointer(const void* pointer);
|
||||
void storePointer(const void* pointer);
|
||||
void storePointer(const void* pointer, Utils::Stream::Offset offset);
|
||||
|
||||
template<typename T>
|
||||
inline T* getPointer(const T* pointer) { return reinterpret_cast<T*>(this->safeGetPointer(pointer)); }
|
||||
|
@ -1542,10 +1542,9 @@ namespace Game
|
||||
struct cbrushWrapper_t
|
||||
{
|
||||
short count;
|
||||
short pad;
|
||||
cbrushside_t* brushSide;
|
||||
char * brushEdge;
|
||||
char pad2[24];
|
||||
char pad[24];
|
||||
};
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
@ -277,20 +277,14 @@ namespace Utils
|
||||
return 0;
|
||||
}
|
||||
|
||||
Stream::Offset Stream::getOffset()
|
||||
DWORD Stream::getPackedOffset()
|
||||
{
|
||||
Game::XFILE_BLOCK_TYPES block = this->getCurrentBlock();
|
||||
|
||||
Stream::Offset offset;
|
||||
offset.block = block;
|
||||
offset.offset = this->getBlockSize(block);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
DWORD Stream::getPackedOffset()
|
||||
{
|
||||
return this->getOffset().getPackedOffset();
|
||||
return offset.getPackedOffset();
|
||||
}
|
||||
|
||||
void Stream::toBuffer(std::string& outBuffer)
|
||||
|
@ -177,7 +177,5 @@ namespace Utils
|
||||
return lOffset.block;
|
||||
};
|
||||
};
|
||||
|
||||
Offset getOffset();
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user