]> icculus.org git repositories - divverent/darkplaces.git/blob - vid_shared.c
added a qtypes.h for little things like qbyte and such
[divverent/darkplaces.git] / vid_shared.c
1
2 #include "quakedef.h"
3
4 // LordHavoc: these are only set in wgl
5 qboolean isG200 = false; // LordHavoc: the Matrox G200 can't do per pixel alpha, and it uses a D3D driver for GL... ugh...
6 qboolean isRagePro = false; // LordHavoc: the ATI Rage Pro has limitations with per pixel alpha (the color scaler does not apply to per pixel alpha images...), although not as bad as a G200.
7
8 // LordHavoc: GL_ARB_multitexture support
9 int gl_textureunits;
10 // LordHavoc: GL_ARB_texture_env_combine or GL_EXT_texture_env_combine support
11 int gl_combine_extension = false;
12 // LordHavoc: GL_EXT_compiled_vertex_array support
13 int gl_supportslockarrays = false;
14
15 int gl_maxdrawrangeelementsvertices;
16 int gl_maxdrawrangeelementsindices;
17
18 cvar_t vid_mode = {0, "vid_mode", "0"};
19 cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1"};
20 cvar_t vid_fullscreen = {0, "vid_fullscreen", "1"};
21 cvar_t gl_combine = {0, "gl_combine", "1"};
22
23 cvar_t in_pitch_min = {0, "in_pitch_min", "-90"};
24 cvar_t in_pitch_max = {0, "in_pitch_max", "90"};
25
26 cvar_t m_filter = {CVAR_SAVE, "m_filter","0"};
27
28 // GL_ARB_multitexture
29 void (GLAPIENTRY *qglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
30 void (GLAPIENTRY *qglActiveTexture) (GLenum);
31 void (GLAPIENTRY *qglClientActiveTexture) (GLenum);
32
33 // GL_EXT_compiled_vertex_array
34 void (GLAPIENTRY *qglLockArraysEXT) (GLint first, GLint count);
35 void (GLAPIENTRY *qglUnlockArraysEXT) (void);
36
37
38 // general GL functions
39
40 void (GLAPIENTRY *qglClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
41
42 void (GLAPIENTRY *qglClear)(GLbitfield mask);
43
44 //void (GLAPIENTRY *qglAlphaFunc)(GLenum func, GLclampf ref);
45 void (GLAPIENTRY *qglBlendFunc)(GLenum sfactor, GLenum dfactor);
46 void (GLAPIENTRY *qglCullFace)(GLenum mode);
47
48 void (GLAPIENTRY *qglDrawBuffer)(GLenum mode);
49 void (GLAPIENTRY *qglReadBuffer)(GLenum mode);
50 void (GLAPIENTRY *qglEnable)(GLenum cap);
51 void (GLAPIENTRY *qglDisable)(GLenum cap);
52 //GLboolean GLAPIENTRY *qglIsEnabled)(GLenum cap);
53
54 void (GLAPIENTRY *qglEnableClientState)(GLenum cap);
55 void (GLAPIENTRY *qglDisableClientState)(GLenum cap);
56
57 //void (GLAPIENTRY *qglGetBooleanv)(GLenum pname, GLboolean *params);
58 //void (GLAPIENTRY *qglGetDoublev)(GLenum pname, GLdouble *params);
59 //void (GLAPIENTRY *qglGetFloatv)(GLenum pname, GLfloat *params);
60 void (GLAPIENTRY *qglGetIntegerv)(GLenum pname, GLint *params);
61
62 GLenum (GLAPIENTRY *qglGetError)(void);
63 const GLubyte* (GLAPIENTRY *qglGetString)(GLenum name);
64 void (GLAPIENTRY *qglFinish)(void);
65 void (GLAPIENTRY *qglFlush)(void);
66
67 void (GLAPIENTRY *qglClearDepth)(GLclampd depth);
68 void (GLAPIENTRY *qglDepthFunc)(GLenum func);
69 void (GLAPIENTRY *qglDepthMask)(GLboolean flag);
70 void (GLAPIENTRY *qglDepthRange)(GLclampd near_val, GLclampd far_val);
71
72 void (GLAPIENTRY *qglDrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
73 void (GLAPIENTRY *qglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
74 void (GLAPIENTRY *qglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
75 //void (GLAPIENTRY *qglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *ptr);
76 void (GLAPIENTRY *qglColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
77 void (GLAPIENTRY *qglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
78 void (GLAPIENTRY *qglArrayElement)(GLint i);
79
80 void (GLAPIENTRY *qglColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
81 void (GLAPIENTRY *qglTexCoord2f)(GLfloat s, GLfloat t);
82 void (GLAPIENTRY *qglVertex2f)(GLfloat x, GLfloat y);
83 void (GLAPIENTRY *qglVertex3f)(GLfloat x, GLfloat y, GLfloat z);
84 void (GLAPIENTRY *qglBegin)(GLenum mode);
85 void (GLAPIENTRY *qglEnd)(void);
86
87 void (GLAPIENTRY *qglMatrixMode)(GLenum mode);
88 void (GLAPIENTRY *qglOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
89 void (GLAPIENTRY *qglFrustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
90 void (GLAPIENTRY *qglViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
91 //void (GLAPIENTRY *qglPushMatrix)(void);
92 //void (GLAPIENTRY *qglPopMatrix)(void);
93 void (GLAPIENTRY *qglLoadIdentity)(void);
94 //void (GLAPIENTRY *qglLoadMatrixd)(const GLdouble *m);
95 //void (GLAPIENTRY *qglLoadMatrixf)(const GLfloat *m);
96 //void (GLAPIENTRY *qglMultMatrixd)(const GLdouble *m);
97 //void (GLAPIENTRY *qglMultMatrixf)(const GLfloat *m);
98 //void (GLAPIENTRY *qglRotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
99 void (GLAPIENTRY *qglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
100 //void (GLAPIENTRY *qglScaled)(GLdouble x, GLdouble y, GLdouble z);
101 //void (GLAPIENTRY *qglScalef)(GLfloat x, GLfloat y, GLfloat z);
102 //void (GLAPIENTRY *qglTranslated)(GLdouble x, GLdouble y, GLdouble z);
103 void (GLAPIENTRY *qglTranslatef)(GLfloat x, GLfloat y, GLfloat z);
104
105 void (GLAPIENTRY *qglReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
106
107 //void (GLAPIENTRY *qglStencilFunc)(GLenum func, GLint ref, GLuint mask);
108 //void (GLAPIENTRY *qglStencilMask)(GLuint mask);
109 //void (GLAPIENTRY *qglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
110 //void (GLAPIENTRY *qglClearStencil)(GLint s);
111
112 //void (GLAPIENTRY *qglTexEnvf)(GLenum target, GLenum pname, GLfloat param);
113 void (GLAPIENTRY *qglTexEnvi)(GLenum target, GLenum pname, GLint param);
114
115 //void (GLAPIENTRY *qglTexParameterf)(GLenum target, GLenum pname, GLfloat param);
116 void (GLAPIENTRY *qglTexParameteri)(GLenum target, GLenum pname, GLint param);
117
118 void (GLAPIENTRY *qglBindTexture)(GLenum target, GLuint texture);
119 void (GLAPIENTRY *qglTexImage2D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
120 void (GLAPIENTRY *qglTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
121 void (GLAPIENTRY *qglDeleteTextures)(GLsizei n, const GLuint *textures);
122
123 void (GLAPIENTRY *qglDrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
124
125 //void (GLAPIENTRY *qglColorTableEXT)(int, int, int, int, int, const void *);
126
127 #if WIN32
128 int (WINAPI *qwglChoosePixelFormat)(HDC, CONST PIXELFORMATDESCRIPTOR *);
129 int (WINAPI *qwglDescribePixelFormat)(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
130 //int (WINAPI *qwglGetPixelFormat)(HDC);
131 BOOL (WINAPI *qwglSetPixelFormat)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
132 BOOL (WINAPI *qwglSwapBuffers)(HDC);
133 HGLRC (WINAPI *qwglCreateContext)(HDC);
134 BOOL (WINAPI *qwglDeleteContext)(HGLRC);
135 PROC (WINAPI *qwglGetProcAddress)(LPCSTR);
136 BOOL (WINAPI *qwglMakeCurrent)(HDC, HGLRC);
137 //BOOL (WINAPI *qwglSwapIntervalEXT)(int interval);
138 #endif
139
140
141 typedef struct
142 {
143         char *name;
144         void **funcvariable;
145 }
146 gl_extensionfunctionlist_t;
147
148 typedef struct
149 {
150         char *name;
151         gl_extensionfunctionlist_t *funcs;
152         int *enablevariable;
153         char *disableparm;
154 }
155 gl_extensioninfo_t;
156
157 #if WIN32
158 static gl_extensionfunctionlist_t wglfuncs[] =
159 {
160         {"wglChoosePixelFormat", (void **) &qwglChoosePixelFormat},
161         {"wglDescribePixelFormat", (void **) &qwglDescribePixelFormat},
162 //      {"wglGetPixelFormat", (void **) &qwglGetPixelFormat},
163         {"wglSetPixelFormat", (void **) &qwglSetPixelFormat},
164         {"wglSwapBuffers", (void **) &qwglSwapBuffers},
165         {"wglCreateContext", (void **) &qwglCreateContext},
166         {"wglDeleteContext", (void **) &qwglDeleteContext},
167         {"wglGetProcAddress", (void **) &qwglGetProcAddress},
168         {"wglMakeCurrent", (void **) &qwglMakeCurrent},
169         {NULL, NULL}
170 };
171
172 /*
173 static gl_extensionfunctionlist_t wglswapintervalfuncs[] =
174 {
175         {"wglSwapIntervalEXT", (void **) &qwglSwapIntervalEXT},
176         {NULL, NULL}
177 };
178 */
179 #endif
180
181 static gl_extensionfunctionlist_t opengl110funcs[] =
182 {
183         {"glClearColor", (void **) &qglClearColor},
184         {"glClear", (void **) &qglClear},
185 //      {"glAlphaFunc", (void **) &qglAlphaFunc},
186         {"glBlendFunc", (void **) &qglBlendFunc},
187         {"glCullFace", (void **) &qglCullFace},
188         {"glDrawBuffer", (void **) &qglDrawBuffer},
189         {"glReadBuffer", (void **) &qglReadBuffer},
190         {"glEnable", (void **) &qglEnable},
191         {"glDisable", (void **) &qglDisable},
192 //      {"glIsEnabled", (void **) &qglIsEnabled},
193         {"glEnableClientState", (void **) &qglEnableClientState},
194         {"glDisableClientState", (void **) &qglDisableClientState},
195 //      {"glGetBooleanv", (void **) &qglGetBooleanv},
196 //      {"glGetDoublev", (void **) &qglGetDoublev},
197 //      {"glGetFloatv", (void **) &qglGetFloatv},
198         {"glGetIntegerv", (void **) &qglGetIntegerv},
199         {"glGetError", (void **) &qglGetError},
200         {"glGetString", (void **) &qglGetString},
201         {"glFinish", (void **) &qglFinish},
202         {"glFlush", (void **) &qglFlush},
203         {"glClearDepth", (void **) &qglClearDepth},
204         {"glDepthFunc", (void **) &qglDepthFunc},
205         {"glDepthMask", (void **) &qglDepthMask},
206         {"glDepthRange", (void **) &qglDepthRange},
207         {"glDrawElements", (void **) &qglDrawElements},
208         {"glVertexPointer", (void **) &qglVertexPointer},
209 //      {"glNormalPointer", (void **) &qglNormalPointer},
210         {"glColorPointer", (void **) &qglColorPointer},
211         {"glTexCoordPointer", (void **) &qglTexCoordPointer},
212         {"glArrayElement", (void **) &qglArrayElement},
213         {"glColor4ub", (void **) &qglColor4ub},
214         {"glTexCoord2f", (void **) &qglTexCoord2f},
215         {"glVertex2f", (void **) &qglVertex2f},
216         {"glVertex3f", (void **) &qglVertex3f},
217         {"glBegin", (void **) &qglBegin},
218         {"glEnd", (void **) &qglEnd},
219         {"glMatrixMode", (void **) &qglMatrixMode},
220         {"glOrtho", (void **) &qglOrtho},
221         {"glFrustum", (void **) &qglFrustum},
222         {"glViewport", (void **) &qglViewport},
223 //      {"glPushMatrix", (void **) &qglPushMatrix},
224 //      {"glPopMatrix", (void **) &qglPopMatrix},
225         {"glLoadIdentity", (void **) &qglLoadIdentity},
226 //      {"glLoadMatrixd", (void **) &qglLoadMatrixd},
227 //      {"glLoadMatrixf", (void **) &qglLoadMatrixf},
228 //      {"glMultMatrixd", (void **) &qglMultMatrixd},
229 //      {"glMultMatrixf", (void **) &qglMultMatrixf},
230 //      {"glRotated", (void **) &qglRotated},
231         {"glRotatef", (void **) &qglRotatef},
232 //      {"glScaled", (void **) &qglScaled},
233 //      {"glScalef", (void **) &qglScalef},
234 //      {"glTranslated", (void **) &qglTranslated},
235         {"glTranslatef", (void **) &qglTranslatef},
236         {"glReadPixels", (void **) &qglReadPixels},
237 //      {"glStencilFunc", (void **) &qglStencilFunc},
238 //      {"glStencilMask", (void **) &qglStencilMask},
239 //      {"glStencilOp", (void **) &qglStencilOp},
240 //      {"glClearStencil", (void **) &qglClearStencil},
241 //      {"glTexEnvf", (void **) &qglTexEnvf},
242         {"glTexEnvi", (void **) &qglTexEnvi},
243 //      {"glTexParameterf", (void **) &qglTexParameterf},
244         {"glTexParameteri", (void **) &qglTexParameteri},
245         {"glBindTexture", (void **) &qglBindTexture},
246         {"glTexImage2D", (void **) &qglTexImage2D},
247         {"glTexSubImage2D", (void **) &qglTexSubImage2D},
248         {"glDeleteTextures", (void **) &qglDeleteTextures},
249         {NULL, NULL}
250 };
251
252 static gl_extensionfunctionlist_t drawrangeelementsfuncs[] =
253 {
254         {"glDrawRangeElements", (void **) &qglDrawRangeElements},
255         {NULL, NULL}
256 };
257
258 static gl_extensionfunctionlist_t drawrangeelementsextfuncs[] =
259 {
260         {"glDrawRangeElementsEXT", (void **) &qglDrawRangeElementsEXT},
261         {NULL, NULL}
262 };
263
264 static gl_extensionfunctionlist_t multitexturefuncs[] =
265 {
266         {"glMultiTexCoord2fARB", (void **) &qglMultiTexCoord2f},
267         {"glActiveTextureARB", (void **) &qglActiveTexture},
268         {"glClientActiveTextureARB", (void **) &qglClientActiveTexture},
269         {NULL, NULL}
270 };
271
272 static gl_extensionfunctionlist_t compiledvertexarrayfuncs[] =
273 {
274         {"glLockArraysEXT", (void **) &qglLockArraysEXT},
275         {"glUnlockArraysEXT", (void **) &qglUnlockArraysEXT},
276         {NULL, NULL}
277 };
278
279 #ifndef WIN32
280 #include <dlfcn.h>
281 #endif
282
283 #ifdef WIN32
284 static HINSTANCE gldll;
285 #else
286 static void *prjobj = NULL;
287 #endif
288
289 static void gl_getfuncs_begin(void)
290 {
291 #ifdef WIN32
292         gldll = LoadLibrary("opengl32.dll");
293 #else
294         if (prjobj)
295                 dlclose(prjobj);
296
297         prjobj = dlopen(NULL, RTLD_LAZY);
298         if (prjobj == NULL)
299         {
300                 Con_Printf("Unable to open symbol list for main program.\n");
301                 return;
302         }
303 #endif
304 }
305
306 static void gl_getfuncs_end(void)
307 {
308 #ifdef WIN32
309         FreeLibrary(gldll);
310 #else
311         if (prjobj)
312                 dlclose(prjobj);
313         prjobj = NULL;
314 #endif
315 }
316
317 static void *gl_getfuncaddress(char *name)
318 {
319         void *p = NULL;
320 #ifdef WIN32
321         if (qwglGetProcAddress != NULL)
322                 p = (void *) qwglGetProcAddress(name);
323         if (p == NULL)
324                 p = (void *) GetProcAddress(gldll, name);
325 #else
326         p = (void *) dlsym(prjobj, name);
327 #endif
328         return p;
329 }
330
331 static int gl_checkextension(char *name, gl_extensionfunctionlist_t *funcs, char *disableparm, int silent)
332 {
333         int failed = false;
334         gl_extensionfunctionlist_t *func;
335
336         Con_Printf("checking for %s...  ", name);
337
338         for (func = funcs;func && func->name;func++)
339                 *func->funcvariable = NULL;
340
341         if (disableparm && COM_CheckParm(disableparm))
342         {
343                 Con_Printf("disabled by commandline\n");
344                 return false;
345         }
346
347         if (strncmp(name, "GL_", 3) || strstr(gl_extensions, name))
348         {
349                 for (func = funcs;func && func->name != NULL;func++)
350                 {
351                         // functions are cleared before all the extensions are evaluated
352                         if (!(*func->funcvariable = (void *) gl_getfuncaddress(func->name)))
353                         {
354                                 if (!silent)
355                                         Con_Printf("missing function \"%s\" - broken driver!\n", func->name);
356                                 failed = true;
357                         }
358                 }
359                 // delay the return so it prints all missing functions
360                 if (failed)
361                         return false;
362                 Con_Printf("enabled\n");
363                 return true;
364         }
365         else
366         {
367                 Con_Printf("not detected\n");
368                 return false;
369         }
370 }
371
372 void VID_CheckExtensions(void)
373 {
374         Con_Printf("Checking OpenGL extensions...\n");
375
376         gl_getfuncs_begin();
377
378         gl_combine_extension = false;
379         gl_supportslockarrays = false;
380         gl_textureunits = 1;
381
382 #if WIN32
383         if (!gl_checkextension("wgl", wglfuncs, NULL, false))
384                 Sys_Error("wgl functions not found\n");
385         //gl_checkextension("wglSwapIntervalEXT", wglswapintervalfuncs, NULL, false);
386 #endif
387
388         if (!gl_checkextension("OpenGL 1.1.0", opengl110funcs, NULL, false))
389                 Sys_Error("OpenGL 1.1.0 functions not found\n");
390
391         if (gl_checkextension("glDrawRangeElements", drawrangeelementsfuncs, "-nodrawrangeelements", true)
392          || gl_checkextension("GL_EXT_draw_range_elements", drawrangeelementsextfuncs, "-nodrawrangeelements", true))
393         {
394                 qglGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &gl_maxdrawrangeelementsvertices);
395                 qglGetIntegerv(GL_MAX_ELEMENTS_INDICES, &gl_maxdrawrangeelementsindices);
396
397                 if (gl_maxdrawrangeelementsvertices < 1 || gl_maxdrawrangeelementsindices < 1)
398                 {
399                         Con_Printf("invalid GL_MAX_ELEMENTS_VERTICES (%i) and/or GL_MAX_ELEMENTS_INDICES (%i)\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices);
400                         qglDrawRangeElements = qglDrawRangeElementsEXT = NULL;
401                 }
402         }
403
404         if (gl_checkextension("GL_ARB_multitexture", multitexturefuncs, "-nomtex", false))
405         {
406                 qglGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_textureunits);
407                 if (gl_textureunits > 1)
408                         gl_combine_extension = gl_checkextension("GL_ARB_texture_env_combine", NULL, "-nocombine", false) || gl_checkextension("GL_EXT_texture_env_combine", NULL, "-nocombine", false);
409                 else
410                 {
411                         Con_Printf("GL_ARB_multitexture with less than 2 units? - BROKEN DRIVER!\n");
412                         gl_textureunits = 1; // for sanity sake, make sure it's not 0
413                 }
414         }
415
416         gl_supportslockarrays = gl_checkextension("GL_EXT_compiled_vertex_array", compiledvertexarrayfuncs, "-nocva", false);
417
418         gl_getfuncs_end();
419
420         // we don't care if it's an extension or not, they are identical functions, so keep it simple in the rendering code
421         if (qglDrawRangeElements == NULL)
422                 qglDrawRangeElements = qglDrawRangeElementsEXT;
423 }
424
425 void Force_CenterView_f (void)
426 {
427         cl.viewangles[PITCH] = 0;
428 }
429
430 void IN_PreMove(void)
431 {
432 }
433
434 void CL_AdjustAngles(void);
435 void IN_PostMove(void)
436 {
437         // clamp after the move as well to prevent messed up rendering angles
438         CL_AdjustAngles();
439 }
440
441 void IN_Mouse(usercmd_t *cmd, float mx, float my)
442 {
443         int mouselook = (in_mlook.state & 1) || freelook.integer;
444         float mouse_x, mouse_y;
445         static float old_mouse_x = 0, old_mouse_y = 0;
446
447         if (m_filter.integer)
448         {
449                 mouse_x = (mx + old_mouse_x) * 0.5;
450                 mouse_y = (my + old_mouse_y) * 0.5;
451         }
452         else
453         {
454                 mouse_x = mx;
455                 mouse_y = my;
456         }
457
458         old_mouse_x = mx;
459         old_mouse_y = my;
460
461         // LordHavoc: viewzoom affects mouse sensitivity for sniping
462         mouse_x *= sensitivity.value * cl.viewzoom;
463         mouse_y *= sensitivity.value * cl.viewzoom;
464
465         // Add mouse X/Y movement to cmd
466         if ((in_strafe.state & 1) || (lookstrafe.integer && mouselook))
467                 cmd->sidemove += m_side.value * mouse_x;
468         else
469                 cl.viewangles[YAW] -= m_yaw.value * mouse_x;
470
471         if (mouselook)
472                 V_StopPitchDrift();
473
474         if (mouselook && !(in_strafe.state & 1))
475                 cl.viewangles[PITCH] += m_pitch.value * mouse_y;
476         else
477         {
478                 if ((in_strafe.state & 1) && noclip_anglehack)
479                         cmd->upmove -= m_forward.value * mouse_y;
480                 else
481                         cmd->forwardmove -= m_forward.value * mouse_y;
482         }
483 }
484
485 void VID_InitCvars(void)
486 {
487         Cvar_RegisterVariable(&vid_mode);
488         Cvar_RegisterVariable(&vid_mouse);
489         Cvar_RegisterVariable(&vid_fullscreen);
490         Cvar_RegisterVariable(&gl_combine);
491         Cvar_RegisterVariable(&in_pitch_min);
492         Cvar_RegisterVariable(&in_pitch_max);
493         Cvar_RegisterVariable(&m_filter);
494         Cmd_AddCommand("force_centerview", Force_CenterView_f);
495 }
496