Renamed some more cvars, removed osdcompletionstyle and merged the two methods into one

git-svn-id: https://svn.eduke32.com/eduke32@833 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-07-02 22:45:04 +00:00
parent 4c8538e0f7
commit c5d1978aa2
3 changed files with 40 additions and 45 deletions

View file

@ -79,7 +79,6 @@ static int osdhistorysize=0; // number of entries in history
// execution buffer
// the execution buffer works from the command history
static int osdexeccount=0; // number of lines from the head of the history buffer to execute
static int osdcompletionstyle=0;
// maximal log line count
int logcutoff=120000;
@ -268,10 +267,16 @@ static int _internal_osdfunc_alias(const osdfuncparm_t *parm)
if (parm->numparms < 1)
{
int j = 0;
OSD_Printf("Alias listing:\n");
for (i=symbols; i!=NULL; i=i->next)
if (i->func == (void *)OSD_ALIAS)
{
j++;
OSD_Printf(" %s \"%s\"\n", i->name, i->help);
}
if (j == 0)
OSD_Printf("No aliases found.\n");
return OSDCMD_OK;
}
@ -417,18 +422,6 @@ static int _internal_osdfunc_vars(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
}
else if (!Bstrcasecmp(parm->name, "osdcompletionstyle"))
{
if (showval) { OSD_Printf("osdcompletionstyle is %d\n", osdcompletionstyle); return OSDCMD_OK; }
else
{
osdcompletionstyle = atoi(parm->parms[0]);
if (osdcompletionstyle < 0) osdcompletionstyle = 0;
else if (osdcompletionstyle > 1) osdcompletionstyle = 1;
OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK;
}
}
else if (!Bstrcasecmp(parm->name, "logcutoff"))
{
if (showval) { OSD_Printf("logcutoff is %d\n", logcutoff); return OSDCMD_OK; }
@ -538,14 +531,13 @@ void OSD_Init(void)
osdinited=1;
OSD_RegisterFunction("listsymbols","listsymbols: lists all the recognized symbols",_internal_osdfunc_listsymbols);
OSD_RegisterFunction("help","help: displays help on the named symbol",_internal_osdfunc_help);
OSD_RegisterFunction("help","help: displays help for the specified cvar or command",_internal_osdfunc_help);
OSD_RegisterFunction("osdrows","osdrows: sets the number of visible lines of the OSD",_internal_osdfunc_vars);
OSD_RegisterFunction("logcutoff","logcutoff: sets the maximal line count of the log file",_internal_osdfunc_vars);
OSD_RegisterFunction("clear","clear: clears the console text buffer",_internal_osdfunc_clear);
OSD_RegisterFunction("alias","alias: creates an alias for calling multiple commands",_internal_osdfunc_alias);
OSD_RegisterFunction("unalias","unalias: removes an alias created with \"alias\"",_internal_osdfunc_unalias);
OSD_RegisterFunction("exec","exec <scriptfile>: executes a script", _internal_osdfunc_exec);
OSD_RegisterFunction("osdcompletionstyle","osdcompletionstyle: sets the type of tab completion to be used in the OSD; 0 (default) = bash style, 1 = cycling style",_internal_osdfunc_vars);
OSD_RegisterFunction("osdpromptshade","osdpromptshade: sets the shade of the OSD prompt",_internal_osdfunc_vars);
OSD_RegisterFunction("osdeditshade","osdeditshade: sets the shade of the OSD input text",_internal_osdfunc_vars);
OSD_RegisterFunction("osdtextshade","osdtextshade: sets the shade of the OSD text",_internal_osdfunc_vars);
@ -709,7 +701,6 @@ int OSD_HandleChars(void)
{
if (findsymbol(osdedittmp, tabc->next))
{
char tempbuf[512];
symbol_t *symb=tabc;
int maxwidth = 0, x = 0;
@ -731,18 +722,13 @@ int OSD_HandleChars(void)
lastmatch = symb;
symb=findsymbol(osdedittmp, lastmatch->next);
}
if (!osdcompletionstyle)
{
Bstrncpy(tempbuf,tabc->name,commonsize);
tempbuf[commonsize] = '\0';
}
else Bstrcpy(tempbuf,osdedittmp);
OSD_Printf("Completions for '%s':\n",tempbuf);
OSD_Printf("Completions for '%s':\n",osdedittmp);
maxwidth += 3;
symb = tabc;
OSD_Printf(" ");
// OSD_Printf(" ");
while (symb && symb != lastmatch)
{
tabc = symb;
OSD_Printf("%-*s",maxwidth,symb->name);
x += maxwidth;
lastmatch = symb;
@ -751,8 +737,8 @@ int OSD_HandleChars(void)
{
x = 0;
OSD_Printf("\n");
if (symb && symb != lastmatch)
OSD_Printf(" ");
// if (symb && symb != lastmatch)
// OSD_Printf(" ");
}
}
if (x)
@ -764,12 +750,9 @@ int OSD_HandleChars(void)
}
else
{
if (osdcompletionstyle == 1)
{
tabc = findsymbol(osdedittmp, lastmatch->next);
if (!tabc && lastmatch)
tabc = findsymbol(osdedittmp, NULL); // wrap */
}
tabc = findsymbol(osdedittmp, lastmatch->next);
if (!tabc && lastmatch)
tabc = findsymbol(osdedittmp, NULL); // wrap */
}
if (tabc)
@ -777,7 +760,7 @@ int OSD_HandleChars(void)
for (i=osdeditcursor;i>0;i--) if (osdeditbuf[i-1] == ' ') break;
osdeditlen = i;
for (j=0;tabc->name[j] && osdeditlen <= EDITLENGTH
&& (!osdcompletionstyle?osdeditlen < commonsize:1);i++,j++,osdeditlen++)
&& (osdeditlen < commonsize);i++,j++,osdeditlen++)
osdeditbuf[i] = tabc->name[j];
osdeditcursor = osdeditlen;
osdeditwinend = osdeditcursor;

View file

@ -5684,9 +5684,9 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
#ifdef USE_OPENGL
else if (!Bstrcasecmp(parm->name, "r_usetexcompr"))
else if (!Bstrcasecmp(parm->name, "r_texcompr"))
{
if (showval) { OSD_Printf("r_usetexcompr is %d\n", glusetexcompr); }
if (showval) { OSD_Printf("r_texcompr is %d\n", glusetexcompr); }
else glusetexcompr = (val != 0);
return OSDCMD_OK;
}
@ -5828,15 +5828,15 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm)
else glpolygonmode = val;
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "r_usetexcache"))
else if (!Bstrcasecmp(parm->name, "r_texcache"))
{
if (showval) { OSD_Printf("r_usetexcache is %d\n", glusetexcache); }
if (showval) { OSD_Printf("r_texcache is %d\n", glusetexcache); }
else glusetexcache = (val != 0);
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "r_usetexcachecompression"))
else if (!Bstrcasecmp(parm->name, "r_texcachecompression"))
{
if (showval) { OSD_Printf("r_usetexcachecompression is %d\n", glusetexcachecompression); }
if (showval) { OSD_Printf("r_texcachecompression is %d\n", glusetexcachecompression); }
else glusetexcachecompression = (val != 0);
return OSDCMD_OK;
}
@ -5899,15 +5899,15 @@ static int dumptexturedefs(const osdfuncparm_t *parm)
void polymost_initosdfuncs(void)
{
#ifdef USE_OPENGL
OSD_RegisterFunction("r_usetexcompr","r_usetexcompr: enable/disable OpenGL texture compression",osdcmd_polymostvars);
OSD_RegisterFunction("r_texcompr","r_texcompr: enable/disable OpenGL texture compression",osdcmd_polymostvars);
OSD_RegisterFunction("r_redbluemode","r_redbluemode: enable/disable experimental OpenGL red-blue glasses mode",osdcmd_polymostvars);
OSD_RegisterFunction("r_texturemode", "r_texturemode: changes the texture filtering settings", gltexturemode);
OSD_RegisterFunction("r_textureanisotropy", "r_textureanisotropy: changes the OpenGL texture anisotropy setting", gltextureanisotropy);
OSD_RegisterFunction("r_texturemaxsize","r_texturemaxsize: changes the maximum OpenGL texture size limit",osdcmd_polymostvars);
OSD_RegisterFunction("r_texturemiplevel","r_texturemiplevel: changes the highest OpenGL mipmap level used",osdcmd_polymostvars);
OSD_RegisterFunction("r_polygonmode","r_polygonmode: debugging feature",osdcmd_polymostvars); //FUK
OSD_RegisterFunction("r_usetexcache","r_usetexcache: enable/disable OpenGL compressed texture cache",osdcmd_polymostvars);
OSD_RegisterFunction("r_usetexcachecompression","usetexcachecompression: enable/disable compression of files in the OpenGL compressed texture cache",osdcmd_polymostvars);
OSD_RegisterFunction("r_texcache","r_texcache: enable/disable OpenGL compressed texture cache",osdcmd_polymostvars);
OSD_RegisterFunction("r_texcachecompression","r_texcachecompression: enable/disable compression of files in the OpenGL compressed texture cache",osdcmd_polymostvars);
OSD_RegisterFunction("r_multisample","r_multisample: sets the number of samples used for antialiasing (0 = off)",osdcmd_polymostvars);
OSD_RegisterFunction("r_nvmultisamplehint","r_nvmultisamplehint: enable/disable Nvidia multisampling hinting",osdcmd_polymostvars);
OSD_RegisterFunction("r_shadescale","r_shadescale: multiplier for lighting",osdcmd_polymostvars);

View file

@ -639,14 +639,12 @@ cvarmappings cvar[] =
{ "cl_deathmessages", "cl_deathmessages: enable/disable multiplayer death messages", (void*)&ud.deathmsgs, CVAR_BOOL, 0, 0, 1 },
{ "cl_democams", "cl_democams: enable/disable demo playback cameras", (void*)&ud.democams, CVAR_BOOL, 0, 0, 1 },
{ "cl_drawweapon", "cl_drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 0, 2 },
{ "cl_idplayers", "cl_idplayers: enable/disable name display when aiming at opponents", (void*)&ud.idplayers, CVAR_BOOL, 0, 0, 1 },
{ "cl_messagetime", "cl_messagetime: length of time to display multiplayer chat messages\n", (void*)&ud.msgdisptime, CVAR_INT, 0, 0, 3600 },
{ "cl_showcoords", "cl_showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0, 0, 1 },
{ "cl_showfps", "cl_showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_BOOL, 0, 0, 1 },
{ "cl_viewbob", "cl_viewbob: enable/disable player head bobbing\n", (void*)&ud.viewbob, CVAR_BOOL, 0, 0, 1 },
@ -672,6 +670,8 @@ cvarmappings cvar[] =
{ "pr_gpusmoothing", "pr_gpusmoothing: toggles model animation interpolation", (void*)&pr_gpusmoothing, CVAR_INT, 0, 0, 1 },
#endif
#endif
{ "r_drawweapon", "r_drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 0, 2 },
{ "r_showfps", "r_showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_BOOL, 0, 0, 1 },
{ "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&ud.config.useprecache, CVAR_BOOL, 0, 0, 1 },
{ "snd_ambience", "snd_ambience: enables/disables ambient sounds", (void*)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 0, 1 },
@ -939,13 +939,25 @@ static int osdcmd_bind(const osdfuncparm_t *parm)
if (parm->numparms==0)
{
OSD_Printf("Keybindings:\n");
int j=0;
OSD_Printf("Current key bindings:\n");
for (i=0;i<MAXBOUNDKEYS;i++)
if (*boundkeys[i].name)
{
j++;
OSD_Printf("%-11s = %s\n",boundkeys[i].key,boundkeys[i].name);
}
for (i=0;i<MAXMOUSEBUTTONS;i++)
if (*mousebind[i].name)
{
j++;
OSD_Printf("%-11s = %s\n",mousebind[i].key,mousebind[i].name);
}
if (j == 0)
OSD_Printf("No binds found.\n");
return OSDCMD_OK;
}