enum DvarSetSource
{
        DVAR_SOURCE_INTERNAL = 0,
        DVAR_SOURCE_EXTERNAL = 1,
        DVAR_SOURCE_SCRIPT = 2
};

union DvarLimits {

        struct
        {
                int stringCount;
                char * * strings;
        } enumeration;
        struct
        {
                int min;
                int max;
        } integer;

        struct
        {
                float min;
                float max;
        } decimal;
};
 
union DvarValue {
        bool enabled;
        int integer;
        unsigned int unsignedInt;
        float value;
        float vector[4];
        char * string;
        byte color[4];
};
 
typedef enum DvarType : char
{
        Dvar_Bool = 0x00,
        Dvar_Float = 0x01,
        Dvar_Vec2 = 0x02,
        Dvar_Vec3 = 0x03,
        Dvar_Vec4 = 0x04,
        Dvar_Int = 0x05,
        Dvar_Enum = 0x06,
        Dvar_String = 0x07,
        Dvar_Color = 0x08,
        Dvar_DevTweak = 0x09
} DvarType;
 
typedef struct dvar_s
{
        char * dvarName;
        short flags;
        DvarType type;
        bool modified;
 
        DvarValue current;
        DvarValue latched;
        DvarValue reset;
        DvarLimits domain;
        dvar_s * next;
} dvar_s;

typedef void (__cdecl * Dvar_SetBoolFromSource_t)(dvar_s * dvar, bool value, DvarSetSource source);
typedef dvar_s * (__cdecl * Dvar_FindVar_t)(const char * dvarName);
typedef bool (*Dvar_GetBool_t)(const char *dvarName);
typedef const char* (*Dvar_GetString_t)(const char* Dvar);
Dvar_SetBoolFromSource_t Dvar_SetBoolFromSource = (Dvar_SetBoolFromSource_t)0x822A04B8;
Dvar_FindVar_t Dvar_FindVar = (Dvar_FindVar_t)0x8229EE40;
Dvar_GetBool_t Dvar_GetBool = (Dvar_GetBool_t)0x8229EF58;
Dvar_GetString_t Dvar_GetString = (Dvar_GetString_t)0x8229F118;