From 01449fc547d9e4de66183c829918abd12dcd2cc0 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 7 Jul 2008 12:35:21 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@843 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/osd.h | 5 ++--- polymer/build/src/osd.c | 22 +++++++++++++++++----- polymer/build/src/sdlayer.c | 2 +- polymer/build/src/winlayer.c | 2 +- polymer/eduke32/source/osdcmds.c | 4 ++-- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/polymer/build/include/osd.h b/polymer/build/include/osd.h index 7760cd9ed..d22d76037 100644 --- a/polymer/build/include/osd.h +++ b/polymer/build/include/osd.h @@ -31,9 +31,8 @@ const char *stripcolorcodes(const char *t); #define OSDCMD_OK 0 #define OSDCMD_SHOWHELP 1 -extern int osdexecscript; -extern int osdkey; - +int OSD_ParsingScript(void); +int OSD_OSDKey(void); int OSD_Exec(const char *szScript); // initializes things diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index bd33151f1..73d93b660 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -52,7 +52,7 @@ static char osdinput=0; // capture input? static int osdhead=0; // topmost visible line number static BFILE *osdlog=NULL; // log filehandle 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 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 char osdhistorybuf[HISTORYDEPTH][EDITLENGTH+1]; // history strings static int osdhistorysize=0; // number of entries in history +static int osdhistorytotal=0; // number of total history entries // 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 // maximal log line count -int logcutoff=120000; -int linecnt; -int osdexecscript=0; +static int logcutoff=120000; +static int linecnt; +static int osdexecscript=0; // presentation parameters static int osdpromptshade=0; @@ -504,7 +505,7 @@ static int _internal_osdfunc_history(const osdfuncparm_t *parm) OSD_Printf("%s\n",parm->raw); for (i=HISTORYDEPTH-1; i>=0;i--) 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; } @@ -800,6 +801,7 @@ int OSD_HandleChar(char ch) Bmemmove(osdhistorybuf[1], osdhistorybuf[0], (HISTORYDEPTH-1)*(EDITLENGTH+1)); Bmemmove(osdhistorybuf[0], osdeditbuf, EDITLENGTH+1); if (osdhistorysize < HISTORYDEPTH) osdhistorysize++; + osdhistorytotal++; if (osdexeccount == HISTORYDEPTH) OSD_Printf("Command Buffer Warning: Failed queueing command " "for execution. Buffer full.\n"); @@ -1575,6 +1577,16 @@ void OSD_SetVersionString(const char *version, int shade, int 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 // appropriately to the lists, sorted. diff --git a/polymer/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index 945973452..3a9c5e642 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -1416,7 +1416,7 @@ int handleevents(void) case SDL_KEYUP: 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 && ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc) { diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index c83af1de7..479ad2cc4 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -4124,7 +4124,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA case WM_CHAR: if (((keyasciififoend+1)&(KEYFIFOSIZ-1)) == keyasciififoplc) 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; keyasciififo[keyasciififoend] = (unsigned char)wParam; keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1)); diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 67298e539..1d1aa6e34 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -1110,7 +1110,7 @@ static int osdcmd_bind(const osdfuncparm_t *parm) Bstrncpy(mousebind[i].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); mousebind[i].key=mousenames[i]; - if (!osdexecscript) + if (!OSD_ParsingScript()) OSD_Printf("%s\n",parm->raw); return OSDCMD_OK; } @@ -1139,7 +1139,7 @@ static int osdcmd_bind(const osdfuncparm_t *parm) Bstrncpy(boundkeys[keynames[i].id].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); boundkeys[keynames[i].id].key=keynames[i].name; - if (!osdexecscript) + if (!OSD_ParsingScript()) OSD_Printf("%s\n",parm->raw); return OSDCMD_OK; }