summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2005-08-06 18:37:47 +0000
committerSimon Howard2005-08-06 18:37:47 +0000
commiteff0a337f498aa7cf3a4735a8be5a5b3ace172d9 (patch)
tree7d7c7aaae7d96ba828abd4045e62b2b768efd479 /src
parent89ac13b4f2bf950bec584fe8adc4aa1c8748c3e2 (diff)
downloadchocolate-doom-eff0a337f498aa7cf3a4735a8be5a5b3ace172d9.tar.gz
chocolate-doom-eff0a337f498aa7cf3a4735a8be5a5b3ace172d9.tar.bz2
chocolate-doom-eff0a337f498aa7cf3a4735a8be5a5b3ace172d9.zip
Fix low resolution mode
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 45
Diffstat (limited to 'src')
-rw-r--r--src/m_menu.c16
-rw-r--r--src/r_draw.c173
-rw-r--r--src/r_main.c11
-rw-r--r--src/r_main.h6
-rw-r--r--src/r_things.c9
5 files changed, 150 insertions, 65 deletions
diff --git a/src/m_menu.c b/src/m_menu.c
index 4d9adf74..aa87fcef 100644
--- 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 @@ void M_ChangeDetail(int choice)
choice = 0;
detailLevel = 1 - detailLevel;
- // FIXME - does not work. Remove anyway?
- fprintf( stderr, "M_ChangeDetail: low detail mode n.a.\n");
-
- return;
-
- /*R_SetViewSize (screenblocks, detailLevel);
+ R_SetViewSize (screenblocks, detailLevel);
if (!detailLevel)
players[consoleplayer].message = DETAILHI;
else
- players[consoleplayer].message = DETAILLO;*/
+ players[consoleplayer].message = DETAILLO;
}
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);
diff --git a/src/r_main.c b/src/r_main.c
index d2d8bbb4..ba230097 100644
--- 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 @@ void R_ExecuteSetViewSize (void)
else
{
colfunc = basecolfunc = R_DrawColumnLow;
- fuzzcolfunc = R_DrawFuzzColumn;
- transcolfunc = R_DrawTranslatedColumn;
+ fuzzcolfunc = R_DrawFuzzColumnLow;
+ transcolfunc = R_DrawTranslatedColumnLow;
spanfunc = R_DrawSpanLow;
}
diff --git a/src/r_main.h b/src/r_main.h
index de2d8736..870c2e0a 100644
--- 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 @@ extern int detailshift;
// 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 @@ void R_SetViewSize (int blocks, int detail);
//-----------------------------------------------------------------------------
//
// $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
//
diff --git a/src/r_things.c b/src/r_things.c
index 779354dc..86dabd6c 100644
--- 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 @@ R_DrawVisSprite
}
else if (vis->mobjflags & MF_TRANSLATION)
{
- colfunc = R_DrawTranslatedColumn;
+ colfunc = transcolfunc;
dc_translation = translationtables - 256 +
( (vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT-8) );
}