Merge pull request #16 from Laupetin/code-formatting

Code formatting with clang-format
This commit is contained in:
Jan 2023-11-19 22:19:13 +01:00 committed by GitHub
commit 8295b81ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1103 changed files with 16814 additions and 16229 deletions

24
.clang-format Normal file
View File

@ -0,0 +1,24 @@
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignArrayOfStructures: Left
AllowShortBlocksOnASingleLine: Empty
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: Empty
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
ColumnLimit: 160
IncludeBlocks: Regroup
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertNewlineAtEOF: true
NamespaceIndentation: All
PackConstructorInitializers: Never
PointerAlignment: Left
SeparateDefinitionBlocks: Always
SortUsingDeclarations: Lexicographic
SpaceAfterTemplateKeyword: false

24
.github/workflows/check-formatting.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
name: check-formatting
on:
pull_request:
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "17.0"
- name: Test formatting for all files
working-directory: ${{ github.workspace }}
run: |
export CLANG_FORMAT_BIN="${LLVM_PATH}/bin/clang-format"
./scripts/check-format.sh

8
scripts/check-format.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# Go to repository root
cd "$(dirname "$0")/.." || exit 2
CLANG_FORMAT_BIN="${CLANG_FORMAT_BIN:-clang-format}"
find ./src ./test -iname '*.h' -o -iname '*.cpp' | xargs $CLANG_FORMAT_BIN -Werror -ferror-limit=1 --dry-run

6
scripts/reformat-all.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# Go to repository root
cd "$(dirname "$0")/.." || exit 2
find ./src ./test -iname '*.h' -o -iname '*.cpp' | xargs clang-format --verbose -i

View File

@ -1,7 +1,8 @@
#pragma once #pragma once
#include <vector>
#include "GameLanguage.h" #include "GameLanguage.h"
#include <vector>
class Zone; class Zone;
class IGame class IGame
@ -20,4 +21,4 @@ public:
virtual void RemoveZone(Zone* zone) = 0; virtual void RemoveZone(Zone* zone) = 0;
virtual std::vector<Zone*> GetZones() = 0; virtual std::vector<Zone*> GetZones() = 0;
virtual std::vector<GameLanguagePrefix> GetLanguagePrefixes() = 0; virtual std::vector<GameLanguagePrefix> GetLanguagePrefixes() = 0;
}; };

View File

@ -10,7 +10,7 @@ namespace IW3
static constexpr uint32_t R_HashString(const char* string, const uint32_t hash) static constexpr uint32_t R_HashString(const char* string, const uint32_t hash)
{ {
const char* v2 = string; // edx@1 const char* v2 = string; // edx@1
char v3 = *string; // cl@1 char v3 = *string; // cl@1
uint32_t result = hash; uint32_t result = hash;
for (; *v2; v3 = *v2) for (; *v2; v3 = *v2)
@ -28,4 +28,4 @@ namespace IW3
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
}; };
} } // namespace IW3

View File

@ -1,9 +1,9 @@
#include "GameIW3.h" #include "GameIW3.h"
#include <algorithm>
#include "IW3.h" #include "IW3.h"
#include <algorithm>
using namespace IW3; using namespace IW3;
GameIW3 g_GameIW3; GameIW3 g_GameIW3;

View File

@ -14,4 +14,4 @@ public:
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override; std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
}; };
extern GameIW3 g_GameIW3; extern GameIW3 g_GameIW3;

View File

@ -1,10 +1,14 @@
#pragma once #pragma once
//#include <d3d11.h> // clang-format off: Order of includes matters here
// #include <d3d9.h>
#include "Image/Texture.h" #include "Image/Texture.h"
#include "IW3_Assets.h" #include "IW3_Assets.h"
// clang-format on
namespace IW3 namespace IW3
{ {
struct ScriptStringList struct ScriptStringList
@ -79,4 +83,4 @@ namespace IW3
WFT_NUM_FIELD_TYPES WFT_NUM_FIELD_TYPES
}; };
} } // namespace IW3

View File

@ -45,7 +45,7 @@ namespace IW3
ASSET_TYPE_RAWFILE = 0x1F, ASSET_TYPE_RAWFILE = 0x1F,
ASSET_TYPE_STRINGTABLE = 0x20, ASSET_TYPE_STRINGTABLE = 0x20,
ASSET_TYPE_COUNT, ASSET_TYPE_COUNT,
ASSET_TYPE_STRING = ASSET_TYPE_COUNT, ASSET_TYPE_STRING = ASSET_TYPE_COUNT,
ASSET_TYPE_ASSETLIST, ASSET_TYPE_ASSETLIST,
@ -100,35 +100,35 @@ namespace IW3
union XAssetHeader union XAssetHeader
{ {
// XModelPieces *xmodelPieces; // NOT AN ASSET // XModelPieces *xmodelPieces; // NOT AN ASSET
PhysPreset *physPreset; PhysPreset* physPreset;
XAnimParts *parts; XAnimParts* parts;
XModel *model; XModel* model;
Material *material; Material* material;
MaterialPixelShader *pixelShader; MaterialPixelShader* pixelShader;
MaterialVertexShader *vertexShader; MaterialVertexShader* vertexShader;
MaterialTechniqueSet *techniqueSet; MaterialTechniqueSet* techniqueSet;
GfxImage *image; GfxImage* image;
snd_alias_list_t *sound; snd_alias_list_t* sound;
SndCurve *sndCurve; SndCurve* sndCurve;
LoadedSound *loadSnd; LoadedSound* loadSnd;
clipMap_t *clipMap; clipMap_t* clipMap;
ComWorld *comWorld; ComWorld* comWorld;
GameWorldSp *gameWorldSp; GameWorldSp* gameWorldSp;
GameWorldMp *gameWorldMp; GameWorldMp* gameWorldMp;
MapEnts *mapEnts; MapEnts* mapEnts;
GfxWorld *gfxWorld; GfxWorld* gfxWorld;
GfxLightDef *lightDef; GfxLightDef* lightDef;
Font_s *font; Font_s* font;
MenuList *menuList; MenuList* menuList;
menuDef_t *menu; menuDef_t* menu;
LocalizeEntry *localize; LocalizeEntry* localize;
WeaponDef *weapon; WeaponDef* weapon;
SndDriverGlobals *sndDriverGlobals; SndDriverGlobals* sndDriverGlobals;
FxEffectDef *fx; FxEffectDef* fx;
FxImpactTable *impactFx; FxImpactTable* impactFx;
RawFile *rawfile; RawFile* rawfile;
StringTable *stringTable; StringTable* stringTable;
void *data; void* data;
}; };
typedef char cbrushedge_t; typedef char cbrushedge_t;
@ -142,7 +142,7 @@ namespace IW3
XModel* model; XModel* model;
float offset[3]; float offset[3];
}; };
struct XModelPieces struct XModelPieces
{ {
const char* name; const char* name;
@ -152,14 +152,14 @@ namespace IW3
struct PhysPreset struct PhysPreset
{ {
const char *name; const char* name;
int type; int type;
float mass; float mass;
float bounce; float bounce;
float friction; float friction;
float bulletForceScale; float bulletForceScale;
float explosiveForceScale; float explosiveForceScale;
const char *sndAliasPrefix; const char* sndAliasPrefix;
float piecesSpreadFraction; float piecesSpreadFraction;
float piecesUpwardVelocity; float piecesUpwardVelocity;
bool tempDefaultToCylinder; bool tempDefaultToCylinder;
@ -224,7 +224,7 @@ namespace IW3
struct XAnimDeltaPartQuatDataFrames struct XAnimDeltaPartQuatDataFrames
{ {
XQuat *frames; XQuat* frames;
XAnimDynamicIndicesQuat indices; XAnimDynamicIndicesQuat indices;
}; };
@ -371,7 +371,7 @@ namespace IW3
char zoneHandle; char zoneHandle;
uint16_t baseTriIndex; uint16_t baseTriIndex;
uint16_t baseVertIndex; uint16_t baseVertIndex;
r_index16_t(*triIndices)[3]; r_index16_t (*triIndices)[3];
XSurfaceVertexInfo vertInfo; XSurfaceVertexInfo vertInfo;
GfxPackedVertex* verts0; GfxPackedVertex* verts0;
unsigned int vertListCount; unsigned int vertListCount;
@ -485,8 +485,8 @@ namespace IW3
char lodRampType; char lodRampType;
uint16_t* boneNames; uint16_t* boneNames;
char* parentList; char* parentList;
int16_t(*quats)[4]; int16_t (*quats)[4];
float(*trans)[4]; float (*trans)[4];
char* partClassification; char* partClassification;
DObjAnimMat* baseMat; DObjAnimMat* baseMat;
XSurface* surfs; XSurface* surfs;
@ -705,7 +705,7 @@ namespace IW3
char nameStart; char nameStart;
char nameEnd; char nameEnd;
unsigned char samplerState; // SamplerStateBits_e unsigned char samplerState; // SamplerStateBits_e
unsigned char semantic; // TextureSemantic unsigned char semantic; // TextureSemantic
MaterialTextureDefInfo u; MaterialTextureDefInfo u;
}; };
@ -820,7 +820,7 @@ namespace IW3
union MaterialArgumentDef union MaterialArgumentDef
{ {
const float(*literalConst)[4]; const float (*literalConst)[4];
MaterialArgumentCodeConst codeConst; MaterialArgumentCodeConst codeConst;
unsigned int codeSampler; unsigned int codeSampler;
unsigned int nameHash; unsigned int nameHash;
@ -1156,7 +1156,7 @@ namespace IW3
struct MaterialVertexStreamRouting struct MaterialVertexStreamRouting
{ {
MaterialStreamRouting data[16]; MaterialStreamRouting data[16];
void/*IDirect3DVertexDeclaration9*/* decl[16]; void /*IDirect3DVertexDeclaration9*/* decl[16];
}; };
struct MaterialVertexDeclaration struct MaterialVertexDeclaration
@ -1176,7 +1176,7 @@ namespace IW3
struct MaterialVertexShaderProgram struct MaterialVertexShaderProgram
{ {
void/*IDirect3DVertexShader9*/* vs; void /*IDirect3DVertexShader9*/* vs;
GfxVertexShaderLoadDef loadDef; GfxVertexShaderLoadDef loadDef;
}; };
@ -1195,7 +1195,7 @@ namespace IW3
struct MaterialPixelShaderProgram struct MaterialPixelShaderProgram
{ {
void/*IDirect3DPixelShader9*/* ps; void /*IDirect3DPixelShader9*/* ps;
GfxPixelShaderLoadDef loadDef; GfxPixelShaderLoadDef loadDef;
}; };
@ -1304,10 +1304,10 @@ namespace IW3
union GfxTexture union GfxTexture
{ {
//void/*IDirect3DBaseTexture9*/* basemap; // void/*IDirect3DBaseTexture9*/* basemap;
//void/*IDirect3DTexture9*/* map; // void/*IDirect3DTexture9*/* map;
//void/*IDirect3DVolumeTexture9*/* volmap; // void/*IDirect3DVolumeTexture9*/* volmap;
//void/*IDirect3DCubeTexture9*/* cubemap; // void/*IDirect3DCubeTexture9*/* cubemap;
Texture* texture; Texture* texture;
GfxImageLoadDef* loadDef; GfxImageLoadDef* loadDef;
}; };
@ -1681,7 +1681,7 @@ namespace IW3
unsigned int numLeafSurfaces; unsigned int numLeafSurfaces;
unsigned int* leafsurfaces; unsigned int* leafsurfaces;
unsigned int vertCount; unsigned int vertCount;
vec3_t *verts; vec3_t* verts;
int triCount; int triCount;
uint16_t* triIndices; uint16_t* triIndices;
char* triEdgeIsWalkable; char* triEdgeIsWalkable;
@ -1898,13 +1898,13 @@ namespace IW3
struct GfxWorldVertexData struct GfxWorldVertexData
{ {
GfxWorldVertex* vertices; GfxWorldVertex* vertices;
void/*IDirect3DVertexBuffer9*/* worldVb; void /*IDirect3DVertexBuffer9*/* worldVb;
}; };
struct GfxWorldVertexLayerData struct GfxWorldVertexLayerData
{ {
char* data; char* data;
void/*IDirect3DVertexBuffer9*/* layerVb; void /*IDirect3DVertexBuffer9*/* layerVb;
}; };
struct SunLightParseParams struct SunLightParseParams
@ -1979,7 +1979,7 @@ namespace IW3
bool isAncestor; bool isAncestor;
char recursionDepth; char recursionDepth;
char hullPointCount; char hullPointCount;
float(*hullPoints)[2]; float (*hullPoints)[2];
GfxPortal* queuedParent; GfxPortal* queuedParent;
}; };
@ -3076,13 +3076,13 @@ namespace IW3
// TODO: Order is accuracyGraphName[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ... // 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. // 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. // So might be something to fix but on the other hand it might be too much work for this little inconvenience.
//const char* accuracyGraphName[2]; // const char* accuracyGraphName[2];
const char* accuracyGraphName0; const char* accuracyGraphName0;
const char* accuracyGraphName1; const char* accuracyGraphName1;
//float(*accuracyGraphKnots[2])[2]; // float(*accuracyGraphKnots[2])[2];
vec2_t* accuracyGraphKnots0; vec2_t* accuracyGraphKnots0;
vec2_t* accuracyGraphKnots1; vec2_t* accuracyGraphKnots1;
//float(*originalAccuracyGraphKnots[2])[2]; // float(*originalAccuracyGraphKnots[2])[2];
vec2_t* originalAccuracyGraphKnots0; vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1; vec2_t* originalAccuracyGraphKnots1;
int accuracyGraphKnotCount[2]; int accuracyGraphKnotCount[2];

View File

@ -10,7 +10,7 @@ namespace IW4
static constexpr uint32_t R_HashString(const char* string, const uint32_t hash) static constexpr uint32_t R_HashString(const char* string, const uint32_t hash)
{ {
const char* v2 = string; // edx@1 const char* v2 = string; // edx@1
char v3 = *string; // cl@1 char v3 = *string; // cl@1
uint32_t result = hash; uint32_t result = hash;
for (; *v2; v3 = *v2) for (; *v2; v3 = *v2)
@ -35,4 +35,4 @@ namespace IW4
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
}; };
} } // namespace IW4

View File

@ -1,9 +1,9 @@
#include "GameIW4.h" #include "GameIW4.h"
#include <algorithm>
#include "IW4.h" #include "IW4.h"
#include <algorithm>
using namespace IW4; using namespace IW4;
GameIW4 g_GameIW4; GameIW4 g_GameIW4;

View File

@ -14,4 +14,4 @@ public:
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override; std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
}; };
extern GameIW4 g_GameIW4; extern GameIW4 g_GameIW4;

View File

@ -1,10 +1,14 @@
#pragma once #pragma once
//#include <d3d11.h> // clang-format off: Order of includes matters here
// #include <d3d9.h>
#include "Image/Texture.h" #include "Image/Texture.h"
#include "IW4_Assets.h" #include "IW4_Assets.h"
// clang-format on
namespace IW4 namespace IW4
{ {
struct DB_AuthHash struct DB_AuthHash
@ -26,11 +30,11 @@ namespace IW4
struct DB_AuthHeader struct DB_AuthHeader
{ {
char magic[8]; // + 0 char magic[8]; // + 0
unsigned int reserved; // + 8 unsigned int reserved; // + 8
DB_AuthHash subheaderHash; // + 12 DB_AuthHash subheaderHash; // + 12
DB_AuthSignature signedSubheaderHash; // + 44 DB_AuthSignature signedSubheaderHash; // + 44
DB_AuthSubHeader subheader; // + 300 DB_AuthSubHeader subheader; // + 300
}; };
struct ScriptStringList struct ScriptStringList
@ -122,4 +126,4 @@ namespace IW4
VFT_NUM, VFT_NUM,
}; };
} } // namespace IW4

View File

@ -571,8 +571,8 @@ namespace IW4
unsigned int noScalePartBits[6]; unsigned int noScalePartBits[6];
uint16_t* boneNames; uint16_t* boneNames;
unsigned char* parentList; unsigned char* parentList;
int16_t(*quats)[4]; int16_t (*quats)[4];
float(*trans)[3]; float (*trans)[3];
unsigned char* partClassification; unsigned char* partClassification;
DObjAnimMat* baseMat; DObjAnimMat* baseMat;
Material** materialHandles; Material** materialHandles;
@ -669,7 +669,7 @@ namespace IW4
char nameStart; char nameStart;
char nameEnd; char nameEnd;
unsigned char samplerState; // SamplerStateBits_e unsigned char samplerState; // SamplerStateBits_e
unsigned char semantic; // TextureSemantic unsigned char semantic; // TextureSemantic
MaterialTextureDefInfo u; MaterialTextureDefInfo u;
}; };
@ -878,13 +878,13 @@ namespace IW4
SORTKEY_TRANS_START = 6, SORTKEY_TRANS_START = 6,
SORTKEY_DECAL_BOTTOM_1 = 6, // prob decal - bottom 1 SORTKEY_DECAL_BOTTOM_1 = 6, // prob decal - bottom 1
SORTKEY_DECAL_BOTTOM_2 = 7, // prob decal - bottom 2 SORTKEY_DECAL_BOTTOM_2 = 7, // prob decal - bottom 2
SORTKEY_DECAL_BOTTOM_3 = 8, // prob decal - bottom 3 SORTKEY_DECAL_BOTTOM_3 = 8, // prob decal - bottom 3
SORTKEY_DECAL_STATIC_DECAL = 9, // prob decal - static decal SORTKEY_DECAL_STATIC_DECAL = 9, // prob decal - static decal
SORTKEY_DECAL_MIDDLE_1 = 10, // prob decal - middle 1 SORTKEY_DECAL_MIDDLE_1 = 10, // prob decal - middle 1
SORTKEY_DECAL_MIDDLE_2 = 11, // prob decal - middle 2 SORTKEY_DECAL_MIDDLE_2 = 11, // prob decal - middle 2
SORTKEY_DECAL_MIDDLE_3 = 12, // prob decal - middle 3 SORTKEY_DECAL_MIDDLE_3 = 12, // prob decal - middle 3
SORTKEY_DECAL_WEAPON_IMPACT = 13, // prob decal - weapon impact SORTKEY_DECAL_WEAPON_IMPACT = 13, // prob decal - weapon impact
// ? = 14, // prob decal - top 1 // ? = 14, // prob decal - top 1
// some decal = 15, // prob decal - top 2 or decal - top 3 // some decal = 15, // prob decal - top 2 or decal - top 3
@ -896,7 +896,7 @@ namespace IW4
// ? = 21, // ? = 21,
// - = 22, // - = 22,
// - = 23, // - = 23,
SORTKEY_WINDOW_INSIDE = 24, // prob window inside SORTKEY_WINDOW_INSIDE = 24, // prob window inside
SORTKEY_WINDOW_OUTSIDE = 25, // prob window outside SORTKEY_WINDOW_OUTSIDE = 25, // prob window outside
// ? = 26, // includes motiontracker3d, impact fx, atmos // ? = 26, // includes motiontracker3d, impact fx, atmos
// ? = 27, // ? = 27,
@ -919,11 +919,11 @@ namespace IW4
// ? = 44, // ? = 44,
// ? = 45, // ? = 45,
// - = 46, // - = 46,
SORTKEY_BLEND_ADDITIVE = 47, // most likely blend / additive SORTKEY_BLEND_ADDITIVE = 47, // most likely blend / additive
SORTKEY_EFFECT_AUTO_SORT = 48, // most likely effect - auto sort SORTKEY_EFFECT_AUTO_SORT = 48, // most likely effect - auto sort
SORTKEY_AFTER_EFFECTS_BOTTOM = 49, SORTKEY_AFTER_EFFECTS_BOTTOM = 49,
SORTKEY_AFTER_EFFECTS_MIDDLE = 50, // prob after effects - middle SORTKEY_AFTER_EFFECTS_MIDDLE = 50, // prob after effects - middle
SORTKEY_AFTER_EFFECTS_TOP = 51, // prob after effects - top SORTKEY_AFTER_EFFECTS_TOP = 51, // prob after effects - top
// - = 52, // - = 52,
SORTKEY_VIEWMODEL_EFFECT = 53, // maybe viewmodel effect SORTKEY_VIEWMODEL_EFFECT = 53, // maybe viewmodel effect
@ -1087,7 +1087,7 @@ namespace IW4
STREAM_SRC_COUNT STREAM_SRC_COUNT
}; };
enum MaterialStreamDestination_e enum MaterialStreamDestination_e
{ {
STREAM_DST_POSITION = 0x0, STREAM_DST_POSITION = 0x0,
@ -1116,7 +1116,7 @@ namespace IW4
struct MaterialVertexStreamRouting struct MaterialVertexStreamRouting
{ {
MaterialStreamRouting data[13]; MaterialStreamRouting data[13];
void/*IDirect3DVertexDeclaration9*/* decl[16]; void /*IDirect3DVertexDeclaration9*/* decl[16];
}; };
struct MaterialVertexDeclaration struct MaterialVertexDeclaration
@ -1129,7 +1129,7 @@ namespace IW4
struct MaterialVertexShaderProgram struct MaterialVertexShaderProgram
{ {
void/*IDirect3DVertexShader9*/* vs; void /*IDirect3DVertexShader9*/* vs;
GfxVertexShaderLoadDef loadDef; GfxVertexShaderLoadDef loadDef;
}; };
@ -1141,7 +1141,7 @@ namespace IW4
struct MaterialPixelShaderProgram struct MaterialPixelShaderProgram
{ {
void/*IDirect3DPixelShader9*/* ps; void /*IDirect3DPixelShader9*/* ps;
GfxPixelShaderLoadDef loadDef; GfxPixelShaderLoadDef loadDef;
}; };
@ -1205,11 +1205,11 @@ namespace IW4
enum MaterialType enum MaterialType
{ {
MTL_TYPE_DEFAULT = 0x0, MTL_TYPE_DEFAULT = 0x0,
MTL_TYPE_MODEL = 0x1, // m_ MTL_TYPE_MODEL = 0x1, // m_
MTL_TYPE_MODEL_VERTCOL = 0x2, // mc_ MTL_TYPE_MODEL_VERTCOL = 0x2, // mc_
MTL_TYPE_MODEL_VERTCOL_GREY = 0x3, // mg_ MTL_TYPE_MODEL_VERTCOL_GREY = 0x3, // mg_
MTL_TYPE_WORLD = 0x4, // w_ MTL_TYPE_WORLD = 0x4, // w_
MTL_TYPE_WORLD_VERTCOL = 0x5, // wc_ MTL_TYPE_WORLD_VERTCOL = 0x5, // wc_
MTL_TYPE_COUNT, MTL_TYPE_COUNT,
}; };
@ -1409,20 +1409,20 @@ namespace IW4
enum MaterialShaderArgumentType enum MaterialShaderArgumentType
{ {
MTL_ARG_MATERIAL_VERTEX_CONST = 0x0, // stable MTL_ARG_MATERIAL_VERTEX_CONST = 0x0, // stable
MTL_ARG_LITERAL_VERTEX_CONST = 0x1, // stable MTL_ARG_LITERAL_VERTEX_CONST = 0x1, // stable
MTL_ARG_MATERIAL_PIXEL_SAMPLER = 0x2, // stable MTL_ARG_MATERIAL_PIXEL_SAMPLER = 0x2, // stable
MTL_ARG_CODE_PRIM_BEGIN = 0x3, MTL_ARG_CODE_PRIM_BEGIN = 0x3,
MTL_ARG_CODE_VERTEX_CONST = 0x3, // stable object prim MTL_ARG_CODE_VERTEX_CONST = 0x3, // stable object prim
MTL_ARG_CODE_PIXEL_SAMPLER = 0x4, // stable object MTL_ARG_CODE_PIXEL_SAMPLER = 0x4, // stable object
MTL_ARG_CODE_PIXEL_CONST = 0x5, // stable MTL_ARG_CODE_PIXEL_CONST = 0x5, // stable
MTL_ARG_CODE_PRIM_END = 0x6, MTL_ARG_CODE_PRIM_END = 0x6,
MTL_ARG_MATERIAL_PIXEL_CONST = 0x6, // stable MTL_ARG_MATERIAL_PIXEL_CONST = 0x6, // stable
MTL_ARG_LITERAL_PIXEL_CONST = 0x7, // stable MTL_ARG_LITERAL_PIXEL_CONST = 0x7, // stable
MTL_ARG_COUNT MTL_ARG_COUNT
}; };
@ -1457,14 +1457,15 @@ namespace IW4
enum TechniqueFlags enum TechniqueFlags
{ {
// Guesses purely based on data analysis: // Guesses purely based on data analysis:
TECHNIQUE_FLAG_1 = 0x1, // uses resolvedPostSun code sampler // MTL_TECHFLAG_NEEDS_RESOLVED_POST_SUN TECHNIQUE_FLAG_1 = 0x1, // uses resolvedPostSun code sampler // MTL_TECHFLAG_NEEDS_RESOLVED_POST_SUN
TECHNIQUE_FLAG_2 = 0x2, // uses resolvedScene code sampler MTL_TECHFLAG_NEEDS_RESOLVED_SCENE TECHNIQUE_FLAG_2 = 0x2, // uses resolvedScene code sampler MTL_TECHFLAG_NEEDS_RESOLVED_SCENE
TECHNIQUE_FLAG_4 = 0x4, // zprepass only TECHNIQUE_FLAG_4 = 0x4, // zprepass only
TECHNIQUE_FLAG_8 = 0x8, // build_floatz only TECHNIQUE_FLAG_8 = 0x8, // build_floatz only
TECHNIQUE_FLAG_10 = 0x10, // build_shadowmap_depth + build_shadowmap_model only TECHNIQUE_FLAG_10 = 0x10, // build_shadowmap_depth + build_shadowmap_model only
TECHNIQUE_FLAG_20 = 0x20, // techniques with _i_ in its name (all use texcoord[1] in decl -> other optional stream sources are not used at all so might be any optional) TECHNIQUE_FLAG_20 =
TECHNIQUE_FLAG_40 = 0x40, // uses code constant light.spotDir or light.spotFactors 0x20, // techniques with _i_ in its name (all use texcoord[1] in decl -> other optional stream sources are not used at all so might be any optional)
TECHNIQUE_FLAG_80 = 0x80, // uses floatZ sampler and does not have 0x100 flag TECHNIQUE_FLAG_40 = 0x40, // uses code constant light.spotDir or light.spotFactors
TECHNIQUE_FLAG_80 = 0x80, // uses floatZ sampler and does not have 0x100 flag
TECHNIQUE_FLAG_100 = 0x100, // distortion_scale_zfeather_dtex + distortion_scale_ua_zfeather + distortion_scale_zfeather TECHNIQUE_FLAG_100 = 0x100, // distortion_scale_zfeather_dtex + distortion_scale_ua_zfeather + distortion_scale_zfeather
TECHNIQUE_FLAG_200 = 0x200, // ? TECHNIQUE_FLAG_200 = 0x200, // ?
}; };
@ -1758,7 +1759,7 @@ namespace IW4
DvarValue latched; DvarValue latched;
DvarValue reset; DvarValue reset;
DvarLimits domain; DvarLimits domain;
//bool (__cdecl* domainFunc)(dvar_t*, DvarValue); // bool (__cdecl* domainFunc)(dvar_t*, DvarValue);
void* domainFunc; void* domainFunc;
dvar_t* hashNext; dvar_t* hashNext;
}; };
@ -3065,11 +3066,13 @@ namespace IW4
float fAngle; float fAngle;
float forward[2]; float forward[2];
float fRadius; float fRadius;
union union
{ {
float minUseDistSq; float minUseDistSq;
PathNodeErrorCode error; PathNodeErrorCode error;
}; };
int16_t wOverlapNode[2]; int16_t wOverlapNode[2];
uint16_t totalLinkCount; uint16_t totalLinkCount;
pathlink_s* Links; pathlink_s* Links;
@ -3097,6 +3100,7 @@ namespace IW4
pathnode_t* pParent; pathnode_t* pParent;
float fCost; float fCost;
float fHeuristic; float fHeuristic;
union union
{ {
float nodeCost; float nodeCost;
@ -3259,6 +3263,7 @@ namespace IW4
FxSpatialFrame frame; FxSpatialFrame frame;
float radius; float radius;
}; };
unsigned int nextFree; unsigned int nextFree;
}; };
@ -3417,7 +3422,7 @@ namespace IW4
bool isAncestor; bool isAncestor;
char recursionDepth; char recursionDepth;
char hullPointCount; char hullPointCount;
float(*hullPoints)[2]; float (*hullPoints)[2];
GfxPortal* queuedParent; GfxPortal* queuedParent;
}; };
@ -3470,13 +3475,13 @@ namespace IW4
struct GfxWorldVertexData struct GfxWorldVertexData
{ {
GfxWorldVertex* vertices; GfxWorldVertex* vertices;
void/*IDirect3DVertexBuffer9*/* worldVb; void /*IDirect3DVertexBuffer9*/* worldVb;
}; };
struct GfxWorldVertexLayerData struct GfxWorldVertexLayerData
{ {
char* data; char* data;
void/*IDirect3DVertexBuffer9*/* layerVb; void /*IDirect3DVertexBuffer9*/* layerVb;
}; };
struct GfxWorldDraw struct GfxWorldDraw
@ -3757,7 +3762,7 @@ namespace IW4
unsigned int sortKeyEffectAuto; unsigned int sortKeyEffectAuto;
unsigned int sortKeyDistortion; unsigned int sortKeyDistortion;
GfxWorldDpvsPlanes dpvsPlanes; GfxWorldDpvsPlanes dpvsPlanes;
int/*GfxCellTreeCount*/* aabbTreeCounts; int /*GfxCellTreeCount*/* aabbTreeCounts;
GfxCellTree128* aabbTrees; GfxCellTree128* aabbTrees;
GfxCell* cells; GfxCell* cells;
GfxWorldDraw draw; GfxWorldDraw draw;
@ -4639,7 +4644,6 @@ namespace IW4
VEH_TYPE_COUNT = 0x7, VEH_TYPE_COUNT = 0x7,
}; };
struct VehicleDef struct VehicleDef
{ {
const char* name; const char* name;

View File

@ -22,17 +22,17 @@ int Common::StringTable_HashString(const char* str)
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in) PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
{ {
return PackedTexCoords{ Pack32::Vec2PackTexCoords(reinterpret_cast<const float*>(in)) }; return PackedTexCoords{Pack32::Vec2PackTexCoords(reinterpret_cast<const float*>(in))};
} }
PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in) PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
{ {
return PackedUnitVec{ Pack32::Vec3PackUnitVec(reinterpret_cast<const float*>(in)) }; return PackedUnitVec{Pack32::Vec3PackUnitVec(reinterpret_cast<const float*>(in))};
} }
GfxColor Common::Vec4PackGfxColor(const vec4_t* in) GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
{ {
return GfxColor{ Pack32::Vec4PackGfxColor(reinterpret_cast<const float*>(in)) }; return GfxColor{Pack32::Vec4PackGfxColor(reinterpret_cast<const float*>(in))};
} }
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out) void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)

View File

@ -16,4 +16,4 @@ namespace IW5
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
}; };
} } // namespace IW5

View File

@ -1,9 +1,9 @@
#include "GameIW5.h" #include "GameIW5.h"
#include <algorithm>
#include "IW5.h" #include "IW5.h"
#include <algorithm>
using namespace IW5; using namespace IW5;
GameIW5 g_GameIW5; GameIW5 g_GameIW5;

View File

@ -14,4 +14,4 @@ public:
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override; std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
}; };
extern GameIW5 g_GameIW5; extern GameIW5 g_GameIW5;

View File

@ -1,10 +1,14 @@
#pragma once #pragma once
//#include <d3d11.h> // clang-format off: Order of includes matters here
// #include <d3d9.h>
#include "Image/Texture.h" #include "Image/Texture.h"
#include "IW5_Assets.h" #include "IW5_Assets.h"
// clang-format on
namespace IW5 namespace IW5
{ {
struct DB_AuthHash struct DB_AuthHash
@ -26,11 +30,11 @@ namespace IW5
struct DB_AuthHeader struct DB_AuthHeader
{ {
char magic[8]; // + 0 char magic[8]; // + 0
unsigned int reserved; // + 8 unsigned int reserved; // + 8
DB_AuthHash subheaderHash; // + 12 DB_AuthHash subheaderHash; // + 12
DB_AuthSignature signedSubheaderHash; // + 44 DB_AuthSignature signedSubheaderHash; // + 44
DB_AuthSubHeader subheader; // + 300 DB_AuthSubHeader subheader; // + 300
}; };
struct ScriptStringList struct ScriptStringList
@ -79,4 +83,4 @@ namespace IW5
CSPFT_NUM_BASE_FIELD_TYPES, CSPFT_NUM_BASE_FIELD_TYPES,
}; };
} } // namespace IW5

View File

@ -536,7 +536,7 @@ namespace IW5
uint16_t baseTriIndex; uint16_t baseTriIndex;
uint16_t baseVertIndex; uint16_t baseVertIndex;
float quantizeScale; float quantizeScale;
r_index16_t(*triIndices)[3]; r_index16_t (*triIndices)[3];
XSurfaceVertexInfo vertInfo; XSurfaceVertexInfo vertInfo;
GfxVertexUnion0 verts0; GfxVertexUnion0 verts0;
unsigned int vertListCount; unsigned int vertListCount;
@ -606,8 +606,8 @@ namespace IW5
unsigned int noScalePartBits[6]; unsigned int noScalePartBits[6];
ScriptString* boneNames; ScriptString* boneNames;
unsigned char* parentList; unsigned char* parentList;
short(*quats)[4]; short (*quats)[4];
float(*trans)[3]; float (*trans)[3];
unsigned char* partClassification; unsigned char* partClassification;
DObjAnimMat* baseMat; DObjAnimMat* baseMat;
Material** materialHandles; Material** materialHandles;
@ -802,13 +802,13 @@ namespace IW5
char source; char source;
char dest; char dest;
}; };
struct MaterialVertexStreamRouting struct MaterialVertexStreamRouting
{ {
MaterialStreamRouting data[13]; MaterialStreamRouting data[13];
void* decl[16]; void* decl[16];
}; };
struct MaterialVertexDeclaration struct MaterialVertexDeclaration
{ {
const char* name; const char* name;
@ -843,7 +843,7 @@ namespace IW5
union MaterialArgumentDef union MaterialArgumentDef
{ {
const float(*literalConst)[4]; const float (*literalConst)[4];
MaterialArgumentCodeConst codeConst; MaterialArgumentCodeConst codeConst;
unsigned int codeSampler; unsigned int codeSampler;
unsigned int nameHash; unsigned int nameHash;
@ -1507,6 +1507,7 @@ namespace IW5
pathnode_t* pParent; pathnode_t* pParent;
float fCost; float fCost;
float fHeuristic; float fHeuristic;
union union
{ {
float nodeCost; float nodeCost;
@ -1659,6 +1660,7 @@ namespace IW5
FxSpatialFrame frame; FxSpatialFrame frame;
float radius; float radius;
}; };
unsigned int nextFree; unsigned int nextFree;
}; };
@ -1817,7 +1819,7 @@ namespace IW5
bool isAncestor; bool isAncestor;
unsigned char recursionDepth; unsigned char recursionDepth;
unsigned char hullPointCount; unsigned char hullPointCount;
float(*hullPoints)[2]; float (*hullPoints)[2];
GfxPortal* queuedParent; GfxPortal* queuedParent;
}; };
@ -2173,7 +2175,7 @@ namespace IW5
unsigned int sortKeyEffectAuto; unsigned int sortKeyEffectAuto;
unsigned int sortKeyDistortion; unsigned int sortKeyDistortion;
GfxWorldDpvsPlanes dpvsPlanes; GfxWorldDpvsPlanes dpvsPlanes;
int/*GfxCellTreeCount*/* aabbTreeCounts; int /*GfxCellTreeCount*/* aabbTreeCounts;
GfxCellTree128* aabbTrees; GfxCellTree128* aabbTrees;
GfxCell* cells; GfxCell* cells;
GfxWorldDraw draw; GfxWorldDraw draw;
@ -2569,8 +2571,8 @@ namespace IW5
WINDOW_FLAG_POPUP = 0x1000000, WINDOW_FLAG_POPUP = 0x1000000,
WINDOW_FLAG_LEGACY_SPLIT_SCREEN_SCALE = 0x4000000, WINDOW_FLAG_LEGACY_SPLIT_SCREEN_SCALE = 0x4000000,
WINDOW_FLAG_HIDDEN_DURING_FLASH_BANG = 0x10000000, // confirmed WINDOW_FLAG_HIDDEN_DURING_FLASH_BANG = 0x10000000, // confirmed
WINDOW_FLAG_HIDDEN_DURING_SCOPE = 0x20000000, // confirmed WINDOW_FLAG_HIDDEN_DURING_SCOPE = 0x20000000, // confirmed
WINDOW_FLAG_HIDDEN_DURING_UI = 0x40000000, // confirmed WINDOW_FLAG_HIDDEN_DURING_UI = 0x40000000, // confirmed
WINDOW_FLAG_TEXT_ONLY_FOCUS = 0x80000000, WINDOW_FLAG_TEXT_ONLY_FOCUS = 0x80000000,
}; };

View File

@ -1,9 +1,9 @@
#include "CommonT5.h" #include "CommonT5.h"
#include <cctype>
#include "Utils/Pack.h" #include "Utils/Pack.h"
#include <cctype>
using namespace T5; using namespace T5;
int Common::Com_HashKey(const char* str, const int maxLen) int Common::Com_HashKey(const char* str, const int maxLen)

View File

@ -18,4 +18,4 @@ namespace T5
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
}; };
} } // namespace T5

View File

@ -1,9 +1,9 @@
#include "GameT5.h" #include "GameT5.h"
#include <algorithm>
#include "T5.h" #include "T5.h"
#include <algorithm>
using namespace T5; using namespace T5;
GameT5 g_GameT5; GameT5 g_GameT5;

View File

@ -14,4 +14,4 @@ public:
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override; std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
}; };
extern GameT5 g_GameT5; extern GameT5 g_GameT5;

View File

@ -1,10 +1,14 @@
#pragma once #pragma once
//#include <d3d9.h> // clang-format off: Order of includes matters here
// #include <d3d9.h>
#include "Image/Texture.h" #include "Image/Texture.h"
#include "T5_Assets.h" #include "T5_Assets.h"
// clang-format on
namespace T5 namespace T5
{ {
struct ScriptStringList struct ScriptStringList
@ -110,4 +114,4 @@ namespace T5
CFT_NUM_FIELD_TYPES CFT_NUM_FIELD_TYPES
}; };
} } // namespace T5

View File

@ -114,43 +114,43 @@ namespace T5
union XAssetHeader union XAssetHeader
{ {
//XModelPieces *xmodelPieces; // Not an asset // XModelPieces *xmodelPieces; // Not an asset
PhysPreset *physPreset; PhysPreset* physPreset;
PhysConstraints *physConstraints; PhysConstraints* physConstraints;
DestructibleDef *destructibleDef; DestructibleDef* destructibleDef;
XAnimParts *parts; XAnimParts* parts;
XModel *model; XModel* model;
Material *material; Material* material;
//MaterialPixelShader *pixelShader; // Not an asset // MaterialPixelShader *pixelShader; // Not an asset
//MaterialVertexShader *vertexShader; // Not an asset // MaterialVertexShader *vertexShader; // Not an asset
MaterialTechniqueSet *techniqueSet; MaterialTechniqueSet* techniqueSet;
GfxImage *image; GfxImage* image;
SndBank *sound; SndBank* sound;
SndPatch *soundPatch; SndPatch* soundPatch;
clipMap_t *clipMap; clipMap_t* clipMap;
ComWorld *comWorld; ComWorld* comWorld;
GameWorldSp *gameWorldSp; GameWorldSp* gameWorldSp;
GameWorldMp *gameWorldMp; GameWorldMp* gameWorldMp;
MapEnts *mapEnts; MapEnts* mapEnts;
GfxWorld *gfxWorld; GfxWorld* gfxWorld;
GfxLightDef *lightDef; GfxLightDef* lightDef;
Font_s *font; Font_s* font;
MenuList *menuList; MenuList* menuList;
menuDef_t *menu; menuDef_t* menu;
LocalizeEntry *localize; LocalizeEntry* localize;
WeaponVariantDef *weapon; WeaponVariantDef* weapon;
SndDriverGlobals *sndDriverGlobals; SndDriverGlobals* sndDriverGlobals;
FxEffectDef *fx; FxEffectDef* fx;
FxImpactTable *impactFx; FxImpactTable* impactFx;
RawFile *rawfile; RawFile* rawfile;
StringTable *stringTable; StringTable* stringTable;
PackIndex *packIndex; PackIndex* packIndex;
XGlobals *xGlobals; XGlobals* xGlobals;
ddlRoot_t *ddlRoot; ddlRoot_t* ddlRoot;
Glasses *glasses; Glasses* glasses;
//TextureList *textureList; // Not an asset // TextureList *textureList; // Not an asset
EmblemSet *emblemSet; EmblemSet* emblemSet;
void *data; void* data;
}; };
typedef tdef_align(16) char char16; typedef tdef_align(16) char char16;
@ -508,12 +508,12 @@ namespace T5
uint16_t triCount; uint16_t triCount;
uint16_t baseTriIndex; uint16_t baseTriIndex;
uint16_t baseVertIndex; uint16_t baseVertIndex;
r_index16_t(*triIndices)[3]; r_index16_t (*triIndices)[3];
XSurfaceVertexInfo vertInfo; XSurfaceVertexInfo vertInfo;
GfxPackedVertex* verts0; GfxPackedVertex* verts0;
void/*IDirect3DVertexBuffer9*/* vb0; void /*IDirect3DVertexBuffer9*/* vb0;
XRigidVertList* vertList; XRigidVertList* vertList;
void/*IDirect3DIndexBuffer9*/* indexBuffer; void /*IDirect3DIndexBuffer9*/* indexBuffer;
int partBits[5]; int partBits[5];
}; };
@ -628,8 +628,8 @@ namespace T5
char lodRampType; char lodRampType;
uint16_t* boneNames; uint16_t* boneNames;
char* parentList; char* parentList;
int16_t(*quats)[4]; int16_t (*quats)[4];
float(*trans)[4]; float (*trans)[4];
char* partClassification; char* partClassification;
DObjAnimMat* baseMat; DObjAnimMat* baseMat;
XSurface* surfs; XSurface* surfs;
@ -837,7 +837,7 @@ namespace T5
struct MaterialVertexStreamRouting struct MaterialVertexStreamRouting
{ {
MaterialStreamRouting data[16]; MaterialStreamRouting data[16];
void/*IDirect3DVertexDeclaration9*/* decl[18]; void /*IDirect3DVertexDeclaration9*/* decl[18];
}; };
struct MaterialVertexDeclaration struct MaterialVertexDeclaration
@ -856,7 +856,7 @@ namespace T5
struct MaterialVertexShaderProgram struct MaterialVertexShaderProgram
{ {
void/*IDirect3DVertexShader9*/* vs; void /*IDirect3DVertexShader9*/* vs;
GfxVertexShaderLoadDef loadDef; GfxVertexShaderLoadDef loadDef;
}; };
@ -874,7 +874,7 @@ namespace T5
struct MaterialPixelShaderProgram struct MaterialPixelShaderProgram
{ {
void/*IDirect3DPixelShader9*/* ps; void /*IDirect3DPixelShader9*/* ps;
GfxPixelShaderLoadDef loadDef; GfxPixelShaderLoadDef loadDef;
}; };
@ -893,7 +893,7 @@ namespace T5
union MaterialArgumentDef union MaterialArgumentDef
{ {
const float(*literalConst)[4]; const float (*literalConst)[4];
MaterialArgumentCodeConst codeConst; MaterialArgumentCodeConst codeConst;
unsigned int codeSampler; unsigned int codeSampler;
unsigned int nameHash; unsigned int nameHash;
@ -1963,7 +1963,7 @@ namespace T5
bool isAncestor; bool isAncestor;
char recursionDepth; char recursionDepth;
char hullPointCount; char hullPointCount;
float(*hullPoints)[2]; float (*hullPoints)[2];
GfxPortal* queuedParent; GfxPortal* queuedParent;
}; };
@ -2040,17 +2040,17 @@ namespace T5
PackedUnitVec normal; PackedUnitVec normal;
PackedUnitVec tangent; PackedUnitVec tangent;
}; };
struct GfxWorldVertexData struct GfxWorldVertexData
{ {
GfxWorldVertex* vertices; GfxWorldVertex* vertices;
void/*IDirect3DVertexBuffer9*/* worldVb; void /*IDirect3DVertexBuffer9*/* worldVb;
}; };
struct GfxWorldVertexLayerData struct GfxWorldVertexLayerData
{ {
char* data; char* data;
void/*IDirect3DVertexBuffer9*/* layerVb; void /*IDirect3DVertexBuffer9*/* layerVb;
}; };
struct GfxWorldDraw struct GfxWorldDraw
@ -3861,15 +3861,16 @@ namespace T5
float fHipViewScatterMax; float fHipViewScatterMax;
float fightDist; float fightDist;
float maxDist; float maxDist;
//const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ... // const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] ->
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case. // accuracyGraphName[1] -> ...
// So might be something to fix but on the other hand it might be too much work for this little inconvenience. // 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.
const char* accuracyGraphName0; const char* accuracyGraphName0;
const char* accuracyGraphName1; const char* accuracyGraphName1;
//vec2_t *accuracyGraphKnots[2]; // vec2_t *accuracyGraphKnots[2];
vec2_t* accuracyGraphKnots0; vec2_t* accuracyGraphKnots0;
vec2_t* accuracyGraphKnots1; vec2_t* accuracyGraphKnots1;
//vec2_t *originalAccuracyGraphKnots[2]; // vec2_t *originalAccuracyGraphKnots[2];
vec2_t* originalAccuracyGraphKnots0; vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1; vec2_t* originalAccuracyGraphKnots1;
int accuracyGraphKnotCount[2]; int accuracyGraphKnotCount[2];

View File

@ -1,9 +1,9 @@
#include "CommonT6.h" #include "CommonT6.h"
#include <cctype>
#include "Utils/Pack.h" #include "Utils/Pack.h"
#include <cctype>
using namespace T6; using namespace T6;
int Common::Com_HashKey(const char* str, const int maxLen) int Common::Com_HashKey(const char* str, const int maxLen)
@ -30,7 +30,7 @@ int Common::Com_HashString(const char* str)
auto result = 0x1505; auto result = 0x1505;
auto offset = 0; auto offset = 0;
while(str[offset]) while (str[offset])
{ {
const auto c = tolower(str[offset++]); const auto c = tolower(str[offset++]);
result = c + 33 * result; result = c + 33 * result;
@ -46,7 +46,7 @@ int Common::Com_HashString(const char* str, const int len)
int result = 0x1505; int result = 0x1505;
int offset = 0; int offset = 0;
while(str[offset]) while (str[offset])
{ {
if (len > 0 && offset >= len) if (len > 0 && offset >= len)
break; break;
@ -70,17 +70,17 @@ uint32_t Common::R_HashString(const char* str, uint32_t hash)
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in) PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
{ {
return PackedTexCoords{ Pack32::Vec2PackTexCoords(in->v) }; return PackedTexCoords{Pack32::Vec2PackTexCoords(in->v)};
} }
PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in) PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
{ {
return PackedUnitVec{ Pack32::Vec3PackUnitVec(in->v) }; return PackedUnitVec{Pack32::Vec3PackUnitVec(in->v)};
} }
GfxColor Common::Vec4PackGfxColor(const vec4_t* in) GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
{ {
return GfxColor{ Pack32::Vec4PackGfxColor(in->v) }; return GfxColor{Pack32::Vec4PackGfxColor(in->v)};
} }
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out) void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)
@ -96,4 +96,4 @@ void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out)
void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out) void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out)
{ {
Pack32::Vec4UnpackGfxColor(in.packed, out->v); Pack32::Vec4UnpackGfxColor(in.packed, out->v);
} }

View File

@ -19,4 +19,4 @@ namespace T6
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
}; };
} } // namespace T6

View File

@ -1,9 +1,9 @@
#include "GameT6.h" #include "GameT6.h"
#include <algorithm>
#include "T6.h" #include "T6.h"
#include <algorithm>
using namespace T6; using namespace T6;
GameT6 g_GameT6; GameT6 g_GameT6;

View File

@ -14,4 +14,4 @@ public:
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override; std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
}; };
extern GameT6 g_GameT6; extern GameT6 g_GameT6;

View File

@ -1,10 +1,14 @@
#pragma once #pragma once
//#include <d3d11.h> // clang-format off: Order of includes matters here
// #include <d3d11.h>
#include "Image/Texture.h" #include "Image/Texture.h"
#include "T6_Assets.h" #include "T6_Assets.h"
// clang-format on
namespace T6 namespace T6
{ {
struct ScriptStringList struct ScriptStringList
@ -149,4 +153,4 @@ namespace T6
AUFT_NUM_FIELD_TYPES, AUFT_NUM_FIELD_TYPES,
}; };
} } // namespace T6

File diff suppressed because it is too large Load Diff

View File

@ -99,12 +99,10 @@ enum D3DFORMAT
// 2.8 biased fixed point // 2.8 biased fixed point
D3DFMT_A2B10G10R10_XR_BIAS = 119, D3DFMT_A2B10G10R10_XR_BIAS = 119,
// Binary format indicating that the data has no inherent type // Binary format indicating that the data has no inherent type
D3DFMT_BINARYBUFFER = 199, D3DFMT_BINARYBUFFER = 199,
/* -- D3D9Ex only */ /* -- D3D9Ex only */
D3DFMT_FORCE_DWORD = 0x7fffffff D3DFMT_FORCE_DWORD = 0x7fffffff
}; };

View File

@ -4,10 +4,7 @@
constexpr uint32_t MakeFourCc(const char ch0, const char ch1, const char ch2, const char ch3) constexpr uint32_t MakeFourCc(const char ch0, const char ch1, const char ch2, const char ch3)
{ {
return static_cast<uint32_t>(ch0) return static_cast<uint32_t>(ch0) | static_cast<uint32_t>(ch1) << 8 | static_cast<uint32_t>(ch2) << 16 | static_cast<uint32_t>(ch3) << 24;
| static_cast<uint32_t>(ch1) << 8
| static_cast<uint32_t>(ch2) << 16
| static_cast<uint32_t>(ch3) << 24;
} }
enum DDP_FLAGS enum DDP_FLAGS

View File

@ -22,126 +22,126 @@ const unsigned int DXGI_FORMAT_DEFINED = 1;
enum DXGI_FORMAT enum DXGI_FORMAT
{ {
DXGI_FORMAT_UNKNOWN = 0x00, DXGI_FORMAT_UNKNOWN = 0x00,
DXGI_FORMAT_R32G32B32A32_TYPELESS = 0x01, DXGI_FORMAT_R32G32B32A32_TYPELESS = 0x01,
DXGI_FORMAT_R32G32B32A32_FLOAT = 0x02, DXGI_FORMAT_R32G32B32A32_FLOAT = 0x02,
DXGI_FORMAT_R32G32B32A32_UINT = 0x03, DXGI_FORMAT_R32G32B32A32_UINT = 0x03,
DXGI_FORMAT_R32G32B32A32_SINT = 0x04, DXGI_FORMAT_R32G32B32A32_SINT = 0x04,
DXGI_FORMAT_R32G32B32_TYPELESS = 0x05, DXGI_FORMAT_R32G32B32_TYPELESS = 0x05,
DXGI_FORMAT_R32G32B32_FLOAT = 0x06, DXGI_FORMAT_R32G32B32_FLOAT = 0x06,
DXGI_FORMAT_R32G32B32_UINT = 0x07, DXGI_FORMAT_R32G32B32_UINT = 0x07,
DXGI_FORMAT_R32G32B32_SINT = 0x08, DXGI_FORMAT_R32G32B32_SINT = 0x08,
DXGI_FORMAT_R16G16B16A16_TYPELESS = 0x09, DXGI_FORMAT_R16G16B16A16_TYPELESS = 0x09,
DXGI_FORMAT_R16G16B16A16_FLOAT = 0x0a, DXGI_FORMAT_R16G16B16A16_FLOAT = 0x0a,
DXGI_FORMAT_R16G16B16A16_UNORM = 0x0b, DXGI_FORMAT_R16G16B16A16_UNORM = 0x0b,
DXGI_FORMAT_R16G16B16A16_UINT = 0x0c, DXGI_FORMAT_R16G16B16A16_UINT = 0x0c,
DXGI_FORMAT_R16G16B16A16_SNORM = 0x0d, DXGI_FORMAT_R16G16B16A16_SNORM = 0x0d,
DXGI_FORMAT_R16G16B16A16_SINT = 0x0e, DXGI_FORMAT_R16G16B16A16_SINT = 0x0e,
DXGI_FORMAT_R32G32_TYPELESS = 0x0f, DXGI_FORMAT_R32G32_TYPELESS = 0x0f,
DXGI_FORMAT_R32G32_FLOAT = 0x10, DXGI_FORMAT_R32G32_FLOAT = 0x10,
DXGI_FORMAT_R32G32_UINT = 0x11, DXGI_FORMAT_R32G32_UINT = 0x11,
DXGI_FORMAT_R32G32_SINT = 0x12, DXGI_FORMAT_R32G32_SINT = 0x12,
DXGI_FORMAT_R32G8X24_TYPELESS = 0x13, DXGI_FORMAT_R32G8X24_TYPELESS = 0x13,
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 0x14, DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 0x14,
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 0x15, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 0x15,
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 0x16, DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 0x16,
DXGI_FORMAT_R10G10B10A2_TYPELESS = 0x17, DXGI_FORMAT_R10G10B10A2_TYPELESS = 0x17,
DXGI_FORMAT_R10G10B10A2_UNORM = 0x18, DXGI_FORMAT_R10G10B10A2_UNORM = 0x18,
DXGI_FORMAT_R10G10B10A2_UINT = 0x19, DXGI_FORMAT_R10G10B10A2_UINT = 0x19,
DXGI_FORMAT_R11G11B10_FLOAT = 0x1a, DXGI_FORMAT_R11G11B10_FLOAT = 0x1a,
DXGI_FORMAT_R8G8B8A8_TYPELESS = 0x1b, DXGI_FORMAT_R8G8B8A8_TYPELESS = 0x1b,
DXGI_FORMAT_R8G8B8A8_UNORM = 0x1c, DXGI_FORMAT_R8G8B8A8_UNORM = 0x1c,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 0x1d, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 0x1d,
DXGI_FORMAT_R8G8B8A8_UINT = 0x1e, DXGI_FORMAT_R8G8B8A8_UINT = 0x1e,
DXGI_FORMAT_R8G8B8A8_SNORM = 0x1f, DXGI_FORMAT_R8G8B8A8_SNORM = 0x1f,
DXGI_FORMAT_R8G8B8A8_SINT = 0x20, DXGI_FORMAT_R8G8B8A8_SINT = 0x20,
DXGI_FORMAT_R16G16_TYPELESS = 0x21, DXGI_FORMAT_R16G16_TYPELESS = 0x21,
DXGI_FORMAT_R16G16_FLOAT = 0x22, DXGI_FORMAT_R16G16_FLOAT = 0x22,
DXGI_FORMAT_R16G16_UNORM = 0x23, DXGI_FORMAT_R16G16_UNORM = 0x23,
DXGI_FORMAT_R16G16_UINT = 0x24, DXGI_FORMAT_R16G16_UINT = 0x24,
DXGI_FORMAT_R16G16_SNORM = 0x25, DXGI_FORMAT_R16G16_SNORM = 0x25,
DXGI_FORMAT_R16G16_SINT = 0x26, DXGI_FORMAT_R16G16_SINT = 0x26,
DXGI_FORMAT_R32_TYPELESS = 0x27, DXGI_FORMAT_R32_TYPELESS = 0x27,
DXGI_FORMAT_D32_FLOAT = 0x28, DXGI_FORMAT_D32_FLOAT = 0x28,
DXGI_FORMAT_R32_FLOAT = 0x29, DXGI_FORMAT_R32_FLOAT = 0x29,
DXGI_FORMAT_R32_UINT = 0x2a, DXGI_FORMAT_R32_UINT = 0x2a,
DXGI_FORMAT_R32_SINT = 0x2b, DXGI_FORMAT_R32_SINT = 0x2b,
DXGI_FORMAT_R24G8_TYPELESS = 0x2c, DXGI_FORMAT_R24G8_TYPELESS = 0x2c,
DXGI_FORMAT_D24_UNORM_S8_UINT = 0x2d, DXGI_FORMAT_D24_UNORM_S8_UINT = 0x2d,
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 0x2e, DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 0x2e,
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 0x2f, DXGI_FORMAT_X24_TYPELESS_G8_UINT = 0x2f,
DXGI_FORMAT_R8G8_TYPELESS = 0x30, DXGI_FORMAT_R8G8_TYPELESS = 0x30,
DXGI_FORMAT_R8G8_UNORM = 0x31, DXGI_FORMAT_R8G8_UNORM = 0x31,
DXGI_FORMAT_R8G8_UINT = 0x32, DXGI_FORMAT_R8G8_UINT = 0x32,
DXGI_FORMAT_R8G8_SNORM = 0x33, DXGI_FORMAT_R8G8_SNORM = 0x33,
DXGI_FORMAT_R8G8_SINT = 0x34, DXGI_FORMAT_R8G8_SINT = 0x34,
DXGI_FORMAT_R16_TYPELESS = 0x35, DXGI_FORMAT_R16_TYPELESS = 0x35,
DXGI_FORMAT_R16_FLOAT = 0x36, DXGI_FORMAT_R16_FLOAT = 0x36,
DXGI_FORMAT_D16_UNORM = 0x37, DXGI_FORMAT_D16_UNORM = 0x37,
DXGI_FORMAT_R16_UNORM = 0x38, DXGI_FORMAT_R16_UNORM = 0x38,
DXGI_FORMAT_R16_UINT = 0x39, DXGI_FORMAT_R16_UINT = 0x39,
DXGI_FORMAT_R16_SNORM = 0x3a, DXGI_FORMAT_R16_SNORM = 0x3a,
DXGI_FORMAT_R16_SINT = 0x3b, DXGI_FORMAT_R16_SINT = 0x3b,
DXGI_FORMAT_R8_TYPELESS = 0x3c, DXGI_FORMAT_R8_TYPELESS = 0x3c,
DXGI_FORMAT_R8_UNORM = 0x3d, DXGI_FORMAT_R8_UNORM = 0x3d,
DXGI_FORMAT_R8_UINT = 0x3e, DXGI_FORMAT_R8_UINT = 0x3e,
DXGI_FORMAT_R8_SNORM = 0x3f, DXGI_FORMAT_R8_SNORM = 0x3f,
DXGI_FORMAT_R8_SINT = 0x40, DXGI_FORMAT_R8_SINT = 0x40,
DXGI_FORMAT_A8_UNORM = 0x41, DXGI_FORMAT_A8_UNORM = 0x41,
DXGI_FORMAT_R1_UNORM = 0x42, DXGI_FORMAT_R1_UNORM = 0x42,
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 0x43, DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 0x43,
DXGI_FORMAT_R8G8_B8G8_UNORM = 0x44, DXGI_FORMAT_R8G8_B8G8_UNORM = 0x44,
DXGI_FORMAT_G8R8_G8B8_UNORM = 0x45, DXGI_FORMAT_G8R8_G8B8_UNORM = 0x45,
DXGI_FORMAT_BC1_TYPELESS = 0x46, DXGI_FORMAT_BC1_TYPELESS = 0x46,
DXGI_FORMAT_BC1_UNORM = 0x47, DXGI_FORMAT_BC1_UNORM = 0x47,
DXGI_FORMAT_BC1_UNORM_SRGB = 0x48, DXGI_FORMAT_BC1_UNORM_SRGB = 0x48,
DXGI_FORMAT_BC2_TYPELESS = 0x49, DXGI_FORMAT_BC2_TYPELESS = 0x49,
DXGI_FORMAT_BC2_UNORM = 0x4a, DXGI_FORMAT_BC2_UNORM = 0x4a,
DXGI_FORMAT_BC2_UNORM_SRGB = 0x4b, DXGI_FORMAT_BC2_UNORM_SRGB = 0x4b,
DXGI_FORMAT_BC3_TYPELESS = 0x4c, DXGI_FORMAT_BC3_TYPELESS = 0x4c,
DXGI_FORMAT_BC3_UNORM = 0x4d, DXGI_FORMAT_BC3_UNORM = 0x4d,
DXGI_FORMAT_BC3_UNORM_SRGB = 0x4e, DXGI_FORMAT_BC3_UNORM_SRGB = 0x4e,
DXGI_FORMAT_BC4_TYPELESS = 0x4f, DXGI_FORMAT_BC4_TYPELESS = 0x4f,
DXGI_FORMAT_BC4_UNORM = 0x50, DXGI_FORMAT_BC4_UNORM = 0x50,
DXGI_FORMAT_BC4_SNORM = 0x51, DXGI_FORMAT_BC4_SNORM = 0x51,
DXGI_FORMAT_BC5_TYPELESS = 0x52, DXGI_FORMAT_BC5_TYPELESS = 0x52,
DXGI_FORMAT_BC5_UNORM = 0x53, DXGI_FORMAT_BC5_UNORM = 0x53,
DXGI_FORMAT_BC5_SNORM = 0x54, DXGI_FORMAT_BC5_SNORM = 0x54,
DXGI_FORMAT_B5G6R5_UNORM = 0x55, DXGI_FORMAT_B5G6R5_UNORM = 0x55,
DXGI_FORMAT_B5G5R5A1_UNORM = 0x56, DXGI_FORMAT_B5G5R5A1_UNORM = 0x56,
DXGI_FORMAT_B8G8R8A8_UNORM = 0x57, DXGI_FORMAT_B8G8R8A8_UNORM = 0x57,
DXGI_FORMAT_B8G8R8X8_UNORM = 0x58, DXGI_FORMAT_B8G8R8X8_UNORM = 0x58,
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 0x59, DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 0x59,
DXGI_FORMAT_B8G8R8A8_TYPELESS = 0x5a, DXGI_FORMAT_B8G8R8A8_TYPELESS = 0x5a,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 0x5b, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 0x5b,
DXGI_FORMAT_B8G8R8X8_TYPELESS = 0x5c, DXGI_FORMAT_B8G8R8X8_TYPELESS = 0x5c,
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 0x5d, DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 0x5d,
DXGI_FORMAT_BC6H_TYPELESS = 0x5e, DXGI_FORMAT_BC6H_TYPELESS = 0x5e,
DXGI_FORMAT_BC6H_UF16 = 0x5f, DXGI_FORMAT_BC6H_UF16 = 0x5f,
DXGI_FORMAT_BC6H_SF16 = 0x60, DXGI_FORMAT_BC6H_SF16 = 0x60,
DXGI_FORMAT_BC7_TYPELESS = 0x61, DXGI_FORMAT_BC7_TYPELESS = 0x61,
DXGI_FORMAT_BC7_UNORM = 0x62, DXGI_FORMAT_BC7_UNORM = 0x62,
DXGI_FORMAT_BC7_UNORM_SRGB = 0x63, DXGI_FORMAT_BC7_UNORM_SRGB = 0x63,
DXGI_FORMAT_AYUV = 0x64, DXGI_FORMAT_AYUV = 0x64,
DXGI_FORMAT_Y410 = 0x65, DXGI_FORMAT_Y410 = 0x65,
DXGI_FORMAT_Y416 = 0x66, DXGI_FORMAT_Y416 = 0x66,
DXGI_FORMAT_NV12 = 0x67, DXGI_FORMAT_NV12 = 0x67,
DXGI_FORMAT_P010 = 0x68, DXGI_FORMAT_P010 = 0x68,
DXGI_FORMAT_P016 = 0x69, DXGI_FORMAT_P016 = 0x69,
DXGI_FORMAT_420_OPAQUE = 0x6a, DXGI_FORMAT_420_OPAQUE = 0x6a,
DXGI_FORMAT_YUY2 = 0x6b, DXGI_FORMAT_YUY2 = 0x6b,
DXGI_FORMAT_Y210 = 0x6c, DXGI_FORMAT_Y210 = 0x6c,
DXGI_FORMAT_Y216 = 0x6d, DXGI_FORMAT_Y216 = 0x6d,
DXGI_FORMAT_NV11 = 0x6e, DXGI_FORMAT_NV11 = 0x6e,
DXGI_FORMAT_AI44 = 0x6f, DXGI_FORMAT_AI44 = 0x6f,
DXGI_FORMAT_IA44 = 0x70, DXGI_FORMAT_IA44 = 0x70,
DXGI_FORMAT_P8 = 0x71, DXGI_FORMAT_P8 = 0x71,
DXGI_FORMAT_A8P8 = 0x72, DXGI_FORMAT_A8P8 = 0x72,
DXGI_FORMAT_B4G4R4A4_UNORM = 0x73, DXGI_FORMAT_B4G4R4A4_UNORM = 0x73,
DXGI_FORMAT_P208 = 0x82, DXGI_FORMAT_P208 = 0x82,
DXGI_FORMAT_V208 = 0x83, DXGI_FORMAT_V208 = 0x83,
DXGI_FORMAT_V408 = 0x84, DXGI_FORMAT_V408 = 0x84,
DXGI_FORMAT_FORCE_UINT = 0xffffffff, DXGI_FORMAT_FORCE_UINT = 0xffffffff,
}; };

View File

@ -22,10 +22,18 @@ DXGI_FORMAT ImageFormat::GetDxgiFormat() const
return m_dxgi_format; return m_dxgi_format;
} }
ImageFormatUnsigned::ImageFormatUnsigned(const ImageFormatId id, const D3DFORMAT d3dFormat, const DXGI_FORMAT dxgiFormat, ImageFormatUnsigned::ImageFormatUnsigned(const ImageFormatId id,
const unsigned bitsPerPixel, const unsigned rOffset, const unsigned rSize, const D3DFORMAT d3dFormat,
const unsigned gOffset, const unsigned gSize, const unsigned bOffset, const DXGI_FORMAT dxgiFormat,
const unsigned bSize, const unsigned aOffset, const unsigned aSize) const unsigned bitsPerPixel,
const unsigned rOffset,
const unsigned rSize,
const unsigned gOffset,
const unsigned gSize,
const unsigned bOffset,
const unsigned bSize,
const unsigned aOffset,
const unsigned aSize)
: ImageFormat(id, d3dFormat, dxgiFormat), : ImageFormat(id, d3dFormat, dxgiFormat),
m_bits_per_pixel(bitsPerPixel), m_bits_per_pixel(bitsPerPixel),
m_r_offset(rOffset), m_r_offset(rOffset),
@ -53,8 +61,7 @@ size_t ImageFormatUnsigned::GetPitch(const unsigned mipLevel, const unsigned wid
return mipWidth * m_bits_per_pixel / 8; return mipWidth * m_bits_per_pixel / 8;
} }
size_t ImageFormatUnsigned::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, const unsigned height, size_t ImageFormatUnsigned::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, const unsigned height, const unsigned depth) const
const unsigned depth) const
{ {
unsigned mipWidth = width >> mipLevel; unsigned mipWidth = width >> mipLevel;
unsigned mipHeight = height >> mipLevel; unsigned mipHeight = height >> mipLevel;
@ -70,8 +77,8 @@ size_t ImageFormatUnsigned::GetSizeOfMipLevel(const unsigned mipLevel, const uns
return mipWidth * mipHeight * mipDepth * m_bits_per_pixel / 8; return mipWidth * mipHeight * mipDepth * m_bits_per_pixel / 8;
} }
ImageFormatBlockCompressed::ImageFormatBlockCompressed(const ImageFormatId id, const D3DFORMAT d3dFormat, const DXGI_FORMAT dxgiFormat, ImageFormatBlockCompressed::ImageFormatBlockCompressed(
const unsigned blockSize, const unsigned bitsPerBlock) const ImageFormatId id, const D3DFORMAT d3dFormat, const DXGI_FORMAT dxgiFormat, const unsigned blockSize, const unsigned bitsPerBlock)
: ImageFormat(id, d3dFormat, dxgiFormat), : ImageFormat(id, d3dFormat, dxgiFormat),
m_block_size(blockSize), m_block_size(blockSize),
m_bits_per_block(bitsPerBlock) m_bits_per_block(bitsPerBlock)
@ -95,8 +102,7 @@ size_t ImageFormatBlockCompressed::GetPitch(const unsigned mipLevel, const unsig
return blockCount * m_bits_per_block / 8; return blockCount * m_bits_per_block / 8;
} }
size_t ImageFormatBlockCompressed::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, size_t ImageFormatBlockCompressed::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, const unsigned height, const unsigned depth) const
const unsigned height, const unsigned depth) const
{ {
unsigned mipWidth = width >> mipLevel; unsigned mipWidth = width >> mipLevel;
unsigned mipHeight = height >> mipLevel; unsigned mipHeight = height >> mipLevel;
@ -109,9 +115,7 @@ size_t ImageFormatBlockCompressed::GetSizeOfMipLevel(const unsigned mipLevel, co
if (mipDepth == 0) if (mipDepth == 0)
mipDepth = 1; mipDepth = 1;
const unsigned blockCount = ((mipWidth + m_block_size - 1) / m_block_size) const unsigned blockCount = ((mipWidth + m_block_size - 1) / m_block_size) * ((mipHeight + m_block_size - 1) / m_block_size) * mipDepth;
* ((mipHeight + m_block_size - 1) / m_block_size)
* mipDepth;
return blockCount * m_bits_per_block / 8; return blockCount * m_bits_per_block / 8;
} }
@ -138,10 +142,13 @@ bool ImageFormatUnsigned::HasA() const
const ImageFormatUnsigned ImageFormat::FORMAT_R8_G8_B8(ImageFormatId::R8_G8_B8, D3DFMT_R8G8B8, DXGI_FORMAT_UNKNOWN, 24, 0, 8, 8, 8, 16, 8, 0, 0); const ImageFormatUnsigned ImageFormat::FORMAT_R8_G8_B8(ImageFormatId::R8_G8_B8, D3DFMT_R8G8B8, DXGI_FORMAT_UNKNOWN, 24, 0, 8, 8, 8, 16, 8, 0, 0);
const ImageFormatUnsigned ImageFormat::FORMAT_B8_G8_R8_X8(ImageFormatId::B8_G8_R8_X8, D3DFMT_X8R8G8B8, DXGI_FORMAT_B8G8R8X8_UNORM, 32, 16, 8, 8, 8, 0, 8, 0, 0); const ImageFormatUnsigned ImageFormat::FORMAT_B8_G8_R8_X8(ImageFormatId::B8_G8_R8_X8, D3DFMT_X8R8G8B8, DXGI_FORMAT_B8G8R8X8_UNORM, 32, 16, 8, 8, 8, 0, 8, 0, 0);
const ImageFormatUnsigned ImageFormat::FORMAT_R8_G8_B8_A8(ImageFormatId::R8_G8_B8_A8, D3DFMT_A8B8G8R8, DXGI_FORMAT_R8G8B8A8_UNORM, 32, 0, 8, 8, 8, 16, 8, 24, 8); const ImageFormatUnsigned
const ImageFormatUnsigned ImageFormat::FORMAT_B8_G8_R8_A8(ImageFormatId::B8_G8_R8_A8, D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM, 32, 16, 8, 8, 8, 0, 8, 24, 8); ImageFormat::FORMAT_R8_G8_B8_A8(ImageFormatId::R8_G8_B8_A8, D3DFMT_A8B8G8R8, DXGI_FORMAT_R8G8B8A8_UNORM, 32, 0, 8, 8, 8, 16, 8, 24, 8);
const ImageFormatUnsigned
ImageFormat::FORMAT_B8_G8_R8_A8(ImageFormatId::B8_G8_R8_A8, D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM, 32, 16, 8, 8, 8, 0, 8, 24, 8);
const ImageFormatUnsigned ImageFormat::FORMAT_A8(ImageFormatId::A8, D3DFMT_A8, DXGI_FORMAT_A8_UNORM, 8, 0, 0, 0, 0, 0, 0, 0, 8); const ImageFormatUnsigned ImageFormat::FORMAT_A8(ImageFormatId::A8, D3DFMT_A8, DXGI_FORMAT_A8_UNORM, 8, 0, 0, 0, 0, 0, 0, 0, 8);
const ImageFormatUnsigned ImageFormat::FORMAT_R16_G16_B16_A16_FLOAT(ImageFormatId::R16_G16_B16_A16_FLOAT, D3DFMT_A16B16G16R16F, DXGI_FORMAT_R16G16B16A16_FLOAT, 128, 0, 0, 0, 0, 0, 0, 0, 8); const ImageFormatUnsigned ImageFormat::FORMAT_R16_G16_B16_A16_FLOAT(
ImageFormatId::R16_G16_B16_A16_FLOAT, D3DFMT_A16B16G16R16F, DXGI_FORMAT_R16G16B16A16_FLOAT, 128, 0, 0, 0, 0, 0, 0, 0, 8);
const ImageFormatUnsigned ImageFormat::FORMAT_R8(ImageFormatId::R8, D3DFMT_L8, DXGI_FORMAT_R8_UNORM, 8, 0, 8, 0, 0, 0, 0, 0, 0); const ImageFormatUnsigned ImageFormat::FORMAT_R8(ImageFormatId::R8, D3DFMT_L8, DXGI_FORMAT_R8_UNORM, 8, 0, 8, 0, 0, 0, 0, 0, 0);
const ImageFormatUnsigned ImageFormat::FORMAT_R8_A8(ImageFormatId::R8_A8, D3DFMT_A8L8, DXGI_FORMAT_UNKNOWN, 16, 0, 8, 0, 0, 0, 0, 8, 8); const ImageFormatUnsigned ImageFormat::FORMAT_R8_A8(ImageFormatId::R8_A8, D3DFMT_A8L8, DXGI_FORMAT_UNKNOWN, 16, 0, 8, 0, 0, 0, 0, 8, 8);
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC1(ImageFormatId::BC1, D3DFMT_DXT1, DXGI_FORMAT_BC1_UNORM, 4, 64); const ImageFormatBlockCompressed ImageFormat::FORMAT_BC1(ImageFormatId::BC1, D3DFMT_DXT1, DXGI_FORMAT_BC1_UNORM, 4, 64);
@ -150,8 +157,7 @@ const ImageFormatBlockCompressed ImageFormat::FORMAT_BC3(ImageFormatId::BC3, D3D
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC4(ImageFormatId::BC4, D3DFMT_UNKNOWN, DXGI_FORMAT_BC4_UNORM, 4, 64); const ImageFormatBlockCompressed ImageFormat::FORMAT_BC4(ImageFormatId::BC4, D3DFMT_UNKNOWN, DXGI_FORMAT_BC4_UNORM, 4, 64);
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC5(ImageFormatId::BC5, D3DFMT_UNKNOWN, DXGI_FORMAT_BC5_UNORM, 4, 128); const ImageFormatBlockCompressed ImageFormat::FORMAT_BC5(ImageFormatId::BC5, D3DFMT_UNKNOWN, DXGI_FORMAT_BC5_UNORM, 4, 128);
const ImageFormat* const ImageFormat::ALL_FORMATS[static_cast<unsigned>(ImageFormatId::MAX)] const ImageFormat* const ImageFormat::ALL_FORMATS[static_cast<unsigned>(ImageFormatId::MAX)]{
{
&FORMAT_R8_G8_B8, &FORMAT_R8_G8_B8,
&FORMAT_B8_G8_R8_X8, &FORMAT_B8_G8_R8_X8,
&FORMAT_R8_G8_B8_A8, &FORMAT_R8_G8_B8_A8,

View File

@ -1,10 +1,11 @@
#pragma once #pragma once
#include <cstdint>
#include <cstddef>
#include "D3DFormat.h" #include "D3DFormat.h"
#include "DxgiFormat.h" #include "DxgiFormat.h"
#include <cstddef>
#include <cstdint>
enum class ImageFormatId enum class ImageFormatId
{ {
UNKNOWN = -1, UNKNOWN = -1,
@ -60,7 +61,7 @@ public:
static const ImageFormatUnsigned FORMAT_R8_G8_B8_A8; static const ImageFormatUnsigned FORMAT_R8_G8_B8_A8;
static const ImageFormatUnsigned FORMAT_B8_G8_R8_A8; static const ImageFormatUnsigned FORMAT_B8_G8_R8_A8;
static const ImageFormatUnsigned FORMAT_A8; static const ImageFormatUnsigned FORMAT_A8;
static const ImageFormatUnsigned FORMAT_R16_G16_B16_A16_FLOAT; //TODO: Float not unsigned static const ImageFormatUnsigned FORMAT_R16_G16_B16_A16_FLOAT; // TODO: Float not unsigned
static const ImageFormatUnsigned FORMAT_R8; static const ImageFormatUnsigned FORMAT_R8;
static const ImageFormatUnsigned FORMAT_R8_A8; static const ImageFormatUnsigned FORMAT_R8_A8;
static const ImageFormatBlockCompressed FORMAT_BC1; static const ImageFormatBlockCompressed FORMAT_BC1;
@ -84,9 +85,18 @@ public:
unsigned m_a_offset; unsigned m_a_offset;
unsigned m_a_size; unsigned m_a_size;
ImageFormatUnsigned(ImageFormatId id, D3DFORMAT d3dFormat, DXGI_FORMAT dxgiFormat, unsigned bitsPerPixel, unsigned rOffset, ImageFormatUnsigned(ImageFormatId id,
unsigned rSize, unsigned gOffset, unsigned gSize, unsigned bOffset, unsigned bSize, D3DFORMAT d3dFormat,
unsigned aOffset, unsigned aSize); DXGI_FORMAT dxgiFormat,
unsigned bitsPerPixel,
unsigned rOffset,
unsigned rSize,
unsigned gOffset,
unsigned gSize,
unsigned bOffset,
unsigned bSize,
unsigned aOffset,
unsigned aSize);
ImageFormatType GetType() const override; ImageFormatType GetType() const override;
size_t GetPitch(unsigned mipLevel, unsigned width) const override; size_t GetPitch(unsigned mipLevel, unsigned width) const override;

View File

@ -54,7 +54,7 @@ namespace iwi6
IMG_FLAG_RENDER_TARGET = 1 << 17, IMG_FLAG_RENDER_TARGET = 1 << 17,
IMG_FLAG_SYSTEMMEM = 1 << 18 IMG_FLAG_SYSTEMMEM = 1 << 18
}; };
} } // namespace iwi6
// IW4 // IW4
namespace iwi8 namespace iwi8
@ -122,7 +122,7 @@ namespace iwi8
IMG_FLAG_RENDER_TARGET = 1 << 25, IMG_FLAG_RENDER_TARGET = 1 << 25,
IMG_FLAG_SYSTEMMEM = 1 << 26 IMG_FLAG_SYSTEMMEM = 1 << 26
}; };
} } // namespace iwi8
// T5 // T5
namespace iwi13 namespace iwi13
@ -177,7 +177,7 @@ namespace iwi13
IMG_FLAG_SYSTEMMEM = 1 << 18, IMG_FLAG_SYSTEMMEM = 1 << 18,
}; };
} } // namespace iwi13
// T6 // T6
namespace iwi27 namespace iwi27
@ -232,4 +232,4 @@ namespace iwi27
IMG_FLAG_MULTISAMPLE = 1 << 18, IMG_FLAG_MULTISAMPLE = 1 << 18,
}; };
} } // namespace iwi27

View File

@ -260,8 +260,7 @@ Texture3D::Texture3D(const ImageFormat* format, const unsigned width, const unsi
{ {
} }
Texture3D::Texture3D(const ImageFormat* format, const unsigned width, const unsigned height, const unsigned depth, Texture3D::Texture3D(const ImageFormat* format, const unsigned width, const unsigned height, const unsigned depth, const bool mipMaps)
const bool mipMaps)
: Texture(format, mipMaps) : Texture(format, mipMaps)
{ {
m_width = width; m_width = width;

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "ImageFormat.h" #include "ImageFormat.h"
#include <cstdint> #include <cstdint>
enum class TextureType enum class TextureType
@ -123,4 +124,4 @@ public:
uint8_t* GetBufferForMipLevel(int mipLevel, int face) override; uint8_t* GetBufferForMipLevel(int mipLevel, int face) override;
int GetMipMapCount() const override; int GetMipMapCount() const override;
}; };

View File

@ -44,8 +44,7 @@ void TextureConverter::SetPixelFunctions(const unsigned inBitCount, const unsign
for (auto pixelOffset = 0u; pixelOffset < bitCount; pixelOffset += 8) for (auto pixelOffset = 0u; pixelOffset < bitCount; pixelOffset += 8)
{ {
result |= (static_cast<uint64_t>(*(static_cast<const uint8_t*>(offset) + (pixelOffset / 8))) << result |= (static_cast<uint64_t>(*(static_cast<const uint8_t*>(offset) + (pixelOffset / 8))) << pixelOffset);
pixelOffset);
} }
return result; return result;
@ -99,9 +98,7 @@ void TextureConverter::SetPixelFunctions(const unsigned inBitCount, const unsign
else else
{ {
assert(false); assert(false);
m_write_pixel_func = [](void* offset, uint64_t pixel, unsigned bitCount) m_write_pixel_func = [](void* offset, uint64_t pixel, unsigned bitCount) {};
{
};
} }
break; break;
} }
@ -120,18 +117,16 @@ void TextureConverter::CreateOutputTexture()
switch (m_input_texture->GetTextureType()) switch (m_input_texture->GetTextureType())
{ {
case TextureType::T_2D: case TextureType::T_2D:
m_output_texture = new Texture2D(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), m_output_texture = new Texture2D(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), m_input_texture->HasMipMaps());
m_input_texture->HasMipMaps());
break; break;
case TextureType::T_CUBE: case TextureType::T_CUBE:
m_output_texture = new TextureCube(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), m_output_texture = new TextureCube(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), m_input_texture->HasMipMaps());
m_input_texture->HasMipMaps());
break; break;
case TextureType::T_3D: case TextureType::T_3D:
m_output_texture = new Texture3D(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), m_output_texture = new Texture3D(
m_input_texture->GetDepth(), m_input_texture->HasMipMaps()); m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), m_input_texture->GetDepth(), m_input_texture->HasMipMaps());
break; break;
default: default:
assert(false); assert(false);
@ -166,8 +161,7 @@ void TextureConverter::ReorderUnsignedToUnsigned() const
const auto outputBytePerPixel = outputFormat->m_bits_per_pixel / 8; const auto outputBytePerPixel = outputFormat->m_bits_per_pixel / 8;
auto outputOffset = 0u; auto outputOffset = 0u;
for (auto inputOffset = 0u; inputOffset < mipLevelSize; inputOffset += inputBytePerPixel, outputOffset += for (auto inputOffset = 0u; inputOffset < mipLevelSize; inputOffset += inputBytePerPixel, outputOffset += outputBytePerPixel)
outputBytePerPixel)
{ {
uint64_t outPixel = 0; uint64_t outPixel = 0;
const auto inPixel = m_read_pixel_func(&inputBuffer[inputOffset], inputFormat->m_bits_per_pixel); const auto inPixel = m_read_pixel_func(&inputBuffer[inputOffset], inputFormat->m_bits_per_pixel);
@ -196,9 +190,7 @@ void TextureConverter::ConvertUnsignedToUnsigned()
SetPixelFunctions(inputFormat->m_bits_per_pixel, outputFormat->m_bits_per_pixel); SetPixelFunctions(inputFormat->m_bits_per_pixel, outputFormat->m_bits_per_pixel);
if (inputFormat->m_r_size == outputFormat->m_r_size if (inputFormat->m_r_size == outputFormat->m_r_size && inputFormat->m_g_size == outputFormat->m_g_size && inputFormat->m_b_size == outputFormat->m_b_size
&& inputFormat->m_g_size == outputFormat->m_g_size
&& inputFormat->m_b_size == outputFormat->m_b_size
&& inputFormat->m_a_size == outputFormat->m_a_size) && inputFormat->m_a_size == outputFormat->m_a_size)
{ {
ReorderUnsignedToUnsigned(); ReorderUnsignedToUnsigned();
@ -214,8 +206,7 @@ Texture* TextureConverter::Convert()
{ {
CreateOutputTexture(); CreateOutputTexture();
if (m_input_format->GetType() == ImageFormatType::UNSIGNED if (m_input_format->GetType() == ImageFormatType::UNSIGNED && m_output_format->GetType() == ImageFormatType::UNSIGNED)
&& m_output_format->GetType() == ImageFormatType::UNSIGNED)
{ {
ConvertUnsignedToUnsigned(); ConvertUnsignedToUnsigned();
} }

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include <functional>
#include "Texture.h" #include "Texture.h"
#include <functional>
class TextureConverter class TextureConverter
{ {
Texture* m_input_texture; Texture* m_input_texture;
@ -23,8 +23,7 @@ class TextureConverter
void ConvertUnsignedToUnsigned(); void ConvertUnsignedToUnsigned();
public: public:
TextureConverter(Texture* inputTexture, const ImageFormat* targetFormat); TextureConverter(Texture* inputTexture, const ImageFormat* targetFormat);
Texture* Convert(); Texture* Convert();
}; };

View File

@ -37,10 +37,12 @@ namespace state_map
for (auto& resultVar : entry.m_result_vars) for (auto& resultVar : entry.m_result_vars)
{ {
const auto correspondingVar = std::find_if(layout.m_var_layout.m_vars.begin(), layout.m_var_layout.m_vars.end(), [&resultVar](const StateMapLayoutVar& var) const auto correspondingVar = std::find_if(layout.m_var_layout.m_vars.begin(),
{ layout.m_var_layout.m_vars.end(),
return var.m_name == resultVar; [&resultVar](const StateMapLayoutVar& var)
}); {
return var.m_name == resultVar;
});
// Has to have a corresponding var // Has to have a corresponding var
assert(correspondingVar != layout.m_var_layout.m_vars.end()); assert(correspondingVar != layout.m_var_layout.m_vars.end());
@ -48,7 +50,7 @@ namespace state_map
} }
} }
#endif #endif
} } // namespace state_map
StateMapLayoutEntry::StateMapLayoutEntry(std::string name, const size_t stateBitsIndex, const size_t stateBitsMask, std::vector<std::string> resultVars) StateMapLayoutEntry::StateMapLayoutEntry(std::string name, const size_t stateBitsIndex, const size_t stateBitsMask, std::vector<std::string> resultVars)
: m_name(std::move(name)), : m_name(std::move(name)),

View File

@ -60,4 +60,4 @@ namespace state_map
const StateMapLayoutEntries& m_entry_layout; const StateMapLayoutEntries& m_entry_layout;
const StateMapLayoutVars& m_var_layout; const StateMapLayoutVars& m_var_layout;
}; };
} } // namespace state_map

View File

@ -10,8 +10,7 @@ float HalfFloat::ToFloat(const half_float_t half)
float f; float f;
} result{}; } result{};
result.u = ((half << 16) & 0x80000000) | (((((half << 14) & 0xFFFC000) result.u = ((half << 16) & 0x80000000) | (((((half << 14) & 0xFFFC000) - (~(half << 14) & 0x10000000)) ^ 0x80000000) >> 1);
- (~(half << 14) & 0x10000000)) ^ 0x80000000) >> 1);
return result.f; return result.f;
} }

View File

@ -11,4 +11,4 @@ class HalfFloat
public: public:
static float ToFloat(half_float_t half); static float ToFloat(half_float_t half);
static half_float_t ToHalf(float f); static half_float_t ToHalf(float f);
}; };

View File

@ -1,10 +1,10 @@
#include "Pack.h" #include "Pack.h"
#include "HalfFloat.h"
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include "HalfFloat.h"
union PackUtil32 union PackUtil32
{ {
uint32_t u; uint32_t u;
@ -16,8 +16,7 @@ union PackUtil32
uint32_t Pack32::Vec2PackTexCoords(const float* in) uint32_t Pack32::Vec2PackTexCoords(const float* in)
{ {
return static_cast<uint32_t>(HalfFloat::ToHalf(in[0])) << 16 return static_cast<uint32_t>(HalfFloat::ToHalf(in[0])) << 16 | HalfFloat::ToHalf(in[1]);
| HalfFloat::ToHalf(in[1]);
} }
uint32_t Pack32::Vec3PackUnitVec(const float* in) uint32_t Pack32::Vec3PackUnitVec(const float* in)
@ -28,10 +27,8 @@ uint32_t Pack32::Vec3PackUnitVec(const float* in)
uint32_t Pack32::Vec4PackGfxColor(const float* in) uint32_t Pack32::Vec4PackGfxColor(const float* in)
{ {
return static_cast<uint8_t>(std::clamp(in[0], 0.0f, 1.0f) * 255.0f) return static_cast<uint8_t>(std::clamp(in[0], 0.0f, 1.0f) * 255.0f) | static_cast<uint8_t>(std::clamp(in[1], 0.0f, 1.0f) * 255.0f) << 8
| static_cast<uint8_t>(std::clamp(in[1], 0.0f, 1.0f) * 255.0f) << 8 | static_cast<uint8_t>(std::clamp(in[2], 0.0f, 1.0f) * 255.0f) << 16 | static_cast<uint8_t>(std::clamp(in[3], 0.0f, 1.0f) * 255.0f) << 24;
| static_cast<uint8_t>(std::clamp(in[2], 0.0f, 1.0f) * 255.0f) << 16
| static_cast<uint8_t>(std::clamp(in[3], 0.0f, 1.0f) * 255.0f) << 24;
} }
void Pack32::Vec2UnpackTexCoordsUV(const uint32_t in, float* out) void Pack32::Vec2UnpackTexCoordsUV(const uint32_t in, float* out)
@ -65,9 +62,9 @@ void Pack32::Vec3UnpackUnitVecScaleBased(const uint32_t in, float* out)
void Pack32::Vec3UnpackUnitVecThirdBased(const uint32_t in, float* out) void Pack32::Vec3UnpackUnitVecThirdBased(const uint32_t in, float* out)
{ {
PackUtil32 v0{ (in >> 0) & 0x3FF }; PackUtil32 v0{(in >> 0) & 0x3FF};
PackUtil32 v1{ (in >> 10) & 0x3FF }; PackUtil32 v1{(in >> 10) & 0x3FF};
PackUtil32 v2{ (in >> 20) & 0x3FF }; PackUtil32 v2{(in >> 20) & 0x3FF};
v0.u = v0.u - 2 * (v0.u & 0x200) + 0x40400000; v0.u = v0.u - 2 * (v0.u & 0x200) + 0x40400000;
v1.u = v1.u - 2 * (v1.u & 0x200) + 0x40400000; v1.u = v1.u - 2 * (v1.u & 0x200) + 0x40400000;

View File

@ -15,4 +15,4 @@ public:
static void Vec3UnpackUnitVecScaleBased(uint32_t in, float* out); static void Vec3UnpackUnitVecScaleBased(uint32_t in, float* out);
static void Vec3UnpackUnitVecThirdBased(uint32_t in, float* out); static void Vec3UnpackUnitVecThirdBased(uint32_t in, float* out);
static void Vec4UnpackGfxColor(uint32_t in, float* out); static void Vec4UnpackGfxColor(uint32_t in, float* out);
}; };

View File

@ -11,4 +11,4 @@ class QuatInt16
public: public:
static quat_int_16 ToInt16(float quat); static quat_int_16 ToInt16(float quat);
static float ToFloat(quat_int_16 quat); static float ToFloat(quat_int_16 quat);
}; };

View File

@ -38,4 +38,4 @@
#define gcc_align(x) __attribute__((__aligned__(x))) #define gcc_align(x) __attribute__((__aligned__(x)))
#endif #endif
#endif #endif
#endif #endif

View File

@ -25,4 +25,4 @@ constexpr uint16_t SCR_STRING_MAX = UINT16_MAX;
typedef int block_t; typedef int block_t;
typedef int asset_type_t; typedef int asset_type_t;
typedef unsigned int zone_priority_t; typedef unsigned int zone_priority_t;

View File

@ -1,8 +1,9 @@
#include "Crypto.h" #include "Crypto.h"
#include "Impl/AlgorithmRSA.h" #include "Impl/AlgorithmRSA.h"
#include "Impl/AlgorithmSHA1.h" #include "Impl/AlgorithmSHA1.h"
#include "Impl/AlgorithmSalsa20.h"
#include "Impl/AlgorithmSHA256.h" #include "Impl/AlgorithmSHA256.h"
#include "Impl/AlgorithmSalsa20.h"
std::unique_ptr<IHashFunction> Crypto::CreateSHA1() std::unique_ptr<IHashFunction> Crypto::CreateSHA1()
{ {
@ -22,4 +23,4 @@ std::unique_ptr<IStreamCipher> Crypto::CreateSalsa20(const uint8_t* keyBytes, co
std::unique_ptr<IPublicKeyAlgorithm> Crypto::CreateRSA(const IPublicKeyAlgorithm::HashingAlgorithm hashingAlgorithm, const RSAPaddingMode paddingMode) std::unique_ptr<IPublicKeyAlgorithm> Crypto::CreateRSA(const IPublicKeyAlgorithm::HashingAlgorithm hashingAlgorithm, const RSAPaddingMode paddingMode)
{ {
return std::make_unique<AlgorithmRSA>(hashingAlgorithm, paddingMode); return std::make_unique<AlgorithmRSA>(hashingAlgorithm, paddingMode);
} }

View File

@ -1,13 +1,12 @@
#pragma once #pragma once
#include "IHashFunction.h"
#include "IPublicKeyAlgorithm.h"
#include "IStreamCipher.h"
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include "IHashFunction.h"
#include "IStreamCipher.h"
#include "IPublicKeyAlgorithm.h"
class Crypto class Crypto
{ {
public: public:

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <cstdint>
#include <cstddef> #include <cstddef>
#include <cstdint>
class IPublicKeyAlgorithm class IPublicKeyAlgorithm
{ {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <cstdint>
#include <cstddef> #include <cstddef>
#include <cstdint>
class IStreamCipher class IStreamCipher
{ {

View File

@ -1,8 +1,9 @@
#include "AlgorithmRSA.h" #include "AlgorithmRSA.h"
#include <cstring>
#include "CryptoLibrary.h" #include "CryptoLibrary.h"
#include <cstring>
class AlgorithmRSA::AlgorithmRSAImpl class AlgorithmRSA::AlgorithmRSAImpl
{ {
rsa_key m_key{}; rsa_key m_key{};
@ -11,7 +12,7 @@ class AlgorithmRSA::AlgorithmRSAImpl
const ltc_hash_descriptor* GetHashDescriptor() const const ltc_hash_descriptor* GetHashDescriptor() const
{ {
switch(m_hash) switch (m_hash)
{ {
case HashingAlgorithm::RSA_HASH_SHA256: case HashingAlgorithm::RSA_HASH_SHA256:
return &sha256_desc; return &sha256_desc;
@ -24,7 +25,7 @@ class AlgorithmRSA::AlgorithmRSAImpl
int GetPaddingMode() const int GetPaddingMode() const
{ {
switch(m_padding) switch (m_padding)
{ {
case Crypto::RSAPaddingMode::RSA_PADDING_PKS1: case Crypto::RSAPaddingMode::RSA_PADDING_PKS1:
return LTC_PKCS_1_V1_5; return LTC_PKCS_1_V1_5;
@ -56,7 +57,7 @@ public:
{ {
return rsa_import(keyData, keySize, &m_key) == CRYPT_OK; return rsa_import(keyData, keySize, &m_key) == CRYPT_OK;
} }
bool Verify(const uint8_t* signedData, const size_t signedDataSize, const uint8_t* signature, const size_t signatureSize) bool Verify(const uint8_t* signedData, const size_t signedDataSize, const uint8_t* signature, const size_t signatureSize)
{ {
const ltc_hash_descriptor* hashDesc = GetHashDescriptor(); const ltc_hash_descriptor* hashDesc = GetHashDescriptor();
@ -115,4 +116,4 @@ bool AlgorithmRSA::SetKey(const uint8_t* keyData, size_t keySize)
bool AlgorithmRSA::Verify(const uint8_t* signedData, const size_t signedDataSize, const uint8_t* signature, const size_t signatureSize) bool AlgorithmRSA::Verify(const uint8_t* signedData, const size_t signedDataSize, const uint8_t* signature, const size_t signatureSize)
{ {
return m_impl->Verify(signedData, signedDataSize, signature, signatureSize); return m_impl->Verify(signedData, signedDataSize, signature, signatureSize);
} }

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "IPublicKeyAlgorithm.h"
#include "Crypto.h" #include "Crypto.h"
#include "IPublicKeyAlgorithm.h"
#include <cstdint> #include <cstdint>
class AlgorithmRSA final : public IPublicKeyAlgorithm class AlgorithmRSA final : public IPublicKeyAlgorithm

View File

@ -1,6 +1,7 @@
#include "AlgorithmSHA1.h" #include "AlgorithmSHA1.h"
#include "CryptoLibrary.h" #include "CryptoLibrary.h"
#include <cstdint> #include <cstdint>
class AlgorithmSHA1::AlgorithmSHA1Impl class AlgorithmSHA1::AlgorithmSHA1Impl
@ -60,4 +61,4 @@ void AlgorithmSHA1::Process(const void* input, const size_t inputSize)
void AlgorithmSHA1::Finish(void* hashBuffer) void AlgorithmSHA1::Finish(void* hashBuffer)
{ {
m_impl->Finish(hashBuffer); m_impl->Finish(hashBuffer);
} }

View File

@ -1,6 +1,7 @@
#include "AlgorithmSHA256.h" #include "AlgorithmSHA256.h"
#include "CryptoLibrary.h" #include "CryptoLibrary.h"
#include <cstdint> #include <cstdint>
class AlgorithmSHA256::Impl class AlgorithmSHA256::Impl
@ -60,4 +61,4 @@ void AlgorithmSHA256::Process(const void* input, const size_t inputSize)
void AlgorithmSHA256::Finish(void* hashBuffer) void AlgorithmSHA256::Finish(void* hashBuffer)
{ {
m_impl->Finish(hashBuffer); m_impl->Finish(hashBuffer);
} }

View File

@ -1,5 +1,7 @@
#include "AlgorithmSalsa20.h" #include "AlgorithmSalsa20.h"
#include "salsa20.h" #include "salsa20.h"
#include <cassert> #include <cassert>
#include <stdexcept> #include <stdexcept>
@ -25,7 +27,7 @@ public:
{ {
assert(ivSize == 8); assert(ivSize == 8);
if(ivSize != 8) if (ivSize != 8)
{ {
throw std::invalid_argument("Salsa20 IV size must be 8"); throw std::invalid_argument("Salsa20 IV size must be 8");
} }

View File

@ -1,4 +1,5 @@
#include "CryptoLibrary.h" #include "CryptoLibrary.h"
#include "tommath.h" #include "tommath.h"
void CryptoLibrary::Init() void CryptoLibrary::Init()
@ -11,4 +12,4 @@ void CryptoLibrary::Init()
ltc_mp = ltm_desc; ltc_mp = ltm_desc;
} }
} }

View File

@ -7,4 +7,4 @@ class CryptoLibrary
{ {
public: public:
static void Init(); static void Init();
}; };

View File

@ -1,11 +1,11 @@
#include "ZoneCreatorIW3.h" #include "ZoneCreatorIW3.h"
#include <iostream>
#include "ObjLoading.h"
#include "AssetLoading/AssetLoadingContext.h" #include "AssetLoading/AssetLoadingContext.h"
#include "Game/IW3/GameIW3.h"
#include "Game/IW3/GameAssetPoolIW3.h" #include "Game/IW3/GameAssetPoolIW3.h"
#include "Game/IW3/GameIW3.h"
#include "ObjLoading.h"
#include <iostream>
using namespace IW3; using namespace IW3;

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h" #include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h" #include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace IW3 namespace IW3
{ {
class ZoneCreator final : public IZoneCreator class ZoneCreator final : public IZoneCreator
@ -22,4 +22,4 @@ namespace IW3
_NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override; _NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
}; };
} } // namespace IW3

View File

@ -1,10 +1,10 @@
#include "ZoneCreatorIW4.h" #include "ZoneCreatorIW4.h"
#include <iostream>
#include "ObjLoading.h"
#include "Game/IW4/GameIW4.h"
#include "Game/IW4/GameAssetPoolIW4.h" #include "Game/IW4/GameAssetPoolIW4.h"
#include "Game/IW4/GameIW4.h"
#include "ObjLoading.h"
#include <iostream>
using namespace IW4; using namespace IW4;

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h" #include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h" #include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace IW4 namespace IW4
{ {
class ZoneCreator final : public IZoneCreator class ZoneCreator final : public IZoneCreator
@ -22,4 +22,4 @@ namespace IW4
_NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override; _NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
}; };
} } // namespace IW4

View File

@ -1,10 +1,10 @@
#include "ZoneCreatorIW5.h" #include "ZoneCreatorIW5.h"
#include <iostream>
#include "ObjLoading.h"
#include "Game/IW5/GameIW5.h"
#include "Game/IW5/GameAssetPoolIW5.h" #include "Game/IW5/GameAssetPoolIW5.h"
#include "Game/IW5/GameIW5.h"
#include "ObjLoading.h"
#include <iostream>
using namespace IW5; using namespace IW5;

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h" #include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h" #include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace IW5 namespace IW5
{ {
class ZoneCreator final : public IZoneCreator class ZoneCreator final : public IZoneCreator
@ -22,4 +22,4 @@ namespace IW5
_NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override; _NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
}; };
} } // namespace IW5

View File

@ -1,11 +1,11 @@
#include "ZoneCreatorT5.h" #include "ZoneCreatorT5.h"
#include <iostream>
#include "ObjLoading.h"
#include "AssetLoading/AssetLoadingContext.h" #include "AssetLoading/AssetLoadingContext.h"
#include "Game/T5/GameT5.h"
#include "Game/T5/GameAssetPoolT5.h" #include "Game/T5/GameAssetPoolT5.h"
#include "Game/T5/GameT5.h"
#include "ObjLoading.h"
#include <iostream>
using namespace T5; using namespace T5;

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h" #include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h" #include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace T5 namespace T5
{ {
class ZoneCreator final : public IZoneCreator class ZoneCreator final : public IZoneCreator
@ -22,4 +22,4 @@ namespace T5
_NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override; _NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
}; };
} } // namespace T5

View File

@ -1,12 +1,12 @@
#include "ZoneCreatorT6.h" #include "ZoneCreatorT6.h"
#include <iostream>
#include "ObjLoading.h"
#include "Game/T6/CommonT6.h" #include "Game/T6/CommonT6.h"
#include "Game/T6/T6.h"
#include "Game/T6/GameT6.h"
#include "Game/T6/GameAssetPoolT6.h" #include "Game/T6/GameAssetPoolT6.h"
#include "Game/T6/GameT6.h"
#include "Game/T6/T6.h"
#include "ObjLoading.h"
#include <iostream>
using namespace T6; using namespace T6;
@ -87,12 +87,7 @@ void ZoneCreator::HandleMetadata(Zone* zone, const ZoneCreationContext& context)
keyHash = Common::Com_HashKey(strValue.c_str(), 64); keyHash = Common::Com_HashKey(strValue.c_str(), 64);
} }
KeyValuePair kvp KeyValuePair kvp{keyHash, Common::Com_HashKey(zone->m_name.c_str(), 64), zone->GetMemory()->Dup(metaData->m_value.c_str())};
{
keyHash,
Common::Com_HashKey(zone->m_name.c_str(), 64),
zone->GetMemory()->Dup(metaData->m_value.c_str())
};
kvpList.push_back(kvp); kvpList.push_back(kvp);
} }
} }

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h" #include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h" #include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace T6 namespace T6
{ {
class ZoneCreator final : public IZoneCreator class ZoneCreator final : public IZoneCreator
@ -23,4 +23,4 @@ namespace T6
_NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override; _NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
}; };
} } // namespace T6

View File

@ -1,45 +1,43 @@
#include "Linker.h" #include "Linker.h"
#include <set>
#include <regex>
#include <filesystem>
#include <fstream>
#include <deque>
#include "Utils/ClassUtils.h"
#include "Utils/Arguments/ArgumentParser.h"
#include "ZoneLoading.h"
#include "ObjWriting.h"
#include "ObjLoading.h"
#include "SearchPath/SearchPaths.h"
#include "ObjContainer/IWD/IWD.h"
#include "LinkerArgs.h"
#include "LinkerSearchPaths.h"
#include "ZoneWriting.h"
#include "Game/IW3/ZoneCreatorIW3.h" #include "Game/IW3/ZoneCreatorIW3.h"
#include "ZoneCreation/ZoneCreationContext.h"
#include "ZoneCreation/IZoneCreator.h"
#include "Game/IW4/ZoneCreatorIW4.h" #include "Game/IW4/ZoneCreatorIW4.h"
#include "Game/IW5/ZoneCreatorIW5.h" #include "Game/IW5/ZoneCreatorIW5.h"
#include "Game/T5/ZoneCreatorT5.h" #include "Game/T5/ZoneCreatorT5.h"
#include "Game/T6/ZoneCreatorT6.h" #include "Game/T6/ZoneCreatorT6.h"
#include "LinkerArgs.h"
#include "LinkerSearchPaths.h"
#include "ObjContainer/IPak/IPakWriter.h" #include "ObjContainer/IPak/IPakWriter.h"
#include "ObjContainer/IWD/IWD.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "SearchPath/SearchPaths.h"
#include "Utils/Arguments/ArgumentParser.h"
#include "Utils/ClassUtils.h"
#include "Utils/ObjFileStream.h" #include "Utils/ObjFileStream.h"
#include "Utils/StringUtils.h" #include "Utils/StringUtils.h"
#include "Zone/AssetList/AssetList.h" #include "Zone/AssetList/AssetList.h"
#include "Zone/AssetList/AssetListStream.h" #include "Zone/AssetList/AssetListStream.h"
#include "Zone/Definition/ZoneDefinitionStream.h" #include "Zone/Definition/ZoneDefinitionStream.h"
#include "ZoneCreation/IZoneCreator.h"
#include "ZoneCreation/ZoneCreationContext.h"
#include "ZoneLoading.h"
#include "ZoneWriting.h"
#include <deque>
#include <filesystem>
#include <fstream>
#include <regex>
#include <set>
namespace fs = std::filesystem; namespace fs = std::filesystem;
const IZoneCreator* const ZONE_CREATORS[] const IZoneCreator* const ZONE_CREATORS[]{
{
new IW3::ZoneCreator(), new IW3::ZoneCreator(),
new IW4::ZoneCreator(), new IW4::ZoneCreator(),
new IW5::ZoneCreator(), new IW5::ZoneCreator(),
new T5::ZoneCreator(), new T5::ZoneCreator(),
new T6::ZoneCreator() new T6::ZoneCreator(),
}; };
enum class ProjectType enum class ProjectType
@ -51,11 +49,10 @@ enum class ProjectType
MAX MAX
}; };
constexpr const char* PROJECT_TYPE_NAMES[static_cast<unsigned>(ProjectType::MAX)] constexpr const char* PROJECT_TYPE_NAMES[static_cast<unsigned>(ProjectType::MAX)]{
{
"none", "none",
"fastfile", "fastfile",
"ipak" "ipak",
}; };
class LinkerImpl final : public Linker class LinkerImpl final : public Linker
@ -294,7 +291,7 @@ class LinkerImpl final : public Linker
if (projectType != parsedProjectType) if (projectType != parsedProjectType)
{ {
std::cerr << "Conflicting types in target \"" << targetName << "\": " << PROJECT_TYPE_NAMES[static_cast<unsigned>(projectType)] std::cerr << "Conflicting types in target \"" << targetName << "\": " << PROJECT_TYPE_NAMES[static_cast<unsigned>(projectType)]
<< " != " << PROJECT_TYPE_NAMES[static_cast<unsigned>(parsedProjectType)] << std::endl; << " != " << PROJECT_TYPE_NAMES[static_cast<unsigned>(parsedProjectType)] << std::endl;
return false; return false;
} }
} }
@ -367,7 +364,10 @@ class LinkerImpl final : public Linker
return true; return true;
} }
std::unique_ptr<Zone> CreateZoneForDefinition(const std::string& targetName, ZoneDefinition& zoneDefinition, ISearchPath* assetSearchPath, ISearchPath* gdtSearchPath, std::unique_ptr<Zone> CreateZoneForDefinition(const std::string& targetName,
ZoneDefinition& zoneDefinition,
ISearchPath* assetSearchPath,
ISearchPath* gdtSearchPath,
ISearchPath* sourceSearchPath) const ISearchPath* sourceSearchPath) const
{ {
const auto context = std::make_unique<ZoneCreationContext>(assetSearchPath, &zoneDefinition); const auto context = std::make_unique<ZoneCreationContext>(assetSearchPath, &zoneDefinition);
@ -412,7 +412,11 @@ class LinkerImpl final : public Linker
return true; return true;
} }
bool BuildFastFile(const std::string& projectName, const std::string& targetName, ZoneDefinition& zoneDefinition, SearchPaths& assetSearchPaths, SearchPaths& gdtSearchPaths, bool BuildFastFile(const std::string& projectName,
const std::string& targetName,
ZoneDefinition& zoneDefinition,
SearchPaths& assetSearchPaths,
SearchPaths& gdtSearchPaths,
SearchPaths& sourceSearchPaths) const SearchPaths& sourceSearchPaths) const
{ {
const auto zone = CreateZoneForDefinition(targetName, zoneDefinition, &assetSearchPaths, &gdtSearchPaths, &sourceSearchPaths); const auto zone = CreateZoneForDefinition(targetName, zoneDefinition, &assetSearchPaths, &gdtSearchPaths, &sourceSearchPaths);
@ -460,17 +464,19 @@ class LinkerImpl final : public Linker
bool BuildReferencedTargets(const std::string& projectName, const std::string& targetName, const ZoneDefinition& zoneDefinition) bool BuildReferencedTargets(const std::string& projectName, const std::string& targetName, const ZoneDefinition& zoneDefinition)
{ {
return std::all_of(zoneDefinition.m_targets_to_build.begin(), zoneDefinition.m_targets_to_build.end(), [this, &projectName, &targetName](const std::string& buildTargetName) return std::all_of(zoneDefinition.m_targets_to_build.begin(),
{ zoneDefinition.m_targets_to_build.end(),
if (buildTargetName == targetName) [this, &projectName, &targetName](const std::string& buildTargetName)
{ {
std::cerr << "Cannot build target with same name: \"" << targetName << "\"\n"; if (buildTargetName == targetName)
return false; {
} std::cerr << "Cannot build target with same name: \"" << targetName << "\"\n";
return false;
}
std::cout << "Building referenced target \"" << buildTargetName << "\"\n"; std::cout << "Building referenced target \"" << buildTargetName << "\"\n";
return BuildProject(projectName, buildTargetName); return BuildProject(projectName, buildTargetName);
}); });
} }
bool BuildProject(const std::string& projectName, const std::string& targetName) bool BuildProject(const std::string& projectName, const std::string& targetName)

View File

@ -1,16 +1,17 @@
#include "LinkerArgs.h" #include "LinkerArgs.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "Utils/Arguments/UsageInformation.h"
#include "Utils/FileUtils.h"
#include <filesystem> #include <filesystem>
#include <regex> #include <regex>
#include <type_traits> #include <type_traits>
#include "Utils/Arguments/UsageInformation.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "Utils/FileUtils.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;
// clang-format off
const CommandLineOption* const OPTION_HELP = const CommandLineOption* const OPTION_HELP =
CommandLineOption::Builder::Create() CommandLineOption::Builder::Create()
.WithShortName("?") .WithShortName("?")
@ -79,11 +80,13 @@ const CommandLineOption* const OPTION_MENU_PERMISSIVE =
const CommandLineOption* const OPTION_MENU_NO_OPTIMIZATION = const CommandLineOption* const OPTION_MENU_NO_OPTIMIZATION =
CommandLineOption::Builder::Create() CommandLineOption::Builder::Create()
.WithLongName("menu-no-optimization") .WithLongName("menu-no-optimization")
.WithDescription("Refrain from applying optimizations to parsed menus. (Optimizations increase menu performance and size. May result in less source information when dumped though.)") .WithDescription("Refrain from applying optimizations to parsed menus. (Optimizations increase menu performance and size. May result in less source "
"information when dumped though.)")
.Build(); .Build();
const CommandLineOption* const COMMAND_LINE_OPTIONS[] // clang-format on
{
const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
OPTION_HELP, OPTION_HELP,
OPTION_VERBOSE, OPTION_VERBOSE,
OPTION_BASE_FOLDER, OPTION_BASE_FOLDER,
@ -93,7 +96,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]
OPTION_SOURCE_SEARCH_PATH, OPTION_SOURCE_SEARCH_PATH,
OPTION_LOAD, OPTION_LOAD,
OPTION_MENU_PERMISSIVE, OPTION_MENU_PERMISSIVE,
OPTION_MENU_NO_OPTIMIZATION OPTION_MENU_NO_OPTIMIZATION,
}; };
LinkerArgs::LinkerArgs() LinkerArgs::LinkerArgs()
@ -182,14 +185,14 @@ std::set<std::string> LinkerArgs::GetSearchPathsForProject(const std::set<std::s
for (const auto& path : set) for (const auto& path : set)
{ {
if (path.find(PATTERN_GAME) == std::string::npos if (path.find(PATTERN_GAME) == std::string::npos && path.find(PATTERN_PROJECT) == std::string::npos
&& path.find(PATTERN_PROJECT) == std::string::npos
&& (!m_base_folder_depends_on_project || path.find(PATTERN_BASE) == std::string::npos)) && (!m_base_folder_depends_on_project || path.find(PATTERN_BASE) == std::string::npos))
{ {
continue; continue;
} }
out.emplace(std::regex_replace(std::regex_replace(std::regex_replace(path, m_project_pattern, projectName), m_game_pattern, gameName), m_base_pattern, basePath)); out.emplace(std::regex_replace(
std::regex_replace(std::regex_replace(path, m_project_pattern, projectName), m_game_pattern, gameName), m_base_pattern, basePath));
} }
return out; return out;

View File

@ -1,12 +1,12 @@
#pragma once #pragma once
#include <vector>
#include <set>
#include <regex>
#include "Utils/ClassUtils.h"
#include "Utils/Arguments/ArgumentParser.h" #include "Utils/Arguments/ArgumentParser.h"
#include "Utils/ClassUtils.h"
#include "Zone/Zone.h" #include "Zone/Zone.h"
#include <regex>
#include <set>
#include <vector>
class LinkerArgs class LinkerArgs
{ {
public: public:
@ -37,12 +37,13 @@ private:
_NODISCARD std::string GetBasePathForProject(const std::string& projectName) const; _NODISCARD std::string GetBasePathForProject(const std::string& projectName) const;
void SetDefaultBasePath(); void SetDefaultBasePath();
_NODISCARD std::set<std::string> GetProjectIndependentSearchPaths(const std::set<std::string>& set) const; _NODISCARD std::set<std::string> GetProjectIndependentSearchPaths(const std::set<std::string>& set) const;
_NODISCARD std::set<std::string> GetSearchPathsForProject(const std::set<std::string>& set, const std::string& gameName, const std::string& projectName) const; _NODISCARD std::set<std::string>
GetSearchPathsForProject(const std::set<std::string>& set, const std::string& gameName, const std::string& projectName) const;
public: public:
std::vector<std::string> m_zones_to_load; std::vector<std::string> m_zones_to_load;
std::vector<std::string> m_project_specifiers_to_build; std::vector<std::string> m_project_specifiers_to_build;
std::string m_base_folder; std::string m_base_folder;
std::string m_out_folder; std::string m_out_folder;
bool m_base_folder_depends_on_project; bool m_base_folder_depends_on_project;
@ -67,7 +68,7 @@ public:
_NODISCARD std::set<std::string> GetProjectIndependentAssetSearchPaths() const; _NODISCARD std::set<std::string> GetProjectIndependentAssetSearchPaths() const;
_NODISCARD std::set<std::string> GetProjectIndependentGdtSearchPaths() const; _NODISCARD std::set<std::string> GetProjectIndependentGdtSearchPaths() const;
_NODISCARD std::set<std::string> GetProjectIndependentSourceSearchPaths() const; _NODISCARD std::set<std::string> GetProjectIndependentSourceSearchPaths() const;
_NODISCARD std::set<std::string> GetAssetSearchPathsForProject(const std::string& gameName, const std::string& projectName) const; _NODISCARD std::set<std::string> GetAssetSearchPathsForProject(const std::string& gameName, const std::string& projectName) const;
_NODISCARD std::set<std::string> GetGdtSearchPathsForProject(const std::string& gameName, const std::string& projectName) const; _NODISCARD std::set<std::string> GetGdtSearchPathsForProject(const std::string& gameName, const std::string& projectName) const;
_NODISCARD std::set<std::string> GetSourceSearchPathsForProject(const std::string& projectName) const; _NODISCARD std::set<std::string> GetSourceSearchPathsForProject(const std::string& projectName) const;

View File

@ -1,12 +1,12 @@
#include "LinkerSearchPaths.h" #include "LinkerSearchPaths.h"
#include "ObjContainer/IWD/IWD.h"
#include "ObjLoading.h"
#include "SearchPath/SearchPathFilesystem.h"
#include <filesystem> #include <filesystem>
#include <iostream> #include <iostream>
#include "ObjLoading.h"
#include "ObjContainer/IWD/IWD.h"
#include "SearchPath/SearchPathFilesystem.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;
LinkerSearchPaths::LinkerSearchPaths(const LinkerArgs& args) LinkerSearchPaths::LinkerSearchPaths(const LinkerArgs& args)
@ -178,7 +178,6 @@ bool LinkerSearchPaths::BuildProjectIndependentSearchPaths()
return true; return true;
} }
void LinkerSearchPaths::UnloadProjectSpecificSearchPaths() void LinkerSearchPaths::UnloadProjectSpecificSearchPaths()
{ {
for (const auto& loadedSearchPath : m_loaded_project_search_paths) for (const auto& loadedSearchPath : m_loaded_project_search_paths)

View File

@ -1,11 +1,10 @@
#pragma once #pragma once
#include "LinkerArgs.h"
#include "SearchPath/SearchPaths.h" #include "SearchPath/SearchPaths.h"
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "LinkerArgs.h"
class LinkerSearchPaths class LinkerSearchPaths
{ {
public: public:

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include <string>
#include "Utils/ClassUtils.h" #include "Utils/ClassUtils.h"
#include "ZoneCreationContext.h"
#include "Zone/Zone.h" #include "Zone/Zone.h"
#include "ZoneCreationContext.h"
#include <string>
class IZoneCreator class IZoneCreator
{ {

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
#include <string>
#include <vector>
#include <memory>
#include "SearchPath/ISearchPath.h"
#include "Obj/Gdt/Gdt.h" #include "Obj/Gdt/Gdt.h"
#include "SearchPath/ISearchPath.h"
#include "Zone/AssetList/AssetList.h" #include "Zone/AssetList/AssetList.h"
#include "Zone/Definition/ZoneDefinition.h" #include "Zone/Definition/ZoneDefinition.h"
#include <memory>
#include <string>
#include <vector>
class ZoneCreationContext class ZoneCreationContext
{ {
public: public:

View File

@ -17,22 +17,22 @@ bool CsvInputStream::NextRow(std::vector<std::string>& out) const
auto c = m_stream.get(); auto c = m_stream.get();
const auto isEof = c == EOF; const auto isEof = c == EOF;
std::ostringstream col; std::ostringstream col;
while(c != EOF) while (c != EOF)
{ {
if(c == CSV_SEPARATOR) if (c == CSV_SEPARATOR)
{ {
out.emplace_back(col.str()); out.emplace_back(col.str());
col.clear(); col.clear();
col.str(std::string()); col.str(std::string());
} }
else if(c == '\r') else if (c == '\r')
{ {
c = m_stream.get(); c = m_stream.get();
if (c == '\n') if (c == '\n')
break; break;
col << '\r'; col << '\r';
} }
else if(c == '\n') else if (c == '\n')
{ {
break; break;
} }
@ -44,7 +44,7 @@ bool CsvInputStream::NextRow(std::vector<std::string>& out) const
c = m_stream.get(); c = m_stream.get();
} }
if(!isEof) if (!isEof)
{ {
out.emplace_back(col.str()); out.emplace_back(col.str());
} }

View File

@ -25,4 +25,4 @@ public:
void WriteColumn(const std::string& value); void WriteColumn(const std::string& value);
void NextRow(); void NextRow();
}; };

View File

@ -1,43 +1,16 @@
#pragma once #pragma once
#include <unordered_map>
#include <type_traits>
#include "Game/IW3/IW3.h" #include "Game/IW3/IW3.h"
#include <type_traits>
#include <unordered_map>
namespace IW3 namespace IW3
{ {
inline const char* surfaceTypeNames[] inline const char* surfaceTypeNames[]{
{ "default", "bark", "brick", "carpet", "cloth", "concrete", "dirt", "flesh", "foliage", "glass",
"default", "grass", "gravel", "ice", "metal", "mud", "paper", "plaster", "rock", "sand", "snow",
"bark", "water", "wood", "asphalt", "ceramic", "plastic", "rubber", "cushion", "fruit", "paintedmetal",
"brick",
"carpet",
"cloth",
"concrete",
"dirt",
"flesh",
"foliage",
"glass",
"grass",
"gravel",
"ice",
"metal",
"mud",
"paper",
"plaster",
"rock",
"sand",
"snow",
"water",
"wood",
"asphalt",
"ceramic",
"plastic",
"rubber",
"cushion",
"fruit",
"paintedmetal"
}; };
static_assert(std::extent_v<decltype(surfaceTypeNames)> == SURF_TYPE_NUM); static_assert(std::extent_v<decltype(surfaceTypeNames)> == SURF_TYPE_NUM);
} } // namespace IW3

View File

@ -1,15 +1,14 @@
#pragma once #pragma once
#include <unordered_map>
#include <type_traits>
#include "Game/IW3/CommonIW3.h" #include "Game/IW3/CommonIW3.h"
#include "Game/IW3/IW3.h" #include "Game/IW3/IW3.h"
#include <type_traits>
#include <unordered_map>
namespace IW3 namespace IW3
{ {
inline const char* techniqueTypeNames[] inline const char* techniqueTypeNames[]{
{
"depth prepass", "depth prepass",
"build floatz", "build floatz",
"build shadowmap depth", "build shadowmap depth",
@ -47,8 +46,7 @@ namespace IW3
}; };
static_assert(std::extent_v<decltype(techniqueTypeNames)> == TECHNIQUE_COUNT); static_assert(std::extent_v<decltype(techniqueTypeNames)> == TECHNIQUE_COUNT);
static const char* materialStreamDestinationNames[] static const char* materialStreamDestinationNames[]{
{
"position", "position",
"normal", "normal",
"color[0]", "color[0]",
@ -64,8 +62,7 @@ namespace IW3
}; };
static_assert(std::extent_v<decltype(materialStreamDestinationNames)> == STREAM_DST_COUNT); static_assert(std::extent_v<decltype(materialStreamDestinationNames)> == STREAM_DST_COUNT);
static const char* materialStreamSourceNames[] static const char* materialStreamSourceNames[]{
{
"position", "position",
"color", "color",
"texcoord[0]", "texcoord[0]",
@ -74,7 +71,7 @@ namespace IW3
"texcoord[1]", "texcoord[1]",
"texcoord[2]", "texcoord[2]",
"normalTransform[0]", "normalTransform[0]",
"normalTransform[1]" "normalTransform[1]",
}; };
static_assert(std::extent_v<decltype(materialStreamSourceNames)> == STREAM_SRC_COUNT); static_assert(std::extent_v<decltype(materialStreamSourceNames)> == STREAM_SRC_COUNT);
@ -83,56 +80,23 @@ namespace IW3
return std::make_pair(Common::R_HashString(name, 0u), name); return std::make_pair(Common::R_HashString(name, 0u), name);
} }
inline std::unordered_map knownMaterialSourceNames inline std::unordered_map knownMaterialSourceNames{
{ KnownMaterialSource("colorMap"), KnownMaterialSource("colorMap0"), KnownMaterialSource("colorMap1"),
KnownMaterialSource("colorMap"), KnownMaterialSource("colorMap2"), KnownMaterialSource("colorMap3"), KnownMaterialSource("colorMap4"),
KnownMaterialSource("colorMap0"), KnownMaterialSource("colorMap5"), KnownMaterialSource("colorMap6"), KnownMaterialSource("colorMap7"),
KnownMaterialSource("colorMap1"), KnownMaterialSource("normalMap"), KnownMaterialSource("normalMap0"), KnownMaterialSource("normalMap1"),
KnownMaterialSource("colorMap2"), KnownMaterialSource("normalMap2"), KnownMaterialSource("normalMap3"), KnownMaterialSource("normalMap4"),
KnownMaterialSource("colorMap3"), KnownMaterialSource("normalMap5"), KnownMaterialSource("normalMap6"), KnownMaterialSource("normalMap7"),
KnownMaterialSource("colorMap4"), KnownMaterialSource("specularMap"), KnownMaterialSource("specularMap0"), KnownMaterialSource("specularMap1"),
KnownMaterialSource("colorMap5"), KnownMaterialSource("specularMap2"), KnownMaterialSource("specularMap3"), KnownMaterialSource("specularMap4"),
KnownMaterialSource("colorMap6"), KnownMaterialSource("specularMap5"), KnownMaterialSource("specularMap6"), KnownMaterialSource("specularMap7"),
KnownMaterialSource("colorMap7"), KnownMaterialSource("detailMap"), KnownMaterialSource("detailMap0"), KnownMaterialSource("detailMap1"),
KnownMaterialSource("normalMap"), KnownMaterialSource("detailMap2"), KnownMaterialSource("detailMap3"), KnownMaterialSource("detailMap4"),
KnownMaterialSource("normalMap0"), KnownMaterialSource("detailMap5"), KnownMaterialSource("detailMap6"), KnownMaterialSource("detailMap7"),
KnownMaterialSource("normalMap1"), KnownMaterialSource("attenuationMap"), KnownMaterialSource("attenuationMap0"), KnownMaterialSource("attenuationMap1"),
KnownMaterialSource("normalMap2"), KnownMaterialSource("attenuationMap2"), KnownMaterialSource("attenuationMap3"), KnownMaterialSource("attenuationMap4"),
KnownMaterialSource("normalMap3"), KnownMaterialSource("attenuationMap5"), KnownMaterialSource("attenuationMap6"), KnownMaterialSource("attenuationMap7"),
KnownMaterialSource("normalMap4"), KnownMaterialSource("distortionScale"), KnownMaterialSource("eyeOffsetParms"), KnownMaterialSource("falloffBeginColor"),
KnownMaterialSource("normalMap5"),
KnownMaterialSource("normalMap6"),
KnownMaterialSource("normalMap7"),
KnownMaterialSource("specularMap"),
KnownMaterialSource("specularMap0"),
KnownMaterialSource("specularMap1"),
KnownMaterialSource("specularMap2"),
KnownMaterialSource("specularMap3"),
KnownMaterialSource("specularMap4"),
KnownMaterialSource("specularMap5"),
KnownMaterialSource("specularMap6"),
KnownMaterialSource("specularMap7"),
KnownMaterialSource("detailMap"),
KnownMaterialSource("detailMap0"),
KnownMaterialSource("detailMap1"),
KnownMaterialSource("detailMap2"),
KnownMaterialSource("detailMap3"),
KnownMaterialSource("detailMap4"),
KnownMaterialSource("detailMap5"),
KnownMaterialSource("detailMap6"),
KnownMaterialSource("detailMap7"),
KnownMaterialSource("attenuationMap"),
KnownMaterialSource("attenuationMap0"),
KnownMaterialSource("attenuationMap1"),
KnownMaterialSource("attenuationMap2"),
KnownMaterialSource("attenuationMap3"),
KnownMaterialSource("attenuationMap4"),
KnownMaterialSource("attenuationMap5"),
KnownMaterialSource("attenuationMap6"),
KnownMaterialSource("attenuationMap7"),
KnownMaterialSource("distortionScale"),
KnownMaterialSource("eyeOffsetParms"),
KnownMaterialSource("falloffBeginColor"),
KnownMaterialSource("falloffEndColor"), KnownMaterialSource("falloffEndColor"),
}; };
} } // namespace IW3

View File

@ -2,16 +2,14 @@
namespace IW4 namespace IW4
{ {
inline const char* szWeapTypeNames[] inline const char* szWeapTypeNames[]{
{
"bullet", "bullet",
"grenade", "grenade",
"projectile", "projectile",
"riotshield", "riotshield",
}; };
inline const char* szWeapClassNames[] inline const char* szWeapClassNames[]{
{
"rifle", "rifle",
"sniper", "sniper",
"mg", "mg",
@ -26,14 +24,12 @@ namespace IW4
"item", "item",
}; };
inline const char* szWeapOverlayReticleNames[] inline const char* szWeapOverlayReticleNames[]{
{
"none", "none",
"crosshair", "crosshair",
}; };
inline const char* szWeapInventoryTypeNames[] inline const char* szWeapInventoryTypeNames[]{
{
"primary", "primary",
"offhand", "offhand",
"item", "item",
@ -42,8 +38,7 @@ namespace IW4
"scavenger", "scavenger",
}; };
inline const char* szWeapFireTypeNames[] inline const char* szWeapFireTypeNames[]{
{
"Full Auto", "Full Auto",
"Single Shot", "Single Shot",
"2-Round Burst", "2-Round Burst",
@ -52,16 +47,14 @@ namespace IW4
"Double Barrel", "Double Barrel",
}; };
inline const char* penetrateTypeNames[] inline const char* penetrateTypeNames[]{
{
"none", "none",
"small", "small",
"medium", "medium",
"large", "large",
}; };
inline const char* impactTypeNames[] inline const char* impactTypeNames[]{
{
"none", "none",
"bullet_small", "bullet_small",
"bullet_large", "bullet_large",
@ -75,15 +68,13 @@ namespace IW4
"projectile_dud", "projectile_dud",
}; };
inline const char* szWeapStanceNames[] inline const char* szWeapStanceNames[]{
{
"stand", "stand",
"duck", "duck",
"prone", "prone",
}; };
inline const char* szProjectileExplosionNames[] inline const char* szProjectileExplosionNames[]{
{
"grenade", "grenade",
"rocket", "rocket",
"flashbang", "flashbang",
@ -93,8 +84,7 @@ namespace IW4
"heavy explosive", "heavy explosive",
}; };
inline const char* offhandClassNames[] inline const char* offhandClassNames[]{
{
"None", "None",
"Frag Grenade", "Frag Grenade",
"Smoke Grenade", "Smoke Grenade",
@ -103,8 +93,7 @@ namespace IW4
"Other", "Other",
}; };
inline const char* playerAnimTypeNames[] inline const char* playerAnimTypeNames[]{
{
"none", "none",
"other", "other",
"pistol", "pistol",
@ -125,23 +114,20 @@ namespace IW4
"throwingknife", "throwingknife",
}; };
inline const char* activeReticleNames[] inline const char* activeReticleNames[]{
{
"None", "None",
"Pip-On-A-Stick", "Pip-On-A-Stick",
"Bouncing diamond", "Bouncing diamond",
}; };
inline const char* guidedMissileNames[] inline const char* guidedMissileNames[]{
{
"None", "None",
"Sidewinder", "Sidewinder",
"Hellfire", "Hellfire",
"Javelin", "Javelin",
}; };
inline const char* stickinessNames[] inline const char* stickinessNames[]{
{
"Don't stick", "Don't stick",
"Stick to all", "Stick to all",
"Stick to all, orient to surface", "Stick to all, orient to surface",
@ -150,15 +136,13 @@ namespace IW4
"Knife", "Knife",
}; };
inline const char* overlayInterfaceNames[] inline const char* overlayInterfaceNames[]{
{
"None", "None",
"Javelin", "Javelin",
"Turret Scope", "Turret Scope",
}; };
inline const char* ammoCounterClipNames[] inline const char* ammoCounterClipNames[]{
{
"None", "None",
"Magazine", "Magazine",
"ShortMagazine", "ShortMagazine",
@ -168,15 +152,13 @@ namespace IW4
"AltWeapon", "AltWeapon",
}; };
inline const char* weapIconRatioNames[] inline const char* weapIconRatioNames[]{
{
"1:1", "1:1",
"2:1", "2:1",
"4:1", "4:1",
}; };
inline const char* s_vehicleClassNames[] inline const char* s_vehicleClassNames[]{
{
"4 wheel", "4 wheel",
"tank", "tank",
"plane", "plane",
@ -186,10 +168,9 @@ namespace IW4
"snowmobile", "snowmobile",
}; };
inline const char* s_vehicleAxleTypeNames[] inline const char* s_vehicleAxleTypeNames[]{
{
"front", "front",
"rear", "rear",
"all", "all",
}; };
} } // namespace IW4

View File

@ -3,18 +3,17 @@
namespace IW4 namespace IW4
{ {
inline cspField_t phys_preset_fields[] inline cspField_t phys_preset_fields[]{
{ {"mass", offsetof(PhysPresetInfo, mass), CSPFT_FLOAT },
{ "mass", offsetof(PhysPresetInfo, mass), CSPFT_FLOAT }, {"bounce", offsetof(PhysPresetInfo, bounce), CSPFT_FLOAT },
{ "bounce", offsetof(PhysPresetInfo, bounce), CSPFT_FLOAT }, {"friction", offsetof(PhysPresetInfo, friction), CSPFT_FLOAT },
{ "friction", offsetof(PhysPresetInfo, friction), CSPFT_FLOAT }, {"isFrictionInfinity", offsetof(PhysPresetInfo, isFrictionInfinity), CSPFT_QBOOLEAN},
{ "isFrictionInfinity", offsetof(PhysPresetInfo, isFrictionInfinity), CSPFT_QBOOLEAN }, {"bulletForceScale", offsetof(PhysPresetInfo, bulletForceScale), CSPFT_FLOAT },
{ "bulletForceScale", offsetof(PhysPresetInfo, bulletForceScale), CSPFT_FLOAT }, {"explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT },
{ "explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT }, {"sndAliasPrefix", offsetof(PhysPresetInfo, sndAliasPrefix), CSPFT_STRING },
{ "sndAliasPrefix", offsetof(PhysPresetInfo, sndAliasPrefix), CSPFT_STRING }, {"piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT },
{ "piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT }, {"piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT },
{ "piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT }, {"tempDefaultToCylinder", offsetof(PhysPresetInfo, tempDefaultToCylinder), CSPFT_QBOOLEAN},
{ "tempDefaultToCylinder", offsetof(PhysPresetInfo, tempDefaultToCylinder), CSPFT_QBOOLEAN }, {"perSurfaceSndAlias", offsetof(PhysPresetInfo, perSurfaceSndAlias), CSPFT_QBOOLEAN},
{ "perSurfaceSndAlias", offsetof(PhysPresetInfo, perSurfaceSndAlias), CSPFT_QBOOLEAN },
}; };
} }

View File

@ -3,34 +3,33 @@
namespace IW4 namespace IW4
{ {
inline cspField_t tracer_fields[] inline cspField_t tracer_fields[]{
{ {"material", offsetof(TracerDef, material), CSPFT_MATERIAL},
{ "material", offsetof(TracerDef, material), CSPFT_MATERIAL }, {"drawInterval", offsetof(TracerDef, drawInterval), CSPFT_INT },
{ "drawInterval", offsetof(TracerDef, drawInterval), CSPFT_INT }, {"speed", offsetof(TracerDef, speed), CSPFT_FLOAT },
{ "speed", offsetof(TracerDef, speed), CSPFT_FLOAT }, {"beamLength", offsetof(TracerDef, beamLength), CSPFT_FLOAT },
{ "beamLength", offsetof(TracerDef, beamLength), CSPFT_FLOAT }, {"beamWidth", offsetof(TracerDef, beamWidth), CSPFT_FLOAT },
{ "beamWidth", offsetof(TracerDef, beamWidth), CSPFT_FLOAT }, {"screwRadius", offsetof(TracerDef, screwRadius), CSPFT_FLOAT },
{ "screwRadius", offsetof(TracerDef, screwRadius), CSPFT_FLOAT }, {"screwDist", offsetof(TracerDef, screwDist), CSPFT_FLOAT },
{ "screwDist", offsetof(TracerDef, screwDist), CSPFT_FLOAT }, {"colorR0", offsetof(TracerDef, colors[0][0]), CSPFT_FLOAT },
{ "colorR0", offsetof(TracerDef, colors[0][0]), CSPFT_FLOAT}, {"colorG0", offsetof(TracerDef, colors[0][1]), CSPFT_FLOAT },
{ "colorG0", offsetof(TracerDef, colors[0][1]), CSPFT_FLOAT }, {"colorB0", offsetof(TracerDef, colors[0][2]), CSPFT_FLOAT },
{ "colorB0", offsetof(TracerDef, colors[0][2]), CSPFT_FLOAT }, {"colorA0", offsetof(TracerDef, colors[0][3]), CSPFT_FLOAT },
{ "colorA0", offsetof(TracerDef, colors[0][3]), CSPFT_FLOAT }, {"colorR1", offsetof(TracerDef, colors[1][0]), CSPFT_FLOAT },
{ "colorR1", offsetof(TracerDef, colors[1][0]), CSPFT_FLOAT }, {"colorG1", offsetof(TracerDef, colors[1][1]), CSPFT_FLOAT },
{ "colorG1", offsetof(TracerDef, colors[1][1]), CSPFT_FLOAT }, {"colorB1", offsetof(TracerDef, colors[1][2]), CSPFT_FLOAT },
{ "colorB1", offsetof(TracerDef, colors[1][2]), CSPFT_FLOAT }, {"colorA1", offsetof(TracerDef, colors[1][3]), CSPFT_FLOAT },
{ "colorA1", offsetof(TracerDef, colors[1][3]), CSPFT_FLOAT }, {"colorR2", offsetof(TracerDef, colors[2][0]), CSPFT_FLOAT },
{ "colorR2", offsetof(TracerDef, colors[2][0]), CSPFT_FLOAT }, {"colorG2", offsetof(TracerDef, colors[2][1]), CSPFT_FLOAT },
{ "colorG2", offsetof(TracerDef, colors[2][1]), CSPFT_FLOAT }, {"colorB2", offsetof(TracerDef, colors[2][2]), CSPFT_FLOAT },
{ "colorB2", offsetof(TracerDef, colors[2][2]), CSPFT_FLOAT }, {"colorA2", offsetof(TracerDef, colors[2][3]), CSPFT_FLOAT },
{ "colorA2", offsetof(TracerDef, colors[2][3]), CSPFT_FLOAT }, {"colorR3", offsetof(TracerDef, colors[3][0]), CSPFT_FLOAT },
{ "colorR3", offsetof(TracerDef, colors[3][0]), CSPFT_FLOAT }, {"colorG3", offsetof(TracerDef, colors[3][1]), CSPFT_FLOAT },
{ "colorG3", offsetof(TracerDef, colors[3][1]), CSPFT_FLOAT }, {"colorB3", offsetof(TracerDef, colors[3][2]), CSPFT_FLOAT },
{ "colorB3", offsetof(TracerDef, colors[3][2]), CSPFT_FLOAT }, {"colorA3", offsetof(TracerDef, colors[3][3]), CSPFT_FLOAT },
{ "colorA3", offsetof(TracerDef, colors[3][3]), CSPFT_FLOAT }, {"colorR4", offsetof(TracerDef, colors[4][0]), CSPFT_FLOAT },
{ "colorR4", offsetof(TracerDef, colors[4][0]), CSPFT_FLOAT }, {"colorG4", offsetof(TracerDef, colors[4][1]), CSPFT_FLOAT },
{ "colorG4", offsetof(TracerDef, colors[4][1]), CSPFT_FLOAT }, {"colorB4", offsetof(TracerDef, colors[4][2]), CSPFT_FLOAT },
{ "colorB4", offsetof(TracerDef, colors[4][2]), CSPFT_FLOAT }, {"colorA4", offsetof(TracerDef, colors[4][3]), CSPFT_FLOAT },
{ "colorA4", offsetof(TracerDef, colors[4][3]), CSPFT_FLOAT },
}; };
} }

View File

@ -3,150 +3,149 @@
namespace IW4 namespace IW4
{ {
inline cspField_t vehicle_fields[] inline cspField_t vehicle_fields[]{
{ {"type", offsetof(VehicleDef, type), VFT_TYPE },
{"type", offsetof(VehicleDef, type), VFT_TYPE}, {"useHintString", offsetof(VehicleDef, useHintString), CSPFT_STRING },
{"useHintString", offsetof(VehicleDef, useHintString), CSPFT_STRING}, {"health", offsetof(VehicleDef, health), CSPFT_INT },
{"health", offsetof(VehicleDef, health), CSPFT_INT}, {"quadBarrel", offsetof(VehicleDef, quadBarrel), CSPFT_QBOOLEAN },
{"quadBarrel", offsetof(VehicleDef, quadBarrel), CSPFT_QBOOLEAN}, {"texureScrollScale", offsetof(VehicleDef, texScrollScale), CSPFT_FLOAT },
{"texureScrollScale", offsetof(VehicleDef, texScrollScale), CSPFT_FLOAT}, {"topSpeed", offsetof(VehicleDef, topSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"topSpeed", offsetof(VehicleDef, topSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"accel", offsetof(VehicleDef, accel), CSPFT_MPH_TO_INCHES_PER_SEC},
{"accel", offsetof(VehicleDef, accel), CSPFT_MPH_TO_INCHES_PER_SEC}, {"rotRate", offsetof(VehicleDef, rotRate), CSPFT_FLOAT },
{"rotRate", offsetof(VehicleDef, rotRate), CSPFT_FLOAT}, {"rotAccel", offsetof(VehicleDef, rotAccel), CSPFT_FLOAT },
{"rotAccel", offsetof(VehicleDef, rotAccel), CSPFT_FLOAT}, {"maxBodyPitch", offsetof(VehicleDef, maxBodyPitch), CSPFT_FLOAT },
{"maxBodyPitch", offsetof(VehicleDef, maxBodyPitch), CSPFT_FLOAT}, {"maxBodyRoll", offsetof(VehicleDef, maxBodyRoll), CSPFT_FLOAT },
{"maxBodyRoll", offsetof(VehicleDef, maxBodyRoll), CSPFT_FLOAT}, {"fakeBodyAccelPitch", offsetof(VehicleDef, fakeBodyAccelPitch), CSPFT_FLOAT },
{"fakeBodyAccelPitch", offsetof(VehicleDef, fakeBodyAccelPitch), CSPFT_FLOAT}, {"fakeBodyAccelRoll", offsetof(VehicleDef, fakeBodyAccelRoll), CSPFT_FLOAT },
{"fakeBodyAccelRoll", offsetof(VehicleDef, fakeBodyAccelRoll), CSPFT_FLOAT}, {"fakeBodyVelPitch", offsetof(VehicleDef, fakeBodyVelPitch), CSPFT_FLOAT },
{"fakeBodyVelPitch", offsetof(VehicleDef, fakeBodyVelPitch), CSPFT_FLOAT}, {"fakeBodyVelRoll", offsetof(VehicleDef, fakeBodyVelRoll), CSPFT_FLOAT },
{"fakeBodyVelRoll", offsetof(VehicleDef, fakeBodyVelRoll), CSPFT_FLOAT}, {"fakeBodySideVelPitch", offsetof(VehicleDef, fakeBodySideVelPitch), CSPFT_FLOAT },
{"fakeBodySideVelPitch", offsetof(VehicleDef, fakeBodySideVelPitch), CSPFT_FLOAT}, {"fakeBodyPitchStrength", offsetof(VehicleDef, fakeBodyPitchStrength), CSPFT_FLOAT },
{"fakeBodyPitchStrength", offsetof(VehicleDef, fakeBodyPitchStrength), CSPFT_FLOAT}, {"fakeBodyRollStrength", offsetof(VehicleDef, fakeBodyRollStrength), CSPFT_FLOAT },
{"fakeBodyRollStrength", offsetof(VehicleDef, fakeBodyRollStrength), CSPFT_FLOAT}, {"fakeBodyPitchDampening", offsetof(VehicleDef, fakeBodyPitchDampening), CSPFT_FLOAT },
{"fakeBodyPitchDampening", offsetof(VehicleDef, fakeBodyPitchDampening), CSPFT_FLOAT}, {"fakeBodyRollDampening", offsetof(VehicleDef, fakeBodyRollDampening), CSPFT_FLOAT },
{"fakeBodyRollDampening", offsetof(VehicleDef, fakeBodyRollDampening), CSPFT_FLOAT}, {"fakeBodyBoatRockingAmplitude", offsetof(VehicleDef, fakeBodyBoatRockingAmplitude), CSPFT_FLOAT },
{"fakeBodyBoatRockingAmplitude", offsetof(VehicleDef, fakeBodyBoatRockingAmplitude), CSPFT_FLOAT}, {"fakeBodyBoatRockingPeriod", offsetof(VehicleDef, fakeBodyBoatRockingPeriod), CSPFT_FLOAT },
{"fakeBodyBoatRockingPeriod", offsetof(VehicleDef, fakeBodyBoatRockingPeriod), CSPFT_FLOAT}, {"fakeBodyBoatRockingRotationPeriod", offsetof(VehicleDef, fakeBodyBoatRockingRotationPeriod), CSPFT_FLOAT },
{"fakeBodyBoatRockingRotationPeriod", offsetof(VehicleDef, fakeBodyBoatRockingRotationPeriod), CSPFT_FLOAT}, {"fakeBodyBoatRockingFadeoutSpeed", offsetof(VehicleDef, fakeBodyBoatRockingFadeoutSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"fakeBodyBoatRockingFadeoutSpeed", offsetof(VehicleDef, fakeBodyBoatRockingFadeoutSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"boatBouncingMinForce", offsetof(VehicleDef, boatBouncingMinForce), CSPFT_MPH_TO_INCHES_PER_SEC},
{"boatBouncingMinForce", offsetof(VehicleDef, boatBouncingMinForce), CSPFT_MPH_TO_INCHES_PER_SEC}, {"boatBouncingMaxForce", offsetof(VehicleDef, boatBouncingMaxForce), CSPFT_MPH_TO_INCHES_PER_SEC},
{"boatBouncingMaxForce", offsetof(VehicleDef, boatBouncingMaxForce), CSPFT_MPH_TO_INCHES_PER_SEC}, {"boatBouncingRate", offsetof(VehicleDef, boatBouncingRate), CSPFT_FLOAT },
{"boatBouncingRate", offsetof(VehicleDef, boatBouncingRate), CSPFT_FLOAT}, {"boatBouncingFadeinSpeed", offsetof(VehicleDef, boatBouncingFadeinSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"boatBouncingFadeinSpeed", offsetof(VehicleDef, boatBouncingFadeinSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"boatBouncingFadeoutSteeringAngle", offsetof(VehicleDef, boatBouncingFadeoutSteeringAngle), CSPFT_FLOAT },
{"boatBouncingFadeoutSteeringAngle", offsetof(VehicleDef, boatBouncingFadeoutSteeringAngle), CSPFT_FLOAT}, {"collisionDamage", offsetof(VehicleDef, collisionDamage), CSPFT_FLOAT },
{"collisionDamage", offsetof(VehicleDef, collisionDamage), CSPFT_FLOAT}, {"collisionSpeed", offsetof(VehicleDef, collisionSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"collisionSpeed", offsetof(VehicleDef, collisionSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"killcamZDist", offsetof(VehicleDef, killcamOffset[0]), CSPFT_FLOAT },
{"killcamZDist", offsetof(VehicleDef, killcamOffset[0]), CSPFT_FLOAT}, {"killcamBackDist", offsetof(VehicleDef, killcamOffset[1]), CSPFT_FLOAT },
{"killcamBackDist", offsetof(VehicleDef, killcamOffset[1]), CSPFT_FLOAT}, {"killcamUpDist", offsetof(VehicleDef, killcamOffset[2]), CSPFT_FLOAT },
{"killcamUpDist", offsetof(VehicleDef, killcamOffset[2]), CSPFT_FLOAT}, {"playerProtected", offsetof(VehicleDef, playerProtected), CSPFT_QBOOLEAN },
{"playerProtected", offsetof(VehicleDef, playerProtected), CSPFT_QBOOLEAN}, {"bulletDamage", offsetof(VehicleDef, bulletDamage), CSPFT_QBOOLEAN },
{"bulletDamage", offsetof(VehicleDef, bulletDamage), CSPFT_QBOOLEAN}, {"armorPiercingDamage", offsetof(VehicleDef, armorPiercingDamage), CSPFT_QBOOLEAN },
{"armorPiercingDamage", offsetof(VehicleDef, armorPiercingDamage), CSPFT_QBOOLEAN}, {"grenadeDamage", offsetof(VehicleDef, grenadeDamage), CSPFT_QBOOLEAN },
{"grenadeDamage", offsetof(VehicleDef, grenadeDamage), CSPFT_QBOOLEAN}, {"projectileDamage", offsetof(VehicleDef, projectileDamage), CSPFT_QBOOLEAN },
{"projectileDamage", offsetof(VehicleDef, projectileDamage), CSPFT_QBOOLEAN}, {"projectileSplashDamage", offsetof(VehicleDef, projectileSplashDamage), CSPFT_QBOOLEAN },
{"projectileSplashDamage", offsetof(VehicleDef, projectileSplashDamage), CSPFT_QBOOLEAN}, {"heavyExplosiveDamage", offsetof(VehicleDef, heavyExplosiveDamage), CSPFT_QBOOLEAN },
{"heavyExplosiveDamage", offsetof(VehicleDef, heavyExplosiveDamage), CSPFT_QBOOLEAN}, {"physicsEnabled", offsetof(VehicleDef, vehPhysDef.physicsEnabled), CSPFT_QBOOLEAN },
{"physicsEnabled", offsetof(VehicleDef, vehPhysDef.physicsEnabled), CSPFT_QBOOLEAN}, {"physicsPreset", offsetof(VehicleDef, vehPhysDef.physPresetName), CSPFT_STRING },
{"physicsPreset", offsetof(VehicleDef, vehPhysDef.physPresetName), CSPFT_STRING}, {"accelerationGraph", offsetof(VehicleDef, vehPhysDef.accelGraphName), CSPFT_STRING },
{"accelerationGraph", offsetof(VehicleDef, vehPhysDef.accelGraphName), CSPFT_STRING}, {"steeringAxle", offsetof(VehicleDef, vehPhysDef.steeringAxle), VFT_AXLE_STEERING },
{"steeringAxle", offsetof(VehicleDef, vehPhysDef.steeringAxle), VFT_AXLE_STEERING}, {"powerAxle", offsetof(VehicleDef, vehPhysDef.powerAxle), VFT_AXLE_POWER },
{"powerAxle", offsetof(VehicleDef, vehPhysDef.powerAxle), VFT_AXLE_POWER}, {"brakingAxle", offsetof(VehicleDef, vehPhysDef.brakingAxle), VFT_AXLE_BRAKING },
{"brakingAxle", offsetof(VehicleDef, vehPhysDef.brakingAxle), VFT_AXLE_BRAKING}, {"reverseSpeed", offsetof(VehicleDef, vehPhysDef.reverseSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"reverseSpeed", offsetof(VehicleDef, vehPhysDef.reverseSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"maxVelocity", offsetof(VehicleDef, vehPhysDef.maxVelocity), CSPFT_MPH_TO_INCHES_PER_SEC},
{"maxVelocity", offsetof(VehicleDef, vehPhysDef.maxVelocity), CSPFT_MPH_TO_INCHES_PER_SEC}, {"maxPitch", offsetof(VehicleDef, vehPhysDef.maxPitch), CSPFT_FLOAT },
{"maxPitch", offsetof(VehicleDef, vehPhysDef.maxPitch), CSPFT_FLOAT}, {"maxRoll", offsetof(VehicleDef, vehPhysDef.maxRoll), CSPFT_FLOAT },
{"maxRoll", offsetof(VehicleDef, vehPhysDef.maxRoll), CSPFT_FLOAT}, {"suspensionTravelRear", offsetof(VehicleDef, vehPhysDef.suspensionTravelRear), CSPFT_FLOAT },
{"suspensionTravelRear", offsetof(VehicleDef, vehPhysDef.suspensionTravelRear), CSPFT_FLOAT}, {"suspensionStrengthFront", offsetof(VehicleDef, vehPhysDef.suspensionStrengthFront), CSPFT_FLOAT },
{"suspensionStrengthFront", offsetof(VehicleDef, vehPhysDef.suspensionStrengthFront), CSPFT_FLOAT}, {"suspensionDampingFront", offsetof(VehicleDef, vehPhysDef.suspensionDampingFront), CSPFT_FLOAT },
{"suspensionDampingFront", offsetof(VehicleDef, vehPhysDef.suspensionDampingFront), CSPFT_FLOAT}, {"suspensionStrengthRear", offsetof(VehicleDef, vehPhysDef.suspensionStrengthRear), CSPFT_FLOAT },
{"suspensionStrengthRear", offsetof(VehicleDef, vehPhysDef.suspensionStrengthRear), CSPFT_FLOAT}, {"suspensionDampingRear", offsetof(VehicleDef, vehPhysDef.suspensionDampingRear), CSPFT_FLOAT },
{"suspensionDampingRear", offsetof(VehicleDef, vehPhysDef.suspensionDampingRear), CSPFT_FLOAT}, {"frictionBraking", offsetof(VehicleDef, vehPhysDef.frictionBraking), CSPFT_FLOAT },
{"frictionBraking", offsetof(VehicleDef, vehPhysDef.frictionBraking), CSPFT_FLOAT}, {"frictionCoasting", offsetof(VehicleDef, vehPhysDef.frictionCoasting), CSPFT_FLOAT },
{"frictionCoasting", offsetof(VehicleDef, vehPhysDef.frictionCoasting), CSPFT_FLOAT}, {"frictionTopSpeed", offsetof(VehicleDef, vehPhysDef.frictionTopSpeed), CSPFT_FLOAT },
{"frictionTopSpeed", offsetof(VehicleDef, vehPhysDef.frictionTopSpeed), CSPFT_FLOAT}, {"frictionSide", offsetof(VehicleDef, vehPhysDef.frictionSide), CSPFT_FLOAT },
{"frictionSide", offsetof(VehicleDef, vehPhysDef.frictionSide), CSPFT_FLOAT}, {"frictionSideRear", offsetof(VehicleDef, vehPhysDef.frictionSideRear), CSPFT_FLOAT },
{"frictionSideRear", offsetof(VehicleDef, vehPhysDef.frictionSideRear), CSPFT_FLOAT}, {"velocityDependentSlip", offsetof(VehicleDef, vehPhysDef.velocityDependentSlip), CSPFT_FLOAT },
{"velocityDependentSlip", offsetof(VehicleDef, vehPhysDef.velocityDependentSlip), CSPFT_FLOAT}, {"rollStability", offsetof(VehicleDef, vehPhysDef.rollStability), CSPFT_FLOAT },
{"rollStability", offsetof(VehicleDef, vehPhysDef.rollStability), CSPFT_FLOAT}, {"rollResistance", offsetof(VehicleDef, vehPhysDef.rollResistance), CSPFT_MPH_TO_INCHES_PER_SEC},
{"rollResistance", offsetof(VehicleDef, vehPhysDef.rollResistance), CSPFT_MPH_TO_INCHES_PER_SEC}, {"pitchResistance", offsetof(VehicleDef, vehPhysDef.pitchResistance), CSPFT_MPH_TO_INCHES_PER_SEC},
{"pitchResistance", offsetof(VehicleDef, vehPhysDef.pitchResistance), CSPFT_MPH_TO_INCHES_PER_SEC}, {"yawResistance", offsetof(VehicleDef, vehPhysDef.yawResistance), CSPFT_MPH_TO_INCHES_PER_SEC},
{"yawResistance", offsetof(VehicleDef, vehPhysDef.yawResistance), CSPFT_MPH_TO_INCHES_PER_SEC}, {"uprightStrengthPitch", offsetof(VehicleDef, vehPhysDef.uprightStrengthPitch), CSPFT_MPH_TO_INCHES_PER_SEC},
{"uprightStrengthPitch", offsetof(VehicleDef, vehPhysDef.uprightStrengthPitch), CSPFT_MPH_TO_INCHES_PER_SEC}, {"uprightStrengthRoll", offsetof(VehicleDef, vehPhysDef.uprightStrengthRoll), CSPFT_MPH_TO_INCHES_PER_SEC},
{"uprightStrengthRoll", offsetof(VehicleDef, vehPhysDef.uprightStrengthRoll), CSPFT_MPH_TO_INCHES_PER_SEC}, {"targetAirPitch", offsetof(VehicleDef, vehPhysDef.targetAirPitch), CSPFT_FLOAT },
{"targetAirPitch", offsetof(VehicleDef, vehPhysDef.targetAirPitch), CSPFT_FLOAT}, {"airYawTorque", offsetof(VehicleDef, vehPhysDef.airYawTorque), CSPFT_MPH_TO_INCHES_PER_SEC},
{"airYawTorque", offsetof(VehicleDef, vehPhysDef.airYawTorque), CSPFT_MPH_TO_INCHES_PER_SEC}, {"airPitchTorque", offsetof(VehicleDef, vehPhysDef.airPitchTorque), CSPFT_MPH_TO_INCHES_PER_SEC},
{"airPitchTorque", offsetof(VehicleDef, vehPhysDef.airPitchTorque), CSPFT_MPH_TO_INCHES_PER_SEC}, {"minimumMomentumForCollision", offsetof(VehicleDef, vehPhysDef.minimumMomentumForCollision), CSPFT_MPH_TO_INCHES_PER_SEC},
{"minimumMomentumForCollision", offsetof(VehicleDef, vehPhysDef.minimumMomentumForCollision), CSPFT_MPH_TO_INCHES_PER_SEC}, {"collisionLaunchForceScale", offsetof(VehicleDef, vehPhysDef.collisionLaunchForceScale), CSPFT_FLOAT },
{"collisionLaunchForceScale", offsetof(VehicleDef, vehPhysDef.collisionLaunchForceScale), CSPFT_FLOAT}, {"wreckedMassScale", offsetof(VehicleDef, vehPhysDef.wreckedMassScale), CSPFT_FLOAT },
{"wreckedMassScale", offsetof(VehicleDef, vehPhysDef.wreckedMassScale), CSPFT_FLOAT}, {"wreckedBodyFriction", offsetof(VehicleDef, vehPhysDef.wreckedBodyFriction), CSPFT_FLOAT },
{"wreckedBodyFriction", offsetof(VehicleDef, vehPhysDef.wreckedBodyFriction), CSPFT_FLOAT}, {"minimumJoltForNotify", offsetof(VehicleDef, vehPhysDef.minimumJoltForNotify), CSPFT_MPH_TO_INCHES_PER_SEC},
{"minimumJoltForNotify", offsetof(VehicleDef, vehPhysDef.minimumJoltForNotify), CSPFT_MPH_TO_INCHES_PER_SEC}, {"slipThresholdFront", offsetof(VehicleDef, vehPhysDef.slipThresholdFront), CSPFT_FLOAT },
{"slipThresholdFront", offsetof(VehicleDef, vehPhysDef.slipThresholdFront), CSPFT_FLOAT}, {"slipThresholdRear", offsetof(VehicleDef, vehPhysDef.slipThresholdRear), CSPFT_FLOAT },
{"slipThresholdRear", offsetof(VehicleDef, vehPhysDef.slipThresholdRear), CSPFT_FLOAT}, {"slipFricScaleFront", offsetof(VehicleDef, vehPhysDef.slipFricScaleFront), CSPFT_FLOAT },
{"slipFricScaleFront", offsetof(VehicleDef, vehPhysDef.slipFricScaleFront), CSPFT_FLOAT}, {"slipFricScaleRear", offsetof(VehicleDef, vehPhysDef.slipFricScaleRear), CSPFT_FLOAT },
{"slipFricScaleRear", offsetof(VehicleDef, vehPhysDef.slipFricScaleRear), CSPFT_FLOAT}, {"slipFricRateFront", offsetof(VehicleDef, vehPhysDef.slipFricRateFront), CSPFT_FLOAT },
{"slipFricRateFront", offsetof(VehicleDef, vehPhysDef.slipFricRateFront), CSPFT_FLOAT}, {"slipFricRateRear", offsetof(VehicleDef, vehPhysDef.slipFricRateRear), CSPFT_FLOAT },
{"slipFricRateRear", offsetof(VehicleDef, vehPhysDef.slipFricRateRear), CSPFT_FLOAT}, {"slipYawTorque", offsetof(VehicleDef, vehPhysDef.slipYawTorque), CSPFT_MPH_TO_INCHES_PER_SEC},
{"slipYawTorque", offsetof(VehicleDef, vehPhysDef.slipYawTorque), CSPFT_MPH_TO_INCHES_PER_SEC}, {"boostDuration", offsetof(VehicleDef, boostDuration), CSPFT_FLOAT },
{"boostDuration", offsetof(VehicleDef, boostDuration), CSPFT_FLOAT}, {"boostRechargeTime", offsetof(VehicleDef, boostRechargeTime), CSPFT_FLOAT },
{"boostRechargeTime", offsetof(VehicleDef, boostRechargeTime), CSPFT_FLOAT}, {"boostAcceleration", offsetof(VehicleDef, boostAcceleration), CSPFT_MPH_TO_INCHES_PER_SEC},
{"boostAcceleration", offsetof(VehicleDef, boostAcceleration), CSPFT_MPH_TO_INCHES_PER_SEC}, {"suspensionTravel", offsetof(VehicleDef, suspensionTravel), CSPFT_FLOAT },
{"suspensionTravel", offsetof(VehicleDef, suspensionTravel), CSPFT_FLOAT}, {"maxSteeringAngle", offsetof(VehicleDef, maxSteeringAngle), CSPFT_FLOAT },
{"maxSteeringAngle", offsetof(VehicleDef, maxSteeringAngle), CSPFT_FLOAT}, {"steeringLerp", offsetof(VehicleDef, steeringLerp), CSPFT_FLOAT },
{"steeringLerp", offsetof(VehicleDef, steeringLerp), CSPFT_FLOAT}, {"minSteeringScale", offsetof(VehicleDef, minSteeringScale), CSPFT_FLOAT },
{"minSteeringScale", offsetof(VehicleDef, minSteeringScale), CSPFT_FLOAT}, {"minSteeringSpeed", offsetof(VehicleDef, minSteeringSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"minSteeringSpeed", offsetof(VehicleDef, minSteeringSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"camLookEnabled", offsetof(VehicleDef, camLookEnabled), CSPFT_QBOOLEAN },
{"camLookEnabled", offsetof(VehicleDef, camLookEnabled), CSPFT_QBOOLEAN}, {"camLerp", offsetof(VehicleDef, camLerp), CSPFT_FLOAT },
{"camLerp", offsetof(VehicleDef, camLerp), CSPFT_FLOAT}, {"camPitchInfluence", offsetof(VehicleDef, camPitchInfluence), CSPFT_FLOAT },
{"camPitchInfluence", offsetof(VehicleDef, camPitchInfluence), CSPFT_FLOAT}, {"camRollInfluence", offsetof(VehicleDef, camRollInfluence), CSPFT_FLOAT },
{"camRollInfluence", offsetof(VehicleDef, camRollInfluence), CSPFT_FLOAT}, {"camFovIncrease", offsetof(VehicleDef, camFovIncrease), CSPFT_FLOAT },
{"camFovIncrease", offsetof(VehicleDef, camFovIncrease), CSPFT_FLOAT}, {"camFovOffset", offsetof(VehicleDef, camFovOffset), CSPFT_FLOAT },
{"camFovOffset", offsetof(VehicleDef, camFovOffset), CSPFT_FLOAT}, {"camFovSpeed", offsetof(VehicleDef, camFovSpeed), CSPFT_FLOAT },
{"camFovSpeed", offsetof(VehicleDef, camFovSpeed), CSPFT_FLOAT}, {"turretWeaponName", offsetof(VehicleDef, turretWeaponName), CSPFT_STRING },
{"turretWeaponName", offsetof(VehicleDef, turretWeaponName), CSPFT_STRING}, {"turretHorizSpanLeft", offsetof(VehicleDef, turretHorizSpanLeft), CSPFT_FLOAT },
{"turretHorizSpanLeft", offsetof(VehicleDef, turretHorizSpanLeft), CSPFT_FLOAT}, {"turretHorizSpanRight", offsetof(VehicleDef, turretHorizSpanRight), CSPFT_FLOAT },
{"turretHorizSpanRight", offsetof(VehicleDef, turretHorizSpanRight), CSPFT_FLOAT}, {"turretVertSpanUp", offsetof(VehicleDef, turretVertSpanUp), CSPFT_FLOAT },
{"turretVertSpanUp", offsetof(VehicleDef, turretVertSpanUp), CSPFT_FLOAT}, {"turretVertSpanDown", offsetof(VehicleDef, turretVertSpanDown), CSPFT_FLOAT },
{"turretVertSpanDown", offsetof(VehicleDef, turretVertSpanDown), CSPFT_FLOAT}, {"turretRotRate", offsetof(VehicleDef, turretRotRate), CSPFT_FLOAT },
{"turretRotRate", offsetof(VehicleDef, turretRotRate), CSPFT_FLOAT}, {"turretSpinSnd", offsetof(VehicleDef, turretSpinSnd), CSPFT_SOUND },
{"turretSpinSnd", offsetof(VehicleDef, turretSpinSnd), CSPFT_SOUND}, {"turretStopSnd", offsetof(VehicleDef, turretStopSnd), CSPFT_SOUND },
{"turretStopSnd", offsetof(VehicleDef, turretStopSnd), CSPFT_SOUND}, {"trophyEnabled", offsetof(VehicleDef, trophyEnabled), CSPFT_QBOOLEAN },
{"trophyEnabled", offsetof(VehicleDef, trophyEnabled), CSPFT_QBOOLEAN}, {"trophyRadius", offsetof(VehicleDef, trophyRadius), CSPFT_FLOAT },
{"trophyRadius", offsetof(VehicleDef, trophyRadius), CSPFT_FLOAT}, {"trophyInactiveRadius", offsetof(VehicleDef, trophyInactiveRadius), CSPFT_FLOAT },
{"trophyInactiveRadius", offsetof(VehicleDef, trophyInactiveRadius), CSPFT_FLOAT}, {"trophyAmmoCount", offsetof(VehicleDef, trophyAmmoCount), CSPFT_INT },
{"trophyAmmoCount", offsetof(VehicleDef, trophyAmmoCount), CSPFT_INT}, {"trophyReloadTime", offsetof(VehicleDef, trophyReloadTime), CSPFT_FLOAT },
{"trophyReloadTime", offsetof(VehicleDef, trophyReloadTime), CSPFT_FLOAT}, {"trophyTags", offsetof(VehicleDef, trophyTags), VFT_TROPHY_TAGS },
{"trophyTags", offsetof(VehicleDef, trophyTags), VFT_TROPHY_TAGS}, {"compassFriendlyIcon", offsetof(VehicleDef, compassFriendlyIcon), CSPFT_MATERIAL },
{"compassFriendlyIcon", offsetof(VehicleDef, compassFriendlyIcon), CSPFT_MATERIAL}, {"compassEnemyIcon", offsetof(VehicleDef, compassEnemyIcon), CSPFT_MATERIAL },
{"compassEnemyIcon", offsetof(VehicleDef, compassEnemyIcon), CSPFT_MATERIAL}, {"compassIconWidth", offsetof(VehicleDef, compassIconWidth), CSPFT_INT },
{"compassIconWidth", offsetof(VehicleDef, compassIconWidth), CSPFT_INT}, {"compassIconHeight", offsetof(VehicleDef, compassIconHeight), CSPFT_INT },
{"compassIconHeight", offsetof(VehicleDef, compassIconHeight), CSPFT_INT}, {"lowIdleSnd", offsetof(VehicleDef, idleLowSnd), CSPFT_SOUND },
{"lowIdleSnd", offsetof(VehicleDef, idleLowSnd), CSPFT_SOUND}, {"highIdleSnd", offsetof(VehicleDef, idleHighSnd), CSPFT_SOUND },
{"highIdleSnd", offsetof(VehicleDef, idleHighSnd), CSPFT_SOUND}, {"lowEngineSnd", offsetof(VehicleDef, engineLowSnd), CSPFT_SOUND },
{"lowEngineSnd", offsetof(VehicleDef, engineLowSnd), CSPFT_SOUND}, {"highEngineSnd", offsetof(VehicleDef, engineHighSnd), CSPFT_SOUND },
{"highEngineSnd", offsetof(VehicleDef, engineHighSnd), CSPFT_SOUND}, {"engineSndSpeed", offsetof(VehicleDef, engineSndSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"engineSndSpeed", offsetof(VehicleDef, engineSndSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"engineStartUpSnd", offsetof(VehicleDef, engineStartUpSnd), CSPFT_SOUND },
{"engineStartUpSnd", offsetof(VehicleDef, engineStartUpSnd), CSPFT_SOUND}, {"engineStartUpLength", offsetof(VehicleDef, engineStartUpLength), CSPFT_MILLISECONDS },
{"engineStartUpLength", offsetof(VehicleDef, engineStartUpLength), CSPFT_MILLISECONDS}, {"engineShutdownSnd", offsetof(VehicleDef, engineShutdownSnd), CSPFT_SOUND },
{"engineShutdownSnd", offsetof(VehicleDef, engineShutdownSnd), CSPFT_SOUND}, {"engineIdleSnd", offsetof(VehicleDef, engineIdleSnd), CSPFT_SOUND },
{"engineIdleSnd", offsetof(VehicleDef, engineIdleSnd), CSPFT_SOUND}, {"engineSustainSnd", offsetof(VehicleDef, engineSustainSnd), CSPFT_SOUND },
{"engineSustainSnd", offsetof(VehicleDef, engineSustainSnd), CSPFT_SOUND}, {"engineRampUpSnd", offsetof(VehicleDef, engineRampUpSnd), CSPFT_SOUND },
{"engineRampUpSnd", offsetof(VehicleDef, engineRampUpSnd), CSPFT_SOUND}, {"engineRampUpLength", offsetof(VehicleDef, engineRampUpLength), CSPFT_MILLISECONDS },
{"engineRampUpLength", offsetof(VehicleDef, engineRampUpLength), CSPFT_MILLISECONDS}, {"engineRampDownSnd", offsetof(VehicleDef, engineRampDownSnd), CSPFT_SOUND },
{"engineRampDownSnd", offsetof(VehicleDef, engineRampDownSnd), CSPFT_SOUND}, {"engineRampDownLength", offsetof(VehicleDef, engineRampDownLength), CSPFT_MILLISECONDS },
{"engineRampDownLength", offsetof(VehicleDef, engineRampDownLength), CSPFT_MILLISECONDS}, {"suspensionSoftSnd", offsetof(VehicleDef, suspensionSoftSnd), CSPFT_SOUND },
{"suspensionSoftSnd", offsetof(VehicleDef, suspensionSoftSnd), CSPFT_SOUND}, {"suspensionSoftCompression", offsetof(VehicleDef, suspensionSoftCompression), CSPFT_FLOAT },
{"suspensionSoftCompression", offsetof(VehicleDef, suspensionSoftCompression), CSPFT_FLOAT}, {"suspensionHardSnd", offsetof(VehicleDef, suspensionHardSnd), CSPFT_SOUND },
{"suspensionHardSnd", offsetof(VehicleDef, suspensionHardSnd), CSPFT_SOUND}, {"suspensionHardCompression", offsetof(VehicleDef, suspensionHardCompression), CSPFT_FLOAT },
{"suspensionHardCompression", offsetof(VehicleDef, suspensionHardCompression), CSPFT_FLOAT}, {"collisionSnd", offsetof(VehicleDef, collisionSnd), CSPFT_SOUND },
{"collisionSnd", offsetof(VehicleDef, collisionSnd), CSPFT_SOUND}, {"collisionBlendSpeed", offsetof(VehicleDef, collisionBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"collisionBlendSpeed", offsetof(VehicleDef, collisionBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"speedSnd", offsetof(VehicleDef, speedSnd), CSPFT_SOUND },
{"speedSnd", offsetof(VehicleDef, speedSnd), CSPFT_SOUND}, {"speedSndBlendSpeed", offsetof(VehicleDef, speedSndBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"speedSndBlendSpeed", offsetof(VehicleDef, speedSndBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"surfaceSndPrefix", offsetof(VehicleDef, surfaceSndPrefix), CSPFT_STRING },
{"surfaceSndPrefix", offsetof(VehicleDef, surfaceSndPrefix), CSPFT_STRING}, {"surfaceSndBlendSpeed", offsetof(VehicleDef, surfaceSndBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"surfaceSndBlendSpeed", offsetof(VehicleDef, surfaceSndBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"slideVolume", offsetof(VehicleDef, slideVolume), CSPFT_FLOAT },
{"slideVolume", offsetof(VehicleDef, slideVolume), CSPFT_FLOAT}, {"slideBlendSpeed", offsetof(VehicleDef, slideBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC},
{"slideBlendSpeed", offsetof(VehicleDef, slideBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, {"inAirPitch", offsetof(VehicleDef, inAirPitch), CSPFT_FLOAT },
{"inAirPitch", offsetof(VehicleDef, inAirPitch), CSPFT_FLOAT},
}; };
} }

File diff suppressed because it is too large Load Diff

View File

@ -4,112 +4,81 @@
namespace IW4 namespace IW4
{ {
inline infoParm_t infoParms[] inline infoParm_t infoParms[]{
{ {"bark", 0x0, 0x100000, 0x0, 0x0 },
{"bark", 0x0, 0x100000, 0x0, 0x0}, {"brick", 0x0, 0x200000, 0x0, 0x0 },
{"brick", 0x0, 0x200000, 0x0, 0x0}, {"carpet", 0x0, 0x300000, 0x0, 0x0 },
{"carpet", 0x0, 0x300000, 0x0, 0x0}, {"cloth", 0x0, 0x400000, 0x0, 0x0 },
{"cloth", 0x0, 0x400000, 0x0, 0x0}, {"concrete", 0x0, 0x500000, 0x0, 0x0 },
{"concrete", 0x0, 0x500000, 0x0, 0x0}, {"dirt", 0x0, 0x600000, 0x0, 0x0 },
{"dirt", 0x0, 0x600000, 0x0, 0x0}, {"flesh", 0x0, 0x700000, 0x0, 0x0 },
{"flesh", 0x0, 0x700000, 0x0, 0x0}, {"foliage", 0x1, 0x800000, 0x2, 0x0 },
{"foliage", 0x1, 0x800000, 0x2, 0x0}, {"glass", 0x1, 0x900000, 0x10, 0x0 },
{"glass", 0x1, 0x900000, 0x10, 0x0}, {"grass", 0x0, 0xa00000, 0x0, 0x0 },
{"grass", 0x0, 0xa00000, 0x0, 0x0}, {"gravel", 0x0, 0xb00000, 0x0, 0x0 },
{"gravel", 0x0, 0xb00000, 0x0, 0x0}, {"ice", 0x0, 0xc00000, 0x0, 0x0 },
{"ice", 0x0, 0xc00000, 0x0, 0x0}, {"metal", 0x0, 0xd00000, 0x0, 0x0 },
{"metal", 0x0, 0xd00000, 0x0, 0x0}, {"mud", 0x0, 0xe00000, 0x0, 0x0 },
{"mud", 0x0, 0xe00000, 0x0, 0x0}, {"paper", 0x0, 0xf00000, 0x0, 0x0 },
{"paper", 0x0, 0xf00000, 0x0, 0x0}, {"plaster", 0x0, 0x1000000, 0x0, 0x0 },
{"plaster", 0x0, 0x1000000, 0x0, 0x0}, {"rock", 0x0, 0x1100000, 0x0, 0x0 },
{"rock", 0x0, 0x1100000, 0x0, 0x0}, {"sand", 0x0, 0x1200000, 0x0, 0x0 },
{"sand", 0x0, 0x1200000, 0x0, 0x0}, {"snow", 0x0, 0x1300000, 0x0, 0x0 },
{"snow", 0x0, 0x1300000, 0x0, 0x0}, {"water", 0x1, 0x1400000, 0x20, 0x0 },
{"water", 0x1, 0x1400000, 0x20, 0x0}, {"wood", 0x0, 0x1500000, 0x0, 0x0 },
{"wood", 0x0, 0x1500000, 0x0, 0x0}, {"asphalt", 0x0, 0x1600000, 0x0, 0x0 },
{"asphalt", 0x0, 0x1600000, 0x0, 0x0}, {"ceramic", 0x0, 0x1700000, 0x0, 0x0 },
{"ceramic", 0x0, 0x1700000, 0x0, 0x0}, {"plastic", 0x0, 0x1800000, 0x0, 0x0 },
{"plastic", 0x0, 0x1800000, 0x0, 0x0}, {"rubber", 0x0, 0x1900000, 0x0, 0x0 },
{"rubber", 0x0, 0x1900000, 0x0, 0x0}, {"cushion", 0x0, 0x1a00000, 0x0, 0x0 },
{"cushion", 0x0, 0x1a00000, 0x0, 0x0}, {"fruit", 0x0, 0x1b00000, 0x0, 0x0 },
{"fruit", 0x0, 0x1b00000, 0x0, 0x0}, {"paintedmetal", 0x0, 0x1c00000, 0x0, 0x0 },
{"paintedmetal", 0x0, 0x1c00000, 0x0, 0x0}, {"riotshield", 0x0, 0x1d00000, 0x0, 0x0 },
{"riotshield", 0x0, 0x1d00000, 0x0, 0x0}, {"slush", 0x0, 0x1e00000, 0x0, 0x0 },
{"slush", 0x0, 0x1e00000, 0x0, 0x0}, {"opaqueglass", 0x0, 0x900000, 0x0, 0x0 },
{"opaqueglass", 0x0, 0x900000, 0x0, 0x0}, {"clipmissile", 0x1, 0x0, 0x80, 0x0 },
{"clipmissile", 0x1, 0x0, 0x80, 0x0}, {"ai_nosight", 0x1, 0x0, 0x1000, 0x0 },
{"ai_nosight", 0x1, 0x0, 0x1000, 0x0}, {"clipshot", 0x1, 0x0, 0x2000, 0x0 },
{"clipshot", 0x1, 0x0, 0x2000, 0x0}, {"playerclip", 0x1, 0x0, 0x10000, 0x0 },
{"playerclip", 0x1, 0x0, 0x10000, 0x0}, {"monsterclip", 0x1, 0x0, 0x20000, 0x0 },
{"monsterclip", 0x1, 0x0, 0x20000, 0x0}, {"aiclipallowdeath", 0x1, 0x0, 0x4, 0x0 },
{"aiclipallowdeath", 0x1, 0x0, 0x4, 0x0}, {"vehicleclip", 0x1, 0x0, 0x200, 0x0 },
{"vehicleclip", 0x1, 0x0, 0x200, 0x0}, {"itemclip", 0x1, 0x0, 0x400, 0x0 },
{"itemclip", 0x1, 0x0, 0x400, 0x0}, {"nodrop", 0x1, 0x0, 0x80000000, 0x0 },
{"nodrop", 0x1, 0x0, 0x80000000, 0x0}, {"nonsolid", 0x1, 0x4000, 0x0, 0x0 },
{"nonsolid", 0x1, 0x4000, 0x0, 0x0}, {"detail", 0x0, 0x0, 0x8000000, 0x0 },
{"detail", 0x0, 0x0, 0x8000000, 0x0}, {"structural", 0x0, 0x0, 0x10000000, 0x0 },
{"structural", 0x0, 0x0, 0x10000000, 0x0}, {"portal", 0x1, 0x80000000, 0x0, 0x0 },
{"portal", 0x1, 0x80000000, 0x0, 0x0}, {"canshootclip", 0x0, 0x0, 0x40, 0x0 },
{"canshootclip", 0x0, 0x0, 0x40, 0x0}, {"origin", 0x1, 0x0, 0x0, 0x4 },
{"origin", 0x1, 0x0, 0x0, 0x4}, {"sky", 0x0, 0x4, 0x800, 0x0 },
{"sky", 0x0, 0x4, 0x800, 0x0}, {"nocastshadow", 0x0, 0x40000, 0x0, 0x0 },
{"nocastshadow", 0x0, 0x40000, 0x0, 0x0}, {"physicsGeom", 0x0, 0x0, 0x0, 0x400 },
{"physicsGeom", 0x0, 0x0, 0x0, 0x400}, {"lightPortal", 0x0, 0x0, 0x0, 0x2000},
{"lightPortal", 0x0, 0x0, 0x0, 0x2000}, {"outdoorBounds", 0x0, 0x0, 0x0, 0x8000},
{"outdoorBounds", 0x0, 0x0, 0x0, 0x8000}, {"slick", 0x0, 0x2, 0x0, 0x0 },
{"slick", 0x0, 0x2, 0x0, 0x0}, {"noimpact", 0x0, 0x10, 0x0, 0x0 },
{"noimpact", 0x0, 0x10, 0x0, 0x0}, {"nomarks", 0x0, 0x20, 0x0, 0x0 },
{"nomarks", 0x0, 0x20, 0x0, 0x0}, {"nopenetrate", 0x0, 0x100, 0x0, 0x0 },
{"nopenetrate", 0x0, 0x100, 0x0, 0x0}, {"ladder", 0x0, 0x8, 0x0, 0x0 },
{"ladder", 0x0, 0x8, 0x0, 0x0}, {"nodamage", 0x0, 0x1, 0x0, 0x0 },
{"nodamage", 0x0, 0x1, 0x0, 0x0}, {"mantleOn", 0x0, 0x2000000, 0x1000000, 0x0 },
{"mantleOn", 0x0, 0x2000000, 0x1000000, 0x0}, {"mantleOver", 0x0, 0x4000000, 0x1000000, 0x0 },
{"mantleOver", 0x0, 0x4000000, 0x1000000, 0x0}, {"stairs", 0x0, 0x200, 0x0, 0x0 },
{"stairs", 0x0, 0x200, 0x0, 0x0}, {"soft", 0x0, 0x1000, 0x0, 0x0 },
{"soft", 0x0, 0x1000, 0x0, 0x0}, {"nosteps", 0x0, 0x2000, 0x0, 0x0 },
{"nosteps", 0x0, 0x2000, 0x0, 0x0}, {"nodraw", 0x0, 0x80, 0x0, 0x0 },
{"nodraw", 0x0, 0x80, 0x0, 0x0}, {"nolightmap", 0x0, 0x400, 0x0, 0x0 },
{"nolightmap", 0x0, 0x400, 0x0, 0x0}, {"nodlight", 0x0, 0x20000, 0x0, 0x0 },
{"nodlight", 0x0, 0x20000, 0x0, 0x0}
}; };
inline const char* surfaceTypeNames[] inline const char* surfaceTypeNames[]{
{ "default", "bark", "brick", "carpet", "cloth", "concrete", "dirt", "flesh", "foliage", "glass", "grass",
"default", "gravel", "ice", "metal", "mud", "paper", "plaster", "rock", "sand", "snow", "water", "wood",
"bark", "asphalt", "ceramic", "plastic", "rubber", "cushion", "fruit", "paintedmetal", "riotshield", "slush",
"brick",
"carpet",
"cloth",
"concrete",
"dirt",
"flesh",
"foliage",
"glass",
"grass",
"gravel",
"ice",
"metal",
"mud",
"paper",
"plaster",
"rock",
"sand",
"snow",
"water",
"wood",
"asphalt",
"ceramic",
"plastic",
"rubber",
"cushion",
"fruit",
"paintedmetal",
"riotshield",
"slush"
}; };
static_assert(std::extent_v<decltype(surfaceTypeNames)> == SURF_TYPE_NUM); static_assert(std::extent_v<decltype(surfaceTypeNames)> == SURF_TYPE_NUM);
enum class BlendFunc_e enum class BlendFunc_e
{ {
UNKNOWN, UNKNOWN,
@ -131,15 +100,14 @@ namespace IW4
constexpr auto GDT_BLEND_FUNC_MULTIPLY = "Multiply"; constexpr auto GDT_BLEND_FUNC_MULTIPLY = "Multiply";
constexpr auto GDT_BLEND_FUNC_SCREEN_ADD = "Screen Add"; constexpr auto GDT_BLEND_FUNC_SCREEN_ADD = "Screen Add";
inline const char* GdtBlendFuncNames[] inline const char* GdtBlendFuncNames[]{
{
GDT_BLEND_FUNC_UNKNOWN, GDT_BLEND_FUNC_UNKNOWN,
GDT_BLEND_FUNC_CUSTOM, GDT_BLEND_FUNC_CUSTOM,
GDT_BLEND_FUNC_REPLACE, GDT_BLEND_FUNC_REPLACE,
GDT_BLEND_FUNC_BLEND, GDT_BLEND_FUNC_BLEND,
GDT_BLEND_FUNC_ADD, GDT_BLEND_FUNC_ADD,
GDT_BLEND_FUNC_MULTIPLY, GDT_BLEND_FUNC_MULTIPLY,
GDT_BLEND_FUNC_SCREEN_ADD GDT_BLEND_FUNC_SCREEN_ADD,
}; };
static_assert(std::extent_v<decltype(GdtBlendFuncNames)> == static_cast<size_t>(BlendFunc_e::COUNT)); static_assert(std::extent_v<decltype(GdtBlendFuncNames)> == static_cast<size_t>(BlendFunc_e::COUNT));
@ -164,15 +132,14 @@ namespace IW4
constexpr auto GDT_BLEND_OP_MIN = "Min"; constexpr auto GDT_BLEND_OP_MIN = "Min";
constexpr auto GDT_BLEND_OP_MAX = "Max"; constexpr auto GDT_BLEND_OP_MAX = "Max";
inline const char* GdtBlendOpNames[] inline const char* GdtBlendOpNames[]{
{
GDT_BLEND_OP_UNKNOWN, GDT_BLEND_OP_UNKNOWN,
GDT_BLEND_OP_DISABLE, GDT_BLEND_OP_DISABLE,
GDT_BLEND_OP_ADD, GDT_BLEND_OP_ADD,
GDT_BLEND_OP_SUBTRACT, GDT_BLEND_OP_SUBTRACT,
GDT_BLEND_OP_REV_SUBTRACT, GDT_BLEND_OP_REV_SUBTRACT,
GDT_BLEND_OP_MIN, GDT_BLEND_OP_MIN,
GDT_BLEND_OP_MAX GDT_BLEND_OP_MAX,
}; };
static_assert(std::extent_v<decltype(GdtBlendOpNames)> == static_cast<size_t>(BlendOp_e::COUNT)); static_assert(std::extent_v<decltype(GdtBlendOpNames)> == static_cast<size_t>(BlendOp_e::COUNT));
@ -194,8 +161,7 @@ namespace IW4
COUNT COUNT
}; };
inline const char* GdtCustomBlendFuncNames[] inline const char* GdtCustomBlendFuncNames[]{
{
"", "",
"Disable", "Disable",
"Zero", "Zero",
@ -207,7 +173,7 @@ namespace IW4
"DestAlpha", "DestAlpha",
"InvDestAlpha", "InvDestAlpha",
"DestColor", "DestColor",
"InvDestColor" "InvDestColor",
}; };
static_assert(std::extent_v<decltype(GdtCustomBlendFuncNames)> == static_cast<size_t>(CustomBlendFunc_e::COUNT)); static_assert(std::extent_v<decltype(GdtCustomBlendFuncNames)> == static_cast<size_t>(CustomBlendFunc_e::COUNT));
@ -228,13 +194,12 @@ namespace IW4
constexpr auto GDT_ALPHA_TEST_LT128 = "LT128"; constexpr auto GDT_ALPHA_TEST_LT128 = "LT128";
constexpr auto GDT_ALPHA_TEST_GE128 = "GE128"; constexpr auto GDT_ALPHA_TEST_GE128 = "GE128";
inline const char* GdtAlphaTestNames[] inline const char* GdtAlphaTestNames[]{
{
GDT_ALPHA_TEST_UNKNOWN, GDT_ALPHA_TEST_UNKNOWN,
GDT_ALPHA_TEST_ALWAYS, GDT_ALPHA_TEST_ALWAYS,
GDT_ALPHA_TEST_GT0, GDT_ALPHA_TEST_GT0,
GDT_ALPHA_TEST_LT128, GDT_ALPHA_TEST_LT128,
GDT_ALPHA_TEST_GE128 GDT_ALPHA_TEST_GE128,
}; };
static_assert(std::extent_v<decltype(GdtAlphaTestNames)> == static_cast<size_t>(AlphaTest_e::COUNT)); static_assert(std::extent_v<decltype(GdtAlphaTestNames)> == static_cast<size_t>(AlphaTest_e::COUNT));
@ -250,14 +215,13 @@ namespace IW4
COUNT COUNT
}; };
inline const char* GdtDepthTestNames[] inline const char* GdtDepthTestNames[]{
{
"", "",
"LessEqual*", "LessEqual*",
"Less", "Less",
"Equal", "Equal",
"Always", "Always",
"Disable" "Disable",
}; };
static_assert(std::extent_v<decltype(GdtDepthTestNames)> == static_cast<size_t>(DepthTest_e::COUNT)); static_assert(std::extent_v<decltype(GdtDepthTestNames)> == static_cast<size_t>(DepthTest_e::COUNT));
@ -270,19 +234,17 @@ namespace IW4
COUNT COUNT
}; };
inline const char* GdtStateBitsEnabledStatusNames[] inline const char* GdtStateBitsEnabledStatusNames[]{
{
"", "",
"Enable", "Enable",
"Disable" "Disable",
}; };
static_assert(std::extent_v<decltype(GdtStateBitsEnabledStatusNames)> == static_cast<size_t>(StateBitsEnabledStatus_e::COUNT)); static_assert(std::extent_v<decltype(GdtStateBitsEnabledStatusNames)> == static_cast<size_t>(StateBitsEnabledStatus_e::COUNT));
inline const char* GdtStateBitsOnOffStatusNames[] inline const char* GdtStateBitsOnOffStatusNames[]{
{
"", "",
"On", "On",
"Off" "Off",
}; };
static_assert(std::extent_v<decltype(GdtStateBitsOnOffStatusNames)> == static_cast<size_t>(StateBitsEnabledStatus_e::COUNT)); static_assert(std::extent_v<decltype(GdtStateBitsOnOffStatusNames)> == static_cast<size_t>(StateBitsEnabledStatus_e::COUNT));
@ -296,12 +258,11 @@ namespace IW4
COUNT COUNT
}; };
inline const char* GdtCullFaceNames[] inline const char* GdtCullFaceNames[]{
{
"", "",
"None", "None",
"Back*", "Back*",
"Front" "Front",
}; };
static_assert(std::extent_v<decltype(GdtCullFaceNames)> == static_cast<size_t>(CullFace_e::COUNT)); static_assert(std::extent_v<decltype(GdtCullFaceNames)> == static_cast<size_t>(CullFace_e::COUNT));
@ -316,13 +277,12 @@ namespace IW4
COUNT COUNT
}; };
inline const char* GdtPolygonOffsetNames[] inline const char* GdtPolygonOffsetNames[]{
{
"", "",
"0", "0",
"1", "1",
"2", "2",
"shadowMap" "shadowMap",
}; };
static_assert(std::extent_v<decltype(GdtPolygonOffsetNames)> == static_cast<size_t>(PolygonOffset_e::COUNT)); static_assert(std::extent_v<decltype(GdtPolygonOffsetNames)> == static_cast<size_t>(PolygonOffset_e::COUNT));
@ -342,12 +302,11 @@ namespace IW4
COUNT COUNT
}; };
inline const char* GdtStencilModeNames[] inline const char* GdtStencilModeNames[]{
{
"", "",
"Disable", "Disable",
"One-sided", "One-sided",
"Two-sided" "Two-sided",
}; };
static_assert(std::extent_v<decltype(GdtStencilModeNames)> == static_cast<size_t>(StencilMode_e::COUNT)); static_assert(std::extent_v<decltype(GdtStencilModeNames)> == static_cast<size_t>(StencilMode_e::COUNT));
@ -366,8 +325,7 @@ namespace IW4
COUNT COUNT
}; };
inline const char* GdtStencilFuncNames[] inline const char* GdtStencilFuncNames[]{
{
"", "",
"Never", "Never",
"Less", "Less",
@ -376,7 +334,7 @@ namespace IW4
"Greater", "Greater",
"NotEqual", "NotEqual",
"GreaterEqual", "GreaterEqual",
"Always" "Always",
}; };
static_assert(std::extent_v<decltype(GdtStencilFuncNames)> == static_cast<size_t>(StencilFunc_e::COUNT)); static_assert(std::extent_v<decltype(GdtStencilFuncNames)> == static_cast<size_t>(StencilFunc_e::COUNT));
@ -395,8 +353,7 @@ namespace IW4
COUNT COUNT
}; };
inline const char* GdtStencilOpNames[] inline const char* GdtStencilOpNames[]{
{
"", "",
"Keep", "Keep",
"Zero", "Zero",
@ -405,7 +362,7 @@ namespace IW4
"DecrSat", "DecrSat",
"Invert", "Invert",
"Incr", "Incr",
"Decr" "Decr",
}; };
static_assert(std::extent_v<decltype(GdtStencilOpNames)> == static_cast<size_t>(StencilOp_e::COUNT)); static_assert(std::extent_v<decltype(GdtStencilOpNames)> == static_cast<size_t>(StencilOp_e::COUNT));
@ -420,13 +377,12 @@ namespace IW4
COUNT COUNT
}; };
inline const char* GdtTileModeNames[] inline const char* GdtTileModeNames[]{
{
"", "",
"tile both*", "tile both*",
"tile horizontal", "tile horizontal",
"tile vertical", "tile vertical",
"no tile" "no tile",
}; };
static_assert(std::extent_v<decltype(GdtTileModeNames)> == static_cast<size_t>(TileMode_e::COUNT)); static_assert(std::extent_v<decltype(GdtTileModeNames)> == static_cast<size_t>(TileMode_e::COUNT));
@ -443,15 +399,14 @@ namespace IW4
COUNT COUNT
}; };
static const char* GdtSamplerFilterNames[] static const char* GdtSamplerFilterNames[]{
{
"", "",
"mip standard (2x bilinear)*", "mip standard (2x bilinear)*",
"mip expensive (4x bilinear)", "mip expensive (4x bilinear)",
"mip more expensive (2x trilinear)", "mip more expensive (2x trilinear)",
"mip most expensive (4x trilinear)", "mip most expensive (4x trilinear)",
"nomip nearest", "nomip nearest",
"nomip bilinear" "nomip bilinear",
}; };
static_assert(std::extent_v<decltype(GdtSamplerFilterNames)> == static_cast<size_t>(GdtFilter_e::COUNT)); static_assert(std::extent_v<decltype(GdtSamplerFilterNames)> == static_cast<size_t>(GdtFilter_e::COUNT));
@ -496,8 +451,7 @@ namespace IW4
constexpr auto GDT_MATERIAL_TYPE_WORLD_PHONG = "world phong"; constexpr auto GDT_MATERIAL_TYPE_WORLD_PHONG = "world phong";
constexpr auto GDT_MATERIAL_TYPE_WORLD_UNLIT = "world unlit"; constexpr auto GDT_MATERIAL_TYPE_WORLD_UNLIT = "world unlit";
inline const char* GdtMaterialTypeNames[] inline const char* GdtMaterialTypeNames[]{
{
GDT_MATERIAL_TYPE_UNKNOWN, GDT_MATERIAL_TYPE_UNKNOWN,
GDT_MATERIAL_TYPE_2D, GDT_MATERIAL_TYPE_2D,
GDT_MATERIAL_TYPE_CUSTOM, GDT_MATERIAL_TYPE_CUSTOM,
@ -514,7 +468,7 @@ namespace IW4
GDT_MATERIAL_TYPE_UNLIT, GDT_MATERIAL_TYPE_UNLIT,
GDT_MATERIAL_TYPE_WATER, GDT_MATERIAL_TYPE_WATER,
GDT_MATERIAL_TYPE_WORLD_PHONG, GDT_MATERIAL_TYPE_WORLD_PHONG,
GDT_MATERIAL_TYPE_WORLD_UNLIT GDT_MATERIAL_TYPE_WORLD_UNLIT,
}; };
static_assert(std::extent_v<decltype(GdtMaterialTypeNames)> == static_cast<size_t>(MATERIAL_TYPE_COUNT)); static_assert(std::extent_v<decltype(GdtMaterialTypeNames)> == static_cast<size_t>(MATERIAL_TYPE_COUNT));
@ -541,62 +495,61 @@ namespace IW4
constexpr auto GDT_SORTKEY_AFTER_EFFECT_TOP = "after effects - top"; constexpr auto GDT_SORTKEY_AFTER_EFFECT_TOP = "after effects - top";
constexpr auto GDT_SORTKEY_VIEWMODEL_EFFECT = "viewmodel effect"; constexpr auto GDT_SORTKEY_VIEWMODEL_EFFECT = "viewmodel effect";
inline const char* SortKeyNames[] inline const char* SortKeyNames[]{
{ GDT_SORTKEY_OPAQUE_AMBIENT, // 0
GDT_SORTKEY_OPAQUE_AMBIENT, // 0 GDT_SORTKEY_OPAQUE, // 1
GDT_SORTKEY_OPAQUE, // 1 GDT_SORTKEY_SKY, // 2
GDT_SORTKEY_SKY, // 2 GDT_SORTKEY_SKYBOX, // 3
GDT_SORTKEY_SKYBOX, // 3 nullptr, // ? 4
nullptr, // ? 4 nullptr, // ? 5
nullptr, // ? 5 GDT_SORTKEY_DECAL_BOTTOM_1, // 6
GDT_SORTKEY_DECAL_BOTTOM_1, // 6 GDT_SORTKEY_DECAL_BOTTOM_2, // 7
GDT_SORTKEY_DECAL_BOTTOM_2, // 7 GDT_SORTKEY_DECAL_BOTTOM_3, // 8
GDT_SORTKEY_DECAL_BOTTOM_3, // 8 GDT_SORTKEY_DECAL_STATIC, // 9
GDT_SORTKEY_DECAL_STATIC, // 9 GDT_SORTKEY_DECAL_MIDDLE_1, // 10
GDT_SORTKEY_DECAL_MIDDLE_1, // 10 GDT_SORTKEY_DECAL_MIDDLE_2, // 11
GDT_SORTKEY_DECAL_MIDDLE_2, // 11 GDT_SORTKEY_DECAL_MIDDLE_3, // 12
GDT_SORTKEY_DECAL_MIDDLE_3, // 12
GDT_SORTKEY_DECAL_WEAPON_IMPACT, // 13 GDT_SORTKEY_DECAL_WEAPON_IMPACT, // 13
nullptr, // ? 14 nullptr, // ? 14
nullptr, // ? 15 nullptr, // ? 15
nullptr, // ? 16 nullptr, // ? 16
nullptr, // ? 17 nullptr, // ? 17
nullptr, // ? 18 nullptr, // ? 18
nullptr, // ? 19 nullptr, // ? 19
nullptr, // ? 20 nullptr, // ? 20
nullptr, // ? 21 nullptr, // ? 21
nullptr, // - 22 nullptr, // - 22
nullptr, // - 23 nullptr, // - 23
GDT_SORTKEY_WINDOW_INSIDE, // 24 GDT_SORTKEY_WINDOW_INSIDE, // 24
GDT_SORTKEY_WINDOW_OUTSIDE, // 25 GDT_SORTKEY_WINDOW_OUTSIDE, // 25
nullptr, // ? 26 nullptr, // ? 26
nullptr, // ? 27 nullptr, // ? 27
nullptr, // ? 28 nullptr, // ? 28
nullptr, // ? 29 nullptr, // ? 29
nullptr, // ? 30 nullptr, // ? 30
nullptr, // ? 31 nullptr, // ? 31
nullptr, // ? 32 nullptr, // ? 32
nullptr, // ? 33 nullptr, // ? 33
nullptr, // ? 34 nullptr, // ? 34
nullptr, // ? 35 nullptr, // ? 35
nullptr, // ? 36 nullptr, // ? 36
nullptr, // ? 37 nullptr, // ? 37
nullptr, // ? 38 nullptr, // ? 38
nullptr, // ? 39 nullptr, // ? 39
nullptr, // ? 40 nullptr, // ? 40
nullptr, // ? 41 nullptr, // ? 41
nullptr, // ? 42 nullptr, // ? 42
GDT_SORTKEY_DISTORTION, // 43 GDT_SORTKEY_DISTORTION, // 43
nullptr, // ? 44 nullptr, // ? 44
nullptr, // ? 45 nullptr, // ? 45
nullptr, // - 46 nullptr, // - 46
GDT_SORTKEY_BLEND_ADDITIVE, // 47 GDT_SORTKEY_BLEND_ADDITIVE, // 47
GDT_SORTKEY_EFFECT_AUTO_SORT, // 48 GDT_SORTKEY_EFFECT_AUTO_SORT, // 48
GDT_SORTKEY_AFTER_EFFECT_BOTTOM, // 49 GDT_SORTKEY_AFTER_EFFECT_BOTTOM, // 49
GDT_SORTKEY_AFTER_EFFECT_MIDDLE, // 50 GDT_SORTKEY_AFTER_EFFECT_MIDDLE, // 50
GDT_SORTKEY_AFTER_EFFECT_TOP, // 51 GDT_SORTKEY_AFTER_EFFECT_TOP, // 51
nullptr, // - 52 nullptr, // - 52
GDT_SORTKEY_VIEWMODEL_EFFECT, // 53 GDT_SORTKEY_VIEWMODEL_EFFECT, // 53
}; };
static_assert(std::extent_v<decltype(SortKeyNames)> == static_cast<size_t>(SORTKEY_MAX)); static_assert(std::extent_v<decltype(SortKeyNames)> == static_cast<size_t>(SORTKEY_MAX));
@ -628,8 +581,7 @@ namespace IW4
constexpr auto GDT_CUSTOM_MATERIAL_TYPE_SHADOWOVERLAY = "mtl_shadowoverlay"; constexpr auto GDT_CUSTOM_MATERIAL_TYPE_SHADOWOVERLAY = "mtl_shadowoverlay";
constexpr auto GDT_CUSTOM_MATERIAL_TYPE_SPLATTER = "mtl_splatter"; constexpr auto GDT_CUSTOM_MATERIAL_TYPE_SPLATTER = "mtl_splatter";
inline const char* GdtCustomMaterialTypeNames[] inline const char* GdtCustomMaterialTypeNames[]{
{
GDT_CUSTOM_MATERIAL_TYPE_NONE, GDT_CUSTOM_MATERIAL_TYPE_NONE,
GDT_CUSTOM_MATERIAL_TYPE_CUSTOM, GDT_CUSTOM_MATERIAL_TYPE_CUSTOM,
GDT_CUSTOM_MATERIAL_TYPE_PHONG_FLAG, GDT_CUSTOM_MATERIAL_TYPE_PHONG_FLAG,
@ -638,7 +590,7 @@ namespace IW4
GDT_CUSTOM_MATERIAL_TYPE_REFLEXSIGHT, GDT_CUSTOM_MATERIAL_TYPE_REFLEXSIGHT,
GDT_CUSTOM_MATERIAL_TYPE_SHADOWCLEAR, GDT_CUSTOM_MATERIAL_TYPE_SHADOWCLEAR,
GDT_CUSTOM_MATERIAL_TYPE_SHADOWOVERLAY, GDT_CUSTOM_MATERIAL_TYPE_SHADOWOVERLAY,
GDT_CUSTOM_MATERIAL_TYPE_SPLATTER GDT_CUSTOM_MATERIAL_TYPE_SPLATTER,
}; };
static_assert(std::extent_v<decltype(GdtCustomMaterialTypeNames)> == static_cast<size_t>(CUSTOM_MATERIAL_TYPE_COUNT)); static_assert(std::extent_v<decltype(GdtCustomMaterialTypeNames)> == static_cast<size_t>(CUSTOM_MATERIAL_TYPE_COUNT));
} } // namespace IW4

View File

@ -4,8 +4,7 @@
namespace IW4 namespace IW4
{ {
inline const char* g_expFunctionNames[] inline const char* g_expFunctionNames[]{
{
"NOOP", "NOOP",
")", ")",
"*", "*",
@ -194,26 +193,25 @@ namespace IW4
"coopready", "coopready",
}; };
inline const ItemExpressionTargetBinding floatExpressionTargetBindings[ITEM_FLOATEXP_TGT_COUNT] inline const ItemExpressionTargetBinding floatExpressionTargetBindings[ITEM_FLOATEXP_TGT_COUNT]{
{ {ITEM_FLOATEXP_TGT_RECT_X, "rect", "x" },
{ITEM_FLOATEXP_TGT_RECT_X, "rect", "x"}, {ITEM_FLOATEXP_TGT_RECT_Y, "rect", "y" },
{ITEM_FLOATEXP_TGT_RECT_Y, "rect", "y"}, {ITEM_FLOATEXP_TGT_RECT_W, "rect", "w" },
{ITEM_FLOATEXP_TGT_RECT_W, "rect", "w"}, {ITEM_FLOATEXP_TGT_RECT_H, "rect", "h" },
{ITEM_FLOATEXP_TGT_RECT_H, "rect", "h"}, {ITEM_FLOATEXP_TGT_FORECOLOR_R, "forecolor", "r" },
{ITEM_FLOATEXP_TGT_FORECOLOR_R, "forecolor", "r"}, {ITEM_FLOATEXP_TGT_FORECOLOR_G, "forecolor", "g" },
{ITEM_FLOATEXP_TGT_FORECOLOR_G, "forecolor", "g"}, {ITEM_FLOATEXP_TGT_FORECOLOR_B, "forecolor", "b" },
{ITEM_FLOATEXP_TGT_FORECOLOR_B, "forecolor", "b"},
{ITEM_FLOATEXP_TGT_FORECOLOR_RGB, "forecolor", "rgb"}, {ITEM_FLOATEXP_TGT_FORECOLOR_RGB, "forecolor", "rgb"},
{ITEM_FLOATEXP_TGT_FORECOLOR_A, "forecolor", "a"}, {ITEM_FLOATEXP_TGT_FORECOLOR_A, "forecolor", "a" },
{ITEM_FLOATEXP_TGT_GLOWCOLOR_R, "glowcolor", "r"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_R, "glowcolor", "r" },
{ITEM_FLOATEXP_TGT_GLOWCOLOR_G, "glowcolor", "g"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_G, "glowcolor", "g" },
{ITEM_FLOATEXP_TGT_GLOWCOLOR_B, "glowcolor", "b"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_B, "glowcolor", "b" },
{ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, "glowcolor", "rgb"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, "glowcolor", "rgb"},
{ITEM_FLOATEXP_TGT_GLOWCOLOR_A, "glowcolor", "a"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_A, "glowcolor", "a" },
{ITEM_FLOATEXP_TGT_BACKCOLOR_R, "backcolor", "r"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_R, "backcolor", "r" },
{ITEM_FLOATEXP_TGT_BACKCOLOR_G, "backcolor", "g"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_G, "backcolor", "g" },
{ITEM_FLOATEXP_TGT_BACKCOLOR_B, "backcolor", "b"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_B, "backcolor", "b" },
{ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, "backcolor", "rgb"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, "backcolor", "rgb"},
{ITEM_FLOATEXP_TGT_BACKCOLOR_A, "backcolor", "a"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_A, "backcolor", "a" },
}; };
} } // namespace IW4

View File

@ -18,4 +18,4 @@ namespace IW4
static constexpr const char* GDF_FILENAME_VEHICLE = "vehicle.gdf"; static constexpr const char* GDF_FILENAME_VEHICLE = "vehicle.gdf";
static constexpr const char* GDF_FILENAME_WEAPON = "weapon.gdf"; static constexpr const char* GDF_FILENAME_WEAPON = "weapon.gdf";
}; };
} } // namespace IW4

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,7 @@
namespace IW5 namespace IW5
{ {
inline const char* g_expFunctionNames[] inline const char* g_expFunctionNames[]{
{
"NOOP", "NOOP",
")", ")",
"*", "*",
@ -361,26 +360,25 @@ namespace IW5
"doWeHaveMissingOwnedContent", "doWeHaveMissingOwnedContent",
}; };
inline const ItemExpressionTargetBinding floatExpressionTargetBindings[ITEM_FLOATEXP_TGT_COUNT] inline const ItemExpressionTargetBinding floatExpressionTargetBindings[ITEM_FLOATEXP_TGT_COUNT]{
{ {ITEM_FLOATEXP_TGT_RECT_X, "rect", "x" },
{ITEM_FLOATEXP_TGT_RECT_X, "rect", "x"}, {ITEM_FLOATEXP_TGT_RECT_Y, "rect", "y" },
{ITEM_FLOATEXP_TGT_RECT_Y, "rect", "y"}, {ITEM_FLOATEXP_TGT_RECT_W, "rect", "w" },
{ITEM_FLOATEXP_TGT_RECT_W, "rect", "w"}, {ITEM_FLOATEXP_TGT_RECT_H, "rect", "h" },
{ITEM_FLOATEXP_TGT_RECT_H, "rect", "h"}, {ITEM_FLOATEXP_TGT_FORECOLOR_R, "forecolor", "r" },
{ITEM_FLOATEXP_TGT_FORECOLOR_R, "forecolor", "r"}, {ITEM_FLOATEXP_TGT_FORECOLOR_G, "forecolor", "g" },
{ITEM_FLOATEXP_TGT_FORECOLOR_G, "forecolor", "g"}, {ITEM_FLOATEXP_TGT_FORECOLOR_B, "forecolor", "b" },
{ITEM_FLOATEXP_TGT_FORECOLOR_B, "forecolor", "b"},
{ITEM_FLOATEXP_TGT_FORECOLOR_RGB, "forecolor", "rgb"}, {ITEM_FLOATEXP_TGT_FORECOLOR_RGB, "forecolor", "rgb"},
{ITEM_FLOATEXP_TGT_FORECOLOR_A, "forecolor", "a"}, {ITEM_FLOATEXP_TGT_FORECOLOR_A, "forecolor", "a" },
{ITEM_FLOATEXP_TGT_GLOWCOLOR_R, "glowcolor", "r"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_R, "glowcolor", "r" },
{ITEM_FLOATEXP_TGT_GLOWCOLOR_G, "glowcolor", "g"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_G, "glowcolor", "g" },
{ITEM_FLOATEXP_TGT_GLOWCOLOR_B, "glowcolor", "b"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_B, "glowcolor", "b" },
{ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, "glowcolor", "rgb"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, "glowcolor", "rgb"},
{ITEM_FLOATEXP_TGT_GLOWCOLOR_A, "glowcolor", "a"}, {ITEM_FLOATEXP_TGT_GLOWCOLOR_A, "glowcolor", "a" },
{ITEM_FLOATEXP_TGT_BACKCOLOR_R, "backcolor", "r"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_R, "backcolor", "r" },
{ITEM_FLOATEXP_TGT_BACKCOLOR_G, "backcolor", "g"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_G, "backcolor", "g" },
{ITEM_FLOATEXP_TGT_BACKCOLOR_B, "backcolor", "b"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_B, "backcolor", "b" },
{ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, "backcolor", "rgb"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, "backcolor", "rgb"},
{ITEM_FLOATEXP_TGT_BACKCOLOR_A, "backcolor", "a"}, {ITEM_FLOATEXP_TGT_BACKCOLOR_A, "backcolor", "a" },
}; };
} } // namespace IW5

View File

@ -17,4 +17,4 @@ namespace IW5
static constexpr const char* GDF_FILENAME_VEHICLE = "vehicle.gdf"; static constexpr const char* GDF_FILENAME_VEHICLE = "vehicle.gdf";
static constexpr const char* GDF_FILENAME_WEAPON = "weapon.gdf"; static constexpr const char* GDF_FILENAME_WEAPON = "weapon.gdf";
}; };
} } // namespace IW5

View File

@ -2,8 +2,7 @@
namespace T6 namespace T6
{ {
inline const char* szWeapTypeNames[] inline const char* szWeapTypeNames[]{
{
"bullet", "bullet",
"grenade", "grenade",
"projectile", "projectile",
@ -12,11 +11,10 @@ namespace T6
"bomb", "bomb",
"mine", "mine",
"melee", "melee",
"riotshield" "riotshield",
}; };
inline const char* szWeapClassNames[] inline const char* szWeapClassNames[]{
{
"rifle", "rifle",
"mg", "mg",
"smg", "smg",
@ -30,47 +28,42 @@ namespace T6
"item", "item",
"melee", "melee",
"Killstreak Alt Stored Weapon", "Killstreak Alt Stored Weapon",
"pistol spread" "pistol spread",
}; };
inline const char* szWeapOverlayReticleNames[] inline const char* szWeapOverlayReticleNames[]{
{
"none", "none",
"crosshair" "crosshair",
}; };
inline const char* szWeapInventoryTypeNames[] inline const char* szWeapInventoryTypeNames[]{
{
"primary", "primary",
"offhand", "offhand",
"item", "item",
"altmode", "altmode",
"melee", "melee",
"dwlefthand" "dwlefthand",
}; };
inline const char* szWeapClipTypeNames[] inline const char* szWeapClipTypeNames[]{
{
"bottom", "bottom",
"top", "top",
"left", "left",
"dp28", "dp28",
"ptrs", "ptrs",
"lmg" "lmg",
}; };
inline const char* barrelTypeNames[] inline const char* barrelTypeNames[]{
{
"Single", "Single",
"Dual Barrel", "Dual Barrel",
"Dual Barrel Alternate", "Dual Barrel Alternate",
"Quad Barrel", "Quad Barrel",
"Quad Barrel Alternate", "Quad Barrel Alternate",
"Quad Barrel Double Alternate" "Quad Barrel Double Alternate",
}; };
inline const char* impactTypeNames[] inline const char* impactTypeNames[]{
{
"none", "none",
"bullet_small", "bullet_small",
"bullet_large", "bullet_large",
@ -86,18 +79,16 @@ namespace T6
"mortar_shell", "mortar_shell",
"tank_shell", "tank_shell",
"bolt", "bolt",
"blade" "blade",
}; };
inline const char* szWeapStanceNames[] inline const char* szWeapStanceNames[]{
{
"stand", "stand",
"duck", "duck",
"prone" "prone",
}; };
inline const char* szProjectileExplosionNames[] inline const char* szProjectileExplosionNames[]{
{
"grenade", "grenade",
"rocket", "rocket",
"flashbang", "flashbang",
@ -108,71 +99,40 @@ namespace T6
"fire", "fire",
"napalmblob", "napalmblob",
"bolt", "bolt",
"shrapnel span" "shrapnel span",
}; };
inline const char* offhandClassNames[] inline const char* offhandClassNames[]{
{
"None", "None",
"Frag Grenade", "Frag Grenade",
"Smoke Grenade", "Smoke Grenade",
"Flash Grenade", "Flash Grenade",
"Gear", "Gear",
"Supply Drop Marker" "Supply Drop Marker",
}; };
inline const char* offhandSlotNames[] inline const char* offhandSlotNames[]{
{
"None", "None",
"Lethal grenade", "Lethal grenade",
"Tactical grenade", "Tactical grenade",
"Equipment", "Equipment",
"Specific use" "Specific use",
}; };
inline const char* playerAnimTypeNames[] inline const char* playerAnimTypeNames[]{
{ "none", "default", "other", "sniper", "m203", "hold", "briefcase", "reviver", "radio", "dualwield",
"none", "remotecontrol", "crossbow", "minigun", "beltfed", "g11", "rearclip", "handleclip", "rearclipsniper", "ballisticknife", "singleknife",
"default", "nopump", "hatchet", "grimreaper", "zipline", "riotshield", "tablet", "turned", "screecher", "staff",
"other",
"sniper",
"m203",
"hold",
"briefcase",
"reviver",
"radio",
"dualwield",
"remotecontrol",
"crossbow",
"minigun",
"beltfed",
"g11",
"rearclip",
"handleclip",
"rearclipsniper",
"ballisticknife",
"singleknife",
"nopump",
"hatchet",
"grimreaper",
"zipline",
"riotshield",
"tablet",
"turned",
"screecher",
"staff"
}; };
inline const char* activeReticleNames[] inline const char* activeReticleNames[]{
{
"None", "None",
"Pip-On-A-Stick", "Pip-On-A-Stick",
"Bouncing Diamond", "Bouncing Diamond",
"Missile Lock" "Missile Lock",
}; };
inline const char* guidedMissileNames[] inline const char* guidedMissileNames[]{
{
"None", "None",
"Sidewinder", "Sidewinder",
"Hellfire", "Hellfire",
@ -181,87 +141,53 @@ namespace T6
"WireGuided", "WireGuided",
"TVGuided", "TVGuided",
"Drone", "Drone",
"HeatSeeking" "HeatSeeking",
}; };
inline const char* stickinessNames[] inline const char* stickinessNames[]{
{
"Don't stick", "Don't stick",
"Stick to all", "Stick to all",
"Stick to all, except ai and clients", "Stick to all, except ai and clients",
"Stick to ground", "Stick to ground",
"Stick to ground, maintain yaw", "Stick to ground, maintain yaw",
"Stick to flesh" "Stick to flesh",
}; };
inline const char* rotateTypeNames[] inline const char* rotateTypeNames[]{
{
"Rotate both axis, grenade style", "Rotate both axis, grenade style",
"Rotate one axis, blade style", "Rotate one axis, blade style",
"Rotate like a cylinder" "Rotate like a cylinder",
}; };
inline const char* overlayInterfaceNames[] inline const char* overlayInterfaceNames[]{
{
"None", "None",
"Javelin", "Javelin",
"Turret Scope" "Turret Scope",
}; };
inline const char* ammoCounterClipNames[] inline const char* ammoCounterClipNames[]{
{
"None", "None",
"Magazine", "Magazine",
"ShortMagazine", "ShortMagazine",
"Shotgun", "Shotgun",
"Rocket", "Rocket",
"Beltfed", "Beltfed",
"AltWeapon" "AltWeapon",
}; };
inline const char* weapIconRatioNames[] inline const char* weapIconRatioNames[]{
{
"1:1", "1:1",
"2:1", "2:1",
"4:1" "4:1",
}; };
inline const char* szAttachmentTypeNames[] inline const char* szAttachmentTypeNames[]{
{ "none", "acog", "dualclip", "dualoptic", "dw", "extbarrel", "extclip", "extramags", "fastads", "fastreload",
"none", "fmj", "gl", "grip", "holo", "ir", "is", "longbreath", "mk", "mms", "rangefinder",
"acog", "reflex", "rf", "sf", "silencer", "stackfire", "stalker", "steadyaim", "swayreduc", "tacknife", "vzoom",
"dualclip",
"dualoptic",
"dw",
"extbarrel",
"extclip",
"extramags",
"fastads",
"fastreload",
"fmj",
"gl",
"grip",
"holo",
"ir",
"is",
"longbreath",
"mk",
"mms",
"rangefinder",
"reflex",
"rf",
"sf",
"silencer",
"stackfire",
"stalker",
"steadyaim",
"swayreduc",
"tacknife",
"vzoom"
}; };
inline const char* szWeapFireTypeNames[] inline const char* szWeapFireTypeNames[]{
{
"Full Auto", "Full Auto",
"Single Shot", "Single Shot",
"2-Round Burst", "2-Round Burst",
@ -271,19 +197,17 @@ namespace T6
"Stacked Fire", "Stacked Fire",
"Minigun", "Minigun",
"Charge Shot", "Charge Shot",
"Jetgun" "Jetgun",
}; };
inline const char* penetrateTypeNames[] inline const char* penetrateTypeNames[]{
{
"none", "none",
"small", "small",
"medium", "medium",
"large" "large",
}; };
inline const char* s_constraintTypeNames[] inline const char* s_constraintTypeNames[]{
{
"none", "none",
"point", "point",
"distance", "distance",
@ -296,8 +220,7 @@ namespace T6
"light", "light",
}; };
inline const char* s_vehicleClassNames[] inline const char* s_vehicleClassNames[]{
{
"4 wheel", "4 wheel",
"motorcycle", "motorcycle",
"tank", "tank",
@ -307,8 +230,7 @@ namespace T6
"helicopter", "helicopter",
}; };
inline const char* s_vehicleCameraModes[] inline const char* s_vehicleCameraModes[]{
{
"first", "first",
"chase", "chase",
"view", "view",
@ -319,52 +241,20 @@ namespace T6
"vtol", "vtol",
}; };
inline const char* s_tractionTypeNames[] inline const char* s_tractionTypeNames[]{
{
"TRACTION_TYPE_FRONT", "TRACTION_TYPE_FRONT",
"TRACTION_TYPE_BACK", "TRACTION_TYPE_BACK",
"TRACTION_TYPE_ALL_WD", "TRACTION_TYPE_ALL_WD",
}; };
inline const char* tracerTypeNames[] inline const char* tracerTypeNames[]{
{
"Laser", "Laser",
"Smoke" "Smoke",
}; };
inline const char* bounceSoundSuffixes[] inline const char* bounceSoundSuffixes[]{
{ "_default", "_bark", "_brick", "_carpet", "_cloth", "_concrete", "_dirt", "_flesh", "_foliage", "_glass", "_grass",
"_default", "_gravel", "_ice", "_metal", "_mud", "_paper", "_plaster", "_rock", "_sand", "_snow", "_water", "_wood",
"_bark", "_asphalt", "_ceramic", "_plastic", "_rubber", "_cushion", "_fruit", "_paintedmetal", "_player", "_tallgrass", "_riotshield",
"_brick",
"_carpet",
"_cloth",
"_concrete",
"_dirt",
"_flesh",
"_foliage",
"_glass",
"_grass",
"_gravel",
"_ice",
"_metal",
"_mud",
"_paper",
"_plaster",
"_rock",
"_sand",
"_snow",
"_water",
"_wood",
"_asphalt",
"_ceramic",
"_plastic",
"_rubber",
"_cushion",
"_fruit",
"_paintedmetal",
"_player",
"_tallgrass",
"_riotshield"
}; };
} } // namespace T6

View File

@ -3,83 +3,82 @@
namespace T6 namespace T6
{ {
inline cspField_t phys_constraints_fields[] inline cspField_t phys_constraints_fields[]{
{ {"c1_type", offsetof(PhysConstraints, data[0].type), CFT_TYPE },
{"c1_type", offsetof(PhysConstraints, data[0].type), CFT_TYPE}, {"c1_bone1_name", offsetof(PhysConstraints, data[0].target_bone1), CSPFT_STRING},
{"c1_bone1_name", offsetof(PhysConstraints, data[0].target_bone1), CSPFT_STRING}, {"c1_bone2_name", offsetof(PhysConstraints, data[0].target_bone2), CSPFT_STRING},
{"c1_bone2_name", offsetof(PhysConstraints, data[0].target_bone2), CSPFT_STRING}, {"c1_offsetX", offsetof(PhysConstraints, data[0].offset.x), CSPFT_FLOAT },
{"c1_offsetX", offsetof(PhysConstraints, data[0].offset.x), CSPFT_FLOAT}, {"c1_offsetY", offsetof(PhysConstraints, data[0].offset.y), CSPFT_FLOAT },
{"c1_offsetY", offsetof(PhysConstraints, data[0].offset.y), CSPFT_FLOAT}, {"c1_offsetZ", offsetof(PhysConstraints, data[0].offset.z), CSPFT_FLOAT },
{"c1_offsetZ", offsetof(PhysConstraints, data[0].offset.z), CSPFT_FLOAT}, {"c1_timeout", offsetof(PhysConstraints, data[0].timeout), CSPFT_INT },
{"c1_timeout", offsetof(PhysConstraints, data[0].timeout), CSPFT_INT}, {"c1_min_health", offsetof(PhysConstraints, data[0].min_health), CSPFT_INT },
{"c1_min_health", offsetof(PhysConstraints, data[0].min_health), CSPFT_INT}, {"c1_max_health", offsetof(PhysConstraints, data[0].max_health), CSPFT_INT },
{"c1_max_health", offsetof(PhysConstraints, data[0].max_health), CSPFT_INT}, {"c1_damp", offsetof(PhysConstraints, data[0].damp), CSPFT_FLOAT },
{"c1_damp", offsetof(PhysConstraints, data[0].damp), CSPFT_FLOAT}, {"c1_power", offsetof(PhysConstraints, data[0].power), CSPFT_FLOAT },
{"c1_power", offsetof(PhysConstraints, data[0].power), CSPFT_FLOAT}, {"c1_spin_scale", offsetof(PhysConstraints, data[0].spin_scale), CSPFT_FLOAT },
{"c1_spin_scale", offsetof(PhysConstraints, data[0].spin_scale), CSPFT_FLOAT}, {"c1_shakescalex", offsetof(PhysConstraints, data[0].scale.x), CSPFT_FLOAT },
{"c1_shakescalex", offsetof(PhysConstraints, data[0].scale.x), CSPFT_FLOAT}, {"c1_shakescaley", offsetof(PhysConstraints, data[0].scale.y), CSPFT_FLOAT },
{"c1_shakescaley", offsetof(PhysConstraints, data[0].scale.y), CSPFT_FLOAT}, {"c1_shakescalez", offsetof(PhysConstraints, data[0].scale.z), CSPFT_FLOAT },
{"c1_shakescalez", offsetof(PhysConstraints, data[0].scale.z), CSPFT_FLOAT}, {"c1_min_angle", offsetof(PhysConstraints, data[0].minAngle), CSPFT_FLOAT },
{"c1_min_angle", offsetof(PhysConstraints, data[0].minAngle), CSPFT_FLOAT}, {"c1_max_angle", offsetof(PhysConstraints, data[0].maxAngle), CSPFT_FLOAT },
{"c1_max_angle", offsetof(PhysConstraints, data[0].maxAngle), CSPFT_FLOAT}, {"c1_yaw", offsetof(PhysConstraints, data[0].scale.y), CSPFT_FLOAT },
{"c1_yaw", offsetof(PhysConstraints, data[0].scale.y), CSPFT_FLOAT}, {"c1_pitch", offsetof(PhysConstraints, data[0].scale.x), CSPFT_FLOAT },
{"c1_pitch", offsetof(PhysConstraints, data[0].scale.x), CSPFT_FLOAT}, {"c2_type", offsetof(PhysConstraints, data[1].type), CFT_TYPE },
{"c2_type", offsetof(PhysConstraints, data[1].type), CFT_TYPE}, {"c2_bone1_name", offsetof(PhysConstraints, data[1].target_bone1), CSPFT_STRING},
{"c2_bone1_name", offsetof(PhysConstraints, data[1].target_bone1), CSPFT_STRING}, {"c2_bone2_name", offsetof(PhysConstraints, data[1].target_bone2), CSPFT_STRING},
{"c2_bone2_name", offsetof(PhysConstraints, data[1].target_bone2), CSPFT_STRING}, {"c2_offsetX", offsetof(PhysConstraints, data[1].offset.x), CSPFT_FLOAT },
{"c2_offsetX", offsetof(PhysConstraints, data[1].offset.x), CSPFT_FLOAT}, {"c2_offsetY", offsetof(PhysConstraints, data[1].offset.y), CSPFT_FLOAT },
{"c2_offsetY", offsetof(PhysConstraints, data[1].offset.y), CSPFT_FLOAT}, {"c2_offsetZ", offsetof(PhysConstraints, data[1].offset.z), CSPFT_FLOAT },
{"c2_offsetZ", offsetof(PhysConstraints, data[1].offset.z), CSPFT_FLOAT}, {"c2_timeout", offsetof(PhysConstraints, data[1].timeout), CSPFT_INT },
{"c2_timeout", offsetof(PhysConstraints, data[1].timeout), CSPFT_INT}, {"c2_min_health", offsetof(PhysConstraints, data[1].min_health), CSPFT_INT },
{"c2_min_health", offsetof(PhysConstraints, data[1].min_health), CSPFT_INT}, {"c2_max_health", offsetof(PhysConstraints, data[1].max_health), CSPFT_INT },
{"c2_max_health", offsetof(PhysConstraints, data[1].max_health), CSPFT_INT}, {"c2_damp", offsetof(PhysConstraints, data[1].damp), CSPFT_FLOAT },
{"c2_damp", offsetof(PhysConstraints, data[1].damp), CSPFT_FLOAT}, {"c2_power", offsetof(PhysConstraints, data[1].power), CSPFT_FLOAT },
{"c2_power", offsetof(PhysConstraints, data[1].power), CSPFT_FLOAT}, {"c2_spin_scale", offsetof(PhysConstraints, data[1].spin_scale), CSPFT_FLOAT },
{"c2_spin_scale", offsetof(PhysConstraints, data[1].spin_scale), CSPFT_FLOAT}, {"c2_shakescalex", offsetof(PhysConstraints, data[1].scale.x), CSPFT_FLOAT },
{"c2_shakescalex", offsetof(PhysConstraints, data[1].scale.x), CSPFT_FLOAT}, {"c2_shakescaley", offsetof(PhysConstraints, data[1].scale.y), CSPFT_FLOAT },
{"c2_shakescaley", offsetof(PhysConstraints, data[1].scale.y), CSPFT_FLOAT}, {"c2_shakescalez", offsetof(PhysConstraints, data[1].scale.z), CSPFT_FLOAT },
{"c2_shakescalez", offsetof(PhysConstraints, data[1].scale.z), CSPFT_FLOAT}, {"c2_min_angle", offsetof(PhysConstraints, data[1].minAngle), CSPFT_FLOAT },
{"c2_min_angle", offsetof(PhysConstraints, data[1].minAngle), CSPFT_FLOAT}, {"c2_max_angle", offsetof(PhysConstraints, data[1].maxAngle), CSPFT_FLOAT },
{"c2_max_angle", offsetof(PhysConstraints, data[1].maxAngle), CSPFT_FLOAT}, {"c2_yaw", offsetof(PhysConstraints, data[1].scale.y), CSPFT_FLOAT },
{"c2_yaw", offsetof(PhysConstraints, data[1].scale.y), CSPFT_FLOAT}, {"c2_pitch", offsetof(PhysConstraints, data[1].scale.x), CSPFT_FLOAT },
{"c2_pitch", offsetof(PhysConstraints, data[1].scale.x), CSPFT_FLOAT}, {"c3_type", offsetof(PhysConstraints, data[2].type), CFT_TYPE },
{"c3_type", offsetof(PhysConstraints, data[2].type), CFT_TYPE}, {"c3_bone1_name", offsetof(PhysConstraints, data[2].target_bone1), CSPFT_STRING},
{"c3_bone1_name", offsetof(PhysConstraints, data[2].target_bone1), CSPFT_STRING}, {"c3_bone2_name", offsetof(PhysConstraints, data[2].target_bone2), CSPFT_STRING},
{"c3_bone2_name", offsetof(PhysConstraints, data[2].target_bone2), CSPFT_STRING}, {"c3_offsetX", offsetof(PhysConstraints, data[2].offset.x), CSPFT_FLOAT },
{"c3_offsetX", offsetof(PhysConstraints, data[2].offset.x), CSPFT_FLOAT}, {"c3_offsetY", offsetof(PhysConstraints, data[2].offset.y), CSPFT_FLOAT },
{"c3_offsetY", offsetof(PhysConstraints, data[2].offset.y), CSPFT_FLOAT}, {"c3_offsetZ", offsetof(PhysConstraints, data[2].offset.z), CSPFT_FLOAT },
{"c3_offsetZ", offsetof(PhysConstraints, data[2].offset.z), CSPFT_FLOAT}, {"c3_timeout", offsetof(PhysConstraints, data[2].timeout), CSPFT_INT },
{"c3_timeout", offsetof(PhysConstraints, data[2].timeout), CSPFT_INT}, {"c3_min_health", offsetof(PhysConstraints, data[2].min_health), CSPFT_INT },
{"c3_min_health", offsetof(PhysConstraints, data[2].min_health), CSPFT_INT}, {"c3_max_health", offsetof(PhysConstraints, data[2].max_health), CSPFT_INT },
{"c3_max_health", offsetof(PhysConstraints, data[2].max_health), CSPFT_INT}, {"c3_damp", offsetof(PhysConstraints, data[2].damp), CSPFT_FLOAT },
{"c3_damp", offsetof(PhysConstraints, data[2].damp), CSPFT_FLOAT}, {"c3_power", offsetof(PhysConstraints, data[2].power), CSPFT_FLOAT },
{"c3_power", offsetof(PhysConstraints, data[2].power), CSPFT_FLOAT}, {"c3_spin_scale", offsetof(PhysConstraints, data[2].spin_scale), CSPFT_FLOAT },
{"c3_spin_scale", offsetof(PhysConstraints, data[2].spin_scale), CSPFT_FLOAT}, {"c3_shakescalex", offsetof(PhysConstraints, data[2].scale.x), CSPFT_FLOAT },
{"c3_shakescalex", offsetof(PhysConstraints, data[2].scale.x), CSPFT_FLOAT}, {"c3_shakescaley", offsetof(PhysConstraints, data[2].scale.y), CSPFT_FLOAT },
{"c3_shakescaley", offsetof(PhysConstraints, data[2].scale.y), CSPFT_FLOAT}, {"c3_shakescalez", offsetof(PhysConstraints, data[2].scale.z), CSPFT_FLOAT },
{"c3_shakescalez", offsetof(PhysConstraints, data[2].scale.z), CSPFT_FLOAT}, {"c3_min_angle", offsetof(PhysConstraints, data[2].minAngle), CSPFT_FLOAT },
{"c3_min_angle", offsetof(PhysConstraints, data[2].minAngle), CSPFT_FLOAT}, {"c3_max_angle", offsetof(PhysConstraints, data[2].maxAngle), CSPFT_FLOAT },
{"c3_max_angle", offsetof(PhysConstraints, data[2].maxAngle), CSPFT_FLOAT}, {"c3_yaw", offsetof(PhysConstraints, data[2].scale.y), CSPFT_FLOAT },
{"c3_yaw", offsetof(PhysConstraints, data[2].scale.y), CSPFT_FLOAT}, {"c3_pitch", offsetof(PhysConstraints, data[2].scale.x), CSPFT_FLOAT },
{"c3_pitch", offsetof(PhysConstraints, data[2].scale.x), CSPFT_FLOAT}, {"c4_type", offsetof(PhysConstraints, data[3].type), CFT_TYPE },
{"c4_type", offsetof(PhysConstraints, data[3].type), CFT_TYPE}, {"c4_bone1_name", offsetof(PhysConstraints, data[3].target_bone1), CSPFT_STRING},
{"c4_bone1_name", offsetof(PhysConstraints, data[3].target_bone1), CSPFT_STRING}, {"c4_bone2_name", offsetof(PhysConstraints, data[3].target_bone2), CSPFT_STRING},
{"c4_bone2_name", offsetof(PhysConstraints, data[3].target_bone2), CSPFT_STRING}, {"c4_offsetX", offsetof(PhysConstraints, data[3].offset.x), CSPFT_FLOAT },
{"c4_offsetX", offsetof(PhysConstraints, data[3].offset.x), CSPFT_FLOAT}, {"c4_offsetY", offsetof(PhysConstraints, data[3].offset.y), CSPFT_FLOAT },
{"c4_offsetY", offsetof(PhysConstraints, data[3].offset.y), CSPFT_FLOAT}, {"c4_offsetZ", offsetof(PhysConstraints, data[3].offset.z), CSPFT_FLOAT },
{"c4_offsetZ", offsetof(PhysConstraints, data[3].offset.z), CSPFT_FLOAT}, {"c4_timeout", offsetof(PhysConstraints, data[3].timeout), CSPFT_INT },
{"c4_timeout", offsetof(PhysConstraints, data[3].timeout), CSPFT_INT}, {"c4_min_health", offsetof(PhysConstraints, data[3].min_health), CSPFT_INT },
{"c4_min_health", offsetof(PhysConstraints, data[3].min_health), CSPFT_INT}, {"c4_max_health", offsetof(PhysConstraints, data[3].max_health), CSPFT_INT },
{"c4_max_health", offsetof(PhysConstraints, data[3].max_health), CSPFT_INT}, {"c4_damp", offsetof(PhysConstraints, data[3].damp), CSPFT_FLOAT },
{"c4_damp", offsetof(PhysConstraints, data[3].damp), CSPFT_FLOAT}, {"c4_power", offsetof(PhysConstraints, data[3].power), CSPFT_FLOAT },
{"c4_power", offsetof(PhysConstraints, data[3].power), CSPFT_FLOAT}, {"c4_spin_scale", offsetof(PhysConstraints, data[3].spin_scale), CSPFT_FLOAT },
{"c4_spin_scale", offsetof(PhysConstraints, data[3].spin_scale), CSPFT_FLOAT}, {"c4_shakescalex", offsetof(PhysConstraints, data[3].scale.x), CSPFT_FLOAT },
{"c4_shakescalex", offsetof(PhysConstraints, data[3].scale.x), CSPFT_FLOAT}, {"c4_shakescaley", offsetof(PhysConstraints, data[3].scale.y), CSPFT_FLOAT },
{"c4_shakescaley", offsetof(PhysConstraints, data[3].scale.y), CSPFT_FLOAT}, {"c4_shakescalez", offsetof(PhysConstraints, data[3].scale.z), CSPFT_FLOAT },
{"c4_shakescalez", offsetof(PhysConstraints, data[3].scale.z), CSPFT_FLOAT}, {"c4_min_angle", offsetof(PhysConstraints, data[3].minAngle), CSPFT_FLOAT },
{"c4_min_angle", offsetof(PhysConstraints, data[3].minAngle), CSPFT_FLOAT}, {"c4_max_angle", offsetof(PhysConstraints, data[3].maxAngle), CSPFT_FLOAT },
{"c4_max_angle", offsetof(PhysConstraints, data[3].maxAngle), CSPFT_FLOAT}, {"c4_yaw", offsetof(PhysConstraints, data[3].scale.y), CSPFT_FLOAT },
{"c4_yaw", offsetof(PhysConstraints, data[3].scale.y), CSPFT_FLOAT}, {"c4_pitch", offsetof(PhysConstraints, data[3].scale.x), CSPFT_FLOAT },
{"c4_pitch", offsetof(PhysConstraints, data[3].scale.x), CSPFT_FLOAT},
}; };
} }

View File

@ -3,26 +3,25 @@
namespace T6 namespace T6
{ {
inline cspField_t phys_preset_fields[] inline cspField_t phys_preset_fields[]{
{ {"mass", offsetof(PhysPresetInfo, mass), CSPFT_FLOAT },
{ "mass", offsetof(PhysPresetInfo, mass), CSPFT_FLOAT }, {"bounce", offsetof(PhysPresetInfo, bounce), CSPFT_FLOAT },
{ "bounce", offsetof(PhysPresetInfo, bounce), CSPFT_FLOAT }, {"friction", offsetof(PhysPresetInfo, friction), CSPFT_FLOAT },
{ "friction", offsetof(PhysPresetInfo, friction), CSPFT_FLOAT }, {"isFrictionInfinity", offsetof(PhysPresetInfo, isFrictionInfinity), CSPFT_QBOOLEAN},
{ "isFrictionInfinity", offsetof(PhysPresetInfo, isFrictionInfinity), CSPFT_QBOOLEAN }, {"bulletForceScale", offsetof(PhysPresetInfo, bulletForceScale), CSPFT_FLOAT },
{ "bulletForceScale", offsetof(PhysPresetInfo, bulletForceScale), CSPFT_FLOAT }, {"explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT },
{ "explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT }, {"piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT },
{ "piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT }, {"piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT },
{ "piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT }, {"canFloat", offsetof(PhysPresetInfo, canFloat), CSPFT_INT },
{ "canFloat", offsetof(PhysPresetInfo, canFloat), CSPFT_INT }, {"gravityScale", offsetof(PhysPresetInfo, gravityScale), CSPFT_FLOAT },
{ "gravityScale", offsetof(PhysPresetInfo, gravityScale), CSPFT_FLOAT }, {"massOffsetX", offsetof(PhysPresetInfo, centerOfMassOffset.x), CSPFT_FLOAT },
{ "massOffsetX", offsetof(PhysPresetInfo, centerOfMassOffset.x), CSPFT_FLOAT }, {"massOffsetY", offsetof(PhysPresetInfo, centerOfMassOffset.y), CSPFT_FLOAT },
{ "massOffsetY", offsetof(PhysPresetInfo, centerOfMassOffset.y), CSPFT_FLOAT }, {"massOffsetZ", offsetof(PhysPresetInfo, centerOfMassOffset.z), CSPFT_FLOAT },
{ "massOffsetZ", offsetof(PhysPresetInfo, centerOfMassOffset.z), CSPFT_FLOAT }, {"buoyancyMinX", offsetof(PhysPresetInfo, buoyancyBoxMin.x), CSPFT_FLOAT },
{ "buoyancyMinX", offsetof(PhysPresetInfo, buoyancyBoxMin.x), CSPFT_FLOAT }, {"buoyancyMinY", offsetof(PhysPresetInfo, buoyancyBoxMin.y), CSPFT_FLOAT },
{ "buoyancyMinY", offsetof(PhysPresetInfo, buoyancyBoxMin.y), CSPFT_FLOAT }, {"buoyancyMinZ", offsetof(PhysPresetInfo, buoyancyBoxMin.z), CSPFT_FLOAT },
{ "buoyancyMinZ", offsetof(PhysPresetInfo, buoyancyBoxMin.z), CSPFT_FLOAT }, {"buoyancyMaxX", offsetof(PhysPresetInfo, buoyancyBoxMax.x), CSPFT_FLOAT },
{ "buoyancyMaxX", offsetof(PhysPresetInfo, buoyancyBoxMax.x), CSPFT_FLOAT }, {"buoyancyMaxY", offsetof(PhysPresetInfo, buoyancyBoxMax.y), CSPFT_FLOAT },
{ "buoyancyMaxY", offsetof(PhysPresetInfo, buoyancyBoxMax.y), CSPFT_FLOAT }, {"buoyancyMaxZ", offsetof(PhysPresetInfo, buoyancyBoxMax.z), CSPFT_FLOAT },
{ "buoyancyMaxZ", offsetof(PhysPresetInfo, buoyancyBoxMax.z), CSPFT_FLOAT },
}; };
} }

View File

@ -3,38 +3,37 @@
namespace T6 namespace T6
{ {
inline cspField_t tracer_fields[] inline cspField_t tracer_fields[]{
{ {"type", offsetof(TracerDef, type), TFT_TRACERTYPE},
{"type", offsetof(TracerDef, type), TFT_TRACERTYPE}, {"material", offsetof(TracerDef, material), CSPFT_MATERIAL},
{"material", offsetof(TracerDef, material), CSPFT_MATERIAL}, {"drawInterval", offsetof(TracerDef, drawInterval), CSPFT_INT },
{"drawInterval", offsetof(TracerDef, drawInterval), CSPFT_INT}, {"speed", offsetof(TracerDef, speed), CSPFT_FLOAT },
{"speed", offsetof(TracerDef, speed), CSPFT_FLOAT}, {"beamLength", offsetof(TracerDef, beamLength), CSPFT_FLOAT },
{"beamLength", offsetof(TracerDef, beamLength), CSPFT_FLOAT}, {"beamWidth", offsetof(TracerDef, beamWidth), CSPFT_FLOAT },
{"beamWidth", offsetof(TracerDef, beamWidth), CSPFT_FLOAT}, {"screwRadius", offsetof(TracerDef, screwRadius), CSPFT_FLOAT },
{"screwRadius", offsetof(TracerDef, screwRadius), CSPFT_FLOAT}, {"screwDist", offsetof(TracerDef, screwDist), CSPFT_FLOAT },
{"screwDist", offsetof(TracerDef, screwDist), CSPFT_FLOAT}, {"fadeTime", offsetof(TracerDef, fadeTime), CSPFT_FLOAT },
{"fadeTime", offsetof(TracerDef, fadeTime), CSPFT_FLOAT}, {"fadeScale", offsetof(TracerDef, fadeScale), CSPFT_FLOAT },
{"fadeScale", offsetof(TracerDef, fadeScale), CSPFT_FLOAT}, {"texRepeatRate", offsetof(TracerDef, texRepeatRate), CSPFT_FLOAT },
{"texRepeatRate", offsetof(TracerDef, texRepeatRate), CSPFT_FLOAT}, {"colorR0", offsetof(TracerDef, colors[0].r), CSPFT_FLOAT },
{"colorR0", offsetof(TracerDef, colors[0].r), CSPFT_FLOAT}, {"colorG0", offsetof(TracerDef, colors[0].g), CSPFT_FLOAT },
{"colorG0", offsetof(TracerDef, colors[0].g), CSPFT_FLOAT}, {"colorB0", offsetof(TracerDef, colors[0].b), CSPFT_FLOAT },
{"colorB0", offsetof(TracerDef, colors[0].b), CSPFT_FLOAT}, {"colorA0", offsetof(TracerDef, colors[0].a), CSPFT_FLOAT },
{"colorA0", offsetof(TracerDef, colors[0].a), CSPFT_FLOAT}, {"colorR1", offsetof(TracerDef, colors[1].r), CSPFT_FLOAT },
{"colorR1", offsetof(TracerDef, colors[1].r), CSPFT_FLOAT}, {"colorG1", offsetof(TracerDef, colors[1].g), CSPFT_FLOAT },
{"colorG1", offsetof(TracerDef, colors[1].g), CSPFT_FLOAT}, {"colorB1", offsetof(TracerDef, colors[1].b), CSPFT_FLOAT },
{"colorB1", offsetof(TracerDef, colors[1].b), CSPFT_FLOAT}, {"colorA1", offsetof(TracerDef, colors[1].a), CSPFT_FLOAT },
{"colorA1", offsetof(TracerDef, colors[1].a), CSPFT_FLOAT}, {"colorR2", offsetof(TracerDef, colors[2].r), CSPFT_FLOAT },
{"colorR2", offsetof(TracerDef, colors[2].r), CSPFT_FLOAT}, {"colorG2", offsetof(TracerDef, colors[2].g), CSPFT_FLOAT },
{"colorG2", offsetof(TracerDef, colors[2].g), CSPFT_FLOAT}, {"colorB2", offsetof(TracerDef, colors[2].b), CSPFT_FLOAT },
{"colorB2", offsetof(TracerDef, colors[2].b), CSPFT_FLOAT}, {"colorA2", offsetof(TracerDef, colors[2].a), CSPFT_FLOAT },
{"colorA2", offsetof(TracerDef, colors[2].a), CSPFT_FLOAT}, {"colorR3", offsetof(TracerDef, colors[3].r), CSPFT_FLOAT },
{"colorR3", offsetof(TracerDef, colors[3].r), CSPFT_FLOAT}, {"colorG3", offsetof(TracerDef, colors[3].g), CSPFT_FLOAT },
{"colorG3", offsetof(TracerDef, colors[3].g), CSPFT_FLOAT}, {"colorB3", offsetof(TracerDef, colors[3].b), CSPFT_FLOAT },
{"colorB3", offsetof(TracerDef, colors[3].b), CSPFT_FLOAT}, {"colorA3", offsetof(TracerDef, colors[3].a), CSPFT_FLOAT },
{"colorA3", offsetof(TracerDef, colors[3].a), CSPFT_FLOAT}, {"colorR4", offsetof(TracerDef, colors[4].r), CSPFT_FLOAT },
{"colorR4", offsetof(TracerDef, colors[4].r), CSPFT_FLOAT}, {"colorG4", offsetof(TracerDef, colors[4].g), CSPFT_FLOAT },
{"colorG4", offsetof(TracerDef, colors[4].g), CSPFT_FLOAT}, {"colorB4", offsetof(TracerDef, colors[4].b), CSPFT_FLOAT },
{"colorB4", offsetof(TracerDef, colors[4].b), CSPFT_FLOAT}, {"colorA4", offsetof(TracerDef, colors[4].a), CSPFT_FLOAT },
{"colorA4", offsetof(TracerDef, colors[4].a), CSPFT_FLOAT}
}; };
} }

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More