mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 04:29:34 -04:00
remove resolution limit (MAX_SCREENWIDTH and MAX_SCREENHEIGHT)
This commit is contained in:
parent
b944f58067
commit
7be7a78e8a
@ -84,9 +84,6 @@ typedef enum
|
|||||||
#define SCREENWIDTH 320
|
#define SCREENWIDTH 320
|
||||||
#define SCREENHEIGHT 200
|
#define SCREENHEIGHT 200
|
||||||
|
|
||||||
#define MAX_SCREENWIDTH (1152 * 8) // [FG] corresponds to 2.4:1 in hires mode
|
|
||||||
#define MAX_SCREENHEIGHT (400 * 8) // [crispy]
|
|
||||||
|
|
||||||
// The maximum number of players, multiplayer/networking.
|
// The maximum number of players, multiplayer/networking.
|
||||||
#define MAXPLAYERS 4
|
#define MAXPLAYERS 4
|
||||||
|
|
||||||
|
@ -895,7 +895,7 @@ static void I_GetWindowPosition(int *x, int *y, int w, int h)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_GetScreenDimensions(void)
|
static void I_GetScreenDimensions(void)
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
int w = 16, h = 9;
|
int w = 16, h = 9;
|
||||||
@ -961,10 +961,6 @@ void I_GetScreenDimensions(void)
|
|||||||
video.width = (video.width + 3) & ~3;
|
video.width = (video.width + 3) & ~3;
|
||||||
video.height = (video.height + 3) & ~3;
|
video.height = (video.height + 3) & ~3;
|
||||||
|
|
||||||
// [crispy] ... but never exceeds MAX_SCREENWIDTH (array size!)
|
|
||||||
video.width = MIN(video.width, MAX_SCREENWIDTH);
|
|
||||||
video.height = MIN(video.height, MAX_SCREENHEIGHT);
|
|
||||||
|
|
||||||
video.deltaw = (video.unscaledw - NONWIDEWIDTH) / 2;
|
video.deltaw = (video.unscaledw - NONWIDEWIDTH) / 2;
|
||||||
|
|
||||||
video.fov = 2 * atan(video.unscaledw / (1.2 * video.unscaledh) * 3 / 4) / M_PI * ANG180;
|
video.fov = 2 * atan(video.unscaledw / (1.2 * video.unscaledh) * 3 / 4) / M_PI * ANG180;
|
||||||
@ -974,6 +970,8 @@ void I_GetScreenDimensions(void)
|
|||||||
video.xstep = ((video.unscaledw << FRACBITS) / video.width) + 1;
|
video.xstep = ((video.unscaledw << FRACBITS) / video.width) + 1;
|
||||||
video.ystep = ((video.unscaledh << FRACBITS) / video.height) + 1;
|
video.ystep = ((video.unscaledh << FRACBITS) / video.height) + 1;
|
||||||
|
|
||||||
|
R_InitAnyRes();
|
||||||
|
|
||||||
printf("render resolution: %dx%d\n", video.width, video.height);
|
printf("render resolution: %dx%d\n", video.width, video.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,6 @@ typedef struct
|
|||||||
|
|
||||||
extern video_t video;
|
extern video_t video;
|
||||||
|
|
||||||
void I_GetScreenDimensions(void);
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
RATIO_ORIG,
|
RATIO_ORIG,
|
||||||
|
@ -85,7 +85,7 @@ typedef struct {
|
|||||||
// Replaces the old R_Clip*WallSegment functions. It draws bits of walls in those
|
// Replaces the old R_Clip*WallSegment functions. It draws bits of walls in those
|
||||||
// columns which aren't solid, and updates the solidcol[] array appropriately
|
// columns which aren't solid, and updates the solidcol[] array appropriately
|
||||||
|
|
||||||
byte solidcol[MAX_SCREENWIDTH];
|
byte *solidcol = NULL;
|
||||||
|
|
||||||
static void R_ClipWallSegment(int first, int last, boolean solid)
|
static void R_ClipWallSegment(int first, int last, boolean solid)
|
||||||
{
|
{
|
||||||
@ -124,7 +124,7 @@ static void R_ClipWallSegment(int first, int last, boolean solid)
|
|||||||
|
|
||||||
void R_ClearClipSegs (void)
|
void R_ClearClipSegs (void)
|
||||||
{
|
{
|
||||||
memset(solidcol, 0, MAX_SCREENWIDTH);
|
memset(solidcol, 0, video.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
// killough 1/18/98 -- This function is used to fix the automap bug which
|
// killough 1/18/98 -- This function is used to fix the automap bug which
|
||||||
|
@ -41,7 +41,7 @@ extern unsigned maxdrawsegs;
|
|||||||
|
|
||||||
extern drawseg_t *ds_p;
|
extern drawseg_t *ds_p;
|
||||||
|
|
||||||
extern byte solidcol[];
|
extern byte *solidcol;
|
||||||
|
|
||||||
void R_ClearClipSegs(void);
|
void R_ClearClipSegs(void);
|
||||||
void R_ClearDrawSegs(void);
|
void R_ClearDrawSegs(void);
|
||||||
|
@ -449,11 +449,9 @@ typedef struct visplane
|
|||||||
int picnum, lightlevel, minx, maxx;
|
int picnum, lightlevel, minx, maxx;
|
||||||
fixed_t height;
|
fixed_t height;
|
||||||
fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats
|
fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats
|
||||||
|
unsigned short *bottom;
|
||||||
unsigned short pad1; // leave pads for [minx-1]/[maxx+1]
|
unsigned short pad1; // leave pads for [minx-1]/[maxx+1]
|
||||||
unsigned short top[MAX_SCREENWIDTH];
|
unsigned short top[3];
|
||||||
unsigned short pad2, pad3; // killough 2/8/98, 4/25/98
|
|
||||||
unsigned short bottom[MAX_SCREENWIDTH];
|
|
||||||
unsigned short pad4;
|
|
||||||
} visplane_t;
|
} visplane_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
44
src/r_draw.c
44
src/r_draw.c
@ -21,14 +21,12 @@
|
|||||||
|
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
#include "r_bsp.h"
|
||||||
#include "r_draw.h" // [FG]
|
#include "r_draw.h" // [FG]
|
||||||
#include "r_main.h"
|
#include "r_main.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "m_menu.h"
|
#include "m_menu.h"
|
||||||
|
|
||||||
#define MAXWIDTH MAX_SCREENWIDTH /* kilough 2/8/98 */
|
|
||||||
#define MAXHEIGHT MAX_SCREENHEIGHT
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// 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,
|
||||||
@ -47,8 +45,8 @@ int scaledviewy;
|
|||||||
int viewheight;
|
int viewheight;
|
||||||
int viewwindowx;
|
int viewwindowx;
|
||||||
int viewwindowy;
|
int viewwindowy;
|
||||||
static byte *ylookup[MAXHEIGHT];
|
static byte **ylookup = NULL;
|
||||||
static int columnofs[MAXWIDTH];
|
static int *columnofs = NULL;
|
||||||
static int linesize = SCREENWIDTH; // killough 11/98
|
static int linesize = SCREENWIDTH; // killough 11/98
|
||||||
|
|
||||||
// Color tables for different players,
|
// Color tables for different players,
|
||||||
@ -102,9 +100,9 @@ void R_DrawColumn (void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if ((unsigned)dc_x >= MAX_SCREENWIDTH
|
if ((unsigned)dc_x >= video.width
|
||||||
|| dc_yl < 0
|
|| dc_yl < 0
|
||||||
|| dc_yh >= MAX_SCREENHEIGHT)
|
|| dc_yh >= video.height)
|
||||||
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
|
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -205,9 +203,9 @@ void R_DrawTLColumn (void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if ((unsigned)dc_x >= MAX_SCREENWIDTH
|
if ((unsigned)dc_x >= video.width
|
||||||
|| dc_yl < 0
|
|| dc_yl < 0
|
||||||
|| dc_yh >= MAX_SCREENHEIGHT)
|
|| dc_yh >= video.height)
|
||||||
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
|
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -292,9 +290,9 @@ void R_DrawSkyColumn(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if ((unsigned)dc_x >= MAX_SCREENWIDTH
|
if ((unsigned)dc_x >= video.width
|
||||||
|| dc_yl < 0
|
|| dc_yl < 0
|
||||||
|| dc_yh >= MAX_SCREENHEIGHT)
|
|| dc_yh >= video.height)
|
||||||
I_Error ("R_DrawSkyColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
|
I_Error ("R_DrawSkyColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -473,9 +471,9 @@ static void R_DrawFuzzColumn_orig(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if ((unsigned) dc_x >= MAX_SCREENWIDTH
|
if ((unsigned) dc_x >= video.width
|
||||||
|| dc_yl < 0
|
|| dc_yl < 0
|
||||||
|| dc_yh >= MAX_SCREENHEIGHT)
|
|| dc_yh >= video.height)
|
||||||
I_Error ("R_DrawFuzzColumn: %i to %i at %i",
|
I_Error ("R_DrawFuzzColumn: %i to %i at %i",
|
||||||
dc_yl, dc_yh, dc_x);
|
dc_yl, dc_yh, dc_x);
|
||||||
#endif
|
#endif
|
||||||
@ -555,9 +553,9 @@ static void R_DrawFuzzColumn_block(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if ((unsigned) dc_x >= MAX_SCREENWIDTH
|
if ((unsigned) dc_x >= video.width
|
||||||
|| dc_yl < 0
|
|| dc_yl < 0
|
||||||
|| dc_yh >= MAX_SCREENHEIGHT)
|
|| dc_yh >= video.height)
|
||||||
I_Error ("R_DrawFuzzColumn: %i to %i at %i",
|
I_Error ("R_DrawFuzzColumn: %i to %i at %i",
|
||||||
dc_yl, dc_yh, dc_x);
|
dc_yl, dc_yh, dc_x);
|
||||||
#endif
|
#endif
|
||||||
@ -638,9 +636,9 @@ void R_DrawTranslatedColumn (void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if ((unsigned)dc_x >= MAX_SCREENWIDTH
|
if ((unsigned)dc_x >= video.width
|
||||||
|| dc_yl < 0
|
|| dc_yl < 0
|
||||||
|| dc_yh >= MAX_SCREENHEIGHT)
|
|| dc_yh >= video.height)
|
||||||
I_Error ( "R_DrawColumn: %i to %i at %i",
|
I_Error ( "R_DrawColumn: %i to %i at %i",
|
||||||
dc_yl, dc_yh, dc_x);
|
dc_yl, dc_yh, dc_x);
|
||||||
#endif
|
#endif
|
||||||
@ -800,6 +798,18 @@ void R_DrawSpan (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void R_InitBufferRes(void)
|
||||||
|
{
|
||||||
|
if (solidcol) Z_Free(solidcol);
|
||||||
|
if (columnofs) Z_Free(columnofs);
|
||||||
|
if (ylookup) Z_Free(ylookup);
|
||||||
|
|
||||||
|
columnofs = Z_Malloc(video.width * sizeof(*columnofs), PU_STATIC, NULL);
|
||||||
|
ylookup = Z_Malloc(video.height * sizeof(*ylookup), PU_STATIC, NULL);
|
||||||
|
|
||||||
|
solidcol = Z_Calloc(1, video.width * sizeof(*solidcol), PU_STATIC, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_InitBuffer
|
// R_InitBuffer
|
||||||
// Creats lookup tables that avoid
|
// Creats lookup tables that avoid
|
||||||
|
@ -88,7 +88,7 @@ void R_DrawBorder(int x, int y, int w, int h);
|
|||||||
// If the view size is not full screen, draws a border around it.
|
// If the view size is not full screen, draws a border around it.
|
||||||
void R_DrawViewBorder(void);
|
void R_DrawViewBorder(void);
|
||||||
|
|
||||||
extern byte *ylookup[]; // killough 11/98
|
void R_InitBufferRes(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
12
src/r_main.c
12
src/r_main.c
@ -71,10 +71,10 @@ int viewangletox[FINEANGLES/2];
|
|||||||
// to the lowest viewangle that maps back to x ranges
|
// to the lowest viewangle that maps back to x ranges
|
||||||
// from clipangle to -clipangle.
|
// from clipangle to -clipangle.
|
||||||
|
|
||||||
angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98
|
angle_t *xtoviewangle = NULL; // killough 2/8/98
|
||||||
|
|
||||||
// [FG] linear horizontal sky scrolling
|
// [FG] linear horizontal sky scrolling
|
||||||
angle_t linearskyangle[MAX_SCREENWIDTH+1];
|
angle_t *linearskyangle = NULL;
|
||||||
|
|
||||||
int LIGHTLEVELS;
|
int LIGHTLEVELS;
|
||||||
int LIGHTSEGSHIFT;
|
int LIGHTSEGSHIFT;
|
||||||
@ -856,6 +856,14 @@ void R_RenderPlayerView (player_t* player)
|
|||||||
NetUpdate ();
|
NetUpdate ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void R_InitAnyRes(void)
|
||||||
|
{
|
||||||
|
R_InitSpritesRes();
|
||||||
|
R_InitBufferRes();
|
||||||
|
R_InitPlanesRes();
|
||||||
|
R_InitVisplanesRes();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log: r_main.c,v $
|
// $Log: r_main.c,v $
|
||||||
|
@ -117,6 +117,8 @@ void R_ExecuteSetViewSize(void);
|
|||||||
// [crispy] smooth texture scrolling
|
// [crispy] smooth texture scrolling
|
||||||
void R_InterpolateTextureOffsets (void);
|
void R_InterpolateTextureOffsets (void);
|
||||||
|
|
||||||
|
void R_InitAnyRes(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "i_video.h"
|
||||||
#include "z_zone.h" /* memory allocation wrappers -- killough */
|
#include "z_zone.h" /* memory allocation wrappers -- killough */
|
||||||
|
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
@ -58,18 +59,18 @@ visplane_t *floorplane, *ceilingplane;
|
|||||||
|
|
||||||
// killough 8/1/98: set static number of openings to be large enough
|
// killough 8/1/98: set static number of openings to be large enough
|
||||||
// (a static limit is okay in this case and avoids difficulties in r_segs.c)
|
// (a static limit is okay in this case and avoids difficulties in r_segs.c)
|
||||||
#define MAXOPENINGS (MAX_SCREENWIDTH*MAX_SCREENHEIGHT)
|
static int *openings = NULL;
|
||||||
int openings[MAXOPENINGS],*lastopening; // [FG] 32-bit integer math
|
int *lastopening; // [FG] 32-bit integer math
|
||||||
|
|
||||||
// Clip values are the solid pixel bounding the range.
|
// Clip values are the solid pixel bounding the range.
|
||||||
// floorclip starts out SCREENHEIGHT
|
// floorclip starts out SCREENHEIGHT
|
||||||
// ceilingclip starts out -1
|
// ceilingclip starts out -1
|
||||||
|
|
||||||
int floorclip[MAX_SCREENWIDTH], ceilingclip[MAX_SCREENWIDTH]; // [FG] 32-bit integer math
|
int *floorclip = NULL, *ceilingclip = NULL; // [FG] 32-bit integer math
|
||||||
|
|
||||||
// spanstart holds the start of a plane span; initialized to 0 at start
|
// spanstart holds the start of a plane span; initialized to 0 at start
|
||||||
|
|
||||||
static int spanstart[MAX_SCREENHEIGHT]; // killough 2/8/98
|
static int *spanstart = NULL; // killough 2/8/98
|
||||||
|
|
||||||
//
|
//
|
||||||
// texture mapping
|
// texture mapping
|
||||||
@ -80,13 +81,13 @@ static fixed_t planeheight;
|
|||||||
|
|
||||||
// killough 2/8/98: make variables static
|
// killough 2/8/98: make variables static
|
||||||
|
|
||||||
static fixed_t cachedheight[MAX_SCREENHEIGHT];
|
static fixed_t *cachedheight = NULL;
|
||||||
static fixed_t cacheddistance[MAX_SCREENHEIGHT];
|
static fixed_t *cacheddistance = NULL;
|
||||||
static fixed_t cachedxstep[MAX_SCREENHEIGHT];
|
static fixed_t *cachedxstep = NULL;
|
||||||
static fixed_t cachedystep[MAX_SCREENHEIGHT];
|
static fixed_t *cachedystep = NULL;
|
||||||
static fixed_t xoffs,yoffs; // killough 2/28/98: flat offsets
|
static fixed_t xoffs,yoffs; // killough 2/28/98: flat offsets
|
||||||
|
|
||||||
fixed_t *yslope, yslopes[LOOKDIRS][MAX_SCREENHEIGHT], distscale[MAX_SCREENWIDTH];
|
fixed_t *yslope = NULL, **yslopes = NULL, *distscale = NULL;
|
||||||
|
|
||||||
// [FG] linear horizontal sky scrolling
|
// [FG] linear horizontal sky scrolling
|
||||||
boolean linearsky;
|
boolean linearsky;
|
||||||
@ -98,9 +99,68 @@ static angle_t *xtoskyangle;
|
|||||||
//
|
//
|
||||||
void R_InitPlanes (void)
|
void R_InitPlanes (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_InitPlanesRes(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (floorclip) Z_Free(floorclip);
|
||||||
|
if (ceilingclip) Z_Free(ceilingclip);
|
||||||
|
if (spanstart) Z_Free(spanstart);
|
||||||
|
|
||||||
|
if (cachedheight) Z_Free(cachedheight);
|
||||||
|
if (cacheddistance) Z_Free(cacheddistance);
|
||||||
|
if (cachedxstep) Z_Free(cachedxstep);
|
||||||
|
if (cachedystep) Z_Free(cachedystep);
|
||||||
|
|
||||||
|
if (openings) Z_Free(openings);
|
||||||
|
|
||||||
|
if (yslopes)
|
||||||
|
{
|
||||||
|
for (i = 0; i < LOOKDIRS; ++i)
|
||||||
|
{
|
||||||
|
Z_Free(yslopes[i]);
|
||||||
|
}
|
||||||
|
Z_Free(yslopes);
|
||||||
|
}
|
||||||
|
if (distscale) Z_Free(distscale);
|
||||||
|
|
||||||
|
floorclip = Z_Calloc(1, video.width * sizeof(*floorclip), PU_STATIC, NULL);
|
||||||
|
ceilingclip = Z_Calloc(1, video.width * sizeof(*ceilingclip), PU_STATIC, NULL);
|
||||||
|
spanstart = Z_Calloc(1, video.height * sizeof(*spanstart), PU_STATIC, NULL);
|
||||||
|
|
||||||
|
cachedheight = Z_Calloc(1, video.height * sizeof(*cachedheight), PU_STATIC, NULL);
|
||||||
|
cacheddistance = Z_Calloc(1, video.height * sizeof(*cacheddistance), PU_STATIC, NULL);
|
||||||
|
cachedxstep = Z_Calloc(1, video.height * sizeof(*cachedxstep), PU_STATIC, NULL);
|
||||||
|
cachedystep = Z_Calloc(1, video.height * sizeof(*cachedystep), PU_STATIC, NULL);
|
||||||
|
|
||||||
|
yslopes = Z_Malloc(LOOKDIRS * sizeof(*yslopes), PU_STATIC, NULL);
|
||||||
|
for (i = 0; i < LOOKDIRS; ++i)
|
||||||
|
{
|
||||||
|
yslopes[i] = Z_Calloc(1, video.height * sizeof(**yslopes), PU_STATIC, NULL);
|
||||||
|
}
|
||||||
|
distscale = Z_Calloc(1, video.width * sizeof(*distscale), PU_STATIC, NULL);
|
||||||
|
|
||||||
|
openings = Z_Calloc(1, video.width * video.height * sizeof(*openings), PU_STATIC, NULL);
|
||||||
|
|
||||||
xtoskyangle = linearsky ? linearskyangle : xtoviewangle;
|
xtoskyangle = linearsky ? linearskyangle : xtoviewangle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void R_InitVisplanesRes(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
freetail = NULL;
|
||||||
|
freehead = &freetail;
|
||||||
|
|
||||||
|
for (i = 0; i < MAXVISPLANES; i++)
|
||||||
|
{
|
||||||
|
visplanes[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_MapPlane
|
// R_MapPlane
|
||||||
//
|
//
|
||||||
@ -205,7 +265,11 @@ static visplane_t *new_visplane(unsigned hash)
|
|||||||
{
|
{
|
||||||
visplane_t *check = freetail;
|
visplane_t *check = freetail;
|
||||||
if (!check)
|
if (!check)
|
||||||
check = Z_Calloc(1, sizeof *check, PU_STATIC, 0);
|
{
|
||||||
|
const int size = sizeof(*check) + sizeof(*check->top) * (video.width * 2 + sizeof(*check->bottom) * 4);
|
||||||
|
check = Z_Calloc(1, size, PU_STATIC, NULL);
|
||||||
|
check->bottom = &check->top[video.width + sizeof(*check->bottom)];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (!(freetail = freetail->next))
|
if (!(freetail = freetail->next))
|
||||||
freehead = &freetail;
|
freehead = &freetail;
|
||||||
@ -228,7 +292,7 @@ visplane_t *R_DupPlane(const visplane_t *pl, int start, int stop)
|
|||||||
new_pl->yoffs = pl->yoffs;
|
new_pl->yoffs = pl->yoffs;
|
||||||
new_pl->minx = start;
|
new_pl->minx = start;
|
||||||
new_pl->maxx = stop;
|
new_pl->maxx = stop;
|
||||||
memset(new_pl->top, UCHAR_MAX, viewwidth * sizeof(*new_pl->top));
|
memset(new_pl->top, UCHAR_MAX, video.width * sizeof(*new_pl->top));
|
||||||
|
|
||||||
return new_pl;
|
return new_pl;
|
||||||
}
|
}
|
||||||
@ -278,7 +342,7 @@ visplane_t *R_FindPlane(fixed_t height, int picnum, int lightlevel,
|
|||||||
check->xoffs = xoffs; // killough 2/28/98: Save offsets
|
check->xoffs = xoffs; // killough 2/28/98: Save offsets
|
||||||
check->yoffs = yoffs;
|
check->yoffs = yoffs;
|
||||||
|
|
||||||
memset(check->top, UCHAR_MAX, viewwidth * sizeof(*check->top));
|
memset(check->top, UCHAR_MAX, video.width * sizeof(*check->top));
|
||||||
|
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
// Visplane related.
|
// Visplane related.
|
||||||
extern int *lastopening; // [FG] 32-bit integer math
|
extern int *lastopening; // [FG] 32-bit integer math
|
||||||
|
|
||||||
extern int floorclip[], ceilingclip[]; // [FG] 32-bit integer math
|
extern int *floorclip, *ceilingclip; // [FG] 32-bit integer math
|
||||||
extern fixed_t *yslope, yslopes[LOOKDIRS][MAX_SCREENHEIGHT], distscale[];
|
extern fixed_t *yslope, **yslopes, *distscale;
|
||||||
|
|
||||||
void R_InitPlanes(void);
|
void R_InitPlanes(void);
|
||||||
void R_ClearPlanes(void);
|
void R_ClearPlanes(void);
|
||||||
@ -48,6 +48,10 @@ visplane_t *R_CheckPlane(visplane_t *pl, int start, int stop);
|
|||||||
// cph 2003/04/18 - create duplicate of existing visplane and set initial range
|
// cph 2003/04/18 - create duplicate of existing visplane and set initial range
|
||||||
visplane_t *R_DupPlane(const visplane_t *pl, int start, int stop);
|
visplane_t *R_DupPlane(const visplane_t *pl, int start, int stop);
|
||||||
|
|
||||||
|
void R_InitPlanesRes(void);
|
||||||
|
|
||||||
|
void R_InitVisplanesRes(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -179,7 +179,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2)
|
|||||||
int64_t t = ((int64_t) centeryfrac << FRACBITS) -
|
int64_t t = ((int64_t) centeryfrac << FRACBITS) -
|
||||||
(int64_t) dc_texturemid * spryscale;
|
(int64_t) dc_texturemid * spryscale;
|
||||||
if (t + (int64_t) textureheight[texnum] * spryscale < 0 ||
|
if (t + (int64_t) textureheight[texnum] * spryscale < 0 ||
|
||||||
t > (int64_t) MAX_SCREENHEIGHT << FRACBITS*2)
|
t > (int64_t) video.height << FRACBITS*2)
|
||||||
continue; // skip if the texture is out of screen's range
|
continue; // skip if the texture is out of screen's range
|
||||||
sprtopscreen = (int64_t)(t >> FRACBITS); // [FG] 64-bit integer math
|
sprtopscreen = (int64_t)(t >> FRACBITS); // [FG] 64-bit integer math
|
||||||
}
|
}
|
||||||
|
@ -100,12 +100,12 @@ extern player_t *viewplayer;
|
|||||||
extern angle_t clipangle;
|
extern angle_t clipangle;
|
||||||
extern angle_t vx_clipangle;
|
extern angle_t vx_clipangle;
|
||||||
extern int viewangletox[FINEANGLES/2];
|
extern int viewangletox[FINEANGLES/2];
|
||||||
extern angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98
|
extern angle_t *xtoviewangle; // killough 2/8/98
|
||||||
extern fixed_t rw_distance;
|
extern fixed_t rw_distance;
|
||||||
extern angle_t rw_normalangle;
|
extern angle_t rw_normalangle;
|
||||||
|
|
||||||
// [FG] linear horizontal sky scrolling
|
// [FG] linear horizontal sky scrolling
|
||||||
extern angle_t linearskyangle[MAX_SCREENWIDTH+1];
|
extern angle_t *linearskyangle;
|
||||||
|
|
||||||
// angle to line origin
|
// angle to line origin
|
||||||
extern int rw_angle1;
|
extern int rw_angle1;
|
||||||
|
@ -78,12 +78,16 @@ static drawseg_xrange_item_t *drawsegs_xrange;
|
|||||||
static unsigned int drawsegs_xrange_size = 0;
|
static unsigned int drawsegs_xrange_size = 0;
|
||||||
static int drawsegs_xrange_count = 0;
|
static int drawsegs_xrange_count = 0;
|
||||||
|
|
||||||
|
// [FG] 32-bit integer math
|
||||||
|
static int *clipbot = NULL; // killough 2/8/98: // dropoff overflow
|
||||||
|
static int *cliptop = NULL; // change to MAX_* // dropoff overflow
|
||||||
|
|
||||||
// constant arrays
|
// constant arrays
|
||||||
// used for psprite clipping and initializing clipping
|
// used for psprite clipping and initializing clipping
|
||||||
|
|
||||||
// [FG] 32-bit integer math
|
// [FG] 32-bit integer math
|
||||||
int negonearray[MAX_SCREENWIDTH]; // killough 2/8/98:
|
int *negonearray = NULL; // killough 2/8/98:
|
||||||
int screenheightarray[MAX_SCREENWIDTH]; // change to MAX_*
|
int *screenheightarray = NULL; // change to MAX_*
|
||||||
|
|
||||||
//
|
//
|
||||||
// INITIALIZATION FUNCTIONS
|
// INITIALIZATION FUNCTIONS
|
||||||
@ -98,6 +102,24 @@ spritedef_t *sprites;
|
|||||||
static spriteframe_t sprtemp[MAX_SPRITE_FRAMES];
|
static spriteframe_t sprtemp[MAX_SPRITE_FRAMES];
|
||||||
static int maxframe;
|
static int maxframe;
|
||||||
|
|
||||||
|
void R_InitSpritesRes(void)
|
||||||
|
{
|
||||||
|
if (xtoviewangle) Z_Free(xtoviewangle);
|
||||||
|
if (linearskyangle) Z_Free(linearskyangle);
|
||||||
|
if (negonearray) Z_Free(negonearray);
|
||||||
|
if (screenheightarray) Z_Free(screenheightarray);
|
||||||
|
|
||||||
|
xtoviewangle = Z_Calloc(1, (video.width + 1) * sizeof(*xtoviewangle), PU_STATIC, NULL);
|
||||||
|
linearskyangle = Z_Calloc(1, (video.width + 1) * sizeof(*linearskyangle), PU_STATIC, NULL);
|
||||||
|
negonearray = Z_Calloc(1, video.width * sizeof(*negonearray), PU_STATIC, NULL);
|
||||||
|
screenheightarray = Z_Calloc(1, video.width * sizeof(*screenheightarray), PU_STATIC, NULL);
|
||||||
|
|
||||||
|
if (clipbot) Z_Free(clipbot);
|
||||||
|
|
||||||
|
clipbot = Z_Calloc(1, 2 * video.width * sizeof(*clipbot), PU_STATIC, NULL);
|
||||||
|
cliptop = clipbot + video.width;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_InstallSpriteLump
|
// R_InstallSpriteLump
|
||||||
// Local function for R_InitSprites.
|
// Local function for R_InitSprites.
|
||||||
@ -285,7 +307,7 @@ static size_t num_vissprite, num_vissprite_alloc, num_vissprite_ptrs;
|
|||||||
void R_InitSprites(char **namelist)
|
void R_InitSprites(char **namelist)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<MAX_SCREENWIDTH; i++) // killough 2/8/98
|
for (i = 0; i < video.width; i++) // killough 2/8/98
|
||||||
negonearray[i] = -1;
|
negonearray[i] = -1;
|
||||||
R_InitSpriteDefs(namelist);
|
R_InitSpriteDefs(namelist);
|
||||||
}
|
}
|
||||||
@ -974,9 +996,6 @@ void R_SortVisSprites (void)
|
|||||||
void R_DrawSprite (vissprite_t* spr)
|
void R_DrawSprite (vissprite_t* spr)
|
||||||
{
|
{
|
||||||
drawseg_t *ds;
|
drawseg_t *ds;
|
||||||
// [FG] 32-bit integer math
|
|
||||||
int clipbot[MAX_SCREENWIDTH]; // killough 2/8/98:
|
|
||||||
int cliptop[MAX_SCREENWIDTH]; // change to MAX_*
|
|
||||||
int x;
|
int x;
|
||||||
int r1;
|
int r1;
|
||||||
int r2;
|
int r2;
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
// Constant arrays used for psprite clipping and initializing clipping.
|
// Constant arrays used for psprite clipping and initializing clipping.
|
||||||
|
|
||||||
// [FG] 32-bit integer math
|
// [FG] 32-bit integer math
|
||||||
extern int negonearray[MAX_SCREENWIDTH]; // killough 2/8/98:
|
extern int *negonearray; // killough 2/8/98:
|
||||||
extern int screenheightarray[MAX_SCREENWIDTH]; // change to MAX_*
|
extern int *screenheightarray; // change to MAX_*
|
||||||
|
|
||||||
// Vars for R_DrawMaskedColumn
|
// Vars for R_DrawMaskedColumn
|
||||||
|
|
||||||
@ -54,6 +54,8 @@ void R_DrawMasked(void);
|
|||||||
|
|
||||||
void R_ClipVisSprite(vissprite_t *vis, int xl, int xh);
|
void R_ClipVisSprite(vissprite_t *vis, int xl, int xh);
|
||||||
|
|
||||||
|
void R_InitSpritesRes(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user