#include "../qcommon/qcommon.h"
#define MAX_DLIGHTS 32
#define MAX_ENTITIES 128
#define MAX_LIGHTSTYLES 256
#define POWERSUIT_SCALE 4.0F
#define SHELL_RED_COLOR 0xF2
#define SHELL_GREEN_COLOR 0xD0
#define SHELL_BLUE_COLOR 0xF3
#define SHELL_RG_COLOR 0xDC
#define SHELL_RB_COLOR 0x68
#define SHELL_BG_COLOR 0x78
#define SHELL_DOUBLE_COLOR 0xDF
#define SHELL_HALF_DAM_COLOR 0x90
#define SHELL_CYAN_COLOR 0x72
#define SHELL_WHITE_COLOR 0xD7
struct BaseImage {
char name[MAX_QPATH];
uint32_t width;
uint32_t height;
float s0;
float t0;
float s1;
float t1;
};
typedef struct entity_s {
struct model_s *model; float angles[3];
float origin[3]; int frame;
float oldorigin[3]; int oldframe;
float backlerp; int skinnum;
int lightstyle; float alpha;
struct BaseImage *skin; int flags;
} entity_t;
#define ENTITY_FLAGS 68
typedef struct {
vec3_t origin;
vec3_t color;
float intensity;
} dlight_t;
typedef struct {
float rgb[3]; float white; } lightstyle_t;
typedef struct {
int cmodel_index;
int x, y, width, height; float fov_x, fov_y;
float vieworg[3];
float viewangles[3];
float blend[4]; float time; int rdflags;
byte *areabits;
lightstyle_t *lightstyles;
int num_entities;
entity_t *entities;
int num_dlights;
dlight_t *dlights;
} refdef_t;
#define API_VERSION 3
struct DrawVertex {
float xy[2];
float st[2];
uint8_t rgba[4];
};
typedef struct {
int api_version;
bool (*Init)(void *hinstance, void *wndproc);
void (*Shutdown)(void);
void (*BeginRegistration)(const char *map);
struct model_s *(*RegisterModel)(int cmodel_index, const char *name);
struct BaseImage *(*RegisterSkin)(const char *name);
struct BaseImage *(*RegisterPic)(const char *name);
void (*SetSky)(uint32_t cmodel_index, const char *name, float rotate, vec3_t axis);
void (*EndRegistration)(void);
void (*RenderFrame)(refdef_t *fd);
void (*DrawGetPicSize)(int *w, int *h, const char *name); void (*DrawPic)(int x, int y, const char *name);
void (*DrawStretchPic)(int x, int y, int w, int h, const char *name);
void (*DrawChar)(int x, int y, int c);
void (*DrawTileClear)(int x, int y, int w, int h, const char *name);
void (*DrawFill)(int x, int y, int w, int h, int c);
void (*DrawFadeScreen)(void);
void (*DrawStretchRaw)(int x, int y, int w, int h, int cols, int rows, byte *data);
void (*DrawTriangles)(const struct BaseImage *image, const struct DrawVertex *vertexes, uint32_t num_vertexes,
const uint32_t *indexes, uint32_t num_indexes);
void (*CinematicSetPalette)(const unsigned char *palette); void (*BeginFrame)(float camera_separation);
void (*EndFrame)(void);
void (*AppActivate)(bool activate);
} refexport_t;
typedef struct {
void (*Sys_Error)(int err_level, const char *str, ...);
void (*Cmd_AddCommand)(const char *name, void (*cmd)(void));
void (*Cmd_RemoveCommand)(const char *name);
int (*Cmd_Argc)(void);
char *(*Cmd_Argv)(int i);
void (*Cmd_ExecuteText)(int exec_when, const char *text);
void (*Con_Printf)(int print_level, const char *str, ...);
int (*FS_LoadFile)(const char *name, void **buf);
void (*FS_FreeFile)(void *buf);
const char *(*FS_Gamedir)(void);
cvar_t *(*Cvar_Get)(const char *name, const char *value, int flags);
cvar_t *(*Cvar_Set)(const char *name, const char *value);
void (*Cvar_SetValue)(const char *name, float value);
bool (*Vid_GetModeInfo)(int *width, int *height, int mode);
void (*Vid_MenuInit)(void);
void (*Vid_NewWindow)(int width, int height);
} refimport_t;
typedef refexport_t (*GetRefAPI_t)(refimport_t);