From 727ca143b590d910cbf56c8662d6ff1474ca9ce6 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 10 Nov 2018 13:28:10 -0500 Subject: [PATCH] Branch G_Controldefault into FPS and PLATFORM --- src/g_input.c | 94 ++++++++++++++++++++++++++++++++------------------- src/g_input.h | 6 +++- src/m_misc.c | 4 +-- 3 files changed, 66 insertions(+), 38 deletions(-) diff --git a/src/g_input.c b/src/g_input.c index 67aaf4179..cb27fb345 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -611,42 +611,66 @@ INT32 G_KeyStringtoNum(const char *keystr) return 0; } -void G_Controldefault(void) +void G_Controldefault(INT32 scheme, boolean setcommon) { - gamecontrol[gc_forward ][0] = 'w'; - gamecontrol[gc_backward ][0] = 's'; - gamecontrol[gc_strafeleft ][0] = 'a'; - gamecontrol[gc_straferight][0] = 'd'; - gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW; - gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW; - gamecontrol[gc_weaponnext ][0] = 'e'; - gamecontrol[gc_weaponprev ][0] = 'q'; - gamecontrol[gc_wepslot1 ][0] = '1'; - gamecontrol[gc_wepslot2 ][0] = '2'; - gamecontrol[gc_wepslot3 ][0] = '3'; - gamecontrol[gc_wepslot4 ][0] = '4'; - gamecontrol[gc_wepslot5 ][0] = '5'; - gamecontrol[gc_wepslot6 ][0] = '6'; - gamecontrol[gc_wepslot7 ][0] = '7'; - gamecontrol[gc_wepslot8 ][0] = '8'; - gamecontrol[gc_wepslot9 ][0] = '9'; - gamecontrol[gc_wepslot10 ][0] = '0'; - gamecontrol[gc_fire ][0] = KEY_RCTRL; - gamecontrol[gc_fire ][1] = KEY_MOUSE1+0; - gamecontrol[gc_firenormal ][0] = 'c'; - gamecontrol[gc_tossflag ][0] = '\''; - gamecontrol[gc_use ][0] = KEY_LSHIFT; - gamecontrol[gc_camtoggle ][0] = 'v'; - gamecontrol[gc_camreset ][0] = 'r'; - gamecontrol[gc_lookup ][0] = KEY_UPARROW; - gamecontrol[gc_lookdown ][0] = KEY_DOWNARROW; - gamecontrol[gc_centerview ][0] = KEY_END; - gamecontrol[gc_talkkey ][0] = 't'; - gamecontrol[gc_teamkey ][0] = 'y'; - gamecontrol[gc_scores ][0] = KEY_TAB; - gamecontrol[gc_jump ][0] = KEY_SPACE; - gamecontrol[gc_console ][0] = KEY_CONSOLE; - gamecontrol[gc_pause ][0] = KEY_PAUSE; + if (scheme == CONTROL_DEFAULT_PLATFORM) + { + gamecontrol[gc_forward ][0] = KEY_UPARROW; + gamecontrol[gc_backward ][0] = KEY_DOWNARROW; + gamecontrol[gc_strafeleft ][0] = 'a'; + gamecontrol[gc_straferight][0] = 'd'; + gamecontrol[gc_lookup ][0] = KEY_PGUP; + gamecontrol[gc_lookdown ][0] = KEY_PGDN; + gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW; + gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW; + gamecontrol[gc_centerview ][0] = KEY_END; + gamecontrol[gc_jump ][0] = KEY_SPACE; + gamecontrol[gc_use ][0] = KEY_LSHIFT; + gamecontrol[gc_fire ][0] = 's'; + gamecontrol[gc_fire ][1] = KEY_MOUSE1+0; + gamecontrol[gc_firenormal ][0] = 'w'; + } + else // if (scheme == CONTROL_DEFAULT_FPS) + { + gamecontrol[gc_forward ][0] = 'w'; + gamecontrol[gc_backward ][0] = 's'; + gamecontrol[gc_strafeleft ][0] = 'a'; + gamecontrol[gc_straferight][0] = 'd'; + gamecontrol[gc_lookup ][0] = KEY_UPARROW; + gamecontrol[gc_lookdown ][0] = KEY_DOWNARROW; + gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW; + gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW; + gamecontrol[gc_centerview ][0] = KEY_END; + gamecontrol[gc_jump ][0] = KEY_SPACE; + gamecontrol[gc_use ][0] = KEY_LSHIFT; + gamecontrol[gc_fire ][0] = KEY_RCTRL; + gamecontrol[gc_fire ][1] = KEY_MOUSE1+0; + gamecontrol[gc_firenormal ][0] = 'c'; + } + + if (setcommon) + { + gamecontrol[gc_weaponnext ][0] = 'e'; + gamecontrol[gc_weaponprev ][0] = 'q'; + gamecontrol[gc_wepslot1 ][0] = '1'; + gamecontrol[gc_wepslot2 ][0] = '2'; + gamecontrol[gc_wepslot3 ][0] = '3'; + gamecontrol[gc_wepslot4 ][0] = '4'; + gamecontrol[gc_wepslot5 ][0] = '5'; + gamecontrol[gc_wepslot6 ][0] = '6'; + gamecontrol[gc_wepslot7 ][0] = '7'; + gamecontrol[gc_wepslot8 ][0] = '8'; + gamecontrol[gc_wepslot9 ][0] = '9'; + gamecontrol[gc_wepslot10 ][0] = '0'; + gamecontrol[gc_tossflag ][0] = '\''; + gamecontrol[gc_camtoggle ][0] = 'v'; + gamecontrol[gc_camreset ][0] = 'r'; + gamecontrol[gc_talkkey ][0] = 't'; + gamecontrol[gc_teamkey ][0] = 'y'; + gamecontrol[gc_scores ][0] = KEY_TAB; + gamecontrol[gc_console ][0] = KEY_CONSOLE; + gamecontrol[gc_pause ][0] = KEY_PAUSE; + } } void G_SaveKeySetting(FILE *f) diff --git a/src/g_input.h b/src/g_input.h index 2a447c683..ea952a8ea 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -27,6 +27,10 @@ #define JOYHATS 4 // 4 hats #define JOYAXISSET 4 // 4 Sets of 2 axises +#define CONTROL_DEFAULT_FPS 0 +#define CONTROL_DEFAULT_PLATFORM 1 +#define CONTROL_DEFAULT_CUSTOM 2 + // // mouse and joystick buttons are handled as 'virtual' keys // @@ -133,7 +137,7 @@ INT32 G_KeyStringtoNum(const char *keystr); void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control); void Command_Setcontrol_f(void); void Command_Setcontrol2_f(void); -void G_Controldefault(void); +void G_Controldefault(INT32 scheme); void G_SaveKeySetting(FILE *f); void G_CheckDoubleUsage(INT32 keynum); diff --git a/src/m_misc.c b/src/m_misc.c index 50b6d7a05..cfd788d87 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -58,7 +58,7 @@ typedef off_t off64_t; #if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)) #define PRIdS "u" -#elif defined (_WIN32) +#elif defined (_WIN32) #define PRIdS "Iu" #elif defined (DJGPP) #define PRIdS "u" @@ -475,7 +475,7 @@ void M_FirstLoadConfig(void) } // load default control - G_Controldefault(); + G_Controldefault(CONTROL_DEFAULT_FPS, true); // load config, make sure those commands doesnt require the screen... COM_BufInsertText(va("exec \"%s\"\n", configfile));