[Game] Adapt to correct structures
This commit is contained in:
parent
7ca3b49f1e
commit
33a8baa9b5
@ -158,26 +158,26 @@ namespace Components
|
||||
|
||||
void AssetHandler::ModifyAsset(Game::XAssetType type, Game::XAssetHeader asset, std::string name)
|
||||
{
|
||||
if (type == Game::XAssetType::ASSET_TYPE_MATERIAL && (name == "gfx_distortion_knife_trail" || name == "gfx_distortion_heat_far" || name == "gfx_distortion_ring_light" || name == "gfx_distortion_heat") && asset.material->sortKey >= 43)
|
||||
if (type == Game::XAssetType::ASSET_TYPE_MATERIAL && (name == "gfx_distortion_knife_trail" || name == "gfx_distortion_heat_far" || name == "gfx_distortion_ring_light" || name == "gfx_distortion_heat") && asset.material->info.sortKey >= 43)
|
||||
{
|
||||
if (Zones::Version() >= VERSION_ALPHA2)
|
||||
{
|
||||
asset.material->sortKey = 44;
|
||||
asset.material->info.sortKey = 44;
|
||||
}
|
||||
else
|
||||
{
|
||||
asset.material->sortKey = 43;
|
||||
asset.material->info.sortKey = 43;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == Game::XAssetType::ASSET_TYPE_MATERIAL && (name == "wc/codo_ui_viewer_black_decal3" || name == "wc/codo_ui_viewer_black_decal2" || name == "wc/hint_arrows01" || name == "wc/hint_arrows02"))
|
||||
{
|
||||
asset.material->sortKey = 0xE;
|
||||
asset.material->info.sortKey = 0xE;
|
||||
}
|
||||
|
||||
if (type == Game::XAssetType::ASSET_TYPE_VEHICLE && Zones::Version() >= VERSION_ALPHA2)
|
||||
{
|
||||
asset.vehicle->weaponDef = nullptr;
|
||||
asset.vehDef->turretWeapon = nullptr;
|
||||
}
|
||||
|
||||
// Fix shader const stuff
|
||||
|
@ -6,21 +6,21 @@ namespace Assets
|
||||
{
|
||||
Game::Font_s *asset = header.font;
|
||||
|
||||
if (asset->image)
|
||||
if (asset->material)
|
||||
{
|
||||
builder->loadAsset(Game::ASSET_TYPE_MATERIAL, asset->image);
|
||||
builder->loadAsset(Game::ASSET_TYPE_MATERIAL, asset->material);
|
||||
}
|
||||
|
||||
if (asset->glowImage)
|
||||
if (asset->glowMaterial)
|
||||
{
|
||||
builder->loadAsset(Game::ASSET_TYPE_MATERIAL, asset->glowImage);
|
||||
builder->loadAsset(Game::ASSET_TYPE_MATERIAL, asset->glowMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
void IFont_s::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
AssertSize(Game::Font_s, 24);
|
||||
AssertSize(Game::FontEntry, 24);
|
||||
AssertSize(Game::Glyph, 24);
|
||||
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
Game::Font_s* asset = header.font;
|
||||
@ -30,20 +30,20 @@ namespace Assets
|
||||
|
||||
buffer->pushBlock(Game::XFILE_BLOCK_VIRTUAL);
|
||||
|
||||
if (asset->name)
|
||||
if (asset->fontName)
|
||||
{
|
||||
buffer->saveString(asset->name);
|
||||
Utils::Stream::ClearPointer(&dest->name);
|
||||
buffer->saveString(asset->fontName);
|
||||
Utils::Stream::ClearPointer(&dest->fontName);
|
||||
}
|
||||
|
||||
dest->image = builder->saveSubAsset(Game::ASSET_TYPE_MATERIAL, asset->image).material;
|
||||
dest->glowImage = builder->saveSubAsset(Game::ASSET_TYPE_MATERIAL, asset->glowImage).material;
|
||||
dest->material = builder->saveSubAsset(Game::ASSET_TYPE_MATERIAL, asset->material).material;
|
||||
dest->glowMaterial = builder->saveSubAsset(Game::ASSET_TYPE_MATERIAL, asset->glowMaterial).material;
|
||||
|
||||
if (asset->characters)
|
||||
if (asset->glyphs)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->characters, asset->entries);
|
||||
Utils::Stream::ClearPointer(&dest->characters);
|
||||
buffer->saveArray(asset->glyphs, asset->glyphCount);
|
||||
Utils::Stream::ClearPointer(&dest->glyphs);
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
|
@ -17,9 +17,9 @@ namespace Assets
|
||||
{
|
||||
case Game::FX_ELEM_TYPE_MODEL:
|
||||
{
|
||||
if (visuals->xmodel)
|
||||
if (visuals->model)
|
||||
{
|
||||
visuals->xmodel = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_XMODEL, reader->readString().data(), builder).model;
|
||||
visuals->model = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_XMODEL, reader->readString().data(), builder).model;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -119,14 +119,14 @@ namespace Assets
|
||||
|
||||
for (char j = 0; j < elemDef->visualCount; ++j)
|
||||
{
|
||||
if (elemDef->visuals.markArray[j].data[0])
|
||||
if (elemDef->visuals.markArray[j].materials[0])
|
||||
{
|
||||
elemDef->visuals.markArray[j].data[0] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, buffer.readString().data(), builder).material;
|
||||
elemDef->visuals.markArray[j].materials[0] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, buffer.readString().data(), builder).material;
|
||||
}
|
||||
|
||||
if (elemDef->visuals.markArray[j].data[1])
|
||||
if (elemDef->visuals.markArray[j].materials[1])
|
||||
{
|
||||
elemDef->visuals.markArray[j].data[1] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, buffer.readString().data(), builder).material;
|
||||
elemDef->visuals.markArray[j].materials[1] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, buffer.readString().data(), builder).material;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -171,10 +171,10 @@ namespace Assets
|
||||
{
|
||||
// Save_FxTrailDef
|
||||
{
|
||||
if (elemDef->extendedDef.trailDef)
|
||||
if (elemDef->extended.trailDef)
|
||||
{
|
||||
Game::FxTrailDef* trailDef = buffer.readObject<Game::FxTrailDef>();
|
||||
elemDef->extendedDef.trailDef = trailDef;
|
||||
elemDef->extended.trailDef = trailDef;
|
||||
|
||||
if (trailDef->verts)
|
||||
{
|
||||
@ -188,7 +188,7 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (elemDef->extendedDef.trailDef)
|
||||
else if (elemDef->extended.trailDef)
|
||||
{
|
||||
Components::Logger::Error("Fx element of type %d has traildef, that's impossible?\n", elemDef->elemType);
|
||||
}
|
||||
@ -284,9 +284,9 @@ namespace Assets
|
||||
{
|
||||
case 7:
|
||||
{
|
||||
if (visuals->xmodel)
|
||||
if (visuals->model)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, visuals->xmodel);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, visuals->model);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -339,14 +339,14 @@ namespace Assets
|
||||
{
|
||||
for (char j = 0; j < elemDef->visualCount; ++j)
|
||||
{
|
||||
if (elemDef->visuals.markArray[j].data[0])
|
||||
if (elemDef->visuals.markArray[j].materials[0])
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[0]);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].materials[0]);
|
||||
}
|
||||
|
||||
if (elemDef->visuals.markArray[j].data[1])
|
||||
if (elemDef->visuals.markArray[j].materials[1])
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[1]);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].materials[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -392,9 +392,9 @@ namespace Assets
|
||||
{
|
||||
case 7:
|
||||
{
|
||||
if (visuals->xmodel)
|
||||
if (visuals->model)
|
||||
{
|
||||
destVisuals->xmodel = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODEL, visuals->xmodel).model;
|
||||
destVisuals->model = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODEL, visuals->model).model;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -502,14 +502,14 @@ namespace Assets
|
||||
|
||||
for (char j = 0; j < elemDef->visualCount; ++j)
|
||||
{
|
||||
if (elemDef->visuals.markArray[j].data[0])
|
||||
if (elemDef->visuals.markArray[j].materials[0])
|
||||
{
|
||||
destMarkArray[j].data[0] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[0]).material;
|
||||
destMarkArray[j].materials[0] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].materials[0]).material;
|
||||
}
|
||||
|
||||
if (elemDef->visuals.markArray[j].data[1])
|
||||
if (elemDef->visuals.markArray[j].materials[1])
|
||||
{
|
||||
destMarkArray[j].data[1] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[1]).material;
|
||||
destMarkArray[j].materials[1] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].materials[1]).material;
|
||||
}
|
||||
}
|
||||
|
||||
@ -560,18 +560,18 @@ namespace Assets
|
||||
|
||||
// Save_FxElemExtendedDefPtr
|
||||
{
|
||||
AssertSize(Game::FxElemExtendedDef, 4);
|
||||
AssertSize(Game::FxElemExtendedDefPtr, 4);
|
||||
|
||||
if (elemDef->elemType == 3)
|
||||
{
|
||||
// Save_FxTrailDef
|
||||
{
|
||||
if (elemDef->extendedDef.trailDef)
|
||||
if (elemDef->extended.trailDef)
|
||||
{
|
||||
AssertSize(Game::FxTrailDef, 36);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::FxTrailDef* trailDef = elemDef->extendedDef.trailDef;
|
||||
Game::FxTrailDef* trailDef = elemDef->extended.trailDef;
|
||||
Game::FxTrailDef* destTrailDef = buffer->dest<Game::FxTrailDef>();
|
||||
buffer->save(trailDef);
|
||||
|
||||
@ -592,27 +592,27 @@ namespace Assets
|
||||
Utils::Stream::ClearPointer(&destTrailDef->inds);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&destElemDef->extendedDef.trailDef);
|
||||
Utils::Stream::ClearPointer(&destElemDef->extended.trailDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (elemDef->elemType == 6)
|
||||
{
|
||||
if (elemDef->extendedDef.sparkFountain)
|
||||
if (elemDef->extended.sparkFountainDef)
|
||||
{
|
||||
AssertSize(Game::FxSparkFountain, 52);
|
||||
AssertSize(Game::FxSparkFountainDef, 52);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
buffer->save(elemDef->extendedDef.sparkFountain);
|
||||
Utils::Stream::ClearPointer(&destElemDef->extendedDef.sparkFountain);
|
||||
buffer->save(elemDef->extended.sparkFountainDef);
|
||||
Utils::Stream::ClearPointer(&destElemDef->extended.sparkFountainDef);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (elemDef->extendedDef.unknownBytes)
|
||||
if (elemDef->extended.unknownDef)
|
||||
{
|
||||
buffer->save(elemDef->extendedDef.unknownBytes);
|
||||
Utils::Stream::ClearPointer(&destElemDef->extendedDef.unknownBytes);
|
||||
buffer->save(reinterpret_cast<char*>(elemDef->extended.unknownDef));
|
||||
Utils::Stream::ClearPointer(&destElemDef->extended.unknownDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace Assets
|
||||
Utils::Stream::ClearPointer(&dest->name);
|
||||
}
|
||||
|
||||
if (asset->data)
|
||||
if (asset->g_glassData)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
@ -28,28 +28,28 @@ namespace Assets
|
||||
AssertSize(Game::G_GlassData, 128);
|
||||
|
||||
Game::G_GlassData* destGlass = buffer->dest<Game::G_GlassData>();
|
||||
buffer->save(asset->data);
|
||||
buffer->save(asset->g_glassData);
|
||||
|
||||
if (asset->data->glassPieces)
|
||||
if (asset->g_glassData->glassPieces)
|
||||
{
|
||||
AssertSize(Game::G_GlassPiece, 12);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->data->glassPieces, asset->data->pieceCount);
|
||||
buffer->saveArray(asset->g_glassData->glassPieces, asset->g_glassData->pieceCount);
|
||||
Utils::Stream::ClearPointer(&destGlass->glassPieces);
|
||||
}
|
||||
|
||||
if (asset->data->glassNames)
|
||||
if (asset->g_glassData->glassNames)
|
||||
{
|
||||
AssertSize(Game::G_GlassName, 12);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::G_GlassName* destGlassNames = buffer->dest<Game::G_GlassName>();
|
||||
buffer->saveArray(asset->data->glassNames, asset->data->glassNameCount);
|
||||
buffer->saveArray(asset->g_glassData->glassNames, asset->g_glassData->glassNameCount);
|
||||
|
||||
for (unsigned int i = 0; i < asset->data->glassNameCount; ++i)
|
||||
for (unsigned int i = 0; i < asset->g_glassData->glassNameCount; ++i)
|
||||
{
|
||||
Game::G_GlassName* destGlassName = &destGlassNames[i];
|
||||
Game::G_GlassName* glassName = &asset->data->glassNames[i];
|
||||
Game::G_GlassName* glassName = &asset->g_glassData->glassNames[i];
|
||||
|
||||
if (glassName->nameStr)
|
||||
{
|
||||
@ -69,7 +69,7 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->data);
|
||||
Utils::Stream::ClearPointer(&dest->g_glassData);
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
|
@ -6,11 +6,11 @@ namespace Assets
|
||||
{
|
||||
Game::GameWorldSp* asset = header.gameWorldSp;
|
||||
|
||||
if (asset->pathData.nodes)
|
||||
if (asset->path.nodes)
|
||||
{
|
||||
for (unsigned int i = 0; i < asset->pathData.nodeCount; ++i)
|
||||
for (unsigned int i = 0; i < asset->path.nodeCount; ++i)
|
||||
{
|
||||
Game::pathnode_t* node = &asset->pathData.nodes[i];
|
||||
Game::pathnode_t* node = &asset->path.nodes[i];
|
||||
|
||||
for (char j = 0; j < 5; ++j)
|
||||
{
|
||||
@ -104,47 +104,47 @@ namespace Assets
|
||||
{
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
|
||||
if (trackSegment->name)
|
||||
if (trackSegment->targetName)
|
||||
{
|
||||
buffer->saveString(trackSegment->name);
|
||||
Utils::Stream::ClearPointer(&destTrackSegment->name);
|
||||
buffer->saveString(trackSegment->targetName);
|
||||
Utils::Stream::ClearPointer(&destTrackSegment->targetName);
|
||||
}
|
||||
|
||||
if (trackSegment->trackSectors)
|
||||
if (trackSegment->sectors)
|
||||
{
|
||||
AssertSize(Game::VehicleTrackSector, 60);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::VehicleTrackSector* destTrackSectors = buffer->dest<Game::VehicleTrackSector>();
|
||||
buffer->saveArray(trackSegment->trackSectors, trackSegment->trackSectorCount);
|
||||
buffer->saveArray(trackSegment->sectors, trackSegment->sectorCount);
|
||||
|
||||
for (int i = 0; i < trackSegment->trackSectorCount; ++i)
|
||||
for (unsigned int i = 0; i < trackSegment->sectorCount; ++i)
|
||||
{
|
||||
Game::VehicleTrackSector* destTrackSector = &destTrackSectors[i];
|
||||
Game::VehicleTrackSector* trackSector = &trackSegment->trackSectors[i];
|
||||
Game::VehicleTrackSector* trackSector = &trackSegment->sectors[i];
|
||||
|
||||
if (trackSector->trackObstacles)
|
||||
if (trackSector->obstacles)
|
||||
{
|
||||
AssertSize(Game::VehicleTrackObstacle, 12);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(trackSector->trackObstacles, trackSector->trackObstacleCount);
|
||||
Utils::Stream::ClearPointer(&destTrackSector->trackObstacles);
|
||||
buffer->saveArray(trackSector->obstacles, trackSector->obstacleCount);
|
||||
Utils::Stream::ClearPointer(&destTrackSector->obstacles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (trackSegment->trackSegments1)
|
||||
if (trackSegment->nextBranches)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
this->saveVehicleTrackSegment_ptrArray(trackSegment->trackSegments1, trackSegment->trackSegmentCount1, builder);
|
||||
Utils::Stream::ClearPointer(&destTrackSegment->trackSegments1);
|
||||
this->saveVehicleTrackSegment_ptrArray(trackSegment->nextBranches, trackSegment->nextBranchesCount, builder);
|
||||
Utils::Stream::ClearPointer(&destTrackSegment->nextBranches);
|
||||
}
|
||||
|
||||
if (trackSegment->trackSegments2)
|
||||
if (trackSegment->prevBranches)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
this->saveVehicleTrackSegment_ptrArray(trackSegment->trackSegments2, trackSegment->trackSegmentCount2, builder);
|
||||
Utils::Stream::ClearPointer(&destTrackSegment->trackSegments2);
|
||||
this->saveVehicleTrackSegment_ptrArray(trackSegment->prevBranches, trackSegment->prevBranchesCount, builder);
|
||||
Utils::Stream::ClearPointer(&destTrackSegment->prevBranches);
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,18 +169,18 @@ namespace Assets
|
||||
{
|
||||
AssertSize(Game::PathData, 40);
|
||||
|
||||
if (asset->pathData.nodes)
|
||||
if (asset->path.nodes)
|
||||
{
|
||||
AssertSize(Game::pathnode_t, 136);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::pathnode_t* destNodes = buffer->dest<Game::pathnode_t>();
|
||||
buffer->saveArray(asset->pathData.nodes, asset->pathData.nodeCount);
|
||||
buffer->saveArray(asset->path.nodes, asset->path.nodeCount);
|
||||
|
||||
for (unsigned int i = 0; i < asset->pathData.nodeCount; ++i)
|
||||
for (unsigned int i = 0; i < asset->path.nodeCount; ++i)
|
||||
{
|
||||
Game::pathnode_t* destNode = &destNodes[i];
|
||||
Game::pathnode_t* node = &asset->pathData.nodes[i];
|
||||
Game::pathnode_t* node = &asset->path.nodes[i];
|
||||
|
||||
AssertSize(Game::pathnode_constant_t, 64);
|
||||
|
||||
@ -198,59 +198,59 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->pathData.nodes);
|
||||
Utils::Stream::ClearPointer(&dest->path.nodes);
|
||||
}
|
||||
|
||||
buffer->pushBlock(Game::XFILE_BLOCK_RUNTIME);
|
||||
|
||||
if (asset->pathData.basenodes)
|
||||
if (asset->path.basenodes)
|
||||
{
|
||||
AssertSize(Game::pathbasenode_t, 16);
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_16);
|
||||
buffer->saveArray(asset->pathData.basenodes, asset->pathData.nodeCount);
|
||||
Utils::Stream::ClearPointer(&dest->pathData.basenodes);
|
||||
buffer->saveArray(asset->path.basenodes, asset->path.nodeCount);
|
||||
Utils::Stream::ClearPointer(&dest->path.basenodes);
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
|
||||
if (asset->pathData.chainNodeForNode)
|
||||
if (asset->path.chainNodeForNode)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_2);
|
||||
buffer->saveArray(asset->pathData.chainNodeForNode, asset->pathData.nodeCount);
|
||||
Utils::Stream::ClearPointer(&dest->pathData.chainNodeForNode);
|
||||
buffer->saveArray(asset->path.chainNodeForNode, asset->path.nodeCount);
|
||||
Utils::Stream::ClearPointer(&dest->path.chainNodeForNode);
|
||||
}
|
||||
|
||||
if (asset->pathData.nodeForChainNode)
|
||||
if (asset->path.nodeForChainNode)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_2);
|
||||
buffer->saveArray(asset->pathData.nodeForChainNode, asset->pathData.nodeCount);
|
||||
Utils::Stream::ClearPointer(&dest->pathData.nodeForChainNode);
|
||||
buffer->saveArray(asset->path.nodeForChainNode, asset->path.nodeCount);
|
||||
Utils::Stream::ClearPointer(&dest->path.nodeForChainNode);
|
||||
}
|
||||
|
||||
if (asset->pathData.pathVis)
|
||||
if (asset->path.pathVis)
|
||||
{
|
||||
buffer->saveArray(asset->pathData.pathVis, asset->pathData.visBytes);
|
||||
Utils::Stream::ClearPointer(&dest->pathData.pathVis);
|
||||
buffer->saveArray(asset->path.pathVis, asset->path.visBytes);
|
||||
Utils::Stream::ClearPointer(&dest->path.pathVis);
|
||||
}
|
||||
|
||||
if (asset->pathData.nodeTree)
|
||||
if (asset->path.nodeTree)
|
||||
{
|
||||
AssertSize(Game::pathnode_tree_t, 16);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::pathnode_tree_t* destNodeTrees = buffer->dest<Game::pathnode_tree_t>();
|
||||
buffer->saveArray(asset->pathData.nodeTree, asset->pathData.nodeTreeCount);
|
||||
buffer->saveArray(asset->path.nodeTree, asset->path.nodeTreeCount);
|
||||
|
||||
for (int i = 0; i < asset->pathData.nodeTreeCount; ++i)
|
||||
for (int i = 0; i < asset->path.nodeTreeCount; ++i)
|
||||
{
|
||||
Game::pathnode_tree_t* destNodeTree = &destNodeTrees[i];
|
||||
Game::pathnode_tree_t* nodeTree = &asset->pathData.nodeTree[i];
|
||||
Game::pathnode_tree_t* nodeTree = &asset->path.nodeTree[i];
|
||||
|
||||
this->savepathnode_tree_info_t(nodeTree, destNodeTree, builder);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->pathData.nodeTree);
|
||||
Utils::Stream::ClearPointer(&dest->path.nodeTree);
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,11 +258,11 @@ namespace Assets
|
||||
{
|
||||
AssertSize(Game::VehicleTrack, 8);
|
||||
|
||||
if (asset->vehicleTrack.trackSegments)
|
||||
if (asset->vehicleTrack.segments)
|
||||
{
|
||||
if (builder->hasPointer(asset->vehicleTrack.trackSegments))
|
||||
if (builder->hasPointer(asset->vehicleTrack.segments))
|
||||
{
|
||||
dest->vehicleTrack.trackSegments = builder->getPointer(asset->vehicleTrack.trackSegments);
|
||||
dest->vehicleTrack.segments = builder->getPointer(asset->vehicleTrack.segments);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -271,26 +271,26 @@ namespace Assets
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
Game::VehicleTrackSegment* destTrackSegments = buffer->dest<Game::VehicleTrackSegment>();
|
||||
|
||||
for (int i = 0; i < asset->vehicleTrack.trackSegmentCount; ++i)
|
||||
for (unsigned int i = 0; i < asset->vehicleTrack.segmentCount; ++i)
|
||||
{
|
||||
builder->storePointer(&asset->vehicleTrack.trackSegments[i]);
|
||||
buffer->save(&asset->vehicleTrack.trackSegments[i]);
|
||||
builder->storePointer(&asset->vehicleTrack.segments[i]);
|
||||
buffer->save(&asset->vehicleTrack.segments[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < asset->vehicleTrack.trackSegmentCount; ++i)
|
||||
for (unsigned int i = 0; i < asset->vehicleTrack.segmentCount; ++i)
|
||||
{
|
||||
Game::VehicleTrackSegment* destTrackSegment = &destTrackSegments[i];
|
||||
Game::VehicleTrackSegment* trackSegment = &asset->vehicleTrack.trackSegments[i];
|
||||
Game::VehicleTrackSegment* trackSegment = &asset->vehicleTrack.segments[i];
|
||||
|
||||
this->saveVehicleTrackSegment(trackSegment, destTrackSegment, builder);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->vehicleTrack.trackSegments);
|
||||
Utils::Stream::ClearPointer(&dest->vehicleTrack.segments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (asset->data)
|
||||
if (asset->g_glassData)
|
||||
{
|
||||
// Save_G_GlassData
|
||||
{
|
||||
@ -298,28 +298,28 @@ namespace Assets
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::G_GlassData* destGlass = buffer->dest<Game::G_GlassData>();
|
||||
buffer->save(asset->data);
|
||||
buffer->save(asset->g_glassData);
|
||||
|
||||
if (asset->data->glassPieces)
|
||||
if (asset->g_glassData->glassPieces)
|
||||
{
|
||||
AssertSize(Game::G_GlassPiece, 12);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->data->glassPieces, asset->data->pieceCount);
|
||||
buffer->saveArray(asset->g_glassData->glassPieces, asset->g_glassData->pieceCount);
|
||||
Utils::Stream::ClearPointer(&destGlass->glassPieces);
|
||||
}
|
||||
|
||||
if (asset->data->glassNames)
|
||||
if (asset->g_glassData->glassNames)
|
||||
{
|
||||
AssertSize(Game::G_GlassName, 12);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::G_GlassName* destGlassNames = buffer->dest<Game::G_GlassName>();
|
||||
buffer->saveArray(asset->data->glassNames, asset->data->glassNameCount);
|
||||
buffer->saveArray(asset->g_glassData->glassNames, asset->g_glassData->glassNameCount);
|
||||
|
||||
for (unsigned int i = 0; i < asset->data->glassNameCount; ++i)
|
||||
for (unsigned int i = 0; i < asset->g_glassData->glassNameCount; ++i)
|
||||
{
|
||||
Game::G_GlassName* destGlassName = &destGlassNames[i];
|
||||
Game::G_GlassName* glassName = &asset->data->glassNames[i];
|
||||
Game::G_GlassName* glassName = &asset->g_glassData->glassNames[i];
|
||||
|
||||
if (glassName->nameStr)
|
||||
{
|
||||
@ -339,7 +339,7 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->data);
|
||||
Utils::Stream::ClearPointer(&dest->g_glassData);
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
|
@ -19,7 +19,10 @@ namespace Assets
|
||||
image->name = builder->getAllocator()->duplicateString(name);
|
||||
image->semantic = 2;
|
||||
image->category = 0;
|
||||
image->cardMemory = 0;
|
||||
image->picmip.platform[0] = 0;
|
||||
image->picmip.platform[1] = 0;
|
||||
image->noPicmip = 0;
|
||||
image->track = 0;
|
||||
|
||||
const char* tempName = image->name;
|
||||
if (tempName[0] == '*') tempName++;
|
||||
@ -35,33 +38,34 @@ namespace Assets
|
||||
Components::Logger::Error(0, "Reading image '%s' failed, header is invalid!", name.data());
|
||||
}
|
||||
|
||||
AssertSize(Game::MapType, 1);
|
||||
image->mapType = reader.read<Game::MapType>();
|
||||
image->mapType = reader.read<char>();
|
||||
image->semantic = reader.read<char>();
|
||||
image->category = reader.read<char>();
|
||||
|
||||
image->dataLen1 = reader.read<int>();
|
||||
image->dataLen2 = image->dataLen1;
|
||||
image->cardMemory.platform[0] = reader.read<int>();
|
||||
image->cardMemory.platform[1] = image->cardMemory.platform[0];
|
||||
|
||||
image->loadDef = reinterpret_cast<Game::GfxImageLoadDef*>(reader.readArray<char>(image->dataLen1 + 16));
|
||||
image->texture.loadDef = reinterpret_cast<Game::GfxImageLoadDef*>(reader.readArray<char>(image->cardMemory.platform[0] + 16));
|
||||
|
||||
image->height = image->loadDef->dimensions[0];
|
||||
image->width = image->loadDef->dimensions[1];
|
||||
image->depth = image->loadDef->dimensions[2];
|
||||
// TODO: Fix that, this is clearly wrong
|
||||
auto dimensions = reinterpret_cast<unsigned short*>(&image->texture.loadDef->pad[2]);
|
||||
image->height = dimensions[0];
|
||||
image->width = dimensions[1];
|
||||
image->depth = dimensions[2];
|
||||
|
||||
image->loaded = true;
|
||||
image->loadDef->flags = 0;
|
||||
image->delayLoadPixels = true;
|
||||
image->texture.loadDef->flags = 0;
|
||||
|
||||
if (image->loadDef->resourceSize != image->dataLen1)
|
||||
if (image->texture.loadDef->resourceSize != image->cardMemory.platform[0])
|
||||
{
|
||||
Components::Logger::Error("Resource size doesn't match the data length (%s)!\n", name.data());
|
||||
}
|
||||
|
||||
if (Utils::String::StartsWith(name, "*lightmap"))
|
||||
{
|
||||
image->loadDef->dimensions[0] = 0;
|
||||
image->loadDef->dimensions[1] = 2;
|
||||
image->loadDef->dimensions[2] = 0;
|
||||
dimensions[0] = 0;
|
||||
dimensions[1] = 2;
|
||||
dimensions[2] = 0;
|
||||
}
|
||||
|
||||
header->image = image;
|
||||
@ -89,53 +93,52 @@ namespace Assets
|
||||
}
|
||||
|
||||
image->mapType = Game::MAPTYPE_2D;
|
||||
image->dataLen1 = iwiHeader->fileSizeForPicmip[0] - 32;
|
||||
image->dataLen2 = iwiHeader->fileSizeForPicmip[0] - 32;
|
||||
//image->dataLen1 = iwiHeader->fileSizeForPicmip[0] - 32;
|
||||
//image->dataLen2 = iwiHeader->fileSizeForPicmip[0] - 32;
|
||||
|
||||
image->loadDef = builder->getAllocator()->allocate<Game::GfxImageLoadDef>();
|
||||
if (!image->loadDef)
|
||||
image->texture.loadDef = builder->getAllocator()->allocate<Game::GfxImageLoadDef>();
|
||||
if (!image->texture.loadDef)
|
||||
{
|
||||
Components::Logger::Error("Failed to allocate GfxImageLoadDef structure!");
|
||||
return;
|
||||
}
|
||||
|
||||
std::memcpy(image->loadDef->dimensions, iwiHeader->dimensions, 6);
|
||||
image->loadDef->flags = 0;
|
||||
image->loadDef->levelCount = 0;
|
||||
image->texture.loadDef->flags = 0;
|
||||
image->texture.loadDef->levelCount = 0;
|
||||
|
||||
image->height = image->loadDef->dimensions[0];
|
||||
image->width = image->loadDef->dimensions[1];
|
||||
image->depth = image->loadDef->dimensions[2];
|
||||
image->height = iwiHeader->dimensions[0];
|
||||
image->width = iwiHeader->dimensions[1];
|
||||
image->depth = iwiHeader->dimensions[2];
|
||||
|
||||
switch (iwiHeader->format)
|
||||
{
|
||||
case Game::IWI_COMPRESSION::IWI_ARGB:
|
||||
case Game::IMG_FORMAT_BITMAP_RGBA:
|
||||
{
|
||||
image->loadDef->format = 21;
|
||||
image->texture.loadDef->format = 21;
|
||||
break;
|
||||
}
|
||||
|
||||
case Game::IWI_COMPRESSION::IWI_RGB8:
|
||||
case Game::IMG_FORMAT_BITMAP_RGB:
|
||||
{
|
||||
image->loadDef->format = 20;
|
||||
image->texture.loadDef->format = 20;
|
||||
break;
|
||||
}
|
||||
|
||||
case Game::IWI_COMPRESSION::IWI_DXT1:
|
||||
case Game::IMG_FORMAT_DXT1:
|
||||
{
|
||||
image->loadDef->format = 0x31545844;
|
||||
image->texture.loadDef->format = 0x31545844;
|
||||
break;
|
||||
}
|
||||
|
||||
case Game::IWI_COMPRESSION::IWI_DXT3:
|
||||
case Game::IMG_FORMAT_DXT3:
|
||||
{
|
||||
image->loadDef->format = 0x33545844;
|
||||
image->texture.loadDef->format = 0x33545844;
|
||||
break;
|
||||
}
|
||||
|
||||
case Game::IWI_COMPRESSION::IWI_DXT5:
|
||||
case Game::IMG_FORMAT_DXT5:
|
||||
{
|
||||
image->loadDef->format = 0x35545844;
|
||||
image->texture.loadDef->format = 0x35545844;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -152,7 +155,6 @@ namespace Assets
|
||||
void IGfxImage::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
AssertSize(Game::GfxImage, 32);
|
||||
AssertSize(Game::MapType, 1);
|
||||
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
Game::GfxImage* asset = header.image;
|
||||
@ -169,21 +171,21 @@ namespace Assets
|
||||
|
||||
buffer->pushBlock(Game::XFILE_BLOCK_TEMP);
|
||||
|
||||
if (asset->loadDef)
|
||||
if (asset->texture.loadDef)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::GfxImageLoadDef* destTexture = buffer->dest<Game::GfxImageLoadDef>();
|
||||
buffer->save(asset->loadDef, 16, 1);
|
||||
buffer->save(asset->texture.loadDef, 16, 1);
|
||||
|
||||
builder->incrementExternalSize(asset->loadDef->resourceSize);
|
||||
builder->incrementExternalSize(asset->texture.loadDef->resourceSize);
|
||||
|
||||
if (destTexture->resourceSize > 0)
|
||||
{
|
||||
buffer->save(asset->loadDef->data, asset->loadDef->resourceSize);
|
||||
buffer->save(asset->texture.loadDef->data, asset->texture.loadDef->resourceSize);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->loadDef);
|
||||
Utils::Stream::ClearPointer(&dest->texture.loadDef);
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
|
@ -54,19 +54,19 @@ namespace Assets
|
||||
|
||||
void IGfxWorld::loadGfxWorldDraw(Game::GfxWorldDraw* asset, Components::ZoneBuilder::Zone* builder, Utils::Stream::Reader* reader)
|
||||
{
|
||||
if (asset->reflectionImages)
|
||||
if (asset->reflectionProbes)
|
||||
{
|
||||
asset->reflectionImages = reader->readArray<Game::GfxImage*>(asset->reflectionProbeCount);
|
||||
asset->reflectionProbes = reader->readArray<Game::GfxImage*>(asset->reflectionProbeCount);
|
||||
|
||||
for (unsigned int i = 0; i < asset->reflectionProbeCount; ++i)
|
||||
{
|
||||
asset->reflectionImages[i] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
||||
asset->reflectionProbes[i] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
||||
}
|
||||
}
|
||||
|
||||
if (asset->reflectionProbes)
|
||||
if (asset->reflectionProbeOrigins)
|
||||
{
|
||||
asset->reflectionProbes = reader->readArray<Game::GfxReflectionProbe>(asset->reflectionProbeCount);
|
||||
asset->reflectionProbeOrigins = reader->readArray<Game::GfxReflectionProbe>(asset->reflectionProbeCount);
|
||||
}
|
||||
|
||||
if (asset->lightmaps)
|
||||
@ -89,14 +89,14 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
if (asset->skyImage)
|
||||
if (asset->lightmapOverridePrimary)
|
||||
{
|
||||
asset->skyImage = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
||||
asset->lightmapOverridePrimary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
||||
}
|
||||
|
||||
if (asset->outdoorImage)
|
||||
if (asset->lightmapOverrideSecondary)
|
||||
{
|
||||
asset->outdoorImage = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
||||
asset->lightmapOverrideSecondary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
||||
}
|
||||
|
||||
// saveGfxWorldVertexData
|
||||
@ -183,11 +183,11 @@ namespace Assets
|
||||
if (asset->dpvsPlanes.planes)
|
||||
{
|
||||
void* oldPtr = asset->dpvsPlanes.planes;
|
||||
asset->dpvsPlanes.planes = reader.readArray<Game::cplane_t>(asset->planeCount);
|
||||
asset->dpvsPlanes.planes = reader.readArray<Game::cplane_s>(asset->planeCount);
|
||||
|
||||
if (builder->getAllocator()->isPointerMapped(oldPtr))
|
||||
{
|
||||
asset->dpvsPlanes.planes = builder->getAllocator()->getPointer<Game::cplane_t>(oldPtr);
|
||||
asset->dpvsPlanes.planes = builder->getAllocator()->getPointer<Game::cplane_s>(oldPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -418,11 +418,11 @@ namespace Assets
|
||||
{
|
||||
Game::GfxWorld* asset = header.gfxWorld;
|
||||
|
||||
if (asset->draw.reflectionImages)
|
||||
if (asset->draw.reflectionProbes)
|
||||
{
|
||||
for (unsigned int i = 0; i < asset->draw.reflectionProbeCount; ++i)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->draw.reflectionImages[i]);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->draw.reflectionProbes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,14 +442,14 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
if (asset->draw.skyImage)
|
||||
if (asset->draw.lightmapOverridePrimary)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->draw.skyImage);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->draw.lightmapOverridePrimary);
|
||||
}
|
||||
|
||||
if (asset->draw.outdoorImage)
|
||||
if (asset->draw.lightmapOverrideSecondary)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->draw.outdoorImage);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->draw.lightmapOverrideSecondary);
|
||||
}
|
||||
|
||||
if (asset->sun.spriteMaterial)
|
||||
@ -527,7 +527,7 @@ namespace Assets
|
||||
}
|
||||
else
|
||||
{
|
||||
AssertSize(Game::cplane_t, 20);
|
||||
AssertSize(Game::cplane_s, 20);
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
@ -568,32 +568,32 @@ namespace Assets
|
||||
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
|
||||
if (asset->reflectionImages)
|
||||
if (asset->reflectionProbes)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::GfxImage** imageDest = buffer->dest<Game::GfxImage*>();
|
||||
buffer->saveArray(asset->reflectionImages, asset->reflectionProbeCount);
|
||||
buffer->saveArray(asset->reflectionProbes, asset->reflectionProbeCount);
|
||||
|
||||
for (unsigned int i = 0; i < asset->reflectionProbeCount; ++i)
|
||||
{
|
||||
if (asset->reflectionImages[i])
|
||||
if (asset->reflectionProbes[i])
|
||||
{
|
||||
imageDest[i] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->reflectionImages[i]).image;
|
||||
imageDest[i] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->reflectionProbes[i]).image;
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->reflectionImages);
|
||||
Utils::Stream::ClearPointer(&dest->reflectionProbes);
|
||||
}
|
||||
|
||||
if (asset->reflectionProbes)
|
||||
if (asset->reflectionProbeOrigins)
|
||||
{
|
||||
AssertSize(Game::GfxReflectionProbe, 12);
|
||||
SaveLogEnter("GfxReflectionProbe");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->reflectionProbes, asset->reflectionProbeCount);
|
||||
Utils::Stream::ClearPointer(&dest->reflectionProbes);
|
||||
buffer->saveArray(asset->reflectionProbeOrigins, asset->reflectionProbeCount);
|
||||
Utils::Stream::ClearPointer(&dest->reflectionProbeOrigins);
|
||||
|
||||
SaveLogExit();
|
||||
}
|
||||
@ -602,7 +602,7 @@ namespace Assets
|
||||
|
||||
if (asset->reflectionProbeTextures)
|
||||
{
|
||||
AssertSize(Game::GfxRawTexture, 4);
|
||||
AssertSize(Game::GfxTexture, 4);
|
||||
SaveLogEnter("GfxRawTexture");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
@ -662,14 +662,14 @@ namespace Assets
|
||||
|
||||
buffer->popBlock();
|
||||
|
||||
if (asset->skyImage)
|
||||
if (asset->lightmapOverridePrimary)
|
||||
{
|
||||
dest->skyImage = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->skyImage).image;
|
||||
dest->lightmapOverridePrimary = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->lightmapOverridePrimary).image;
|
||||
}
|
||||
|
||||
if (asset->outdoorImage)
|
||||
if (asset->lightmapOverrideSecondary)
|
||||
{
|
||||
dest->outdoorImage = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->outdoorImage).image;
|
||||
dest->lightmapOverrideSecondary = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->lightmapOverrideSecondary).image;
|
||||
}
|
||||
|
||||
// saveGfxWorldVertexData
|
||||
|
@ -39,8 +39,9 @@ namespace Assets
|
||||
{
|
||||
entites->stageCount = 1;
|
||||
entites->stages = builder->getAllocator()->allocate<Game::Stage>();
|
||||
entites->stages[0].stageName = "stage 0";
|
||||
entites->stages[0].flags = 0x10400;
|
||||
entites->stages[0].name = "stage 0";
|
||||
entites->stages[0].triggerIndex = 0x400;
|
||||
entites->stages[0].sunPrimaryLightIndex = 0x1;
|
||||
}
|
||||
|
||||
std::string entityString = ents.getBuffer();
|
||||
@ -92,7 +93,7 @@ namespace Assets
|
||||
AssertSize(Game::TriggerModel, 8);
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->trigger.models, asset->trigger.modelCount);
|
||||
buffer->saveArray(asset->trigger.models, asset->trigger.count);
|
||||
Utils::Stream::ClearPointer(&dest->trigger.models);
|
||||
}
|
||||
|
||||
@ -128,10 +129,10 @@ namespace Assets
|
||||
Game::Stage* destStage = &destStages[i];
|
||||
Game::Stage* stage = &asset->stages[i];
|
||||
|
||||
if (stage->stageName)
|
||||
if (stage->name)
|
||||
{
|
||||
buffer->saveString(stage->stageName);
|
||||
Utils::Stream::ClearPointer(&destStage->stageName);
|
||||
buffer->saveString(stage->name);
|
||||
Utils::Stream::ClearPointer(&destStage->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,9 @@ namespace Assets
|
||||
|
||||
Game::Material* asset = reader.readObject<Game::Material>();
|
||||
|
||||
if (asset->name)
|
||||
if (asset->info.name)
|
||||
{
|
||||
asset->name = reader.readCString();
|
||||
asset->info.name = reader.readCString();
|
||||
}
|
||||
|
||||
if (asset->techniqueSet)
|
||||
@ -101,10 +101,10 @@ namespace Assets
|
||||
|
||||
if (textureDef->semantic == SEMANTIC_WATER_MAP)
|
||||
{
|
||||
if (textureDef->info.water)
|
||||
if (textureDef->u.water)
|
||||
{
|
||||
Game::water_t* water = reader.readObject<Game::water_t>();
|
||||
textureDef->info.water = water;
|
||||
textureDef->u.water = water;
|
||||
|
||||
// Save_water_t
|
||||
if (water->H0)
|
||||
@ -123,9 +123,9 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (textureDef->info.image)
|
||||
else if (textureDef->u.image)
|
||||
{
|
||||
textureDef->info.image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString().data(), builder).image;
|
||||
textureDef->u.image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString().data(), builder).image;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,9 +135,9 @@ namespace Assets
|
||||
asset->constantTable = reader.readArray<Game::MaterialConstantDef>(asset->constantCount);
|
||||
}
|
||||
|
||||
if (asset->stateBitTable)
|
||||
if (asset->stateBitsTable)
|
||||
{
|
||||
asset->stateBitTable = reader.readArray<Game::GfxStateBits>(asset->stateBitsCount);
|
||||
asset->stateBitsTable = reader.readArray<Game::GfxStateBits>(asset->stateBitsCount);
|
||||
}
|
||||
|
||||
header->material = asset;
|
||||
@ -157,7 +157,7 @@ namespace Assets
|
||||
|
||||
if (std::string(name) == header.material->techniqueSet->name)
|
||||
{
|
||||
asset->sortKey = header.material->sortKey;
|
||||
asset->info.sortKey = header.material->info.sortKey;
|
||||
|
||||
// This is temp, as nobody has time to fix materials
|
||||
// asset->stateBitsCount = header.material->stateBitsCount;
|
||||
@ -178,7 +178,7 @@ namespace Assets
|
||||
Game::MaterialTechniqueSet* t1 = m1->techniqueSet;
|
||||
Game::MaterialTechniqueSet* t2 = m2->techniqueSet;
|
||||
if (!t1 || !t2) return false;
|
||||
if (t1->remappedTechniques && t2->remappedTechniques && std::string(t1->remappedTechniques->name) == t2->remappedTechniques->name) return true;
|
||||
if (t1->remappedTechniqueSet && t2->remappedTechniqueSet && std::string(t1->remappedTechniqueSet->name) == t2->remappedTechniqueSet->name) return true;
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(t1->techniques); ++i)
|
||||
{
|
||||
@ -199,8 +199,8 @@ namespace Assets
|
||||
|
||||
if (techsetMatches(header.material, asset))
|
||||
{
|
||||
Components::Logger::Print("Material %s with techset %s has been mapped to %s\n", asset->name, asset->techniqueSet->name, header.material->techniqueSet->name);
|
||||
asset->sortKey = header.material->sortKey;
|
||||
Components::Logger::Print("Material %s with techset %s has been mapped to %s\n", asset->info.name, asset->techniqueSet->name, header.material->techniqueSet->name);
|
||||
asset->info.sortKey = header.material->info.sortKey;
|
||||
replacementFound = true;
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ namespace Assets
|
||||
if (!replacementFound && asset->techniqueSet)
|
||||
{
|
||||
|
||||
Components::Logger::Print("No replacement found for material %s with techset %s\n", asset->name, asset->techniqueSet->name);
|
||||
Components::Logger::Print("No replacement found for material %s with techset %s\n", asset->info.name, asset->techniqueSet->name);
|
||||
}
|
||||
|
||||
if (!reader.end())
|
||||
@ -221,7 +221,7 @@ namespace Assets
|
||||
char baseIndex = 0;
|
||||
for (char i = 0; i < asset->stateBitsCount; ++i)
|
||||
{
|
||||
auto stateBits = asset->stateBitTable[i];
|
||||
auto stateBits = asset->stateBitsTable[i];
|
||||
if (stateBits.loadBits[0] == 0x18128812 &&
|
||||
stateBits.loadBits[1] == 0xD) // Seems to be like a default stateBit causing a 'generic' initialization
|
||||
{
|
||||
@ -290,10 +290,10 @@ namespace Assets
|
||||
|
||||
// Copy base material to our structure
|
||||
std::memcpy(material, baseMaterial, sizeof(Game::Material));
|
||||
material->name = builder->getAllocator()->duplicateString(name);
|
||||
material->info.name = builder->getAllocator()->duplicateString(name);
|
||||
|
||||
material->textureAtlasRowCount = 1;
|
||||
material->textureAtlasColumnCount = 1;
|
||||
material->info.textureAtlasRowCount = 1;
|
||||
material->info.textureAtlasColumnCount = 1;
|
||||
|
||||
// Load animation frames
|
||||
auto anims = infoData["anims"];
|
||||
@ -308,12 +308,12 @@ namespace Assets
|
||||
|
||||
if (animCoordX.is_number())
|
||||
{
|
||||
material->textureAtlasColumnCount = static_cast<char>(animCoordX.number_value()) & 0xFF;
|
||||
material->info.textureAtlasColumnCount = static_cast<char>(animCoordX.number_value()) & 0xFF;
|
||||
}
|
||||
|
||||
if (animCoordY.is_number())
|
||||
{
|
||||
material->textureAtlasRowCount = static_cast<char>(animCoordY.number_value()) & 0xFF;
|
||||
material->info.textureAtlasRowCount = static_cast<char>(animCoordY.number_value()) & 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -349,12 +349,12 @@ namespace Assets
|
||||
Game::MaterialTextureDef textureDef;
|
||||
|
||||
textureDef.semantic = 0; // No water image
|
||||
textureDef.sampleState = -30;
|
||||
textureDef.samplerState = -30;
|
||||
textureDef.nameEnd = map.string_value().back();
|
||||
textureDef.nameStart = map.string_value().front();
|
||||
textureDef.nameHash = Game::R_HashString(map.string_value().data());
|
||||
|
||||
textureDef.info.image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, image.string_value(), builder).image;
|
||||
textureDef.u.image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, image.string_value(), builder).image;
|
||||
|
||||
if (replaceTexture)
|
||||
{
|
||||
@ -365,14 +365,14 @@ namespace Assets
|
||||
if (material->textureTable[i].nameHash == textureDef.nameHash)
|
||||
{
|
||||
applied = true;
|
||||
material->textureTable[i].info.image = textureDef.info.image;
|
||||
material->textureTable[i].u.image = textureDef.u.image;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!applied)
|
||||
{
|
||||
Components::Logger::Error(0, "Unable to find texture for map '%s' in %s!", map.string_value().data(), baseMaterial->name);
|
||||
Components::Logger::Error(0, "Unable to find texture for map '%s' in %s!", map.string_value().data(), baseMaterial->info.name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -422,18 +422,18 @@ namespace Assets
|
||||
{
|
||||
for (char i = 0; i < asset->textureCount; ++i)
|
||||
{
|
||||
if (asset->textureTable[i].info.image)
|
||||
if (asset->textureTable[i].u.image)
|
||||
{
|
||||
if (asset->textureTable[i].semantic == SEMANTIC_WATER_MAP)
|
||||
{
|
||||
if (asset->textureTable[i].info.water->image)
|
||||
if (asset->textureTable[i].u.water->image)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->textureTable[i].info.water->image);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->textureTable[i].u.water->image);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->textureTable[i].info.image);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->textureTable[i].u.image);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -451,10 +451,10 @@ namespace Assets
|
||||
|
||||
buffer->pushBlock(Game::XFILE_BLOCK_VIRTUAL);
|
||||
|
||||
if (asset->name)
|
||||
if (asset->info.name)
|
||||
{
|
||||
buffer->saveString(builder->getAssetName(this->getType(), asset->name));
|
||||
Utils::Stream::ClearPointer(&dest->name);
|
||||
buffer->saveString(builder->getAssetName(this->getType(), asset->info.name));
|
||||
Utils::Stream::ClearPointer(&dest->info.name);
|
||||
}
|
||||
|
||||
if (asset->techniqueSet)
|
||||
@ -489,13 +489,13 @@ namespace Assets
|
||||
AssertSize(Game::water_t, 68);
|
||||
|
||||
Game::water_t* destWater = buffer->dest<Game::water_t>();
|
||||
Game::water_t* water = textureDef->info.water;
|
||||
Game::water_t* water = textureDef->u.water;
|
||||
|
||||
if (water)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->save(water);
|
||||
Utils::Stream::ClearPointer(&destTextureDef->info.water);
|
||||
Utils::Stream::ClearPointer(&destTextureDef->u.water);
|
||||
|
||||
// Save_water_t
|
||||
if (water->H0)
|
||||
@ -518,9 +518,9 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (textureDef->info.image)
|
||||
else if (textureDef->u.image)
|
||||
{
|
||||
destTextureDef->info.image = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, textureDef->info.image).image;
|
||||
destTextureDef->u.image = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, textureDef->u.image).image;
|
||||
}
|
||||
}
|
||||
|
||||
@ -546,19 +546,19 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
if (asset->stateBitTable)
|
||||
if (asset->stateBitsTable)
|
||||
{
|
||||
if (builder->hasPointer(asset->stateBitTable))
|
||||
if (builder->hasPointer(asset->stateBitsTable))
|
||||
{
|
||||
dest->stateBitTable = builder->getPointer(asset->stateBitTable);
|
||||
dest->stateBitsTable = builder->getPointer(asset->stateBitsTable);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
builder->storePointer(asset->stateBitTable);
|
||||
builder->storePointer(asset->stateBitsTable);
|
||||
|
||||
buffer->save(asset->stateBitTable, 8, asset->stateBitsCount);
|
||||
Utils::Stream::ClearPointer(&dest->stateBitTable);
|
||||
buffer->save(asset->stateBitsTable, 8, asset->stateBitsCount);
|
||||
Utils::Stream::ClearPointer(&dest->stateBitsTable);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace Assets
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
builder->storePointer(side->plane);
|
||||
|
||||
buffer->save(side->plane, sizeof(Game::cplane_t));
|
||||
buffer->save(side->plane, sizeof(Game::cplane_s));
|
||||
Utils::Stream::ClearPointer(&destSide->plane);
|
||||
}
|
||||
}
|
||||
@ -59,7 +59,7 @@ namespace Assets
|
||||
|
||||
if (brush->planes)
|
||||
{
|
||||
AssertSize(Game::cplane_t, 20);
|
||||
AssertSize(Game::cplane_s, 20);
|
||||
|
||||
if (builder->hasPointer(brush->planes))
|
||||
{
|
||||
@ -95,12 +95,12 @@ namespace Assets
|
||||
Game::PhysGeomInfo* destGeom = &destGeoms[i];
|
||||
Game::PhysGeomInfo* geom = &geoms[i];
|
||||
|
||||
if (geom->brush)
|
||||
if (geom->brushWrapper)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
this->saveBrushWrapper(builder, geom->brush);
|
||||
Utils::Stream::ClearPointer(&destGeom->brush);
|
||||
this->saveBrushWrapper(builder, geom->brushWrapper);
|
||||
Utils::Stream::ClearPointer(&destGeom->brushWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ namespace Assets
|
||||
//std::string data = Utils::Compression::ZLib::Compress(rawFile.getBuffer());
|
||||
|
||||
asset->name = builder->getAllocator()->duplicateString(name);
|
||||
asset->compressedData = builder->getAllocator()->duplicateString(rawFile.getBuffer());
|
||||
asset->sizeCompressed = 0;//data.size();
|
||||
asset->sizeUnCompressed = rawFile.getBuffer().size();
|
||||
asset->buffer = builder->getAllocator()->duplicateString(rawFile.getBuffer());
|
||||
asset->compressedLen = 0;//data.size();
|
||||
asset->len = rawFile.getBuffer().size();
|
||||
|
||||
header->rawfile = asset;
|
||||
}
|
||||
@ -41,18 +41,18 @@ namespace Assets
|
||||
Utils::Stream::ClearPointer(&dest->name);
|
||||
}
|
||||
|
||||
if (asset->compressedData)
|
||||
if (asset->buffer)
|
||||
{
|
||||
if (asset->sizeCompressed)
|
||||
if (asset->compressedLen)
|
||||
{
|
||||
buffer->save(asset->compressedData, asset->sizeCompressed);
|
||||
buffer->save(asset->buffer, asset->compressedLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->save(asset->compressedData, asset->sizeUnCompressed + 1);
|
||||
buffer->save(asset->buffer, asset->len + 1);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->compressedData);
|
||||
Utils::Stream::ClearPointer(&dest->buffer);
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
|
@ -27,10 +27,10 @@ namespace Assets
|
||||
Game::StructuredDataEnumEntry* destIndex = &destIndices[j];
|
||||
Game::StructuredDataEnumEntry* index = &enum_->entries[j];
|
||||
|
||||
if (index->name)
|
||||
if (index->string)
|
||||
{
|
||||
buffer->saveString(index->name);
|
||||
Utils::Stream::ClearPointer(&destIndex->name);
|
||||
buffer->saveString(index->string);
|
||||
Utils::Stream::ClearPointer(&destIndex->string);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ namespace Assets
|
||||
AssertSize(Game::StructuredDataDefSet, 12);
|
||||
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
Game::StructuredDataDefSet* asset = header.structuredData;
|
||||
Game::StructuredDataDefSet* asset = header.structuredDataDefSet;
|
||||
Game::StructuredDataDefSet* dest = buffer->dest<Game::StructuredDataDefSet>();
|
||||
buffer->save(asset);
|
||||
|
||||
|
@ -33,22 +33,22 @@ namespace Assets
|
||||
xanim->name = reader.readCString();
|
||||
}
|
||||
|
||||
if (xanim->tagnames)
|
||||
if (xanim->names)
|
||||
{
|
||||
xanim->tagnames = builder->getAllocator()->allocateArray<short>(xanim->boneCount[Game::XAnimPartType::PART_TYPE_ALL]);
|
||||
for (int i = 0; i < xanim->boneCount[Game::XAnimPartType::PART_TYPE_ALL]; ++i)
|
||||
xanim->names = builder->getAllocator()->allocateArray<unsigned short>(xanim->boneCount[Game::PART_TYPE_ALL]);
|
||||
for (int i = 0; i < xanim->boneCount[Game::PART_TYPE_ALL]; ++i)
|
||||
{
|
||||
xanim->tagnames[i] = Game::SL_GetString(reader.readCString(), 0);
|
||||
xanim->names[i] = Game::SL_GetString(reader.readCString(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (xanim->notetracks)
|
||||
if (xanim->notify)
|
||||
{
|
||||
xanim->notetracks = reader.readArray<Game::XAnimNotifyInfo>(xanim->notetrackCount);
|
||||
xanim->notify = reader.readArray<Game::XAnimNotifyInfo>(xanim->notifyCount);
|
||||
|
||||
for (int i = 0; i < xanim->notetrackCount; ++i)
|
||||
for (int i = 0; i < xanim->notifyCount; ++i)
|
||||
{
|
||||
xanim->notetracks[i].name = Game::SL_GetString(reader.readCString(), 0);
|
||||
xanim->notify[i].name = Game::SL_GetString(reader.readCString(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,13 +84,13 @@ namespace Assets
|
||||
|
||||
if (xanim->indices.data)
|
||||
{
|
||||
if (xanim->framecount < 256)
|
||||
if (xanim->numframes < 256)
|
||||
{
|
||||
xanim->indices._1 = reader.readArray<char>(xanim->indexcount);
|
||||
xanim->indices._1 = reader.readArray<char>(xanim->indexCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
xanim->indices._2 = reader.readArray<unsigned short>(xanim->indexcount);
|
||||
xanim->indices._2 = reader.readArray<unsigned short>(xanim->indexCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,19 +108,19 @@ namespace Assets
|
||||
{
|
||||
Game::XAnimParts* asset = header.parts;
|
||||
|
||||
if (asset->tagnames)
|
||||
if (asset->names)
|
||||
{
|
||||
for (char i = 0; i < asset->boneCount[Game::XAnimPartType::PART_TYPE_ALL]; ++i)
|
||||
for (char i = 0; i < asset->boneCount[Game::PART_TYPE_ALL]; ++i)
|
||||
{
|
||||
builder->addScriptString(asset->tagnames[i]);
|
||||
builder->addScriptString(asset->names[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (asset->notetracks)
|
||||
if (asset->notify)
|
||||
{
|
||||
for (char i = 0; i < asset->notetrackCount; ++i)
|
||||
for (char i = 0; i < asset->notifyCount; ++i)
|
||||
{
|
||||
builder->addScriptString(asset->notetracks[i].name);
|
||||
builder->addScriptString(asset->notify[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,11 +183,11 @@ namespace Assets
|
||||
|
||||
if (framecount > 0xFF)
|
||||
{
|
||||
buffer->save(delta->quat2->u.frames.indices, 2, delta->quat2->size + 1);
|
||||
buffer->save(delta->quat2->u.frames.indices._1, 2, delta->quat2->size + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->save(delta->quat2->u.frames.indices, 1, delta->quat2->size + 1);
|
||||
buffer->save(delta->quat2->u.frames.indices._1, 1, delta->quat2->size + 1);
|
||||
}
|
||||
|
||||
if (delta->quat2->u.frames.frames)
|
||||
@ -215,11 +215,11 @@ namespace Assets
|
||||
|
||||
if (framecount > 0xFF)
|
||||
{
|
||||
buffer->save(delta->quat->u.frames.indices, 2, delta->quat->size + 1);
|
||||
buffer->save(delta->quat->u.frames.indices._1, 2, delta->quat->size + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->save(delta->quat->u.frames.indices, 1, delta->quat->size + 1);
|
||||
buffer->save(delta->quat->u.frames.indices._1, 1, delta->quat->size + 1);
|
||||
}
|
||||
|
||||
if (delta->quat->u.frames.frames)
|
||||
@ -254,45 +254,45 @@ namespace Assets
|
||||
Utils::Stream::ClearPointer(&dest->name);
|
||||
}
|
||||
|
||||
if (asset->tagnames)
|
||||
if (asset->names)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_2);
|
||||
|
||||
unsigned short* destTagnames = buffer->dest<unsigned short>();
|
||||
buffer->saveArray(asset->tagnames, asset->boneCount[Game::XAnimPartType::PART_TYPE_ALL]);
|
||||
buffer->saveArray(asset->names, asset->boneCount[Game::PART_TYPE_ALL]);
|
||||
|
||||
for (char i = 0; i < asset->boneCount[Game::XAnimPartType::PART_TYPE_ALL]; ++i)
|
||||
for (char i = 0; i < asset->boneCount[Game::PART_TYPE_ALL]; ++i)
|
||||
{
|
||||
builder->mapScriptString(&destTagnames[i]);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->tagnames);
|
||||
Utils::Stream::ClearPointer(&dest->names);
|
||||
}
|
||||
|
||||
if (asset->notetracks)
|
||||
if (asset->notify)
|
||||
{
|
||||
AssertSize(Game::XAnimNotifyInfo, 8);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::XAnimNotifyInfo* destNotetracks = buffer->dest<Game::XAnimNotifyInfo>();
|
||||
buffer->saveArray(asset->notetracks, asset->notetrackCount);
|
||||
buffer->saveArray(asset->notify, asset->notifyCount);
|
||||
|
||||
for (char i = 0; i < asset->notetrackCount; ++i)
|
||||
for (char i = 0; i < asset->notifyCount; ++i)
|
||||
{
|
||||
builder->mapScriptString(&destNotetracks[i].name);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->notetracks);
|
||||
Utils::Stream::ClearPointer(&dest->notify);
|
||||
}
|
||||
|
||||
if (asset->delta)
|
||||
if (asset->deltaPart)
|
||||
{
|
||||
AssertSize(Game::XAnimDeltaPart, 12);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
this->saveXAnimDeltaPart(asset->delta, asset->framecount, builder);
|
||||
this->saveXAnimDeltaPart(asset->deltaPart, asset->numframes, builder);
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->delta);
|
||||
Utils::Stream::ClearPointer(&dest->deltaPart);
|
||||
}
|
||||
|
||||
if (asset->dataByte)
|
||||
@ -337,14 +337,14 @@ namespace Assets
|
||||
|
||||
if (asset->indices.data)
|
||||
{
|
||||
if (asset->framecount > 0xFF)
|
||||
if (asset->numframes > 0xFF)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_2);
|
||||
buffer->saveArray(asset->indices._2, asset->indexcount);
|
||||
buffer->saveArray(asset->indices._2, asset->indexCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->saveArray(asset->indices._1, asset->indexcount);
|
||||
buffer->saveArray(asset->indices._1, asset->indexCount);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->indices.data);
|
||||
|
@ -61,13 +61,13 @@ namespace Assets
|
||||
asset->name = reader->readCString();
|
||||
}
|
||||
|
||||
if (asset->surfaces)
|
||||
if (asset->surfs)
|
||||
{
|
||||
asset->surfaces = reader->readArray<Game::XSurface>(asset->numSurfaces);
|
||||
asset->surfs = reader->readArray<Game::XSurface>(asset->numsurfs);
|
||||
|
||||
for (int i = 0; i < asset->numSurfaces; ++i)
|
||||
for (int i = 0; i < asset->numsurfs; ++i)
|
||||
{
|
||||
this->loadXSurface(&asset->surfaces[i], reader);
|
||||
this->loadXSurface(&asset->surfs[i], reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -168,7 +168,7 @@ namespace Assets
|
||||
this->loadXModelSurfs(asset->lodInfo[i].modelSurfs, &reader);
|
||||
Components::AssetHandler::StoreTemporaryAsset(Game::XAssetType::ASSET_TYPE_XMODEL_SURFS, { asset->lodInfo[i].modelSurfs });
|
||||
|
||||
asset->lodInfo[i].surfs = asset->lodInfo[i].modelSurfs->surfaces;
|
||||
asset->lodInfo[i].surfs = asset->lodInfo[i].modelSurfs->surfs;
|
||||
|
||||
// Zero that for now, it breaks the models.
|
||||
// TODO: Figure out how that can be converted
|
||||
@ -257,10 +257,10 @@ namespace Assets
|
||||
{
|
||||
Game::PhysGeomInfo* geom = &collmap->geoms[i];
|
||||
|
||||
if (geom->brush)
|
||||
if (geom->brushWrapper)
|
||||
{
|
||||
Game::BrushWrapper* brush = reader.readObject<Game::BrushWrapper>();
|
||||
geom->brush = brush;
|
||||
geom->brushWrapper = brush;
|
||||
{
|
||||
if (brush->brush.sides)
|
||||
{
|
||||
@ -272,7 +272,7 @@ namespace Assets
|
||||
// TODO: Add pointer support
|
||||
if (side->plane)
|
||||
{
|
||||
side->plane = reader.readObject<Game::cplane_t>();
|
||||
side->plane = reader.readObject<Game::cplane_s>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -286,7 +286,7 @@ namespace Assets
|
||||
// TODO: Add pointer support
|
||||
if (brush->planes)
|
||||
{
|
||||
brush->planes = reader.readArray<Game::cplane_t>(brush->brush.numsides);
|
||||
brush->planes = reader.readArray<Game::cplane_s>(brush->brush.numsides);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -441,7 +441,7 @@ namespace Assets
|
||||
{
|
||||
if (asset->lodInfo[i].modelSurfs)
|
||||
{
|
||||
dest->lodInfo[i].modelSurfs = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODEL_SURFS, asset->lodInfo[i].modelSurfs).surfaces;
|
||||
dest->lodInfo[i].modelSurfs = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODEL_SURFS, asset->lodInfo[i].modelSurfs).modelSurfs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ namespace Assets
|
||||
AssertSize(Game::XModelSurfs, 36);
|
||||
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
Game::XModelSurfs* asset = header.surfaces;
|
||||
Game::XModelSurfs* asset = header.modelSurfs;
|
||||
Game::XModelSurfs* dest = buffer->dest<Game::XModelSurfs>();
|
||||
buffer->save(asset);
|
||||
|
||||
@ -107,21 +107,21 @@ namespace Assets
|
||||
Utils::Stream::ClearPointer(&dest->name);
|
||||
}
|
||||
|
||||
if (asset->surfaces)
|
||||
if (asset->surfs)
|
||||
{
|
||||
AssertSize(Game::XSurface, 64);
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::XSurface* destSurfaces = buffer->dest<Game::XSurface>();
|
||||
buffer->saveArray(asset->surfaces, asset->numSurfaces);
|
||||
buffer->saveArray(asset->surfs, asset->numsurfs);
|
||||
|
||||
for (int i = 0; i < asset->numSurfaces; ++i)
|
||||
for (int i = 0; i < asset->numsurfs; ++i)
|
||||
{
|
||||
this->saveXSurface(&asset->surfaces[i], &destSurfaces[i], builder);
|
||||
this->saveXSurface(&asset->surfs[i], &destSurfaces[i], builder);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->surfaces);
|
||||
Utils::Stream::ClearPointer(&dest->surfs);
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
|
@ -22,26 +22,26 @@ namespace Assets
|
||||
Utils::Stream::ClearPointer(&dest->name);
|
||||
}
|
||||
|
||||
if (asset->cPlanes)
|
||||
if (asset->planes)
|
||||
{
|
||||
AssertSize(Game::cplane_t, 20);
|
||||
AssertSize(Game::cplane_s, 20);
|
||||
SaveLogEnter("cplane_t");
|
||||
|
||||
if (builder->hasPointer(asset->cPlanes))
|
||||
if (builder->hasPointer(asset->planes))
|
||||
{
|
||||
dest->cPlanes = builder->getPointer(asset->cPlanes);
|
||||
dest->planes = builder->getPointer(asset->planes);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
// not sure if this is needed but both brushside and brushedge need it and it can't hurt
|
||||
for (int i = 0; i < asset->numCPlanes; ++i)
|
||||
for (int i = 0; i < asset->planeCount; ++i)
|
||||
{
|
||||
builder->storePointer(&asset->cPlanes[i]);
|
||||
buffer->save(&asset->cPlanes[i]);
|
||||
builder->storePointer(&asset->planes[i]);
|
||||
buffer->save(&asset->planes[i]);
|
||||
}
|
||||
Utils::Stream::ClearPointer(&dest->cPlanes);
|
||||
Utils::Stream::ClearPointer(&dest->planes);
|
||||
}
|
||||
|
||||
SaveLogExit();
|
||||
@ -50,15 +50,15 @@ namespace Assets
|
||||
if (asset->staticModelList)
|
||||
{
|
||||
|
||||
AssertSize(Game::cStaticModel_t, 76);
|
||||
AssertSize(Game::cStaticModel_s, 76);
|
||||
SaveLogEnter("cStaticModel_t");
|
||||
|
||||
// xmodel is already stored
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
Game::cStaticModel_t* destStaticModelList = buffer->dest<Game::cStaticModel_t>();
|
||||
Game::cStaticModel_s* destStaticModelList = buffer->dest<Game::cStaticModel_s>();
|
||||
buffer->saveArray(asset->staticModelList, asset->numStaticModels);
|
||||
|
||||
for (int i = 0; i < asset->numStaticModels; ++i)
|
||||
for (unsigned int i = 0; i < asset->numStaticModels; ++i)
|
||||
{
|
||||
if (asset->staticModelList[i].xmodel)
|
||||
{
|
||||
@ -79,7 +79,7 @@ namespace Assets
|
||||
Game::ClipMaterial* mats = buffer->dest<Game::ClipMaterial>();
|
||||
buffer->saveArray(asset->materials, asset->numMaterials);
|
||||
|
||||
for (int i = 0; i < asset->numMaterials; ++i)
|
||||
for (unsigned int i = 0; i < asset->numMaterials; ++i)
|
||||
{
|
||||
buffer->saveString(asset->materials[i].name);
|
||||
Utils::Stream::ClearPointer(&mats[i].name);
|
||||
@ -89,7 +89,7 @@ namespace Assets
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->cBrushSides)
|
||||
if (asset->brushsides)
|
||||
{
|
||||
AssertSize(Game::cbrushside_t, 8);
|
||||
SaveLogEnter("cbrushside_t");
|
||||
@ -97,17 +97,17 @@ namespace Assets
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
Game::cbrushside_t* sides = buffer->dest<Game::cbrushside_t>();
|
||||
// we need the pointer to each of these to be stored so we can't write them all at once
|
||||
for (int i = 0; i < asset->numCBrushSides; ++i)
|
||||
for (unsigned int i = 0; i < asset->numBrushSides; ++i)
|
||||
{
|
||||
builder->storePointer(&asset->cBrushSides[i]); // for reference in cBrush
|
||||
buffer->save(&asset->cBrushSides[i]);
|
||||
builder->storePointer(&asset->brushsides[i]); // for reference in cBrush
|
||||
buffer->save(&asset->brushsides[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < asset->numCBrushSides; ++i)
|
||||
for (unsigned int i = 0; i < asset->numBrushSides; ++i)
|
||||
{
|
||||
if (sides[i].plane)
|
||||
{
|
||||
AssertSize(Game::cplane_t, 20);
|
||||
AssertSize(Game::cplane_s, 20);
|
||||
|
||||
if (builder->hasPointer(sides[i].plane))
|
||||
{
|
||||
@ -124,35 +124,35 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->cBrushSides);
|
||||
Utils::Stream::ClearPointer(&dest->brushsides);
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->cBrushEdges)
|
||||
if (asset->brushEdges)
|
||||
{
|
||||
SaveLogEnter("cBrushEdge");
|
||||
|
||||
// no align for char
|
||||
for (int i = 0; i < asset->numCBrushEdges; ++i)
|
||||
for (unsigned int i = 0; i < asset->numBrushEdges; ++i)
|
||||
{
|
||||
builder->storePointer(&asset->cBrushEdges[i]); // for reference in cBrush
|
||||
buffer->save(&asset->cBrushEdges[i]);
|
||||
builder->storePointer(&asset->brushEdges[i]); // for reference in cBrush
|
||||
buffer->save(&asset->brushEdges[i]);
|
||||
}
|
||||
Utils::Stream::ClearPointer(&dest->cBrushEdges);
|
||||
Utils::Stream::ClearPointer(&dest->brushEdges);
|
||||
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->cNodes)
|
||||
if (asset->nodes)
|
||||
{
|
||||
AssertSize(Game::cNode_t, 8);
|
||||
SaveLogEnter("cNode_t");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
Game::cNode_t* nodes = buffer->dest<Game::cNode_t>();
|
||||
buffer->saveArray(asset->cNodes, asset->numCNodes);
|
||||
buffer->saveArray(asset->nodes, asset->numNodes);
|
||||
|
||||
for (int i = 0; i < asset->numCNodes; ++i)
|
||||
for (unsigned int i = 0; i < asset->numNodes; ++i)
|
||||
{
|
||||
if (nodes[i].plane)
|
||||
{
|
||||
@ -171,42 +171,42 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->cNodes);
|
||||
Utils::Stream::ClearPointer(&dest->nodes);
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->cLeaf)
|
||||
if (asset->leafs)
|
||||
{
|
||||
AssertSize(Game::cLeaf_t, 40);
|
||||
SaveLogEnter("cLeaf_t");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->cLeaf, asset->numCLeaf);
|
||||
Utils::Stream::ClearPointer(&dest->cLeaf);
|
||||
buffer->saveArray(asset->leafs, asset->numLeafs);
|
||||
Utils::Stream::ClearPointer(&dest->leafs);
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->leafBrushes)
|
||||
if (asset->leafbrushes)
|
||||
{
|
||||
SaveLogEnter("cLeafBrush_t");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_2);
|
||||
buffer->saveArray(asset->leafBrushes, asset->numLeafBrushes);
|
||||
Utils::Stream::ClearPointer(&dest->leafBrushes);
|
||||
buffer->saveArray(asset->leafbrushes, asset->numLeafBrushes);
|
||||
Utils::Stream::ClearPointer(&dest->leafbrushes);
|
||||
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->cLeafBrushNodes)
|
||||
if (asset->leafbrushNodes)
|
||||
{
|
||||
AssertSize(Game::cLeafBrushNode_t, 20);
|
||||
AssertSize(Game::cLeafBrushNode_s, 20);
|
||||
SaveLogEnter("cLeafBrushNode_t");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
Game::cLeafBrushNode_t* node = buffer->dest<Game::cLeafBrushNode_t>();
|
||||
buffer->saveArray(asset->cLeafBrushNodes, asset->numCLeafBrushNodes);
|
||||
Game::cLeafBrushNode_s* node = buffer->dest<Game::cLeafBrushNode_s>();
|
||||
buffer->saveArray(asset->leafbrushNodes, asset->leafbrushNodesCount);
|
||||
|
||||
for (int i = 0; i < asset->numCLeafBrushNodes; ++i)
|
||||
for (unsigned int i = 0; i < asset->leafbrushNodesCount; ++i)
|
||||
{
|
||||
if (node[i].leafBrushCount > 0)
|
||||
{
|
||||
@ -232,17 +232,17 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->cLeafBrushNodes);
|
||||
Utils::Stream::ClearPointer(&dest->leafbrushNodes);
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->leafSurfaces)
|
||||
if (asset->leafsurfaces)
|
||||
{
|
||||
SaveLogEnter("cLeafSurface_t");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->leafSurfaces, asset->numLeafSurfaces);
|
||||
Utils::Stream::ClearPointer(&dest->leafSurfaces);
|
||||
buffer->saveArray(asset->leafsurfaces, asset->numLeafSurfaces);
|
||||
Utils::Stream::ClearPointer(&dest->leafsurfaces);
|
||||
|
||||
SaveLogExit();
|
||||
}
|
||||
@ -252,54 +252,54 @@ namespace Assets
|
||||
AssertSize(Game::vec3_t, 12);
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->verts, asset->numVerts);
|
||||
buffer->saveArray(asset->verts, asset->vertCount);
|
||||
Utils::Stream::ClearPointer(&dest->verts);
|
||||
}
|
||||
|
||||
if (asset->triIndices)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_2);
|
||||
buffer->save(asset->triIndices, 6, asset->numTriIndices);
|
||||
buffer->save(asset->triIndices, 6, asset->triCount);
|
||||
Utils::Stream::ClearPointer(&dest->triIndices);
|
||||
}
|
||||
|
||||
if (asset->triEdgeIsWalkable)
|
||||
{
|
||||
// no align for char
|
||||
buffer->save(asset->triEdgeIsWalkable, 1, 4 * ((3 * asset->numTriIndices + 31) >> 5));
|
||||
buffer->save(asset->triEdgeIsWalkable, 1, 4 * ((3 * asset->triCount + 31) >> 5));
|
||||
Utils::Stream::ClearPointer(&dest->triEdgeIsWalkable);
|
||||
}
|
||||
|
||||
if (asset->collisionBorders)
|
||||
if (asset->borders)
|
||||
{
|
||||
AssertSize(Game::CollisionBorder, 28);
|
||||
SaveLogEnter("CollisionBorder");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
for (int i = 0; i < asset->numCollisionBorders; ++i)
|
||||
for (int i = 0; i < asset->borderCount; ++i)
|
||||
{
|
||||
builder->storePointer(&asset->collisionBorders[i]);
|
||||
buffer->save(&asset->collisionBorders[i]);
|
||||
builder->storePointer(&asset->borders[i]);
|
||||
buffer->save(&asset->borders[i]);
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->collisionBorders);
|
||||
Utils::Stream::ClearPointer(&dest->borders);
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->collisionPartitions)
|
||||
if (asset->partitions)
|
||||
{
|
||||
AssertSize(Game::CollisionPartition, 12);
|
||||
SaveLogEnter("CollisionPartition");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
Game::CollisionPartition* destPartitions = buffer->dest<Game::CollisionPartition>();
|
||||
buffer->saveArray(asset->collisionPartitions, asset->numCollisionPartitions);
|
||||
buffer->saveArray(asset->partitions, asset->partitionCount);
|
||||
|
||||
for (int i = 0; i < asset->numCollisionPartitions; ++i)
|
||||
for (int i = 0; i < asset->partitionCount; ++i)
|
||||
{
|
||||
Game::CollisionPartition* destPartition = &destPartitions[i];
|
||||
Game::CollisionPartition* partition = &asset->collisionPartitions[i];
|
||||
Game::CollisionPartition* partition = &asset->partitions[i];
|
||||
|
||||
if (partition->borders)
|
||||
{
|
||||
@ -317,47 +317,47 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->collisionPartitions);
|
||||
Utils::Stream::ClearPointer(&dest->partitions);
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->collisionAABBTrees)
|
||||
if (asset->aabbTrees)
|
||||
{
|
||||
AssertSize(Game::CollisionAabbTree, 32);
|
||||
SaveLogEnter("CollisionAabbTree");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_16);
|
||||
buffer->saveArray(asset->collisionAABBTrees, asset->numCollisionAABBTrees);
|
||||
Utils::Stream::ClearPointer(&dest->collisionAABBTrees);
|
||||
buffer->saveArray(asset->aabbTrees, asset->aabbTreeCount);
|
||||
Utils::Stream::ClearPointer(&dest->aabbTrees);
|
||||
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->cModels)
|
||||
if (asset->cmodels)
|
||||
{
|
||||
AssertSize(Game::cmodel_t, 68);
|
||||
SaveLogEnter("cmodel_t");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->cModels, asset->numCModels);
|
||||
Utils::Stream::ClearPointer(&dest->cModels);
|
||||
buffer->saveArray(asset->cmodels, asset->numSubModels);
|
||||
Utils::Stream::ClearPointer(&dest->cmodels);
|
||||
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->cBrushes)
|
||||
if (asset->brushes)
|
||||
{
|
||||
AssertSize(Game::cbrush_t, 36);
|
||||
SaveLogEnter("cbrush_t");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_128);
|
||||
Game::cbrush_t* destBrushes = buffer->dest<Game::cbrush_t>();
|
||||
buffer->saveArray(asset->cBrushes, asset->numCBrushes);
|
||||
buffer->saveArray(asset->brushes, asset->numBrushes);
|
||||
|
||||
for (short i = 0; i < asset->numCBrushes; ++i)
|
||||
for (short i = 0; i < asset->numBrushes; ++i)
|
||||
{
|
||||
Game::cbrush_t* destBrush = &destBrushes[i];
|
||||
Game::cbrush_t* brush = &asset->cBrushes[i];
|
||||
Game::cbrush_t* brush = &asset->brushes[i];
|
||||
|
||||
if (brush->sides)
|
||||
{
|
||||
@ -411,27 +411,27 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->cBrushes);
|
||||
Utils::Stream::ClearPointer(&dest->brushes);
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->cBrushBounds)
|
||||
if (asset->brushBounds)
|
||||
{
|
||||
AssertSize(Game::Bounds, 24);
|
||||
SaveLogEnter("Bounds");
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_128);
|
||||
buffer->saveArray(asset->cBrushBounds, asset->numCBrushes);
|
||||
Utils::Stream::ClearPointer(&dest->cBrushBounds);
|
||||
buffer->saveArray(asset->brushBounds, asset->numBrushes);
|
||||
Utils::Stream::ClearPointer(&dest->brushBounds);
|
||||
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
if (asset->cBrushContents)
|
||||
if (asset->brushContents)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveArray(asset->cBrushContents, asset->numCBrushes);
|
||||
Utils::Stream::ClearPointer(&dest->cBrushContents);
|
||||
buffer->saveArray(asset->brushContents, asset->numBrushes);
|
||||
Utils::Stream::ClearPointer(&dest->brushContents);
|
||||
}
|
||||
|
||||
if (asset->smodelNodes)
|
||||
@ -532,7 +532,7 @@ namespace Assets
|
||||
void IclipMap_t::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
Game::clipMap_t* asset = header.clipMap;
|
||||
for (int i = 0; i < asset->numStaticModels; ++i)
|
||||
for (unsigned int i = 0; i < asset->numStaticModels; ++i)
|
||||
{
|
||||
Game::XModel* m = asset->staticModelList[i].xmodel;
|
||||
if (m)
|
||||
@ -611,46 +611,46 @@ namespace Assets
|
||||
|
||||
clipMap->name = reader.readCString();
|
||||
|
||||
clipMap->numCPlanes = reader.read<int>();
|
||||
clipMap->planeCount = reader.read<int>();
|
||||
clipMap->numStaticModels = reader.read<int>();
|
||||
clipMap->numMaterials = reader.read<int>();
|
||||
clipMap->numCBrushSides = reader.read<int>();
|
||||
clipMap->numCBrushEdges = reader.read<int>();
|
||||
clipMap->numCNodes = reader.read<int>();
|
||||
clipMap->numCLeaf = reader.read<int>();
|
||||
clipMap->numCLeafBrushNodes = reader.read<int>();
|
||||
clipMap->numBrushSides = reader.read<int>();
|
||||
clipMap->numBrushEdges = reader.read<int>();
|
||||
clipMap->numNodes = reader.read<int>();
|
||||
clipMap->numLeafs = reader.read<int>();
|
||||
clipMap->leafbrushNodesCount = reader.read<int>();
|
||||
clipMap->numLeafBrushes = reader.read<int>();
|
||||
clipMap->numLeafSurfaces = reader.read<int>();
|
||||
clipMap->numVerts = reader.read<int>();
|
||||
clipMap->numTriIndices = reader.read<int>();
|
||||
clipMap->numCollisionBorders = reader.read<int>();
|
||||
clipMap->numCollisionPartitions = reader.read<int>();
|
||||
clipMap->numCollisionAABBTrees = reader.read<int>();
|
||||
clipMap->numCModels = reader.read<int>();
|
||||
clipMap->numCBrushes = reader.read<short>();
|
||||
clipMap->vertCount = reader.read<int>();
|
||||
clipMap->triCount = reader.read<int>();
|
||||
clipMap->borderCount = reader.read<int>();
|
||||
clipMap->partitionCount = reader.read<int>();
|
||||
clipMap->aabbTreeCount = reader.read<int>();
|
||||
clipMap->numSubModels = reader.read<int>();
|
||||
clipMap->numBrushes = reader.read<short>();
|
||||
clipMap->dynEntCount[0] = reader.read<unsigned __int16>();
|
||||
clipMap->dynEntCount[1] = reader.read<unsigned __int16>();
|
||||
|
||||
if (clipMap->numCPlanes)
|
||||
if (clipMap->planeCount)
|
||||
{
|
||||
void* oldPtr = reader.read<void*>();
|
||||
clipMap->cPlanes = reader.readArray<Game::cplane_t>(clipMap->numCPlanes);
|
||||
clipMap->planes = reader.readArray<Game::cplane_s>(clipMap->planeCount);
|
||||
|
||||
if (builder->getAllocator()->isPointerMapped(oldPtr))
|
||||
{
|
||||
clipMap->cPlanes = builder->getAllocator()->getPointer<Game::cplane_t>(oldPtr);
|
||||
clipMap->planes = builder->getAllocator()->getPointer<Game::cplane_s>(oldPtr);
|
||||
Components::Logger::Print("ClipMap dpvs planes already mapped. This shouldn't happen. Make sure to load the ClipMap before the GfxWorld!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder->getAllocator()->mapPointer(oldPtr, clipMap->cPlanes);
|
||||
builder->getAllocator()->mapPointer(oldPtr, clipMap->planes);
|
||||
}
|
||||
}
|
||||
|
||||
if (clipMap->numStaticModels)
|
||||
{
|
||||
clipMap->staticModelList = builder->getAllocator()->allocateArray<Game::cStaticModel_t>(clipMap->numStaticModels);
|
||||
for (int i = 0; i < clipMap->numStaticModels; ++i)
|
||||
clipMap->staticModelList = builder->getAllocator()->allocateArray<Game::cStaticModel_s>(clipMap->numStaticModels);
|
||||
for (unsigned int i = 0; i < clipMap->numStaticModels; ++i)
|
||||
{
|
||||
std::string modelName = reader.readString();
|
||||
if (modelName != "NONE"s)
|
||||
@ -665,179 +665,179 @@ namespace Assets
|
||||
if (clipMap->numMaterials)
|
||||
{
|
||||
clipMap->materials = builder->getAllocator()->allocateArray<Game::ClipMaterial>(clipMap->numMaterials);
|
||||
for (int j = 0; j < clipMap->numMaterials; ++j)
|
||||
for (unsigned int j = 0; j < clipMap->numMaterials; ++j)
|
||||
{
|
||||
clipMap->materials[j].name = reader.readArray<char>(64);
|
||||
clipMap->materials[j].unk = reader.read<int>();
|
||||
clipMap->materials[j].unk2 = reader.read<int>();
|
||||
clipMap->materials[j].surfaceFlags = reader.read<int>();
|
||||
clipMap->materials[j].contents = reader.read<int>();
|
||||
}
|
||||
}
|
||||
|
||||
if (clipMap->numCBrushSides)
|
||||
if (clipMap->numBrushSides)
|
||||
{
|
||||
clipMap->cBrushSides = builder->getAllocator()->allocateArray<Game::cbrushside_t>(clipMap->numCBrushSides);
|
||||
for (int i = 0; i < clipMap->numCBrushSides; ++i)
|
||||
clipMap->brushsides = builder->getAllocator()->allocateArray<Game::cbrushside_t>(clipMap->numBrushSides);
|
||||
for (unsigned int i = 0; i < clipMap->numBrushSides; ++i)
|
||||
{
|
||||
int planeIndex = reader.read<int>();
|
||||
if (planeIndex < 0 || planeIndex >= clipMap->numCPlanes)
|
||||
if (planeIndex < 0 || planeIndex >= clipMap->planeCount)
|
||||
{
|
||||
Components::Logger::Error("invalid plane index");
|
||||
return;
|
||||
}
|
||||
clipMap->cBrushSides[i].plane = &clipMap->cPlanes[planeIndex];
|
||||
clipMap->cBrushSides[i].materialNum = static_cast<unsigned short>(reader.read<int>()); // materialNum
|
||||
clipMap->cBrushSides[i].firstAdjacentSideOffset = static_cast<char>(reader.read<short>()); // firstAdjacentSide
|
||||
clipMap->cBrushSides[i].edgeCount = reader.read<char>(); // edgeCount
|
||||
clipMap->brushsides[i].plane = &clipMap->planes[planeIndex];
|
||||
clipMap->brushsides[i].materialNum = static_cast<unsigned short>(reader.read<int>()); // materialNum
|
||||
clipMap->brushsides[i].firstAdjacentSideOffset = static_cast<char>(reader.read<short>()); // firstAdjacentSide
|
||||
clipMap->brushsides[i].edgeCount = reader.read<char>(); // edgeCount
|
||||
}
|
||||
}
|
||||
|
||||
if (clipMap->numCBrushEdges)
|
||||
if (clipMap->numBrushEdges)
|
||||
{
|
||||
clipMap->cBrushEdges = reader.readArray<char>(clipMap->numCBrushEdges);
|
||||
clipMap->brushEdges = reader.readArray<char>(clipMap->numBrushEdges);
|
||||
}
|
||||
|
||||
if (clipMap->numCNodes)
|
||||
if (clipMap->numNodes)
|
||||
{
|
||||
clipMap->cNodes = builder->getAllocator()->allocateArray<Game::cNode_t>(clipMap->numCNodes);
|
||||
for (int i = 0; i < clipMap->numCNodes; ++i)
|
||||
clipMap->nodes = builder->getAllocator()->allocateArray<Game::cNode_t>(clipMap->numNodes);
|
||||
for (unsigned int i = 0; i < clipMap->numNodes; ++i)
|
||||
{
|
||||
int planeIndex = reader.read<int>();
|
||||
if (planeIndex < 0 || planeIndex >= clipMap->numCPlanes)
|
||||
if (planeIndex < 0 || planeIndex >= clipMap->planeCount)
|
||||
{
|
||||
Components::Logger::Error("invalid plane index\n");
|
||||
return;
|
||||
}
|
||||
clipMap->cNodes[i].plane = &clipMap->cPlanes[planeIndex];
|
||||
clipMap->cNodes[i].children[0] = reader.read<short>();
|
||||
clipMap->cNodes[i].children[1] = reader.read<short>();
|
||||
clipMap->nodes[i].plane = &clipMap->planes[planeIndex];
|
||||
clipMap->nodes[i].children[0] = reader.read<short>();
|
||||
clipMap->nodes[i].children[1] = reader.read<short>();
|
||||
}
|
||||
}
|
||||
|
||||
if (clipMap->numCLeaf)
|
||||
if (clipMap->numLeafs)
|
||||
{
|
||||
clipMap->cLeaf = reader.readArray<Game::cLeaf_t>(clipMap->numCLeaf);
|
||||
clipMap->leafs = reader.readArray<Game::cLeaf_t>(clipMap->numLeafs);
|
||||
}
|
||||
|
||||
if (clipMap->numCLeafBrushNodes)
|
||||
if (clipMap->leafbrushNodesCount)
|
||||
{
|
||||
clipMap->cLeafBrushNodes = builder->getAllocator()->allocateArray<Game::cLeafBrushNode_t>(clipMap->numCLeafBrushNodes);
|
||||
for (int i = 0; i < clipMap->numCLeafBrushNodes; ++i)
|
||||
clipMap->leafbrushNodes = builder->getAllocator()->allocateArray<Game::cLeafBrushNode_s>(clipMap->leafbrushNodesCount);
|
||||
for (unsigned int i = 0; i < clipMap->leafbrushNodesCount; ++i)
|
||||
{
|
||||
clipMap->cLeafBrushNodes[i] = reader.read<Game::cLeafBrushNode_t>();
|
||||
clipMap->leafbrushNodes[i] = reader.read<Game::cLeafBrushNode_s>();
|
||||
|
||||
if (clipMap->cLeafBrushNodes[i].leafBrushCount > 0)
|
||||
if (clipMap->leafbrushNodes[i].leafBrushCount > 0)
|
||||
{
|
||||
clipMap->cLeafBrushNodes[i].data.leaf.brushes = reader.readArray<unsigned short>(clipMap->cLeafBrushNodes[i].leafBrushCount);
|
||||
clipMap->leafbrushNodes[i].data.leaf.brushes = reader.readArray<unsigned short>(clipMap->leafbrushNodes[i].leafBrushCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clipMap->numLeafBrushes)
|
||||
{
|
||||
clipMap->leafBrushes = reader.readArray<short>(clipMap->numLeafBrushes);
|
||||
clipMap->leafbrushes = reader.readArray<unsigned short>(clipMap->numLeafBrushes);
|
||||
}
|
||||
|
||||
if (clipMap->numLeafSurfaces)
|
||||
{
|
||||
clipMap->leafSurfaces = reader.readArray<int>(clipMap->numLeafSurfaces);
|
||||
clipMap->leafsurfaces = reader.readArray<unsigned int>(clipMap->numLeafSurfaces);
|
||||
}
|
||||
|
||||
if (clipMap->numVerts)
|
||||
if (clipMap->vertCount)
|
||||
{
|
||||
clipMap->verts = reader.readArray<Game::vec3_t>(clipMap->numVerts);
|
||||
clipMap->verts = reader.readArray<Game::vec3_t>(clipMap->vertCount);
|
||||
}
|
||||
|
||||
if (clipMap->numTriIndices)
|
||||
if (clipMap->triCount)
|
||||
{
|
||||
clipMap->triIndices = reader.readArray<short>(clipMap->numTriIndices * 3);
|
||||
clipMap->triEdgeIsWalkable = reader.readArray<bool>(4 * ((3 * clipMap->numTriIndices + 31) >> 5));
|
||||
clipMap->triIndices = reader.readArray<unsigned short>(clipMap->triCount * 3);
|
||||
clipMap->triEdgeIsWalkable = reader.readArray<char>(4 * ((3 * clipMap->triCount + 31) >> 5));
|
||||
}
|
||||
|
||||
if (clipMap->numCollisionBorders)
|
||||
if (clipMap->borderCount)
|
||||
{
|
||||
clipMap->collisionBorders = reader.readArray<Game::CollisionBorder>(clipMap->numCollisionBorders);
|
||||
clipMap->borders = reader.readArray<Game::CollisionBorder>(clipMap->borderCount);
|
||||
}
|
||||
|
||||
if (clipMap->numCollisionPartitions)
|
||||
if (clipMap->partitionCount)
|
||||
{
|
||||
clipMap->collisionPartitions = builder->getAllocator()->allocateArray<Game::CollisionPartition>(clipMap->numCollisionPartitions);
|
||||
for (int i = 0; i < clipMap->numCollisionPartitions; ++i)
|
||||
clipMap->partitions = builder->getAllocator()->allocateArray<Game::CollisionPartition>(clipMap->partitionCount);
|
||||
for (int i = 0; i < clipMap->partitionCount; ++i)
|
||||
{
|
||||
clipMap->collisionPartitions[i].triCount = reader.read<char>();
|
||||
clipMap->collisionPartitions[i].borderCount = reader.read<char>();
|
||||
clipMap->collisionPartitions[i].firstTri = reader.read<int>();
|
||||
clipMap->partitions[i].triCount = reader.read<char>();
|
||||
clipMap->partitions[i].borderCount = reader.read<char>();
|
||||
clipMap->partitions[i].firstTri = reader.read<int>();
|
||||
|
||||
if (clipMap->collisionPartitions[i].borderCount > 0)
|
||||
if (clipMap->partitions[i].borderCount > 0)
|
||||
{
|
||||
int index = reader.read<int>();
|
||||
if (index < 0 || index > clipMap->numCollisionBorders)
|
||||
if (index < 0 || index > clipMap->partitionCount)
|
||||
{
|
||||
Components::Logger::Error("invalid border index\n");
|
||||
return;
|
||||
}
|
||||
clipMap->collisionPartitions[i].borders = &clipMap->collisionBorders[index];
|
||||
clipMap->partitions[i].borders = &clipMap->borders[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clipMap->numCollisionAABBTrees)
|
||||
if (clipMap->aabbTreeCount)
|
||||
{
|
||||
clipMap->collisionAABBTrees = reader.readArray<Game::CollisionAabbTree>(clipMap->numCollisionAABBTrees);
|
||||
clipMap->aabbTrees = reader.readArray<Game::CollisionAabbTree>(clipMap->aabbTreeCount);
|
||||
}
|
||||
|
||||
if (clipMap->numCModels)
|
||||
if (clipMap->numSubModels)
|
||||
{
|
||||
clipMap->cModels = reader.readArray<Game::cmodel_t>(clipMap->numCModels);
|
||||
clipMap->cmodels = reader.readArray<Game::cmodel_t>(clipMap->numSubModels);
|
||||
}
|
||||
|
||||
if (clipMap->numCBrushes)
|
||||
if (clipMap->numBrushes)
|
||||
{
|
||||
clipMap->cBrushes = builder->getAllocator()->allocateArray<Game::cbrush_t>(clipMap->numCBrushes);
|
||||
memset(clipMap->cBrushes, 0, sizeof(Game::cbrush_t) * clipMap->numCBrushes);
|
||||
for (int i = 0; i < clipMap->numCBrushes; ++i)
|
||||
clipMap->brushes = builder->getAllocator()->allocateArray<Game::cbrush_t>(clipMap->numBrushes);
|
||||
memset(clipMap->brushes, 0, sizeof(Game::cbrush_t) * clipMap->numBrushes);
|
||||
for (int i = 0; i < clipMap->numBrushes; ++i)
|
||||
{
|
||||
clipMap->cBrushes[i].numsides = reader.read<unsigned int>() & 0xFFFF; // todo: check for overflow here
|
||||
if (clipMap->cBrushes[i].numsides > 0)
|
||||
clipMap->brushes[i].numsides = reader.read<unsigned int>() & 0xFFFF; // todo: check for overflow here
|
||||
if (clipMap->brushes[i].numsides > 0)
|
||||
{
|
||||
int index = reader.read<int>();
|
||||
if (index < 0 || index > clipMap->numCBrushSides)
|
||||
unsigned int index = reader.read<unsigned int>();
|
||||
if (index < 0 || index > clipMap->numBrushSides)
|
||||
{
|
||||
Components::Logger::Error("invalid side index\n");
|
||||
return;
|
||||
}
|
||||
clipMap->cBrushes[i].sides = &clipMap->cBrushSides[index];
|
||||
clipMap->brushes[i].sides = &clipMap->brushsides[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
clipMap->cBrushes[i].sides = nullptr;
|
||||
clipMap->brushes[i].sides = nullptr;
|
||||
}
|
||||
|
||||
int index = reader.read<int>();
|
||||
if (index > clipMap->numCBrushEdges)
|
||||
unsigned int index = reader.read<unsigned int>();
|
||||
if (index > clipMap->numBrushEdges)
|
||||
{
|
||||
Components::Logger::Error("invalid edge index\n");
|
||||
return;
|
||||
}
|
||||
clipMap->cBrushes[i].baseAdjacentSide = &clipMap->cBrushEdges[index];
|
||||
clipMap->brushes[i].baseAdjacentSide = &clipMap->brushEdges[index];
|
||||
|
||||
char* tmp = reader.readArray<char>(12);
|
||||
memcpy(&clipMap->cBrushes[i].axialMaterialNum, tmp, 12);
|
||||
memcpy(&clipMap->brushes[i].axialMaterialNum, tmp, 12);
|
||||
|
||||
//todo check for overflow
|
||||
for (int r = 0; r < 2; ++r)
|
||||
{
|
||||
for (int c = 0; c < 3; ++c)
|
||||
{
|
||||
clipMap->cBrushes[i].firstAdjacentSideOffsets[r][c] = reader.read<short>() & 0xFF;
|
||||
clipMap->brushes[i].firstAdjacentSideOffsets[r][c] = reader.read<short>() & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
tmp = reader.readArray<char>(6);
|
||||
memcpy(&clipMap->cBrushes[i].edgeCount, tmp, 6);
|
||||
memcpy(&clipMap->brushes[i].edgeCount, tmp, 6);
|
||||
}
|
||||
|
||||
clipMap->cBrushBounds = reader.readArray<Game::Bounds>(clipMap->numCBrushes);
|
||||
clipMap->cBrushContents = reader.readArray<int>(clipMap->numCBrushes);
|
||||
clipMap->brushBounds = reader.readArray<Game::Bounds>(clipMap->numBrushes);
|
||||
clipMap->brushContents = reader.readArray<int>(clipMap->numBrushes);
|
||||
}
|
||||
|
||||
for (int x = 0; x < 2; ++x)
|
||||
|
@ -19,7 +19,7 @@ namespace Assets
|
||||
{
|
||||
}
|
||||
|
||||
SModelQuadtree(Game::cStaticModel_t* modelList, int numModels)
|
||||
SModelQuadtree(Game::cStaticModel_s* modelList, int numModels)
|
||||
{
|
||||
numValues = 0;
|
||||
|
||||
@ -29,7 +29,7 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
void insert(Game::cStaticModel_t* item)
|
||||
void insert(Game::cStaticModel_s* item)
|
||||
{
|
||||
if (numValues < 4) // add here
|
||||
{
|
||||
@ -84,7 +84,7 @@ namespace Assets
|
||||
|
||||
private:
|
||||
SModelQuadtree* children[4];
|
||||
Game::cStaticModel_t* values[4];
|
||||
Game::cStaticModel_s* values[4];
|
||||
int numValues;
|
||||
float x, y, z;
|
||||
float halfX, halfY, halfZ;
|
||||
|
@ -331,7 +331,7 @@ namespace Assets
|
||||
Utils::Stream::ClearPointer(&dest->__indice); \
|
||||
}
|
||||
|
||||
void ImenuDef_t::save_itemDefData_t(Game::itemDefData_t* asset, int type, Game::itemDef_t* dest, Components::ZoneBuilder::Zone* builder)
|
||||
void ImenuDef_t::save_itemDefData_t(Game::itemDefData_t* asset, int type, Game::itemDef_s* dest, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
AssertSize(Game::newsTickerDef_s, 28);
|
||||
AssertSize(Game::listBoxDef_s, 324);
|
||||
@ -347,10 +347,10 @@ namespace Assets
|
||||
Game::listBoxDef_s* destlb = buffer->dest<Game::listBoxDef_s>();
|
||||
buffer->save(asset->listBox);
|
||||
|
||||
if (asset->listBox->doubleClick)
|
||||
if (asset->listBox->onDoubleClick)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
this->save_MenuEventHandlerSet(asset->listBox->doubleClick, builder);
|
||||
this->save_MenuEventHandlerSet(asset->listBox->onDoubleClick, builder);
|
||||
}
|
||||
|
||||
if (asset->listBox->selectIcon)
|
||||
@ -390,22 +390,22 @@ namespace Assets
|
||||
case 12:
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
Game::multiDef_s* destdef = buffer->dest<Game::multiDef_s>();
|
||||
buffer->save(asset->multiDef);
|
||||
buffer->save(asset->multi);
|
||||
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
if (asset->multiDef->dvarList[i])
|
||||
if (asset->multi->dvarList[i])
|
||||
{
|
||||
buffer->saveString(asset->multiDef->dvarList[i]);
|
||||
buffer->saveString(asset->multi->dvarList[i]);
|
||||
Utils::Stream::ClearPointer(&destdef->dvarList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
if (asset->multiDef->dvarStr[i])
|
||||
if (asset->multi->dvarStr[i])
|
||||
{
|
||||
buffer->saveString(asset->multiDef->dvarStr[i]);
|
||||
buffer->saveString(asset->multi->dvarStr[i]);
|
||||
Utils::Stream::ClearPointer(&destdef->dvarStr[i]);
|
||||
}
|
||||
}
|
||||
@ -423,17 +423,17 @@ namespace Assets
|
||||
Utils::Stream::ClearPointer(&dest->typeData.data);
|
||||
}
|
||||
|
||||
void ImenuDef_t::save_itemDef_t(Game::itemDef_t *asset, Components::ZoneBuilder::Zone* builder)
|
||||
void ImenuDef_t::save_itemDef_s(Game::itemDef_s *asset, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
AssertSize(Game::itemDef_t, 380);
|
||||
AssertSize(Game::itemDef_s, 380);
|
||||
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
Game::itemDef_t* dest = buffer->dest<Game::itemDef_t>();
|
||||
Game::itemDef_s* dest = buffer->dest<Game::itemDef_s>();
|
||||
|
||||
buffer->save(asset);
|
||||
|
||||
// window data
|
||||
save_windowDef_t<Game::itemDef_t>(&asset->window, dest, builder);
|
||||
save_windowDef_t<Game::itemDef_s>(&asset->window, dest, builder);
|
||||
|
||||
// text
|
||||
if (asset->text)
|
||||
@ -553,9 +553,9 @@ namespace Assets
|
||||
|
||||
// MenuEventHandlerSets
|
||||
EVENTHANDLERSET(onOpen);
|
||||
EVENTHANDLERSET(onRequestClose);
|
||||
EVENTHANDLERSET(onCloseRequest);
|
||||
EVENTHANDLERSET(onClose);
|
||||
EVENTHANDLERSET(onEsc);
|
||||
EVENTHANDLERSET(onESC);
|
||||
|
||||
// ItemKeyHandler
|
||||
if (asset->onKey)
|
||||
@ -574,10 +574,10 @@ namespace Assets
|
||||
buffer->saveString(asset->allowedBinding);
|
||||
Utils::Stream::ClearPointer(&dest->allowedBinding);
|
||||
}
|
||||
if (asset->soundLoop)
|
||||
if (asset->soundName)
|
||||
{
|
||||
buffer->saveString(asset->soundLoop);
|
||||
Utils::Stream::ClearPointer(&dest->soundLoop);
|
||||
buffer->saveString(asset->soundName);
|
||||
Utils::Stream::ClearPointer(&dest->soundName);
|
||||
}
|
||||
|
||||
// Statements
|
||||
@ -599,7 +599,7 @@ namespace Assets
|
||||
if (asset->items[i])
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
this->save_itemDef_t(asset->items[i], builder);
|
||||
this->save_itemDef_s(asset->items[i], builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace Assets
|
||||
void save_Statement_s(Game::Statement_s* asset, Components::ZoneBuilder::Zone* builder);
|
||||
void save_MenuEventHandlerSet(Game::MenuEventHandlerSet* asset, Components::ZoneBuilder::Zone* builder);
|
||||
void save_ItemKeyHandler(Game::ItemKeyHandler* asset, Components::ZoneBuilder::Zone* builder);
|
||||
void save_itemDefData_t(Game::itemDefData_t* asset, int type, Game::itemDef_t* dest, Components::ZoneBuilder::Zone* builder);
|
||||
void save_itemDef_t(Game::itemDef_t *asset, Components::ZoneBuilder::Zone* builder);
|
||||
void save_itemDefData_t(Game::itemDefData_t* asset, int type, Game::itemDef_s* dest, Components::ZoneBuilder::Zone* builder);
|
||||
void save_itemDef_s(Game::itemDef_s *asset, Components::ZoneBuilder::Zone* builder);
|
||||
};
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ namespace Assets
|
||||
alias->distMin = float(distMin.number_value());
|
||||
alias->distMax = float(distMax.number_value());
|
||||
alias->flags = flags.int_value();
|
||||
alias->slavePercentage = float(slavePercentage.number_value());
|
||||
alias->___u15.slavePercentage = float(slavePercentage.number_value());
|
||||
alias->probability = float(probability.number_value());
|
||||
alias->lfePercentage = float(lfePercentage.number_value());
|
||||
alias->centerPercentage = float(centerPercentage.number_value());
|
||||
@ -126,15 +126,15 @@ namespace Assets
|
||||
if (type.string_value() == "loaded"s)
|
||||
{
|
||||
alias->soundFile->type = Game::SAT_LOADED;
|
||||
alias->soundFile->data.loaded = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, soundFile.string_value(), builder).loadSnd;
|
||||
alias->soundFile->u.loadSnd = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, soundFile.string_value(), builder).loadSnd;
|
||||
}
|
||||
else if (type.string_value() == "streamed"s)
|
||||
{
|
||||
alias->soundFile->type = Game::SAT_STREAMED;
|
||||
std::string streamedFile = soundFile.string_value();
|
||||
int split = streamedFile.find_last_of('/');
|
||||
alias->soundFile->data.stream.dir = builder->getAllocator()->duplicateString(streamedFile.substr(0, split).c_str());
|
||||
alias->soundFile->data.stream.name = builder->getAllocator()->duplicateString(streamedFile.substr(split).c_str());
|
||||
alias->soundFile->u.streamSnd.filename.info.raw.dir = builder->getAllocator()->duplicateString(streamedFile.substr(0, split).c_str());
|
||||
alias->soundFile->u.streamSnd.filename.info.raw.name = builder->getAllocator()->duplicateString(streamedFile.substr(split).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -161,7 +161,7 @@ namespace Assets
|
||||
|
||||
if (alias->soundFile && alias->soundFile->type == Game::snd_alias_type_t::SAT_LOADED)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, alias->soundFile->data.loaded);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, alias->soundFile->u.loadSnd);
|
||||
}
|
||||
|
||||
if (alias->volumeFalloffCurve)
|
||||
@ -182,10 +182,10 @@ namespace Assets
|
||||
|
||||
buffer->pushBlock(Game::XFILE_BLOCK_VIRTUAL);
|
||||
|
||||
if (asset->name)
|
||||
if (asset->aliasName)
|
||||
{
|
||||
buffer->saveString(builder->getAssetName(this->getType(), asset->name));
|
||||
Utils::Stream::ClearPointer(&dest->name);
|
||||
buffer->saveString(builder->getAssetName(this->getType(), asset->aliasName));
|
||||
Utils::Stream::ClearPointer(&dest->aliasName);
|
||||
}
|
||||
|
||||
if (asset->head)
|
||||
@ -209,10 +209,10 @@ namespace Assets
|
||||
Game::snd_alias_t* destAlias = &destHead[i];
|
||||
Game::snd_alias_t* alias = &asset->head[i];
|
||||
|
||||
if (alias->name)
|
||||
if (alias->aliasName)
|
||||
{
|
||||
buffer->saveString(alias->name);
|
||||
Utils::Stream::ClearPointer(&destAlias->name);
|
||||
buffer->saveString(alias->aliasName);
|
||||
Utils::Stream::ClearPointer(&destAlias->aliasName);
|
||||
}
|
||||
|
||||
if (alias->subtitle)
|
||||
@ -233,10 +233,10 @@ namespace Assets
|
||||
Utils::Stream::ClearPointer(&destAlias->chainAliasName);
|
||||
}
|
||||
|
||||
if (alias->string4)
|
||||
if (alias->mixerGroup)
|
||||
{
|
||||
buffer->saveString(alias->string4);
|
||||
Utils::Stream::ClearPointer(&destAlias->string4);
|
||||
buffer->saveString(alias->mixerGroup);
|
||||
Utils::Stream::ClearPointer(&destAlias->mixerGroup);
|
||||
}
|
||||
|
||||
if (alias->soundFile)
|
||||
@ -259,22 +259,22 @@ namespace Assets
|
||||
{
|
||||
if (alias->soundFile->type == Game::snd_alias_type_t::SAT_LOADED)
|
||||
{
|
||||
destSoundFile->data.loaded = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, alias->soundFile->data.loaded).loadSnd;
|
||||
destSoundFile->u.loadSnd = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, alias->soundFile->u.loadSnd).loadSnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save_StreamedSound
|
||||
{
|
||||
if (alias->soundFile->data.stream.dir)
|
||||
if (alias->soundFile->u.streamSnd.filename.info.raw.dir)
|
||||
{
|
||||
buffer->saveString(alias->soundFile->data.stream.dir);
|
||||
Utils::Stream::ClearPointer(&destSoundFile->data.stream.dir);
|
||||
buffer->saveString(alias->soundFile->u.streamSnd.filename.info.raw.dir);
|
||||
Utils::Stream::ClearPointer(&destSoundFile->u.streamSnd.filename.info.raw.dir);
|
||||
}
|
||||
|
||||
if (alias->soundFile->data.stream.name)
|
||||
if (alias->soundFile->u.streamSnd.filename.info.raw.name)
|
||||
{
|
||||
buffer->saveString(alias->soundFile->data.stream.name);
|
||||
Utils::Stream::ClearPointer(&destSoundFile->data.stream.name);
|
||||
buffer->saveString(alias->soundFile->u.streamSnd.filename.info.raw.name);
|
||||
Utils::Stream::ClearPointer(&destSoundFile->u.streamSnd.filename.info.raw.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ namespace Components
|
||||
// Display DEBUG branding, so we know we're on a debug build
|
||||
Scheduler::OnFrame([]()
|
||||
{
|
||||
Game::Font* font = Game::R_RegisterFont("fonts/normalFont", 0);
|
||||
Game::Font_s* font = Game::R_RegisterFont("fonts/normalFont", 0);
|
||||
float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
|
||||
// Change the color when attaching a debugger
|
||||
|
@ -561,7 +561,7 @@ namespace Components
|
||||
{
|
||||
if (FastFiles::Current().empty() || !Dvar::Var("ui_zoneDebug").get<bool>()) return;
|
||||
|
||||
Game::Font* font = Game::R_RegisterFont("fonts/consoleFont", 0);
|
||||
Game::Font_s* font = Game::R_RegisterFont("fonts/consoleFont", 0);
|
||||
float color[4] = { 1.0f, 1.0f, 1.0f, (Game::CL_IsCgameInitialized() ? 0.3f : 1.0f) };
|
||||
|
||||
std::uint32_t FFTotalSize = *reinterpret_cast<std::uint32_t*>(0x10AA5D8);
|
||||
|
@ -65,16 +65,16 @@ namespace Components
|
||||
if (!this->exists()) return std::string();
|
||||
|
||||
int position = Game::FS_FTell(this->handle);
|
||||
this->seek(0, FS_SEEK_SET);
|
||||
this->seek(0, Game::FS_SEEK_SET);
|
||||
|
||||
char* buffer = allocator.allocateArray<char>(this->size);
|
||||
if (!this->read(buffer, this->size))
|
||||
{
|
||||
this->seek(position, FS_SEEK_SET);
|
||||
this->seek(position, Game::FS_SEEK_SET);
|
||||
return std::string();
|
||||
}
|
||||
|
||||
this->seek(position, FS_SEEK_SET);
|
||||
this->seek(position, Game::FS_SEEK_SET);
|
||||
|
||||
return std::string(buffer, this->size);
|
||||
}
|
||||
|
@ -407,9 +407,9 @@ namespace Components
|
||||
buffer[3] = size; // Height
|
||||
|
||||
// Icon name length
|
||||
buffer[4] = static_cast<char>(strlen(rankIcon->name));
|
||||
buffer[4] = static_cast<char>(strlen(rankIcon->info.name));
|
||||
|
||||
strcat_s(buffer, rankIcon->name);
|
||||
strcat_s(buffer, rankIcon->info.name);
|
||||
strcat_s(buffer, Utils::String::VA(" %i", (rank + 1)));
|
||||
|
||||
return buffer;
|
||||
@ -542,7 +542,7 @@ namespace Components
|
||||
Game::GfxImage* image = Materials::CreateImage(Utils::String::VA("texture_%llX", user.bits), width, height, 1, 0x1000003, D3DFMT_A8R8G8B8);
|
||||
|
||||
D3DLOCKED_RECT lockedRect;
|
||||
image->map->LockRect(0, &lockedRect, nullptr, 0);
|
||||
image->texture.map->LockRect(0, &lockedRect, nullptr, 0);
|
||||
|
||||
unsigned char* buffer = static_cast<unsigned char*>(lockedRect.pBits);
|
||||
Steam::Proxy::SteamUtils->GetImageRGBA(index, buffer, width * height * 4);
|
||||
@ -559,7 +559,7 @@ namespace Components
|
||||
buffer[((height - 1) * width * 4) + 3] = 0; // bottom-left
|
||||
buffer[((height - 1) * width * 4) + (width - 1) * 4 + 3] = 0; // bottom-right
|
||||
|
||||
image->map->UnlockRect(0);
|
||||
image->texture.map->UnlockRect(0);
|
||||
|
||||
return Materials::Create(Utils::String::VA("avatar_%llX", user.bits), image);
|
||||
}
|
||||
|
@ -273,11 +273,11 @@ namespace Components
|
||||
|
||||
if (!Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || Maps::SPMap)
|
||||
{
|
||||
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP].gameWorldSp[0].data;
|
||||
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP].gameWorldSp[0].g_glassData;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP].gameWorldMp[0].data;
|
||||
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP].gameWorldMp[0].g_glassData;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1028,7 +1028,7 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
Game::Font* font = Game::R_RegisterFont("fonts/smallFont", 0);
|
||||
Game::Font_s* font = Game::R_RegisterFont("fonts/smallFont", 0);
|
||||
int height = Game::R_TextHeight(font);
|
||||
float scale = 0.75;
|
||||
float color[4] = { 0, 1.0f, 0, 1.0f };
|
||||
|
@ -16,10 +16,10 @@ namespace Components
|
||||
material->textureCount = 1;
|
||||
material->textureTable = texture;
|
||||
|
||||
material->name = Utils::Memory::GetAllocator()->duplicateString(name);
|
||||
material->sortKey = 0x22;
|
||||
material->textureAtlasColumnCount = 1;
|
||||
material->textureAtlasRowCount = 1;
|
||||
material->info.name = Utils::Memory::GetAllocator()->duplicateString(name);
|
||||
material->info.sortKey = 0x22;
|
||||
material->info.textureAtlasColumnCount = 1;
|
||||
material->info.textureAtlasRowCount = 1;
|
||||
|
||||
for (int i = 0; i < 48; ++i)
|
||||
{
|
||||
@ -33,13 +33,13 @@ namespace Components
|
||||
material->textureTable->nameHash = Game::R_HashString("colorMap");
|
||||
material->textureTable->nameStart = 'c';
|
||||
material->textureTable->nameEnd = 'p';
|
||||
material->textureTable->sampleState = -30;
|
||||
material->textureTable->info.image = image;
|
||||
material->textureTable->samplerState = -30;
|
||||
material->textureTable->u.image = image;
|
||||
|
||||
Game::Material* cursor = Game::DB_FindXAssetHeader(Game::ASSET_TYPE_MATERIAL, "ui_cursor").material;
|
||||
if (cursor)
|
||||
{
|
||||
material->stateBitTable = cursor->stateBitTable;
|
||||
material->stateBitsTable = cursor->stateBitsTable;
|
||||
material->stateBitsCount = cursor->stateBitsCount;
|
||||
}
|
||||
|
||||
@ -56,12 +56,12 @@ namespace Components
|
||||
{
|
||||
for (char i = 0; i < material->textureCount; ++i)
|
||||
{
|
||||
Materials::DeleteImage(material->textureTable[i].info.image);
|
||||
Materials::DeleteImage(material->textureTable[i].u.image);
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Memory::GetAllocator()->free(material->textureTable);
|
||||
Utils::Memory::GetAllocator()->free(material->name);
|
||||
Utils::Memory::GetAllocator()->free(material->info.name);
|
||||
Utils::Memory::GetAllocator()->free(material);
|
||||
|
||||
auto mat = std::find(Materials::MaterialTable.begin(), Materials::MaterialTable.end(), material);
|
||||
@ -126,7 +126,7 @@ namespace Components
|
||||
|
||||
for (char i = 0; i < material->textureCount; ++i)
|
||||
{
|
||||
if (!material->textureTable[i].info.image || !material->textureTable[i].info.image->map)
|
||||
if (!material->textureTable[i].u.image || !material->textureTable[i].u.image->texture.map)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -207,10 +207,10 @@ namespace Components
|
||||
material = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, "default").material;
|
||||
}
|
||||
|
||||
int length = strlen(material->name);
|
||||
int length = strlen(material->info.name);
|
||||
string[offset++] = static_cast<char>(length);
|
||||
|
||||
strncpy_s(string + offset, 1024 - offset, material->name, length);
|
||||
strncpy_s(string + offset, 1024 - offset, material->info.name, length);
|
||||
|
||||
return offset + length;
|
||||
}
|
||||
@ -322,7 +322,7 @@ namespace Components
|
||||
for (auto& image : Materials::ImageTable)
|
||||
{
|
||||
Game::Image_Release(image);
|
||||
image->map = nullptr;
|
||||
image->texture.map = nullptr;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace Components
|
||||
Game::menuDef_t* menu = allocator->allocate<Game::menuDef_t>();
|
||||
if (!menu) return nullptr;
|
||||
|
||||
menu->items = allocator->allocateArray<Game::itemDef_t*>(512);
|
||||
menu->items = allocator->allocateArray<Game::itemDef_s*>(512);
|
||||
if (!menu->items)
|
||||
{
|
||||
allocator->free(menu);
|
||||
@ -532,9 +532,9 @@ namespace Components
|
||||
// Replace every old instance with our new one in the ui context
|
||||
for (int j = 0; j < Game::uiContext->menuCount; ++j)
|
||||
{
|
||||
if (Game::uiContext->menus[j] == oldMenu)
|
||||
if (Game::uiContext->Menus[j] == oldMenu)
|
||||
{
|
||||
Game::uiContext->menus[j] = menu;
|
||||
Game::uiContext->Menus[j] = menu;
|
||||
}
|
||||
}
|
||||
|
||||
@ -670,7 +670,7 @@ namespace Components
|
||||
int i = 0;
|
||||
for (; i < dc->menuCount; ++i)
|
||||
{
|
||||
if (dc->menus[i] == menu)
|
||||
if (dc->Menus[i] == menu)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -681,11 +681,11 @@ namespace Components
|
||||
{
|
||||
for (; i < dc->menuCount - 1; ++i)
|
||||
{
|
||||
dc->menus[i] = dc->menus[i + 1];
|
||||
dc->Menus[i] = dc->Menus[i + 1];
|
||||
}
|
||||
|
||||
// Clear last menu
|
||||
dc->menus[--dc->menuCount] = nullptr;
|
||||
dc->Menus[--dc->menuCount] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@ namespace Components
|
||||
|
||||
void ModelSurfs::CreateBuffers(Game::XModelSurfs* surfs)
|
||||
{
|
||||
for (int i = 0; i < surfs->numSurfaces; ++i)
|
||||
for (int i = 0; i < surfs->numsurfs; ++i)
|
||||
{
|
||||
Game::XSurface* surface = &surfs->surfaces[i];
|
||||
Game::XSurface* surface = &surfs->surfs[i];
|
||||
if (surface->zoneHandle == -1)
|
||||
{
|
||||
IDirect3DVertexBuffer9* vertexBuffer = nullptr;
|
||||
@ -79,7 +79,7 @@ namespace Components
|
||||
// Load section data
|
||||
for (int i = 0; i < ARRAYSIZE(header.sectionHeader); ++i)
|
||||
{
|
||||
model.seek(header.sectionHeader[i].offset, FS_SEEK_SET);
|
||||
model.seek(header.sectionHeader[i].offset, Game::FS_SEEK_SET);
|
||||
if (!model.read(header.sectionHeader[i].buffer, header.sectionHeader[i].size))
|
||||
{
|
||||
Logger::Error("Reading section %d for model %s failed!", i, name.data());
|
||||
@ -106,8 +106,8 @@ namespace Components
|
||||
|
||||
AssertSize(Game::XSurface, 64);
|
||||
Game::XModelSurfs* modelSurfs = reinterpret_cast<Game::XModelSurfs*>(allocationData->mainArray);
|
||||
Game::XSurface* tempSurfaces = allocator.allocateArray<Game::XSurface>(modelSurfs->numSurfaces);
|
||||
char* surfaceData = reinterpret_cast<char*>(modelSurfs->surfaces);
|
||||
Game::XSurface* tempSurfaces = allocator.allocateArray<Game::XSurface>(modelSurfs->numsurfs);
|
||||
char* surfaceData = reinterpret_cast<char*>(modelSurfs->surfs);
|
||||
|
||||
if (ModelSurfs::AllocMap.find(modelSurfs->name) != ModelSurfs::AllocMap.end())
|
||||
{
|
||||
@ -125,7 +125,7 @@ namespace Components
|
||||
ModelSurfs::AllocMap[modelSurfs->name] = allocationData;
|
||||
*reinterpret_cast<void**>(reinterpret_cast<char*>(allocationData->mainArray) + 44) = allocationData;
|
||||
|
||||
for (int i = 0; i < modelSurfs->numSurfaces; ++i)
|
||||
for (int i = 0; i < modelSurfs->numsurfs; ++i)
|
||||
{
|
||||
char* source = &surfaceData[i * 84];
|
||||
|
||||
@ -136,7 +136,7 @@ namespace Components
|
||||
tempSurfaces[i].zoneHandle = -1; // Fake handle for buffer interception
|
||||
}
|
||||
|
||||
std::memcpy(surfaceData, tempSurfaces, 64 * modelSurfs->numSurfaces);
|
||||
std::memcpy(surfaceData, tempSurfaces, 64 * modelSurfs->numsurfs);
|
||||
|
||||
ModelSurfs::CreateBuffers(modelSurfs);
|
||||
|
||||
@ -154,19 +154,19 @@ namespace Components
|
||||
{
|
||||
Game::XModelSurfs* surfs = model->lodInfo[i].modelSurfs;
|
||||
|
||||
if (!surfs->surfaces)
|
||||
if (!surfs->surfs)
|
||||
{
|
||||
AssertOffset(Game::XModelLodInfo, partBits, 12);
|
||||
Game::XModelSurfs* newSurfs = ModelSurfs::LoadXModelSurfaces(surfs->name);
|
||||
if (!newSurfs) continue;
|
||||
|
||||
surfs->surfaces = newSurfs->surfaces;
|
||||
surfs->numSurfaces = newSurfs->numSurfaces;
|
||||
surfs->surfs = newSurfs->surfs;
|
||||
surfs->numsurfs = newSurfs->numsurfs;
|
||||
|
||||
model->lodInfo[i].surfs = newSurfs->surfaces;
|
||||
model->lodInfo[i].surfs = newSurfs->surfs;
|
||||
std::memcpy(&model->lodInfo[i].partBits, &newSurfs->partBits, 24);
|
||||
|
||||
short numSurfs = static_cast<short>(newSurfs->numSurfaces);
|
||||
short numSurfs = static_cast<short>(newSurfs->numsurfs);
|
||||
model->lodInfo[i].numsurfs = numSurfs;
|
||||
model->lodInfo[i].surfIndex = surfCount;
|
||||
surfCount += numSurfs;
|
||||
@ -181,9 +181,9 @@ namespace Components
|
||||
void ModelSurfs::ReleaseModelSurf(Game::XAssetHeader header)
|
||||
{
|
||||
bool hasCustomSurface = false;
|
||||
for (int i = 0; i < header.surfaces->numSurfaces && header.surfaces->surfaces; ++i)
|
||||
for (int i = 0; i < header.modelSurfs->numsurfs && header.modelSurfs->surfs; ++i)
|
||||
{
|
||||
Game::XSurface* surface = &header.surfaces->surfaces[i];
|
||||
Game::XSurface* surface = &header.modelSurfs->surfs[i];
|
||||
|
||||
if (surface->zoneHandle == -1)
|
||||
{
|
||||
@ -210,7 +210,7 @@ namespace Components
|
||||
|
||||
if (hasCustomSurface && !ModelSurfs::AllocMap.empty())
|
||||
{
|
||||
auto allocData = ModelSurfs::AllocMap.find(header.surfaces->name);
|
||||
auto allocData = ModelSurfs::AllocMap.find(header.modelSurfs->name);
|
||||
if (allocData != ModelSurfs::AllocMap.end())
|
||||
{
|
||||
Utils::Memory::FreeAlign(allocData->second->indexBuffer);
|
||||
@ -237,7 +237,7 @@ namespace Components
|
||||
{
|
||||
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_XMODEL_SURFS, [](Game::XAssetHeader header, void* /*userdata*/)
|
||||
{
|
||||
ModelSurfs::CreateBuffers(header.surfaces);
|
||||
ModelSurfs::CreateBuffers(header.modelSurfs);
|
||||
}, nullptr, false);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace Components
|
||||
{
|
||||
if (aliases->head->soundFile->type == Game::snd_alias_type_t::SAT_STREAMED)
|
||||
{
|
||||
aliases->head->soundFile->data.stream.name = MusicalTalent::SoundAliasList[Utils::String::ToLower(filename)];
|
||||
aliases->head->soundFile->u.streamSnd.filename.info.raw.name = MusicalTalent::SoundAliasList[Utils::String::ToLower(filename)];
|
||||
}
|
||||
|
||||
header.sound = aliases;
|
||||
|
@ -148,7 +148,7 @@ namespace Components
|
||||
|
||||
void Network::Send(Network::Address target, std::string data)
|
||||
{
|
||||
Network::Send(Game::netsrc_t::NS_CLIENT, target, data);
|
||||
Network::Send(Game::netsrc_t::NS_CLIENT1, target, data);
|
||||
}
|
||||
|
||||
void Network::SendRaw(Game::netsrc_t type, Network::Address target, std::string data)
|
||||
@ -162,7 +162,7 @@ namespace Components
|
||||
|
||||
void Network::SendRaw(Network::Address target, std::string data)
|
||||
{
|
||||
Network::SendRaw(Game::netsrc_t::NS_CLIENT, target, data);
|
||||
Network::SendRaw(Game::netsrc_t::NS_CLIENT1, target, data);
|
||||
}
|
||||
|
||||
void Network::SendCommand(Game::netsrc_t type, Network::Address target, std::string command, std::string data)
|
||||
@ -180,7 +180,7 @@ namespace Components
|
||||
|
||||
void Network::SendCommand(Network::Address target, std::string command, std::string data)
|
||||
{
|
||||
Network::SendCommand(Game::netsrc_t::NS_CLIENT, target, command, data);
|
||||
Network::SendCommand(Game::netsrc_t::NS_CLIENT1, target, command, data);
|
||||
}
|
||||
|
||||
void Network::Broadcast(unsigned short port, std::string data)
|
||||
@ -191,7 +191,7 @@ namespace Components
|
||||
target.setIP(INADDR_BROADCAST);
|
||||
target.setType(Game::netadrtype_t::NA_BROADCAST);
|
||||
|
||||
Network::Send(Game::netsrc_t::NS_CLIENT, target, data);
|
||||
Network::Send(Game::netsrc_t::NS_CLIENT1, target, data);
|
||||
}
|
||||
|
||||
void Network::BroadcastRange(unsigned int min, unsigned int max, std::string data)
|
||||
|
@ -100,45 +100,6 @@ namespace Components
|
||||
Game::CL_SelectStringTableEntryInDvar_f();
|
||||
}
|
||||
|
||||
void QuickPatch::CompareMaterialStateBits()
|
||||
{
|
||||
Game::DB_EnumXAssets(Game::XAssetType::ASSET_TYPE_MATERIAL, [](Game::XAssetHeader header, void* /*unused*/)
|
||||
{
|
||||
bool first = true;
|
||||
Game::Material* material = header.material;
|
||||
Logger::Print(6, "Checking material %s...", material->name);
|
||||
#define COMPARE_TECHNIQUES(x) if(!(material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x)] == material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x ## _DFOG)])) \
|
||||
{ \
|
||||
if(first) { Logger::Print("\nMismatch in material %s:\n", material->name); first = false; } \
|
||||
Logger::Print(6, #x " != " #x "_DFOG\n"); \
|
||||
Logger::Print("0x02%hhx %hhb\n", material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x)], material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x)]); \
|
||||
Logger::Print("0x02%hhx %hhb\n", material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x ## _DFOG)], material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x ## _DFOG)]); \
|
||||
}
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_EMISSIVE)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_EMISSIVE_SHADOW)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_SUN)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_SUN_SHADOW)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_SPOT)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_SPOT_SHADOW)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_OMNI)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_OMNI_SHADOW)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_SUN)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_SUN_SHADOW)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_SPOT)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_SPOT_SHADOW)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_OMNI)
|
||||
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_OMNI_SHADOW)
|
||||
#undef COMPARE_TECHNIQUES
|
||||
if(first)
|
||||
{
|
||||
Logger::Print(6, "no mismatches found\n");
|
||||
}
|
||||
|
||||
}, nullptr, false);
|
||||
}
|
||||
|
||||
QuickPatch::QuickPatch()
|
||||
{
|
||||
QuickPatch::FrameTime = 0;
|
||||
@ -427,11 +388,6 @@ namespace Components
|
||||
throw new std::exception();
|
||||
});
|
||||
|
||||
Command::Add("checkmaterials", [](Command::Params*)
|
||||
{
|
||||
QuickPatch::CompareMaterialStateBits();
|
||||
});
|
||||
|
||||
Command::Add("dumptechsets", [](Command::Params* param)
|
||||
{
|
||||
if (param->length() != 2)
|
||||
@ -614,7 +570,7 @@ namespace Components
|
||||
|
||||
for (unsigned int i = 0; i < asset.gfxWorld->dpvs.staticSurfaceCount; ++i)
|
||||
{
|
||||
buffer.append(Utils::String::VA("%s\n", asset.gfxWorld->dpvs.surfaces[asset.gfxWorld->dpvs.sortedSurfIndex[i]].material->name));
|
||||
buffer.append(Utils::String::VA("%s\n", asset.gfxWorld->dpvs.surfaces[asset.gfxWorld->dpvs.sortedSurfIndex[i]].material->info.name));
|
||||
}
|
||||
|
||||
Utils::IO::WriteFile("userraw/logs/matlog.txt", buffer);
|
||||
@ -673,7 +629,7 @@ namespace Components
|
||||
|
||||
Scheduler::OnFrame([]()
|
||||
{
|
||||
if (*reinterpret_cast<Game::Font**>(0x62E4BAC))
|
||||
if (*reinterpret_cast<Game::Font_s**>(0x62E4BAC))
|
||||
{
|
||||
Game::Con_DrawMiniConsole(0, 2, 4, (Game::CL_IsCgameInitialized() ? 1.0f : 0.4f));
|
||||
}
|
||||
|
@ -22,7 +22,5 @@ namespace Components
|
||||
|
||||
static int MsgReadBitsCompressCheckSV(const char *from, char *to, int size);
|
||||
static int MsgReadBitsCompressCheckCL(const char *from, char *to, int size);
|
||||
|
||||
static void CompareMaterialStateBits();
|
||||
};
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace Components
|
||||
|
||||
void ServerInfo::DrawScoreboardInfo(void* a1)
|
||||
{
|
||||
Game::Font* font = Game::R_RegisterFont("fonts/bigfont", 0);
|
||||
Game::Font_s* font = Game::R_RegisterFont("fonts/bigfont", 0);
|
||||
void* cxt = Game::UI_GetContext(a1);
|
||||
|
||||
std::string addressText = Network::Address(*Game::connectedHost).getString();
|
||||
|
@ -53,7 +53,7 @@ namespace Components
|
||||
}
|
||||
|
||||
// send statpacket
|
||||
Network::SendRaw(Game::NS_CLIENT, *reinterpret_cast<Game::netadr_t*>(0xA1E888), std::string(msg.data, msg.cursize));
|
||||
Network::SendRaw(Game::NS_CLIENT1, *reinterpret_cast<Game::netadr_t*>(0xA1E888), std::string(msg.data, msg.cursize));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
dataVector.push_back(dataEnum->entries[index].name);
|
||||
dataVector.push_back(dataEnum->entries[index].string);
|
||||
}
|
||||
|
||||
// Rebase or add new entries
|
||||
@ -67,16 +67,16 @@ namespace Components
|
||||
for (unsigned short i = 0; i < dataVector.size(); ++i)
|
||||
{
|
||||
indices[i].index = i;
|
||||
indices[i].name = dataVector[i];
|
||||
indices[i].string = dataVector[i];
|
||||
}
|
||||
|
||||
// Sort alphabetically
|
||||
qsort(indices, dataVector.size(), sizeof(Game::StructuredDataEnumEntry), [](const void* first, const void* second)
|
||||
qsort(indices, dataVector.size(), sizeof(Game::StructuredDataEnumEntry), [](void const* first, void const* second)
|
||||
{
|
||||
const Game::StructuredDataEnumEntry* entry1 = reinterpret_cast<const Game::StructuredDataEnumEntry*>(first);
|
||||
const Game::StructuredDataEnumEntry* entry2 = reinterpret_cast<const Game::StructuredDataEnumEntry*>(second);
|
||||
|
||||
return std::string(entry1->name).compare(entry2->name);
|
||||
return std::string(entry1->string).compare(entry2->string);
|
||||
});
|
||||
|
||||
// Apply our patches
|
||||
@ -177,7 +177,7 @@ namespace Components
|
||||
if (type != Game::XAssetType::ASSET_TYPE_STRUCTURED_DATA_DEF || filename != "mp/playerdata.def") return;
|
||||
|
||||
// Store asset
|
||||
Game::StructuredDataDefSet* data = asset.structuredData;
|
||||
Game::StructuredDataDefSet* data = asset.structuredDataDefSet;
|
||||
if (!data) return;
|
||||
|
||||
if (data->defCount != 1)
|
||||
|
@ -52,8 +52,8 @@ namespace Components
|
||||
float descSize = 0.9f;
|
||||
|
||||
Game::Material* white = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, "white").material; if (!white) return;
|
||||
Game::Font* font = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_FONT, "fonts/objectiveFont").font; if (!font) return;
|
||||
Game::Font* descfont = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_FONT, "fonts/normalFont").font; if (!descfont) return;
|
||||
Game::Font_s* font = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_FONT, "fonts/objectiveFont").font; if (!font) return;
|
||||
Game::Font_s* descfont = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_FONT, "fonts/normalFont").font; if (!descfont) return;
|
||||
Game::vec4_t wColor = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
Game::vec4_t bgColor = { 0.0f, 0.0f, 0.0f, 0.8f };
|
||||
Game::vec4_t borderColor = { 1.0f, 1.0f, 1.0f, 0.2f };
|
||||
|
@ -159,11 +159,11 @@ namespace Components
|
||||
|
||||
// Get item cursor position ptr
|
||||
mov ecx, ebx
|
||||
add ecx, Game::itemDef_t::cursorPos
|
||||
add ecx, Game::itemDef_s::cursorPos
|
||||
|
||||
// Get item listbox ptr
|
||||
mov edx, ebx
|
||||
add edx, Game::itemDef_t::typeData
|
||||
add edx, Game::itemDef_s::typeData
|
||||
|
||||
// Get listbox cursor pos
|
||||
mov edx, [edx]
|
||||
@ -262,10 +262,10 @@ namespace Components
|
||||
{
|
||||
for (int i = 0; i < menu->itemCount; ++i)
|
||||
{
|
||||
Game::itemDef_t* item = menu->items[i];
|
||||
Game::itemDef_s* item = menu->items[i];
|
||||
if (item && item->type == 6 && item->special == feeder)
|
||||
{
|
||||
item->cursorPos = static_cast<int>(index);
|
||||
item->cursorPos[0] = static_cast<int>(index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -728,16 +728,16 @@ namespace Components
|
||||
void* data = Utils::Memory::GetAllocator()->allocate(size);
|
||||
std::memcpy(data, *loadDef, size);
|
||||
|
||||
image->loadDef = reinterpret_cast<Game::GfxImageLoadDef *>(data);
|
||||
image->texture.loadDef = reinterpret_cast<Game::GfxImageLoadDef *>(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ZoneBuilder::ReleaseTexture(Game::XAssetHeader header)
|
||||
{
|
||||
if (header.image && header.image->loadDef)
|
||||
if (header.image && header.image->texture.loadDef)
|
||||
{
|
||||
Utils::Memory::GetAllocator()->free(header.image->loadDef);
|
||||
Utils::Memory::GetAllocator()->free(header.image->texture.loadDef);
|
||||
}
|
||||
}
|
||||
|
||||
@ -771,24 +771,24 @@ namespace Components
|
||||
}
|
||||
|
||||
static Game::XZoneInfo baseZones_old[] = {
|
||||
{ "code_pre_gfx_mp", Game::ZoneAllocFlags::DB_ZONE_CODE, 0 },
|
||||
{ "localized_code_pre_gfx_mp", Game::ZoneAllocFlags::DB_ZONE_CODE_LOC, 0 },
|
||||
{ "code_post_gfx_mp", Game::ZoneAllocFlags::DB_ZONE_CODE, 0 },
|
||||
{ "localized_code_post_gfx_mp", Game::ZoneAllocFlags::DB_ZONE_CODE_LOC, 0 },
|
||||
{ "common_mp", Game::ZoneAllocFlags::DB_ZONE_COMMON, 0 },
|
||||
{ "localized_common_mp", Game::ZoneAllocFlags::DB_ZONE_COMMON_LOC, 0 },
|
||||
{ "ui_mp", Game::ZoneAllocFlags::DB_ZONE_GAME, 0 },
|
||||
{ "localized_ui_mp", Game::ZoneAllocFlags::DB_ZONE_GAME, 0 }
|
||||
{ "code_pre_gfx_mp", Game::DB_ZONE_CODE, 0 },
|
||||
{ "localized_code_pre_gfx_mp", Game::DB_ZONE_CODE_LOC, 0 },
|
||||
{ "code_post_gfx_mp", Game::DB_ZONE_CODE, 0 },
|
||||
{ "localized_code_post_gfx_mp", Game::DB_ZONE_CODE_LOC, 0 },
|
||||
{ "common_mp", Game::DB_ZONE_COMMON, 0 },
|
||||
{ "localized_common_mp", Game::DB_ZONE_COMMON_LOC, 0 },
|
||||
{ "ui_mp", Game::DB_ZONE_GAME, 0 },
|
||||
{ "localized_ui_mp", Game::DB_ZONE_GAME, 0 }
|
||||
};
|
||||
|
||||
|
||||
static Game::XZoneInfo baseZones[] = {
|
||||
{ "defaults", Game::ZoneAllocFlags::DB_ZONE_CODE, 0 },
|
||||
{ "techsets", Game::ZoneAllocFlags::DB_ZONE_CODE, 0 },
|
||||
{ "common_mp", Game::ZoneAllocFlags::DB_ZONE_COMMON, 0 },
|
||||
{ "localized_common_mp", Game::ZoneAllocFlags::DB_ZONE_COMMON_LOC, 0 },
|
||||
{ "ui_mp", Game::ZoneAllocFlags::DB_ZONE_GAME, 0 },
|
||||
{ "localized_ui_mp", Game::ZoneAllocFlags::DB_ZONE_GAME, 0 }
|
||||
{ "defaults", Game::DB_ZONE_CODE, 0 },
|
||||
{ "techsets", Game::DB_ZONE_CODE, 0 },
|
||||
{ "common_mp", Game::DB_ZONE_COMMON, 0 },
|
||||
{ "localized_common_mp", Game::DB_ZONE_COMMON_LOC, 0 },
|
||||
{ "ui_mp", Game::DB_ZONE_GAME, 0 },
|
||||
{ "localized_ui_mp", Game::DB_ZONE_GAME, 0 }
|
||||
};
|
||||
|
||||
int __stdcall ZoneBuilder::EntryPoint(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nShowCmd*/)
|
||||
@ -972,7 +972,7 @@ namespace Components
|
||||
if (name[0] == ',') name = name.substr(1);
|
||||
if (name == header.material->techniqueSet->name)
|
||||
{
|
||||
ret = header.material->name;
|
||||
ret = header.material->info.name;
|
||||
replacementFound = true;
|
||||
}
|
||||
}
|
||||
@ -1115,7 +1115,7 @@ namespace Components
|
||||
|
||||
Game::XZoneInfo info;
|
||||
info.name = zone.data();
|
||||
info.allocFlags = Game::ZoneAllocFlags::DB_ZONE_MOD;
|
||||
info.allocFlags = Game::DB_ZONE_MOD;
|
||||
info.freeFlags = 0;
|
||||
|
||||
Logger::Print("Loading zone '%s'...\n", zone.data());
|
||||
@ -1126,7 +1126,7 @@ namespace Components
|
||||
auto assets = ZoneBuilder::EndAssetTrace();
|
||||
|
||||
Logger::Print("Unloading zone '%s'...\n", zone.data());
|
||||
info.freeFlags = Game::ZoneAllocFlags::DB_ZONE_MOD;
|
||||
info.freeFlags = Game::DB_ZONE_MOD;
|
||||
info.allocFlags = 0;
|
||||
info.name = nullptr;
|
||||
|
||||
@ -1222,7 +1222,7 @@ namespace Components
|
||||
// load the zone
|
||||
Game::XZoneInfo info;
|
||||
info.name = zone.c_str();
|
||||
info.allocFlags = Game::ZoneAllocFlags::DB_ZONE_MOD;
|
||||
info.allocFlags = Game::DB_ZONE_MOD;
|
||||
info.freeFlags = 0x0;
|
||||
Game::DB_LoadXAssets(&info, 1, 0);
|
||||
|
||||
@ -1234,7 +1234,7 @@ namespace Components
|
||||
// unload zone
|
||||
info.name = nullptr;
|
||||
info.allocFlags = 0x0;
|
||||
info.freeFlags = Game::ZoneAllocFlags::DB_ZONE_MOD;
|
||||
info.freeFlags = Game::DB_ZONE_MOD;
|
||||
Game::DB_LoadXAssets(&info, 1, true);
|
||||
continue;
|
||||
}
|
||||
@ -1265,7 +1265,7 @@ namespace Components
|
||||
// unload original zone
|
||||
info.name = nullptr;
|
||||
info.allocFlags = 0x0;
|
||||
info.freeFlags = Game::ZoneAllocFlags::DB_ZONE_MOD;
|
||||
info.freeFlags = Game::DB_ZONE_MOD;
|
||||
Game::DB_LoadXAssets(&info, 1, true);
|
||||
|
||||
while (!Game::Sys_IsDatabaseReady()) std::this_thread::sleep_for(10ms); // wait till its fully loaded
|
||||
@ -1299,7 +1299,7 @@ namespace Components
|
||||
{
|
||||
Game::XZoneInfo info;
|
||||
info.name = it.data();
|
||||
info.allocFlags = Game::ZoneAllocFlags::DB_ZONE_MOD;
|
||||
info.allocFlags = Game::DB_ZONE_MOD;
|
||||
info.freeFlags = 0;
|
||||
|
||||
Game::DB_LoadXAssets(&info, 1, 0);
|
||||
@ -1339,7 +1339,7 @@ namespace Components
|
||||
Game::XZoneInfo info;
|
||||
info.name = nullptr;
|
||||
info.allocFlags = 0x0;
|
||||
info.freeFlags = Game::ZoneAllocFlags::DB_ZONE_MOD;
|
||||
info.freeFlags = Game::DB_ZONE_MOD;
|
||||
Game::DB_LoadXAssets(&info, 1, true);
|
||||
|
||||
Utils::Hook::Set<char*>(0x649E740, "techsets");
|
||||
@ -1384,7 +1384,7 @@ namespace Components
|
||||
Game::XZoneInfo info;
|
||||
info.name = nullptr;
|
||||
info.allocFlags = 0x0;
|
||||
info.freeFlags = Game::ZoneAllocFlags::DB_ZONE_MOD;
|
||||
info.freeFlags = Game::DB_ZONE_MOD;
|
||||
Game::DB_LoadXAssets(&info, 1, true);
|
||||
|
||||
subCount++;
|
||||
@ -1403,7 +1403,7 @@ namespace Components
|
||||
{
|
||||
Game::XZoneInfo info;
|
||||
info.name = Utils::String::VA("techsets%d", j);
|
||||
info.allocFlags = Game::ZoneAllocFlags::DB_ZONE_MOD;
|
||||
info.allocFlags = Game::DB_ZONE_MOD;
|
||||
info.freeFlags = 0;
|
||||
|
||||
Game::DB_LoadXAssets(&info, 1, 0);
|
||||
@ -1477,7 +1477,7 @@ namespace Components
|
||||
{
|
||||
Game::DB_EnumXAssets(Game::ASSET_TYPE_MATERIAL, [](Game::XAssetHeader header, void*)
|
||||
{
|
||||
Logger::Print("%s: %X %X %X\n", header.material->name, header.material->sortKey & 0xFF, header.material->gameFlags & 0xFF, header.material->stateFlags & 0xFF);
|
||||
Logger::Print("%s: %X %X %X\n", header.material->info.name, header.material->info.sortKey & 0xFF, header.material->info.gameFlags & 0xFF, header.material->stateFlags & 0xFF);
|
||||
}, nullptr, false);
|
||||
});
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ namespace Components
|
||||
struct
|
||||
{
|
||||
Game::GfxImageLoadDef* texture;
|
||||
Game::MapType mapType;
|
||||
char mapType;
|
||||
char semantic;
|
||||
char category;
|
||||
char flags;
|
||||
@ -1197,18 +1197,19 @@ namespace Components
|
||||
image->mapType = image359.mapType;
|
||||
image->semantic = image359.semantic;
|
||||
image->category = image359.category;
|
||||
image->flags = image359.flags;
|
||||
image->cardMemory = image359.cardMemory;
|
||||
image->dataLen1 = image359.dataLen1;
|
||||
image->dataLen2 = image359.dataLen2;
|
||||
image->useSrgbReads = image359.flags;
|
||||
//image->cardMemory = image359.cardMemory;
|
||||
//image->dataLen1 = image359.dataLen1;
|
||||
//image->dataLen2 = image359.dataLen2;
|
||||
std::memcpy(image->picmip.platform, &image359.cardMemory, sizeof(int) * 3);
|
||||
image->height = image359.height;
|
||||
image->width = image359.width;
|
||||
image->depth = image359.depth;
|
||||
image->loaded = image359.loaded;
|
||||
image->delayLoadPixels = image359.loaded;
|
||||
image->name = image359.name;
|
||||
|
||||
// Used for later stuff
|
||||
image->pad = image359.pad3[1];
|
||||
(&image->delayLoadPixels)[1] = image359.pad3[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1310,21 +1311,21 @@ namespace Components
|
||||
Game::Material* material = reinterpret_cast<Game::Material*>(buffer);
|
||||
memcpy(&material359, material, sizeof(material359));
|
||||
|
||||
material->name = material359.name;
|
||||
material->sortKey = material359.sortKey;
|
||||
material->textureAtlasRowCount = material359.textureAtlasRowCount;
|
||||
material->textureAtlasColumnCount = material359.textureAtlasColumnCount;
|
||||
material->gameFlags = material359.gameFlags;
|
||||
material->info.name = material359.name;
|
||||
material->info.sortKey = material359.sortKey;
|
||||
material->info.textureAtlasRowCount = material359.textureAtlasRowCount;
|
||||
material->info.textureAtlasColumnCount = material359.textureAtlasColumnCount;
|
||||
material->info.gameFlags = material359.gameFlags;
|
||||
|
||||
// Probably wrong
|
||||
material->surfaceTypeBits = 0;//material359.surfaceTypeBits;
|
||||
material->info.surfaceTypeBits = 0;//material359.surfaceTypeBits;
|
||||
|
||||
// Pretty sure that's wrong
|
||||
// Actually, it's not
|
||||
// yes it was lol
|
||||
memcpy(&material->drawSurf.packed, material359.drawSurfBegin, 8);
|
||||
memcpy(&material->info.drawSurf.packed, material359.drawSurfBegin, 8);
|
||||
|
||||
memcpy(&material->surfaceTypeBits, &material359.drawSurf[0], 6); // copies both surfaceTypeBits and hashIndex
|
||||
memcpy(&material->info.surfaceTypeBits, &material359.drawSurf[0], 6); // copies both surfaceTypeBits and hashIndex
|
||||
//material->drawSurf[8] = material359.drawSurf[0];
|
||||
//material->drawSurf[9] = material359.drawSurf[1];
|
||||
//material->drawSurf[10] = material359.drawSurf[2];
|
||||
|
@ -962,7 +962,7 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked) void Menu_FreeItemMemory(itemDef_t* /*item*/)
|
||||
__declspec(naked) void Menu_FreeItemMemory(itemDef_s* /*item*/)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
|
@ -490,10 +490,10 @@ namespace Game
|
||||
typedef void(__cdecl * Playlist_ParsePlaylists_t)(const char* data);
|
||||
extern Playlist_ParsePlaylists_t Playlist_ParsePlaylists;
|
||||
|
||||
typedef Font* (__cdecl * R_RegisterFont_t)(const char* asset, int safe);
|
||||
typedef Font_s* (__cdecl * R_RegisterFont_t)(const char* asset, int safe);
|
||||
extern R_RegisterFont_t R_RegisterFont;
|
||||
|
||||
typedef void(__cdecl * R_AddCmdDrawText_t)(const char *text, int maxChars, Font *font, float x, float y, float xScale, float yScale, float rotation, const float *color, int style);
|
||||
typedef void(__cdecl * R_AddCmdDrawText_t)(const char *text, int maxChars, Font_s *font, float x, float y, float xScale, float yScale, float rotation, const float *color, int style);
|
||||
extern R_AddCmdDrawText_t R_AddCmdDrawText;
|
||||
|
||||
typedef void(_cdecl * R_AddCmdDrawStretchPic_t)(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, Game::Material* material);
|
||||
@ -508,10 +508,10 @@ namespace Game
|
||||
typedef void(__cdecl * R_LoadGraphicsAssets_t)();
|
||||
extern R_LoadGraphicsAssets_t R_LoadGraphicsAssets;
|
||||
|
||||
typedef int(__cdecl * R_TextWidth_t)(const char* text, int maxlength, Font* font);
|
||||
typedef int(__cdecl * R_TextWidth_t)(const char* text, int maxlength, Font_s* font);
|
||||
extern R_TextWidth_t R_TextWidth;
|
||||
|
||||
typedef int(__cdecl * R_TextHeight_t)(Font* font);
|
||||
typedef int(__cdecl * R_TextHeight_t)(Font_s* font);
|
||||
extern R_TextHeight_t R_TextHeight;
|
||||
|
||||
typedef void(__cdecl * R_FlushSun_t)();
|
||||
@ -712,10 +712,10 @@ namespace Game
|
||||
typedef void* (__cdecl * UI_GetContext_t)(void*);
|
||||
extern UI_GetContext_t UI_GetContext;
|
||||
|
||||
typedef int(__cdecl * UI_TextWidth_t)(const char *text, int maxChars, Font *font, float scale);
|
||||
typedef int(__cdecl * UI_TextWidth_t)(const char *text, int maxChars, Font_s *font, float scale);
|
||||
extern UI_TextWidth_t UI_TextWidth;
|
||||
|
||||
typedef void(__cdecl * UI_DrawText_t)(void* scrPlace, const char *text, int maxChars, Font *font, float x, float y, int horzAlign, int vertAlign, float scale, const float *color, int style);
|
||||
typedef void(__cdecl * UI_DrawText_t)(void* scrPlace, const char *text, int maxChars, Font_s *font, float x, float y, int horzAlign, int vertAlign, float scale, const float *color, int style);
|
||||
extern UI_DrawText_t UI_DrawText;
|
||||
|
||||
typedef const char * (__cdecl * Win_GetLanguage_t)();
|
||||
@ -812,7 +812,7 @@ namespace Game
|
||||
extern ScriptContainer* scriptContainer;
|
||||
|
||||
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
|
||||
void Menu_FreeItemMemory(Game::itemDef_t* item);
|
||||
void Menu_FreeItemMemory(Game::itemDef_s* item);
|
||||
const char* TableLookup(StringTable* stringtable, int row, int column);
|
||||
const char* UI_LocalizeMapName(const char* mapName);
|
||||
const char* UI_LocalizeGameType(const char* gameType);
|
||||
|
6637
src/Game/Structs.hpp
6637
src/Game/Structs.hpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user