From 2b0974822c2212741f9eceaeaa8e21d45582609f Mon Sep 17 00:00:00 2001 From: Alejandro Ricoveri Date: Wed, 1 May 2013 16:54:44 -0430 Subject: [PATCH] Client refactoring Some stuff being reordered --- src/backends/generic/qgl.c | 700 ++--- src/backends/generic/vid.c | 41 +- src/backends/sdl/input.c | 48 +- src/backends/sdl/refresh.c | 32 +- src/client/cl_view.c | 3 +- src/client/header/client.h | 2 - src/client/header/ref.h | 110 +- src/client/header/vid.h | 6 + src/client/menu/menu.c | 5296 ++++++++++++++++++------------------ src/client/menu/qmenu.c | 3 - src/refresh/files/jpeg.c | 20 +- src/refresh/files/md2.c | 14 +- src/refresh/files/pcx.c | 14 +- src/refresh/files/sp2.c | 4 +- src/refresh/files/tga.c | 32 +- src/refresh/files/wal.c | 10 +- src/refresh/header/local.h | 14 +- src/refresh/r_draw.c | 10 +- src/refresh/r_image.c | 48 +- src/refresh/r_light.c | 8 +- src/refresh/r_lightmap.c | 10 +- src/refresh/r_main.c | 330 +-- src/refresh/r_mesh.c | 10 +- src/refresh/r_misc.c | 18 +- src/refresh/r_model.c | 60 +- src/refresh/r_surf.c | 14 +- src/refresh/r_warp.c | 6 +- 27 files changed, 3326 insertions(+), 3537 deletions(-) diff --git a/src/backends/generic/qgl.c b/src/backends/generic/qgl.c index cc26fea7..2208a047 100644 --- a/src/backends/generic/qgl.c +++ b/src/backends/generic/qgl.c @@ -1146,7 +1146,7 @@ logColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) static void APIENTRY logColor4fv(const GLfloat *v) { - fprintf(glw_state.log_fp, "glColor4fv( %f,%f,%f,%f )\n", + fprintf(glw_state.log_fp, "glColor4fv( %f,%f,%f,%f )\n", v[0], v[1], v[2], v[3]); dllColor4fv(v); } @@ -3270,7 +3270,7 @@ QGL_Shutdown(void) { if (glw_state.OpenGLLib) { - ri.Sys_FreeLibrary(glw_state.OpenGLLib); + Sys_FreeLibrary(glw_state.OpenGLLib); glw_state.OpenGLLib = NULL; } @@ -3631,7 +3631,7 @@ GetProcAddressGL(char *symbol) } else if (glw_state.OpenGLLib) { - return ri.Sys_GetProcAddress(glw_state.OpenGLLib, symbol); + return Sys_GetProcAddress(glw_state.OpenGLLib, symbol); } else { @@ -3654,7 +3654,7 @@ QGL_Init(const char *dllname) QGL_Shutdown(); } - ri.Sys_LoadLibrary(dllname, NULL, &glw_state.OpenGLLib); + Sys_LoadLibrary(dllname, NULL, &glw_state.OpenGLLib); if (glw_state.OpenGLLib == 0) { @@ -3662,16 +3662,16 @@ QGL_Init(const char *dllname) char *path; /* try basedir next */ - path = ri.Cvar_Get("basedir", ".", CVAR_NOSET)->string; + path = Cvar_Get("basedir", ".", CVAR_NOSET)->string; snprintf(fn, MAX_OSPATH, "%s/%s", path, dllname); - ri.Sys_LoadLibrary(fn, NULL, &glw_state.OpenGLLib); + Sys_LoadLibrary(fn, NULL, &glw_state.OpenGLLib); if (glw_state.OpenGLLib == NULL) { - ri.Con_Printf(PRINT_ALL, "Trying hardcoded default libGL\n"); + VID_Printf(PRINT_ALL, "Trying hardcoded default libGL\n"); - ri.Sys_LoadLibrary(LIBGL, NULL, &glw_state.OpenGLLib); + Sys_LoadLibrary(LIBGL, NULL, &glw_state.OpenGLLib); if (glw_state.OpenGLLib == NULL) { @@ -3679,359 +3679,359 @@ QGL_Init(const char *dllname) } else { - ri.Cvar_Set("gl_driver", LIBGL); - ri.Con_Printf(PRINT_ALL, "Using %s for OpenGL.\n", LIBGL); + Cvar_Set("gl_driver", LIBGL); + VID_Printf(PRINT_ALL, "Using %s for OpenGL.\n", LIBGL); } } else { - ri.Con_Printf(PRINT_ALL, "Using %s for OpenGL.\n", fn); + VID_Printf(PRINT_ALL, "Using %s for OpenGL.\n", fn); } } else { - ri.Con_Printf(PRINT_ALL, "Using %s for OpenGL.\n", dllname); + VID_Printf(PRINT_ALL, "Using %s for OpenGL.\n", dllname); } - qglAccum = dllAccum = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glAccum"); - qglAlphaFunc = dllAlphaFunc = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glAlphaFunc"); - qglAreTexturesResident = dllAreTexturesResident = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glAreTexturesResident"); - qglArrayElement = dllArrayElement = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glArrayElement"); - qglBegin = dllBegin = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glBegin"); - qglBindTexture = dllBindTexture = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glBindTexture"); - qglBitmap = dllBitmap = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glBitmap"); - qglBlendFunc = dllBlendFunc = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glBlendFunc"); - qglCallList = dllCallList = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glCallList"); - qglCallLists = dllCallLists = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glCallLists"); - qglClear = dllClear = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glClear"); - qglClearAccum = dllClearAccum = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glClearAccum"); - qglClearColor = dllClearColor = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glClearColor"); - qglClearDepth = dllClearDepth = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glClearDepth"); - qglClearIndex = dllClearIndex = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glClearIndex"); - qglClearStencil = dllClearStencil = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glClearStencil"); - qglClipPlane = dllClipPlane = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glClipPlane"); - qglColor3b = dllColor3b = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3b"); - qglColor3bv = dllColor3bv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3bv"); - qglColor3d = dllColor3d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3d"); - qglColor3dv = dllColor3dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3dv"); - qglColor3f = dllColor3f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3f"); - qglColor3fv = dllColor3fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3fv"); - qglColor3i = dllColor3i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3i"); - qglColor3iv = dllColor3iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3iv"); - qglColor3s = dllColor3s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3s"); - qglColor3sv = dllColor3sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3sv"); - qglColor3ub = dllColor3ub = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3ub"); - qglColor3ubv = dllColor3ubv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3ubv"); - qglColor3ui = dllColor3ui = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3ui"); - qglColor3uiv = dllColor3uiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3uiv"); - qglColor3us = dllColor3us = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3us"); - qglColor3usv = dllColor3usv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3usv"); - qglColor4b = dllColor4b = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4b"); - qglColor4bv = dllColor4bv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4bv"); - qglColor4d = dllColor4d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4d"); - qglColor4dv = dllColor4dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4dv"); - qglColor4f = dllColor4f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4f"); - qglColor4fv = dllColor4fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4fv"); - qglColor4i = dllColor4i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4i"); - qglColor4iv = dllColor4iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4iv"); - qglColor4s = dllColor4s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4s"); - qglColor4sv = dllColor4sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4sv"); - qglColor4ub = dllColor4ub = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4ub"); - qglColor4ubv = dllColor4ubv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4ubv"); - qglColor4ui = dllColor4ui = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4ui"); - qglColor4uiv = dllColor4uiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4uiv"); - qglColor4us = dllColor4us = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4us"); - qglColor4usv = dllColor4usv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4usv"); - qglColorMask = dllColorMask = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColorMask"); - qglColorMaterial = dllColorMaterial = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColorMaterial"); - qglColorPointer = dllColorPointer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glColorPointer"); - qglCopyPixels = dllCopyPixels = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyPixels"); - qglCopyTexImage1D = dllCopyTexImage1D = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyTexImage1D"); - qglCopyTexImage2D = dllCopyTexImage2D = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyTexImage2D"); - qglCopyTexSubImage1D = dllCopyTexSubImage1D = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyTexSubImage1D"); - qglCopyTexSubImage2D = dllCopyTexSubImage2D = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyTexSubImage2D"); - qglCullFace = dllCullFace = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glCullFace"); - qglDeleteLists = dllDeleteLists = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDeleteLists"); - qglDeleteTextures = dllDeleteTextures = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDeleteTextures"); - qglDepthFunc = dllDepthFunc = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDepthFunc"); - qglDepthMask = dllDepthMask = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDepthMask"); - qglDepthRange = dllDepthRange = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDepthRange"); - qglDisable = dllDisable = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDisable"); - qglDisableClientState = dllDisableClientState = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDisableClientState"); - qglDrawArrays = dllDrawArrays = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDrawArrays"); - qglDrawBuffer = dllDrawBuffer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDrawBuffer"); - qglDrawElements = dllDrawElements = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDrawElements"); - qglDrawPixels = dllDrawPixels = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glDrawPixels"); - qglEdgeFlag = dllEdgeFlag = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEdgeFlag"); - qglEdgeFlagPointer = dllEdgeFlagPointer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEdgeFlagPointer"); - qglEdgeFlagv = dllEdgeFlagv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEdgeFlagv"); - qglEnable = dllEnable = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEnable"); - qglEnableClientState = dllEnableClientState = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEnableClientState"); - qglEnd = dllEnd = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEnd"); - qglEndList = dllEndList = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEndList"); - qglEvalCoord1d = dllEvalCoord1d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord1d"); - qglEvalCoord1dv = dllEvalCoord1dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord1dv"); - qglEvalCoord1f = dllEvalCoord1f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord1f"); - qglEvalCoord1fv = dllEvalCoord1fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord1fv"); - qglEvalCoord2d = dllEvalCoord2d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord2d"); - qglEvalCoord2dv = dllEvalCoord2dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord2dv"); - qglEvalCoord2f = dllEvalCoord2f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord2f"); - qglEvalCoord2fv = dllEvalCoord2fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord2fv"); - qglEvalMesh1 = dllEvalMesh1 = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalMesh1"); - qglEvalMesh2 = dllEvalMesh2 = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalMesh2"); - qglEvalPoint1 = dllEvalPoint1 = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalPoint1"); - qglEvalPoint2 = dllEvalPoint2 = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalPoint2"); - qglFeedbackBuffer = dllFeedbackBuffer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glFeedbackBuffer"); - qglFinish = dllFinish = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glFinish"); - qglFlush = dllFlush = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glFlush"); - qglFogf = dllFogf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glFogf"); - qglFogfv = dllFogfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glFogfv"); - qglFogi = dllFogi = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glFogi"); - qglFogiv = dllFogiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glFogiv"); - qglFrontFace = dllFrontFace = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glFrontFace"); - qglFrustum = dllFrustum = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glFrustum"); - qglGenLists = dllGenLists = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGenLists"); - qglGenTextures = dllGenTextures = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGenTextures"); - qglGetBooleanv = dllGetBooleanv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetBooleanv"); - qglGetClipPlane = dllGetClipPlane = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetClipPlane"); - qglGetDoublev = dllGetDoublev = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetDoublev"); - qglGetError = dllGetError = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetError"); - qglGetFloatv = dllGetFloatv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetFloatv"); - qglGetIntegerv = dllGetIntegerv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetIntegerv"); - qglGetLightfv = dllGetLightfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetLightfv"); - qglGetLightiv = dllGetLightiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetLightiv"); - qglGetMapdv = dllGetMapdv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMapdv"); - qglGetMapfv = dllGetMapfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMapfv"); - qglGetMapiv = dllGetMapiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMapiv"); - qglGetMaterialfv = dllGetMaterialfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMaterialfv"); - qglGetMaterialiv = dllGetMaterialiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMaterialiv"); - qglGetPixelMapfv = dllGetPixelMapfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPixelMapfv"); - qglGetPixelMapuiv = dllGetPixelMapuiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPixelMapuiv"); - qglGetPixelMapusv = dllGetPixelMapusv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPixelMapusv"); - qglGetPointerv = dllGetPointerv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPointerv"); - qglGetPolygonStipple = dllGetPolygonStipple = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPolygonStipple"); - qglGetString = dllGetString = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetString"); - qglGetTexEnvfv = dllGetTexEnvfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexEnvfv"); - qglGetTexEnviv = dllGetTexEnviv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexEnviv"); - qglGetTexGendv = dllGetTexGendv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexGendv"); - qglGetTexGenfv = dllGetTexGenfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexGenfv"); - qglGetTexGeniv = dllGetTexGeniv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexGeniv"); - qglGetTexImage = dllGetTexImage = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexImage"); - qglGetTexLevelParameterfv = dllGetTexLevelParameterfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetLevelParameterfv"); - qglGetTexLevelParameteriv = dllGetTexLevelParameteriv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetLevelParameteriv"); - qglGetTexParameterfv = dllGetTexParameterfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexParameterfv"); - qglGetTexParameteriv = dllGetTexParameteriv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexParameteriv"); - qglHint = dllHint = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glHint"); - qglIndexMask = dllIndexMask = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexMask"); - qglIndexPointer = dllIndexPointer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexPointer"); - qglIndexd = dllIndexd = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexd"); - qglIndexdv = dllIndexdv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexdv"); - qglIndexf = dllIndexf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexf"); - qglIndexfv = dllIndexfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexfv"); - qglIndexi = dllIndexi = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexi"); - qglIndexiv = dllIndexiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexiv"); - qglIndexs = dllIndexs = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexs"); - qglIndexsv = dllIndexsv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexsv"); - qglIndexub = dllIndexub = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexub"); - qglIndexubv = dllIndexubv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexubv"); - qglInitNames = dllInitNames = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glInitNames"); - qglInterleavedArrays = dllInterleavedArrays = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glInterleavedArrays"); - qglIsEnabled = dllIsEnabled = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIsEnabled"); - qglIsList = dllIsList = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIsList"); - qglIsTexture = dllIsTexture = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glIsTexture"); - qglLightModelf = dllLightModelf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLightModelf"); - qglLightModelfv = dllLightModelfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLightModelfv"); - qglLightModeli = dllLightModeli = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLightModeli"); - qglLightModeliv = dllLightModeliv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLightModeliv"); - qglLightf = dllLightf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLightf"); - qglLightfv = dllLightfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLightfv"); - qglLighti = dllLighti = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLighti"); - qglLightiv = dllLightiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLightiv"); - qglLineStipple = dllLineStipple = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLineStipple"); - qglLineWidth = dllLineWidth = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLineWidth"); - qglListBase = dllListBase = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glListBase"); - qglLoadIdentity = dllLoadIdentity = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLoadIdentity"); - qglLoadMatrixd = dllLoadMatrixd = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLoadMatrixd"); - qglLoadMatrixf = dllLoadMatrixf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLoadMatrixf"); - qglLoadName = dllLoadName = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLoadName"); - qglLogicOp = dllLogicOp = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glLogicOp"); - qglMap1d = dllMap1d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMap1d"); - qglMap1f = dllMap1f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMap1f"); - qglMap2d = dllMap2d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMap2d"); - qglMap2f = dllMap2f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMap2f"); - qglMapGrid1d = dllMapGrid1d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMapGrid1d"); - qglMapGrid1f = dllMapGrid1f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMapGrid1f"); - qglMapGrid2d = dllMapGrid2d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMapGrid2d"); - qglMapGrid2f = dllMapGrid2f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMapGrid2f"); - qglMaterialf = dllMaterialf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMaterialf"); - qglMaterialfv = dllMaterialfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMaterialfv"); - qglMateriali = dllMateriali = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMateriali"); - qglMaterialiv = dllMaterialiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMaterialiv"); - qglMatrixMode = dllMatrixMode = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMatrixMode"); - qglMultMatrixd = dllMultMatrixd = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMultMatrixd"); - qglMultMatrixf = dllMultMatrixf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glMultMatrixf"); - qglNewList = dllNewList = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNewList"); - qglNormal3b = dllNormal3b = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3b"); - qglNormal3bv = dllNormal3bv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3bv"); - qglNormal3d = dllNormal3d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3d"); - qglNormal3dv = dllNormal3dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3dv"); - qglNormal3f = dllNormal3f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3f"); - qglNormal3fv = dllNormal3fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3fv"); - qglNormal3i = dllNormal3i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3i"); - qglNormal3iv = dllNormal3iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3iv"); - qglNormal3s = dllNormal3s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3s"); - qglNormal3sv = dllNormal3sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3sv"); - qglNormalPointer = dllNormalPointer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glNormalPointer"); - qglOrtho = dllOrtho = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glOrtho"); - qglPassThrough = dllPassThrough = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPassThrough"); - qglPixelMapfv = dllPixelMapfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelMapfv"); - qglPixelMapuiv = dllPixelMapuiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelMapuiv"); - qglPixelMapusv = dllPixelMapusv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelMapusv"); - qglPixelStoref = dllPixelStoref = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelStoref"); - qglPixelStorei = dllPixelStorei = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelStorei"); - qglPixelTransferf = dllPixelTransferf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelTransferf"); - qglPixelTransferi = dllPixelTransferi = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelTransferi"); - qglPixelZoom = dllPixelZoom = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelZoom"); - qglPointSize = dllPointSize = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPointSize"); - qglPolygonMode = dllPolygonMode = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPolygonMode"); - qglPolygonOffset = dllPolygonOffset = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPolygonOffset"); - qglPolygonStipple = dllPolygonStipple = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPolygonStipple"); - qglPopAttrib = dllPopAttrib = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPopAttrib"); - qglPopClientAttrib = dllPopClientAttrib = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPopClientAttrib"); - qglPopMatrix = dllPopMatrix = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPopMatrix"); - qglPopName = dllPopName = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPopName"); - qglPrioritizeTextures = dllPrioritizeTextures = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPrioritizeTextures"); - qglPushAttrib = dllPushAttrib = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPushAttrib"); - qglPushClientAttrib = dllPushClientAttrib = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPushClientAttrib"); - qglPushMatrix = dllPushMatrix = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPushMatrix"); - qglPushName = dllPushName = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glPushName"); - qglRasterPos2d = dllRasterPos2d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2d"); - qglRasterPos2dv = dllRasterPos2dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2dv"); - qglRasterPos2f = dllRasterPos2f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2f"); - qglRasterPos2fv = dllRasterPos2fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2fv"); - qglRasterPos2i = dllRasterPos2i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2i"); - qglRasterPos2iv = dllRasterPos2iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2iv"); - qglRasterPos2s = dllRasterPos2s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2s"); - qglRasterPos2sv = dllRasterPos2sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2sv"); - qglRasterPos3d = dllRasterPos3d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3d"); - qglRasterPos3dv = dllRasterPos3dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3dv"); - qglRasterPos3f = dllRasterPos3f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3f"); - qglRasterPos3fv = dllRasterPos3fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3fv"); - qglRasterPos3i = dllRasterPos3i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3i"); - qglRasterPos3iv = dllRasterPos3iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3iv"); - qglRasterPos3s = dllRasterPos3s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3s"); - qglRasterPos3sv = dllRasterPos3sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3sv"); - qglRasterPos4d = dllRasterPos4d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4d"); - qglRasterPos4dv = dllRasterPos4dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4dv"); - qglRasterPos4f = dllRasterPos4f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4f"); - qglRasterPos4fv = dllRasterPos4fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4fv"); - qglRasterPos4i = dllRasterPos4i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4i"); - qglRasterPos4iv = dllRasterPos4iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4iv"); - qglRasterPos4s = dllRasterPos4s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4s"); - qglRasterPos4sv = dllRasterPos4sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4sv"); - qglReadBuffer = dllReadBuffer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glReadBuffer"); - qglReadPixels = dllReadPixels = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glReadPixels"); - qglRectd = dllRectd = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRectd"); - qglRectdv = dllRectdv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRectdv"); - qglRectf = dllRectf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRectf"); - qglRectfv = dllRectfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRectfv"); - qglRecti = dllRecti = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRecti"); - qglRectiv = dllRectiv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRectiv"); - qglRects = dllRects = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRects"); - qglRectsv = dllRectsv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRectsv"); - qglRenderMode = dllRenderMode = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRenderMode"); - qglRotated = dllRotated = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRotated"); - qglRotatef = dllRotatef = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glRotatef"); - qglScaled = dllScaled = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glScaled"); - qglScalef = dllScalef = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glScalef"); - qglScissor = dllScissor = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glScissor"); - qglSelectBuffer = dllSelectBuffer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glSelectBuffer"); - qglShadeModel = dllShadeModel = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glShadeModel"); - qglStencilFunc = dllStencilFunc = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glStencilFunc"); - qglStencilMask = dllStencilMask = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glStencilMask"); - qglStencilOp = dllStencilOp = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glStencilOp"); - qglTexCoord1d = dllTexCoord1d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1d"); - qglTexCoord1dv = dllTexCoord1dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1dv"); - qglTexCoord1f = dllTexCoord1f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1f"); - qglTexCoord1fv = dllTexCoord1fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1fv"); - qglTexCoord1i = dllTexCoord1i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1i"); - qglTexCoord1iv = dllTexCoord1iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1iv"); - qglTexCoord1s = dllTexCoord1s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1s"); - qglTexCoord1sv = dllTexCoord1sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1sv"); - qglTexCoord2d = dllTexCoord2d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2d"); - qglTexCoord2dv = dllTexCoord2dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2dv"); - qglTexCoord2f = dllTexCoord2f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2f"); - qglTexCoord2fv = dllTexCoord2fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2fv"); - qglTexCoord2i = dllTexCoord2i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2i"); - qglTexCoord2iv = dllTexCoord2iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2iv"); - qglTexCoord2s = dllTexCoord2s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2s"); - qglTexCoord2sv = dllTexCoord2sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2sv"); - qglTexCoord3d = dllTexCoord3d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3d"); - qglTexCoord3dv = dllTexCoord3dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3dv"); - qglTexCoord3f = dllTexCoord3f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3f"); - qglTexCoord3fv = dllTexCoord3fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3fv"); - qglTexCoord3i = dllTexCoord3i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3i"); - qglTexCoord3iv = dllTexCoord3iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3iv"); - qglTexCoord3s = dllTexCoord3s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3s"); - qglTexCoord3sv = dllTexCoord3sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3sv"); - qglTexCoord4d = dllTexCoord4d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4d"); - qglTexCoord4dv = dllTexCoord4dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4dv"); - qglTexCoord4f = dllTexCoord4f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4f"); - qglTexCoord4fv = dllTexCoord4fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4fv"); - qglTexCoord4i = dllTexCoord4i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4i"); - qglTexCoord4iv = dllTexCoord4iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4iv"); - qglTexCoord4s = dllTexCoord4s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4s"); - qglTexCoord4sv = dllTexCoord4sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4sv"); - qglTexCoordPointer = dllTexCoordPointer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoordPointer"); - qglTexEnvf = dllTexEnvf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexEnvf"); - qglTexEnvfv = dllTexEnvfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexEnvfv"); - qglTexEnvi = dllTexEnvi = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexEnvi"); - qglTexEnviv = dllTexEnviv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexEnviv"); - qglTexGend = dllTexGend = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGend"); - qglTexGendv = dllTexGendv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGendv"); - qglTexGenf = dllTexGenf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGenf"); - qglTexGenfv = dllTexGenfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGenfv"); - qglTexGeni = dllTexGeni = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGeni"); - qglTexGeniv = dllTexGeniv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGeniv"); - qglTexImage1D = dllTexImage1D = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexImage1D"); - qglTexImage2D = dllTexImage2D = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexImage2D"); - qglTexParameterf = dllTexParameterf = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexParameterf"); - qglTexParameterfv = dllTexParameterfv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexParameterfv"); - qglTexParameteri = dllTexParameteri = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexParameteri"); - qglTexParameteriv = dllTexParameteriv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexParameteriv"); - qglTexSubImage1D = dllTexSubImage1D = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexSubImage1D"); - qglTexSubImage2D = dllTexSubImage2D = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTexSubImage2D"); - qglTranslated = dllTranslated = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTranslated"); - qglTranslatef = dllTranslatef = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glTranslatef"); - qglVertex2d = dllVertex2d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2d"); - qglVertex2dv = dllVertex2dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2dv"); - qglVertex2f = dllVertex2f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2f"); - qglVertex2fv = dllVertex2fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2fv"); - qglVertex2i = dllVertex2i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2i"); - qglVertex2iv = dllVertex2iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2iv"); - qglVertex2s = dllVertex2s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2s"); - qglVertex2sv = dllVertex2sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2sv"); - qglVertex3d = dllVertex3d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3d"); - qglVertex3dv = dllVertex3dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3dv"); - qglVertex3f = dllVertex3f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3f"); - qglVertex3fv = dllVertex3fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3fv"); - qglVertex3i = dllVertex3i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3i"); - qglVertex3iv = dllVertex3iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3iv"); - qglVertex3s = dllVertex3s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3s"); - qglVertex3sv = dllVertex3sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3sv"); - qglVertex4d = dllVertex4d = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4d"); - qglVertex4dv = dllVertex4dv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4dv"); - qglVertex4f = dllVertex4f = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4f"); - qglVertex4fv = dllVertex4fv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4fv"); - qglVertex4i = dllVertex4i = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4i"); - qglVertex4iv = dllVertex4iv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4iv"); - qglVertex4s = dllVertex4s = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4s"); - qglVertex4sv = dllVertex4sv = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4sv"); - qglVertexPointer = dllVertexPointer = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glVertexPointer"); - qglViewport = dllViewport = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "glViewport"); + qglAccum = dllAccum = Sys_GetProcAddress(glw_state.OpenGLLib, "glAccum"); + qglAlphaFunc = dllAlphaFunc = Sys_GetProcAddress(glw_state.OpenGLLib, "glAlphaFunc"); + qglAreTexturesResident = dllAreTexturesResident = Sys_GetProcAddress(glw_state.OpenGLLib, "glAreTexturesResident"); + qglArrayElement = dllArrayElement = Sys_GetProcAddress(glw_state.OpenGLLib, "glArrayElement"); + qglBegin = dllBegin = Sys_GetProcAddress(glw_state.OpenGLLib, "glBegin"); + qglBindTexture = dllBindTexture = Sys_GetProcAddress(glw_state.OpenGLLib, "glBindTexture"); + qglBitmap = dllBitmap = Sys_GetProcAddress(glw_state.OpenGLLib, "glBitmap"); + qglBlendFunc = dllBlendFunc = Sys_GetProcAddress(glw_state.OpenGLLib, "glBlendFunc"); + qglCallList = dllCallList = Sys_GetProcAddress(glw_state.OpenGLLib, "glCallList"); + qglCallLists = dllCallLists = Sys_GetProcAddress(glw_state.OpenGLLib, "glCallLists"); + qglClear = dllClear = Sys_GetProcAddress(glw_state.OpenGLLib, "glClear"); + qglClearAccum = dllClearAccum = Sys_GetProcAddress(glw_state.OpenGLLib, "glClearAccum"); + qglClearColor = dllClearColor = Sys_GetProcAddress(glw_state.OpenGLLib, "glClearColor"); + qglClearDepth = dllClearDepth = Sys_GetProcAddress(glw_state.OpenGLLib, "glClearDepth"); + qglClearIndex = dllClearIndex = Sys_GetProcAddress(glw_state.OpenGLLib, "glClearIndex"); + qglClearStencil = dllClearStencil = Sys_GetProcAddress(glw_state.OpenGLLib, "glClearStencil"); + qglClipPlane = dllClipPlane = Sys_GetProcAddress(glw_state.OpenGLLib, "glClipPlane"); + qglColor3b = dllColor3b = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3b"); + qglColor3bv = dllColor3bv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3bv"); + qglColor3d = dllColor3d = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3d"); + qglColor3dv = dllColor3dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3dv"); + qglColor3f = dllColor3f = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3f"); + qglColor3fv = dllColor3fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3fv"); + qglColor3i = dllColor3i = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3i"); + qglColor3iv = dllColor3iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3iv"); + qglColor3s = dllColor3s = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3s"); + qglColor3sv = dllColor3sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3sv"); + qglColor3ub = dllColor3ub = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3ub"); + qglColor3ubv = dllColor3ubv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3ubv"); + qglColor3ui = dllColor3ui = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3ui"); + qglColor3uiv = dllColor3uiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3uiv"); + qglColor3us = dllColor3us = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3us"); + qglColor3usv = dllColor3usv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor3usv"); + qglColor4b = dllColor4b = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4b"); + qglColor4bv = dllColor4bv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4bv"); + qglColor4d = dllColor4d = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4d"); + qglColor4dv = dllColor4dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4dv"); + qglColor4f = dllColor4f = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4f"); + qglColor4fv = dllColor4fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4fv"); + qglColor4i = dllColor4i = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4i"); + qglColor4iv = dllColor4iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4iv"); + qglColor4s = dllColor4s = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4s"); + qglColor4sv = dllColor4sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4sv"); + qglColor4ub = dllColor4ub = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4ub"); + qglColor4ubv = dllColor4ubv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4ubv"); + qglColor4ui = dllColor4ui = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4ui"); + qglColor4uiv = dllColor4uiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4uiv"); + qglColor4us = dllColor4us = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4us"); + qglColor4usv = dllColor4usv = Sys_GetProcAddress(glw_state.OpenGLLib, "glColor4usv"); + qglColorMask = dllColorMask = Sys_GetProcAddress(glw_state.OpenGLLib, "glColorMask"); + qglColorMaterial = dllColorMaterial = Sys_GetProcAddress(glw_state.OpenGLLib, "glColorMaterial"); + qglColorPointer = dllColorPointer = Sys_GetProcAddress(glw_state.OpenGLLib, "glColorPointer"); + qglCopyPixels = dllCopyPixels = Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyPixels"); + qglCopyTexImage1D = dllCopyTexImage1D = Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyTexImage1D"); + qglCopyTexImage2D = dllCopyTexImage2D = Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyTexImage2D"); + qglCopyTexSubImage1D = dllCopyTexSubImage1D = Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyTexSubImage1D"); + qglCopyTexSubImage2D = dllCopyTexSubImage2D = Sys_GetProcAddress(glw_state.OpenGLLib, "glCopyTexSubImage2D"); + qglCullFace = dllCullFace = Sys_GetProcAddress(glw_state.OpenGLLib, "glCullFace"); + qglDeleteLists = dllDeleteLists = Sys_GetProcAddress(glw_state.OpenGLLib, "glDeleteLists"); + qglDeleteTextures = dllDeleteTextures = Sys_GetProcAddress(glw_state.OpenGLLib, "glDeleteTextures"); + qglDepthFunc = dllDepthFunc = Sys_GetProcAddress(glw_state.OpenGLLib, "glDepthFunc"); + qglDepthMask = dllDepthMask = Sys_GetProcAddress(glw_state.OpenGLLib, "glDepthMask"); + qglDepthRange = dllDepthRange = Sys_GetProcAddress(glw_state.OpenGLLib, "glDepthRange"); + qglDisable = dllDisable = Sys_GetProcAddress(glw_state.OpenGLLib, "glDisable"); + qglDisableClientState = dllDisableClientState = Sys_GetProcAddress(glw_state.OpenGLLib, "glDisableClientState"); + qglDrawArrays = dllDrawArrays = Sys_GetProcAddress(glw_state.OpenGLLib, "glDrawArrays"); + qglDrawBuffer = dllDrawBuffer = Sys_GetProcAddress(glw_state.OpenGLLib, "glDrawBuffer"); + qglDrawElements = dllDrawElements = Sys_GetProcAddress(glw_state.OpenGLLib, "glDrawElements"); + qglDrawPixels = dllDrawPixels = Sys_GetProcAddress(glw_state.OpenGLLib, "glDrawPixels"); + qglEdgeFlag = dllEdgeFlag = Sys_GetProcAddress(glw_state.OpenGLLib, "glEdgeFlag"); + qglEdgeFlagPointer = dllEdgeFlagPointer = Sys_GetProcAddress(glw_state.OpenGLLib, "glEdgeFlagPointer"); + qglEdgeFlagv = dllEdgeFlagv = Sys_GetProcAddress(glw_state.OpenGLLib, "glEdgeFlagv"); + qglEnable = dllEnable = Sys_GetProcAddress(glw_state.OpenGLLib, "glEnable"); + qglEnableClientState = dllEnableClientState = Sys_GetProcAddress(glw_state.OpenGLLib, "glEnableClientState"); + qglEnd = dllEnd = Sys_GetProcAddress(glw_state.OpenGLLib, "glEnd"); + qglEndList = dllEndList = Sys_GetProcAddress(glw_state.OpenGLLib, "glEndList"); + qglEvalCoord1d = dllEvalCoord1d = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord1d"); + qglEvalCoord1dv = dllEvalCoord1dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord1dv"); + qglEvalCoord1f = dllEvalCoord1f = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord1f"); + qglEvalCoord1fv = dllEvalCoord1fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord1fv"); + qglEvalCoord2d = dllEvalCoord2d = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord2d"); + qglEvalCoord2dv = dllEvalCoord2dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord2dv"); + qglEvalCoord2f = dllEvalCoord2f = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord2f"); + qglEvalCoord2fv = dllEvalCoord2fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalCoord2fv"); + qglEvalMesh1 = dllEvalMesh1 = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalMesh1"); + qglEvalMesh2 = dllEvalMesh2 = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalMesh2"); + qglEvalPoint1 = dllEvalPoint1 = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalPoint1"); + qglEvalPoint2 = dllEvalPoint2 = Sys_GetProcAddress(glw_state.OpenGLLib, "glEvalPoint2"); + qglFeedbackBuffer = dllFeedbackBuffer = Sys_GetProcAddress(glw_state.OpenGLLib, "glFeedbackBuffer"); + qglFinish = dllFinish = Sys_GetProcAddress(glw_state.OpenGLLib, "glFinish"); + qglFlush = dllFlush = Sys_GetProcAddress(glw_state.OpenGLLib, "glFlush"); + qglFogf = dllFogf = Sys_GetProcAddress(glw_state.OpenGLLib, "glFogf"); + qglFogfv = dllFogfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glFogfv"); + qglFogi = dllFogi = Sys_GetProcAddress(glw_state.OpenGLLib, "glFogi"); + qglFogiv = dllFogiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glFogiv"); + qglFrontFace = dllFrontFace = Sys_GetProcAddress(glw_state.OpenGLLib, "glFrontFace"); + qglFrustum = dllFrustum = Sys_GetProcAddress(glw_state.OpenGLLib, "glFrustum"); + qglGenLists = dllGenLists = Sys_GetProcAddress(glw_state.OpenGLLib, "glGenLists"); + qglGenTextures = dllGenTextures = Sys_GetProcAddress(glw_state.OpenGLLib, "glGenTextures"); + qglGetBooleanv = dllGetBooleanv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetBooleanv"); + qglGetClipPlane = dllGetClipPlane = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetClipPlane"); + qglGetDoublev = dllGetDoublev = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetDoublev"); + qglGetError = dllGetError = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetError"); + qglGetFloatv = dllGetFloatv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetFloatv"); + qglGetIntegerv = dllGetIntegerv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetIntegerv"); + qglGetLightfv = dllGetLightfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetLightfv"); + qglGetLightiv = dllGetLightiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetLightiv"); + qglGetMapdv = dllGetMapdv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMapdv"); + qglGetMapfv = dllGetMapfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMapfv"); + qglGetMapiv = dllGetMapiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMapiv"); + qglGetMaterialfv = dllGetMaterialfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMaterialfv"); + qglGetMaterialiv = dllGetMaterialiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetMaterialiv"); + qglGetPixelMapfv = dllGetPixelMapfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPixelMapfv"); + qglGetPixelMapuiv = dllGetPixelMapuiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPixelMapuiv"); + qglGetPixelMapusv = dllGetPixelMapusv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPixelMapusv"); + qglGetPointerv = dllGetPointerv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPointerv"); + qglGetPolygonStipple = dllGetPolygonStipple = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetPolygonStipple"); + qglGetString = dllGetString = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetString"); + qglGetTexEnvfv = dllGetTexEnvfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexEnvfv"); + qglGetTexEnviv = dllGetTexEnviv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexEnviv"); + qglGetTexGendv = dllGetTexGendv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexGendv"); + qglGetTexGenfv = dllGetTexGenfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexGenfv"); + qglGetTexGeniv = dllGetTexGeniv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexGeniv"); + qglGetTexImage = dllGetTexImage = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexImage"); + qglGetTexLevelParameterfv = dllGetTexLevelParameterfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetLevelParameterfv"); + qglGetTexLevelParameteriv = dllGetTexLevelParameteriv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetLevelParameteriv"); + qglGetTexParameterfv = dllGetTexParameterfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexParameterfv"); + qglGetTexParameteriv = dllGetTexParameteriv = Sys_GetProcAddress(glw_state.OpenGLLib, "glGetTexParameteriv"); + qglHint = dllHint = Sys_GetProcAddress(glw_state.OpenGLLib, "glHint"); + qglIndexMask = dllIndexMask = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexMask"); + qglIndexPointer = dllIndexPointer = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexPointer"); + qglIndexd = dllIndexd = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexd"); + qglIndexdv = dllIndexdv = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexdv"); + qglIndexf = dllIndexf = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexf"); + qglIndexfv = dllIndexfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexfv"); + qglIndexi = dllIndexi = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexi"); + qglIndexiv = dllIndexiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexiv"); + qglIndexs = dllIndexs = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexs"); + qglIndexsv = dllIndexsv = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexsv"); + qglIndexub = dllIndexub = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexub"); + qglIndexubv = dllIndexubv = Sys_GetProcAddress(glw_state.OpenGLLib, "glIndexubv"); + qglInitNames = dllInitNames = Sys_GetProcAddress(glw_state.OpenGLLib, "glInitNames"); + qglInterleavedArrays = dllInterleavedArrays = Sys_GetProcAddress(glw_state.OpenGLLib, "glInterleavedArrays"); + qglIsEnabled = dllIsEnabled = Sys_GetProcAddress(glw_state.OpenGLLib, "glIsEnabled"); + qglIsList = dllIsList = Sys_GetProcAddress(glw_state.OpenGLLib, "glIsList"); + qglIsTexture = dllIsTexture = Sys_GetProcAddress(glw_state.OpenGLLib, "glIsTexture"); + qglLightModelf = dllLightModelf = Sys_GetProcAddress(glw_state.OpenGLLib, "glLightModelf"); + qglLightModelfv = dllLightModelfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glLightModelfv"); + qglLightModeli = dllLightModeli = Sys_GetProcAddress(glw_state.OpenGLLib, "glLightModeli"); + qglLightModeliv = dllLightModeliv = Sys_GetProcAddress(glw_state.OpenGLLib, "glLightModeliv"); + qglLightf = dllLightf = Sys_GetProcAddress(glw_state.OpenGLLib, "glLightf"); + qglLightfv = dllLightfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glLightfv"); + qglLighti = dllLighti = Sys_GetProcAddress(glw_state.OpenGLLib, "glLighti"); + qglLightiv = dllLightiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glLightiv"); + qglLineStipple = dllLineStipple = Sys_GetProcAddress(glw_state.OpenGLLib, "glLineStipple"); + qglLineWidth = dllLineWidth = Sys_GetProcAddress(glw_state.OpenGLLib, "glLineWidth"); + qglListBase = dllListBase = Sys_GetProcAddress(glw_state.OpenGLLib, "glListBase"); + qglLoadIdentity = dllLoadIdentity = Sys_GetProcAddress(glw_state.OpenGLLib, "glLoadIdentity"); + qglLoadMatrixd = dllLoadMatrixd = Sys_GetProcAddress(glw_state.OpenGLLib, "glLoadMatrixd"); + qglLoadMatrixf = dllLoadMatrixf = Sys_GetProcAddress(glw_state.OpenGLLib, "glLoadMatrixf"); + qglLoadName = dllLoadName = Sys_GetProcAddress(glw_state.OpenGLLib, "glLoadName"); + qglLogicOp = dllLogicOp = Sys_GetProcAddress(glw_state.OpenGLLib, "glLogicOp"); + qglMap1d = dllMap1d = Sys_GetProcAddress(glw_state.OpenGLLib, "glMap1d"); + qglMap1f = dllMap1f = Sys_GetProcAddress(glw_state.OpenGLLib, "glMap1f"); + qglMap2d = dllMap2d = Sys_GetProcAddress(glw_state.OpenGLLib, "glMap2d"); + qglMap2f = dllMap2f = Sys_GetProcAddress(glw_state.OpenGLLib, "glMap2f"); + qglMapGrid1d = dllMapGrid1d = Sys_GetProcAddress(glw_state.OpenGLLib, "glMapGrid1d"); + qglMapGrid1f = dllMapGrid1f = Sys_GetProcAddress(glw_state.OpenGLLib, "glMapGrid1f"); + qglMapGrid2d = dllMapGrid2d = Sys_GetProcAddress(glw_state.OpenGLLib, "glMapGrid2d"); + qglMapGrid2f = dllMapGrid2f = Sys_GetProcAddress(glw_state.OpenGLLib, "glMapGrid2f"); + qglMaterialf = dllMaterialf = Sys_GetProcAddress(glw_state.OpenGLLib, "glMaterialf"); + qglMaterialfv = dllMaterialfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glMaterialfv"); + qglMateriali = dllMateriali = Sys_GetProcAddress(glw_state.OpenGLLib, "glMateriali"); + qglMaterialiv = dllMaterialiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glMaterialiv"); + qglMatrixMode = dllMatrixMode = Sys_GetProcAddress(glw_state.OpenGLLib, "glMatrixMode"); + qglMultMatrixd = dllMultMatrixd = Sys_GetProcAddress(glw_state.OpenGLLib, "glMultMatrixd"); + qglMultMatrixf = dllMultMatrixf = Sys_GetProcAddress(glw_state.OpenGLLib, "glMultMatrixf"); + qglNewList = dllNewList = Sys_GetProcAddress(glw_state.OpenGLLib, "glNewList"); + qglNormal3b = dllNormal3b = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3b"); + qglNormal3bv = dllNormal3bv = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3bv"); + qglNormal3d = dllNormal3d = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3d"); + qglNormal3dv = dllNormal3dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3dv"); + qglNormal3f = dllNormal3f = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3f"); + qglNormal3fv = dllNormal3fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3fv"); + qglNormal3i = dllNormal3i = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3i"); + qglNormal3iv = dllNormal3iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3iv"); + qglNormal3s = dllNormal3s = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3s"); + qglNormal3sv = dllNormal3sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormal3sv"); + qglNormalPointer = dllNormalPointer = Sys_GetProcAddress(glw_state.OpenGLLib, "glNormalPointer"); + qglOrtho = dllOrtho = Sys_GetProcAddress(glw_state.OpenGLLib, "glOrtho"); + qglPassThrough = dllPassThrough = Sys_GetProcAddress(glw_state.OpenGLLib, "glPassThrough"); + qglPixelMapfv = dllPixelMapfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelMapfv"); + qglPixelMapuiv = dllPixelMapuiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelMapuiv"); + qglPixelMapusv = dllPixelMapusv = Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelMapusv"); + qglPixelStoref = dllPixelStoref = Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelStoref"); + qglPixelStorei = dllPixelStorei = Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelStorei"); + qglPixelTransferf = dllPixelTransferf = Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelTransferf"); + qglPixelTransferi = dllPixelTransferi = Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelTransferi"); + qglPixelZoom = dllPixelZoom = Sys_GetProcAddress(glw_state.OpenGLLib, "glPixelZoom"); + qglPointSize = dllPointSize = Sys_GetProcAddress(glw_state.OpenGLLib, "glPointSize"); + qglPolygonMode = dllPolygonMode = Sys_GetProcAddress(glw_state.OpenGLLib, "glPolygonMode"); + qglPolygonOffset = dllPolygonOffset = Sys_GetProcAddress(glw_state.OpenGLLib, "glPolygonOffset"); + qglPolygonStipple = dllPolygonStipple = Sys_GetProcAddress(glw_state.OpenGLLib, "glPolygonStipple"); + qglPopAttrib = dllPopAttrib = Sys_GetProcAddress(glw_state.OpenGLLib, "glPopAttrib"); + qglPopClientAttrib = dllPopClientAttrib = Sys_GetProcAddress(glw_state.OpenGLLib, "glPopClientAttrib"); + qglPopMatrix = dllPopMatrix = Sys_GetProcAddress(glw_state.OpenGLLib, "glPopMatrix"); + qglPopName = dllPopName = Sys_GetProcAddress(glw_state.OpenGLLib, "glPopName"); + qglPrioritizeTextures = dllPrioritizeTextures = Sys_GetProcAddress(glw_state.OpenGLLib, "glPrioritizeTextures"); + qglPushAttrib = dllPushAttrib = Sys_GetProcAddress(glw_state.OpenGLLib, "glPushAttrib"); + qglPushClientAttrib = dllPushClientAttrib = Sys_GetProcAddress(glw_state.OpenGLLib, "glPushClientAttrib"); + qglPushMatrix = dllPushMatrix = Sys_GetProcAddress(glw_state.OpenGLLib, "glPushMatrix"); + qglPushName = dllPushName = Sys_GetProcAddress(glw_state.OpenGLLib, "glPushName"); + qglRasterPos2d = dllRasterPos2d = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2d"); + qglRasterPos2dv = dllRasterPos2dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2dv"); + qglRasterPos2f = dllRasterPos2f = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2f"); + qglRasterPos2fv = dllRasterPos2fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2fv"); + qglRasterPos2i = dllRasterPos2i = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2i"); + qglRasterPos2iv = dllRasterPos2iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2iv"); + qglRasterPos2s = dllRasterPos2s = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2s"); + qglRasterPos2sv = dllRasterPos2sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos2sv"); + qglRasterPos3d = dllRasterPos3d = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3d"); + qglRasterPos3dv = dllRasterPos3dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3dv"); + qglRasterPos3f = dllRasterPos3f = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3f"); + qglRasterPos3fv = dllRasterPos3fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3fv"); + qglRasterPos3i = dllRasterPos3i = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3i"); + qglRasterPos3iv = dllRasterPos3iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3iv"); + qglRasterPos3s = dllRasterPos3s = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3s"); + qglRasterPos3sv = dllRasterPos3sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos3sv"); + qglRasterPos4d = dllRasterPos4d = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4d"); + qglRasterPos4dv = dllRasterPos4dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4dv"); + qglRasterPos4f = dllRasterPos4f = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4f"); + qglRasterPos4fv = dllRasterPos4fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4fv"); + qglRasterPos4i = dllRasterPos4i = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4i"); + qglRasterPos4iv = dllRasterPos4iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4iv"); + qglRasterPos4s = dllRasterPos4s = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4s"); + qglRasterPos4sv = dllRasterPos4sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRasterPos4sv"); + qglReadBuffer = dllReadBuffer = Sys_GetProcAddress(glw_state.OpenGLLib, "glReadBuffer"); + qglReadPixels = dllReadPixels = Sys_GetProcAddress(glw_state.OpenGLLib, "glReadPixels"); + qglRectd = dllRectd = Sys_GetProcAddress(glw_state.OpenGLLib, "glRectd"); + qglRectdv = dllRectdv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRectdv"); + qglRectf = dllRectf = Sys_GetProcAddress(glw_state.OpenGLLib, "glRectf"); + qglRectfv = dllRectfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRectfv"); + qglRecti = dllRecti = Sys_GetProcAddress(glw_state.OpenGLLib, "glRecti"); + qglRectiv = dllRectiv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRectiv"); + qglRects = dllRects = Sys_GetProcAddress(glw_state.OpenGLLib, "glRects"); + qglRectsv = dllRectsv = Sys_GetProcAddress(glw_state.OpenGLLib, "glRectsv"); + qglRenderMode = dllRenderMode = Sys_GetProcAddress(glw_state.OpenGLLib, "glRenderMode"); + qglRotated = dllRotated = Sys_GetProcAddress(glw_state.OpenGLLib, "glRotated"); + qglRotatef = dllRotatef = Sys_GetProcAddress(glw_state.OpenGLLib, "glRotatef"); + qglScaled = dllScaled = Sys_GetProcAddress(glw_state.OpenGLLib, "glScaled"); + qglScalef = dllScalef = Sys_GetProcAddress(glw_state.OpenGLLib, "glScalef"); + qglScissor = dllScissor = Sys_GetProcAddress(glw_state.OpenGLLib, "glScissor"); + qglSelectBuffer = dllSelectBuffer = Sys_GetProcAddress(glw_state.OpenGLLib, "glSelectBuffer"); + qglShadeModel = dllShadeModel = Sys_GetProcAddress(glw_state.OpenGLLib, "glShadeModel"); + qglStencilFunc = dllStencilFunc = Sys_GetProcAddress(glw_state.OpenGLLib, "glStencilFunc"); + qglStencilMask = dllStencilMask = Sys_GetProcAddress(glw_state.OpenGLLib, "glStencilMask"); + qglStencilOp = dllStencilOp = Sys_GetProcAddress(glw_state.OpenGLLib, "glStencilOp"); + qglTexCoord1d = dllTexCoord1d = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1d"); + qglTexCoord1dv = dllTexCoord1dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1dv"); + qglTexCoord1f = dllTexCoord1f = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1f"); + qglTexCoord1fv = dllTexCoord1fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1fv"); + qglTexCoord1i = dllTexCoord1i = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1i"); + qglTexCoord1iv = dllTexCoord1iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1iv"); + qglTexCoord1s = dllTexCoord1s = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1s"); + qglTexCoord1sv = dllTexCoord1sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord1sv"); + qglTexCoord2d = dllTexCoord2d = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2d"); + qglTexCoord2dv = dllTexCoord2dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2dv"); + qglTexCoord2f = dllTexCoord2f = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2f"); + qglTexCoord2fv = dllTexCoord2fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2fv"); + qglTexCoord2i = dllTexCoord2i = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2i"); + qglTexCoord2iv = dllTexCoord2iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2iv"); + qglTexCoord2s = dllTexCoord2s = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2s"); + qglTexCoord2sv = dllTexCoord2sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord2sv"); + qglTexCoord3d = dllTexCoord3d = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3d"); + qglTexCoord3dv = dllTexCoord3dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3dv"); + qglTexCoord3f = dllTexCoord3f = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3f"); + qglTexCoord3fv = dllTexCoord3fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3fv"); + qglTexCoord3i = dllTexCoord3i = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3i"); + qglTexCoord3iv = dllTexCoord3iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3iv"); + qglTexCoord3s = dllTexCoord3s = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3s"); + qglTexCoord3sv = dllTexCoord3sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord3sv"); + qglTexCoord4d = dllTexCoord4d = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4d"); + qglTexCoord4dv = dllTexCoord4dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4dv"); + qglTexCoord4f = dllTexCoord4f = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4f"); + qglTexCoord4fv = dllTexCoord4fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4fv"); + qglTexCoord4i = dllTexCoord4i = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4i"); + qglTexCoord4iv = dllTexCoord4iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4iv"); + qglTexCoord4s = dllTexCoord4s = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4s"); + qglTexCoord4sv = dllTexCoord4sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoord4sv"); + qglTexCoordPointer = dllTexCoordPointer = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexCoordPointer"); + qglTexEnvf = dllTexEnvf = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexEnvf"); + qglTexEnvfv = dllTexEnvfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexEnvfv"); + qglTexEnvi = dllTexEnvi = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexEnvi"); + qglTexEnviv = dllTexEnviv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexEnviv"); + qglTexGend = dllTexGend = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGend"); + qglTexGendv = dllTexGendv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGendv"); + qglTexGenf = dllTexGenf = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGenf"); + qglTexGenfv = dllTexGenfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGenfv"); + qglTexGeni = dllTexGeni = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGeni"); + qglTexGeniv = dllTexGeniv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexGeniv"); + qglTexImage1D = dllTexImage1D = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexImage1D"); + qglTexImage2D = dllTexImage2D = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexImage2D"); + qglTexParameterf = dllTexParameterf = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexParameterf"); + qglTexParameterfv = dllTexParameterfv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexParameterfv"); + qglTexParameteri = dllTexParameteri = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexParameteri"); + qglTexParameteriv = dllTexParameteriv = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexParameteriv"); + qglTexSubImage1D = dllTexSubImage1D = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexSubImage1D"); + qglTexSubImage2D = dllTexSubImage2D = Sys_GetProcAddress(glw_state.OpenGLLib, "glTexSubImage2D"); + qglTranslated = dllTranslated = Sys_GetProcAddress(glw_state.OpenGLLib, "glTranslated"); + qglTranslatef = dllTranslatef = Sys_GetProcAddress(glw_state.OpenGLLib, "glTranslatef"); + qglVertex2d = dllVertex2d = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2d"); + qglVertex2dv = dllVertex2dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2dv"); + qglVertex2f = dllVertex2f = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2f"); + qglVertex2fv = dllVertex2fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2fv"); + qglVertex2i = dllVertex2i = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2i"); + qglVertex2iv = dllVertex2iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2iv"); + qglVertex2s = dllVertex2s = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2s"); + qglVertex2sv = dllVertex2sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex2sv"); + qglVertex3d = dllVertex3d = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3d"); + qglVertex3dv = dllVertex3dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3dv"); + qglVertex3f = dllVertex3f = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3f"); + qglVertex3fv = dllVertex3fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3fv"); + qglVertex3i = dllVertex3i = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3i"); + qglVertex3iv = dllVertex3iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3iv"); + qglVertex3s = dllVertex3s = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3s"); + qglVertex3sv = dllVertex3sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex3sv"); + qglVertex4d = dllVertex4d = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4d"); + qglVertex4dv = dllVertex4dv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4dv"); + qglVertex4f = dllVertex4f = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4f"); + qglVertex4fv = dllVertex4fv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4fv"); + qglVertex4i = dllVertex4i = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4i"); + qglVertex4iv = dllVertex4iv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4iv"); + qglVertex4s = dllVertex4s = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4s"); + qglVertex4sv = dllVertex4sv = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertex4sv"); + qglVertexPointer = dllVertexPointer = Sys_GetProcAddress(glw_state.OpenGLLib, "glVertexPointer"); + qglViewport = dllViewport = Sys_GetProcAddress(glw_state.OpenGLLib, "glViewport"); /* Connect wglGetProcAddress (only available on Windows, otherwise NULL */ - qwglGetProcAddress = ri.Sys_GetProcAddress(glw_state.OpenGLLib, "wglGetProcAddress"); + qwglGetProcAddress = Sys_GetProcAddress(glw_state.OpenGLLib, "wglGetProcAddress"); qglLockArraysEXT = 0; qglUnlockArraysEXT = 0; @@ -4063,7 +4063,7 @@ GLimp_EnableLogging(qboolean enable) asctime(newtime); - Com_sprintf(buffer, sizeof(buffer), "%s/gl.log", ri.FS_Gamedir()); + Com_sprintf(buffer, sizeof(buffer), "%s/gl.log", FS_Gamedir()); glw_state.log_fp = fopen(buffer, "wt"); fprintf(glw_state.log_fp, "%s\n", asctime(newtime)); diff --git a/src/backends/generic/vid.c b/src/backends/generic/vid.c index 845ec891..f67c6231 100644 --- a/src/backends/generic/vid.c +++ b/src/backends/generic/vid.c @@ -76,9 +76,6 @@ vidmode_t vid_modes[] = { {"Mode 23: 2048x1536", 2048, 1536, 23}, }; -/* Structure containing functions exported from refresh DLL */ -//refexport_t re; - /* Console variables that we need to access from this module */ cvar_t *vid_gamma; cvar_t *vid_xpos; /* X coordinate of window position */ @@ -163,18 +160,9 @@ VID_NewWindow(int width, int height) viddef.height = height; } -// Get rid of refexport function pointers -void -VID_FreeReflib(void) -{ - //memset(&re, 0, sizeof(re)); -} - qboolean VID_LoadRefresh(void) { - refimport_t ri; // Refresh imported functions - // If the refresher is already active // we'll shut it down VID_Shutdown(); @@ -182,30 +170,8 @@ VID_LoadRefresh(void) // Log it! Com_Printf("----- refresher initialization -----\n"); - // Fill in client functions for the refresher - ri.Cmd_AddCommand = Cmd_AddCommand; - ri.Cmd_RemoveCommand = Cmd_RemoveCommand; - ri.Cmd_Argc = Cmd_Argc; - ri.Cmd_Argv = Cmd_Argv; - ri.Cmd_ExecuteText = Cbuf_ExecuteText; - ri.Con_Printf = VID_Printf; - ri.Sys_Error = VID_Error; - ri.Sys_Mkdir = Sys_Mkdir; - ri.Sys_LoadLibrary = Sys_LoadLibrary; - ri.Sys_FreeLibrary = Sys_FreeLibrary; - ri.Sys_GetProcAddress = Sys_GetProcAddress; - ri.FS_LoadFile = FS_LoadFile; - ri.FS_FreeFile = FS_FreeFile; - ri.FS_Gamedir = FS_Gamedir; - ri.Cvar_Get = Cvar_Get; - ri.Cvar_Set = Cvar_Set; - ri.Cvar_SetValue = Cvar_SetValue; - ri.Vid_GetModeInfo = VID_GetModeInfo; - ri.Vid_MenuInit = VID_MenuInit; - ri.Vid_NewWindow = VID_NewWindow; - // Get refresher API exports - R_GetRefAPI(ri); + //R_GetRefAPI(); /* Init IN (Mouse) */ in_state.IN_CenterView_fp = IN_CenterView; @@ -225,7 +191,6 @@ VID_LoadRefresh(void) ref_active = true; // Initiate the refresher - //if (re.Init(0, 0) == -1) if (R_Init(0, 0) == -1) { VID_Shutdown(); // Isn't that just too bad? :( @@ -288,10 +253,6 @@ VID_Shutdown(void) /* Shut down the renderer */ R_Shutdown(); - - // Get rid of refexport function pointers - // (soon to be deleted) - VID_FreeReflib(); } // Declare the refresher as inactive diff --git a/src/backends/sdl/input.c b/src/backends/sdl/input.c index b450f823..c67f584f 100644 --- a/src/backends/sdl/input.c +++ b/src/backends/sdl/input.c @@ -360,11 +360,11 @@ IN_GetEvent(SDL_Event *event) if (surface->flags & SDL_FULLSCREEN) { - ri.Cvar_SetValue("vid_fullscreen", 1); + Cvar_SetValue("vid_fullscreen", 1); } else { - ri.Cvar_SetValue("vid_fullscreen", 0); + Cvar_SetValue("vid_fullscreen", 0); } vid_fullscreen->modified = false; @@ -380,7 +380,7 @@ IN_GetEvent(SDL_Event *event) KeyStates[SDLK_RSHIFT]) && (event->key.keysym.sym == SDLK_ESCAPE)) { - ri.Cmd_ExecuteText(EXEC_NOW, "toggleconsole"); + Cbuf_ExecuteText(EXEC_NOW, "toggleconsole"); break; } @@ -626,32 +626,32 @@ void IN_BackendInit(in_state_t *in_state_p) { in_state = in_state_p; - m_filter = ri.Cvar_Get("m_filter", "0", CVAR_ARCHIVE); - in_mouse = ri.Cvar_Get("in_mouse", "0", CVAR_ARCHIVE); + m_filter = Cvar_Get("m_filter", "0", CVAR_ARCHIVE); + in_mouse = Cvar_Get("in_mouse", "0", CVAR_ARCHIVE); - freelook = ri.Cvar_Get("freelook", "1", 0); - lookstrafe = ri.Cvar_Get("lookstrafe", "0", 0); - sensitivity = ri.Cvar_Get("sensitivity", "3", 0); - exponential_speedup = ri.Cvar_Get("exponential_speedup", "0", CVAR_ARCHIVE); + freelook = Cvar_Get("freelook", "1", 0); + lookstrafe = Cvar_Get("lookstrafe", "0", 0); + sensitivity = Cvar_Get("sensitivity", "3", 0); + exponential_speedup = Cvar_Get("exponential_speedup", "0", CVAR_ARCHIVE); - m_pitch = ri.Cvar_Get("m_pitch", "0.022", 0); - m_yaw = ri.Cvar_Get("m_yaw", "0.022", 0); - m_forward = ri.Cvar_Get("m_forward", "1", 0); - m_side = ri.Cvar_Get("m_side", "0.8", 0); + m_pitch = Cvar_Get("m_pitch", "0.022", 0); + m_yaw = Cvar_Get("m_yaw", "0.022", 0); + m_forward = Cvar_Get("m_forward", "1", 0); + m_side = Cvar_Get("m_side", "0.8", 0); - ri.Cmd_AddCommand("+mlook", IN_MLookDown); - ri.Cmd_AddCommand("-mlook", IN_MLookUp); - ri.Cmd_AddCommand("force_centerview", IN_ForceCenterView); + Cmd_AddCommand("+mlook", IN_MLookDown); + Cmd_AddCommand("-mlook", IN_MLookUp); + Cmd_AddCommand("force_centerview", IN_ForceCenterView); mouse_x = mouse_y = 0.0; - windowed_mouse = ri.Cvar_Get("windowed_mouse", "1", + windowed_mouse = Cvar_Get("windowed_mouse", "1", CVAR_USERINFO | CVAR_ARCHIVE); - in_grab = ri.Cvar_Get("in_grab", "2", CVAR_ARCHIVE); + in_grab = Cvar_Get("in_grab", "2", CVAR_ARCHIVE); - vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE); + vid_fullscreen = Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE); - ri.Con_Printf(PRINT_ALL, "Input initialized.\n"); + VID_Printf(PRINT_ALL, "Input initialized.\n"); } /* @@ -660,10 +660,10 @@ IN_BackendInit(in_state_t *in_state_p) void IN_BackendShutdown(void) { - ri.Cmd_RemoveCommand("+mlook"); - ri.Cmd_RemoveCommand("-mlook"); - ri.Cmd_RemoveCommand("force_centerview"); - ri.Con_Printf(PRINT_ALL, "Input shut down.\n"); + Cmd_RemoveCommand("+mlook"); + Cmd_RemoveCommand("-mlook"); + Cmd_RemoveCommand("force_centerview"); + VID_Printf(PRINT_ALL, "Input shut down.\n"); } /* diff --git a/src/backends/sdl/refresh.c b/src/backends/sdl/refresh.c index a9b7e081..713cc89d 100644 --- a/src/backends/sdl/refresh.c +++ b/src/backends/sdl/refresh.c @@ -76,13 +76,13 @@ GLimp_Init(void) if (SDL_Init(SDL_INIT_VIDEO) == -1) { - ri.Con_Printf(PRINT_ALL, "Couldn't init SDL video: %s.\n", + VID_Printf(PRINT_ALL, "Couldn't init SDL video: %s.\n", SDL_GetError()); return false; } SDL_VideoDriverName(driverName, sizeof(driverName) - 1); - ri.Con_Printf(PRINT_ALL, "SDL video driver is \"%s\".\n", driverName); + VID_Printf(PRINT_ALL, "SDL video driver is \"%s\".\n", driverName); } return true; @@ -209,7 +209,7 @@ GLimp_InitGraphics(qboolean fullscreen) } /* Create the window */ - ri.Vid_NewWindow(vid.width, vid.height); + VID_NewWindow(vid.width, vid.height); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); @@ -241,17 +241,17 @@ GLimp_InitGraphics(qboolean fullscreen) { if (counter == 1) { - ri.Sys_Error(ERR_FATAL, "Failed to revert to gl_mode 4. Exiting...\n"); + VID_Error(ERR_FATAL, "Failed to revert to gl_mode 4. Exiting...\n"); return false; } - ri.Con_Printf(PRINT_ALL, "SDL SetVideoMode failed: %s\n", + VID_Printf(PRINT_ALL, "SDL SetVideoMode failed: %s\n", SDL_GetError()); - ri.Con_Printf(PRINT_ALL, "Reverting to gl_mode 4 (640x480) and windowed mode.\n"); + VID_Printf(PRINT_ALL, "Reverting to gl_mode 4 (640x480) and windowed mode.\n"); /* Try to recover */ - ri.Cvar_SetValue("gl_mode", 4); - ri.Cvar_SetValue("vid_fullscreen", 0); + Cvar_SetValue("gl_mode", 4); + Cvar_SetValue("vid_fullscreen", 0); vid.width = 640; vid.height = 480; @@ -267,7 +267,7 @@ GLimp_InitGraphics(qboolean fullscreen) /* Initialize the stencil buffer */ if (!SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &stencil_bits)) { - ri.Con_Printf(PRINT_ALL, "Got %d bits of stencil.\n", stencil_bits); + VID_Printf(PRINT_ALL, "Got %d bits of stencil.\n", stencil_bits); if (stencil_bits >= 1) { @@ -279,7 +279,7 @@ GLimp_InitGraphics(qboolean fullscreen) #ifdef X11GAMMA if ((dpy = XOpenDisplay(displayname)) == NULL) { - ri.Con_Printf(PRINT_ALL, "Unable to open display.\n"); + VID_Printf(PRINT_ALL, "Unable to open display.\n"); } else { @@ -293,12 +293,12 @@ GLimp_InitGraphics(qboolean fullscreen) XF86VidModeGetGamma(dpy, screen, &x11_oldgamma); - ri.Con_Printf(PRINT_ALL, "Using hardware gamma via X11.\n"); + VID_Printf(PRINT_ALL, "Using hardware gamma via X11.\n"); } #else gl_state.hwgamma = true; vid_gamma->modified = true; - ri.Con_Printf(PRINT_ALL, "Using hardware gamma via SDL.\n"); + VID_Printf(PRINT_ALL, "Using hardware gamma via SDL.\n"); #endif /* Window title */ @@ -326,17 +326,17 @@ GLimp_EndFrame(void) int GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen) { - ri.Con_Printf(PRINT_ALL, "setting mode %d:", mode); + VID_Printf(PRINT_ALL, "setting mode %d:", mode); /* mode -1 is not in the vid mode table - so we keep the values in pwidth and pheight and don't even try to look up the mode info */ - if ((mode != -1) && !ri.Vid_GetModeInfo(pwidth, pheight, mode)) + if ((mode != -1) && !VID_GetModeInfo(pwidth, pheight, mode)) { - ri.Con_Printf(PRINT_ALL, " invalid mode\n"); + VID_Printf(PRINT_ALL, " invalid mode\n"); return rserr_invalid_mode; } - ri.Con_Printf(PRINT_ALL, " %d %d\n", *pwidth, *pheight); + VID_Printf(PRINT_ALL, " %d %d\n", *pwidth, *pheight); if (!GLimp_InitGraphics(fullscreen)) { diff --git a/src/client/cl_view.c b/src/client/cl_view.c index e0881ddd..1f9c569d 100644 --- a/src/client/cl_view.c +++ b/src/client/cl_view.c @@ -250,8 +250,7 @@ CL_PrepRefresh(void) /* register models, pics, and skins */ Com_Printf("Map: %s\r", mapname); SCR_UpdateScreen(); - //re.BeginRegistration(mapname); - R_BeginRegistration (mapname); + R_BeginRegistration (mapname); Com_Printf(" \r"); /* precache status bar pics */ diff --git a/src/client/header/client.h b/src/client/header/client.h index 4bd4d295..5d106116 100644 --- a/src/client/header/client.h +++ b/src/client/header/client.h @@ -423,8 +423,6 @@ void IN_Accumulate (void); void CL_ParseLayout (void); -//extern refexport_t re; - void CL_Init (void); void CL_FixUpGender(void); diff --git a/src/client/header/ref.h b/src/client/header/ref.h index 37c23fe9..57c4f54c 100644 --- a/src/client/header/ref.h +++ b/src/client/header/ref.h @@ -28,6 +28,7 @@ #define CL_REF_H #include "../../common/header/common.h" +#include "vid.h" #define MAX_DLIGHTS 32 #define MAX_ENTITIES 128 @@ -116,115 +117,14 @@ typedef struct { particle_t *particles; } refdef_t; -/* - * these are the functions exported by the refresh module - */ -//typedef struct { -// /* if api_version is different, the dll cannot be used */ -// int api_version; -// -// /* called when the library is loaded */ -// int (*Init)(void *hinstance, void *wndproc); -// -// /* called before the library is unloaded */ -// void (*Shutdown)(void); -// -// /* All data that will be used in a level should be -// registered before rendering any frames to prevent disk hits, -// but they can still be registered at a later time -// if necessary. -// -// EndRegistration will free any remaining data that wasn't registered. -// Any model_s or skin_s pointers from before the BeginRegistration -// are no longer valid after EndRegistration. -// -// Skins and images need to be differentiated, because skins -// are flood filled to eliminate mip map edge errors, and pics have -// an implicit "pics/" prepended to the name. (a pic name that starts with a -// slash will not use the "pics/" prefix or the ".pcx" postfix) */ -// void (*BeginRegistration)(char *map); -// struct model_s *(*RegisterModel)(char *name); -// struct image_s *(*RegisterSkin)(char *name); -// struct image_s *(*RegisterPic)(char *name); -// void (*SetSky)(char *name, float rotate, vec3_t axis); -// void (*EndRegistration)(void); -// -// void (*RenderFrame)(refdef_t *fd); -// void (*DrawStretchPic)(int x, int y, int w, int h, char *name); -// void (*DrawChar)(int x, int y, int c); -// void (*DrawGetPicSize)(int *w, int *h, char *name); /* will return 0 0 if not found */ -// void (*DrawPic)(int x, int y, char *name); -// void (*DrawTileClear)(int x, int y, int w, int h, char *name); -// void (*DrawFill)(int x, int y, int w, int h, int c); -// void (*DrawFadeScreen)(void); -// -// /* Draw images for cinematic rendering (which can have a different palette). Note that calls */ -// void (*DrawStretchRaw)(int x, int y, int w, int h, int cols, int rows, byte *data); -// -// /* video mode and refresh state management entry points */ -// void (*CinematicSetPalette)(const unsigned char *palette); /* NULL = game palette */ -// void (*BeginFrame)(float camera_separation); -// void (*EndFrame)(void); -// -// void (*AppActivate)(qboolean activate); -// -//} refexport_t; - -/* - * these are the functions imported by the refresh module - */ -typedef struct { - void (*Sys_Error)(int err_level, char *str, ...); - void (*Sys_Mkdir)(char *path); - void (*Sys_FreeLibrary)(void *handle); - void *(*Sys_LoadLibrary)(const char *path, const char *sym, void **handle); - void *(*Sys_GetProcAddress)(void *handle, const char *sym); - - void (*Cmd_AddCommand)(char *name, void(*cmd)(void)); - void (*Cmd_RemoveCommand)(char *name); - int (*Cmd_Argc)(void); - char *(*Cmd_Argv)(int i); - void (*Cmd_ExecuteText)(int exec_when, char *text); - - void (*Con_Printf)(int print_level, char *str, ...); - - /* files will be memory mapped read only - the returned buffer may be part of a larger pak file, - or a discrete file from anywhere in the quake search path - a -1 return means the file does not exist - NULL can be passed for buf to just determine existance */ - int (*FS_LoadFile)(char *name, void **buf); - void (*FS_FreeFile)(void *buf); - - /* The gamedir is the ./baseq2 directory (read only) and the - ~/.quake2/baseq2 directory for write operations. The later - overrides the first */ - char *(*FS_Gamedir)(void); - - cvar_t *(*Cvar_Get)(char *name, char *value, int flags); - cvar_t *(*Cvar_Set)(char *name, char *value); - void (*Cvar_SetValue)(char *name, float value); - - qboolean(*Vid_GetModeInfo)(int *width, int *height, int mode); - void (*Vid_MenuInit)(void); - void (*Vid_NewWindow)(int width, int height); -} refimport_t; - -/* this is the only function actually exported at the linker level */ -//typedef refexport_t (*R_GetRefAPI_t)(refimport_t); - -/* This will be deleted */ -//refexport_t R_GetRefAPI(refimport_t rimp); -void *R_GetRefAPI(refimport_t rimp); - -/* - * Specifies the model that will be used as the world - */ -void R_BeginRegistration(char *map); +// Soon to be deleted +//void R_GetRefAPI(void); /* * Refresh API */ +void R_BeginRegistration(char *map); +void R_Clear(void); struct model_s *R_RegisterModel(char *name); struct image_s *R_RegisterSkin(char *name); void R_SetSky(char *name, float rotate, vec3_t axis); diff --git a/src/client/header/vid.h b/src/client/header/vid.h index 60cd33af..80cb790b 100644 --- a/src/client/header/vid.h +++ b/src/client/header/vid.h @@ -46,4 +46,10 @@ void VID_MenuInit(void); void VID_MenuDraw(void); const char *VID_MenuKey(int); +void VID_Printf(int print_level, char *fmt, ...); +void VID_Error(int err_level, char *fmt, ...); + +void VID_NewWindow(int width, int height); +qboolean VID_GetModeInfo(int *width, int *height, int mode); + #endif diff --git a/src/client/menu/menu.c b/src/client/menu/menu.c index b3ba9b79..af3d7c44 100644 --- a/src/client/menu/menu.c +++ b/src/client/menu/menu.c @@ -71,8 +71,8 @@ const char *(*m_keyfunc)(int key); typedef struct { - void (*draw)(void); - const char *(*key)(int k); + void (*draw)(void); + const char *(*key)(int k); } menulayer_t; menulayer_t m_layers[MAX_MENU_DEPTH]; @@ -81,42 +81,42 @@ int m_menudepth; static void M_Banner(char *name) { - int w, h; + int w, h; - Draw_GetPicSize(&w, &h, name); - Draw_Pic(viddef.width / 2 - w / 2, viddef.height / 2 - 110, name); + Draw_GetPicSize(&w, &h, name); + Draw_Pic(viddef.width / 2 - w / 2, viddef.height / 2 - 110, name); } void M_ForceMenuOff(void) { - m_drawfunc = NULL; - m_keyfunc = NULL; - cls.key_dest = key_game; - m_menudepth = 0; - Key_ClearStates(); - Cvar_Set("paused", "0"); + m_drawfunc = NULL; + m_keyfunc = NULL; + cls.key_dest = key_game; + m_menudepth = 0; + Key_ClearStates(); + Cvar_Set("paused", "0"); } void M_PopMenu(void) { - S_StartLocalSound(menu_out_sound); + S_StartLocalSound(menu_out_sound); - if (m_menudepth < 1) - { - Com_Error(ERR_FATAL, "M_PopMenu: depth < 1"); - } + if (m_menudepth < 1) + { + Com_Error(ERR_FATAL, "M_PopMenu: depth < 1"); + } - m_menudepth--; + m_menudepth--; - m_drawfunc = m_layers[m_menudepth].draw; - m_keyfunc = m_layers[m_menudepth].key; + m_drawfunc = m_layers[m_menudepth].draw; + m_keyfunc = m_layers[m_menudepth].key; - if (!m_menudepth) - { - M_ForceMenuOff(); - } + if (!m_menudepth) + { + M_ForceMenuOff(); + } } /* @@ -140,188 +140,188 @@ M_PopMenu(void) static void M_PushMenu(void (*draw)(void), const char *(*key)(int)) { - int i; - int alreadyPresent = 0; + int i; + int alreadyPresent = 0; - if ((Cvar_VariableValue("maxclients") == 1) && - Com_ServerState()) - { - Cvar_Set("paused", "1"); - } + if ((Cvar_VariableValue("maxclients") == 1) && + Com_ServerState()) + { + Cvar_Set("paused", "1"); + } - /* if this menu is already open (and on top), - close it => toggling behaviour */ - if ((m_drawfunc == draw) && (m_keyfunc == key)) - { - M_PopMenu(); - return; - } + /* if this menu is already open (and on top), + close it => toggling behaviour */ + if ((m_drawfunc == draw) && (m_keyfunc == key)) + { + M_PopMenu(); + return; + } - /* if this menu is already present, drop back to - that level to avoid stacking menus by hotkeys */ - for (i = 0; i < m_menudepth; i++) - { - if ((m_layers[i].draw == draw) && - (m_layers[i].key == key)) - { - alreadyPresent = 1; - break; - } - } + /* if this menu is already present, drop back to + that level to avoid stacking menus by hotkeys */ + for (i = 0; i < m_menudepth; i++) + { + if ((m_layers[i].draw == draw) && + (m_layers[i].key == key)) + { + alreadyPresent = 1; + break; + } + } - /* menu was already opened further down the stack */ - while (alreadyPresent && i <= m_menudepth) - { - M_PopMenu(); /* decrements m_menudepth */ - } + /* menu was already opened further down the stack */ + while (alreadyPresent && i <= m_menudepth) + { + M_PopMenu(); /* decrements m_menudepth */ + } - if (m_menudepth >= MAX_MENU_DEPTH) - { - Com_Printf("Too many open menus!\n"); - return; - } + if (m_menudepth >= MAX_MENU_DEPTH) + { + Com_Printf("Too many open menus!\n"); + return; + } - m_layers[m_menudepth].draw = m_drawfunc; - m_layers[m_menudepth].key = m_keyfunc; - m_menudepth++; + m_layers[m_menudepth].draw = m_drawfunc; + m_layers[m_menudepth].key = m_keyfunc; + m_menudepth++; - m_drawfunc = draw; - m_keyfunc = key; + m_drawfunc = draw; + m_keyfunc = key; - m_entersound = true; + m_entersound = true; - cls.key_dest = key_menu; + cls.key_dest = key_menu; } const char * Default_MenuKey(menuframework_s *m, int key) { - const char *sound = NULL; - menucommon_s *item; + const char *sound = NULL; + menucommon_s *item; - if (m) - { - if ((item = Menu_ItemAtCursor(m)) != 0) - { - if (item->type == MTYPE_FIELD) - { - if (Field_Key((menufield_s *)item, key)) - { - return NULL; - } - } - } - } + if (m) + { + if ((item = Menu_ItemAtCursor(m)) != 0) + { + if (item->type == MTYPE_FIELD) + { + if (Field_Key((menufield_s *)item, key)) + { + return NULL; + } + } + } + } - switch (key) - { - case K_ESCAPE: - M_PopMenu(); - return menu_out_sound; - case K_KP_UPARROW: - case K_UPARROW: + switch (key) + { + case K_ESCAPE: + M_PopMenu(); + return menu_out_sound; + case K_KP_UPARROW: + case K_UPARROW: - if (m) - { - m->cursor--; - Menu_AdjustCursor(m, -1); - sound = menu_move_sound; - } + if (m) + { + m->cursor--; + Menu_AdjustCursor(m, -1); + sound = menu_move_sound; + } - break; - case K_TAB: + break; + case K_TAB: - if (m) - { - m->cursor++; - Menu_AdjustCursor(m, 1); - sound = menu_move_sound; - } + if (m) + { + m->cursor++; + Menu_AdjustCursor(m, 1); + sound = menu_move_sound; + } - break; - case K_KP_DOWNARROW: - case K_DOWNARROW: + break; + case K_KP_DOWNARROW: + case K_DOWNARROW: - if (m) - { - m->cursor++; - Menu_AdjustCursor(m, 1); - sound = menu_move_sound; - } + if (m) + { + m->cursor++; + Menu_AdjustCursor(m, 1); + sound = menu_move_sound; + } - break; - case K_KP_LEFTARROW: - case K_LEFTARROW: + break; + case K_KP_LEFTARROW: + case K_LEFTARROW: - if (m) - { - Menu_SlideItem(m, -1); - sound = menu_move_sound; - } + if (m) + { + Menu_SlideItem(m, -1); + sound = menu_move_sound; + } - break; - case K_KP_RIGHTARROW: - case K_RIGHTARROW: + break; + case K_KP_RIGHTARROW: + case K_RIGHTARROW: - if (m) - { - Menu_SlideItem(m, 1); - sound = menu_move_sound; - } + if (m) + { + Menu_SlideItem(m, 1); + sound = menu_move_sound; + } - break; + break; - case K_MOUSE1: - case K_MOUSE2: - case K_MOUSE3: - case K_MOUSE4: - case K_MOUSE5: - case K_AUX1: - case K_AUX2: - case K_AUX3: - case K_AUX4: - case K_AUX5: - case K_AUX6: - case K_AUX7: - case K_AUX8: - case K_AUX9: - case K_AUX10: - case K_AUX11: - case K_AUX12: - case K_AUX13: - case K_AUX14: - case K_AUX15: - case K_AUX16: - case K_AUX17: - case K_AUX18: - case K_AUX19: - case K_AUX20: - case K_AUX21: - case K_AUX22: - case K_AUX23: - case K_AUX24: - case K_AUX25: - case K_AUX26: - case K_AUX27: - case K_AUX28: - case K_AUX29: - case K_AUX30: - case K_AUX31: - case K_AUX32: + case K_MOUSE1: + case K_MOUSE2: + case K_MOUSE3: + case K_MOUSE4: + case K_MOUSE5: + case K_AUX1: + case K_AUX2: + case K_AUX3: + case K_AUX4: + case K_AUX5: + case K_AUX6: + case K_AUX7: + case K_AUX8: + case K_AUX9: + case K_AUX10: + case K_AUX11: + case K_AUX12: + case K_AUX13: + case K_AUX14: + case K_AUX15: + case K_AUX16: + case K_AUX17: + case K_AUX18: + case K_AUX19: + case K_AUX20: + case K_AUX21: + case K_AUX22: + case K_AUX23: + case K_AUX24: + case K_AUX25: + case K_AUX26: + case K_AUX27: + case K_AUX28: + case K_AUX29: + case K_AUX30: + case K_AUX31: + case K_AUX32: - case K_KP_ENTER: - case K_ENTER: + case K_KP_ENTER: + case K_ENTER: - if (m) - { - Menu_SelectItem(m); - } + if (m) + { + Menu_SelectItem(m); + } - sound = menu_move_sound; - break; - } + sound = menu_move_sound; + break; + } - return sound; + return sound; } /* @@ -331,38 +331,38 @@ Default_MenuKey(menuframework_s *m, int key) static void M_DrawCharacter(int cx, int cy, int num) { - Draw_Char(cx + ((viddef.width - 320) >> 1), cy + ((viddef.height - 240) >> 1), num); + Draw_Char(cx + ((viddef.width - 320) >> 1), cy + ((viddef.height - 240) >> 1), num); } static void M_Print(int x, int y, char *str) { - int cx, cy; + int cx, cy; - cx = x; - cy = y; - while (*str) - { - if (*str == '\n') - { - cx = x; - cy += 8; - } - else - { - M_DrawCharacter(cx, cy, (*str) + 128); - cx += 8; - } - str++; - } + cx = x; + cy = y; + while (*str) + { + if (*str == '\n') + { + cx = x; + cy += 8; + } + else + { + M_DrawCharacter(cx, cy, (*str) + 128); + cx += 8; + } + str++; + } } void M_DrawPic(int x, int y, char *pic) { - Draw_Pic(x + ((viddef.width - 320) >> 1), - y + ((viddef.height - 240) >> 1), - pic); + Draw_Pic(x + ((viddef.width - 320) >> 1), + y + ((viddef.height - 240) >> 1), + pic); } /* @@ -373,76 +373,76 @@ M_DrawPic(int x, int y, char *pic) static void M_DrawCursor(int x, int y, int f) { - char cursorname[80]; - static qboolean cached; + char cursorname[80]; + static qboolean cached; - if (!cached) - { - int i; + if (!cached) + { + int i; - for (i = 0; i < NUM_CURSOR_FRAMES; i++) - { - Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", i); + for (i = 0; i < NUM_CURSOR_FRAMES; i++) + { + Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", i); - Draw_FindPic(cursorname); - } + Draw_FindPic(cursorname); + } - cached = true; - } + cached = true; + } - Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", f); - Draw_Pic(x, y, cursorname); + Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", f); + Draw_Pic(x, y, cursorname); } static void M_DrawTextBox(int x, int y, int width, int lines) { - int cx, cy; - int n; + int cx, cy; + int n; - /* draw left side */ - cx = x; - cy = y; - M_DrawCharacter(cx, cy, 1); + /* draw left side */ + cx = x; + cy = y; + M_DrawCharacter(cx, cy, 1); - for (n = 0; n < lines; n++) - { - cy += 8; - M_DrawCharacter(cx, cy, 4); - } + for (n = 0; n < lines; n++) + { + cy += 8; + M_DrawCharacter(cx, cy, 4); + } - M_DrawCharacter(cx, cy + 8, 7); + M_DrawCharacter(cx, cy + 8, 7); - /* draw middle */ - cx += 8; + /* draw middle */ + cx += 8; - while (width > 0) - { - cy = y; - M_DrawCharacter(cx, cy, 2); + while (width > 0) + { + cy = y; + M_DrawCharacter(cx, cy, 2); - for (n = 0; n < lines; n++) - { - cy += 8; - M_DrawCharacter(cx, cy, 5); - } + for (n = 0; n < lines; n++) + { + cy += 8; + M_DrawCharacter(cx, cy, 5); + } - M_DrawCharacter(cx, cy + 8, 8); - width -= 1; - cx += 8; - } + M_DrawCharacter(cx, cy + 8, 8); + width -= 1; + cx += 8; + } - /* draw right side */ - cy = y; - M_DrawCharacter(cx, cy, 3); + /* draw right side */ + cy = y; + M_DrawCharacter(cx, cy, 3); - for (n = 0; n < lines; n++) - { - cy += 8; - M_DrawCharacter(cx, cy, 6); - } + for (n = 0; n < lines; n++) + { + cy += 8; + M_DrawCharacter(cx, cy, 6); + } - M_DrawCharacter(cx, cy + 8, 9); + M_DrawCharacter(cx, cy + 8, 9); } static char *m_popup_string; @@ -451,53 +451,53 @@ static int m_popup_endtime; static void M_Popup(void) { - int x, y, width, lines; - int n; - char *str; + int x, y, width, lines; + int n; + char *str; - if (!m_popup_string) - { - return; - } + if (!m_popup_string) + { + return; + } - if (m_popup_endtime && m_popup_endtime < cls.realtime) - { - m_popup_string = NULL; - return; - } + if (m_popup_endtime && m_popup_endtime < cls.realtime) + { + m_popup_string = NULL; + return; + } - width = lines = n = 0; - for (str = m_popup_string; *str; str++) - { - if (*str == '\n') - { - lines++; - n = 0; - } - else - { - n++; - if (n > width) - { - width = n; - } - } - } - if (n) - { - lines++; - } + width = lines = n = 0; + for (str = m_popup_string; *str; str++) + { + if (*str == '\n') + { + lines++; + n = 0; + } + else + { + n++; + if (n > width) + { + width = n; + } + } + } + if (n) + { + lines++; + } - if (width) - { - width += 2; + if (width) + { + width += 2; - x = (320 - (width + 2) * 8) / 2; - y = (240 - (lines + 2) * 8) / 3; + x = (320 - (width + 2) * 8) / 2; + y = (240 - (lines + 2) * 8) / 3; - M_DrawTextBox(x, y, width, lines); - M_Print(x + 16, y + 8, m_popup_string); - } + M_DrawTextBox(x, y, width, lines); + M_Print(x + 16, y + 8, m_popup_string); + } } /* @@ -509,124 +509,125 @@ M_Popup(void) static void M_Main_Draw(void) { - int i; - int w, h; - int ystart; - int xoffset; - int widest = -1; - int totalheight = 0; - char litname[80]; - char *names[] = { - "m_main_game", - "m_main_multiplayer", - "m_main_options", - "m_main_video", - "m_main_quit", - 0 - }; + int i; + int w, h; + int ystart; + int xoffset; + int widest = -1; + int totalheight = 0; + char litname[80]; + char *names[] = + { + "m_main_game", + "m_main_multiplayer", + "m_main_options", + "m_main_video", + "m_main_quit", + 0 + }; - for (i = 0; names[i] != 0; i++) - { - Draw_GetPicSize(&w, &h, names[i]); + for (i = 0; names[i] != 0; i++) + { + Draw_GetPicSize(&w, &h, names[i]); - if (w > widest) - { - widest = w; - } + if (w > widest) + { + widest = w; + } - totalheight += (h + 12); - } + totalheight += (h + 12); + } - ystart = (viddef.height / 2 - 110); - xoffset = (viddef.width - widest + 70) / 2; + ystart = (viddef.height / 2 - 110); + xoffset = (viddef.width - widest + 70) / 2; - for (i = 0; names[i] != 0; i++) - { - if (i != m_main_cursor) - { - Draw_Pic(xoffset, ystart + i * 40 + 13, names[i]); - } - } + for (i = 0; names[i] != 0; i++) + { + if (i != m_main_cursor) + { + Draw_Pic(xoffset, ystart + i * 40 + 13, names[i]); + } + } - strcpy(litname, names[m_main_cursor]); - strcat(litname, "_sel"); - Draw_Pic(xoffset, ystart + m_main_cursor * 40 + 13, litname); + strcpy(litname, names[m_main_cursor]); + strcat(litname, "_sel"); + Draw_Pic(xoffset, ystart + m_main_cursor * 40 + 13, litname); - M_DrawCursor(xoffset - 25, ystart + m_main_cursor * 40 + 11, - (int)(cls.realtime / 100) % NUM_CURSOR_FRAMES); + M_DrawCursor(xoffset - 25, ystart + m_main_cursor * 40 + 11, + (int)(cls.realtime / 100) % NUM_CURSOR_FRAMES); - Draw_GetPicSize(&w, &h, "m_main_plaque"); - Draw_Pic(xoffset - 30 - w, ystart, "m_main_plaque"); + Draw_GetPicSize(&w, &h, "m_main_plaque"); + Draw_Pic(xoffset - 30 - w, ystart, "m_main_plaque"); - Draw_Pic(xoffset - 30 - w, ystart + h + 5, "m_main_logo"); + Draw_Pic(xoffset - 30 - w, ystart + h + 5, "m_main_logo"); } const char * M_Main_Key(int key) { - const char *sound = menu_move_sound; + const char *sound = menu_move_sound; - switch (key) - { - case K_ESCAPE: - M_PopMenu(); - break; + switch (key) + { + case K_ESCAPE: + M_PopMenu(); + break; - case K_KP_DOWNARROW: - case K_DOWNARROW: + case K_KP_DOWNARROW: + case K_DOWNARROW: - if (++m_main_cursor >= MAIN_ITEMS) - { - m_main_cursor = 0; - } + if (++m_main_cursor >= MAIN_ITEMS) + { + m_main_cursor = 0; + } - return sound; + return sound; - case K_KP_UPARROW: - case K_UPARROW: + case K_KP_UPARROW: + case K_UPARROW: - if (--m_main_cursor < 0) - { - m_main_cursor = MAIN_ITEMS - 1; - } + if (--m_main_cursor < 0) + { + m_main_cursor = MAIN_ITEMS - 1; + } - return sound; + return sound; - case K_KP_ENTER: - case K_ENTER: - m_entersound = true; + case K_KP_ENTER: + case K_ENTER: + m_entersound = true; - switch (m_main_cursor) - { - case 0: - M_Menu_Game_f(); - break; + switch (m_main_cursor) + { + case 0: + M_Menu_Game_f(); + break; - case 1: - M_Menu_Multiplayer_f(); - break; + case 1: + M_Menu_Multiplayer_f(); + break; - case 2: - M_Menu_Options_f(); - break; + case 2: + M_Menu_Options_f(); + break; - case 3: - M_Menu_Video_f(); - break; + case 3: + M_Menu_Video_f(); + break; - case 4: - M_Menu_Quit_f(); - break; - } - } + case 4: + M_Menu_Quit_f(); + break; + } + } - return NULL; + return NULL; } void M_Menu_Main_f(void) { - M_PushMenu(M_Main_Draw, M_Main_Key); + M_PushMenu(M_Main_Draw, M_Main_Key); } /* @@ -641,108 +642,109 @@ static menuaction_s s_player_setup_action; static void Multiplayer_MenuDraw(void) { - M_Banner("m_banner_multiplayer"); + M_Banner("m_banner_multiplayer"); - Menu_AdjustCursor(&s_multiplayer_menu, 1); - Menu_Draw(&s_multiplayer_menu); + Menu_AdjustCursor(&s_multiplayer_menu, 1); + Menu_Draw(&s_multiplayer_menu); } static void PlayerSetupFunc(void *unused) { - M_Menu_PlayerConfig_f(); + M_Menu_PlayerConfig_f(); } static void JoinNetworkServerFunc(void *unused) { - M_Menu_JoinServer_f(); + M_Menu_JoinServer_f(); } static void StartNetworkServerFunc(void *unused) { - M_Menu_StartServer_f(); + M_Menu_StartServer_f(); } static void Multiplayer_MenuInit(void) { - s_multiplayer_menu.x = (int)(viddef.width * 0.50f) - 64; - s_multiplayer_menu.nitems = 0; + s_multiplayer_menu.x = (int)(viddef.width * 0.50f) - 64; + s_multiplayer_menu.nitems = 0; - s_join_network_server_action.generic.type = MTYPE_ACTION; - s_join_network_server_action.generic.flags = QMF_LEFT_JUSTIFY; - s_join_network_server_action.generic.x = 0; - s_join_network_server_action.generic.y = 0; - s_join_network_server_action.generic.name = " join network server"; - s_join_network_server_action.generic.callback = JoinNetworkServerFunc; + s_join_network_server_action.generic.type = MTYPE_ACTION; + s_join_network_server_action.generic.flags = QMF_LEFT_JUSTIFY; + s_join_network_server_action.generic.x = 0; + s_join_network_server_action.generic.y = 0; + s_join_network_server_action.generic.name = " join network server"; + s_join_network_server_action.generic.callback = JoinNetworkServerFunc; - s_start_network_server_action.generic.type = MTYPE_ACTION; - s_start_network_server_action.generic.flags = QMF_LEFT_JUSTIFY; - s_start_network_server_action.generic.x = 0; - s_start_network_server_action.generic.y = 10; - s_start_network_server_action.generic.name = " start network server"; - s_start_network_server_action.generic.callback = StartNetworkServerFunc; + s_start_network_server_action.generic.type = MTYPE_ACTION; + s_start_network_server_action.generic.flags = QMF_LEFT_JUSTIFY; + s_start_network_server_action.generic.x = 0; + s_start_network_server_action.generic.y = 10; + s_start_network_server_action.generic.name = " start network server"; + s_start_network_server_action.generic.callback = StartNetworkServerFunc; - s_player_setup_action.generic.type = MTYPE_ACTION; - s_player_setup_action.generic.flags = QMF_LEFT_JUSTIFY; - s_player_setup_action.generic.x = 0; - s_player_setup_action.generic.y = 20; - s_player_setup_action.generic.name = " player setup"; - s_player_setup_action.generic.callback = PlayerSetupFunc; + s_player_setup_action.generic.type = MTYPE_ACTION; + s_player_setup_action.generic.flags = QMF_LEFT_JUSTIFY; + s_player_setup_action.generic.x = 0; + s_player_setup_action.generic.y = 20; + s_player_setup_action.generic.name = " player setup"; + s_player_setup_action.generic.callback = PlayerSetupFunc; - Menu_AddItem(&s_multiplayer_menu, (void *)&s_join_network_server_action); - Menu_AddItem(&s_multiplayer_menu, (void *)&s_start_network_server_action); - Menu_AddItem(&s_multiplayer_menu, (void *)&s_player_setup_action); + Menu_AddItem(&s_multiplayer_menu, (void *)&s_join_network_server_action); + Menu_AddItem(&s_multiplayer_menu, (void *)&s_start_network_server_action); + Menu_AddItem(&s_multiplayer_menu, (void *)&s_player_setup_action); - Menu_SetStatusBar(&s_multiplayer_menu, NULL); + Menu_SetStatusBar(&s_multiplayer_menu, NULL); - Menu_Center(&s_multiplayer_menu); + Menu_Center(&s_multiplayer_menu); } static const char * Multiplayer_MenuKey(int key) { - return Default_MenuKey(&s_multiplayer_menu, key); + return Default_MenuKey(&s_multiplayer_menu, key); } static void M_Menu_Multiplayer_f(void) { - Multiplayer_MenuInit(); - M_PushMenu(Multiplayer_MenuDraw, Multiplayer_MenuKey); + Multiplayer_MenuInit(); + M_PushMenu(Multiplayer_MenuDraw, Multiplayer_MenuKey); } /* * KEYS MENU */ -char *bindnames[][2] = { - {"+attack", "attack"}, - {"weapnext", "next weapon"}, - {"weapprev", "previous weapon"}, - {"+forward", "walk forward"}, - {"+back", "backpedal"}, - {"+left", "turn left"}, - {"+right", "turn right"}, - {"+speed", "run"}, - {"+moveleft", "step left"}, - {"+moveright", "step right"}, - {"+strafe", "sidestep"}, - {"+lookup", "look up"}, - {"+lookdown", "look down"}, - {"centerview", "center view"}, - {"+mlook", "mouse look"}, - {"+klook", "keyboard look"}, - {"+moveup", "up / jump"}, - {"+movedown", "down / crouch"}, - {"inven", "inventory"}, - {"invuse", "use item"}, - {"invdrop", "drop item"}, - {"invprev", "prev item"}, - {"invnext", "next item"}, - {"cmd help", "help computer"} +char *bindnames[][2] = +{ + {"+attack", "attack"}, + {"weapnext", "next weapon"}, + {"weapprev", "previous weapon"}, + {"+forward", "walk forward"}, + {"+back", "backpedal"}, + {"+left", "turn left"}, + {"+right", "turn right"}, + {"+speed", "run"}, + {"+moveleft", "step left"}, + {"+moveright", "step right"}, + {"+strafe", "sidestep"}, + {"+lookup", "look up"}, + {"+lookdown", "look down"}, + {"centerview", "center view"}, + {"+mlook", "mouse look"}, + {"+klook", "keyboard look"}, + {"+moveup", "up / jump"}, + {"+movedown", "down / crouch"}, + {"inven", "inventory"}, + {"invuse", "use item"}, + {"invdrop", "drop item"}, + {"invprev", "prev item"}, + {"invnext", "next item"}, + {"cmd help", "help computer"} }; #define NUM_BINDNAMES (sizeof bindnames / sizeof bindnames[0]) @@ -755,207 +757,207 @@ static menuaction_s s_keys_actions[NUM_BINDNAMES]; static void M_UnbindCommand(char *command) { - int j; - int l; - char *b; + int j; + int l; + char *b; - l = strlen(command); + l = strlen(command); - for (j = 0; j < 256; j++) - { - b = keybindings[j]; + for (j = 0; j < 256; j++) + { + b = keybindings[j]; - if (!b) - { - continue; - } + if (!b) + { + continue; + } - if (!strncmp(b, command, l)) - { - Key_SetBinding(j, ""); - } - } + if (!strncmp(b, command, l)) + { + Key_SetBinding(j, ""); + } + } } static void M_FindKeysForCommand(char *command, int *twokeys) { - int count; - int j; - int l; - char *b; + int count; + int j; + int l; + char *b; - twokeys[0] = twokeys[1] = -1; - l = strlen(command); - count = 0; + twokeys[0] = twokeys[1] = -1; + l = strlen(command); + count = 0; - for (j = 0; j < 256; j++) - { - b = keybindings[j]; + for (j = 0; j < 256; j++) + { + b = keybindings[j]; - if (!b) - { - continue; - } + if (!b) + { + continue; + } - if (!strncmp(b, command, l)) - { - twokeys[count] = j; - count++; + if (!strncmp(b, command, l)) + { + twokeys[count] = j; + count++; - if (count == 2) - { - break; - } - } - } + if (count == 2) + { + break; + } + } + } } static void KeyCursorDrawFunc(menuframework_s *menu) { - if (bind_grab) - { - Draw_Char(menu->x, menu->y + menu->cursor * 9, '='); - } + if (bind_grab) + { + Draw_Char(menu->x, menu->y + menu->cursor * 9, '='); + } - else - { - Draw_Char(menu->x, menu->y + menu->cursor * 9, 12 + - ((int)(Sys_Milliseconds() / 250) & 1)); - } + else + { + Draw_Char(menu->x, menu->y + menu->cursor * 9, 12 + + ((int)(Sys_Milliseconds() / 250) & 1)); + } } static void DrawKeyBindingFunc(void *self) { - int keys[2]; - menuaction_s *a = (menuaction_s *)self; + int keys[2]; + menuaction_s *a = (menuaction_s *)self; - M_FindKeysForCommand(bindnames[a->generic.localdata[0]][0], keys); + M_FindKeysForCommand(bindnames[a->generic.localdata[0]][0], keys); - if (keys[0] == -1) - { - Menu_DrawString(a->generic.x + a->generic.parent->x + 16, - a->generic.y + a->generic.parent->y, "???"); - } - else - { - int x; - const char *name; + if (keys[0] == -1) + { + Menu_DrawString(a->generic.x + a->generic.parent->x + 16, + a->generic.y + a->generic.parent->y, "???"); + } + else + { + int x; + const char *name; - name = Key_KeynumToString(keys[0]); + name = Key_KeynumToString(keys[0]); - Menu_DrawString(a->generic.x + a->generic.parent->x + 16, - a->generic.y + a->generic.parent->y, name); + Menu_DrawString(a->generic.x + a->generic.parent->x + 16, + a->generic.y + a->generic.parent->y, name); - x = strlen(name) * 8; + x = strlen(name) * 8; - if (keys[1] != -1) - { - Menu_DrawString(a->generic.x + a->generic.parent->x + 24 + x, - a->generic.y + a->generic.parent->y, "or"); - Menu_DrawString(a->generic.x + a->generic.parent->x + 48 + x, - a->generic.y + a->generic.parent->y, - Key_KeynumToString(keys[1])); - } - } + if (keys[1] != -1) + { + Menu_DrawString(a->generic.x + a->generic.parent->x + 24 + x, + a->generic.y + a->generic.parent->y, "or"); + Menu_DrawString(a->generic.x + a->generic.parent->x + 48 + x, + a->generic.y + a->generic.parent->y, + Key_KeynumToString(keys[1])); + } + } } static void KeyBindingFunc(void *self) { - menuaction_s *a = (menuaction_s *)self; - int keys[2]; + menuaction_s *a = (menuaction_s *)self; + int keys[2]; - M_FindKeysForCommand(bindnames[a->generic.localdata[0]][0], keys); + M_FindKeysForCommand(bindnames[a->generic.localdata[0]][0], keys); - if (keys[1] != -1) - { - M_UnbindCommand(bindnames[a->generic.localdata[0]][0]); - } + if (keys[1] != -1) + { + M_UnbindCommand(bindnames[a->generic.localdata[0]][0]); + } - bind_grab = true; + bind_grab = true; - Menu_SetStatusBar(&s_keys_menu, "press a key or button for this action"); + Menu_SetStatusBar(&s_keys_menu, "press a key or button for this action"); } static void Keys_MenuInit(void) { - int i; + int i; - s_keys_menu.x = (int)(viddef.width * 0.50f); - s_keys_menu.nitems = 0; - s_keys_menu.cursordraw = KeyCursorDrawFunc; + s_keys_menu.x = (int)(viddef.width * 0.50f); + s_keys_menu.nitems = 0; + s_keys_menu.cursordraw = KeyCursorDrawFunc; - for (i = 0; i < NUM_BINDNAMES; i++) - { - s_keys_actions[i].generic.type = MTYPE_ACTION; - s_keys_actions[i].generic.flags = QMF_GRAYED; - s_keys_actions[i].generic.x = 0; - s_keys_actions[i].generic.y = i * 9; - s_keys_actions[i].generic.ownerdraw = DrawKeyBindingFunc; - s_keys_actions[i].generic.localdata[0] = i; - s_keys_actions[i].generic.name = - bindnames[s_keys_actions[i].generic.localdata[0]][1]; + for (i = 0; i < NUM_BINDNAMES; i++) + { + s_keys_actions[i].generic.type = MTYPE_ACTION; + s_keys_actions[i].generic.flags = QMF_GRAYED; + s_keys_actions[i].generic.x = 0; + s_keys_actions[i].generic.y = i * 9; + s_keys_actions[i].generic.ownerdraw = DrawKeyBindingFunc; + s_keys_actions[i].generic.localdata[0] = i; + s_keys_actions[i].generic.name = + bindnames[s_keys_actions[i].generic.localdata[0]][1]; - Menu_AddItem(&s_keys_menu, (void *)&s_keys_actions[i]); - } + Menu_AddItem(&s_keys_menu, (void *)&s_keys_actions[i]); + } - Menu_SetStatusBar(&s_keys_menu, "ENTER to change, BACKSPACE to clear"); - Menu_Center(&s_keys_menu); + Menu_SetStatusBar(&s_keys_menu, "ENTER to change, BACKSPACE to clear"); + Menu_Center(&s_keys_menu); } static void Keys_MenuDraw(void) { - Menu_AdjustCursor(&s_keys_menu, 1); - Menu_Draw(&s_keys_menu); + Menu_AdjustCursor(&s_keys_menu, 1); + Menu_Draw(&s_keys_menu); } static const char * Keys_MenuKey(int key) { - menuaction_s *item = (menuaction_s *)Menu_ItemAtCursor(&s_keys_menu); + menuaction_s *item = (menuaction_s *)Menu_ItemAtCursor(&s_keys_menu); - if (bind_grab) - { - if ((key != K_ESCAPE) && (key != '`')) - { - char cmd[1024]; + if (bind_grab) + { + if ((key != K_ESCAPE) && (key != '`')) + { + char cmd[1024]; - Com_sprintf(cmd, sizeof(cmd), "bind \"%s\" \"%s\"\n", - Key_KeynumToString(key), bindnames[item->generic.localdata[0]][0]); - Cbuf_InsertText(cmd); - } + Com_sprintf(cmd, sizeof(cmd), "bind \"%s\" \"%s\"\n", + Key_KeynumToString(key), bindnames[item->generic.localdata[0]][0]); + Cbuf_InsertText(cmd); + } - Menu_SetStatusBar(&s_keys_menu, "ENTER to change, BACKSPACE to clear"); - bind_grab = false; - return menu_out_sound; - } + Menu_SetStatusBar(&s_keys_menu, "ENTER to change, BACKSPACE to clear"); + bind_grab = false; + return menu_out_sound; + } - switch (key) - { - case K_KP_ENTER: - case K_ENTER: - KeyBindingFunc(item); - return menu_in_sound; - case K_BACKSPACE: /* delete bindings */ - case K_DEL: /* delete bindings */ - case K_KP_DEL: - M_UnbindCommand(bindnames[item->generic.localdata[0]][0]); - return menu_out_sound; - default: - return Default_MenuKey(&s_keys_menu, key); - } + switch (key) + { + case K_KP_ENTER: + case K_ENTER: + KeyBindingFunc(item); + return menu_in_sound; + case K_BACKSPACE: /* delete bindings */ + case K_DEL: /* delete bindings */ + case K_KP_DEL: + M_UnbindCommand(bindnames[item->generic.localdata[0]][0]); + return menu_out_sound; + default: + return Default_MenuKey(&s_keys_menu, key); + } } static void M_Menu_Keys_f(void) { - Keys_MenuInit(); - M_PushMenu(Keys_MenuDraw, Keys_MenuKey); + Keys_MenuInit(); + M_PushMenu(Keys_MenuDraw, Keys_MenuKey); } /* @@ -988,169 +990,169 @@ static menulist_s s_options_console_action; static void CrosshairFunc(void *unused) { - Cvar_SetValue("crosshair", (float)s_options_crosshair_box.curvalue); + Cvar_SetValue("crosshair", (float)s_options_crosshair_box.curvalue); } static void CustomizeControlsFunc(void *unused) { - M_Menu_Keys_f(); + M_Menu_Keys_f(); } static void AlwaysRunFunc(void *unused) { - Cvar_SetValue("cl_run", (float)s_options_alwaysrun_box.curvalue); + Cvar_SetValue("cl_run", (float)s_options_alwaysrun_box.curvalue); } static void FreeLookFunc(void *unused) { - Cvar_SetValue("freelook", (float)s_options_freelook_box.curvalue); + Cvar_SetValue("freelook", (float)s_options_freelook_box.curvalue); } static void MouseSpeedFunc(void *unused) { - Cvar_SetValue("sensitivity", s_options_sensitivity_slider.curvalue / 2.0F); + Cvar_SetValue("sensitivity", s_options_sensitivity_slider.curvalue / 2.0F); } static float ClampCvar(float min, float max, float value) { - if (value < min) - { - return min; - } + if (value < min) + { + return min; + } - if (value > max) - { - return max; - } + if (value > max) + { + return max; + } - return value; + return value; } static void ControlsSetMenuItemValues(void) { - s_options_sfxvolume_slider.curvalue = Cvar_VariableValue("s_volume") * 10; + s_options_sfxvolume_slider.curvalue = Cvar_VariableValue("s_volume") * 10; #ifdef CDA - s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd"); + s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd"); #endif #ifdef OGG - s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable"); + s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable"); - cvar_t *ogg; - ogg = Cvar_Get("ogg_sequence", "loop", CVAR_ARCHIVE); + cvar_t *ogg; + ogg = Cvar_Get("ogg_sequence", "loop", CVAR_ARCHIVE); - if (!strcmp(ogg->string, "random")) - { - s_options_cdshuffle_box.curvalue = 1; - } - else - { - s_options_cdshuffle_box.curvalue = 0; - } + if (!strcmp(ogg->string, "random")) + { + s_options_cdshuffle_box.curvalue = 1; + } + else + { + s_options_cdshuffle_box.curvalue = 0; + } #endif - s_options_quality_list.curvalue = !Cvar_VariableValue("s_loadas8bit"); - s_options_sensitivity_slider.curvalue = (sensitivity->value) * 2; + s_options_quality_list.curvalue = !Cvar_VariableValue("s_loadas8bit"); + s_options_sensitivity_slider.curvalue = (sensitivity->value) * 2; - Cvar_SetValue("cl_run", ClampCvar(0, 1, cl_run->value)); - s_options_alwaysrun_box.curvalue = cl_run->value; + Cvar_SetValue("cl_run", ClampCvar(0, 1, cl_run->value)); + s_options_alwaysrun_box.curvalue = cl_run->value; - s_options_invertmouse_box.curvalue = m_pitch->value < 0; + s_options_invertmouse_box.curvalue = m_pitch->value < 0; - Cvar_SetValue("lookspring", ClampCvar(0, 1, lookspring->value)); - s_options_lookspring_box.curvalue = lookspring->value; + Cvar_SetValue("lookspring", ClampCvar(0, 1, lookspring->value)); + s_options_lookspring_box.curvalue = lookspring->value; - Cvar_SetValue("lookstrafe", ClampCvar(0, 1, lookstrafe->value)); - s_options_lookstrafe_box.curvalue = lookstrafe->value; + Cvar_SetValue("lookstrafe", ClampCvar(0, 1, lookstrafe->value)); + s_options_lookstrafe_box.curvalue = lookstrafe->value; - Cvar_SetValue("freelook", ClampCvar(0, 1, freelook->value)); - s_options_freelook_box.curvalue = freelook->value; + Cvar_SetValue("freelook", ClampCvar(0, 1, freelook->value)); + s_options_freelook_box.curvalue = freelook->value; - Cvar_SetValue("crosshair", ClampCvar(0, 3, crosshair->value)); - s_options_crosshair_box.curvalue = crosshair->value; + Cvar_SetValue("crosshair", ClampCvar(0, 3, crosshair->value)); + s_options_crosshair_box.curvalue = crosshair->value; } static void ControlsResetDefaultsFunc(void *unused) { - Cbuf_AddText("exec default.cfg\n"); - Cbuf_AddText("exec yq2.cfg\n"); - Cbuf_Execute(); + Cbuf_AddText("exec default.cfg\n"); + Cbuf_AddText("exec yq2.cfg\n"); + Cbuf_Execute(); - ControlsSetMenuItemValues(); + ControlsSetMenuItemValues(); } static void InvertMouseFunc(void *unused) { - Cvar_SetValue("m_pitch", -m_pitch->value); + Cvar_SetValue("m_pitch", -m_pitch->value); } static void LookspringFunc(void *unused) { - Cvar_SetValue("lookspring", (float)!lookspring->value); + Cvar_SetValue("lookspring", (float)!lookspring->value); } static void LookstrafeFunc(void *unused) { - Cvar_SetValue("lookstrafe", (float)!lookstrafe->value); + Cvar_SetValue("lookstrafe", (float)!lookstrafe->value); } static void UpdateVolumeFunc(void *unused) { - Cvar_SetValue("s_volume", s_options_sfxvolume_slider.curvalue / 10); + Cvar_SetValue("s_volume", s_options_sfxvolume_slider.curvalue / 10); } #if defined(OGG) || defined(CDA) static void CDShuffleFunc(void *unused) { - Cvar_SetValue("cd_shuffle", s_options_cdshuffle_box.curvalue); + Cvar_SetValue("cd_shuffle", s_options_cdshuffle_box.curvalue); - #ifdef OGG - cvar_t *ogg; - ogg = Cvar_Get("ogg_enable", "1", CVAR_ARCHIVE); +#ifdef OGG + cvar_t *ogg; + ogg = Cvar_Get("ogg_enable", "1", CVAR_ARCHIVE); - if (s_options_cdshuffle_box.curvalue) - { - Cvar_Set("ogg_sequence", "random"); + if (s_options_cdshuffle_box.curvalue) + { + Cvar_Set("ogg_sequence", "random"); - if (ogg->value) - { - OGG_ParseCmd("?"); - OGG_Stop(); - } - } - else - { - Cvar_Set("ogg_sequence", "loop"); + if (ogg->value) + { + OGG_ParseCmd("?"); + OGG_Stop(); + } + } + else + { + Cvar_Set("ogg_sequence", "loop"); - if (ogg->value) - { - if ((int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, - 10) < 10) - { - char tmp[2] = "0"; - OGG_ParseCmd(strcat(tmp, cl.configstrings[CS_CDTRACK])); - } - else - { - OGG_ParseCmd(cl.configstrings[CS_CDTRACK]); - } - } - } + if (ogg->value) + { + if ((int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, + 10) < 10) + { + char tmp[2] = "0"; + OGG_ParseCmd(strcat(tmp, cl.configstrings[CS_CDTRACK])); + } + else + { + OGG_ParseCmd(cl.configstrings[CS_CDTRACK]); + } + } + } - #endif +#endif } #endif @@ -1159,32 +1161,32 @@ CDShuffleFunc(void *unused) static void UpdateCDVolumeFunc(void *unused) { - Cvar_SetValue("cd_nocd", (float)!s_options_cdvolume_box.curvalue); - #ifdef OGG - Cvar_SetValue("ogg_enable", 0); - #endif + Cvar_SetValue("cd_nocd", (float)!s_options_cdvolume_box.curvalue); +#ifdef OGG + Cvar_SetValue("ogg_enable", 0); +#endif - if (s_options_cdvolume_box.curvalue) - { - #ifdef OGG - OGG_Shutdown(); - #endif - CDAudio_Init(); + if (s_options_cdvolume_box.curvalue) + { +#ifdef OGG + OGG_Shutdown(); +#endif + CDAudio_Init(); - if (s_options_cdshuffle_box.curvalue) - { - CDAudio_RandomPlay(); - } - else - { - CDAudio_Play((int)strtol(cl.configstrings[CS_CDTRACK], - (char **)NULL, 10), true); - } - } - else - { - CDAudio_Stop(); - } + if (s_options_cdshuffle_box.curvalue) + { + CDAudio_RandomPlay(); + } + else + { + CDAudio_Play((int)strtol(cl.configstrings[CS_CDTRACK], + (char **)NULL, 10), true); + } + } + else + { + CDAudio_Stop(); + } } #endif @@ -1193,33 +1195,33 @@ UpdateCDVolumeFunc(void *unused) static void UpdateOGGVolumeFunc(void *unused) { - Cvar_SetValue("ogg_enable", (float)s_options_oggvolume_box.curvalue); - #ifdef CDA - Cvar_SetValue("cd_nocd", 1); - #endif + Cvar_SetValue("ogg_enable", (float)s_options_oggvolume_box.curvalue); +#ifdef CDA + Cvar_SetValue("cd_nocd", 1); +#endif - if (s_options_oggvolume_box.curvalue) - { - #ifdef CDA - CDAudio_Stop(); - #endif - OGG_Init(); - OGG_Stop(); + if (s_options_oggvolume_box.curvalue) + { +#ifdef CDA + CDAudio_Stop(); +#endif + OGG_Init(); + OGG_Stop(); - if ((int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, 10) < 10) - { - char tmp[3] = "0"; - OGG_ParseCmd(strcat(tmp, cl.configstrings[CS_CDTRACK])); - } - else - { - OGG_ParseCmd(cl.configstrings[CS_CDTRACK]); - } - } - else - { - OGG_Shutdown(); - } + if ((int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, 10) < 10) + { + char tmp[3] = "0"; + OGG_ParseCmd(strcat(tmp, cl.configstrings[CS_CDTRACK])); + } + else + { + OGG_ParseCmd(cl.configstrings[CS_CDTRACK]); + } + } + else + { + OGG_Shutdown(); + } } #endif @@ -1229,268 +1231,274 @@ extern void Key_ClearTyping(void); static void ConsoleFunc(void *unused) { - SCR_EndLoadingPlaque(); /* get rid of loading plaque */ + SCR_EndLoadingPlaque(); /* get rid of loading plaque */ - if (cl.attractloop) - { - Cbuf_AddText("killserver\n"); - return; - } + if (cl.attractloop) + { + Cbuf_AddText("killserver\n"); + return; + } - Key_ClearTyping(); - Con_ClearNotify(); + Key_ClearTyping(); + Con_ClearNotify(); - M_ForceMenuOff(); - cls.key_dest = key_console; + M_ForceMenuOff(); + cls.key_dest = key_console; - if ((Cvar_VariableValue("maxclients") == 1) && - Com_ServerState()) - { - Cvar_Set("paused", "1"); - } + if ((Cvar_VariableValue("maxclients") == 1) && + Com_ServerState()) + { + Cvar_Set("paused", "1"); + } } static void UpdateSoundQualityFunc(void *unused) { - if (s_options_quality_list.curvalue == 0) - { - Cvar_SetValue("s_khz", 22); - Cvar_SetValue("s_loadas8bit", false); - } - else - { - Cvar_SetValue("s_khz", 44); - Cvar_SetValue("s_loadas8bit", false); - } + if (s_options_quality_list.curvalue == 0) + { + Cvar_SetValue("s_khz", 22); + Cvar_SetValue("s_loadas8bit", false); + } + else + { + Cvar_SetValue("s_khz", 44); + Cvar_SetValue("s_loadas8bit", false); + } - m_popup_string = "Restarting the sound system. This\n" - "could take up to a minute, so\n" - "please be patient."; - m_popup_endtime = cls.realtime + 2000; - M_Popup(); + m_popup_string = "Restarting the sound system. This\n" + "could take up to a minute, so\n" + "please be patient."; + m_popup_endtime = cls.realtime + 2000; + M_Popup(); - /* the text box won't show up unless we do a buffer swap */ - GLimp_EndFrame(); + /* the text box won't show up unless we do a buffer swap */ + GLimp_EndFrame(); - CL_Snd_Restart_f(); + CL_Snd_Restart_f(); } static void Options_MenuInit(void) { #ifdef CDA - static const char *cd_music_items[] = { - "disabled", - "enabled", - 0 - }; + static const char *cd_music_items[] = + { + "disabled", + "enabled", + 0 + }; #endif #ifdef OGG - static const char *ogg_music_items[] = { - "disabled", - "enabled", - 0 - }; + static const char *ogg_music_items[] = + { + "disabled", + "enabled", + 0 + }; #endif #if defined(OGG) || defined(CDA) - static const char *cd_shuffle[] = { - "disabled", - "enabled", - 0 - }; + static const char *cd_shuffle[] = + { + "disabled", + "enabled", + 0 + }; #endif - static const char *quality_items[] = { - "normal", "high", 0 - }; + static const char *quality_items[] = + { + "normal", "high", 0 + }; - static const char *yesno_names[] = { - "no", - "yes", - 0 - }; + static const char *yesno_names[] = + { + "no", + "yes", + 0 + }; - static const char *crosshair_names[] = { - "none", - "cross", - "dot", - "angle", - 0 - }; + static const char *crosshair_names[] = + { + "none", + "cross", + "dot", + "angle", + 0 + }; - /* configure controls menu and menu items */ - s_options_menu.x = viddef.width / 2; - s_options_menu.y = viddef.height / 2 - 58; - s_options_menu.nitems = 0; + /* configure controls menu and menu items */ + s_options_menu.x = viddef.width / 2; + s_options_menu.y = viddef.height / 2 - 58; + s_options_menu.nitems = 0; - s_options_sfxvolume_slider.generic.type = MTYPE_SLIDER; - s_options_sfxvolume_slider.generic.x = 0; - s_options_sfxvolume_slider.generic.y = 0; - s_options_sfxvolume_slider.generic.name = "effects volume"; - s_options_sfxvolume_slider.generic.callback = UpdateVolumeFunc; - s_options_sfxvolume_slider.minvalue = 0; - s_options_sfxvolume_slider.maxvalue = 10; - s_options_sfxvolume_slider.curvalue = Cvar_VariableValue("s_volume") * 10.0f; + s_options_sfxvolume_slider.generic.type = MTYPE_SLIDER; + s_options_sfxvolume_slider.generic.x = 0; + s_options_sfxvolume_slider.generic.y = 0; + s_options_sfxvolume_slider.generic.name = "effects volume"; + s_options_sfxvolume_slider.generic.callback = UpdateVolumeFunc; + s_options_sfxvolume_slider.minvalue = 0; + s_options_sfxvolume_slider.maxvalue = 10; + s_options_sfxvolume_slider.curvalue = Cvar_VariableValue("s_volume") * 10.0f; #ifdef CDA - s_options_cdvolume_box.generic.type = MTYPE_SPINCONTROL; - s_options_cdvolume_box.generic.x = 0; - s_options_cdvolume_box.generic.y = 10; - s_options_cdvolume_box.generic.name = "CD music"; - s_options_cdvolume_box.generic.callback = UpdateCDVolumeFunc; - s_options_cdvolume_box.itemnames = cd_music_items; - s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd"); + s_options_cdvolume_box.generic.type = MTYPE_SPINCONTROL; + s_options_cdvolume_box.generic.x = 0; + s_options_cdvolume_box.generic.y = 10; + s_options_cdvolume_box.generic.name = "CD music"; + s_options_cdvolume_box.generic.callback = UpdateCDVolumeFunc; + s_options_cdvolume_box.itemnames = cd_music_items; + s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd"); #endif #ifdef OGG - s_options_oggvolume_box.generic.type = MTYPE_SPINCONTROL; - s_options_oggvolume_box.generic.x = 0; - s_options_oggvolume_box.generic.y = 20; - s_options_oggvolume_box.generic.name = "OGG music"; - s_options_oggvolume_box.generic.callback = UpdateOGGVolumeFunc; - s_options_oggvolume_box.itemnames = ogg_music_items; - s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable"); + s_options_oggvolume_box.generic.type = MTYPE_SPINCONTROL; + s_options_oggvolume_box.generic.x = 0; + s_options_oggvolume_box.generic.y = 20; + s_options_oggvolume_box.generic.name = "OGG music"; + s_options_oggvolume_box.generic.callback = UpdateOGGVolumeFunc; + s_options_oggvolume_box.itemnames = ogg_music_items; + s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable"); #endif #if defined(OGG) || defined(CDA) - s_options_cdshuffle_box.generic.type = MTYPE_SPINCONTROL; - s_options_cdshuffle_box.generic.x = 0; - s_options_cdshuffle_box.generic.y = 30; - s_options_cdshuffle_box.generic.name = "Shuffle"; - s_options_cdshuffle_box.generic.callback = CDShuffleFunc; - s_options_cdshuffle_box.itemnames = cd_shuffle; - s_options_cdshuffle_box.curvalue = Cvar_VariableValue("cd_shuffle"); + s_options_cdshuffle_box.generic.type = MTYPE_SPINCONTROL; + s_options_cdshuffle_box.generic.x = 0; + s_options_cdshuffle_box.generic.y = 30; + s_options_cdshuffle_box.generic.name = "Shuffle"; + s_options_cdshuffle_box.generic.callback = CDShuffleFunc; + s_options_cdshuffle_box.itemnames = cd_shuffle; + s_options_cdshuffle_box.curvalue = Cvar_VariableValue("cd_shuffle"); #endif - s_options_quality_list.generic.type = MTYPE_SPINCONTROL; - s_options_quality_list.generic.x = 0; - s_options_quality_list.generic.y = 40; - s_options_quality_list.generic.name = "sound quality"; - s_options_quality_list.generic.callback = UpdateSoundQualityFunc; - s_options_quality_list.itemnames = quality_items; - s_options_quality_list.curvalue = !Cvar_VariableValue("s_loadas8bit"); + s_options_quality_list.generic.type = MTYPE_SPINCONTROL; + s_options_quality_list.generic.x = 0; + s_options_quality_list.generic.y = 40; + s_options_quality_list.generic.name = "sound quality"; + s_options_quality_list.generic.callback = UpdateSoundQualityFunc; + s_options_quality_list.itemnames = quality_items; + s_options_quality_list.curvalue = !Cvar_VariableValue("s_loadas8bit"); - s_options_sensitivity_slider.generic.type = MTYPE_SLIDER; - s_options_sensitivity_slider.generic.x = 0; - s_options_sensitivity_slider.generic.y = 60; - s_options_sensitivity_slider.generic.name = "mouse speed"; - s_options_sensitivity_slider.generic.callback = MouseSpeedFunc; - s_options_sensitivity_slider.minvalue = 2; - s_options_sensitivity_slider.maxvalue = 22; + s_options_sensitivity_slider.generic.type = MTYPE_SLIDER; + s_options_sensitivity_slider.generic.x = 0; + s_options_sensitivity_slider.generic.y = 60; + s_options_sensitivity_slider.generic.name = "mouse speed"; + s_options_sensitivity_slider.generic.callback = MouseSpeedFunc; + s_options_sensitivity_slider.minvalue = 2; + s_options_sensitivity_slider.maxvalue = 22; - s_options_alwaysrun_box.generic.type = MTYPE_SPINCONTROL; - s_options_alwaysrun_box.generic.x = 0; - s_options_alwaysrun_box.generic.y = 70; - s_options_alwaysrun_box.generic.name = "always run"; - s_options_alwaysrun_box.generic.callback = AlwaysRunFunc; - s_options_alwaysrun_box.itemnames = yesno_names; + s_options_alwaysrun_box.generic.type = MTYPE_SPINCONTROL; + s_options_alwaysrun_box.generic.x = 0; + s_options_alwaysrun_box.generic.y = 70; + s_options_alwaysrun_box.generic.name = "always run"; + s_options_alwaysrun_box.generic.callback = AlwaysRunFunc; + s_options_alwaysrun_box.itemnames = yesno_names; - s_options_invertmouse_box.generic.type = MTYPE_SPINCONTROL; - s_options_invertmouse_box.generic.x = 0; - s_options_invertmouse_box.generic.y = 80; - s_options_invertmouse_box.generic.name = "invert mouse"; - s_options_invertmouse_box.generic.callback = InvertMouseFunc; - s_options_invertmouse_box.itemnames = yesno_names; + s_options_invertmouse_box.generic.type = MTYPE_SPINCONTROL; + s_options_invertmouse_box.generic.x = 0; + s_options_invertmouse_box.generic.y = 80; + s_options_invertmouse_box.generic.name = "invert mouse"; + s_options_invertmouse_box.generic.callback = InvertMouseFunc; + s_options_invertmouse_box.itemnames = yesno_names; - s_options_lookspring_box.generic.type = MTYPE_SPINCONTROL; - s_options_lookspring_box.generic.x = 0; - s_options_lookspring_box.generic.y = 90; - s_options_lookspring_box.generic.name = "lookspring"; - s_options_lookspring_box.generic.callback = LookspringFunc; - s_options_lookspring_box.itemnames = yesno_names; + s_options_lookspring_box.generic.type = MTYPE_SPINCONTROL; + s_options_lookspring_box.generic.x = 0; + s_options_lookspring_box.generic.y = 90; + s_options_lookspring_box.generic.name = "lookspring"; + s_options_lookspring_box.generic.callback = LookspringFunc; + s_options_lookspring_box.itemnames = yesno_names; - s_options_lookstrafe_box.generic.type = MTYPE_SPINCONTROL; - s_options_lookstrafe_box.generic.x = 0; - s_options_lookstrafe_box.generic.y = 100; - s_options_lookstrafe_box.generic.name = "lookstrafe"; - s_options_lookstrafe_box.generic.callback = LookstrafeFunc; - s_options_lookstrafe_box.itemnames = yesno_names; + s_options_lookstrafe_box.generic.type = MTYPE_SPINCONTROL; + s_options_lookstrafe_box.generic.x = 0; + s_options_lookstrafe_box.generic.y = 100; + s_options_lookstrafe_box.generic.name = "lookstrafe"; + s_options_lookstrafe_box.generic.callback = LookstrafeFunc; + s_options_lookstrafe_box.itemnames = yesno_names; - s_options_freelook_box.generic.type = MTYPE_SPINCONTROL; - s_options_freelook_box.generic.x = 0; - s_options_freelook_box.generic.y = 110; - s_options_freelook_box.generic.name = "free look"; - s_options_freelook_box.generic.callback = FreeLookFunc; - s_options_freelook_box.itemnames = yesno_names; + s_options_freelook_box.generic.type = MTYPE_SPINCONTROL; + s_options_freelook_box.generic.x = 0; + s_options_freelook_box.generic.y = 110; + s_options_freelook_box.generic.name = "free look"; + s_options_freelook_box.generic.callback = FreeLookFunc; + s_options_freelook_box.itemnames = yesno_names; - s_options_crosshair_box.generic.type = MTYPE_SPINCONTROL; - s_options_crosshair_box.generic.x = 0; - s_options_crosshair_box.generic.y = 120; - s_options_crosshair_box.generic.name = "crosshair"; - s_options_crosshair_box.generic.callback = CrosshairFunc; - s_options_crosshair_box.itemnames = crosshair_names; + s_options_crosshair_box.generic.type = MTYPE_SPINCONTROL; + s_options_crosshair_box.generic.x = 0; + s_options_crosshair_box.generic.y = 120; + s_options_crosshair_box.generic.name = "crosshair"; + s_options_crosshair_box.generic.callback = CrosshairFunc; + s_options_crosshair_box.itemnames = crosshair_names; - s_options_customize_options_action.generic.type = MTYPE_ACTION; - s_options_customize_options_action.generic.x = 0; - s_options_customize_options_action.generic.y = 140; - s_options_customize_options_action.generic.name = "customize controls"; - s_options_customize_options_action.generic.callback = CustomizeControlsFunc; + s_options_customize_options_action.generic.type = MTYPE_ACTION; + s_options_customize_options_action.generic.x = 0; + s_options_customize_options_action.generic.y = 140; + s_options_customize_options_action.generic.name = "customize controls"; + s_options_customize_options_action.generic.callback = CustomizeControlsFunc; - s_options_defaults_action.generic.type = MTYPE_ACTION; - s_options_defaults_action.generic.x = 0; - s_options_defaults_action.generic.y = 150; - s_options_defaults_action.generic.name = "reset defaults"; - s_options_defaults_action.generic.callback = ControlsResetDefaultsFunc; + s_options_defaults_action.generic.type = MTYPE_ACTION; + s_options_defaults_action.generic.x = 0; + s_options_defaults_action.generic.y = 150; + s_options_defaults_action.generic.name = "reset defaults"; + s_options_defaults_action.generic.callback = ControlsResetDefaultsFunc; - s_options_console_action.generic.type = MTYPE_ACTION; - s_options_console_action.generic.x = 0; - s_options_console_action.generic.y = 160; - s_options_console_action.generic.name = "go to console"; - s_options_console_action.generic.callback = ConsoleFunc; + s_options_console_action.generic.type = MTYPE_ACTION; + s_options_console_action.generic.x = 0; + s_options_console_action.generic.y = 160; + s_options_console_action.generic.name = "go to console"; + s_options_console_action.generic.callback = ConsoleFunc; - ControlsSetMenuItemValues(); + ControlsSetMenuItemValues(); - Menu_AddItem(&s_options_menu, (void *)&s_options_sfxvolume_slider); + Menu_AddItem(&s_options_menu, (void *)&s_options_sfxvolume_slider); #ifdef CDA - Menu_AddItem(&s_options_menu, (void *)&s_options_cdvolume_box); + Menu_AddItem(&s_options_menu, (void *)&s_options_cdvolume_box); #endif #ifdef OGG - Menu_AddItem(&s_options_menu, (void *)&s_options_oggvolume_box); + Menu_AddItem(&s_options_menu, (void *)&s_options_oggvolume_box); #endif #if defined(OGG) || defined(CDA) - Menu_AddItem(&s_options_menu, (void *)&s_options_cdshuffle_box); + Menu_AddItem(&s_options_menu, (void *)&s_options_cdshuffle_box); #endif - Menu_AddItem(&s_options_menu, (void *)&s_options_quality_list); - Menu_AddItem(&s_options_menu, (void *)&s_options_sensitivity_slider); - Menu_AddItem(&s_options_menu, (void *)&s_options_alwaysrun_box); - Menu_AddItem(&s_options_menu, (void *)&s_options_invertmouse_box); - Menu_AddItem(&s_options_menu, (void *)&s_options_lookspring_box); - Menu_AddItem(&s_options_menu, (void *)&s_options_lookstrafe_box); - Menu_AddItem(&s_options_menu, (void *)&s_options_freelook_box); - Menu_AddItem(&s_options_menu, (void *)&s_options_crosshair_box); - Menu_AddItem(&s_options_menu, (void *)&s_options_customize_options_action); - Menu_AddItem(&s_options_menu, (void *)&s_options_defaults_action); - Menu_AddItem(&s_options_menu, (void *)&s_options_console_action); + Menu_AddItem(&s_options_menu, (void *)&s_options_quality_list); + Menu_AddItem(&s_options_menu, (void *)&s_options_sensitivity_slider); + Menu_AddItem(&s_options_menu, (void *)&s_options_alwaysrun_box); + Menu_AddItem(&s_options_menu, (void *)&s_options_invertmouse_box); + Menu_AddItem(&s_options_menu, (void *)&s_options_lookspring_box); + Menu_AddItem(&s_options_menu, (void *)&s_options_lookstrafe_box); + Menu_AddItem(&s_options_menu, (void *)&s_options_freelook_box); + Menu_AddItem(&s_options_menu, (void *)&s_options_crosshair_box); + Menu_AddItem(&s_options_menu, (void *)&s_options_customize_options_action); + Menu_AddItem(&s_options_menu, (void *)&s_options_defaults_action); + Menu_AddItem(&s_options_menu, (void *)&s_options_console_action); } static void Options_MenuDraw(void) { - M_Banner("m_banner_options"); - Menu_AdjustCursor(&s_options_menu, 1); - Menu_Draw(&s_options_menu); - M_Popup(); + M_Banner("m_banner_options"); + Menu_AdjustCursor(&s_options_menu, 1); + Menu_Draw(&s_options_menu); + M_Popup(); } static const char * Options_MenuKey(int key) { - if (m_popup_string) - { - m_popup_string = NULL; - return NULL; - } - return Default_MenuKey(&s_options_menu, key); + if (m_popup_string) + { + m_popup_string = NULL; + return NULL; + } + return Default_MenuKey(&s_options_menu, key); } static void M_Menu_Options_f(void) { - Options_MenuInit(); - M_PushMenu(Options_MenuDraw, Options_MenuKey); + Options_MenuInit(); + M_PushMenu(Options_MenuDraw, Options_MenuKey); } /* @@ -1500,8 +1508,8 @@ M_Menu_Options_f(void) static void M_Menu_Video_f(void) { - VID_MenuInit(); - M_PushMenu(VID_MenuDraw, VID_MenuKey); + VID_MenuInit(); + M_PushMenu(VID_MenuDraw, VID_MenuKey); } /* @@ -1607,331 +1615,333 @@ static const char *idcredits[] = { 0 }; -static const char *xatcredits[] = { - "+QUAKE II MISSION PACK: THE RECKONING", - "+BY", - "+XATRIX ENTERTAINMENT, INC.", - "", - "+DESIGN AND DIRECTION", - "Drew Markham", - "", - "+PRODUCED BY", - "Greg Goodrich", - "", - "+PROGRAMMING", - "Rafael Paiz", - "", - "+LEVEL DESIGN / ADDITIONAL GAME DESIGN", - "Alex Mayberry", - "", - "+LEVEL DESIGN", - "Mal Blackwell", - "Dan Koppel", - "", - "+ART DIRECTION", - "Michael \"Maxx\" Kaufman", - "", - "+COMPUTER GRAPHICS SUPERVISOR AND", - "+CHARACTER ANIMATION DIRECTION", - "Barry Dempsey", - "", - "+SENIOR ANIMATOR AND MODELER", - "Jason Hoover", - "", - "+CHARACTER ANIMATION AND", - "+MOTION CAPTURE SPECIALIST", - "Amit Doron", - "", - "+ART", - "Claire Praderie-Markham", - "Viktor Antonov", - "Corky Lehmkuhl", - "", - "+INTRODUCTION ANIMATION", - "Dominique Drozdz", - "", - "+ADDITIONAL LEVEL DESIGN", - "Aaron Barber", - "Rhett Baldwin", - "", - "+3D CHARACTER ANIMATION TOOLS", - "Gerry Tyra, SA Technology", - "", - "+ADDITIONAL EDITOR TOOL PROGRAMMING", - "Robert Duffy", - "", - "+ADDITIONAL PROGRAMMING", - "Ryan Feltrin", - "", - "+PRODUCTION COORDINATOR", - "Victoria Sylvester", - "", - "+SOUND DESIGN", - "Gary Bradfield", - "", - "+MUSIC BY", - "Sonic Mayhem", - "", - "", - "", - "+SPECIAL THANKS", - "+TO", - "+OUR FRIENDS AT ID SOFTWARE", - "", - "John Carmack", - "John Cash", - "Brian Hook", - "Adrian Carmack", - "Kevin Cloud", - "Paul Steed", - "Tim Willits", - "Christian Antkow", - "Paul Jaquays", - "Brandon James", - "Todd Hollenshead", - "Barrett (Bear) Alexander", - "Dave \"Zoid\" Kirsch", - "Donna Jackson", - "", - "", - "", - "+THANKS TO ACTIVISION", - "+IN PARTICULAR:", - "", - "Marty Stratton", - "Henk \"The Original Ripper\" Hartong", - "Kevin Kraff", - "Jamey Gottlieb", - "Chris Hepburn", - "", - "+AND THE GAME TESTERS", - "", - "Tim Vanlaw", - "Doug Jacobs", - "Steven Rosenthal", - "David Baker", - "Chris Campbell", - "Aaron Casillas", - "Steve Elwell", - "Derek Johnstone", - "Igor Krinitskiy", - "Samantha Lee", - "Michael Spann", - "Chris Toft", - "Juan Valdes", - "", - "+THANKS TO INTERGRAPH COMPUTER SYTEMS", - "+IN PARTICULAR:", - "", - "Michael T. Nicolaou", - "", - "", - "Quake II Mission Pack: The Reckoning", - "(tm) (C)1998 Id Software, Inc. All", - "Rights Reserved. Developed by Xatrix", - "Entertainment, Inc. for Id Software,", - "Inc. Distributed by Activision Inc.", - "under license. Quake(R) is a", - "registered trademark of Id Software,", - "Inc. Quake II Mission Pack: The", - "Reckoning(tm), Quake II(tm), the Id", - "Software name, the \"Q II\"(tm) logo", - "and id(tm) logo are trademarks of Id", - "Software, Inc. Activision(R) is a", - "registered trademark of Activision,", - "Inc. Xatrix(R) is a registered", - "trademark of Xatrix Entertainment,", - "Inc. All other trademarks and trade", - "names are properties of their", - "respective owners.", - 0 +static const char *xatcredits[] = +{ + "+QUAKE II MISSION PACK: THE RECKONING", + "+BY", + "+XATRIX ENTERTAINMENT, INC.", + "", + "+DESIGN AND DIRECTION", + "Drew Markham", + "", + "+PRODUCED BY", + "Greg Goodrich", + "", + "+PROGRAMMING", + "Rafael Paiz", + "", + "+LEVEL DESIGN / ADDITIONAL GAME DESIGN", + "Alex Mayberry", + "", + "+LEVEL DESIGN", + "Mal Blackwell", + "Dan Koppel", + "", + "+ART DIRECTION", + "Michael \"Maxx\" Kaufman", + "", + "+COMPUTER GRAPHICS SUPERVISOR AND", + "+CHARACTER ANIMATION DIRECTION", + "Barry Dempsey", + "", + "+SENIOR ANIMATOR AND MODELER", + "Jason Hoover", + "", + "+CHARACTER ANIMATION AND", + "+MOTION CAPTURE SPECIALIST", + "Amit Doron", + "", + "+ART", + "Claire Praderie-Markham", + "Viktor Antonov", + "Corky Lehmkuhl", + "", + "+INTRODUCTION ANIMATION", + "Dominique Drozdz", + "", + "+ADDITIONAL LEVEL DESIGN", + "Aaron Barber", + "Rhett Baldwin", + "", + "+3D CHARACTER ANIMATION TOOLS", + "Gerry Tyra, SA Technology", + "", + "+ADDITIONAL EDITOR TOOL PROGRAMMING", + "Robert Duffy", + "", + "+ADDITIONAL PROGRAMMING", + "Ryan Feltrin", + "", + "+PRODUCTION COORDINATOR", + "Victoria Sylvester", + "", + "+SOUND DESIGN", + "Gary Bradfield", + "", + "+MUSIC BY", + "Sonic Mayhem", + "", + "", + "", + "+SPECIAL THANKS", + "+TO", + "+OUR FRIENDS AT ID SOFTWARE", + "", + "John Carmack", + "John Cash", + "Brian Hook", + "Adrian Carmack", + "Kevin Cloud", + "Paul Steed", + "Tim Willits", + "Christian Antkow", + "Paul Jaquays", + "Brandon James", + "Todd Hollenshead", + "Barrett (Bear) Alexander", + "Dave \"Zoid\" Kirsch", + "Donna Jackson", + "", + "", + "", + "+THANKS TO ACTIVISION", + "+IN PARTICULAR:", + "", + "Marty Stratton", + "Henk \"The Original Ripper\" Hartong", + "Kevin Kraff", + "Jamey Gottlieb", + "Chris Hepburn", + "", + "+AND THE GAME TESTERS", + "", + "Tim Vanlaw", + "Doug Jacobs", + "Steven Rosenthal", + "David Baker", + "Chris Campbell", + "Aaron Casillas", + "Steve Elwell", + "Derek Johnstone", + "Igor Krinitskiy", + "Samantha Lee", + "Michael Spann", + "Chris Toft", + "Juan Valdes", + "", + "+THANKS TO INTERGRAPH COMPUTER SYTEMS", + "+IN PARTICULAR:", + "", + "Michael T. Nicolaou", + "", + "", + "Quake II Mission Pack: The Reckoning", + "(tm) (C)1998 Id Software, Inc. All", + "Rights Reserved. Developed by Xatrix", + "Entertainment, Inc. for Id Software,", + "Inc. Distributed by Activision Inc.", + "under license. Quake(R) is a", + "registered trademark of Id Software,", + "Inc. Quake II Mission Pack: The", + "Reckoning(tm), Quake II(tm), the Id", + "Software name, the \"Q II\"(tm) logo", + "and id(tm) logo are trademarks of Id", + "Software, Inc. Activision(R) is a", + "registered trademark of Activision,", + "Inc. Xatrix(R) is a registered", + "trademark of Xatrix Entertainment,", + "Inc. All other trademarks and trade", + "names are properties of their", + "respective owners.", + 0 }; -static const char *roguecredits[] = { - "+QUAKE II MISSION PACK 2: GROUND ZERO", - "+BY", - "+ROGUE ENTERTAINMENT, INC.", - "", - "+PRODUCED BY", - "Jim Molinets", - "", - "+PROGRAMMING", - "Peter Mack", - "Patrick Magruder", - "", - "+LEVEL DESIGN", - "Jim Molinets", - "Cameron Lamprecht", - "Berenger Fish", - "Robert Selitto", - "Steve Tietze", - "Steve Thoms", - "", - "+ART DIRECTION", - "Rich Fleider", - "", - "+ART", - "Rich Fleider", - "Steve Maines", - "Won Choi", - "", - "+ANIMATION SEQUENCES", - "Creat Studios", - "Steve Maines", - "", - "+ADDITIONAL LEVEL DESIGN", - "Rich Fleider", - "Steve Maines", - "Peter Mack", - "", - "+SOUND", - "James Grunke", - "", - "+GROUND ZERO THEME", - "+AND", - "+MUSIC BY", - "Sonic Mayhem", - "", - "+VWEP MODELS", - "Brent \"Hentai\" Dill", - "", - "", - "", - "+SPECIAL THANKS", - "+TO", - "+OUR FRIENDS AT ID SOFTWARE", - "", - "John Carmack", - "John Cash", - "Brian Hook", - "Adrian Carmack", - "Kevin Cloud", - "Paul Steed", - "Tim Willits", - "Christian Antkow", - "Paul Jaquays", - "Brandon James", - "Todd Hollenshead", - "Barrett (Bear) Alexander", - "Katherine Anna Kang", - "Donna Jackson", - "Dave \"Zoid\" Kirsch", - "", - "", - "", - "+THANKS TO ACTIVISION", - "+IN PARTICULAR:", - "", - "Marty Stratton", - "Henk Hartong", - "Mitch Lasky", - "Steve Rosenthal", - "Steve Elwell", - "", - "+AND THE GAME TESTERS", - "", - "The Ranger Clan", - "Dave \"Zoid\" Kirsch", - "Nihilistic Software", - "Robert Duffy", - "", - "And Countless Others", - "", - "", - "", - "Quake II Mission Pack 2: Ground Zero", - "(tm) (C)1998 Id Software, Inc. All", - "Rights Reserved. Developed by Rogue", - "Entertainment, Inc. for Id Software,", - "Inc. Distributed by Activision Inc.", - "under license. Quake(R) is a", - "registered trademark of Id Software,", - "Inc. Quake II Mission Pack 2: Ground", - "Zero(tm), Quake II(tm), the Id", - "Software name, the \"Q II\"(tm) logo", - "and id(tm) logo are trademarks of Id", - "Software, Inc. Activision(R) is a", - "registered trademark of Activision,", - "Inc. Rogue(R) is a registered", - "trademark of Rogue Entertainment,", - "Inc. All other trademarks and trade", - "names are properties of their", - "respective owners.", - 0 +static const char *roguecredits[] = +{ + "+QUAKE II MISSION PACK 2: GROUND ZERO", + "+BY", + "+ROGUE ENTERTAINMENT, INC.", + "", + "+PRODUCED BY", + "Jim Molinets", + "", + "+PROGRAMMING", + "Peter Mack", + "Patrick Magruder", + "", + "+LEVEL DESIGN", + "Jim Molinets", + "Cameron Lamprecht", + "Berenger Fish", + "Robert Selitto", + "Steve Tietze", + "Steve Thoms", + "", + "+ART DIRECTION", + "Rich Fleider", + "", + "+ART", + "Rich Fleider", + "Steve Maines", + "Won Choi", + "", + "+ANIMATION SEQUENCES", + "Creat Studios", + "Steve Maines", + "", + "+ADDITIONAL LEVEL DESIGN", + "Rich Fleider", + "Steve Maines", + "Peter Mack", + "", + "+SOUND", + "James Grunke", + "", + "+GROUND ZERO THEME", + "+AND", + "+MUSIC BY", + "Sonic Mayhem", + "", + "+VWEP MODELS", + "Brent \"Hentai\" Dill", + "", + "", + "", + "+SPECIAL THANKS", + "+TO", + "+OUR FRIENDS AT ID SOFTWARE", + "", + "John Carmack", + "John Cash", + "Brian Hook", + "Adrian Carmack", + "Kevin Cloud", + "Paul Steed", + "Tim Willits", + "Christian Antkow", + "Paul Jaquays", + "Brandon James", + "Todd Hollenshead", + "Barrett (Bear) Alexander", + "Katherine Anna Kang", + "Donna Jackson", + "Dave \"Zoid\" Kirsch", + "", + "", + "", + "+THANKS TO ACTIVISION", + "+IN PARTICULAR:", + "", + "Marty Stratton", + "Henk Hartong", + "Mitch Lasky", + "Steve Rosenthal", + "Steve Elwell", + "", + "+AND THE GAME TESTERS", + "", + "The Ranger Clan", + "Dave \"Zoid\" Kirsch", + "Nihilistic Software", + "Robert Duffy", + "", + "And Countless Others", + "", + "", + "", + "Quake II Mission Pack 2: Ground Zero", + "(tm) (C)1998 Id Software, Inc. All", + "Rights Reserved. Developed by Rogue", + "Entertainment, Inc. for Id Software,", + "Inc. Distributed by Activision Inc.", + "under license. Quake(R) is a", + "registered trademark of Id Software,", + "Inc. Quake II Mission Pack 2: Ground", + "Zero(tm), Quake II(tm), the Id", + "Software name, the \"Q II\"(tm) logo", + "and id(tm) logo are trademarks of Id", + "Software, Inc. Activision(R) is a", + "registered trademark of Activision,", + "Inc. Rogue(R) is a registered", + "trademark of Rogue Entertainment,", + "Inc. All other trademarks and trade", + "names are properties of their", + "respective owners.", + 0 }; static void M_Credits_MenuDraw(void) { - int i, y; + int i, y; - /* draw the credits */ - for (i = 0, - y = (int)(viddef.height - ((cls.realtime - credits_start_time) / 40.0F)); - credits[i] && y < viddef.height; - y += 10, i++) - { - int j, stringoffset = 0; - int bold = false; + /* draw the credits */ + for (i = 0, + y = (int)(viddef.height - ((cls.realtime - credits_start_time) / 40.0F)); + credits[i] && y < viddef.height; + y += 10, i++) + { + int j, stringoffset = 0; + int bold = false; - if (y <= -8) - { - continue; - } + if (y <= -8) + { + continue; + } - if (credits[i][0] == '+') - { - bold = true; - stringoffset = 1; - } - else - { - bold = false; - stringoffset = 0; - } + if (credits[i][0] == '+') + { + bold = true; + stringoffset = 1; + } + else + { + bold = false; + stringoffset = 0; + } - for (j = 0; credits[i][j + stringoffset]; j++) - { - int x; + for (j = 0; credits[i][j + stringoffset]; j++) + { + int x; - x = (viddef.width - (int)strlen(credits[i]) * 8 - stringoffset * - 8) / 2 + (j + stringoffset) * 8; + x = (viddef.width - (int)strlen(credits[i]) * 8 - stringoffset * + 8) / 2 + (j + stringoffset) * 8; - if (bold) - { - Draw_Char(x, y, credits[i][j + stringoffset] + 128); - } + if (bold) + { + Draw_Char(x, y, credits[i][j + stringoffset] + 128); + } - else - { - Draw_Char(x, y, credits[i][j + stringoffset]); - } - } - } + else + { + Draw_Char(x, y, credits[i][j + stringoffset]); + } + } + } - if (y < 0) - { - credits_start_time = cls.realtime; - } + if (y < 0) + { + credits_start_time = cls.realtime; + } } const char * M_Credits_Key(int key) { - switch (key) - { - case K_ESCAPE: + switch (key) + { + case K_ESCAPE: - if (creditsBuffer) - { - FS_FreeFile(creditsBuffer); - } + if (creditsBuffer) + { + FS_FreeFile(creditsBuffer); + } - M_PopMenu(); - break; - } + M_PopMenu(); + break; + } - return menu_out_sound; + return menu_out_sound; } extern int Developer_searchpath(void); @@ -1939,75 +1949,75 @@ extern int Developer_searchpath(void); static void M_Menu_Credits_f(void) { - int n; - int count; - char *p; - int isdeveloper = 0; + int n; + int count; + char *p; + int isdeveloper = 0; - creditsBuffer = NULL; - count = FS_LoadFile("credits", (void **)&creditsBuffer); + creditsBuffer = NULL; + count = FS_LoadFile("credits", (void **)&creditsBuffer); - if (count != -1) - { - p = creditsBuffer; + if (count != -1) + { + p = creditsBuffer; - for (n = 0; n < 255; n++) - { - creditsIndex[n] = p; + for (n = 0; n < 255; n++) + { + creditsIndex[n] = p; - while (*p != '\r' && *p != '\n') - { - p++; + while (*p != '\r' && *p != '\n') + { + p++; - if (--count == 0) - { - break; - } - } + if (--count == 0) + { + break; + } + } - if (*p == '\r') - { - *p++ = 0; + if (*p == '\r') + { + *p++ = 0; - if (--count == 0) - { - break; - } - } + if (--count == 0) + { + break; + } + } - *p++ = 0; + *p++ = 0; - if (--count == 0) - { - break; - } - } + if (--count == 0) + { + break; + } + } - creditsIndex[++n] = 0; - credits = (const char **)creditsIndex; - } - else - { - isdeveloper = Developer_searchpath(); + creditsIndex[++n] = 0; + credits = (const char **)creditsIndex; + } + else + { + isdeveloper = Developer_searchpath(); - if (isdeveloper == 1) /* Xatrix - The Reckoning */ - { - credits = xatcredits; - } + if (isdeveloper == 1) /* Xatrix - The Reckoning */ + { + credits = xatcredits; + } - else if (isdeveloper == 2) /* Rogue - Ground Zero */ - { - credits = roguecredits; - } + else if (isdeveloper == 2) /* Rogue - Ground Zero */ + { + credits = roguecredits; + } - else - { - credits = idcredits; - } - } + else + { + credits = idcredits; + } + } - credits_start_time = cls.realtime; - M_PushMenu(M_Credits_MenuDraw, M_Credits_Key); + credits_start_time = cls.realtime; + M_PushMenu(M_Credits_MenuDraw, M_Credits_Key); } /* @@ -2029,152 +2039,152 @@ static menuseparator_s s_blankline; static void StartGame(void) { - /* disable updates and start the cinematic going */ - cl.servercount = -1; - M_ForceMenuOff(); - Cvar_SetValue("deathmatch", 0); - Cvar_SetValue("coop", 0); + /* disable updates and start the cinematic going */ + cl.servercount = -1; + M_ForceMenuOff(); + Cvar_SetValue("deathmatch", 0); + Cvar_SetValue("coop", 0); - Cbuf_AddText("loading ; killserver ; wait ; newgame\n"); - cls.key_dest = key_game; + Cbuf_AddText("loading ; killserver ; wait ; newgame\n"); + cls.key_dest = key_game; } static void EasyGameFunc(void *data) { - Cvar_ForceSet("skill", "0"); - StartGame(); + Cvar_ForceSet("skill", "0"); + StartGame(); } static void MediumGameFunc(void *data) { - Cvar_ForceSet("skill", "1"); - StartGame(); + Cvar_ForceSet("skill", "1"); + StartGame(); } static void HardGameFunc(void *data) { - Cvar_ForceSet("skill", "2"); - StartGame(); + Cvar_ForceSet("skill", "2"); + StartGame(); } static void HardpGameFunc(void *data) { - Cvar_ForceSet("skill", "3"); - StartGame(); + Cvar_ForceSet("skill", "3"); + StartGame(); } static void LoadGameFunc(void *unused) { - M_Menu_LoadGame_f(); + M_Menu_LoadGame_f(); } static void SaveGameFunc(void *unused) { - M_Menu_SaveGame_f(); + M_Menu_SaveGame_f(); } static void CreditsFunc(void *unused) { - M_Menu_Credits_f(); + M_Menu_Credits_f(); } void Game_MenuInit(void) { - s_game_menu.x = (int)(viddef.width * 0.50f); - s_game_menu.nitems = 0; + s_game_menu.x = (int)(viddef.width * 0.50f); + s_game_menu.nitems = 0; - s_easy_game_action.generic.type = MTYPE_ACTION; - s_easy_game_action.generic.flags = QMF_LEFT_JUSTIFY; - s_easy_game_action.generic.x = 0; - s_easy_game_action.generic.y = 0; - s_easy_game_action.generic.name = "easy"; - s_easy_game_action.generic.callback = EasyGameFunc; + s_easy_game_action.generic.type = MTYPE_ACTION; + s_easy_game_action.generic.flags = QMF_LEFT_JUSTIFY; + s_easy_game_action.generic.x = 0; + s_easy_game_action.generic.y = 0; + s_easy_game_action.generic.name = "easy"; + s_easy_game_action.generic.callback = EasyGameFunc; - s_medium_game_action.generic.type = MTYPE_ACTION; - s_medium_game_action.generic.flags = QMF_LEFT_JUSTIFY; - s_medium_game_action.generic.x = 0; - s_medium_game_action.generic.y = 10; - s_medium_game_action.generic.name = "medium"; - s_medium_game_action.generic.callback = MediumGameFunc; + s_medium_game_action.generic.type = MTYPE_ACTION; + s_medium_game_action.generic.flags = QMF_LEFT_JUSTIFY; + s_medium_game_action.generic.x = 0; + s_medium_game_action.generic.y = 10; + s_medium_game_action.generic.name = "medium"; + s_medium_game_action.generic.callback = MediumGameFunc; - s_hard_game_action.generic.type = MTYPE_ACTION; - s_hard_game_action.generic.flags = QMF_LEFT_JUSTIFY; - s_hard_game_action.generic.x = 0; - s_hard_game_action.generic.y = 20; - s_hard_game_action.generic.name = "hard"; - s_hard_game_action.generic.callback = HardGameFunc; + s_hard_game_action.generic.type = MTYPE_ACTION; + s_hard_game_action.generic.flags = QMF_LEFT_JUSTIFY; + s_hard_game_action.generic.x = 0; + s_hard_game_action.generic.y = 20; + s_hard_game_action.generic.name = "hard"; + s_hard_game_action.generic.callback = HardGameFunc; - s_hardp_game_action.generic.type = MTYPE_ACTION; - s_hardp_game_action.generic.flags = QMF_LEFT_JUSTIFY; - s_hardp_game_action.generic.x = 0; - s_hardp_game_action.generic.y = 30; - s_hardp_game_action.generic.name = "nightmare"; - s_hardp_game_action.generic.callback = HardpGameFunc; + s_hardp_game_action.generic.type = MTYPE_ACTION; + s_hardp_game_action.generic.flags = QMF_LEFT_JUSTIFY; + s_hardp_game_action.generic.x = 0; + s_hardp_game_action.generic.y = 30; + s_hardp_game_action.generic.name = "nightmare"; + s_hardp_game_action.generic.callback = HardpGameFunc; - s_blankline.generic.type = MTYPE_SEPARATOR; + s_blankline.generic.type = MTYPE_SEPARATOR; - s_load_game_action.generic.type = MTYPE_ACTION; - s_load_game_action.generic.flags = QMF_LEFT_JUSTIFY; - s_load_game_action.generic.x = 0; - s_load_game_action.generic.y = 50; - s_load_game_action.generic.name = "load game"; - s_load_game_action.generic.callback = LoadGameFunc; + s_load_game_action.generic.type = MTYPE_ACTION; + s_load_game_action.generic.flags = QMF_LEFT_JUSTIFY; + s_load_game_action.generic.x = 0; + s_load_game_action.generic.y = 50; + s_load_game_action.generic.name = "load game"; + s_load_game_action.generic.callback = LoadGameFunc; - s_save_game_action.generic.type = MTYPE_ACTION; - s_save_game_action.generic.flags = QMF_LEFT_JUSTIFY; - s_save_game_action.generic.x = 0; - s_save_game_action.generic.y = 60; - s_save_game_action.generic.name = "save game"; - s_save_game_action.generic.callback = SaveGameFunc; + s_save_game_action.generic.type = MTYPE_ACTION; + s_save_game_action.generic.flags = QMF_LEFT_JUSTIFY; + s_save_game_action.generic.x = 0; + s_save_game_action.generic.y = 60; + s_save_game_action.generic.name = "save game"; + s_save_game_action.generic.callback = SaveGameFunc; - s_credits_action.generic.type = MTYPE_ACTION; - s_credits_action.generic.flags = QMF_LEFT_JUSTIFY; - s_credits_action.generic.x = 0; - s_credits_action.generic.y = 70; - s_credits_action.generic.name = "credits"; - s_credits_action.generic.callback = CreditsFunc; + s_credits_action.generic.type = MTYPE_ACTION; + s_credits_action.generic.flags = QMF_LEFT_JUSTIFY; + s_credits_action.generic.x = 0; + s_credits_action.generic.y = 70; + s_credits_action.generic.name = "credits"; + s_credits_action.generic.callback = CreditsFunc; - Menu_AddItem(&s_game_menu, (void *)&s_easy_game_action); - Menu_AddItem(&s_game_menu, (void *)&s_medium_game_action); - Menu_AddItem(&s_game_menu, (void *)&s_hard_game_action); - Menu_AddItem(&s_game_menu, (void *)&s_hardp_game_action); - Menu_AddItem(&s_game_menu, (void *)&s_blankline); - Menu_AddItem(&s_game_menu, (void *)&s_load_game_action); - Menu_AddItem(&s_game_menu, (void *)&s_save_game_action); - Menu_AddItem(&s_game_menu, (void *)&s_blankline); - Menu_AddItem(&s_game_menu, (void *)&s_credits_action); + Menu_AddItem(&s_game_menu, (void *)&s_easy_game_action); + Menu_AddItem(&s_game_menu, (void *)&s_medium_game_action); + Menu_AddItem(&s_game_menu, (void *)&s_hard_game_action); + Menu_AddItem(&s_game_menu, (void *)&s_hardp_game_action); + Menu_AddItem(&s_game_menu, (void *)&s_blankline); + Menu_AddItem(&s_game_menu, (void *)&s_load_game_action); + Menu_AddItem(&s_game_menu, (void *)&s_save_game_action); + Menu_AddItem(&s_game_menu, (void *)&s_blankline); + Menu_AddItem(&s_game_menu, (void *)&s_credits_action); - Menu_Center(&s_game_menu); + Menu_Center(&s_game_menu); } static void Game_MenuDraw(void) { - M_Banner("m_banner_game"); - Menu_AdjustCursor(&s_game_menu, 1); - Menu_Draw(&s_game_menu); + M_Banner("m_banner_game"); + Menu_AdjustCursor(&s_game_menu, 1); + Menu_Draw(&s_game_menu); } static const char * Game_MenuKey(int key) { - return Default_MenuKey(&s_game_menu, key); + return Default_MenuKey(&s_game_menu, key); } static void M_Menu_Game_f(void) { - Game_MenuInit(); - M_PushMenu(Game_MenuDraw, Game_MenuKey); - m_game_cursor = 1; + Game_MenuInit(); + M_PushMenu(Game_MenuDraw, Game_MenuKey); + m_game_cursor = 1; } /* @@ -2230,14 +2240,14 @@ LoadSave_AdjustPage(int dir) m_loadsave_page += dir; - if (m_loadsave_page >= MAX_SAVEPAGES) - { - m_loadsave_page = 0; - } - else if (m_loadsave_page < 0) - { - m_loadsave_page = MAX_SAVEPAGES - 1; - } + if (m_loadsave_page >= MAX_SAVEPAGES) + { + m_loadsave_page = 0; + } + else if (m_loadsave_page < 0) + { + m_loadsave_page = MAX_SAVEPAGES - 1; + } strcpy(m_loadsave_statusbar, "pages: "); @@ -2261,102 +2271,102 @@ LoadSave_AdjustPage(int dir) static void LoadGameCallback(void *self) { - menuaction_s *a = (menuaction_s *)self; + menuaction_s *a = (menuaction_s *)self; - Cbuf_AddText(va("load save%i\n", a->generic.localdata[0])); - M_ForceMenuOff(); + Cbuf_AddText(va("load save%i\n", a->generic.localdata[0])); + M_ForceMenuOff(); } static void LoadGame_MenuInit(void) { - int i; + int i; - s_loadgame_menu.x = viddef.width / 2 - 120; - s_loadgame_menu.y = viddef.height / 2 - 58; - s_loadgame_menu.nitems = 0; + s_loadgame_menu.x = viddef.width / 2 - 120; + s_loadgame_menu.y = viddef.height / 2 - 58; + s_loadgame_menu.nitems = 0; - Create_Savestrings(); + Create_Savestrings(); - for (i = 0; i < MAX_SAVESLOTS; i++) - { - s_loadgame_actions[i].generic.type = MTYPE_ACTION; - s_loadgame_actions[i].generic.name = m_savestrings[i]; - s_loadgame_actions[i].generic.x = 0; - s_loadgame_actions[i].generic.y = i * 10; - s_loadgame_actions[i].generic.localdata[0] = i + m_loadsave_page * MAX_SAVESLOTS; - s_loadgame_actions[i].generic.flags = QMF_LEFT_JUSTIFY; - if (!m_savevalid[i]) - { - s_loadgame_actions[i].generic.callback = NULL; - } - else - { - s_loadgame_actions[i].generic.callback = LoadGameCallback; - } + for (i = 0; i < MAX_SAVESLOTS; i++) + { + s_loadgame_actions[i].generic.type = MTYPE_ACTION; + s_loadgame_actions[i].generic.name = m_savestrings[i]; + s_loadgame_actions[i].generic.x = 0; + s_loadgame_actions[i].generic.y = i * 10; + s_loadgame_actions[i].generic.localdata[0] = i + m_loadsave_page * MAX_SAVESLOTS; + s_loadgame_actions[i].generic.flags = QMF_LEFT_JUSTIFY; + if (!m_savevalid[i]) + { + s_loadgame_actions[i].generic.callback = NULL; + } + else + { + s_loadgame_actions[i].generic.callback = LoadGameCallback; + } - Menu_AddItem(&s_loadgame_menu, &s_loadgame_actions[i]); - } + Menu_AddItem(&s_loadgame_menu, &s_loadgame_actions[i]); + } - Menu_SetStatusBar(&s_loadgame_menu, m_loadsave_statusbar); + Menu_SetStatusBar(&s_loadgame_menu, m_loadsave_statusbar); } static void LoadGame_MenuDraw(void) { - M_Banner("m_banner_load_game"); - Menu_AdjustCursor(&s_loadgame_menu, 1); - Menu_Draw(&s_loadgame_menu); + M_Banner("m_banner_load_game"); + Menu_AdjustCursor(&s_loadgame_menu, 1); + Menu_Draw(&s_loadgame_menu); } static const char * LoadGame_MenuKey(int key) { - static menuframework_s *m = &s_loadgame_menu; + static menuframework_s *m = &s_loadgame_menu; - switch (key) - { - case K_KP_UPARROW: - case K_UPARROW: - if (m->cursor == 0) - { - LoadSave_AdjustPage(-1); - LoadGame_MenuInit(); - } - break; - case K_TAB: - case K_KP_DOWNARROW: - case K_DOWNARROW: - if (m->cursor == m->nitems - 1) - { - LoadSave_AdjustPage(1); - LoadGame_MenuInit(); - } - break; - case K_KP_LEFTARROW: - case K_LEFTARROW: - LoadSave_AdjustPage(-1); - LoadGame_MenuInit(); - return menu_move_sound; - case K_KP_RIGHTARROW: - case K_RIGHTARROW: - LoadSave_AdjustPage(1); - LoadGame_MenuInit(); - return menu_move_sound; - default: - s_savegame_menu.cursor = s_loadgame_menu.cursor; - break; - } + switch (key) + { + case K_KP_UPARROW: + case K_UPARROW: + if (m->cursor == 0) + { + LoadSave_AdjustPage(-1); + LoadGame_MenuInit(); + } + break; + case K_TAB: + case K_KP_DOWNARROW: + case K_DOWNARROW: + if (m->cursor == m->nitems - 1) + { + LoadSave_AdjustPage(1); + LoadGame_MenuInit(); + } + break; + case K_KP_LEFTARROW: + case K_LEFTARROW: + LoadSave_AdjustPage(-1); + LoadGame_MenuInit(); + return menu_move_sound; + case K_KP_RIGHTARROW: + case K_RIGHTARROW: + LoadSave_AdjustPage(1); + LoadGame_MenuInit(); + return menu_move_sound; + default: + s_savegame_menu.cursor = s_loadgame_menu.cursor; + break; + } - return Default_MenuKey(m, key); + return Default_MenuKey(m, key); } static void M_Menu_LoadGame_f(void) { - LoadSave_AdjustPage(0); - LoadGame_MenuInit(); - M_PushMenu(LoadGame_MenuDraw, LoadGame_MenuKey); + LoadSave_AdjustPage(0); + LoadGame_MenuInit(); + M_PushMenu(LoadGame_MenuDraw, LoadGame_MenuKey); } /* @@ -2366,118 +2376,118 @@ M_Menu_LoadGame_f(void) static void SaveGameCallback(void *self) { - menuaction_s *a = (menuaction_s *)self; + menuaction_s *a = (menuaction_s *)self; - if (a->generic.localdata[0] == 0) - { - m_popup_string = "This slot is reserved for\n" - "autosaving, so please select\n" - "another one."; - m_popup_endtime = cls.realtime + 2000; - M_Popup(); - return; - } + if (a->generic.localdata[0] == 0) + { + m_popup_string = "This slot is reserved for\n" + "autosaving, so please select\n" + "another one."; + m_popup_endtime = cls.realtime + 2000; + M_Popup(); + return; + } - Cbuf_AddText(va("save save%i\n", a->generic.localdata[0])); - M_ForceMenuOff(); + Cbuf_AddText(va("save save%i\n", a->generic.localdata[0])); + M_ForceMenuOff(); } static void SaveGame_MenuDraw(void) { - M_Banner("m_banner_save_game"); - Menu_AdjustCursor(&s_savegame_menu, 1); - Menu_Draw(&s_savegame_menu); - M_Popup(); + M_Banner("m_banner_save_game"); + Menu_AdjustCursor(&s_savegame_menu, 1); + Menu_Draw(&s_savegame_menu); + M_Popup(); } static void SaveGame_MenuInit(void) { - int i; + int i; - s_savegame_menu.x = viddef.width / 2 - 120; - s_savegame_menu.y = viddef.height / 2 - 58; - s_savegame_menu.nitems = 0; + s_savegame_menu.x = viddef.width / 2 - 120; + s_savegame_menu.y = viddef.height / 2 - 58; + s_savegame_menu.nitems = 0; - Create_Savestrings(); + Create_Savestrings(); - /* don't include the autosave slot */ - for (i = 0; i < MAX_SAVESLOTS; i++) - { - s_savegame_actions[i].generic.type = MTYPE_ACTION; - s_savegame_actions[i].generic.name = m_savestrings[i]; - s_savegame_actions[i].generic.x = 0; - s_savegame_actions[i].generic.y = i * 10; - s_savegame_actions[i].generic.localdata[0] = i + m_loadsave_page * MAX_SAVESLOTS; - s_savegame_actions[i].generic.flags = QMF_LEFT_JUSTIFY; - s_savegame_actions[i].generic.callback = SaveGameCallback; + /* don't include the autosave slot */ + for (i = 0; i < MAX_SAVESLOTS; i++) + { + s_savegame_actions[i].generic.type = MTYPE_ACTION; + s_savegame_actions[i].generic.name = m_savestrings[i]; + s_savegame_actions[i].generic.x = 0; + s_savegame_actions[i].generic.y = i * 10; + s_savegame_actions[i].generic.localdata[0] = i + m_loadsave_page * MAX_SAVESLOTS; + s_savegame_actions[i].generic.flags = QMF_LEFT_JUSTIFY; + s_savegame_actions[i].generic.callback = SaveGameCallback; - Menu_AddItem(&s_savegame_menu, &s_savegame_actions[i]); - } + Menu_AddItem(&s_savegame_menu, &s_savegame_actions[i]); + } - Menu_SetStatusBar(&s_savegame_menu, m_loadsave_statusbar); + Menu_SetStatusBar(&s_savegame_menu, m_loadsave_statusbar); } static const char * SaveGame_MenuKey(int key) { - static menuframework_s *m = &s_savegame_menu; + static menuframework_s *m = &s_savegame_menu; - if (m_popup_string) - { - m_popup_string = NULL; - return NULL; - } + if (m_popup_string) + { + m_popup_string = NULL; + return NULL; + } - switch (key) - { - case K_KP_UPARROW: - case K_UPARROW: - if (m->cursor == 0) - { - LoadSave_AdjustPage(-1); - SaveGame_MenuInit(); - } - break; - case K_TAB: - case K_KP_DOWNARROW: - case K_DOWNARROW: - if (m->cursor == m->nitems - 1) - { - LoadSave_AdjustPage(1); - SaveGame_MenuInit(); - } - break; - case K_KP_LEFTARROW: - case K_LEFTARROW: - LoadSave_AdjustPage(-1); - SaveGame_MenuInit(); - return menu_move_sound; - case K_KP_RIGHTARROW: - case K_RIGHTARROW: - LoadSave_AdjustPage(1); - SaveGame_MenuInit(); - return menu_move_sound; - default: - s_loadgame_menu.cursor = s_savegame_menu.cursor; - break; - } + switch (key) + { + case K_KP_UPARROW: + case K_UPARROW: + if (m->cursor == 0) + { + LoadSave_AdjustPage(-1); + SaveGame_MenuInit(); + } + break; + case K_TAB: + case K_KP_DOWNARROW: + case K_DOWNARROW: + if (m->cursor == m->nitems - 1) + { + LoadSave_AdjustPage(1); + SaveGame_MenuInit(); + } + break; + case K_KP_LEFTARROW: + case K_LEFTARROW: + LoadSave_AdjustPage(-1); + SaveGame_MenuInit(); + return menu_move_sound; + case K_KP_RIGHTARROW: + case K_RIGHTARROW: + LoadSave_AdjustPage(1); + SaveGame_MenuInit(); + return menu_move_sound; + default: + s_loadgame_menu.cursor = s_savegame_menu.cursor; + break; + } - return Default_MenuKey(m, key); + return Default_MenuKey(m, key); } static void M_Menu_SaveGame_f(void) { - if (!Com_ServerState()) - { - return; /* not playing a game */ - } + if (!Com_ServerState()) + { + return; /* not playing a game */ + } - LoadSave_AdjustPage(0); - SaveGame_MenuInit(); - M_PushMenu(SaveGame_MenuDraw, SaveGame_MenuKey); + LoadSave_AdjustPage(0); + SaveGame_MenuInit(); + M_PushMenu(SaveGame_MenuDraw, SaveGame_MenuKey); } /* @@ -2541,143 +2551,143 @@ M_AddToServerList(netadr_t adr, char *info) static void JoinServerFunc(void *self) { - char buffer[128]; - int index; + char buffer[128]; + int index; - index = (int)((menuaction_s *)self - s_joinserver_server_actions); + index = (int)((menuaction_s *)self - s_joinserver_server_actions); - if (Q_stricmp(local_server_names[index], NO_SERVER_STRING) == 0) - { - return; - } + if (Q_stricmp(local_server_names[index], NO_SERVER_STRING) == 0) + { + return; + } - if (index >= m_num_servers) - { - return; - } + if (index >= m_num_servers) + { + return; + } - Com_sprintf(buffer, sizeof(buffer), "connect %s\n", - NET_AdrToString(local_server_netadr[index])); - Cbuf_AddText(buffer); - M_ForceMenuOff(); + Com_sprintf(buffer, sizeof(buffer), "connect %s\n", + NET_AdrToString(local_server_netadr[index])); + Cbuf_AddText(buffer); + M_ForceMenuOff(); } static void AddressBookFunc(void *self) { - M_Menu_AddressBook_f(); + M_Menu_AddressBook_f(); } static void SearchLocalGames(void) { - int i; + int i; - m_num_servers = 0; + m_num_servers = 0; - for (i = 0; i < MAX_LOCAL_SERVERS; i++) - { - strcpy(local_server_names[i], NO_SERVER_STRING); - local_server_netadr_strings[i][0] = '\0'; - } + for (i = 0; i < MAX_LOCAL_SERVERS; i++) + { + strcpy(local_server_names[i], NO_SERVER_STRING); + local_server_netadr_strings[i][0] = '\0'; + } - m_popup_string = "Searching for local servers. This\n" - "could take up to a minute, so\n" - "please be patient."; - m_popup_endtime = cls.realtime + 2000; - M_Popup(); + m_popup_string = "Searching for local servers. This\n" + "could take up to a minute, so\n" + "please be patient."; + m_popup_endtime = cls.realtime + 2000; + M_Popup(); - /* the text box won't show up unless we do a buffer swap */ - GLimp_EndFrame(); + /* the text box won't show up unless we do a buffer swap */ + GLimp_EndFrame(); - /* send out info packets */ - CL_PingServers_f(); + /* send out info packets */ + CL_PingServers_f(); } static void SearchLocalGamesFunc(void *self) { - SearchLocalGames(); + SearchLocalGames(); } static void JoinServer_MenuInit(void) { - int i; + int i; - s_joinserver_menu.x = (int)(viddef.width * 0.50f) - 120; - s_joinserver_menu.nitems = 0; + s_joinserver_menu.x = (int)(viddef.width * 0.50f) - 120; + s_joinserver_menu.nitems = 0; - s_joinserver_address_book_action.generic.type = MTYPE_ACTION; - s_joinserver_address_book_action.generic.name = "address book"; - s_joinserver_address_book_action.generic.flags = QMF_LEFT_JUSTIFY; - s_joinserver_address_book_action.generic.x = 0; - s_joinserver_address_book_action.generic.y = 0; - s_joinserver_address_book_action.generic.callback = AddressBookFunc; + s_joinserver_address_book_action.generic.type = MTYPE_ACTION; + s_joinserver_address_book_action.generic.name = "address book"; + s_joinserver_address_book_action.generic.flags = QMF_LEFT_JUSTIFY; + s_joinserver_address_book_action.generic.x = 0; + s_joinserver_address_book_action.generic.y = 0; + s_joinserver_address_book_action.generic.callback = AddressBookFunc; - s_joinserver_search_action.generic.type = MTYPE_ACTION; - s_joinserver_search_action.generic.name = "refresh server list"; - s_joinserver_search_action.generic.flags = QMF_LEFT_JUSTIFY; - s_joinserver_search_action.generic.x = 0; - s_joinserver_search_action.generic.y = 10; - s_joinserver_search_action.generic.callback = SearchLocalGamesFunc; - s_joinserver_search_action.generic.statusbar = "search for servers"; + s_joinserver_search_action.generic.type = MTYPE_ACTION; + s_joinserver_search_action.generic.name = "refresh server list"; + s_joinserver_search_action.generic.flags = QMF_LEFT_JUSTIFY; + s_joinserver_search_action.generic.x = 0; + s_joinserver_search_action.generic.y = 10; + s_joinserver_search_action.generic.callback = SearchLocalGamesFunc; + s_joinserver_search_action.generic.statusbar = "search for servers"; - s_joinserver_server_title.generic.type = MTYPE_SEPARATOR; - s_joinserver_server_title.generic.name = "connect to..."; - s_joinserver_server_title.generic.x = 80; - s_joinserver_server_title.generic.y = 30; + s_joinserver_server_title.generic.type = MTYPE_SEPARATOR; + s_joinserver_server_title.generic.name = "connect to..."; + s_joinserver_server_title.generic.x = 80; + s_joinserver_server_title.generic.y = 30; - for (i = 0; i < MAX_LOCAL_SERVERS; i++) - { - s_joinserver_server_actions[i].generic.type = MTYPE_ACTION; - s_joinserver_server_actions[i].generic.name = local_server_names[i]; - s_joinserver_server_actions[i].generic.flags = QMF_LEFT_JUSTIFY; - s_joinserver_server_actions[i].generic.x = 0; - s_joinserver_server_actions[i].generic.y = 40 + i * 10; - s_joinserver_server_actions[i].generic.callback = JoinServerFunc; - s_joinserver_server_actions[i].generic.statusbar = - local_server_netadr_strings[i]; - } + for (i = 0; i < MAX_LOCAL_SERVERS; i++) + { + s_joinserver_server_actions[i].generic.type = MTYPE_ACTION; + s_joinserver_server_actions[i].generic.name = local_server_names[i]; + s_joinserver_server_actions[i].generic.flags = QMF_LEFT_JUSTIFY; + s_joinserver_server_actions[i].generic.x = 0; + s_joinserver_server_actions[i].generic.y = 40 + i * 10; + s_joinserver_server_actions[i].generic.callback = JoinServerFunc; + s_joinserver_server_actions[i].generic.statusbar = + local_server_netadr_strings[i]; + } - Menu_AddItem(&s_joinserver_menu, &s_joinserver_address_book_action); - Menu_AddItem(&s_joinserver_menu, &s_joinserver_server_title); - Menu_AddItem(&s_joinserver_menu, &s_joinserver_search_action); + Menu_AddItem(&s_joinserver_menu, &s_joinserver_address_book_action); + Menu_AddItem(&s_joinserver_menu, &s_joinserver_server_title); + Menu_AddItem(&s_joinserver_menu, &s_joinserver_search_action); - for (i = 0; i < 8; i++) - { - Menu_AddItem(&s_joinserver_menu, &s_joinserver_server_actions[i]); - } + for (i = 0; i < 8; i++) + { + Menu_AddItem(&s_joinserver_menu, &s_joinserver_server_actions[i]); + } - Menu_Center(&s_joinserver_menu); + Menu_Center(&s_joinserver_menu); - SearchLocalGames(); + SearchLocalGames(); } static void JoinServer_MenuDraw(void) { - M_Banner("m_banner_join_server"); - Menu_Draw(&s_joinserver_menu); - M_Popup(); + M_Banner("m_banner_join_server"); + Menu_Draw(&s_joinserver_menu); + M_Popup(); } static const char * JoinServer_MenuKey(int key) { - if (m_popup_string) - { - m_popup_string = NULL; - return NULL; - } - return Default_MenuKey(&s_joinserver_menu, key); + if (m_popup_string) + { + m_popup_string = NULL; + return NULL; + } + return Default_MenuKey(&s_joinserver_menu, key); } static void M_Menu_JoinServer_f(void) { - JoinServer_MenuInit(); - M_PushMenu(JoinServer_MenuDraw, JoinServer_MenuKey); + JoinServer_MenuInit(); + M_PushMenu(JoinServer_MenuDraw, JoinServer_MenuKey); } /* @@ -2700,364 +2710,366 @@ static menulist_s s_rules_box; static void DMOptionsFunc(void *self) { - M_Menu_DMOptions_f(); + M_Menu_DMOptions_f(); } static void RulesChangeFunc(void *self) { - /* Deathmatch */ - if (s_rules_box.curvalue == 0) - { - s_maxclients_field.generic.statusbar = NULL; - s_startserver_dmoptions_action.generic.statusbar = NULL; - } + /* Deathmatch */ + if (s_rules_box.curvalue == 0) + { + s_maxclients_field.generic.statusbar = NULL; + s_startserver_dmoptions_action.generic.statusbar = NULL; + } - /* Ground Zero game modes */ - else if (Developer_searchpath() == 2) - { - if (s_rules_box.curvalue == 2) - { - s_maxclients_field.generic.statusbar = NULL; - s_startserver_dmoptions_action.generic.statusbar = NULL; - } - } + /* Ground Zero game modes */ + else if (Developer_searchpath() == 2) + { + if (s_rules_box.curvalue == 2) + { + s_maxclients_field.generic.statusbar = NULL; + s_startserver_dmoptions_action.generic.statusbar = NULL; + } + } } static void StartServerActionFunc(void *self) { - char startmap[1024]; - float timelimit; - float fraglimit; - float maxclients; - char *spot; + char startmap[1024]; + float timelimit; + float fraglimit; + float maxclients; + char *spot; - strcpy(startmap, strchr(mapnames[s_startmap_list.curvalue], '\n') + 1); + strcpy(startmap, strchr(mapnames[s_startmap_list.curvalue], '\n') + 1); - maxclients = (float)strtod(s_maxclients_field.buffer, (char **)NULL); - timelimit = (float)strtod(s_timelimit_field.buffer, (char **)NULL); - fraglimit = (float)strtod(s_fraglimit_field.buffer, (char **)NULL); + maxclients = (float)strtod(s_maxclients_field.buffer, (char **)NULL); + timelimit = (float)strtod(s_timelimit_field.buffer, (char **)NULL); + fraglimit = (float)strtod(s_fraglimit_field.buffer, (char **)NULL); - Cvar_SetValue("maxclients", ClampCvar(0, maxclients, maxclients)); - Cvar_SetValue("timelimit", ClampCvar(0, timelimit, timelimit)); - Cvar_SetValue("fraglimit", ClampCvar(0, fraglimit, fraglimit)); - Cvar_Set("hostname", s_hostname_field.buffer); + Cvar_SetValue("maxclients", ClampCvar(0, maxclients, maxclients)); + Cvar_SetValue("timelimit", ClampCvar(0, timelimit, timelimit)); + Cvar_SetValue("fraglimit", ClampCvar(0, fraglimit, fraglimit)); + Cvar_Set("hostname", s_hostname_field.buffer); - if ((s_rules_box.curvalue < 2) || (Developer_searchpath() != 2)) - { - Cvar_SetValue("deathmatch", (float)!s_rules_box.curvalue); - Cvar_SetValue("coop", (float)s_rules_box.curvalue); - } - else - { - Cvar_SetValue("deathmatch", 1); /* deathmatch is always true for rogue games */ - Cvar_SetValue("coop", 0); /* This works for at least the main game and both addons */ - } + if ((s_rules_box.curvalue < 2) || (Developer_searchpath() != 2)) + { + Cvar_SetValue("deathmatch", (float)!s_rules_box.curvalue); + Cvar_SetValue("coop", (float)s_rules_box.curvalue); + } + else + { + Cvar_SetValue("deathmatch", 1); /* deathmatch is always true for rogue games */ + Cvar_SetValue("coop", 0); /* This works for at least the main game and both addons */ + } - spot = NULL; + spot = NULL; - if (s_rules_box.curvalue == 1) - { - if (Q_stricmp(startmap, "bunk1") == 0) - { - spot = "start"; - } + if (s_rules_box.curvalue == 1) + { + if (Q_stricmp(startmap, "bunk1") == 0) + { + spot = "start"; + } - else if (Q_stricmp(startmap, "mintro") == 0) - { - spot = "start"; - } + else if (Q_stricmp(startmap, "mintro") == 0) + { + spot = "start"; + } - else if (Q_stricmp(startmap, "fact1") == 0) - { - spot = "start"; - } + else if (Q_stricmp(startmap, "fact1") == 0) + { + spot = "start"; + } - else if (Q_stricmp(startmap, "power1") == 0) - { - spot = "pstart"; - } + else if (Q_stricmp(startmap, "power1") == 0) + { + spot = "pstart"; + } - else if (Q_stricmp(startmap, "biggun") == 0) - { - spot = "bstart"; - } + else if (Q_stricmp(startmap, "biggun") == 0) + { + spot = "bstart"; + } - else if (Q_stricmp(startmap, "hangar1") == 0) - { - spot = "unitstart"; - } + else if (Q_stricmp(startmap, "hangar1") == 0) + { + spot = "unitstart"; + } - else if (Q_stricmp(startmap, "city1") == 0) - { - spot = "unitstart"; - } + else if (Q_stricmp(startmap, "city1") == 0) + { + spot = "unitstart"; + } - else if (Q_stricmp(startmap, "boss1") == 0) - { - spot = "bosstart"; - } - } + else if (Q_stricmp(startmap, "boss1") == 0) + { + spot = "bosstart"; + } + } - if (spot) - { - if (Com_ServerState()) - { - Cbuf_AddText("disconnect\n"); - } + if (spot) + { + if (Com_ServerState()) + { + Cbuf_AddText("disconnect\n"); + } - Cbuf_AddText(va("gamemap \"*%s$%s\"\n", startmap, spot)); - } - else - { - Cbuf_AddText(va("map %s\n", startmap)); - } + Cbuf_AddText(va("gamemap \"*%s$%s\"\n", startmap, spot)); + } + else + { + Cbuf_AddText(va("map %s\n", startmap)); + } - M_ForceMenuOff(); + M_ForceMenuOff(); } static void StartServer_MenuInit(void) { - static const char *dm_coop_names[] = { - "deathmatch", - "cooperative", - 0 - }; - static const char *dm_coop_names_rogue[] = { - "deathmatch", - "cooperative", - "tag", - 0 - }; - char *buffer; - char mapsname[1024]; - char *s; - int length; - int i; - FILE *fp; + static const char *dm_coop_names[] = + { + "deathmatch", + "cooperative", + 0 + }; + static const char *dm_coop_names_rogue[] = + { + "deathmatch", + "cooperative", + "tag", + 0 + }; + char *buffer; + char mapsname[1024]; + char *s; + int length; + int i; + FILE *fp; - /* initialize list of maps once, reuse it afterwards (=> it isn't freed) */ - if (mapnames == NULL) - { - /* load the list of map names */ - Com_sprintf(mapsname, sizeof(mapsname), "%s/maps.lst", FS_Gamedir()); + /* initialize list of maps once, reuse it afterwards (=> it isn't freed) */ + if (mapnames == NULL) + { + /* load the list of map names */ + Com_sprintf(mapsname, sizeof(mapsname), "%s/maps.lst", FS_Gamedir()); - if ((fp = fopen(mapsname, "rb")) == 0) - { - if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1) - { - Com_Error(ERR_DROP, "couldn't find maps.lst\n"); - } - } - else - { - fseek(fp, 0, SEEK_END); - length = ftell(fp); - fseek(fp, 0, SEEK_SET); - buffer = malloc(length); - fread(buffer, length, 1, fp); - } + if ((fp = fopen(mapsname, "rb")) == 0) + { + if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1) + { + Com_Error(ERR_DROP, "couldn't find maps.lst\n"); + } + } + else + { + fseek(fp, 0, SEEK_END); + length = ftell(fp); + fseek(fp, 0, SEEK_SET); + buffer = malloc(length); + fread(buffer, length, 1, fp); + } - s = buffer; + s = buffer; - i = 0; + i = 0; - while (i < length) - { - if (s[i] == '\r') - { - nummaps++; - } + while (i < length) + { + if (s[i] == '\r') + { + nummaps++; + } - i++; - } + i++; + } - if (nummaps == 0) - { - Com_Error(ERR_DROP, "no maps in maps.lst\n"); - } + if (nummaps == 0) + { + Com_Error(ERR_DROP, "no maps in maps.lst\n"); + } - mapnames = malloc(sizeof(char *) * (nummaps + 1)); - memset(mapnames, 0, sizeof(char *) * (nummaps + 1)); + mapnames = malloc(sizeof(char *) * (nummaps + 1)); + memset(mapnames, 0, sizeof(char *) * (nummaps + 1)); - s = buffer; + s = buffer; - for (i = 0; i < nummaps; i++) - { - char shortname[MAX_TOKEN_CHARS]; - char longname[MAX_TOKEN_CHARS]; - char scratch[200]; - int j, l; + for (i = 0; i < nummaps; i++) + { + char shortname[MAX_TOKEN_CHARS]; + char longname[MAX_TOKEN_CHARS]; + char scratch[200]; + int j, l; - strcpy(shortname, COM_Parse(&s)); - l = strlen(shortname); + strcpy(shortname, COM_Parse(&s)); + l = strlen(shortname); - for (j = 0; j < l; j++) - { - shortname[j] = toupper(shortname[j]); - } + for (j = 0; j < l; j++) + { + shortname[j] = toupper(shortname[j]); + } - strcpy(longname, COM_Parse(&s)); - Com_sprintf(scratch, sizeof(scratch), "%s\n%s", longname, shortname); + strcpy(longname, COM_Parse(&s)); + Com_sprintf(scratch, sizeof(scratch), "%s\n%s", longname, shortname); - mapnames[i] = malloc(strlen(scratch) + 1); - strcpy(mapnames[i], scratch); - } + mapnames[i] = malloc(strlen(scratch) + 1); + strcpy(mapnames[i], scratch); + } - mapnames[nummaps] = 0; + mapnames[nummaps] = 0; - if (fp != 0) - { - fclose(fp); - fp = 0; - free(buffer); - } - else - { - FS_FreeFile(buffer); - } - } + if (fp != 0) + { + fclose(fp); + fp = 0; + free(buffer); + } + else + { + FS_FreeFile(buffer); + } + } - /* initialize the menu stuff */ - s_startserver_menu.x = (int)(viddef.width * 0.50f); - s_startserver_menu.nitems = 0; + /* initialize the menu stuff */ + s_startserver_menu.x = (int)(viddef.width * 0.50f); + s_startserver_menu.nitems = 0; - s_startmap_list.generic.type = MTYPE_SPINCONTROL; - s_startmap_list.generic.x = 0; - s_startmap_list.generic.y = 0; - s_startmap_list.generic.name = "initial map"; - s_startmap_list.itemnames = (const char **)mapnames; + s_startmap_list.generic.type = MTYPE_SPINCONTROL; + s_startmap_list.generic.x = 0; + s_startmap_list.generic.y = 0; + s_startmap_list.generic.name = "initial map"; + s_startmap_list.itemnames = (const char **)mapnames; - s_rules_box.generic.type = MTYPE_SPINCONTROL; - s_rules_box.generic.x = 0; - s_rules_box.generic.y = 20; - s_rules_box.generic.name = "rules"; + s_rules_box.generic.type = MTYPE_SPINCONTROL; + s_rules_box.generic.x = 0; + s_rules_box.generic.y = 20; + s_rules_box.generic.name = "rules"; - /* Ground Zero games only available with rogue game */ - if (Developer_searchpath() == 2) - { - s_rules_box.itemnames = dm_coop_names_rogue; - } + /* Ground Zero games only available with rogue game */ + if (Developer_searchpath() == 2) + { + s_rules_box.itemnames = dm_coop_names_rogue; + } - else - { - s_rules_box.itemnames = dm_coop_names; - } + else + { + s_rules_box.itemnames = dm_coop_names; + } - if (Cvar_VariableValue("coop")) - { - s_rules_box.curvalue = 1; - } + if (Cvar_VariableValue("coop")) + { + s_rules_box.curvalue = 1; + } - else - { - s_rules_box.curvalue = 0; - } + else + { + s_rules_box.curvalue = 0; + } - s_rules_box.generic.callback = RulesChangeFunc; + s_rules_box.generic.callback = RulesChangeFunc; - s_timelimit_field.generic.type = MTYPE_FIELD; - s_timelimit_field.generic.name = "time limit"; - s_timelimit_field.generic.flags = QMF_NUMBERSONLY; - s_timelimit_field.generic.x = 0; - s_timelimit_field.generic.y = 36; - s_timelimit_field.generic.statusbar = "0 = no limit"; - s_timelimit_field.length = 3; - s_timelimit_field.visible_length = 3; - strcpy(s_timelimit_field.buffer, Cvar_VariableString("timelimit")); + s_timelimit_field.generic.type = MTYPE_FIELD; + s_timelimit_field.generic.name = "time limit"; + s_timelimit_field.generic.flags = QMF_NUMBERSONLY; + s_timelimit_field.generic.x = 0; + s_timelimit_field.generic.y = 36; + s_timelimit_field.generic.statusbar = "0 = no limit"; + s_timelimit_field.length = 3; + s_timelimit_field.visible_length = 3; + strcpy(s_timelimit_field.buffer, Cvar_VariableString("timelimit")); - s_fraglimit_field.generic.type = MTYPE_FIELD; - s_fraglimit_field.generic.name = "frag limit"; - s_fraglimit_field.generic.flags = QMF_NUMBERSONLY; - s_fraglimit_field.generic.x = 0; - s_fraglimit_field.generic.y = 54; - s_fraglimit_field.generic.statusbar = "0 = no limit"; - s_fraglimit_field.length = 3; - s_fraglimit_field.visible_length = 3; - strcpy(s_fraglimit_field.buffer, Cvar_VariableString("fraglimit")); + s_fraglimit_field.generic.type = MTYPE_FIELD; + s_fraglimit_field.generic.name = "frag limit"; + s_fraglimit_field.generic.flags = QMF_NUMBERSONLY; + s_fraglimit_field.generic.x = 0; + s_fraglimit_field.generic.y = 54; + s_fraglimit_field.generic.statusbar = "0 = no limit"; + s_fraglimit_field.length = 3; + s_fraglimit_field.visible_length = 3; + strcpy(s_fraglimit_field.buffer, Cvar_VariableString("fraglimit")); - /* maxclients determines the maximum number of players that can join - the game. If maxclients is only "1" then we should default the menu - option to 8 players, otherwise use whatever its current value is. - Clamping will be done when the server is actually started. */ - s_maxclients_field.generic.type = MTYPE_FIELD; - s_maxclients_field.generic.name = "max players"; - s_maxclients_field.generic.flags = QMF_NUMBERSONLY; - s_maxclients_field.generic.x = 0; - s_maxclients_field.generic.y = 72; - s_maxclients_field.generic.statusbar = NULL; - s_maxclients_field.length = 3; - s_maxclients_field.visible_length = 3; + /* maxclients determines the maximum number of players that can join + the game. If maxclients is only "1" then we should default the menu + option to 8 players, otherwise use whatever its current value is. + Clamping will be done when the server is actually started. */ + s_maxclients_field.generic.type = MTYPE_FIELD; + s_maxclients_field.generic.name = "max players"; + s_maxclients_field.generic.flags = QMF_NUMBERSONLY; + s_maxclients_field.generic.x = 0; + s_maxclients_field.generic.y = 72; + s_maxclients_field.generic.statusbar = NULL; + s_maxclients_field.length = 3; + s_maxclients_field.visible_length = 3; - if (Cvar_VariableValue("maxclients") == 1) - { - strcpy(s_maxclients_field.buffer, "8"); - } + if (Cvar_VariableValue("maxclients") == 1) + { + strcpy(s_maxclients_field.buffer, "8"); + } - else - { - strcpy(s_maxclients_field.buffer, Cvar_VariableString("maxclients")); - } + else + { + strcpy(s_maxclients_field.buffer, Cvar_VariableString("maxclients")); + } - s_hostname_field.generic.type = MTYPE_FIELD; - s_hostname_field.generic.name = "hostname"; - s_hostname_field.generic.flags = 0; - s_hostname_field.generic.x = 0; - s_hostname_field.generic.y = 90; - s_hostname_field.generic.statusbar = NULL; - s_hostname_field.length = 12; - s_hostname_field.visible_length = 12; - strcpy(s_hostname_field.buffer, Cvar_VariableString("hostname")); + s_hostname_field.generic.type = MTYPE_FIELD; + s_hostname_field.generic.name = "hostname"; + s_hostname_field.generic.flags = 0; + s_hostname_field.generic.x = 0; + s_hostname_field.generic.y = 90; + s_hostname_field.generic.statusbar = NULL; + s_hostname_field.length = 12; + s_hostname_field.visible_length = 12; + strcpy(s_hostname_field.buffer, Cvar_VariableString("hostname")); - s_startserver_dmoptions_action.generic.type = MTYPE_ACTION; - s_startserver_dmoptions_action.generic.name = " deathmatch flags"; - s_startserver_dmoptions_action.generic.flags = QMF_LEFT_JUSTIFY; - s_startserver_dmoptions_action.generic.x = 24; - s_startserver_dmoptions_action.generic.y = 108; - s_startserver_dmoptions_action.generic.statusbar = NULL; - s_startserver_dmoptions_action.generic.callback = DMOptionsFunc; + s_startserver_dmoptions_action.generic.type = MTYPE_ACTION; + s_startserver_dmoptions_action.generic.name = " deathmatch flags"; + s_startserver_dmoptions_action.generic.flags = QMF_LEFT_JUSTIFY; + s_startserver_dmoptions_action.generic.x = 24; + s_startserver_dmoptions_action.generic.y = 108; + s_startserver_dmoptions_action.generic.statusbar = NULL; + s_startserver_dmoptions_action.generic.callback = DMOptionsFunc; - s_startserver_start_action.generic.type = MTYPE_ACTION; - s_startserver_start_action.generic.name = " begin"; - s_startserver_start_action.generic.flags = QMF_LEFT_JUSTIFY; - s_startserver_start_action.generic.x = 24; - s_startserver_start_action.generic.y = 128; - s_startserver_start_action.generic.callback = StartServerActionFunc; + s_startserver_start_action.generic.type = MTYPE_ACTION; + s_startserver_start_action.generic.name = " begin"; + s_startserver_start_action.generic.flags = QMF_LEFT_JUSTIFY; + s_startserver_start_action.generic.x = 24; + s_startserver_start_action.generic.y = 128; + s_startserver_start_action.generic.callback = StartServerActionFunc; - Menu_AddItem(&s_startserver_menu, &s_startmap_list); - Menu_AddItem(&s_startserver_menu, &s_rules_box); - Menu_AddItem(&s_startserver_menu, &s_timelimit_field); - Menu_AddItem(&s_startserver_menu, &s_fraglimit_field); - Menu_AddItem(&s_startserver_menu, &s_maxclients_field); - Menu_AddItem(&s_startserver_menu, &s_hostname_field); - Menu_AddItem(&s_startserver_menu, &s_startserver_dmoptions_action); - Menu_AddItem(&s_startserver_menu, &s_startserver_start_action); + Menu_AddItem(&s_startserver_menu, &s_startmap_list); + Menu_AddItem(&s_startserver_menu, &s_rules_box); + Menu_AddItem(&s_startserver_menu, &s_timelimit_field); + Menu_AddItem(&s_startserver_menu, &s_fraglimit_field); + Menu_AddItem(&s_startserver_menu, &s_maxclients_field); + Menu_AddItem(&s_startserver_menu, &s_hostname_field); + Menu_AddItem(&s_startserver_menu, &s_startserver_dmoptions_action); + Menu_AddItem(&s_startserver_menu, &s_startserver_start_action); - Menu_Center(&s_startserver_menu); + Menu_Center(&s_startserver_menu); - /* call this now to set proper inital state */ - RulesChangeFunc(NULL); + /* call this now to set proper inital state */ + RulesChangeFunc(NULL); } static void StartServer_MenuDraw(void) { - Menu_Draw(&s_startserver_menu); + Menu_Draw(&s_startserver_menu); } static const char * StartServer_MenuKey(int key) { - return Default_MenuKey(&s_startserver_menu, key); + return Default_MenuKey(&s_startserver_menu, key); } static void M_Menu_StartServer_f(void) { - StartServer_MenuInit(); - M_PushMenu(StartServer_MenuDraw, StartServer_MenuKey); + StartServer_MenuInit(); + M_PushMenu(StartServer_MenuDraw, StartServer_MenuKey); } /* @@ -3091,394 +3103,396 @@ static menulist_s s_no_spheres_box; static void DMFlagCallback(void *self) { - menulist_s *f = (menulist_s *)self; - int flags; - int bit = 0; + menulist_s *f = (menulist_s *)self; + int flags; + int bit = 0; - flags = Cvar_VariableValue("dmflags"); + flags = Cvar_VariableValue("dmflags"); - if (f == &s_friendlyfire_box) - { - if (f->curvalue) - { - flags &= ~DF_NO_FRIENDLY_FIRE; - } + if (f == &s_friendlyfire_box) + { + if (f->curvalue) + { + flags &= ~DF_NO_FRIENDLY_FIRE; + } - else - { - flags |= DF_NO_FRIENDLY_FIRE; - } + else + { + flags |= DF_NO_FRIENDLY_FIRE; + } - goto setvalue; - } - else if (f == &s_falls_box) - { - if (f->curvalue) - { - flags &= ~DF_NO_FALLING; - } + goto setvalue; + } + else if (f == &s_falls_box) + { + if (f->curvalue) + { + flags &= ~DF_NO_FALLING; + } - else - { - flags |= DF_NO_FALLING; - } + else + { + flags |= DF_NO_FALLING; + } - goto setvalue; - } - else if (f == &s_weapons_stay_box) - { - bit = DF_WEAPONS_STAY; - } - else if (f == &s_instant_powerups_box) - { - bit = DF_INSTANT_ITEMS; - } - else if (f == &s_allow_exit_box) - { - bit = DF_ALLOW_EXIT; - } - else if (f == &s_powerups_box) - { - if (f->curvalue) - { - flags &= ~DF_NO_ITEMS; - } + goto setvalue; + } + else if (f == &s_weapons_stay_box) + { + bit = DF_WEAPONS_STAY; + } + else if (f == &s_instant_powerups_box) + { + bit = DF_INSTANT_ITEMS; + } + else if (f == &s_allow_exit_box) + { + bit = DF_ALLOW_EXIT; + } + else if (f == &s_powerups_box) + { + if (f->curvalue) + { + flags &= ~DF_NO_ITEMS; + } - else - { - flags |= DF_NO_ITEMS; - } + else + { + flags |= DF_NO_ITEMS; + } - goto setvalue; - } - else if (f == &s_health_box) - { - if (f->curvalue) - { - flags &= ~DF_NO_HEALTH; - } + goto setvalue; + } + else if (f == &s_health_box) + { + if (f->curvalue) + { + flags &= ~DF_NO_HEALTH; + } - else - { - flags |= DF_NO_HEALTH; - } + else + { + flags |= DF_NO_HEALTH; + } - goto setvalue; - } - else if (f == &s_spawn_farthest_box) - { - bit = DF_SPAWN_FARTHEST; - } - else if (f == &s_teamplay_box) - { - if (f->curvalue == 1) - { - flags |= DF_SKINTEAMS; - flags &= ~DF_MODELTEAMS; - } - else if (f->curvalue == 2) - { - flags |= DF_MODELTEAMS; - flags &= ~DF_SKINTEAMS; - } - else - { - flags &= ~(DF_MODELTEAMS | DF_SKINTEAMS); - } + goto setvalue; + } + else if (f == &s_spawn_farthest_box) + { + bit = DF_SPAWN_FARTHEST; + } + else if (f == &s_teamplay_box) + { + if (f->curvalue == 1) + { + flags |= DF_SKINTEAMS; + flags &= ~DF_MODELTEAMS; + } + else if (f->curvalue == 2) + { + flags |= DF_MODELTEAMS; + flags &= ~DF_SKINTEAMS; + } + else + { + flags &= ~(DF_MODELTEAMS | DF_SKINTEAMS); + } - goto setvalue; - } - else if (f == &s_samelevel_box) - { - bit = DF_SAME_LEVEL; - } - else if (f == &s_force_respawn_box) - { - bit = DF_FORCE_RESPAWN; - } - else if (f == &s_armor_box) - { - if (f->curvalue) - { - flags &= ~DF_NO_ARMOR; - } + goto setvalue; + } + else if (f == &s_samelevel_box) + { + bit = DF_SAME_LEVEL; + } + else if (f == &s_force_respawn_box) + { + bit = DF_FORCE_RESPAWN; + } + else if (f == &s_armor_box) + { + if (f->curvalue) + { + flags &= ~DF_NO_ARMOR; + } - else - { - flags |= DF_NO_ARMOR; - } + else + { + flags |= DF_NO_ARMOR; + } - goto setvalue; - } - else if (f == &s_infinite_ammo_box) - { - bit = DF_INFINITE_AMMO; - } - else if (f == &s_fixed_fov_box) - { - bit = DF_FIXED_FOV; - } - else if (f == &s_quad_drop_box) - { - bit = DF_QUAD_DROP; - } - else if (Developer_searchpath() == 2) - { - if (f == &s_no_mines_box) - { - bit = DF_NO_MINES; - } - else if (f == &s_no_nukes_box) - { - bit = DF_NO_NUKES; - } - else if (f == &s_stack_double_box) - { - bit = DF_NO_STACK_DOUBLE; - } - else if (f == &s_no_spheres_box) - { - bit = DF_NO_SPHERES; - } - } + goto setvalue; + } + else if (f == &s_infinite_ammo_box) + { + bit = DF_INFINITE_AMMO; + } + else if (f == &s_fixed_fov_box) + { + bit = DF_FIXED_FOV; + } + else if (f == &s_quad_drop_box) + { + bit = DF_QUAD_DROP; + } + else if (Developer_searchpath() == 2) + { + if (f == &s_no_mines_box) + { + bit = DF_NO_MINES; + } + else if (f == &s_no_nukes_box) + { + bit = DF_NO_NUKES; + } + else if (f == &s_stack_double_box) + { + bit = DF_NO_STACK_DOUBLE; + } + else if (f == &s_no_spheres_box) + { + bit = DF_NO_SPHERES; + } + } - if (f) - { - if (f->curvalue == 0) - { - flags &= ~bit; - } + if (f) + { + if (f->curvalue == 0) + { + flags &= ~bit; + } - else - { - flags |= bit; - } - } + else + { + flags |= bit; + } + } setvalue: - Cvar_SetValue("dmflags", (float)flags); + Cvar_SetValue("dmflags", (float)flags); - Com_sprintf(dmoptions_statusbar, sizeof(dmoptions_statusbar), - "dmflags = %d", flags); + Com_sprintf(dmoptions_statusbar, sizeof(dmoptions_statusbar), + "dmflags = %d", flags); } static void DMOptions_MenuInit(void) { - static const char *yes_no_names[] = { - "no", "yes", 0 - }; - static const char *teamplay_names[] = { - "disabled", "by skin", "by model", 0 - }; - int dmflags = Cvar_VariableValue("dmflags"); - int y = 0; + static const char *yes_no_names[] = + { + "no", "yes", 0 + }; + static const char *teamplay_names[] = + { + "disabled", "by skin", "by model", 0 + }; + int dmflags = Cvar_VariableValue("dmflags"); + int y = 0; - s_dmoptions_menu.x = (int)(viddef.width * 0.50f); - s_dmoptions_menu.nitems = 0; + s_dmoptions_menu.x = (int)(viddef.width * 0.50f); + s_dmoptions_menu.nitems = 0; - s_falls_box.generic.type = MTYPE_SPINCONTROL; - s_falls_box.generic.x = 0; - s_falls_box.generic.y = y; - s_falls_box.generic.name = "falling damage"; - s_falls_box.generic.callback = DMFlagCallback; - s_falls_box.itemnames = yes_no_names; - s_falls_box.curvalue = (dmflags & DF_NO_FALLING) == 0; + s_falls_box.generic.type = MTYPE_SPINCONTROL; + s_falls_box.generic.x = 0; + s_falls_box.generic.y = y; + s_falls_box.generic.name = "falling damage"; + s_falls_box.generic.callback = DMFlagCallback; + s_falls_box.itemnames = yes_no_names; + s_falls_box.curvalue = (dmflags & DF_NO_FALLING) == 0; - s_weapons_stay_box.generic.type = MTYPE_SPINCONTROL; - s_weapons_stay_box.generic.x = 0; - s_weapons_stay_box.generic.y = y += 10; - s_weapons_stay_box.generic.name = "weapons stay"; - s_weapons_stay_box.generic.callback = DMFlagCallback; - s_weapons_stay_box.itemnames = yes_no_names; - s_weapons_stay_box.curvalue = (dmflags & DF_WEAPONS_STAY) != 0; + s_weapons_stay_box.generic.type = MTYPE_SPINCONTROL; + s_weapons_stay_box.generic.x = 0; + s_weapons_stay_box.generic.y = y += 10; + s_weapons_stay_box.generic.name = "weapons stay"; + s_weapons_stay_box.generic.callback = DMFlagCallback; + s_weapons_stay_box.itemnames = yes_no_names; + s_weapons_stay_box.curvalue = (dmflags & DF_WEAPONS_STAY) != 0; - s_instant_powerups_box.generic.type = MTYPE_SPINCONTROL; - s_instant_powerups_box.generic.x = 0; - s_instant_powerups_box.generic.y = y += 10; - s_instant_powerups_box.generic.name = "instant powerups"; - s_instant_powerups_box.generic.callback = DMFlagCallback; - s_instant_powerups_box.itemnames = yes_no_names; - s_instant_powerups_box.curvalue = (dmflags & DF_INSTANT_ITEMS) != 0; + s_instant_powerups_box.generic.type = MTYPE_SPINCONTROL; + s_instant_powerups_box.generic.x = 0; + s_instant_powerups_box.generic.y = y += 10; + s_instant_powerups_box.generic.name = "instant powerups"; + s_instant_powerups_box.generic.callback = DMFlagCallback; + s_instant_powerups_box.itemnames = yes_no_names; + s_instant_powerups_box.curvalue = (dmflags & DF_INSTANT_ITEMS) != 0; - s_powerups_box.generic.type = MTYPE_SPINCONTROL; - s_powerups_box.generic.x = 0; - s_powerups_box.generic.y = y += 10; - s_powerups_box.generic.name = "allow powerups"; - s_powerups_box.generic.callback = DMFlagCallback; - s_powerups_box.itemnames = yes_no_names; - s_powerups_box.curvalue = (dmflags & DF_NO_ITEMS) == 0; + s_powerups_box.generic.type = MTYPE_SPINCONTROL; + s_powerups_box.generic.x = 0; + s_powerups_box.generic.y = y += 10; + s_powerups_box.generic.name = "allow powerups"; + s_powerups_box.generic.callback = DMFlagCallback; + s_powerups_box.itemnames = yes_no_names; + s_powerups_box.curvalue = (dmflags & DF_NO_ITEMS) == 0; - s_health_box.generic.type = MTYPE_SPINCONTROL; - s_health_box.generic.x = 0; - s_health_box.generic.y = y += 10; - s_health_box.generic.callback = DMFlagCallback; - s_health_box.generic.name = "allow health"; - s_health_box.itemnames = yes_no_names; - s_health_box.curvalue = (dmflags & DF_NO_HEALTH) == 0; + s_health_box.generic.type = MTYPE_SPINCONTROL; + s_health_box.generic.x = 0; + s_health_box.generic.y = y += 10; + s_health_box.generic.callback = DMFlagCallback; + s_health_box.generic.name = "allow health"; + s_health_box.itemnames = yes_no_names; + s_health_box.curvalue = (dmflags & DF_NO_HEALTH) == 0; - s_armor_box.generic.type = MTYPE_SPINCONTROL; - s_armor_box.generic.x = 0; - s_armor_box.generic.y = y += 10; - s_armor_box.generic.name = "allow armor"; - s_armor_box.generic.callback = DMFlagCallback; - s_armor_box.itemnames = yes_no_names; - s_armor_box.curvalue = (dmflags & DF_NO_ARMOR) == 0; + s_armor_box.generic.type = MTYPE_SPINCONTROL; + s_armor_box.generic.x = 0; + s_armor_box.generic.y = y += 10; + s_armor_box.generic.name = "allow armor"; + s_armor_box.generic.callback = DMFlagCallback; + s_armor_box.itemnames = yes_no_names; + s_armor_box.curvalue = (dmflags & DF_NO_ARMOR) == 0; - s_spawn_farthest_box.generic.type = MTYPE_SPINCONTROL; - s_spawn_farthest_box.generic.x = 0; - s_spawn_farthest_box.generic.y = y += 10; - s_spawn_farthest_box.generic.name = "spawn farthest"; - s_spawn_farthest_box.generic.callback = DMFlagCallback; - s_spawn_farthest_box.itemnames = yes_no_names; - s_spawn_farthest_box.curvalue = (dmflags & DF_SPAWN_FARTHEST) != 0; + s_spawn_farthest_box.generic.type = MTYPE_SPINCONTROL; + s_spawn_farthest_box.generic.x = 0; + s_spawn_farthest_box.generic.y = y += 10; + s_spawn_farthest_box.generic.name = "spawn farthest"; + s_spawn_farthest_box.generic.callback = DMFlagCallback; + s_spawn_farthest_box.itemnames = yes_no_names; + s_spawn_farthest_box.curvalue = (dmflags & DF_SPAWN_FARTHEST) != 0; - s_samelevel_box.generic.type = MTYPE_SPINCONTROL; - s_samelevel_box.generic.x = 0; - s_samelevel_box.generic.y = y += 10; - s_samelevel_box.generic.name = "same map"; - s_samelevel_box.generic.callback = DMFlagCallback; - s_samelevel_box.itemnames = yes_no_names; - s_samelevel_box.curvalue = (dmflags & DF_SAME_LEVEL) != 0; + s_samelevel_box.generic.type = MTYPE_SPINCONTROL; + s_samelevel_box.generic.x = 0; + s_samelevel_box.generic.y = y += 10; + s_samelevel_box.generic.name = "same map"; + s_samelevel_box.generic.callback = DMFlagCallback; + s_samelevel_box.itemnames = yes_no_names; + s_samelevel_box.curvalue = (dmflags & DF_SAME_LEVEL) != 0; - s_force_respawn_box.generic.type = MTYPE_SPINCONTROL; - s_force_respawn_box.generic.x = 0; - s_force_respawn_box.generic.y = y += 10; - s_force_respawn_box.generic.name = "force respawn"; - s_force_respawn_box.generic.callback = DMFlagCallback; - s_force_respawn_box.itemnames = yes_no_names; - s_force_respawn_box.curvalue = (dmflags & DF_FORCE_RESPAWN) != 0; + s_force_respawn_box.generic.type = MTYPE_SPINCONTROL; + s_force_respawn_box.generic.x = 0; + s_force_respawn_box.generic.y = y += 10; + s_force_respawn_box.generic.name = "force respawn"; + s_force_respawn_box.generic.callback = DMFlagCallback; + s_force_respawn_box.itemnames = yes_no_names; + s_force_respawn_box.curvalue = (dmflags & DF_FORCE_RESPAWN) != 0; - s_teamplay_box.generic.type = MTYPE_SPINCONTROL; - s_teamplay_box.generic.x = 0; - s_teamplay_box.generic.y = y += 10; - s_teamplay_box.generic.name = "teamplay"; - s_teamplay_box.generic.callback = DMFlagCallback; - s_teamplay_box.itemnames = teamplay_names; + s_teamplay_box.generic.type = MTYPE_SPINCONTROL; + s_teamplay_box.generic.x = 0; + s_teamplay_box.generic.y = y += 10; + s_teamplay_box.generic.name = "teamplay"; + s_teamplay_box.generic.callback = DMFlagCallback; + s_teamplay_box.itemnames = teamplay_names; - s_allow_exit_box.generic.type = MTYPE_SPINCONTROL; - s_allow_exit_box.generic.x = 0; - s_allow_exit_box.generic.y = y += 10; - s_allow_exit_box.generic.name = "allow exit"; - s_allow_exit_box.generic.callback = DMFlagCallback; - s_allow_exit_box.itemnames = yes_no_names; - s_allow_exit_box.curvalue = (dmflags & DF_ALLOW_EXIT) != 0; + s_allow_exit_box.generic.type = MTYPE_SPINCONTROL; + s_allow_exit_box.generic.x = 0; + s_allow_exit_box.generic.y = y += 10; + s_allow_exit_box.generic.name = "allow exit"; + s_allow_exit_box.generic.callback = DMFlagCallback; + s_allow_exit_box.itemnames = yes_no_names; + s_allow_exit_box.curvalue = (dmflags & DF_ALLOW_EXIT) != 0; - s_infinite_ammo_box.generic.type = MTYPE_SPINCONTROL; - s_infinite_ammo_box.generic.x = 0; - s_infinite_ammo_box.generic.y = y += 10; - s_infinite_ammo_box.generic.name = "infinite ammo"; - s_infinite_ammo_box.generic.callback = DMFlagCallback; - s_infinite_ammo_box.itemnames = yes_no_names; - s_infinite_ammo_box.curvalue = (dmflags & DF_INFINITE_AMMO) != 0; + s_infinite_ammo_box.generic.type = MTYPE_SPINCONTROL; + s_infinite_ammo_box.generic.x = 0; + s_infinite_ammo_box.generic.y = y += 10; + s_infinite_ammo_box.generic.name = "infinite ammo"; + s_infinite_ammo_box.generic.callback = DMFlagCallback; + s_infinite_ammo_box.itemnames = yes_no_names; + s_infinite_ammo_box.curvalue = (dmflags & DF_INFINITE_AMMO) != 0; - s_fixed_fov_box.generic.type = MTYPE_SPINCONTROL; - s_fixed_fov_box.generic.x = 0; - s_fixed_fov_box.generic.y = y += 10; - s_fixed_fov_box.generic.name = "fixed FOV"; - s_fixed_fov_box.generic.callback = DMFlagCallback; - s_fixed_fov_box.itemnames = yes_no_names; - s_fixed_fov_box.curvalue = (dmflags & DF_FIXED_FOV) != 0; + s_fixed_fov_box.generic.type = MTYPE_SPINCONTROL; + s_fixed_fov_box.generic.x = 0; + s_fixed_fov_box.generic.y = y += 10; + s_fixed_fov_box.generic.name = "fixed FOV"; + s_fixed_fov_box.generic.callback = DMFlagCallback; + s_fixed_fov_box.itemnames = yes_no_names; + s_fixed_fov_box.curvalue = (dmflags & DF_FIXED_FOV) != 0; - s_quad_drop_box.generic.type = MTYPE_SPINCONTROL; - s_quad_drop_box.generic.x = 0; - s_quad_drop_box.generic.y = y += 10; - s_quad_drop_box.generic.name = "quad drop"; - s_quad_drop_box.generic.callback = DMFlagCallback; - s_quad_drop_box.itemnames = yes_no_names; - s_quad_drop_box.curvalue = (dmflags & DF_QUAD_DROP) != 0; + s_quad_drop_box.generic.type = MTYPE_SPINCONTROL; + s_quad_drop_box.generic.x = 0; + s_quad_drop_box.generic.y = y += 10; + s_quad_drop_box.generic.name = "quad drop"; + s_quad_drop_box.generic.callback = DMFlagCallback; + s_quad_drop_box.itemnames = yes_no_names; + s_quad_drop_box.curvalue = (dmflags & DF_QUAD_DROP) != 0; - s_friendlyfire_box.generic.type = MTYPE_SPINCONTROL; - s_friendlyfire_box.generic.x = 0; - s_friendlyfire_box.generic.y = y += 10; - s_friendlyfire_box.generic.name = "friendly fire"; - s_friendlyfire_box.generic.callback = DMFlagCallback; - s_friendlyfire_box.itemnames = yes_no_names; - s_friendlyfire_box.curvalue = (dmflags & DF_NO_FRIENDLY_FIRE) == 0; + s_friendlyfire_box.generic.type = MTYPE_SPINCONTROL; + s_friendlyfire_box.generic.x = 0; + s_friendlyfire_box.generic.y = y += 10; + s_friendlyfire_box.generic.name = "friendly fire"; + s_friendlyfire_box.generic.callback = DMFlagCallback; + s_friendlyfire_box.itemnames = yes_no_names; + s_friendlyfire_box.curvalue = (dmflags & DF_NO_FRIENDLY_FIRE) == 0; - if (Developer_searchpath() == 2) - { - s_no_mines_box.generic.type = MTYPE_SPINCONTROL; - s_no_mines_box.generic.x = 0; - s_no_mines_box.generic.y = y += 10; - s_no_mines_box.generic.name = "remove mines"; - s_no_mines_box.generic.callback = DMFlagCallback; - s_no_mines_box.itemnames = yes_no_names; - s_no_mines_box.curvalue = (dmflags & DF_NO_MINES) != 0; + if (Developer_searchpath() == 2) + { + s_no_mines_box.generic.type = MTYPE_SPINCONTROL; + s_no_mines_box.generic.x = 0; + s_no_mines_box.generic.y = y += 10; + s_no_mines_box.generic.name = "remove mines"; + s_no_mines_box.generic.callback = DMFlagCallback; + s_no_mines_box.itemnames = yes_no_names; + s_no_mines_box.curvalue = (dmflags & DF_NO_MINES) != 0; - s_no_nukes_box.generic.type = MTYPE_SPINCONTROL; - s_no_nukes_box.generic.x = 0; - s_no_nukes_box.generic.y = y += 10; - s_no_nukes_box.generic.name = "remove nukes"; - s_no_nukes_box.generic.callback = DMFlagCallback; - s_no_nukes_box.itemnames = yes_no_names; - s_no_nukes_box.curvalue = (dmflags & DF_NO_NUKES) != 0; + s_no_nukes_box.generic.type = MTYPE_SPINCONTROL; + s_no_nukes_box.generic.x = 0; + s_no_nukes_box.generic.y = y += 10; + s_no_nukes_box.generic.name = "remove nukes"; + s_no_nukes_box.generic.callback = DMFlagCallback; + s_no_nukes_box.itemnames = yes_no_names; + s_no_nukes_box.curvalue = (dmflags & DF_NO_NUKES) != 0; - s_stack_double_box.generic.type = MTYPE_SPINCONTROL; - s_stack_double_box.generic.x = 0; - s_stack_double_box.generic.y = y += 10; - s_stack_double_box.generic.name = "2x/4x stacking off"; - s_stack_double_box.generic.callback = DMFlagCallback; - s_stack_double_box.itemnames = yes_no_names; - s_stack_double_box.curvalue = (dmflags & DF_NO_STACK_DOUBLE) != 0; + s_stack_double_box.generic.type = MTYPE_SPINCONTROL; + s_stack_double_box.generic.x = 0; + s_stack_double_box.generic.y = y += 10; + s_stack_double_box.generic.name = "2x/4x stacking off"; + s_stack_double_box.generic.callback = DMFlagCallback; + s_stack_double_box.itemnames = yes_no_names; + s_stack_double_box.curvalue = (dmflags & DF_NO_STACK_DOUBLE) != 0; - s_no_spheres_box.generic.type = MTYPE_SPINCONTROL; - s_no_spheres_box.generic.x = 0; - s_no_spheres_box.generic.y = y += 10; - s_no_spheres_box.generic.name = "remove spheres"; - s_no_spheres_box.generic.callback = DMFlagCallback; - s_no_spheres_box.itemnames = yes_no_names; - s_no_spheres_box.curvalue = (dmflags & DF_NO_SPHERES) != 0; - } + s_no_spheres_box.generic.type = MTYPE_SPINCONTROL; + s_no_spheres_box.generic.x = 0; + s_no_spheres_box.generic.y = y += 10; + s_no_spheres_box.generic.name = "remove spheres"; + s_no_spheres_box.generic.callback = DMFlagCallback; + s_no_spheres_box.itemnames = yes_no_names; + s_no_spheres_box.curvalue = (dmflags & DF_NO_SPHERES) != 0; + } - Menu_AddItem(&s_dmoptions_menu, &s_falls_box); - Menu_AddItem(&s_dmoptions_menu, &s_weapons_stay_box); - Menu_AddItem(&s_dmoptions_menu, &s_instant_powerups_box); - Menu_AddItem(&s_dmoptions_menu, &s_powerups_box); - Menu_AddItem(&s_dmoptions_menu, &s_health_box); - Menu_AddItem(&s_dmoptions_menu, &s_armor_box); - Menu_AddItem(&s_dmoptions_menu, &s_spawn_farthest_box); - Menu_AddItem(&s_dmoptions_menu, &s_samelevel_box); - Menu_AddItem(&s_dmoptions_menu, &s_force_respawn_box); - Menu_AddItem(&s_dmoptions_menu, &s_teamplay_box); - Menu_AddItem(&s_dmoptions_menu, &s_allow_exit_box); - Menu_AddItem(&s_dmoptions_menu, &s_infinite_ammo_box); - Menu_AddItem(&s_dmoptions_menu, &s_fixed_fov_box); - Menu_AddItem(&s_dmoptions_menu, &s_quad_drop_box); - Menu_AddItem(&s_dmoptions_menu, &s_friendlyfire_box); + Menu_AddItem(&s_dmoptions_menu, &s_falls_box); + Menu_AddItem(&s_dmoptions_menu, &s_weapons_stay_box); + Menu_AddItem(&s_dmoptions_menu, &s_instant_powerups_box); + Menu_AddItem(&s_dmoptions_menu, &s_powerups_box); + Menu_AddItem(&s_dmoptions_menu, &s_health_box); + Menu_AddItem(&s_dmoptions_menu, &s_armor_box); + Menu_AddItem(&s_dmoptions_menu, &s_spawn_farthest_box); + Menu_AddItem(&s_dmoptions_menu, &s_samelevel_box); + Menu_AddItem(&s_dmoptions_menu, &s_force_respawn_box); + Menu_AddItem(&s_dmoptions_menu, &s_teamplay_box); + Menu_AddItem(&s_dmoptions_menu, &s_allow_exit_box); + Menu_AddItem(&s_dmoptions_menu, &s_infinite_ammo_box); + Menu_AddItem(&s_dmoptions_menu, &s_fixed_fov_box); + Menu_AddItem(&s_dmoptions_menu, &s_quad_drop_box); + Menu_AddItem(&s_dmoptions_menu, &s_friendlyfire_box); - if (Developer_searchpath() == 2) - { - Menu_AddItem(&s_dmoptions_menu, &s_no_mines_box); - Menu_AddItem(&s_dmoptions_menu, &s_no_nukes_box); - Menu_AddItem(&s_dmoptions_menu, &s_stack_double_box); - Menu_AddItem(&s_dmoptions_menu, &s_no_spheres_box); - } + if (Developer_searchpath() == 2) + { + Menu_AddItem(&s_dmoptions_menu, &s_no_mines_box); + Menu_AddItem(&s_dmoptions_menu, &s_no_nukes_box); + Menu_AddItem(&s_dmoptions_menu, &s_stack_double_box); + Menu_AddItem(&s_dmoptions_menu, &s_no_spheres_box); + } - Menu_Center(&s_dmoptions_menu); + Menu_Center(&s_dmoptions_menu); - /* set the original dmflags statusbar */ - DMFlagCallback(0); - Menu_SetStatusBar(&s_dmoptions_menu, dmoptions_statusbar); + /* set the original dmflags statusbar */ + DMFlagCallback(0); + Menu_SetStatusBar(&s_dmoptions_menu, dmoptions_statusbar); } static void DMOptions_MenuDraw(void) { - Menu_Draw(&s_dmoptions_menu); + Menu_Draw(&s_dmoptions_menu); } const char * DMOptions_MenuKey(int key) { - return Default_MenuKey(&s_dmoptions_menu, key); + return Default_MenuKey(&s_dmoptions_menu, key); } static void M_Menu_DMOptions_f(void) { - DMOptions_MenuInit(); - M_PushMenu(DMOptions_MenuDraw, DMOptions_MenuKey); + DMOptions_MenuInit(); + M_PushMenu(DMOptions_MenuDraw, DMOptions_MenuKey); } /* @@ -3497,127 +3511,128 @@ static menulist_s s_allow_download_sounds_box; static void DownloadCallback(void *self) { - menulist_s *f = (menulist_s *)self; + menulist_s *f = (menulist_s *)self; - if (f == &s_allow_download_box) - { - Cvar_SetValue("allow_download", (float)f->curvalue); - } + if (f == &s_allow_download_box) + { + Cvar_SetValue("allow_download", (float)f->curvalue); + } - else if (f == &s_allow_download_maps_box) - { - Cvar_SetValue("allow_download_maps", (float)f->curvalue); - } + else if (f == &s_allow_download_maps_box) + { + Cvar_SetValue("allow_download_maps", (float)f->curvalue); + } - else if (f == &s_allow_download_models_box) - { - Cvar_SetValue("allow_download_models", (float)f->curvalue); - } + else if (f == &s_allow_download_models_box) + { + Cvar_SetValue("allow_download_models", (float)f->curvalue); + } - else if (f == &s_allow_download_players_box) - { - Cvar_SetValue("allow_download_players", (float)f->curvalue); - } + else if (f == &s_allow_download_players_box) + { + Cvar_SetValue("allow_download_players", (float)f->curvalue); + } - else if (f == &s_allow_download_sounds_box) - { - Cvar_SetValue("allow_download_sounds", (float)f->curvalue); - } + else if (f == &s_allow_download_sounds_box) + { + Cvar_SetValue("allow_download_sounds", (float)f->curvalue); + } } static void DownloadOptions_MenuInit(void) { - static const char *yes_no_names[] = { - "no", "yes", 0 - }; - int y = 0; + static const char *yes_no_names[] = + { + "no", "yes", 0 + }; + int y = 0; - s_downloadoptions_menu.x = (int)(viddef.width * 0.50f); - s_downloadoptions_menu.nitems = 0; + s_downloadoptions_menu.x = (int)(viddef.width * 0.50f); + s_downloadoptions_menu.nitems = 0; - s_download_title.generic.type = MTYPE_SEPARATOR; - s_download_title.generic.name = "Download Options"; - s_download_title.generic.x = 48; - s_download_title.generic.y = y; + s_download_title.generic.type = MTYPE_SEPARATOR; + s_download_title.generic.name = "Download Options"; + s_download_title.generic.x = 48; + s_download_title.generic.y = y; - s_allow_download_box.generic.type = MTYPE_SPINCONTROL; - s_allow_download_box.generic.x = 0; - s_allow_download_box.generic.y = y += 20; - s_allow_download_box.generic.name = "allow downloading"; - s_allow_download_box.generic.callback = DownloadCallback; - s_allow_download_box.itemnames = yes_no_names; - s_allow_download_box.curvalue = (Cvar_VariableValue("allow_download") != 0); + s_allow_download_box.generic.type = MTYPE_SPINCONTROL; + s_allow_download_box.generic.x = 0; + s_allow_download_box.generic.y = y += 20; + s_allow_download_box.generic.name = "allow downloading"; + s_allow_download_box.generic.callback = DownloadCallback; + s_allow_download_box.itemnames = yes_no_names; + s_allow_download_box.curvalue = (Cvar_VariableValue("allow_download") != 0); - s_allow_download_maps_box.generic.type = MTYPE_SPINCONTROL; - s_allow_download_maps_box.generic.x = 0; - s_allow_download_maps_box.generic.y = y += 20; - s_allow_download_maps_box.generic.name = "maps"; - s_allow_download_maps_box.generic.callback = DownloadCallback; - s_allow_download_maps_box.itemnames = yes_no_names; - s_allow_download_maps_box.curvalue = - (Cvar_VariableValue("allow_download_maps") != 0); + s_allow_download_maps_box.generic.type = MTYPE_SPINCONTROL; + s_allow_download_maps_box.generic.x = 0; + s_allow_download_maps_box.generic.y = y += 20; + s_allow_download_maps_box.generic.name = "maps"; + s_allow_download_maps_box.generic.callback = DownloadCallback; + s_allow_download_maps_box.itemnames = yes_no_names; + s_allow_download_maps_box.curvalue = + (Cvar_VariableValue("allow_download_maps") != 0); - s_allow_download_players_box.generic.type = MTYPE_SPINCONTROL; - s_allow_download_players_box.generic.x = 0; - s_allow_download_players_box.generic.y = y += 10; - s_allow_download_players_box.generic.name = "player models/skins"; - s_allow_download_players_box.generic.callback = DownloadCallback; - s_allow_download_players_box.itemnames = yes_no_names; - s_allow_download_players_box.curvalue = - (Cvar_VariableValue("allow_download_players") != 0); + s_allow_download_players_box.generic.type = MTYPE_SPINCONTROL; + s_allow_download_players_box.generic.x = 0; + s_allow_download_players_box.generic.y = y += 10; + s_allow_download_players_box.generic.name = "player models/skins"; + s_allow_download_players_box.generic.callback = DownloadCallback; + s_allow_download_players_box.itemnames = yes_no_names; + s_allow_download_players_box.curvalue = + (Cvar_VariableValue("allow_download_players") != 0); - s_allow_download_models_box.generic.type = MTYPE_SPINCONTROL; - s_allow_download_models_box.generic.x = 0; - s_allow_download_models_box.generic.y = y += 10; - s_allow_download_models_box.generic.name = "models"; - s_allow_download_models_box.generic.callback = DownloadCallback; - s_allow_download_models_box.itemnames = yes_no_names; - s_allow_download_models_box.curvalue = - (Cvar_VariableValue("allow_download_models") != 0); + s_allow_download_models_box.generic.type = MTYPE_SPINCONTROL; + s_allow_download_models_box.generic.x = 0; + s_allow_download_models_box.generic.y = y += 10; + s_allow_download_models_box.generic.name = "models"; + s_allow_download_models_box.generic.callback = DownloadCallback; + s_allow_download_models_box.itemnames = yes_no_names; + s_allow_download_models_box.curvalue = + (Cvar_VariableValue("allow_download_models") != 0); - s_allow_download_sounds_box.generic.type = MTYPE_SPINCONTROL; - s_allow_download_sounds_box.generic.x = 0; - s_allow_download_sounds_box.generic.y = y += 10; - s_allow_download_sounds_box.generic.name = "sounds"; - s_allow_download_sounds_box.generic.callback = DownloadCallback; - s_allow_download_sounds_box.itemnames = yes_no_names; - s_allow_download_sounds_box.curvalue = - (Cvar_VariableValue("allow_download_sounds") != 0); + s_allow_download_sounds_box.generic.type = MTYPE_SPINCONTROL; + s_allow_download_sounds_box.generic.x = 0; + s_allow_download_sounds_box.generic.y = y += 10; + s_allow_download_sounds_box.generic.name = "sounds"; + s_allow_download_sounds_box.generic.callback = DownloadCallback; + s_allow_download_sounds_box.itemnames = yes_no_names; + s_allow_download_sounds_box.curvalue = + (Cvar_VariableValue("allow_download_sounds") != 0); - Menu_AddItem(&s_downloadoptions_menu, &s_download_title); - Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_box); - Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_maps_box); - Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_players_box); - Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_models_box); - Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_sounds_box); + Menu_AddItem(&s_downloadoptions_menu, &s_download_title); + Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_box); + Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_maps_box); + Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_players_box); + Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_models_box); + Menu_AddItem(&s_downloadoptions_menu, &s_allow_download_sounds_box); - Menu_Center(&s_downloadoptions_menu); + Menu_Center(&s_downloadoptions_menu); - /* skip over title */ - if (s_downloadoptions_menu.cursor == 0) - { - s_downloadoptions_menu.cursor = 1; - } + /* skip over title */ + if (s_downloadoptions_menu.cursor == 0) + { + s_downloadoptions_menu.cursor = 1; + } } static void DownloadOptions_MenuDraw(void) { - Menu_Draw(&s_downloadoptions_menu); + Menu_Draw(&s_downloadoptions_menu); } static const char * DownloadOptions_MenuKey(int key) { - return Default_MenuKey(&s_downloadoptions_menu, key); + return Default_MenuKey(&s_downloadoptions_menu, key); } static void M_Menu_DownloadOptions_f(void) { - DownloadOptions_MenuInit(); - M_PushMenu(DownloadOptions_MenuDraw, DownloadOptions_MenuKey); + DownloadOptions_MenuInit(); + M_PushMenu(DownloadOptions_MenuDraw, DownloadOptions_MenuKey); } /* @@ -3632,67 +3647,67 @@ static menufield_s s_addressbook_fields[NUM_ADDRESSBOOK_ENTRIES]; static void AddressBook_MenuInit(void) { - int i; + int i; - s_addressbook_menu.x = viddef.width / 2 - 142; - s_addressbook_menu.y = viddef.height / 2 - 58; - s_addressbook_menu.nitems = 0; + s_addressbook_menu.x = viddef.width / 2 - 142; + s_addressbook_menu.y = viddef.height / 2 - 58; + s_addressbook_menu.nitems = 0; - for (i = 0; i < NUM_ADDRESSBOOK_ENTRIES; i++) - { - cvar_t *adr; - char buffer[20]; + for (i = 0; i < NUM_ADDRESSBOOK_ENTRIES; i++) + { + cvar_t *adr; + char buffer[20]; - Com_sprintf(buffer, sizeof(buffer), "adr%d", i); + Com_sprintf(buffer, sizeof(buffer), "adr%d", i); - adr = Cvar_Get(buffer, "", CVAR_ARCHIVE); + adr = Cvar_Get(buffer, "", CVAR_ARCHIVE); - s_addressbook_fields[i].generic.type = MTYPE_FIELD; - s_addressbook_fields[i].generic.name = 0; - s_addressbook_fields[i].generic.callback = 0; - s_addressbook_fields[i].generic.x = 0; - s_addressbook_fields[i].generic.y = i * 18 + 0; - s_addressbook_fields[i].generic.localdata[0] = i; - s_addressbook_fields[i].cursor = 0; - s_addressbook_fields[i].length = 60; - s_addressbook_fields[i].visible_length = 30; + s_addressbook_fields[i].generic.type = MTYPE_FIELD; + s_addressbook_fields[i].generic.name = 0; + s_addressbook_fields[i].generic.callback = 0; + s_addressbook_fields[i].generic.x = 0; + s_addressbook_fields[i].generic.y = i * 18 + 0; + s_addressbook_fields[i].generic.localdata[0] = i; + s_addressbook_fields[i].cursor = 0; + s_addressbook_fields[i].length = 60; + s_addressbook_fields[i].visible_length = 30; - strcpy(s_addressbook_fields[i].buffer, adr->string); + strcpy(s_addressbook_fields[i].buffer, adr->string); - Menu_AddItem(&s_addressbook_menu, &s_addressbook_fields[i]); - } + Menu_AddItem(&s_addressbook_menu, &s_addressbook_fields[i]); + } } const char * AddressBook_MenuKey(int key) { - if (key == K_ESCAPE) - { - int index; - char buffer[20]; + if (key == K_ESCAPE) + { + int index; + char buffer[20]; - for (index = 0; index < NUM_ADDRESSBOOK_ENTRIES; index++) - { - Com_sprintf(buffer, sizeof(buffer), "adr%d", index); - Cvar_Set(buffer, s_addressbook_fields[index].buffer); - } - } + for (index = 0; index < NUM_ADDRESSBOOK_ENTRIES; index++) + { + Com_sprintf(buffer, sizeof(buffer), "adr%d", index); + Cvar_Set(buffer, s_addressbook_fields[index].buffer); + } + } - return Default_MenuKey(&s_addressbook_menu, key); + return Default_MenuKey(&s_addressbook_menu, key); } static void AddressBook_MenuDraw(void) { - M_Banner("m_banner_addressbook"); - Menu_Draw(&s_addressbook_menu); + M_Banner("m_banner_addressbook"); + Menu_Draw(&s_addressbook_menu); } static void M_Menu_AddressBook_f(void) { - AddressBook_MenuInit(); - M_PushMenu(AddressBook_MenuDraw, AddressBook_MenuKey); + AddressBook_MenuInit(); + M_PushMenu(AddressBook_MenuDraw, AddressBook_MenuKey); } /* @@ -3716,10 +3731,10 @@ static menuaction_s s_player_download_action; typedef struct { - int nskins; - char **skindisplaynames; - char displayname[MAX_DISPLAYNAME]; - char directory[MAX_QPATH]; + int nskins; + char **skindisplaynames; + char displayname[MAX_DISPLAYNAME]; + char directory[MAX_QPATH]; } playermodelinfo_s; static playermodelinfo_s s_pmi[MAX_PLAYERMODELS]; @@ -3728,74 +3743,75 @@ static int s_numplayermodels; static int rate_tbl[] = {2500, 3200, 5000, 10000, 25000, 0}; static const char *rate_names[] = {"28.8 Modem", "33.6 Modem", "Single ISDN", - "Dual ISDN/Cable", "T1/LAN", "User defined", - 0}; + "Dual ISDN/Cable", "T1/LAN", "User defined", + 0 + }; static void DownloadOptionsFunc(void *self) { - M_Menu_DownloadOptions_f(); + M_Menu_DownloadOptions_f(); } static void HandednessCallback(void *unused) { - Cvar_SetValue("hand", (float)s_player_handedness_box.curvalue); + Cvar_SetValue("hand", (float)s_player_handedness_box.curvalue); } static void RateCallback(void *unused) { - if (s_player_rate_box.curvalue != sizeof(rate_tbl) / sizeof(*rate_tbl) - 1) - { - Cvar_SetValue("rate", (float)rate_tbl[s_player_rate_box.curvalue]); - } + if (s_player_rate_box.curvalue != sizeof(rate_tbl) / sizeof(*rate_tbl) - 1) + { + Cvar_SetValue("rate", (float)rate_tbl[s_player_rate_box.curvalue]); + } } static void ModelCallback(void *unused) { - s_player_skin_box.itemnames = - (const char **)s_pmi[s_player_model_box.curvalue].skindisplaynames; - s_player_skin_box.curvalue = 0; + s_player_skin_box.itemnames = + (const char **)s_pmi[s_player_model_box.curvalue].skindisplaynames; + s_player_skin_box.curvalue = 0; } static void FreeFileList(char **list, int n) { - int i; + int i; - for (i = 0; i < n; i++) - { - if (list[i]) - { - free(list[i]); - list[i] = 0; - } - } + for (i = 0; i < n; i++) + { + if (list[i]) + { + free(list[i]); + list[i] = 0; + } + } - free(list); + free(list); } static qboolean IconOfSkinExists(char *skin, char **pcxfiles, int npcxfiles) { - int i; - char scratch[1024]; + int i; + char scratch[1024]; - strcpy(scratch, skin); - *strrchr(scratch, '.') = 0; - strcat(scratch, "_i.pcx"); + strcpy(scratch, skin); + *strrchr(scratch, '.') = 0; + strcat(scratch, "_i.pcx"); - for (i = 0; i < npcxfiles; i++) - { - if (strcmp(pcxfiles[i], scratch) == 0) - { - return true; - } - } + for (i = 0; i < npcxfiles; i++) + { + if (strcmp(pcxfiles[i], scratch) == 0) + { + return true; + } + } - return false; + return false; } extern char **FS_ListFiles(char *, int *, unsigned, unsigned); @@ -3982,207 +3998,207 @@ PlayerConfig_ScanDirectories(void) static int pmicmpfnc(const void *_a, const void *_b) { - const playermodelinfo_s *a = (const playermodelinfo_s *)_a; - const playermodelinfo_s *b = (const playermodelinfo_s *)_b; + const playermodelinfo_s *a = (const playermodelinfo_s *)_a; + const playermodelinfo_s *b = (const playermodelinfo_s *)_b; - /* sort by male, female, then alphabetical */ - if (strcmp(a->directory, "male") == 0) - { - return -1; - } + /* sort by male, female, then alphabetical */ + if (strcmp(a->directory, "male") == 0) + { + return -1; + } - else if (strcmp(b->directory, "male") == 0) - { - return 1; - } + else if (strcmp(b->directory, "male") == 0) + { + return 1; + } - if (strcmp(a->directory, "female") == 0) - { - return -1; - } + if (strcmp(a->directory, "female") == 0) + { + return -1; + } - else if (strcmp(b->directory, "female") == 0) - { - return 1; - } + else if (strcmp(b->directory, "female") == 0) + { + return 1; + } - return strcmp(a->directory, b->directory); + return strcmp(a->directory, b->directory); } static qboolean PlayerConfig_MenuInit(void) { - extern cvar_t *name; - extern cvar_t *skin; - char currentdirectory[1024]; - char currentskin[1024]; - int i = 0; + extern cvar_t *name; + extern cvar_t *skin; + char currentdirectory[1024]; + char currentskin[1024]; + int i = 0; - int currentdirectoryindex = 0; - int currentskinindex = 0; + int currentdirectoryindex = 0; + int currentskinindex = 0; - cvar_t *hand = Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE); + cvar_t *hand = Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE); - static const char *handedness[] = {"right", "left", "center", 0}; + static const char *handedness[] = {"right", "left", "center", 0}; - PlayerConfig_ScanDirectories(); + PlayerConfig_ScanDirectories(); - if (s_numplayermodels == 0) - { - return false; - } + if (s_numplayermodels == 0) + { + return false; + } - if ((hand->value < 0) || (hand->value > 2)) - { - Cvar_SetValue("hand", 0); - } + if ((hand->value < 0) || (hand->value > 2)) + { + Cvar_SetValue("hand", 0); + } - strcpy(currentdirectory, skin->string); + strcpy(currentdirectory, skin->string); - if (strchr(currentdirectory, '/')) - { - strcpy(currentskin, strchr(currentdirectory, '/') + 1); - *strchr(currentdirectory, '/') = 0; - } - else if (strchr(currentdirectory, '\\')) - { - strcpy(currentskin, strchr(currentdirectory, '\\') + 1); - *strchr(currentdirectory, '\\') = 0; - } - else - { - strcpy(currentdirectory, "male"); - strcpy(currentskin, "grunt"); - } + if (strchr(currentdirectory, '/')) + { + strcpy(currentskin, strchr(currentdirectory, '/') + 1); + *strchr(currentdirectory, '/') = 0; + } + else if (strchr(currentdirectory, '\\')) + { + strcpy(currentskin, strchr(currentdirectory, '\\') + 1); + *strchr(currentdirectory, '\\') = 0; + } + else + { + strcpy(currentdirectory, "male"); + strcpy(currentskin, "grunt"); + } - qsort(s_pmi, s_numplayermodels, sizeof(s_pmi[0]), pmicmpfnc); + qsort(s_pmi, s_numplayermodels, sizeof(s_pmi[0]), pmicmpfnc); - memset(s_pmnames, 0, sizeof(s_pmnames)); + memset(s_pmnames, 0, sizeof(s_pmnames)); - for (i = 0; i < s_numplayermodels; i++) - { - s_pmnames[i] = s_pmi[i].displayname; + for (i = 0; i < s_numplayermodels; i++) + { + s_pmnames[i] = s_pmi[i].displayname; - if (Q_stricmp(s_pmi[i].directory, currentdirectory) == 0) - { - int j; + if (Q_stricmp(s_pmi[i].directory, currentdirectory) == 0) + { + int j; - currentdirectoryindex = i; + currentdirectoryindex = i; - for (j = 0; j < s_pmi[i].nskins; j++) - { - if (Q_stricmp(s_pmi[i].skindisplaynames[j], currentskin) == 0) - { - currentskinindex = j; - break; - } - } - } - } + for (j = 0; j < s_pmi[i].nskins; j++) + { + if (Q_stricmp(s_pmi[i].skindisplaynames[j], currentskin) == 0) + { + currentskinindex = j; + break; + } + } + } + } - s_player_config_menu.x = viddef.width / 2 - 95; - s_player_config_menu.y = viddef.height / 2 - 97; - s_player_config_menu.nitems = 0; + s_player_config_menu.x = viddef.width / 2 - 95; + s_player_config_menu.y = viddef.height / 2 - 97; + s_player_config_menu.nitems = 0; - s_player_name_field.generic.type = MTYPE_FIELD; - s_player_name_field.generic.name = "name"; - s_player_name_field.generic.callback = 0; - s_player_name_field.generic.x = 0; - s_player_name_field.generic.y = 0; - s_player_name_field.length = 20; - s_player_name_field.visible_length = 20; - strcpy(s_player_name_field.buffer, name->string); - s_player_name_field.cursor = strlen(name->string); + s_player_name_field.generic.type = MTYPE_FIELD; + s_player_name_field.generic.name = "name"; + s_player_name_field.generic.callback = 0; + s_player_name_field.generic.x = 0; + s_player_name_field.generic.y = 0; + s_player_name_field.length = 20; + s_player_name_field.visible_length = 20; + strcpy(s_player_name_field.buffer, name->string); + s_player_name_field.cursor = strlen(name->string); - s_player_model_title.generic.type = MTYPE_SEPARATOR; - s_player_model_title.generic.name = "model"; - s_player_model_title.generic.x = -8; - s_player_model_title.generic.y = 60; + s_player_model_title.generic.type = MTYPE_SEPARATOR; + s_player_model_title.generic.name = "model"; + s_player_model_title.generic.x = -8; + s_player_model_title.generic.y = 60; - s_player_model_box.generic.type = MTYPE_SPINCONTROL; - s_player_model_box.generic.x = -56; - s_player_model_box.generic.y = 70; - s_player_model_box.generic.callback = ModelCallback; - s_player_model_box.generic.cursor_offset = -48; - s_player_model_box.curvalue = currentdirectoryindex; - s_player_model_box.itemnames = (const char **)s_pmnames; + s_player_model_box.generic.type = MTYPE_SPINCONTROL; + s_player_model_box.generic.x = -56; + s_player_model_box.generic.y = 70; + s_player_model_box.generic.callback = ModelCallback; + s_player_model_box.generic.cursor_offset = -48; + s_player_model_box.curvalue = currentdirectoryindex; + s_player_model_box.itemnames = (const char **)s_pmnames; - s_player_skin_title.generic.type = MTYPE_SEPARATOR; - s_player_skin_title.generic.name = "skin"; - s_player_skin_title.generic.x = -16; - s_player_skin_title.generic.y = 84; + s_player_skin_title.generic.type = MTYPE_SEPARATOR; + s_player_skin_title.generic.name = "skin"; + s_player_skin_title.generic.x = -16; + s_player_skin_title.generic.y = 84; - s_player_skin_box.generic.type = MTYPE_SPINCONTROL; - s_player_skin_box.generic.x = -56; - s_player_skin_box.generic.y = 94; - s_player_skin_box.generic.name = 0; - s_player_skin_box.generic.callback = 0; - s_player_skin_box.generic.cursor_offset = -48; - s_player_skin_box.curvalue = currentskinindex; - s_player_skin_box.itemnames = - (const char **)s_pmi[currentdirectoryindex].skindisplaynames; + s_player_skin_box.generic.type = MTYPE_SPINCONTROL; + s_player_skin_box.generic.x = -56; + s_player_skin_box.generic.y = 94; + s_player_skin_box.generic.name = 0; + s_player_skin_box.generic.callback = 0; + s_player_skin_box.generic.cursor_offset = -48; + s_player_skin_box.curvalue = currentskinindex; + s_player_skin_box.itemnames = + (const char **)s_pmi[currentdirectoryindex].skindisplaynames; - s_player_hand_title.generic.type = MTYPE_SEPARATOR; - s_player_hand_title.generic.name = "handedness"; - s_player_hand_title.generic.x = 32; - s_player_hand_title.generic.y = 108; + s_player_hand_title.generic.type = MTYPE_SEPARATOR; + s_player_hand_title.generic.name = "handedness"; + s_player_hand_title.generic.x = 32; + s_player_hand_title.generic.y = 108; - s_player_handedness_box.generic.type = MTYPE_SPINCONTROL; - s_player_handedness_box.generic.x = -56; - s_player_handedness_box.generic.y = 118; - s_player_handedness_box.generic.name = 0; - s_player_handedness_box.generic.cursor_offset = -48; - s_player_handedness_box.generic.callback = HandednessCallback; - s_player_handedness_box.curvalue = Cvar_VariableValue("hand"); - s_player_handedness_box.itemnames = handedness; + s_player_handedness_box.generic.type = MTYPE_SPINCONTROL; + s_player_handedness_box.generic.x = -56; + s_player_handedness_box.generic.y = 118; + s_player_handedness_box.generic.name = 0; + s_player_handedness_box.generic.cursor_offset = -48; + s_player_handedness_box.generic.callback = HandednessCallback; + s_player_handedness_box.curvalue = Cvar_VariableValue("hand"); + s_player_handedness_box.itemnames = handedness; - for (i = 0; i < sizeof(rate_tbl) / sizeof(*rate_tbl) - 1; i++) - { - if (Cvar_VariableValue("rate") == rate_tbl[i]) - { - break; - } - } + for (i = 0; i < sizeof(rate_tbl) / sizeof(*rate_tbl) - 1; i++) + { + if (Cvar_VariableValue("rate") == rate_tbl[i]) + { + break; + } + } - s_player_rate_title.generic.type = MTYPE_SEPARATOR; - s_player_rate_title.generic.name = "connect speed"; - s_player_rate_title.generic.x = 56; - s_player_rate_title.generic.y = 156; + s_player_rate_title.generic.type = MTYPE_SEPARATOR; + s_player_rate_title.generic.name = "connect speed"; + s_player_rate_title.generic.x = 56; + s_player_rate_title.generic.y = 156; - s_player_rate_box.generic.type = MTYPE_SPINCONTROL; - s_player_rate_box.generic.x = -56; - s_player_rate_box.generic.y = 166; - s_player_rate_box.generic.name = 0; - s_player_rate_box.generic.cursor_offset = -48; - s_player_rate_box.generic.callback = RateCallback; - s_player_rate_box.curvalue = i; - s_player_rate_box.itemnames = rate_names; + s_player_rate_box.generic.type = MTYPE_SPINCONTROL; + s_player_rate_box.generic.x = -56; + s_player_rate_box.generic.y = 166; + s_player_rate_box.generic.name = 0; + s_player_rate_box.generic.cursor_offset = -48; + s_player_rate_box.generic.callback = RateCallback; + s_player_rate_box.curvalue = i; + s_player_rate_box.itemnames = rate_names; - s_player_download_action.generic.type = MTYPE_ACTION; - s_player_download_action.generic.name = "download options"; - s_player_download_action.generic.flags = QMF_LEFT_JUSTIFY; - s_player_download_action.generic.x = -24; - s_player_download_action.generic.y = 186; - s_player_download_action.generic.statusbar = NULL; - s_player_download_action.generic.callback = DownloadOptionsFunc; + s_player_download_action.generic.type = MTYPE_ACTION; + s_player_download_action.generic.name = "download options"; + s_player_download_action.generic.flags = QMF_LEFT_JUSTIFY; + s_player_download_action.generic.x = -24; + s_player_download_action.generic.y = 186; + s_player_download_action.generic.statusbar = NULL; + s_player_download_action.generic.callback = DownloadOptionsFunc; - Menu_AddItem(&s_player_config_menu, &s_player_name_field); - Menu_AddItem(&s_player_config_menu, &s_player_model_title); - Menu_AddItem(&s_player_config_menu, &s_player_model_box); + Menu_AddItem(&s_player_config_menu, &s_player_name_field); + Menu_AddItem(&s_player_config_menu, &s_player_model_title); + Menu_AddItem(&s_player_config_menu, &s_player_model_box); - if (s_player_skin_box.itemnames) - { - Menu_AddItem(&s_player_config_menu, &s_player_skin_title); - Menu_AddItem(&s_player_config_menu, &s_player_skin_box); - } + if (s_player_skin_box.itemnames) + { + Menu_AddItem(&s_player_config_menu, &s_player_skin_title); + Menu_AddItem(&s_player_config_menu, &s_player_skin_box); + } - Menu_AddItem(&s_player_config_menu, &s_player_hand_title); - Menu_AddItem(&s_player_config_menu, &s_player_handedness_box); - Menu_AddItem(&s_player_config_menu, &s_player_rate_title); - Menu_AddItem(&s_player_config_menu, &s_player_rate_box); - Menu_AddItem(&s_player_config_menu, &s_player_download_action); + Menu_AddItem(&s_player_config_menu, &s_player_hand_title); + Menu_AddItem(&s_player_config_menu, &s_player_handedness_box); + Menu_AddItem(&s_player_config_menu, &s_player_rate_title); + Menu_AddItem(&s_player_config_menu, &s_player_rate_box); + Menu_AddItem(&s_player_config_menu, &s_player_download_action); - return true; + return true; } extern float CalcFov(float fov_x, float w, float h); @@ -4190,125 +4206,125 @@ extern float CalcFov(float fov_x, float w, float h); static void PlayerConfig_MenuDraw(void) { - refdef_t refdef; - char scratch[MAX_QPATH]; + refdef_t refdef; + char scratch[MAX_QPATH]; - memset(&refdef, 0, sizeof(refdef)); + memset(&refdef, 0, sizeof(refdef)); - refdef.x = viddef.width / 2; - refdef.y = viddef.height / 2 - 72; - refdef.width = 144; - refdef.height = 168; - refdef.fov_x = 40; - refdef.fov_y = CalcFov(refdef.fov_x, (float)refdef.width, - (float)refdef.height); - refdef.time = cls.realtime * 0.001f; + refdef.x = viddef.width / 2; + refdef.y = viddef.height / 2 - 72; + refdef.width = 144; + refdef.height = 168; + refdef.fov_x = 40; + refdef.fov_y = CalcFov(refdef.fov_x, (float)refdef.width, + (float)refdef.height); + refdef.time = cls.realtime * 0.001f; - if (s_pmi[s_player_model_box.curvalue].skindisplaynames) - { - static int yaw; - entity_t entity; + if (s_pmi[s_player_model_box.curvalue].skindisplaynames) + { + static int yaw; + entity_t entity; - memset(&entity, 0, sizeof(entity)); + memset(&entity, 0, sizeof(entity)); - Com_sprintf(scratch, sizeof(scratch), "players/%s/tris.md2", - s_pmi[s_player_model_box.curvalue].directory); - entity.model = R_RegisterModel(scratch); - Com_sprintf(scratch, sizeof(scratch), "players/%s/%s.pcx", - s_pmi[s_player_model_box.curvalue].directory, - s_pmi[s_player_model_box.curvalue].skindisplaynames[ - s_player_skin_box.curvalue]); - entity.skin = R_RegisterSkin(scratch); - entity.flags = RF_FULLBRIGHT; - entity.origin[0] = 80; - entity.origin[1] = 0; - entity.origin[2] = 0; - VectorCopy(entity.origin, entity.oldorigin); - entity.frame = 0; - entity.oldframe = 0; - entity.backlerp = 0.0; - entity.angles[1] = (float)yaw; + Com_sprintf(scratch, sizeof(scratch), "players/%s/tris.md2", + s_pmi[s_player_model_box.curvalue].directory); + entity.model = R_RegisterModel(scratch); + Com_sprintf(scratch, sizeof(scratch), "players/%s/%s.pcx", + s_pmi[s_player_model_box.curvalue].directory, + s_pmi[s_player_model_box.curvalue].skindisplaynames[ + s_player_skin_box.curvalue]); + entity.skin = R_RegisterSkin(scratch); + entity.flags = RF_FULLBRIGHT; + entity.origin[0] = 80; + entity.origin[1] = 0; + entity.origin[2] = 0; + VectorCopy(entity.origin, entity.oldorigin); + entity.frame = 0; + entity.oldframe = 0; + entity.backlerp = 0.0; + entity.angles[1] = (float)yaw; - if (++yaw > 360) - { - yaw -= 360; - } + if (++yaw > 360) + { + yaw -= 360; + } - refdef.areabits = 0; - refdef.num_entities = 1; - refdef.entities = &entity; - refdef.lightstyles = 0; - refdef.rdflags = RDF_NOWORLDMODEL; + refdef.areabits = 0; + refdef.num_entities = 1; + refdef.entities = &entity; + refdef.lightstyles = 0; + refdef.rdflags = RDF_NOWORLDMODEL; - Menu_Draw(&s_player_config_menu); + Menu_Draw(&s_player_config_menu); - M_DrawTextBox(((int)(refdef.x) * (320.0F / viddef.width) - 8), - (int)((viddef.height / 2) * (240.0F / viddef.height) - 77), - refdef.width / 8, refdef.height / 8); - refdef.height += 4; + M_DrawTextBox(((int)(refdef.x) * (320.0F / viddef.width) - 8), + (int)((viddef.height / 2) * (240.0F / viddef.height) - 77), + refdef.width / 8, refdef.height / 8); + refdef.height += 4; - R_RenderFrame(&refdef); + R_RenderFrame(&refdef); - Com_sprintf(scratch, sizeof(scratch), "/players/%s/%s_i.pcx", - s_pmi[s_player_model_box.curvalue].directory, - s_pmi[s_player_model_box.curvalue].skindisplaynames[ - s_player_skin_box.curvalue]); - Draw_Pic(s_player_config_menu.x - 40, refdef.y, scratch); - } + Com_sprintf(scratch, sizeof(scratch), "/players/%s/%s_i.pcx", + s_pmi[s_player_model_box.curvalue].directory, + s_pmi[s_player_model_box.curvalue].skindisplaynames[ + s_player_skin_box.curvalue]); + Draw_Pic(s_player_config_menu.x - 40, refdef.y, scratch); + } } static const char * PlayerConfig_MenuKey(int key) { - int i; + int i; - if (key == K_ESCAPE) - { - char scratch[1024]; + if (key == K_ESCAPE) + { + char scratch[1024]; - Cvar_Set("name", s_player_name_field.buffer); + Cvar_Set("name", s_player_name_field.buffer); - Com_sprintf(scratch, sizeof(scratch), "%s/%s", - s_pmi[s_player_model_box.curvalue].directory, - s_pmi[s_player_model_box.curvalue].skindisplaynames[ - s_player_skin_box.curvalue]); + Com_sprintf(scratch, sizeof(scratch), "%s/%s", + s_pmi[s_player_model_box.curvalue].directory, + s_pmi[s_player_model_box.curvalue].skindisplaynames[ + s_player_skin_box.curvalue]); - Cvar_Set("skin", scratch); + Cvar_Set("skin", scratch); - for (i = 0; i < s_numplayermodels; i++) - { - int j; + for (i = 0; i < s_numplayermodels; i++) + { + int j; - for (j = 0; j < s_pmi[i].nskins; j++) - { - if (s_pmi[i].skindisplaynames[j]) - { - free(s_pmi[i].skindisplaynames[j]); - } + for (j = 0; j < s_pmi[i].nskins; j++) + { + if (s_pmi[i].skindisplaynames[j]) + { + free(s_pmi[i].skindisplaynames[j]); + } - s_pmi[i].skindisplaynames[j] = 0; - } + s_pmi[i].skindisplaynames[j] = 0; + } - free(s_pmi[i].skindisplaynames); - s_pmi[i].skindisplaynames = 0; - s_pmi[i].nskins = 0; - } - } + free(s_pmi[i].skindisplaynames); + s_pmi[i].skindisplaynames = 0; + s_pmi[i].nskins = 0; + } + } - return Default_MenuKey(&s_player_config_menu, key); + return Default_MenuKey(&s_player_config_menu, key); } static void M_Menu_PlayerConfig_f(void) { - if (!PlayerConfig_MenuInit()) - { - Menu_SetStatusBar(&s_multiplayer_menu, "no valid player models found"); - return; - } + if (!PlayerConfig_MenuInit()) + { + Menu_SetStatusBar(&s_multiplayer_menu, "no valid player models found"); + return; + } - Menu_SetStatusBar(&s_multiplayer_menu, NULL); - M_PushMenu(PlayerConfig_MenuDraw, PlayerConfig_MenuKey); + Menu_SetStatusBar(&s_multiplayer_menu, NULL); + M_PushMenu(PlayerConfig_MenuDraw, PlayerConfig_MenuKey); } /* @@ -4318,108 +4334,108 @@ M_Menu_PlayerConfig_f(void) static const char * M_Quit_Key(int key) { - switch (key) - { - case K_ESCAPE: - case 'n': - case 'N': - M_PopMenu(); - break; + switch (key) + { + case K_ESCAPE: + case 'n': + case 'N': + M_PopMenu(); + break; - case 'Y': - case 'y': - cls.key_dest = key_console; - CL_Quit_f(); - break; + case 'Y': + case 'y': + cls.key_dest = key_console; + CL_Quit_f(); + break; - default: - break; - } + default: + break; + } - return NULL; + return NULL; } static void M_Quit_Draw(void) { - int w, h; + int w, h; - Draw_GetPicSize(&w, &h, "quit"); - Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "quit"); + Draw_GetPicSize(&w, &h, "quit"); + Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "quit"); } static void M_Menu_Quit_f(void) { - M_PushMenu(M_Quit_Draw, M_Quit_Key); + M_PushMenu(M_Quit_Draw, M_Quit_Key); } void M_Init(void) { - Cmd_AddCommand("menu_main", M_Menu_Main_f); - Cmd_AddCommand("menu_game", M_Menu_Game_f); - Cmd_AddCommand("menu_loadgame", M_Menu_LoadGame_f); - Cmd_AddCommand("menu_savegame", M_Menu_SaveGame_f); - Cmd_AddCommand("menu_joinserver", M_Menu_JoinServer_f); - Cmd_AddCommand("menu_addressbook", M_Menu_AddressBook_f); - Cmd_AddCommand("menu_startserver", M_Menu_StartServer_f); - Cmd_AddCommand("menu_dmoptions", M_Menu_DMOptions_f); - Cmd_AddCommand("menu_playerconfig", M_Menu_PlayerConfig_f); - Cmd_AddCommand("menu_downloadoptions", M_Menu_DownloadOptions_f); - Cmd_AddCommand("menu_credits", M_Menu_Credits_f); - Cmd_AddCommand("menu_multiplayer", M_Menu_Multiplayer_f); - Cmd_AddCommand("menu_video", M_Menu_Video_f); - Cmd_AddCommand("menu_options", M_Menu_Options_f); - Cmd_AddCommand("menu_keys", M_Menu_Keys_f); - Cmd_AddCommand("menu_quit", M_Menu_Quit_f); + Cmd_AddCommand("menu_main", M_Menu_Main_f); + Cmd_AddCommand("menu_game", M_Menu_Game_f); + Cmd_AddCommand("menu_loadgame", M_Menu_LoadGame_f); + Cmd_AddCommand("menu_savegame", M_Menu_SaveGame_f); + Cmd_AddCommand("menu_joinserver", M_Menu_JoinServer_f); + Cmd_AddCommand("menu_addressbook", M_Menu_AddressBook_f); + Cmd_AddCommand("menu_startserver", M_Menu_StartServer_f); + Cmd_AddCommand("menu_dmoptions", M_Menu_DMOptions_f); + Cmd_AddCommand("menu_playerconfig", M_Menu_PlayerConfig_f); + Cmd_AddCommand("menu_downloadoptions", M_Menu_DownloadOptions_f); + Cmd_AddCommand("menu_credits", M_Menu_Credits_f); + Cmd_AddCommand("menu_multiplayer", M_Menu_Multiplayer_f); + Cmd_AddCommand("menu_video", M_Menu_Video_f); + Cmd_AddCommand("menu_options", M_Menu_Options_f); + Cmd_AddCommand("menu_keys", M_Menu_Keys_f); + Cmd_AddCommand("menu_quit", M_Menu_Quit_f); } void M_Draw(void) { - if (cls.key_dest != key_menu) - { - return; - } + if (cls.key_dest != key_menu) + { + return; + } - /* repaint everything next frame */ - SCR_DirtyScreen(); + /* repaint everything next frame */ + SCR_DirtyScreen(); - /* dim everything behind it down */ - if (cl.cinematictime > 0) - { - Draw_Fill(0, 0, viddef.width, viddef.height, 0); - } + /* dim everything behind it down */ + if (cl.cinematictime > 0) + { + Draw_Fill(0, 0, viddef.width, viddef.height, 0); + } - else - { - Draw_FadeScreen(); - } + else + { + Draw_FadeScreen(); + } - m_drawfunc(); + m_drawfunc(); - /* delay playing the enter sound until after the - menu has been drawn, to avoid delay while - caching images */ - if (m_entersound) - { - S_StartLocalSound(menu_in_sound); - m_entersound = false; - } + /* delay playing the enter sound until after the + menu has been drawn, to avoid delay while + caching images */ + if (m_entersound) + { + S_StartLocalSound(menu_in_sound); + m_entersound = false; + } } void M_Keydown(int key) { - const char *s; + const char *s; - if (m_keyfunc) - { - if ((s = m_keyfunc(key)) != 0) - { - S_StartLocalSound((char *)s); - } - } + if (m_keyfunc) + { + if ((s = m_keyfunc(key)) != 0) + { + S_StartLocalSound((char *)s); + } + } } diff --git a/src/client/menu/qmenu.c b/src/client/menu/qmenu.c index b91aa4e9..e5419a79 100644 --- a/src/client/menu/qmenu.c +++ b/src/client/menu/qmenu.c @@ -42,13 +42,10 @@ static void SpinControl_DoSlide(menulist_s *s, int dir); #define RCOLUMN_OFFSET 16 #define LCOLUMN_OFFSET -16 -//extern refexport_t re; extern viddef_t viddef; #define VID_WIDTH viddef.width #define VID_HEIGHT viddef.height -//#define Draw_Char re.DrawChar -//#define Draw_Fill re.DrawFill void Action_DoEnter(menuaction_s *a) diff --git a/src/refresh/files/jpeg.c b/src/refresh/files/jpeg.c index 8abd1630..7ab90a18 100644 --- a/src/refresh/files/jpeg.c +++ b/src/refresh/files/jpeg.c @@ -48,7 +48,7 @@ jpg_null(j_decompress_ptr cinfo) boolean jpg_fill_input_buffer(j_decompress_ptr cinfo) { - ri.Con_Printf(PRINT_ALL, "Premature end of JPEG data\n"); + VID_Printf(PRINT_ALL, "Premature end of JPEG data\n"); return 1; } @@ -95,7 +95,7 @@ LoadJPG(char *origname, byte **pic, int *width, int *height) *pic = NULL; /* Load JPEG file into memory */ - rawsize = ri.FS_LoadFile(filename, (void **)&rawdata); + rawsize = FS_LoadFile(filename, (void **)&rawdata); if (!rawdata) { @@ -105,8 +105,8 @@ LoadJPG(char *origname, byte **pic, int *width, int *height) if ((rawsize < 10) || (rawdata[6] != 'J') || (rawdata[7] != 'F') || (rawdata[8] != 'I') || (rawdata[9] != 'F')) { - ri.Con_Printf(PRINT_ALL, "Invalid JPEG header: %s\n", filename); - ri.FS_FreeFile(rawdata); + VID_Printf(PRINT_ALL, "Invalid JPEG header: %s\n", filename); + FS_FreeFile(rawdata); return; } @@ -118,9 +118,9 @@ LoadJPG(char *origname, byte **pic, int *width, int *height) if ((cinfo.output_components != 3) && (cinfo.output_components != 4)) { - ri.Con_Printf(PRINT_ALL, "Invalid JPEG colour components\n"); + VID_Printf(PRINT_ALL, "Invalid JPEG colour components\n"); jpeg_destroy_decompress(&cinfo); - ri.FS_FreeFile(rawdata); + FS_FreeFile(rawdata); return; } @@ -129,9 +129,9 @@ LoadJPG(char *origname, byte **pic, int *width, int *height) if (!rgbadata) { - ri.Con_Printf(PRINT_ALL, "Insufficient memory for JPEG buffer\n"); + VID_Printf(PRINT_ALL, "Insufficient memory for JPEG buffer\n"); jpeg_destroy_decompress(&cinfo); - ri.FS_FreeFile(rawdata); + FS_FreeFile(rawdata); return; } @@ -144,11 +144,11 @@ LoadJPG(char *origname, byte **pic, int *width, int *height) if (!scanline) { - ri.Con_Printf(PRINT_ALL, + VID_Printf(PRINT_ALL, "Insufficient memory for JPEG scanline buffer\n"); free(rgbadata); jpeg_destroy_decompress(&cinfo); - ri.FS_FreeFile(rawdata); + FS_FreeFile(rawdata); return; } diff --git a/src/refresh/files/md2.c b/src/refresh/files/md2.c index 930725b4..6105d110 100644 --- a/src/refresh/files/md2.c +++ b/src/refresh/files/md2.c @@ -43,7 +43,7 @@ LoadMD2(model_t *mod, void *buffer) if (version != ALIAS_VERSION) { - ri.Sys_Error(ERR_DROP, "%s has wrong version number (%i should be %i)", + VID_Error(ERR_DROP, "%s has wrong version number (%i should be %i)", mod->name, version, ALIAS_VERSION); } @@ -57,33 +57,33 @@ LoadMD2(model_t *mod, void *buffer) if (pheader->skinheight > MAX_LBM_HEIGHT) { - ri.Sys_Error(ERR_DROP, "model %s has a skin taller than %d", mod->name, + VID_Error(ERR_DROP, "model %s has a skin taller than %d", mod->name, MAX_LBM_HEIGHT); } if (pheader->num_xyz <= 0) { - ri.Sys_Error(ERR_DROP, "model %s has no vertices", mod->name); + VID_Error(ERR_DROP, "model %s has no vertices", mod->name); } if (pheader->num_xyz > MAX_VERTS) { - ri.Sys_Error(ERR_DROP, "model %s has too many vertices", mod->name); + VID_Error(ERR_DROP, "model %s has too many vertices", mod->name); } if (pheader->num_st <= 0) { - ri.Sys_Error(ERR_DROP, "model %s has no st vertices", mod->name); + VID_Error(ERR_DROP, "model %s has no st vertices", mod->name); } if (pheader->num_tris <= 0) { - ri.Sys_Error(ERR_DROP, "model %s has no triangles", mod->name); + VID_Error(ERR_DROP, "model %s has no triangles", mod->name); } if (pheader->num_frames <= 0) { - ri.Sys_Error(ERR_DROP, "model %s has no frames", mod->name); + VID_Error(ERR_DROP, "model %s has no frames", mod->name); } /* load base s and t vertices (not used in gl version) */ diff --git a/src/refresh/files/pcx.c b/src/refresh/files/pcx.c index b29c7f3b..2a0d1e97 100644 --- a/src/refresh/files/pcx.c +++ b/src/refresh/files/pcx.c @@ -49,11 +49,11 @@ LoadPCX(char *origname, byte **pic, byte **palette, int *width, int *height) *palette = NULL; /* load the file */ - len = ri.FS_LoadFile(filename, (void **)&raw); + len = FS_LoadFile(filename, (void **)&raw); if (!raw) { - ri.Con_Printf(PRINT_DEVELOPER, "Bad pcx file %s\n", filename); + VID_Printf(PRINT_DEVELOPER, "Bad pcx file %s\n", filename); return; } @@ -75,7 +75,7 @@ LoadPCX(char *origname, byte **pic, byte **palette, int *width, int *height) (pcx->encoding != 1) || (pcx->bits_per_pixel != 8) || (pcx->xmax >= 640) || (pcx->ymax >= 480)) { - ri.Con_Printf(PRINT_ALL, "Bad pcx file %s\n", filename); + VID_Printf(PRINT_ALL, "Bad pcx file %s\n", filename); return; } @@ -126,12 +126,12 @@ LoadPCX(char *origname, byte **pic, byte **palette, int *width, int *height) if (raw - (byte *)pcx > len) { - ri.Con_Printf(PRINT_DEVELOPER, "PCX file %s was malformed", filename); + VID_Printf(PRINT_DEVELOPER, "PCX file %s was malformed", filename); free(*pic); *pic = NULL; } - ri.FS_FreeFile(pcx); + FS_FreeFile(pcx); } void @@ -140,7 +140,7 @@ GetPCXInfo(char *filename, int *width, int *height) pcx_t *pcx; byte *raw; - ri.FS_LoadFile(filename, (void **)&raw); + FS_LoadFile(filename, (void **)&raw); if (!raw) { @@ -152,7 +152,7 @@ GetPCXInfo(char *filename, int *width, int *height) *width = pcx->xmax + 1; *height = pcx->ymax + 1; - ri.FS_FreeFile(raw); + FS_FreeFile(raw); return; } diff --git a/src/refresh/files/sp2.c b/src/refresh/files/sp2.c index 4221b548..2442e7ef 100644 --- a/src/refresh/files/sp2.c +++ b/src/refresh/files/sp2.c @@ -43,13 +43,13 @@ LoadSP2(model_t *mod, void *buffer) if (sprout->version != SPRITE_VERSION) { - ri.Sys_Error(ERR_DROP, "%s has wrong version number (%i should be %i)", + VID_Error(ERR_DROP, "%s has wrong version number (%i should be %i)", mod->name, sprout->version, SPRITE_VERSION); } if (sprout->numframes > MAX_MD2SKINS) { - ri.Sys_Error(ERR_DROP, "%s has too many frames (%i > %i)", + VID_Error(ERR_DROP, "%s has too many frames (%i > %i)", mod->name, sprout->numframes, MAX_MD2SKINS); } diff --git a/src/refresh/files/tga.c b/src/refresh/files/tga.c index 5d472c65..04bdeb4c 100644 --- a/src/refresh/files/tga.c +++ b/src/refresh/files/tga.c @@ -60,7 +60,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) *pic = NULL; /* load the file */ - length = ri.FS_LoadFile(name, (void **)&buffer); + length = FS_LoadFile(name, (void **)&buffer); if (!buffer) { @@ -69,7 +69,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (length < 18) { - ri.Sys_Error(ERR_DROP, "LoadTGA: %s has an invalid file size", name); + VID_Error(ERR_DROP, "LoadTGA: %s has an invalid file size", name); } buf_p = buffer; @@ -101,17 +101,17 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) (targa_header.image_type != 10) && (targa_header.image_type != 3)) { - ri.Sys_Error(ERR_DROP, "LoadTGA (%s): Only type 2 (RGB), 3 (gray), and 10 (RGB) TGA images supported", name); + VID_Error(ERR_DROP, "LoadTGA (%s): Only type 2 (RGB), 3 (gray), and 10 (RGB) TGA images supported", name); } if (targa_header.colormap_type != 0) { - ri.Sys_Error(ERR_DROP, "LoadTGA (%s): colormaps not supported", name); + VID_Error(ERR_DROP, "LoadTGA (%s): colormaps not supported", name); } if (((targa_header.pixel_size != 32) && (targa_header.pixel_size != 24)) && (targa_header.image_type != 3)) { - ri.Sys_Error( ERR_DROP, "LoadTGA (%s): Only 32 or 24 bit images supported (no colormaps)", name); + VID_Error( ERR_DROP, "LoadTGA (%s): Only 32 or 24 bit images supported (no colormaps)", name); } columns = targa_header.width; @@ -130,7 +130,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (!columns || !rows || (numPixels > 0x7FFFFFFF) || (numPixels / columns / 4 != rows)) { - ri.Sys_Error(ERR_DROP, "LoadTGA (%s): Invalid image size", name); + VID_Error(ERR_DROP, "LoadTGA (%s): Invalid image size", name); } targa_rgba = malloc(numPixels); @@ -152,7 +152,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (buf_p - buffer + (3 * columns * rows) > length) { - ri.Sys_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); + VID_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); } for (row = rows - 1; row >= 0; row--) @@ -179,7 +179,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (buf_p - buffer + (4 * columns * rows) > length) { - ri.Sys_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); + VID_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); } for (row = rows - 1; row >= 0; row--) @@ -207,7 +207,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (buf_p - buffer + (1 * columns * rows) > length) { - ri.Sys_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); + VID_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); } for (row = rows - 1; row >= 0; row--) @@ -260,7 +260,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (buf_p - buffer + (3) > length) { - ri.Sys_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); + VID_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); } blue = *buf_p++; @@ -272,7 +272,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (buf_p - buffer + (4) > length) { - ri.Sys_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); + VID_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); } blue = *buf_p++; @@ -319,7 +319,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (buf_p - buffer + (3 * packetSize) > length) { - ri.Sys_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); + VID_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); } for (j = 0; j < packetSize; j++) @@ -358,7 +358,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (buf_p - buffer + (4 * packetSize) > length) { - ri.Sys_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); + VID_Error( ERR_DROP, "LoadTGA: (%s): Pointer passed end of file - corrupt TGA file", name); } for (j = 0; j < packetSize; j++) @@ -411,10 +411,10 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) if (!temp) { - ri.Sys_Error(ERR_FATAL, "LoadTGA: not enough memory"); + VID_Error(ERR_FATAL, "LoadTGA: not enough memory"); } - ri.Con_Printf(PRINT_DEVELOPER, "LoadTGA: Bottom-to-top TGA file (slow): %s\n", name); + VID_Printf(PRINT_DEVELOPER, "LoadTGA: Bottom-to-top TGA file (slow): %s\n", name); memcpy(temp, targa_rgba, numPixels); for (row = 0; row < rows; row++) @@ -425,5 +425,5 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) free(temp); } - ri.FS_FreeFile(buffer); + FS_FreeFile(buffer); } diff --git a/src/refresh/files/wal.c b/src/refresh/files/wal.c index 6c4a8919..e3b8d561 100644 --- a/src/refresh/files/wal.c +++ b/src/refresh/files/wal.c @@ -42,11 +42,11 @@ LoadWal(char *origname) Q_strlcat(name, ".wal", sizeof(name)); } - ri.FS_LoadFile(name, (void **)&mt); + FS_LoadFile(name, (void **)&mt); if (!mt) { - ri.Con_Printf(PRINT_ALL, "LoadWall: can't load %s\n", name); + VID_Printf(PRINT_ALL, "LoadWall: can't load %s\n", name); return r_notexture; } @@ -56,7 +56,7 @@ LoadWal(char *origname) image = R_LoadPic(name, (byte *)mt + ofs, width, 0, height, 0, it_wall, 8); - ri.FS_FreeFile((void *)mt); + FS_FreeFile((void *)mt); return image; } @@ -66,7 +66,7 @@ GetWalInfo(char *name, int *width, int *height) { miptex_t *mt; - ri.FS_LoadFile(name, (void **)&mt); + FS_LoadFile(name, (void **)&mt); if (!mt) { @@ -76,7 +76,7 @@ GetWalInfo(char *name, int *width, int *height) *width = LittleLong(mt->width); *height = LittleLong(mt->height); - ri.FS_FreeFile((void *)mt); + FS_FreeFile((void *)mt); return; } diff --git a/src/refresh/header/local.h b/src/refresh/header/local.h index 4dc64ce6..dd839434 100644 --- a/src/refresh/header/local.h +++ b/src/refresh/header/local.h @@ -83,16 +83,7 @@ /* fall over */ #define ROLL 2 -#ifndef __VIDDEF_T - #define __VIDDEF_T - -typedef struct -{ - int width, height; /* coordinates from main game */ -} viddef_t; - -#endif - +char *strlwr(char *s); extern viddef_t vid; /* @@ -319,8 +310,6 @@ int Draw_GetPalette(void); void R_ResampleTexture(unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight); -struct image_s *R_RegisterSkin(char *name); - void LoadPCX(char *filename, byte **pic, byte **palette, int *width, int *height); image_t *LoadWal(char *name); @@ -409,7 +398,6 @@ typedef struct extern glconfig_t gl_config; extern glstate_t gl_state; -extern refimport_t ri; void GLimp_BeginFrame(float camera_separation); int GLimp_Init(void); diff --git a/src/refresh/r_draw.c b/src/refresh/r_draw.c index a86f3173..34b6b365 100644 --- a/src/refresh/r_draw.c +++ b/src/refresh/r_draw.c @@ -132,7 +132,7 @@ Draw_StretchPic(int x, int y, int w, int h, char *pic) if (!gl) { - ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic); + VID_Printf(PRINT_ALL, "Can't find pic: %s\n", pic); return; } @@ -163,7 +163,7 @@ Draw_Pic(int x, int y, char *pic) if (!gl) { - ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic); + VID_Printf(PRINT_ALL, "Can't find pic: %s\n", pic); return; } @@ -199,7 +199,7 @@ Draw_TileClear(int x, int y, int w, int h, char *pic) if (!image) { - ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic); + VID_Printf(PRINT_ALL, "Can't find pic: %s\n", pic); return; } @@ -230,7 +230,7 @@ Draw_Fill(int x, int y, int w, int h, int c) if ((unsigned)c > 255) { - ri.Sys_Error(ERR_FATAL, "Draw_Fill: bad color"); + VID_Error(ERR_FATAL, "Draw_Fill: bad color"); } qglDisable(GL_TEXTURE_2D); @@ -390,7 +390,7 @@ Draw_GetPalette(void) if (!pal) { - ri.Sys_Error(ERR_FATAL, "Couldn't load pics/colormap.pcx"); + VID_Error(ERR_FATAL, "Couldn't load pics/colormap.pcx"); } for (i = 0; i < 256; i++) diff --git a/src/refresh/r_image.c b/src/refresh/r_image.c index 975064a2..94402d28 100644 --- a/src/refresh/r_image.c +++ b/src/refresh/r_image.c @@ -280,7 +280,7 @@ R_TextureMode(char *string) if (i == NUM_GL_MODES) { - ri.Con_Printf(PRINT_ALL, "bad filter name\n"); + VID_Printf(PRINT_ALL, "bad filter name\n"); return; } @@ -292,11 +292,11 @@ R_TextureMode(char *string) { if (gl_anisotropic->value > gl_config.max_anisotropy) { - ri.Cvar_SetValue("gl_anisotropic", gl_config.max_anisotropy); + Cvar_SetValue("gl_anisotropic", gl_config.max_anisotropy); } else if (gl_anisotropic->value < 1.0) { - ri.Cvar_SetValue("gl_anisotropic", 1.0); + Cvar_SetValue("gl_anisotropic", 1.0); } } @@ -336,7 +336,7 @@ R_TextureAlphaMode(char *string) if (i == NUM_GL_ALPHA_MODES) { - ri.Con_Printf(PRINT_ALL, "bad alpha texture mode name\n"); + VID_Printf(PRINT_ALL, "bad alpha texture mode name\n"); return; } @@ -358,7 +358,7 @@ R_TextureSolidMode(char *string) if (i == NUM_GL_SOLID_MODES) { - ri.Con_Printf(PRINT_ALL, "bad solid texture mode name\n"); + VID_Printf(PRINT_ALL, "bad solid texture mode name\n"); return; } @@ -376,7 +376,7 @@ R_ImageList_f(void) "PAL" }; - ri.Con_Printf(PRINT_ALL, "------------------\n"); + VID_Printf(PRINT_ALL, "------------------\n"); texels = 0; for (i = 0, image = gltextures; i < numgltextures; i++, image++) @@ -391,28 +391,28 @@ R_ImageList_f(void) switch (image->type) { case it_skin: - ri.Con_Printf(PRINT_ALL, "M"); + VID_Printf(PRINT_ALL, "M"); break; case it_sprite: - ri.Con_Printf(PRINT_ALL, "S"); + VID_Printf(PRINT_ALL, "S"); break; case it_wall: - ri.Con_Printf(PRINT_ALL, "W"); + VID_Printf(PRINT_ALL, "W"); break; case it_pic: - ri.Con_Printf(PRINT_ALL, "P"); + VID_Printf(PRINT_ALL, "P"); break; default: - ri.Con_Printf(PRINT_ALL, " "); + VID_Printf(PRINT_ALL, " "); break; } - ri.Con_Printf(PRINT_ALL, " %3i %3i %s: %s\n", + VID_Printf(PRINT_ALL, " %3i %3i %s: %s\n", image->upload_width, image->upload_height, palstrings[image->paletted], image->name); } - ri.Con_Printf(PRINT_ALL, + VID_Printf(PRINT_ALL, "Total texel count (not counting mipmaps): %i\n", texels); } @@ -689,7 +689,7 @@ R_Upload32(unsigned *data, int width, int height, qboolean mipmap) if (scaled_width * scaled_height > sizeof(scaled) / 4) { - ri.Sys_Error(ERR_DROP, "R_Upload32: too big"); + VID_Error(ERR_DROP, "R_Upload32: too big"); } /* scan the texture for any non-255 alpha */ @@ -716,7 +716,7 @@ R_Upload32(unsigned *data, int width, int height, qboolean mipmap) } else { - ri.Con_Printf(PRINT_ALL, "Unknown number of texture components %i\n", + VID_Printf(PRINT_ALL, "Unknown number of texture components %i\n", samples); comp = samples; } @@ -850,7 +850,7 @@ R_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky) if (s > sizeof(trans) / 4) { - ri.Sys_Error(ERR_DROP, "R_Upload8: too large"); + VID_Error(ERR_DROP, "R_Upload8: too large"); } if (qglColorTableEXT && gl_ext_palettedtexture->value && is_sky) @@ -871,7 +871,7 @@ R_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky) p = data[i]; trans[i] = d_8to24table[p]; - /* transparent, so scan around for + /* transparent, so scan around for another color to avoid alpha fringes */ if (p == 255) { @@ -930,7 +930,7 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth, { if (numgltextures == MAX_GLTEXTURES) { - ri.Sys_Error(ERR_DROP, "MAX_GLTEXTURES"); + VID_Error(ERR_DROP, "MAX_GLTEXTURES"); } numgltextures++; @@ -940,7 +940,7 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth, if (strlen(name) >= sizeof(image->name)) { - ri.Sys_Error(ERR_DROP, "Draw_LoadPic: \"%s\" is too long", name); + VID_Error(ERR_DROP, "Draw_LoadPic: \"%s\" is too long", name); } strcpy(image->name, name); @@ -1023,7 +1023,7 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth, } else { - ri.Con_Printf(PRINT_DEVELOPER, + VID_Printf(PRINT_DEVELOPER, "Warning, image '%s' has hi-res replacement smaller than the original! (%d x %d) < (%d x %d)\n", name, image->width, image->height, realwidth, realheight); } @@ -1288,11 +1288,11 @@ R_InitImages(void) registration_sequence = 1; /* init intensity conversions */ - intensity = ri.Cvar_Get("intensity", "2", CVAR_ARCHIVE); + intensity = Cvar_Get("intensity", "2", CVAR_ARCHIVE); if (intensity->value <= 1) { - ri.Cvar_Set("intensity", "1"); + Cvar_Set("intensity", "1"); } gl_state.inverse_intensity = 1 / intensity->value; @@ -1301,11 +1301,11 @@ R_InitImages(void) if (qglColorTableEXT) { - ri.FS_LoadFile("pics/16to8.dat", (void **)&gl_state.d_16to8table); + FS_LoadFile("pics/16to8.dat", (void **)&gl_state.d_16to8table); if (!gl_state.d_16to8table) { - ri.Sys_Error(ERR_FATAL, "Couldn't load pics/16to8.pcx"); + VID_Error(ERR_FATAL, "Couldn't load pics/16to8.pcx"); } } diff --git a/src/refresh/r_light.c b/src/refresh/r_light.c index ce23b677..cb3143b7 100644 --- a/src/refresh/r_light.c +++ b/src/refresh/r_light.c @@ -488,7 +488,7 @@ R_BuildLightMap(msurface_t *surf, byte *dest, int stride) if (surf->texinfo->flags & (SURF_SKY | SURF_TRANS33 | SURF_TRANS66 | SURF_WARP)) { - ri.Sys_Error(ERR_DROP, "R_BuildLightMap called for non-lit surface"); + VID_Error(ERR_DROP, "R_BuildLightMap called for non-lit surface"); } smax = (surf->extents[0] >> 4) + 1; @@ -497,7 +497,7 @@ R_BuildLightMap(msurface_t *surf, byte *dest, int stride) if (size > (sizeof(s_blocklights) >> 4)) { - ri.Sys_Error(ERR_DROP, "Bad s_blocklights size"); + VID_Error(ERR_DROP, "Bad s_blocklights size"); } /* set to full bright if no light data */ @@ -649,12 +649,12 @@ store: max = b; } - /* alpha is ONLY used for the mono lightmap case. For this + /* alpha is ONLY used for the mono lightmap case. For this reason we set it to the brightest of the color components so that things don't get too dim. */ a = max; - /* rescale all the color components if the + /* rescale all the color components if the intensity of the greatest channel exceeds 1.0 */ if (max > 255) diff --git a/src/refresh/r_lightmap.c b/src/refresh/r_lightmap.c index b1ed39ed..9a0be952 100644 --- a/src/refresh/r_lightmap.c +++ b/src/refresh/r_lightmap.c @@ -68,7 +68,7 @@ LM_UploadBlock(qboolean dynamic) } } - qglTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, BLOCK_WIDTH, + qglTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, BLOCK_WIDTH, height, GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer); } @@ -80,14 +80,14 @@ LM_UploadBlock(qboolean dynamic) if (++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS) { - ri.Sys_Error(ERR_DROP, + VID_Error(ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n"); } } } -/* - * returns a texture number and the position inside it +/* + * returns a texture number and the position inside it */ qboolean LM_AllocBlock(int w, int h, int *x, int *y) @@ -226,7 +226,7 @@ LM_CreateSurfaceLightmap(msurface_t *surf) if (!LM_AllocBlock(smax, tmax, &surf->light_s, &surf->light_t)) { - ri.Sys_Error(ERR_FATAL, "Consecutive calls to LM_AllocBlock(%d,%d) failed\n", + VID_Error(ERR_FATAL, "Consecutive calls to LM_AllocBlock(%d,%d) failed\n", smax, tmax); } } diff --git a/src/refresh/r_main.c b/src/refresh/r_main.c index 3b128b7b..a278c597 100644 --- a/src/refresh/r_main.c +++ b/src/refresh/r_main.c @@ -28,19 +28,8 @@ #define NUM_BEAM_SEGS 6 -void R_Clear(void); - - -void Draw_Pic(int x, int y, char *name); -void Draw_Char(int x, int y, int c); -void Draw_TileClear(int x, int y, int w, int h, char *name); -void Draw_Fill(int x, int y, int w, int h, int c); -void Draw_FadeScreen(void); - viddef_t vid; -refimport_t ri; - int QGL_TEXTURE0, QGL_TEXTURE1; model_t *r_worldmodel; @@ -365,7 +354,7 @@ R_DrawEntitiesOnList(void) R_DrawSpriteModel(currententity); break; default: - ri.Sys_Error(ERR_DROP, "Bad modeltype"); + VID_Error(ERR_DROP, "Bad modeltype"); break; } } @@ -411,7 +400,7 @@ R_DrawEntitiesOnList(void) R_DrawSpriteModel(currententity); break; default: - ri.Sys_Error(ERR_DROP, "Bad modeltype"); + VID_Error(ERR_DROP, "Bad modeltype"); break; } } @@ -849,7 +838,7 @@ R_RenderView(refdef_t *fd) if (!r_worldmodel && !(r_newrefdef.rdflags & RDF_NOWORLDMODEL)) { - ri.Sys_Error(ERR_DROP, "R_RenderView: NULL worldmodel"); + VID_Error(ERR_DROP, "R_RenderView: NULL worldmodel"); } if (gl_speeds->value) @@ -887,7 +876,7 @@ R_RenderView(refdef_t *fd) if (gl_speeds->value) { - ri.Con_Printf(PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n", + VID_Printf(PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n", c_brush_polys, c_alias_polys, c_visible_textures, c_visible_lightmaps); } @@ -960,88 +949,88 @@ R_RenderFrame(refdef_t *fd) void R_Register(void) { - gl_lefthand = ri.Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE); - gl_farsee = ri.Cvar_Get("gl_farsee", "0", CVAR_LATCH | CVAR_ARCHIVE); - gl_norefresh = ri.Cvar_Get("gl_norefresh", "0", 0); - gl_fullbright = ri.Cvar_Get("gl_fullbright", "0", 0); - gl_drawentities = ri.Cvar_Get("gl_drawentities", "1", 0); - gl_drawworld = ri.Cvar_Get("gl_drawworld", "1", 0); - gl_novis = ri.Cvar_Get("gl_novis", "0", 0); - gl_nocull = ri.Cvar_Get("gl_nocull", "0", 0); - gl_lerpmodels = ri.Cvar_Get("gl_lerpmodels", "1", 0); - gl_speeds = ri.Cvar_Get("gl_speeds", "0", 0); + gl_lefthand = Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE); + gl_farsee = Cvar_Get("gl_farsee", "0", CVAR_LATCH | CVAR_ARCHIVE); + gl_norefresh = Cvar_Get("gl_norefresh", "0", 0); + gl_fullbright = Cvar_Get("gl_fullbright", "0", 0); + gl_drawentities = Cvar_Get("gl_drawentities", "1", 0); + gl_drawworld = Cvar_Get("gl_drawworld", "1", 0); + gl_novis = Cvar_Get("gl_novis", "0", 0); + gl_nocull = Cvar_Get("gl_nocull", "0", 0); + gl_lerpmodels = Cvar_Get("gl_lerpmodels", "1", 0); + gl_speeds = Cvar_Get("gl_speeds", "0", 0); - gl_lightlevel = ri.Cvar_Get("gl_lightlevel", "0", 0); - gl_overbrightbits = ri.Cvar_Get("gl_overbrightbits", "2", CVAR_ARCHIVE); + gl_lightlevel = Cvar_Get("gl_lightlevel", "0", 0); + gl_overbrightbits = Cvar_Get("gl_overbrightbits", "2", CVAR_ARCHIVE); - gl_nosubimage = ri.Cvar_Get("gl_nosubimage", "0", 0); - gl_allow_software = ri.Cvar_Get("gl_allow_software", "0", 0); + gl_nosubimage = Cvar_Get("gl_nosubimage", "0", 0); + gl_allow_software = Cvar_Get("gl_allow_software", "0", 0); - gl_particle_min_size = ri.Cvar_Get("gl_particle_min_size", "2", CVAR_ARCHIVE); - gl_particle_max_size = ri.Cvar_Get("gl_particle_max_size", "40", CVAR_ARCHIVE); - gl_particle_size = ri.Cvar_Get("gl_particle_size", "40", CVAR_ARCHIVE); - gl_particle_att_a = ri.Cvar_Get("gl_particle_att_a", "0.01", CVAR_ARCHIVE); - gl_particle_att_b = ri.Cvar_Get("gl_particle_att_b", "0.0", CVAR_ARCHIVE); - gl_particle_att_c = ri.Cvar_Get("gl_particle_att_c", "0.01", CVAR_ARCHIVE); + gl_particle_min_size = Cvar_Get("gl_particle_min_size", "2", CVAR_ARCHIVE); + gl_particle_max_size = Cvar_Get("gl_particle_max_size", "40", CVAR_ARCHIVE); + gl_particle_size = Cvar_Get("gl_particle_size", "40", CVAR_ARCHIVE); + gl_particle_att_a = Cvar_Get("gl_particle_att_a", "0.01", CVAR_ARCHIVE); + gl_particle_att_b = Cvar_Get("gl_particle_att_b", "0.0", CVAR_ARCHIVE); + gl_particle_att_c = Cvar_Get("gl_particle_att_c", "0.01", CVAR_ARCHIVE); - gl_modulate = ri.Cvar_Get("gl_modulate", "1", CVAR_ARCHIVE); - gl_log = ri.Cvar_Get("gl_log", "0", 0); - gl_bitdepth = ri.Cvar_Get("gl_bitdepth", "0", 0); - gl_mode = ri.Cvar_Get("gl_mode", "4", CVAR_ARCHIVE); - gl_lightmap = ri.Cvar_Get("gl_lightmap", "0", 0); - gl_shadows = ri.Cvar_Get("gl_shadows", "0", CVAR_ARCHIVE); - gl_stencilshadow = ri.Cvar_Get("gl_stencilshadow", "0", CVAR_ARCHIVE); - gl_dynamic = ri.Cvar_Get("gl_dynamic", "1", 0); - gl_nobind = ri.Cvar_Get("gl_nobind", "0", 0); - gl_round_down = ri.Cvar_Get("gl_round_down", "1", 0); - gl_picmip = ri.Cvar_Get("gl_picmip", "0", 0); - gl_skymip = ri.Cvar_Get("gl_skymip", "0", 0); - gl_showtris = ri.Cvar_Get("gl_showtris", "0", 0); - gl_ztrick = ri.Cvar_Get("gl_ztrick", "0", 0); - gl_zfix = ri.Cvar_Get("gl_zfix", "0", 0); - gl_finish = ri.Cvar_Get("gl_finish", "0", CVAR_ARCHIVE); - gl_clear = ri.Cvar_Get("gl_clear", "0", 0); - gl_cull = ri.Cvar_Get("gl_cull", "1", 0); - gl_polyblend = ri.Cvar_Get("gl_polyblend", "1", 0); - gl_flashblend = ri.Cvar_Get("gl_flashblend", "0", 0); - gl_playermip = ri.Cvar_Get("gl_playermip", "0", 0); - gl_driver = ri.Cvar_Get("gl_driver", LIBGL, CVAR_ARCHIVE); + gl_modulate = Cvar_Get("gl_modulate", "1", CVAR_ARCHIVE); + gl_log = Cvar_Get("gl_log", "0", 0); + gl_bitdepth = Cvar_Get("gl_bitdepth", "0", 0); + gl_mode = Cvar_Get("gl_mode", "4", CVAR_ARCHIVE); + gl_lightmap = Cvar_Get("gl_lightmap", "0", 0); + gl_shadows = Cvar_Get("gl_shadows", "0", CVAR_ARCHIVE); + gl_stencilshadow = Cvar_Get("gl_stencilshadow", "0", CVAR_ARCHIVE); + gl_dynamic = Cvar_Get("gl_dynamic", "1", 0); + gl_nobind = Cvar_Get("gl_nobind", "0", 0); + gl_round_down = Cvar_Get("gl_round_down", "1", 0); + gl_picmip = Cvar_Get("gl_picmip", "0", 0); + gl_skymip = Cvar_Get("gl_skymip", "0", 0); + gl_showtris = Cvar_Get("gl_showtris", "0", 0); + gl_ztrick = Cvar_Get("gl_ztrick", "0", 0); + gl_zfix = Cvar_Get("gl_zfix", "0", 0); + gl_finish = Cvar_Get("gl_finish", "0", CVAR_ARCHIVE); + gl_clear = Cvar_Get("gl_clear", "0", 0); + gl_cull = Cvar_Get("gl_cull", "1", 0); + gl_polyblend = Cvar_Get("gl_polyblend", "1", 0); + gl_flashblend = Cvar_Get("gl_flashblend", "0", 0); + gl_playermip = Cvar_Get("gl_playermip", "0", 0); + gl_driver = Cvar_Get("gl_driver", LIBGL, CVAR_ARCHIVE); - gl_texturemode = ri.Cvar_Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE); - gl_texturealphamode = ri.Cvar_Get("gl_texturealphamode", "default", CVAR_ARCHIVE); - gl_texturesolidmode = ri.Cvar_Get("gl_texturesolidmode", "default", CVAR_ARCHIVE); - gl_anisotropic = ri.Cvar_Get("gl_anisotropic", "0", CVAR_ARCHIVE); - gl_anisotropic_avail = ri.Cvar_Get("gl_anisotropic_avail", "0", 0); - gl_lockpvs = ri.Cvar_Get("gl_lockpvs", "0", 0); + gl_texturemode = Cvar_Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE); + gl_texturealphamode = Cvar_Get("gl_texturealphamode", "default", CVAR_ARCHIVE); + gl_texturesolidmode = Cvar_Get("gl_texturesolidmode", "default", CVAR_ARCHIVE); + gl_anisotropic = Cvar_Get("gl_anisotropic", "0", CVAR_ARCHIVE); + gl_anisotropic_avail = Cvar_Get("gl_anisotropic_avail", "0", 0); + gl_lockpvs = Cvar_Get("gl_lockpvs", "0", 0); - gl_vertex_arrays = ri.Cvar_Get("gl_vertex_arrays", "0", CVAR_ARCHIVE); + gl_vertex_arrays = Cvar_Get("gl_vertex_arrays", "0", CVAR_ARCHIVE); - gl_ext_swapinterval = ri.Cvar_Get("gl_ext_swapinterval", "1", CVAR_ARCHIVE); - gl_ext_palettedtexture = ri.Cvar_Get("gl_ext_palettedtexture", "0", CVAR_ARCHIVE); - gl_ext_multitexture = ri.Cvar_Get("gl_ext_multitexture", "1", CVAR_ARCHIVE); - gl_ext_pointparameters = ri.Cvar_Get("gl_ext_pointparameters", "1", CVAR_ARCHIVE); - gl_ext_compiled_vertex_array = ri.Cvar_Get("gl_ext_compiled_vertex_array", "1", CVAR_ARCHIVE); - gl_ext_mtexcombine = ri.Cvar_Get("gl_ext_mtexcombine", "1", CVAR_ARCHIVE); + gl_ext_swapinterval = Cvar_Get("gl_ext_swapinterval", "1", CVAR_ARCHIVE); + gl_ext_palettedtexture = Cvar_Get("gl_ext_palettedtexture", "0", CVAR_ARCHIVE); + gl_ext_multitexture = Cvar_Get("gl_ext_multitexture", "1", CVAR_ARCHIVE); + gl_ext_pointparameters = Cvar_Get("gl_ext_pointparameters", "1", CVAR_ARCHIVE); + gl_ext_compiled_vertex_array = Cvar_Get("gl_ext_compiled_vertex_array", "1", CVAR_ARCHIVE); + gl_ext_mtexcombine = Cvar_Get("gl_ext_mtexcombine", "1", CVAR_ARCHIVE); - gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0); - gl_swapinterval = ri.Cvar_Get("gl_swapinterval", "1", CVAR_ARCHIVE); + gl_drawbuffer = Cvar_Get("gl_drawbuffer", "GL_BACK", 0); + gl_swapinterval = Cvar_Get("gl_swapinterval", "1", CVAR_ARCHIVE); - gl_saturatelighting = ri.Cvar_Get("gl_saturatelighting", "0", 0); + gl_saturatelighting = Cvar_Get("gl_saturatelighting", "0", 0); - vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE); - vid_gamma = ri.Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE); + vid_fullscreen = Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE); + vid_gamma = Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE); - gl_customwidth = ri.Cvar_Get("gl_customwidth", "1024", CVAR_ARCHIVE); - gl_customheight = ri.Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE); + gl_customwidth = Cvar_Get("gl_customwidth", "1024", CVAR_ARCHIVE); + gl_customheight = Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE); #ifdef RETEXTURE - gl_retexturing = ri.Cvar_Get("gl_retexturing", "1", CVAR_ARCHIVE); + gl_retexturing = Cvar_Get("gl_retexturing", "1", CVAR_ARCHIVE); #endif - ri.Cmd_AddCommand("imagelist", R_ImageList_f); - ri.Cmd_AddCommand("screenshot", R_ScreenShot); - ri.Cmd_AddCommand("modellist", Mod_Modellist_f); - ri.Cmd_AddCommand("gl_strings", R_Strings); + Cmd_AddCommand("imagelist", R_ImageList_f); + Cmd_AddCommand("screenshot", R_ScreenShot); + Cmd_AddCommand("modellist", Mod_Modellist_f); + Cmd_AddCommand("gl_strings", R_Strings); } qboolean @@ -1076,9 +1065,9 @@ R_SetMode(void) { if (err == rserr_invalid_fullscreen) { - ri.Cvar_SetValue("vid_fullscreen", 0); + Cvar_SetValue("vid_fullscreen", 0); vid_fullscreen->modified = false; - ri.Con_Printf(PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n"); + VID_Printf(PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n"); if ((err = GLimp_SetMode(&vid.width, &vid.height, gl_mode->value, false)) == rserr_ok) { @@ -1087,15 +1076,15 @@ R_SetMode(void) } else if (err == rserr_invalid_mode) { - ri.Cvar_SetValue("gl_mode", gl_state.prev_mode); + Cvar_SetValue("gl_mode", gl_state.prev_mode); gl_mode->modified = false; - ri.Con_Printf(PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n"); + VID_Printf(PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n"); } /* try setting it back to something safe */ if ((err =GLimp_SetMode(&vid.width, &vid.height, gl_state.prev_mode, false)) != rserr_ok) { - ri.Con_Printf(PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n"); + VID_Printf(PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n"); return false; } } @@ -1112,25 +1101,27 @@ R_Init(void *hinstance, void *hWnd) int j; extern float r_turbsin[256]; + Swap_Init(); + for (j = 0; j < 256; j++) { r_turbsin[j] *= 0.5; } /* Options */ - ri.Con_Printf(PRINT_ALL, "Refresher build options:\n"); + VID_Printf(PRINT_ALL, "Refresher build options:\n"); #ifdef RETEXTURE - ri.Con_Printf(PRINT_ALL, " + Retexturing support\n"); + VID_Printf(PRINT_ALL, " + Retexturing support\n"); #else - ri.Con_Printf(PRINT_ALL, " - Retexturing support\n"); + VID_Printf(PRINT_ALL, " - Retexturing support\n"); #endif #ifdef X11GAMMA - ri.Con_Printf(PRINT_ALL, " + Gamma via X11\n"); + VID_Printf(PRINT_ALL, " + Gamma via X11\n"); #else - ri.Con_Printf(PRINT_ALL, " - Gamma via X11\n"); + VID_Printf(PRINT_ALL, " - Gamma via X11\n"); #endif - ri.Con_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n"); + VID_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n"); Draw_GetPalette(); @@ -1140,7 +1131,7 @@ R_Init(void *hinstance, void *hWnd) if (!QGL_Init(gl_driver->string)) { QGL_Shutdown(); - ri.Con_Printf(PRINT_ALL, "ref_gl::R_Init() - could not load \"%s\"\n", + VID_Printf(PRINT_ALL, "ref_gl::R_Init() - could not load \"%s\"\n", gl_driver->string); return -1; } @@ -1159,22 +1150,22 @@ R_Init(void *hinstance, void *hWnd) if (!R_SetMode()) { QGL_Shutdown(); - ri.Con_Printf(PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n"); + VID_Printf(PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n"); return -1; } - ri.Vid_MenuInit(); + VID_MenuInit(); /* get our various GL strings */ - ri.Con_Printf(PRINT_ALL, "\nOpenGL setting:\n", gl_config.vendor_string); + VID_Printf(PRINT_ALL, "\nOpenGL setting:\n", gl_config.vendor_string); gl_config.vendor_string = (char *)qglGetString(GL_VENDOR); - ri.Con_Printf(PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string); + VID_Printf(PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string); gl_config.renderer_string = (char *)qglGetString(GL_RENDERER); - ri.Con_Printf(PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string); + VID_Printf(PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string); gl_config.version_string = (char *)qglGetString(GL_VERSION); - ri.Con_Printf(PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string); + VID_Printf(PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string); gl_config.extensions_string = (char *)qglGetString(GL_EXTENSIONS); - ri.Con_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string); + VID_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string); Q_strlcpy(renderer_buffer, gl_config.renderer_string, sizeof(renderer_buffer)); Q_strlwr(renderer_buffer); @@ -1182,29 +1173,29 @@ R_Init(void *hinstance, void *hWnd) Q_strlcpy(vendor_buffer, gl_config.vendor_string, sizeof(vendor_buffer)); Q_strlwr(vendor_buffer); - ri.Cvar_Set("scr_drawall", "0"); + Cvar_Set("scr_drawall", "0"); gl_config.allow_cds = true; - ri.Con_Printf(PRINT_ALL, "\n\nProbing for OpenGL extensions:\n"); + VID_Printf(PRINT_ALL, "\n\nProbing for OpenGL extensions:\n"); /* grab extensions */ if (strstr(gl_config.extensions_string, "GL_EXT_compiled_vertex_array") || strstr(gl_config.extensions_string, "GL_SGI_compiled_vertex_array")) { - ri.Con_Printf(PRINT_ALL, "...using GL_EXT_compiled_vertex_array\n"); + VID_Printf(PRINT_ALL, "...using GL_EXT_compiled_vertex_array\n"); qglLockArraysEXT = (void *)GetProcAddressGL("glLockArraysEXT"); qglUnlockArraysEXT = (void *)GetProcAddressGL("glUnlockArraysEXT"); } else { - ri.Con_Printf(PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n"); + VID_Printf(PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n"); } if (strstr(gl_config.extensions_string, "GL_EXT_point_parameters")) { if (gl_ext_pointparameters->value) { - ri.Con_Printf(PRINT_ALL, "...using GL_EXT_point_parameters\n"); + VID_Printf(PRINT_ALL, "...using GL_EXT_point_parameters\n"); qglPointParameterfEXT = (void (APIENTRY *)(GLenum, GLfloat)) GetProcAddressGL("glPointParameterfEXT"); qglPointParameterfvEXT = (void (APIENTRY *)(GLenum, const GLfloat *)) @@ -1212,12 +1203,12 @@ R_Init(void *hinstance, void *hWnd) } else { - ri.Con_Printf(PRINT_ALL, "...ignoring GL_EXT_point_parameters\n"); + VID_Printf(PRINT_ALL, "...ignoring GL_EXT_point_parameters\n"); } } else { - ri.Con_Printf(PRINT_ALL, "...GL_EXT_point_parameters not found\n"); + VID_Printf(PRINT_ALL, "...GL_EXT_point_parameters not found\n"); } if (!qglColorTableEXT && @@ -1226,7 +1217,7 @@ R_Init(void *hinstance, void *hWnd) { if (gl_ext_palettedtexture->value) { - ri.Con_Printf(PRINT_ALL, "...using GL_EXT_shared_texture_palette\n"); + VID_Printf(PRINT_ALL, "...using GL_EXT_shared_texture_palette\n"); qglColorTableEXT = (void (APIENTRY *)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *))GetProcAddressGL( @@ -1234,19 +1225,19 @@ R_Init(void *hinstance, void *hWnd) } else { - ri.Con_Printf(PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n"); + VID_Printf(PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n"); } } else { - ri.Con_Printf(PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n"); + VID_Printf(PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n"); } if (strstr(gl_config.extensions_string, "GL_ARB_multitexture")) { if (gl_ext_multitexture->value) { - ri.Con_Printf(PRINT_ALL, "...using GL_ARB_multitexture\n"); + VID_Printf(PRINT_ALL, "...using GL_ARB_multitexture\n"); qglMTexCoord2fSGIS = (void *)GetProcAddressGL("glMultiTexCoord2fARB"); qglActiveTextureARB = (void *)GetProcAddressGL("glActiveTextureARB"); qglClientActiveTextureARB = (void *)GetProcAddressGL("glClientActiveTextureARB"); @@ -1255,23 +1246,23 @@ R_Init(void *hinstance, void *hWnd) } else { - ri.Con_Printf(PRINT_ALL, "...ignoring GL_ARB_multitexture\n"); + VID_Printf(PRINT_ALL, "...ignoring GL_ARB_multitexture\n"); } } else { - ri.Con_Printf(PRINT_ALL, "...GL_ARB_multitexture not found\n"); + VID_Printf(PRINT_ALL, "...GL_ARB_multitexture not found\n"); } if (strstr(gl_config.extensions_string, "GL_SGIS_multitexture")) { if (qglActiveTextureARB) { - ri.Con_Printf(PRINT_ALL, "...GL_SGIS_multitexture deprecated in favor of ARB_multitexture\n"); + VID_Printf(PRINT_ALL, "...GL_SGIS_multitexture deprecated in favor of ARB_multitexture\n"); } else if (gl_ext_multitexture->value) { - ri.Con_Printf(PRINT_ALL, "...using GL_SGIS_multitexture\n"); + VID_Printf(PRINT_ALL, "...using GL_SGIS_multitexture\n"); qglMTexCoord2fSGIS = (void *)GetProcAddressGL("glMTexCoord2fSGIS"); qglSelectTextureSGIS = (void *)GetProcAddressGL("glSelectTextureSGIS"); QGL_TEXTURE0 = GL_TEXTURE0_SGIS; @@ -1279,29 +1270,29 @@ R_Init(void *hinstance, void *hWnd) } else { - ri.Con_Printf(PRINT_ALL, "...ignoring GL_SGIS_multitexture\n"); + VID_Printf(PRINT_ALL, "...ignoring GL_SGIS_multitexture\n"); } } else { - ri.Con_Printf(PRINT_ALL, "...GL_SGIS_multitexture not found\n"); + VID_Printf(PRINT_ALL, "...GL_SGIS_multitexture not found\n"); } gl_config.anisotropic = false; if (strstr(gl_config.extensions_string, "GL_EXT_texture_filter_anisotropic")) { - ri.Con_Printf(PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic\n"); + VID_Printf(PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic\n"); gl_config.anisotropic = true; qglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_config.max_anisotropy); - ri.Cvar_SetValue("gl_anisotropic_avail", gl_config.max_anisotropy); + Cvar_SetValue("gl_anisotropic_avail", gl_config.max_anisotropy); } else { - ri.Con_Printf(PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n"); + VID_Printf(PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n"); gl_config.anisotropic = false; gl_config.max_anisotropy = 0.0; - ri.Cvar_SetValue("gl_anisotropic_avail", 0.0); + Cvar_SetValue("gl_anisotropic_avail", 0.0); } gl_config.mtexcombine = false; @@ -1310,17 +1301,17 @@ R_Init(void *hinstance, void *hWnd) { if (gl_ext_mtexcombine->value) { - ri.Con_Printf(PRINT_ALL, "...using GL_ARB_texture_env_combine\n"); + VID_Printf(PRINT_ALL, "...using GL_ARB_texture_env_combine\n"); gl_config.mtexcombine = true; } else { - ri.Con_Printf(PRINT_ALL, "...ignoring GL_ARB_texture_env_combine\n"); + VID_Printf(PRINT_ALL, "...ignoring GL_ARB_texture_env_combine\n"); } } else { - ri.Con_Printf(PRINT_ALL, "...GL_ARB_texture_env_combine not found\n"); + VID_Printf(PRINT_ALL, "...GL_ARB_texture_env_combine not found\n"); } if (!gl_config.mtexcombine) @@ -1329,17 +1320,17 @@ R_Init(void *hinstance, void *hWnd) { if (gl_ext_mtexcombine->value) { - ri.Con_Printf(PRINT_ALL, "...using GL_EXT_texture_env_combine\n"); + VID_Printf(PRINT_ALL, "...using GL_EXT_texture_env_combine\n"); gl_config.mtexcombine = true; } else { - ri.Con_Printf(PRINT_ALL, "...ignoring GL_EXT_texture_env_combine\n"); + VID_Printf(PRINT_ALL, "...ignoring GL_EXT_texture_env_combine\n"); } } else { - ri.Con_Printf(PRINT_ALL, "...GL_EXT_texture_env_combine not found\n"); + VID_Printf(PRINT_ALL, "...GL_EXT_texture_env_combine not found\n"); } } @@ -1354,7 +1345,7 @@ R_Init(void *hinstance, void *hWnd) if (err != GL_NO_ERROR) { - ri.Con_Printf(PRINT_ALL, "glGetError() = 0x%x\n", err); + VID_Printf(PRINT_ALL, "glGetError() = 0x%x\n", err); } return true; @@ -1363,10 +1354,10 @@ R_Init(void *hinstance, void *hWnd) void R_Shutdown(void) { - ri.Cmd_RemoveCommand("modellist"); - ri.Cmd_RemoveCommand("screenshot"); - ri.Cmd_RemoveCommand("imagelist"); - ri.Cmd_RemoveCommand("gl_strings"); + Cmd_RemoveCommand("modellist"); + Cmd_RemoveCommand("screenshot"); + Cmd_RemoveCommand("imagelist"); + Cmd_RemoveCommand("gl_strings"); Mod_FreeAll(); @@ -1573,77 +1564,10 @@ R_DrawBeam(entity_t *e) qglDepthMask(GL_TRUE); } -//refexport_t -void * -R_GetRefAPI(refimport_t rimp) -{ - //refexport_t re; - - ri = rimp; - - /*re.api_version = API_VERSION; - - re.BeginRegistration = R_BeginRegistration; - re.RegisterModel = R_RegisterModel; - re.RegisterSkin = R_RegisterSkin; - re.RegisterPic = Draw_FindPic; - re.SetSky = R_SetSky; - re.EndRegistration = R_EndRegistration; - - re.RenderFrame = R_RenderFrame; - - re.DrawGetPicSize = Draw_GetPicSize; - re.DrawPic = Draw_Pic; - re.DrawStretchPic = Draw_StretchPic; - re.DrawChar = Draw_Char; - re.DrawTileClear = Draw_TileClear; - re.DrawFill = Draw_Fill; - re.DrawFadeScreen = Draw_FadeScreen; - - re.DrawStretchRaw = Draw_StretchRaw; - - re.Init = R_Init; - re.Shutdown = R_Shutdown; - - re.CinematicSetPalette = R_SetPalette; - re.BeginFrame = R_BeginFrame; - re.EndFrame = GLimp_EndFrame; - - re.AppActivate = NULL;*/ - - Swap_Init(); - - //return re; - return NULL; -} - -/* - * this is only here so the functions - * in shared source files can link - */ /*void -Sys_Error(char *error, ...) +R_GetRefAPI(void) { - va_list argptr; - char text[1024]; - - va_start(argptr, error); - vsprintf(text, error, argptr); - va_end(argptr); - - ri.Sys_Error(ERR_FATAL, "%s", text); -} - -void -Com_Printf(char *fmt, ...) -{ - va_list argptr; - char text[1024]; - - va_start(argptr, fmt); - vsprintf(text, fmt, argptr); - va_end(argptr); - - ri.Con_Printf(PRINT_ALL, "%s", text); + Swap_Init(); }*/ + diff --git a/src/refresh/r_mesh.c b/src/refresh/r_mesh.c index 8342fa13..5e39523e 100644 --- a/src/refresh/r_mesh.c +++ b/src/refresh/r_mesh.c @@ -54,7 +54,7 @@ R_LerpVerts(int nverts, dtrivertx_t *v, dtrivertx_t *ov, int i; if (currententity->flags & - (RF_SHELL_RED | RF_SHELL_GREEN | + (RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE | RF_SHELL_DOUBLE | RF_SHELL_HALF_DAM)) { @@ -390,14 +390,14 @@ R_CullAliasModel(vec3_t bbox[8], entity_t *e) if ((e->frame >= paliashdr->num_frames) || (e->frame < 0)) { - ri.Con_Printf(PRINT_ALL, "R_CullAliasModel %s: no such frame %d\n", + VID_Printf(PRINT_ALL, "R_CullAliasModel %s: no such frame %d\n", currentmodel->name, e->frame); e->frame = 0; } if ((e->oldframe >= paliashdr->num_frames) || (e->oldframe < 0)) { - ri.Con_Printf(PRINT_ALL, "R_CullAliasModel %s: no such oldframe %d\n", + VID_Printf(PRINT_ALL, "R_CullAliasModel %s: no such oldframe %d\n", currentmodel->name, e->oldframe); e->oldframe = 0; } @@ -760,7 +760,7 @@ R_DrawAliasModel(entity_t *e) if ((currententity->frame >= paliashdr->num_frames) || (currententity->frame < 0)) { - ri.Con_Printf(PRINT_ALL, "R_DrawAliasModel %s: no such frame %d\n", + VID_Printf(PRINT_ALL, "R_DrawAliasModel %s: no such frame %d\n", currentmodel->name, currententity->frame); currententity->frame = 0; currententity->oldframe = 0; @@ -769,7 +769,7 @@ R_DrawAliasModel(entity_t *e) if ((currententity->oldframe >= paliashdr->num_frames) || (currententity->oldframe < 0)) { - ri.Con_Printf(PRINT_ALL, "R_DrawAliasModel %s: no such oldframe %d\n", + VID_Printf(PRINT_ALL, "R_DrawAliasModel %s: no such oldframe %d\n", currentmodel->name, currententity->oldframe); currententity->frame = 0; currententity->oldframe = 0; diff --git a/src/refresh/r_misc.c b/src/refresh/r_misc.c index 93c9f35b..822358c3 100644 --- a/src/refresh/r_misc.c +++ b/src/refresh/r_misc.c @@ -93,8 +93,8 @@ R_ScreenShot(void) FILE *f; /* create the scrnshots directory if it doesn't exist */ - Com_sprintf(checkname, sizeof(checkname), "%s/scrnshot", ri.FS_Gamedir()); - ri.Sys_Mkdir(checkname); + Com_sprintf(checkname, sizeof(checkname), "%s/scrnshot", FS_Gamedir()); + Sys_Mkdir(checkname); /* find a file name to save it to */ strcpy(picname, "quake00.tga"); @@ -104,7 +104,7 @@ R_ScreenShot(void) picname[5] = i / 10 + '0'; picname[6] = i % 10 + '0'; Com_sprintf(checkname, sizeof(checkname), "%s/scrnshot/%s", - ri.FS_Gamedir(), picname); + FS_Gamedir(), picname); f = fopen(checkname, "rb"); if (!f) @@ -117,7 +117,7 @@ R_ScreenShot(void) if (i == 100) { - ri.Con_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n"); + VID_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n"); return; } @@ -148,16 +148,16 @@ R_ScreenShot(void) fclose(f); free(buffer); - ri.Con_Printf(PRINT_ALL, "Wrote %s\n", picname); + VID_Printf(PRINT_ALL, "Wrote %s\n", picname); } void R_Strings(void) { - ri.Con_Printf(PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string); - ri.Con_Printf(PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string); - ri.Con_Printf(PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string); - ri.Con_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string); + VID_Printf(PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string); + VID_Printf(PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string); + VID_Printf(PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string); + VID_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string); } void diff --git a/src/refresh/r_model.c b/src/refresh/r_model.c index 4da12d46..cb220153 100644 --- a/src/refresh/r_model.c +++ b/src/refresh/r_model.c @@ -57,7 +57,7 @@ Mod_PointInLeaf(vec3_t p, model_t *model) if (!model || !model->nodes) { - ri.Sys_Error(ERR_DROP, "Mod_PointInLeaf: bad model"); + VID_Error(ERR_DROP, "Mod_PointInLeaf: bad model"); } node = model->nodes; @@ -151,7 +151,7 @@ Mod_Modellist_f(void) int total; total = 0; - ri.Con_Printf(PRINT_ALL, "Loaded models:\n"); + VID_Printf(PRINT_ALL, "Loaded models:\n"); for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) { @@ -160,11 +160,11 @@ Mod_Modellist_f(void) continue; } - ri.Con_Printf(PRINT_ALL, "%8i : %s\n", mod->extradatasize, mod->name); + VID_Printf(PRINT_ALL, "%8i : %s\n", mod->extradatasize, mod->name); total += mod->extradatasize; } - ri.Con_Printf(PRINT_ALL, "Total resident: %i\n", total); + VID_Printf(PRINT_ALL, "Total resident: %i\n", total); } void @@ -185,7 +185,7 @@ Mod_ForName(char *name, qboolean crash) if (!name[0]) { - ri.Sys_Error(ERR_DROP, "Mod_ForName: NULL name"); + VID_Error(ERR_DROP, "Mod_ForName: NULL name"); } /* inline models are grabbed only from worldmodel */ @@ -195,7 +195,7 @@ Mod_ForName(char *name, qboolean crash) if ((i < 1) || !r_worldmodel || (i >= r_worldmodel->numsubmodels)) { - ri.Sys_Error(ERR_DROP, "bad inline model number"); + VID_Error(ERR_DROP, "bad inline model number"); } return &mod_inline[i]; @@ -228,7 +228,7 @@ Mod_ForName(char *name, qboolean crash) { if (mod_numknown == MAX_MOD_KNOWN) { - ri.Sys_Error(ERR_DROP, "mod_numknown == MAX_MOD_KNOWN"); + VID_Error(ERR_DROP, "mod_numknown == MAX_MOD_KNOWN"); } mod_numknown++; @@ -237,13 +237,13 @@ Mod_ForName(char *name, qboolean crash) strcpy(mod->name, name); /* load the file */ - modfilelen = ri.FS_LoadFile(mod->name, (void **)&buf); + modfilelen = FS_LoadFile(mod->name, (void **)&buf); if (!buf) { if (crash) { - ri.Sys_Error(ERR_DROP, "Mod_NumForName: %s not found", mod->name); + VID_Error(ERR_DROP, "Mod_NumForName: %s not found", mod->name); } memset(mod->name, 0, sizeof(mod->name)); @@ -271,7 +271,7 @@ Mod_ForName(char *name, qboolean crash) break; default: - ri.Sys_Error(ERR_DROP, + VID_Error(ERR_DROP, "Mod_NumForName: unknown fileid for %s", mod->name); break; @@ -279,7 +279,7 @@ Mod_ForName(char *name, qboolean crash) loadmodel->extradatasize = Hunk_End(); - ri.FS_FreeFile(buf); + FS_FreeFile(buf); return mod; } @@ -331,7 +331,7 @@ Mod_LoadVertexes(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -374,7 +374,7 @@ Mod_LoadSubmodels(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -412,7 +412,7 @@ Mod_LoadEdges(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -442,7 +442,7 @@ Mod_LoadTexinfo(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -478,7 +478,7 @@ Mod_LoadTexinfo(lump_t *l) if (!out->image) { - ri.Con_Printf(PRINT_ALL, "Couldn't load %s\n", name); + VID_Printf(PRINT_ALL, "Couldn't load %s\n", name); out->image = r_notexture; } } @@ -568,7 +568,7 @@ Mod_LoadFaces(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -603,7 +603,7 @@ Mod_LoadFaces(lump_t *l) if ((ti < 0) || (ti >= loadmodel->numtexinfo)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: bad texinfo number"); + VID_Error(ERR_DROP, "MOD_LoadBmodel: bad texinfo number"); } out->texinfo = loadmodel->texinfo + ti; @@ -682,7 +682,7 @@ Mod_LoadNodes(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -736,7 +736,7 @@ Mod_LoadLeafs(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -777,7 +777,7 @@ Mod_LoadMarksurfaces(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -793,7 +793,7 @@ Mod_LoadMarksurfaces(lump_t *l) if ((j < 0) || (j >= loadmodel->numsurfaces)) { - ri.Sys_Error(ERR_DROP, "Mod_ParseMarksurfaces: bad surface number"); + VID_Error(ERR_DROP, "Mod_ParseMarksurfaces: bad surface number"); } out[i] = loadmodel->surfaces + j; @@ -810,7 +810,7 @@ Mod_LoadSurfedges(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -818,7 +818,7 @@ Mod_LoadSurfedges(lump_t *l) if ((count < 1) || (count >= MAX_MAP_SURFEDGES)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: bad surfedges count in %s: %i", + VID_Error(ERR_DROP, "MOD_LoadBmodel: bad surfedges count in %s: %i", loadmodel->name, count); } @@ -846,7 +846,7 @@ Mod_LoadPlanes(lump_t *l) if (l->filelen % sizeof(*in)) { - ri.Sys_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", + VID_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size in %s", loadmodel->name); } @@ -887,7 +887,7 @@ Mod_LoadBrushModel(model_t *mod, void *buffer) if (loadmodel != mod_known) { - ri.Sys_Error(ERR_DROP, "Loaded a brush model after the world"); + VID_Error(ERR_DROP, "Loaded a brush model after the world"); } header = (dheader_t *)buffer; @@ -896,7 +896,7 @@ Mod_LoadBrushModel(model_t *mod, void *buffer) if (i != BSPVERSION) { - ri.Sys_Error(ERR_DROP, "Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", + VID_Error(ERR_DROP, "Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION); } @@ -939,7 +939,7 @@ Mod_LoadBrushModel(model_t *mod, void *buffer) if (starmod->firstnode >= loadmodel->numnodes) { - ri.Sys_Error(ERR_DROP, "Inline model %i has bad firstnode", i); + VID_Error(ERR_DROP, "Inline model %i has bad firstnode", i); } VectorCopy(bm->maxs, starmod->maxs); @@ -991,9 +991,9 @@ R_BeginRegistration(char *model) Com_sprintf(fullname, sizeof(fullname), "maps/%s.bsp", model); /* explicitly free the old map if different - this guarantees that mod_known[0] is the + this guarantees that mod_known[0] is the world map */ - flushmap = ri.Cvar_Get("flushmap", "0", 0); + flushmap = Cvar_Get("flushmap", "0", 0); if (strcmp(mod_known[0].name, fullname) || flushmap->value) { diff --git a/src/refresh/r_surf.c b/src/refresh/r_surf.c index ed33a0ec..d4b0d647 100644 --- a/src/refresh/r_surf.c +++ b/src/refresh/r_surf.c @@ -335,7 +335,7 @@ R_BlendLightmaps(void) /* try uploading the block now */ if (!LM_AllocBlock(smax, tmax, &surf->dlight_s, &surf->dlight_t)) { - ri.Sys_Error(ERR_FATAL, + VID_Error(ERR_FATAL, "Consecutive calls to LM_AllocBlock(%d,%d) failed (dynamic)\n", smax, tmax); } @@ -429,7 +429,7 @@ R_RenderBrushPoly(msurface_t *fa) if (gl_dynamic->value) { if (!(fa->texinfo->flags & - (SURF_SKY | SURF_TRANS33 | + (SURF_SKY | SURF_TRANS33 | SURF_TRANS66 | SURF_WARP))) { is_dynamic = true; @@ -440,7 +440,7 @@ R_RenderBrushPoly(msurface_t *fa) if (is_dynamic) { if (((fa->styles[maps] >= 32) || - (fa->styles[maps] == 0)) && + (fa->styles[maps] == 0)) && (fa->dlightframe != r_framecount)) { unsigned temp[34 * 34]; @@ -664,7 +664,7 @@ R_RenderLightmappedPoly(msurface_t *surf) int smax, tmax; if (((surf->styles[map] >= 32) || - (surf->styles[map] == 0)) && + (surf->styles[map] == 0)) && (surf->dlightframe != r_framecount)) { smax = (surf->extents[0] >> 4) + 1; @@ -1241,7 +1241,7 @@ R_DrawWorld(void) } /* - * Mark the leaves and nodes that are + * Mark the leaves and nodes that are * in the PVS for the current cluster */ void @@ -1255,14 +1255,14 @@ R_MarkLeaves(void) int cluster; if ((r_oldviewcluster == r_viewcluster) && - (r_oldviewcluster2 == r_viewcluster2) && + (r_oldviewcluster2 == r_viewcluster2) && !gl_novis->value && (r_viewcluster != -1)) { return; } - /* development aid to let you run around + /* development aid to let you run around and see exactly where the pvs ends */ if (gl_lockpvs->value) { diff --git a/src/refresh/r_warp.c b/src/refresh/r_warp.c index f2d508b4..bc1cf592 100644 --- a/src/refresh/r_warp.c +++ b/src/refresh/r_warp.c @@ -126,7 +126,7 @@ R_SubdividePolygon(int numverts, float *verts) if (numverts > 60) { - ri.Sys_Error(ERR_DROP, "numverts = %i", numverts); + VID_Error(ERR_DROP, "numverts = %i", numverts); } R_BoundPoly(numverts, verts, mins, maxs); @@ -454,7 +454,7 @@ R_ClipSkyPolygon(int nump, vec3_t vecs, int stage) if (nump > MAX_CLIP_VERTS - 2) { - ri.Sys_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS"); + VID_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS"); } if (stage == 6) @@ -522,7 +522,7 @@ R_ClipSkyPolygon(int nump, vec3_t vecs, int stage) break; } - if ((sides[i] == SIDE_ON) || + if ((sides[i] == SIDE_ON) || (sides[i + 1] == SIDE_ON) || (sides[i + 1] == sides[i])) {