2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-01-13 20:21:48 +00:00

Merge fixup

This commit is contained in:
LJW-Dev
2025-10-09 00:05:49 +08:00
771 changed files with 27490 additions and 14332 deletions

View File

@@ -1,11 +1,10 @@
#pragma once
#include "GameLanguage.h"
#include <type_traits>
#include <vector>
class Zone;
enum class GameId
{
IW3,
@@ -17,6 +16,22 @@ enum class GameId
COUNT
};
// The full uppercase names are macros in the standard lib
// So unfortunately not usable as values in the enum
enum class GameEndianness
{
/* Little endian */
LE,
/* Big endian */
BE
};
enum class GameWordSize
{
ARCH_32,
ARCH_64
};
static constexpr const char* GameId_Names[]{
"IW3",
"IW4",
@@ -39,9 +54,6 @@ public:
[[nodiscard]] virtual GameId GetId() const = 0;
[[nodiscard]] virtual const std::string& GetFullName() const = 0;
[[nodiscard]] virtual const std::string& GetShortName() const = 0;
virtual void AddZone(Zone* zone) = 0;
virtual void RemoveZone(Zone* zone) = 0;
[[nodiscard]] virtual const std::vector<Zone*>& GetZones() const = 0;
[[nodiscard]] virtual const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const = 0;
static IGame* GetGameById(GameId gameId);

View File

@@ -21,6 +21,11 @@ namespace IW3
return result;
}
static constexpr uint32_t R_HashString(const char* string)
{
return R_HashString(string, 0u);
}
static PackedTexCoords Vec2PackTexCoords(const float (&in)[2]);
static PackedUnitVec Vec3PackUnitVec(const float (&in)[3]);
static GfxColor Vec4PackGfxColor(const float (&in)[4]);

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes;

View File

@@ -9,12 +9,6 @@ namespace IW3
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace IW3

View File

@@ -97,6 +97,8 @@ namespace IW3
struct RawFile;
struct StringTable;
typedef unsigned short ScriptString;
union XAssetHeader
{
// XModelPieces *xmodelPieces; // NOT AN ASSET
@@ -215,7 +217,7 @@ namespace IW3
struct XAnimNotifyInfo
{
uint16_t name;
ScriptString name;
float time;
};
@@ -309,7 +311,7 @@ namespace IW3
unsigned int indexCount;
float framerate;
float frequency;
uint16_t* names;
ScriptString* names;
char* dataByte;
int16_t* dataShort;
int* dataInt;
@@ -329,8 +331,8 @@ namespace IW3
struct DObjAnimMat
{
float quat[4];
float trans[3];
vec4_t quat;
vec3_t trans;
float transWeight;
};
@@ -390,7 +392,7 @@ namespace IW3
struct type_align(16) GfxPackedVertex
{
float xyz[3];
vec3_t xyz;
float binormalSign;
GfxColor color;
PackedTexCoords texCoord;
@@ -404,7 +406,12 @@ namespace IW3
uint16_t* vertsBlend;
};
typedef tdef_align32(16) uint16_t r_index16_t;
struct XSurfaceTri
{
uint16_t i[3];
};
typedef tdef_align32(16) XSurfaceTri XSurfaceTri16;
struct XSurface
{
@@ -415,7 +422,7 @@ namespace IW3
char zoneHandle;
uint16_t baseTriIndex;
uint16_t baseVertIndex;
r_index16_t (*triIndices)[3];
XSurfaceTri16* triIndices;
XSurfaceVertexInfo vertInfo;
GfxPackedVertex* verts0;
unsigned int vertListCount;
@@ -455,8 +462,8 @@ namespace IW3
struct XBoneInfo
{
float bounds[2][3];
float offset[3];
vec3_t bounds[2];
vec3_t offset;
float radiusSquared;
};
@@ -520,6 +527,11 @@ namespace IW3
char pad;
};
struct XModelQuat
{
int16_t v[4];
};
struct XModel
{
const char* name;
@@ -527,11 +539,11 @@ namespace IW3
unsigned char numRootBones;
unsigned char numsurfs;
char lodRampType;
uint16_t* boneNames;
char* parentList;
int16_t (*quats)[4];
float (*trans)[4];
char* partClassification;
ScriptString* boneNames;
unsigned char* parentList;
XModelQuat* quats;
float* trans;
unsigned char* partClassification;
DObjAnimMat* baseMat;
XSurface* surfs;
Material** materialHandles;
@@ -541,10 +553,10 @@ namespace IW3
int contents;
XBoneInfo* boneInfo;
float radius;
float mins[3];
float maxs[3];
vec3_t mins;
vec3_t maxs;
uint16_t numLods;
uint16_t collLod;
int16_t collLod;
XModelStreamInfo streamInfo;
int memUsage;
char flags;
@@ -566,7 +578,8 @@ namespace IW3
GFXS_BLEND_INVDESTALPHA = 0x8,
GFXS_BLEND_DESTCOLOR = 0x9,
GFXS_BLEND_INVDESTCOLOR = 0xA,
GFXS_BLEND_MASK = 0xF,
GFXS_BLEND_COUNT
};
enum GfxBlendOp
@@ -577,7 +590,40 @@ namespace IW3
GFXS_BLENDOP_REVSUBTRACT = 0x3,
GFXS_BLENDOP_MIN = 0x4,
GFXS_BLENDOP_MAX = 0x5,
GFXS_BLENDOP_MASK = 0x7,
GFXS_BLENDOP_COUNT
};
enum GfxAlphaTest_e
{
GFXS_ALPHA_TEST_GT_0 = 1,
GFXS_ALPHA_TEST_LT_128 = 2,
GFXS_ALPHA_TEST_GE_128 = 3,
GFXS_ALPHA_TEST_COUNT
};
enum GfxCullFace_e
{
GFXS_CULL_NONE = 1,
GFXS_CULL_BACK = 2,
GFXS_CULL_FRONT = 3,
};
enum GfxDepthTest_e
{
GFXS_DEPTHTEST_ALWAYS = 0,
GFXS_DEPTHTEST_LESS = 1,
GFXS_DEPTHTEST_EQUAL = 2,
GFXS_DEPTHTEST_LESSEQUAL = 3
};
enum GfxPolygonOffset_e
{
GFXS_POLYGON_OFFSET_0 = 0,
GFXS_POLYGON_OFFSET_1 = 1,
GFXS_POLYGON_OFFSET_2 = 2,
GFXS_POLYGON_OFFSET_SHADOWMAP = 3
};
enum GfxStencilOp
@@ -589,10 +635,19 @@ namespace IW3
GFXS_STENCILOP_DECRSAT = 0x4,
GFXS_STENCILOP_INVERT = 0x5,
GFXS_STENCILOP_INCR = 0x6,
GFXS_STENCILOP_DECR = 0x7,
GFXS_STENCILOP_DECR = 0x7
};
GFXS_STENCILOP_COUNT,
GFXS_STENCILOP_MASK = 0x7
enum GfxStencilFunc
{
GFXS_STENCILFUNC_NEVER = 0x0,
GFXS_STENCILFUNC_LESS = 0x1,
GFXS_STENCILFUNC_EQUAL = 0x2,
GFXS_STENCILFUNC_LESSEQUAL = 0x3,
GFXS_STENCILFUNC_GREATER = 0x4,
GFXS_STENCILFUNC_NOTEQUAL = 0x5,
GFXS_STENCILFUNC_GREATEREQUAL = 0x6,
GFXS_STENCILFUNC_ALWAYS = 0x7
};
enum GfxStateBitsEnum : unsigned int
@@ -613,10 +668,10 @@ namespace IW3
GFXS0_ATEST_GE_128 = 0x3000,
GFXS0_ATEST_MASK = 0x3000,
GFXS0_CULL_SHIFT = 0xE,
GFXS0_CULL_NONE = 0x4000,
GFXS0_CULL_BACK = 0x8000,
GFXS0_CULL_FRONT = 0xC000,
GFXS0_CULL_SHIFT = 0xE,
GFXS0_CULL_MASK = 0xC000,
GFXS0_SRCBLEND_ALPHA_SHIFT = 0x10,
@@ -638,18 +693,18 @@ namespace IW3
GFXS1_DEPTHWRITE = 0x1,
GFXS1_DEPTHTEST_DISABLE = 0x2,
GFXS1_DEPTHTEST_SHIFT = 0x2,
GFXS1_DEPTHTEST_ALWAYS = 0x0,
GFXS1_DEPTHTEST_LESS = 0x4,
GFXS1_DEPTHTEST_EQUAL = 0x8,
GFXS1_DEPTHTEST_LESSEQUAL = 0xC,
GFXS1_DEPTHTEST_SHIFT = 0x2,
GFXS1_DEPTHTEST_MASK = 0xC,
GFXS1_POLYGON_OFFSET_SHIFT = 0x4,
GFXS1_POLYGON_OFFSET_0 = 0x0,
GFXS1_POLYGON_OFFSET_1 = 0x10,
GFXS1_POLYGON_OFFSET_2 = 0x20,
GFXS1_POLYGON_OFFSET_SHADOWMAP = 0x30,
GFXS1_POLYGON_OFFSET_SHIFT = 0x4,
GFXS1_POLYGON_OFFSET_MASK = 0x30,
GFXS1_STENCIL_FRONT_ENABLE = 0x40,
@@ -672,16 +727,61 @@ namespace IW3
GFXS1_STENCILOP_FRONTBACK_MASK = 0x1FF1FF00,
};
struct GfxStateBitsLoadBitsStructured
{
// Byte 0
unsigned int srcBlendRgb : 4; // 0-3
unsigned int dstBlendRgb : 4; // 4-7
unsigned int blendOpRgb : 3; // 8-10
unsigned int alphaTestDisabled : 1; // 11
unsigned int alphaTest : 2; // 12-13
unsigned int cullFace : 2; // 14-15
unsigned int srcBlendAlpha : 4; // 16-19
unsigned int dstBlendAlpha : 4; // 20-23
unsigned int blendOpAlpha : 3; // 24-26
unsigned int colorWriteRgb : 1; // 27
unsigned int colorWriteAlpha : 1; // 28
unsigned int unused1 : 2; // 29-30
unsigned int polymodeLine : 1; // 31
// Byte 1
unsigned int depthWrite : 1; // 0
unsigned int depthTestDisabled : 1; // 1
unsigned int depthTest : 2; // 2-3
unsigned int polygonOffset : 2; // 4-5
unsigned int stencilFrontEnabled : 1; // 6
unsigned int stencilBackEnabled : 1; // 7
unsigned int stencilFrontPass : 3; // 8-10
unsigned int stencilFrontFail : 3; // 11-13
unsigned int stencilFrontZFail : 3; // 14-16
unsigned int stencilFrontFunc : 3; // 17-19
unsigned int stencilBackPass : 3; // 20-22
unsigned int stencilBackFail : 3; // 23-25
unsigned int stencilBackZFail : 3; // 26-28
unsigned int stencilBackFunc : 3; // 29-31
};
union GfxStateBitsLoadBits
{
unsigned int raw[2];
GfxStateBitsLoadBitsStructured structured;
};
#ifndef __zonecodegenerator
static_assert(sizeof(GfxStateBitsLoadBits) == 8);
static_assert(sizeof(GfxStateBitsLoadBitsStructured) == 8);
#endif
struct GfxStateBits
{
unsigned int loadBits[2];
GfxStateBitsLoadBits loadBits;
};
struct type_align(16) MaterialConstantDef
{
unsigned int nameHash;
char name[12];
float literal[4];
vec4_t literal;
};
struct complex_s
@@ -718,6 +818,26 @@ namespace IW3
water_t* water;
};
enum TextureFilter
{
TEXTURE_FILTER_DISABLED = 0x0,
TEXTURE_FILTER_NEAREST = 0x1,
TEXTURE_FILTER_LINEAR = 0x2,
TEXTURE_FILTER_ANISO2X = 0x3,
TEXTURE_FILTER_ANISO4X = 0x4,
TEXTURE_FILTER_COUNT
};
enum SamplerStateBitsMipMap_e
{
SAMPLER_MIPMAP_ENUM_DISABLED,
SAMPLER_MIPMAP_ENUM_NEAREST,
SAMPLER_MIPMAP_ENUM_LINEAR,
SAMPLER_MIPMAP_ENUM_COUNT
};
enum SamplerStateBits_e
{
SAMPLER_FILTER_SHIFT = 0x0,
@@ -743,13 +863,26 @@ namespace IW3
SAMPLER_CLAMP_MASK = 0xE0,
};
struct MaterialTextureDefSamplerState
{
unsigned char filter : 3;
unsigned char mipMap : 2;
unsigned char clampU : 1;
unsigned char clampV : 1;
unsigned char clampW : 1;
};
#ifndef __zonecodegenerator
static_assert(sizeof(MaterialTextureDefSamplerState) == 1u);
#endif
struct MaterialTextureDef
{
unsigned int nameHash;
char nameStart;
char nameEnd;
unsigned char samplerState; // SamplerStateBits_e
unsigned char semantic; // TextureSemantic
MaterialTextureDefSamplerState samplerState; // SamplerStateBits_e
unsigned char semantic; // TextureSemantic
MaterialTextureDefInfo u;
};
@@ -842,8 +975,9 @@ namespace IW3
CAMERA_REGION_LIT = 0x0,
CAMERA_REGION_DECAL = 0x1,
CAMERA_REGION_EMISSIVE = 0x2,
CAMERA_REGION_COUNT = 0x3,
CAMERA_REGION_NONE = 0x3,
CAMERA_REGION_COUNT,
CAMERA_REGION_NONE = CAMERA_REGION_COUNT,
};
enum MaterialStateFlags
@@ -2799,6 +2933,30 @@ namespace IW3
MISSILE_GUIDANCE_COUNT = 0x4,
};
enum hitLocation_t
{
HITLOC_NONE = 0x0,
HITLOC_HELMET = 0x1,
HITLOC_HEAD = 0x2,
HITLOC_NECK = 0x3,
HITLOC_TORSO_UPR = 0x4,
HITLOC_TORSO_LWR = 0x5,
HITLOC_R_ARM_UPR = 0x6,
HITLOC_L_ARM_UPR = 0x7,
HITLOC_R_ARM_LWR = 0x8,
HITLOC_L_ARM_LWR = 0x9,
HITLOC_R_HAND = 0xA,
HITLOC_L_HAND = 0xB,
HITLOC_R_LEG_UPR = 0xC,
HITLOC_L_LEG_UPR = 0xD,
HITLOC_R_LEG_LWR = 0xE,
HITLOC_L_LEG_LWR = 0xF,
HITLOC_R_FOOT = 0x10,
HITLOC_L_FOOT = 0x11,
HITLOC_COUNT,
};
struct snd_alias_list_name
{
const char* soundName;

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes;

View File

@@ -9,12 +9,6 @@ namespace IW4
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace IW4

View File

@@ -113,6 +113,8 @@ namespace IW4
struct VehicleDef;
struct AddonMapEnts;
typedef unsigned short ScriptString;
union XAssetHeader
{
PhysPreset* physPreset;
@@ -239,8 +241,8 @@ namespace IW4
struct Bounds
{
float midPoint[3];
float halfSize[3];
vec3_t midPoint;
vec3_t halfSize;
};
struct cplane_s
@@ -325,7 +327,7 @@ namespace IW4
struct XAnimNotifyInfo
{
uint16_t name;
ScriptString name;
float time;
};
@@ -448,7 +450,7 @@ namespace IW4
unsigned int indexCount;
float framerate;
float frequency;
uint16_t* names;
ScriptString* names;
char* dataByte;
int16_t* dataShort;
int* dataInt;
@@ -491,7 +493,7 @@ namespace IW4
struct type_align(16) GfxPackedVertex
{
float xyz[3];
vec3_t xyz;
float binormalSign;
GfxColor color;
PackedTexCoords texCoord;
@@ -536,7 +538,12 @@ namespace IW4
XSurfaceCollisionTree* collisionTree;
};
typedef tdef_align32(16) uint16_t r_index16_t;
struct XSurfaceTri
{
uint16_t i[3];
};
typedef tdef_align32(16) XSurfaceTri XSurfaceTri16;
struct XSurface
{
@@ -547,7 +554,7 @@ namespace IW4
char zoneHandle;
uint16_t baseTriIndex;
uint16_t baseVertIndex;
r_index16_t (*triIndices)[3];
XSurfaceTri16* triIndices;
XSurfaceVertexInfo vertInfo;
GfxPackedVertex* verts0;
unsigned int vertListCount;
@@ -602,11 +609,16 @@ namespace IW4
struct DObjAnimMat
{
float quat[4];
float trans[3];
vec4_t quat;
vec3_t trans;
float transWeight;
};
struct XModelQuat
{
int16_t v[4];
};
struct XModel
{
const char* name;
@@ -616,17 +628,17 @@ namespace IW4
char lodRampType;
float scale;
unsigned int noScalePartBits[6];
uint16_t* boneNames;
ScriptString* boneNames;
unsigned char* parentList;
int16_t (*quats)[4];
float (*trans)[3];
XModelQuat* quats;
float* trans;
unsigned char* partClassification;
DObjAnimMat* baseMat;
Material** materialHandles;
XModelLodInfo lodInfo[4];
char maxLoadedLod;
unsigned char numLods;
unsigned char collLod;
char collLod;
char flags;
XModelCollSurf_s* collSurfs;
int numCollSurfs;

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes;

View File

@@ -9,12 +9,6 @@ namespace IW5
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace IW5

View File

@@ -11,6 +11,21 @@ namespace T5
static int Com_HashString(const char* str);
static int Com_HashString(const char* str, int len);
static constexpr uint32_t R_HashString(const char* str, uint32_t hash)
{
for (const auto* pos = str; *pos; pos++)
{
hash = 33 * hash ^ (*pos | 0x20);
}
return hash;
}
static constexpr uint32_t R_HashString(const char* string)
{
return R_HashString(string, 0u);
}
static PackedTexCoords Vec2PackTexCoords(const float (&in)[2]);
static PackedUnitVec Vec3PackUnitVec(const float (&in)[3]);
static GfxColor Vec4PackGfxColor(const float (&in)[4]);

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes{

View File

@@ -9,12 +9,6 @@ namespace T5
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace T5

View File

@@ -540,6 +540,15 @@ namespace T5
XSurfaceCollisionTree* collisionTree;
};
enum XSurfaceFlag
{
XSURFACE_FLAG_QUANTIZED = 0x1,
XSURFACE_FLAG_SKINNED = 0x2,
XSURFACE_FLAG_CONSTANT_COLOR = 0x4,
XSURFACE_FLAG_DEFORMED = 0x80,
XSURFACE_FLAG_STREAMED = 0x8000,
};
struct XSurfaceTri
{
uint16_t i[3];
@@ -739,14 +748,30 @@ namespace T5
gcc_align32(8) uint64_t packed;
};
enum MaterialGameFlags
{
MTL_GAMEFLAG_1 = 0x1,
MTL_GAMEFLAG_2 = 0x2,
MTL_GAMEFLAG_4 = 0x4,
MTL_GAMEFLAG_8 = 0x8,
MTL_GAMEFLAG_10 = 0x10,
MTL_GAMEFLAG_20 = 0x20,
// Probably, seems to be this in T5
MTL_GAMEFLAG_CASTS_SHADOW = 0x40,
MTL_GAMEFLAG_80 = 0x80,
MTL_GAMEFLAG_100 = 0x100,
MTL_GAMEFLAG_200 = 0x200,
};
struct MaterialInfo
{
const char* name;
unsigned int gameFlags;
char pad;
char sortKey;
char textureAtlasRowCount;
char textureAtlasColumnCount;
unsigned char sortKey;
unsigned char textureAtlasRowCount;
unsigned char textureAtlasColumnCount;
GfxDrawSurf drawSurf;
unsigned int surfaceTypeBits;
unsigned int layeredSurfaceTypes;
@@ -787,14 +812,47 @@ namespace T5
water_t* water;
};
enum TextureFilter
{
TEXTURE_FILTER_DISABLED = 0x0,
TEXTURE_FILTER_NEAREST = 0x1,
TEXTURE_FILTER_LINEAR = 0x2,
TEXTURE_FILTER_ANISO2X = 0x3,
TEXTURE_FILTER_ANISO4X = 0x4,
TEXTURE_FILTER_COUNT
};
enum SamplerStateBitsMipMap_e
{
SAMPLER_MIPMAP_ENUM_DISABLED,
SAMPLER_MIPMAP_ENUM_NEAREST,
SAMPLER_MIPMAP_ENUM_LINEAR,
SAMPLER_MIPMAP_ENUM_COUNT
};
struct MaterialTextureDefSamplerState
{
unsigned char filter : 3;
unsigned char mipMap : 2;
unsigned char clampU : 1;
unsigned char clampV : 1;
unsigned char clampW : 1;
};
#ifndef __zonecodegenerator
static_assert(sizeof(MaterialTextureDefSamplerState) == 1u);
#endif
struct MaterialTextureDef
{
unsigned int nameHash;
char nameStart;
char nameEnd;
char samplerState;
MaterialTextureDefSamplerState samplerState;
unsigned char semantic; // TextureSemantic
char isMatureContent;
bool isMatureContent;
char pad[3];
MaterialTextureDefInfo u;
};
@@ -803,7 +861,96 @@ namespace T5
{
unsigned int nameHash;
char name[12];
float literal[4];
vec4_t literal;
};
enum GfxBlend : unsigned int
{
GFXS_BLEND_DISABLED = 0x0,
GFXS_BLEND_ZERO = 0x1,
GFXS_BLEND_ONE = 0x2,
GFXS_BLEND_SRCCOLOR = 0x3,
GFXS_BLEND_INVSRCCOLOR = 0x4,
GFXS_BLEND_SRCALPHA = 0x5,
GFXS_BLEND_INVSRCALPHA = 0x6,
GFXS_BLEND_DESTALPHA = 0x7,
GFXS_BLEND_INVDESTALPHA = 0x8,
GFXS_BLEND_DESTCOLOR = 0x9,
GFXS_BLEND_INVDESTCOLOR = 0xA,
GFXS_BLEND_MASK = 0xF,
};
enum GfxBlendOp : unsigned int
{
GFXS_BLENDOP_DISABLED = 0x0,
GFXS_BLENDOP_ADD = 0x1,
GFXS_BLENDOP_SUBTRACT = 0x2,
GFXS_BLENDOP_REVSUBTRACT = 0x3,
GFXS_BLENDOP_MIN = 0x4,
GFXS_BLENDOP_MAX = 0x5,
GFXS_BLENDOP_MASK = 0x7,
};
enum GfxAlphaTest_e
{
GFXS_ALPHA_TEST_GT_0 = 1,
GFXS_ALPHA_TEST_GE_255 = 2,
GFXS_ALPHA_TEST_GE_128 = 3,
GFXS_ALPHA_TEST_COUNT
};
enum GfxCullFace_e
{
GFXS_CULL_NONE = 1,
GFXS_CULL_BACK = 2,
GFXS_CULL_FRONT = 3,
};
enum GfxDepthTest_e
{
GFXS_DEPTHTEST_ALWAYS = 0,
GFXS_DEPTHTEST_LESS = 1,
GFXS_DEPTHTEST_EQUAL = 2,
GFXS_DEPTHTEST_LESSEQUAL = 3
};
enum GfxPolygonOffset_e
{
GFXS_POLYGON_OFFSET_0 = 0,
GFXS_POLYGON_OFFSET_1 = 1,
GFXS_POLYGON_OFFSET_2 = 2,
GFXS_POLYGON_OFFSET_SHADOWMAP = 3
};
enum GfxStencilOp : unsigned int
{
GFXS_STENCILOP_KEEP = 0x0,
GFXS_STENCILOP_ZERO = 0x1,
GFXS_STENCILOP_REPLACE = 0x2,
GFXS_STENCILOP_INCRSAT = 0x3,
GFXS_STENCILOP_DECRSAT = 0x4,
GFXS_STENCILOP_INVERT = 0x5,
GFXS_STENCILOP_INCR = 0x6,
GFXS_STENCILOP_DECR = 0x7,
GFXS_STENCILOP_COUNT,
GFXS_STENCILOP_MASK = 0x7
};
enum GfxStencilFunc : unsigned int
{
GFXS_STENCILFUNC_NEVER = 0x0,
GFXS_STENCILFUNC_LESS = 0x1,
GFXS_STENCILFUNC_EQUAL = 0x2,
GFXS_STENCILFUNC_LESSEQUAL = 0x3,
GFXS_STENCILFUNC_GREATER = 0x4,
GFXS_STENCILFUNC_NOTEQUAL = 0x5,
GFXS_STENCILFUNC_GREATEREQUAL = 0x6,
GFXS_STENCILFUNC_ALWAYS = 0x7,
GFXS_STENCILFUNC_COUNT,
GFXS_STENCILFUNC_MASK = 0x7
};
enum GfxStateBitsEnum : unsigned int
@@ -868,9 +1015,64 @@ namespace T5
GFXS1_STENCILOP_FRONTBACK_MASK = 0x1FF1FF00,
};
struct GfxStateBitsLoadBitsStructured
{
// Byte 0
unsigned int srcBlendRgb : 4; // 0-3
unsigned int dstBlendRgb : 4; // 4-7
unsigned int blendOpRgb : 3; // 8-10
unsigned int alphaTestDisabled : 1; // 11
unsigned int alphaTest : 2; // 12-13
unsigned int cullFace : 2; // 14-15
unsigned int srcBlendAlpha : 4; // 16-19
unsigned int dstBlendAlpha : 4; // 20-23
unsigned int blendOpAlpha : 3; // 24-26
unsigned int colorWriteRgb : 1; // 27
unsigned int colorWriteAlpha : 1; // 28
unsigned int unused0 : 2; // 29-30
unsigned int polymodeLine : 1; // 31
// Byte 1
unsigned int depthWrite : 1; // 0
unsigned int depthTestDisabled : 1; // 1
unsigned int depthTest : 2; // 2-3
unsigned int polygonOffset : 2; // 4-5
unsigned int stencilFrontEnabled : 1; // 6
unsigned int stencilBackEnabled : 1; // 7
unsigned int stencilFrontPass : 3; // 8-10
unsigned int stencilFrontFail : 3; // 11-13
unsigned int stencilFrontZFail : 3; // 14-16
unsigned int stencilFrontFunc : 3; // 17-19
unsigned int stencilBackPass : 3; // 20-22
unsigned int stencilBackFail : 3; // 23-25
unsigned int stencilBackZFail : 3; // 26-28
unsigned int stencilBackFunc : 3; // 29-31
};
union GfxStateBitsLoadBits
{
unsigned int raw[2];
GfxStateBitsLoadBitsStructured structured;
};
#ifndef __zonecodegenerator
static_assert(sizeof(GfxStateBitsLoadBits) == 8);
static_assert(sizeof(GfxStateBitsLoadBitsStructured) == 8);
#endif
struct GfxStateBits
{
unsigned int loadBits[2];
GfxStateBitsLoadBits loadBits;
};
enum GfxCameraRegionType
{
CAMERA_REGION_LIT = 0x0,
CAMERA_REGION_DECAL = 0x1,
CAMERA_REGION_EMISSIVE = 0x2,
CAMERA_REGION_COUNT,
CAMERA_REGION_NONE = CAMERA_REGION_COUNT,
};
struct Material
@@ -880,8 +1082,8 @@ namespace T5
unsigned char textureCount;
unsigned char constantCount;
unsigned char stateBitsCount;
char stateFlags;
char cameraRegion;
unsigned char stateFlags;
unsigned char cameraRegion;
unsigned char maxStreamedMips;
MaterialTechniqueSet* techniqueSet;
MaterialTextureDef* textureTable;

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes{

View File

@@ -9,12 +9,6 @@ namespace T6
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace T6

View File

@@ -700,6 +700,8 @@ namespace T6
MTL_GAMEFLAG_400 = 0x400,
MTL_GAMEFLAG_800 = 0x800,
MTL_GAMEFLAG_1000 = 0x1000,
MTL_GAMEFLAG_2000 = 0x2000,
MTL_GAMEFLAG_4000 = 0x4000,
};
struct type_align32(8) MaterialInfo
@@ -2765,6 +2767,14 @@ namespace T6
float transWeight;
};
enum XSurfaceFlag
{
XSURFACE_FLAG_QUANTIZED = 0x1,
XSURFACE_FLAG_SKINNED = 0x2,
XSURFACE_FLAG_CONSTANT_COLOR = 0x4,
XSURFACE_FLAG_DEFORMED = 0x80,
};
struct XSurfaceVertexInfo
{
int16_t vertCount[4];