Rename a few variables we've added to MACT over the years to be more consistent with the rest of its naming conventions

git-svn-id: https://svn.eduke32.com/eduke32@3195 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-11-17 16:47:47 +00:00
parent f779b53c0f
commit 11a5000630
7 changed files with 69 additions and 68 deletions

View file

@ -151,8 +151,8 @@ void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN])
Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys));
Bmemset(&KeyBindings,0,sizeof(KeyBindings));
Bmemset(&MouseBindings,0,sizeof(MouseBindings));
Bmemset(&CONTROL_KeyBinds,0,sizeof(CONTROL_KeyBinds));
Bmemset(&CONTROL_MouseBinds,0,sizeof(CONTROL_MouseBinds));
for (i=0; i < (int32_t)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3)
{
@ -347,10 +347,10 @@ void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scan
if (ii[k] == ConsoleKeys[j].id)
break;
if (ConsoleKeys[j].name)
KeyBindings[ii[k]].key=Bstrdup(ConsoleKeys[j].name);
CONTROL_KeyBinds[ii[k]].key=Bstrdup(ConsoleKeys[j].name);
KeyBindings[ii[k]].repeat = 1;
KeyBindings[ii[k]].cmd[0] = 0;
CONTROL_KeyBinds[ii[k]].repeat = 1;
CONTROL_KeyBinds[ii[k]].cmd[0] = 0;
tempbuf[0] = 0;
for (i=NUMGAMEFUNCTIONS-1; i>=0; i--)
@ -362,11 +362,11 @@ void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scan
}
}
Bstrncpyz(KeyBindings[ii[k]].cmd, tempbuf, MAXBINDSTRINGLENGTH);
Bstrncpyz(CONTROL_KeyBinds[ii[k]].cmd, tempbuf, MAXBINDSTRINGLENGTH);
i = Bstrlen(KeyBindings[ii[k]].cmd);
i = Bstrlen(CONTROL_KeyBinds[ii[k]].cmd);
if (i)
KeyBindings[ii[k]].cmd[i-2] = 0; // cut off the trailing "; "
CONTROL_KeyBinds[ii[k]].cmd[i-2] = 0; // cut off the trailing "; "
}
}
@ -734,12 +734,12 @@ void CONFIG_WriteBinds(void) // save binds and aliases to <cfgname>_settings.cfg
Bfprintf(fp,"unbindall\n");
for (i=0; i<MAXBOUNDKEYS; i++)
if (KeyBindings[i].cmd[0] && KeyBindings[i].key)
Bfprintf(fp,"bind \"%s\"%s \"%s\"\n",KeyBindings[i].key,KeyBindings[i].repeat?"":" norepeat",KeyBindings[i].cmd);
if (CONTROL_KeyBinds[i].cmd[0] && CONTROL_KeyBinds[i].key)
Bfprintf(fp,"bind \"%s\"%s \"%s\"\n",CONTROL_KeyBinds[i].key,CONTROL_KeyBinds[i].repeat?"":" norepeat",CONTROL_KeyBinds[i].cmd);
for (i=0; i<MAXMOUSEBUTTONS; i++)
if (MouseBindings[i].cmd[0])
Bfprintf(fp,"bind \"%s\"%s \"%s\"\n",MouseBindings[i].key,MouseBindings[i].repeat?"":" norepeat",MouseBindings[i].cmd);
if (CONTROL_MouseBinds[i].cmd[0])
Bfprintf(fp,"bind \"%s\"%s \"%s\"\n",CONTROL_MouseBinds[i].key,CONTROL_MouseBinds[i].repeat?"":" norepeat",CONTROL_MouseBinds[i].cmd);
for (symb=symbols; symb!=NULL; symb=symb->next)
if (symb->func == (void *)OSD_ALIAS)

View file

@ -10616,7 +10616,7 @@ MAIN_LOOP_RESTART:
Net_GetPackets();
// 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|MODE_DEMO);
CONTROL_BindsEnabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO);
#ifndef _WIN32
// stdin -> OSD input for dedicated server
@ -11005,7 +11005,7 @@ void G_BonusScreen(int32_t bonusonly)
FX_StopAllSounds();
S_ClearSoundLocks();
FX_SetReverb(0L);
bindsenabled = 1; // so you can use your screenshot bind on the score screens
CONTROL_BindsEnabled = 1; // so you can use your screenshot bind on the score screens
if (bonusonly) goto FRAGBONUS;

View file

@ -54,10 +54,11 @@ int32_t CONTROL_Started = FALSE;
//static int32_t ticrate;
static int32_t CONTROL_DoubleClickSpeed;
int32_t extinput[CONTROL_NUM_FLAGS];
keybind KeyBindings[MAXBOUNDKEYS], MouseBindings[MAXMOUSEBUTTONS];
int32_t bindsenabled = 0;
int32_t control_smoothmouse = 0;
int32_t CONTROL_OSDInput[CONTROL_NUM_FLAGS];
keybind CONTROL_KeyBinds[MAXBOUNDKEYS];
keybind CONTROL_MouseBinds[MAXMOUSEBUTTONS];
int32_t CONTROL_BindsEnabled = 0;
int32_t CONTROL_SmoothMouse = 0;
static void CONTROL_GetMouseDelta(void)
{
@ -65,7 +66,7 @@ static void CONTROL_GetMouseDelta(void)
MOUSE_GetDelta(&x, &y);
if (control_smoothmouse)
if (CONTROL_SmoothMouse)
{
static int32_t lastx = 0, lasty = 0;
@ -682,7 +683,7 @@ static void CONTROL_ButtonFunctionState(int32_t *p1)
do
{
if (!MouseBindings[i].cmd[0])
if (!CONTROL_MouseBinds[i].cmd[0])
{
j = CONTROL_MouseButtonMapping[i].doubleclicked;
if (j != KEYUNDEFINED)
@ -693,15 +694,15 @@ static void CONTROL_ButtonFunctionState(int32_t *p1)
p1[j] |= CONTROL_MouseButtonState[i];
}
if (!bindsenabled)
if (!CONTROL_BindsEnabled)
continue;
if (MouseBindings[i].cmd[0] && CONTROL_MouseButtonState[i])
if (CONTROL_MouseBinds[i].cmd[0] && CONTROL_MouseButtonState[i])
{
if (MouseBindings[i].repeat || (MouseBindings[i].laststate == 0))
OSD_Dispatch(MouseBindings[i].cmd);
if (CONTROL_MouseBinds[i].repeat || (CONTROL_MouseBinds[i].laststate == 0))
OSD_Dispatch(CONTROL_MouseBinds[i].cmd);
}
MouseBindings[i].laststate = CONTROL_MouseButtonState[i];
CONTROL_MouseBinds[i].laststate = CONTROL_MouseButtonState[i];
}
while (i--);
}
@ -735,19 +736,19 @@ void CONTROL_ProcessBinds(void)
{
int32_t i=MAXBOUNDKEYS-1;
if (!bindsenabled)
if (!CONTROL_BindsEnabled)
return;
do
{
if (KeyBindings[i].cmd[0])
if (CONTROL_KeyBinds[i].cmd[0])
{
if (KB_KeyPressed(i) && (KeyBindings[i].repeat || (KeyBindings[i].laststate == 0)))
if (KB_KeyPressed(i) && (CONTROL_KeyBinds[i].repeat || (CONTROL_KeyBinds[i].laststate == 0)))
{
OSD_Dispatch(KeyBindings[i].cmd);
OSD_Dispatch(CONTROL_KeyBinds[i].cmd);
}
KeyBindings[i].laststate = KB_KeyPressed(i);
CONTROL_KeyBinds[i].laststate = KB_KeyPressed(i);
}
}
while (i--);
@ -767,14 +768,14 @@ static void CONTROL_GetFunctionInput(void)
do
{
CONTROL_SetFlag(i, /*CONTROL_KeyboardFunctionPressed(i) | */periphs[i] | extinput[i]);
CONTROL_SetFlag(i, /*CONTROL_KeyboardFunctionPressed(i) | */periphs[i] | CONTROL_OSDInput[i]);
if (CONTROL_Flags[i].cleared == FALSE) BUTTONSET(i, CONTROL_Flags[i].active);
else if (CONTROL_Flags[i].active == FALSE) CONTROL_Flags[i].cleared = 0;
}
while (i--);
memset(extinput, 0, sizeof(extinput));
memset(CONTROL_OSDInput, 0, sizeof(CONTROL_OSDInput));
}
void CONTROL_GetInput(ControlInfo *info)

View file

@ -210,14 +210,14 @@ typedef struct binding {
#define MAXMOUSEBUTTONS 10
extern keybind KeyBindings[MAXBOUNDKEYS], MouseBindings[MAXMOUSEBUTTONS];
extern int32_t bindsenabled;
extern keybind CONTROL_KeyBinds[MAXBOUNDKEYS], CONTROL_MouseBinds[MAXMOUSEBUTTONS];
extern int32_t CONTROL_BindsEnabled;
void CONTROL_ProcessBinds(void);
#define CONTROL_NUM_FLAGS 64
extern int32_t extinput[CONTROL_NUM_FLAGS];
extern int32_t control_smoothmouse;
extern int32_t CONTROL_OSDInput[CONTROL_NUM_FLAGS];
extern int32_t CONTROL_SmoothMouse;
#ifdef EXTERNC
};

View file

@ -78,7 +78,7 @@ extern kb_scancode KB_LastScan;
#define KB_ClearKeyDown( scan ) { keystatus[ ( scan ) ] = FALSE; }
#define KB_UnBoundKeyPressed( scan ) ( keystatus[ ( scan ) ] != 0 && !KeyBindings[scan].cmd[0])
#define KB_UnBoundKeyPressed( scan ) ( keystatus[ ( scan ) ] != 0 && !CONTROL_KeyBinds[scan].cmd[0])
/*
=============================================================================

View file

@ -3833,7 +3833,7 @@ cheat_for_port_credits2:
{
//input smoothing
ud.config.SmoothInput = !ud.config.SmoothInput;
control_smoothmouse = ud.config.SmoothInput;
CONTROL_SmoothMouse = ud.config.SmoothInput;
}
else if (x == NUMMOUSEFUNCTIONS+2+2)
{
@ -3912,7 +3912,7 @@ cheat_for_port_credits2:
if (probey == NUMMOUSEFUNCTIONS+2+1)
{
// mgametext(160,160+9,"This option incurs a movement delay",0,2+8+16);
control_smoothmouse = ud.config.SmoothInput;
CONTROL_SmoothMouse = ud.config.SmoothInput;
}
mgametextpal(240,118+9, g_myAimMode && !ud.mouseaiming ? "Yes" : "No",
@ -3973,13 +3973,13 @@ cheat_for_port_credits2:
{
ud.config.MouseFunctions[whichkey>>1][whichkey&1] = x;
CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_mouse);
MouseBindings[whichkey>>1].cmd[0] = 0; // kill the bind when changing the button in the menu
CONTROL_MouseBinds[whichkey>>1].cmd[0] = 0; // kill the bind when changing the button in the menu
}
else
{
ud.config.MouseFunctions[whichkey-NUMDOUBLEMBTNS][0] = x;
CONTROL_MapButton(x, whichkey-NUMDOUBLEMBTNS, 0, controldevice_mouse);
MouseBindings[whichkey-NUMDOUBLEMBTNS].cmd[0] = 0;
CONTROL_MouseBinds[whichkey-NUMDOUBLEMBTNS].cmd[0] = 0;
}
M_ChangeMenu(205);
probey = whichkey;

View file

@ -785,7 +785,7 @@ static int32_t 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
CONTROL_OSDInput[CONFIG_FunctionNameToNum(p)] = 1; // FIXME
return OSDCMD_OK;
}
@ -921,19 +921,19 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
OSD_Printf("Current key bindings:\n");
for (i=0; i<MAXBOUNDKEYS; i++)
if (KeyBindings[i].cmd[0] && KeyBindings[i].key)
if (CONTROL_KeyBinds[i].cmd[0] && CONTROL_KeyBinds[i].key)
{
j++;
OSD_Printf("%-9s %s\"%s\"\n", KeyBindings[i].key, KeyBindings[i].repeat?"":"norepeat ",
KeyBindings[i].cmd);
OSD_Printf("%-9s %s\"%s\"\n", CONTROL_KeyBinds[i].key, CONTROL_KeyBinds[i].repeat?"":"norepeat ",
CONTROL_KeyBinds[i].cmd);
}
for (i=0; i<MAXMOUSEBUTTONS; i++)
if (MouseBindings[i].cmd[0] && MouseBindings[i].key)
if (CONTROL_MouseBinds[i].cmd[0] && CONTROL_MouseBinds[i].key)
{
j++;
OSD_Printf("%-9s %s\"%s\"\n", MouseBindings[i].key, MouseBindings[i].repeat?"":"norepeat ",
MouseBindings[i].cmd);
OSD_Printf("%-9s %s\"%s\"\n", CONTROL_MouseBinds[i].key, CONTROL_MouseBinds[i].repeat?"":"norepeat ",
CONTROL_MouseBinds[i].cmd);
}
if (j == 0)
@ -956,17 +956,17 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
if (parm->numparms < 2)
{
OSD_Printf("%-9s %s\"%s\"\n", ConsoleButtons[i], MouseBindings[i].repeat?"":"norepeat ",
MouseBindings[i].cmd);
OSD_Printf("%-9s %s\"%s\"\n", ConsoleButtons[i], CONTROL_MouseBinds[i].repeat?"":"norepeat ",
CONTROL_MouseBinds[i].cmd);
return OSDCMD_OK;
}
j = 1;
MouseBindings[i].repeat = 1;
CONTROL_MouseBinds[i].repeat = 1;
if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat"))
{
MouseBindings[i].repeat = 0;
CONTROL_MouseBinds[i].repeat = 0;
j++;
}
@ -976,9 +976,9 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
Bstrcat(tempbuf," ");
Bstrcat(tempbuf,parm->parms[j++]);
}
Bstrncpy(MouseBindings[i].cmd,tempbuf, MAXBINDSTRINGLENGTH-1);
Bstrncpy(CONTROL_MouseBinds[i].cmd,tempbuf, MAXBINDSTRINGLENGTH-1);
MouseBindings[i].key=ConsoleButtons[i];
CONTROL_MouseBinds[i].key=ConsoleButtons[i];
if (!OSD_ParsingScript())
OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK;
@ -986,17 +986,17 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
if (parm->numparms < 2)
{
OSD_Printf("%-9s %s\"%s\"\n", ConsoleKeys[i].name, KeyBindings[ConsoleKeys[i].id].repeat?"":"norepeat ",
KeyBindings[ConsoleKeys[i].id].cmd);
OSD_Printf("%-9s %s\"%s\"\n", ConsoleKeys[i].name, CONTROL_KeyBinds[ConsoleKeys[i].id].repeat?"":"norepeat ",
CONTROL_KeyBinds[ConsoleKeys[i].id].cmd);
return OSDCMD_OK;
}
j = 1;
KeyBindings[ConsoleKeys[i].id].repeat = 1;
CONTROL_KeyBinds[ConsoleKeys[i].id].repeat = 1;
if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat"))
{
KeyBindings[ConsoleKeys[i].id].repeat = 0;
CONTROL_KeyBinds[ConsoleKeys[i].id].repeat = 0;
j++;
}
@ -1006,9 +1006,9 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
Bstrcat(tempbuf," ");
Bstrcat(tempbuf,parm->parms[j++]);
}
Bstrncpy(KeyBindings[ConsoleKeys[i].id].cmd,tempbuf, MAXBINDSTRINGLENGTH-1);
Bstrncpy(CONTROL_KeyBinds[ConsoleKeys[i].id].cmd,tempbuf, MAXBINDSTRINGLENGTH-1);
KeyBindings[ConsoleKeys[i].id].key=ConsoleKeys[i].name;
CONTROL_KeyBinds[ConsoleKeys[i].id].key=ConsoleKeys[i].name;
{
char *cp = tempbuf;
@ -1055,12 +1055,12 @@ static int32_t osdcmd_unbindall(const osdfuncparm_t *parm)
UNREFERENCED_PARAMETER(parm);
for (i=0; i<MAXBOUNDKEYS; i++)
if (KeyBindings[i].cmd[0])
KeyBindings[i].cmd[0] = 0;
if (CONTROL_KeyBinds[i].cmd[0])
CONTROL_KeyBinds[i].cmd[0] = 0;
for (i=0; i<MAXMOUSEBUTTONS; i++)
if (MouseBindings[i].cmd[0])
MouseBindings[i].cmd[0] = 0;
if (CONTROL_MouseBinds[i].cmd[0])
CONTROL_MouseBinds[i].cmd[0] = 0;
for (i=0; i<NUMGAMEFUNCTIONS; i++)
{
@ -1093,16 +1093,16 @@ static int32_t osdcmd_unbind(const osdfuncparm_t *parm)
if (i >= MAXMOUSEBUTTONS)
return OSDCMD_SHOWHELP;
MouseBindings[i].repeat = 0;
MouseBindings[i].cmd[0] = 0;
CONTROL_MouseBinds[i].repeat = 0;
CONTROL_MouseBinds[i].cmd[0] = 0;
OSD_Printf("unbound %s\n",ConsoleButtons[i]);
return OSDCMD_OK;
}
KeyBindings[ConsoleKeys[i].id].repeat = 0;
KeyBindings[ConsoleKeys[i].id].cmd[0] = 0;
CONTROL_KeyBinds[ConsoleKeys[i].id].repeat = 0;
CONTROL_KeyBinds[ConsoleKeys[i].id].cmd[0] = 0;
OSD_Printf("unbound key %s\n",ConsoleKeys[i].name);