From 33a8baa9b5f62e1e8adb6fce41a3b3b7b86d9686 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Wed, 9 May 2018 14:33:52 +0200 Subject: [PATCH] [Game] Adapt to correct structures --- src/Components/Modules/AssetHandler.cpp | 10 +- .../Modules/AssetInterfaces/IFont_s.cpp | 26 +- .../Modules/AssetInterfaces/IFxEffectDef.cpp | 64 +- .../Modules/AssetInterfaces/IGameWorldMp.cpp | 18 +- .../Modules/AssetInterfaces/IGameWorldSp.cpp | 118 +- .../Modules/AssetInterfaces/IGfxImage.cpp | 84 +- .../Modules/AssetInterfaces/IGfxWorld.cpp | 62 +- .../Modules/AssetInterfaces/IMapEnts.cpp | 13 +- .../Modules/AssetInterfaces/IMaterial.cpp | 80 +- .../Modules/AssetInterfaces/IPhysCollmap.cpp | 10 +- .../Modules/AssetInterfaces/IRawFile.cpp | 16 +- .../AssetInterfaces/IStructuredDataDefSet.cpp | 8 +- .../Modules/AssetInterfaces/IXAnimParts.cpp | 70 +- .../Modules/AssetInterfaces/IXModel.cpp | 20 +- .../Modules/AssetInterfaces/IXModelSurfs.cpp | 12 +- .../Modules/AssetInterfaces/IclipMap_t.cpp | 322 +- .../Modules/AssetInterfaces/IclipMap_t.hpp | 6 +- .../Modules/AssetInterfaces/ImenuDef_t.cpp | 36 +- .../Modules/AssetInterfaces/ImenuDef_t.hpp | 4 +- .../AssetInterfaces/Isnd_alias_list_t.cpp | 42 +- src/Components/Modules/Exception.cpp | 2 +- src/Components/Modules/FastFiles.cpp | 2 +- src/Components/Modules/FileSystem.cpp | 6 +- src/Components/Modules/Friends.cpp | 8 +- src/Components/Modules/Maps.cpp | 6 +- src/Components/Modules/Materials.cpp | 26 +- src/Components/Modules/Menus.cpp | 12 +- src/Components/Modules/ModelSurfs.cpp | 32 +- src/Components/Modules/MusicalTalent.cpp | 2 +- src/Components/Modules/Network.cpp | 8 +- src/Components/Modules/QuickPatch.cpp | 48 +- src/Components/Modules/QuickPatch.hpp | 2 - src/Components/Modules/ServerInfo.cpp | 2 +- src/Components/Modules/Stats.cpp | 2 +- src/Components/Modules/StructuredData.cpp | 10 +- src/Components/Modules/Toast.cpp | 4 +- src/Components/Modules/UIFeeder.cpp | 8 +- src/Components/Modules/ZoneBuilder.cpp | 56 +- src/Components/Modules/Zones.cpp | 31 +- src/Game/Functions.cpp | 2 +- src/Game/Functions.hpp | 14 +- src/Game/Structs.hpp | 6641 +++++++++-------- 42 files changed, 4211 insertions(+), 3734 deletions(-) diff --git a/src/Components/Modules/AssetHandler.cpp b/src/Components/Modules/AssetHandler.cpp index 6780f3ee..5bfd108d 100644 --- a/src/Components/Modules/AssetHandler.cpp +++ b/src/Components/Modules/AssetHandler.cpp @@ -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 diff --git a/src/Components/Modules/AssetInterfaces/IFont_s.cpp b/src/Components/Modules/AssetInterfaces/IFont_s.cpp index 5a8a318c..0e154c1a 100644 --- a/src/Components/Modules/AssetInterfaces/IFont_s.cpp +++ b/src/Components/Modules/AssetInterfaces/IFont_s.cpp @@ -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(); diff --git a/src/Components/Modules/AssetInterfaces/IFxEffectDef.cpp b/src/Components/Modules/AssetInterfaces/IFxEffectDef.cpp index 44dda186..fb32fad9 100644 --- a/src/Components/Modules/AssetInterfaces/IFxEffectDef.cpp +++ b/src/Components/Modules/AssetInterfaces/IFxEffectDef.cpp @@ -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(); - 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(); 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(elemDef->extended.unknownDef)); + Utils::Stream::ClearPointer(&destElemDef->extended.unknownDef); } } } diff --git a/src/Components/Modules/AssetInterfaces/IGameWorldMp.cpp b/src/Components/Modules/AssetInterfaces/IGameWorldMp.cpp index 4e75094d..685ebaa7 100644 --- a/src/Components/Modules/AssetInterfaces/IGameWorldMp.cpp +++ b/src/Components/Modules/AssetInterfaces/IGameWorldMp.cpp @@ -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(); - 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(); - 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(); diff --git a/src/Components/Modules/AssetInterfaces/IGameWorldSp.cpp b/src/Components/Modules/AssetInterfaces/IGameWorldSp.cpp index 53aa758f..07a79b9c 100644 --- a/src/Components/Modules/AssetInterfaces/IGameWorldSp.cpp +++ b/src/Components/Modules/AssetInterfaces/IGameWorldSp.cpp @@ -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(); - 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(); - 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(); - 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(); - 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(); - 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(); - 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(); diff --git a/src/Components/Modules/AssetInterfaces/IGfxImage.cpp b/src/Components/Modules/AssetInterfaces/IGfxImage.cpp index 1c167cb4..87bb6ae6 100644 --- a/src/Components/Modules/AssetInterfaces/IGfxImage.cpp +++ b/src/Components/Modules/AssetInterfaces/IGfxImage.cpp @@ -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(); + image->mapType = reader.read(); image->semantic = reader.read(); image->category = reader.read(); - image->dataLen1 = reader.read(); - image->dataLen2 = image->dataLen1; + image->cardMemory.platform[0] = reader.read(); + image->cardMemory.platform[1] = image->cardMemory.platform[0]; - image->loadDef = reinterpret_cast(reader.readArray(image->dataLen1 + 16)); + image->texture.loadDef = reinterpret_cast(reader.readArray(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(&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(); - if (!image->loadDef) + image->texture.loadDef = builder->getAllocator()->allocate(); + 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(); - 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(); diff --git a/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp b/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp index 3b1c1309..b2b60b31 100644 --- a/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp +++ b/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp @@ -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(asset->reflectionProbeCount); + asset->reflectionProbes = reader->readArray(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(asset->reflectionProbeCount); + asset->reflectionProbeOrigins = reader->readArray(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(asset->planeCount); + asset->dpvsPlanes.planes = reader.readArray(asset->planeCount); if (builder->getAllocator()->isPointerMapped(oldPtr)) { - asset->dpvsPlanes.planes = builder->getAllocator()->getPointer(oldPtr); + asset->dpvsPlanes.planes = builder->getAllocator()->getPointer(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(); - 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 diff --git a/src/Components/Modules/AssetInterfaces/IMapEnts.cpp b/src/Components/Modules/AssetInterfaces/IMapEnts.cpp index 11282670..4219e23a 100644 --- a/src/Components/Modules/AssetInterfaces/IMapEnts.cpp +++ b/src/Components/Modules/AssetInterfaces/IMapEnts.cpp @@ -39,8 +39,9 @@ namespace Assets { entites->stageCount = 1; entites->stages = builder->getAllocator()->allocate(); - 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); } } diff --git a/src/Components/Modules/AssetInterfaces/IMaterial.cpp b/src/Components/Modules/AssetInterfaces/IMaterial.cpp index d13f76da..5bfe92af 100644 --- a/src/Components/Modules/AssetInterfaces/IMaterial.cpp +++ b/src/Components/Modules/AssetInterfaces/IMaterial.cpp @@ -49,9 +49,9 @@ namespace Assets Game::Material* asset = reader.readObject(); - 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(); - 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(asset->constantCount); } - if (asset->stateBitTable) + if (asset->stateBitsTable) { - asset->stateBitTable = reader.readArray(asset->stateBitsCount); + asset->stateBitsTable = reader.readArray(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(animCoordX.number_value()) & 0xFF; + material->info.textureAtlasColumnCount = static_cast(animCoordX.number_value()) & 0xFF; } if (animCoordY.is_number()) { - material->textureAtlasRowCount = static_cast(animCoordY.number_value()) & 0xFF; + material->info.textureAtlasRowCount = static_cast(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* 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); } } diff --git a/src/Components/Modules/AssetInterfaces/IPhysCollmap.cpp b/src/Components/Modules/AssetInterfaces/IPhysCollmap.cpp index e91f8500..6c84f43f 100644 --- a/src/Components/Modules/AssetInterfaces/IPhysCollmap.cpp +++ b/src/Components/Modules/AssetInterfaces/IPhysCollmap.cpp @@ -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); } } } diff --git a/src/Components/Modules/AssetInterfaces/IRawFile.cpp b/src/Components/Modules/AssetInterfaces/IRawFile.cpp index d3aeb4ce..5fff00fe 100644 --- a/src/Components/Modules/AssetInterfaces/IRawFile.cpp +++ b/src/Components/Modules/AssetInterfaces/IRawFile.cpp @@ -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(); diff --git a/src/Components/Modules/AssetInterfaces/IStructuredDataDefSet.cpp b/src/Components/Modules/AssetInterfaces/IStructuredDataDefSet.cpp index dc5a3047..b0d159a0 100644 --- a/src/Components/Modules/AssetInterfaces/IStructuredDataDefSet.cpp +++ b/src/Components/Modules/AssetInterfaces/IStructuredDataDefSet.cpp @@ -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(); buffer->save(asset); diff --git a/src/Components/Modules/AssetInterfaces/IXAnimParts.cpp b/src/Components/Modules/AssetInterfaces/IXAnimParts.cpp index c875c581..b1c132cc 100644 --- a/src/Components/Modules/AssetInterfaces/IXAnimParts.cpp +++ b/src/Components/Modules/AssetInterfaces/IXAnimParts.cpp @@ -33,22 +33,22 @@ namespace Assets xanim->name = reader.readCString(); } - if (xanim->tagnames) + if (xanim->names) { - xanim->tagnames = builder->getAllocator()->allocateArray(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(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(xanim->notetrackCount); + xanim->notify = reader.readArray(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(xanim->indexcount); + xanim->indices._1 = reader.readArray(xanim->indexCount); } else { - xanim->indices._2 = reader.readArray(xanim->indexcount); + xanim->indices._2 = reader.readArray(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(); - 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(); - 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); diff --git a/src/Components/Modules/AssetInterfaces/IXModel.cpp b/src/Components/Modules/AssetInterfaces/IXModel.cpp index 6fc7a03a..807d2191 100644 --- a/src/Components/Modules/AssetInterfaces/IXModel.cpp +++ b/src/Components/Modules/AssetInterfaces/IXModel.cpp @@ -61,13 +61,13 @@ namespace Assets asset->name = reader->readCString(); } - if (asset->surfaces) + if (asset->surfs) { - asset->surfaces = reader->readArray(asset->numSurfaces); + asset->surfs = reader->readArray(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(); - 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(); + side->plane = reader.readObject(); } } } @@ -286,7 +286,7 @@ namespace Assets // TODO: Add pointer support if (brush->planes) { - brush->planes = reader.readArray(brush->brush.numsides); + brush->planes = reader.readArray(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; } } } diff --git a/src/Components/Modules/AssetInterfaces/IXModelSurfs.cpp b/src/Components/Modules/AssetInterfaces/IXModelSurfs.cpp index fbdf42b6..bcbaa7fe 100644 --- a/src/Components/Modules/AssetInterfaces/IXModelSurfs.cpp +++ b/src/Components/Modules/AssetInterfaces/IXModelSurfs.cpp @@ -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(); 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(); - 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(); diff --git a/src/Components/Modules/AssetInterfaces/IclipMap_t.cpp b/src/Components/Modules/AssetInterfaces/IclipMap_t.cpp index 0fec9848..8a86d218 100644 --- a/src/Components/Modules/AssetInterfaces/IclipMap_t.cpp +++ b/src/Components/Modules/AssetInterfaces/IclipMap_t.cpp @@ -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_s* destStaticModelList = buffer->dest(); 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(); 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(); // 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(); - 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(); - buffer->saveArray(asset->cLeafBrushNodes, asset->numCLeafBrushNodes); + Game::cLeafBrushNode_s* node = buffer->dest(); + 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(); - 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(); - 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(); + clipMap->planeCount = reader.read(); clipMap->numStaticModels = reader.read(); clipMap->numMaterials = reader.read(); - clipMap->numCBrushSides = reader.read(); - clipMap->numCBrushEdges = reader.read(); - clipMap->numCNodes = reader.read(); - clipMap->numCLeaf = reader.read(); - clipMap->numCLeafBrushNodes = reader.read(); + clipMap->numBrushSides = reader.read(); + clipMap->numBrushEdges = reader.read(); + clipMap->numNodes = reader.read(); + clipMap->numLeafs = reader.read(); + clipMap->leafbrushNodesCount = reader.read(); clipMap->numLeafBrushes = reader.read(); clipMap->numLeafSurfaces = reader.read(); - clipMap->numVerts = reader.read(); - clipMap->numTriIndices = reader.read(); - clipMap->numCollisionBorders = reader.read(); - clipMap->numCollisionPartitions = reader.read(); - clipMap->numCollisionAABBTrees = reader.read(); - clipMap->numCModels = reader.read(); - clipMap->numCBrushes = reader.read(); + clipMap->vertCount = reader.read(); + clipMap->triCount = reader.read(); + clipMap->borderCount = reader.read(); + clipMap->partitionCount = reader.read(); + clipMap->aabbTreeCount = reader.read(); + clipMap->numSubModels = reader.read(); + clipMap->numBrushes = reader.read(); clipMap->dynEntCount[0] = reader.read(); clipMap->dynEntCount[1] = reader.read(); - if (clipMap->numCPlanes) + if (clipMap->planeCount) { void* oldPtr = reader.read(); - clipMap->cPlanes = reader.readArray(clipMap->numCPlanes); + clipMap->planes = reader.readArray(clipMap->planeCount); if (builder->getAllocator()->isPointerMapped(oldPtr)) { - clipMap->cPlanes = builder->getAllocator()->getPointer(oldPtr); + clipMap->planes = builder->getAllocator()->getPointer(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(clipMap->numStaticModels); - for (int i = 0; i < clipMap->numStaticModels; ++i) + clipMap->staticModelList = builder->getAllocator()->allocateArray(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(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(64); - clipMap->materials[j].unk = reader.read(); - clipMap->materials[j].unk2 = reader.read(); + clipMap->materials[j].surfaceFlags = reader.read(); + clipMap->materials[j].contents = reader.read(); } } - if (clipMap->numCBrushSides) + if (clipMap->numBrushSides) { - clipMap->cBrushSides = builder->getAllocator()->allocateArray(clipMap->numCBrushSides); - for (int i = 0; i < clipMap->numCBrushSides; ++i) + clipMap->brushsides = builder->getAllocator()->allocateArray(clipMap->numBrushSides); + for (unsigned int i = 0; i < clipMap->numBrushSides; ++i) { int planeIndex = reader.read(); - 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(reader.read()); // materialNum - clipMap->cBrushSides[i].firstAdjacentSideOffset = static_cast(reader.read()); // firstAdjacentSide - clipMap->cBrushSides[i].edgeCount = reader.read(); // edgeCount + clipMap->brushsides[i].plane = &clipMap->planes[planeIndex]; + clipMap->brushsides[i].materialNum = static_cast(reader.read()); // materialNum + clipMap->brushsides[i].firstAdjacentSideOffset = static_cast(reader.read()); // firstAdjacentSide + clipMap->brushsides[i].edgeCount = reader.read(); // edgeCount } } - if (clipMap->numCBrushEdges) + if (clipMap->numBrushEdges) { - clipMap->cBrushEdges = reader.readArray(clipMap->numCBrushEdges); + clipMap->brushEdges = reader.readArray(clipMap->numBrushEdges); } - if (clipMap->numCNodes) + if (clipMap->numNodes) { - clipMap->cNodes = builder->getAllocator()->allocateArray(clipMap->numCNodes); - for (int i = 0; i < clipMap->numCNodes; ++i) + clipMap->nodes = builder->getAllocator()->allocateArray(clipMap->numNodes); + for (unsigned int i = 0; i < clipMap->numNodes; ++i) { int planeIndex = reader.read(); - 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(); - clipMap->cNodes[i].children[1] = reader.read(); + clipMap->nodes[i].plane = &clipMap->planes[planeIndex]; + clipMap->nodes[i].children[0] = reader.read(); + clipMap->nodes[i].children[1] = reader.read(); } } - if (clipMap->numCLeaf) + if (clipMap->numLeafs) { - clipMap->cLeaf = reader.readArray(clipMap->numCLeaf); + clipMap->leafs = reader.readArray(clipMap->numLeafs); } - if (clipMap->numCLeafBrushNodes) + if (clipMap->leafbrushNodesCount) { - clipMap->cLeafBrushNodes = builder->getAllocator()->allocateArray(clipMap->numCLeafBrushNodes); - for (int i = 0; i < clipMap->numCLeafBrushNodes; ++i) + clipMap->leafbrushNodes = builder->getAllocator()->allocateArray(clipMap->leafbrushNodesCount); + for (unsigned int i = 0; i < clipMap->leafbrushNodesCount; ++i) { - clipMap->cLeafBrushNodes[i] = reader.read(); + clipMap->leafbrushNodes[i] = reader.read(); - if (clipMap->cLeafBrushNodes[i].leafBrushCount > 0) + if (clipMap->leafbrushNodes[i].leafBrushCount > 0) { - clipMap->cLeafBrushNodes[i].data.leaf.brushes = reader.readArray(clipMap->cLeafBrushNodes[i].leafBrushCount); + clipMap->leafbrushNodes[i].data.leaf.brushes = reader.readArray(clipMap->leafbrushNodes[i].leafBrushCount); } } } if (clipMap->numLeafBrushes) { - clipMap->leafBrushes = reader.readArray(clipMap->numLeafBrushes); + clipMap->leafbrushes = reader.readArray(clipMap->numLeafBrushes); } if (clipMap->numLeafSurfaces) { - clipMap->leafSurfaces = reader.readArray(clipMap->numLeafSurfaces); + clipMap->leafsurfaces = reader.readArray(clipMap->numLeafSurfaces); } - if (clipMap->numVerts) + if (clipMap->vertCount) { - clipMap->verts = reader.readArray(clipMap->numVerts); + clipMap->verts = reader.readArray(clipMap->vertCount); } - if (clipMap->numTriIndices) + if (clipMap->triCount) { - clipMap->triIndices = reader.readArray(clipMap->numTriIndices * 3); - clipMap->triEdgeIsWalkable = reader.readArray(4 * ((3 * clipMap->numTriIndices + 31) >> 5)); + clipMap->triIndices = reader.readArray(clipMap->triCount * 3); + clipMap->triEdgeIsWalkable = reader.readArray(4 * ((3 * clipMap->triCount + 31) >> 5)); } - if (clipMap->numCollisionBorders) + if (clipMap->borderCount) { - clipMap->collisionBorders = reader.readArray(clipMap->numCollisionBorders); + clipMap->borders = reader.readArray(clipMap->borderCount); } - if (clipMap->numCollisionPartitions) + if (clipMap->partitionCount) { - clipMap->collisionPartitions = builder->getAllocator()->allocateArray(clipMap->numCollisionPartitions); - for (int i = 0; i < clipMap->numCollisionPartitions; ++i) + clipMap->partitions = builder->getAllocator()->allocateArray(clipMap->partitionCount); + for (int i = 0; i < clipMap->partitionCount; ++i) { - clipMap->collisionPartitions[i].triCount = reader.read(); - clipMap->collisionPartitions[i].borderCount = reader.read(); - clipMap->collisionPartitions[i].firstTri = reader.read(); + clipMap->partitions[i].triCount = reader.read(); + clipMap->partitions[i].borderCount = reader.read(); + clipMap->partitions[i].firstTri = reader.read(); - if (clipMap->collisionPartitions[i].borderCount > 0) + if (clipMap->partitions[i].borderCount > 0) { int index = reader.read(); - 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(clipMap->numCollisionAABBTrees); + clipMap->aabbTrees = reader.readArray(clipMap->aabbTreeCount); } - if (clipMap->numCModels) + if (clipMap->numSubModels) { - clipMap->cModels = reader.readArray(clipMap->numCModels); + clipMap->cmodels = reader.readArray(clipMap->numSubModels); } - if (clipMap->numCBrushes) + if (clipMap->numBrushes) { - clipMap->cBrushes = builder->getAllocator()->allocateArray(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(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() & 0xFFFF; // todo: check for overflow here - if (clipMap->cBrushes[i].numsides > 0) + clipMap->brushes[i].numsides = reader.read() & 0xFFFF; // todo: check for overflow here + if (clipMap->brushes[i].numsides > 0) { - int index = reader.read(); - if (index < 0 || index > clipMap->numCBrushSides) + unsigned int index = reader.read(); + 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(); - if (index > clipMap->numCBrushEdges) + unsigned int index = reader.read(); + 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(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() & 0xFF; + clipMap->brushes[i].firstAdjacentSideOffsets[r][c] = reader.read() & 0xFF; } } tmp = reader.readArray(6); - memcpy(&clipMap->cBrushes[i].edgeCount, tmp, 6); + memcpy(&clipMap->brushes[i].edgeCount, tmp, 6); } - clipMap->cBrushBounds = reader.readArray(clipMap->numCBrushes); - clipMap->cBrushContents = reader.readArray(clipMap->numCBrushes); + clipMap->brushBounds = reader.readArray(clipMap->numBrushes); + clipMap->brushContents = reader.readArray(clipMap->numBrushes); } for (int x = 0; x < 2; ++x) diff --git a/src/Components/Modules/AssetInterfaces/IclipMap_t.hpp b/src/Components/Modules/AssetInterfaces/IclipMap_t.hpp index b7fa94fc..57c88bed 100644 --- a/src/Components/Modules/AssetInterfaces/IclipMap_t.hpp +++ b/src/Components/Modules/AssetInterfaces/IclipMap_t.hpp @@ -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; diff --git a/src/Components/Modules/AssetInterfaces/ImenuDef_t.cpp b/src/Components/Modules/AssetInterfaces/ImenuDef_t.cpp index 188f6138..e9bd1eb3 100644 --- a/src/Components/Modules/AssetInterfaces/ImenuDef_t.cpp +++ b/src/Components/Modules/AssetInterfaces/ImenuDef_t.cpp @@ -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(); 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(); - 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_s* dest = buffer->dest(); buffer->save(asset); // window data - save_windowDef_t(&asset->window, dest, builder); + save_windowDef_t(&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); } } } diff --git a/src/Components/Modules/AssetInterfaces/ImenuDef_t.hpp b/src/Components/Modules/AssetInterfaces/ImenuDef_t.hpp index 0b7700cf..e62b15ea 100644 --- a/src/Components/Modules/AssetInterfaces/ImenuDef_t.hpp +++ b/src/Components/Modules/AssetInterfaces/ImenuDef_t.hpp @@ -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); }; } diff --git a/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp b/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp index 2286d2e5..10e8052c 100644 --- a/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp +++ b/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp @@ -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); } } } diff --git a/src/Components/Modules/Exception.cpp b/src/Components/Modules/Exception.cpp index 0da74a42..3e9905d5 100644 --- a/src/Components/Modules/Exception.cpp +++ b/src/Components/Modules/Exception.cpp @@ -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 diff --git a/src/Components/Modules/FastFiles.cpp b/src/Components/Modules/FastFiles.cpp index f97c3837..ed2d69dc 100644 --- a/src/Components/Modules/FastFiles.cpp +++ b/src/Components/Modules/FastFiles.cpp @@ -561,7 +561,7 @@ namespace Components { if (FastFiles::Current().empty() || !Dvar::Var("ui_zoneDebug").get()) 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(0x10AA5D8); diff --git a/src/Components/Modules/FileSystem.cpp b/src/Components/Modules/FileSystem.cpp index 91543696..c5d55571 100644 --- a/src/Components/Modules/FileSystem.cpp +++ b/src/Components/Modules/FileSystem.cpp @@ -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(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); } diff --git a/src/Components/Modules/Friends.cpp b/src/Components/Modules/Friends.cpp index 79d76467..ccd74024 100644 --- a/src/Components/Modules/Friends.cpp +++ b/src/Components/Modules/Friends.cpp @@ -407,9 +407,9 @@ namespace Components buffer[3] = size; // Height // Icon name length - buffer[4] = static_cast(strlen(rankIcon->name)); + buffer[4] = static_cast(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(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); } diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index 79d27e87..b90b2eed 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -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 }; diff --git a/src/Components/Modules/Materials.cpp b/src/Components/Modules/Materials.cpp index f13fac2b..fe0cdda8 100644 --- a/src/Components/Modules/Materials.cpp +++ b/src/Components/Modules/Materials.cpp @@ -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(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; } }); diff --git a/src/Components/Modules/Menus.cpp b/src/Components/Modules/Menus.cpp index 31be3ea0..ebe70300 100644 --- a/src/Components/Modules/Menus.cpp +++ b/src/Components/Modules/Menus.cpp @@ -119,7 +119,7 @@ namespace Components Game::menuDef_t* menu = allocator->allocate(); if (!menu) return nullptr; - menu->items = allocator->allocateArray(512); + menu->items = allocator->allocateArray(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; } } diff --git a/src/Components/Modules/ModelSurfs.cpp b/src/Components/Modules/ModelSurfs.cpp index 71fe6875..eef88a84 100644 --- a/src/Components/Modules/ModelSurfs.cpp +++ b/src/Components/Modules/ModelSurfs.cpp @@ -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(allocationData->mainArray); - Game::XSurface* tempSurfaces = allocator.allocateArray(modelSurfs->numSurfaces); - char* surfaceData = reinterpret_cast(modelSurfs->surfaces); + Game::XSurface* tempSurfaces = allocator.allocateArray(modelSurfs->numsurfs); + char* surfaceData = reinterpret_cast(modelSurfs->surfs); if (ModelSurfs::AllocMap.find(modelSurfs->name) != ModelSurfs::AllocMap.end()) { @@ -125,7 +125,7 @@ namespace Components ModelSurfs::AllocMap[modelSurfs->name] = allocationData; *reinterpret_cast(reinterpret_cast(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(newSurfs->numSurfaces); + short numSurfs = static_cast(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); } diff --git a/src/Components/Modules/MusicalTalent.cpp b/src/Components/Modules/MusicalTalent.cpp index 668911f5..63bd3512 100644 --- a/src/Components/Modules/MusicalTalent.cpp +++ b/src/Components/Modules/MusicalTalent.cpp @@ -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; diff --git a/src/Components/Modules/Network.cpp b/src/Components/Modules/Network.cpp index 8cb1749f..dc2ef50c 100644 --- a/src/Components/Modules/Network.cpp +++ b/src/Components/Modules/Network.cpp @@ -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) diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index 5a192416..c9a1af42 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -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(0x62E4BAC)) + if (*reinterpret_cast(0x62E4BAC)) { Game::Con_DrawMiniConsole(0, 2, 4, (Game::CL_IsCgameInitialized() ? 1.0f : 0.4f)); } diff --git a/src/Components/Modules/QuickPatch.hpp b/src/Components/Modules/QuickPatch.hpp index 8cf2f542..22c57758 100644 --- a/src/Components/Modules/QuickPatch.hpp +++ b/src/Components/Modules/QuickPatch.hpp @@ -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(); }; } diff --git a/src/Components/Modules/ServerInfo.cpp b/src/Components/Modules/ServerInfo.cpp index 6c8017eb..1ba487a9 100644 --- a/src/Components/Modules/ServerInfo.cpp +++ b/src/Components/Modules/ServerInfo.cpp @@ -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(); diff --git a/src/Components/Modules/Stats.cpp b/src/Components/Modules/Stats.cpp index f4dbbb24..36f28419 100644 --- a/src/Components/Modules/Stats.cpp +++ b/src/Components/Modules/Stats.cpp @@ -53,7 +53,7 @@ namespace Components } // send statpacket - Network::SendRaw(Game::NS_CLIENT, *reinterpret_cast(0xA1E888), std::string(msg.data, msg.cursize)); + Network::SendRaw(Game::NS_CLIENT1, *reinterpret_cast(0xA1E888), std::string(msg.data, msg.cursize)); } } } diff --git a/src/Components/Modules/StructuredData.cpp b/src/Components/Modules/StructuredData.cpp index eb64020c..6a9a588d 100644 --- a/src/Components/Modules/StructuredData.cpp +++ b/src/Components/Modules/StructuredData.cpp @@ -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(first); const Game::StructuredDataEnumEntry* entry2 = reinterpret_cast(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) diff --git a/src/Components/Modules/Toast.cpp b/src/Components/Modules/Toast.cpp index fecc45bd..8600ea62 100644 --- a/src/Components/Modules/Toast.cpp +++ b/src/Components/Modules/Toast.cpp @@ -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 }; diff --git a/src/Components/Modules/UIFeeder.cpp b/src/Components/Modules/UIFeeder.cpp index 900f09c4..279d04d8 100644 --- a/src/Components/Modules/UIFeeder.cpp +++ b/src/Components/Modules/UIFeeder.cpp @@ -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(index); + item->cursorPos[0] = static_cast(index); break; } } diff --git a/src/Components/Modules/ZoneBuilder.cpp b/src/Components/Modules/ZoneBuilder.cpp index e7021ff7..f08ce5a7 100644 --- a/src/Components/Modules/ZoneBuilder.cpp +++ b/src/Components/Modules/ZoneBuilder.cpp @@ -728,16 +728,16 @@ namespace Components void* data = Utils::Memory::GetAllocator()->allocate(size); std::memcpy(data, *loadDef, size); - image->loadDef = reinterpret_cast(data); + image->texture.loadDef = reinterpret_cast(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(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); }); diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index 3a92d165..06f265a6 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -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(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]; diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index fc30056e..5a647d11 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -962,7 +962,7 @@ namespace Game } } - __declspec(naked) void Menu_FreeItemMemory(itemDef_t* /*item*/) + __declspec(naked) void Menu_FreeItemMemory(itemDef_s* /*item*/) { __asm { diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index 7cb409ba..48d738e0 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -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); diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index 55f318b1..21296519 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -2,6 +2,8 @@ #define PROTOCOL 0x95 #define NUM_CUSTOM_CLASSES 15 +#define SEMANTIC_WATER_MAP 11 +#define FX_ELEM_FIELD_COUNT 90 // This allows us to compile our structures in IDA, for easier reversing :3 #ifndef __cplusplus @@ -119,57 +121,13 @@ namespace Game DVAR_TYPE_COUNT = 0xA, } dvar_type; - union DvarValue - { - bool enabled; - int integer; - unsigned int unsignedInt; - float value; - float vector[4]; - const char *string; - char color[4]; - }; - - union DvarLimits - { - struct StringLimit - { - int stringCount; - const char **strings; - }; - - struct IntLimit - { - int min; - int max; - }; - - struct FloatLimit - { - float min; - float max; - }; - - StringLimit enumeration; - IntLimit integer; - FloatLimit value; - FloatLimit vector; - }; - - struct dvar_t - { - const char *name; - const char *description; - unsigned int flags; - char type; - bool modified; - DvarValue current; - DvarValue latched; - DvarValue reset; - DvarLimits domain; - bool(__cdecl *domainFunc)(dvar_t *, DvarValue); - dvar_t *hashNext; - }; + struct FxEffectDef; + struct pathnode_t; + struct pathnode_tree_t; + struct GfxPortal; + struct Statement_s; + struct MenuEventHandlerSet; + struct menuDef_t; typedef struct cmd_function_s { @@ -192,211 +150,496 @@ namespace Game }; #pragma pack(pop) - struct SpeakerLevels + struct __declspec(align(4)) PhysPreset { - int speaker; - int numLevels; - float levels[2]; + const char *name; + int type; + float mass; + float bounce; + float friction; + float bulletForceScale; + float explosiveForceScale; + const char *sndAliasPrefix; + float piecesSpreadFraction; + float piecesUpwardVelocity; + bool tempDefaultToCylinder; + bool perSurfaceSndAlias; }; - struct ChannelMap + struct Bounds { - int entryCount; // how many entries are used - SpeakerLevels speakers[6]; + float midPoint[3]; + float halfSize[3]; }; - struct SpeakerMap + struct cplane_s { + float normal[3]; + float dist; + char type; + char pad[3]; + }; + + struct cbrushside_t + { + cplane_s *plane; + unsigned __int16 materialNum; + char firstAdjacentSideOffset; + char edgeCount; + }; + + struct cbrush_t + { + unsigned __int16 numsides; + unsigned __int16 glassPieceIndex; + cbrushside_t *sides; + char *baseAdjacentSide; + __int16 axialMaterialNum[2][3]; + char firstAdjacentSideOffsets[2][3]; + char edgeCount[2][3]; + }; + + struct BrushWrapper + { + Bounds bounds; + cbrush_t brush; + int totalEdgeCount; + cplane_s *planes; + }; + + struct PhysGeomInfo + { + BrushWrapper *brushWrapper; + int type; + float orientation[3][3]; + Bounds bounds; + }; + + struct PhysMass + { + float centerOfMass[3]; + float momentsOfInertia[3]; + float productsOfInertia[3]; + }; + + struct PhysCollmap + { + const char *name; + unsigned int count; + PhysGeomInfo *geoms; + PhysMass mass; + Bounds bounds; + }; + + union XAnimIndices + { + char *_1; + unsigned __int16 *_2; + void *data; + }; + + struct XAnimNotifyInfo + { + unsigned __int16 name; + float time; + }; + + union XAnimDynamicFrames + { + char(*_1)[3]; + unsigned __int16(*_2)[3]; + }; + + union XAnimDynamicIndices + { + char _1[1]; + unsigned __int16 _2[1]; + }; + + struct __declspec(align(4)) XAnimPartTransFrames + { + float mins[3]; + float size[3]; + XAnimDynamicFrames frames; + XAnimDynamicIndices indices; + }; + + union XAnimPartTransData + { + XAnimPartTransFrames frames; + float frame0[3]; + }; + + struct XAnimPartTrans + { + unsigned __int16 size; + char smallTrans; + XAnimPartTransData u; + }; + + struct __declspec(align(4)) XAnimDeltaPartQuatDataFrames2 + { + __int16(*frames)[2]; + XAnimDynamicIndices indices; + }; + + union XAnimDeltaPartQuatData2 + { + XAnimDeltaPartQuatDataFrames2 frames; + __int16 frame0[2]; + }; + + struct XAnimDeltaPartQuat2 + { + unsigned __int16 size; + XAnimDeltaPartQuatData2 u; + }; + + struct __declspec(align(4)) XAnimDeltaPartQuatDataFrames + { + __int16(*frames)[4]; + XAnimDynamicIndices indices; + }; + + union XAnimDeltaPartQuatData + { + XAnimDeltaPartQuatDataFrames frames; + __int16 frame0[4]; + }; + + struct XAnimDeltaPartQuat + { + unsigned __int16 size; + XAnimDeltaPartQuatData u; + }; + + struct XAnimDeltaPart + { + XAnimPartTrans *trans; + XAnimDeltaPartQuat2 *quat2; + XAnimDeltaPartQuat *quat; + }; + + struct XAnimParts + { + const char *name; + unsigned __int16 dataByteCount; + unsigned __int16 dataShortCount; + unsigned __int16 dataIntCount; + unsigned __int16 randomDataByteCount; + unsigned __int16 randomDataIntCount; + unsigned __int16 numframes; + char flags; + char boneCount[10]; + char notifyCount; + char assetType; bool isDefault; - const char *name; - ChannelMap channelMaps[2][2]; + unsigned int randomDataShortCount; + unsigned int indexCount; + float framerate; + float frequency; + unsigned __int16 *names; + char *dataByte; + __int16 *dataShort; + int *dataInt; + __int16 *randomDataShort; + char *randomDataByte; + int *randomDataInt; + XAnimIndices indices; + XAnimNotifyInfo *notify; + XAnimDeltaPart *deltaPart; }; - enum snd_alias_type_t : char + struct XSurfaceVertexInfo { - SAT_UNKNOWN = 0x0, - SAT_LOADED = 0x1, - SAT_STREAMED = 0x2 + __int16 vertCount[4]; + unsigned __int16 *vertsBlend; }; - struct StreamedSound + union GfxColor { - const char *dir; - const char *name; + unsigned int packed; + char array[4]; }; - struct SndCurve + union PackedTexCoords { - const char *filename; - unsigned __int16 knotCount; - vec2_t knots[16]; + unsigned int packed; }; - struct _AILSOUNDINFO + union PackedUnitVec { - int format; - const void *data_ptr; - unsigned int data_len; - unsigned int rate; - int bits; - int channels; - unsigned int samples; - unsigned int block_size; - const void *initial_ptr; + unsigned int packed; + char array[4]; }; - struct MssSound + struct GfxPackedVertex { - _AILSOUNDINFO info; - char *data; + float xyz[3]; + float binormalSign; + GfxColor color; + PackedTexCoords texCoord; + PackedUnitVec normal; + PackedUnitVec tangent; }; - struct LoadedSound + struct XSurfaceCollisionAabb + { + unsigned __int16 mins[3]; + unsigned __int16 maxs[3]; + }; + + struct XSurfaceCollisionNode + { + XSurfaceCollisionAabb aabb; + unsigned __int16 childBeginIndex; + unsigned __int16 childCount; + }; + + struct XSurfaceCollisionLeaf + { + unsigned __int16 triangleBeginIndex; + }; + + struct XSurfaceCollisionTree + { + float trans[3]; + float scale[3]; + unsigned int nodeCount; + XSurfaceCollisionNode *nodes; + unsigned int leafCount; + XSurfaceCollisionLeaf *leafs; + }; + + struct XRigidVertList + { + unsigned __int16 boneOffset; + unsigned __int16 vertCount; + unsigned __int16 triOffset; + unsigned __int16 triCount; + XSurfaceCollisionTree *collisionTree; + }; + + struct XSurface + { + char tileMode; + bool deformed; + unsigned __int16 vertCount; + unsigned __int16 triCount; + char zoneHandle; + unsigned __int16 baseTriIndex; + unsigned __int16 baseVertIndex; + unsigned __int16 *triIndices; + XSurfaceVertexInfo vertInfo; + GfxPackedVertex *verts0; + unsigned int vertListCount; + XRigidVertList *vertList; + int partBits[6]; + }; + + struct XModelSurfs { const char *name; - MssSound sound; + XSurface *surfs; + unsigned __int16 numsurfs; + int partBits[6]; }; - union SoundData + struct DObjAnimMat { - LoadedSound* loaded; - StreamedSound stream; + float quat[4]; + float trans[3]; + float transWeight; }; - struct SoundFile + struct GfxDrawSurfFields { - snd_alias_type_t type; - bool exists; - SoundData data; + unsigned __int64 objectId : 16; + unsigned __int64 reflectionProbeIndex : 8; + unsigned __int64 hasGfxEntIndex : 1; + unsigned __int64 customIndex : 5; + unsigned __int64 materialSortedIndex : 12; + unsigned __int64 prepass : 2; + unsigned __int64 useHeroLighting : 1; + unsigned __int64 sceneLightIndex : 8; + unsigned __int64 surfType : 4; + unsigned __int64 primarySortKey : 6; + unsigned __int64 unused : 1; }; - struct snd_alias_t + union GfxDrawSurf + { + GfxDrawSurfFields fields; + unsigned __int64 packed; + }; + + struct /*__declspec(align(4))*/ MaterialInfo { const char *name; - const char *subtitle; - const char *secondaryAliasName; - const char *chainAliasName; - const char *string4; - SoundFile *soundFile; - int sequence; - float volMin; - float volMax; - float pitchMin; - float pitchMax; - float distMin; - float distMax; - int flags; - float slavePercentage; - float probability; - float lfePercentage; - float centerPercentage; - int startDelay; - int pad; - SndCurve *volumeFalloffCurve; - float envelopMin; - float envelopMax; - float envelopPercentage; - SpeakerMap *speakerMap; + char gameFlags; + char sortKey; + char textureAtlasRowCount; + char textureAtlasColumnCount; + GfxDrawSurf drawSurf; + unsigned int surfaceTypeBits; + unsigned __int16 hashIndex; }; - struct snd_alias_list_t + struct MaterialStreamRouting + { + char source; + char dest; + }; + + struct MaterialVertexStreamRouting + { + MaterialStreamRouting data[13]; + IDirect3DVertexDeclaration9 *decl[16]; + }; + + struct MaterialVertexDeclaration { const char *name; - snd_alias_t *head; - int count; + char streamCount; + bool hasOptionalSource; + MaterialVertexStreamRouting routing; }; - enum ZoneAllocFlags + struct GfxVertexShaderLoadDef { - DB_ZONE_CODE_LOC = 0x0, - DB_ZONE_COMMON_LOC = 0x1, - DB_ZONE_CODE = 0x2, - DB_ZONE_COMMON = 0x4, - DB_ZONE_GAME = 0x8, - DB_ZONE_MOD = 0x10, - DB_ZONE_LOAD = 0x20, - DB_ZONE_DEV = 0x40 + unsigned int *program; + unsigned __int16 programSize; + unsigned __int16 loadForRenderer; }; - typedef struct + struct MaterialVertexShaderProgram + { + IDirect3DVertexShader9 *vs; + GfxVertexShaderLoadDef loadDef; + }; + + struct MaterialVertexShader { const char *name; - int allocFlags; - int freeFlags; - } XZoneInfo; - - struct expression_s; - struct statement_s; - struct menuDef_t; - enum operationEnum; - - enum IWI_COMPRESSION - { - IWI_INVALID = 0x0, - IWI_ARGB = 0x1, - IWI_RGB8 = 0x2, - IWI_DXT1 = 0xB, - IWI_DXT3 = 0xC, - IWI_DXT5 = 0xD, + MaterialVertexShaderProgram prog; }; - struct GfxImageFileHeader + struct GfxPixelShaderLoadDef { - char tag[3]; - char version; - int flags; - char format; - short dimensions[3]; - int fileSizeForPicmip[4]; + unsigned int *program; + unsigned __int16 programSize; + unsigned __int16 loadForRenderer; + }; + + struct MaterialPixelShaderProgram + { + IDirect3DPixelShader9 *ps; + GfxPixelShaderLoadDef loadDef; + }; + + struct MaterialPixelShader + { + const char *name; + MaterialPixelShaderProgram prog; + }; + + struct MaterialArgumentCodeConst + { + unsigned __int16 index; + char firstRow; + char rowCount; + }; + + union MaterialArgumentDef + { + const float *literalConst; + MaterialArgumentCodeConst codeConst; + unsigned int codeSampler; + unsigned int nameHash; + }; + + struct MaterialShaderArgument + { + unsigned __int16 type; + unsigned __int16 dest; + MaterialArgumentDef u; + }; + + struct MaterialPass + { + MaterialVertexDeclaration *vertexDecl; + MaterialVertexShader *vertexShader; + MaterialPixelShader *pixelShader; + char perPrimArgCount; + char perObjArgCount; + char stableArgCount; + char customSamplerFlags; + MaterialShaderArgument *args; + }; + + struct MaterialTechnique + { + const char *name; + unsigned __int16 flags; + unsigned __int16 passCount; + MaterialPass passArray[1]; + }; + + struct MaterialTechniqueSet + { + const char *name; + char worldVertFormat; + bool hasBeenUploaded; + char unused[1]; + MaterialTechniqueSet *remappedTechniqueSet; + MaterialTechnique *techniques[48]; }; struct __declspec(align(4)) GfxImageLoadDef { char levelCount; - char flags; - __int16 dimensions[3]; + char pad[3]; + int flags; int format; int resourceSize; char data[1]; }; - enum MapType : char + union GfxTexture { - MAPTYPE_NONE = 0x0, - MAPTYPE_INVALID1 = 0x1, - MAPTYPE_INVALID2 = 0x2, - MAPTYPE_2D = 0x3, - MAPTYPE_3D = 0x4, - MAPTYPE_CUBE = 0x5, - MAPTYPE_COUNT = 0x6, + IDirect3DBaseTexture9 *basemap; + IDirect3DTexture9 *map; + IDirect3DVolumeTexture9 *volmap; + IDirect3DCubeTexture9 *cubemap; + GfxImageLoadDef *loadDef; + }; + + struct Picmip + { + char platform[2]; + }; + + struct CardMemory + { + int platform[2]; }; struct GfxImage { - union - { - GfxImageLoadDef* loadDef; -#ifndef IDA - IDirect3DBaseTexture9 *basemap; - IDirect3DTexture9 *map; - IDirect3DVolumeTexture9 *volmap; - IDirect3DCubeTexture9 *cubemap; -#endif - }; - - MapType mapType; + GfxTexture texture; + char mapType; char semantic; char category; - char flags; - int cardMemory; - int dataLen1; - int dataLen2; - short height; - short width; - short depth; - char loaded; - char pad; - char* name; + bool useSrgbReads; + Picmip picmip; + bool noPicmip; + char track; + CardMemory cardMemory; + unsigned __int16 width; + unsigned __int16 height; + unsigned __int16 depth; + bool delayLoadPixels; + const char *name; }; struct WaterWritable @@ -427,12 +670,10 @@ namespace Game GfxImage *image; }; -#define SEMANTIC_WATER_MAP 11 - union MaterialTextureDefInfo { - GfxImage *image; // MaterialTextureDef->semantic != SEMANTIC_WATER_MAP - water_t *water; // MaterialTextureDef->semantic == SEMANTIC_WATER_MAP + GfxImage *image; + water_t *water; }; struct MaterialTextureDef @@ -440,227 +681,16 @@ namespace Game unsigned int nameHash; char nameStart; char nameEnd; - char sampleState; + char samplerState; char semantic; - MaterialTextureDefInfo info; - }; - - struct GfxShaderConstantBlock - { - unsigned int count; - unsigned __int16 dest[16]; - const float *value[16]; - }; - - struct MaterialArgumentCodeConst - { - unsigned __int16 index; - char firstRow; - char rowCount; - }; - - union MaterialArgumentDef - { - const float *literalConst; - MaterialArgumentCodeConst codeConst; - unsigned int codeSampler; - unsigned int nameHash; - }; - - struct MaterialShaderArgument - { - unsigned __int16 type; - unsigned __int16 dest; - MaterialArgumentDef u; - }; - - struct MaterialStreamRouting - { - char source; - char dest; - }; - - struct MaterialVertexStreamRouting - { - MaterialStreamRouting data[14]; -#ifdef IDA - void -#else - IDirect3DVertexDeclaration9 -#endif - *decl[16]; - }; - - struct MaterialVertexDeclaration - { - const char* name; - char streamCount; - bool hasOptionalSource; - bool isLoaded; - MaterialVertexStreamRouting routing; - }; - - struct GfxPixelShaderLoadDef - { - unsigned int *program; - unsigned __int16 programSize; - unsigned __int16 loadForRenderer; - }; - - struct MaterialPixelShaderProgram - { -#ifdef IDA - void -#else - IDirect3DPixelShader9 -#endif - *ps; - GfxPixelShaderLoadDef loadDef; - }; - - struct MaterialPixelShader - { - const char* name; - MaterialPixelShaderProgram prog; - }; - - struct GfxVertexShaderLoadDef - { - unsigned int *program; - unsigned __int16 programSize; - unsigned __int16 loadForRenderer; - }; - - struct MaterialVertexShaderProgram - { -#ifdef IDA - void -#else - IDirect3DVertexShader9 -#endif - *vs; - GfxVertexShaderLoadDef loadDef; - }; - - struct MaterialVertexShader - { - const char *name; - MaterialVertexShaderProgram prog; - }; - - struct MaterialPass - { - MaterialVertexDeclaration* vertexDecl; - MaterialVertexShader* vertexShader; - MaterialPixelShader* pixelShader; - char perPrimArgCount; - char perObjArgCount; - char stableArgCount; - char customSamplerFlags; - MaterialShaderArgument* args; - }; - - struct MaterialTechnique - { - const char *name; - unsigned __int16 flags; - unsigned __int16 passCount; - MaterialPass passArray[1]; - }; - - enum MaterialTechniqueType - { - TECHNIQUE_DEPTH_PREPASS = 0x0, - TECHNIQUE_BUILD_FLOAT_Z = 0x1, - TECHNIQUE_BUILD_SHADOWMAP_DEPTH = 0x2, - TECHNIQUE_BUILD_SHADOWMAP_COLOR = 0x3, - TECHNIQUE_UNLIT = 0x4, - TECHNIQUE_EMISSIVE = 0x5, - TECHNIQUE_EMISSIVE_DFOG = 0x6, - TECHNIQUE_EMISSIVE_SHADOW = 0x7, - TECHNIQUE_EMISSIVE_SHADOW_DFOG = 0x8, - TECHNIQUE_LIT_BEGIN = 0x9, - TECHNIQUE_LIT = 0x9, - TECHNIQUE_LIT_DFOG = 0xA, - TECHNIQUE_LIT_SUN = 0xB, - TECHNIQUE_LIT_SUN_DFOG = 0xC, - TECHNIQUE_LIT_SUN_SHADOW = 0xD, - TECHNIQUE_LIT_SUN_SHADOW_DFOG = 0xE, - TECHNIQUE_LIT_SPOT = 0xF, - TECHNIQUE_LIT_SPOT_DFOG = 0x10, - TECHNIQUE_LIT_SPOT_SHADOW = 0x11, - TECHNIQUE_LIT_SPOT_SHADOW_DFOG = 0x12, - TECHNIQUE_LIT_OMNI = 0x13, - TECHNIQUE_LIT_OMNI_DFOG = 0x14, - TECHNIQUE_LIT_OMNI_SHADOW = 0x15, - TECHNIQUE_LIT_OMNI_SHADOW_DFOG = 0x16, - TECHNIQUE_LIT_INSTANCED = 0x17, - TECHNIQUE_LIT_INSTANCED_DFOG = 0x18, - TECHNIQUE_LIT_INSTANCED_SUN = 0x19, - TECHNIQUE_LIT_INSTANCED_SUN_DFOG = 0x1A, - TECHNIQUE_LIT_INSTANCED_SUN_SHADOW = 0x1B, - TECHNIQUE_LIT_INSTANCED_SUN_SHADOW_DFOG = 0x1C, - TECHNIQUE_LIT_INSTANCED_SPOT = 0x1D, - TECHNIQUE_LIT_INSTANCED_SPOT_DFOG = 0x1E, - TECHNIQUE_LIT_INSTANCED_SPOT_SHADOW = 0x1F, - TECHNIQUE_LIT_INSTANCED_SPOT_SHADOW_DFOG = 0x20, - TECHNIQUE_LIT_INSTANCED_OMNI = 0x21, - TECHNIQUE_LIT_INSTANCED_OMNI_DFOG = 0x22, - TECHNIQUE_LIT_INSTANCED_OMNI_SHADOW = 0x23, - TECHNIQUE_LIT_INSTANCED_OMNI_SHADOW_DFOG = 0x24, - TECHNIQUE_LIT_END = 0x25, - TECHNIQUE_LIGHT_SPOT = 0x25, - TECHNIQUE_LIGHT_OMNI = 0x26, - TECHNIQUE_LIGHT_SPOT_SHADOW = 0x27, - TECHNIQUE_FAKELIGHT_NORMAL = 0x28, - TECHNIQUE_FAKELIGHT_VIEW = 0x29, - TECHNIQUE_SUNLIGHT_PREVIEW = 0x2A, - TECHNIQUE_CASE_TEXTURE = 0x2B, - TECHNIQUE_WIREFRAME_SOLID = 0x2C, - TECHNIQUE_WIREFRAME_SHADED = 0x2D, - TECHNIQUE_DEBUG_BUMPMAP = 0x2E, - TECHNIQUE_DEBUG_BUMPMAP_INSTANCED = 0x2F, - TECHNIQUE_COUNT = 0x30, - TECHNIQUE_TOTAL_COUNT = 0x31, - TECHNIQUE_NONE = 0x32, - }; - - struct MaterialTechniqueSet - { - const char* name; - char worldVertFormat; - bool hasBeenUploaded; - char unused[1]; - MaterialTechniqueSet* remappedTechniques; - MaterialTechnique* techniques[48]; + MaterialTextureDefInfo u; }; struct MaterialConstantDef { - int nameHash; + unsigned int nameHash; char name[12]; - vec4_t literal; - }; - - struct GfxDrawSurfFields - { - unsigned __int64 objectId : 16; - unsigned __int64 reflectionProbeIndex : 8; - unsigned __int64 hasGfxEntIndex : 1; - unsigned __int64 customIndex : 5; - unsigned __int64 materialSortedIndex : 12; - unsigned __int64 prepass : 2; - unsigned __int64 useHeroLighting : 1; - unsigned __int64 sceneLightIndex : 8; - unsigned __int64 surfType : 4; - unsigned __int64 primarySortKey : 6; - unsigned __int64 unused : 1; - }; - - union GfxDrawSurf - { - GfxDrawSurfFields fields; - unsigned __int64 packed; + float literal[4]; }; struct GfxStateBits @@ -668,27 +698,9 @@ namespace Game unsigned int loadBits[2]; }; - struct infoParm_t - { - const char *name; - int clearSolid; - int surfaceFlags; - int contents; - int toolFlags; - }; - -#pragma pack(push, 4) struct Material { - const char *name; - char gameFlags; - char sortKey; - char textureAtlasRowCount; - char textureAtlasColumnCount; - GfxDrawSurf drawSurf; - int surfaceTypeBits; - unsigned __int16 hashIndex; - unsigned __int16 pad; + MaterialInfo info; char stateBitsEntry[48]; char textureCount; char constantCount; @@ -698,75 +710,1595 @@ namespace Game MaterialTechniqueSet *techniqueSet; MaterialTextureDef *textureTable; MaterialConstantDef *constantTable; - GfxStateBits *stateBitTable; + GfxStateBits *stateBitsTable; }; -#pragma pack(pop) - struct TracerDef + struct XModelLodInfo { - const char * name; - Material * material; - unsigned int drawInterval; - float speed; - float beamLength; - float beamWidth; - float screwRadius; - float screwDist; - float colors[5][4]; + float dist; + unsigned __int16 numsurfs; + unsigned __int16 surfIndex; + XModelSurfs *modelSurfs; + int partBits[6]; + XSurface *surfs; + char lod; + char smcBaseIndexPlusOne; + char smcSubIndexMask; + char smcBucket; }; - struct keyname_t + struct XModelCollTri_s + { + float plane[4]; + float svec[4]; + float tvec[4]; + }; + + struct XModelCollSurf_s + { + XModelCollTri_s *collTris; + int numCollTris; + Bounds bounds; + int boneIdx; + int contents; + int surfFlags; + }; + + struct XBoneInfo + { + Bounds bounds; + float radiusSquared; + }; + + struct XModel { const char *name; - int keynum; + char numBones; + char numRootBones; + char numsurfs; + char lodRampType; + float scale; + unsigned int noScalePartBits[6]; + unsigned __int16 *boneNames; + char *parentList; + __int16 *quats; + float *trans; + char *partClassification; + DObjAnimMat *baseMat; + Material **materialHandles; + XModelLodInfo lodInfo[4]; + char maxLoadedLod; + char numLods; + char collLod; + char flags; + XModelCollSurf_s *collSurfs; + int numCollSurfs; + int contents; + XBoneInfo *boneInfo; + float radius; + Bounds bounds; + int memUsage; + bool bad; + PhysPreset *physPreset; + PhysCollmap *physCollmap; }; - struct ItemFloatExpressionEntry + struct _AILSOUNDINFO { - int target; - const char *s1; - const char *s2; + int format; + const void *data_ptr; + unsigned int data_len; + unsigned int rate; + int bits; + int channels; + unsigned int samples; + unsigned int block_size; + const void *initial_ptr; }; - // Taken from menudefinition.h - enum itemTextStyle + struct MssSound { - ITEM_TEXTSTYLE_NORMAL = 0, // normal text - ITEM_TEXTSTYLE_SHADOWED = 3, // drop shadow ( need a color for this ) - ITEM_TEXTSTYLE_SHADOWEDMORE = 6, // drop shadow ( need a color for this ) - ITEM_TEXTSTYLE_BORDERED = 7, // border (stroke) - ITEM_TEXTSTYLE_BORDEREDMORE = 8, // more border :P - ITEM_TEXTSTYLE_MONOSPACE = 128, - ITEM_TEXTSTYLE_MONOSPACESHADOWED = 132, + _AILSOUNDINFO info; + char *data; }; -#define ITEM_TYPE_TEXT 0 // simple text -#define ITEM_TYPE_BUTTON 1 // button, basically text with a border -#define ITEM_TYPE_RADIOBUTTON 2 // toggle button, may be grouped -#define ITEM_TYPE_CHECKBOX 3 // check box -#define ITEM_TYPE_EDITFIELD 4 // editable text, associated with a dvar -#define ITEM_TYPE_COMBO 5 // drop down list -#define ITEM_TYPE_LISTBOX 6 // scrollable list -#define ITEM_TYPE_MODEL 7 // model -#define ITEM_TYPE_OWNERDRAW 8 // owner draw, name specs what it is -#define ITEM_TYPE_NUMERICFIELD 9 // editable text, associated with a dvar -#define ITEM_TYPE_SLIDER 10 // mouse speed, volume, etc. -#define ITEM_TYPE_YESNO 11 // yes no dvar setting -#define ITEM_TYPE_MULTI 12 // multiple list setting, enumerated -#define ITEM_TYPE_DVARENUM 13 // multiple list setting, enumerated from a dvar -#define ITEM_TYPE_BIND 14 // bind -#define ITEM_TYPE_MENUMODEL 15 // special menu model -#define ITEM_TYPE_VALIDFILEFIELD 16 // text must be valid for use in a dos filename -#define ITEM_TYPE_DECIMALFIELD 17 // editable text, associated with a dvar, which allows decimal input -#define ITEM_TYPE_UPREDITFIELD 18 // editable text, associated with a dvar -#define ITEM_TYPE_GAME_MESSAGE_WINDOW 19 // game message window -#define ITEM_TYPE_NEWSTICKER 20 // horizontal scrollbox -#define ITEM_TYPE_TEXTSCROLL 21 // vertical scrollbox -#define ITEM_TYPE_EMAILFIELD 22 -#define ITEM_TYPE_PASSWORDFIELD 23 + struct LoadedSound + { + const char *name; + MssSound sound; + }; - struct MenuEventHandlerSet; - struct Statement_s; + struct StreamFileNameRaw + { + const char *dir; + const char *name; + }; + + union StreamFileInfo + { + StreamFileNameRaw raw; + }; + + struct StreamFileName + { + StreamFileInfo info; + }; + + struct StreamedSound + { + StreamFileName filename; + }; + + union SoundFileRef + { + LoadedSound *loadSnd; + StreamedSound streamSnd; + }; + + enum snd_alias_type_t + { + SAT_UNKNOWN = 0x0, + SAT_LOADED = 0x1, + SAT_STREAMED = 0x2, + SAT_VOICED = 0x3, + SAT_COUNT = 0x4, + }; + + struct SoundFile + { + char type; + char exists; + SoundFileRef u; + }; + + union $C8D87EB0090687D323381DFB7A82089C + { + float slavePercentage; + float masterPercentage; + }; + + struct SndCurve + { + const char *filename; + unsigned __int16 knotCount; + float knots[16][2]; + }; + + struct MSSSpeakerLevels + { + int speaker; + int numLevels; + float levels[2]; + }; + + struct MSSChannelMap + { + int speakerCount; + MSSSpeakerLevels speakers[6]; + }; + + struct SpeakerMap + { + bool isDefault; + const char *name; + MSSChannelMap channelMaps[2][2]; + }; + + const struct snd_alias_t + { + const char *aliasName; + const char *subtitle; + const char *secondaryAliasName; + const char *chainAliasName; + const char *mixerGroup; + SoundFile *soundFile; + int sequence; + float volMin; + float volMax; + float pitchMin; + float pitchMax; + float distMin; + float distMax; + float velocityMin; + int flags; + $C8D87EB0090687D323381DFB7A82089C ___u15; + float probability; + float lfePercentage; + float centerPercentage; + int startDelay; + SndCurve *volumeFalloffCurve; + float envelopMin; + float envelopMax; + float envelopPercentage; + SpeakerMap *speakerMap; + }; + + struct snd_alias_list_t + { + const char *aliasName; + snd_alias_t *head; + int count; + }; + + struct cStaticModel_s + { + XModel *xmodel; + float origin[3]; + float invScaledAxis[3][3]; + Bounds absBounds; + }; + + struct ClipMaterial + { + const char *name; + int surfaceFlags; + int contents; + }; + + struct cNode_t + { + cplane_s *plane; + __int16 children[2]; + }; + + struct cLeaf_t + { + unsigned __int16 firstCollAabbIndex; + unsigned __int16 collAabbCount; + int brushContents; + int terrainContents; + Bounds bounds; + int leafBrushNode; + }; + + struct cLeafBrushNodeLeaf_t + { + unsigned __int16 *brushes; + }; + + struct cLeafBrushNodeChildren_t + { + float dist; + float range; + unsigned __int16 childOffset[2]; + }; + + union cLeafBrushNodeData_t + { + cLeafBrushNodeLeaf_t leaf; + cLeafBrushNodeChildren_t children; + }; + + struct cLeafBrushNode_s + { + char axis; + __int16 leafBrushCount; + int contents; + cLeafBrushNodeData_t data; + }; + + struct CollisionBorder + { + float distEq[3]; + float zBase; + float zSlope; + float start; + float length; + }; + + struct CollisionPartition + { + char triCount; + char borderCount; + char firstVertSegment; + int firstTri; + CollisionBorder *borders; + }; + + union CollisionAabbTreeIndex + { + int firstChildIndex; + int partitionIndex; + }; + + struct CollisionAabbTree + { + float midPoint[3]; + unsigned __int16 materialIndex; + unsigned __int16 childCount; + float halfSize[3]; + CollisionAabbTreeIndex u; + }; + + struct cmodel_t + { + Bounds bounds; + float radius; + cLeaf_t leaf; + }; + + struct TriggerModel + { + int contents; + unsigned __int16 hullCount; + unsigned __int16 firstHull; + }; + + struct TriggerHull + { + Bounds bounds; + int contents; + unsigned __int16 slabCount; + unsigned __int16 firstSlab; + }; + + struct TriggerSlab + { + float dir[3]; + float midPoint; + float halfSize; + }; + + struct MapTriggers + { + unsigned int count; + TriggerModel *models; + unsigned int hullCount; + TriggerHull *hulls; + unsigned int slabCount; + TriggerSlab *slabs; + }; + + struct /*__declspec(align(2))*/ Stage + { + const char *name; + float origin[3]; + unsigned __int16 triggerIndex; + char sunPrimaryLightIndex; + }; + + struct __declspec(align(4)) MapEnts + { + const char *name; + char *entityString; + int numEntityChars; + MapTriggers trigger; + Stage *stages; + char stageCount; + }; + + struct SModelAabbNode + { + Bounds bounds; + unsigned __int16 firstChild; + unsigned __int16 childCount; + }; + + enum DynEntityType + { + DYNENT_TYPE_INVALID = 0x0, + DYNENT_TYPE_CLUTTER = 0x1, + DYNENT_TYPE_DESTRUCT = 0x2, + DYNENT_TYPE_COUNT = 0x3, + }; + + struct GfxPlacement + { + float quat[4]; + float origin[3]; + }; + + struct FxSpawnDefLooping + { + int intervalMsec; + int count; + }; + + struct FxIntRange + { + int base; + int amplitude; + }; + + struct FxSpawnDefOneShot + { + FxIntRange count; + }; + + union FxSpawnDef + { + FxSpawnDefLooping looping; + FxSpawnDefOneShot oneShot; + }; + + struct FxFloatRange + { + float base; + float amplitude; + }; + + struct FxElemAtlas + { + char behavior; + char index; + char fps; + char loopCount; + char colIndexBits; + char rowIndexBits; + __int16 entryCount; + }; + + struct FxElemVec3Range + { + float base[3]; + float amplitude[3]; + }; + + struct FxElemVelStateInFrame + { + FxElemVec3Range velocity; + FxElemVec3Range totalDelta; + }; + + const struct FxElemVelStateSample + { + FxElemVelStateInFrame local; + FxElemVelStateInFrame world; + }; + + struct FxElemVisualState + { + char color[4]; + float rotationDelta; + float rotationTotal; + float size[2]; + float scale; + }; + + const struct FxElemVisStateSample + { + FxElemVisualState base; + FxElemVisualState amplitude; + }; + + struct FxElemMarkVisuals + { + Material *materials[2]; + }; + + union FxEffectDefRef + { + FxEffectDef *handle; + const char *name; + }; + + union FxElemVisuals + { + const void *anonymous; + Material *material; + XModel *model; + FxEffectDefRef effectDef; + const char *soundName; + }; + + union FxElemDefVisuals + { + FxElemMarkVisuals *markArray; + FxElemVisuals *array; + FxElemVisuals instance; + }; + + struct FxTrailVertex + { + float pos[2]; + float normal[2]; + float texCoord; + }; + + struct FxTrailDef + { + int scrollTimeMsec; + int repeatDist; + float invSplitDist; + float invSplitArcDist; + float invSplitTime; + int vertCount; + FxTrailVertex *verts; + int indCount; + unsigned __int16 *inds; + }; + + struct FxSparkFountainDef + { + float gravity; + float bounceFrac; + float bounceRand; + float sparkSpacing; + float sparkLength; + int sparkCount; + float loopTime; + float velMin; + float velMax; + float velConeFrac; + float restSpeed; + float boostTime; + float boostFactor; + }; + + union FxElemExtendedDefPtr + { + FxTrailDef *trailDef; + FxSparkFountainDef *sparkFountainDef; + void *unknownDef; + }; + + const struct FxElemDef + { + int flags; + FxSpawnDef spawn; + FxFloatRange spawnRange; + FxFloatRange fadeInRange; + FxFloatRange fadeOutRange; + float spawnFrustumCullRadius; + FxIntRange spawnDelayMsec; + FxIntRange lifeSpanMsec; + FxFloatRange spawnOrigin[3]; + FxFloatRange spawnOffsetRadius; + FxFloatRange spawnOffsetHeight; + FxFloatRange spawnAngles[3]; + FxFloatRange angularVelocity[3]; + FxFloatRange initialRotation; + FxFloatRange gravity; + FxFloatRange reflectionFactor; + FxElemAtlas atlas; + char elemType; + char visualCount; + char velIntervalCount; + char visStateIntervalCount; + FxElemVelStateSample *velSamples; + FxElemVisStateSample *visSamples; + FxElemDefVisuals visuals; + Bounds collBounds; + FxEffectDefRef effectOnImpact; + FxEffectDefRef effectOnDeath; + FxEffectDefRef effectEmitted; + FxFloatRange emitDist; + FxFloatRange emitDistVariance; + FxElemExtendedDefPtr extended; + char sortOrder; + char lightingFrac; + char useItemClip; + char fadeInfo; + }; + + struct FxEffectDef + { + const char *name; + int flags; + int totalSize; + int msecLoopingLife; + int elemDefCountLooping; + int elemDefCountOneShot; + int elemDefCountEmission; + FxElemDef *elemDefs; + }; + + struct DynEntityDef + { + DynEntityType type; + GfxPlacement pose; + XModel *xModel; + unsigned __int16 brushModel; + unsigned __int16 physicsBrushModel; + FxEffectDef *destroyFx; + PhysPreset *physPreset; + int health; + PhysMass mass; + int contents; + }; + + struct DynEntityPose + { + GfxPlacement pose; + float radius; + }; + + struct DynEntityClient + { + int physObjId; + unsigned __int16 flags; + unsigned __int16 lightingHandle; + int health; + }; + + struct DynEntityColl + { + unsigned __int16 sector; + unsigned __int16 nextEntInSector; + float linkMins[2]; + float linkMaxs[2]; + }; + +#pragma warning(push) +#pragma warning(disable: 4324) + struct __declspec(align(64)) clipMap_t + { + const char *name; + int isInUse; + int planeCount; + cplane_s *planes; + unsigned int numStaticModels; + cStaticModel_s *staticModelList; + unsigned int numMaterials; + ClipMaterial *materials; + unsigned int numBrushSides; + cbrushside_t *brushsides; + unsigned int numBrushEdges; + char *brushEdges; + unsigned int numNodes; + cNode_t *nodes; + unsigned int numLeafs; + cLeaf_t *leafs; + unsigned int leafbrushNodesCount; + cLeafBrushNode_s *leafbrushNodes; + unsigned int numLeafBrushes; + unsigned __int16 *leafbrushes; + unsigned int numLeafSurfaces; + unsigned int *leafsurfaces; + unsigned int vertCount; + float(*verts)[3]; + int triCount; + unsigned __int16 *triIndices; + char *triEdgeIsWalkable; + int borderCount; + CollisionBorder *borders; + int partitionCount; + CollisionPartition *partitions; + int aabbTreeCount; + CollisionAabbTree *aabbTrees; + unsigned int numSubModels; + cmodel_t *cmodels; + unsigned __int16 numBrushes; + cbrush_t *brushes; + Bounds *brushBounds; + int *brushContents; + MapEnts *mapEnts; + unsigned __int16 smodelNodeCount; + SModelAabbNode *smodelNodes; + unsigned __int16 dynEntCount[2]; + DynEntityDef *dynEntDefList[2]; + DynEntityPose *dynEntPoseList[2]; + DynEntityClient *dynEntClientList[2]; + DynEntityColl *dynEntCollList[2]; + unsigned int checksum; + }; +#pragma warning(pop) + + struct ComPrimaryLight + { + char type; + char canUseShadowMap; + char exponent; + char unused; + float color[3]; + float dir[3]; + float origin[3]; + float radius; + float cosHalfFovOuter; + float cosHalfFovInner; + float cosHalfFovExpanded; + float rotationLimit; + float translationLimit; + const char *defName; + }; + + struct ComWorld + { + const char *name; + int isInUse; + unsigned int primaryLightCount; + ComPrimaryLight *primaryLights; + }; + + enum nodeType + { + NODE_ERROR = 0x0, + NODE_PATHNODE = 0x1, + NODE_COVER_STAND = 0x2, + NODE_COVER_CROUCH = 0x3, + NODE_COVER_CROUCH_WINDOW = 0x4, + NODE_COVER_PRONE = 0x5, + NODE_COVER_RIGHT = 0x6, + NODE_COVER_LEFT = 0x7, + NODE_AMBUSH = 0x8, + NODE_EXPOSED = 0x9, + NODE_CONCEALMENT_STAND = 0xA, + NODE_CONCEALMENT_CROUCH = 0xB, + NODE_CONCEALMENT_PRONE = 0xC, + NODE_DOOR = 0xD, + NODE_DOOR_INTERIOR = 0xE, + NODE_SCRIPTED = 0xF, + NODE_NEGOTIATION_BEGIN = 0x10, + NODE_NEGOTIATION_END = 0x11, + NODE_TURRET = 0x12, + NODE_GUARD = 0x13, + NODE_NUMTYPES = 0x14, + NODE_DONTLINK = 0x14, + }; + + enum PathNodeErrorCode + { + PNERR_NONE = 0x0, + PNERR_INSOLID = 0x1, + PNERR_FLOATING = 0x2, + PNERR_NOLINK = 0x3, + PNERR_DUPLICATE = 0x4, + PNERR_NOSTANCE = 0x5, + PNERR_INVALIDDOOR = 0x6, + PNERR_NOANGLES = 0x7, + PNERR_BADPLACEMENT = 0x8, + NUM_PATH_NODE_ERRORS = 0x9, + }; + + union $23305223CFD097B6F79557BDD2047E6C + { + float minUseDistSq; + PathNodeErrorCode error; + }; + + struct pathlink_s + { + float fDist; + unsigned __int16 nodeNum; + char disconnectCount; + char negotiationLink; + char flags; + char ubBadPlaceCount[3]; + }; + + struct pathnode_constant_t + { + nodeType type; + unsigned __int16 spawnflags; + unsigned __int16 targetname; + unsigned __int16 script_linkName; + unsigned __int16 script_noteworthy; + unsigned __int16 target; + unsigned __int16 animscript; + int animscriptfunc; + float vOrigin[3]; + float fAngle; + float forward[2]; + float fRadius; + $23305223CFD097B6F79557BDD2047E6C ___u12; + __int16 wOverlapNode[2]; + unsigned __int16 totalLinkCount; + pathlink_s *Links; + }; + + struct pathnode_dynamic_t + { + void *pOwner; + int iFreeTime; + int iValidTime[3]; + int dangerousNodeTime[3]; + int inPlayerLOSTime; + __int16 wLinkCount; + __int16 wOverlapCount; + __int16 turretEntNumber; + char userCount; + bool hasBadPlaceLink; + }; + + union $73F238679C0419BE2C31C6559E8604FC + { + float nodeCost; + int linkIndex; + }; + + struct pathnode_transient_t + { + int iSearchFrame; + pathnode_t *pNextOpen; + pathnode_t *pPrevOpen; + pathnode_t *pParent; + float fCost; + float fHeuristic; + $73F238679C0419BE2C31C6559E8604FC ___u6; + }; + + struct pathnode_t + { + pathnode_constant_t constant; + pathnode_dynamic_t dynamic; + pathnode_transient_t transient; + }; + + struct pathbasenode_t + { + float vOrigin[3]; + unsigned int type; + }; + + struct pathnode_tree_nodes_t + { + int nodeCount; + unsigned __int16 *nodes; + }; + + union pathnode_tree_info_t + { + pathnode_tree_t *child[2]; + pathnode_tree_nodes_t s; + }; + + struct pathnode_tree_t + { + int axis; + float dist; + pathnode_tree_info_t u; + }; + + struct PathData + { + unsigned int nodeCount; + pathnode_t *nodes; + pathbasenode_t *basenodes; + unsigned int chainNodeCount; + unsigned __int16 *chainNodeForNode; + unsigned __int16 *nodeForChainNode; + int visBytes; + char *pathVis; + int nodeTreeCount; + pathnode_tree_t *nodeTree; + }; + + struct VehicleTrackObstacle + { + float origin[2]; + float radius; + }; + + struct VehicleTrackSector + { + float startEdgeDir[2]; + float startEdgeDist; + float leftEdgeDir[2]; + float leftEdgeDist; + float rightEdgeDir[2]; + float rightEdgeDist; + float sectorLength; + float sectorWidth; + float totalPriorLength; + float totalFollowingLength; + VehicleTrackObstacle *obstacles; + unsigned int obstacleCount; + }; + + struct VehicleTrackSegment + { + const char *targetName; + VehicleTrackSector *sectors; + unsigned int sectorCount; + VehicleTrackSegment **nextBranches; + unsigned int nextBranchesCount; + VehicleTrackSegment **prevBranches; + unsigned int prevBranchesCount; + float endEdgeDir[2]; + float endEdgeDist; + float totalLength; + }; + + struct VehicleTrack + { + VehicleTrackSegment *segments; + unsigned int segmentCount; + }; + + struct /*__declspec(align(2))*/ G_GlassPiece + { + unsigned __int16 damageTaken; + unsigned __int16 collapseTime; + int lastStateChangeTime; + char impactDir; + char impactPos[2]; + }; + + struct G_GlassName + { + char *nameStr; + unsigned __int16 name; + unsigned __int16 pieceCount; + unsigned __int16 *pieceIndices; + }; + + struct G_GlassData + { + G_GlassPiece *glassPieces; + unsigned int pieceCount; + unsigned __int16 damageToWeaken; + unsigned __int16 damageToDestroy; + unsigned int glassNameCount; + G_GlassName *glassNames; + char pad[108]; + }; + + struct GameWorldSp + { + const char *name; + PathData path; + VehicleTrack vehicleTrack; + G_GlassData *g_glassData; + }; + + struct GameWorldMp + { + const char *name; + G_GlassData *g_glassData; + }; + + struct FxGlassDef + { + float halfThickness; + float texVecs[2][2]; + GfxColor color; + Material *material; + Material *materialShattered; + PhysPreset *physPreset; + }; + + struct FxSpatialFrame + { + float quat[4]; + float origin[3]; + }; + + struct $E43DBA5037697D705289B74D87E76C70 + { + FxSpatialFrame frame; + float radius; + }; + + union FxGlassPiecePlace + { + $E43DBA5037697D705289B74D87E76C70 __s0; + unsigned int nextFree; + }; + + struct FxGlassPieceState + { + float texCoordOrigin[2]; + unsigned int supportMask; + unsigned __int16 initIndex; + unsigned __int16 geoDataStart; + char defIndex; + char pad[5]; + char vertCount; + char holeDataCount; + char crackDataCount; + char fanDataCount; + unsigned __int16 flags; + float areaX2; + }; + + struct FxGlassPieceDynamics + { + int fallTime; + int physObjId; + int physJointId; + float vel[3]; + float avel[3]; + }; + + struct FxGlassVertex + { + __int16 x; + __int16 y; + }; + + struct FxGlassHoleHeader + { + unsigned __int16 uniqueVertCount; + char touchVert; + char pad[1]; + }; + + struct FxGlassCrackHeader + { + unsigned __int16 uniqueVertCount; + char beginVertIndex; + char endVertIndex; + }; + + union FxGlassGeometryData + { + FxGlassVertex vert; + FxGlassHoleHeader hole; + FxGlassCrackHeader crack; + char asBytes[4]; + __int16 anonymous[2]; + }; + + struct FxGlassInitPieceState + { + FxSpatialFrame frame; + float radius; + float texCoordOrigin[2]; + unsigned int supportMask; + float areaX2; + char defIndex; + char vertCount; + char fanDataCount; + char pad[1]; + }; + + struct FxGlassSystem + { + int time; + int prevTime; + unsigned int defCount; + unsigned int pieceLimit; + unsigned int pieceWordCount; + unsigned int initPieceCount; + unsigned int cellCount; + unsigned int activePieceCount; + unsigned int firstFreePiece; + unsigned int geoDataLimit; + unsigned int geoDataCount; + unsigned int initGeoDataCount; + FxGlassDef *defs; + FxGlassPiecePlace *piecePlaces; + FxGlassPieceState *pieceStates; + FxGlassPieceDynamics *pieceDynamics; + FxGlassGeometryData *geoData; + unsigned int *isInUse; + unsigned int *cellBits; + char *visData; + float(*linkOrg)[3]; + float *halfThickness; + unsigned __int16 *lightingHandles; + FxGlassInitPieceState *initPieceStates; + FxGlassGeometryData *initGeoData; + bool needToCompactData; + char initCount; + float effectChanceAccum; + int lastPieceDeletionTime; + }; + + struct FxWorld + { + const char *name; + FxGlassSystem glassSys; + }; + + struct __declspec(align(4)) GfxSky + { + int skySurfCount; + int *skyStartSurfs; + GfxImage *skyImage; + char skySamplerState; + }; + + struct GfxWorldDpvsPlanes + { + int cellCount; + cplane_s *planes; + unsigned __int16 *nodes; + unsigned int *sceneEntCellBits; + }; + + struct GfxCellTreeCount + { + int aabbTreeCount; + }; + + struct GfxAabbTree + { + Bounds bounds; + unsigned __int16 childCount; + unsigned __int16 surfaceCount; + unsigned __int16 startSurfIndex; + unsigned __int16 surfaceCountNoDecal; + unsigned __int16 startSurfIndexNoDecal; + unsigned __int16 smodelIndexCount; + unsigned __int16 *smodelIndexes; + int childrenOffset; + }; + + struct GfxCellTree + { + GfxAabbTree *aabbTree; + }; + + struct GfxPortalWritable + { + bool isQueued; + bool isAncestor; + char recursionDepth; + char hullPointCount; + float(*hullPoints)[2]; + GfxPortal *queuedParent; + }; + + struct DpvsPlane + { + float coeffs[4]; + }; + + struct GfxPortal + { + GfxPortalWritable writable; + DpvsPlane plane; + float(*vertices)[3]; + unsigned __int16 cellIndex; + char vertexCount; + float hullAxis[2][3]; + }; + + struct GfxCell + { + Bounds bounds; + int portalCount; + GfxPortal *portals; + char reflectionProbeCount; + char *reflectionProbes; + }; + + struct GfxReflectionProbe + { + float origin[3]; + }; + + struct GfxLightmapArray + { + GfxImage *primary; + GfxImage *secondary; + }; + + struct GfxWorldVertex + { + float xyz[3]; + float binormalSign; + GfxColor color; + float texCoord[2]; + float lmapCoord[2]; + PackedUnitVec normal; + PackedUnitVec tangent; + }; + + struct GfxWorldVertexData + { + GfxWorldVertex *vertices; + IDirect3DVertexBuffer9 *worldVb; + }; + + struct GfxWorldVertexLayerData + { + char *data; + IDirect3DVertexBuffer9 *layerVb; + }; + + struct GfxWorldDraw + { + unsigned int reflectionProbeCount; + GfxImage **reflectionProbes; + GfxReflectionProbe *reflectionProbeOrigins; + GfxTexture *reflectionProbeTextures; + int lightmapCount; + GfxLightmapArray *lightmaps; + GfxTexture *lightmapPrimaryTextures; + GfxTexture *lightmapSecondaryTextures; + GfxImage *lightmapOverridePrimary; + GfxImage *lightmapOverrideSecondary; + unsigned int vertexCount; + GfxWorldVertexData vd; + unsigned int vertexLayerDataSize; + GfxWorldVertexLayerData vld; + unsigned int indexCount; + unsigned __int16 *indices; + }; + + struct GfxLightGridEntry + { + unsigned __int16 colorsIndex; + char primaryLightIndex; + char needsTrace; + }; + + struct GfxLightGridColors + { + char rgb[56][3]; + }; + + struct GfxLightGrid + { + bool hasLightRegions; + unsigned int lastSunPrimaryLightIndex; + unsigned __int16 mins[3]; + unsigned __int16 maxs[3]; + unsigned int rowAxis; + unsigned int colAxis; + unsigned __int16 *rowDataStart; + unsigned int rawRowDataSize; + char *rawRowData; + unsigned int entryCount; + GfxLightGridEntry *entries; + unsigned int colorCount; + GfxLightGridColors *colors; + }; + + struct GfxBrushModelWritable + { + Bounds bounds; + }; + + struct __declspec(align(4)) GfxBrushModel + { + GfxBrushModelWritable writable; + Bounds bounds; + float radius; + unsigned __int16 surfaceCount; + unsigned __int16 startSurfIndex; + unsigned __int16 surfaceCountNoDecal; + }; + + struct MaterialMemory + { + Material *material; + int memory; + }; + + struct sunflare_t + { + bool hasValidData; + Material *spriteMaterial; + Material *flareMaterial; + float spriteSize; + float flareMinSize; + float flareMinDot; + float flareMaxSize; + float flareMaxDot; + float flareMaxAlpha; + int flareFadeInTime; + int flareFadeOutTime; + float blindMinDot; + float blindMaxDot; + float blindMaxDarken; + int blindFadeInTime; + int blindFadeOutTime; + float glareMinDot; + float glareMaxDot; + float glareMaxLighten; + int glareFadeInTime; + int glareFadeOutTime; + float sunFxPosition[3]; + }; + + struct XModelDrawInfo + { + char hasGfxEntIndex; + char lod; + unsigned __int16 surfId; + }; + + struct GfxSceneDynModel + { + XModelDrawInfo info; + unsigned __int16 dynEntId; + }; + + struct BModelDrawInfo + { + unsigned __int16 surfId; + }; + + struct GfxSceneDynBrush + { + BModelDrawInfo info; + unsigned __int16 dynEntId; + }; + + struct GfxShadowGeometry + { + unsigned __int16 surfaceCount; + unsigned __int16 smodelCount; + unsigned __int16 *sortedSurfIndex; + unsigned __int16 *smodelIndex; + }; + + struct GfxLightRegionAxis + { + float dir[3]; + float midPoint; + float halfSize; + }; + + struct GfxLightRegionHull + { + float kdopMidPoint[9]; + float kdopHalfSize[9]; + unsigned int axisCount; + GfxLightRegionAxis *axis; + }; + + struct GfxLightRegion + { + unsigned int hullCount; + GfxLightRegionHull *hulls; + }; + + struct GfxStaticModelInst + { + Bounds bounds; + float lightingOrigin[3]; + }; + + struct srfTriangles_t + { + unsigned int vertexLayerData; + unsigned int firstVertex; + unsigned __int16 vertexCount; + unsigned __int16 triCount; + unsigned int baseIndex; + }; + + struct GfxSurfaceLightingAndFlagsFields + { + char lightmapIndex; + char reflectionProbeIndex; + char primaryLightIndex; + char flags; + }; + + union GfxSurfaceLightingAndFlags + { + GfxSurfaceLightingAndFlagsFields fields; + unsigned int packed; + }; + + struct GfxSurface + { + srfTriangles_t tris; + Material *material; + GfxSurfaceLightingAndFlags laf; + }; + + struct GfxSurfaceBounds + { + Bounds bounds; + }; + + struct GfxPackedPlacement + { + float origin[3]; + float axis[3][3]; + float scale; + }; + + struct GfxStaticModelDrawInst + { + GfxPackedPlacement placement; + XModel *model; + unsigned __int16 cullDist; + unsigned __int16 lightingHandle; + char reflectionProbeIndex; + char primaryLightIndex; + char flags; + char firstMtlSkinIndex; + GfxColor groundLighting; + unsigned __int16 cacheId[4]; + }; + + struct GfxWorldDpvsStatic + { + unsigned int smodelCount; + unsigned int staticSurfaceCount; + unsigned int staticSurfaceCountNoDecal; + unsigned int litOpaqueSurfsBegin; + unsigned int litOpaqueSurfsEnd; + unsigned int litTransSurfsBegin; + unsigned int litTransSurfsEnd; + unsigned int shadowCasterSurfsBegin; + unsigned int shadowCasterSurfsEnd; + unsigned int emissiveSurfsBegin; + unsigned int emissiveSurfsEnd; + unsigned int smodelVisDataCount; + unsigned int surfaceVisDataCount; + char *smodelVisData[3]; + char *surfaceVisData[3]; + unsigned __int16 *sortedSurfIndex; + GfxStaticModelInst *smodelInsts; + GfxSurface *surfaces; + GfxSurfaceBounds *surfacesBounds; + GfxStaticModelDrawInst *smodelDrawInsts; + GfxDrawSurf *surfaceMaterials; + unsigned int *surfaceCastsSunShadow; + volatile int usageCount; + }; + + struct GfxWorldDpvsDynamic + { + unsigned int dynEntClientWordCount[2]; + unsigned int dynEntClientCount[2]; + unsigned int *dynEntCellBits[2]; + char *dynEntVisData[2][3]; + }; + + struct GfxHeroOnlyLight + { + char type; + char unused[3]; + float color[3]; + float dir[3]; + float origin[3]; + float radius; + float cosHalfFovOuter; + float cosHalfFovInner; + int exponent; + }; + + struct __declspec(align(4)) GfxWorld + { + const char *name; + const char *baseName; + int planeCount; + int nodeCount; + unsigned int surfaceCount; + int skyCount; + GfxSky *skies; + unsigned int lastSunPrimaryLightIndex; + unsigned int primaryLightCount; + unsigned int sortKeyLitDecal; + unsigned int sortKeyEffectDecal; + unsigned int sortKeyEffectAuto; + unsigned int sortKeyDistortion; + GfxWorldDpvsPlanes dpvsPlanes; + GfxCellTreeCount *aabbTreeCounts; + GfxCellTree *aabbTrees; + GfxCell *cells; + GfxWorldDraw draw; + GfxLightGrid lightGrid; + int modelCount; + GfxBrushModel *models; + Bounds bounds; + unsigned int checksum; + int materialMemoryCount; + MaterialMemory *materialMemory; + sunflare_t sun; + float outdoorLookupMatrix[4][4]; + GfxImage *outdoorImage; + unsigned int *cellCasterBits; + unsigned int *cellHasSunLitSurfsBits; + GfxSceneDynModel *sceneDynModel; + GfxSceneDynBrush *sceneDynBrush; + unsigned int *primaryLightEntityShadowVis; + unsigned int *primaryLightDynEntShadowVis[2]; + char *nonSunPrimaryLightForModelDynEnt; + GfxShadowGeometry *shadowGeom; + GfxLightRegion *lightRegion; + GfxWorldDpvsStatic dpvs; + GfxWorldDpvsDynamic dpvsDyn; + unsigned int mapVtxChecksum; + unsigned int heroOnlyLightCount; + GfxHeroOnlyLight *heroOnlyLights; + char fogTypesAllowed; + }; + + struct __declspec(align(4)) GfxLightImage + { + GfxImage *image; + char samplerState; + }; + + struct GfxLightDef + { + const char *name; + GfxLightImage attenuation; + int lmapLookupStart; + }; + + struct Glyph + { + unsigned __int16 letter; + char x0; + char y0; + char dx; + char pixelWidth; + char pixelHeight; + float s0; + float t0; + float s1; + float t1; + }; + + struct Font_s + { + const char *fontName; + int pixelHeight; + int glyphCount; + Material *material; + Material *glowMaterial; + Glyph *glyphs; + }; + + struct __declspec(align(4)) rectDef_s + { + float x; + float y; + float w; + float h; + char horzAlign; + char vertAlign; + }; + + struct windowDef_t + { + const char *name; + rectDef_s rect; + rectDef_s rectClient; + const char *group; + int style; + int border; + int ownerDraw; + int ownerDrawFlags; + float borderSize; + int staticFlags; + int dynamicFlags[1]; + int nextTime; + float foreColor[4]; + float backColor[4]; + float borderColor[4]; + float outlineColor[4]; + float disableColor[4]; + Material *background; + }; + + enum expDataType + { + VAL_INT = 0x0, + VAL_FLOAT = 0x1, + VAL_STRING = 0x2, + NUM_INTERNAL_DATATYPES = 0x3, + VAL_FUNCTION = 0x3, + NUM_DATATYPES = 0x4, + }; + + struct ExpressionString + { + const char *string; + }; + + union operandInternalDataUnion + { + int intVal; + float floatVal; + ExpressionString stringVal; + Statement_s *function; + }; + + struct Operand + { + expDataType dataType; + operandInternalDataUnion internals; + }; + + // This enum is unknown + enum operationEnum + { + BLUB + }; + + union entryInternalData + { + operationEnum op; + Operand operand; + }; + + struct expressionEntry + { + int type; + entryInternalData data; + }; struct UIFunctionList { @@ -774,10 +2306,61 @@ namespace Game Statement_s **functions; }; + union DvarValue + { + bool enabled; + int integer; + unsigned int unsignedInt; + float value; + float vector[4]; + const char *string; + char color[4]; + }; + + struct $BFBB53559BEAC4289F32B924847E59CB + { + int stringCount; + const char **strings; + }; + + struct $9CA192F9DB66A3CB7E01DE78A0DEA53D + { + int min; + int max; + }; + + struct $251C2428A496074035CACA7AAF3D55BD + { + float min; + float max; + }; + + union DvarLimits + { + $BFBB53559BEAC4289F32B924847E59CB enumeration; + $9CA192F9DB66A3CB7E01DE78A0DEA53D integer; + $251C2428A496074035CACA7AAF3D55BD value; + $251C2428A496074035CACA7AAF3D55BD vector; + }; + + struct dvar_t + { + const char *name; + const char *description; + unsigned int flags; + char type; + bool modified; + DvarValue current; + DvarValue latched; + DvarValue reset; + DvarLimits domain; + bool(__cdecl *domainFunc)(dvar_t *, DvarValue); + dvar_t *hashNext; + }; + struct StaticDvar { - /*dvar_t*/ - void *dvar; + dvar_t *dvar; char *dvarName; }; @@ -800,55 +2383,19 @@ namespace Game StringList uiStrings; }; - enum expDataType : int - { - VAL_INT = 0x0, - VAL_FLOAT = 0x1, - VAL_STRING = 0x2, - VAL_FUNCTION = 0x3, - }; - - struct ExpressionString - { - const char *string; - }; - - union operandInternalDataUnion - { - int intVal; - float floatVal; - ExpressionString stringVal; - Statement_s *function; - }; - - struct Operand - { - expDataType dataType; - operandInternalDataUnion internals; - }; - - union entryInternalData - { - //operationEnum op; - Operand operand; - }; - - /* expressionEntry->type */ -#define OPERATOR 0 -#define OPERAND 1 - - struct expressionEntry // 0xC - { - int type; - entryInternalData data; - }; - - struct Statement_s // 0x18 + struct Statement_s { int numEntries; expressionEntry *entries; ExpressionSupportingData *supportingData; - char unknown[0xC]; // ? + int lastExecuteTime; + Operand lastResult; + }; + + struct ConditionalScript + { + MenuEventHandlerSet *eventHandlerSet; + Statement_s *eventExpression; }; struct SetLocalVarData @@ -857,12 +2404,6 @@ namespace Game Statement_s *expression; }; - struct ConditionalScript - { - MenuEventHandlerSet *eventHandlerSet; - Statement_s *eventExpression; // loads this first - }; - union EventData { const char *unconditionalScript; @@ -871,22 +2412,10 @@ namespace Game SetLocalVarData *setLocalVarData; }; - enum EventType - { - EVENT_UNCONDITIONAL = 0x0, - EVENT_IF = 0x1, - EVENT_ELSE = 0x2, - EVENT_SET_LOCAL_VAR_BOOL = 0x3, - EVENT_SET_LOCAL_VAR_INT = 0x4, - EVENT_SET_LOCAL_VAR_FLOAT = 0x5, - EVENT_SET_LOCAL_VAR_STRING = 0x6, - EVENT_COUNT = 0x7, - }; - - struct MenuEventHandler + struct __declspec(align(4)) MenuEventHandler { EventData eventData; - EventType eventType; + char eventType; }; struct MenuEventHandlerSet @@ -902,94 +2431,31 @@ namespace Game ItemKeyHandler *next; }; -#pragma pack(push, 4) - struct rectDef_s + struct columnInfo_s { - float x; - float y; - float w; - float h; - char horzAlign; - char vertAlign; - }; -#pragma pack(pop) - - /* windowDef_t->dynamicFlags */ - // 0x1 -#define WINDOWDYNAMIC_HASFOCUS 0x00000002 -#define WINDOWDYNAMIC_VISIBLE 0x00000004 -#define WINDOWDYNAMIC_FADEOUT 0x00000010 -#define WINDOWDYNAMIC_FADEIN 0x00000020 - // 0x40 - // 0x80 -#define WINDOWDYNAMIC_CLOSED 0x00000800 - // 0x2000 -#define WINDOWDYNAMIC_BACKCOLOR 0x00008000 -#define WINDOWDYNAMIC_FORECOLOR 0x00010000 - - /* windowDef_t->staticFlags */ -#define WINDOWSTATIC_DECORATION 0x00100000 -#define WINDOWSTATIC_HORIZONTALSCROLL 0x00200000 -#define WINDOWSTATIC_SCREENSPACE 0x00400000 -#define WINDOWSTATIC_AUTOWRAPPED 0x00800000 -#define WINDOWSTATIC_POPUP 0x01000000 -#define WINDOWSTATIC_OUTOFBOUNDSCLICK 0x02000000 -#define WINDOWSTATIC_LEGACYSPLITSCREENSCALE 0x04000000 -#define WINDOWSTATIC_HIDDENDURINGFLASH 0x10000000 -#define WINDOWSTATIC_HIDDENDURINGSCOPE 0x20000000 -#define WINDOWSTATIC_HIDDENDURINGUI 0x40000000 -#define WINDOWSTATIC_TEXTONLYFOCUS 0x80000000 - - struct windowDef_t // 0xA4 - { - const char *name; // 0x00 - rectDef_s rect; - rectDef_s rectClient; - char *group; // 0x2C - int style; // 0x30 - int border; // 0x34 - int ownerDraw; // 0x38 - int ownerDrawFlags; // 0x3C - float borderSize; // 0x40 - int staticFlags; // 0x44 - int dynamicFlags; // 0x48 - int nextTime; // 0x4C - float foreColor[4]; // 0x50 - float backColor[4]; // 0x60 - float borderColor[4];// 0x70 - float outlineColor[4];// 0x80 - float disableColor[4];// 0x90 - Material *background; // 0xA0 + int pos; + int width; + int maxChars; + int alignment; }; - enum ItemFloatExpressionTarget + struct listBoxDef_s { - ITEM_FLOATEXP_TGT_RECT_X = 0x0, - ITEM_FLOATEXP_TGT_RECT_Y = 0x1, - ITEM_FLOATEXP_TGT_RECT_W = 0x2, - ITEM_FLOATEXP_TGT_RECT_H = 0x3, - ITEM_FLOATEXP_TGT_FORECOLOR_R = 0x4, - ITEM_FLOATEXP_TGT_FORECOLOR_G = 0x5, - ITEM_FLOATEXP_TGT_FORECOLOR_B = 0x6, - ITEM_FLOATEXP_TGT_FORECOLOR_RGB = 0x7, - ITEM_FLOATEXP_TGT_FORECOLOR_A = 0x8, - ITEM_FLOATEXP_TGT_GLOWCOLOR_R = 0x9, - ITEM_FLOATEXP_TGT_GLOWCOLOR_G = 0xA, - ITEM_FLOATEXP_TGT_GLOWCOLOR_B = 0xB, - ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB = 0xC, - ITEM_FLOATEXP_TGT_GLOWCOLOR_A = 0xD, - ITEM_FLOATEXP_TGT_BACKCOLOR_R = 0xE, - ITEM_FLOATEXP_TGT_BACKCOLOR_G = 0xF, - ITEM_FLOATEXP_TGT_BACKCOLOR_B = 0x10, - ITEM_FLOATEXP_TGT_BACKCOLOR_RGB = 0x11, - ITEM_FLOATEXP_TGT_BACKCOLOR_A = 0x12, - ITEM_FLOATEXP_TGT__COUNT = 0x13, - }; - - struct ItemFloatExpression - { - ItemFloatExpressionTarget target; - Statement_s *expression; + int mousePos; + int startPos[1]; + int endPos[1]; + int drawPadding; + float elementWidth; + float elementHeight; + int elementStyle; + int numColumns; + columnInfo_s columnInfo[16]; + MenuEventHandlerSet *onDoubleClick; + int notselectable; + int noScrollBars; + int usePaging; + float selectBorder[4]; + Material *selectIcon; }; struct editFieldDef_s @@ -1004,7 +2470,7 @@ namespace Game int paintOffset; }; - struct multiDef_s // 0x188 + struct multiDef_s { const char *dvarList[32]; const char *dvarStr[32]; @@ -1013,38 +2479,15 @@ namespace Game int strDef; }; - struct columnInfo_s - { - int xpos; - int width; - int maxChars; - int alignment; - }; - - struct listBoxDef_s // 0x144 - { - // somethings not right here - int startPos[2]; - int endPos[2]; - float elementWidth; - float elementHeight; - int elementStyle; - int numColumns; - columnInfo_s columnInfo[16]; - MenuEventHandlerSet *doubleClick; // 0xC8 - int notselectable; - int noscrollbars; - int usepaging; - float selectBorder[4]; - Material *selectIcon; - }; - struct newsTickerDef_s { int feedId; int speed; int spacing; - char pad[16]; + int lastTime; + int start; + int end; + float x; }; struct textScrollDef_s @@ -1056,31 +2499,37 @@ namespace Game { listBoxDef_s *listBox; editFieldDef_s *editField; - newsTickerDef_s *ticker; - multiDef_s *multiDef; + multiDef_s *multi; const char *enumDvarName; + newsTickerDef_s *ticker; textScrollDef_s *scroll; void *data; }; - struct itemDef_t + struct ItemFloatExpression + { + int target; + Statement_s *expression; + }; + + struct itemDef_s { windowDef_t window; - rectDef_s textRect; + rectDef_s textRect[1]; int type; int dataType; int alignment; int fontEnum; int textAlignMode; - float textAlignX; - float textAlignY; - float textScale; + float textalignx; + float textaligny; + float textscale; int textStyle; int gameMsgWindowIndex; int gameMsgWindowMode; const char *text; - int textSaveGameInfo; - int parent; + int itemFlags; + menuDef_t *parent; MenuEventHandlerSet *mouseEnterText; MenuEventHandlerSet *mouseExitText; MenuEventHandlerSet *mouseEnter; @@ -1097,7 +2546,7 @@ namespace Game int dvarFlags; snd_alias_list_t *focusSound; float special; - int cursorPos; + int cursorPos[1]; itemDefData_t typeData; int imageTrack; int floatExpressionCount; @@ -1115,9 +2564,10 @@ namespace Game int lastSoundPlayedTime; }; - struct menuTransition // 0x18 + struct menuTransition { int transitionType; + int targetField; int startTime; float startVal; float endVal; @@ -1128,398 +2578,714 @@ namespace Game struct menuDef_t { windowDef_t window; - char* font; - int fullscreen; + const char *font; + int fullScreen; int itemCount; int fontIndex; - int cursorItems; + int cursorItem[1]; int fadeCycle; float fadeClamp; float fadeAmount; float fadeInAmount; float blurRadius; MenuEventHandlerSet *onOpen; - MenuEventHandlerSet *onRequestClose; + MenuEventHandlerSet *onCloseRequest; MenuEventHandlerSet *onClose; - MenuEventHandlerSet *onEsc; + MenuEventHandlerSet *onESC; ItemKeyHandler *onKey; Statement_s *visibleExp; const char *allowedBinding; - const char *soundLoop; + const char *soundName; int imageTrack; float focusColor[4]; Statement_s *rectXExp; Statement_s *rectYExp; - Statement_s *rectHExp; Statement_s *rectWExp; + Statement_s *rectHExp; Statement_s *openSoundExp; Statement_s *closeSoundExp; - itemDef_t **items; - char unknown[112]; + itemDef_s **items; + menuTransition scaleTransition[1]; + menuTransition alphaTransition[1]; + menuTransition xTransition[1]; + menuTransition yTransition[1]; ExpressionSupportingData *expressionData; }; struct MenuList { - char *name; + const char *name; int menuCount; menuDef_t **menus; }; -#define FS_SEEK_CUR 0 -#define FS_SEEK_END 1 -#define FS_SEEK_SET 2 - - enum FsListBehavior_e - { - FS_LIST_PURE_ONLY = 0x0, - FS_LIST_ALL = 0x1, - }; - - typedef enum - { - NA_BOT, - NA_BAD, // an address lookup failed - NA_LOOPBACK, - NA_BROADCAST, - NA_IP, - NA_IP6, // custom type - } netadrtype_t; - - typedef enum - { - NS_CLIENT, - NS_SERVER - } netsrc_t; - - typedef union - { - unsigned char bytes[4]; - DWORD full; - } netIP_t; - - typedef struct - { - netadrtype_t type; - netIP_t ip; - unsigned short port; - unsigned char ipx[8]; - } netadr_t; - - typedef struct - { - int overflowed; - int readOnly; - char *data; - char *splitData; - int maxsize; - int cursize; - int splitSize; - int readcount; - int bit; - int lastEntityRef; - } msg_t; - - enum playerFlag - { - PLAYER_FLAG_NOCLIP = 1 << 0, - PLAYER_FLAG_UFO = 1 << 1, - PLAYER_FLAG_FROZEN = 1 << 2, - }; - - typedef struct gclient_s - { - unsigned char pad[12764]; - unsigned int team; - char pad2[436]; - int flags; - char pad3[724]; - } gclient_t; - - typedef struct gentity_s - { - int number; - unsigned char pad[308]; // 4 - float origin[3]; // 312 - float angles[3]; // 324 - char pad2[8]; - gclient_t* client; // 344 - unsigned char pad3[28]; - short classname; - short pad4; - unsigned char pad5[248]; - } gentity_t; - -#pragma pack(push, 1) - typedef struct client_s - { - // 0 - int state; - // 4 - char pad[36]; - // 40 - netadr_t addr; - // 60 - char pad1[1568]; - // 1628 - char connectInfoString[1024]; - // 2652 - char pad2[133192]; - // 135844 - char name[16]; - // 135860 - char pad3[12]; - // 135872 - int snapNum; - // 135876 - int pad4; - // 135880 - short ping; - // 135882 - //char pad5[142390]; - char pad5[133158]; - // 269040 - int isBot; - // 269044 - char pad6[9228]; - // 278272 - unsigned __int64 steamid; - // 278280 - char pad7[403592]; - } client_t; -#pragma pack(pop) - - // Q3TA precompiler code - - //undef if binary numbers of the form 0b... or 0B... are not allowed -#define BINARYNUMBERS - //undef if not using the token.intvalue and token.floatvalue -#define NUMBERVALUE - //use dollar sign also as punctuation -#define DOLLAR - - //maximum token length -#define MAX_TOKEN 1024 - - //punctuation - typedef struct punctuation_s - { - char *p; //punctuation character(s) - int n; //punctuation indication - struct punctuation_s *next; //next punctuation - } punctuation_t; - - //token - typedef struct token_s - { - char string[MAX_TOKEN]; //available token - int type; //last read token type - int subtype; //last read token sub type -#ifdef NUMBERVALUE - unsigned long int intvalue; //integer value - long double floatvalue; //floating point value -#endif //NUMBERVALUE - char *whitespace_p; //start of white space before token - char *endwhitespace_p; //start of white space before token - int line; //line the token was on - int linescrossed; //lines crossed in white space - struct token_s *next; //next token in chain - } token_t; - - //script file - typedef struct script_s - { - char filename[64]; //file name of the script - char *buffer; //buffer containing the script - char *script_p; //current pointer in the script - char *end_p; //pointer to the end of the script - char *lastscript_p; //script pointer before reading token - char *whitespace_p; //begin of the white space - char *endwhitespace_p; //end of the white space - int length; //length of the script in bytes - int line; //current line in script - int lastline; //line before reading token - int tokenavailable; //set by UnreadLastToken - int flags; //several script flags - punctuation_t *punctuations; //the punctuations used in the script - punctuation_t **punctuationtable; - token_t token; //available token - struct script_s *next; //next script in a chain - } script_t; - - //macro definitions - typedef struct define_s - { - char *name; //define name - int flags; //define flags - int builtin; // > 0 if builtin define - int numparms; //number of define parameters - token_t *parms; //define parameters - token_t *tokens; //macro tokens (possibly containing parm tokens) - struct define_s *next; //next defined macro in a list - struct define_s *hashnext; //next define in the hash chain - } define_t; - - //indents - //used for conditional compilation directives: - //#if, #else, #elif, #ifdef, #ifndef - typedef struct indent_s - { - int type; //indent type - int skip; //true if skipping current indent - script_t *script; //script the indent was in - struct indent_s *next; //next indent on the indent stack - } indent_t; - - //source file - typedef struct source_s - { - char filename[64]; //file name of the script - char includepath[64]; //path to include files - punctuation_t *punctuations; //punctuations to use - script_t *scriptstack; //stack with scripts of the source - token_t *tokens; //tokens to read first - define_t *defines; //list with macro definitions - define_t **definehash; //hash chain with defines - indent_t *indentstack; //stack with indents - int skip; // > 0 if skipping conditional code - token_t token; //last read token - } source_t; - -#define MAX_TOKENLENGTH 1024 - - typedef struct pc_token_s - { - int type; - int subtype; - int intvalue; - float floatvalue; - char string[MAX_TOKENLENGTH]; - } pc_token_t; - - //token types -#define TT_STRING 1 // string -#define TT_LITERAL 2 // literal -#define TT_NUMBER 3 // number -#define TT_NAME 4 // name -#define TT_PUNCTUATION 5 // punctuation - -#define KEYWORDHASH_SIZE 512 - - typedef struct keywordHash_s - { - char *keyword; - bool(*func)(menuDef_t *item, int handle); - //struct keywordHash_s *next; - } keywordHash_t; - - enum UILocalVarType - { - UILOCALVAR_INT = 0x0, - UILOCALVAR_FLOAT = 0x1, - UILOCALVAR_STRING = 0x2, - }; - - struct UILocalVar - { - UILocalVarType type; - const char *name; - union - { - int integer; - float value; - const char *string; - }; - }; - - struct UILocalVarContext - { - UILocalVar table[256]; - }; - - struct UiContext - { -// int localClientNum; -// float bias; -// int realTime; -// int frameTime; -// int cursorx; -// int cursory; -// int debug; -// int screenWidth; -// int screenHeight; -// float screenAspect; -// float FPS; -// float blurRadiusOut; - char pad[56]; - menuDef_t *menus[512]; - char pad2[512]; - int menuCount; - // Unsure if below is correct - menuDef_t *menuStack[16]; - int openMenuCount; - UILocalVarContext localVars; - }; - struct LocalizeEntry { - const char* value; - const char* name; + const char *value; + const char *name; }; - struct Bounds + enum weapType_t { - vec3_t midPoint; // mins - vec3_t halfSize; // maxs + WEAPTYPE_BULLET = 0x0, + WEAPTYPE_GRENADE = 0x1, + WEAPTYPE_PROJECTILE = 0x2, + WEAPTYPE_RIOTSHIELD = 0x3, + WEAPTYPE_NUM = 0x4, }; - struct TriggerModel + enum weapClass_t { - int contents; - unsigned short hullCount; - unsigned short firstHull; + WEAPCLASS_RIFLE = 0x0, + WEAPCLASS_SNIPER = 0x1, + WEAPCLASS_MG = 0x2, + WEAPCLASS_SMG = 0x3, + WEAPCLASS_SPREAD = 0x4, + WEAPCLASS_PISTOL = 0x5, + WEAPCLASS_GRENADE = 0x6, + WEAPCLASS_ROCKETLAUNCHER = 0x7, + WEAPCLASS_TURRET = 0x8, + WEAPCLASS_THROWINGKNIFE = 0x9, + WEAPCLASS_NON_PLAYER = 0xA, + WEAPCLASS_ITEM = 0xB, + WEAPCLASS_NUM = 0xC, }; - struct TriggerHull + enum PenetrateType { - Bounds bounds; - int contents; - unsigned short slabCount; - unsigned short firstSlab; + PENETRATE_TYPE_NONE = 0x0, + PENETRATE_TYPE_SMALL = 0x1, + PENETRATE_TYPE_MEDIUM = 0x2, + PENETRATE_TYPE_LARGE = 0x3, + PENETRATE_TYPE_COUNT = 0x4, }; - struct TriggerSlab + enum weapInventoryType_t { - vec3_t dir; - float midPoint; - float halfSize; + WEAPINVENTORY_PRIMARY = 0x0, + WEAPINVENTORY_OFFHAND = 0x1, + WEAPINVENTORY_ITEM = 0x2, + WEAPINVENTORY_ALTMODE = 0x3, + WEAPINVENTORY_EXCLUSIVE = 0x4, + WEAPINVENTORY_SCAVENGER = 0x5, + WEAPINVENTORYCOUNT = 0x6, }; - struct MapTriggers + enum weapFireType_t { - int modelCount; - TriggerModel* models; // sizeof 8 - int hullCount; - TriggerHull* hulls; // sizeof 32 - int slabCount; - TriggerSlab* slabs; // sizeof 20 + WEAPON_FIRETYPE_FULLAUTO = 0x0, + WEAPON_FIRETYPE_SINGLESHOT = 0x1, + WEAPON_FIRETYPE_BURSTFIRE2 = 0x2, + WEAPON_FIRETYPE_BURSTFIRE3 = 0x3, + WEAPON_FIRETYPE_BURSTFIRE4 = 0x4, + WEAPON_FIRETYPE_DOUBLEBARREL = 0x5, + WEAPON_FIRETYPECOUNT = 0x6, + WEAPON_FIRETYPE_BURSTFIRE_FIRST = 0x2, + WEAPON_FIRETYPE_BURSTFIRE_LAST = 0x4, }; - struct Stage + enum OffhandClass { - char * stageName; - float offset[3]; - int flags; + OFFHAND_CLASS_NONE = 0x0, + OFFHAND_CLASS_FRAG_GRENADE = 0x1, + OFFHAND_CLASS_SMOKE_GRENADE = 0x2, + OFFHAND_CLASS_FLASH_GRENADE = 0x3, + OFFHAND_CLASS_THROWINGKNIFE = 0x4, + OFFHAND_CLASS_OTHER = 0x5, + OFFHAND_CLASS_COUNT = 0x6, }; - struct MapEnts + enum weapStance_t + { + WEAPSTANCE_STAND = 0x0, + WEAPSTANCE_DUCK = 0x1, + WEAPSTANCE_PRONE = 0x2, + WEAPSTANCE_NUM = 0x3, + }; + + enum activeReticleType_t + { + VEH_ACTIVE_RETICLE_NONE = 0x0, + VEH_ACTIVE_RETICLE_PIP_ON_A_STICK = 0x1, + VEH_ACTIVE_RETICLE_BOUNCING_DIAMOND = 0x2, + VEH_ACTIVE_RETICLE_COUNT = 0x3, + }; + + enum weaponIconRatioType_t + { + WEAPON_ICON_RATIO_1TO1 = 0x0, + WEAPON_ICON_RATIO_2TO1 = 0x1, + WEAPON_ICON_RATIO_4TO1 = 0x2, + WEAPON_ICON_RATIO_COUNT = 0x3, + }; + + enum ammoCounterClipType_t + { + AMMO_COUNTER_CLIP_NONE = 0x0, + AMMO_COUNTER_CLIP_MAGAZINE = 0x1, + AMMO_COUNTER_CLIP_SHORTMAGAZINE = 0x2, + AMMO_COUNTER_CLIP_SHOTGUN = 0x3, + AMMO_COUNTER_CLIP_ROCKET = 0x4, + AMMO_COUNTER_CLIP_BELTFED = 0x5, + AMMO_COUNTER_CLIP_ALTWEAPON = 0x6, + AMMO_COUNTER_CLIP_COUNT = 0x7, + }; + + enum weapOverlayReticle_t + { + WEAPOVERLAYRETICLE_NONE = 0x0, + WEAPOVERLAYRETICLE_CROSSHAIR = 0x1, + WEAPOVERLAYRETICLE_NUM = 0x2, + }; + + enum WeapOverlayInteface_t + { + WEAPOVERLAYINTERFACE_NONE = 0x0, + WEAPOVERLAYINTERFACE_JAVELIN = 0x1, + WEAPOVERLAYINTERFACE_TURRETSCOPE = 0x2, + WEAPOVERLAYINTERFACECOUNT = 0x3, + }; + + enum weapProjExposion_t + { + WEAPPROJEXP_GRENADE = 0x0, + WEAPPROJEXP_ROCKET = 0x1, + WEAPPROJEXP_FLASHBANG = 0x2, + WEAPPROJEXP_NONE = 0x3, + WEAPPROJEXP_DUD = 0x4, + WEAPPROJEXP_SMOKE = 0x5, + WEAPPROJEXP_HEAVY = 0x6, + WEAPPROJEXP_NUM = 0x7, + }; + + enum WeapStickinessType + { + WEAPSTICKINESS_NONE = 0x0, + WEAPSTICKINESS_ALL = 0x1, + WEAPSTICKINESS_ALL_ORIENT = 0x2, + WEAPSTICKINESS_GROUND = 0x3, + WEAPSTICKINESS_GROUND_WITH_YAW = 0x4, + WEAPSTICKINESS_KNIFE = 0x5, + WEAPSTICKINESS_COUNT = 0x6, + }; + + enum guidedMissileType_t + { + MISSILE_GUIDANCE_NONE = 0x0, + MISSILE_GUIDANCE_SIDEWINDER = 0x1, + MISSILE_GUIDANCE_HELLFIRE = 0x2, + MISSILE_GUIDANCE_JAVELIN = 0x3, + MISSILE_GUIDANCE_COUNT = 0x4, + }; + + struct TracerDef { const char *name; - char *entityString; - int numEntityChars; - MapTriggers trigger; - Stage * stages; - char stageCount; + Material *material; + unsigned int drawInterval; + float speed; + float beamLength; + float beamWidth; + float screwRadius; + float screwDist; + float colors[5][4]; + }; + + struct __declspec(align(4)) WeaponDef + { + const char *szOverlayName; + XModel **gunXModel; + XModel *handXModel; + const char **szXAnimsRightHanded; + const char **szXAnimsLeftHanded; + const char *szModeName; + unsigned __int16 *notetrackSoundMapKeys; + unsigned __int16 *notetrackSoundMapValues; + unsigned __int16 *notetrackRumbleMapKeys; + unsigned __int16 *notetrackRumbleMapValues; + int playerAnimType; + weapType_t weapType; + weapClass_t weapClass; + PenetrateType penetrateType; + weapInventoryType_t inventoryType; + weapFireType_t fireType; + OffhandClass offhandClass; + weapStance_t stance; + FxEffectDef *viewFlashEffect; + FxEffectDef *worldFlashEffect; + snd_alias_list_t *pickupSound; + snd_alias_list_t *pickupSoundPlayer; + snd_alias_list_t *ammoPickupSound; + snd_alias_list_t *ammoPickupSoundPlayer; + snd_alias_list_t *projectileSound; + snd_alias_list_t *pullbackSound; + snd_alias_list_t *pullbackSoundPlayer; + snd_alias_list_t *fireSound; + snd_alias_list_t *fireSoundPlayer; + snd_alias_list_t *fireSoundPlayerAkimbo; + snd_alias_list_t *fireLoopSound; + snd_alias_list_t *fireLoopSoundPlayer; + snd_alias_list_t *fireStopSound; + snd_alias_list_t *fireStopSoundPlayer; + snd_alias_list_t *fireLastSound; + snd_alias_list_t *fireLastSoundPlayer; + snd_alias_list_t *emptyFireSound; + snd_alias_list_t *emptyFireSoundPlayer; + snd_alias_list_t *meleeSwipeSound; + snd_alias_list_t *meleeSwipeSoundPlayer; + snd_alias_list_t *meleeHitSound; + snd_alias_list_t *meleeMissSound; + snd_alias_list_t *rechamberSound; + snd_alias_list_t *rechamberSoundPlayer; + snd_alias_list_t *reloadSound; + snd_alias_list_t *reloadSoundPlayer; + snd_alias_list_t *reloadEmptySound; + snd_alias_list_t *reloadEmptySoundPlayer; + snd_alias_list_t *reloadStartSound; + snd_alias_list_t *reloadStartSoundPlayer; + snd_alias_list_t *reloadEndSound; + snd_alias_list_t *reloadEndSoundPlayer; + snd_alias_list_t *detonateSound; + snd_alias_list_t *detonateSoundPlayer; + snd_alias_list_t *nightVisionWearSound; + snd_alias_list_t *nightVisionWearSoundPlayer; + snd_alias_list_t *nightVisionRemoveSound; + snd_alias_list_t *nightVisionRemoveSoundPlayer; + snd_alias_list_t *altSwitchSound; + snd_alias_list_t *altSwitchSoundPlayer; + snd_alias_list_t *raiseSound; + snd_alias_list_t *raiseSoundPlayer; + snd_alias_list_t *firstRaiseSound; + snd_alias_list_t *firstRaiseSoundPlayer; + snd_alias_list_t *putawaySound; + snd_alias_list_t *putawaySoundPlayer; + snd_alias_list_t *scanSound; + snd_alias_list_t **bounceSound; + FxEffectDef *viewShellEjectEffect; + FxEffectDef *worldShellEjectEffect; + FxEffectDef *viewLastShotEjectEffect; + FxEffectDef *worldLastShotEjectEffect; + Material *reticleCenter; + Material *reticleSide; + int iReticleCenterSize; + int iReticleSideSize; + int iReticleMinOfs; + activeReticleType_t activeReticleType; + float vStandMove[3]; + float vStandRot[3]; + float strafeMove[3]; + float strafeRot[3]; + float vDuckedOfs[3]; + float vDuckedMove[3]; + float vDuckedRot[3]; + float vProneOfs[3]; + float vProneMove[3]; + float vProneRot[3]; + float fPosMoveRate; + float fPosProneMoveRate; + float fStandMoveMinSpeed; + float fDuckedMoveMinSpeed; + float fProneMoveMinSpeed; + float fPosRotRate; + float fPosProneRotRate; + float fStandRotMinSpeed; + float fDuckedRotMinSpeed; + float fProneRotMinSpeed; + XModel **worldModel; + XModel *worldClipModel; + XModel *rocketModel; + XModel *knifeModel; + XModel *worldKnifeModel; + Material *hudIcon; + weaponIconRatioType_t hudIconRatio; + Material *pickupIcon; + weaponIconRatioType_t pickupIconRatio; + Material *ammoCounterIcon; + weaponIconRatioType_t ammoCounterIconRatio; + ammoCounterClipType_t ammoCounterClip; + int iStartAmmo; + const char *szAmmoName; + int iAmmoIndex; + const char *szClipName; + int iClipIndex; + int iMaxAmmo; + int shotCount; + const char *szSharedAmmoCapName; + int iSharedAmmoCapIndex; + int iSharedAmmoCap; + int damage; + int playerDamage; + int iMeleeDamage; + int iDamageType; + int iFireDelay; + int iMeleeDelay; + int meleeChargeDelay; + int iDetonateDelay; + int iRechamberTime; + int rechamberTimeOneHanded; + int iRechamberBoltTime; + int iHoldFireTime; + int iDetonateTime; + int iMeleeTime; + int meleeChargeTime; + int iReloadTime; + int reloadShowRocketTime; + int iReloadEmptyTime; + int iReloadAddTime; + int iReloadStartTime; + int iReloadStartAddTime; + int iReloadEndTime; + int iDropTime; + int iRaiseTime; + int iAltDropTime; + int quickDropTime; + int quickRaiseTime; + int iBreachRaiseTime; + int iEmptyRaiseTime; + int iEmptyDropTime; + int sprintInTime; + int sprintLoopTime; + int sprintOutTime; + int stunnedTimeBegin; + int stunnedTimeLoop; + int stunnedTimeEnd; + int nightVisionWearTime; + int nightVisionWearTimeFadeOutEnd; + int nightVisionWearTimePowerUp; + int nightVisionRemoveTime; + int nightVisionRemoveTimePowerDown; + int nightVisionRemoveTimeFadeInStart; + int fuseTime; + int aiFuseTime; + float autoAimRange; + float aimAssistRange; + float aimAssistRangeAds; + float aimPadding; + float enemyCrosshairRange; + float moveSpeedScale; + float adsMoveSpeedScale; + float sprintDurationScale; + float fAdsZoomInFrac; + float fAdsZoomOutFrac; + Material *overlayMaterial; + Material *overlayMaterialLowRes; + Material *overlayMaterialEMP; + Material *overlayMaterialEMPLowRes; + weapOverlayReticle_t overlayReticle; + WeapOverlayInteface_t overlayInterface; + float overlayWidth; + float overlayHeight; + float overlayWidthSplitscreen; + float overlayHeightSplitscreen; + float fAdsBobFactor; + float fAdsViewBobMult; + float fHipSpreadStandMin; + float fHipSpreadDuckedMin; + float fHipSpreadProneMin; + float hipSpreadStandMax; + float hipSpreadDuckedMax; + float hipSpreadProneMax; + float fHipSpreadDecayRate; + float fHipSpreadFireAdd; + float fHipSpreadTurnAdd; + float fHipSpreadMoveAdd; + float fHipSpreadDuckedDecay; + float fHipSpreadProneDecay; + float fHipReticleSidePos; + float fAdsIdleAmount; + float fHipIdleAmount; + float adsIdleSpeed; + float hipIdleSpeed; + float fIdleCrouchFactor; + float fIdleProneFactor; + float fGunMaxPitch; + float fGunMaxYaw; + float swayMaxAngle; + float swayLerpSpeed; + float swayPitchScale; + float swayYawScale; + float swayHorizScale; + float swayVertScale; + float swayShellShockScale; + float adsSwayMaxAngle; + float adsSwayLerpSpeed; + float adsSwayPitchScale; + float adsSwayYawScale; + float adsSwayHorizScale; + float adsSwayVertScale; + float adsViewErrorMin; + float adsViewErrorMax; + PhysCollmap *physCollmap; + float dualWieldViewModelOffset; + weaponIconRatioType_t killIconRatio; + int iReloadAmmoAdd; + int iReloadStartAdd; + int ammoDropStockMin; + int ammoDropClipPercentMin; + int ammoDropClipPercentMax; + int iExplosionRadius; + int iExplosionRadiusMin; + int iExplosionInnerDamage; + int iExplosionOuterDamage; + float damageConeAngle; + float bulletExplDmgMult; + float bulletExplRadiusMult; + int iProjectileSpeed; + int iProjectileSpeedUp; + int iProjectileSpeedForward; + int iProjectileActivateDist; + float projLifetime; + float timeToAccelerate; + float projectileCurvature; + XModel *projectileModel; + weapProjExposion_t projExplosion; + FxEffectDef *projExplosionEffect; + FxEffectDef *projDudEffect; + snd_alias_list_t *projExplosionSound; + snd_alias_list_t *projDudSound; + WeapStickinessType stickiness; + float lowAmmoWarningThreshold; + float ricochetChance; + float *parallelBounce; + float *perpendicularBounce; + FxEffectDef *projTrailEffect; + FxEffectDef *projBeaconEffect; + float vProjectileColor[3]; + guidedMissileType_t guidedMissileType; + float maxSteeringAccel; + int projIgnitionDelay; + FxEffectDef *projIgnitionEffect; + snd_alias_list_t *projIgnitionSound; + float fAdsAimPitch; + float fAdsCrosshairInFrac; + float fAdsCrosshairOutFrac; + int adsGunKickReducedKickBullets; + float adsGunKickReducedKickPercent; + float fAdsGunKickPitchMin; + float fAdsGunKickPitchMax; + float fAdsGunKickYawMin; + float fAdsGunKickYawMax; + float fAdsGunKickAccel; + float fAdsGunKickSpeedMax; + float fAdsGunKickSpeedDecay; + float fAdsGunKickStaticDecay; + float fAdsViewKickPitchMin; + float fAdsViewKickPitchMax; + float fAdsViewKickYawMin; + float fAdsViewKickYawMax; + float fAdsViewScatterMin; + float fAdsViewScatterMax; + float fAdsSpread; + int hipGunKickReducedKickBullets; + float hipGunKickReducedKickPercent; + float fHipGunKickPitchMin; + float fHipGunKickPitchMax; + float fHipGunKickYawMin; + float fHipGunKickYawMax; + float fHipGunKickAccel; + float fHipGunKickSpeedMax; + float fHipGunKickSpeedDecay; + float fHipGunKickStaticDecay; + float fHipViewKickPitchMin; + float fHipViewKickPitchMax; + float fHipViewKickYawMin; + float fHipViewKickYawMax; + float fHipViewScatterMin; + float fHipViewScatterMax; + float fightDist; + float maxDist; + const char *accuracyGraphName[2]; + float(*originalAccuracyGraphKnots[2])[2]; + unsigned __int16 originalAccuracyGraphKnotCount[2]; + int iPositionReloadTransTime; + float leftArc; + float rightArc; + float topArc; + float bottomArc; + float accuracy; + float aiSpread; + float playerSpread; + float minTurnSpeed[2]; + float maxTurnSpeed[2]; + float pitchConvergenceTime; + float yawConvergenceTime; + float suppressTime; + float maxRange; + float fAnimHorRotateInc; + float fPlayerPositionDist; + const char *szUseHintString; + const char *dropHintString; + int iUseHintStringIndex; + int dropHintStringIndex; + float horizViewJitter; + float vertViewJitter; + float scanSpeed; + float scanAccel; + int scanPauseTime; + const char *szScript; + float fOOPosAnimLength[2]; + int minDamage; + int minPlayerDamage; + float fMaxDamageRange; + float fMinDamageRange; + float destabilizationRateTime; + float destabilizationCurvatureMax; + int destabilizeDistance; + float *locationDamageMultipliers; + const char *fireRumble; + const char *meleeImpactRumble; + TracerDef *tracerType; + float turretScopeZoomRate; + float turretScopeZoomMin; + float turretScopeZoomMax; + float turretOverheatUpRate; + float turretOverheatDownRate; + float turretOverheatPenalty; + snd_alias_list_t *turretOverheatSound; + FxEffectDef *turretOverheatEffect; + const char *turretBarrelSpinRumble; + float turretBarrelSpinSpeed; + float turretBarrelSpinUpTime; + float turretBarrelSpinDownTime; + snd_alias_list_t *turretBarrelSpinMaxSnd; + snd_alias_list_t *turretBarrelSpinUpSnd[4]; + snd_alias_list_t *turretBarrelSpinDownSnd[4]; + snd_alias_list_t *missileConeSoundAlias; + snd_alias_list_t *missileConeSoundAliasAtBase; + float missileConeSoundRadiusAtTop; + float missileConeSoundRadiusAtBase; + float missileConeSoundHeight; + float missileConeSoundOriginOffset; + float missileConeSoundVolumescaleAtCore; + float missileConeSoundVolumescaleAtEdge; + float missileConeSoundVolumescaleCoreSize; + float missileConeSoundPitchAtTop; + float missileConeSoundPitchAtBottom; + float missileConeSoundPitchTopSize; + float missileConeSoundPitchBottomSize; + float missileConeSoundCrossfadeTopSize; + float missileConeSoundCrossfadeBottomSize; + bool sharedAmmo; + bool lockonSupported; + bool requireLockonToFire; + bool bigExplosion; + bool noAdsWhenMagEmpty; + bool avoidDropCleanup; + bool inheritsPerks; + bool crosshairColorChange; + bool bRifleBullet; + bool armorPiercing; + bool bBoltAction; + bool aimDownSight; + bool bRechamberWhileAds; + bool bBulletExplosiveDamage; + bool bCookOffHold; + bool bClipOnly; + bool noAmmoPickup; + bool adsFireOnly; + bool cancelAutoHolsterWhenEmpty; + bool disableSwitchToWhenEmpty; + bool suppressAmmoReserveDisplay; + bool laserSightDuringNightvision; + bool markableViewmodel; + bool noDualWield; + bool flipKillIcon; + bool bNoPartialReload; + bool bSegmentedReload; + bool blocksProne; + bool silenced; + bool isRollingGrenade; + bool projExplosionEffectForceNormalUp; + bool bProjImpactExplode; + bool stickToPlayers; + bool hasDetonator; + bool disableFiring; + bool timedDetonation; + bool rotate; + bool holdButtonToThrow; + bool freezeMovementWhenFiring; + bool thermalScope; + bool altModeSameWeapon; + bool turretBarrelSpinEnabled; + bool missileConeSoundEnabled; + bool missileConeSoundPitchshiftEnabled; + bool missileConeSoundCrossfadeEnabled; + bool offhandHoldIsCancelable; + }; + + enum ImpactType + { + IMPACT_TYPE_NONE = 0x0, + IMPACT_TYPE_BULLET_SMALL = 0x1, + IMPACT_TYPE_BULLET_LARGE = 0x2, + IMPACT_TYPE_BULLET_AP = 0x3, + IMPACT_TYPE_BULLET_EXPLODE = 0x4, + IMPACT_TYPE_SHOTGUN = 0x5, + IMPACT_TYPE_SHOTGUN_EXPLODE = 0x6, + IMPACT_TYPE_GRENADE_BOUNCE = 0x7, + IMPACT_TYPE_GRENADE_EXPLODE = 0x8, + IMPACT_TYPE_ROCKET_EXPLODE = 0x9, + IMPACT_TYPE_PROJECTILE_DUD = 0xA, + IMPACT_TYPE_COUNT = 0xB, + }; + + struct /*__declspec(align(2))*/ WeaponCompleteDef + { + const char *szInternalName; + WeaponDef *weapDef; + const char *szDisplayName; + unsigned __int16 *hideTags; + const char **szXAnims; + float fAdsZoomFov; + int iAdsTransInTime; + int iAdsTransOutTime; + int iClipSize; + ImpactType impactType; + int iFireTime; + weaponIconRatioType_t dpadIconRatio; + float penetrateMultiplier; + float fAdsViewKickCenterSpeed; + float fHipViewKickCenterSpeed; + const char *szAltWeaponName; + unsigned int altWeaponIndex; + int iAltRaiseTime; + Material *killIcon; + Material *dpadIcon; + int fireAnimLength; + int iFirstRaiseTime; + int ammoDropStockMax; + float adsDofStart; + float adsDofEnd; + unsigned __int16 accuracyGraphKnotCount[2]; + float(*accuracyGraphKnots[2])[2]; + bool motionTracker; + bool enhanced; + bool dpadIconShowsAmmo; + }; + + struct SndDriverGlobals + { + const char *name; + }; + + struct FxImpactEntry + { + FxEffectDef *nonflesh[31]; + FxEffectDef *flesh[4]; + }; + + struct FxImpactTable + { + const char *name; + FxImpactEntry *table; + }; + + struct RawFile + { + const char *name; + int compressedLen; + int len; + const char *buffer; }; struct StringTableCell @@ -1536,38 +3302,60 @@ namespace Game StringTableCell *values; }; - struct RawFile + enum LbColType { - const char* name; - int sizeCompressed; - int sizeUnCompressed; - char * compressedData; + LBCOL_TYPE_NUMBER = 0x0, + LBCOL_TYPE_TIME = 0x1, + LBCOL_TYPE_LEVELXP = 0x2, + LBCOL_TYPE_PRESTIGE = 0x3, + LBCOL_TYPE_BIGNUMBER = 0x4, + LBCOL_TYPE_PERCENT = 0x5, + LBCOL_TYPE_COUNT = 0x6, }; - struct FontEntry + enum LbAggType { - unsigned short character; - unsigned char padLeft; - unsigned char padTop; - unsigned char padRight; - unsigned char width; - unsigned char height; - unsigned char const0; - float uvLeft; - float uvTop; - float uvRight; - float uvBottom; + LBAGG_TYPE_MIN = 0x0, + LBAGG_TYPE_MAX = 0x1, + LBAGG_TYPE_SUM = 0x2, + LBAGG_TYPE_LAST = 0x3, + LBAGG_TYPE_COUNT = 0x4, }; - typedef struct Font_s + struct LbColumnDef { - char* name; - int size; - int entries; - Material* image; - Material* glowImage; - FontEntry* characters; - } Font; + const char *name; + int id; + int propertyId; + bool hidden; + const char *statName; + LbColType type; + int precision; + LbAggType agg; + }; + + struct LeaderboardDef + { + const char *name; + int id; + int columnCount; + int xpColId; + int prestigeColId; + LbColumnDef *columns; + }; + + struct __declspec(align(4)) StructuredDataEnumEntry + { + const char *string; + unsigned __int16 index; + }; + + struct StructuredDataEnum + { + int entryCount; + int reservedEntryCount; + StructuredDataEnumEntry *entries; + }; enum StructuredDataTypeCategory { @@ -1584,21 +3372,6 @@ namespace Game DATA_COUNT = 0xA, }; -#pragma pack(push,4) - struct StructuredDataEnumEntry - { - const char *name; - unsigned __int16 index; - }; -#pragma pack(pop) - - struct StructuredDataEnum - { - int entryCount; - int reservedEntryCount; - StructuredDataEnumEntry *entries; - }; - union StructuredDataTypeUnion { unsigned int stringDataLength; @@ -1614,20 +3387,12 @@ namespace Game StructuredDataTypeUnion u; }; - typedef struct - { - StructuredDataType item; - int offset; - } StructuredDataItem; - -#pragma pack(push,4) struct StructuredDataStructProperty { const char *name; - StructuredDataType item; - int offset; + StructuredDataType type; + unsigned int offset; }; -#pragma pack(pop) struct StructuredDataStruct { @@ -1677,2033 +3442,233 @@ namespace Game struct StructuredDataBuffer { char *data; - size_t size; // 8188 + unsigned int size; }; - struct StructuredDataLookup + enum VehicleType { - char pad[0x10]; + VEH_WHEELS_4 = 0x0, + VEH_TANK = 0x1, + VEH_PLANE = 0x2, + VEH_BOAT = 0x3, + VEH_ARTILLERY = 0x4, + VEH_HELICOPTER = 0x5, + VEH_SNOWMOBILE = 0x6, + VEH_TYPE_COUNT = 0x7, }; - typedef struct + enum VehicleAxleType { - StructuredDataDef* data; - StructuredDataItem* item; - int offset; - int error; - } structuredDataFindState_t; - - struct XSurfaceCollisionLeaf - { - unsigned __int16 triangleBeginIndex; + VEH_AXLE_FRONT = 0x0, + VEH_AXLE_REAR = 0x1, + VEH_AXLE_ALL = 0x2, + VEH_AXLE_COUNT = 0x3, }; - struct XSurfaceCollisionAabb + struct VehiclePhysDef { - unsigned __int16 mins[3]; - unsigned __int16 maxs[3]; - }; - - struct XSurfaceCollisionNode - { - XSurfaceCollisionAabb aabb; - unsigned __int16 childBeginIndex; - unsigned __int16 childCount; - }; - - struct XSurfaceCollisionTree - { - float trans[3]; - float scale[3]; - unsigned int nodeCount; - XSurfaceCollisionNode *nodes; - unsigned int leafCount; - XSurfaceCollisionLeaf *leafs; - }; - - struct XRigidVertList - { - unsigned __int16 boneOffset; - unsigned __int16 vertCount; - unsigned __int16 triOffset; - unsigned __int16 triCount; - XSurfaceCollisionTree *collisionTree; - }; - - union PackedTexCoords - { - unsigned int packed; - }; - - union GfxColor - { - unsigned int packed; - char array[4]; - unsigned char uArray[4]; - }; - - union PackedUnitVec - { - unsigned int packed; - }; - - struct GfxPackedVertex - { - float xyz[3]; - float binormalSign; - GfxColor color; - PackedTexCoords texCoord; - PackedUnitVec normal; - PackedUnitVec tangent; - }; - - struct XSurfaceVertexInfo - { - __int16 vertCount[4]; - unsigned __int16 *vertsBlend; - }; - - struct XSurface - { - char tileMode; - bool deformed; - unsigned __int16 vertCount; - unsigned __int16 triCount; - char zoneHandle; - unsigned __int16 baseTriIndex; - unsigned __int16 baseVertIndex; - unsigned __int16 *triIndices; - XSurfaceVertexInfo vertInfo; - GfxPackedVertex *verts0; - unsigned int vertListCount; - XRigidVertList *vertList; - int partBits[6]; - }; - - struct XModelSurfs - { - const char* name; - XSurface* surfaces; - int numSurfaces; - int partBits[6]; - }; - - struct XModelLodInfo - { - float dist; - unsigned __int16 numsurfs; - unsigned __int16 surfIndex; - XModelSurfs *modelSurfs; - int partBits[6]; - XSurface *surfs; - char lod; - char smcBaseIndexPlusOne; - char smcSubIndexMask; - char smcBucket; - }; - - struct cplane_t - { - float normal[3]; - float dist; - char type; - char signbits; - char pad[2]; - }; - - struct cbrushside_t - { - cplane_t *plane; - unsigned __int16 materialNum; - char firstAdjacentSideOffset; - char edgeCount; - }; - - struct cbrush_t - { - unsigned __int16 numsides; - unsigned __int16 glassPieceIndex; - cbrushside_t *sides; - char *baseAdjacentSide; - __int16 axialMaterialNum[2][3]; - char firstAdjacentSideOffsets[2][3]; - char edgeCount[2][3]; - }; - -#pragma pack(push, 4) - struct BrushWrapper - { - Bounds bounds; - cbrush_t brush; - int totalEdgeCount; - cplane_t *planes; - }; -#pragma pack(pop) - - struct PhysGeomInfo - { - BrushWrapper *brush; - int type; - float orientation[3][3]; - float offset[3]; - float halfLengths[3]; - }; - - struct PhysMass - { - float centerOfMass[3]; - float momentsOfInertia[3]; - float productsOfInertia[3]; - }; - - struct PhysCollmap - { - const char *name; - unsigned int count; - PhysGeomInfo *geoms; - char unknown[0x18]; - PhysMass mass; - }; - - struct DObjAnimMat - { - float quat[4]; - float trans[3]; - float transWeight; - }; - - struct XModelCollTri_s - { - float plane[4]; - float svec[4]; - float tvec[4]; - }; - - struct XModelCollSurf_s - { - XModelCollTri_s *collTris; - int numCollTris; - Bounds bounds; - int boneIdx; - int contents; - int surfFlags; - }; - - struct PhysPreset - { - const char *name; - int type; - float mass; - float bounce; - float friction; - float bulletForceScale; - float explosiveForceScale; - const char *sndAliasPrefix; - float piecesSpreadFraction; - float piecesUpwardVelocity; - bool tempDefaultToCylinder; - }; - - struct XBoneInfo - { - float offset[3]; - float bounds[3]; - float radiusSquared; - }; - - struct XModel - { - const char *name; - char numBones; - char numRootBones; - unsigned char numsurfs; - char lodRampType; - float scale; - unsigned int noScalePartBits[6]; - unsigned __int16 *boneNames; - char *parentList; - __int16 *quats; - float *trans; - char *partClassification; - DObjAnimMat *baseMat; - Material **materialHandles; - XModelLodInfo lodInfo[4]; - char maxLoadedLod; - char numLods; - char collLod; - char flags; - XModelCollSurf_s *collSurfs; - int numCollSurfs; - int contents; - XBoneInfo *boneInfo; - float radius; - Bounds bounds; - int memUsage; - bool bad; + int physicsEnabled; + const char *physPresetName; PhysPreset *physPreset; - PhysCollmap *physCollmap; - }; - - struct CModelAllocData - { - void* mainArray; - void* vertexBuffer; - void* indexBuffer; - }; - - struct CModelSectionHeader - { - int size; - int offset; - int fixupStart; - int fixupCount; - void* buffer; - }; - - enum CModelSection - { - SECTION_MAIN = 0, - SECTION_INDEX = 1, - SECTION_VERTEX = 2, - SECTION_FIXUP = 3, - }; - - struct CModelHeader - { - int version; - unsigned int signature; - CModelSectionHeader sectionHeader[4]; - }; - - struct DSkelPartBits - { - int anim[4]; - int control[4]; - int skel[4]; - }; - - struct DSkel - { - DSkelPartBits partBits; - int timeStamp; - DObjAnimMat *mat; - }; - -#pragma pack(push, 2) - struct DObj - { - /*XAnimTree_s*/void *tree; - unsigned __int16 duplicateParts; - unsigned __int16 entnum; - char duplicatePartsSize; - char numModels; - char numBones; - char pad; - unsigned int ignoreCollision; - volatile int locked; - DSkel skel; - float radius; - int hidePartBits[4]; - char pad2[56]; - XModel **models; - }; -#pragma pack(pop) - - union XAnimDynamicIndices - { - char _1[1]; - unsigned __int16 _2[1]; - }; - - union XAnimDynamicFrames - { - char(*_1)[3]; - unsigned __int16(*_2)[3]; - }; - - struct XAnimNotifyInfo - { - unsigned __int16 name; - float time; - }; - - union XAnimIndices - { - char* _1; - unsigned short *_2; - void* data; - }; - - struct XAnimPartTransFrames - { - float mins[3]; - float size[3]; - XAnimDynamicFrames frames; - XAnimDynamicIndices indices; - }; - - union XAnimPartTransData - { - XAnimPartTransFrames frames; - float frame0[3]; - }; - - struct XAnimPartTrans - { - unsigned __int16 size; - char smallTrans; - XAnimPartTransData u; - }; - - struct XAnimDeltaPartQuatDataFrames2 - { - __int16 *frames; - char indices[1]; - }; - - union XAnimDeltaPartQuatData2 - { - XAnimDeltaPartQuatDataFrames2 frames; - __int16 frame0[2]; - }; - - struct XAnimDeltaPartQuat2 - { - unsigned __int16 size; - XAnimDeltaPartQuatData2 u; - }; - - struct XAnimDeltaPartQuatDataFrames - { - __int16 *frames; - char indices[1]; - }; - - union XAnimDeltaPartQuatData - { - XAnimDeltaPartQuatDataFrames frames; - __int16 frame0[4]; - }; - - struct XAnimDeltaPartQuat - { - unsigned __int16 size; - XAnimDeltaPartQuatData u; - }; - - struct XAnimDeltaPart - { - XAnimPartTrans *trans; - XAnimDeltaPartQuat2 *quat2; - XAnimDeltaPartQuat *quat; - }; - - enum XAnimPartType - { - PART_TYPE_NO_QUAT = 0x0, - PART_TYPE_HALF_QUAT = 0x1, - PART_TYPE_FULL_QUAT = 0x2, - PART_TYPE_HALF_QUAT_NO_SIZE = 0x3, - PART_TYPE_FULL_QUAT_NO_SIZE = 0x4, - PART_TYPE_SMALL_TRANS = 0x5, - PART_TYPE_TRANS = 0x6, - PART_TYPE_TRANS_NO_SIZE = 0x7, - PART_TYPE_NO_TRANS = 0x8, - PART_TYPE_ALL = 0x9, - }; - - enum XAnimFlags - { - XANIM_LOOP_SYNC_TIME = 0x1, - XANIM_NONLOOP_SYNC_TIME = 0x2, - XANIM_SYNC_ROOT = 0x4, - XANIM_COMPLETE = 0x8, - XANIM_ADDITIVE = 0x10, - XANIM_CLIENT = 0x20, - XANIM_SEPARATE = 0x40, - XANIM_FORCELOAD = 0x80, - XANIM_PROPOGATE_FLAGS = 0x63, - }; - - struct XAnimParts - { - const char * name; // 0 - unsigned short dataByteCount; // 4 - unsigned short dataShortCount; // 6 - unsigned short dataIntCount; // 8 - unsigned short randomDataByteCount; // 10 - 0xA - unsigned short randomDataIntCount;// 12 - 0xC - unsigned short framecount; // 14 - 0xE - char bLoop; // 16 - char boneCount[10]; // 17 - char notetrackCount; // 27 - bool pad1; // 28 - bool bDelta; // 29 - char assetType; // 30 - char pad2; // 31 - int randomDataShortCount; // 32 - 0x20 - int indexcount; // 36 - 0x24 - float framerate; // 40 - 0x28 - float frequency; // 44 - 0x2C - short * tagnames; // 48 - 0x30 - char *dataByte;// 52 - 0x34 - short *dataShort; // 56 - 0x38 - int *dataInt; // 60 - 0x3C - short *randomDataShort; // 64 - 0x40 - char *randomDataByte; // 68 - 0x44 - int *randomDataInt; // 72 - 0x48 - XAnimIndices indices; // 76 - 0x4C - XAnimNotifyInfo* notetracks; // 80 - 0x50 - XAnimDeltaPart * delta; // 84 - 0x54 - // 88 - 0x58 - }; - -/* FxEffectDef::flags */ -#define FX_ELEM_LOOPING 0x1 -#define FX_ELEM_USE_RAND_COLOR 0x2 -#define FX_ELEM_USE_RAND_ALPHA 0x4 -#define FX_ELEM_USE_RAND_SIZE0 0x8 -#define FX_ELEM_USE_RAND_SIZE1 0x10 -#define FX_ELEM_USE_RAND_SCALE 0x20 -#define FX_ELEM_USE_RAND_ROT_DELTA 0x40 -#define FX_ELEM_MOD_COLOR_BY_ALPHA 0x80 -#define FX_ELEM_USE_RAND_VEL0 0x100 -#define FX_ELEM_USE_RAND_VEL1 0x200 -#define FX_ELEM_USE_BACK_COMPAT_VEL 0x400 -#define FX_ELEM_ABS_VEL0 0x800 -#define FX_ELEM_ABS_VEL1 0x1000 -#define FX_ELEM_PLAY_ON_TOUCH 0x2000 -#define FX_ELEM_PLAY_ON_DEATH 0x4000 -#define FX_ELEM_PLAY_ON_RUN 0x8000 -#define FX_ELEM_BOUNDING_SPHERE 0x10000 -#define FX_ELEM_USE_ITEM_CLIP 0x20000 -#define FX_ELEM_DECAL_FADE_IN 0x40000 -#define FX_ELEM_DISABLED 0x80000000 - -/* FxElemDef::flags */ -#define FX_ELEM_SPAWN_RELATIVE_TO_EFFECT 0x2 -#define FX_ELEM_SPAWN_FRUSTUM_CULL 0x4 -#define FX_ELEM_RUNNER_USES_RAND_ROT 0x8 -#define FX_ELEM_SPAWN_OFFSET_NONE 0x0 -#define FX_ELEM_SPAWN_OFFSET_SPHERE 0x10 -#define FX_ELEM_SPAWN_OFFSET_CYLINDER 0x20 -#define FX_ELEM_SPAWN_OFFSET_MASK 0x30 -#define FX_ELEM_RUN_RELATIVE_TO_WORLD 0x0 -#define FX_ELEM_RUN_RELATIVE_TO_SPAWN 0x40 -#define FX_ELEM_RUN_RELATIVE_TO_EFFECT 0x80 -#define FX_ELEM_RUN_RELATIVE_TO_OFFSET 0xC0 -#define FX_ELEM_RUN_MASK 0xC0 -#define FX_ELEM_USE_COLLISION 0x100 -#define FX_ELEM_DIE_ON_TOUCH 0x200 -#define FX_ELEM_DRAW_PAST_FOG 0x400 -#define FX_ELEM_DRAW_WITH_VIEWMODEL 0x800 -#define FX_ELEM_BLOCK_SIGHT 0x1000 -#define FX_ELEM_HAS_VELOCITY_GRAPH_LOCAL 0x1000000 -#define FX_ELEM_HAS_VELOCITY_GRAPH_WORLD 0x2000000 -#define FX_ELEM_HAS_GRAVITY 0x4000000 -#define FX_ELEM_USE_MODEL_PHYSICS 0x8000000 -#define FX_ELEM_NONUNIFORM_SCALE 0x10000000 -#define FX_ELEM_CLOUD_SHAPE_CUBE 0x0 -#define FX_ELEM_CLOUD_SHAPE_SPHERE_LARGE 0x20000000 -#define FX_ELEM_CLOUD_SHAPE_SPHERE_MEDIUM 0x40000000 -#define FX_ELEM_CLOUD_SHAPE_SPHERE_SMALL 0x60000000 -#define FX_ELEM_CLOUD_MASK 0x60000000 -#define FX_ELEM_DISABLE_FOUNTAIN_COLLISION 0x80000000 -#define FX_ELEM_DRAW_IN_THERMAL_ONLY 0x2000 -#define FX_ELEM_TRAIL_ORIENT_BY_VELOCITY 0x4000 -#define FX_ELEM_EMIT_ORIENT_BY_ELEM 0x8000 - -/* FxElemAtlas::behavior */ -#define FX_ATLAS_START_MASK 0x3 -#define FX_ATLAS_START_FIXED 0x0 -#define FX_ATLAS_START_RANDOM 0x1 -#define FX_ATLAS_START_INDEXED 0x2 -#define FX_ATLAS_PLAY_OVER_LIFE 0x4 -#define FX_ATLAS_LOOP_ONLY_N_TIMES 0x8 - - enum FxElemType : char - { - FX_ELEM_TYPE_SPRITE_BILLBOARD = 0x0, - FX_ELEM_TYPE_SPRITE_ORIENTED = 0x1, - FX_ELEM_TYPE_TAIL = 0x2, - FX_ELEM_TYPE_TRAIL = 0x3, - FX_ELEM_TYPE_CLOUD = 0x4, - FX_ELEM_TYPE_SPARKCLOUD = 0x5, - FX_ELEM_TYPE_SPARKFOUNTAIN = 0x6, - FX_ELEM_TYPE_MODEL = 0x7, - FX_ELEM_TYPE_OMNI_LIGHT = 0x8, - FX_ELEM_TYPE_SPOT_LIGHT = 0x9, - FX_ELEM_TYPE_SOUND = 0xA, - FX_ELEM_TYPE_DECAL = 0xB, - FX_ELEM_TYPE_RUNNER = 0xC, - FX_ELEM_TYPE_COUNT = 0xD, - FX_ELEM_TYPE_LAST_SPRITE = 0x3, - FX_ELEM_TYPE_LAST_DRAWN = 0x9, - }; - - struct FxElemVec3Range - { - float base[3]; - float amplitude[3]; - }; - - struct FxIntRange - { - int base; - int amplitude; - }; - - struct FxFloatRange - { - float base; - float amplitude; - }; - - struct FxSpawnDefLooping - { - int intervalMsec; - int count; - }; - - struct FxSpawnDefOneShot - { - FxIntRange count; - }; - - union FxSpawnDef - { - FxSpawnDefLooping looping; - FxSpawnDefOneShot oneShot; - }; - - struct FxEffectDef; - - union FxEffectDefRef - { - FxEffectDef *handle; - const char *name; - }; - - union FxElemVisuals - { - const void *anonymous; - Material *material; - XModel *xmodel; - FxEffectDefRef effectDef; - const char *soundName; - }; - - struct FxElemMarkVisuals - { - Material* data[2]; - }; - - union FxElemDefVisuals - { - FxElemVisuals instance; - //If parent FxElemDef::elemType == 0x7, use xmodel - //If parent FxElemDef::elemType == 0xC, use effectDef - //If parent FxElemDef::elemType == 0xA, use soundName - //If parent FxElemDef::elemType != 0x9 || 0x8, use material - - FxElemVisuals *array; //Total count = parent FxElemDef::visualCount - FxElemMarkVisuals *markArray; //Total count = parent FxElemDef::visualCount - }; - - struct FxTrailVertex - { - float pos[2]; - float normal[2]; - float texCoord; - }; - - struct FxTrailDef - { - int scrollTimeMsec; - int repeatDist; - float invSplitDist; - float invSplitArcDist; - float invSplitTime; - int vertCount; - FxTrailVertex *verts; - int indCount; - unsigned __int16 *inds; - }; - - struct FxSparkFountain - { - float sparkFountainGravity; - float sparkFountainBounceFrac; - float sparkFountainBounceRand; - float sparkFountainSparkSpacing; - float sparkFountainSparkLength; - int sparkFountainSparkCount; - float sparkFountainLoopTime; - float sparkFountainVelMin; - float sparkFountainVelMax; - float sparkFountainVelConeAngle; - float sparkFountainRestSpeed; - float sparkFountainBoostTime; - float sparkFountainBoostFactor; - }; - - union FxElemExtendedDef - { - char *unknownBytes; - FxSparkFountain *sparkFountain; - FxTrailDef *trailDef; - }; - - struct FxElemAtlas - { - char behavior; - char index; - char fps; - char loopCount; - char colIndexBits; - char rowIndexBits; - __int16 entryCount; - }; - - struct FxElemVelStateInFrame - { - FxElemVec3Range velocity; - FxElemVec3Range totalDelta; - }; - - struct FxElemVelStateSample - { - FxElemVelStateInFrame local; - FxElemVelStateInFrame world; - }; - - struct FxElemVisualState - { - char color[4]; - float rotationDelta; - float rotationTotal; - float size[2]; - float scale; - }; - - struct FxElemVisStateSample - { - FxElemVisualState base; - FxElemVisualState amplitude; - }; - - struct FxElemDef // 0xFC - { - int flags; - FxSpawnDef spawn; - FxFloatRange spawnRange; - FxFloatRange fadeInRange; - FxFloatRange fadeOutRange; - float spawnFrustumCullRadius; - FxIntRange spawnDelayMsec; - FxIntRange lifeSpanMsec; - FxFloatRange spawnOrigin[3]; - FxFloatRange spawnOffsetRadius; - FxFloatRange spawnOffsetHeight; - FxFloatRange spawnAngles[3]; - FxFloatRange angularVelocity[3]; - FxFloatRange initialRotation; - FxFloatRange gravity; - FxFloatRange reflectionFactor; - FxElemAtlas atlas; - char elemType; - char visualCount; - char velIntervalCount; - char visStateIntervalCount; - FxElemVelStateSample *velSamples; // count = velIntervalCount - FxElemVisStateSample *visSamples; // count = visStateIntervalCount - FxElemDefVisuals visuals; - //If elemType is 0xB, then use markVisuals - //If elemType is not 0xB and visualCount == 1, then use visual - //If elemType is not 0xB and visualCount != 1, then use visualsArray - - // Those are probably bounds! - vec3_t collMins; - vec3_t collMaxs; - FxEffectDefRef effectOnImpact; - FxEffectDefRef effectOnDeath; - FxEffectDefRef effectEmitted; - FxFloatRange emitDist; - FxFloatRange emitDistVariance; - FxElemExtendedDef extendedDef; - //If elemType == 3, then use trailDef - //If elemType == 6, then use sparkFountain - //If elemType != 3 && elemType != 6 use unknownBytes (size = 1) - char sortOrder; - char lightingFrac; - char useItemClip; - char unused[1]; - }; - - struct FxEffectDef - { - const char *name; - int flags; - int totalSize; - int msecLoopingLife; - int elemDefCountLooping; - int elemDefCountOneShot; - int elemDefCountEmission; - FxElemDef *elemDefs; //Count = elemDefCountOneShot + elemDefCountEmission + elemDefCountLooping - }; - -#define FX_ELEM_FIELD_COUNT 90 - - struct FxEditorElemAtlas - { - int behavior; - int index; - int fps; - int loopCount; - int indexRange; - int colIndexBits; - int rowIndexBits; - int entryCount; - }; - - struct FxCurve - { - int dimensionCount; - int keyCount; - float keys[1]; - }; - - struct FxEditorTrailDef - { - FxTrailVertex verts[64]; - int vertCount; - unsigned __int16 inds[128]; - int indCount; - }; - - struct FxEditorElemDef - { - char name[48]; - int editorFlags; - int flags; - FxFloatRange spawnRange; - FxFloatRange fadeInRange; - FxFloatRange fadeOutRange; - float spawnFrustumCullRadius; - FxSpawnDefLooping spawnLooping; - FxSpawnDefOneShot spawnOneShot; - FxIntRange spawnDelayMsec; - FxIntRange lifeSpanMsec; - FxFloatRange spawnOrigin[3]; - FxFloatRange spawnOffsetRadius; - FxFloatRange spawnOffsetHeight; - FxFloatRange spawnAngles[3]; - FxFloatRange angularVelocity[3]; - FxFloatRange initialRotation; - FxFloatRange gravity; - FxFloatRange elasticity; - FxEditorElemAtlas atlas; - float velScale[2][3]; - FxCurve *velShape[2][3][2]; - float rotationScale; - FxCurve *rotationShape[2]; - float sizeScale[2]; - FxCurve *sizeShape[2][2]; - float scaleScale; - FxCurve *scaleShape[2]; - FxCurve *color[2]; - FxCurve *alpha[2]; - float lightingFrac; - float decalFadeInTime; - float collOffset[3]; - float collRadius; - FxEffectDef *effectOnImpact; - FxEffectDef *effectOnDeath; - int sortOrder; - FxEffectDef *emission; - FxFloatRange emitDist; - FxFloatRange emitDistVariance; - char elemType; - __declspec(align(4)) int visualCount; - union - { - FxElemVisuals visuals[32]; - FxElemMarkVisuals markVisuals[16]; - } visuals; - int trailSplitDist; - int trailSplitArcDist; - int trailSplitTime; - int trailRepeatDist; - float trailScrollTime; - FxEditorTrailDef trailDef; - int sparkFountainGravity; - int sparkFountainBounceFrac; - int sparkFountainBounceRand; - int sparkFountainSparkSpacing; - int sparkFountainSparkLength; - int sparkFountainSparkCount; - int sparkFountainLoopTime; - int sparkFountainVelMin; - int sparkFountainVelMax; - int sparkFountainVelConeAngle; - int sparkFountainRestSpeed; - int sparkFountainBoostTime; - int sparkFountainBoostFactor; - }; - - struct FxEditorEffectDef - { - char name[64]; - int elemCount; - FxEditorElemDef elems[32]; - }; - - struct FxElemField - { - const char *keyName; - bool(__cdecl *handler)(const char**, FxEditorElemDef*); - }; - - struct cStaticModel_t - { - XModel *xmodel; - float origin[3]; - float invScaledAxis[3][3]; - float absmin[3]; - float absmax[3]; - }; - - struct ClipMaterial - { - char* name; - int unk; - int unk2; - }; - - struct cNode_t - { - cplane_t* plane; - short children[2]; - }; - - struct cLeaf_t - { - unsigned __int16 firstCollAabbIndex; - unsigned __int16 collAabbCount; - int brushContents; - int terrainContents; - Bounds bounds; - int leafBrushNode; - }; - - struct cLeafBrushNodeLeaf_t - { - unsigned __int16 *brushes; - }; - - struct cLeafBrushNodeChildren_t - { - float dist; - float range; - unsigned __int16 childOffset[2]; - }; - - union cLeafBrushNodeData_t - { - cLeafBrushNodeLeaf_t leaf; - cLeafBrushNodeChildren_t children; - }; - - struct cLeafBrushNode_t - { - char axis; - __int16 leafBrushCount; - int contents; - cLeafBrushNodeData_t data; - }; - - struct cmodel_t - { - Bounds bounds; - float radius; - cLeaf_t leaf; - }; - - enum DynEntityType - { - DYNENT_TYPE_INVALID = 0x0, - DYNENT_TYPE_CLUTTER = 0x1, - DYNENT_TYPE_DESTRUCT = 0x2, - DYNENT_TYPE_COUNT = 0x3, - }; - - struct GfxPlacement - { - float quat[4]; - float origin[3]; - }; - - struct DynEntityDef - { - DynEntityType type; - GfxPlacement pose; - XModel *xModel; - unsigned __int16 brushModel; - unsigned __int16 physicsBrushModel; - FxEffectDef *destroyFx; - PhysPreset *physPreset; - int health; - PhysMass mass; - int contents; - }; - - struct DynEntityPose - { - GfxPlacement pose; - float radius; - }; - - struct DynEntityClient - { - int physObjId; - unsigned __int16 flags; - unsigned __int16 lightingHandle; - int health; - }; - - struct DynEntityColl - { - unsigned __int16 sector; - unsigned __int16 nextEntInSector; - float linkMins[2]; - float linkMaxs[2]; - }; - - struct CollisionBorder - { - float distEq[3]; - float zBase; - float zSlope; - float start; - float length; - }; - - struct CollisionPartition - { - char triCount; - char borderCount; - int firstTri; - CollisionBorder *borders; - }; - - union CollisionAabbTreeIndex - { - int firstChildIndex; - int partitionIndex; - }; - - struct CollisionAabbTree - { - float midPoint[3]; - unsigned __int16 materialIndex; - unsigned __int16 childCount; - float halfSize[3]; - CollisionAabbTreeIndex u; - }; - - struct SModelAabbNode - { - Bounds bounds; - unsigned __int16 firstChild; - unsigned __int16 childCount; - }; - - struct clipMap_t - { - const char* name; - int isInUse; // +8 - int numCPlanes; // +8 - cplane_t* cPlanes; // sizeof 20, +12 - int numStaticModels; // +16 - cStaticModel_t* staticModelList; // sizeof 76, +20 - int numMaterials; // +24 - ClipMaterial* materials; // sizeof 12 with a string (possibly name?), +28 - int numCBrushSides; // +32 - cbrushside_t* cBrushSides; // sizeof 8, +36 - int numCBrushEdges; // +40 - char* cBrushEdges; // +44 - int numCNodes; // +48 - cNode_t* cNodes; // sizeof 8, +52 - int numCLeaf; // +56 - cLeaf_t* cLeaf; // +60 - int numCLeafBrushNodes; // +64 - cLeafBrushNode_t* cLeafBrushNodes; // +68 - int numLeafBrushes; // +72 - short* leafBrushes; // +76 - int numLeafSurfaces; // +80 - int* leafSurfaces; // +84 - int numVerts; // +88 - vec3_t* verts; // +92 - int numTriIndices; // +96 - short* triIndices; // +100 - bool* triEdgeIsWalkable; // +104 - int numCollisionBorders; // +108 - CollisionBorder* collisionBorders;// sizeof 28, +112 - int numCollisionPartitions; // +116 - CollisionPartition* collisionPartitions; // sizeof 12, +120 - int numCollisionAABBTrees; // +124 - CollisionAabbTree* collisionAABBTrees;// sizeof 32, +128 - int numCModels; // +132 - cmodel_t* cModels; // sizeof 68, +136 - short numCBrushes; // +140 - short pad2; // +142 - cbrush_t * cBrushes; // sizeof 36, +144 - Bounds* cBrushBounds; // same count as cBrushes, +148 - int * cBrushContents; // same count as cBrushes, +152 - MapEnts * mapEnts; // +156 - unsigned __int16 smodelNodeCount; - short pad; // +160 - SModelAabbNode *smodelNodes; - unsigned __int16 dynEntCount[2]; - DynEntityDef *dynEntDefList[2]; - DynEntityPose *dynEntPoseList[2]; - DynEntityClient *dynEntClientList[2]; - DynEntityColl *dynEntCollList[2]; - unsigned int checksum; - char unknown5[0x30]; - }; // +256 - - struct G_GlassPiece - { - unsigned __int16 damageTaken; - unsigned __int16 collapseTime; - int lastStateChangeTime; - char impactDir; - char impactPos[2]; - }; - - struct G_GlassName - { - char *nameStr; - __int16 name; - unsigned __int16 pieceCount; - unsigned __int16 *pieceIndices; - }; - - struct G_GlassData - { - G_GlassPiece *glassPieces; - unsigned int pieceCount; - unsigned __int16 damageToWeaken; - unsigned __int16 damageToDestroy; - unsigned int glassNameCount; - G_GlassName *glassNames; - char pad[108]; - }; - - struct pathbasenode_t - { - float vOrigin[3]; - unsigned int type; - }; - - struct pathnode_tree_nodes_t - { - int nodeCount; - unsigned __int16 *nodes; - }; - - struct pathnode_tree_t; - - union pathnode_tree_info_t - { - pathnode_tree_t *child[2]; - pathnode_tree_nodes_t s; - }; - - struct pathnode_tree_t - { - int axis; - float dist; - pathnode_tree_info_t u; - }; - - enum nodeType - { - NODE_BADNODE = 0x0, - NODE_PATHNODE = 0x1, - NODE_COVER_STAND = 0x2, - NODE_COVER_CROUCH = 0x3, - NODE_COVER_CROUCH_WINDOW = 0x4, - NODE_COVER_PRONE = 0x5, - NODE_COVER_RIGHT = 0x6, - NODE_COVER_LEFT = 0x7, - NODE_COVER_WIDE_RIGHT = 0x8, - NODE_COVER_WIDE_LEFT = 0x9, - NODE_CONCEALMENT_STAND = 0xA, - NODE_CONCEALMENT_CROUCH = 0xB, - NODE_CONCEALMENT_PRONE = 0xC, - NODE_REACQUIRE = 0xD, - NODE_BALCONY = 0xE, - NODE_SCRIPTED = 0xF, - NODE_NEGOTIATION_BEGIN = 0x10, - NODE_NEGOTIATION_END = 0x11, - NODE_TURRET = 0x12, - NODE_GUARD = 0x13, - NODE_NUMTYPES = 0x14, - NODE_DONTLINK = 0x14, - }; - - struct pathlink_s - { - float fDist; - unsigned __int16 nodeNum; - char disconnectCount; - char negotiationLink; - char ubBadPlaceCount[4]; - }; - - struct pathnode_constant_t - { - nodeType type; - unsigned __int16 spawnflags; - unsigned __int16 targetname; - unsigned __int16 script_linkName; - unsigned __int16 script_noteworthy; - unsigned __int16 target; - unsigned __int16 animscript; - int animscriptfunc; - float vOrigin[3]; - float fAngle; - float forward[2]; - float fRadius; - float minUseDistSq; - __int16 wOverlapNode[2]; -// __int16 wChainId; -// __int16 wChainDepth; -// __int16 wChainParent; - unsigned __int16 totalLinkCount; - pathlink_s *Links; - }; - - struct pathnode_dynamic_t - { - void *pOwner; - int iFreeTime; - int iValidTime[3]; - int inPlayerLOSTime; - __int16 wLinkCount; - __int16 wOverlapCount; - __int16 turretEntNumber; - __int16 userCount; - }; - - struct pathnode_t; - - struct pathnode_transient_t - { - int iSearchFrame; - pathnode_t *pNextOpen; - pathnode_t *pPrevOpen; - pathnode_t *pParent; - float fCost; - float fHeuristic; - float costFactor; - }; - - struct pathnode_t - { - pathnode_constant_t constant; - pathnode_dynamic_t dynamic; - pathnode_transient_t transient; - char pad[12]; - }; - - struct PathData - { - unsigned int nodeCount; - pathnode_t *nodes; - pathbasenode_t *basenodes; - unsigned int chainNodeCount; - unsigned __int16 *chainNodeForNode; - unsigned __int16 *nodeForChainNode; - int visBytes; - char *pathVis; - int nodeTreeCount; - pathnode_tree_t *nodeTree; - }; - - struct VehicleTrackObstacle - { - char pad[12]; - }; - - struct VehicleTrackSector - { - char pad[52]; - VehicleTrackObstacle* trackObstacles; - int trackObstacleCount; - }; - - struct VehicleTrackSegment - { - const char* name; - VehicleTrackSector* trackSectors; - int trackSectorCount; - VehicleTrackSegment** trackSegments1; - int trackSegmentCount1; - VehicleTrackSegment** trackSegments2; - int trackSegmentCount2; - int pad[4]; - }; - - struct VehicleTrack - { - VehicleTrackSegment* trackSegments; - int trackSegmentCount; - }; - - struct GameWorldSp - { - const char* name; - PathData pathData; - VehicleTrack vehicleTrack; - G_GlassData* data; - }; - - struct GameWorldMp - { - const char* name; - G_GlassData* data; + const char *accelGraphName; + VehicleAxleType steeringAxle; + VehicleAxleType powerAxle; + VehicleAxleType brakingAxle; + float topSpeed; + float reverseSpeed; + float maxVelocity; + float maxPitch; + float maxRoll; + float suspensionTravelFront; + float suspensionTravelRear; + float suspensionStrengthFront; + float suspensionDampingFront; + float suspensionStrengthRear; + float suspensionDampingRear; + float frictionBraking; + float frictionCoasting; + float frictionTopSpeed; + float frictionSide; + float frictionSideRear; + float velocityDependentSlip; + float rollStability; + float rollResistance; + float pitchResistance; + float yawResistance; + float uprightStrengthPitch; + float uprightStrengthRoll; + float targetAirPitch; + float airYawTorque; + float airPitchTorque; + float minimumMomentumForCollision; + float collisionLaunchForceScale; + float wreckedMassScale; + float wreckedBodyFriction; + float minimumJoltForNotify; + float slipThresholdFront; + float slipThresholdRear; + float slipFricScaleFront; + float slipFricScaleRear; + float slipFricRateFront; + float slipFricRateRear; + float slipYawTorque; }; struct VehicleDef { - const char* name; - char pad[408]; - void* weaponDef; - char pad2[304]; + const char *name; + VehicleType type; + const char *useHintString; + int health; + int quadBarrel; + float texScrollScale; + float topSpeed; + float accel; + float rotRate; + float rotAccel; + float maxBodyPitch; + float maxBodyRoll; + float fakeBodyAccelPitch; + float fakeBodyAccelRoll; + float fakeBodyVelPitch; + float fakeBodyVelRoll; + float fakeBodySideVelPitch; + float fakeBodyPitchStrength; + float fakeBodyRollStrength; + float fakeBodyPitchDampening; + float fakeBodyRollDampening; + float fakeBodyBoatRockingAmplitude; + float fakeBodyBoatRockingPeriod; + float fakeBodyBoatRockingRotationPeriod; + float fakeBodyBoatRockingFadeoutSpeed; + float boatBouncingMinForce; + float boatBouncingMaxForce; + float boatBouncingRate; + float boatBouncingFadeinSpeed; + float boatBouncingFadeoutSteeringAngle; + float collisionDamage; + float collisionSpeed; + float killcamOffset[3]; + int playerProtected; + int bulletDamage; + int armorPiercingDamage; + int grenadeDamage; + int projectileDamage; + int projectileSplashDamage; + int heavyExplosiveDamage; + VehiclePhysDef vehPhysDef; + float boostDuration; + float boostRechargeTime; + float boostAcceleration; + float suspensionTravel; + float maxSteeringAngle; + float steeringLerp; + float minSteeringScale; + float minSteeringSpeed; + int camLookEnabled; + float camLerp; + float camPitchInfluence; + float camRollInfluence; + float camFovIncrease; + float camFovOffset; + float camFovSpeed; + const char *turretWeaponName; + WeaponCompleteDef *turretWeapon; + float turretHorizSpanLeft; + float turretHorizSpanRight; + float turretVertSpanUp; + float turretVertSpanDown; + float turretRotRate; + snd_alias_list_t *turretSpinSnd; + snd_alias_list_t *turretStopSnd; + int trophyEnabled; + float trophyRadius; + float trophyInactiveRadius; + int trophyAmmoCount; + float trophyReloadTime; + unsigned __int16 trophyTags[4]; + Material *compassFriendlyIcon; + Material *compassEnemyIcon; + int compassIconWidth; + int compassIconHeight; + snd_alias_list_t *idleLowSnd; + snd_alias_list_t *idleHighSnd; + snd_alias_list_t *engineLowSnd; + snd_alias_list_t *engineHighSnd; + float engineSndSpeed; + snd_alias_list_t *engineStartUpSnd; + int engineStartUpLength; + snd_alias_list_t *engineShutdownSnd; + snd_alias_list_t *engineIdleSnd; + snd_alias_list_t *engineSustainSnd; + snd_alias_list_t *engineRampUpSnd; + int engineRampUpLength; + snd_alias_list_t *engineRampDownSnd; + int engineRampDownLength; + snd_alias_list_t *suspensionSoftSnd; + float suspensionSoftCompression; + snd_alias_list_t *suspensionHardSnd; + float suspensionHardCompression; + snd_alias_list_t *collisionSnd; + float collisionBlendSpeed; + snd_alias_list_t *speedSnd; + float speedSndBlendSpeed; + const char *surfaceSndPrefix; + snd_alias_list_t *surfaceSnds[31]; + float surfaceSndBlendSpeed; + float slideVolume; + float slideBlendSpeed; + float inAirPitch; }; - struct XModelDrawInfo - { - unsigned __int16 lod; - unsigned __int16 surfId; - }; - - struct GfxSceneDynModel - { - XModelDrawInfo info; - unsigned __int16 dynEntId; - }; - - struct BModelDrawInfo - { - unsigned __int16 surfId; - }; - - struct GfxSceneDynBrush - { - BModelDrawInfo info; - unsigned __int16 dynEntId; - }; - - struct GfxStreamingAabbTree - { - unsigned __int16 firstItem; - unsigned __int16 itemCount; - unsigned __int16 firstChild; - unsigned __int16 childCount; - float mins[3]; - float maxs[3]; - }; - - struct GfxWorldStreamInfo - { - int aabbTreeCount; - GfxStreamingAabbTree *aabbTrees; - int leafRefCount; - int *leafRefs; - }; - - struct GfxWorldVertex - { - float xyz[3]; - float binormalSign; - GfxColor color; - float texCoord[2]; - float lmapCoord[2]; - PackedUnitVec normal; - PackedUnitVec tangent; - }; - - struct GfxWorldVertexData - { - GfxWorldVertex *vertices; - void/*IDirect3DVertexBuffer9*/* worldVb; - }; - -#pragma pack(push, 4) - struct GfxLightImage - { - GfxImage *image; - char samplerState; - }; -#pragma pack(pop) - - struct GfxLightDef + struct AddonMapEnts { const char *name; - GfxLightImage attenuation; - int lmapLookupStart; - }; - - struct GfxLight - { - char type; - char canUseShadowMap; - char unused[2]; - float color[3]; - float dir[3]; - float origin[3]; - float radius; - float cosHalfFovOuter; - float cosHalfFovInner; - int exponent; - unsigned int spotShadowIndex; - GfxLightDef *def; - }; - - struct GfxReflectionProbe - { - float origin[3]; - }; - - struct GfxWorldDpvsPlanes - { - int cellCount; - cplane_t *planes; - unsigned __int16 *nodes; - unsigned int *sceneEntCellBits; //Size = cellCount << 11 - }; - - struct GfxAabbTree - { - Bounds bounds; - unsigned __int16 childCount; - unsigned __int16 surfaceCount; - unsigned __int16 startSurfIndex; - unsigned __int16 surfaceCountNoDecal; - unsigned __int16 startSurfIndexNoDecal; - unsigned __int16 smodelIndexCount; - unsigned __int16 *smodelIndexes; - int childrenOffset; - }; - - struct GfxCellTree - { - GfxAabbTree *aabbTree; - }; - - struct GfxCellTreeCount - { - int aabbTreeCount; - }; - - struct GfxLightGridEntry - { - unsigned __int16 colorsIndex; - char primaryLightIndex; - char needsTrace; - }; - - struct GfxLightGridColors - { - char rgb[56][3]; - }; - - struct GfxStaticModelInst - { - Bounds bounds; - float lightingOrigin[3]; - }; - - enum surfaceType_t - { - SF_TRIANGLES = 0x0, - SF_TRIANGLES_NO_SUN_SHADOW = 0x1, - SF_BEGIN_STATICMODEL = 0x2, - SF_STATICMODEL_RIGID = 0x2, - SF_STATICMODEL_INSTANCED = 0x3, - SF_STATICMODEL_RIGID_NO_SUN_SHADOW = 0x4, - SF_STATICMODEL_INSTANCED_NO_SUN_SHADOW = 0x5, - SF_END_STATICMODEL = 0x6, - SF_BMODEL = 0x6, - SF_BEGIN_XMODEL = 0x7, - SF_XMODEL_RIGID = 0x7, - SF_XMODEL_SKINNED = 0x8, - SF_END_XMODEL = 0x9, - SF_BEGIN_FX = 0x9, - SF_CODE = 0x9, - SF_GLASS = 0xA, - SF_MARK = 0xB, - SF_SPARK = 0xC, - SF_PARTICLE_CLOUD = 0xD, - SF_PARTICLE_SPARK_CLOUD = 0xE, - SF_END_FX = 0xF, - SF_NUM_SURFACE_TYPES = 0xF, - SF_FORCE_32_BITS = 0xFFFFFFFF, - }; - - struct srfTriangles_t - { - int vertexLayerData; - int firstVertex; - unsigned __int16 vertexCount; - unsigned __int16 triCount; - int baseIndex; - }; - - struct GfxSurface - { - srfTriangles_t tris; - Material *material; - char lightmapIndex; - char reflectionProbeIndex; - char primaryLightIndex; - char flag; - }; - - struct GfxSurfaceBounds - { - Bounds bounds; - //char flags; - }; - - struct GfxPackedPlacement - { - float origin[3]; - vec3_t axis[3]; - float scale; - }; - - struct GfxStaticModelDrawInst - { - GfxPackedPlacement placement; - XModel *model; - unsigned __int16 cullDist; - unsigned __int16 lightingHandle; - char reflectionProbeIndex; - char primaryLightIndex; - char flags; - char firstMtlSkinIndex; - GfxColor groundLighting; - unsigned __int16 cacheId[4]; - }; - - struct GfxWorldDpvsStatic - { - unsigned int smodelCount; - unsigned int staticSurfaceCount; - unsigned int staticSurfaceCountNoDecal; - unsigned int litOpaqueSurfsBegin; - unsigned int litOpaqueSurfsEnd; - unsigned int litTransSurfsBegin; - unsigned int litTransSurfsEnd; - unsigned int shadowCasterSurfsBegin; - unsigned int shadowCasterSurfsEnd; - unsigned int emissiveSurfsBegin; - unsigned int emissiveSurfsEnd; - unsigned int smodelVisDataCount; - unsigned int surfaceVisDataCount; - char *smodelVisData[3]; - char *surfaceVisData[3]; - unsigned __int16 *sortedSurfIndex; - GfxStaticModelInst *smodelInsts; - GfxSurface *surfaces; - GfxSurfaceBounds *surfacesBounds; - GfxStaticModelDrawInst *smodelDrawInsts; - GfxDrawSurf *surfaceMaterials; - unsigned int *surfaceCastsSunShadow; - volatile int usageCount; - }; - -#pragma pack(push, 4) - - struct GfxPortal; - - struct GfxPortalWritable - { - bool isQueued; - bool isAncestor; - char recursionDepth; - char hullPointCount; - float(*hullPoints)[2]; - GfxPortal *queuedParent; - }; - - struct DpvsPlane - { - float coeffs[4]; - }; - - struct DpvsPlanes - { - DpvsPlane *planes; - int count; - }; - - struct DpvsClipPlaneSet - { - DpvsPlane *planes[16]; - unsigned int count; - }; - -#pragma pack(push, 1) - struct DpvsStaticCellCmd - { - DpvsPlane *planes; - GfxAabbTree *tree; - char planeCount; - char frustumPlaneCount; - unsigned __int16 sceneViewType; - }; -#pragma pack(pop) - - struct GfxPortal - { - GfxPortalWritable writable; - DpvsPlane plane; - vec3_t* vertices; - unsigned __int16 cellIndex; - char vertexCount; - float hullAxis[2][3]; - }; - - struct GfxCell - { - Bounds bounds; - int portalCount; - GfxPortal *portals; - char reflectionProbeCount; - char *reflectionProbes; - }; - - struct GfxLightmapArray - { - GfxImage *primary; - GfxImage *secondary; - }; - - struct GfxLightGrid - { - bool hasLightRegions; - unsigned int sunPrimaryLightIndex; - unsigned __int16 mins[3]; - unsigned __int16 maxs[3]; - unsigned int rowAxis; - unsigned int colAxis; - unsigned __int16 *rowDataStart; - unsigned int rawRowDataSize; - char *rawRowData; - unsigned int entryCount; - GfxLightGridEntry *entries; - unsigned int colorCount; - GfxLightGridColors *colors; - }; - - struct GfxBrushModelWritable - { - Bounds bounds; - }; - - struct GfxBrushModel - { - GfxBrushModelWritable writable; - Bounds bounds; - float radius; - unsigned short surfaceCount; - unsigned short startSurfIndex; - unsigned short surfaceCountNoDecal; - }; - - struct MaterialMemory - { - Material *material; - int memory; - }; - - struct sunflare_t - { - bool hasValidData; - Material *spriteMaterial; - Material *flareMaterial; - float spriteSize; - float flareMinSize; - float flareMinDot; - float flareMaxSize; - float flareMaxDot; - float flareMaxAlpha; - int flareFadeInTime; - int flareFadeOutTime; - float blindMinDot; - float blindMaxDot; - float blindMaxDarken; - int blindFadeInTime; - int blindFadeOutTime; - float glareMinDot; - float glareMaxDot; - float glareMaxLighten; - int glareFadeInTime; - int glareFadeOutTime; - float sunFxPosition[3]; - }; - - struct GfxShadowGeometry - { - unsigned __int16 surfaceCount; - unsigned __int16 smodelCount; - unsigned __int16 *sortedSurfIndex; - unsigned __int16 *smodelIndex; - }; - - struct GfxLightRegionAxis - { - float dir[3]; - float midPoint; - float halfSize; - }; - - struct GfxLightRegionHull - { - float kdopMidPoint[9]; - float kdopHalfSize[9]; - unsigned int axisCount; - GfxLightRegionAxis *axis; - }; - - struct GfxLightRegion - { - unsigned int hullCount; - GfxLightRegionHull *hulls; - }; - - struct GfxWorldDpvsDynamic - { - unsigned int dynEntClientWordCount[2]; - unsigned int dynEntClientCount[2]; - unsigned int *dynEntCellBits[2]; - char *dynEntVisData[2][3]; - }; - - struct SunLightParseParams - { - char name[64]; - float ambientScale; - float ambientColor[3]; - float diffuseFraction; - float sunLight; - float sunColor[3]; - float diffuseColor[3]; - bool diffuseColorHasBeenSet; - float angles[3]; - }; - - struct GfxWorldVertexLayerData - { - char *data; - void/*IDirect3DVertexBuffer9*/* layerVb; - }; - - typedef unsigned int GfxRawTexture; - - struct GfxWorldDraw - { - unsigned int reflectionProbeCount; - GfxImage * * reflectionImages; - GfxReflectionProbe *reflectionProbes; - GfxRawTexture * reflectionProbeTextures; //Count = refelctionProbeCount - int lightmapCount; - GfxLightmapArray *lightmaps; - GfxRawTexture * lightmapPrimaryTextures; //Count = lightmapCount - GfxRawTexture * lightmapSecondaryTextures; //Count = lightmapCount - GfxImage *skyImage; - GfxImage *outdoorImage; - unsigned int vertexCount; - GfxWorldVertexData vd; - unsigned int vertexLayerDataSize; - GfxWorldVertexLayerData vld; - int indexCount; - unsigned __int16 *indices; - }; - - struct GfxSky - { - int skySurfCount; - int * skyStartSurfs; - GfxImage * skyImage; - int skySamplerState; - }; - - struct GfxHeroOnlyLight - { - char pad[56]; - }; - - struct GfxWorld - { - const char *name; - const char *baseName; - int planeCount; - int nodeCount; - unsigned int surfaceCount; - int skyCount; - GfxSky *skies; - unsigned int lastSunPrimaryLightIndex; - unsigned int primaryLightCount; - unsigned int sortKeyLitDecal; - unsigned int sortKeyEffectDecal; - unsigned int sortKeyEffectAuto; - unsigned int sortKeyDistortion; - GfxWorldDpvsPlanes dpvsPlanes; - GfxCellTreeCount *aabbTreeCounts; - GfxCellTree *aabbTrees; - GfxCell *cells; - GfxWorldDraw draw; - GfxLightGrid lightGrid; - int modelCount; - GfxBrushModel *models; - Bounds bounds; - unsigned int checksum; - int materialMemoryCount; - MaterialMemory *materialMemory; - sunflare_t sun; - float outdoorLookupMatrix[4][4]; - GfxImage *outdoorImage; - unsigned int *cellCasterBits; - unsigned int *cellHasSunLitSurfsBits; - GfxSceneDynModel *sceneDynModel; - GfxSceneDynBrush *sceneDynBrush; - unsigned int *primaryLightEntityShadowVis; - unsigned int *primaryLightDynEntShadowVis[2]; - char *nonSunPrimaryLightForModelDynEnt; - GfxShadowGeometry *shadowGeom; - GfxLightRegion *lightRegion; - GfxWorldDpvsStatic dpvs; - GfxWorldDpvsDynamic dpvsDyn; - unsigned int mapVtxChecksum; - unsigned int heroOnlyLightCount; - GfxHeroOnlyLight *heroOnlyLights; - char fogTypesAllowed; - }; -#pragma pack(pop) - - struct rgpStruct - { - int pad[2117]; - GfxWorld* world; - }; - - struct ComPrimaryLight - { - char type; - char canUseShadowMap; - char exponent; - char unused; - float color[3]; - float dir[3]; - float origin[3]; - float radius; - float cosHalfFovOuter; - float cosHalfFovInner; - float cosHalfFovExpanded; - float rotationLimit; - float translationLimit; - const char *defName; - }; - - struct ComWorld - { - const char *name; - int isInUse; - unsigned int primaryLightCount; - ComPrimaryLight *primaryLights; - }; - -#pragma pack(push, 4) - struct FxGlassDef - { - float halfThickness; - float texVecs[2][2]; - GfxColor color; - Material *material; - Material *materialShattered; - PhysPreset *physPreset; - }; -#pragma pack(pop) - - struct FxSpatialFrame - { - float quat[4]; - float origin[3]; - }; - - union FxGlassPiecePlace - { - struct - { - FxSpatialFrame frame; - float radius; - }; - unsigned int nextFree; - }; - - struct FxGlassPieceState - { - float texCoordOrigin[2]; - unsigned int supportMask; - unsigned __int16 initIndex; - unsigned __int16 geoDataStart; - unsigned __int16 lightingIndex; - char defIndex; - char pad[3]; - char vertCount; - char holeDataCount; - char crackDataCount; - char fanDataCount; - unsigned __int16 flags; - float areaX2; - }; - - struct FxGlassPieceDynamics - { - char pad[36]; - }; - - struct FxGlassVertex - { - __int16 x; - __int16 y; - }; - - struct FxGlassHoleHeader - { - unsigned __int16 uniqueVertCount; - char touchVert; - char pad[1]; - }; - - struct FxGlassCrackHeader - { - unsigned __int16 uniqueVertCount; - char beginVertIndex; - char endVertIndex; - }; - - union FxGlassGeometryData - { - FxGlassVertex vert; - FxGlassHoleHeader hole; - FxGlassCrackHeader crack; - char asBytes[4]; - __int16 anonymous[2]; - }; - -#pragma pack(push, 4) - struct FxGlassInitPieceState //Note, on MW3 this is missing 4 bytes, just not sure whats missing yet - { - /* - FxSpatialFrame frame; - float radius; - float texCoordOrigin[2]; - unsigned int supportMask; - float areaX2; - unsigned __int16 lightingIndex; - char defIndex; - char vertCount; - char fanDataCount; - */ - char pad[52]; - }; -#pragma pack(pop) - -#pragma pack(push, 8) - struct FxGlassSystem - { - int time; - int prevTime; - unsigned int defCount; - unsigned int pieceLimit; - unsigned int pieceWordCount; - unsigned int initPieceCount; - unsigned int cellCount; - unsigned int activePieceCount; - unsigned int firstFreePiece; - unsigned int geoDataLimit; - unsigned int geoDataCount; - unsigned int initGeoDataCount; - FxGlassDef *defs; - FxGlassPiecePlace *piecePlaces; - FxGlassPieceState *pieceStates; - FxGlassPieceDynamics *pieceDynamics; - FxGlassGeometryData *geoData; - unsigned int *isInUse; - unsigned int *cellBits; - char *visData; - float(*linkOrg)[3]; - float *halfThickness; - unsigned __int16 *lightingHandles; - FxGlassInitPieceState *initPieceStates; - FxGlassGeometryData *initGeoData; - bool needToCompactData; - char initCount; - float effectChanceAccum; - int lastPieceDeletionTime; - }; -#pragma pack(pop) - - struct FxWorld - { - const char * name; - FxGlassSystem glassSys; + char *entityString; + int numEntityChars; + MapTriggers trigger; }; union XAssetHeader { void *data; - + PhysPreset *physPreset; + PhysCollmap *physCollmap; + XAnimParts *parts; + XModelSurfs *modelSurfs; + XModel *model; + Material *material; + MaterialPixelShader *pixelShader; + MaterialVertexShader *vertexShader; + MaterialVertexDeclaration *vertexDecl; + MaterialTechniqueSet *techniqueSet; + GfxImage *image; + snd_alias_list_t *sound; + SndCurve *sndCurve; + LoadedSound *loadSnd; + clipMap_t *clipMap; + ComWorld *comWorld; + GameWorldSp *gameWorldSp; + GameWorldMp *gameWorldMp; + MapEnts *mapEnts; + FxWorld *fxWorld; + GfxWorld *gfxWorld; + GfxLightDef *lightDef; + Font_s *font; MenuList *menuList; menuDef_t *menu; - Material *material; - snd_alias_list_t* sound; - LocalizeEntry* localize; - StringTable* stringTable; - MapEnts* mapEnts; - RawFile* rawfile; - GfxImage* image; - Font* font; - MaterialTechniqueSet* techniqueSet; - MaterialVertexDeclaration* vertexDecl; - MaterialVertexShader* vertexShader; - MaterialPixelShader* pixelShader; - StructuredDataDefSet* structuredData; - XModel* model; - PhysPreset* physPreset; - PhysCollmap* physCollmap; - XModelSurfs* surfaces; - XAnimParts* parts; - clipMap_t* clipMap; - FxEffectDef* fx; - GameWorldMp* gameWorldMp; - GameWorldSp* gameWorldSp; - TracerDef* tracer; - VehicleDef* vehicle; - FxWorld* fxWorld; - GfxWorld* gfxWorld; - GfxLightDef* lightDef; - SndCurve* sndCurve; - LoadedSound* loadSnd; - ComWorld* comWorld; + LocalizeEntry *localize; + WeaponCompleteDef *weapon; + SndDriverGlobals *sndDriverGlobals; + FxEffectDef *fx; + FxImpactTable *impactFx; + RawFile *rawfile; + StringTable *stringTable; + LeaderboardDef *leaderboardDef; + StructuredDataDefSet *structuredDataDefSet; + TracerDef *tracerDef; + VehicleDef *vehDef; + AddonMapEnts *addonMapEnts; }; struct XAsset @@ -4102,6 +4067,560 @@ namespace Game int numParam; }; + enum UILocalVarType + { + UILOCALVAR_INT = 0x0, + UILOCALVAR_FLOAT = 0x1, + UILOCALVAR_STRING = 0x2, + }; + + union $B42A88463653BDCDFC5664844B4491DA + { + int integer; + float value; + const char *string; + }; + + struct UILocalVar + { + UILocalVarType type; + const char *name; + $B42A88463653BDCDFC5664844B4491DA u; + }; + + struct UILocalVarContext + { + UILocalVar table[256]; + }; + + struct $1942E78D15753E2013144570239460A8 + { + float x; + float y; + int lastMoveTime; + }; + + struct UiContext + { + int localClientNum; + float bias; + int realTime; + int frameTime; + $1942E78D15753E2013144570239460A8 cursor; + int isCursorVisible; + int paintFull; + int screenWidth; + int screenHeight; + float screenAspect; + float FPS; + float blurRadiusOut; + menuDef_t *Menus[640]; + int menuCount; + menuDef_t *menuStack[16]; + int openMenuCount; + UILocalVarContext localVars; + }; + + struct msg_t + { + int overflowed; + int readOnly; + char *data; + char *splitData; + int maxsize; + int cursize; + int splitSize; + int readcount; + int bit; + int lastEntityRef; + }; + + struct XZoneInfo + { + const char *name; + int allocFlags; + int freeFlags; + }; + + enum FsListBehavior_e + { + FS_LIST_PURE_ONLY = 0x0, + FS_LIST_ALL = 0x1, + }; + + enum netsrc_t + { + NS_CLIENT1 = 0x0, + NS_SERVER = 0x1, + NS_MAXCLIENTS = 0x1, + NS_PACKET = 0x2, + }; + + enum netadrtype_t + { + NA_BOT = 0x0, + NA_BAD = 0x1, + NA_LOOPBACK = 0x2, + NA_BROADCAST = 0x3, + NA_IP = 0x4, + NA_IPX = 0x5, + NA_BROADCAST_IPX = 0x6, + }; + + typedef union + { + unsigned char bytes[4]; + DWORD full; + } netIP_t; + + struct netadr_t + { + netadrtype_t type; + //char ip[4]; + netIP_t ip; + unsigned __int16 port; + char ipx[10]; + }; + + struct FxEditorElemAtlas + { + int behavior; + int index; + int fps; + int loopCount; + int colIndexBits; + int rowIndexBits; + int entryCount; + }; + + struct FxCurve + { + int dimensionCount; + int keyCount; + float keys[1]; + }; + + union $81775853B5F1E1C6748A82ED93FC367C + { + FxElemVisuals visuals[32]; + FxElemMarkVisuals markVisuals[16]; + }; + + struct FxEditorTrailDef + { + FxTrailVertex verts[64]; + int vertCount; + unsigned __int16 inds[128]; + int indCount; + }; + + struct FxEditorElemDef + { + char name[48]; + int editorFlags; + int flags; + FxFloatRange spawnRange; + FxFloatRange fadeInRange; + FxFloatRange fadeOutRange; + float spawnFrustumCullRadius; + FxSpawnDefLooping spawnLooping; + FxSpawnDefOneShot spawnOneShot; + FxIntRange spawnDelayMsec; + FxIntRange lifeSpanMsec; + FxFloatRange spawnOrigin[3]; + FxFloatRange spawnOffsetRadius; + FxFloatRange spawnOffsetHeight; + FxFloatRange spawnAngles[3]; + FxFloatRange angularVelocity[3]; + FxFloatRange initialRotation; + FxFloatRange gravity; + FxFloatRange elasticity; + FxEditorElemAtlas atlas; + float velScale[2][3]; + FxCurve *velShape[2][3][2]; + float rotationScale; + FxCurve *rotationShape[2]; + float sizeScale[2]; + FxCurve *sizeShape[2][2]; + float scaleScale; + FxCurve *scaleShape[2]; + FxCurve *color[2]; + FxCurve *alpha[2]; + float lightingFrac; + float decalFadeInTime; + float collOffset[3]; + float collRadius; + FxEffectDef *effectOnImpact; + FxEffectDef *effectOnDeath; + int sortOrder; + FxEffectDef *emission; + FxFloatRange emitDist; + FxFloatRange emitDistVariance; + char elemType; + int visualCount; + $81775853B5F1E1C6748A82ED93FC367C ___u42; + int trailSplitDist; + int trailSplitArcDist; + int trailSplitTime; + int trailRepeatDist; + float trailScrollTime; + FxEditorTrailDef trailDef; + float sparkFountainGravity; + float sparkFountainBounceFrac; + float sparkFountainBounceRand; + float sparkFountainSparkSpacing; + float sparkFountainSparkLength; + int sparkFountainSparkCount; + float sparkFountainLoopTime; + float sparkFountainVelMin; + float sparkFountainVelMax; + float sparkFountainVelConeAngle; + float sparkFountainRestSpeed; + float sparkFountainBoostTime; + float sparkFountainBoostFactor; + }; + + struct FxEditorEffectDef + { + char name[64]; + int elemCount; + FxEditorElemDef elems[32]; + }; + + struct FxElemField + { + const char *keyName; + bool(__cdecl *handler)(const char **, FxEditorElemDef *); + }; + + enum $18B36A54AD92993D0728595D3504B7CB + { + FX_ELEM_TYPE_SPRITE_BILLBOARD = 0x0, + FX_ELEM_TYPE_SPRITE_ORIENTED = 0x1, + FX_ELEM_TYPE_TAIL = 0x2, + FX_ELEM_TYPE_TRAIL = 0x3, + FX_ELEM_TYPE_CLOUD = 0x4, + FX_ELEM_TYPE_SPARK_CLOUD = 0x5, + FX_ELEM_TYPE_SPARK_FOUNTAIN = 0x6, + FX_ELEM_TYPE_MODEL = 0x7, + FX_ELEM_TYPE_OMNI_LIGHT = 0x8, + FX_ELEM_TYPE_SPOT_LIGHT = 0x9, + FX_ELEM_TYPE_SOUND = 0xA, + FX_ELEM_TYPE_DECAL = 0xB, + FX_ELEM_TYPE_RUNNER = 0xC, + FX_ELEM_TYPE_COUNT = 0xD, + FX_ELEM_TYPE_LAST_SPRITE = 0x3, + FX_ELEM_TYPE_LAST_DRAWN = 0x9, + }; + + struct infoParm_t + { + char *name; + int clearSolid; + int surfaceFlags; + int contents; + int toolFlags; + }; + + struct GfxImageFileHeader + { + char tag[3]; + char version; + unsigned int flags; + char format; + char unused; + __int16 dimensions[3]; + int fileSizeForPicmip[4]; + }; + + enum $1FA877C9772E9F0892A93F52A91453E9 + { + MAPTYPE_NONE = 0x0, + MAPTYPE_INVALID1 = 0x1, + MAPTYPE_1D = 0x2, + MAPTYPE_2D = 0x3, + MAPTYPE_3D = 0x4, + MAPTYPE_CUBE = 0x5, + MAPTYPE_COUNT = 0x6, + }; + + enum GfxImageFileFormat + { + IMG_FORMAT_INVALID = 0x0, + IMG_FORMAT_BITMAP_RGBA = 0x1, + IMG_FORMAT_BITMAP_RGB = 0x2, + IMG_FORMAT_BITMAP_LUMINANCE_ALPHA = 0x3, + IMG_FORMAT_BITMAP_LUMINANCE = 0x4, + IMG_FORMAT_BITMAP_ALPHA = 0x5, + IMG_FORMAT_WAVELET_RGBA = 0x6, + IMG_FORMAT_WAVELET_RGB = 0x7, + IMG_FORMAT_WAVELET_LUMINANCE_ALPHA = 0x8, + IMG_FORMAT_WAVELET_LUMINANCE = 0x9, + IMG_FORMAT_WAVELET_ALPHA = 0xA, + IMG_FORMAT_DXT1 = 0xB, + IMG_FORMAT_DXT3 = 0xC, + IMG_FORMAT_DXT5 = 0xD, + IMG_FORMAT_DXN = 0xE, + IMG_FORMAT_DXT3A_AS_LUMINANCE = 0xF, + IMG_FORMAT_DXT5A_AS_LUMINANCE = 0x10, + IMG_FORMAT_DXT3A_AS_ALPHA = 0x11, + IMG_FORMAT_DXT5A_AS_ALPHA = 0x12, + IMG_FORMAT_DXT1_AS_LUMINANCE_ALPHA = 0x13, + IMG_FORMAT_DXN_AS_LUMINANCE_ALPHA = 0x14, + IMG_FORMAT_DXT1_AS_LUMINANCE = 0x15, + IMG_FORMAT_DXT1_AS_ALPHA = 0x16, + IMG_FORMAT_COUNT = 0x17, + }; + + enum $25EF9448C800B18F0C83DB367159AFD6 + { + PART_TYPE_NO_QUAT = 0x0, + PART_TYPE_HALF_QUAT = 0x1, + PART_TYPE_FULL_QUAT = 0x2, + PART_TYPE_HALF_QUAT_NO_SIZE = 0x3, + PART_TYPE_FULL_QUAT_NO_SIZE = 0x4, + PART_TYPE_SMALL_TRANS = 0x5, + PART_TYPE_TRANS = 0x6, + PART_TYPE_TRANS_NO_SIZE = 0x7, + PART_TYPE_NO_TRANS = 0x8, + PART_TYPE_ALL = 0x9, + PART_TYPE_COUNT = 0xA, + }; + + enum $EDD38D6A57EF43793B1F773859FC039A + { + FS_SEEK_CUR = 0x0, + FS_SEEK_END = 0x1, + FS_SEEK_SET = 0x2, + }; + +#pragma region CUSTOM + + enum itemTextStyle + { + ITEM_TEXTSTYLE_NORMAL = 0, // normal text + ITEM_TEXTSTYLE_SHADOWED = 3, // drop shadow ( need a color for this ) + ITEM_TEXTSTYLE_SHADOWEDMORE = 6, // drop shadow ( need a color for this ) + ITEM_TEXTSTYLE_BORDERED = 7, // border (stroke) + ITEM_TEXTSTYLE_BORDEREDMORE = 8, // more border :P + ITEM_TEXTSTYLE_MONOSPACE = 128, + ITEM_TEXTSTYLE_MONOSPACESHADOWED = 132, + }; + + enum $53C66D4FC2874B6934A17E4ED449BCEB + { + // DB_ZONE_COMMON = 0x1, + // DB_ZONE_UI = 0x2, + // DB_ZONE_GAME = 0x4, + // DB_ZONE_LOAD = 0x8, + // DB_ZONE_DEV = 0x10, + // DB_ZONE_TRANSIENT = 0x20, + DB_ZONE_CODE_LOC = 0x0, + DB_ZONE_COMMON_LOC = 0x1, + DB_ZONE_CODE = 0x2, + DB_ZONE_COMMON = 0x4, + DB_ZONE_GAME = 0x8, + DB_ZONE_MOD = 0x10, + DB_ZONE_LOAD = 0x20, + DB_ZONE_DEV = 0x40 + }; + + enum playerFlag + { + PLAYER_FLAG_NOCLIP = 1 << 0, + PLAYER_FLAG_UFO = 1 << 1, + PLAYER_FLAG_FROZEN = 1 << 2, + }; + + typedef struct gclient_s + { + unsigned char pad[12764]; + unsigned int team; + char pad2[436]; + int flags; + char pad3[724]; + } gclient_t; + + typedef struct gentity_s + { + int number; + unsigned char pad[308]; // 4 + float origin[3]; // 312 + float angles[3]; // 324 + char pad2[8]; + gclient_t* client; // 344 + unsigned char pad3[28]; + short classname; + short pad4; + unsigned char pad5[248]; + } gentity_t; + +#pragma pack(push, 1) + typedef struct client_s + { + // 0 + int state; + // 4 + char pad[36]; + // 40 + netadr_t addr; + // 60 + char pad1[1568]; + // 1628 + char connectInfoString[1024]; + // 2652 + char pad2[133192]; + // 135844 + char name[16]; + // 135860 + char pad3[12]; + // 135872 + int snapNum; + // 135876 + int pad4; + // 135880 + short ping; + // 135882 + //char pad5[142390]; + char pad5[133158]; + // 269040 + int isBot; + // 269044 + char pad6[9228]; + // 278272 + unsigned __int64 steamid; + // 278280 + char pad7[403592]; + } client_t; +#pragma pack(pop) + + struct CModelAllocData + { + void* mainArray; + void* vertexBuffer; + void* indexBuffer; + }; + + struct CModelSectionHeader + { + int size; + int offset; + int fixupStart; + int fixupCount; + void* buffer; + }; + + enum CModelSection + { + SECTION_MAIN = 0, + SECTION_INDEX = 1, + SECTION_VERTEX = 2, + SECTION_FIXUP = 3, + }; + + struct CModelHeader + { + int version; + unsigned int signature; + CModelSectionHeader sectionHeader[4]; + }; + + typedef struct punctuation_s + { + char *p; //punctuation character(s) + int n; //punctuation indication + struct punctuation_s *next; //next punctuation + } punctuation_t; + +#define MAX_TOKEN 1024 +#define MAX_TOKENLENGTH 1024 + + typedef struct token_s + { + char string[MAX_TOKEN]; //available token + int type; //last read token type + int subtype; //last read token sub type + unsigned long int intvalue; //integer value + long double floatvalue; //floating point value + char *whitespace_p; //start of white space before token + char *endwhitespace_p; //start of white space before token + int line; //line the token was on + int linescrossed; //lines crossed in white space + struct token_s *next; //next token in chain + } token_t; + + typedef struct script_s + { + char filename[64]; //file name of the script + char *buffer; //buffer containing the script + char *script_p; //current pointer in the script + char *end_p; //pointer to the end of the script + char *lastscript_p; //script pointer before reading token + char *whitespace_p; //begin of the white space + char *endwhitespace_p; //end of the white space + int length; //length of the script in bytes + int line; //current line in script + int lastline; //line before reading token + int tokenavailable; //set by UnreadLastToken + int flags; //several script flags + punctuation_t *punctuations; //the punctuations used in the script + punctuation_t **punctuationtable; + token_t token; //available token + struct script_s *next; //next script in a chain + } script_t; + + typedef struct define_s + { + char *name; //define name + int flags; //define flags + int builtin; // > 0 if builtin define + int numparms; //number of define parameters + token_t *parms; //define parameters + token_t *tokens; //macro tokens (possibly containing parm tokens) + struct define_s *next; //next defined macro in a list + struct define_s *hashnext; //next define in the hash chain + } define_t; + + typedef struct indent_s + { + int type; //indent type + int skip; //true if skipping current indent + script_t *script; //script the indent was in + struct indent_s *next; //next indent on the indent stack + } indent_t; + + typedef struct source_s + { + char filename[64]; //file name of the script + char includepath[64]; //path to include files + punctuation_t *punctuations; //punctuations to use + script_t *scriptstack; //stack with scripts of the source + token_t *tokens; //tokens to read first + define_t *defines; //list with macro definitions + define_t **definehash; //hash chain with defines + indent_t *indentstack; //stack with indents + int skip; // > 0 if skipping conditional code + token_t token; //last read token + } source_t; + + typedef struct pc_token_s + { + int type; + int subtype; + int intvalue; + float floatvalue; + char string[MAX_TOKENLENGTH]; + } pc_token_t; + + typedef struct keywordHash_s + { + char *keyword; + bool(*func)(menuDef_t *item, int handle); + //struct keywordHash_s *next; + } keywordHash_t; + +#pragma endregion + #ifndef IDA } #endif