From 82c397bde642ecacce33911c4d97b3cf664209c7 Mon Sep 17 00:00:00 2001 From: Tomas 'ZeXx86' Jedrzejek Date: Sun, 19 Apr 2009 11:09:58 +0200 Subject: Alternative ASCII character support in game chat Small cleanup in browser.c file Address filter for widget textfield was updated --- src/client/chat.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/client/chat.c') diff --git a/src/client/chat.c b/src/client/chat.c index 019445f..b6904c9 100644 --- a/src/client/chat.c +++ b/src/client/chat.c @@ -119,7 +119,21 @@ static void processMessageKey(SDL_keysym keysym) { int w, h; int len; - //int i; + unsigned n; + + char shift_map[] = { + '-', '_', + '=', '+', + '[', '{', + ']', '}', + ';', ':', + '/', '\"', + '\\', '|', + ',', '<', + '.', '>', + '/', '?', + ')', '(', + }; if (line_atime < 100) line_atime++; @@ -145,9 +159,15 @@ static void processMessageKey(SDL_keysym keysym) */ char c = keysym.sym; - /* TODO: should correspond with ASCII table */ - if (keysym.mod & KMOD_RSHIFT) - c --; + if (keysym.mod & KMOD_RSHIFT) { + for (n = 0; n < sizeof (shift_map); n += 2) { + if (c == shift_map[n]) { + c = shift_map[n+1]; + break; + } + } + } + line[len] = c; return; -- cgit v1.2.3