h2-mod/src/game/structs.hpp
2021-04-23 19:11:43 +02:00

714 lines
12 KiB
C++

#pragma once
namespace game
{
typedef float vec_t;
typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
struct gclient_s
{
};
struct client_t
{
char __pad0[13508];
};
struct EntityState
{
char entityNum;
};
struct gentity_s
{
char __pad0[760];
}; // size = 760
struct Material
{
const char* name;
};
struct Glyph
{
unsigned short letter;
char x0;
char y0;
char dx;
char pixelWidth;
char pixelHeight;
float s0;
float t0;
float s1;
float t1;
};
struct Font_s
{
const char* fontName;
int pixelHeight;
int glyphCount;
Material* material;
Material* glowMaterial;
Glyph* glyphs;
};
enum keyNum_t
{
K_NONE = 0x0,
K_FIRSTGAMEPADBUTTON_RANGE_1 = 0x1,
K_BUTTON_A = 0x1,
K_BUTTON_B = 0x2,
K_BUTTON_X = 0x3,
K_BUTTON_Y = 0x4,
K_BUTTON_LSHLDR = 0x5,
K_BUTTON_RSHLDR = 0x6,
K_LASTGAMEPADBUTTON_RANGE_1 = 0x6,
K_BS = 0x8,
K_TAB = 0x9,
K_ENTER = 0xD,
K_FIRSTGAMEPADBUTTON_RANGE_2 = 0xE,
K_BUTTON_START = 0xE,
K_BUTTON_BACK = 0xF,
K_BUTTON_LSTICK = 0x10,
K_BUTTON_RSTICK = 0x11,
K_BUTTON_LTRIG = 0x12,
K_BUTTON_RTRIG = 0x13,
K_DPAD_UP = 0x14,
K_FIRSTDPAD = 0x14,
K_DPAD_DOWN = 0x15,
K_DPAD_LEFT = 0x16,
K_DPAD_RIGHT = 0x17,
K_BUTTON_LSTICK_ALTIMAGE2 = 0x10,
K_BUTTON_RSTICK_ALTIMAGE2 = 0x11,
K_BUTTON_LSTICK_ALTIMAGE = 0xBC,
K_BUTTON_RSTICK_ALTIMAGE = 0xBD,
K_LASTDPAD = 0x17,
K_LASTGAMEPADBUTTON_RANGE_2 = 0x17,
K_ESCAPE = 0x1B,
K_FIRSTGAMEPADBUTTON_RANGE_3 = 0x1C,
K_APAD_UP = 0x1C,
K_FIRSTAPAD = 0x1C,
K_APAD_DOWN = 0x1D,
K_APAD_LEFT = 0x1E,
K_APAD_RIGHT = 0x1F,
K_LASTAPAD = 0x1F,
K_LASTGAMEPADBUTTON_RANGE_3 = 0x1F,
K_SPACE = 0x20,
K_GRAVE = 0x60,
K_TILDE = 0x7E,
K_BACKSPACE = 0x7F,
K_ASCII_FIRST = 0x80,
K_ASCII_181 = 0x80,
K_ASCII_191 = 0x81,
K_ASCII_223 = 0x82,
K_ASCII_224 = 0x83,
K_ASCII_225 = 0x84,
K_ASCII_228 = 0x85,
K_ASCII_229 = 0x86,
K_ASCII_230 = 0x87,
K_ASCII_231 = 0x88,
K_ASCII_232 = 0x89,
K_ASCII_233 = 0x8A,
K_ASCII_236 = 0x8B,
K_ASCII_241 = 0x8C,
K_ASCII_242 = 0x8D,
K_ASCII_243 = 0x8E,
K_ASCII_246 = 0x8F,
K_ASCII_248 = 0x90,
K_ASCII_249 = 0x91,
K_ASCII_250 = 0x92,
K_ASCII_252 = 0x93,
K_END_ASCII_CHARS = 0x94,
K_COMMAND = 0x96,
K_CAPSLOCK = 0x97,
K_POWER = 0x98,
K_PAUSE = 0x99,
K_UPARROW = 0x9A,
K_DOWNARROW = 0x9B,
K_LEFTARROW = 0x9C,
K_RIGHTARROW = 0x9D,
K_ALT = 0x9E,
K_CTRL = 0x9F,
K_SHIFT = 0xA0,
K_INS = 0xA1,
K_DEL = 0xA2,
K_PGDN = 0xA3,
K_PGUP = 0xA4,
K_HOME = 0xA5,
K_END = 0xA6,
K_F1 = 0xA7,
K_F2 = 0xA8,
K_F3 = 0xA9,
K_F4 = 0xAA,
K_F5 = 0xAB,
K_F6 = 0xAC,
K_F7 = 0xAD,
K_F8 = 0xAE,
K_F9 = 0xAF,
K_F10 = 0xB0,
K_F11 = 0xB1,
K_F12 = 0xB2,
K_F13 = 0xB3,
K_F14 = 0xB4,
K_F15 = 0xB5,
K_KP_HOME = 0xB6,
K_KP_UPARROW = 0xB7,
K_KP_PGUP = 0xB8,
K_KP_LEFTARROW = 0xB9,
K_KP_5 = 0xBA,
K_KP_RIGHTARROW = 0xBB,
K_KP_END = 0xBC,
K_KP_DOWNARROW = 0xBD,
K_KP_PGDN = 0xBE,
K_KP_ENTER = 0xBF,
K_KP_INS = 0xC0,
K_KP_DEL = 0xC1,
K_KP_SLASH = 0xC2,
K_KP_MINUS = 0xC3,
K_KP_PLUS = 0xC4,
K_KP_NUMLOCK = 0xC5,
K_KP_STAR = 0xC6,
K_KP_EQUALS = 0xC7,
K_MOUSE1 = 0xC8,
K_MOUSE2 = 0xC9,
K_MOUSE3 = 0xCA,
K_MOUSE4 = 0xCB,
K_MOUSE5 = 0xCC,
K_MWHEELDOWN = 0xCD,
K_MWHEELUP = 0xCE,
K_AUX1 = 0xCF,
K_AUX2 = 0xD0,
K_AUX3 = 0xD1,
K_AUX4 = 0xD2,
K_AUX5 = 0xD3,
K_AUX6 = 0xD4,
K_AUX7 = 0xD5,
K_AUX8 = 0xD6,
K_AUX9 = 0xD7,
K_AUX10 = 0xD8,
K_AUX11 = 0xD9,
K_AUX12 = 0xDA,
K_AUX13 = 0xDB,
K_AUX14 = 0xDC,
K_AUX15 = 0xDD,
K_AUX16 = 0xDE,
K_LAST_KEY = 0xDF
};
struct KeyState
{
int down;
int repeats;
int binding;
};
struct PlayerKeyState
{
int overstrikeMode;
int anyKeyDown;
KeyState keys[256];
};
enum DvarSetSource : std::uint32_t
{
DVAR_SOURCE_INTERNAL = 0x0,
DVAR_SOURCE_EXTERNAL = 0x1,
DVAR_SOURCE_SCRIPT = 0x2,
DVAR_SOURCE_UISCRIPT = 0x3,
DVAR_SOURCE_SERVERCMD = 0x4,
DVAR_SOURCE_NUM = 0x5,
};
enum DvarFlags : std::uint32_t
{
DVAR_FLAG_NONE = 0,
DVAR_FLAG_SAVED = 0x1,
DVAR_FLAG_LATCHED = 0x2,
DVAR_FLAG_CHEAT = 0x4,
DVAR_FLAG_REPLICATED = 0x8,
DVAR_FLAG_WRITE = 0x800,
DVAR_FLAG_READ = 0x2000,
};
enum dvar_type : std::int8_t
{
boolean = 0,
value = 1,
vec2 = 2,
vec3 = 3,
vec4 = 4,
integer = 5,
enumeration = 6,
string = 7,
color = 8,
rgb = 9 // Color without alpha
};
union dvar_value
{
bool enabled;
int integer;
unsigned int unsignedInt;
float value;
float vector[4];
const char* string;
char color[4];
};
struct $A37BA207B3DDD6345C554D4661813EDD
{
int stringCount;
const char* const* strings;
};
struct $9CA192F9DB66A3CB7E01DE78A0DEA53D
{
int min;
int max;
};
struct $251C2428A496074035CACA7AAF3D55BD
{
float min;
float max;
};
union dvar_limits
{
$A37BA207B3DDD6345C554D4661813EDD enumeration;
$9CA192F9DB66A3CB7E01DE78A0DEA53D integer;
$251C2428A496074035CACA7AAF3D55BD value;
$251C2428A496074035CACA7AAF3D55BD vector;
};
struct dvar_t
{
int name; //00
unsigned int flags; //08
dvar_type type; //0C
bool modified; //0D
dvar_value current; //10
dvar_value latched;
dvar_value reset;
dvar_limits domain;
};
struct ScreenPlacement
{
vec2_t scaleVirtualToReal;
vec2_t scaleVirtualToFull;
vec2_t scaleRealToVirtual;
vec2_t realViewportPosition;
vec2_t realViewportSize;
vec2_t virtualViewableMin;
vec2_t virtualViewableMax;
vec2_t realViewableMin;
vec2_t realViewableMax;
vec2_t virtualAdjustableMin;
vec2_t virtualAdjustableMax;
vec2_t realAdjustableMin;
vec2_t realAdjustableMax;
vec2_t subScreenLeft;
};
struct CmdArgs
{
int nesting;
int localClientNum[8];
int controllerIndex[8];
int argc[8];
const char** argv[8];
};
struct cmd_function_s
{
cmd_function_s* next;
const char* name;
void(__cdecl* function)();
};
enum XAssetType
{
ASSET_TYPE_PHYSPRESET,
ASSET_TYPE_PHYSCOLLMAP,
ASSET_TYPE_PHYSWATERPRESET,
ASSET_TYPE_PHYSWORLDMAP,
ASSET_TYPE_PHYSCONSTRAINT,
ASSET_TYPE_XANIMPARTS,
ASSET_TYPE_XMODELSURFS,
ASSET_TYPE_XMODEL,
ASSET_TYPE_MATERIAL,
ASSET_TYPE_COMPUTESHADER,
ASSET_TYPE_VERTEXSHADER,
ASSET_TYPE_HULLSHADER,
ASSET_TYPE_DOMAINSHADER,
ASSET_TYPE_PIXELSHADER,
ASSET_TYPE_VERTEXDECL,
ASSET_TYPE_TECHNIQUE_SET,
ASSET_TYPE_IMAGE,
ASSET_TYPE_SOUND,
ASSET_TYPE_SOUND_SUBMIX,
ASSET_TYPE_SOUND_CURVE,
ASSET_TYPE_LPF_CURVE,
ASSET_TYPE_REVERB_CURVE,
ASSET_TYPE_SOUND_CONTEXT,
ASSET_TYPE_LOADED_SOUND,
ASSET_TYPE_CLIPMAP,
ASSET_TYPE_COMWORLD,
ASSET_TYPE_GLASSWORLD,
ASSET_TYPE_PATHDATA,
ASSET_TYPE_VEHICLE_TRACK,
ASSET_TYPE_MAP_ENTS,
ASSET_TYPE_FXWORLD,
ASSET_TYPE_GFXWORLD,
ASSET_TYPE_LIGHT_DEF,
ASSET_TYPE_UI_MAP,
ASSET_TYPE_FONT,
ASSET_TYPE_MENULIST,
ASSET_TYPE_MENU,
ASSET_TYPE_ANIMCLASS,
ASSET_TYPE_LOCALIZE_ENTRY,
ASSET_TYPE_ATTACHMENT,
ASSET_TYPE_WEAPON,
ASSET_TYPE_SNDDRIVER_GLOBALS,
ASSET_TYPE_FX,
ASSET_TYPE_IMPACT_FX,
ASSET_TYPE_SURFACE_FX,
ASSET_TYPE_AITYPE,
ASSET_TYPE_MPTYPE,
ASSET_TYPE_CHARACTER,
ASSET_TYPE_XMODELALIAS,
ASSET_TYPE_RAWFILE,
ASSET_TYPE_SCRIPTFILE,
ASSET_TYPE_STRINGTABLE,
ASSET_TYPE_LEADERBOARD,
ASSET_TYPE_STRUCTURED_DATA_DEF,
ASSET_TYPE_TRACER,
ASSET_TYPE_VEHICLE,
ASSET_TYPE_ADDON_MAP_ENTS,
ASSET_TYPE_NET_CONST_STRINGS,
ASSET_TYPE_REVERB_PRESET,
ASSET_TYPE_LUA_FILE,
ASSET_TYPE_SCRIPTABLE,
ASSET_TYPE_EQUIPMENT_SND_TABLE,
ASSET_TYPE_VECTORFIELD,
ASSET_TYPE_DOPPLER_PRESET,
ASSET_TYPE_PARTICLE_SIM_ANIMATION,
ASSET_TYPE_LASER,
ASSET_TYPE_SKELETON_SCRIPT,
ASSET_TYPE_CLUT,
ASSET_TYPE_COUNT,
};
struct StreamFileNameRaw
{
const char* dir;
const char* name;
};
struct StreamFileNamePacked
{
unsigned __int64 offset;
unsigned __int64 length;
};
union StreamFileInfo
{
StreamFileNameRaw raw;
StreamFileNamePacked packed;
};
struct StreamFileName
{
unsigned __int16 isLocalized;
unsigned __int16 fileIndex;
StreamFileInfo info;
};
struct StreamedSound
{
StreamFileName filename;
unsigned int totalMsec;
};
union SoundFileRef
{
StreamedSound streamSnd;
};
struct SoundFile
{
char type;
char exists;
SoundFileRef u;
};
struct snd_alias_t
{
const char* aliasName;
char __pad0[24];
SoundFile* soundFile;
char __pad1[198];
// not gonna map this out...
};
struct snd_alias_list_t
{
const char* aliasName;
snd_alias_t* head;
void* unk;
unsigned char count;
unsigned char unkCount;
char __pad0[6];
};
struct RawFile
{
const char* name;
int compressedLen;
int len;
const char* buffer;
};
struct ScriptFile
{
const char* name;
int compressedLen;
int len;
int bytecodeLen;
const char* buffer;
char* bytecode;
};
struct StringTableCell
{
const char* string;
int hash;
};
struct StringTable
{
const char* name;
int columnCount;
int rowCount;
StringTableCell* values;
};
struct LuaFile
{
const char* name;
int len;
char strippingType;
const char* buffer;
};
union XAssetHeader
{
void* data;
Material* material;
Font_s* font;
RawFile* rawfile;
ScriptFile* scriptfile;
StringTable* stringTable;
LuaFile* luaFile;
};
struct XAsset
{
XAssetType type;
XAssetHeader header;
};
struct XAssetEntry
{
XAsset asset;
char zoneIndex;
volatile char inuseMask;
unsigned int nextHash;
unsigned int nextOverride;
unsigned int nextPoolEntry;
};
enum scr_string_t
{
scr_string_t_dummy = 0x0,
};
struct scr_entref_t
{
unsigned short entnum;
unsigned short classnum;
};
enum scriptType_e
{
SCRIPT_NONE = 0,
SCRIPT_OBJECT = 1,
SCRIPT_STRING = 2,
SCRIPT_ISTRING = 3,
SCRIPT_VECTOR = 4,
SCRIPT_FLOAT = 5,
SCRIPT_INTEGER = 6,
SCRIPT_END = 8,
SCRIPT_ARRAY = 22
};
struct VariableStackBuffer
{
const char* pos;
unsigned __int16 size;
unsigned __int16 bufLen;
unsigned __int16 localId;
char time;
char buf[1];
};
union VariableUnion
{
int intValue;
unsigned int uintValue;
float floatValue;
unsigned int stringValue;
const float* vectorValue;
const char* codePosValue;
unsigned int pointerValue;
VariableStackBuffer* stackValue;
unsigned int entityOffset;
};
struct VariableValue
{
VariableUnion u;
int type;
};
struct function_stack_t
{
const char* pos;
unsigned int localId;
unsigned int localVarCount;
VariableValue* top;
VariableValue* startTop;
};
struct function_frame_t
{
function_stack_t fs;
int topType;
};
struct scrVmPub_t
{
unsigned int* localVars;
VariableValue* maxstack;
int function_count;
function_frame_t* function_frame;
VariableValue* top;
unsigned int inparamcount;
unsigned int outparamcount;
function_frame_t function_frame_start[32];
VariableValue stack[2048];
};
struct scr_classStruct_t
{
unsigned __int16 id;
unsigned __int16 entArrayId;
char charId;
const char* name;
};
struct ObjectVariableChildren
{
unsigned __int16 firstChild;
unsigned __int16 lastChild;
};
struct ObjectVariableValue_u_f
{
unsigned __int16 prev;
unsigned __int16 next;
};
union ObjectVariableValue_u_o_u
{
unsigned __int16 size;
unsigned __int16 entnum;
unsigned __int16 nextEntId;
unsigned __int16 self;
};
struct ObjectVariableValue_u_o
{
unsigned __int16 refCount;
ObjectVariableValue_u_o_u u;
};
union ObjectVariableValue_w
{
unsigned int type;
unsigned int classnum;
unsigned int notifyName;
unsigned int waitTime;
unsigned int parentLocalId;
};
struct ChildVariableValue_u_f
{
unsigned __int16 prev;
unsigned __int16 next;
};
union ChildVariableValue_u
{
ChildVariableValue_u_f f;
VariableUnion u;
};
struct ChildBucketMatchKeys_keys
{
unsigned __int16 name_hi;
unsigned __int16 parentId;
};
union ChildBucketMatchKeys
{
ChildBucketMatchKeys_keys keys;
unsigned int match;
};
struct ChildVariableValue
{
ChildVariableValue_u u;
unsigned __int16 next;
char type;
char name_lo;
ChildBucketMatchKeys k;
unsigned __int16 nextSibling;
unsigned __int16 prevSibling;
};
union ObjectVariableValue_u
{
ObjectVariableValue_u_f f;
ObjectVariableValue_u_o o;
};
struct ObjectVariableValue
{
ObjectVariableValue_u u;
ObjectVariableValue_w w;
};
struct scrVarGlob_t
{
ObjectVariableValue objectVariableValue[56320];
ObjectVariableChildren objectVariableChildren[56320];
unsigned __int16 childVariableBucket[65536];
ChildVariableValue childVariableValue[384000];
};
}