This adds a menu option to reset the key layout to what the game shipped with

git-svn-id: https://svn.eduke32.com/eduke32@496 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-02-14 00:22:12 +00:00
parent c4ffc08584
commit 5bc5a1bfd0
4 changed files with 87 additions and 5 deletions

View file

@ -210,6 +210,62 @@ char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
"Show_Console", "`", ""
};
static char oldkeydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
{
"Move_Forward", "Up", "Kpad8",
"Move_Backward", "Down", "Kpad2",
"Turn_Left", "Left", "Kpad4",
"Turn_Right", "Right", "KPad6",
"Strafe", "LAlt", "RAlt",
"Fire", "LCtrl", "RCtrl",
"Open", "Space", "",
"Run", "LShift", "RShift",
"AutoRun", "CapLck", "",
"Jump", "A", "/",
"Crouch", "Z", "",
"Look_Up", "PgUp", "Kpad9",
"Look_Down", "PgDn", "Kpad3",
"Look_Left", "Insert", "Kpad0",
"Look_Right", "Delete", "Kpad.",
"Strafe_Left", ",", "",
"Strafe_Right", ".", "",
"Aim_Up", "Home", "KPad7",
"Aim_Down", "End", "Kpad1",
"Weapon_1", "1", "",
"Weapon_2", "2", "",
"Weapon_3", "3", "",
"Weapon_4", "4", "",
"Weapon_5", "5", "",
"Weapon_6", "6", "",
"Weapon_7", "7", "",
"Weapon_8", "8", "",
"Weapon_9", "9", "",
"Weapon_10", "0", "",
"Inventory", "Enter", "KpdEnt",
"Inventory_Left", "[", "",
"Inventory_Right", "]", "",
"Holo_Duke", "H", "",
"Jetpack", "J", "",
"NightVision", "N", "",
"MedKit", "M", "",
"TurnAround", "BakSpc", "",
"SendMessage", "T", "",
"Map", "Tab", "",
"Shrink_Screen", "-", "Kpad-",
"Enlarge_Screen", "=", "Kpad+",
"Center_View", "KPad5", "",
"Holster_Weapon", "ScrLck", "",
"Show_Opponents_Weapon", "W", "",
"Map_Follow_Mode", "F", "",
"See_Coop_View", "K", "",
"Mouse_Aiming", "U", "",
"Toggle_Crosshair", "I", "",
"Steroids", "R", "",
"Quick_Kick", "`", "",
"Next_Weapon", "'", "",
"Previous_Weapon", ";", "",
"Show_Console", "`", ""
};
static char * mousedefaults[] =
{

View file

@ -207,11 +207,27 @@ char * CONFIG_AnalogNumToName(int32 func)
===================
*/
void CONFIG_SetDefaultKeys(void)
void CONFIG_SetDefaultKeys(int type)
{
int32 i,f;
memset(KeyboardKeys, 0xff, sizeof(KeyboardKeys));
if (type == 1)
{
for (i=0; i < (int32)(sizeof(oldkeydefaults)/sizeof(oldkeydefaults[0])); i+=3)
{
f = CONFIG_FunctionNameToNum(oldkeydefaults[i+0]);
if (f == -1) continue;
KeyboardKeys[f][0] = KB_StringToScanCode(oldkeydefaults[i+1]);
KeyboardKeys[f][1] = KB_StringToScanCode(oldkeydefaults[i+2]);
if (f == gamefunc_Show_Console) OSD_CaptureKey(KeyboardKeys[f][0]);
else CONTROL_MapKey(f, KeyboardKeys[f][0], KeyboardKeys[f][1]);
}
return;
}
for (i=0; i < (int32)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3)
{
f = CONFIG_FunctionNameToNum(keydefaults[i+0]);

View file

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

View file

@ -3252,7 +3252,11 @@ cheat_for_port_credits:
onbar = 0;
x = probesm((probey == NUMGAMEFUNCTIONS)?60:0,(probey == NUMGAMEFUNCTIONS)?149:0,0,NUMGAMEFUNCTIONS+1);
if (probey == NUMGAMEFUNCTIONS)
x = probesm(60,145,0,NUMGAMEFUNCTIONS+2);
else if (probey == NUMGAMEFUNCTIONS+1)
x = probesm(60,152,0,NUMGAMEFUNCTIONS+2);
else x = probesm(0,0,0,NUMGAMEFUNCTIONS+2);
if (x==-1)
{
@ -3261,7 +3265,12 @@ cheat_for_port_credits:
}
else if (x == NUMGAMEFUNCTIONS)
{
CONFIG_SetDefaultKeys();
CONFIG_SetDefaultKeys(0);
break;
}
else if (x == NUMGAMEFUNCTIONS+1)
{
CONFIG_SetDefaultKeys(1);
break;
}
else if (x>=0)
@ -3322,7 +3331,8 @@ cheat_for_port_credits:
(m+l == probey && currentlist?0:16),2,10+16);
}
gametextpal(160,144,"RESET KEYS TO DEFAULTS",MENUHIGHLIGHT(NUMGAMEFUNCTIONS),10);
gametextpal(160,140, "RESET KEYS TO DEFAULTS",MENUHIGHLIGHT(NUMGAMEFUNCTIONS),10);
gametextpal(160,140+7,"SET CLASSIC KEY LAYOUT",MENUHIGHLIGHT(NUMGAMEFUNCTIONS+1),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);