mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
More bind shit
git-svn-id: https://svn.eduke32.com/eduke32@834 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c5d1978aa2
commit
13d4b6fb14
9 changed files with 101 additions and 62 deletions
|
@ -174,10 +174,10 @@ static int osdcmd_vars(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
int showval = (parm->numparms < 1);
|
int showval = (parm->numparms < 1);
|
||||||
|
|
||||||
if (!Bstrcasecmp(parm->name, "r_captureformat"))
|
if (!Bstrcasecmp(parm->name, "r_scrcaptureformat"))
|
||||||
{
|
{
|
||||||
const char *fmts[] = {"TGA", "PCX"};
|
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
|
else
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
@ -218,7 +218,7 @@ int baselayer_init(void)
|
||||||
,
|
,
|
||||||
osdfunc_setrendermode);
|
osdfunc_setrendermode);
|
||||||
#endif
|
#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
|
#ifdef SUPERBUILD
|
||||||
OSD_RegisterFunction("r_novoxmips","novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",osdcmd_vars);
|
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);
|
OSD_RegisterFunction("r_voxels","usevoxels: enable/disable automatic sprite->voxel rendering",osdcmd_vars);
|
||||||
|
|
|
@ -725,7 +725,7 @@ int OSD_HandleChars(void)
|
||||||
OSD_Printf("Completions for '%s':\n",osdedittmp);
|
OSD_Printf("Completions for '%s':\n",osdedittmp);
|
||||||
maxwidth += 3;
|
maxwidth += 3;
|
||||||
symb = tabc;
|
symb = tabc;
|
||||||
// OSD_Printf(" ");
|
OSD_Printf(" ");
|
||||||
while (symb && symb != lastmatch)
|
while (symb && symb != lastmatch)
|
||||||
{
|
{
|
||||||
tabc = symb;
|
tabc = symb;
|
||||||
|
@ -737,8 +737,8 @@ int OSD_HandleChars(void)
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
OSD_Printf("\n");
|
OSD_Printf("\n");
|
||||||
// if (symb && symb != lastmatch)
|
if (symb && symb != lastmatch)
|
||||||
// OSD_Printf(" ");
|
OSD_Printf(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (x)
|
if (x)
|
||||||
|
|
|
@ -383,14 +383,14 @@ void CONFIG_ReadKeys(void)
|
||||||
boundkeys[key1].key=Bstrdup(keynames[j].name);
|
boundkeys[key1].key=Bstrdup(keynames[j].name);
|
||||||
else boundkeys[key1].key=Bstrdup(keyname1);
|
else boundkeys[key1].key=Bstrdup(keyname1);
|
||||||
Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(function));
|
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
|
else
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(function));
|
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])
|
if (key2 != 0xff && keyname2[0])
|
||||||
|
@ -403,14 +403,14 @@ void CONFIG_ReadKeys(void)
|
||||||
boundkeys[key2].key=Bstrdup(keynames[j].name);
|
boundkeys[key2].key=Bstrdup(keynames[j].name);
|
||||||
else boundkeys[key2].key=Bstrdup(keyname2);
|
else boundkeys[key2].key=Bstrdup(keyname2);
|
||||||
Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(function));
|
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
|
else
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(function));
|
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);
|
boundkeys[key1].key=Bstrdup(keynames[j].name);
|
||||||
|
|
||||||
Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(which));
|
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
|
else
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(which));
|
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)
|
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);
|
boundkeys[key2].key=Bstrdup(keynames[j].name);
|
||||||
|
|
||||||
Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(which));
|
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
|
else
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(which));
|
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)
|
if ((!key1 || key1 == 0xff) && oldkey1)
|
||||||
boundkeys[oldkey1].name[0] = 0;
|
boundkeys[oldkey1].cmd[0] = 0;
|
||||||
if ((!key2 || key2 == 0xff) && oldkey2)
|
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;
|
symbol_t *symb;
|
||||||
fprintf(fp,"// this file automatically generated by EDuke32\n// do not modify if you lack common sense\n");
|
fprintf(fp,"// this file automatically generated by EDuke32\n// do not modify if you lack common sense\n");
|
||||||
for (i=0;i<MAXBOUNDKEYS;i++)
|
for (i=0;i<MAXBOUNDKEYS;i++)
|
||||||
if (boundkeys[i].key && *boundkeys[i].name)
|
if (boundkeys[i].key && *boundkeys[i].cmd)
|
||||||
fprintf(fp,"bind %s%s \"%s\"\n",boundkeys[i].key,boundkeys[i].repeat?"":" norepeat",boundkeys[i].name);
|
fprintf(fp,"bind %s%s \"%s\"\n",boundkeys[i].key,boundkeys[i].repeat?"":" norepeat",boundkeys[i].cmd);
|
||||||
|
|
||||||
for (i=0;i<MAXMOUSEBUTTONS;i++)
|
for (i=0;i<MAXMOUSEBUTTONS;i++)
|
||||||
if (mousebind[i].key && *mousebind[i].name)
|
if (mousebind[i].key && *mousebind[i].cmd)
|
||||||
fprintf(fp,"bind %s%s \"%s\"\n",mousebind[i].key,mousebind[i].repeat?"":" norepeat",mousebind[i].name);
|
fprintf(fp,"bind %s%s \"%s\"\n",mousebind[i].key,mousebind[i].repeat?"":" norepeat",mousebind[i].cmd);
|
||||||
|
|
||||||
for (symb=symbols; symb!=NULL; symb=symb->next)
|
for (symb=symbols; symb!=NULL; symb=symb->next)
|
||||||
if (symb->func == (void *)OSD_ALIAS)
|
if (symb->func == (void *)OSD_ALIAS)
|
||||||
|
|
|
@ -54,7 +54,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
extern int getversionfromwebsite(char *buffer);
|
extern int getversionfromwebsite(char *buffer);
|
||||||
#define BUILDDATE 20080612
|
#define BUILDDATE 20080702
|
||||||
#define UPDATEINTERVAL 604800 // 1w
|
#define UPDATEINTERVAL 604800 // 1w
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ void getpackets(void)
|
||||||
sampletimer();
|
sampletimer();
|
||||||
AudioUpdate();
|
AudioUpdate();
|
||||||
|
|
||||||
CONTROL_ProcessBinds();
|
// CONTROL_ProcessBinds();
|
||||||
|
|
||||||
if (ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
|
if (ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
|
||||||
{
|
{
|
||||||
|
@ -10718,6 +10718,9 @@ MAIN_LOOP_RESTART:
|
||||||
|
|
||||||
AudioUpdate();
|
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();
|
OSD_DispatchQueued();
|
||||||
|
|
||||||
if (ud.recstat == 2 || ud.multimode > 1 || (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU))
|
if (ud.recstat == 2 || ud.multimode > 1 || (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU))
|
||||||
|
|
|
@ -56,8 +56,8 @@ static int32 ticrate;
|
||||||
static int32 CONTROL_DoubleClickSpeed;
|
static int32 CONTROL_DoubleClickSpeed;
|
||||||
|
|
||||||
int extinput[CONTROL_NUM_FLAGS];
|
int extinput[CONTROL_NUM_FLAGS];
|
||||||
keybind boundkeys[MAXBOUNDKEYS];
|
keybind boundkeys[MAXBOUNDKEYS], mousebind[MAXMOUSEBUTTONS];
|
||||||
keybind mousebind[MAXMOUSEBUTTONS];
|
int bindsenabled = 0;
|
||||||
|
|
||||||
void CONTROL_GetMouseDelta(void)
|
void CONTROL_GetMouseDelta(void)
|
||||||
{
|
{
|
||||||
|
@ -168,10 +168,10 @@ boolean CONTROL_KeyboardFunctionPressed(int32 which)
|
||||||
|
|
||||||
if (!CONTROL_Flags[which].used) return false;
|
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;
|
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;
|
key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? true : false;
|
||||||
|
|
||||||
return (key1 | key2);
|
return (key1 | key2);
|
||||||
|
@ -733,16 +733,19 @@ void CONTROL_ButtonFunctionState(int32 *p1)
|
||||||
|
|
||||||
for (i=0; i<CONTROL_NumMouseButtons; i++)
|
for (i=0; i<CONTROL_NumMouseButtons; i++)
|
||||||
{
|
{
|
||||||
if (mousebind[i].name[0] && CONTROL_MouseButtonState[i])
|
if (bindsenabled)
|
||||||
|
{
|
||||||
|
if (mousebind[i].cmd[0] && CONTROL_MouseButtonState[i])
|
||||||
{
|
{
|
||||||
if (mousebind[i].repeat || (mousebind[i].laststate == 0))
|
if (mousebind[i].repeat || (mousebind[i].laststate == 0))
|
||||||
OSD_Dispatch(mousebind[i].name);
|
OSD_Dispatch(mousebind[i].cmd);
|
||||||
// if (!boundkeys[i].repeat)
|
// if (!boundkeys[i].repeat)
|
||||||
// KB_ClearKeyDown(i);
|
// KB_ClearKeyDown(i);
|
||||||
}
|
}
|
||||||
mousebind[i].laststate = CONTROL_MouseButtonState[i];
|
mousebind[i].laststate = CONTROL_MouseButtonState[i];
|
||||||
|
}
|
||||||
|
|
||||||
if (!mousebind[i].name[0])
|
if (!mousebind[i].cmd[0])
|
||||||
{
|
{
|
||||||
j = CONTROL_MouseButtonMapping[i].doubleclicked;
|
j = CONTROL_MouseButtonMapping[i].doubleclicked;
|
||||||
if (j != KEYUNDEFINED)
|
if (j != KEYUNDEFINED)
|
||||||
|
@ -863,12 +866,14 @@ void CONTROL_ProcessBinds(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0;i<256;i++)
|
if (!bindsenabled) return;
|
||||||
|
|
||||||
|
for (i=0;i<MAXBOUNDKEYS;i++)
|
||||||
{
|
{
|
||||||
if (boundkeys[i].name[0] && KB_KeyPressed(i))
|
if (boundkeys[i].cmd[0] && KB_KeyPressed(i))
|
||||||
{
|
{
|
||||||
if (boundkeys[i].repeat || (boundkeys[i].laststate == 0))
|
if (boundkeys[i].repeat || (boundkeys[i].laststate == 0))
|
||||||
OSD_Dispatch(boundkeys[i].name);
|
OSD_Dispatch(boundkeys[i].cmd);
|
||||||
// if (!boundkeys[i].repeat)
|
// if (!boundkeys[i].repeat)
|
||||||
// KB_ClearKeyDown(i);
|
// KB_ClearKeyDown(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,13 +217,15 @@ void CONTROL_PrintAxes( void );
|
||||||
|
|
||||||
typedef struct binding {
|
typedef struct binding {
|
||||||
char *key;
|
char *key;
|
||||||
char name[MAXBINDSTRINGLENGTH];
|
char cmd[MAXBINDSTRINGLENGTH];
|
||||||
char repeat;
|
char repeat;
|
||||||
char laststate;
|
char laststate;
|
||||||
} keybind;
|
} keybind;
|
||||||
|
|
||||||
extern keybind boundkeys[MAXBOUNDKEYS];
|
#define MAXMOUSEBUTTONS 6
|
||||||
extern keybind mousebind[6]; // FIXME
|
|
||||||
|
extern keybind boundkeys[MAXBOUNDKEYS], mousebind[MAXMOUSEBUTTONS];
|
||||||
|
extern int bindsenabled;
|
||||||
|
|
||||||
void CONTROL_ProcessBinds(void);
|
void CONTROL_ProcessBinds(void);
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ extern kb_scancode KB_LastScan;
|
||||||
|
|
||||||
#define KB_ClearKeyDown( scan ) { keystatus[ ( scan ) ] = FALSE; }
|
#define KB_ClearKeyDown( scan ) { keystatus[ ( scan ) ] = FALSE; }
|
||||||
|
|
||||||
#define KB_UnBoundKeyPressed( scan ) ( keystatus[ ( scan ) ] != 0 && !boundkeys[scan].name[0])
|
#define KB_UnBoundKeyPressed( scan ) ( keystatus[ ( scan ) ] != 0 && !boundkeys[scan].cmd[0])
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
|
|
|
@ -3594,13 +3594,13 @@ cheat_for_port_credits:
|
||||||
{
|
{
|
||||||
ud.config.MouseFunctions[whichkey>>1][whichkey&1] = x;
|
ud.config.MouseFunctions[whichkey>>1][whichkey&1] = x;
|
||||||
CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_mouse);
|
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
|
else
|
||||||
{
|
{
|
||||||
ud.config.MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x;
|
ud.config.MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x;
|
||||||
CONTROL_MapButton(x, whichkey-(MAXMOUSEBUTTONS-2), 0, controldevice_mouse);
|
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);
|
cmenu(205);
|
||||||
probey = whichkey;
|
probey = whichkey;
|
||||||
|
|
|
@ -922,6 +922,7 @@ static int osdcmd_name(const osdfuncparm_t *parm)
|
||||||
static int osdcmd_button(const osdfuncparm_t *parm)
|
static int osdcmd_button(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
char *p = (char *)parm->name+9; // skip "gamefunc_"
|
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
|
extinput[CONFIG_FunctionNameToNum(p)] = 1; // FIXME
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
@ -943,16 +944,16 @@ static int osdcmd_bind(const osdfuncparm_t *parm)
|
||||||
|
|
||||||
OSD_Printf("Current key bindings:\n");
|
OSD_Printf("Current key bindings:\n");
|
||||||
for (i=0;i<MAXBOUNDKEYS;i++)
|
for (i=0;i<MAXBOUNDKEYS;i++)
|
||||||
if (*boundkeys[i].name)
|
if (boundkeys[i].cmd[0])
|
||||||
{
|
{
|
||||||
j++;
|
j++;
|
||||||
OSD_Printf("%-11s = %s\n",boundkeys[i].key,boundkeys[i].name);
|
OSD_Printf("%-11s = %s\n",boundkeys[i].key,boundkeys[i].cmd);
|
||||||
}
|
}
|
||||||
for (i=0;i<MAXMOUSEBUTTONS;i++)
|
for (i=0;i<MAXMOUSEBUTTONS;i++)
|
||||||
if (*mousebind[i].name)
|
if (mousebind[i].cmd[0])
|
||||||
{
|
{
|
||||||
j++;
|
j++;
|
||||||
OSD_Printf("%-11s = %s\n",mousebind[i].key,mousebind[i].name);
|
OSD_Printf("%-11s = %s\n",mousebind[i].key,mousebind[i].cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j == 0)
|
if (j == 0)
|
||||||
|
@ -975,18 +976,27 @@ static int osdcmd_bind(const osdfuncparm_t *parm)
|
||||||
|
|
||||||
if (parm->numparms < 2)
|
if (parm->numparms < 2)
|
||||||
{
|
{
|
||||||
OSD_Printf("%-11s = %s\n",mousenames[i], mousebind[i].name);
|
OSD_Printf("%-11s = %s\n",mousenames[i], mousebind[i].cmd);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
j = 1;
|
j = 1;
|
||||||
|
|
||||||
|
mousebind[i].repeat = 1;
|
||||||
if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat"))
|
if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat"))
|
||||||
{
|
{
|
||||||
mousebind[i].repeat = 0;
|
mousebind[i].repeat = 0;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
else mousebind[i].repeat = 1;
|
|
||||||
Bstrncpy(mousebind[i].name,parm->parms[j], MAXBINDSTRINGLENGTH-1);
|
Bstrcpy(tempbuf,parm->parms[j++]);
|
||||||
|
for (;j<parm->numparms;j++)
|
||||||
|
{
|
||||||
|
Bstrcat(tempbuf," ");
|
||||||
|
Bstrcat(tempbuf,parm->parms[j++]);
|
||||||
|
}
|
||||||
|
Bstrncpy(mousebind[i].cmd,tempbuf, MAXBINDSTRINGLENGTH-1);
|
||||||
|
|
||||||
mousebind[i].key=mousenames[i];
|
mousebind[i].key=mousenames[i];
|
||||||
if (!osdexecscript)
|
if (!osdexecscript)
|
||||||
OSD_Printf("%s\n",parm->raw);
|
OSD_Printf("%s\n",parm->raw);
|
||||||
|
@ -995,18 +1005,27 @@ static int osdcmd_bind(const osdfuncparm_t *parm)
|
||||||
|
|
||||||
if (parm->numparms < 2)
|
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;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
j = 1;
|
j = 1;
|
||||||
|
|
||||||
|
boundkeys[keynames[i].id].repeat = 1;
|
||||||
if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat"))
|
if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat"))
|
||||||
{
|
{
|
||||||
boundkeys[keynames[i].id].repeat = 0;
|
boundkeys[keynames[i].id].repeat = 0;
|
||||||
j++;
|
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 (;j<parm->numparms;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;
|
boundkeys[keynames[i].id].key=keynames[i].name;
|
||||||
if (!osdexecscript)
|
if (!osdexecscript)
|
||||||
OSD_Printf("%s\n",parm->raw);
|
OSD_Printf("%s\n",parm->raw);
|
||||||
|
@ -1020,11 +1039,11 @@ static int osdcmd_unbindall(const osdfuncparm_t *parm)
|
||||||
UNREFERENCED_PARAMETER(parm);
|
UNREFERENCED_PARAMETER(parm);
|
||||||
|
|
||||||
for (i=0;i<MAXBOUNDKEYS;i++)
|
for (i=0;i<MAXBOUNDKEYS;i++)
|
||||||
if (*boundkeys[i].name)
|
if (boundkeys[i].cmd[0])
|
||||||
boundkeys[i].name[0] = 0;
|
boundkeys[i].cmd[0] = 0;
|
||||||
for (i=0;i<MAXMOUSEBUTTONS;i++)
|
for (i=0;i<MAXMOUSEBUTTONS;i++)
|
||||||
if (*mousebind[i].name)
|
if (mousebind[i].cmd[0])
|
||||||
mousebind[i].name[0] = 0;
|
mousebind[i].cmd[0] = 0;
|
||||||
OSD_Printf("unbound all keys\n");
|
OSD_Printf("unbound all keys\n");
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
@ -1045,12 +1064,12 @@ static int osdcmd_unbind(const osdfuncparm_t *parm)
|
||||||
if (i >= MAXMOUSEBUTTONS)
|
if (i >= MAXMOUSEBUTTONS)
|
||||||
return OSDCMD_SHOWHELP;
|
return OSDCMD_SHOWHELP;
|
||||||
mousebind[i].repeat = 0;
|
mousebind[i].repeat = 0;
|
||||||
mousebind[i].name[0] = 0;
|
mousebind[i].cmd[0] = 0;
|
||||||
OSD_Printf("unbound %s\n",mousenames[i]);
|
OSD_Printf("unbound %s\n",mousenames[i]);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
boundkeys[keynames[i].id].repeat = 0;
|
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);
|
OSD_Printf("unbound key %s\n",keynames[i].name);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
@ -1073,6 +1092,14 @@ static int osdcmd_quickload(const osdfuncparm_t *parm)
|
||||||
return OSDCMD_OK;
|
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)
|
int registerosdcommands(void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -1135,6 +1162,8 @@ int registerosdcommands(void)
|
||||||
OSD_RegisterFunction("setvar","setvar <gamevar> <value>: sets the value of a gamevar", osdcmd_setvar);
|
OSD_RegisterFunction("setvar","setvar <gamevar> <value>: sets the value of a gamevar", osdcmd_setvar);
|
||||||
OSD_RegisterFunction("setvarvar","setvar <gamevar> <gamevar>: sets the value of a gamevar", osdcmd_setvar);
|
OSD_RegisterFunction("setvarvar","setvar <gamevar> <gamevar>: sets the value of a gamevar", osdcmd_setvar);
|
||||||
OSD_RegisterFunction("setactorvar","setactorvar <actorID> <gamevar> <value>: sets the value of a gamevar", osdcmd_setactorvar);
|
OSD_RegisterFunction("setactorvar","setactorvar <actorID> <gamevar> <value>: sets the value of a gamevar", osdcmd_setactorvar);
|
||||||
|
OSD_RegisterFunction("screenshot","screenshot: takes a screenshot. See r_scrcaptureformat.", osdcmd_screenshot);
|
||||||
|
|
||||||
OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
|
OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
|
||||||
|
|
||||||
OSD_RegisterFunction("unbind","unbind <key>: unbinds a key.", osdcmd_unbind);
|
OSD_RegisterFunction("unbind","unbind <key>: unbinds a key.", osdcmd_unbind);
|
||||||
|
|
Loading…
Reference in a new issue