git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2694 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Mark Olsen 2007-09-26 15:08:42 +00:00
parent b23217d785
commit 31ab61b06b

View file

@ -61,6 +61,9 @@ static void Fod_Cvar_Register(cvar_t *cvar)
#define Com_Printf Con_Printf
#define Q_Malloc Z_Malloc
/* And some funny prototypes. Just because. */
void Sys_Video_SetPalette(void *display, unsigned char *palette);
#include "fod/vid_x11.c"
#include "fod/in_x11.c"
@ -80,8 +83,22 @@ static void *fod_display;
static int fod_width;
static int fod_height;
static void *vid_surfcache;
qboolean SWVID_Init(rendererstate_t *info, unsigned char *palette)
{
unsigned int surfcachesize;
surfcachesize = D_SurfaceCacheForRes(vid.width, vid.height, 0);
d_pzbuffer = malloc(info->width * info->height * sizeof(*d_pzbuffer));
if (d_pzbuffer)
{
vid_surfcache = malloc(surfcachesize);
if (vid_surfcache)
{
D_InitCaches(vid_surfcache, surfcachesize);
fod_display = Sys_Video_Open(info->width, info->height, info->bpp, info->fullscreen, vid_curpal);
if (fod_display)
{
@ -117,6 +134,12 @@ qboolean SWVID_Init(rendererstate_t *info, unsigned char *palette)
return true;
}
free(vid_surfcache);
}
free(d_pzbuffer);
}
return false;
}
@ -134,6 +157,11 @@ void SWVID_Shutdown(void)
{
if (fod_display)
{
D_FlushCaches();
free(vid_surfcache);
free(d_pzbuffer);
Sys_Video_Close(fod_display);
fod_display = 0;