Add some new cvar flags to handle cvars that need to invalidate textures or reset the video mode after modifying

git-svn-id: https://svn.eduke32.com/eduke32@3757 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2013-05-15 02:16:19 +00:00
parent edb222ea4a
commit 80f645c65e
5 changed files with 41 additions and 15 deletions

View file

@ -31,16 +31,19 @@ const char *OSD_StripColors(char *out, const char *in);
enum cvartype_t
{
CVAR_FLOAT = 0x00000001,
CVAR_INT = 0x00000002,
CVAR_UINT = 0x00000004,
CVAR_BOOL = 0x00000008,
CVAR_STRING = 0x00000010,
CVAR_DOUBLE = 0x00000020,
CVAR_LOCKED = 0x00000040,
CVAR_MULTI = 0x00000080,
CVAR_NOSAVE = 0x00000100,
CVAR_FUNCPTR = 0x00000200,
CVAR_FLOAT = 0x00000001,
CVAR_INT = 0x00000002,
CVAR_UINT = 0x00000004,
CVAR_BOOL = 0x00000008,
CVAR_STRING = 0x00000010,
CVAR_DOUBLE = 0x00000020,
CVAR_LOCKED = 0x00000040,
CVAR_MULTI = 0x00000080,
CVAR_NOSAVE = 0x00000100,
CVAR_FUNCPTR = 0x00000200,
CVAR_RESTARTVID = 0x00000400,
CVAR_INVALIDATE = 0x00000800,
CVAR_INVALIDATE8 = 0x00001000,
};
typedef struct
@ -194,6 +197,8 @@ extern char osdhistorybuf[OSD_HISTORYDEPTH][OSD_EDITLENGTH+1]; // history strin
extern int32_t osdhistorysize; // number of entries in history
extern int32_t osdhistorytotal; // number of total history entries
extern int32_t osdcmd_restartvid(const osdfuncparm_t *parm);
#ifdef EXTERNC
}
#endif

View file

@ -233,7 +233,7 @@ void clearkeys(void)
}
#ifdef USE_OPENGL
static int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
{
UNREFERENCED_PARAMETER(parm);

View file

@ -2100,6 +2100,27 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
default:
break;
}
#ifdef USE_OPENGL
if (!OSD_ParsingScript())
{
switch (cvars[i].c.type&(CVAR_RESTARTVID|CVAR_INVALIDATE|CVAR_INVALIDATE8))
{
case CVAR_RESTARTVID:
osdcmd_restartvid(NULL);
break;
case CVAR_INVALIDATE:
gltexinvalidateall();
case CVAR_INVALIDATE8:
gltexinvalidate8();
#ifdef POLYMER
if (getrendermode() == REND_POLYMER)
polymer_texinvalidate();
#endif
break;
}
}
#endif
}
if (!OSD_ParsingScript())

View file

@ -6074,7 +6074,7 @@ void polymost_initosdfuncs(void)
#ifdef POLYMER
// polymer cvars
{ "r_pr_lighting", "r_pr_lighting: enable/disable dynamic lights", (void *) &pr_lighting, CVAR_BOOL, 0, 1 },
{ "r_pr_lighting", "r_pr_lighting: enable/disable dynamic lights - restarts renderer", (void *) &pr_lighting, CVAR_BOOL | CVAR_RESTARTVID, 0, 1 },
{ "r_pr_normalmapping", "r_pr_normalmapping: enable/disable virtual displacement mapping", (void *) &pr_normalmapping, CVAR_BOOL, 0, 1 },
{ "r_pr_specularmapping", "r_pr_specularmapping: enable/disable specular mapping", (void *) &pr_specularmapping, CVAR_BOOL, 0, 1 },
{ "r_pr_shadows", "r_pr_shadows: enable/disable dynamic shadows", (void *) &pr_shadows, CVAR_BOOL, 0, 1 },
@ -6088,7 +6088,7 @@ void polymost_initosdfuncs(void)
{ "r_pr_billboardingmode", "r_pr_billboardingmode: face sprite display method. 0: classic mode; 1: polymost mode", (void *) &pr_billboardingmode, CVAR_INT, 0, 1 },
{ "r_pr_verbosity", "r_pr_verbosity: verbosity level of the polymer renderer", (void *) &pr_verbosity, CVAR_INT, 0, 3 },
{ "r_pr_wireframe", "r_pr_wireframe: toggles wireframe mode", (void *) &pr_wireframe, CVAR_INT | CVAR_NOSAVE, 0, 1 },
{ "r_pr_vbos", "r_pr_vbos: contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void *) &pr_vbos, CVAR_INT, 0, 2 },
{ "r_pr_vbos", "r_pr_vbos: contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void *) &pr_vbos, CVAR_INT | CVAR_RESTARTVID, 0, 2 },
{ "r_pr_gpusmoothing", "r_pr_gpusmoothing: toggles model animation interpolation", (void *) &pr_gpusmoothing, CVAR_INT, 0, 1 },
{ "r_pr_overrideparallax", "r_pr_overrideparallax: overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens", (void *) &pr_overrideparallax, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_parallaxscale", "r_pr_parallaxscale: overriden parallax mapping offset scale", (void *) &pr_parallaxscale, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 },
@ -6097,7 +6097,7 @@ void polymost_initosdfuncs(void)
{ "r_pr_specularpower", "r_pr_specularpower: overriden specular material power", (void *) &pr_specularpower, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 },
{ "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void *) &pr_specularfactor, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 },
{ "r_pr_highpalookups", "r_pr_highpalookups: enable/disable highpalookups", (void *) &pr_highpalookups, CVAR_BOOL, 0, 1 },
{ "r_pr_artmapping", "r_pr_artmapping: enable/disable art mapping - you need to restart the renderer or you'll destroy everything", (void *) &pr_artmapping, CVAR_BOOL, 0, 1 },
{ "r_pr_artmapping", "r_pr_artmapping: enable/disable art mapping", (void *) &pr_artmapping, CVAR_BOOL | CVAR_INVALIDATE8, 0, 1 },
{ "r_pr_overridehud", "r_pr_overridehud: overrides hud model parameters with values from the pr_hud* cvars; use it to fine-tune DEF tokens", (void *) &pr_overridehud, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_hudxadd", "r_pr_hudxadd: overriden HUD xadd; see r_pr_overridehud", (void *) &pr_hudxadd, CVAR_FLOAT | CVAR_NOSAVE, -100, 100 },
{ "r_pr_hudyadd", "r_pr_hudyadd: overriden HUD yadd; see r_pr_overridehud", (void *) &pr_hudyadd, CVAR_FLOAT | CVAR_NOSAVE, -100, 100 },

View file

@ -388,7 +388,7 @@ static int32_t osdcmd_restartsound(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
{
UNREFERENCED_PARAMETER(parm);
resetvideomode();