mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-21 11:21:52 +00:00
pass Com_VPrintf() to reflib used by R_Printf(), remove VID_Printf()
So in all code in the reflib (ref_gl.dll/.so/.dylib) calls to ri.Con_Printf(print_level, fmt, ...) have been replaced by calls to R_Printf(print_level, fmt, ...) which uses ri.Com_VPrintf().
This commit is contained in:
parent
a0c1c74a2e
commit
5938a665e8
15 changed files with 106 additions and 120 deletions
|
@ -89,26 +89,6 @@ viddef_t viddef; /* global video state; used by other modules */
|
|||
#define VID_NUM_MODES (sizeof(vid_modes) / sizeof(vid_modes[0]))
|
||||
#define MAXPRINTMSG 4096
|
||||
|
||||
static void // FIXME: remove, it sucks! (only kept as long as it's passed into reflibs)
|
||||
VID_Printf(int print_level, char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char msg[MAXPRINTMSG];
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(msg, MAXPRINTMSG, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
if (print_level == PRINT_ALL)
|
||||
{
|
||||
Com_Printf("%s", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_DPrintf("%s", msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Console command to re-start the video mode and refresh. We do this
|
||||
* simply by setting the modified flag for the vid_fullscreen variable, which will
|
||||
|
@ -227,7 +207,7 @@ VID_LoadRefresh(void)
|
|||
ri.Cmd_Argc = Cmd_Argc;
|
||||
ri.Cmd_Argv = Cmd_Argv;
|
||||
ri.Cmd_ExecuteText = Cbuf_ExecuteText;
|
||||
ri.Con_Printf = VID_Printf; // FIXME: use Com_VPrintf()
|
||||
ri.Com_VPrintf = Com_VPrintf;
|
||||
ri.Sys_Error = Com_Error;
|
||||
ri.FS_LoadFile = FS_LoadFile;
|
||||
ri.FS_FreeFile = FS_FreeFile;
|
||||
|
|
|
@ -205,7 +205,7 @@ typedef struct
|
|||
char *(IMPORT *Cmd_Argv) (int i);
|
||||
void (IMPORT *Cmd_ExecuteText) (int exec_when, char *text);
|
||||
|
||||
void (IMPORT *Con_Printf) (int print_level, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
void (IMPORT *Com_VPrintf) (int print_level, const char *fmt, va_list argptr);
|
||||
|
||||
// files will be memory mapped read only
|
||||
// the returned buffer may be part of a larger pak file,
|
||||
|
|
|
@ -53,7 +53,7 @@ LoadPCX(char *origname, byte **pic, byte **palette, int *width, int *height)
|
|||
|
||||
if (!raw)
|
||||
{
|
||||
ri.Con_Printf(PRINT_DEVELOPER, "Bad pcx file %s\n", filename);
|
||||
R_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);
|
||||
R_Printf(PRINT_ALL, "Bad pcx file %s\n", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ 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);
|
||||
R_Printf(PRINT_DEVELOPER, "PCX file %s was malformed", filename);
|
||||
free(*pic);
|
||||
*pic = NULL;
|
||||
}
|
||||
|
|
|
@ -74,14 +74,14 @@ LoadSTB(const char *origname, const char* type, byte **pic, int *width, int *hei
|
|||
data = stbi_load_from_memory(rawdata, rawsize, &w, &h, &bytesPerPixel, STBI_rgb_alpha);
|
||||
if (data == NULL)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "stb_image couldn't load data from %s: %s!\n", filename, stbi_failure_reason());
|
||||
R_Printf(PRINT_ALL, "stb_image couldn't load data from %s: %s!\n", filename, stbi_failure_reason());
|
||||
ri.FS_FreeFile(rawdata);
|
||||
return false;
|
||||
}
|
||||
|
||||
ri.FS_FreeFile(rawdata);
|
||||
|
||||
ri.Con_Printf(PRINT_DEVELOPER, "LoadSTB() loaded: %s\n", filename);
|
||||
R_Printf(PRINT_DEVELOPER, "LoadSTB() loaded: %s\n", filename);
|
||||
|
||||
*pic = data;
|
||||
*width = w;
|
||||
|
|
|
@ -46,7 +46,7 @@ LoadWal(char *origname)
|
|||
|
||||
if (!mt)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "LoadWall: can't load %s\n", name);
|
||||
R_Printf(PRINT_ALL, "LoadWall: can't load %s\n", name);
|
||||
return r_notexture;
|
||||
}
|
||||
|
||||
|
|
|
@ -408,4 +408,6 @@ void RI_ShutdownWindow(qboolean contextOnly);
|
|||
*/
|
||||
void *GLimp_GetProcAddress (const char* proc);
|
||||
|
||||
void R_Printf(int level, const char* msg, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -149,7 +149,7 @@ RDraw_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);
|
||||
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ RDraw_PicScaled(int x, int y, char *pic, float factor)
|
|||
|
||||
if (!gl)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ RDraw_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);
|
||||
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ R_TextureMode(char *string)
|
|||
|
||||
if (i == NUM_GL_MODES)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "bad filter name\n");
|
||||
R_Printf(PRINT_ALL, "bad filter name\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ R_TextureAlphaMode(char *string)
|
|||
|
||||
if (i == NUM_GL_ALPHA_MODES)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "bad alpha texture mode name\n");
|
||||
R_Printf(PRINT_ALL, "bad alpha texture mode name\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ R_TextureSolidMode(char *string)
|
|||
|
||||
if (i == NUM_GL_SOLID_MODES)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "bad solid texture mode name\n");
|
||||
R_Printf(PRINT_ALL, "bad solid texture mode name\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ R_ImageList_f(void)
|
|||
"PAL"
|
||||
};
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "------------------\n");
|
||||
R_Printf(PRINT_ALL, "------------------\n");
|
||||
texels = 0;
|
||||
|
||||
for (i = 0, image = gltextures; i < numgltextures; i++, image++)
|
||||
|
@ -307,28 +307,28 @@ R_ImageList_f(void)
|
|||
switch (image->type)
|
||||
{
|
||||
case it_skin:
|
||||
ri.Con_Printf(PRINT_ALL, "M");
|
||||
R_Printf(PRINT_ALL, "M");
|
||||
break;
|
||||
case it_sprite:
|
||||
ri.Con_Printf(PRINT_ALL, "S");
|
||||
R_Printf(PRINT_ALL, "S");
|
||||
break;
|
||||
case it_wall:
|
||||
ri.Con_Printf(PRINT_ALL, "W");
|
||||
R_Printf(PRINT_ALL, "W");
|
||||
break;
|
||||
case it_pic:
|
||||
ri.Con_Printf(PRINT_ALL, "P");
|
||||
R_Printf(PRINT_ALL, "P");
|
||||
break;
|
||||
default:
|
||||
ri.Con_Printf(PRINT_ALL, " ");
|
||||
R_Printf(PRINT_ALL, " ");
|
||||
break;
|
||||
}
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, " %3i %3i %s: %s\n",
|
||||
R_Printf(PRINT_ALL, " %3i %3i %s: %s\n",
|
||||
image->upload_width, image->upload_height,
|
||||
palstrings[image->paletted], image->name);
|
||||
}
|
||||
|
||||
ri.Con_Printf(PRINT_ALL,
|
||||
R_Printf(PRINT_ALL,
|
||||
"Total texel count (not counting mipmaps): %i\n",
|
||||
texels);
|
||||
}
|
||||
|
@ -992,7 +992,7 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth,
|
|||
}
|
||||
else
|
||||
{
|
||||
ri.Con_Printf(PRINT_DEVELOPER,
|
||||
R_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);
|
||||
}
|
||||
|
|
|
@ -1106,7 +1106,7 @@ R_RenderView(refdef_t *fd)
|
|||
|
||||
if (gl_speeds->value)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n",
|
||||
R_Printf(PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n",
|
||||
c_brush_polys, c_alias_polys, c_visible_textures,
|
||||
c_visible_lightmaps);
|
||||
}
|
||||
|
@ -1272,17 +1272,17 @@ R_Register(void)
|
|||
static int
|
||||
SetMode_impl(int *pwidth, int *pheight, int mode, qboolean fullscreen)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "setting mode %d:", mode);
|
||||
R_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))
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, " invalid mode\n");
|
||||
R_Printf(PRINT_ALL, " invalid mode\n");
|
||||
return rserr_invalid_mode;
|
||||
}
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, " %d %d\n", *pwidth, *pheight);
|
||||
R_Printf(PRINT_ALL, " %d %d\n", *pwidth, *pheight);
|
||||
|
||||
if (!ri.GLimp_InitGraphics(fullscreen, pwidth, pheight))
|
||||
{
|
||||
|
@ -1326,7 +1326,7 @@ R_SetMode(void)
|
|||
{
|
||||
ri.Cvar_SetValue("vid_fullscreen", 0);
|
||||
vid_fullscreen->modified = false;
|
||||
ri.Con_Printf(PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n");
|
||||
R_Printf(PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n");
|
||||
|
||||
if ((err = SetMode_impl(&vid.width, &vid.height, gl_mode->value, false)) == rserr_ok)
|
||||
{
|
||||
|
@ -1337,13 +1337,13 @@ R_SetMode(void)
|
|||
{
|
||||
ri.Cvar_SetValue("gl_mode", gl_state.prev_mode);
|
||||
gl_mode->modified = false;
|
||||
ri.Con_Printf(PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n");
|
||||
R_Printf(PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n");
|
||||
}
|
||||
|
||||
/* try setting it back to something safe */
|
||||
if ((err = SetMode_impl(&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");
|
||||
R_Printf(PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1365,17 +1365,17 @@ RI_Init(void *hinstance, void *hWnd)
|
|||
}
|
||||
|
||||
/* Options */
|
||||
ri.Con_Printf(PRINT_ALL, "Refresher build options:\n");
|
||||
R_Printf(PRINT_ALL, "Refresher build options:\n");
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, " + Retexturing support\n");
|
||||
R_Printf(PRINT_ALL, " + Retexturing support\n");
|
||||
|
||||
#ifdef X11GAMMA
|
||||
ri.Con_Printf(PRINT_ALL, " + Gamma via X11\n");
|
||||
R_Printf(PRINT_ALL, " + Gamma via X11\n");
|
||||
#else
|
||||
ri.Con_Printf(PRINT_ALL, " - Gamma via X11\n");
|
||||
R_Printf(PRINT_ALL, " - Gamma via X11\n");
|
||||
#endif
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n");
|
||||
R_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n");
|
||||
|
||||
Draw_GetPalette();
|
||||
|
||||
|
@ -1399,7 +1399,7 @@ RI_Init(void *hinstance, void *hWnd)
|
|||
if (!R_SetMode())
|
||||
{
|
||||
QGL_Shutdown();
|
||||
ri.Con_Printf(PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n");
|
||||
R_Printf(PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1408,19 +1408,19 @@ RI_Init(void *hinstance, void *hWnd)
|
|||
// --------
|
||||
|
||||
/* get our various GL strings */
|
||||
ri.Con_Printf(PRINT_ALL, "\nOpenGL setting:\n");
|
||||
R_Printf(PRINT_ALL, "\nOpenGL setting:\n");
|
||||
|
||||
gl_config.vendor_string = (char *)glGetString(GL_VENDOR);
|
||||
ri.Con_Printf(PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string);
|
||||
R_Printf(PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string);
|
||||
|
||||
gl_config.renderer_string = (char *)glGetString(GL_RENDERER);
|
||||
ri.Con_Printf(PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string);
|
||||
R_Printf(PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string);
|
||||
|
||||
gl_config.version_string = (char *)glGetString(GL_VERSION);
|
||||
ri.Con_Printf(PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string);
|
||||
R_Printf(PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string);
|
||||
|
||||
gl_config.extensions_string = (char *)glGetString(GL_EXTENSIONS);
|
||||
ri.Con_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string);
|
||||
R_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string);
|
||||
|
||||
sscanf(gl_config.version_string, "%d.%d", &gl_config.major_version, &gl_config.minor_version);
|
||||
|
||||
|
@ -1429,18 +1429,18 @@ RI_Init(void *hinstance, void *hWnd)
|
|||
if (gl_config.minor_version < 4)
|
||||
{
|
||||
QGL_Shutdown();
|
||||
ri.Con_Printf(PRINT_ALL, "Support for OpenGL 1.4 is not available\n");
|
||||
R_Printf(PRINT_ALL, "Support for OpenGL 1.4 is not available\n");
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "\n\nProbing for OpenGL extensions:\n");
|
||||
R_Printf(PRINT_ALL, "\n\nProbing for OpenGL extensions:\n");
|
||||
|
||||
// ----
|
||||
|
||||
/* Point parameters */
|
||||
ri.Con_Printf(PRINT_ALL, " - Point parameters: ");
|
||||
R_Printf(PRINT_ALL, " - Point parameters: ");
|
||||
|
||||
if (strstr(gl_config.extensions_string, "GL_ARB_point_parameters"))
|
||||
{
|
||||
|
@ -1455,22 +1455,22 @@ RI_Init(void *hinstance, void *hWnd)
|
|||
if (qglPointParameterfARB && qglPointParameterfvARB)
|
||||
{
|
||||
gl_config.pointparameters = true;
|
||||
ri.Con_Printf(PRINT_ALL, "Okay\n");
|
||||
R_Printf(PRINT_ALL, "Okay\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Failed\n");
|
||||
R_Printf(PRINT_ALL, "Failed\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Disabled\n");
|
||||
R_Printf(PRINT_ALL, "Disabled\n");
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
/* Paletted texture */
|
||||
ri.Con_Printf(PRINT_ALL, " - Paletted texture: ");
|
||||
R_Printf(PRINT_ALL, " - Paletted texture: ");
|
||||
|
||||
if (strstr(gl_config.extensions_string, "GL_EXT_paletted_texture") &&
|
||||
strstr(gl_config.extensions_string, "GL_EXT_shared_texture_palette"))
|
||||
|
@ -1486,52 +1486,52 @@ RI_Init(void *hinstance, void *hWnd)
|
|||
if (qglColorTableEXT)
|
||||
{
|
||||
gl_config.palettedtexture = true;
|
||||
ri.Con_Printf(PRINT_ALL, "Okay\n");
|
||||
R_Printf(PRINT_ALL, "Okay\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Failed\n");
|
||||
R_Printf(PRINT_ALL, "Failed\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Disabled\n");
|
||||
R_Printf(PRINT_ALL, "Disabled\n");
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
/* Anisotropic */
|
||||
ri.Con_Printf(PRINT_ALL, " - Anisotropic: ");
|
||||
R_Printf(PRINT_ALL, " - Anisotropic: ");
|
||||
|
||||
if (strstr(gl_config.extensions_string, "GL_EXT_texture_filter_anisotropic"))
|
||||
{
|
||||
gl_config.anisotropic = true;
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_config.max_anisotropy);
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "%ux\n", (int)gl_config.max_anisotropy);
|
||||
R_Printf(PRINT_ALL, "%ux\n", (int)gl_config.max_anisotropy);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_config.anisotropic = false;
|
||||
gl_config.max_anisotropy = 0.0;
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "Failed\n");
|
||||
R_Printf(PRINT_ALL, "Failed\n");
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
/* Non power of two textures */
|
||||
ri.Con_Printf(PRINT_ALL, " - Non power of two textures: ");
|
||||
R_Printf(PRINT_ALL, " - Non power of two textures: ");
|
||||
|
||||
if (strstr(gl_config.extensions_string, "GL_ARB_texture_non_power_of_two"))
|
||||
{
|
||||
gl_config.npottextures = true;
|
||||
ri.Con_Printf(PRINT_ALL, "Okay\n");
|
||||
R_Printf(PRINT_ALL, "Okay\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_config.npottextures = false;
|
||||
ri.Con_Printf(PRINT_ALL, "Failed\n");
|
||||
R_Printf(PRINT_ALL, "Failed\n");
|
||||
}
|
||||
|
||||
// ----
|
||||
|
@ -1586,7 +1586,7 @@ RI_BeginFrame(float camera_separation)
|
|||
}
|
||||
else
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "stereo supermode changed, restarting video!\n");
|
||||
R_Printf(PRINT_ALL, "stereo supermode changed, restarting video!\n");
|
||||
cvar_t *ref;
|
||||
ref = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
|
||||
ref->modified = true;
|
||||
|
@ -1888,6 +1888,14 @@ GetRefAPI(refimport_t imp)
|
|||
return re;
|
||||
}
|
||||
|
||||
void R_Printf(int level, const char* msg, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, msg);
|
||||
ri.Com_VPrintf(level, msg, argptr);
|
||||
va_end(argptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* this is only here so the functions in shared source files
|
||||
* (shared.c, rand.c, flash.c, mem.c/hunk.c) can link
|
||||
|
@ -1896,7 +1904,7 @@ void
|
|||
Sys_Error(char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[1024];
|
||||
char text[4096]; // MAXPRINTMSG == 4096
|
||||
|
||||
va_start(argptr, error);
|
||||
vsprintf(text, error, argptr);
|
||||
|
@ -1909,11 +1917,7 @@ void
|
|||
Com_Printf(char *msg, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[1024];
|
||||
|
||||
va_start(argptr, msg);
|
||||
vsprintf(text, msg, argptr);
|
||||
ri.Com_VPrintf(PRINT_ALL, msg, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "%s", text);
|
||||
}
|
||||
|
|
|
@ -345,14 +345,14 @@ R_CullAliasModel(vec3_t bbox[8], entity_t *e)
|
|||
|
||||
if ((e->frame >= paliashdr->num_frames) || (e->frame < 0))
|
||||
{
|
||||
ri.Con_Printf(PRINT_DEVELOPER, "R_CullAliasModel %s: no such frame %d\n",
|
||||
R_Printf(PRINT_DEVELOPER, "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_DEVELOPER, "R_CullAliasModel %s: no such oldframe %d\n",
|
||||
R_Printf(PRINT_DEVELOPER, "R_CullAliasModel %s: no such oldframe %d\n",
|
||||
currentmodel->name, e->oldframe);
|
||||
e->oldframe = 0;
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ R_DrawAliasModel(entity_t *e)
|
|||
if ((currententity->frame >= paliashdr->num_frames) ||
|
||||
(currententity->frame < 0))
|
||||
{
|
||||
ri.Con_Printf(PRINT_DEVELOPER, "R_DrawAliasModel %s: no such frame %d\n",
|
||||
R_Printf(PRINT_DEVELOPER, "R_DrawAliasModel %s: no such frame %d\n",
|
||||
currentmodel->name, currententity->frame);
|
||||
currententity->frame = 0;
|
||||
currententity->oldframe = 0;
|
||||
|
@ -736,7 +736,7 @@ R_DrawAliasModel(entity_t *e)
|
|||
if ((currententity->oldframe >= paliashdr->num_frames) ||
|
||||
(currententity->oldframe < 0))
|
||||
{
|
||||
ri.Con_Printf(PRINT_DEVELOPER, "R_DrawAliasModel %s: no such oldframe %d\n",
|
||||
R_Printf(PRINT_DEVELOPER, "R_DrawAliasModel %s: no such oldframe %d\n",
|
||||
currentmodel->name, currententity->oldframe);
|
||||
currententity->frame = 0;
|
||||
currententity->oldframe = 0;
|
||||
|
|
|
@ -115,7 +115,7 @@ R_ScreenShot(void)
|
|||
|
||||
if (i == 100)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n");
|
||||
R_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ R_ScreenShot(void)
|
|||
buffer = malloc(c);
|
||||
if (!buffer)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't malloc %d bytes\n", c);
|
||||
R_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't malloc %d bytes\n", c);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -161,11 +161,11 @@ R_ScreenShot(void)
|
|||
{
|
||||
fwrite(buffer, 1, c, f);
|
||||
fclose(f);
|
||||
ri.Con_Printf(PRINT_ALL, "Wrote %s\n", picname);
|
||||
R_Printf(PRINT_ALL, "Wrote %s\n", picname);
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't write %s\n", picname);
|
||||
R_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't write %s\n", picname);
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
@ -174,10 +174,10 @@ R_ScreenShot(void)
|
|||
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);
|
||||
R_Printf(PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string);
|
||||
R_Printf(PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string);
|
||||
R_Printf(PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string);
|
||||
R_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -151,7 +151,7 @@ Mod_Modellist_f(void)
|
|||
int total;
|
||||
|
||||
total = 0;
|
||||
ri.Con_Printf(PRINT_ALL, "Loaded models:\n");
|
||||
R_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);
|
||||
R_Printf(PRINT_ALL, "%8i : %s\n", mod->extradatasize, mod->name);
|
||||
total += mod->extradatasize;
|
||||
}
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "Total resident: %i\n", total);
|
||||
R_Printf(PRINT_ALL, "Total resident: %i\n", total);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -478,7 +478,7 @@ Mod_LoadTexinfo(lump_t *l)
|
|||
|
||||
if (!out->image)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Couldn't load %s\n", name);
|
||||
R_Printf(PRINT_ALL, "Couldn't load %s\n", name);
|
||||
out->image = r_notexture;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ UpdateHardwareGamma(void)
|
|||
if(SDL_GetWMInfo(&info) != 1)
|
||||
#endif
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Couldn't get Window info from SDL\n");
|
||||
R_Printf(PRINT_ALL, "Couldn't get Window info from SDL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ UpdateHardwareGamma(void)
|
|||
XRRScreenResources* res = XRRGetScreenResources(dpy, info.info.x11.window);
|
||||
if(res == NULL)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Unable to get xrandr screen resources.\n");
|
||||
R_Printf(PRINT_ALL, "Unable to get xrandr screen resources.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ UpdateHardwareGamma(void)
|
|||
Uint16* ramp = malloc(rampSize); // TODO: check for NULL
|
||||
if(ramp == NULL)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Couldn't allocate &zd byte of memory for gamma ramp - OOM?!\n", rampSize);
|
||||
R_Printf(PRINT_ALL, "Couldn't allocate &zd byte of memory for gamma ramp - OOM?!\n", rampSize);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ UpdateHardwareGamma(void)
|
|||
#else
|
||||
if(SDL_SetGammaRamp(ramp, ramp, ramp) < 0) {
|
||||
#endif
|
||||
ri.Con_Printf(PRINT_ALL, "Setting gamma failed: %s\n", SDL_GetError());
|
||||
R_Printf(PRINT_ALL, "Setting gamma failed: %s\n", SDL_GetError());
|
||||
}
|
||||
}
|
||||
#endif // X11GAMMA
|
||||
|
@ -211,7 +211,7 @@ static void InitGamma()
|
|||
if(SDL_GetWMInfo(&info) != 1)
|
||||
#endif
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Couldn't get Window info from SDL\n");
|
||||
R_Printf(PRINT_ALL, "Couldn't get Window info from SDL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -220,14 +220,14 @@ static void InitGamma()
|
|||
XRRScreenResources* res = XRRGetScreenResources(dpy, info.info.x11.window);
|
||||
if(res == NULL)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Unable to get xrandr screen resources.\n");
|
||||
R_Printf(PRINT_ALL, "Unable to get xrandr screen resources.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
noGammaRamps = res->ncrtc;
|
||||
gammaRamps = calloc(noGammaRamps, sizeof(XRRCrtcGamma*));
|
||||
if(gammaRamps == NULL) {
|
||||
ri.Con_Printf(PRINT_ALL, "Couldn't allocate memory for %d gamma ramps - OOM?!\n", noGammaRamps);
|
||||
R_Printf(PRINT_ALL, "Couldn't allocate memory for %d gamma ramps - OOM?!\n", noGammaRamps);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -249,13 +249,13 @@ static void InitGamma()
|
|||
|
||||
XRRFreeScreenResources(res);
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "Using hardware gamma via X11/xRandR.\n");
|
||||
R_Printf(PRINT_ALL, "Using hardware gamma via X11/xRandR.\n");
|
||||
#elif __APPLE__
|
||||
gl_state.hwgamma = false;
|
||||
ri.Con_Printf(PRINT_ALL, "Using software gamma (needs vid_restart after changes)\n");
|
||||
R_Printf(PRINT_ALL, "Using software gamma (needs vid_restart after changes)\n");
|
||||
return;
|
||||
#else
|
||||
ri.Con_Printf(PRINT_ALL, "Using hardware gamma via SDL.\n");
|
||||
R_Printf(PRINT_ALL, "Using hardware gamma via SDL.\n");
|
||||
#endif
|
||||
gl_state.hwgamma = true;
|
||||
vid_gamma->modified = true;
|
||||
|
@ -278,7 +278,7 @@ static void RestoreGamma()
|
|||
if(SDL_GetWMInfo(&info) != 1)
|
||||
#endif
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Couldn't get Window info from SDL\n");
|
||||
R_Printf(PRINT_ALL, "Couldn't get Window info from SDL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ static void RestoreGamma()
|
|||
XRRScreenResources* res = XRRGetScreenResources(dpy, info.info.x11.window);
|
||||
if(res == NULL)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Unable to get xrandr screen resources.\n");
|
||||
R_Printf(PRINT_ALL, "Unable to get xrandr screen resources.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ static void RestoreGamma()
|
|||
{
|
||||
int len = XRRGetCrtcGammaSize(dpy, res->crtcs[i]);
|
||||
if(len != gammaRamps[i]->size) {
|
||||
ri.Con_Printf(PRINT_ALL, "WTF, gamma ramp size for display %d has changed from %d to %d!\n",
|
||||
R_Printf(PRINT_ALL, "WTF, gamma ramp size for display %d has changed from %d to %d!\n",
|
||||
i, gammaRamps[i]->size, len);
|
||||
|
||||
continue;
|
||||
|
@ -316,7 +316,7 @@ static void RestoreGamma()
|
|||
free(gammaRamps);
|
||||
gammaRamps = NULL;
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "Restored original Gamma\n");
|
||||
R_Printf(PRINT_ALL, "Restored original Gamma\n");
|
||||
}
|
||||
#endif // X11GAMMA
|
||||
|
||||
|
@ -346,14 +346,14 @@ int RI_PrepareForWindow(void)
|
|||
|
||||
if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1) < 0)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "MSAA is unsupported: %s\n", SDL_GetError());
|
||||
R_Printf(PRINT_ALL, "MSAA is unsupported: %s\n", SDL_GetError());
|
||||
ri.Cvar_SetValue ("gl_msaa_samples", 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||
}
|
||||
else if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa_samples) < 0)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "MSAA %ix is unsupported: %s\n", msaa_samples, SDL_GetError());
|
||||
R_Printf(PRINT_ALL, "MSAA %ix is unsupported: %s\n", msaa_samples, SDL_GetError());
|
||||
ri.Cvar_SetValue("gl_msaa_samples", 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||
|
@ -384,7 +384,7 @@ int RI_InitContext(void* win)
|
|||
context = SDL_GL_CreateContext(window);
|
||||
if(context == NULL)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "R_InitContext(): Creating OpenGL Context failed: %s\n", SDL_GetError());
|
||||
R_Printf(PRINT_ALL, "R_InitContext(): Creating OpenGL Context failed: %s\n", SDL_GetError());
|
||||
window = NULL;
|
||||
return false;
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ int RI_InitContext(void* win)
|
|||
/* 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);
|
||||
R_Printf(PRINT_ALL, "Got %d bits of stencil.\n", stencil_bits);
|
||||
|
||||
if (stencil_bits >= 1)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ Com_EndRedirect(void)
|
|||
* to the apropriate place.
|
||||
*/
|
||||
void
|
||||
Com_VPrintf(int print_level, char *fmt, va_list argptr)
|
||||
Com_VPrintf(int print_level, const char *fmt, va_list argptr)
|
||||
{
|
||||
if((print_level == PRINT_DEVELOPER) && (!developer || !developer->value))
|
||||
{
|
||||
|
|
|
@ -711,7 +711,7 @@ void Com_BeginRedirect(int target, char *buffer, int buffersize, void (*flush));
|
|||
void Com_EndRedirect(void);
|
||||
void Com_Printf(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void Com_DPrintf(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void Com_VPrintf(int print_level, char *fmt, va_list argptr); /* print_level is PRINT_ALL or PRINT_DEVELOPER */
|
||||
void Com_VPrintf(int print_level, const char *fmt, va_list argptr); /* print_level is PRINT_ALL or PRINT_DEVELOPER */
|
||||
void Com_MDPrintf(char *fmt, ...);
|
||||
void Com_Error(int code, char *fmt, ...);
|
||||
void Com_Quit(void);
|
||||
|
|
Loading…
Reference in a new issue