1
0
Fork 0
forked from len0rd/rockbox

Update adds prboom's high resolution support, also makes the scaling for platforms w/ resolution less then 320x200 much nicer. IDoom's lookup table code has been removed. Also fixed a pallete bug. Some graphic errors are present in menu and status bar. Also updates some headers and output formatting.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9418 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Karl Kurbjun 2006-04-02 01:52:44 +00:00
parent e61b079c26
commit 51db2d3f2c
18 changed files with 569 additions and 537 deletions

View file

@ -629,35 +629,35 @@ void D_DoomMainSetup(void)
else if (M_CheckParm ("-deathmatch")) else if (M_CheckParm ("-deathmatch"))
deathmatch = 1; deathmatch = 1;
printf("Welcome to Rockdoom"); printf("Welcome to Rockdoom\n");
switch ( gamemode ) switch ( gamemode )
{ {
case retail: case retail:
printf ("The Ultimate DOOM Startup v%d.%d",DVERSION/100,DVERSION%100); printf ("The Ultimate DOOM Startup v%d.%d\n",DVERSION/100,DVERSION%100);
break; break;
case shareware: case shareware:
printf ("DOOM Shareware Startup v%d.%d",DVERSION/100,DVERSION%100); printf ("DOOM Shareware Startup v%d.%d\n",DVERSION/100,DVERSION%100);
break; break;
case registered: case registered:
printf ("DOOM Registered Startup v%d.%d",DVERSION/100,DVERSION%100); printf ("DOOM Registered Startup v%d.%d\n",DVERSION/100,DVERSION%100);
break; break;
case commercial: case commercial:
switch (gamemission) switch (gamemission)
{ {
case pack_plut: case pack_plut:
printf ("DOOM 2: Plutonia Experiment v%d.%d",DVERSION/100,DVERSION%100); printf ("DOOM 2: Plutonia Experiment v%d.%d\n",DVERSION/100,DVERSION%100);
break; break;
case pack_tnt: case pack_tnt:
printf ("DOOM 2: TNT - Evilution v%d.%d",DVERSION/100,DVERSION%100); printf ("DOOM 2: TNT - Evilution v%d.%d\n",DVERSION/100,DVERSION%100);
break; break;
default: default:
printf ("DOOM 2: Hell on Earth v%d.%d",DVERSION/100,DVERSION%100); printf ("DOOM 2: Hell on Earth v%d.%d\n",DVERSION/100,DVERSION%100);
break; break;
} }
break; break;
default: default:
printf ("Public DOOM v%d.%d",DVERSION/100,DVERSION%100); printf ("Public DOOM v%d.%d\n",DVERSION/100,DVERSION%100);
break; break;
} }
@ -745,14 +745,14 @@ void D_DoomMainSetup(void)
int i; int i;
if ( gamemode == shareware) if ( gamemode == shareware)
I_Error("\nYou cannot -file with the shareware version. Register!"); I_Error("\nYou cannot -file with the shareware version. Register!\n");
// Check for fake IWAD with right name, // Check for fake IWAD with right name,
// but w/o all the lumps of the registered version. // but w/o all the lumps of the registered version.
if (gamemode == registered) if (gamemode == registered)
for (i = 0;i < 23; i++) for (i = 0;i < 23; i++)
if (W_CheckNumForName(name[i])<0) if (W_CheckNumForName(name[i])<0)
I_Error("\nThis is not the registered version."); I_Error("This is not the registered version.\n");
} }
// Iff additonal PWAD files are used, print modified banner // Iff additonal PWAD files are used, print modified banner

View file

@ -92,8 +92,10 @@ typedef enum {
#define MAX_SCREENWIDTH 1600 #define MAX_SCREENWIDTH 1600
#define MAX_SCREENHEIGHT 1200 #define MAX_SCREENHEIGHT 1200
#define SCREENWIDTH 320 #define SCREENWIDTH LCD_WIDTH
#define SCREENHEIGHT 200 //#define SCREENWIDTH 320
//#define SCREENHEIGHT 200
#define SCREENHEIGHT LCD_HEIGHT
// The maximum number of players, multiplayer/networking. // The maximum number of players, multiplayer/networking.
#define MAXPLAYERS 4 #define MAXPLAYERS 4

View file

@ -16,7 +16,10 @@
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// $Log$ // $Log$
// Revision 1.1 2006/03/28 15:44:01 dave // Revision 1.2 2006/04/02 01:52:44 kkurbjun
// Update adds prboom's high resolution support, also makes the scaling for platforms w/ resolution less then 320x200 much nicer. IDoom's lookup table code has been removed. Also fixed a pallete bug. Some graphic errors are present in menu and status bar. Also updates some headers and output formatting.
//
// Revision 1.1 2006-03-28 15:44:01 dave
// Patch #2969 - Doom! Currently only working on the H300. // Patch #2969 - Doom! Currently only working on the H300.
// //
// //
@ -120,7 +123,7 @@ void I_Error (char *error, ...)
vsnprintf(p_buf,sizeof(p_buf), error, ap); vsnprintf(p_buf,sizeof(p_buf), error, ap);
va_end(ap); va_end(ap);
printf("%s",p_buf); printf("%s\n",p_buf);
// Shutdown. Here might be other errors. // Shutdown. Here might be other errors.
if (demorecording) if (demorecording)

View file

@ -16,7 +16,10 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* $Log$ * $Log$
* Revision 1.2 2006/03/28 17:20:49 christian * Revision 1.3 2006/04/02 01:52:44 kkurbjun
* Update adds prboom's high resolution support, also makes the scaling for platforms w/ resolution less then 320x200 much nicer. IDoom's lookup table code has been removed. Also fixed a pallete bug. Some graphic errors are present in menu and status bar. Also updates some headers and output formatting.
*
* Revision 1.2 2006-03-28 17:20:49 christian
* added good (tm) button mappings for x5, and added ifdef for HAS_BUTTON_HOLD * added good (tm) button mappings for x5, and added ifdef for HAS_BUTTON_HOLD
* *
* Revision 1.1 2006-03-28 15:44:01 dave * Revision 1.1 2006-03-28 15:44:01 dave
@ -40,51 +43,12 @@
#include "doomdef.h" #include "doomdef.h"
#include "rockmacros.h" #include "rockmacros.h"
#if defined(CPU_COLDFIRE)
static char fastscreen[LCD_WIDTH*LCD_HEIGHT] IBSS_ATTR;
#endif
static fb_data palette[256] IBSS_ATTR; static fb_data palette[256] IBSS_ATTR;
static fb_data *paldata=NULL; static fb_data *paldata=NULL;
#if !defined(CPU_COLDFIRE) || defined(SIMULATOR)
/*
This code is credit to the IDOOM port. It is not used for the H300, but
serves as a good reference point for other targets.
*/
static fb_data * xtable = 0;
static fb_data * ytable1 = 0;
static fb_data * ytable2 = 0;
#define FLOOR4(a) \
(( a >> 2) << 2)
static int video_w, video_h;
static void genscalexytable(void)
{
// shall we use uint8_t intead of ints?
int y = video_h-1;
int x = video_w-1;
int i = 1 + (x>y?x:y);
xtable = malloc(sizeof(int)*video_w );
ytable1 = malloc(sizeof(int)*video_h );
ytable2 = malloc(sizeof(int)*video_h );
while(i--)
{
if(y>=0)
{
ytable1[y] = ((y*SCREENHEIGHT) / video_h) * SCREENWIDTH;
ytable2[y] = y*video_w;
y--;
}
if(x>=0)
{
xtable[x] = (x*SCREENWIDTH) / video_w;
x--;
}
}
}
#endif
// //
// I_ShutdownGraphics (NOT USED) // I_ShutdownGraphics (NOT USED)
// //
@ -360,9 +324,7 @@ void I_FinishUpdate (void)
{ {
#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) #if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
/* /*
Faster screen update than the lookuptables -> I'm wasting 7 pixels of width Lookup tables are no longer needed
though. This code also doesn't use the framebuffer so rockbox's drawing
functions will not work on top of the doom drawing.
*/ */
// Start the write // Start the write
@ -373,51 +335,27 @@ void I_FinishUpdate (void)
unsigned char *screenptr=screens[0]; unsigned char *screenptr=screens[0];
int wcnt=0, hcnt=0; int wcnt=0, hcnt=0;
*(volatile unsigned short *) 0xf0000002 = 0;
*(volatile unsigned short *) 0xf0000002 = 0;
*(volatile unsigned short *) 0xf0000002 = 0;
while(hcnt<LCD_HEIGHT) while(hcnt<LCD_HEIGHT)
{ {
while(wcnt<LCD_WIDTH-7) while(wcnt<LCD_WIDTH)
{ {
if((wcnt&0x01))
screenptr++; // Skip every so many pixels in Doom buffer
*(volatile unsigned short *)0xf0000002 = palette[*screenptr]; *(volatile unsigned short *)0xf0000002 = palette[*screenptr];
screenptr++; screenptr++;
wcnt++; wcnt++;
} }
screenptr++;
// move on past those 7 pixels
*(volatile unsigned short *) 0xf0000002 = 0;
*(volatile unsigned short *) 0xf0000002 = 0;
*(volatile unsigned short *) 0xf0000002 = 0;
*(volatile unsigned short *) 0xf0000002 = 0;
*(volatile unsigned short *) 0xf0000002 = 0;
*(volatile unsigned short *) 0xf0000002 = 0;
*(volatile unsigned short *) 0xf0000002 = 0;
wcnt=0; wcnt=0;
hcnt++; hcnt++;
if((hcnt&0x07)==0x07)
screenptr+=SCREENWIDTH; // Skip every 7th line
} }
#else #else
// The IDOOM code for screen updates
unsigned char paletteIndex; unsigned char paletteIndex;
int x, y; int x, y;
for (y = 0; y < video_h; y++) for (y = 0; y < LCD_HEIGHT; y++)
{ {
for (x = 0; x < video_w; x++) for (x = 0; x < LCD_WIDTH; x++)
{ {
#if LCD_HEIGHT >= SCREENHEIGHT paletteIndex = screens[0][y*SCREENWIDTH + x];
paletteIndex = screens[0][((y*SCREENHEIGHT) / video_h) rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex];
* SCREENWIDTH + x];
rb->lcd_framebuffer[y * video_w + x] = palette[paletteIndex];
#else
paletteIndex = screens[0][ytable1[y] +xtable[x]];
rb->lcd_framebuffer[x + ytable2[y]] = palette[paletteIndex];
#endif
} }
} }
rb->lcd_update(); rb->lcd_update();
@ -454,14 +392,12 @@ void I_InitGraphics(void)
printf("Starting Graphics engine\n"); printf("Starting Graphics engine\n");
/* Note: The other screens are initialized later */ /* Note: The other screens are initialized later */
screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char));
#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) #if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE); coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE);
screens[0] = fastscreen;
#else #else
// Don't know if this will fit in other IRAMs
video_h = LCD_HEIGHT; screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char));
video_w = FLOOR4(LCD_WIDTH); // From IDOOM, the width has to be a multiple of 4
genscalexytable();
#endif #endif
} }

View file

@ -29,21 +29,14 @@
* *
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
#include "doomdef.h" #include "doomstat.h"
#include "m_bbox.h" #include "m_bbox.h"
#include "i_system.h" #include "i_system.h"
#include "r_main.h" #include "r_main.h"
#include "r_segs.h"
#include "r_plane.h" #include "r_plane.h"
#include "r_things.h" #include "r_things.h"
#include "r_bsp.h" // cph - sanity checking
// State.
#include "doomstat.h"
#include "r_state.h"
#include "r_segs.h"
#include "rockmacros.h"
seg_t *curline; seg_t *curline;
side_t *sidedef; side_t *sidedef;
@ -52,13 +45,18 @@ sector_t *frontsector;
sector_t *backsector; sector_t *backsector;
drawseg_t *ds_p; drawseg_t *ds_p;
// killough 4/7/98: indicates doors closed wrt automap bugfix:
// cph - replaced by linedef rendering flags - int doorclosed;
// killough: New code which removes 2s linedef limit
drawseg_t *drawsegs; drawseg_t *drawsegs;
unsigned maxdrawsegs; unsigned maxdrawsegs;
// drawseg_t drawsegs[MAXDRAWSEGS]; // old code -- killough
// //
// R_ClearDrawSegs // R_ClearDrawSegs
// //
void R_ClearDrawSegs(void) void R_ClearDrawSegs(void)
{ {
ds_p = drawsegs; ds_p = drawsegs;
@ -79,16 +77,24 @@ byte solidcol[SCREENWIDTH] IBSS_ATTR;
void R_ClipWallSegment(int first, int last, boolean solid) void R_ClipWallSegment(int first, int last, boolean solid)
{ {
byte *p; byte *p;
while (first < last) { while (first < last)
if (solidcol[first]) { {
if (!(p = memchr(solidcol+first, 0, last-first))) return; // All solid if (solidcol[first])
{
if (!(p = memchr(solidcol+first, 0, last-first)))
return; // All solid
first = p - solidcol; first = p - solidcol;
} else { }
else
{
int to; int to;
if (!(p = memchr(solidcol+first, 1, last-first))) to = last; if (!(p = memchr(solidcol+first, 1, last-first)))
else to = p - solidcol; to = last;
else
to = p - solidcol;
R_StoreWallRange(first, to-1); R_StoreWallRange(first, to-1);
if (solid) { if (solid)
{
memset(solidcol+first,1,to-first); memset(solidcol+first,1,to-first);
} }
first = to; first = to;
@ -136,7 +142,8 @@ static void R_RecalcLineFlags(void)
) )
) )
linedef->r_flags = RF_CLOSED; linedef->r_flags = RF_CLOSED;
else { else
{
// Reject empty lines used for triggers // Reject empty lines used for triggers
// and special events. // and special events.
// Identical floor and ceiling on both sides, // Identical floor and ceiling on both sides,
@ -151,17 +158,22 @@ static void R_RecalcLineFlags(void)
sizeof(frontsector->ceiling_xoffs) + sizeof(frontsector->ceiling_yoffs) + sizeof(frontsector->ceiling_xoffs) + sizeof(frontsector->ceiling_yoffs) +
sizeof(frontsector->ceilingpic) + sizeof(frontsector->floorpic) + sizeof(frontsector->ceilingpic) + sizeof(frontsector->floorpic) +
sizeof(frontsector->lightlevel) + sizeof(frontsector->floorlightsec) + sizeof(frontsector->lightlevel) + sizeof(frontsector->floorlightsec) +
sizeof(frontsector->ceilinglightsec))) { sizeof(frontsector->ceilinglightsec)))
linedef->r_flags = 0; return; {
} else linedef->r_flags = 0;
return;
}
else
linedef->r_flags = RF_IGNORE; linedef->r_flags = RF_IGNORE;
} }
/* cph - I'm too lazy to try and work with offsets in this */ /* cph - I'm too lazy to try and work with offsets in this */
if (curline->sidedef->rowoffset) return; if (curline->sidedef->rowoffset)
return;
/* Now decide on texture tiling */ /* Now decide on texture tiling */
if (linedef->flags & ML_TWOSIDED) { if (linedef->flags & ML_TWOSIDED)
{
int c; int c;
/* Does top texture need tiling */ /* Does top texture need tiling */
@ -173,7 +185,9 @@ static void R_RecalcLineFlags(void)
if ((c = frontsector->floorheight - backsector->floorheight) > 0 && if ((c = frontsector->floorheight - backsector->floorheight) > 0 &&
(textureheight[texturetranslation[curline->sidedef->bottomtexture]] > c)) (textureheight[texturetranslation[curline->sidedef->bottomtexture]] > c))
linedef->r_flags |= RF_BOT_TILE; linedef->r_flags |= RF_BOT_TILE;
} else { }
else
{
int c; int c;
/* Does middle texture need tiling */ /* Does middle texture need tiling */
if ((c = frontsector->ceilingheight - frontsector->floorheight) > 0 && if ((c = frontsector->ceilingheight - frontsector->floorheight) > 0 &&
@ -228,13 +242,17 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->floor_xoffs = s->floor_xoffs; tempsec->floor_xoffs = s->floor_xoffs;
tempsec->floor_yoffs = s->floor_yoffs; tempsec->floor_yoffs = s->floor_yoffs;
if (underwater) { if (underwater)
if (s->ceilingpic == skyflatnum) { {
if (s->ceilingpic == skyflatnum)
{
tempsec->floorheight = tempsec->ceilingheight+1; tempsec->floorheight = tempsec->ceilingheight+1;
tempsec->ceilingpic = tempsec->floorpic; tempsec->ceilingpic = tempsec->floorpic;
tempsec->ceiling_xoffs = tempsec->floor_xoffs; tempsec->ceiling_xoffs = tempsec->floor_xoffs;
tempsec->ceiling_yoffs = tempsec->floor_yoffs; tempsec->ceiling_yoffs = tempsec->floor_yoffs;
} else { }
else
{
tempsec->ceilingpic = s->ceilingpic; tempsec->ceilingpic = s->ceilingpic;
tempsec->ceiling_xoffs = s->ceiling_xoffs; tempsec->ceiling_xoffs = s->ceiling_xoffs;
tempsec->ceiling_yoffs = s->ceiling_yoffs; tempsec->ceiling_yoffs = s->ceiling_yoffs;
@ -384,7 +402,8 @@ static void R_AddLine (seg_t *line)
static const int checkcoord[12][4] = // killough -- static const static const int checkcoord[12][4] = // killough -- static const
{ {
{3,0,2,1}, {
3,0,2,1},
{3,0,2,0}, {3,0,2,0},
{3,1,2,0}, {3,1,2,0},
{0}, {0},
@ -421,7 +440,8 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
// cph - replaced old code, which was unclear and badly commented // cph - replaced old code, which was unclear and badly commented
// Much more efficient code now // Much more efficient code now
if ((signed)angle1 < (signed)angle2) { /* it's "behind" us */ if ((signed)angle1 < (signed)angle2)
{ /* it's "behind" us */
/* Either angle1 or angle2 is behind us, so it doesn't matter if we /* Either angle1 or angle2 is behind us, so it doesn't matter if we
* change it to the corect sign * change it to the corect sign
*/ */
@ -431,10 +451,14 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
angle2 = INT_MIN; angle2 = INT_MIN;
} }
if ((signed)angle2 >= (signed)clipangle) return false; // Both off left edge if ((signed)angle2 >= (signed)clipangle)
if ((signed)angle1 <= -(signed)clipangle) return false; // Both off right edge return false; // Both off left edge
if ((signed)angle1 >= (signed)clipangle) angle1 = clipangle; // Clip at left edge if ((signed)angle1 <= -(signed)clipangle)
if ((signed)angle2 <= -(signed)clipangle) angle2 = 0-clipangle; // Clip at right edge return false; // Both off right edge
if ((signed)angle1 >= (signed)clipangle)
angle1 = clipangle; // Clip at left edge
if ((signed)angle2 <= -(signed)clipangle)
angle2 = 0-clipangle; // Clip at right edge
// Find the first clippost // Find the first clippost
// that touches the source post // that touches the source post
@ -450,7 +474,8 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
if (sx1 == sx2) if (sx1 == sx2)
return false; return false;
if (!memchr(solidcol+sx1, 0, sx2-sx1)) return false; if (!memchr(solidcol+sx1, 0, sx2-sx1))
return false;
// All columns it covers are already solidly covered // All columns it covers are already solidly covered
} }
@ -477,6 +502,7 @@ static void R_Subsector(int num)
int ceilinglightlevel; // killough 4/11/98 int ceilinglightlevel; // killough 4/11/98
#ifdef RANGECHECK #ifdef RANGECHECK
if (num>=numsubsectors) if (num>=numsubsectors)
I_Error ("R_Subsector: ss %i with numss = %i", num, numsubsectors); I_Error ("R_Subsector: ss %i with numss = %i", num, numsubsectors);
#endif #endif
@ -497,8 +523,7 @@ static void R_Subsector(int num)
floorplane = frontsector->floorheight < viewz || // killough 3/7/98 floorplane = frontsector->floorheight < viewz || // killough 3/7/98
(frontsector->heightsec != -1 && (frontsector->heightsec != -1 &&
sectors[frontsector->heightsec].ceilingpic == skyflatnum) sectors[frontsector->heightsec].ceilingpic == skyflatnum) ?
?
R_FindPlane(frontsector->floorheight, R_FindPlane(frontsector->floorheight,
frontsector->floorpic == skyflatnum && // kilough 10/98 frontsector->floorpic == skyflatnum && // kilough 10/98
frontsector->sky & PL_SKYFLAT ? frontsector->sky : frontsector->sky & PL_SKYFLAT ? frontsector->sky :
@ -511,8 +536,7 @@ static void R_Subsector(int num)
ceilingplane = frontsector->ceilingheight > viewz || ceilingplane = frontsector->ceilingheight > viewz ||
frontsector->ceilingpic == skyflatnum || frontsector->ceilingpic == skyflatnum ||
(frontsector->heightsec != -1 && (frontsector->heightsec != -1 &&
sectors[frontsector->heightsec].floorpic == skyflatnum) sectors[frontsector->heightsec].floorpic == skyflatnum) ?
?
R_FindPlane(frontsector->ceilingheight, // killough 3/8/98 R_FindPlane(frontsector->ceilingheight, // killough 3/8/98
frontsector->ceilingpic == skyflatnum && // kilough 10/98 frontsector->ceilingpic == skyflatnum && // kilough 10/98
frontsector->sky & PL_SKYFLAT ? frontsector->sky : frontsector->sky & PL_SKYFLAT ? frontsector->sky :

View file

@ -29,7 +29,6 @@
* *
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
#ifndef __R_BSP__ #ifndef __R_BSP__
#define __R_BSP__ #define __R_BSP__
@ -48,8 +47,6 @@ extern boolean segtextured;
extern boolean markfloor; /* false if the back side is the same plane */ extern boolean markfloor; /* false if the back side is the same plane */
extern boolean markceiling; extern boolean markceiling;
//extern boolean skymap;
/* old code -- killough: /* old code -- killough:
* extern drawseg_t drawsegs[MAXDRAWSEGS]; * extern drawseg_t drawsegs[MAXDRAWSEGS];
* new code -- killough: */ * new code -- killough: */
@ -58,15 +55,6 @@ extern unsigned maxdrawsegs;
extern drawseg_t *ds_p; extern drawseg_t *ds_p;
/*extern lighttable_t** hscalelight;
extern lighttable_t** vscalelight;
extern lighttable_t** dscalelight;
*/
//typedef void (*drawfunc_t) (int start, int stop);
// BSP?
void R_ClearClipSegs(void); void R_ClearClipSegs(void);
void R_ClearDrawSegs(void); void R_ClearDrawSegs(void);
void R_RenderBSPNode(int bspnum); void R_RenderBSPNode(int bspnum);

View file

@ -63,7 +63,8 @@ typedef struct
short patch; short patch;
short stepdir; // unused in Doom but might be used in Phase 2 Boom short stepdir; // unused in Doom but might be used in Phase 2 Boom
short colormap; // unused in Doom but might be used in Phase 2 Boom short colormap; // unused in Doom but might be used in Phase 2 Boom
} PACKEDATTR mappatch_t; }
PACKEDATTR mappatch_t;
typedef struct typedef struct
{ {
@ -74,7 +75,8 @@ typedef struct
char pad[4]; // unused in Doom but might be used in Boom Phase 2 char pad[4]; // unused in Doom but might be used in Boom Phase 2
short patchcount; short patchcount;
mappatch_t patches[1]; mappatch_t patches[1];
} PACKEDATTR maptexture_t; }
PACKEDATTR maptexture_t;
// A maptexturedef_t describes a rectangular texture, which is composed // A maptexturedef_t describes a rectangular texture, which is composed
// of one or more mappatch_t structures that arrange graphic patches. // of one or more mappatch_t structures that arrange graphic patches.
@ -247,7 +249,8 @@ static void R_GenerateLookup(int texnum, int *const errors)
struct { struct {
unsigned short patches, posts; unsigned short patches, posts;
} *count = calloc(sizeof *count, texture->width); }
*count = calloc(sizeof *count, texture->width);
{ {
int i = texture->patchcount; int i = texture->patchcount;
@ -301,8 +304,10 @@ static void R_GenerateLookup(int texnum, int *const errors)
//jff 8/3/98 use logical output routine //jff 8/3/98 use logical output routine
printf("\nR_GenerateLookup: Column %d is without a patch in texture %s", printf("\nR_GenerateLookup: Column %d is without a patch in texture %s",
x, texture->name); x, texture->name);
if (errors) ++*errors; if (errors)
else I_Error("R_GenerateLookup: Failed"); ++*errors;
else
I_Error("R_GenerateLookup: Failed");
} }
if (count[x].patches > 1) // killough 4/9/98 if (count[x].patches > 1) // killough 4/9/98
{ {
@ -333,7 +338,8 @@ static void R_GenerateLookup(int texnum, int *const errors)
const byte *R_GetColumn(int tex, int col) const byte *R_GetColumn(int tex, int col)
{ {
const texture_t *texture = textures[tex]; const texture_t *texture = textures[tex];
if (!texture->columnlump) R_GenerateLookup(tex, NULL); if (!texture->columnlump)
R_GenerateLookup(tex, NULL);
{ {
int lump = texture->columnlump[col &= texture->widthmask]; int lump = texture->columnlump[col &= texture->widthmask];
int ofs = texture->columnofs[col]; // cph - WARNING: must be after the above line int ofs = texture->columnofs[col]; // cph - WARNING: must be after the above line
@ -345,7 +351,8 @@ const byte *R_GetColumn(int tex, int col)
if ((lump<=0) && (lastlump<=0)) if ((lump<=0) && (lastlump<=0))
lump = lastlump; // cph - force equal lump = lastlump; // cph - force equal
if (lump != lastlump) { if (lump != lastlump)
{
// cph - must change the cached lump // cph - must change the cached lump
if (lastlump>0) if (lastlump>0)
W_UnlockLumpNum(lastlump); W_UnlockLumpNum(lastlump);
@ -353,9 +360,11 @@ const byte *R_GetColumn(int tex, int col)
if ((lastlump = lump) > 0) if ((lastlump = lump) > 0)
lastlumpdata = W_CacheLumpNum(lump); lastlumpdata = W_CacheLumpNum(lump);
#ifdef RANGECHECK #ifdef RANGECHECK
else else
lastlumpdata = NULL; lastlumpdata = NULL;
#endif #endif
} }
if (lump > 0) if (lump > 0)
@ -538,7 +547,8 @@ void R_InitTextures (void)
} }
} }
texture->columnofs = NULL; texture->columnlump = NULL; texture->columnofs = NULL;
texture->columnlump = NULL;
for (j=1; j*2 <= texture->width; j<<=1) for (j=1; j*2 <= texture->width; j<<=1)
; ;
@ -687,7 +697,8 @@ int R_ColormapNumForName(const char *name)
struct _cache { struct _cache {
unsigned char pct; unsigned char pct;
unsigned char playpal[256]; unsigned char playpal[256];
} cache; }
cache;
int tran_filter_pct = 66; // filter percent int tran_filter_pct = 66; // filter percent
@ -749,7 +760,8 @@ void R_InitTranMap(int progress)
d += t*t; d += t*t;
p -= 3; p -= 3;
tot[i] = d << (TSC-1); tot[i] = d << (TSC-1);
} while (--i>=0); }
while (--i>=0);
} }
// Next, compute all entries using minimum arithmetic. // Next, compute all entries using minimum arithmetic.
@ -777,7 +789,8 @@ void R_InitTranMap(int progress)
if ((err = tot[color] - pal[0][color]*r if ((err = tot[color] - pal[0][color]*r
- pal[1][color]*g - pal[2][color]*b) < best) - pal[1][color]*g - pal[2][color]*b) < best)
best = err, *tp = color; best = err, *tp = color;
while (--color >= 0); while (--color >= 0)
;
} }
} }
} }

View file

@ -47,7 +47,8 @@ typedef struct
{ {
int originx, originy; // Block origin, which has already accounted int originx, originy; // Block origin, which has already accounted
int patch; // for the internal origin of the patch. int patch; // for the internal origin of the patch.
} texpatch_t; }
texpatch_t;
// //
// Texture definition. // Texture definition.
@ -69,7 +70,8 @@ typedef struct
short width, height; short width, height;
short patchcount; // All the patches[patchcount] are drawn short patchcount; // All the patches[patchcount] are drawn
texpatch_t patches[1]; // back-to-front into the cached texture. texpatch_t patches[1]; // back-to-front into the cached texture.
} texture_t; }
texture_t;
// Retrieve column data for span blitting. // Retrieve column data for span blitting.
const byte* const byte*

View file

@ -1,24 +1,33 @@
// Emacs style mode select -*- C++ -*- /* Emacs style mode select -*- C++ -*-
//----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
// *
// $Id$ *
// * PrBoom a Doom port merged with LxDoom and LSDLDoom
// Copyright (C) 1993-1996 by id Software, Inc. * based on BOOM, a modified and improved DOOM engine
// * Copyright (C) 1999 by
// This program is free software; you can redistribute it and/or * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
// modify it under the terms of the GNU General Public License * Copyright (C) 1999-2000 by
// as published by the Free Software Foundation; either version 2 * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
// of the License, or (at your option) any later version. *
// * This program is free software; you can redistribute it and/or
// This program is distributed in the hope that it will be useful, * modify it under the terms of the GNU General Public License
// but WITHOUT ANY WARRANTY; without even the implied warranty of * as published by the Free Software Foundation; either version 2
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * of the License, or (at your option) any later version.
// GNU General Public License for more details. *
// * This program is distributed in the hope that it will be useful,
// DESCRIPTION: * but WITHOUT ANY WARRANTY; without even the implied warranty of
// Refresh/rendering module, shared data struct definitions. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
//----------------------------------------------------------------------------- *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Refresh/rendering module, shared data struct definitions.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_DEFS__ #ifndef __R_DEFS__
#define __R_DEFS__ #define __R_DEFS__
@ -62,18 +71,16 @@
typedef struct typedef struct
{ {
fixed_t x, y; fixed_t x, y;
} vertex_t; }
vertex_t;
// Forward of LineDefs, for Sectors.
struct line_s;
// Each sector has a degenmobj_t in its center for sound origin purposes. // Each sector has a degenmobj_t in its center for sound origin purposes.
typedef struct typedef struct
{ {
thinker_t thinker; // not used for anything thinker_t thinker; // not used for anything
fixed_t x, y, z; fixed_t x, y, z;
} degenmobj_t; }
degenmobj_t;
// //
// The SECTORS record, at runtime. // The SECTORS record, at runtime.
@ -142,8 +149,8 @@ typedef struct
short special; short special;
short oldspecial; //jff 2/16/98 remembers if sector WAS secret (automap) short oldspecial; //jff 2/16/98 remembers if sector WAS secret (automap)
short tag; short tag;
void* specialdata; // ROCKDOOM obsolete }
} sector_t; sector_t;
// //
// The SideDef. // The SideDef.
@ -164,7 +171,8 @@ typedef struct
int special; int special;
} side_t; }
side_t;
// //
// Move clipping aid for LineDefs. // Move clipping aid for LineDefs.
@ -201,7 +209,8 @@ typedef struct line_s
RF_IGNORE = 8, // Renderer can skip this line RF_IGNORE = 8, // Renderer can skip this line
RF_CLOSED =16, // Line blocks view RF_CLOSED =16, // Line blocks view
} r_flags; } r_flags;
} line_t; }
line_t;
// phares 3/14/98 // phares 3/14/98
// //
@ -228,7 +237,8 @@ typedef struct msecnode_s
struct msecnode_s *m_sprev; // prev msecnode_t for this sector struct msecnode_s *m_sprev; // prev msecnode_t for this sector
struct msecnode_s *m_snext; // next msecnode_t for this sector struct msecnode_s *m_snext; // next msecnode_t for this sector
boolean visited; // killough 4/4/98, 4/7/98: used in search algorithms boolean visited; // killough 4/4/98, 4/7/98: used in search algorithms
} msecnode_t; }
msecnode_t;
// //
// The LineSeg. // The LineSeg.
@ -249,7 +259,8 @@ typedef struct
// backsector is NULL for one sided lines // backsector is NULL for one sided lines
sector_t *frontsector, *backsector; sector_t *frontsector, *backsector;
} seg_t; }
seg_t;
// //
// A SubSector. // A SubSector.
@ -263,7 +274,8 @@ typedef struct subsector_s
{ {
sector_t *sector; sector_t *sector;
unsigned short numlines, firstline; unsigned short numlines, firstline;
} subsector_t; }
subsector_t;
// //
// BSP node. // BSP node.
@ -273,14 +285,16 @@ typedef struct
fixed_t x, y, dx, dy; // Partition line. fixed_t x, y, dx, dy; // Partition line.
fixed_t bbox[2][4]; // Bounding box for each child. fixed_t bbox[2][4]; // Bounding box for each child.
unsigned short children[2]; // If NF_SUBSECTOR its a subsector. unsigned short children[2]; // If NF_SUBSECTOR its a subsector.
} node_t; }
node_t;
// posts are runs of non masked source pixels // posts are runs of non masked source pixels
typedef struct typedef struct
{ {
byte topdelta; // -1 is the last post in a column byte topdelta; // -1 is the last post in a column
byte length; // length data bytes follows byte length; // length data bytes follows
} post_t; }
post_t;
// column_t is a list of 0 or more post_t, (byte)-1 terminated // column_t is a list of 0 or more post_t, (byte)-1 terminated
typedef post_t column_t; typedef post_t column_t;
@ -293,7 +307,8 @@ typedef post_t column_t;
// Indeed, true color support is posibble // Indeed, true color support is posibble
// precalculating 24bpp lightmap/colormap LUT. // precalculating 24bpp lightmap/colormap LUT.
// from darkening PLAYPAL to all black. // from darkening PLAYPAL to all black.
// Could even us emore than 32 levels. // Could use even more than 32 levels.
typedef byte lighttable_t; typedef byte lighttable_t;
// //
@ -312,7 +327,8 @@ typedef struct drawseg_s
// all three adjusted so [x1] is first value. // all three adjusted so [x1] is first value.
short *sprtopclip, *sprbottomclip, *maskedtexturecol; short *sprtopclip, *sprbottomclip, *maskedtexturecol;
} drawseg_t; }
drawseg_t;
// //
// Patches. // Patches.
@ -328,7 +344,8 @@ typedef struct
short leftoffset; // pixels to the left of origin short leftoffset; // pixels to the left of origin
short topoffset; // pixels below the origin short topoffset; // pixels below the origin
int columnofs[8]; // only [width] used int columnofs[8]; // only [width] used
} patch_t; }
patch_t;
// proff: Added for OpenGL // proff: Added for OpenGL
typedef struct typedef struct
@ -336,7 +353,8 @@ typedef struct
int width,height; int width,height;
int leftoffset,topoffset; int leftoffset,topoffset;
int lumpnum; int lumpnum;
} patchnum_t; }
patchnum_t;
// //
// A vissprite_t is a thing that will be drawn during a refresh. // A vissprite_t is a thing that will be drawn during a refresh.
@ -360,7 +378,8 @@ typedef struct vissprite_s
// killough 3/27/98: height sector for underwater/fake ceiling support // killough 3/27/98: height sector for underwater/fake ceiling support
int heightsec; int heightsec;
} vissprite_t; }
vissprite_t;
// //
// Sprites are patches with a special naming convention // Sprites are patches with a special naming convention
@ -390,7 +409,8 @@ typedef struct
// Flip bit (1 = flip) to use for view angles 0-7. // Flip bit (1 = flip) to use for view angles 0-7.
byte flip[8]; byte flip[8];
} spriteframe_t; }
spriteframe_t;
// //
// A sprite definition: // A sprite definition:
@ -401,7 +421,8 @@ typedef struct
{ {
int numframes; int numframes;
spriteframe_t *spriteframes; spriteframe_t *spriteframes;
} spritedef_t; }
spritedef_t;
// //
// Now what is a visplane, anyway? // Now what is a visplane, anyway?
@ -417,6 +438,7 @@ typedef struct visplane
unsigned short pad2, pad3; // killough 2/8/98, 4/25/98 unsigned short pad2, pad3; // killough 2/8/98, 4/25/98
unsigned short bottom[SCREENWIDTH]; unsigned short bottom[SCREENWIDTH];
unsigned short pad4; unsigned short pad4;
} visplane_t; }
visplane_t;
#endif #endif

View file

@ -41,12 +41,6 @@
//#include "lprintf.h" //#include "lprintf.h"
#include "rockmacros.h" #include "rockmacros.h"
#define MAXWIDTH 1120
#define MAXHEIGHT 832
// status bar height at bottom of screen
#define SBARHEIGHT 32
// //
// All drawing to the view buffer is accomplished in this file. // All drawing to the view buffer is accomplished in this file.
// The other refresh files only know about ccordinates, // The other refresh files only know about ccordinates,
@ -113,6 +107,7 @@ void R_DrawColumn (void)
return; return;
#ifdef RANGECHECK #ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0 || dc_yl < 0
|| dc_yh >= SCREENHEIGHT) || dc_yh >= SCREENHEIGHT)
@ -127,6 +122,7 @@ void R_DrawColumn (void)
// Determine scaling, // Determine scaling,
// which is the only mapping to be done. // which is the only mapping to be done.
#define fracstep dc_iscale #define fracstep dc_iscale
frac = dc_texturemid + (dc_yl-centery)*fracstep; frac = dc_texturemid + (dc_yl-centery)*fracstep;
// Inner loop that does the actual texture mapping, // Inner loop that does the actual texture mapping,
@ -135,21 +131,27 @@ void R_DrawColumn (void)
// //
// killough 2/1/98: more performance tuning // killough 2/1/98: more performance tuning
if (dc_texheight == 128) { if (dc_texheight == 128)
{
while(count--) while(count--)
{ {
*dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]]; *dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
frac += fracstep; frac += fracstep;
dest += SCREENWIDTH; dest += SCREENWIDTH;
} }
} else if (dc_texheight == 0) { }
else if (dc_texheight == 0)
{
/* cph - another special case */ /* cph - another special case */
while (count--) { while (count--)
{
*dest = dc_colormap[dc_source[frac>>FRACBITS]]; *dest = dc_colormap[dc_source[frac>>FRACBITS]];
frac += fracstep; frac += fracstep;
dest += SCREENWIDTH; dest += SCREENWIDTH;
} }
} else { }
else
{
register unsigned heightmask = dc_texheight-1; // CPhipps - specify type register unsigned heightmask = dc_texheight-1; // CPhipps - specify type
if (! (dc_texheight & heightmask) ) // power of 2 -- killough if (! (dc_texheight & heightmask) ) // power of 2 -- killough
{ {
@ -167,7 +169,8 @@ void R_DrawColumn (void)
heightmask <<= FRACBITS; heightmask <<= FRACBITS;
if (frac < 0) if (frac < 0)
while ((frac += heightmask) < 0); while ((frac += heightmask) < 0)
;
else else
while (frac >= (int)heightmask) while (frac >= (int)heightmask)
frac -= heightmask; frac -= heightmask;
@ -215,6 +218,7 @@ void R_DrawTLColumn (void)
return; return;
#ifdef RANGECHECK #ifdef RANGECHECK
if ((unsigned)dc_x >= (unsigned)SCREENWIDTH if ((unsigned)dc_x >= (unsigned)SCREENWIDTH
|| dc_yl < 0 || dc_yl < 0
|| dc_yh >= SCREENHEIGHT) || dc_yh >= SCREENHEIGHT)
@ -227,6 +231,7 @@ void R_DrawTLColumn (void)
// Determine scaling, // Determine scaling,
// which is the only mapping to be done. // which is the only mapping to be done.
#define fracstep dc_iscale #define fracstep dc_iscale
frac = dc_texturemid + (dc_yl-centery)*fracstep; frac = dc_texturemid + (dc_yl-centery)*fracstep;
// Inner loop that does the actual texture mapping, // Inner loop that does the actual texture mapping,
@ -245,7 +250,8 @@ void R_DrawTLColumn (void)
heightmask <<= FRACBITS; heightmask <<= FRACBITS;
if (frac < 0) if (frac < 0)
while ((frac += heightmask) < 0); while ((frac += heightmask) < 0)
;
else else
while (frac >= (int)heightmask) while (frac >= (int)heightmask)
frac -= heightmask; frac -= heightmask;
@ -336,6 +342,7 @@ void R_DrawFuzzColumn(void)
return; return;
#ifdef RANGECHECK #ifdef RANGECHECK
if ((unsigned) dc_x >= (unsigned)SCREENWIDTH if ((unsigned) dc_x >= (unsigned)SCREENWIDTH
|| dc_yl < 0 || dc_yl < 0
|| (unsigned)dc_yh >= (unsigned)SCREENHEIGHT) || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT)
@ -377,7 +384,8 @@ void R_DrawFuzzColumn(void)
dest += SCREENWIDTH; dest += SCREENWIDTH;
frac += fracstep; frac += fracstep;
} while (count--); }
while (count--);
} }
// //
@ -404,6 +412,7 @@ void R_DrawTranslatedColumn (void)
return; return;
#ifdef RANGECHECK #ifdef RANGECHECK
if ((unsigned)dc_x >= (unsigned)SCREENWIDTH if ((unsigned)dc_x >= (unsigned)SCREENWIDTH
|| dc_yl < 0 || dc_yl < 0
|| (unsigned)dc_yh >= (unsigned)SCREENHEIGHT) || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT)
@ -449,6 +458,7 @@ void R_InitTranslationTables (void)
{ {
int i, j; int i, j;
#define MAXTRANS 3 #define MAXTRANS 3
byte transtocolour[MAXTRANS]; byte transtocolour[MAXTRANS];
// killough 5/2/98: // killough 5/2/98:
@ -457,15 +467,20 @@ void R_InitTranslationTables (void)
if (translationtables == NULL) // CPhipps - allow multiple calls if (translationtables == NULL) // CPhipps - allow multiple calls
translationtables = Z_Malloc(256*MAXTRANS, PU_STATIC, 0); translationtables = Z_Malloc(256*MAXTRANS, PU_STATIC, 0);
for (i=0; i<MAXTRANS; i++) transtocolour[i] = 255; for (i=0; i<MAXTRANS; i++)
transtocolour[i] = 255;
for (i=0; i<MAXPLAYERS; i++) { for (i=0; i<MAXPLAYERS; i++)
{
byte wantcolour = mapcolor_plyr[i]; byte wantcolour = mapcolor_plyr[i];
playernumtotrans[i] = 0; playernumtotrans[i] = 0;
if (wantcolour != 0x70) // Not green, would like translation if (wantcolour != 0x70) // Not green, would like translation
for (j=0; j<MAXTRANS; j++) for (j=0; j<MAXTRANS; j++)
if (transtocolour[j] == 255) { if (transtocolour[j] == 255)
transtocolour[j] = wantcolour; playernumtotrans[i] = j+1; break; {
transtocolour[j] = wantcolour;
playernumtotrans[i] = j+1;
break;
} }
} }

View file

@ -61,6 +61,8 @@ int centerx IBSS_ATTR;
int centery IBSS_ATTR; int centery IBSS_ATTR;
fixed_t centerxfrac, centeryfrac; fixed_t centerxfrac, centeryfrac;
fixed_t projection; fixed_t projection;
// proff 11/06/98: Added for high-res
fixed_t projectiony;
fixed_t viewx, viewy, viewz; fixed_t viewx, viewy, viewz;
angle_t viewangle; angle_t viewangle;
fixed_t viewcos, viewsin; fixed_t viewcos, viewsin;
@ -333,10 +335,17 @@ void R_ExecuteSetViewSize (void)
scaledviewwidth = SCREENWIDTH; scaledviewwidth = SCREENWIDTH;
viewheight = SCREENHEIGHT; viewheight = SCREENHEIGHT;
} }
// proff 09/24/98: Added for high-res
else if (setblocks == 10)
{
scaledviewwidth = SCREENWIDTH;
viewheight = SCREENHEIGHT-ST_SCALED_HEIGHT;
}
else else
{ {
scaledviewwidth = setblocks*32; // proff 08/17/98: Changed for high-res
viewheight = (setblocks*168/10)&~7; scaledviewwidth = setblocks*SCREENWIDTH/10;
viewheight = (setblocks*(SCREENHEIGHT-ST_SCALED_HEIGHT)/10) & ~7;
} }
viewwidth = scaledviewwidth; viewwidth = scaledviewwidth;
@ -346,14 +355,19 @@ void R_ExecuteSetViewSize (void)
centerxfrac = centerx<<FRACBITS; centerxfrac = centerx<<FRACBITS;
centeryfrac = centery<<FRACBITS; centeryfrac = centery<<FRACBITS;
projection = centerxfrac; projection = centerxfrac;
// proff 11/06/98: Added for high-res
projectiony = ((SCREENHEIGHT * centerx * 320) / 200) / SCREENWIDTH * FRACUNIT;
R_InitBuffer (scaledviewwidth, viewheight); R_InitBuffer (scaledviewwidth, viewheight);
R_InitTextureMapping(); R_InitTextureMapping();
// psprite scales // psprite scales
pspritescale = FRACUNIT*viewwidth/SCREENWIDTH; // proff 08/17/98: Changed for high-res
pspriteiscale = FRACUNIT*SCREENWIDTH/viewwidth; pspritescale = FRACUNIT*viewwidth/320;
pspriteiscale = FRACUNIT*320/viewwidth;
// proff 11/06/98: Added for high-res
pspriteyscale = (((SCREENHEIGHT*viewwidth)/SCREENWIDTH) << FRACBITS) / 200;
// thing clipping // thing clipping
for (i=0 ; i<viewwidth ; i++) for (i=0 ; i<viewwidth ; i++)
@ -363,7 +377,8 @@ void R_ExecuteSetViewSize (void)
for (i=0 ; i<viewheight ; i++) for (i=0 ; i<viewheight ; i++)
{ // killough 5/2/98: reformatted { // killough 5/2/98: reformatted
fixed_t dy = D_abs(((i-viewheight/2)<<FRACBITS)+FRACUNIT/2); fixed_t dy = D_abs(((i-viewheight/2)<<FRACBITS)+FRACUNIT/2);
yslope[i] = FixedDiv ( (viewwidth)/2*FRACUNIT, dy); // proff 08/17/98: Changed for high-res
yslope[i] = FixedDiv(projectiony, dy);
} }
for (i=0 ; i<viewwidth ; i++) for (i=0 ; i<viewwidth ; i++)
@ -379,10 +394,7 @@ void R_ExecuteSetViewSize (void)
int j, startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS; int j, startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
for (j=0 ; j<MAXLIGHTSCALE ; j++) for (j=0 ; j<MAXLIGHTSCALE ; j++)
{ {
// CPhipps - use 320 here instead of SCREENWIDTH, otherwise hires is int t, level = startmap - j*320/viewwidth/DISTMAP;
// brighter than normal res
int scale = FixedDiv ((320/2*FRACUNIT), (j+1)<<LIGHTZSHIFT);
int t, level = startmap - (scale >>= LIGHTSCALESHIFT)/DISTMAP;
if (level < 0) if (level < 0)
level = 0; level = 0;
@ -410,12 +422,14 @@ void R_Init (void)
// CPhipps - R_DrawColumn isn't constant anymore, so must // CPhipps - R_DrawColumn isn't constant anymore, so must
// initialise in code // initialise in code
colfunc = R_DrawColumn; // current column draw function colfunc = R_DrawColumn; // current column draw function
if (SCREENWIDTH<320) // if (SCREENWIDTH<320)
I_Error("R_Init: Screenwidth(%d) < 320",SCREENWIDTH); // I_Error("R_Init: Screenwidth(%d) < 320",SCREENWIDTH);
#if 1 #if 1
printf("\nR_LoadTrigTables: "); printf("\nR_LoadTrigTables: ");
R_LoadTrigTables(); R_LoadTrigTables();
#endif #endif
printf("\nR_InitData: "); printf("\nR_InitData: ");
R_InitData(); R_InitData();
R_SetViewSize(screenblocks); R_SetViewSize(screenblocks);

View file

@ -54,6 +54,8 @@ extern int centery;
extern fixed_t centerxfrac; extern fixed_t centerxfrac;
extern fixed_t centeryfrac; extern fixed_t centeryfrac;
extern fixed_t projection; extern fixed_t projection;
// proff 11/06/98: Added for high-res
extern fixed_t projectiony;
extern int validcount; extern int validcount;
extern int linecount; extern int linecount;
extern int loopcount; extern int loopcount;

View file

@ -128,6 +128,7 @@ static void R_MapPlane(int y, int x1, int x2)
unsigned index; unsigned index;
#ifdef RANGECHECK #ifdef RANGECHECK
if (x2 < x1 || x1<0 || x2>=viewwidth || (unsigned)y>(unsigned)viewheight) if (x2 < x1 || x1<0 || x2>=viewwidth || (unsigned)y>(unsigned)viewheight)
I_Error ("R_MapPlane: %i, %i at %i",x1,x2,y); I_Error ("R_MapPlane: %i, %i at %i",x1,x2,y);
#endif #endif
@ -295,10 +296,13 @@ visplane_t *R_CheckPlane(visplane_t *pl, int start, int stop)
for (x=intrl ; x <= intrh && pl->top[x] == 0xffff; x++) for (x=intrl ; x <= intrh && pl->top[x] == 0xffff; x++)
; ;
if (x > intrh) { /* Can use existing plane; extend range */ if (x > intrh)
pl->minx = unionl; pl->maxx = unionh; { /* Can use existing plane; extend range */
pl->minx = unionl;
pl->maxx = unionh;
return pl; return pl;
} else /* Cannot use existing plane; create a new one */ }
else /* Cannot use existing plane; create a new one */
return R_DupPlane(pl,start,stop); return R_DupPlane(pl,start,stop);
} }
@ -323,8 +327,10 @@ static void R_MakeSpans(int x, int t1, int b1, int t2, int b2)
static void R_DoDrawPlane(visplane_t *pl) static void R_DoDrawPlane(visplane_t *pl)
{ {
register int x; register int x;
if (pl->minx <= pl->maxx) { if (pl->minx <= pl->maxx)
if (pl->picnum == skyflatnum || pl->picnum & PL_SKYFLAT) { // sky flat {
if (pl->picnum == skyflatnum || pl->picnum & PL_SKYFLAT)
{ // sky flat
int texture; int texture;
angle_t an, flip; angle_t an, flip;
@ -390,7 +396,9 @@ static void R_DoDrawPlane(visplane_t *pl)
ANGLETOSKYSHIFT); ANGLETOSKYSHIFT);
colfunc(); colfunc();
} }
} else { // regular flat }
else
{ // regular flat
int stop, light; int stop, light;

View file

@ -95,18 +95,19 @@ static short *maskedtexturecol;
// rw_distance must be calculated first. // rw_distance must be calculated first.
// //
// killough 5/2/98: reformatted, cleaned up // killough 5/2/98: reformatted, cleaned up
// CPhipps - moved here from r_main.c
static fixed_t R_ScaleFromGlobalAngle(angle_t visangle) static fixed_t R_ScaleFromGlobalAngle(angle_t visangle)
{ {
int anglea = ANG90 + (visangle-viewangle); int anglea = ANG90 + (visangle-viewangle);
int angleb = ANG90 + (visangle-rw_normalangle); int angleb = ANG90 + (visangle-rw_normalangle);
int sinea = finesine[anglea>>ANGLETOFINESHIFT]; int den = FixedMul(rw_distance, finesine[anglea>>ANGLETOFINESHIFT]);
int sineb = finesine[angleb>>ANGLETOFINESHIFT]; // proff 11/06/98: Changed for high-res
fixed_t num = FixedMul(projection,sineb); fixed_t num = FixedMul(projectiony, finesine[angleb>>ANGLETOFINESHIFT]);
int den = FixedMul(rw_distance,sinea);
return den > num>>16 ? (num = FixedDiv(num, den)) > 64*FRACUNIT ? return den > num>>16 ? (num = FixedDiv(num, den)) > 64*FRACUNIT ?
64*FRACUNIT : num < 256 ? 256 : num : 64*FRACUNIT; 64*FRACUNIT : num < 256 ? 256 : num : 64*FRACUNIT;
} }
// //
// R_RenderMaskedSegRange // R_RenderMaskedSegRange
// //
@ -150,7 +151,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2)
/* cph - ...what is this for? adding contrast to rooms? /* cph - ...what is this for? adding contrast to rooms?
* It looks crap in outdoor areas */ * It looks crap in outdoor areas */
if (fake_contrast) { if (fake_contrast)
{
if (curline->v1->y == curline->v2->y) if (curline->v1->y == curline->v2->y)
lightnum--; lightnum--;
else else
@ -402,8 +404,10 @@ static void R_RenderSegLoop (void)
// cph - if we completely blocked further sight through this column, // cph - if we completely blocked further sight through this column,
// add this info to the solid columns array for r_bsp.c // add this info to the solid columns array for r_bsp.c
if ((markceiling || markfloor) && if ((markceiling || markfloor) &&
(floorclip[rw_x] <= ceilingclip[rw_x] + 1)) { (floorclip[rw_x] <= ceilingclip[rw_x] + 1))
solidcol[rw_x] = 1; didsolidcol = 1; {
solidcol[rw_x] = 1;
didsolidcol = 1;
} }
// save texturecol for backdrawing of masked mid texture // save texturecol for backdrawing of masked mid texture
@ -460,6 +464,7 @@ void R_StoreWallRange(const int start, const int stop)
#ifdef RANGECHECK #ifdef RANGECHECK
if (start >=viewwidth || start > stop) if (start >=viewwidth || start > stop)
I_Error ("Bad R_RenderWallRange: %i to %i", start , stop); I_Error ("Bad R_RenderWallRange: %i to %i", start , stop);
#endif #endif
@ -574,7 +579,8 @@ void R_StoreWallRange(const int start, const int stop)
ds_p->sprtopclip = ds_p->sprbottomclip = NULL; ds_p->sprtopclip = ds_p->sprbottomclip = NULL;
ds_p->silhouette = 0; ds_p->silhouette = 0;
if (linedef->r_flags & RF_CLOSED) { /* cph - closed 2S line e.g. door */ if (linedef->r_flags & RF_CLOSED)
{ /* cph - closed 2S line e.g. door */
// cph - killough's (outdated) comment follows - this deals with both // cph - killough's (outdated) comment follows - this deals with both
// "automap fixes", his and mine // "automap fixes", his and mine
// killough 1/17/98: this test is required if the fix // killough 1/17/98: this test is required if the fix
@ -589,7 +595,9 @@ void R_StoreWallRange(const int start, const int stop)
ds_p->sprtopclip = screenheightarray; ds_p->sprtopclip = screenheightarray;
ds_p->tsilheight = INT_MIN; ds_p->tsilheight = INT_MIN;
} else { /* not solid - old code */ }
else
{ /* not solid - old code */
if (frontsector->floorheight > backsector->floorheight) if (frontsector->floorheight > backsector->floorheight)
{ {
@ -721,7 +729,8 @@ void R_StoreWallRange(const int start, const int stop)
/* cph - ...what is this for? adding contrast to rooms? /* cph - ...what is this for? adding contrast to rooms?
* It looks crap in outdoor areas */ * It looks crap in outdoor areas */
if (fake_contrast) { if (fake_contrast)
{
if (curline->v1->y == curline->v2->y) if (curline->v1->y == curline->v2->y)
lightnum--; lightnum--;
else if (curline->v1->x == curline->v2->x) else if (curline->v1->x == curline->v2->x)
@ -778,14 +787,16 @@ void R_StoreWallRange(const int start, const int stop)
} }
// render it // render it
if (markceiling) { if (markceiling)
{
if (ceilingplane) // killough 4/11/98: add NULL ptr checks if (ceilingplane) // killough 4/11/98: add NULL ptr checks
ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1); ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1);
else else
markceiling = 0; markceiling = 0;
} }
if (markfloor) { if (markfloor)
{
if (floorplane) // killough 4/11/98: add NULL ptr checks if (floorplane) // killough 4/11/98: add NULL ptr checks
/* cph 2003/04/18 - ceilingplane and floorplane might be the same /* cph 2003/04/18 - ceilingplane and floorplane might be the same
* visplane (e.g. if both skies); R_CheckPlane doesn't know about * visplane (e.g. if both skies); R_CheckPlane doesn't know about
@ -805,12 +816,15 @@ void R_StoreWallRange(const int start, const int stop)
R_RenderSegLoop(); R_RenderSegLoop();
/* cph - if a column was made solid by this wall, we _must_ save full clipping info */ /* cph - if a column was made solid by this wall, we _must_ save full clipping info */
if (backsector && didsolidcol) { if (backsector && didsolidcol)
if (!(ds_p->silhouette & SIL_BOTTOM)) { {
if (!(ds_p->silhouette & SIL_BOTTOM))
{
ds_p->silhouette |= SIL_BOTTOM; ds_p->silhouette |= SIL_BOTTOM;
ds_p->bsilheight = backsector->floorheight; ds_p->bsilheight = backsector->floorheight;
} }
if (!(ds_p->silhouette & SIL_TOP)) { if (!(ds_p->silhouette & SIL_TOP))
{
ds_p->silhouette |= SIL_TOP; ds_p->silhouette |= SIL_TOP;
ds_p->tsilheight = backsector->ceilingheight; ds_p->tsilheight = backsector->ceilingheight;
} }

View file

@ -52,7 +52,8 @@ typedef struct {
int column; int column;
int topclip; int topclip;
int bottomclip; int bottomclip;
} maskdraw_t; }
maskdraw_t;
// //
// Sprite rotation 0 is facing the viewer, // Sprite rotation 0 is facing the viewer,
@ -63,6 +64,8 @@ typedef struct {
// //
fixed_t pspritescale; fixed_t pspritescale;
fixed_t pspriteiscale; fixed_t pspriteiscale;
// proff 11/06/98: Added for high-res
fixed_t pspriteyscale;
static lighttable_t** spritelights; static lighttable_t** spritelights;
@ -153,7 +156,10 @@ static void R_InstallSpriteLump(int lump, unsigned frame,
void R_InitSpriteDefs(const char * const * namelist) void R_InitSpriteDefs(const char * const * namelist)
{ {
size_t numentries = lastspritelump-firstspritelump+1; size_t numentries = lastspritelump-firstspritelump+1;
struct { int index, next; } *hash; struct {
int index, next;
}
*hash;
int i; int i;
if (!numentries || !*namelist) if (!numentries || !*namelist)
@ -217,7 +223,8 @@ void R_InitSpriteDefs(const char * const * namelist)
true); true);
} }
} }
while ((j = hash[j].next) >= 0); while ((j = hash[j].next) >= 0)
;
// check the frames that were found for completeness // check the frames that were found for completeness
if ((sprites[i].numframes = ++maxframe)) // killough 1/31/98 if ((sprites[i].numframes = ++maxframe)) // killough 1/31/98
@ -387,7 +394,7 @@ void R_DrawVisSprite(vissprite_t *vis, int x1, int x2)
// proff 11/06/98: Changed for high-res // proff 11/06/98: Changed for high-res
dc_iscale = D_abs(vis->xiscale); dc_iscale = FixedDiv (FRACUNIT, vis->scale);
dc_texturemid = vis->texturemid; dc_texturemid = vis->texturemid;
frac = vis->startfrac; frac = vis->startfrac;
spryscale = vis->scale; spryscale = vis->scale;
@ -398,6 +405,7 @@ void R_DrawVisSprite(vissprite_t *vis, int x1, int x2)
texturecolumn = frac>>FRACBITS; texturecolumn = frac>>FRACBITS;
#ifdef RANGECHECK #ifdef RANGECHECK
if (texturecolumn < 0 || texturecolumn >= SHORT(patch->width)) if (texturecolumn < 0 || texturecolumn >= SHORT(patch->width))
I_Error ("R_DrawSpriteRange: Bad texturecolumn"); I_Error ("R_DrawSpriteRange: Bad texturecolumn");
#endif #endif
@ -428,8 +436,10 @@ void R_ProjectSprite (mobj_t* thing)
boolean flip; boolean flip;
vissprite_t *vis; vissprite_t *vis;
#ifndef GL_DOOM #ifndef GL_DOOM
fixed_t iscale; fixed_t iscale;
#endif #endif
int heightsec; // killough 3/27/98 int heightsec; // killough 3/27/98
// transform the origin point // transform the origin point
@ -457,6 +467,7 @@ void R_ProjectSprite (mobj_t* thing)
// decide which patch to use for sprite relative to player // decide which patch to use for sprite relative to player
#ifdef RANGECHECK #ifdef RANGECHECK
if ((unsigned) thing->sprite >= (unsigned)numsprites) if ((unsigned) thing->sprite >= (unsigned)numsprites)
I_Error ("R_ProjectSprite: Invalid sprite number %i", thing->sprite); I_Error ("R_ProjectSprite: Invalid sprite number %i", thing->sprite);
#endif #endif
@ -464,6 +475,7 @@ void R_ProjectSprite (mobj_t* thing)
sprdef = &sprites[thing->sprite]; sprdef = &sprites[thing->sprite];
#ifdef RANGECHECK #ifdef RANGECHECK
if ((thing->frame&FF_FRAMEMASK) >= sprdef->numframes) if ((thing->frame&FF_FRAMEMASK) >= sprdef->numframes)
I_Error ("R_ProjectSprite: Invalid sprite frame %i : %i", thing->sprite, I_Error ("R_ProjectSprite: Invalid sprite frame %i : %i", thing->sprite,
thing->frame); thing->frame);
@ -538,7 +550,7 @@ void R_ProjectSprite (mobj_t* thing)
vis->mobjflags = thing->flags; vis->mobjflags = thing->flags;
// proff 11/06/98: Changed for high-res // proff 11/06/98: Changed for high-res
vis->scale = xscale; vis->scale = FixedDiv(projectiony, tz);
vis->gx = thing->x; vis->gx = thing->x;
vis->gy = thing->y; vis->gy = thing->y;
vis->gz = thing->z; vis->gz = thing->z;
@ -634,6 +646,7 @@ void R_DrawPSprite (pspdef_t *psp)
// decide which patch to use // decide which patch to use
#ifdef RANGECHECK #ifdef RANGECHECK
if ( (unsigned)psp->state->sprite >= (unsigned)numsprites) if ( (unsigned)psp->state->sprite >= (unsigned)numsprites)
I_Error ("R_ProjectSprite: Invalid sprite number %i", psp->state->sprite); I_Error ("R_ProjectSprite: Invalid sprite number %i", psp->state->sprite);
#endif #endif
@ -641,6 +654,7 @@ void R_DrawPSprite (pspdef_t *psp)
sprdef = &sprites[psp->state->sprite]; sprdef = &sprites[psp->state->sprite];
#ifdef RANGECHECK #ifdef RANGECHECK
if ( (psp->state->frame & FF_FRAMEMASK) >= sprdef->numframes) if ( (psp->state->frame & FF_FRAMEMASK) >= sprdef->numframes)
I_Error ("R_ProjectSprite: Invalid sprite frame %i : %li", I_Error ("R_ProjectSprite: Invalid sprite frame %i : %li",
psp->state->sprite, psp->state->frame); psp->state->sprite, psp->state->frame);
@ -677,7 +691,7 @@ void R_DrawPSprite (pspdef_t *psp)
vis->x1 = x1 < 0 ? 0 : x1; vis->x1 = x1 < 0 ? 0 : x1;
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
// proff 11/06/98: Added for high-res // proff 11/06/98: Added for high-res
vis->scale = pspritescale; vis->scale = pspriteyscale;
if (flip) if (flip)
{ {
@ -760,7 +774,8 @@ static void msort(vissprite_t **s, vissprite_t **t, int n)
msort(s2, t, n2); msort(s2, t, n2);
while ((*s1)->scale > (*s2)->scale ? while ((*s1)->scale > (*s2)->scale ?
(*d++ = *s1++, --n1) : (*d++ = *s2++, --n2)); (*d++ = *s1++, --n1) : (*d++ = *s2++, --n2))
;
if (n2) if (n2)
bcopyp(d, s2, n2); bcopyp(d, s2, n2);
@ -778,7 +793,8 @@ static void msort(vissprite_t **s, vissprite_t **t, int n)
if (s[i-1]->scale < temp->scale) if (s[i-1]->scale < temp->scale)
{ {
int j = i; int j = i;
while ((s[j] = s[j-1])->scale < temp->scale && --j); while ((s[j] = s[j-1])->scale < temp->scale && --j)
;
s[j] = temp; s[j] = temp;
} }
} }
@ -893,7 +909,8 @@ void R_DrawSprite (vissprite_t* spr)
int phs = viewplayer->mo->subsector->sector->heightsec; int phs = viewplayer->mo->subsector->sector->heightsec;
if ((mh = sectors[spr->heightsec].floorheight) > spr->gz && if ((mh = sectors[spr->heightsec].floorheight) > spr->gz &&
(h = centeryfrac - FixedMul(mh-=viewz, spr->scale)) >= 0 && (h = centeryfrac - FixedMul(mh-=viewz, spr->scale)) >= 0 &&
(h >>= FRACBITS) < viewheight) { (h >>= FRACBITS) < viewheight)
{
if (mh <= 0 || (phs != -1 && viewz > sectors[phs].floorheight)) if (mh <= 0 || (phs != -1 && viewz > sectors[phs].floorheight))
{ // clip bottom { // clip bottom
for (x=spr->x1 ; x<=spr->x2 ; x++) for (x=spr->x1 ; x<=spr->x2 ; x++)
@ -909,7 +926,8 @@ void R_DrawSprite (vissprite_t* spr)
if ((mh = sectors[spr->heightsec].ceilingheight) < spr->gzt && if ((mh = sectors[spr->heightsec].ceilingheight) < spr->gzt &&
(h = centeryfrac - FixedMul(mh-viewz, spr->scale)) >= 0 && (h = centeryfrac - FixedMul(mh-viewz, spr->scale)) >= 0 &&
(h >>= FRACBITS) < viewheight) { (h >>= FRACBITS) < viewheight)
{
if (phs != -1 && viewz >= sectors[phs].ceilingheight) if (phs != -1 && viewz >= sectors[phs].ceilingheight)
{ // clip bottom { // clip bottom
for (x=spr->x1 ; x<=spr->x2 ; x++) for (x=spr->x1 ; x<=spr->x2 ; x++)
@ -927,7 +945,8 @@ void R_DrawSprite (vissprite_t* spr)
// all clipping has been performed, so draw the sprite // all clipping has been performed, so draw the sprite
// check for unclipped columns // check for unclipped columns
for (x = spr->x1 ; x<=spr->x2 ; x++) { for (x = spr->x1 ; x<=spr->x2 ; x++)
{
if (clipbot[x] == -2) if (clipbot[x] == -2)
clipbot[x] = viewheight; clipbot[x] = viewheight;

View file

@ -1,60 +1,59 @@
// Emacs style mode select -*- C++ -*- /* Emacs style mode select -*- C++ -*-
//----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
// *
// $Id$ *
// * PrBoom a Doom port merged with LxDoom and LSDLDoom
// Copyright (C) 1993-1996 by id Software, Inc. * based on BOOM, a modified and improved DOOM engine
// * Copyright (C) 1999 by
// This program is free software; you can redistribute it and/or * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
// modify it under the terms of the GNU General Public License * Copyright (C) 1999-2000 by
// as published by the Free Software Foundation; either version 2 * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
// of the License, or (at your option) any later version. *
// * This program is free software; you can redistribute it and/or
// This program is distributed in the hope that it will be useful, * modify it under the terms of the GNU General Public License
// but WITHOUT ANY WARRANTY; without even the implied warranty of * as published by the Free Software Foundation; either version 2
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * of the License, or (at your option) any later version.
// GNU General Public License for more details. *
// * This program is distributed in the hope that it will be useful,
// DESCRIPTION: * but WITHOUT ANY WARRANTY; without even the implied warranty of
// Rendering of moving objects, sprites. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
//----------------------------------------------------------------------------- *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Rendering of moving objects, sprites.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_THINGS__ #ifndef __R_THINGS__
#define __R_THINGS__ #define __R_THINGS__
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
#define MAXVISSPRITES 128 /* Constant arrays used for psprite clipping and initializing clipping. */
/*
extern vissprite_t vissprites[MAXVISSPRITES];
extern vissprite_t* vissprite_p;
extern vissprite_t vsprsortedhead;*/
// Constant arrays used for psprite clipping
// and initializing clipping.
extern short negonearray[SCREENWIDTH]; extern short negonearray[SCREENWIDTH];
extern short screenheightarray[SCREENWIDTH]; extern short screenheightarray[SCREENWIDTH];
// vars for R_DrawMaskedColumn /* Vars for R_DrawMaskedColumn */
extern short *mfloorclip; extern short *mfloorclip;
extern short *mceilingclip; extern short *mceilingclip;
extern fixed_t spryscale; extern fixed_t spryscale;
extern fixed_t sprtopscreen; extern fixed_t sprtopscreen;
extern fixed_t pspritescale; extern fixed_t pspritescale;
extern fixed_t pspriteiscale; extern fixed_t pspriteiscale;
/* proff 11/06/98: Added for high-res */
extern fixed_t pspriteyscale;
void R_DrawMaskedColumn(const column_t *column); void R_DrawMaskedColumn(const column_t *column);
void R_SortVisSprites(void); void R_SortVisSprites(void);
void R_AddSprites(subsector_t* subsec, int lightlevel); void R_AddSprites(subsector_t* subsec, int lightlevel);
void R_AddPSprites(void); void R_AddPSprites(void);
void R_DrawSprites(void); void R_DrawSprites(void);
@ -62,19 +61,6 @@ void R_InitSprites(const char * const * namelist);
void R_ClearSprites(void); void R_ClearSprites(void);
void R_DrawMasked(void); void R_DrawMasked(void);
void void R_ClipVisSprite(vissprite_t *vis, int xl, int xh);
R_ClipVisSprite
( vissprite_t* vis,
int xl,
int xh );
#endif #endif
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2006/03/28 15:44:01 dave
// Patch #2969 - Doom! Currently only working on the H300.
//
//
//-----------------------------------------------------------------------------

View file

@ -176,22 +176,6 @@ cont:
} }
/* NOTREACHED */ /* NOTREACHED */
} }
#if 0
static char *tp=NULL;
if(string!=NULL)
tp=string;
while(*tp!=NULL)
{
if(*tp==*delimiters)
break;
tp++;
}
*tp=0;
return tp;
}
#endif
inline void* memcpy(void* dst, const void* src, size_t size) inline void* memcpy(void* dst, const void* src, size_t size)
{ {
@ -415,7 +399,7 @@ int Dbuild_addons(struct opt_items *names)
names[0].string=startpt; names[0].string=startpt;
names[0].voice_id=0; names[0].voice_id=0;
addons=opendir(GAMEBASE"Addons/"); addons=opendir(GAMEBASE"addons/");
if(addons==NULL) if(addons==NULL)
return 1; return 1;
@ -448,7 +432,7 @@ int Dbuild_demos(struct opt_items *names)
names[0].string=startpt; names[0].string=startpt;
names[0].voice_id=0; names[0].voice_id=0;
demos=opendir(GAMEBASE"Demos/"); demos=opendir(GAMEBASE"demos/");
if(demos==NULL) if(demos==NULL)
return 1; return 1;

View file

@ -44,7 +44,7 @@
#include "m_swap.h" #include "m_swap.h"
#include "rockmacros.h" #include "rockmacros.h"
// Each screen is [SCREENWIDTH*SCREENHEIGHT]; // Each screen is [SCREENWIDTH*SCREENHEIGHT];
byte *screens[6]; byte *screens[6] IBSS_ATTR;
int dirtybox[4]; int dirtybox[4];
/* jff 4/24/98 initialize this at runtime */ /* jff 4/24/98 initialize this at runtime */
@ -428,22 +428,22 @@ void V_DrawMemPatch(int x, int y, int scrn, const patch_t *patch,
y -= SHORT(patch->topoffset); y -= SHORT(patch->topoffset);
x -= SHORT(patch->leftoffset); x -= SHORT(patch->leftoffset);
// CPhipps - auto-no-stretch if not high-res // // CPhipps - auto-no-stretch if not high-res
if (flags & VPT_STRETCH) // if (flags & VPT_STRETCH)
if ((SCREENWIDTH==320) && (SCREENHEIGHT==200)) // if ((SCREENWIDTH==320) && (SCREENHEIGHT==200))
flags &= ~VPT_STRETCH; // flags &= ~VPT_STRETCH;
// CPhipps - null translation pointer => no translation // CPhipps - null translation pointer => no translation
if (!trans) if (!trans)
flags &= ~VPT_TRANS; flags &= ~VPT_TRANS;
if (x<0 // if (x<0
||x+SHORT(patch->width) > ((flags & VPT_STRETCH) ? 320 : SCREENWIDTH) // ||x+SHORT(patch->width) > ((flags & VPT_STRETCH) ? 320 : SCREENWIDTH)
|| y<0 // || y<0
|| y+SHORT(patch->height) > ((flags & VPT_STRETCH) ? 200 : SCREENHEIGHT)) // || y+SHORT(patch->height) > ((flags & VPT_STRETCH) ? 200 : SCREENHEIGHT))
// killough 1/19/98: improved error message: // // killough 1/19/98: improved error message:
I_Error("V_DrawMemPatch: Patch (%d,%d)-(%d,%d) exceeds LFB" // I_Error("V_DrawMemPatch: Patch (%d,%d)-(%d,%d) exceeds LFB"
"Bad V_DrawMemPatch (flags=%u)", x, y, x+SHORT(patch->width), y+SHORT(patch->height), flags); // "Bad V_DrawMemPatch (flags=%u)", x, y, x+SHORT(patch->width), y+SHORT(patch->height), flags);
if (!(flags & VPT_STRETCH)) { if (!(flags & VPT_STRETCH)) {
unsigned int col; unsigned int col;