Merge branch 'chat-changes' into 'master'

Fix capslock wonkyness

See merge request KartKrew/Kart!98
This commit is contained in:
Sal 2018-11-17 16:54:56 -05:00
commit c419d973a3
3 changed files with 36 additions and 18 deletions

View file

@ -1098,8 +1098,17 @@ boolean CON_Responder(event_t *ev)
return true; return true;
} }
if (capslock ^ shiftdown) // gets capslock to work because capslock is cool // same capslock code as hu_stuff.c's HU_responder. Check there for details.
key = shiftxform[key]; if ((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z'))
{
if (shiftdown ^ capslock)
key = shiftxform[key];
}
else
{
if (shiftdown)
key = shiftxform[key];
}
// enter a char into the command prompt // enter a char into the command prompt
if (key < 32 || key > 127) if (key < 32 || key > 127)

View file

@ -3603,7 +3603,7 @@ void G_NextLevel(void)
forceresetplayers = false; forceresetplayers = false;
deferencoremode = (boolean)cv_kartencore.value; deferencoremode = (boolean)cv_kartencore.value;
} }
gameaction = ga_worlddone; gameaction = ga_worlddone;
} }
@ -5706,7 +5706,7 @@ void G_DeferedPlayDemo(const char *name)
// //
// Start a demo from a .LMP file or from a wad resource // Start a demo from a .LMP file or from a wad resource
// //
#define SKIPERRORS #define SKIPERRORS
void G_DoPlayDemo(char *defdemoname) void G_DoPlayDemo(char *defdemoname)
{ {
UINT8 i; UINT8 i;

View file

@ -1074,6 +1074,18 @@ boolean HU_Responder(event_t *ev)
return false; return false;
} }
c = (INT32)ev->data1;
// capslock (now handled outside of chat on so that it works everytime......)
if (c && c == KEY_CAPSLOCK) // it's a toggle.
{
if (capslock)
capslock = false;
else
capslock = true;
return true;
}
if (!chat_on) if (!chat_on)
{ {
// enter chat mode // enter chat mode
@ -1109,21 +1121,18 @@ boolean HU_Responder(event_t *ev)
c = (INT32)ev->data1; c = (INT32)ev->data1;
// capslock // I know this looks very messy but this works. If it ain't broke, don't fix it!
if (c && c == KEY_CAPSLOCK) // it's a toggle. // shift LETTERS to uppercase if we have capslock or are holding shift
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
{ {
if (capslock) if (shiftdown ^ capslock)
capslock = false; c = shiftxform[c];
else }
capslock = true; else // if we're holding shift we should still shift non letter symbols
return true; {
if (shiftdown)
c = shiftxform[c];
} }
// use console translations
if (shiftdown ^ capslock)
c = shiftxform[c];
// TODO: make chat behave like the console, so that we can go back and edit stuff when we fuck up.
// pasting. pasting is cool. chat is a bit limited, though :( // pasting. pasting is cool. chat is a bit limited, though :(
if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE) if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE)
@ -2114,7 +2123,7 @@ void HU_Drawer(void)
LUAh_ScoresHUD(); LUAh_ScoresHUD();
#endif #endif
} }
} }
if (gamestate != GS_LEVEL) if (gamestate != GS_LEVEL)
return; return;