diff options
-rw-r--r-- | setup/configfile.c | 3 | ||||
-rw-r--r-- | setup/keyboard.c | 8 | ||||
-rw-r--r-- | setup/keyboard.h | 1 | ||||
-rw-r--r-- | src/am_map.c | 2 | ||||
-rw-r--r-- | src/g_game.c | 2 | ||||
-rw-r--r-- | src/hu_stuff.c | 4 | ||||
-rw-r--r-- | src/i_video.c | 27 | ||||
-rw-r--r-- | src/m_menu.c | 8 | ||||
-rw-r--r-- | src/m_misc.c | 2 | ||||
-rw-r--r-- | src/st_stuff.c | 22 |
10 files changed, 57 insertions, 22 deletions
diff --git a/setup/configfile.c b/setup/configfile.c index f2ec8d3d..3b2326d5 100644 --- a/setup/configfile.c +++ b/setup/configfile.c @@ -188,7 +188,7 @@ typedef struct char *filename; } default_collection_t; -static default_t doom_defaults_list[] = +static default_t doom_defaults_list[] = { {"mouse_sensitivity", &mouseSensitivity, DEFAULT_INT, 0, 0}, {"sfx_volume",&sfxVolume, DEFAULT_INT, 0, 0}, @@ -265,6 +265,7 @@ static default_t extra_defaults_list[] = {"show_endoom", &show_endoom, DEFAULT_INT, 0, 0}, {"vanilla_savegame_limit", &vanilla_savegame_limit, DEFAULT_INT, 0, 0}, {"vanilla_demo_limit", &vanilla_demo_limit, DEFAULT_INT, 0, 0}, + {"vanilla_keyboard_mapping", &vanilla_keyboard_mapping, DEFAULT_INT, 0, 0}, #ifdef FEATURE_MULTIPLAYER {"player_name", &net_player_name, DEFAULT_STRING, 0, 0}, #endif diff --git a/setup/keyboard.c b/setup/keyboard.c index b804714f..c10b9ce4 100644 --- a/setup/keyboard.c +++ b/setup/keyboard.c @@ -37,6 +37,8 @@ int key_strafe = KEY_RALT; int key_speed = KEY_RSHIFT; int joybspeed = 3; +int vanilla_keyboard_mapping = 1; + static int always_run = 0; static int *allkeys[] = {&key_left, &key_right, &key_up, &key_down, @@ -107,10 +109,14 @@ void ConfigKeyboard(void) TXT_AddWidgets(window, TXT_NewSeparator("Movement"), movement_table = TXT_NewTable(2), - run_control = TXT_NewCheckBox("Always run", &always_run), TXT_NewSeparator("Action"), action_table = TXT_NewTable(2), + + TXT_NewSeparator("Misc."), + run_control = TXT_NewCheckBox("Always run", &always_run), + TXT_NewInvertedCheckBox("Use native keyboard mapping", + &vanilla_keyboard_mapping), NULL); TXT_SetColumnWidths(movement_table, 20, 8); diff --git a/setup/keyboard.h b/setup/keyboard.h index e4cb2139..6442e1e4 100644 --- a/setup/keyboard.h +++ b/setup/keyboard.h @@ -33,6 +33,7 @@ extern int key_use; extern int key_strafe; extern int key_speed; extern int joybspeed; +extern int vanilla_keyboard_mapping; void ConfigKeyboard(void); diff --git a/src/am_map.c b/src/am_map.c index 7ba71f5c..11f77c1e 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -706,7 +706,7 @@ AM_Responder cheatstate=0; rc = false; } - if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data1)) + if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data2)) { rc = false; cheating = (cheating+1) % 3; diff --git a/src/g_game.c b/src/g_game.c index 3a4cba02..f46f0d72 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -666,7 +666,7 @@ boolean G_Responder (event_t* ev) { // allow spy mode changes even during the demo if (gamestate == GS_LEVEL && ev->type == ev_keydown - && ev->data1 == KEY_F12 && (singledemo || !deathmatch) ) + && ev->data1 == KEY_F12 && (singledemo || !deathmatch) ) { // spy mode do diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 08422706..32ca1fc3 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -551,7 +551,7 @@ boolean HU_Responder(event_t *ev) message_counter = HU_MSGTIMEOUT; eatkey = true; } - else if (netgame && ev->data1 == HU_INPUTTOGGLE) + else if (netgame && ev->data2 == HU_INPUTTOGGLE) { eatkey = chat_on = true; HUlib_resetIText(&w_chat); @@ -561,7 +561,7 @@ boolean HU_Responder(event_t *ev) { for (i=0; i<MAXPLAYERS ; i++) { - if (ev->data1 == destination_keys[i]) + if (ev->data2 == destination_keys[i]) { if (playeringame[i] && i!=consoleplayer) { diff --git a/src/i_video.c b/src/i_video.c index 3718f612..39208ec3 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -138,6 +138,12 @@ static boolean window_focused; static SDL_Cursor *cursors[2]; +// If true, keyboard mapping is ignored, like in Vanilla Doom. +// The sensible thing to do is to disable this if you have a non-US +// keyboard. + +int vanilla_keyboard_mapping = true; + // Mouse acceleration // // This emulates some of the behavior of DOS mouse drivers by increasing @@ -419,7 +425,26 @@ void I_GetEvent(void) case SDL_KEYDOWN: event.type = ev_keydown; event.data1 = TranslateKey(&sdlevent.key.keysym); - event.data2 = sdlevent.key.keysym.unicode; + + // If Vanilla keyboard mapping enabled, the keyboard + // scan code is used to give the character typed. + // This does not change depending on keyboard layout. + // If you have a German keyboard, pressing 'z' will + // give 'y', for example. It is desirable to be able + // to fix this so that people with non-standard + // keyboard mappings can type properly. If vanilla + // mode is disabled, use the properly translated + // version. + + if (vanilla_keyboard_mapping) + { + event.data2 = event.data1; + } + else + { + event.data2 = sdlevent.key.keysym.unicode; + } + D_PostEvent(&event); break; diff --git a/src/m_menu.c b/src/m_menu.c index b83fca0c..1dbb8f56 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1569,13 +1569,13 @@ boolean M_Responder (event_t* ev) if (messageToPrint) { if (messageNeedsInput == true && - !(key == ' ' || key == 'n' || key == 'y' || key == KEY_ESCAPE)) + !(ch == ' ' || ch == 'n' || ch == 'y' || key == KEY_ESCAPE)) return false; menuactive = messageLastMenuActive; messageToPrint = 0; if (messageRoutine) - messageRoutine(key); + messageRoutine(ch); menuactive = false; S_StartSound(NULL,sfx_swtchx); @@ -1769,14 +1769,14 @@ boolean M_Responder (event_t* ev) default: for (i = itemOn+1;i < currentMenu->numitems;i++) - if (currentMenu->menuitems[i].alphaKey == key) + if (currentMenu->menuitems[i].alphaKey == ch) { itemOn = i; S_StartSound(NULL,sfx_pstop); return true; } for (i = 0;i <= itemOn;i++) - if (currentMenu->menuitems[i].alphaKey == key) + if (currentMenu->menuitems[i].alphaKey == ch) { itemOn = i; S_StartSound(NULL,sfx_pstop); diff --git a/src/m_misc.c b/src/m_misc.c index 35889492..84a2e3fa 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -280,6 +280,7 @@ extern char* chat_macros[]; extern int show_endoom; extern int vanilla_savegame_limit; extern int vanilla_demo_limit; +extern int vanilla_keyboard_mapping; extern int snd_musicdevice; extern int snd_sfxdevice; @@ -408,6 +409,7 @@ static default_t extra_defaults_list[] = {"show_endoom", &show_endoom, DEFAULT_INT, 0, 0}, {"vanilla_savegame_limit", &vanilla_savegame_limit, DEFAULT_INT, 0, 0}, {"vanilla_demo_limit", &vanilla_demo_limit, DEFAULT_INT, 0, 0}, + {"vanilla_keyboard_mapping", &vanilla_keyboard_mapping, DEFAULT_INT, 0, 0}, {"video_driver", &video_driver, DEFAULT_STRING, 0, 0}, #ifdef FEATURE_MULTIPLAYER {"player_name", &net_player_name, DEFAULT_STRING, 0, 0}, diff --git a/src/st_stuff.c b/src/st_stuff.c index b8e636c5..b82504af 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -474,7 +474,7 @@ ST_Responder (event_t* ev) if (!netgame && gameskill != sk_nightmare) { // 'dqd' cheat for toggleable god mode - if (cht_CheckCheat(&cheat_god, ev->data1)) + if (cht_CheckCheat(&cheat_god, ev->data2)) { plyr->cheats ^= CF_GODMODE; if (plyr->cheats & CF_GODMODE) @@ -489,7 +489,7 @@ ST_Responder (event_t* ev) plyr->message = DEH_String(STSTR_DQDOFF); } // 'fa' cheat for killer fucking arsenal - else if (cht_CheckCheat(&cheat_ammonokey, ev->data1)) + else if (cht_CheckCheat(&cheat_ammonokey, ev->data2)) { plyr->armorpoints = deh_idfa_armor; plyr->armortype = deh_idfa_armor_class; @@ -503,7 +503,7 @@ ST_Responder (event_t* ev) plyr->message = DEH_String(STSTR_FAADDED); } // 'kfa' cheat for key full ammo - else if (cht_CheckCheat(&cheat_ammo, ev->data1)) + else if (cht_CheckCheat(&cheat_ammo, ev->data2)) { plyr->armorpoints = deh_idkfa_armor; plyr->armortype = deh_idkfa_armor_class; @@ -520,7 +520,7 @@ ST_Responder (event_t* ev) plyr->message = DEH_String(STSTR_KFAADDED); } // 'mus' cheat for changing music - else if (cht_CheckCheat(&cheat_mus, ev->data1)) + else if (cht_CheckCheat(&cheat_mus, ev->data2)) { char buf[3]; @@ -549,9 +549,9 @@ ST_Responder (event_t* ev) } } else if ( (gamemission == doom - && cht_CheckCheat(&cheat_noclip, ev->data1)) + && cht_CheckCheat(&cheat_noclip, ev->data2)) || (gamemission != doom - && cht_CheckCheat(&cheat_commercial_noclip,ev->data1))) + && cht_CheckCheat(&cheat_commercial_noclip,ev->data2))) { // Noclip cheat. // For Doom 1, use the idspipsopd cheat; for all others, use @@ -567,7 +567,7 @@ ST_Responder (event_t* ev) // 'behold?' power-up cheats for (i=0;i<6;i++) { - if (cht_CheckCheat(&cheat_powerup[i], ev->data1)) + if (cht_CheckCheat(&cheat_powerup[i], ev->data2)) { if (!plyr->powers[i]) P_GivePower( plyr, i); @@ -581,19 +581,19 @@ ST_Responder (event_t* ev) } // 'behold' power-up menu - if (cht_CheckCheat(&cheat_powerup[6], ev->data1)) + if (cht_CheckCheat(&cheat_powerup[6], ev->data2)) { plyr->message = DEH_String(STSTR_BEHOLD); } // 'choppers' invulnerability & chainsaw - else if (cht_CheckCheat(&cheat_choppers, ev->data1)) + else if (cht_CheckCheat(&cheat_choppers, ev->data2)) { plyr->weaponowned[wp_chainsaw] = true; plyr->powers[pw_invulnerability] = true; plyr->message = DEH_String(STSTR_CHOPPERS); } // 'mypos' for player position - else if (cht_CheckCheat(&cheat_mypos, ev->data1)) + else if (cht_CheckCheat(&cheat_mypos, ev->data2)) { static char buf[ST_MSGWIDTH]; sprintf(buf, "ang=0x%x;x,y=(0x%x,0x%x)", @@ -605,7 +605,7 @@ ST_Responder (event_t* ev) } // 'clev' change-level cheat - if (cht_CheckCheat(&cheat_clev, ev->data1)) + if (cht_CheckCheat(&cheat_clev, ev->data2)) { char buf[3]; int epsd; |