[IGfxWorld] Correct formatting

This commit is contained in:
momo5502 2016-12-20 17:42:15 +01:00
parent 58cedeaf5d
commit 3597bc7bfa
4 changed files with 480 additions and 449 deletions

View File

@ -421,6 +421,7 @@ namespace Components
AssetHandler::RegisterInterface(new Assets::IMapEnts());
AssetHandler::RegisterInterface(new Assets::IRawFile());
AssetHandler::RegisterInterface(new Assets::IGfxImage());
AssetHandler::RegisterInterface(new Assets::IGfxWorld());
AssetHandler::RegisterInterface(new Assets::ISndCurve());
AssetHandler::RegisterInterface(new Assets::IMaterial());
AssetHandler::RegisterInterface(new Assets::IPhysPreset());
@ -437,7 +438,6 @@ namespace Components
AssetHandler::RegisterInterface(new Assets::IMaterialVertexShader());
AssetHandler::RegisterInterface(new Assets::IStructuredDataDefSet());
AssetHandler::RegisterInterface(new Assets::IMaterialVertexDeclaration());
AssetHandler::RegisterInterface(new Assets::IGfxWorld());
}
}

View File

@ -77,6 +77,7 @@ namespace Components
#include "AssetInterfaces\IMapEnts.hpp"
#include "AssetInterfaces\IRawFile.hpp"
#include "AssetInterfaces\IGfxImage.hpp"
#include "AssetInterfaces\IGfxWorld.hpp"
#include "AssetInterfaces\IMaterial.hpp"
#include "AssetInterfaces\ISndCurve.hpp"
#include "AssetInterfaces\IPhysPreset.hpp"
@ -93,4 +94,3 @@ namespace Components
#include "AssetInterfaces\IMaterialVertexShader.hpp"
#include "AssetInterfaces\IStructuredDataDefSet.hpp"
#include "AssetInterfaces\IMaterialVertexDeclaration.hpp"
#include "AssetInterfaces\IGfxWorld.hpp"

View File

@ -6,6 +6,7 @@ namespace Assets
{
Game::GfxWorld* map = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_GFX_MAP, name.data()).gfxMap;
if (map) return;
Components::Logger::Error("Missing GfxMap %s... you can't make them yet you idiot.", name.data());
}
@ -14,10 +15,14 @@ namespace Assets
Utils::Stream* buffer = builder->getBuffer();
if(asset->planes) {
if(builder->hasPointer(asset->planes)) {
if (asset->planes)
{
if (builder->hasPointer(asset->planes))
{
dest->planes = builder->getPointer(asset->planes);
} else {
}
else
{
buffer->align(Utils::Stream::ALIGN_4);
builder->storePointer(asset->planes);
@ -45,7 +50,8 @@ namespace Assets
buffer->popBlock();
}
void IGfxWorld::saveGfxWorldDraw(Game::GfxWorldDraw* asset, Game::GfxWorldDraw* dest, Components::ZoneBuilder::Zone* builder) {
void IGfxWorld::saveGfxWorldDraw(Game::GfxWorldDraw* asset, Game::GfxWorldDraw* dest, Components::ZoneBuilder::Zone* builder)
{
AssertSize(Game::GfxWorldDraw, 72);
Utils::Stream* buffer = builder->getBuffer();
@ -61,6 +67,7 @@ namespace Assets
{
imageDest[i] = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->reflectionImages[i]->name).image;
}
Utils::Stream::ClearPointer(asset->reflectionImages);
}
@ -94,11 +101,13 @@ namespace Assets
Game::GfxLightmapArray* lightmapArrayDest = &lightmapArrayDestTable[i];
Game::GfxLightmapArray* lightmapArray = &asset->lightmaps[i];
if (lightmapArray->primary) {
if (lightmapArray->primary)
{
lightmapArrayDest->primary = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, lightmapArray->primary->name).image;
}
if (lightmapArray->secondary) {
if (lightmapArray->secondary)
{
lightmapArrayDest->secondary = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, lightmapArray->secondary->name).image;
}
}
@ -123,11 +132,13 @@ namespace Assets
buffer->popBlock();
if(asset->skyImage) {
if (asset->skyImage)
{
dest->skyImage = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->skyImage->name).image;
}
if(asset->outdoorImage) {
if (asset->outdoorImage)
{
dest->outdoorImage = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->outdoorImage->name).image;
}
@ -145,7 +156,8 @@ namespace Assets
buffer->save(&asset->vd.worldVb, 1, 4);
// saveGfxWorldVertexLayerData
if (asset->vld.data) {
if (asset->vld.data)
{
// no align for char
buffer->saveArray(asset->vld.data, asset->vertexLayerDataSize);
Utils::Stream::ClearPointer(&dest->vld.data);
@ -153,14 +165,16 @@ namespace Assets
buffer->save(&asset->vld.layerVb, 1, 4);
if (asset->indices) {
if (asset->indices)
{
buffer->align(Utils::Stream::ALIGN_2);
buffer->saveArray(asset->indices, asset->indexCount);
Utils::Stream::ClearPointer(&dest->indices);
}
}
void IGfxWorld::saveGfxLightGrid(Game::GfxLightGrid* asset, Game::GfxLightGrid* dest, Components::ZoneBuilder::Zone* builder) {
void IGfxWorld::saveGfxLightGrid(Game::GfxLightGrid* asset, Game::GfxLightGrid* dest, Components::ZoneBuilder::Zone* builder)
{
AssertSize(Game::GfxLightGrid, 56);
Utils::Stream* buffer = builder->getBuffer();
@ -194,25 +208,30 @@ namespace Assets
}
}
void IGfxWorld::savesunflare_t(Game::sunflare_t* asset, Game::sunflare_t* dest, Components::ZoneBuilder::Zone* builder) {
void IGfxWorld::savesunflare_t(Game::sunflare_t* asset, Game::sunflare_t* dest, Components::ZoneBuilder::Zone* builder)
{
AssertSize(Game::sunflare_t, 96);
if(asset->spriteMaterial) {
if (asset->spriteMaterial)
{
dest->spriteMaterial = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->spriteMaterial->name).material;
}
if(asset->flareMaterial) {
if (asset->flareMaterial)
{
dest->flareMaterial = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->flareMaterial->name).material;
}
}
void IGfxWorld::saveGfxWorldDpvsStatic(Game::GfxWorldDpvsStatic* /*asset*/, Game::GfxWorldDpvsStatic* /*dest*/, int /*planeCount*/, Components::ZoneBuilder::Zone* /*builder*/) {
void IGfxWorld::saveGfxWorldDpvsStatic(Game::GfxWorldDpvsStatic* /*asset*/, Game::GfxWorldDpvsStatic* /*dest*/, int /*planeCount*/, Components::ZoneBuilder::Zone* /*builder*/)
{
AssertSize(Game::GfxWorldDpvsStatic, 108);
//Utils::Stream* buffer = builder->getBuffer();
}
void IGfxWorld::saveGfxWorldDpvsDynamic(Game::GfxWorldDpvsDynamic* asset, Game::GfxWorldDpvsDynamic* dest, int planeCount, Components::ZoneBuilder::Zone* builder) {
void IGfxWorld::saveGfxWorldDpvsDynamic(Game::GfxWorldDpvsDynamic* asset, Game::GfxWorldDpvsDynamic* dest, int planeCount, Components::ZoneBuilder::Zone* builder)
{
AssertSize(Game::GfxWorldDpvsDynamic, 48);
Utils::Stream* buffer = builder->getBuffer();
@ -234,11 +253,11 @@ namespace Assets
}
// this covers [0][0], [1][0], [0][1], [1][1], [0][2], [1][2]
for(char i = 0; i < 3; i++)
for (char i = 0; i < 3; i++)
{
for (char j = 0; j < 2; j++)
{
if(asset->dynEntVisData[j][i])
if (asset->dynEntVisData[j][i])
{
buffer->align(Utils::Stream::ALIGN_16);
buffer->save(asset->dynEntVisData[j][i], 32, asset->dynEntClientWordCount[j]);
@ -293,10 +312,11 @@ namespace Assets
Utils::Stream::ClearPointer(&destSky->skyStartSurfs);
}
if(sky->skyImage) {
if (sky->skyImage) {
destSky->skyImage = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, sky->skyImage->name).image;
}
}
Utils::Stream::ClearPointer(&dest->skies);
}
@ -312,6 +332,7 @@ namespace Assets
buffer->saveArray(asset->aabbTreeCounts, cellCount);
Utils::Stream::ClearPointer(&dest->aabbTreeCounts);
}
if (asset->aabbTrees)
{
AssertSize(Game::GfxCellTree, 4);
@ -345,7 +366,8 @@ namespace Assets
if (aabbTree->smodelIndexes)
{
if(builder->hasPointer(aabbTree->smodelIndexes)) {
if (builder->hasPointer(aabbTree->smodelIndexes))
{
destAabbTree->smodelIndexes = builder->getPointer(aabbTree->smodelIndexes);
}
else
@ -358,10 +380,12 @@ namespace Assets
}
}
}
Utils::Stream::ClearPointer(&destCellTree->aabbTree);
}
}
Utils::Stream::ClearPointer(&dest->aabbTrees);
}
@ -398,6 +422,7 @@ namespace Assets
Utils::Stream::ClearPointer(&destPortal->vertices);
}
}
Utils::Stream::ClearPointer(&destCell->portals);
}
@ -408,6 +433,7 @@ namespace Assets
Utils::Stream::ClearPointer(&destCell->reflectionProbes);
}
}
Utils::Stream::ClearPointer(&dest->cells);
}
@ -420,6 +446,7 @@ namespace Assets
buffer->saveArray(asset->models, asset->modelCount);
Utils::Stream::ClearPointer(&dest->aabbTreeCounts);
}
if (asset->materialMemory)
{
AssertSize(Game::MaterialMemory, 8);
@ -438,12 +465,14 @@ namespace Assets
destMaterialMemory->material = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, materialMemory->material->name).material;
}
}
Utils::Stream::ClearPointer(&dest->materialMemory);
}
this->savesunflare_t(&asset->sun, &dest->sun, builder);
if(asset->unknownImage) {
if (asset->unknownImage)
{
dest->unknownImage = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->unknownImage->name).image;
}
@ -534,6 +563,7 @@ namespace Assets
Utils::Stream::ClearPointer(&destShadowGeometry->smodelIndex);
}
}
Utils::Stream::ClearPointer(&dest->shadowGeom);
}
@ -573,10 +603,12 @@ namespace Assets
}
}
Utils::Stream::ClearPointer(&destLightRegion->hulls);
}
}
Utils::Stream::ClearPointer(&dest->lightRegion);
}

View File

@ -14,6 +14,5 @@ namespace Assets
void savesunflare_t(Game::sunflare_t* asset, Game::sunflare_t* dest, Components::ZoneBuilder::Zone* builder);
void saveGfxWorldDpvsStatic(Game::GfxWorldDpvsStatic* asset, Game::GfxWorldDpvsStatic* dest, int planeCount, Components::ZoneBuilder::Zone* builder);
void saveGfxWorldDpvsDynamic(Game::GfxWorldDpvsDynamic* asset, Game::GfxWorldDpvsDynamic* dest, int planeCount, Components::ZoneBuilder::Zone* builder);
};
}