summaryrefslogtreecommitdiff
path: root/src/r_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/r_draw.c')
-rw-r--r--src/r_draw.c173
1 files changed, 125 insertions, 48 deletions
diff --git a/src/r_draw.c b/src/r_draw.c
index ef735f06..afda7a86 100644
--- 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 @@ void R_DrawColumnLow (void)
byte* dest2;
fixed_t frac;
fixed_t fracstep;
+ int x;
count = dc_yh - dc_yl;
@@ -246,10 +250,10 @@ void R_DrawColumnLow (void)
// 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 @@ void R_DrawFuzzColumn (void)
if (count < 0)
return;
-
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0 || dc_yh >= SCREENHEIGHT)
@@ -325,35 +328,74 @@ void R_DrawFuzzColumn (void)
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)
- {
- 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
+ // Looks like an attempt at dithering,
+ // using the colormap #6 (of 0-31, a bit
+ // brighter than average).
+ do
{
- 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,18 +411,21 @@ void R_DrawFuzzColumn (void)
// 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)
fuzzpos = 0;
dest += SCREENWIDTH;
+ dest2 += SCREENWIDTH;
frac += fracstep;
} while (count--);
}
+
//
@@ -418,27 +463,57 @@ void R_DrawTranslatedColumn (void)
#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;
@@ -453,7 +528,9 @@ void R_DrawTranslatedColumn (void)
// 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 @@ void R_DrawSpanLow (void)
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 @@ void R_DrawSpanLow (void)
dest = ylookup[ds_y] + columnofs[ds_x1];
-
- count = ds_x2 - ds_x1;
do
{
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);