From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wi0-f182.google.com ([209.85.212.182]) by ur; Sun Aug 16 16:02:10 EDT 2015 Received: by wicja10 with SMTP id ja10so55996704wic.1 for <9front@9front.org>; Sun, 16 Aug 2015 13:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=e9mo7ZMkQaQiDFSAO/sXNSEKYbzwxdBv/aRG4GWe2U8=; b=bJhyHtbUOwkVRBXdJBhH/wDm8uTTJ1hfXf8MDfXCKa+DwPty3/VpRHY+Z5Q/u3LKVr aUwYWN/wru7AOGKnH9eKekPA47ImYfJNREBx3WCdZQH4aSOyvEkWhWYQbcNrjw6dK8+0 Lrr/IKsNVYQZR1fWjS8xmdMNy5lZfbWaV06S52k5jcRJmaot/wH9nrm4pFa/N1Svn2+U XYviKvtFDanTFeHgdWndveCPp2NiFKq5BMqKowvHgfh43Z/OyzC0LZYg7QagpXzPPDcz OTufdCvJcDjtz26c3oK15QXhoPIrz3JqsKLTJ6hFAx2V+9+yvGokJlFtjiChFAK6Ziv6 pWLQ== MIME-Version: 1.0 X-Received: by 10.195.13.200 with SMTP id fa8mr21535781wjd.9.1439755328273; Sun, 16 Aug 2015 13:02:08 -0700 (PDT) Received: by 10.28.229.135 with HTTP; Sun, 16 Aug 2015 13:02:08 -0700 (PDT) Date: Sun, 16 Aug 2015 23:02:08 +0300 Message-ID: List-ID: <9front.9front.org> X-Glyph: ➈ X-Bullshit: distributed webscale TOR DOM-scale package-oriented optimizer Subject: games/doom: fix gamma correction and key translation From: qux To: 9front@9front.org Content-Type: text/plain; charset=UTF-8 games/doom: fix gamma correction and key translation KEY_F11 and KEY_F12 are not KEY_F1+11 and KEY_F1+12 as it is assumed in runetokey(), which prevents these keystrokes from being used. rather than change runetokey(), it seems better to just change the key definitions in doomdef.h (the new values don't correspond to any other keys anyway). F11 is the gamma correction key. to make gamma correction actually work, i_video.c:I_SetPalette must also take into account usegamma (this was just never ported). cf i_video.c:UploadNewPalette in source code release. F12 is the spycam key. the spycam switches the renderview to a different player during a coop game, or when watching a multiplayer demo. this feature only changes the renderview; sounds, palette effects, status bar, etc. are still from the first player's perspective. diff -Naur a/sys/src/games/doom/doomdef.h b/sys/src/games/doom/doomdef.h --- a/sys/src/games/doom/doomdef.h Sun Apr 26 00:08:10 2015 +++ b/sys/src/games/doom/doomdef.h Sun Aug 16 20:13:42 2015 @@ -248,8 +248,8 @@ #define KEY_F8 (0x80+0x42) #define KEY_F9 (0x80+0x43) #define KEY_F10 (0x80+0x44) -#define KEY_F11 (0x80+0x57) -#define KEY_F12 (0x80+0x58) +#define KEY_F11 (0x80+0x45) +#define KEY_F12 (0x80+0x46) #define KEY_BACKSPACE 127 #define KEY_PAUSE 0xff diff -Naur a/sys/src/games/doom/i_video.c b/sys/src/games/doom/i_video.c --- a/sys/src/games/doom/i_video.c Wed Jul 29 13:45:35 2015 +++ b/sys/src/games/doom/i_video.c Sun Aug 16 20:20:57 2015 @@ -73,7 +73,11 @@ void I_SetPalette(byte *palette) { - memcpy(cmap, palette, 3*256); + uchar *c; + + c = cmap; + while(c < cmap+3*256) + *c++ = gammatable[usegamma][*palette++]; } void I_UpdateNoBlit(void)