|
|
1.1 root 1:
2: #include "../qcommon/qcommon.h"
3: #define MAX_DLIGHTS 32
4: #define MAX_ENTITIES 128
5: #define MAX_PARTICLES 4096
6: #define MAX_LIGHTSTYLES 256
7: #define POWERSUIT_SCALE 4.0F
8: #define SHELL_RED_COLOR 0xF2
9: #define SHELL_GREEN_COLOR 0xD0
10: #define SHELL_BLUE_COLOR 0xF3
11: #define SHELL_RG_COLOR 0xDC
12: #define SHELL_RB_COLOR 0x86
13: #define SHELL_BG_COLOR 0x78
14: #define SHELL_WHITE_COLOR 0xD7
15: typedef struct entity_s
16: {
17: struct model_s *model; // opaque type outside refresh
18: float angles[3];
19: /*
20: ** most recent data
21: */
22: float origin[3]; // also used as RF_BEAM's "from"
23: int frame; // also used as RF_BEAM's diameter
24: /*
25: ** previous data for lerping
26: */
27: float oldorigin[3]; // also used as RF_BEAM's "to"
28: int oldframe;
29: /*
30: ** misc
31: */
32: float backlerp; // 0.0 = current, 1.0 = old
33: int skinnum; // also used as RF_BEAM's palette index
34: int lightstyle; // for flashing entities
35: float alpha; // ignore if RF_TRANSLUCENT isn't set
36: struct image_s *skin; // NULL for inline skin
37: int flags;
38: } entity_t;
39: #define ENTITY_FLAGS 68
40: typedef struct
41: {
42: vec3_t origin;
43: vec3_t color;
44: float intensity;
45: } dlight_t;
46: typedef struct
47: {
48: vec3_t origin;
49: int color;
50: float alpha;
51: } particle_t;
52: typedef struct
53: {
54: float rgb[3]; // 0.0 - 2.0
55: float white; // highest of rgb
56: } lightstyle_t;
57: typedef struct
58: {
59: int x, y, width, height;// in virtual screen coordinates
60: float fov_x, fov_y;
61: float vieworg[3];
62: float viewangles[3];
63: float blend[4]; // rgba 0-1 full screen blend
64: float time; // time is uesed to auto animate
65: int rdflags; // RDF_UNDERWATER, etc
66: byte *areabits; // if not NULL, only areas with set bits will be drawn
67: lightstyle_t *lightstyles; // [MAX_LIGHTSTYLES]
68: int num_entities;
69: entity_t *entities;
70: int num_dlights;
71: dlight_t *dlights;
72: int num_particles;
73: particle_t *particles;
74: } refdef_t;
75: #define API_VERSION 3
76: //
77: // these are the functions exported by the refresh module
78: //
79: typedef struct
80: {
81: // if api_version is different, the dll cannot be used
82: int api_version;
83: // called when the library is loaded
84: qboolean (*Init) ( void *hinstance, void *wndproc );
85: // called before the library is unloaded
86: void (*Shutdown) (void);
87: // All data that will be used in a level should be
88: // registered before rendering any frames to prevent disk hits,
89: // but they can still be registered at a later time
90: // if necessary.
91: //
92: // EndRegistration will free any remaining data that wasn't registered.
93: // Any model_s or skin_s pointers from before the BeginRegistration
94: // are no longer valid after EndRegistration.
95: //
96: // Skins and images need to be differentiated, because skins
97: // are flood filled to eliminate mip map edge errors, and pics have
98: // an implicit "pics/" prepended to the name. (a pic name that starts with a
99: // slash will not use the "pics/" prefix or the ".pcx" postfix)
100: void (*BeginRegistration) (char *map);
101: struct model_s *(*RegisterModel) (char *name);
102: struct image_s *(*RegisterSkin) (char *name);
103: struct image_s *(*RegisterPic) (char *name);
104: void (*SetSky) (char *name, float rotate, vec3_t axis);
105: void (*EndRegistration) (void);
106: void (*RenderFrame) (refdef_t *fd);
107: void (*DrawGetPicSize) (int *w, int *h, char *name); // will return 0 0 if not found
108: void (*DrawPic) (int x, int y, char *name);
109: void (*DrawStretchPic) (int x, int y, int w, int h, char *name);
110: void (*DrawChar) (int x, int y, int c);
111: void (*DrawTileClear) (int x, int y, int w, int h, char *name);
112: void (*DrawFill) (int x, int y, int w, int h, int c);
113: void (*DrawFadeScreen) (void);
114: // Draw images for cinematic rendering (which can have a different palette). Note that calls
115: void (*DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, byte *data);
116: /*
117: ** video mode and refresh state management entry points
118: */
119: void (*CinematicSetPalette)( const unsigned char *palette); // NULL = game palette
120: void (*BeginFrame)( float camera_separation );
121: void (*EndFrame) (void);
122: void (*AppActivate)( qboolean activate );
123: } refexport_t;
124: //
125: // these are the functions imported by the refresh module
126: //
127: typedef struct
128: {
129: void (*Sys_Error) (int err_level, char *str, ...);
130: void (*Cmd_AddCommand) (char *name, void(*cmd)(void));
131: void (*Cmd_RemoveCommand) (char *name);
132: int (*Cmd_Argc) (void);
133: char *(*Cmd_Argv) (int i);
134: void (*Cmd_ExecuteText) (int exec_when, char *text);
135: void (*Con_Printf) (int print_level, char *str, ...);
136: // files will be memory mapped read only
137: // the returned buffer may be part of a larger pak file,
138: // or a discrete file from anywhere in the quake search path
139: // a -1 return means the file does not exist
140: // NULL can be passed for buf to just determine existance
141: int (*FS_LoadFile) (char *name, void **buf);
142: void (*FS_FreeFile) (void *buf);
143: // gamedir will be the current directory that generated
144: // files should be stored to, ie: "f:\quake\id1"
145: char *(*FS_Gamedir) (void);
146: cvar_t *(*Cvar_Get) (char *name, char *value, int flags);
147: cvar_t *(*Cvar_Set)( char *name, char *value );
148: void (*Cvar_SetValue)( char *name, float value );
149: qboolean (*Vid_GetModeInfo)( int *width, int *height, int mode );
150: void (*Vid_MenuInit)( void );
151: void (*Vid_NewWindow)( int width, int height );
152: } refimport_t;
153: // this is the only function actually exported at the linker level
154: typedef refexport_t (*GetRefAPI_t) (refimport_t);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.