From ce61ef8a4568768c51278ec2b56c21046c4eb37a Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 14 Apr 2021 12:07:45 +0200 Subject: [PATCH] iw3 clipmap, sounds, image commands --- src/Common/Game/IW3/IW3_Assets.h | 27 ++++++++++++++++-- src/ZoneCode/Game/IW3/XAssets/GfxImage.txt | 21 ++++++++++++++ src/ZoneCode/Game/IW3/XAssets/LoadedSound.txt | 15 ++++++++++ src/ZoneCode/Game/IW3/XAssets/SndCurve.txt | 6 ++++ .../XAssets/{clipMap.txt => clipMap_t.txt} | 23 ++++++++------- .../Game/IW3/XAssets/snd_alias_list_t.txt | 28 +++++++++++++++++++ 6 files changed, 106 insertions(+), 14 deletions(-) rename src/ZoneCode/Game/IW3/XAssets/{clipMap.txt => clipMap_t.txt} (87%) diff --git a/src/Common/Game/IW3/IW3_Assets.h b/src/Common/Game/IW3/IW3_Assets.h index 0fe05aa8..b781e97e 100644 --- a/src/Common/Game/IW3/IW3_Assets.h +++ b/src/Common/Game/IW3/IW3_Assets.h @@ -137,6 +137,19 @@ namespace IW3 typedef float vec2_t[2]; typedef float vec3_t[3]; + struct XModelPiece + { + XModel* model; + float offset[3]; + }; + + struct XModelPieces + { + const char* name; + int numpieces; + XModelPiece* pieces; + }; + struct PhysPreset { const char *name; @@ -808,6 +821,14 @@ namespace IW3 StreamedSound streamSnd; }; + enum snd_alias_type_t + { + SAT_UNKNOWN = 0x0, + SAT_LOADED = 0x1, + SAT_STREAMED = 0x2, + SAT_COUNT = 0x3, + }; + struct SoundFile { char type; @@ -1044,6 +1065,8 @@ namespace IW3 float linkMaxs[2]; }; + typedef unsigned short LeafBrush; + struct clipMap_t { const char* name; @@ -1065,11 +1088,11 @@ namespace IW3 unsigned int leafbrushNodesCount; cLeafBrushNode_s* leafbrushNodes; unsigned int numLeafBrushes; - uint16_t* leafbrushes; + LeafBrush* leafbrushes; unsigned int numLeafSurfaces; unsigned int* leafsurfaces; unsigned int vertCount; - float(*verts)[3]; + vec3_t *verts; int triCount; uint16_t* triIndices; char* triEdgeIsWalkable; diff --git a/src/ZoneCode/Game/IW3/XAssets/GfxImage.txt b/src/ZoneCode/Game/IW3/XAssets/GfxImage.txt index e69de29b..474674cb 100644 --- a/src/ZoneCode/Game/IW3/XAssets/GfxImage.txt +++ b/src/ZoneCode/Game/IW3/XAssets/GfxImage.txt @@ -0,0 +1,21 @@ +// ========================================= +// GfxImage +// ========================================= +use GfxImage; +set action OnImageLoaded(GfxImage); +set string name; +set name name; +reorder: + name + texture; + +// GfxTexture +use GfxTexture; +set reusable loadDef; +set block loadDef XFILE_BLOCK_TEMP; +set condition texture never; + +// GfxImageLoadDef +use GfxImageLoadDef; +set action LoadImageData(GfxImageLoadDef, GfxImage); +set arraysize data resourceSize; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW3/XAssets/LoadedSound.txt b/src/ZoneCode/Game/IW3/XAssets/LoadedSound.txt index e69de29b..fa0a092f 100644 --- a/src/ZoneCode/Game/IW3/XAssets/LoadedSound.txt +++ b/src/ZoneCode/Game/IW3/XAssets/LoadedSound.txt @@ -0,0 +1,15 @@ +// ========================================= +// LoadedSound +// ========================================= +use LoadedSound; +set string name; +set name name; + +// MssSound +use MssSound; +set block data XFILE_BLOCK_TEMP; +set reusable data; +set count data info::data_len; +set condition info::data_ptr never; +set condition info::initial_ptr never; +set action SetSoundData(MssSound); \ No newline at end of file diff --git a/src/ZoneCode/Game/IW3/XAssets/SndCurve.txt b/src/ZoneCode/Game/IW3/XAssets/SndCurve.txt index e69de29b..2281b2d0 100644 --- a/src/ZoneCode/Game/IW3/XAssets/SndCurve.txt +++ b/src/ZoneCode/Game/IW3/XAssets/SndCurve.txt @@ -0,0 +1,6 @@ +// ========================================= +// SndCurve +// ========================================= +use SndCurve; +set string filename; +set name filename; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW3/XAssets/clipMap.txt b/src/ZoneCode/Game/IW3/XAssets/clipMap_t.txt similarity index 87% rename from src/ZoneCode/Game/IW3/XAssets/clipMap.txt rename to src/ZoneCode/Game/IW3/XAssets/clipMap_t.txt index 349d39a3..4aa10ca9 100644 --- a/src/ZoneCode/Game/IW3/XAssets/clipMap.txt +++ b/src/ZoneCode/Game/IW3/XAssets/clipMap_t.txt @@ -23,9 +23,8 @@ set count partitions partitionCount; set count aabbTrees aabbTreeCount; set count cmodels numSubModels; set count brushes numBrushes; -set count brushBounds numBrushes; -set count brushContents numBrushes; -set count smodelNodes smodelNodeCount; +set visibility numClusters * clusterBytes; +set reusable box_brush; set count dynEntDefList[0] dynEntCount[0]; set count dynEntDefList[1] dynEntCount[1]; set block dynEntPoseList XFILE_BLOCK_RUNTIME; @@ -42,14 +41,6 @@ reorder: leafs leafbrushes leafbrushNodes; -reorder: - ... - brushContents - smodelNodes - mapEnts; - -// ClipMaterial -set string ClipMaterial::name; // cNode_t set reusable cNode_t::plane; @@ -67,4 +58,12 @@ set reusable borders; // cbrush_t use cbrush_t; set reusable sides; -set reusable baseAdjacentSide; \ No newline at end of file +set reusable baseAdjacentSide; + +// DynEntityDef +set reusable DynEntityDef::destroyPieces; + +// XModelPieces +use XModelPieces; +set string name; +set count pieces numpieces; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW3/XAssets/snd_alias_list_t.txt b/src/ZoneCode/Game/IW3/XAssets/snd_alias_list_t.txt index e69de29b..6c5bc736 100644 --- a/src/ZoneCode/Game/IW3/XAssets/snd_alias_list_t.txt +++ b/src/ZoneCode/Game/IW3/XAssets/snd_alias_list_t.txt @@ -0,0 +1,28 @@ +// ========================================= +// snd_alias_list_t +// ========================================= +use snd_alias_list_t; +set string aliasName; +set name aliasName; +set reusable head; +set count head count; + +// snd_alias_t +use snd_alias_t; +set string aliasName; +set string subtitle; +set string secondaryAliasName; +set string chainAliasName; +set reusable soundFile; +set reusable speakerMap; + +// SoundFile +set condition SoundFile::u::loadSnd type == SAT_LOADED; + +// SpeakerMap +set string SpeakerMap::name; + +// StreamedSound +use StreamedSound; +set string dir; +set string name; \ No newline at end of file