From 56eaf2b32ba18d0f39af46af4a8922c7f48181ec Mon Sep 17 00:00:00 2001 From: AlexPoilrouge Date: Wed, 17 Jun 2020 11:02:35 +0200 Subject: [PATCH] =?UTF-8?q?adding=20fallback=20system=20for=20non=20displa?= =?UTF-8?q?y=20special=20azerty=20letters=20(i.e.:=20=C3=A9->e,=20=C3=A0->?= =?UTF-8?q?a,=20etc.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/console.c | 10 ++++++++++ src/hu_stuff.c | 14 ++++++++++++++ src/hu_stuff.h | 3 +++ src/keys.h | 2 ++ src/m_menu.c | 12 ++++++++++++ 5 files changed, 41 insertions(+) diff --git a/src/console.c b/src/console.c index e4b22b850..8717391d0 100644 --- a/src/console.c +++ b/src/console.c @@ -594,6 +594,9 @@ INT32 CON_ShitAndAltGrChar(INT32 ch){ else if (altdown & 0x2){ ch = french_altgrxform[ch]; } + else{ + ch = HU_FallBackFrSpecialLetter(ch); + } } return ch; @@ -1138,6 +1141,10 @@ boolean CON_Responder(event_t *ev) else if (altdown & 0x2){ key = french_altgrxform[key]; } + else{ + key = HU_FallBackFrSpecialLetter(key); + } + } else { @@ -1146,6 +1153,9 @@ boolean CON_Responder(event_t *ev) else if (altdown & 0x2){ key = french_altgrxform[key]; } + else{ + key = HU_FallBackFrSpecialLetter(key); + } } // enter a char into the command prompt diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 2e0785411..86f03287e 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -252,6 +252,20 @@ char french_altgrxform[] ={ 'ù' }; +//fallback for special letter non displayable in the game (i.e.: 'é','à',etc.) +INT32 HU_FallBackFrSpecialLetter(INT32 key){ + switch(key){ + case KEY_FR_E_AIGUE: return 'e'; + case KEY_FR_E_GRAVE: return 'e'; + case KEY_FR_C_CEDILLE: return 'c'; + case KEY_FR_A_GRAVE: return 'a'; + case KEY_FR_U_GRAVE: return 'u'; + default: return key; + } +} + + + static char cechotext[1024]; static tic_t cechotimer = 0; static tic_t cechoduration = 5*TICRATE; diff --git a/src/hu_stuff.h b/src/hu_stuff.h index d594dc3f1..52a32eb64 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -49,6 +49,9 @@ extern char english_shiftxform[]; extern char french_shiftxform[]; extern char french_altgrxform[]; +//fallback for special letter non displayable in the game (i.e.: 'é','à',etc.) +INT32 HU_FallBackFrSpecialLetter(INT32 key); + //------------------------------------ // sorted player lines //------------------------------------ diff --git a/src/keys.h b/src/keys.h index 8947fbc5e..68138fbfc 100644 --- a/src/keys.h +++ b/src/keys.h @@ -26,6 +26,8 @@ #define KEY_MINUS 45 #define KEY_EQUALS 61 +//azerty special keys support +//(necessary for being able to print 'regular' chars in azerty) #define KEY_FR_E_AIGUE (0x80+2) #define KEY_FR_E_GRAVE (0x80+10) #define KEY_FR_C_CEDILLE (0x80+7) diff --git a/src/m_menu.c b/src/m_menu.c index 3025cebcd..f04cf77f9 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2389,6 +2389,9 @@ static boolean M_ChangeStringCvar(INT32 choice) else if(altdown & 0x2){ choice = french_altgrxform[choice]; } + else{ + choice = HU_FallBackFrSpecialLetter(choice); + } } switch (choice) @@ -2701,6 +2704,9 @@ boolean M_Responder(event_t *ev) else if(altdown & 0x2){ ch = french_altgrxform[ch]; } + else{ + ch = HU_FallBackFrSpecialLetter(ch); + } } routine(ch); return true; @@ -2750,6 +2756,9 @@ boolean M_Responder(event_t *ev) else if(altdown & 0x2){ ch = french_altgrxform[ch]; } + else{ + ch = HU_FallBackFrSpecialLetter(ch); + } } if (M_ChangeStringCvar(ch)) return true; @@ -5034,6 +5043,9 @@ static boolean M_ChangeStringAddons(INT32 choice) else if(altdown & 0x2){ choice = french_altgrxform[choice]; } + else{ + choice = HU_FallBackFrSpecialLetter(choice); + } } switch (choice)