This adds a menu option to reset the keys to the default configuration

git-svn-id: https://svn.eduke32.com/eduke32@495 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-02-13 09:50:58 +00:00
parent e1fed262d6
commit c4ffc08584
8 changed files with 54 additions and 41 deletions

View File

@ -217,8 +217,8 @@ static char * mousedefaults[] =
"MedKit",
"Jetpack",
"",
"Next_Weapon",
"Previous_Weapon"
"Previous_Weapon",
"Next_Weapon"
};

View File

@ -207,6 +207,23 @@ char * CONFIG_AnalogNumToName(int32 func)
===================
*/
void CONFIG_SetDefaultKeys(void)
{
int32 i,f;
memset(KeyboardKeys, 0xff, sizeof(KeyboardKeys));
for (i=0; i < (int32)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3)
{
f = CONFIG_FunctionNameToNum(keydefaults[i+0]);
if (f == -1) continue;
KeyboardKeys[f][0] = KB_StringToScanCode(keydefaults[i+1]);
KeyboardKeys[f][1] = KB_StringToScanCode(keydefaults[i+2]);
if (f == gamefunc_Show_Console) OSD_CaptureKey(KeyboardKeys[f][0]);
else CONTROL_MapKey(f, KeyboardKeys[f][0], KeyboardKeys[f][1]);
}
}
void CONFIG_SetDefaults(void)
{
// JBF 20031211
@ -275,17 +292,6 @@ void CONFIG_SetDefaults(void)
Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!");
// JBF 20031211
memset(KeyboardKeys, 0xff, sizeof(KeyboardKeys));
for (i=0; i < (int32)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3)
{
f = CONFIG_FunctionNameToNum(keydefaults[i+0]);
if (f == -1) continue;
KeyboardKeys[f][0] = KB_StringToScanCode(keydefaults[i+1]);
KeyboardKeys[f][1] = KB_StringToScanCode(keydefaults[i+2]);
if (f == gamefunc_Show_Console) OSD_CaptureKey(KeyboardKeys[f][0]);
else CONTROL_MapKey(f, KeyboardKeys[f][0], KeyboardKeys[f][1]);
}
memset(MouseFunctions, -1, sizeof(MouseFunctions));
for (i=0; i<MAXMOUSEBUTTONS; i++)

View File

@ -72,6 +72,7 @@ void CONFIG_GetSetupFilename( void );
void CONFIG_WriteSetup( void );
void CONFIG_SetupMouse( void );
void CONFIG_SetupJoystick( void );
void CONFIG_SetDefaultKeys(void);
int32 CONFIG_GetMapBestTime(char *mapname);
int32 CONFIG_SetMapBestTime(char *mapname, int32 tm);

View File

@ -7652,7 +7652,7 @@ static void nonsharedkeys(void)
}
else
{
ud.statusbarscale += 8;
ud.statusbarscale += 4;
setstatusbarscale(ud.statusbarscale);
}
vscrn();
@ -7670,7 +7670,7 @@ static void nonsharedkeys(void)
}
else
{
ud.statusbarscale -= 8;
ud.statusbarscale -= 4;
if (ud.statusbarscale < 37)
ud.statusbarscale = 37;
setstatusbarscale(ud.statusbarscale);
@ -8391,9 +8391,9 @@ static int loadgroupfiles(char *fn)
int j = initgroupfile(fn);
if (j == -1)
initprintf("Warning: could not find group file %s.\n",fn);
initprintf("Could not find group file '%s'.\n",fn);
else
initprintf("Using group file %s.\n",fn);
initprintf("Using group file '%s'.\n",fn);
}
pathsearchmode = 0;
}
@ -9807,7 +9807,7 @@ void app_main(int argc,char **argv)
exit(1);
}
initprintf("Using config file %s.\n",setupfilename);
initprintf("Using config file '%s'.\n",setupfilename);
ScanGroups();
{ // try and identify the 'defaultduke3dgrp' in the set of GRPs.
@ -9878,11 +9878,11 @@ void app_main(int argc,char **argv)
{
s = CommandGrps->next;
j = initgroupfile(CommandGrps->str);
if (j == -1) initprintf("Warning: could not find group file %s.\n",CommandGrps->str);
if (j == -1) initprintf("Could not find group file '%s'.\n",CommandGrps->str);
else
{
groupfile = j;
initprintf("Using group file %s.\n",CommandGrps->str);
initprintf("Using group file '%s'.\n",CommandGrps->str);
}
free(CommandGrps->str);
@ -9932,6 +9932,7 @@ void app_main(int argc,char **argv)
Bsprintf(ud.user_name[j],"PLAYER %d",j+1);
ps[j].team = ud.pteam[j] = i;
ps[j].weaponswitch = 3;
ps[j].auto_aim = 0;
i = 1-i;
}
@ -9968,7 +9969,7 @@ void app_main(int argc,char **argv)
ud.last_level = -1;
RTS_Init(ud.rtsname);
if (numlumps) initprintf("Using .RTS file: %s\n",ud.rtsname);
if (numlumps) initprintf("Using .RTS file '%s'\n",ud.rtsname);
initprintf("Initializing OSD...\n");
@ -10979,9 +10980,7 @@ static void fakedomovethings(void)
}
else if (syn->avel) //p->ang += syncangvel * constant
{ //ENGINE calculates angvel for you
long tempang;
tempang = syn->avel<<1;
long tempang = syn->avel<<1;
if (psectlotag == 2)
myang += (tempang-(tempang>>3))*ksgn(doubvel);

View File

@ -812,7 +812,7 @@ LABELS userdefslabels[]=
{ "automsg", USERDEFS_AUTOMSG, 0, 0 },
{ "idplayers", USERDEFS_IDPLAYERS, 0, 0 },
{ "team", USERDEFS_TEAM, 0, 0 },
#if 0
#if 1
{ "myx", USERDEFS_MYX, 0, 0 },
{ "omyx", USERDEFS_OMYX, 0, 0 },
{ "myxvel", USERDEFS_MYXVEL, 0, 0 },

View File

@ -316,7 +316,7 @@ enum userdefslabels {
USERDEFS_IDPLAYERS,
USERDEFS_TEAM,
// this stuff isn't really userdef stuff, but getuserdef/setuserdef is already set up for what I want to do
#if 0
#if 1
USERDEFS_MYX,
USERDEFS_OMYX,
USERDEFS_MYXVEL,

View File

@ -665,7 +665,7 @@ static void DoUserDef(int iSet, int lLabelID, int lVar2)
SetGameVarID(lVar2, ud.team, g_i, g_p);
break;
#if 0
#if 1
case USERDEFS_MYX:
if (iSet)
myx = lValue;
@ -4785,7 +4785,7 @@ static int parse(void)
if (x1 > x2) swaplong(&x1,&x2);
if (y1 > y2) swaplong(&y1,&y2);
if (x1 < 0 || y1 < 0 || x2 > xdim-1 || y2 > ydim-1 || x2-x1 < 1 || y2-y1 < 1)
if (x1 < 0 || y1 < 0 || x2 > xdim-1 || y2 > ydim-1 || x2-x1 < 2 || y2-y1 < 2)
break;
#if defined(USE_OPENGL) && defined(POLYMOST)

View File

@ -3232,7 +3232,7 @@ cheat_for_port_credits:
strcpy(tempbuf,"OTHER");
break;
}
// menutext(c+154,50+62+16+16,MENUHIGHLIGHT(5),bpp==8,tempbuf);
// menutext(c+154,50+62+16+16,MENUHIGHLIGHT(5),bpp==8,tempbuf);
gametextpal(c+154,50+62+16+16-8,tempbuf,MENUHIGHLIGHT(5),bpp==8);
menutext(c,50+62+16+16+16,MENUHIGHLIGHT(6),bpp==8,"ANISOTROPY");
@ -3251,13 +3251,19 @@ cheat_for_port_credits:
c = (320>>1)-120;
onbar = 0;
x = probe(0,0,0,NUMGAMEFUNCTIONS);
x = probesm((probey == NUMGAMEFUNCTIONS)?60:0,(probey == NUMGAMEFUNCTIONS)?149:0,0,NUMGAMEFUNCTIONS+1);
if (x==-1)
{
cmenu(202);
probey = 4;
}
else if (x == NUMGAMEFUNCTIONS)
{
CONFIG_SetDefaultKeys();
break;
}
else if (x>=0)
{
function = probey;
@ -3316,9 +3322,10 @@ cheat_for_port_credits:
(m+l == probey && currentlist?0:16),2,10+16);
}
gametext(160,144,"UP/DOWN = SELECT ACTION",0,2+8+16);
gametext(160,144+9,"LEFT/RIGHT = SELECT LIST",0,2+8+16);
gametext(160,144+9+9,"ENTER = MODIFY DELETE = CLEAR",0,2+8+16);
gametextpal(160,144,"RESET KEYS TO DEFAULTS",MENUHIGHLIGHT(NUMGAMEFUNCTIONS),10);
gametext(160,144+9+3,"UP/DOWN = SELECT ACTION",0,2+8+16);
gametext(160,144+9+9+3,"LEFT/RIGHT = SELECT LIST",0,2+8+16);
gametext(160,144+9+9+9+3,"ENTER = MODIFY DELETE = CLEAR",0,2+8+16);
break;