Merge pull request #373 from monster-psychic-cat/sw_planefixes

Software plane fixes
This commit is contained in:
Alam Arias 2018-12-18 14:02:21 -05:00 committed by GitHub
commit 056cfe71a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 203 additions and 283 deletions

View file

@ -58,10 +58,7 @@ static boolean consoleready; // console prompt is ready
INT32 con_destlines; // vid lines used by console at final position
static INT32 con_curlines; // vid lines currently used by console
INT32 con_clipviewtop; // clip value for planes & sprites, so that the
// part of the view covered by the console is not
// drawn when not needed, this must be -1 when
// console is off
INT32 con_clipviewtop; // (useless)
static INT32 con_hudlines; // number of console heads up message lines
static INT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines

View file

@ -1119,7 +1119,6 @@ static void R_Subsector(size_t num)
}
light = R_GetPlaneLight(frontsector, polysec->floorheight, viewz < polysec->floorheight);
light = 0;
ffloor[numffloors].plane = R_FindPlane(polysec->floorheight, polysec->floorpic,
polysec->lightlevel, xoff, yoff,
polysec->floorpic_angle-po->angle,
@ -1167,7 +1166,6 @@ static void R_Subsector(size_t num)
}
light = R_GetPlaneLight(frontsector, polysec->ceilingheight, viewz < polysec->ceilingheight);
light = 0;
ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic,
polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle,
NULL, NULL

View file

@ -551,13 +551,11 @@ void R_SetViewSize(void)
//
void R_ExecuteSetViewSize(void)
{
fixed_t cosadj;
fixed_t dy;
INT32 i;
INT32 j;
INT32 level;
INT32 startmapl;
INT32 aspectx; //added : 02-02-98 : for aspect ratio calc. below...
setsizeneeded = false;
@ -597,31 +595,22 @@ void R_ExecuteSetViewSize(void)
for (i = 0; i < viewwidth; i++)
screenheightarray[i] = (INT16)viewheight;
// setup sky scaling (uses pspriteyscale)
// setup sky scaling
R_SetSkyScale();
// planes
//aspectx = (((vid.height*centerx*BASEVIDWIDTH)/BASEVIDHEIGHT)/vid.width);
aspectx = centerx;
if (rendermode == render_soft)
{
// this is only used for planes rendering in software mode
j = viewheight*8;
j = viewheight*16;
for (i = 0; i < j; i++)
{
dy = ((i - viewheight*2)<<FRACBITS) + FRACUNIT/2;
dy = ((i - viewheight*8)<<FRACBITS) + FRACUNIT/2;
dy = abs(dy);
yslopetab[i] = FixedDiv(aspectx*FRACUNIT, dy);
yslopetab[i] = FixedDiv(centerx*FRACUNIT, dy);
}
}
for (i = 0; i < viewwidth; i++)
{
cosadj = abs(FINECOSINE(xtoviewangle[i]>>ANGLETOFINESHIFT));
distscale[i] = FixedDiv(FRACUNIT, cosadj);
}
memset(scalelight, 0xFF, sizeof(scalelight));
// Calculate the light levels to use for each level/scale combination.
@ -734,9 +723,136 @@ static mobj_t *viewmobj;
// WARNING: a should be unsigned but to add with 2048, it isn't!
#define AIMINGTODY(a) ((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS)
void R_SkyboxFrame(player_t *player)
// recalc necessary stuff for mouseaiming
// slopes are already calculated for the full possible view (which is 4*viewheight).
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
static void R_SetupFreelook(void)
{
INT32 dy = 0;
if (rendermode == render_soft)
{
// clip it in the case we are looking a hardware 90 degrees full aiming
// (lmps, network and use F12...)
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)];
}
centery = (viewheight/2) + dy;
centeryfrac = centery<<FRACBITS;
}
#undef AIMINGTODY
void R_SetupFrame(player_t *player, boolean skybox)
{
camera_t *thiscam;
boolean chasecam = false;
if (splitscreen && player == &players[secondarydisplayplayer]
&& player != &players[consoleplayer])
{
thiscam = &camera2;
chasecam = (cv_chasecam2.value != 0);
}
else
{
thiscam = &camera;
chasecam = (cv_chasecam.value != 0);
}
if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD)
chasecam = true; // force chasecam on
else if (player->spectator) // no spectator chasecam
chasecam = false; // force chasecam off
if (chasecam && !thiscam->chase)
{
P_ResetCamera(player, thiscam);
thiscam->chase = true;
}
else if (!chasecam)
thiscam->chase = false;
viewsky = !skybox;
if (player->awayviewtics)
{
// cut-away view stuff
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
I_Assert(viewmobj != NULL);
viewz = viewmobj->z + 20*FRACUNIT;
aimingangle = player->awayviewaiming;
viewangle = viewmobj->angle;
}
else if (!player->spectator && chasecam)
// use outside cam view
{
viewmobj = NULL;
viewz = thiscam->z + (thiscam->height>>1);
aimingangle = thiscam->aiming;
viewangle = thiscam->angle;
}
else
// use the player's eyes view
{
viewz = player->viewz;
viewmobj = player->mo;
I_Assert(viewmobj != NULL);
aimingangle = player->aiming;
viewangle = viewmobj->angle;
if (!demoplayback && player->playerstate != PST_DEAD)
{
if (player == &players[consoleplayer])
{
viewangle = localangle; // WARNING: camera uses this
aimingangle = localaiming;
}
else if (player == &players[secondarydisplayplayer])
{
viewangle = localangle2;
aimingangle = localaiming2;
}
}
}
viewz += quake.z;
viewplayer = player;
if (chasecam && !player->awayviewtics && !player->spectator)
{
viewx = thiscam->x;
viewy = thiscam->y;
viewx += quake.x;
viewy += quake.y;
if (thiscam->subsector)
viewsector = thiscam->subsector->sector;
else
viewsector = R_PointInSubsector(viewx, viewy)->sector;
}
else
{
viewx = viewmobj->x;
viewy = viewmobj->y;
viewx += quake.x;
viewy += quake.y;
if (viewmobj->subsector)
viewsector = viewmobj->subsector->sector;
else
viewsector = R_PointInSubsector(viewx, viewy)->sector;
}
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
R_SetupFreelook();
}
void R_SkyboxFrame(player_t *player)
{
camera_t *thiscam;
if (splitscreen && player == &players[secondarydisplayplayer]
@ -950,146 +1066,7 @@ void R_SkyboxFrame(player_t *player)
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
// recalc necessary stuff for mouseaiming
// slopes are already calculated for the full possible view (which is 4*viewheight).
// 18/08/18: (No it's actually 8*viewheight, thanks MPC aka Jimita for finding this out)
if (rendermode == render_soft)
{
// clip it in the case we are looking a hardware 90 degrees full aiming
// (lmps, network and use F12...)
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
yslope = &yslopetab[(3*viewheight/2) - dy];
}
centery = (viewheight/2) + dy;
centeryfrac = centery<<FRACBITS;
}
void R_SetupFrame(player_t *player, boolean skybox)
{
INT32 dy = 0;
camera_t *thiscam;
boolean chasecam = false;
if (splitscreen && player == &players[secondarydisplayplayer]
&& player != &players[consoleplayer])
{
thiscam = &camera2;
chasecam = (cv_chasecam2.value != 0);
}
else
{
thiscam = &camera;
chasecam = (cv_chasecam.value != 0);
}
if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD)
chasecam = true; // force chasecam on
else if (player->spectator) // no spectator chasecam
chasecam = false; // force chasecam off
if (chasecam && !thiscam->chase)
{
P_ResetCamera(player, thiscam);
thiscam->chase = true;
}
else if (!chasecam)
thiscam->chase = false;
viewsky = !skybox;
if (player->awayviewtics)
{
// cut-away view stuff
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
I_Assert(viewmobj != NULL);
viewz = viewmobj->z + 20*FRACUNIT;
aimingangle = player->awayviewaiming;
viewangle = viewmobj->angle;
}
else if (!player->spectator && chasecam)
// use outside cam view
{
viewmobj = NULL;
viewz = thiscam->z + (thiscam->height>>1);
aimingangle = thiscam->aiming;
viewangle = thiscam->angle;
}
else
// use the player's eyes view
{
viewz = player->viewz;
viewmobj = player->mo;
I_Assert(viewmobj != NULL);
aimingangle = player->aiming;
viewangle = viewmobj->angle;
if (!demoplayback && player->playerstate != PST_DEAD)
{
if (player == &players[consoleplayer])
{
viewangle = localangle; // WARNING: camera uses this
aimingangle = localaiming;
}
else if (player == &players[secondarydisplayplayer])
{
viewangle = localangle2;
aimingangle = localaiming2;
}
}
}
viewz += quake.z;
viewplayer = player;
if (chasecam && !player->awayviewtics && !player->spectator)
{
viewx = thiscam->x;
viewy = thiscam->y;
viewx += quake.x;
viewy += quake.y;
if (thiscam->subsector)
viewsector = thiscam->subsector->sector;
else
viewsector = R_PointInSubsector(viewx, viewy)->sector;
}
else
{
viewx = viewmobj->x;
viewy = viewmobj->y;
viewx += quake.x;
viewy += quake.y;
if (viewmobj->subsector)
viewsector = viewmobj->subsector->sector;
else
viewsector = R_PointInSubsector(viewx, viewy)->sector;
}
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
// recalc necessary stuff for mouseaiming
// slopes are already calculated for the full possible view (which is 4*viewheight).
// 18/08/18: (No it's actually 8*viewheight, thanks MPC aka Jimita for finding this out)
if (rendermode == render_soft)
{
// clip it in the case we are looking a hardware 90 degrees full aiming
// (lmps, network and use F12...)
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
yslope = &yslopetab[(3*viewheight/2) - dy];
}
centery = (viewheight/2) + dy;
centeryfrac = centery<<FRACBITS;
R_SetupFreelook();
}
#define ANGLED_PORTALS

View file

@ -16,6 +16,8 @@
#include "doomdef.h"
#include "console.h"
#include "g_game.h"
#include "p_setup.h" // levelflats
#include "p_slopes.h"
#include "r_data.h"
#include "r_local.h"
#include "r_state.h"
@ -26,9 +28,12 @@
#include "z_zone.h"
#include "p_tick.h"
#include "p_setup.h" // levelflats
#include "p_slopes.h"
#ifdef TIMING
#include "p5prof.h"
INT64 mycount;
INT64 mytotal = 0;
UINT32 nombre = 100000;
#endif
//
// opening
@ -51,7 +56,7 @@ visplane_t *floorplane;
visplane_t *ceilingplane;
static visplane_t *currentplane;
planemgr_t ffloor[MAXFFLOORS];
visffloor_t ffloor[MAXFFLOORS];
INT32 numffloors;
//SoM: 3/23/2000: Boom visplane hashing routine.
@ -89,10 +94,9 @@ static fixed_t planeheight;
// (this is to calculate yslopes only when really needed)
// (when mouselookin', yslope is moving into yslopetab)
// Check R_SetupFrame, R_SetViewSize for more...
fixed_t yslopetab[MAXVIDHEIGHT*8];
fixed_t yslopetab[MAXVIDHEIGHT*16];
fixed_t *yslope;
fixed_t distscale[MAXVIDWIDTH];
fixed_t basexscale, baseyscale;
fixed_t cachedheight[MAXVIDHEIGHT];
@ -155,34 +159,19 @@ void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor
}
}
//profile stuff ---------------------------------------------------------
//#define TIMING
#ifdef TIMING
#include "p5prof.h"
INT64 mycount;
INT64 mytotal = 0;
UINT32 nombre = 100000;
#endif
//profile stuff ---------------------------------------------------------
//
// R_MapPlane
//
// Uses global vars:
// planeheight
// ds_source
// basexscale
// baseyscale
// centerx
// viewx
// viewy
// xoffs
// yoffs
// planeangle
//
// BASIC PRIMITIVE
//
// viewsin
// viewcos
// viewheight
#ifndef NOWATER
static INT32 bgofs;
static INT32 wtofs=0;
@ -190,10 +179,6 @@ static INT32 waterofs;
static boolean itswater;
#endif
#ifdef __mips__
//#define NOWATER
#endif
#ifndef NOWATER
static void R_DrawTranslucentWaterSpan_8(void)
{
@ -275,8 +260,8 @@ static void R_DrawTranslucentWaterSpan_8(void)
void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
{
angle_t angle;
fixed_t distance, length;
angle_t angle, planecos, planesin;
fixed_t distance, span;
size_t pindex;
#ifdef RANGECHECK
@ -287,12 +272,22 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
// from r_splats's R_RenderFloorSplat
if (x1 >= vid.width) x1 = vid.width - 1;
angle = (currentplane->viewangle + currentplane->plangle)>>ANGLETOFINESHIFT;
planecos = FINECOSINE(angle);
planesin = FINESINE(angle);
if (planeheight != cachedheight[y])
{
cachedheight[y] = planeheight;
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
ds_xstep = cachedxstep[y] = FixedMul(distance, basexscale);
ds_ystep = cachedystep[y] = FixedMul(distance, baseyscale);
if ((span = abs(centery-y)))
{
ds_xstep = cachedxstep[y] = FixedMul(planesin, planeheight) / span;
ds_ystep = cachedystep[y] = FixedMul(planecos, planeheight) / span;
}
}
else
{
@ -301,13 +296,8 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
ds_ystep = cachedystep[y];
}
length = FixedMul (distance,distscale[x1]);
angle = (currentplane->viewangle + currentplane->plangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
/// \note Wouldn't it be faster just to add viewx and viewy
// to the plane's x/yoffs anyway??
ds_xfrac = FixedMul(FINECOSINE(angle), length) + xoffs;
ds_yfrac = yoffs - FixedMul(FINESINE(angle), length);
ds_xfrac = xoffs + FixedMul(planecos, distance) + (x1 - centerx) * ds_xstep;
ds_yfrac = yoffs - FixedMul(planesin, distance) + (x1 - centerx) * ds_ystep;
#ifndef NOWATER
if (itswater)
@ -315,8 +305,9 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
// ripples da water texture
bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
angle = (currentplane->viewangle + currentplane->plangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
angle = (angle + 2048) & 8191; //90<EFBFBD>
angle = (angle + 2048) & 8191; // 90 degrees
ds_xfrac += FixedMul(FINECOSINE(angle), (bgofs<<FRACBITS));
ds_yfrac += FixedMul(FINESINE(angle), (bgofs<<FRACBITS));
@ -328,7 +319,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
#endif
pindex = distance >> LIGHTZSHIFT;
if (pindex >= MAXLIGHTZ)
pindex = MAXLIGHTZ - 1;
@ -365,8 +355,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
// R_ClearPlanes
// At begining of frame.
//
// NOTE: Uses con_clipviewtop, so that when console is on,
// we don't draw the part of the view hidden under the console.
void R_ClearPlanes(void)
{
INT32 i, p;
@ -376,12 +364,12 @@ void R_ClearPlanes(void)
for (i = 0; i < viewwidth; i++)
{
floorclip[i] = (INT16)viewheight;
ceilingclip[i] = (INT16)con_clipviewtop;
ceilingclip[i] = -1;
frontscale[i] = INT32_MAX;
for (p = 0; p < MAXFFLOORS; p++)
{
ffloor[p].f_clip[i] = (INT16)viewheight;
ffloor[p].c_clip[i] = (INT16)con_clipviewtop;
ffloor[p].c_clip[i] = -1;
}
}

View file

@ -21,7 +21,6 @@
//
// Now what is a visplane, anyway?
// Simple: kinda floor/ceiling polygon optimised for SRB2 rendering.
// 7764 bytes! (for win32, anyway)
//
typedef struct visplane_s
{
@ -39,25 +38,12 @@ typedef struct visplane_s
extracolormap_t *extra_colormap;
// leave pads for [minx-1]/[maxx+1]
// words sucks .. should get rid of that.. but eats memory
// THIS IS UNSIGNED! VERY IMPORTANT!!
UINT16 pad1;
UINT16 top[MAXVIDWIDTH];
UINT16 pad2;
UINT16 pad3;
UINT16 bottom[MAXVIDWIDTH];
UINT16 pad4;
UINT16 padtopstart, top[MAXVIDWIDTH], padtopend;
UINT16 padbottomstart, bottom[MAXVIDWIDTH], padbottomend;
INT32 high, low; // R_PlaneBounds should set these.
fixed_t xoffs, yoffs; // Scrolling flats.
// SoM: frontscale should be stored in the first seg of the subsector
// where the planes themselves are stored. I'm doing this now because
// the old way caused trouble with the drawseg array was re-sized.
INT32 scaleseg;
struct ffloor_s *ffloor;
#ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj;
@ -75,17 +61,15 @@ extern INT16 *lastopening, *openings;
extern size_t maxopenings;
extern INT16 floorclip[MAXVIDWIDTH], ceilingclip[MAXVIDWIDTH];
extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*8];
extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*16];
extern fixed_t cachedheight[MAXVIDHEIGHT];
extern fixed_t cacheddistance[MAXVIDHEIGHT];
extern fixed_t cachedxstep[MAXVIDHEIGHT];
extern fixed_t cachedystep[MAXVIDHEIGHT];
extern fixed_t basexscale, baseyscale;
extern lighttable_t **planezlight;
extern fixed_t *yslope;
extern fixed_t distscale[MAXVIDWIDTH];
extern lighttable_t **planezlight;
void R_InitPlanes(void);
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
@ -134,8 +118,8 @@ typedef struct planemgr_s
#ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj;
#endif
} planemgr_t;
} visffloor_t;
extern planemgr_t ffloor[MAXFFLOORS];
extern visffloor_t ffloor[MAXFFLOORS];
extern INT32 numffloors;
#endif

View file

@ -1344,24 +1344,12 @@ static void R_RenderSegLoop (void)
if (markfloor)
{
#if 0 // Old Doom Legacy code
bottom = floorclip[rw_x]-1;
if (top <= ceilingclip[rw_x])
top = ceilingclip[rw_x]+1;
if (top <= bottom && floorplane)
{
floorplane->top[rw_x] = (INT16)top;
floorplane->bottom[rw_x] = (INT16)bottom;
}
#else // Spiffy new PRBoom code
top = yh < ceilingclip[rw_x] ? ceilingclip[rw_x] : yh;
top = yh < ceilingclip[rw_x] ? ceilingclip[rw_x] : yh;
if (++top <= bottom && floorplane)
{
floorplane->top[rw_x] = (INT16)top;
floorplane->bottom[rw_x] = (INT16)bottom;
}
#endif
}
if (numffloors)
@ -1645,26 +1633,11 @@ static void R_RenderSegLoop (void)
}
for (i = 0; i < numffloors; i++)
{
#ifdef POLYOBJECTS_PLANES
if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg))
continue;
#endif
ffloor[i].f_frac += ffloor[i].f_step;
}
for (i = 0; i < numbackffloors; i++)
{
INT32 y_w;
#ifdef POLYOBJECTS_PLANES
if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg))
continue;
#endif
y_w = ffloor[i].b_frac >> HEIGHTBITS;
ffloor[i].f_clip[rw_x] = ffloor[i].c_clip[rw_x] = (INT16)(y_w & 0xFFFF);
ffloor[i].f_clip[rw_x] = ffloor[i].c_clip[rw_x] = (INT16)((ffloor[i].b_frac >> HEIGHTBITS) & 0xFFFF);
ffloor[i].b_frac += ffloor[i].b_step;
}
@ -2775,11 +2748,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{
for (i = 0; i < numffloors; i++)
{
#ifdef POLYOBJECTS_PLANES
if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg))
continue;
#endif
ffloor[i].f_pos >>= 4;
#ifdef ESLOPE
ffloor[i].f_pos_slope >>= 4;
@ -3060,7 +3028,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (ceilingplane) //SoM: 3/29/2000: Check for null ceiling planes
ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1);
else
markceiling = 0;
markceiling = false;
// Don't render the ceiling again when rendering polyobjects
if (curline->polyseg)
markceiling = false;
}
// get a new or use the same visplane
@ -3069,7 +3041,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (floorplane) //SoM: 3/29/2000: Check for null planes
floorplane = R_CheckPlane (floorplane, rw_x, rw_stopx-1);
else
markfloor = 0;
markfloor = false;
// Don't render the floor again when rendering polyobjects
if (curline->polyseg)
markfloor = false;
}
ds_p->numffloorplanes = 0;

View file

@ -365,9 +365,8 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
#else
lighttable_t **planezlight;
fixed_t planeheight;
angle_t angle;
fixed_t distance;
fixed_t length;
angle_t angle, planecos, planesin;
fixed_t distance, span;
size_t indexr;
INT32 light;
#endif
@ -473,12 +472,22 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
if (x2 >= vid.width)
x2 = vid.width - 1;
angle = (currentplane->viewangle + currentplane->plangle)>>ANGLETOFINESHIFT;
planecos = FINECOSINE(angle);
planesin = FINESINE(angle);
if (planeheight != cachedheight[y])
{
cachedheight[y] = planeheight;
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
ds_xstep = cachedxstep[y] = FixedMul(distance,basexscale);
ds_ystep = cachedystep[y] = FixedMul(distance,baseyscale);
if ((span = abs(centery-y)))
{
ds_xstep = cachedxstep[y] = FixedMul(planesin, planeheight) / span;
ds_ystep = cachedystep[y] = FixedMul(planecos, planeheight) / span;
}
}
else
{
@ -486,10 +495,9 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
ds_xstep = cachedxstep[y];
ds_ystep = cachedystep[y];
}
length = FixedMul(distance, distscale[x1]);
angle = (viewangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
ds_xfrac = viewx + FixedMul(FINECOSINE(angle), length);
ds_yfrac = -viewy - FixedMul(FINESINE(angle), length);
ds_xfrac = xoffs + FixedMul(planecos, distance) + (x1 - centerx) * ds_xstep;
ds_yfrac = yoffs - FixedMul(planesin, distance) + (x1 - centerx) * ds_ystep;
ds_xfrac -= offsetx;
ds_yfrac += offsety;

View file

@ -1733,7 +1733,7 @@ static void R_CreateDrawNodes(void)
plane = ds->curline->polyseg->visplane;
R_PlaneBounds(plane);
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low)
if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low)
;
else {
// Put it in!
@ -1762,7 +1762,7 @@ static void R_CreateDrawNodes(void)
plane = ds->ffloorplanes[p];
R_PlaneBounds(plane);
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
{
ds->ffloorplanes[p] = NULL;
continue;
@ -1799,7 +1799,7 @@ static void R_CreateDrawNodes(void)
plane = PolyObjects[i].visplane;
R_PlaneBounds(plane);
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low)
if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low)
{
PolyObjects[i].visplane = NULL;
continue;

View file

@ -309,14 +309,6 @@ void SCR_Recalc(void)
if (automapactive)
AM_Stop();
// r_plane stuff: visplanes, openings, floorclip, ceilingclip, spanstart,
// spanstop, yslope, distscale, cachedheight, cacheddistance,
// cachedxstep, cachedystep
// -> allocated at the maximum vidsize, static.
// r_main: xtoviewangle, allocated at the maximum size.
// r_things: negonearray, screenheightarray allocated max. size.
// set the screen[x] ptrs on the new vidbuffers
V_Init();