1 /* 2 Copyright (C) 1997-2001 Id Software, Inc. 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 */ 19 20 // 21 // r_public.h 22 // Client-refresh global header 23 // 24 25 #include "../common/common.h" 26 #include "../cgame/cg_shared.h" 27 28 #ifndef __REFRESH_H__ 29 #define __REFRESH_H__ 30 31 /* 32 ============================================================================= 33 34 CINEMATIC PLAYBACK 35 36 ============================================================================= 37 */ 38 39 #define RoQ_HEADER1 4228 40 #define RoQ_HEADER2 -1 41 #define RoQ_HEADER3 30 42 43 #define RoQ_FRAMERATE 30 44 45 #define RoQ_INFO 0x1001 46 #define RoQ_QUAD_CODEBOOK 0x1002 47 #define RoQ_QUAD_VQ 0x1011 48 #define RoQ_SOUND_MONO 0x1020 49 #define RoQ_SOUND_STEREO 0x1021 50 51 #define RoQ_ID_MOT 0x00 52 #define RoQ_ID_FCC 0x01 53 #define RoQ_ID_SLD 0x02 54 #define RoQ_ID_CCC 0x03 55 56 typedef struct roqChunk_s { 57 uint16 id; 58 uint32 size; 59 uint16 arg; 60 } roqChunk_t; 61 62 typedef struct roqCell_s { 63 byte y[4], u, v; 64 } roqCell_t; 65 66 typedef struct roqQCell_s { 67 byte idx[4]; 68 } roqQCell_t; 69 70 typedef struct cinematic_s { 71 int time; 72 int frameNum; 73 74 fileHandle_t fileNum; // File handle to the open cinematic 75 76 byte *frames[2]; 77 78 int width; // Width of the cinematic 79 int height; // Height of the cinematic 80 uint32 *vidBuffer; // Written to for rendering each frame 81 82 // Audio settings 83 qBool sndRestart; 84 85 byte *sndBuffer; 86 int sndRate; 87 int sndWidth; 88 int sndChannels; 89 90 struct channel_s *sndRawChannel; 91 qBool sndAL; 92 93 // RoQ information 94 roqChunk_t roqChunk; 95 roqCell_t roqCells[256]; 96 roqQCell_t roqQCells[256]; 97 98 byte *roqBuffer; 99 100 // Cinematic information 101 uint32 hPalette[256]; 102 103 byte *hBuffer; // Buffer for decompression 104 int *hNodes; 105 int hNumNodes[256]; 106 107 int hUsed[512]; 108 int hCount[512]; 109 } cinematic_t; 110 111 /* 112 ============================================================================= 113 114 FUNCTION PROTOTYPES 115 116 ============================================================================= 117 */ 118 119 // 120 // rf_2d.c 121 // 122 123 void R_DrawPic (struct shader_s *shader, float shaderTime, float x, float y, int w, int h, float s1, float t1, float s2, float t2, vec4_t color); 124 void R_DrawRectangle (struct shader_s *shader, float shaderTime, vec2_t tl, vec2_t tr, vec2_t br, vec2_t bl, float s1, float t1, float s2, float t2, vec4_t color); 125 126 // 127 // rf_cull.c 128 // 129 130 qBool R_CullBox (vec3_t mins, vec3_t maxs, int clipFlags); 131 qBool R_CullSphere (const vec3_t origin, const float radius, int clipFlags); 132 133 // 134 // rf_decal.c 135 // 136 137 qBool R_CreateDecal (refDecal_t *d, vec3_t origin, vec3_t direction, float angle, float size); 138 qBool R_FreeDecal (refDecal_t *d); 139 140 // 141 // rf_font.c 142 // 143 144 struct font_s *R_RegisterFont (char *name); 145 void R_GetFontDimensions (struct font_s *font, float xScale, float yScale, uint32 flags, vec2_t dest); 146 147 void R_DrawChar (struct font_s *font, float x, float y, float xScale, float yScale, uint32 flags, int num, vec4_t color); 148 int R_DrawString (struct font_s *font, float x, float y, float xScale, float yScale, uint32 flags, char *string, vec4_t color); 149 int R_DrawStringLen (struct font_s *font, float x, float y, float xScale, float yScale, uint32 flags, char *string, int len, vec4_t color); 150 151 // 152 // rf_image.c 153 // 154 155 qBool R_UpdateTexture (char *name, byte *data, int width, int height); 156 void R_GetImageSize (struct shader_s *shader, int *width, int *height); 157 158 // 159 // rf_init.c 160 // 161 162 void R_MediaInit (void); 163 164 typedef enum { 165 R_INIT_QGL_FAIL, 166 R_INIT_OS_FAIL, 167 R_INIT_MODE_FAIL, 168 R_INIT_SUCCESS 169 } rInit_t; 170 rInit_t R_Init (void); 171 void R_Shutdown (qBool full); 172 173 // 174 // rf_light.c 175 // 176 177 void R_LightPoint (vec3_t point, vec3_t light); 178 179 // 180 // rf_main.c 181 // 182 183 void R_RenderScene (refDef_t *rd); 184 void R_BeginFrame (float cameraSeparation); 185 void R_EndFrame (void); 186 187 void R_ClearScene (void); 188 189 void R_AddDecal (refDecal_t *decal, bvec4_t color, struct shader_s *material, float materialTime); 190 void R_AddEntity (refEntity_t *ent); 191 void R_AddPoly (refPoly_t *poly); 192 void R_AddLight (vec3_t org, float intensity, float r, float g, float b); 193 void R_AddLightStyle (int style, float r, float g, float b); 194 195 void R_GetRefConfig (refConfig_t *outConfig); 196 197 void R_TransformVectorToScreen (refDef_t *rd, vec3_t in, vec2_t out); 198 199 void R_BeginRegistration (void); 200 void R_EndRegistration (void); 201 202 // 203 // rf_model.c 204 // 205 206 void R_RegisterMap (char *mapName); 207 struct refModel_s *R_RegisterModel (char *name); 208 void R_ModelBounds (struct refModel_s *model, vec3_t mins, vec3_t maxs); 209 210 // 211 // rf_shader.c 212 // 213 214 struct shader_s *R_RegisterPic (char *name); 215 struct shader_s *R_RegisterPoly (char *name); 216 struct shader_s *R_RegisterSkin (char *name); 217 218 // 219 // rf_sky.c 220 // 221 222 void R_SetSky (char *name, float rotate, vec3_t axis); 223 224 #endif // __REFRESH_H__ 225