diff --git a/polymer/build/src/baselayer.c b/polymer/build/src/baselayer.c index accf50dd4..3df876eca 100644 --- a/polymer/build/src/baselayer.c +++ b/polymer/build/src/baselayer.c @@ -174,10 +174,10 @@ static int osdcmd_vars(const osdfuncparm_t *parm) { int showval = (parm->numparms < 1); - if (!Bstrcasecmp(parm->name, "r_captureformat")) + if (!Bstrcasecmp(parm->name, "r_scrcaptureformat")) { const char *fmts[] = {"TGA", "PCX"}; - if (showval) { OSD_Printf("r_captureformat is %s\n", fmts[captureformat]); } + if (showval) { OSD_Printf("r_scrcaptureformat is %s\n", fmts[captureformat]); } else { int j; @@ -218,7 +218,7 @@ int baselayer_init(void) , osdfunc_setrendermode); #endif - OSD_RegisterFunction("r_captureformat","screencaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars); + OSD_RegisterFunction("r_scrcaptureformat","r_scrcaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars); #ifdef SUPERBUILD OSD_RegisterFunction("r_novoxmips","novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",osdcmd_vars); OSD_RegisterFunction("r_voxels","usevoxels: enable/disable automatic sprite->voxel rendering",osdcmd_vars); diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index f84d40c40..54f6b521b 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -725,7 +725,7 @@ int OSD_HandleChars(void) OSD_Printf("Completions for '%s':\n",osdedittmp); maxwidth += 3; symb = tabc; -// OSD_Printf(" "); + OSD_Printf(" "); while (symb && symb != lastmatch) { tabc = symb; @@ -737,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) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index c6f20b437..9ccaf4e8b 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -383,14 +383,14 @@ void CONFIG_ReadKeys(void) boundkeys[key1].key=Bstrdup(keynames[j].name); else boundkeys[key1].key=Bstrdup(keyname1); Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(function)); - if (!boundkeys[key1].name[0] || !Bstrcasecmp(tempbuf,boundkeys[key1].name)) + if (!boundkeys[key1].cmd[0] || !Bstrcasecmp(tempbuf,boundkeys[key1].cmd)) { - Bstrncpy(boundkeys[key1].name,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncpy(boundkeys[key1].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } else { Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(function)); - Bstrncat(boundkeys[key1].name,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncat(boundkeys[key1].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } } if (key2 != 0xff && keyname2[0]) @@ -403,14 +403,14 @@ void CONFIG_ReadKeys(void) boundkeys[key2].key=Bstrdup(keynames[j].name); else boundkeys[key2].key=Bstrdup(keyname2); Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(function)); - if (!boundkeys[key2].name[0] || !Bstrcasecmp(tempbuf,boundkeys[key2].name)) + if (!boundkeys[key2].cmd[0] || !Bstrcasecmp(tempbuf,boundkeys[key2].cmd)) { - Bstrncpy(boundkeys[key2].name,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncpy(boundkeys[key2].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } else { Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(function)); - Bstrncat(boundkeys[key2].name,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncat(boundkeys[key2].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } } } @@ -440,14 +440,14 @@ void MapKey(int32 which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2 boundkeys[key1].key=Bstrdup(keynames[j].name); Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(which)); - if (!boundkeys[key1].name[0] || !Bstrcasecmp(tempbuf,boundkeys[key1].name)) + if (!boundkeys[key1].cmd[0] || !Bstrcasecmp(tempbuf,boundkeys[key1].cmd)) { - Bstrncpy(boundkeys[key1].name,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncpy(boundkeys[key1].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } else { Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(which)); - Bstrncat(boundkeys[key1].name,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncat(boundkeys[key1].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } } if (key2 && key2 != 0xff) @@ -460,20 +460,20 @@ void MapKey(int32 which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2 boundkeys[key2].key=Bstrdup(keynames[j].name); Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(which)); - if (!boundkeys[key2].name[0] || !Bstrcasecmp(tempbuf,boundkeys[key2].name)) + if (!boundkeys[key2].cmd[0] || !Bstrcasecmp(tempbuf,boundkeys[key2].cmd)) { - Bstrncpy(boundkeys[key2].name,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncpy(boundkeys[key2].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } else { Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(which)); - Bstrncat(boundkeys[key2].name,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncat(boundkeys[key2].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } } if ((!key1 || key1 == 0xff) && oldkey1) - boundkeys[oldkey1].name[0] = 0; + boundkeys[oldkey1].cmd[0] = 0; if ((!key2 || key2 == 0xff) && oldkey2) - boundkeys[oldkey2].name[0] = 0; + boundkeys[oldkey2].cmd[0] = 0; } /* @@ -851,12 +851,12 @@ void CONFIG_WriteBinds(void) // save binds and aliases to disk symbol_t *symb; fprintf(fp,"// this file automatically generated by EDuke32\n// do not modify if you lack common sense\n"); for (i=0;inext) if (symb->func == (void *)OSD_ALIAS) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index b2e6d93e1..1771d47bf 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -54,7 +54,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include extern int getversionfromwebsite(char *buffer); -#define BUILDDATE 20080612 +#define BUILDDATE 20080702 #define UPDATEINTERVAL 604800 // 1w #endif @@ -594,7 +594,7 @@ void getpackets(void) sampletimer(); AudioUpdate(); - CONTROL_ProcessBinds(); +// CONTROL_ProcessBinds(); if (ALT_IS_PRESSED && KB_KeyPressed(sc_Enter)) { @@ -10718,6 +10718,9 @@ MAIN_LOOP_RESTART: AudioUpdate(); + // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo + bindsenabled = (g_player[myconnectindex].ps->gm == MODE_GAME || g_player[myconnectindex].ps->gm == MODE_DEMO); + OSD_DispatchQueued(); if (ud.recstat == 2 || ud.multimode > 1 || (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)) diff --git a/polymer/eduke32/source/jmact/control.c b/polymer/eduke32/source/jmact/control.c index 04ea0d567..852f835f2 100644 --- a/polymer/eduke32/source/jmact/control.c +++ b/polymer/eduke32/source/jmact/control.c @@ -56,8 +56,8 @@ static int32 ticrate; static int32 CONTROL_DoubleClickSpeed; int extinput[CONTROL_NUM_FLAGS]; -keybind boundkeys[MAXBOUNDKEYS]; -keybind mousebind[MAXMOUSEBUTTONS]; +keybind boundkeys[MAXBOUNDKEYS], mousebind[MAXMOUSEBUTTONS]; +int bindsenabled = 0; void CONTROL_GetMouseDelta(void) { @@ -168,10 +168,10 @@ boolean CONTROL_KeyboardFunctionPressed(int32 which) if (!CONTROL_Flags[which].used) return false; - if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED && !boundkeys[CONTROL_KeyMapping[which].key1].name[0]) + if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED && !boundkeys[CONTROL_KeyMapping[which].key1].cmd[0]) key1 = KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] ? true : false; - if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !boundkeys[CONTROL_KeyMapping[which].key1].name[0]) + if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !boundkeys[CONTROL_KeyMapping[which].key1].cmd[0]) key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? true : false; return (key1 | key2); @@ -733,16 +733,19 @@ void CONTROL_ButtonFunctionState(int32 *p1) for (i=0; i>1][whichkey&1] = x; CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_mouse); - mousebind[whichkey>>1].name[0] = 0; + mousebind[whichkey>>1].cmd[0] = 0; // kill the bind when changing the button in the menu } else { ud.config.MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x; CONTROL_MapButton(x, whichkey-(MAXMOUSEBUTTONS-2), 0, controldevice_mouse); - mousebind[whichkey-(MAXMOUSEBUTTONS-2)].name[0] = 0; + mousebind[whichkey-(MAXMOUSEBUTTONS-2)].cmd[0] = 0; } cmenu(205); probey = whichkey; diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 64e9f539a..6360bc86b 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -922,6 +922,7 @@ static int osdcmd_name(const osdfuncparm_t *parm) static int osdcmd_button(const osdfuncparm_t *parm) { char *p = (char *)parm->name+9; // skip "gamefunc_" +// if (g_player[myconnectindex].ps->gm == MODE_GAME) // only trigger these if in game extinput[CONFIG_FunctionNameToNum(p)] = 1; // FIXME return OSDCMD_OK; } @@ -943,16 +944,16 @@ static int osdcmd_bind(const osdfuncparm_t *parm) OSD_Printf("Current key bindings:\n"); for (i=0;inumparms < 2) { - OSD_Printf("%-11s = %s\n",mousenames[i], mousebind[i].name); + OSD_Printf("%-11s = %s\n",mousenames[i], mousebind[i].cmd); return OSDCMD_OK; } j = 1; + + mousebind[i].repeat = 1; if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat")) { mousebind[i].repeat = 0; j++; } - else mousebind[i].repeat = 1; - Bstrncpy(mousebind[i].name,parm->parms[j], MAXBINDSTRINGLENGTH-1); + + Bstrcpy(tempbuf,parm->parms[j++]); + for (;jnumparms;j++) + { + Bstrcat(tempbuf," "); + Bstrcat(tempbuf,parm->parms[j++]); + } + Bstrncpy(mousebind[i].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); + mousebind[i].key=mousenames[i]; if (!osdexecscript) OSD_Printf("%s\n",parm->raw); @@ -995,18 +1005,27 @@ static int osdcmd_bind(const osdfuncparm_t *parm) if (parm->numparms < 2) { - OSD_Printf("%-11s = %s\n",keynames[i].name, boundkeys[keynames[i].id].name); + OSD_Printf("%-11s = %s\n",keynames[i].name, boundkeys[keynames[i].id].cmd); return OSDCMD_OK; } j = 1; + + boundkeys[keynames[i].id].repeat = 1; if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat")) { boundkeys[keynames[i].id].repeat = 0; j++; } - else boundkeys[keynames[i].id].repeat = 1; - Bstrncpy(boundkeys[keynames[i].id].name,parm->parms[j], MAXBINDSTRINGLENGTH-1); + + Bstrcpy(tempbuf,parm->parms[j++]); + for (;jnumparms;j++) + { + Bstrcat(tempbuf," "); + Bstrcat(tempbuf,parm->parms[j++]); + } + Bstrncpy(boundkeys[keynames[i].id].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); + boundkeys[keynames[i].id].key=keynames[i].name; if (!osdexecscript) OSD_Printf("%s\n",parm->raw); @@ -1020,11 +1039,11 @@ static int osdcmd_unbindall(const osdfuncparm_t *parm) UNREFERENCED_PARAMETER(parm); for (i=0;i= MAXMOUSEBUTTONS) return OSDCMD_SHOWHELP; mousebind[i].repeat = 0; - mousebind[i].name[0] = 0; + mousebind[i].cmd[0] = 0; OSD_Printf("unbound %s\n",mousenames[i]); return OSDCMD_OK; } boundkeys[keynames[i].id].repeat = 0; - boundkeys[keynames[i].id].name[0] = 0; + boundkeys[keynames[i].id].cmd[0] = 0; OSD_Printf("unbound key %s\n",keynames[i].name); return OSDCMD_OK; } @@ -1073,6 +1092,14 @@ static int osdcmd_quickload(const osdfuncparm_t *parm) return OSDCMD_OK; } +static int osdcmd_screenshot(const osdfuncparm_t *parm) +{ + UNREFERENCED_PARAMETER(parm); + KB_ClearKeysDown(); + screencapture("duke0000.tga",0); + return OSDCMD_OK; +} + int registerosdcommands(void) { unsigned int i; @@ -1135,6 +1162,8 @@ int registerosdcommands(void) OSD_RegisterFunction("setvar","setvar : sets the value of a gamevar", osdcmd_setvar); OSD_RegisterFunction("setvarvar","setvar : sets the value of a gamevar", osdcmd_setvar); OSD_RegisterFunction("setactorvar","setactorvar : sets the value of a gamevar", osdcmd_setactorvar); + OSD_RegisterFunction("screenshot","screenshot: takes a screenshot. See r_scrcaptureformat.", osdcmd_screenshot); + OSD_RegisterFunction("spawn","spawn [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn); OSD_RegisterFunction("unbind","unbind : unbinds a key.", osdcmd_unbind);