git-svn-id: https://svn.eduke32.com/eduke32@843 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-07-07 12:35:21 +00:00
parent e67f7bd94a
commit 01449fc547
5 changed files with 23 additions and 12 deletions

View file

@ -31,9 +31,8 @@ const char *stripcolorcodes(const char *t);
#define OSDCMD_OK 0 #define OSDCMD_OK 0
#define OSDCMD_SHOWHELP 1 #define OSDCMD_SHOWHELP 1
extern int osdexecscript; int OSD_ParsingScript(void);
extern int osdkey; int OSD_OSDKey(void);
int OSD_Exec(const char *szScript); int OSD_Exec(const char *szScript);
// initializes things // initializes things

View file

@ -52,7 +52,7 @@ static char osdinput=0; // capture input?
static int osdhead=0; // topmost visible line number static int osdhead=0; // topmost visible line number
static BFILE *osdlog=NULL; // log filehandle static BFILE *osdlog=NULL; // log filehandle
static char osdinited=0; // text buffer initialized? static char osdinited=0; // text buffer initialized?
int osdkey=0x29; // tilde shows the osd static int osdkey=0x29; // tilde shows the osd
static int keytime=0; static int keytime=0;
static int osdscrtime = 0; static int osdscrtime = 0;
@ -75,15 +75,16 @@ static int osdeditwinend=60-1-3;
static int osdhistorypos=-1; // position we are at in the history buffer static int osdhistorypos=-1; // position we are at in the history buffer
static char osdhistorybuf[HISTORYDEPTH][EDITLENGTH+1]; // history strings static char osdhistorybuf[HISTORYDEPTH][EDITLENGTH+1]; // history strings
static int osdhistorysize=0; // number of entries in history static int osdhistorysize=0; // number of entries in history
static int osdhistorytotal=0; // number of total history entries
// execution buffer // execution buffer
// the execution buffer works from the command history // 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 osdexeccount=0; // number of lines from the head of the history buffer to execute
// maximal log line count // maximal log line count
int logcutoff=120000; static int logcutoff=120000;
int linecnt; static int linecnt;
int osdexecscript=0; static int osdexecscript=0;
// presentation parameters // presentation parameters
static int osdpromptshade=0; static int osdpromptshade=0;
@ -504,7 +505,7 @@ static int _internal_osdfunc_history(const osdfuncparm_t *parm)
OSD_Printf("%s\n",parm->raw); OSD_Printf("%s\n",parm->raw);
for (i=HISTORYDEPTH-1; i>=0;i--) for (i=HISTORYDEPTH-1; i>=0;i--)
if (osdhistorybuf[i][0]) if (osdhistorybuf[i][0])
OSD_Printf("%4d \"%s\"\n",++j,osdhistorybuf[i]); OSD_Printf("%4d \"%s\"\n",osdhistorytotal-osdhistorysize+(++j),osdhistorybuf[i]);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -800,6 +801,7 @@ int OSD_HandleChar(char ch)
Bmemmove(osdhistorybuf[1], osdhistorybuf[0], (HISTORYDEPTH-1)*(EDITLENGTH+1)); Bmemmove(osdhistorybuf[1], osdhistorybuf[0], (HISTORYDEPTH-1)*(EDITLENGTH+1));
Bmemmove(osdhistorybuf[0], osdeditbuf, EDITLENGTH+1); Bmemmove(osdhistorybuf[0], osdeditbuf, EDITLENGTH+1);
if (osdhistorysize < HISTORYDEPTH) osdhistorysize++; if (osdhistorysize < HISTORYDEPTH) osdhistorysize++;
osdhistorytotal++;
if (osdexeccount == HISTORYDEPTH) if (osdexeccount == HISTORYDEPTH)
OSD_Printf("Command Buffer Warning: Failed queueing command " OSD_Printf("Command Buffer Warning: Failed queueing command "
"for execution. Buffer full.\n"); "for execution. Buffer full.\n");
@ -1575,6 +1577,16 @@ void OSD_SetVersionString(const char *version, int shade, int pal)
osdversionstringpal = pal; osdversionstringpal = pal;
} }
int OSD_ParsingScript(void)
{
return osdexecscript;
}
int OSD_OSDKey(void)
{
return osdkey;
}
// //
// addnewsymbol() -- Allocates space for a new symbol and attaches it // addnewsymbol() -- Allocates space for a new symbol and attaches it
// appropriately to the lists, sorted. // appropriately to the lists, sorted.

View file

@ -1416,7 +1416,7 @@ int handleevents(void)
case SDL_KEYUP: case SDL_KEYUP:
code = keytranslation[ev.key.keysym.sym]; code = keytranslation[ev.key.keysym.sym];
if (code != osdkey && ev.key.keysym.unicode != 0 && ev.key.type == SDL_KEYDOWN && if (code != OSD_OSDKey() && ev.key.keysym.unicode != 0 && ev.key.type == SDL_KEYDOWN &&
(ev.key.keysym.unicode & 0xff80) == 0 && (ev.key.keysym.unicode & 0xff80) == 0 &&
((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc) ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
{ {

View file

@ -4124,7 +4124,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
case WM_CHAR: case WM_CHAR:
if (((keyasciififoend+1)&(KEYFIFOSIZ-1)) == keyasciififoplc) return 0; if (((keyasciififoend+1)&(KEYFIFOSIZ-1)) == keyasciififoplc) return 0;
if ((keyasciififoend - keyasciififoplc) > 0) return 0; if ((keyasciififoend - keyasciififoplc) > 0) return 0;
if (Btolower(scantoasc[osdkey]) == Btolower((unsigned char)wParam)) return 0; if (Btolower(scantoasc[OSD_OSDKey()]) == Btolower((unsigned char)wParam)) return 0;
if (!OSD_HandleChar((unsigned char)wParam)) return 0; if (!OSD_HandleChar((unsigned char)wParam)) return 0;
keyasciififo[keyasciififoend] = (unsigned char)wParam; keyasciififo[keyasciififoend] = (unsigned char)wParam;
keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1)); keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1));

View file

@ -1110,7 +1110,7 @@ static int osdcmd_bind(const osdfuncparm_t *parm)
Bstrncpy(mousebind[i].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); Bstrncpy(mousebind[i].cmd,tempbuf, MAXBINDSTRINGLENGTH-1);
mousebind[i].key=mousenames[i]; mousebind[i].key=mousenames[i];
if (!osdexecscript) if (!OSD_ParsingScript())
OSD_Printf("%s\n",parm->raw); OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1139,7 +1139,7 @@ static int osdcmd_bind(const osdfuncparm_t *parm)
Bstrncpy(boundkeys[keynames[i].id].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); Bstrncpy(boundkeys[keynames[i].id].cmd,tempbuf, MAXBINDSTRINGLENGTH-1);
boundkeys[keynames[i].id].key=keynames[i].name; boundkeys[keynames[i].id].key=keynames[i].name;
if (!osdexecscript) if (!OSD_ParsingScript())
OSD_Printf("%s\n",parm->raw); OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK; return OSDCMD_OK;
} }