It works again, ref_gl doesn't use any client symbols anymore

So in theory this should even work on Windows now.
This commit is contained in:
Daniel Gibson 2016-10-02 01:47:37 +02:00
parent 0588d3f988
commit 7f27c549a8
16 changed files with 165 additions and 107 deletions

View file

@ -252,6 +252,9 @@ else ifeq ($(OSTYPE), Darwin)
LDFLAGS := $(OSX_ARCH) -lm
endif
CFLAGS += -fvisibility=hidden
LDFLAGS += -fvisibility=hidden -Wl,--no-undefined
# ----------
# Extra LDFLAGS for SDL

View file

@ -198,6 +198,7 @@ qboolean ref_active = false; /* Is the refresher being used? */
void Key_MarkAllUp(void);
extern int GLimp_Init(void);
extern qboolean GLimp_InitGraphics(qboolean fullscreen, int *pwidth, int *pheight);
extern void VID_ShutdownWindow(void);
@ -250,6 +251,7 @@ VID_LoadRefresh(void)
ri.Vid_NewWindow = VID_NewWindow;
ri.Vid_ShutdownWindow = VID_ShutdownWindow;
ri.GLimp_Init = GLimp_Init;
ri.GLimp_InitGraphics = GLimp_InitGraphics;
re = GetRefAPI( ri );

View file

@ -228,6 +228,7 @@ typedef struct
void (IMPORT *Vid_NewWindow)( int width, int height );
void (IMPORT *Vid_ShutdownWindow)(void);
int (IMPORT *GLimp_Init)(void);
qboolean (IMPORT *GLimp_InitGraphics)(qboolean fullscreen, int *pwidth, int *pheight);
} refimport_t;

View file

@ -49,7 +49,7 @@ LoadPCX(char *origname, byte **pic, byte **palette, int *width, int *height)
*palette = NULL;
/* load the file */
len = FS_LoadFile(filename, (void **)&raw);
len = ri.FS_LoadFile(filename, (void **)&raw);
if (!raw)
{
@ -131,7 +131,7 @@ LoadPCX(char *origname, byte **pic, byte **palette, int *width, int *height)
*pic = NULL;
}
FS_FreeFile(pcx);
ri.FS_FreeFile(pcx);
}
void
@ -140,7 +140,7 @@ GetPCXInfo(char *filename, int *width, int *height)
pcx_t *pcx;
byte *raw;
FS_LoadFile(filename, (void **)&raw);
ri.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;
FS_FreeFile(raw);
ri.FS_FreeFile(raw);
return;
}

View file

@ -63,7 +63,7 @@ LoadSTB(const char *origname, const char* type, byte **pic, int *width, int *hei
*pic = NULL;
byte* rawdata = NULL;
int rawsize = FS_LoadFile(filename, (void **)&rawdata);
int rawsize = ri.FS_LoadFile(filename, (void **)&rawdata);
if (rawdata == NULL)
{
return false;
@ -75,11 +75,11 @@ LoadSTB(const char *origname, const char* type, byte **pic, int *width, int *hei
if (data == NULL)
{
ri.Con_Printf(PRINT_ALL, "stb_image couldn't load data from %s: %s!\n", filename, stbi_failure_reason());
FS_FreeFile(rawdata);
ri.FS_FreeFile(rawdata);
return false;
}
FS_FreeFile(rawdata);
ri.FS_FreeFile(rawdata);
ri.Con_Printf(PRINT_DEVELOPER, "LoadSTB() loaded: %s\n", filename);

View file

@ -42,7 +42,7 @@ LoadWal(char *origname)
Q_strlcat(name, ".wal", sizeof(name));
}
FS_LoadFile(name, (void **)&mt);
ri.FS_LoadFile(name, (void **)&mt);
if (!mt)
{
@ -56,7 +56,7 @@ LoadWal(char *origname)
image = R_LoadPic(name, (byte *)mt + ofs, width, 0, height, 0, it_wall, 8);
FS_FreeFile((void *)mt);
ri.FS_FreeFile((void *)mt);
return image;
}
@ -66,7 +66,7 @@ GetWalInfo(char *name, int *width, int *height)
{
miptex_t *mt;
FS_LoadFile(name, (void **)&mt);
ri.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);
FS_FreeFile((void *)mt);
ri.FS_FreeFile((void *)mt);
return;
}

View file

@ -39,7 +39,7 @@ void
Draw_InitLocal(void)
{
/* don't bilerp characters and crosshairs */
gl_nolerp_list = Cvar_Get("gl_nolerp_list", "pics/conchars.pcx pics/ch1.pcx pics/ch2.pcx pics/ch3.pcx", 0);
gl_nolerp_list = ri.Cvar_Get("gl_nolerp_list", "pics/conchars.pcx pics/ch1.pcx pics/ch2.pcx pics/ch3.pcx", 0);
/* load console characters */
draw_chars = R_FindImage("pics/conchars.pcx", it_pic);

View file

@ -204,16 +204,16 @@ R_TextureMode(char *string)
{
if (gl_anisotropic->value > gl_config.max_anisotropy)
{
Cvar_SetValue("gl_anisotropic", gl_config.max_anisotropy);
ri.Cvar_SetValue("gl_anisotropic", gl_config.max_anisotropy);
}
else if (gl_anisotropic->value < 1.0)
{
Cvar_SetValue("gl_anisotropic", 1.0);
ri.Cvar_SetValue("gl_anisotropic", 1.0);
}
}
else
{
Cvar_SetValue("gl_anisotropic", 0.0);
ri.Cvar_SetValue("gl_anisotropic", 0.0);
}
/* change all the existing mipmap texture objects */
@ -877,7 +877,14 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth,
{
image_t *image;
int i;
qboolean nolerp = (strstr(Cvar_VariableString("gl_nolerp_list"), name) != NULL);
qboolean nolerp = false;
cvar_t* nolerp_var = ri.Cvar_Get("gl_nolerp_list", NULL, 0);
if(nolerp_var != NULL && nolerp_var->string != NULL)
{
nolerp = strstr(nolerp_var->string, name) != NULL;
}
/* find a free image_t */
for (i = 0, image = gltextures; i < numgltextures; i++, image++)
@ -1254,11 +1261,11 @@ R_InitImages(void)
registration_sequence = 1;
/* init intensity conversions */
intensity = Cvar_Get("intensity", "2", CVAR_ARCHIVE);
intensity = ri.Cvar_Get("intensity", "2", CVAR_ARCHIVE);
if (intensity->value <= 1)
{
Cvar_Set("intensity", "1");
ri.Cvar_Set("intensity", "1");
}
gl_state.inverse_intensity = 1 / intensity->value;
@ -1267,7 +1274,7 @@ R_InitImages(void)
if (gl_config.palettedtexture)
{
FS_LoadFile("pics/16to8.dat", (void **)&gl_state.d_16to8table);
ri.FS_LoadFile("pics/16to8.dat", (void **)&gl_state.d_16to8table);
if (!gl_state.d_16to8table)
{

View file

@ -1192,78 +1192,78 @@ RI_RenderFrame(refdef_t *fd)
void
R_Register(void)
{
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_lerpmodels = Cvar_Get("gl_lerpmodels", "1", 0);
gl_speeds = Cvar_Get("gl_speeds", "0", 0);
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_lerpmodels = ri.Cvar_Get("gl_lerpmodels", "1", 0);
gl_speeds = ri.Cvar_Get("gl_speeds", "0", 0);
gl_lightlevel = Cvar_Get("gl_lightlevel", "0", 0);
gl_overbrightbits = Cvar_Get("gl_overbrightbits", "0", CVAR_ARCHIVE);
gl_lightlevel = ri.Cvar_Get("gl_lightlevel", "0", 0);
gl_overbrightbits = ri.Cvar_Get("gl_overbrightbits", "0", 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_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_modulate = Cvar_Get("gl_modulate", "1", CVAR_ARCHIVE);
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_showtris = Cvar_Get("gl_showtris", "0", 0);
gl_showbbox = Cvar_Get("gl_showbbox", "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_modulate = ri.Cvar_Get("gl_modulate", "1", CVAR_ARCHIVE);
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_showtris = ri.Cvar_Get("gl_showtris", "0", 0);
gl_showbbox = ri.Cvar_Get("gl_showbbox", "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_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_lockpvs = Cvar_Get("gl_lockpvs", "0", 0);
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_lockpvs = ri.Cvar_Get("gl_lockpvs", "0", 0);
gl_palettedtexture = Cvar_Get("gl_palettedtexture", "0", CVAR_ARCHIVE);
gl_pointparameters = Cvar_Get("gl_pointparameters", "1", CVAR_ARCHIVE);
gl_palettedtexture = ri.Cvar_Get("gl_palettedtexture", "0", CVAR_ARCHIVE);
gl_pointparameters = ri.Cvar_Get("gl_pointparameters", "1", CVAR_ARCHIVE);
gl_drawbuffer = Cvar_Get("gl_drawbuffer", "GL_BACK", 0);
gl_swapinterval = Cvar_Get("gl_swapinterval", "1", CVAR_ARCHIVE);
gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0);
gl_swapinterval = ri.Cvar_Get("gl_swapinterval", "1", CVAR_ARCHIVE);
gl_saturatelighting = Cvar_Get("gl_saturatelighting", "0", 0);
gl_saturatelighting = ri.Cvar_Get("gl_saturatelighting", "0", 0);
vid_fullscreen = Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
vid_gamma = Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE);
vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
vid_gamma = ri.Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE);
gl_customwidth = Cvar_Get("gl_customwidth", "1024", CVAR_ARCHIVE);
gl_customheight = Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE);
gl_msaa_samples = Cvar_Get ( "gl_msaa_samples", "0", CVAR_ARCHIVE );
gl_customwidth = ri.Cvar_Get("gl_customwidth", "1024", CVAR_ARCHIVE);
gl_customheight = ri.Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE);
gl_msaa_samples = ri.Cvar_Get ( "gl_msaa_samples", "0", CVAR_ARCHIVE );
gl_retexturing = Cvar_Get("gl_retexturing", "1", CVAR_ARCHIVE);
gl_retexturing = ri.Cvar_Get("gl_retexturing", "1", CVAR_ARCHIVE);
gl_stereo = Cvar_Get( "gl_stereo", "0", CVAR_ARCHIVE );
gl_stereo_separation = Cvar_Get( "gl_stereo_separation", "-0.4", CVAR_ARCHIVE );
gl_stereo_anaglyph_colors = Cvar_Get( "gl_stereo_anaglyph_colors", "rc", CVAR_ARCHIVE );
gl_stereo_convergence = Cvar_Get( "gl_stereo_convergence", "1", CVAR_ARCHIVE );
gl_stereo = ri.Cvar_Get( "gl_stereo", "0", CVAR_ARCHIVE );
gl_stereo_separation = ri.Cvar_Get( "gl_stereo_separation", "-0.4", CVAR_ARCHIVE );
gl_stereo_anaglyph_colors = ri.Cvar_Get( "gl_stereo_anaglyph_colors", "rc", CVAR_ARCHIVE );
gl_stereo_convergence = ri.Cvar_Get( "gl_stereo_convergence", "1", CVAR_ARCHIVE );
Cmd_AddCommand("imagelist", R_ImageList_f);
Cmd_AddCommand("screenshot", R_ScreenShot);
Cmd_AddCommand("modellist", Mod_Modellist_f);
Cmd_AddCommand("gl_strings", R_Strings);
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);
}
/*
@ -1276,7 +1276,7 @@ SetMode_impl(int *pwidth, int *pheight, int mode, qboolean fullscreen)
/* 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) && !VID_GetModeInfo(pwidth, pheight, mode))
if ((mode != -1) && !ri.Vid_GetModeInfo(pwidth, pheight, mode))
{
ri.Con_Printf(PRINT_ALL, " invalid mode\n");
return rserr_invalid_mode;
@ -1324,7 +1324,7 @@ R_SetMode(void)
{
if (err == rserr_invalid_fullscreen)
{
Cvar_SetValue("vid_fullscreen", 0);
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");
@ -1335,7 +1335,7 @@ R_SetMode(void)
}
else if (err == rserr_invalid_mode)
{
Cvar_SetValue("gl_mode", gl_state.prev_mode);
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");
}
@ -1385,7 +1385,7 @@ RI_Init(void *hinstance, void *hWnd)
QGL_Init();
/* initialize OS-specific parts of OpenGL */
if (!GLimp_Init())
if (!ri.GLimp_Init())
{
QGL_Shutdown();
return -1;
@ -1403,12 +1403,12 @@ RI_Init(void *hinstance, void *hWnd)
return -1;
}
VID_MenuInit();
ri.Vid_MenuInit();
// --------
/* get our various GL strings */
ri.Con_Printf(PRINT_ALL, "\nOpenGL setting:\n", gl_config.vendor_string);
ri.Con_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);
@ -1549,10 +1549,10 @@ RI_Init(void *hinstance, void *hWnd)
void
RI_Shutdown(void)
{
Cmd_RemoveCommand("modellist");
Cmd_RemoveCommand("screenshot");
Cmd_RemoveCommand("imagelist");
Cmd_RemoveCommand("gl_strings");
ri.Cmd_RemoveCommand("modellist");
ri.Cmd_RemoveCommand("screenshot");
ri.Cmd_RemoveCommand("imagelist");
ri.Cmd_RemoveCommand("gl_strings");
Mod_FreeAll();
@ -1588,7 +1588,7 @@ RI_BeginFrame(float camera_separation)
{
ri.Con_Printf(PRINT_ALL, "stereo supermode changed, restarting video!\n");
cvar_t *ref;
ref = Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
ref = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
ref->modified = true;
}
}
@ -1608,11 +1608,11 @@ RI_BeginFrame(float camera_separation)
{
if (gl_overbrightbits->value > 2 && gl_overbrightbits->value < 4)
{
Cvar_Set("gl_overbrightbits", "2");
ri.Cvar_Set("gl_overbrightbits", "2");
}
else if (gl_overbrightbits->value > 4)
{
Cvar_Set("gl_overbrightbits", "4");
ri.Cvar_Set("gl_overbrightbits", "4");
}
gl_overbrightbits->modified = false;
@ -1844,7 +1844,7 @@ extern void RDraw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byt
extern void RI_SetPalette(const unsigned char *palette);
extern void RI_EndFrame(void);
refexport_t
Q2_DLL_EXPORTED refexport_t
GetRefAPI(refimport_t imp)
{
refexport_t re = {0};
@ -1888,3 +1888,32 @@ GetRefAPI(refimport_t imp)
return re;
}
/*
* this is only here so the functions in shared source files
* (shared.c, rand.c, flash.c, mem.c/hunk.c) can link
*/
void
Sys_Error(char *error, ...)
{
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 *msg, ...)
{
va_list argptr;
char text[1024];
va_start(argptr, msg);
vsprintf(text, msg, argptr);
va_end(argptr);
ri.Con_Printf(PRINT_ALL, "%s", text);
}

View file

@ -92,9 +92,7 @@ R_ScreenShot(void)
int i, c;
FILE *f;
/* create the scrnshots directory if it doesn't exist */
Com_sprintf(checkname, sizeof(checkname), "%s/scrnshot", FS_Gamedir());
Sys_Mkdir(checkname);
/* FS_InitFilesystem() made sure the screenshots dir exists */
/* find a file name to save it to */
strcpy(picname, "quake00.tga");
@ -104,7 +102,7 @@ R_ScreenShot(void)
picname[5] = i / 10 + '0';
picname[6] = i % 10 + '0';
Com_sprintf(checkname, sizeof(checkname), "%s/scrnshot/%s",
FS_Gamedir(), picname);
ri.FS_Gamedir(), picname);
f = fopen(checkname, "rb");
if (!f)

View file

@ -237,7 +237,7 @@ Mod_ForName(char *name, qboolean crash)
strcpy(mod->name, name);
/* load the file */
modfilelen = FS_LoadFile(mod->name, (void **)&buf);
modfilelen = ri.FS_LoadFile(mod->name, (void **)&buf);
if (!buf)
{
@ -279,7 +279,7 @@ Mod_ForName(char *name, qboolean crash)
loadmodel->extradatasize = Hunk_End();
FS_FreeFile(buf);
ri.FS_FreeFile(buf);
return mod;
}
@ -993,7 +993,7 @@ RI_BeginRegistration(char *model)
/* explicitly free the old map if different
this guarantees that mod_known[0] is the
world map */
flushmap = Cvar_Get("flushmap", "0", 0);
flushmap = ri.Cvar_Get("flushmap", "0", 0);
if (strcmp(mod_known[0].name, fullname) || flushmap->value)
{

View file

@ -321,15 +321,15 @@ int RI_PrepareForWindow(void)
if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1) < 0)
{
Com_Printf("MSAA is unsupported: %s\n", SDL_GetError());
Cvar_SetValue ("gl_msaa_samples", 0);
ri.Con_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)
{
Com_Printf("MSAA %ix is unsupported: %s\n", msaa_samples, SDL_GetError());
Cvar_SetValue("gl_msaa_samples", 0);
ri.Con_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);
}
@ -368,7 +368,7 @@ int RI_InitContext(void* win)
{
if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaa_samples) == 0)
{
Cvar_SetValue("gl_msaa_samples", msaa_samples);
ri.Cvar_SetValue("gl_msaa_samples", msaa_samples);
}
}

View file

@ -408,7 +408,7 @@ extern glconfig_t gl_config;
extern glstate_t gl_state;
/*
* Initializes the SDL OpenGL context
* Initialzes the SDL video subsystem
*/
int GLimp_Init(void);

View file

@ -1527,6 +1527,8 @@ FS_Dir_f(void)
void
FS_InitFilesystem(void)
{
char scrnshotdir[MAX_OSPATH];
/* Register FS commands. */
Cmd_AddCommand("path", FS_Path_f);
Cmd_AddCommand("link", FS_Link_f);
@ -1577,6 +1579,12 @@ FS_InitFilesystem(void)
/* Create directory if it does not exist. */
FS_CreatePath(fs_gamedir);
/* create the scrnshots directory if it doesn't exist
* (do it here instead of in ref_gl so ref_gl doesn't need mkdir)
*/
Com_sprintf(scrnshotdir, sizeof(scrnshotdir), "%s/scrnshot", FS_Gamedir());
Sys_Mkdir(scrnshotdir);
Com_Printf("Using '%s' for writing.\n", fs_gamedir);
}

View file

@ -79,9 +79,19 @@ typedef unsigned char byte;
#ifdef _WIN32
#define MAX_OSPATH 256 /* max length of a filesystem pathname (same as MAX_PATH) */
#define LATCH_CVAR_SAVELENGTH 256
#else
// by default dlls don't export any functions, use this to
// make a function visible (for GetGameAPI(), GetRefAPI() and similar)
#define Q2_DLL_EXPORTED __declspec(dllexport)
#else // not Win32 (Linux, BSD, Mac, ..)
#define MAX_OSPATH 4096 /* max length of a filesystem pathname */
#define LATCH_CVAR_SAVELENGTH 128
// by default our .so/.dylibs don't export any functions, use this to
// make a function visible (for GetGameAPI(), GetRefAPI() and similar)
#define Q2_DLL_EXPORTED __attribute__((__visibility__("default")))
#endif
/* per-level limits */

View file

@ -111,7 +111,7 @@ ShutdownGame(void)
* with all entry points and global
* variables
*/
game_export_t *
Q2_DLL_EXPORTED game_export_t *
GetGameAPI(game_import_t *import)
{
gi = *import;