(Mostly) get rid of VID_Printf() and VID_Error()

they're only wrapping Com_Printf() and Com_Error() anyway
This commit is contained in:
Daniel Gibson 2016-12-19 21:52:43 +01:00
parent 54ae3be0c6
commit a0c1c74a2e
3 changed files with 11 additions and 29 deletions

View file

@ -89,7 +89,7 @@ viddef_t viddef; /* global video state; used by other modules */
#define VID_NUM_MODES (sizeof(vid_modes) / sizeof(vid_modes[0]))
#define MAXPRINTMSG 4096
void
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;
@ -109,19 +109,6 @@ VID_Printf(int print_level, char *fmt, ...)
}
}
void
VID_Error(int err_level, char *fmt, ...)
{
va_list argptr;
char msg[MAXPRINTMSG];
va_start(argptr, fmt);
vsnprintf(msg, MAXPRINTMSG, fmt, argptr);
va_end(argptr);
Com_Error(err_level, "%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
@ -240,8 +227,8 @@ VID_LoadRefresh(void)
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.Con_Printf = VID_Printf; // FIXME: use Com_VPrintf()
ri.Sys_Error = Com_Error;
ri.FS_LoadFile = FS_LoadFile;
ri.FS_FreeFile = FS_FreeFile;
ri.FS_Gamedir = FS_Gamedir;

View file

@ -72,8 +72,7 @@ GLimp_Init(void)
if (SDL_Init(SDL_INIT_VIDEO) == -1)
{
VID_Printf(PRINT_ALL, "Couldn't init SDL video: %s.\n",
SDL_GetError());
Com_Printf("Couldn't init SDL video: %s.\n", SDL_GetError());
return false;
}
#if SDL_VERSION_ATLEAST(2, 0, 0)
@ -82,7 +81,7 @@ GLimp_Init(void)
char driverName[64];
SDL_VideoDriverName(driverName, sizeof(driverName));
#endif
VID_Printf(PRINT_ALL, "SDL video driver is \"%s\".\n", driverName);
Com_Printf("SDL video driver is \"%s\".\n", driverName);
}
return true;
@ -210,7 +209,7 @@ static qboolean GetWindowSize(int* w, int* h)
SDL_DisplayMode m;
if(SDL_GetWindowDisplayMode(window, &m) != 0)
{
VID_Printf(PRINT_ALL, "Can't get Displaymode: %s\n", SDL_GetError());
Com_Printf("Can't get Displaymode: %s\n", SDL_GetError());
return false;
}
*w = m.w;
@ -309,9 +308,8 @@ GLimp_InitGraphics(qboolean fullscreen, int *pwidth, int *pheight)
#endif // 0
if (width != 640 || height != 480 || (flags & SDL_FULLSCREEN))
{
VID_Printf(PRINT_ALL, "SDL SetVideoMode failed: %s\n",
SDL_GetError());
VID_Printf(PRINT_ALL, "Reverting to windowed gl_mode 4 (640x480).\n");
Com_Printf("SDL SetVideoMode failed: %s\n", SDL_GetError());
Com_Printf("Reverting to windowed gl_mode 4 (640x480).\n");
/* Try to recover */
Cvar_SetValue("gl_mode", 4);
@ -323,7 +321,7 @@ GLimp_InitGraphics(qboolean fullscreen, int *pwidth, int *pheight)
}
else
{
VID_Error(ERR_FATAL, "Failed to revert to gl_mode 4. Exiting...\n");
Com_Error(ERR_FATAL, "Failed to revert to gl_mode 4. Exiting...\n");
return false;
}
}
@ -373,8 +371,8 @@ void GLimp_GrabInput(qboolean grab)
}
if(SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE) < 0)
{
VID_Printf(PRINT_ALL, "WARNING: Setting Relative Mousemode failed, reason: %s\n", SDL_GetError());
VID_Printf(PRINT_ALL, " You should probably update to SDL 2.0.3 or newer!\n");
Com_Printf("WARNING: Setting Relative Mousemode failed, reason: %s\n", SDL_GetError());
Com_Printf(" You should probably update to SDL 2.0.3 or newer!\n");
}
#else
SDL_WM_GrabInput(grab ? SDL_GRAB_ON : SDL_GRAB_OFF);

View file

@ -46,9 +46,6 @@ 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);