mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@847 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
eece4e2b75
commit
098c99e3f7
1 changed files with 94 additions and 105 deletions
|
@ -542,21 +542,21 @@ void OSD_Init(void)
|
||||||
|
|
||||||
osdinited=1;
|
osdinited=1;
|
||||||
|
|
||||||
OSD_RegisterFunction("alias","alias: creates an alias for calling multiple commands",_internal_osdfunc_alias);
|
OSD_RegisterFunction("alias","alias: creates an alias for calling multiple commands",_internal_osdfunc_alias);
|
||||||
OSD_RegisterFunction("clear","clear: clears the console text buffer",_internal_osdfunc_clear);
|
OSD_RegisterFunction("clear","clear: clears the console text buffer",_internal_osdfunc_clear);
|
||||||
OSD_RegisterFunction("exec","exec <scriptfile>: executes a script", _internal_osdfunc_exec);
|
OSD_RegisterFunction("exec","exec <scriptfile>: executes a script", _internal_osdfunc_exec);
|
||||||
OSD_RegisterFunction("help","help: displays help for the specified cvar or command; \"listsymbols\" to show all commands",_internal_osdfunc_help);
|
OSD_RegisterFunction("help","help: displays help for the specified cvar or command; \"listsymbols\" to show all commands",_internal_osdfunc_help);
|
||||||
OSD_RegisterFunction("history","history: displays the console command history",_internal_osdfunc_history);
|
OSD_RegisterFunction("history","history: displays the console command history",_internal_osdfunc_history);
|
||||||
OSD_RegisterFunction("listsymbols","listsymbols: lists all the recognized symbols",_internal_osdfunc_listsymbols);
|
OSD_RegisterFunction("listsymbols","listsymbols: lists all the recognized symbols",_internal_osdfunc_listsymbols);
|
||||||
OSD_RegisterFunction("logcutoff","logcutoff: sets the maximal line count of the log file",_internal_osdfunc_vars);
|
OSD_RegisterFunction("logcutoff","logcutoff: sets the maximal line count of the log file",_internal_osdfunc_vars);
|
||||||
OSD_RegisterFunction("osdeditpal","osdeditpal: sets the palette of the OSD input text",_internal_osdfunc_vars);
|
OSD_RegisterFunction("osdeditpal","osdeditpal: sets the palette of the OSD input text",_internal_osdfunc_vars);
|
||||||
OSD_RegisterFunction("osdeditshade","osdeditshade: sets the shade of the OSD input text",_internal_osdfunc_vars);
|
OSD_RegisterFunction("osdeditshade","osdeditshade: sets the shade of the OSD input text",_internal_osdfunc_vars);
|
||||||
OSD_RegisterFunction("osdpromptpal","osdpromptpal: sets the palette of the OSD prompt",_internal_osdfunc_vars);
|
OSD_RegisterFunction("osdpromptpal","osdpromptpal: sets the palette of the OSD prompt",_internal_osdfunc_vars);
|
||||||
OSD_RegisterFunction("osdpromptshade","osdpromptshade: sets the shade of the OSD prompt",_internal_osdfunc_vars);
|
OSD_RegisterFunction("osdpromptshade","osdpromptshade: sets the shade of the OSD prompt",_internal_osdfunc_vars);
|
||||||
OSD_RegisterFunction("osdrows","osdrows: sets the number of visible lines of the OSD",_internal_osdfunc_vars);
|
OSD_RegisterFunction("osdrows","osdrows: sets the number of visible lines of the OSD",_internal_osdfunc_vars);
|
||||||
OSD_RegisterFunction("osdtextpal","osdtextpal: sets the palette of the OSD text",_internal_osdfunc_vars);
|
OSD_RegisterFunction("osdtextpal","osdtextpal: sets the palette of the OSD text",_internal_osdfunc_vars);
|
||||||
OSD_RegisterFunction("osdtextshade","osdtextshade: sets the shade of the OSD text",_internal_osdfunc_vars);
|
OSD_RegisterFunction("osdtextshade","osdtextshade: sets the shade of the OSD text",_internal_osdfunc_vars);
|
||||||
OSD_RegisterFunction("unalias","unalias: removes an alias created with \"alias\"",_internal_osdfunc_unalias);
|
OSD_RegisterFunction("unalias","unalias: removes an alias created with \"alias\"",_internal_osdfunc_unalias);
|
||||||
|
|
||||||
atexit(OSD_Cleanup);
|
atexit(OSD_Cleanup);
|
||||||
}
|
}
|
||||||
|
@ -656,59 +656,56 @@ static int OSD_FindDiffPoint(const char *str1, const char *str2)
|
||||||
|
|
||||||
static void OSD_HistoryPrev(void)
|
static void OSD_HistoryPrev(void)
|
||||||
{
|
{
|
||||||
if (osdhistorypos < osdhistorysize-1)
|
if (osdhistorypos >= osdhistorysize-1) return;
|
||||||
{
|
|
||||||
osdhistorypos++;
|
|
||||||
memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
|
|
||||||
osdeditlen = osdeditcursor = 0;
|
|
||||||
while (osdeditbuf[osdeditcursor]) osdeditlen++, osdeditcursor++;
|
|
||||||
if (osdeditcursor<osdeditwinstart)
|
|
||||||
{
|
|
||||||
osdeditwinend = osdeditcursor;
|
|
||||||
osdeditwinstart = osdeditwinend-editlinewidth;
|
|
||||||
|
|
||||||
if (osdeditwinstart<0)
|
osdhistorypos++;
|
||||||
osdeditwinend-=osdeditwinstart,
|
memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
|
||||||
osdeditwinstart=0;
|
osdeditlen = osdeditcursor = 0;
|
||||||
}
|
while (osdeditbuf[osdeditcursor]) osdeditlen++, osdeditcursor++;
|
||||||
else if (osdeditcursor>=osdeditwinend)
|
if (osdeditcursor<osdeditwinstart)
|
||||||
osdeditwinstart+=(osdeditcursor-osdeditwinend),
|
{
|
||||||
osdeditwinend+=(osdeditcursor-osdeditwinend);
|
osdeditwinend = osdeditcursor;
|
||||||
|
osdeditwinstart = osdeditwinend-editlinewidth;
|
||||||
|
|
||||||
|
if (osdeditwinstart<0)
|
||||||
|
osdeditwinend-=osdeditwinstart,
|
||||||
|
osdeditwinstart=0;
|
||||||
}
|
}
|
||||||
|
else if (osdeditcursor>=osdeditwinend)
|
||||||
|
osdeditwinstart+=(osdeditcursor-osdeditwinend),
|
||||||
|
osdeditwinend+=(osdeditcursor-osdeditwinend);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OSD_HistoryNext(void)
|
static void OSD_HistoryNext(void)
|
||||||
{
|
{
|
||||||
if (osdhistorypos >= 0)
|
if (osdhistorypos < 0) return;
|
||||||
{
|
|
||||||
if (osdhistorypos == 0)
|
|
||||||
{
|
|
||||||
osdeditlen=0;
|
|
||||||
osdeditcursor=0;
|
|
||||||
osdeditwinstart=0;
|
|
||||||
osdeditwinend=editlinewidth;
|
|
||||||
osdhistorypos = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
osdhistorypos--;
|
|
||||||
memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
|
|
||||||
osdeditlen = osdeditcursor = 0;
|
|
||||||
while (osdeditbuf[osdeditcursor]) osdeditlen++, osdeditcursor++;
|
|
||||||
if (osdeditcursor<osdeditwinstart)
|
|
||||||
{
|
|
||||||
osdeditwinend = osdeditcursor;
|
|
||||||
osdeditwinstart = osdeditwinend-editlinewidth;
|
|
||||||
|
|
||||||
if (osdeditwinstart<0)
|
if (osdhistorypos == 0)
|
||||||
osdeditwinend-=osdeditwinstart,
|
{
|
||||||
osdeditwinstart=0;
|
osdeditlen=0;
|
||||||
}
|
osdeditcursor=0;
|
||||||
else if (osdeditcursor>=osdeditwinend)
|
osdeditwinstart=0;
|
||||||
osdeditwinstart+=(osdeditcursor-osdeditwinend),
|
osdeditwinend=editlinewidth;
|
||||||
osdeditwinend+=(osdeditcursor-osdeditwinend);
|
osdhistorypos = -1;
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
osdhistorypos--;
|
||||||
|
memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
|
||||||
|
osdeditlen = osdeditcursor = 0;
|
||||||
|
while (osdeditbuf[osdeditcursor]) osdeditlen++, osdeditcursor++;
|
||||||
|
if (osdeditcursor<osdeditwinstart)
|
||||||
|
{
|
||||||
|
osdeditwinend = osdeditcursor;
|
||||||
|
osdeditwinstart = osdeditwinend-editlinewidth;
|
||||||
|
|
||||||
|
if (osdeditwinstart<0)
|
||||||
|
osdeditwinend-=osdeditwinstart,
|
||||||
|
osdeditwinstart=0;
|
||||||
|
}
|
||||||
|
else if (osdeditcursor>=osdeditwinend)
|
||||||
|
osdeditwinstart+=(osdeditcursor-osdeditwinend),
|
||||||
|
osdeditwinend+=(osdeditcursor-osdeditwinend);
|
||||||
}
|
}
|
||||||
|
|
||||||
int OSD_HandleChar(char ch)
|
int OSD_HandleChar(char ch)
|
||||||
|
@ -781,58 +778,50 @@ int OSD_HandleChar(char ch)
|
||||||
{
|
{
|
||||||
tabc = findsymbol(osdedittmp, NULL);
|
tabc = findsymbol(osdedittmp, NULL);
|
||||||
|
|
||||||
if (tabc)
|
if (tabc && tabc->next && findsymbol(osdedittmp, tabc->next))
|
||||||
{
|
{
|
||||||
if (tabc->next)
|
symbol_t *symb=tabc;
|
||||||
|
int maxwidth = 0, x = 0, num = 0;
|
||||||
|
|
||||||
|
while (symb && symb != lastmatch)
|
||||||
{
|
{
|
||||||
if (findsymbol(osdedittmp, tabc->next))
|
int diffpt;
|
||||||
|
|
||||||
|
num++;
|
||||||
|
|
||||||
|
if (lastmatch)
|
||||||
{
|
{
|
||||||
symbol_t *symb=tabc;
|
diffpt = OSD_FindDiffPoint(symb->name,lastmatch->name);
|
||||||
int maxwidth = 0, x = 0, num = 0;
|
if (diffpt < commonsize)
|
||||||
|
|
||||||
while (symb && symb != lastmatch)
|
|
||||||
{
|
{
|
||||||
int diffpt;
|
commonsize = diffpt;
|
||||||
|
// OSD_Printf("commonsize %d\n",commonsize);
|
||||||
num++;
|
|
||||||
|
|
||||||
if (lastmatch)
|
|
||||||
{
|
|
||||||
diffpt = OSD_FindDiffPoint(symb->name,lastmatch->name);
|
|
||||||
if (diffpt < commonsize)
|
|
||||||
{
|
|
||||||
commonsize = diffpt;
|
|
||||||
// OSD_Printf("commonsize %d\n",commonsize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
maxwidth = max((unsigned)maxwidth,Bstrlen(symb->name));
|
|
||||||
lastmatch = symb;
|
|
||||||
symb=findsymbol(osdedittmp, lastmatch->next);
|
|
||||||
}
|
}
|
||||||
OSD_Printf("Found %d possible completions for '%s':\n",num,osdedittmp);
|
}
|
||||||
maxwidth += 3;
|
|
||||||
symb = tabc;
|
maxwidth = max((unsigned)maxwidth,Bstrlen(symb->name));
|
||||||
OSD_Printf(" ");
|
lastmatch = symb;
|
||||||
while (symb && symb != lastmatch)
|
symb=findsymbol(osdedittmp, lastmatch->next);
|
||||||
{
|
}
|
||||||
tabc = symb;
|
OSD_Printf("Found %d possible completions for '%s':\n",num,osdedittmp);
|
||||||
OSD_Printf("%-*s",maxwidth,symb->name);
|
maxwidth += 3;
|
||||||
x += maxwidth;
|
symb = tabc;
|
||||||
lastmatch = symb;
|
OSD_Printf(" ");
|
||||||
symb=findsymbol(osdedittmp, lastmatch->next);
|
while (symb && (symb != lastmatch))
|
||||||
if (x > osdcols - maxwidth)
|
{
|
||||||
{
|
tabc = lastmatch = symb;
|
||||||
x = 0;
|
OSD_Printf("%-*s",maxwidth,symb->name);
|
||||||
OSD_Printf("\n");
|
symb=findsymbol(osdedittmp, lastmatch->next);
|
||||||
if (symb && symb != lastmatch)
|
x += maxwidth;
|
||||||
OSD_Printf(" ");
|
if (x > (osdcols - maxwidth))
|
||||||
}
|
{
|
||||||
}
|
x = 0;
|
||||||
if (x)
|
OSD_Printf("\n");
|
||||||
OSD_Printf("\n");
|
if (symb && (symb != lastmatch))
|
||||||
|
OSD_Printf(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (x) OSD_Printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue