commit 8f980fe24cb3144bf7bcb6dbcb4f29ef554fbaa3
Author: Simon Howard <fraggle@gmail.com>
AuthorDate: Sun Oct 16 16:59:19 2011 +0000
Commit: Simon Howard <fraggle@gmail.com>
CommitDate: Sun Oct 16 16:59:19 2011 +0000
Zero out bottom two bits of palette data, to more accurately emulate the
PC hardware that only supports 6 bits per channel (thanks GhostlyDeath).
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2433
---
NEWS | 2 ++
src/i_video.c | 11 +++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 425da376..36d7180a 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@
* Updated COPYING to current version of GPL2 (thanks Rahul
Sundaram).
* Fix bug with detection of IWAD type by filename (thanks mether).
+ * Reduce palette accuracy to 6 bits per channel, to more accurately
+ emulate the PC VGA hardware (thanks GhostlyDeath).
1.6.0 (2011-05-17):
diff --git a/src/i_video.c b/src/i_video.c
index 15e4a6b7..d671a228 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -956,11 +956,14 @@ void I_SetPalette (byte *doompalette)
{
int i;
- for (i=0; i<256; ++i)
+ for (i=0; i<256; ++i)
{
- palette[i].r = gammatable[usegamma][*doompalette++];
- palette[i].g = gammatable[usegamma][*doompalette++];
- palette[i].b = gammatable[usegamma][*doompalette++];
+ // Zero out the bottom two bits of each channel - the PC VGA
+ // controller only supports 6 bits of accuracy.
+
+ palette[i].r = gammatable[usegamma][*doompalette++] & ~3;
+ palette[i].g = gammatable[usegamma][*doompalette++] & ~3;
+ palette[i].b = gammatable[usegamma][*doompalette++] & ~3;
}
palette_to_set = true;