Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 21-installer-nodd
  • 64-gl-log
  • 64-players
  • DJGPP
  • android-port
  • android-port-fix-files
  • android-port-next
  • apng-downscale-old
  • appimage-2210-pre1
  • appimage-2210-rc1
  • appimage-main
  • appimage-master
  • appimage-master-old
  • appimage-next
  • appimage-next-old
  • appimage-prerelease
  • appimage-print-backtrace-master
  • appimage-rc3
  • appimage-release-candidate
  • appimage-uncappedrevengeance-master
  • appveyor
  • better-deh-tablecheck
  • better-pause
  • better-trig-functions
  • blua-but-with-even-more-patches
  • boost-tickrate
  • boost-tickrate-orig
  • callhook
  • cleanup-opengl
  • connect-ip-textbox
  • cons-arg-completion
  • coronas-revival
  • cutscene-cleanup
  • dd-music-bypass
  • dd-music-fix
  • deployer-2-appimage
  • draw-fill-noscalepatch-support
  • draw-string-refactor
  • draw-string-refactor-new
  • drawfill-multithread
  • dummy-revival
  • dynres
  • dynres-master
  • dynres-ported
  • dynres-unlimited
  • exchndl-xp-fix
  • fix-dofile
  • fix-dummy
  • fix-ev-crumblechain
  • fix-get-textcmd-probably
  • fix-gif-delay-menu
  • fix-negative-lives-crash
  • fix-side_t-textures
  • fixed-vector-function-exposure-1
  • fixed-vector-function-exposure-2
  • fof-lightlist-fixes
  • gamepad_experiments
  • gamestatus
  • gl-portals
  • gl-portals-orig
  • homremoval-on-by-default
  • hwr-light
  • intuitive-renderstats
  • io
  • io_openlump
  • io_openlump-alladdons
  • jimita-delfile-2
  • joystick-juggling-maz
  • keycodes-only
  • less-strict-player-names
  • libpng-version-support
  • lj-menunomouse
  • loadstring
  • loops
  • loops-accel-momentum
  • lower-unpegged-fix
  • lua-cutscenes
  • lua-local
  • main
  • make-linedef-422-smarter-no-noclimb
  • makefile-tinkering
  • map-components-signedness-fixes
  • master
  • masterserver-compact-list
  • memstats
  • midgame-addons
  • more-nodes
  • music_cvar
  • next
  • next-test
  • nexttest
  • no-console-text-draw
  • no-lua
  • os
  • p-path-traverse-lua-exposure
  • parser-fixes
  • patch-skew
  • perfstats-refactor
  • perspcorrect
  • polyrenderer
  • SRB2_release_2.1
  • SRB2_release_2.1.1
  • SRB2_release_2.1.10
  • SRB2_release_2.1.11
  • SRB2_release_2.1.12
  • SRB2_release_2.1.14
  • SRB2_release_2.1.15
  • SRB2_release_2.1.16
  • SRB2_release_2.1.16a
  • SRB2_release_2.1.17
  • SRB2_release_2.1.18
  • SRB2_release_2.1.19
  • SRB2_release_2.1.2
  • SRB2_release_2.1.20
  • SRB2_release_2.1.21
  • SRB2_release_2.1.22
  • SRB2_release_2.1.23
  • SRB2_release_2.1.24
  • SRB2_release_2.1.25
  • SRB2_release_2.1.3
  • SRB2_release_2.1.4
  • SRB2_release_2.1.5
  • SRB2_release_2.1.6
  • SRB2_release_2.1.7
  • SRB2_release_2.1.8
  • SRB2_release_2.1.9
  • SRB2_release_2.2.0
  • SRB2_release_2.2.1
  • SRB2_release_2.2.10
  • SRB2_release_2.2.11
  • SRB2_release_2.2.2
  • SRB2_release_2.2.3
  • SRB2_release_2.2.4
  • SRB2_release_2.2.5
  • SRB2_release_2.2.6
  • SRB2_release_2.2.7
  • SRB2_release_2.2.8
  • SRB2_release_2.2.9
  • td-release-v1.0.0
139 results

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
  • Jisk/srb-2-beef-jerky
117 results
Select Git revision
  • 1392-2-2-15-attempting-to-draw-a-hud-graphic-with-the-same-lump-name-as-a-lua-script-crashes-the
  • 21-installer-nodd
  • 2210-pre1
  • 2210-pre2
  • 2210-rc1
  • 2210-rc2
  • 2210-rc3
  • 2211-pre1
  • 2211-pre2
  • 2211-rc1
  • 2212-pre1
  • 2212-pre2
  • 2212-pre3
  • 2212-rc1
  • 2213
  • 2214-pre1
  • 2214-pre2
  • 2214-pre3
  • 2214-pre4
  • 2_2_12
  • 64-gl-log
  • COM_ImmedExecute-lua
  • DJGPP
  • accel-momentum
  • acs
  • action-args
  • alpha-fixes
  • any-resolution
  • appveyor
  • blend-locking
  • blentran
  • blua-unary-not-fix
  • boost-tickrate
  • bustablesoundz
  • cleanup-opengl
  • cleanupmusic
  • clipmidtex
  • cmake-valgrind
  • crawlacommander-sprites
  • custom-map-names
  • custom-teams
  • cutscene-cleanup
  • dd-music-bypass
  • dd-music-fix
  • delfile2
  • deprecate-lua-dedicated-server
  • dpl-2
  • dropshadows-spawning
  • dynabsp
  • emblem-drawing
  • exchndl-xp-fix
  • extra-textures
  • few-kart-lua-changes
  • ffloorclip
  • fix-167
  • fix-cvar-conflicts
  • fix-opengl-parameter-crash
  • fix-opengl-shear-roll
  • flipfuncpointers
  • fof-lightlist-fixes
  • font-FUCK
  • frictionrefactor
  • fuck-macros-1
  • gamepad-luakeydown
  • gamepad-morefixes
  • gamepad_experiments
  • gametype-refactor
  • gametype-refactor-1
  • gametype-refactor-player-spawns
  • ghost-networking
  • gif-splitting
  • grr-lj
  • hitboxviewer
  • hwr-texture-cache-refactor
  • hwrender2
  • improve-439
  • increase-maxconditionsets
  • increase-packet-tics
  • input-display
  • input-display-translucency
  • io
  • joystick-juggling-maz
  • just-in-case
  • keycodes-only
  • ksf-wadfiles
  • ld413-mp-fix
  • levelstruct
  • libpng-version-support
  • linedef-actions
  • lj-test
  • lol-states
  • loopedsounds
  • lower-unpegged-fix
  • lua-change-gametype
  • lua-command-netids
  • lua-gfx-2
  • lua-gfx-sprites
  • lua-local
  • makefile-auto-mingw-gcc
  • makefile-tinkering
  • SRB2_release_2.1
  • SRB2_release_2.1.1
  • SRB2_release_2.1.10
  • SRB2_release_2.1.11
  • SRB2_release_2.1.12
  • SRB2_release_2.1.14
  • SRB2_release_2.1.15
  • SRB2_release_2.1.16
  • SRB2_release_2.1.16a
  • SRB2_release_2.1.17
  • SRB2_release_2.1.18
  • SRB2_release_2.1.19
  • SRB2_release_2.1.2
  • SRB2_release_2.1.20
  • SRB2_release_2.1.21
  • SRB2_release_2.1.22
  • SRB2_release_2.1.23
  • SRB2_release_2.1.24
  • SRB2_release_2.1.25
  • SRB2_release_2.1.3
  • SRB2_release_2.1.4
  • SRB2_release_2.1.5
  • SRB2_release_2.1.6
  • SRB2_release_2.1.7
  • SRB2_release_2.1.8
  • SRB2_release_2.1.9
  • SRB2_release_2.2.0
  • SRB2_release_2.2.1
  • SRB2_release_2.2.10
  • SRB2_release_2.2.11
  • SRB2_release_2.2.12
  • SRB2_release_2.2.13
  • SRB2_release_2.2.15
  • SRB2_release_2.2.2
  • SRB2_release_2.2.3
  • SRB2_release_2.2.4
  • SRB2_release_2.2.5
  • SRB2_release_2.2.6
  • SRB2_release_2.2.7
  • SRB2_release_2.2.8
  • SRB2_release_2.2.9
  • td-release-v1.0.0
142 results
Show changes
Commits on Source (7)
...@@ -906,6 +906,7 @@ boolean CON_Responder(event_t *ev) ...@@ -906,6 +906,7 @@ boolean CON_Responder(event_t *ev)
const char *cmd = NULL; const char *cmd = NULL;
INT32 key; INT32 key;
INT32 realkey;
if (chat_on) if (chat_on)
return false; return false;
...@@ -919,6 +920,7 @@ boolean CON_Responder(event_t *ev) ...@@ -919,6 +920,7 @@ boolean CON_Responder(event_t *ev)
} }
key = ev->key; key = ev->key;
realkey = ev->realkey;
// check for console toggle key // check for console toggle key
if (ev->type != ev_console) if (ev->type != ev_console)
...@@ -956,12 +958,12 @@ boolean CON_Responder(event_t *ev) ...@@ -956,12 +958,12 @@ boolean CON_Responder(event_t *ev)
} }
// Always eat ctrl/shift/alt if console open, so the menu doesn't get ideas // Always eat ctrl/shift/alt if console open, so the menu doesn't get ideas
if (key == KEY_LSHIFT || key == KEY_RSHIFT if (realkey == KEY_LSHIFT || realkey == KEY_RSHIFT
|| key == KEY_LCTRL || key == KEY_RCTRL || realkey == KEY_LCTRL || realkey == KEY_RCTRL
|| key == KEY_LALT || key == KEY_RALT) || realkey == KEY_LALT || realkey == KEY_RALT)
return true; return true;
if (key == KEY_LEFTARROW) if (realkey == KEY_LEFTARROW)
{ {
if (input_cur != 0) if (input_cur != 0)
{ {
...@@ -974,7 +976,7 @@ boolean CON_Responder(event_t *ev) ...@@ -974,7 +976,7 @@ boolean CON_Responder(event_t *ev)
input_sel = input_cur; input_sel = input_cur;
return true; return true;
} }
else if (key == KEY_RIGHTARROW) else if (realkey == KEY_RIGHTARROW)
{ {
if (input_cur < input_len) if (input_cur < input_len)
{ {
...@@ -991,13 +993,13 @@ boolean CON_Responder(event_t *ev) ...@@ -991,13 +993,13 @@ boolean CON_Responder(event_t *ev)
// backspace and delete command prompt // backspace and delete command prompt
if (input_sel != input_cur) if (input_sel != input_cur)
{ {
if (key == KEY_BACKSPACE || key == KEY_DEL) if (realkey == KEY_BACKSPACE || realkey == KEY_DEL)
{ {
CON_InputDelSelection(); CON_InputDelSelection();
return true; return true;
} }
} }
else if (key == KEY_BACKSPACE) else if (realkey == KEY_BACKSPACE)
{ {
if (ctrldown) if (ctrldown)
{ {
...@@ -1008,7 +1010,7 @@ boolean CON_Responder(event_t *ev) ...@@ -1008,7 +1010,7 @@ boolean CON_Responder(event_t *ev)
CON_InputDelChar(); CON_InputDelChar();
return true; return true;
} }
else if (key == KEY_DEL) else if (realkey == KEY_DEL)
{ {
if (input_cur == input_len) if (input_cur == input_len)
return true; return true;
...@@ -1030,7 +1032,7 @@ boolean CON_Responder(event_t *ev) ...@@ -1030,7 +1032,7 @@ boolean CON_Responder(event_t *ev)
if (ctrldown) if (ctrldown)
{ {
// show all cvars/commands that match what we have inputted // show all cvars/commands that match what we have inputted
if (key == KEY_TAB) if (realkey == KEY_TAB)
{ {
size_t i, len; size_t i, len;
...@@ -1066,18 +1068,18 @@ boolean CON_Responder(event_t *ev) ...@@ -1066,18 +1068,18 @@ boolean CON_Responder(event_t *ev)
} }
// --- // ---
if (key == KEY_HOME) // oldest text in buffer if (realkey == KEY_HOME) // oldest text in buffer
{ {
con_scrollup = (con_totallines-((con_curlines-16)>>3)); con_scrollup = (con_totallines-((con_curlines-16)>>3));
return true; return true;
} }
else if (key == KEY_END) // most recent text in buffer else if (realkey == KEY_END) // most recent text in buffer
{ {
con_scrollup = 0; con_scrollup = 0;
return true; return true;
} }
if (key == 'x' || key == 'X') if (realkey == 'x' || realkey == 'X')
{ {
if (input_sel > input_cur) if (input_sel > input_cur)
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur); I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
...@@ -1087,7 +1089,7 @@ boolean CON_Responder(event_t *ev) ...@@ -1087,7 +1089,7 @@ boolean CON_Responder(event_t *ev)
completion[0] = 0; completion[0] = 0;
return true; return true;
} }
else if (key == 'c' || key == 'C') else if (realkey == 'c' || realkey == 'C')
{ {
if (input_sel > input_cur) if (input_sel > input_cur)
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur); I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
...@@ -1095,7 +1097,7 @@ boolean CON_Responder(event_t *ev) ...@@ -1095,7 +1097,7 @@ boolean CON_Responder(event_t *ev)
I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel); I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel);
return true; return true;
} }
else if (key == 'v' || key == 'V') else if (realkey == 'v' || realkey == 'V')
{ {
const char *paste = I_ClipboardPaste(); const char *paste = I_ClipboardPaste();
if (input_sel != input_cur) if (input_sel != input_cur)
...@@ -1107,7 +1109,7 @@ boolean CON_Responder(event_t *ev) ...@@ -1107,7 +1109,7 @@ boolean CON_Responder(event_t *ev)
} }
// Select all // Select all
if (key == 'a' || key == 'A') if (realkey == 'a' || realkey == 'A')
{ {
input_sel = 0; input_sel = 0;
input_cur = input_len; input_cur = input_len;
...@@ -1120,7 +1122,7 @@ boolean CON_Responder(event_t *ev) ...@@ -1120,7 +1122,7 @@ boolean CON_Responder(event_t *ev)
} }
// command completion forward (tab) and backward (shift-tab) // command completion forward (tab) and backward (shift-tab)
if (key == KEY_TAB) if (realkey == KEY_TAB)
{ {
// sequential command completion forward and backward // sequential command completion forward and backward
...@@ -1194,26 +1196,26 @@ boolean CON_Responder(event_t *ev) ...@@ -1194,26 +1196,26 @@ boolean CON_Responder(event_t *ev)
} }
// move up (backward) in console textbuffer // move up (backward) in console textbuffer
if (key == KEY_PGUP) if (realkey == KEY_PGUP)
{ {
if (con_scrollup < (con_totallines-((con_curlines-16)>>3))) if (con_scrollup < (con_totallines-((con_curlines-16)>>3)))
con_scrollup++; con_scrollup++;
return true; return true;
} }
else if (key == KEY_PGDN) else if (realkey == KEY_PGDN)
{ {
if (con_scrollup > 0) if (con_scrollup > 0)
con_scrollup--; con_scrollup--;
return true; return true;
} }
else if (key == KEY_HOME) else if (realkey == KEY_HOME)
{ {
input_cur = 0; input_cur = 0;
if (!shiftdown) if (!shiftdown)
input_sel = input_cur; input_sel = input_cur;
return true; return true;
} }
else if (key == KEY_END) else if (realkey == KEY_END)
{ {
input_cur = input_len; input_cur = input_len;
if (!shiftdown) if (!shiftdown)
...@@ -1226,7 +1228,7 @@ boolean CON_Responder(event_t *ev) ...@@ -1226,7 +1228,7 @@ boolean CON_Responder(event_t *ev)
completion[0] = 0; completion[0] = 0;
// command enter // command enter
if (key == KEY_ENTER) if (realkey == KEY_ENTER)
{ {
if (!input_len) if (!input_len)
return true; return true;
...@@ -1245,7 +1247,7 @@ boolean CON_Responder(event_t *ev) ...@@ -1245,7 +1247,7 @@ boolean CON_Responder(event_t *ev)
} }
// move back in input history // move back in input history
if (key == KEY_UPARROW) if (realkey == KEY_UPARROW)
{ {
// copy one of the previous inputlines to the current // copy one of the previous inputlines to the current
do do
...@@ -1262,7 +1264,7 @@ boolean CON_Responder(event_t *ev) ...@@ -1262,7 +1264,7 @@ boolean CON_Responder(event_t *ev)
} }
// move forward in input history // move forward in input history
if (key == KEY_DOWNARROW) if (realkey == KEY_DOWNARROW)
{ {
if (inputhist == inputline) if (inputhist == inputline)
return true; return true;
...@@ -1279,33 +1281,33 @@ boolean CON_Responder(event_t *ev) ...@@ -1279,33 +1281,33 @@ boolean CON_Responder(event_t *ev)
} }
// allow people to use keypad in console (good for typing IP addresses) - Calum // allow people to use keypad in console (good for typing IP addresses) - Calum
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL) if (realkey >= KEY_KEYPAD7 && realkey <= KEY_KPADDEL)
{ {
char keypad_translation[] = {'7','8','9','-', char keypad_translation[] = {'7','8','9','-',
'4','5','6','+', '4','5','6','+',
'1','2','3', '1','2','3',
'0','.'}; '0','.'};
key = keypad_translation[key - KEY_KEYPAD7]; realkey = keypad_translation[realkey - KEY_KEYPAD7];
} }
else if (key == KEY_KPADSLASH) else if (realkey == KEY_KPADSLASH)
key = '/'; realkey = '/';
if (key >= 'a' && key <= 'z') if (realkey >= 'a' && realkey <= 'z')
{ {
if (capslock ^ shiftdown) if (capslock ^ shiftdown)
key = shiftxform[key]; realkey = shiftxform[key];
} }
else if (shiftdown) else if (shiftdown)
key = shiftxform[key]; realkey = shiftxform[key];
// enter a char into the command prompt // enter a char into the command prompt
if (key < 32 || key > 127) if (realkey < 32 || realkey > 127)
return true; return true;
if (input_sel != input_cur) if (input_sel != input_cur)
CON_InputDelSelection(); CON_InputDelSelection();
CON_InputAddChar(key); CON_InputAddChar(realkey);
return true; return true;
} }
......
...@@ -34,6 +34,7 @@ typedef struct ...@@ -34,6 +34,7 @@ typedef struct
{ {
evtype_t type; evtype_t type;
INT32 key; // keys/mouse/joystick buttons INT32 key; // keys/mouse/joystick buttons
INT32 realkey; // key according to keyboard layout
INT32 x; // mouse/joystick x move INT32 x; // mouse/joystick x move
INT32 y; // mouse/joystick y move INT32 y; // mouse/joystick y move
boolean repeated; // key repeat boolean repeated; // key repeat
......
...@@ -136,6 +136,8 @@ boolean usehome = true; ...@@ -136,6 +136,8 @@ boolean usehome = true;
const char *pandf = "%s" PATHSEP "%s"; const char *pandf = "%s" PATHSEP "%s";
static char addonsdir[MAX_WADPATH]; static char addonsdir[MAX_WADPATH];
consvar_t cv_kb_ignorelayout = CVAR_INIT ("kb_ignorelayout", "Off", CV_SAVE, CV_OnOff, NULL);
// //
// EVENT HANDLING // EVENT HANDLING
// //
...@@ -187,6 +189,10 @@ void D_ProcessEvents(void) ...@@ -187,6 +189,10 @@ void D_ProcessEvents(void)
ev = &events[eventtail]; ev = &events[eventtail];
// Use scancode key instead of keycode key to ignore layout.
if (cv_kb_ignorelayout.value)
ev->realkey = ev->key;
// Set mouse buttons early in case event is eaten later // Set mouse buttons early in case event is eaten later
if (ev->type == ev_keydown || ev->type == ev_keyup) if (ev->type == ev_keydown || ev->type == ev_keyup)
{ {
......
...@@ -27,6 +27,8 @@ extern boolean usehome; //Alam: which path? ...@@ -27,6 +27,8 @@ extern boolean usehome; //Alam: which path?
extern const char *pandf; //Alam: how to path? extern const char *pandf; //Alam: how to path?
extern char srb2path[256]; //Alam: SRB2's Home extern char srb2path[256]; //Alam: SRB2's Home
extern consvar_t cv_kb_ignorelayout;
// the infinite loop of D_SRB2Loop() called from win_main for windows version // the infinite loop of D_SRB2Loop() called from win_main for windows version
void D_SRB2Loop(void) FUNCNORETURN; void D_SRB2Loop(void) FUNCNORETURN;
......
...@@ -761,6 +761,9 @@ void D_RegisterClientCommands(void) ...@@ -761,6 +761,9 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_showfocuslost); CV_RegisterVar(&cv_showfocuslost);
CV_RegisterVar(&cv_pauseifunfocused); CV_RegisterVar(&cv_pauseifunfocused);
// d_main.c
CV_RegisterVar(&cv_kb_ignorelayout);
// g_input.c // g_input.c
CV_RegisterVar(&cv_sideaxis); CV_RegisterVar(&cv_sideaxis);
CV_RegisterVar(&cv_sideaxis2); CV_RegisterVar(&cv_sideaxis2);
......
...@@ -1125,7 +1125,7 @@ boolean HU_Responder(event_t *ev) ...@@ -1125,7 +1125,7 @@ boolean HU_Responder(event_t *ev)
}*/ //We don't actually care about that unless we get splitscreen netgames. :V }*/ //We don't actually care about that unless we get splitscreen netgames. :V
#ifndef NONET #ifndef NONET
c = (INT32)ev->key; c = (INT32)ev->realkey;
if (!chat_on) if (!chat_on)
{ {
...@@ -1157,12 +1157,12 @@ boolean HU_Responder(event_t *ev) ...@@ -1157,12 +1157,12 @@ boolean HU_Responder(event_t *ev)
// Ignore modifier keys // Ignore modifier keys
// Note that we do this here so users can still set // Note that we do this here so users can still set
// their chat keys to one of these, if they so desire. // their chat keys to one of these, if they so desire.
if (ev->key == KEY_LSHIFT || ev->key == KEY_RSHIFT if (ev->realkey == KEY_LSHIFT || ev->realkey == KEY_RSHIFT
|| ev->key == KEY_LCTRL || ev->key == KEY_RCTRL || ev->realkey == KEY_LCTRL || ev->realkey == KEY_RCTRL
|| ev->key == KEY_LALT || ev->key == KEY_RALT) || ev->realkey == KEY_LALT || ev->realkey == KEY_RALT)
return true; return true;
c = (INT32)ev->key; c = (INT32)ev->realkey;
// I know this looks very messy but this works. If it ain't broke, don't fix it! // I know this looks very messy but this works. If it ain't broke, don't fix it!
// shift LETTERS to uppercase if we have capslock or are holding shift // shift LETTERS to uppercase if we have capslock or are holding shift
......
...@@ -189,6 +189,10 @@ static int keyevent_get(lua_State *L) ...@@ -189,6 +189,10 @@ static int keyevent_get(lua_State *L)
lua_pushstring(L, G_KeyNumToName(event->key)); lua_pushstring(L, G_KeyNumToName(event->key));
else if (fastcmp(field,"num")) else if (fastcmp(field,"num"))
lua_pushinteger(L, event->key); lua_pushinteger(L, event->key);
else if (fastcmp(field,"realname"))
lua_pushstring(L, G_KeyNumToName(event->realkey));
else if (fastcmp(field,"realnum"))
lua_pushinteger(L, event->realkey);
else if (fastcmp(field,"repeated")) else if (fastcmp(field,"repeated"))
lua_pushboolean(L, event->repeated); lua_pushboolean(L, event->repeated);
else else
......
...@@ -203,11 +203,11 @@ boolean cht_Responder(event_t *ev) ...@@ -203,11 +203,11 @@ boolean cht_Responder(event_t *ev)
if (ev->type != ev_keydown) if (ev->type != ev_keydown)
return false; return false;
if (ev->key > 0xFF) if (ev->realkey > 0xFF)
{ {
// map some fake (joy) inputs into keys // map some fake (joy) inputs into keys
// map joy inputs into keys // map joy inputs into keys
switch (ev->key) switch (ev->realkey)
{ {
case KEY_JOY1: case KEY_JOY1:
case KEY_JOY1 + 2: case KEY_JOY1 + 2:
...@@ -231,7 +231,7 @@ boolean cht_Responder(event_t *ev) ...@@ -231,7 +231,7 @@ boolean cht_Responder(event_t *ev)
} }
} }
else else
ch = (UINT8)ev->key; ch = (UINT8)ev->realkey;
ret += cht_CheckCheat(&cheat_ultimate, (char)ch); ret += cht_CheckCheat(&cheat_ultimate, (char)ch);
ret += cht_CheckCheat(&cheat_ultimate_joy, (char)ch); ret += cht_CheckCheat(&cheat_ultimate_joy, (char)ch);
......
...@@ -3260,9 +3260,12 @@ boolean M_Responder(event_t *ev) ...@@ -3260,9 +3260,12 @@ boolean M_Responder(event_t *ev)
case KEY_HAT1 + 3: case KEY_HAT1 + 3:
ch = KEY_RIGHTARROW; ch = KEY_RIGHTARROW;
break; break;
default: // Not a virtual key? Remap it.
ch = ev->realkey;
break;
} }
} }
else if (ev->type == ev_joystick && ev->key == 0 && joywait < I_GetTime()) else if (ev->type == ev_joystick && ev->realkey == 0 && joywait < I_GetTime())
{ {
const INT32 jdeadzone = (JOYAXISRANGE * cv_digitaldeadzone.value) / FRACUNIT; const INT32 jdeadzone = (JOYAXISRANGE * cv_digitaldeadzone.value) / FRACUNIT;
if (ev->y != INT32_MAX) if (ev->y != INT32_MAX)
...@@ -3339,7 +3342,7 @@ boolean M_Responder(event_t *ev) ...@@ -3339,7 +3342,7 @@ boolean M_Responder(event_t *ev)
keydown = 0; keydown = 0;
} }
else if (ev->type == ev_keydown) // Preserve event for other responders else if (ev->type == ev_keydown) // Preserve event for other responders
ch = ev->key; ch = ev->realkey; // use layouted key here
if (ch == -1) if (ch == -1)
return false; return false;
...@@ -3464,7 +3467,7 @@ boolean M_Responder(event_t *ev) ...@@ -3464,7 +3467,7 @@ boolean M_Responder(event_t *ev)
{ {
if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING) if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING)
{ {
if (M_ChangeStringCvar(ch)) if (M_ChangeStringCvar(ev->realkey))
return true; return true;
else else
routine = NULL; routine = NULL;
......
...@@ -592,6 +592,9 @@ void I_GetConsoleEvents(void) ...@@ -592,6 +592,9 @@ void I_GetConsoleEvents(void)
// print the current line (this is differential) // print the current line (this is differential)
d = write(STDOUT_FILENO, &key, 1); d = write(STDOUT_FILENO, &key, 1);
} }
ev.realkey = ev.key;
if (ev.key) D_PostEvent(&ev); if (ev.key) D_PostEvent(&ev);
//tty_FlushIn(); //tty_FlushIn();
(void)d; (void)d;
...@@ -1012,7 +1015,7 @@ void I_ShutdownJoystick(void) ...@@ -1012,7 +1015,7 @@ void I_ShutdownJoystick(void)
void I_GetJoystickEvents(void) void I_GetJoystickEvents(void)
{ {
static event_t event = {0,0,0,0,false}; static event_t event = {0,0,0,0,0,false};
INT32 i = 0; INT32 i = 0;
UINT64 joyhats = 0; UINT64 joyhats = 0;
#if 0 #if 0
...@@ -1282,7 +1285,7 @@ void I_ShutdownJoystick2(void) ...@@ -1282,7 +1285,7 @@ void I_ShutdownJoystick2(void)
void I_GetJoystick2Events(void) void I_GetJoystick2Events(void)
{ {
static event_t event = {0,0,0,0,false}; static event_t event = {0,0,0,0,0,false};
INT32 i = 0; INT32 i = 0;
UINT64 joyhats = 0; UINT64 joyhats = 0;
#if 0 #if 0
......
...@@ -363,6 +363,92 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code) ...@@ -363,6 +363,92 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code)
return 0; return 0;
} }
static INT32 Impl_SDL_Keycode_To_Keycode(SDL_Keycode code)
{
if (code >= SDLK_a && code <= SDLK_z)
{
// get lowercase ASCII
return code - SDLK_a + 'a';
}
if (code >= SDLK_0 && code <= SDLK_9)
{
return code - SDLK_0 + '0';
}
if (code >= SDLK_F1 && code <= SDLK_F10)
{
return KEY_F1 + (code - SDLK_F1);
}
switch (code)
{
// F11 and F12 are separated from the rest of the function keys
case SDLK_F11: return KEY_F11;
case SDLK_F12: return KEY_F12;
case SDLK_KP_0: return KEY_KEYPAD0;
case SDLK_KP_1: return KEY_KEYPAD1;
case SDLK_KP_2: return KEY_KEYPAD2;
case SDLK_KP_3: return KEY_KEYPAD3;
case SDLK_KP_4: return KEY_KEYPAD4;
case SDLK_KP_5: return KEY_KEYPAD5;
case SDLK_KP_6: return KEY_KEYPAD6;
case SDLK_KP_7: return KEY_KEYPAD7;
case SDLK_KP_8: return KEY_KEYPAD8;
case SDLK_KP_9: return KEY_KEYPAD9;
case SDLK_RETURN: return KEY_ENTER;
case SDLK_ESCAPE: return KEY_ESCAPE;
case SDLK_BACKSPACE: return KEY_BACKSPACE;
case SDLK_TAB: return KEY_TAB;
case SDLK_SPACE: return KEY_SPACE;
case SDLK_MINUS: return KEY_MINUS;
case SDLK_EQUALS: return KEY_EQUALS;
case SDLK_LEFTBRACKET: return '[';
case SDLK_RIGHTBRACKET: return ']';
case SDLK_BACKSLASH: return '\\';
case SDLK_HASH: return '#';
case SDLK_SEMICOLON: return ';';
case SDLK_QUOTE: return '\'';
case SDLK_BACKQUOTE: return '`';
case SDLK_COMMA: return ',';
case SDLK_PERIOD: return '.';
case SDLK_SLASH: return '/';
case SDLK_CAPSLOCK: return KEY_CAPSLOCK;
case SDLK_PRINTSCREEN: return 0; // undefined?
case SDLK_SCROLLLOCK: return KEY_SCROLLLOCK;
case SDLK_PAUSE: return KEY_PAUSE;
case SDLK_INSERT: return KEY_INS;
case SDLK_HOME: return KEY_HOME;
case SDLK_PAGEUP: return KEY_PGUP;
case SDLK_DELETE: return KEY_DEL;
case SDLK_END: return KEY_END;
case SDLK_PAGEDOWN: return KEY_PGDN;
case SDLK_RIGHT: return KEY_RIGHTARROW;
case SDLK_LEFT: return KEY_LEFTARROW;
case SDLK_DOWN: return KEY_DOWNARROW;
case SDLK_UP: return KEY_UPARROW;
case SDLK_NUMLOCKCLEAR: return KEY_NUMLOCK;
case SDLK_KP_DIVIDE: return KEY_KPADSLASH;
case SDLK_KP_MULTIPLY: return '*'; // undefined?
case SDLK_KP_MINUS: return KEY_MINUSPAD;
case SDLK_KP_PLUS: return KEY_PLUSPAD;
case SDLK_KP_ENTER: return KEY_ENTER;
case SDLK_KP_PERIOD: return KEY_KPADDEL;
//case SDLK_NONUSBACKSLASH: return '\\';
case SDLK_LSHIFT: return KEY_LSHIFT;
case SDLK_RSHIFT: return KEY_RSHIFT;
case SDLK_LCTRL: return KEY_LCTRL;
case SDLK_RCTRL: return KEY_RCTRL;
case SDLK_LALT: return KEY_LALT;
case SDLK_RALT: return KEY_RALT;
case SDLK_LGUI: return KEY_LEFTWIN;
case SDLK_RGUI: return KEY_RIGHTWIN;
default: break;
}
return 0;
}
static boolean IgnoreMouse(void) static boolean IgnoreMouse(void)
{ {
if (cv_alwaysgrabmouse.value) if (cv_alwaysgrabmouse.value)
...@@ -668,6 +754,7 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) ...@@ -668,6 +754,7 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
return; return;
} }
event.key = Impl_SDL_Scancode_To_Keycode(evt.keysym.scancode); event.key = Impl_SDL_Scancode_To_Keycode(evt.keysym.scancode);
event.realkey = Impl_SDL_Keycode_To_Keycode(evt.keysym.sym);
event.repeated = (evt.repeat != 0); event.repeated = (evt.repeat != 0);
if (event.key) D_PostEvent(&event); if (event.key) D_PostEvent(&event);
} }
...@@ -756,6 +843,9 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type) ...@@ -756,6 +843,9 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
event.key = KEY_MOUSE1+3; event.key = KEY_MOUSE1+3;
else if (evt.button == SDL_BUTTON_X2) else if (evt.button == SDL_BUTTON_X2)
event.key = KEY_MOUSE1+4; event.key = KEY_MOUSE1+4;
event.realkey = event.key;
if (event.type == ev_keyup || event.type == ev_keydown) if (event.type == ev_keyup || event.type == ev_keydown)
{ {
D_PostEvent(&event); D_PostEvent(&event);
...@@ -784,6 +874,9 @@ static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt) ...@@ -784,6 +874,9 @@ static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt)
event.key = 0; event.key = 0;
event.type = ev_keyup; event.type = ev_keyup;
} }
event.realkey = event.key;
if (event.type == ev_keyup || event.type == ev_keydown) if (event.type == ev_keyup || event.type == ev_keydown)
{ {
D_PostEvent(&event); D_PostEvent(&event);
...@@ -826,6 +919,9 @@ static void Impl_HandleJoystickAxisEvent(SDL_JoyAxisEvent evt) ...@@ -826,6 +919,9 @@ static void Impl_HandleJoystickAxisEvent(SDL_JoyAxisEvent evt)
event.key = evt.axis / 2; event.key = evt.axis / 2;
event.y = SDLJoyAxis(evt.value, event.type); event.y = SDLJoyAxis(evt.value, event.type);
} }
event.realkey = event.key;
D_PostEvent(&event); D_PostEvent(&event);
} }
...@@ -889,6 +985,8 @@ static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type) ...@@ -889,6 +985,8 @@ static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
} }
else return; else return;
event.realkey = event.key;
SDLJoyRemap(&event); SDLJoyRemap(&event);
if (event.type != ev_console) D_PostEvent(&event); if (event.type != ev_console) D_PostEvent(&event);
} }
...@@ -1089,7 +1187,7 @@ void I_GetEvent(void) ...@@ -1089,7 +1187,7 @@ void I_GetEvent(void)
SDL_GetWindowSize(window, &wwidth, &wheight); SDL_GetWindowSize(window, &wwidth, &wheight);
//SDL_memset(&event, 0, sizeof(event_t)); //SDL_memset(&event, 0, sizeof(event_t));
event.type = ev_mouse; event.type = ev_mouse;
event.key = 0; event.realkey = event.key = 0;
event.x = (INT32)lround(mousemovex * ((float)wwidth / (float)realwidth)); event.x = (INT32)lround(mousemovex * ((float)wwidth / (float)realwidth));
event.y = (INT32)lround(mousemovey * ((float)wheight / (float)realheight)); event.y = (INT32)lround(mousemovey * ((float)wheight / (float)realheight));
D_PostEvent(&event); D_PostEvent(&event);
......