DVARs (BO3)

From COD Engine Research
enum dvarType_t : char
{
  DVAR_TYPE_INVALID = 0x0,
  DVAR_TYPE_BOOL = 0x1,
  DVAR_TYPE_FLOAT = 0x2,
  DVAR_TYPE_FLOAT_2 = 0x3,
  DVAR_TYPE_FLOAT_3 = 0x4,
  DVAR_TYPE_FLOAT_4 = 0x5,
  DVAR_TYPE_INT = 0x6,
  DVAR_TYPE_ENUM = 0x7,
  DVAR_TYPE_STRING = 0x8,
  DVAR_TYPE_COLOR = 0x9,
  DVAR_TYPE_INT64 = 0xA,
  DVAR_TYPE_UINT64 = 0xB,
  DVAR_TYPE_LINEAR_COLOR_RGB = 0xC,
  DVAR_TYPE_COLOR_XYZ = 0xC,
  DVAR_TYPE_COLOR_LAB = 0xD,
  DVAR_TYPE_SESSIONMODE_BASE_DVAR = 0xE,
  DVAR_TYPE_COUNT = 0xF,
};

union DvarLimits
{
  struct {
    int stringCount;
    const char **strings;
  } enumeration;

  struct {
    int min;
    int max;
  } integer;

  struct {
    float min;
    float max;
  } value, vector;

  struct {
    __int64 min;
    __int64 max;
  } integer64;
};

union DvarValue
{
  bool enabled;
  int integer;
  unsigned int unsignedInt;
  __int64 integer64;
  unsigned __int64 unsignedInt64;
  float value;
  vec4_t vector;
  const char *string;
  char color[4];
};

#pragma pack(push, 4)
struct dvar_t
{
  int hash;
  unsigned short flags;
  dvarType_t type; //Note: this is only 1 byte now
  bool modified;
  DvarValue current;
  DvarValue latched;
  DvarValue reset;
  DvarLimits domain;
  dvar_t *hashNext;
	int unknown3;
};
#pragma pack(pop)