use functions for keyshift crap

lmao why tf wasnt this done anyways but copy and pasted 500 times
This commit is contained in:
Alug committed 2024-04-02 16:38:07 +02:00
1 parent ebc467f212
commit 94248eaea2
2 files changed
+59 -121

No files matched your search

+29 -41
View File
@@ -634,13 +634,37 @@ INT32 CON_ShiftChar(INT32 ch)
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
{
if (shiftdown ^ capslock)
ch = shiftxform[ch];
if (cv_keyboardlayout.value == 3)
{
if (shiftdown ^ capslock)
ch = shiftxform[ch];
else if (altdown & 0x2)
ch = french_altgrxform[ch];
else
ch = HU_FallBackFrSpecialLetter(ch);
}
else
{
if (shiftdown ^ capslock)
ch = shiftxform[ch];
}
}
else // if we're holding shift we should still shift non letter symbols
{
if (shiftdown)
ch = shiftxform[ch];
if (cv_keyboardlayout.value == 3)
{
if (shiftdown)
ch = shiftxform[ch];
else if (altdown & 0x2)
ch = french_altgrxform[ch];
else
ch = HU_FallBackFrSpecialLetter(ch);
}
else
{
if (shiftdown)
ch = shiftxform[ch];
}
}
return ch;
@@ -1236,43 +1260,7 @@ boolean CON_Responder(event_t *ev)
key = '/';
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
if (!I_UseNativeKeyboard())
{
if ((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z'))
{
if (cv_keyboardlayout.value == 3)
{
if (shiftdown ^ capslock)
key = shiftxform[key];
else if (altdown & 0x2)
key = french_altgrxform[key];
else
key = HU_FallBackFrSpecialLetter(key);
}
else
{
if (shiftdown ^ capslock)
key = shiftxform[key];
}
}
else
{
if (cv_keyboardlayout.value == 3)
{
if (shiftdown)
key = shiftxform[key];
else if (altdown & 0x2)
key = french_altgrxform[key];
else
key = HU_FallBackFrSpecialLetter(key);
}
else
{
if (shiftdown)
key = shiftxform[key];
}
}
}
key = CON_ShiftChar(key);
// enter a char into the command prompt
if (key < 32 || key > 127)
+30 -80
View File
@@ -533,6 +533,32 @@ static consvar_t cv_dummylives = {"dummylives", "0", CV_HIDEN, liveslimit_cons_t
static consvar_t cv_dummycontinues = {"dummycontinues", "0", CV_HIDEN, liveslimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_dummystaff = {"dummystaff", "0", CV_HIDEN|CV_CALL, dummystaff_cons_t, Dummystaff_OnChange, 0, NULL, NULL, 0, 0, NULL};
static INT32 M_ShiftChar(INT32 ch)
{
if (I_UseNativeKeyboard())
return ch;
if (cv_keyboardlayout.value == 3)
{
if (ch >= 32 && ch <= 141)
{
if (shiftdown)
ch = shiftxform[ch];
else if (altdown & 0x2)
ch = french_altgrxform[ch];
else
ch = HU_FallBackFrSpecialLetter(ch);
}
}
else
{
if (shiftdown && ch >= 32 && ch <= 127)
ch = shiftxform[ch];
}
return ch;
}
// ==========================================================================
// ORGANIZATION START.
// ==========================================================================
@@ -3300,26 +3326,7 @@ static boolean M_ChangeStringCvar(INT32 choice)
char buf[MAXSTRINGLENGTH];
size_t len;
if (!I_UseNativeKeyboard())
{
if (cv_keyboardlayout.value == 3)
{
if (choice >= 32 && choice <= 141)
{
if (shiftdown)
choice = shiftxform[choice];
else if (altdown & 0x2)
choice = french_altgrxform[choice];
else
choice = HU_FallBackFrSpecialLetter(choice);
}
}
else
{
if (shiftdown && choice >= 32 && choice <= 127)
choice = shiftxform[choice];
}
}
choice = M_ShiftChar(choice);
switch (choice)
{
@@ -3666,26 +3673,7 @@ boolean M_Responder(event_t *ev)
if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER)
{
menu_text_input = true;
if (!I_UseNativeKeyboard())
{
if (cv_keyboardlayout.value == 3)
{
if(ch >= 32 && ch <= 141)
{
if (shiftdown)
ch = shiftxform[ch];
else if (altdown & 0x2)
ch = french_altgrxform[ch];
else
ch = HU_FallBackFrSpecialLetter(ch);
}
}
else
{
if (shiftdown && ch >= 32 && ch <= 127)
ch = shiftxform[ch];
}
}
ch = M_ShiftChar(ch);
routine(ch);
return true;
}
@@ -3725,26 +3713,7 @@ boolean M_Responder(event_t *ev)
if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING)
{
menu_text_input = true;
if (!I_UseNativeKeyboard())
{
if (cv_keyboardlayout.value == 3)
{
if(ch >= 32 && ch <= 141)
{
if (shiftdown)
ch = shiftxform[ch];
else if (altdown & 0x2)
ch = french_altgrxform[ch];
else
ch = HU_FallBackFrSpecialLetter(ch);
}
}
else
{
if (shiftdown && ch >= 32 && ch <= 127)
ch = shiftxform[ch];
}
}
ch = M_ShiftChar(ch);
if (M_ChangeStringCvar(ch))
return true;
else
@@ -6438,26 +6407,7 @@ static void M_AddonAutoLoad(INT32 ch)
#define len menusearch[0]
static boolean M_ChangeStringAddons(INT32 choice)
{
if (!I_UseNativeKeyboard())
{
if (cv_keyboardlayout.value == 3)
{
if(choice >= 32 && choice <= 141)
{
if(shiftdown)
choice = shiftxform[choice];
else if(altdown & 0x2)
choice = french_altgrxform[choice];
else
choice = HU_FallBackFrSpecialLetter(choice);
}
}
else
{
if (shiftdown && choice >= 32 && choice <= 127)
choice = shiftxform[choice];
}
}
choice = M_ShiftChar(choice);
switch (choice)
{