From e7725f6a9c3847ab01bb74d757544915f4bde153 Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 7 Dec 2019 03:49:32 +0100 Subject: [PATCH] ZoneLoading: Fix and enable xmodel, destructibledef, gameworldsp/mp, attachment_unique, weaponcamo, fx, vehicledef --- src/ZoneCode/Game/T6/T6_Commands.txt | 13 +++++++------ src/ZoneCommon/Game/T6/T6_Assets.h | 16 ++++++++++------ src/ZoneLoading/Game/T6/ContentLoaderT6.cpp | 16 ++++++++-------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/ZoneCode/Game/T6/T6_Commands.txt b/src/ZoneCode/Game/T6/T6_Commands.txt index 7c850829..dba65147 100644 --- a/src/ZoneCode/Game/T6/T6_Commands.txt +++ b/src/ZoneCode/Game/T6/T6_Commands.txt @@ -219,12 +219,12 @@ use XSurface; set condition verts0 !(flags & 1); set reusable verts0; set count verts0 vertCount; -set count vb0 0; +set condition vb0 never; set reusable vertList; set count vertList vertListCount; set reusable triIndices; set count triIndices triCount; -set count indexBuffer 0; +set condition indexBuffer never; reorder: vertInfo verts0 @@ -240,12 +240,12 @@ set count vertsBlend vertCount[0] + 7 * vertCount[3]; set reusable tensionData; set count tensionData vertCount[0] - + 3 * vertCount[1] - + 5 * vertCount[2] - + 7 * vertCount[3]; + + vertCount[1] + + vertCount[2] + + vertCount[3]; // XRigidVertList -set count XRigidVertList::collisionTree 1; +set reusable XRigidVertList::collisionTree; // XSurfaceCollisionTree use XSurfaceCollisionTree; @@ -515,6 +515,7 @@ set reusable u::child; // pathnode_tree_nodes_t use pathnode_tree_nodes_t; +set count nodes nodeCount; // ========================================= // GameWorldMp diff --git a/src/ZoneCommon/Game/T6/T6_Assets.h b/src/ZoneCommon/Game/T6/T6_Assets.h index e9c141e2..a57d9868 100644 --- a/src/ZoneCommon/Game/T6/T6_Assets.h +++ b/src/ZoneCommon/Game/T6/T6_Assets.h @@ -2455,6 +2455,8 @@ struct XSurfaceVertexInfo float *tensionData; }; +typedef __declspec(align(16)) unsigned short r_index16_t; + struct __declspec(align(16)) XSurface { char tileMode; @@ -2463,7 +2465,7 @@ struct __declspec(align(16)) XSurface unsigned __int16 vertCount; unsigned __int16 triCount; unsigned __int16 baseVertIndex; - unsigned __int16 (*triIndices)[3]; + r_index16_t (*triIndices)[3]; XSurfaceVertexInfo vertInfo; GfxPackedVertex *verts0; ID3D11Buffer *vb0; @@ -3020,7 +3022,7 @@ struct pathnode_t pathnode_transient_t transient; }; -struct pathbasenode_t +struct __declspec(align(16)) pathbasenode_t { vec3_t vOrigin; unsigned int type; @@ -4922,7 +4924,7 @@ union PackedUnitVec unsigned int packed; }; -struct GfxPackedVertex +struct __declspec(align(16)) GfxPackedVertex { vec3_t xyz; float binormalSign; @@ -4948,10 +4950,12 @@ struct XModelCollTri_s vec4_t tvec; }; +typedef __declspec(align(16)) PhysGeomInfo PhysGeomInfo16; + struct PhysGeomList { unsigned int count; - PhysGeomInfo *geoms; + PhysGeomInfo16 *geoms; int contents; }; @@ -5777,7 +5781,7 @@ struct XSurfaceCollisionAabb unsigned __int16 maxs[3]; }; -struct XSurfaceCollisionNode +struct __declspec(align(16)) XSurfaceCollisionNode { XSurfaceCollisionAabb aabb; unsigned __int16 childBeginIndex; @@ -5789,7 +5793,7 @@ struct XSurfaceCollisionLeaf unsigned __int16 triangleBeginIndex; }; -struct BrushWrapper +struct __declspec(align(16)) BrushWrapper { vec3_t mins; int contents; diff --git a/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp b/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp index 7f535aea..a5a8932c 100644 --- a/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp +++ b/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp @@ -107,9 +107,9 @@ void ContentLoaderT6::LoadXAsset(const bool atStreamStart) { LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset); LOAD_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints); - // LOAD_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef); + LOAD_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef); // LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts); - // LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model); + LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model); LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material); // LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet); // LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image); @@ -118,8 +118,8 @@ void ContentLoaderT6::LoadXAsset(const bool atStreamStart) // LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap); // LOAD_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap); LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld); - // LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp); - // LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp); + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp); + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp); LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts); // LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld); LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef); @@ -130,10 +130,10 @@ void ContentLoaderT6::LoadXAsset(const bool atStreamStart) LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize); // LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon); LOAD_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment); - // LOAD_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique); - // LOAD_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo); + LOAD_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique); + LOAD_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo); LOAD_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals); - // LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx); + LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx); LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx); LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile); LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable); @@ -144,7 +144,7 @@ void ContentLoaderT6::LoadXAsset(const bool atStreamStart) LOAD_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet); LOAD_ASSET(ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree, scriptParseTree); LOAD_ASSET(ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs, keyValuePairs); - // LOAD_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef); + LOAD_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef); // LOAD_ASSET(ASSET_TYPE_MEMORYBLOCK, MemoryBlock, memoryBlock); LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts); LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef);