ref: eff0a337f498aa7cf3a4735a8be5a5b3ace172d9
parent: 89ac13b4f2bf950bec584fe8adc4aa1c8748c3e2
author: Simon Howard <[email protected]>
date: Sat Aug 6 14:37:47 EDT 2005
Fix low resolution mode Subversion-branch: /trunk/chocolate-doom Subversion-revision: 45
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_menu.c 17 2005-07-23 18:54:30Z fraggle $
+// $Id: m_menu.c 45 2005-08-06 18:37:47Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.4 2005/08/06 18:37:46 fraggle
+// Fix low resolution mode
+//
// Revision 1.3 2005/07/23 18:54:30 fraggle
// Fix quit prompt not displayed properly
//
@@ -39,7 +42,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: m_menu.c 17 2005-07-23 18:54:30Z fraggle $";
+rcsid[] = "$Id: m_menu.c 45 2005-08-06 18:37:47Z fraggle $";
#include <unistd.h>
#include <sys/types.h>
@@ -1149,17 +1152,12 @@
choice = 0;
detailLevel = 1 - detailLevel;
- // FIXME - does not work. Remove anyway?
- fprintf( stderr, "M_ChangeDetail: low detail mode n.a.\n");
+ R_SetViewSize (screenblocks, detailLevel);
- return;
-
- /*R_SetViewSize (screenblocks, detailLevel);
-
if (!detailLevel)
players[consoleplayer].message = DETAILHI;
else
- players[consoleplayer].message = DETAILLO;*/
+ players[consoleplayer].message = DETAILLO;
}
--- a/src/r_draw.c
+++ b/src/r_draw.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: r_draw.c 8 2005-07-23 16:44:57Z fraggle $
+// $Id: r_draw.c 45 2005-08-06 18:37:47Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.3 2005/08/06 18:37:47 fraggle
+// Fix low resolution mode
+//
// Revision 1.2 2005/07/23 16:44:56 fraggle
// Update copyright to GNU GPL
//
@@ -38,7 +41,7 @@
static const char
-rcsid[] = "$Id: r_draw.c 8 2005-07-23 16:44:57Z fraggle $";
+rcsid[] = "$Id: r_draw.c 45 2005-08-06 18:37:47Z fraggle $";
#include "doomdef.h"
@@ -228,6 +231,7 @@
byte* dest2;
fixed_t frac;
fixed_t fracstep;
+ int x;
count = dc_yh - dc_yl;
@@ -246,10 +250,10 @@
// dccount++;
#endif
// Blocky mode, need to multiply by 2.
- dc_x <<= 1;
+ x = dc_x << 1;
- dest = ylookup[dc_yl] + columnofs[dc_x];
- dest2 = ylookup[dc_yl] + columnofs[dc_x+1];
+ dest = ylookup[dc_yl] + columnofs[x];
+ dest2 = ylookup[dc_yl] + columnofs[x+1];
fracstep = dc_iscale;
frac = dc_texturemid + (dc_yl-centery)*fracstep;
@@ -316,7 +320,6 @@
if (count < 0)
return;
-
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0 || dc_yh >= SCREENHEIGHT)
@@ -325,35 +328,74 @@
dc_yl, dc_yh, dc_x);
}
#endif
+
+ dest = ylookup[dc_yl] + columnofs[dc_x];
+ // Looks familiar.
+ fracstep = dc_iscale;
+ frac = dc_texturemid + (dc_yl-centery)*fracstep;
- // Keep till detailshift bug in blocky mode fixed,
- // or blocky mode removed.
- /* WATCOM code
- if (detailshift)
+ // Looks like an attempt at dithering,
+ // using the colormap #6 (of 0-31, a bit
+ // brighter than average).
+ do
{
- if (dc_x & 1)
- {
- outpw (GC_INDEX,GC_READMAP+(2<<8) );
- outp (SC_INDEX+1,12);
- }
- else
- {
- outpw (GC_INDEX,GC_READMAP);
- outp (SC_INDEX+1,3);
- }
- dest = destview + dc_yl*80 + (dc_x>>1);
- }
- else
- {
- outpw (GC_INDEX,GC_READMAP+((dc_x&3)<<8) );
- outp (SC_INDEX+1,1<<(dc_x&3));
- dest = destview + dc_yl*80 + (dc_x>>2);
- }*/
+ // Lookup framebuffer, and retrieve
+ // a pixel that is either one column
+ // left or right of the current one.
+ // Add index from colormap to index.
+ *dest = colormaps[6*256+dest[fuzzoffset[fuzzpos]]];
+ // Clamp table lookup index.
+ if (++fuzzpos == FUZZTABLE)
+ fuzzpos = 0;
+
+ dest += SCREENWIDTH;
+
+ frac += fracstep;
+ } while (count--);
+}
+
+// low detail mode version
+
+void R_DrawFuzzColumnLow (void)
+{
+ int count;
+ byte* dest;
+ byte* dest2;
+ fixed_t frac;
+ fixed_t fracstep;
+ int x;
+
+ // Adjust borders. Low...
+ if (!dc_yl)
+ dc_yl = 1;
+
+ // .. and high.
+ if (dc_yh == viewheight-1)
+ dc_yh = viewheight - 2;
+
+ count = dc_yh - dc_yl;
+
+ // Zero length.
+ if (count < 0)
+ return;
+
+ // low detail mode, need to multiply by 2
- // Does not work with blocky mode.
- dest = ylookup[dc_yl] + columnofs[dc_x];
+ x = dc_x << 1;
+
+#ifdef RANGECHECK
+ if ((unsigned)x >= SCREENWIDTH
+ || dc_yl < 0 || dc_yh >= SCREENHEIGHT)
+ {
+ I_Error ("R_DrawFuzzColumn: %i to %i at %i",
+ dc_yl, dc_yh, dc_x);
+ }
+#endif
+
+ dest = ylookup[dc_yl] + columnofs[x];
+ dest2 = ylookup[dc_yl] + columnofs[x+1];
// Looks familiar.
fracstep = dc_iscale;
@@ -369,6 +411,7 @@
// left or right of the current one.
// Add index from colormap to index.
*dest = colormaps[6*256+dest[fuzzoffset[fuzzpos]]];
+ *dest2 = colormaps[6*256+dest2[fuzzoffset[fuzzpos]]];
// Clamp table lookup index.
if (++fuzzpos == FUZZTABLE)
@@ -375,6 +418,7 @@
fuzzpos = 0;
dest += SCREENWIDTH;
+ dest2 += SCREENWIDTH;
frac += fracstep;
} while (count--);
@@ -381,6 +425,7 @@
}
+
//
@@ -418,28 +463,58 @@
#endif
- // WATCOM VGA specific.
- /* Keep for fixing.
- if (detailshift)
+ dest = ylookup[dc_yl] + columnofs[dc_x];
+
+ // Looks familiar.
+ fracstep = dc_iscale;
+ frac = dc_texturemid + (dc_yl-centery)*fracstep;
+
+ // Here we do an additional index re-mapping.
+ do
{
- if (dc_x & 1)
- outp (SC_INDEX+1,12);
- else
- outp (SC_INDEX+1,3);
+ // Translation tables are used
+ // to map certain colorramps to other ones,
+ // used with PLAY sprites.
+ // Thus the "green" ramp of the player 0 sprite
+ // is mapped to gray, red, black/indigo.
+ *dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
+ dest += SCREENWIDTH;
- dest = destview + dc_yl*80 + (dc_x>>1);
- }
- else
- {
- outp (SC_INDEX+1,1<<(dc_x&3));
+ frac += fracstep;
+ } while (count--);
+}
- dest = destview + dc_yl*80 + (dc_x>>2);
- }*/
+void R_DrawTranslatedColumnLow (void)
+{
+ int count;
+ byte* dest;
+ byte* dest2;
+ fixed_t frac;
+ fixed_t fracstep;
+ int x;
+
+ count = dc_yh - dc_yl;
+ if (count < 0)
+ return;
+ // low detail, need to scale by 2
+ x = dc_x << 1;
+
+#ifdef RANGECHECK
+ if ((unsigned)x >= SCREENWIDTH
+ || dc_yl < 0
+ || dc_yh >= SCREENHEIGHT)
+ {
+ I_Error ( "R_DrawColumn: %i to %i at %i",
+ dc_yl, dc_yh, x);
+ }
- // FIXME. As above.
- dest = ylookup[dc_yl] + columnofs[dc_x];
+#endif
+
+ dest = ylookup[dc_yl] + columnofs[x];
+ dest2 = ylookup[dc_yl] + columnofs[x+1];
+
// Looks familiar.
fracstep = dc_iscale;
frac = dc_texturemid + (dc_yl-centery)*fracstep;
@@ -453,7 +528,9 @@
// Thus the "green" ramp of the player 0 sprite
// is mapped to gray, red, black/indigo.
*dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
+ *dest2 = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
dest += SCREENWIDTH;
+ dest2 += SCREENWIDTH;
frac += fracstep;
} while (count--);
@@ -675,6 +752,8 @@
xfrac = ds_xfrac;
yfrac = ds_yfrac;
+
+ count = (ds_x2 - ds_x1);
// Blocky mode, need to multiply by 2.
ds_x1 <<= 1;
@@ -682,8 +761,6 @@
dest = ylookup[ds_y] + columnofs[ds_x1];
-
- count = ds_x2 - ds_x1;
do
{
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);
--- a/src/r_main.c
+++ b/src/r_main.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: r_main.c 25 2005-07-23 23:07:04Z fraggle $
+// $Id: r_main.c 45 2005-08-06 18:37:47Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.6 2005/08/06 18:37:47 fraggle
+// Fix low resolution mode
+//
// Revision 1.5 2005/07/23 23:07:04 fraggle
// Add back previously removed printfs as '.'s for startup progress bar
//
@@ -46,7 +49,7 @@
//-----------------------------------------------------------------------------
-static const char rcsid[] = "$Id: r_main.c 25 2005-07-23 23:07:04Z fraggle $";
+static const char rcsid[] = "$Id: r_main.c 45 2005-08-06 18:37:47Z fraggle $";
@@ -731,8 +734,8 @@
else
{
colfunc = basecolfunc = R_DrawColumnLow;
- fuzzcolfunc = R_DrawFuzzColumn;
- transcolfunc = R_DrawTranslatedColumn;
+ fuzzcolfunc = R_DrawFuzzColumnLow;
+ transcolfunc = R_DrawTranslatedColumnLow;
spanfunc = R_DrawSpanLow;
}
--- a/src/r_main.h
+++ b/src/r_main.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: r_main.h 18 2005-07-23 18:56:07Z fraggle $
+// $Id: r_main.h 45 2005-08-06 18:37:47Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -102,6 +102,7 @@
// Used to select shadow mode etc.
//
extern void (*colfunc) (void);
+extern void (*transcolfunc) (void);
extern void (*basecolfunc) (void);
extern void (*fuzzcolfunc) (void);
// No shadow effects on floors.
@@ -172,6 +173,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
+// Revision 1.4 2005/08/06 18:37:47 fraggle
+// Fix low resolution mode
+//
// Revision 1.3 2005/07/23 18:56:07 fraggle
// Remove unneccessary pragmas
//
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: r_things.c 37 2005-08-04 18:42:15Z fraggle $
+// $Id: r_things.c 45 2005-08-06 18:37:47Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.5 2005/08/06 18:37:47 fraggle
+// Fix low resolution mode
+//
// Revision 1.4 2005/08/04 18:42:15 fraggle
// Silence compiler warnings
//
@@ -42,7 +45,7 @@
static const char
-rcsid[] = "$Id: r_things.c 37 2005-08-04 18:42:15Z fraggle $";
+rcsid[] = "$Id: r_things.c 45 2005-08-06 18:37:47Z fraggle $";
#include <stdio.h>
@@ -435,7 +438,7 @@
}
else if (vis->mobjflags & MF_TRANSLATION)
{
- colfunc = R_DrawTranslatedColumn;
+ colfunc = transcolfunc;
dc_translation = translationtables - 256 +
( (vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT-8) );
}