From 88710cb3bfb90af3a1fe6dae95adb7af7caac546 Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 23 Jul 2021 16:28:59 +0200 Subject: [PATCH] IW5 Fixups --- src/Common/Game/IW5/IW5_Assets.h | 448 +++++++++++++----- .../IW5/AssetLoaders/AssetLoaderRawFile.cpp | 6 +- .../IW5/AssetDumpers/AssetDumperRawFile.cpp | 4 +- .../InfoStringFromStructConverter.cpp | 12 - src/ZoneCode/Game/IW5/IW5_Commands.txt | 2 + .../Game/IW5/XAssets/AddonMapEnts.txt | 12 +- src/ZoneCode/Game/IW5/XAssets/FxEffectDef.txt | 1 + src/ZoneCode/Game/IW5/XAssets/GfxWorld.txt | 2 + src/ZoneCode/Game/IW5/XAssets/GlassWorld.txt | 12 +- src/ZoneCode/Game/IW5/XAssets/MapEnts.txt | 6 +- src/ZoneCode/Game/IW5/XAssets/Material.txt | 1 + src/ZoneCode/Game/IW5/XAssets/PathData.txt | 30 +- src/ZoneCode/Game/IW5/XAssets/RawFile.txt | 4 +- src/ZoneCode/Game/IW5/XAssets/ScriptFile.txt | 6 +- .../Game/IW5/XAssets/SurfaceFxTable.txt | 3 +- src/ZoneCode/Game/IW5/XAssets/VehicleDef.txt | 2 + .../Game/IW5/XAssets/VehicleTrack.txt | 16 +- .../Game/IW5/XAssets/WeaponAttachment.txt | 16 +- .../Game/IW5/XAssets/WeaponCompleteDef.txt | 45 +- src/ZoneCode/Game/IW5/XAssets/XModel.txt | 42 -- src/ZoneCode/Game/IW5/XAssets/XModelSurfs.txt | 42 +- src/ZoneCode/Game/IW5/XAssets/clipMap_t.txt | 59 ++- src/ZoneCode/Game/IW5/XAssets/menuDef_t.txt | 42 +- src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp | 1 + src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp | 3 +- .../Game/IW5/ZoneLoaderFactoryIW5.cpp | 16 +- .../Game/IW5/ZoneWriterFactoryIW5.cpp | 2 + 27 files changed, 566 insertions(+), 269 deletions(-) diff --git a/src/Common/Game/IW5/IW5_Assets.h b/src/Common/Game/IW5/IW5_Assets.h index 389ab5b8..3f3f0331 100644 --- a/src/Common/Game/IW5/IW5_Assets.h +++ b/src/Common/Game/IW5/IW5_Assets.h @@ -3,9 +3,11 @@ #ifndef __IW5_ASSETS_H #define __IW5_ASSETS_H +#ifndef __zonecodegenerator #ifndef __cplusplus #define __ida #endif +#endif #include "../../Utils/TypeAlignment.h" @@ -47,6 +49,7 @@ namespace IW5 ASSET_TYPE_LOCALIZE_ENTRY = 0x1B, ASSET_TYPE_ATTACHMENT = 0x1C, ASSET_TYPE_WEAPON = 0x1D, + ASSET_TYPE_SNDDRIVER_GLOBALS = 0x1E, ASSET_TYPE_FX = 0x1F, ASSET_TYPE_IMPACT_FX = 0x20, ASSET_TYPE_SURFACE_FX = 0x21, @@ -78,6 +81,8 @@ namespace IW5 XFILE_BLOCK_VIRTUAL, XFILE_BLOCK_LARGE, XFILE_BLOCK_CALLBACK, + XFILE_BLOCK_VERTEX, + XFILE_BLOCK_INDEX, XFILE_BLOCK_SCRIPT, MAX_XFILE_COUNT @@ -236,7 +241,7 @@ namespace IW5 typedef unsigned char cbrushedge_t; - struct cbrush_t + struct cbrushWrapper_t { unsigned short numsides; unsigned short glassPieceIndex; @@ -247,8 +252,6 @@ namespace IW5 unsigned char edgeCount[2][3]; }; - typedef struct cbrush_t cbrushWrapper_t; - struct BrushWrapper { Bounds bounds; @@ -674,6 +677,23 @@ namespace IW5 GfxImage* image; }; + enum TextureSemantic + { + TS_2D = 0x0, + TS_FUNCTION = 0x1, + TS_COLOR_MAP = 0x2, + TS_DETAIL_MAP = 0x3, + TS_UNUSED_2 = 0x4, + TS_NORMAL_MAP = 0x5, + TS_UNUSED_3 = 0x6, + TS_UNUSED_4 = 0x7, + TS_SPECULAR_MAP = 0x8, + TS_UNUSED_5 = 0x9, + TS_UNUSED_6 = 0xA, + TS_WATER_MAP = 0xB, + TS_DISPLACEMENT_MAP = 0xC + }; + union MaterialTextureDefInfo { GfxImage* image; @@ -733,7 +753,7 @@ namespace IW5 uint16_t loadForRenderer; }; - union MaterialPixelShaderProgram + struct MaterialPixelShaderProgram { void* ps; GfxPixelShaderLoadDef loadDef; @@ -784,6 +804,23 @@ namespace IW5 MaterialVertexStreamRouting routing; }; + enum MaterialShaderArgumentType + { + MTL_ARG_MATERIAL_VERTEX_CONST = 0x0, + MTL_ARG_LITERAL_VERTEX_CONST = 0x1, + MTL_ARG_MATERIAL_VERTEX_SAMPLER = 0x2, + MTL_ARG_MATERIAL_PIXEL_SAMPLER = 0x3, + MTL_ARG_CODE_PRIM_BEGIN = 0x4, + MTL_ARG_CODE_VERTEX_CONST = 0x4, + MTL_ARG_CODE_PIXEL_SAMPLER = 0x5, + MTL_ARG_CODE_PIXEL_CONST = 0x6, + MTL_ARG_CODE_PRIM_END = 0x7, + MTL_ARG_MATERIAL_PIXEL_CONST = 0x7, + MTL_ARG_LITERAL_PIXEL_CONST = 0x8, + + MTL_ARG_COUNT + }; + struct MaterialArgumentCodeConst { unsigned short index; @@ -885,6 +922,15 @@ namespace IW5 const char* name; }; + enum snd_alias_type_t + { + SAT_UNKNOWN = 0x0, + SAT_LOADED = 0x1, + SAT_STREAMED = 0x2, + SAT_VOICED = 0x3, + SAT_COUNT = 0x4 + }; + struct StreamedSound { const char* dir; @@ -1029,6 +1075,18 @@ namespace IW5 int contents; cLeafBrushNodeData_t data; }; + + struct cbrush_t + { + unsigned short numsides; + unsigned short glassPieceIndex; + cbrushside_t* sides; + cbrushedge_t* baseAdjacentSide; + short axialMaterialNum[2][3]; + unsigned char firstAdjacentSideOffsets[2][3]; + unsigned char edgeCount[2][3]; + }; + typedef tdef_align(128) cbrush_t cbrush_array_t; typedef tdef_align(128) Bounds BoundsArray; @@ -2102,7 +2160,7 @@ namespace IW5 unsigned int sortKeyEffectAuto; unsigned int sortKeyDistortion; GfxWorldDpvsPlanes dpvsPlanes; - GfxCellTreeCount* aabbTreeCounts; + int/*GfxCellTreeCount*/* aabbTreeCounts; GfxCellTree128* aabbTrees; GfxCell* cells; GfxWorldDraw draw; @@ -2185,10 +2243,9 @@ namespace IW5 VAL_INT = 0x0, VAL_FLOAT = 0x1, VAL_STRING = 0x2, - NUM_INTERNAL_DATATYPES = 0x3, VAL_FUNCTION = 0x3, - NUM_DATATYPES + NUM_DATATYPES, }; struct ExpressionString @@ -2545,6 +2602,12 @@ namespace IW5 NUM_OPERATORS }; + enum expressionEntryType : int + { + EET_OPERATOR = 0x0, + EET_OPERAND = 0x1, + }; + union entryInternalData { operationEnum op; @@ -2678,6 +2741,19 @@ namespace IW5 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 + }; + struct MenuEventHandler { EventData eventData; @@ -2732,11 +2808,11 @@ namespace IW5 Statement_s* openSoundExp; Statement_s* closeSoundExp; Statement_s* soundLoopExp; - int cursorItem[4]; - menuTransition scaleTransition[4]; - menuTransition alphaTransition[4]; - menuTransition xTransition[4]; - menuTransition yTransition[4]; + int cursorItem[1]; + menuTransition scaleTransition[1]; + menuTransition alphaTransition[1]; + menuTransition xTransition[1]; + menuTransition yTransition[1]; ExpressionSupportingData* expressionData; unsigned char priority; }; @@ -2763,7 +2839,7 @@ namespace IW5 int ownerDrawFlags; float borderSize; int staticFlags; - int dynamicFlags[4]; + int dynamicFlags[1]; int nextTime; float foreColor[4]; float backColor[4]; @@ -2785,8 +2861,9 @@ namespace IW5 struct listBoxDef_s { - int startPos[4]; - int endPos[4]; + int mousePos; + int startPos[1]; + int endPos[1]; int drawPadding; float elementWidth; float elementHeight; @@ -2852,10 +2929,10 @@ namespace IW5 Statement_s* expression; }; - struct itemDef_t + struct itemDef_s { windowDef_t window; - rectDef_s textRect[4]; + rectDef_s textRect[1]; int type; int dataType; int alignment; @@ -2887,7 +2964,7 @@ namespace IW5 int dvarFlags; snd_alias_list_t* focusSound; float special; - int cursorPos[4]; + int cursorPos[1]; itemDefData_t typeData; int floatExpressionCount; ItemFloatExpression* floatExpressions; @@ -2910,7 +2987,7 @@ namespace IW5 menuData_t* data; windowDef_t window; int itemCount; - itemDef_t** items; + itemDef_s** items; }; struct LocalizeEntry @@ -3255,6 +3332,17 @@ namespace IW5 WEAPPROJEXP_NUM }; + struct snd_alias_list_name + { + const char* soundName; + }; + + union SndAliasCustom + { + snd_alias_list_name* name; + snd_alias_list_t* sound; + }; + struct AttProjectile { int explosionRadius; @@ -3269,9 +3357,9 @@ namespace IW5 weapProjExposion_t projExplosionType; FxEffectDef* projExplosionEffect; bool projExplosionEffectForceNormalUp; - snd_alias_list_t* projExplosionSound; + SndAliasCustom projExplosionSound; FxEffectDef* projDudEffect; - snd_alias_list_t* projDudSound; + SndAliasCustom projDudSound; bool projImpactExplode; float destabilizationRateTime; float destabilizationCurvatureMax; @@ -3279,7 +3367,7 @@ namespace IW5 FxEffectDef* projTrailEffect; int projIgnitionDelay; FxEffectDef* projIgnitionEffect; - snd_alias_list_t* projIgnitionSound; + SndAliasCustom projIgnitionSound; }; struct WeaponAttachment @@ -3454,6 +3542,80 @@ namespace IW5 MISSILE_GUIDANCE_COUNT }; + enum weapAnimFiles_t + { + WEAP_ANIM_ROOT = 0x0, + WEAP_ANIM_IDLE = 0x1, + WEAP_ANIM_EMPTY_IDLE = 0x2, + WEAP_ANIM_FIRE = 0x3, + WEAP_ANIM_HOLD_FIRE = 0x4, + WEAP_ANIM_LASTSHOT = 0x5, + WEAP_ANIM_RECHAMBER = 0x6, + WEAP_ANIM_MELEE = 0x7, + WEAP_ANIM_MELEE_CHARGE = 0x8, + WEAP_ANIM_RELOAD = 0x9, + WEAP_ANIM_RELOAD_EMPTY = 0xA, + WEAP_ANIM_RELOAD_START = 0xB, + WEAP_ANIM_RELOAD_END = 0xC, + WEAP_ANIM_RAISE = 0xD, + WEAP_ANIM_FIRST_RAISE = 0xE, + WEAP_ANIM_BREACH_RAISE = 0xF, + WEAP_ANIM_DROP = 0x10, + WEAP_ANIM_ALT_RAISE = 0x11, + WEAP_ANIM_ALT_DROP = 0x12, + WEAP_ANIM_QUICK_RAISE = 0x13, + WEAP_ANIM_QUICK_DROP = 0x14, + WEAP_ANIM_EMPTY_RAISE = 0x15, + WEAP_ANIM_EMPTY_DROP = 0x16, + WEAP_ANIM_SPRINT_IN = 0x17, + WEAP_ANIM_SPRINT_LOOP = 0x18, + WEAP_ANIM_SPRINT_OUT = 0x19, + WEAP_ANIM_STUNNED_START = 0x1A, + WEAP_ANIM_STUNNED_LOOP = 0x1B, + WEAP_ANIM_STUNNED_END = 0x1C, + WEAP_ANIM_DETONATE = 0x1D, + WEAP_ANIM_NIGHTVISION_WEAR = 0x1E, + WEAP_ANIM_NIGHTVISION_REMOVE = 0x1F, + WEAP_ANIM_ADS_FIRE = 0x20, + WEAP_ANIM_ADS_LASTSHOT = 0x21, + WEAP_ANIM_ADS_RECHAMBER = 0x22, + WEAP_ANIM_BLAST_FRONT = 0x23, + WEAP_ANIM_BLAST_RIGHT = 0x24, + WEAP_ANIM_BLAST_BACK = 0x25, + WEAP_ANIM_BLAST_LEFT = 0x26, + WEAP_ANIM_ADS_UP = 0x27, + WEAP_ANIM_ADS_DOWN = 0x28, + WEAP_ALT_ANIM_ADJUST = 0x29, + + NUM_WEAP_ANIMS + }; + + enum hitLocation_t + { + HITLOC_NONE = 0x0, + HITLOC_HELMET = 0x1, + HITLOC_HEAD = 0x2, + HITLOC_NECK = 0x3, + HITLOC_TORSO_UPR = 0x4, + HITLOC_TORSO_LWR = 0x5, + HITLOC_R_ARM_UPR = 0x6, + HITLOC_L_ARM_UPR = 0x7, + HITLOC_R_ARM_LWR = 0x8, + HITLOC_L_ARM_LWR = 0x9, + HITLOC_R_HAND = 0xA, + HITLOC_L_HAND = 0xB, + HITLOC_R_LEG_UPR = 0xC, + HITLOC_L_LEG_UPR = 0xD, + HITLOC_R_LEG_LWR = 0xE, + HITLOC_L_LEG_LWR = 0xF, + HITLOC_R_FOOT = 0x10, + HITLOC_L_FOOT = 0x11, + HITLOC_GUN = 0x12, + HITLOC_SHIELD = 0x13, + + HITLOC_NUM + }; + struct WeaponDef { const char* szOverlayName; @@ -3462,10 +3624,10 @@ namespace IW5 const char** szXAnimsRightHanded; const char** szXAnimsLeftHanded; const char* szModeName; - unsigned short* notetrackSoundMapKeys; - unsigned short* notetrackSoundMapValues; - unsigned short* notetrackRumbleMapKeys; - unsigned short* notetrackRumbleMapValues; + ScriptString* notetrackSoundMapKeys; + ScriptString* notetrackSoundMapValues; + ScriptString* notetrackRumbleMapKeys; + ScriptString* notetrackRumbleMapValues; int playerAnimType; weapType_t weapType; weapClass_t weapClass; @@ -3476,56 +3638,56 @@ namespace IW5 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* changeVariableZoomSound; - snd_alias_list_t** bounceSound; - snd_alias_list_t** rollingSound; + SndAliasCustom pickupSound; + SndAliasCustom pickupSoundPlayer; + SndAliasCustom ammoPickupSound; + SndAliasCustom ammoPickupSoundPlayer; + SndAliasCustom projectileSound; + SndAliasCustom pullbackSound; + SndAliasCustom pullbackSoundPlayer; + SndAliasCustom fireSound; + SndAliasCustom fireSoundPlayer; + SndAliasCustom fireSoundPlayerAkimbo; + SndAliasCustom fireLoopSound; + SndAliasCustom fireLoopSoundPlayer; + SndAliasCustom fireStopSound; + SndAliasCustom fireStopSoundPlayer; + SndAliasCustom fireLastSound; + SndAliasCustom fireLastSoundPlayer; + SndAliasCustom emptyFireSound; + SndAliasCustom emptyFireSoundPlayer; + SndAliasCustom meleeSwipeSound; + SndAliasCustom meleeSwipeSoundPlayer; + SndAliasCustom meleeHitSound; + SndAliasCustom meleeMissSound; + SndAliasCustom rechamberSound; + SndAliasCustom rechamberSoundPlayer; + SndAliasCustom reloadSound; + SndAliasCustom reloadSoundPlayer; + SndAliasCustom reloadEmptySound; + SndAliasCustom reloadEmptySoundPlayer; + SndAliasCustom reloadStartSound; + SndAliasCustom reloadStartSoundPlayer; + SndAliasCustom reloadEndSound; + SndAliasCustom reloadEndSoundPlayer; + SndAliasCustom detonateSound; + SndAliasCustom detonateSoundPlayer; + SndAliasCustom nightVisionWearSound; + SndAliasCustom nightVisionWearSoundPlayer; + SndAliasCustom nightVisionRemoveSound; + SndAliasCustom nightVisionRemoveSoundPlayer; + SndAliasCustom altSwitchSound; + SndAliasCustom altSwitchSoundPlayer; + SndAliasCustom raiseSound; + SndAliasCustom raiseSoundPlayer; + SndAliasCustom firstRaiseSound; + SndAliasCustom firstRaiseSoundPlayer; + SndAliasCustom putawaySound; + SndAliasCustom putawaySoundPlayer; + SndAliasCustom scanSound; + SndAliasCustom changeVariableZoomSound; + SndAliasCustom* bounceSound; + SndAliasCustom* rollingSound; FxEffectDef* viewShellEjectEffect; FxEffectDef* worldShellEjectEffect; FxEffectDef* viewLastShotEjectEffect; @@ -3662,8 +3824,8 @@ namespace IW5 weapProjExposion_t projExplosion; FxEffectDef* projExplosionEffect; FxEffectDef* projDudEffect; - snd_alias_list_t* projExplosionSound; - snd_alias_list_t* projDudSound; + SndAliasCustom projExplosionSound; + SndAliasCustom projDudSound; WeapStickinessType stickiness; float lowAmmoWarningThreshold; float ricochetChance; @@ -3679,7 +3841,7 @@ namespace IW5 float maxSteeringAccel; int projIgnitionDelay; FxEffectDef* projIgnitionEffect; - snd_alias_list_t* projIgnitionSound; + SndAliasCustom projIgnitionSound; float fAdsAimPitch; float fAdsCrosshairInFrac; float fAdsCrosshairOutFrac; @@ -3718,8 +3880,14 @@ namespace IW5 float fHipViewScatterMax; float fightDist; float maxDist; - const char* accuracyGraphName[2]; - float(*originalAccuracyGraphKnots[2])[2]; + // const char* accuracyGraphName[2];// TODO: Order is accuracyGraphName[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ... + // Which is currently not possible to do in code generation. Afaik this is the only place where this is the case. + // So might be something to fix but on the other hand it might be too much work for this little inconvenience. + // vec2_t* originalAccuracyGraphKnots[2]; + const char* accuracyGraphName0; + const char* accuracyGraphName1; + vec2_t* originalAccuracyGraphKnots0; + vec2_t* originalAccuracyGraphKnots1; unsigned short originalAccuracyGraphKnotCount[2]; int iPositionReloadTransTime; float leftArc; @@ -3769,17 +3937,17 @@ namespace IW5 float turretOverheatUpRate; float turretOverheatDownRate; float turretOverheatPenalty; - snd_alias_list_t* turretOverheatSound; + SndAliasCustom 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; + SndAliasCustom turretBarrelSpinMaxSnd; + SndAliasCustom turretBarrelSpinUpSnd[4]; + SndAliasCustom turretBarrelSpinDownSnd[4]; + SndAliasCustom missileConeSoundAlias; + SndAliasCustom missileConeSoundAliasAtBase; float missileConeSoundRadiusAtTop; float missileConeSoundRadiusAtBase; float missileConeSoundHeight; @@ -3845,7 +4013,7 @@ namespace IW5 bool missileConeSoundCrossfadeEnabled; bool offhandHoldIsCancelable; bool doNotAllowAttachmentsToOverrideSpread; - unsigned short stowTag; + ScriptString stowTag; XModel* stowOffsetModel; }; @@ -3864,8 +4032,8 @@ namespace IW5 { unsigned short attachment1; unsigned short attachment2; - snd_alias_list_t* overrideSound; - snd_alias_list_t* altmodeSound; + SndAliasCustom overrideSound; + SndAliasCustom altmodeSound; unsigned int soundType; }; @@ -3888,8 +4056,8 @@ namespace IW5 struct NoteTrackToSoundEntry { int attachment; - unsigned short* notetrackSoundMapKeys; - unsigned short* notetrackSoundMapValues; + ScriptString* notetrackSoundMapKeys; + ScriptString* notetrackSoundMapValues; }; struct WeaponCompleteDef @@ -3897,7 +4065,7 @@ namespace IW5 const char* szInternalName; WeaponDef* weapDef; const char* szDisplayName; - unsigned short* hideTags; + ScriptString* hideTags; WeaponAttachment** scopes; WeaponAttachment** underBarrels; WeaponAttachment** others; @@ -3937,7 +4105,7 @@ namespace IW5 float adsDofStart; float adsDofEnd; unsigned short accuracyGraphKnotCount[2]; - float(*accuracyGraphKnots[2])[2]; + vec2_t* accuracyGraphKnots[2]; bool motionTracker; bool enhanced; bool dpadIconShowsAmmo; @@ -4096,7 +4264,27 @@ namespace IW5 FxTrailDef* trailDef; FxSparkFountainDef* sparkFountainDef; FxSpotLightDef* spotLightDef; - void* unknownDef; + char* unknownDef; + }; + + enum FxElemType + { + 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 FxElemDef @@ -4178,18 +4366,12 @@ namespace IW5 SurfaceFxEntry* table; }; - union RawFileBuffer - { - const char* compressedBuffer; - const char* buffer; - }; - struct RawFile { const char* name; int compressedLen; int len; - RawFileBuffer data; + const char* buffer; }; struct ScriptFile @@ -4598,14 +4780,14 @@ namespace IW5 float turretVertResistUp; float turretVertResistDown; float turretRotRate; - snd_alias_list_t* turretSpinSnd; - snd_alias_list_t* turretStopSnd; + SndAliasCustom turretSpinSnd; + SndAliasCustom turretStopSnd; int trophyEnabled; float trophyRadius; float trophyInactiveRadius; int trophyAmmoCount; float trophyReloadTime; - unsigned short trophyTags[4]; + ScriptString trophyTags[4]; FxEffectDef* trophyExplodeFx; FxEffectDef* trophyFlashFx; Material* compassFriendlyIcon; @@ -4614,45 +4796,53 @@ namespace IW5 Material* compassEnemyAltIcon; int compassIconWidth; int compassIconHeight; - snd_alias_list_t* idleLowSnd; - snd_alias_list_t* idleHighSnd; - snd_alias_list_t* engineLowSnd; - snd_alias_list_t* engineHighSnd; + SndAliasCustom idleLowSnd; + SndAliasCustom idleHighSnd; + SndAliasCustom engineLowSnd; + SndAliasCustom engineHighSnd; float engineSndSpeed; - unsigned short audioOriginTag; - snd_alias_list_t* idleLowSndAlt; - snd_alias_list_t* idleHighSndAlt; - snd_alias_list_t* engineLowSndAlt; - snd_alias_list_t* engineHighSndAlt; + ScriptString audioOriginTag; + SndAliasCustom idleLowSndAlt; + SndAliasCustom idleHighSndAlt; + SndAliasCustom engineLowSndAlt; + SndAliasCustom engineHighSndAlt; float engineSndSpeedAlt; - unsigned short audioOriginTagAlt; - snd_alias_list_t* turretSpinSndAlt; - snd_alias_list_t* turretStopSndAlt; - snd_alias_list_t* engineStartUpSnd; + ScriptString audioOriginTagAlt; + SndAliasCustom turretSpinSndAlt; + SndAliasCustom turretStopSndAlt; + SndAliasCustom engineStartUpSnd; int engineStartUpLength; - snd_alias_list_t* engineShutdownSnd; - snd_alias_list_t* engineIdleSnd; - snd_alias_list_t* engineSustainSnd; - snd_alias_list_t* engineRampUpSnd; + SndAliasCustom engineShutdownSnd; + SndAliasCustom engineIdleSnd; + SndAliasCustom engineSustainSnd; + SndAliasCustom engineRampUpSnd; int engineRampUpLength; - snd_alias_list_t* engineRampDownSnd; + SndAliasCustom engineRampDownSnd; int engineRampDownLength; - snd_alias_list_t* suspensionSoftSnd; + SndAliasCustom suspensionSoftSnd; float suspensionSoftCompression; - snd_alias_list_t* suspensionHardSnd; + SndAliasCustom suspensionHardSnd; float suspensionHardCompression; - snd_alias_list_t* collisionSnd; + SndAliasCustom collisionSnd; float collisionBlendSpeed; - snd_alias_list_t* speedSnd; + SndAliasCustom speedSnd; float speedSndBlendSpeed; const char* surfaceSndPrefix; - snd_alias_list_t* surfaceSnds[31]; + SndAliasCustom surfaceSnds[31]; float surfaceSndBlendSpeed; float slideVolume; float slideBlendSpeed; float inAirPitch; }; + struct cmodel2_t + { + Bounds bounds; + float radius; + ClipInfo* info; + cLeaf_t leaf; + }; + struct AddonMapEnts { const char* name; @@ -4661,7 +4851,7 @@ namespace IW5 MapTriggers trigger; ClipInfo* info; unsigned int numSubModels; - cmodel_t* cmodels; + cmodel2_t* cmodels; GfxBrushModel* models; }; diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.cpp b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.cpp index 02d813aa..8a866f1d 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.cpp +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.cpp @@ -28,15 +28,15 @@ bool AssetLoaderRawFile::LoadFromRaw(const std::string& assetName, ISearchPath* auto* rawFile = memory->Create(); rawFile->name = memory->Dup(assetName.c_str()); - rawFile->len = static_cast(file.m_length); + rawFile->compressedLen = static_cast(file.m_length + 1); auto* fileBuffer = static_cast(memory->Alloc(static_cast(file.m_length + 1))); file.m_stream->read(fileBuffer, file.m_length); if (file.m_stream->gcount() != file.m_length) return false; - fileBuffer[rawFile->len] = '\0'; + fileBuffer[file.m_length] = '\0'; - rawFile->data.buffer = fileBuffer; + rawFile->buffer = fileBuffer; manager->AddAsset(ASSET_TYPE_RAWFILE, assetName, rawFile); return true; diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.cpp b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.cpp index bd07ec0b..128a74f3 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.cpp +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.cpp @@ -40,7 +40,7 @@ void AssetDumperRawFile::DumpRaw(AssetDumpingContext& context, XAssetInfo(rawFile->data.compressedBuffer); + zs.next_in = reinterpret_cast(rawFile->buffer); zs.avail_in = rawFile->compressedLen; Bytef buffer[0x1000]; @@ -65,6 +65,6 @@ void AssetDumperRawFile::DumpRaw(AssetDumpingContext& context, XAssetInfolen > 0) { - stream.write(rawFile->data.buffer, rawFile->len); + stream.write(rawFile->buffer, rawFile->len); } } diff --git a/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.cpp b/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.cpp index c3ec0365..33f30e25 100644 --- a/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.cpp +++ b/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.cpp @@ -85,18 +85,6 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) break; } - case CSPFT_PHYS_COLLMAP: - { - const auto* physCollMap = *reinterpret_cast(reinterpret_cast(m_structure) + field. - iOffset); - - if (physCollMap) - m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(physCollMap->name))); - else - m_info_string.SetValueForKey(std::string(field.szName), ""); - break; - } - case CSPFT_SOUND: { const auto* sndAlias = reinterpret_cast(reinterpret_cast(m_structure) + field. diff --git a/src/ZoneCode/Game/IW5/IW5_Commands.txt b/src/ZoneCode/Game/IW5/IW5_Commands.txt index f50bc026..eb5fae8a 100644 --- a/src/ZoneCode/Game/IW5/IW5_Commands.txt +++ b/src/ZoneCode/Game/IW5/IW5_Commands.txt @@ -51,6 +51,8 @@ block runtime XFILE_BLOCK_RUNTIME default; block normal XFILE_BLOCK_VIRTUAL default; block normal XFILE_BLOCK_LARGE; block normal XFILE_BLOCK_CALLBACK; +block normal XFILE_BLOCK_VERTEX; +block normal XFILE_BLOCK_INDEX; block normal XFILE_BLOCK_SCRIPT; #include "XAssets/PhysPreset.txt" diff --git a/src/ZoneCode/Game/IW5/XAssets/AddonMapEnts.txt b/src/ZoneCode/Game/IW5/XAssets/AddonMapEnts.txt index 213a8428..0b4132ef 100644 --- a/src/ZoneCode/Game/IW5/XAssets/AddonMapEnts.txt +++ b/src/ZoneCode/Game/IW5/XAssets/AddonMapEnts.txt @@ -5,4 +5,14 @@ use AddonMapEnts; set block XFILE_BLOCK_TEMP; set string name; set name name; -set count entityString numEntityChars; \ No newline at end of file +set count entityString numEntityChars; + +// MapTriggers +// see MapEnts + +// ClipInfo +// see clipMap_t + +// cmodel2_t +use cmodel2_t; +set reusable info; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/FxEffectDef.txt b/src/ZoneCode/Game/IW5/XAssets/FxEffectDef.txt index 261df4c7..ceeca471 100644 --- a/src/ZoneCode/Game/IW5/XAssets/FxEffectDef.txt +++ b/src/ZoneCode/Game/IW5/XAssets/FxEffectDef.txt @@ -43,6 +43,7 @@ set string name; use FxElemExtendedDefPtr; set condition trailDef FxElemDef::elemType == FX_ELEM_TYPE_TRAIL; set condition sparkFountainDef FxElemDef::elemType == FX_ELEM_TYPE_SPARK_FOUNTAIN; +set condition spotLightDef FxElemDef::elemType == FX_ELEM_TYPE_SPOT_LIGHT; // FxTrailDef use FxTrailDef; diff --git a/src/ZoneCode/Game/IW5/XAssets/GfxWorld.txt b/src/ZoneCode/Game/IW5/XAssets/GfxWorld.txt index d8069d2c..3c173be4 100644 --- a/src/ZoneCode/Game/IW5/XAssets/GfxWorld.txt +++ b/src/ZoneCode/Game/IW5/XAssets/GfxWorld.txt @@ -57,6 +57,7 @@ set count smodelIndexes smodelIndexCount; use GfxCell; set count portals portalCount; set count reflectionProbes reflectionProbeCount; +set count reflectionProbeReferences reflectionProbeReferenceCount; // GfxPortal use GfxPortal; @@ -69,6 +70,7 @@ set count reflectionProbes reflectionProbeCount; set count reflectionProbeOrigins reflectionProbeCount; set block reflectionProbeTextures XFILE_BLOCK_RUNTIME; set count reflectionProbeTextures reflectionProbeCount; +set count reflectionProbeReferences reflectionProbeReferenceCount; set count lightmaps lightmapCount; set block lightmapPrimaryTextures XFILE_BLOCK_RUNTIME; set count lightmapPrimaryTextures lightmapCount; diff --git a/src/ZoneCode/Game/IW5/XAssets/GlassWorld.txt b/src/ZoneCode/Game/IW5/XAssets/GlassWorld.txt index dc283b17..c1f811db 100644 --- a/src/ZoneCode/Game/IW5/XAssets/GlassWorld.txt +++ b/src/ZoneCode/Game/IW5/XAssets/GlassWorld.txt @@ -4,4 +4,14 @@ use GlassWorld; set block XFILE_BLOCK_TEMP; set string name; -set name name; \ No newline at end of file +set name name; + +// G_GlassData +use G_GlassData; +set count glassPieces pieceCount; +set count glassNames glassNameCount; + +// G_GlassName +use G_GlassName; +set string nameStr; +set count pieceIndices pieceCount; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/MapEnts.txt b/src/ZoneCode/Game/IW5/XAssets/MapEnts.txt index e8edf78e..ae3afdb3 100644 --- a/src/ZoneCode/Game/IW5/XAssets/MapEnts.txt +++ b/src/ZoneCode/Game/IW5/XAssets/MapEnts.txt @@ -6,13 +6,9 @@ set block XFILE_BLOCK_TEMP; set string name; set name name; set count entityString numEntityChars; -set count stages stageCount; // MapTriggers use MapTriggers; set count models count; set count hulls hullCount; -set count slabs slabCount; - -// Stage -set string Stage::name; \ No newline at end of file +set count slabs slabCount; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/Material.txt b/src/ZoneCode/Game/IW5/XAssets/Material.txt index b0f52d34..df928d20 100644 --- a/src/ZoneCode/Game/IW5/XAssets/Material.txt +++ b/src/ZoneCode/Game/IW5/XAssets/Material.txt @@ -11,6 +11,7 @@ set reusable constantTable; set count constantTable constantCount; set reusable stateBitsTable; set count stateBitsTable stateBitsCount; +set condition subMaterials never; // MaterialTextureDef use MaterialTextureDef; diff --git a/src/ZoneCode/Game/IW5/XAssets/PathData.txt b/src/ZoneCode/Game/IW5/XAssets/PathData.txt index 0d84a7e5..f00f5bc8 100644 --- a/src/ZoneCode/Game/IW5/XAssets/PathData.txt +++ b/src/ZoneCode/Game/IW5/XAssets/PathData.txt @@ -4,4 +4,32 @@ use PathData; set block XFILE_BLOCK_TEMP; set string name; -set name name; \ No newline at end of file +set name name; +set count nodes nodeCount; +set block basenodes XFILE_BLOCK_RUNTIME; +set count basenodes nodeCount; +set count chainNodeForNode nodeCount; +set count nodeForChainNode nodeCount; +set count pathVis visBytes; +set count nodeTree nodeTreeCount; + +// pathnode_t +set condition pathnode_t::dynamic never; +set condition pathnode_t::transient never; + +// pathnode_constant_t +use pathnode_constant_t; +set scriptstring targetname; +set scriptstring script_linkName; +set scriptstring script_noteworthy; +set scriptstring target; +set scriptstring animscript; +set count Links totalLinkCount; + +// pathnode_tree_t +use pathnode_tree_t; +set condition u::child axis >= 0; +set reusable u::child; + +// pathnode_tree_nodes_t +set count pathnode_tree_nodes_t::nodes nodeCount; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/RawFile.txt b/src/ZoneCode/Game/IW5/XAssets/RawFile.txt index fd5cc065..2847e064 100644 --- a/src/ZoneCode/Game/IW5/XAssets/RawFile.txt +++ b/src/ZoneCode/Game/IW5/XAssets/RawFile.txt @@ -5,6 +5,4 @@ use RawFile; set block XFILE_BLOCK_TEMP; set string name; set name name; -set condition data::compressedBuffer compressedLen > 0; -set count data::compressedBuffer compressedLen; -set count data::buffer len + 1; \ No newline at end of file +set count buffer compressedLen; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/ScriptFile.txt b/src/ZoneCode/Game/IW5/XAssets/ScriptFile.txt index 5ec0dfb4..21664050 100644 --- a/src/ZoneCode/Game/IW5/XAssets/ScriptFile.txt +++ b/src/ZoneCode/Game/IW5/XAssets/ScriptFile.txt @@ -4,4 +4,8 @@ use ScriptFile; set block XFILE_BLOCK_TEMP; set string name; -set name name; \ No newline at end of file +set name name; +set block buffer XFILE_BLOCK_SCRIPT; +set count buffer compressedLen; +set block bytecode XFILE_BLOCK_SCRIPT; +set count bytecode bytecodeLen; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/SurfaceFxTable.txt b/src/ZoneCode/Game/IW5/XAssets/SurfaceFxTable.txt index bb8f9703..bd557855 100644 --- a/src/ZoneCode/Game/IW5/XAssets/SurfaceFxTable.txt +++ b/src/ZoneCode/Game/IW5/XAssets/SurfaceFxTable.txt @@ -4,4 +4,5 @@ use SurfaceFxTable; set block XFILE_BLOCK_TEMP; set string name; -set name name; \ No newline at end of file +set name name; +set count table 6; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/VehicleDef.txt b/src/ZoneCode/Game/IW5/XAssets/VehicleDef.txt index ec44c85a..11f494e2 100644 --- a/src/ZoneCode/Game/IW5/XAssets/VehicleDef.txt +++ b/src/ZoneCode/Game/IW5/XAssets/VehicleDef.txt @@ -8,6 +8,8 @@ set name name; set string useHintString; set string turretWeaponName; set scriptstring trophyTags; +set scriptstring audioOriginTag; +set scriptstring audioOriginTagAlt; set string surfaceSndPrefix; // VehiclePhysDef diff --git a/src/ZoneCode/Game/IW5/XAssets/VehicleTrack.txt b/src/ZoneCode/Game/IW5/XAssets/VehicleTrack.txt index 55d00902..4bcc09a3 100644 --- a/src/ZoneCode/Game/IW5/XAssets/VehicleTrack.txt +++ b/src/ZoneCode/Game/IW5/XAssets/VehicleTrack.txt @@ -4,4 +4,18 @@ use VehicleTrack; set block XFILE_BLOCK_TEMP; set string name; -set name name; \ No newline at end of file +set name name; +set reusable segments; +set count segments segmentCount; + +// VehicleTrackSegment +use VehicleTrackSegment; +set string targetName; +set count sectors sectorCount; +set reusable nextBranches; +set count nextBranches nextBranchesCount; +set reusable prevBranches; +set count prevBranches prevBranchesCount; + +// VehicleTrackSector +set count VehicleTrackSector::obstacles obstacleCount; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/WeaponAttachment.txt b/src/ZoneCode/Game/IW5/XAssets/WeaponAttachment.txt index 3d30b952..9b85f993 100644 --- a/src/ZoneCode/Game/IW5/XAssets/WeaponAttachment.txt +++ b/src/ZoneCode/Game/IW5/XAssets/WeaponAttachment.txt @@ -3,5 +3,17 @@ // ========================================= use WeaponAttachment; set block XFILE_BLOCK_TEMP; -set string name; -set name name; \ No newline at end of file +set string szInternalName; +set name szInternalName; +set string szDisplayName; +set reusable worldModels; +set count worldModels 16; +set reusable viewModels; +set count viewModels 16; +set reusable reticleViewModels; +set count reticleViewModels 8; + +// AttRumbles +use AttRumbles; +set string fireRumble; +set string meleeImpactRumble; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/WeaponCompleteDef.txt b/src/ZoneCode/Game/IW5/XAssets/WeaponCompleteDef.txt index d55ed68f..ca209224 100644 --- a/src/ZoneCode/Game/IW5/XAssets/WeaponCompleteDef.txt +++ b/src/ZoneCode/Game/IW5/XAssets/WeaponCompleteDef.txt @@ -10,14 +10,44 @@ set string szDisplayName; set reusable hideTags; set scriptstring hideTags; set count hideTags 32; +set reusable scopes; +set count scopes 6; +set reusable underBarrels; +set count underBarrels 3; +set reusable others; +set count others 4; set string szXAnims; set reusable szXAnims; -set count szXAnims 37; +set count szXAnims NUM_WEAP_ANIMS; +set reusable animOverrides; +set count animOverrides numAnimOverrides; +set reusable soundOverrides; +set count soundOverrides numSoundOverrides; +set reusable fxOverrides; +set count fxOverrides numFXOverrides; +set reusable reloadOverrides; +set count reloadOverrides numReloadStateTimerOverrides; +set reusable notetrackOverrides; +set count notetrackOverrides numNotetrackOverrides; set string szAltWeaponName; set reusable accuracyGraphKnots; set count accuracyGraphKnots[0] accuracyGraphKnotCount[0]; set count accuracyGraphKnots[1] accuracyGraphKnotCount[1]; +// AnimOverrideEntry +use AnimOverrideEntry; +set string overrideAnim; +set string altmodeAnim; + +// NoteTrackToSoundEntry +use NoteTrackToSoundEntry; +set reusable notetrackSoundMapKeys; +set scriptstring notetrackSoundMapKeys; +set count notetrackSoundMapKeys 24; +set reusable notetrackSoundMapValues; +set scriptstring notetrackSoundMapValues; +set count notetrackSoundMapValues 24; + // WeaponDef use WeaponDef; set string szOverlayName; @@ -25,17 +55,17 @@ set reusable gunXModel; set count gunXModel 16; set reusable szXAnimsRightHanded; set string szXAnimsRightHanded; -set count szXAnimsRightHanded 37; +set count szXAnimsRightHanded NUM_WEAP_ANIMS; set reusable szXAnimsLeftHanded; set string szXAnimsLeftHanded; -set count szXAnimsLeftHanded 37; +set count szXAnimsLeftHanded NUM_WEAP_ANIMS; set string szModeName; set reusable notetrackSoundMapKeys; set scriptstring notetrackSoundMapKeys; -set count notetrackSoundMapKeys 16; +set count notetrackSoundMapKeys 24; set reusable notetrackSoundMapValues; set scriptstring notetrackSoundMapValues; -set count notetrackSoundMapValues 16; +set count notetrackSoundMapValues 24; set reusable notetrackRumbleMapKeys; set scriptstring notetrackRumbleMapKeys; set count notetrackRumbleMapKeys 16; @@ -44,6 +74,8 @@ set scriptstring notetrackRumbleMapValues; set count notetrackRumbleMapValues 16; set reusable bounceSound; set count bounceSound 31; +set reusable rollingSound; +set count rollingSound 31; set reusable worldModel; set count worldModel 16; set string szAmmoName; @@ -63,10 +95,11 @@ set string szUseHintString; set string dropHintString; set string szScript; set reusable locationDamageMultipliers; -set count locationDamageMultipliers 20; +set count locationDamageMultipliers HITLOC_NUM; set string fireRumble; set string meleeImpactRumble; set string turretBarrelSpinRumble; +set scriptstring stowTag; reorder: ... accuracyGraphName0 diff --git a/src/ZoneCode/Game/IW5/XAssets/XModel.txt b/src/ZoneCode/Game/IW5/XAssets/XModel.txt index 74f6b7e5..fc6addae 100644 --- a/src/ZoneCode/Game/IW5/XAssets/XModel.txt +++ b/src/ZoneCode/Game/IW5/XAssets/XModel.txt @@ -24,49 +24,7 @@ set count boneInfo numBones; // XModelLodInfo use XModelLodInfo; -set block modelSurfs XFILE_BLOCK_TEMP; -set action modelSurfs SetModelSurfs(XModelLodInfo, XModelSurfs); -set reusable modelSurfs; set condition surfs never; -// XModelSurfs -use XModelSurfs; -set block XFILE_BLOCK_VIRTUAL; -set string name; -set count surfs XModelLodInfo::numsurfs; // No this is not a mistake. This is how the game does it. - -// XSurface -use XSurface; -set reusable verts0; -set block verts0 XFILE_BLOCK_VERTEX; -set count verts0 vertCount; -set reusable vertList; -set count vertList vertListCount; -set reusable triIndices; -set block triIndices XFILE_BLOCK_INDEX; -set count triIndices triCount; -reorder: - zoneHandle - vertInfo - verts0 - vertList - triIndices; - -// XSurfaceVertexInfo -use XSurfaceVertexInfo; -set reusable vertsBlend; -set count vertsBlend vertCount[0] - + 3 * vertCount[1] - + 5 * vertCount[2] - + 7 * vertCount[3]; - -// XRigidVertList -set reusable XRigidVertList::collisionTree; - -// XSurfaceCollisionTree -use XSurfaceCollisionTree; -set count nodes nodeCount; -set count leafs leafCount; - // XModelCollSurf_s set count XModelCollSurf_s::collTris numCollTris; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/XModelSurfs.txt b/src/ZoneCode/Game/IW5/XAssets/XModelSurfs.txt index cfe348a9..dd41e7c3 100644 --- a/src/ZoneCode/Game/IW5/XAssets/XModelSurfs.txt +++ b/src/ZoneCode/Game/IW5/XAssets/XModelSurfs.txt @@ -4,4 +4,44 @@ use XModelSurfs; set block XFILE_BLOCK_TEMP; set string name; -set name name; \ No newline at end of file +set name name; +set count surfs numsurfs; + +// XSurface +use XSurface; +set reusable vertList; +set count vertList vertListCount; +set reusable triIndices; +set block triIndices XFILE_BLOCK_INDEX; +set count triIndices triCount; +reorder: + zoneHandle + vertInfo + verts0 + vertList + triIndices; + +// XSurfaceVertexInfo +use XSurfaceVertexInfo; +set reusable vertsBlend; +set count vertsBlend vertCount[0] + + 3 * vertCount[1] + + 5 * vertCount[2] + + 7 * vertCount[3]; + +// GfxVertexUnion0 +use GfxVertexUnion0; +set condition quantizedNoColorVerts0 never; +set condition quantizedVerts0 never; +set condition verts0 never; +set reusable packedVerts0; +set block packedVerts0 XFILE_BLOCK_VERTEX; +set count packedVerts0 XSurface::vertCount; + +// XRigidVertList +set reusable XRigidVertList::collisionTree; + +// XSurfaceCollisionTree +use XSurfaceCollisionTree; +set count nodes nodeCount; +set count leafs leafCount; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/clipMap_t.txt b/src/ZoneCode/Game/IW5/XAssets/clipMap_t.txt index f2636192..3b7f96ef 100644 --- a/src/ZoneCode/Game/IW5/XAssets/clipMap_t.txt +++ b/src/ZoneCode/Game/IW5/XAssets/clipMap_t.txt @@ -5,17 +5,11 @@ use clipMap_t; set block XFILE_BLOCK_TEMP; set string name; set name name; -set reusable planes; -set count planes planeCount; +set block pInfo XFILE_BLOCK_TEMP; +set reusable pInfo; set count staticModelList numStaticModels; -set count materials numMaterials; -set count brushsides numBrushSides; -set count brushEdges numBrushEdges; set count nodes numNodes; set count leafs numLeafs; -set count leafbrushNodes leafbrushNodesCount; -set count leafbrushes numLeafBrushes; -set count leafsurfaces numLeafSurfaces; set count verts vertCount; set count triIndices 3 * triCount; set count triEdgeIsWalkable ((3 * triCount + 31) / 32) * 4; @@ -23,10 +17,8 @@ set count borders borderCount; 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 count stages stageCount; set count dynEntDefList[0] dynEntCount[0]; set count dynEntDefList[1] dynEntCount[1]; set block dynEntPoseList XFILE_BLOCK_RUNTIME; @@ -38,20 +30,34 @@ set count dynEntClientList[1] dynEntCount[1]; set block dynEntCollList XFILE_BLOCK_RUNTIME; set count dynEntCollList[0] dynEntCount[0]; set count dynEntCollList[1] dynEntCount[1]; -reorder: - ... - leafs - leafbrushes - leafbrushNodes; -reorder: - ... - brushContents - smodelNodes - mapEnts; + +// ClipInfo +use ClipInfo; +set reusable planes; +set count planes planeCount; +set reusable materials; +set count materials numMaterials; +set reusable brushsides; +set count brushsides numBrushSides; +set reusable brushEdges; +set count brushEdges numBrushEdges; +set reusable leafbrushNodes; +set count leafbrushNodes leafbrushNodesCount; +set reusable leafbrushes; +set count leafbrushes numLeafBrushes; +set reusable brushes; +set count brushes numBrushes; +set reusable brushBounds; +set count brushBounds numBrushes; +set reusable brushContents; +set count brushContents numBrushes; // ClipMaterial set string ClipMaterial::name; +// cbrushside_t +// see PhysCollmap + // cNode_t set reusable cNode_t::plane; @@ -62,10 +68,15 @@ set reusable data::leaf::brushes; set count data::leaf::brushes leafBrushCount; // CollisionPartition -use CollisionPartition; -set reusable borders; +set reusable CollisionPartition::borders; // cbrush_t use cbrush_t; set reusable sides; -set reusable baseAdjacentSide; \ No newline at end of file +set reusable baseAdjacentSide; + +// Stage +set string Stage::name; + +// DynEntityDef +set reusable DynEntityDef::hinge; \ No newline at end of file diff --git a/src/ZoneCode/Game/IW5/XAssets/menuDef_t.txt b/src/ZoneCode/Game/IW5/XAssets/menuDef_t.txt index 70db6feb..311c3312 100644 --- a/src/ZoneCode/Game/IW5/XAssets/menuDef_t.txt +++ b/src/ZoneCode/Game/IW5/XAssets/menuDef_t.txt @@ -5,7 +5,16 @@ use menuDef_t; set block XFILE_BLOCK_TEMP; set string window::name; set name window::name; -set string font; +set count items itemCount; + +// windowDef_t +use windowDef_t; +set string name; +set string group; + +// menuData_t +use menuData_t; +set reusable expressionData; set reusable visibleExp; set string allowedBinding; set string soundName; @@ -15,32 +24,10 @@ set reusable rectWExp; set reusable rectHExp; set reusable openSoundExp; set reusable closeSoundExp; -set count items itemCount; -set reusable expressionData; +set reusable soundLoopExp; reorder: expressionData - window - font - onOpen - onClose - onCloseRequest - onESC - onKey - visibleExp - allowedBinding - soundName - rectXExp - rectYExp - rectWExp - rectHExp - openSoundExp - closeSoundExp - items; - -// windowDef_t -use windowDef_t; -set string name; -set string group; + onOpen; // MenuEventHandlerSet set count MenuEventHandlerSet::eventHandlers eventHandlerCount; @@ -72,7 +59,7 @@ set reusable expression; use Statement_s; set count entries numEntries; set reusable supportingData; -set condition lastResult never; +set condition persistentState never; // expressionEntry set condition expressionEntry::data::operand type == EET_OPERAND; @@ -123,6 +110,9 @@ set condition enumDvarName itemDef_s::type == 13; set condition ticker itemDef_s::type == 20; set condition scroll itemDef_s::type == 21; +// listBoxDef_s +set reusable listBoxDef_s::elementHeightExp; + // multiDef_s use multiDef_s; set string dvarList; diff --git a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp index 2b9c6b9e..06c8d42f 100644 --- a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp +++ b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp @@ -40,6 +40,7 @@ const char* GameAssetPoolIW5::ASSET_TYPE_NAMES[] "localize", "attachment", "weapon", + "snddriverglobals", "fx", "impactfx", "surfacefx", diff --git a/src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp b/src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp index f0b2ab2e..80abdc40 100644 --- a/src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp +++ b/src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp @@ -97,7 +97,7 @@ void ContentLoader::LoadXAsset(const bool atStreamStart) loader.Load(&varXAsset->header.headerEntry); \ break; \ } -#define SKIP_ASSET(type_index, typeName, headerEntry) \ +#define SKIP_ASSET(type_index) \ case type_index: \ break; @@ -137,6 +137,7 @@ void ContentLoader::LoadXAsset(const bool atStreamStart) LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) LOAD_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) + SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS) LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) LOAD_ASSET(ASSET_TYPE_SURFACE_FX, SurfaceFxTable, surfaceFx) diff --git a/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp b/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp index 10a41a0b..8a6a1a94 100644 --- a/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp +++ b/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp @@ -67,13 +67,15 @@ class ZoneLoaderFactory::Impl { #define XBLOCK_DEF(name, type) std::make_unique(STR(name), name, type) - zoneLoader->AddXBlock(XBLOCK_DEF(IW5::XFILE_BLOCK_TEMP, XBlock::Type::BLOCK_TYPE_TEMP)); - zoneLoader->AddXBlock(XBLOCK_DEF(IW5::XFILE_BLOCK_PHYSICAL, XBlock::Type::BLOCK_TYPE_NORMAL)); - zoneLoader->AddXBlock(XBLOCK_DEF(IW5::XFILE_BLOCK_RUNTIME, XBlock::Type::BLOCK_TYPE_RUNTIME)); - zoneLoader->AddXBlock(XBLOCK_DEF(IW5::XFILE_BLOCK_VIRTUAL, XBlock::Type::BLOCK_TYPE_NORMAL)); - zoneLoader->AddXBlock(XBLOCK_DEF(IW5::XFILE_BLOCK_LARGE, XBlock::Type::BLOCK_TYPE_NORMAL)); - zoneLoader->AddXBlock(XBLOCK_DEF(IW5::XFILE_BLOCK_CALLBACK, XBlock::Type::BLOCK_TYPE_NORMAL)); - zoneLoader->AddXBlock(XBLOCK_DEF(IW5::XFILE_BLOCK_SCRIPT, XBlock::Type::BLOCK_TYPE_NORMAL)); + zoneLoader->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_TEMP, XBlock::Type::BLOCK_TYPE_TEMP)); + zoneLoader->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_PHYSICAL, XBlock::Type::BLOCK_TYPE_NORMAL)); + zoneLoader->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_RUNTIME, XBlock::Type::BLOCK_TYPE_RUNTIME)); + zoneLoader->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_VIRTUAL, XBlock::Type::BLOCK_TYPE_NORMAL)); + zoneLoader->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_LARGE, XBlock::Type::BLOCK_TYPE_NORMAL)); + zoneLoader->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_CALLBACK, XBlock::Type::BLOCK_TYPE_NORMAL)); + zoneLoader->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_VERTEX, XBlock::Type::BLOCK_TYPE_NORMAL)); + zoneLoader->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_INDEX, XBlock::Type::BLOCK_TYPE_NORMAL)); + zoneLoader->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_SCRIPT, XBlock::Type::BLOCK_TYPE_NORMAL)); #undef XBLOCK_DEF } diff --git a/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.cpp b/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.cpp index d6f6ade6..0457f8e6 100644 --- a/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.cpp +++ b/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.cpp @@ -40,6 +40,8 @@ public: m_writer->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_VIRTUAL, XBlock::Type::BLOCK_TYPE_NORMAL)); m_writer->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_LARGE, XBlock::Type::BLOCK_TYPE_NORMAL)); m_writer->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_CALLBACK, XBlock::Type::BLOCK_TYPE_NORMAL)); + m_writer->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_VERTEX, XBlock::Type::BLOCK_TYPE_NORMAL)); + m_writer->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_INDEX, XBlock::Type::BLOCK_TYPE_NORMAL)); m_writer->AddXBlock(XBLOCK_DEF(XFILE_BLOCK_SCRIPT, XBlock::Type::BLOCK_TYPE_NORMAL)); #undef XBLOCK_DEF