Skip to content

Commit

Permalink
adding fallback system for non display special azerty letters (i.e.: …
Browse files Browse the repository at this point in the history
…é->e, à->a, etc.)
  • Loading branch information
AlexPoilrouge committed Jun 17, 2020
1 parent 5e0d8dc commit 56eaf2b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ INT32 CON_ShitAndAltGrChar(INT32 ch){
else if (altdown & 0x2){
ch = french_altgrxform[ch];
}
else{
ch = HU_FallBackFrSpecialLetter(ch);
}
}

return ch;
Expand Down Expand Up @@ -1138,6 +1141,10 @@ boolean CON_Responder(event_t *ev)
else if (altdown & 0x2){
key = french_altgrxform[key];
}
else{
key = HU_FallBackFrSpecialLetter(key);
}

}
else
{
Expand All @@ -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
Expand Down
14 changes: 14 additions & 0 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/hu_stuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 56eaf2b

Please sign in to comment.