1
0
Fork 0
forked from fte/fteqw

Trying to fix bugs.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3797 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2011-05-27 17:59:31 +00:00
parent 646fd03f44
commit ccc0750de0
6 changed files with 41 additions and 24 deletions

View file

@ -396,26 +396,23 @@ void QCBUILTIN PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_
void QCBUILTIN PF_CL_stringwidth(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *text = PR_GetStringOfs(prinst, OFS_PARM0);
qboolean usecolours = G_FLOAT(OFS_PARM1);
int usecolours = G_FLOAT(OFS_PARM1);
float fontsize;
if (*prinst->callargc > 2)
fontsize = G_FLOAT(OFS_PARM2);
else
fontsize = 1;
if (mp_globs.drawfontscale)
fontsize *= mp_globs.drawfontscale[1];
if (usecolours)
{
conchar_t buffer[2048], *str;
conchar_t buffer[2048], *end;
float px, py;
COM_ParseFunString(CON_WHITEMASK, text, buffer, sizeof(buffer), false);
str = buffer;
end = COM_ParseFunString(CON_WHITEMASK, text, buffer, sizeof(buffer), false);
Font_BeginScaledString(font_conchar, 0, 0, &px, &py);
while(*str)
{
px += Font_CharWidth(*str++);
}
px = Font_LineWidth(buffer, end);
Font_EndString(font_conchar);
if (mp_globs.drawfontscale)

View file

@ -58,28 +58,18 @@ extern cvar_t r_stainfadeammount;
static int lightmap_shift;
int Surf_LightmapShift (model_t *model)
{
extern cvar_t gl_overbright_all, gl_lightmap_shift;
extern cvar_t gl_overbright_all, gl_overbright, gl_lightmap_shift;
if (gl_overbright_all.ival || (model->engineflags & MDLF_NEEDOVERBRIGHT))
lightmap_shift = bound(0, gl_lightmap_shift.ival, 2);
lightmap_shift = bound(0, gl_lightmap_shift.ival + gl_overbright.ival, 2);
else
lightmap_shift = 0;
return lightmap_shift;
}
void Surf_RebuildLightmap (void)
{
int i;
msurface_t *surf;
if (cl.worldmodel)
for (i=0, surf = cl.worldmodel->surfaces; i<cl.worldmodel->numsurfaces ; i++, surf++)
surf->cached_dlight=-1;//force it
}
void Surf_RebuildLightmap_Callback (struct cvar_s *var, char *oldvalue)
{
Surf_RebuildLightmap();
Mod_RebuildLightmaps();
}
//radius, x y z, r g b

View file

@ -344,6 +344,7 @@ struct model_s *RMod_ForName (char *name, qboolean crash);
struct model_s *RMod_FindName (char *name);
void *RMod_Extradata (struct model_s *mod); // handles caching
void RMod_TouchModel (char *name);
void Mod_RebuildLightmaps (void);
struct mleaf_s *RMod_PointInLeaf (struct model_s *model, float *p);

View file

@ -258,8 +258,9 @@ cvar_t gl_mindist = SCVARF ("gl_mindist", "4",
cvar_t gl_motionblur = SCVARF ("gl_motionblur", "0",
CVAR_ARCHIVE);
cvar_t gl_motionblurscale = SCVAR ("gl_motionblurscale", "1");
cvar_t gl_overbright = SCVARF ("gl_overbright", "1",
CVAR_ARCHIVE);
cvar_t gl_overbright = CVARFC ("gl_overbright", "1",
CVAR_ARCHIVE,
Surf_RebuildLightmap_Callback);
cvar_t gl_overbright_all = SCVARF ("gl_overbright_all", "0",
CVAR_ARCHIVE);
cvar_t gl_picmip = SCVAR ("gl_picmip", "0");

View file

@ -285,6 +285,24 @@ void RMod_Think (void)
#endif
}
void Mod_RebuildLightmaps (void)
{
int i, j;
msurface_t *surf;
model_t *mod;
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
if (mod->needload)
continue;
if (mod->type == mod_brush)
{
for (j=0, surf = mod->surfaces; j<mod->numsurfaces ; j++, surf++)
surf->cached_dlight=-1;//force it
}
}
}
/*
===================

View file

@ -359,7 +359,17 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name), float ver)
{
/*in gl3.0 things are depricated but not removed*/
/*in gl3.1 depricated things are removed unless compatibility is present*/
if (gl_config.glversion >= 3.1)
/*in gl3.2 there's a profile flag we can query*/
if (gl_config.glversion > 3.1)
{
GLint profile = 0;
#define GL_CONTEXT_PROFILE_MASK 0x9126
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
qglGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
gl_config.nofixedfunc = !(profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT);
}
else if (gl_config.glversion == 3.1)
gl_config.nofixedfunc = !GL_CheckExtension("GL_ARB_compatibility");
else
gl_config.nofixedfunc = false;