From ccc0750de0604dd4847f4c10240b7d2f7fd3fdf4 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 27 May 2011 17:59:31 +0000 Subject: [PATCH] Trying to fix bugs. git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3797 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/pr_menu.c | 13 +++++-------- engine/client/r_surf.c | 16 +++------------- engine/client/render.h | 1 + engine/client/renderer.c | 5 +++-- engine/gl/gl_model.c | 18 ++++++++++++++++++ engine/gl/gl_vidcommon.c | 12 +++++++++++- 6 files changed, 41 insertions(+), 24 deletions(-) diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index 806ce55bb..887435948 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -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) diff --git a/engine/client/r_surf.c b/engine/client/r_surf.c index d839a1bf2..ed7cc05d1 100644 --- a/engine/client/r_surf.c +++ b/engine/client/r_surf.c @@ -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; inumsurfaces ; 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 diff --git a/engine/client/render.h b/engine/client/render.h index e56518c3d..7d17e95d7 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -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); diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 8c2d91bf2..f1c1c9d24 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -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"); diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 61a0326d3..6a666d189 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -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 ; ineedload) + continue; + + if (mod->type == mod_brush) + { + for (j=0, surf = mod->surfaces; jnumsurfaces ; j++, surf++) + surf->cached_dlight=-1;//force it + } + } +} /* =================== diff --git a/engine/gl/gl_vidcommon.c b/engine/gl/gl_vidcommon.c index 8ea2f076c..f0f2fdc27 100644 --- a/engine/gl/gl_vidcommon.c +++ b/engine/gl/gl_vidcommon.c @@ -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;