From: havoc Date: Sun, 19 Jun 2005 23:02:51 +0000 (+0000) Subject: changed keydown[] from unsigned int holding key repeat count to qbyte holding status... X-Git-Tag: xonotic-v0.1.0preview~4729 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=59eb52a8948e5bcaaa12590ff71ae7e9c401a0f0 changed keydown[] from unsigned int holding key repeat count to qbyte holding status (0 = up, 1 = down, 2 = repeating) to save 3K of memory git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5454 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/keys.c b/keys.c index 4db23bae..da4320e0 100644 --- a/keys.c +++ b/keys.c @@ -44,7 +44,7 @@ static qboolean consolekeys[1024]; // if true, can't be rebound while in // console static qboolean menubound[1024]; // if true, can't be rebound while in // menu -static unsigned int keydown[1024]; // if > 1, it is autorepeating +static qbyte keydown[1024]; // 0 = up, 1 = down, 2 = repeating typedef struct { const char *name; @@ -841,7 +841,7 @@ Key_Event (int key, char ascii, qboolean down) // update key repeats if( down ) { - keydown[ key ]++; + keydown[ key ] = min(keydown[ key ] + 1, 2); if( keydown[ key ] > 1 ) { if( (key_consoleactive && !consolekeys[key]) || USERPLAYING() ) return; // ignore most autorepeats @@ -957,7 +957,7 @@ Key_Event (int key, char ascii, qboolean down) // increment key repeat count each time a down is received so that things // which want to ignore key repeat can ignore it - keydown[key]++; + keydown[key] = min(keydown[key] + 1, 2); // key_consoleactive is a flag not a key_dest because the console is a // high priority overlay ontop of the normal screen (designed as a safety @@ -1083,7 +1083,7 @@ Key_Event (int key, char ascii, qboolean down) // update auto-repeat status if (down) { - keydown[key]++; + keydown[key] = min(keydown[key] + 1, 2); if (keydown[key] > 1) { if ((key_consoleactive && !consolekeys[key]) || (!key_consoleactive && key_dest == key_game &&