mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-29 23:23:07 +00:00
Move line handling to r_line and drawseg drawing to r_drawsegment and then remove r_segs
This commit is contained in:
parent
ac7992a2a1
commit
a9fbd421fb
25 changed files with 2000 additions and 2143 deletions
|
@ -847,7 +847,6 @@ set( FASTMATH_PCH_SOURCES
|
|||
swrenderer/drawers/r_thread.cpp
|
||||
swrenderer/scene/r_3dfloors.cpp
|
||||
swrenderer/scene/r_bsp.cpp
|
||||
swrenderer/scene/r_segs.cpp
|
||||
swrenderer/scene/r_things.cpp
|
||||
swrenderer/scene/r_portal.cpp
|
||||
swrenderer/line/r_line.cpp
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -23,6 +23,18 @@ namespace swrenderer
|
|||
void InitFromLine(const DVector2 &left, const DVector2 &right);
|
||||
};
|
||||
|
||||
void R_AddLine(seg_t *line);
|
||||
bool R_StoreWallRange(int start, int stop);
|
||||
void R_NewWall(bool needlights);
|
||||
void R_RenderSegLoop(int x1, int x2);
|
||||
|
||||
bool IsFogBoundary(sector_t *front, sector_t *back);
|
||||
bool R_SkyboxCompare(sector_t *frontsector, sector_t *backsector);
|
||||
|
||||
extern subsector_t *InSubsector;
|
||||
extern sector_t *frontsector;
|
||||
extern sector_t *backsector;
|
||||
|
||||
extern seg_t *curline;
|
||||
extern side_t *sidedef;
|
||||
extern line_t *linedef;
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "swrenderer/drawers/r_draw.h"
|
||||
#include "swrenderer/segments/r_drawsegment.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "swrenderer/line/r_walldraw.h"
|
||||
#include "swrenderer/line/r_wallsetup.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "g_level.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "r_flatplane.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "g_level.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "swrenderer/plane/r_fogboundary.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "g_level.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "r_skyplane.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "g_level.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "r_slopeplane.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "segments/r_drawsegment.h"
|
||||
#include "segments/r_portalsegment.h"
|
||||
#include "segments/r_clipsegment.h"
|
||||
#include "scene/r_segs.h"
|
||||
#include "scene/r_3dfloors.h"
|
||||
#include "scene/r_portal.h"
|
||||
#include "r_sky.h"
|
||||
|
|
|
@ -136,6 +136,8 @@ void R_MultiresInit (void);
|
|||
|
||||
extern void R_CopyStackedViewParameters();
|
||||
|
||||
extern double globaluclip, globaldclip;
|
||||
|
||||
}
|
||||
|
||||
#endif // __R_MAIN_H__
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "swrenderer/r_main.h"
|
||||
#include "r_bsp.h"
|
||||
#include "r_segs.h"
|
||||
#include "c_cvars.h"
|
||||
#include "r_3dfloors.h"
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "doomstat.h"
|
||||
#include "r_state.h"
|
||||
#include "r_bsp.h"
|
||||
#include "r_segs.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_sky.h"
|
||||
#include "po_man.h"
|
||||
|
@ -62,11 +61,6 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
sector_t* frontsector;
|
||||
sector_t* backsector;
|
||||
|
||||
// killough 4/7/98: indicates doors closed wrt automap bugfix:
|
||||
int doorclosed;
|
||||
|
||||
bool r_fakingunderwater;
|
||||
|
||||
|
@ -75,8 +69,16 @@ static BYTE FakeSide;
|
|||
int WindowLeft, WindowRight;
|
||||
WORD MirrorFlags;
|
||||
|
||||
visplane_t *floorplane;
|
||||
visplane_t *ceilingplane;
|
||||
|
||||
// Clip values are the solid pixel bounding the range.
|
||||
// floorclip starts out SCREENHEIGHT and is just outside the range
|
||||
// ceilingclip starts out 0 and is just inside the range
|
||||
//
|
||||
short floorclip[MAXWIDTH];
|
||||
short ceilingclip[MAXWIDTH];
|
||||
|
||||
subsector_t *InSubsector;
|
||||
|
||||
//
|
||||
// killough 3/7/98: Hack floor/ceiling heights for deep water etc.
|
||||
|
@ -290,265 +292,6 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
|
|||
}
|
||||
|
||||
|
||||
bool R_SkyboxCompare(sector_t *frontsector, sector_t *backsector)
|
||||
{
|
||||
FSectorPortal *frontc = frontsector->GetPortal(sector_t::ceiling);
|
||||
FSectorPortal *frontf = frontsector->GetPortal(sector_t::floor);
|
||||
FSectorPortal *backc = backsector->GetPortal(sector_t::ceiling);
|
||||
FSectorPortal *backf = backsector->GetPortal(sector_t::floor);
|
||||
|
||||
// return true if any of the planes has a linedef-based portal (unless both sides have the same one.
|
||||
// Ideally this should also check thing based portals but the omission of this check had been abused to hell and back for those.
|
||||
// (Note: This may require a compatibility option if some maps ran into this for line based portals as well.)
|
||||
if (!frontc->MergeAllowed()) return (frontc != backc);
|
||||
if (!frontf->MergeAllowed()) return (frontf != backf);
|
||||
if (!backc->MergeAllowed()) return true;
|
||||
if (!backf->MergeAllowed()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// R_AddLine
|
||||
// Clips the given segment
|
||||
// and adds any visible pieces to the line list.
|
||||
//
|
||||
|
||||
void R_AddLine (seg_t *line)
|
||||
{
|
||||
static sector_t tempsec; // killough 3/8/98: ceiling/water hack
|
||||
bool solid;
|
||||
DVector2 pt1, pt2;
|
||||
|
||||
curline = line;
|
||||
|
||||
// [RH] Color if not texturing line
|
||||
dc_color = (((int)(line - segs) * 8) + 4) & 255;
|
||||
|
||||
pt1 = line->v1->fPos() - ViewPos;
|
||||
pt2 = line->v2->fPos() - ViewPos;
|
||||
|
||||
// Reject lines not facing viewer
|
||||
if (pt1.Y * (pt1.X - pt2.X) + pt1.X * (pt2.Y - pt1.Y) >= 0)
|
||||
return;
|
||||
|
||||
if (WallC.Init(pt1, pt2, 32.0 / (1 << 12)))
|
||||
return;
|
||||
|
||||
if (WallC.sx1 >= WindowRight || WallC.sx2 <= WindowLeft)
|
||||
return;
|
||||
|
||||
if (line->linedef == NULL)
|
||||
{
|
||||
if (R_CheckClipWallSegment (WallC.sx1, WallC.sx2))
|
||||
{
|
||||
InSubsector->flags |= SSECF_DRAWN;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// reject lines that aren't seen from the portal (if any)
|
||||
// [ZZ] 10.01.2016: lines inside a skybox shouldn't be clipped, although this imposes some limitations on portals in skyboxes.
|
||||
if (!CurrentPortalInSkybox && CurrentPortal && P_ClipLineToPortal(line->linedef, CurrentPortal->dst, ViewPos))
|
||||
return;
|
||||
|
||||
vertex_t *v1, *v2;
|
||||
v1 = line->linedef->v1;
|
||||
v2 = line->linedef->v2;
|
||||
|
||||
if ((v1 == line->v1 && v2 == line->v2) || (v2 == line->v1 && v1 == line->v2))
|
||||
{ // The seg is the entire wall.
|
||||
WallT.InitFromWallCoords(&WallC);
|
||||
}
|
||||
else
|
||||
{ // The seg is only part of the wall.
|
||||
if (line->linedef->sidedef[0] != line->sidedef)
|
||||
{
|
||||
swapvalues (v1, v2);
|
||||
}
|
||||
WallT.InitFromLine(v1->fPos() - ViewPos, v2->fPos() - ViewPos);
|
||||
}
|
||||
|
||||
if (!(fake3D & FAKE3D_FAKEBACK))
|
||||
{
|
||||
backsector = line->backsector;
|
||||
}
|
||||
rw_frontcz1 = frontsector->ceilingplane.ZatPoint(line->v1);
|
||||
rw_frontfz1 = frontsector->floorplane.ZatPoint(line->v1);
|
||||
rw_frontcz2 = frontsector->ceilingplane.ZatPoint(line->v2);
|
||||
rw_frontfz2 = frontsector->floorplane.ZatPoint(line->v2);
|
||||
|
||||
rw_mustmarkfloor = rw_mustmarkceiling = false;
|
||||
rw_havehigh = rw_havelow = false;
|
||||
|
||||
// Single sided line?
|
||||
if (backsector == NULL)
|
||||
{
|
||||
solid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// kg3D - its fake, no transfer_heights
|
||||
if (!(fake3D & FAKE3D_FAKEBACK))
|
||||
{ // killough 3/8/98, 4/4/98: hack for invisible ceilings / deep water
|
||||
backsector = R_FakeFlat (backsector, &tempsec, NULL, NULL, true);
|
||||
}
|
||||
doorclosed = 0; // killough 4/16/98
|
||||
|
||||
rw_backcz1 = backsector->ceilingplane.ZatPoint(line->v1);
|
||||
rw_backfz1 = backsector->floorplane.ZatPoint(line->v1);
|
||||
rw_backcz2 = backsector->ceilingplane.ZatPoint(line->v2);
|
||||
rw_backfz2 = backsector->floorplane.ZatPoint(line->v2);
|
||||
|
||||
if (fake3D & FAKE3D_FAKEBACK)
|
||||
{
|
||||
if (rw_frontfz1 >= rw_backfz1 && rw_frontfz2 >= rw_backfz2)
|
||||
{
|
||||
fake3D |= FAKE3D_CLIPBOTFRONT;
|
||||
}
|
||||
if (rw_frontcz1 <= rw_backcz1 && rw_frontcz2 <= rw_backcz2)
|
||||
{
|
||||
fake3D |= FAKE3D_CLIPTOPFRONT;
|
||||
}
|
||||
}
|
||||
|
||||
// Cannot make these walls solid, because it can result in
|
||||
// sprite clipping problems for sprites near the wall
|
||||
if (rw_frontcz1 > rw_backcz1 || rw_frontcz2 > rw_backcz2)
|
||||
{
|
||||
rw_havehigh = true;
|
||||
R_CreateWallSegmentYSloped (wallupper, backsector->ceilingplane, &WallC, curline, MirrorFlags & RF_XFLIP);
|
||||
}
|
||||
if (rw_frontfz1 < rw_backfz1 || rw_frontfz2 < rw_backfz2)
|
||||
{
|
||||
rw_havelow = true;
|
||||
R_CreateWallSegmentYSloped (walllower, backsector->floorplane, &WallC, curline, MirrorFlags & RF_XFLIP);
|
||||
}
|
||||
|
||||
// Portal
|
||||
if (line->linedef->isVisualPortal() && line->sidedef == line->linedef->sidedef[0])
|
||||
{
|
||||
solid = true;
|
||||
}
|
||||
// Closed door.
|
||||
else if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) ||
|
||||
(rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2))
|
||||
{
|
||||
solid = true;
|
||||
}
|
||||
else if (
|
||||
// properly render skies (consider door "open" if both ceilings are sky):
|
||||
(backsector->GetTexture(sector_t::ceiling) != skyflatnum || frontsector->GetTexture(sector_t::ceiling) != skyflatnum)
|
||||
|
||||
// if door is closed because back is shut:
|
||||
&& rw_backcz1 <= rw_backfz1 && rw_backcz2 <= rw_backfz2
|
||||
|
||||
// preserve a kind of transparent door/lift special effect:
|
||||
&& ((rw_backcz1 >= rw_frontcz1 && rw_backcz2 >= rw_frontcz2) || line->sidedef->GetTexture(side_t::top).isValid())
|
||||
&& ((rw_backfz1 <= rw_frontfz1 && rw_backfz2 <= rw_frontfz2) || line->sidedef->GetTexture(side_t::bottom).isValid()))
|
||||
{
|
||||
// killough 1/18/98 -- This function is used to fix the automap bug which
|
||||
// showed lines behind closed doors simply because the door had a dropoff.
|
||||
//
|
||||
// It assumes that Doom has already ruled out a door being closed because
|
||||
// of front-back closure (e.g. front floor is taller than back ceiling).
|
||||
|
||||
// This fixes the automap floor height bug -- killough 1/18/98:
|
||||
// killough 4/7/98: optimize: save result in doorclosed for use in r_segs.c
|
||||
doorclosed = true;
|
||||
solid = true;
|
||||
}
|
||||
else if (frontsector->ceilingplane != backsector->ceilingplane ||
|
||||
frontsector->floorplane != backsector->floorplane)
|
||||
{
|
||||
// Window.
|
||||
solid = false;
|
||||
}
|
||||
else if (R_SkyboxCompare(frontsector, backsector))
|
||||
{
|
||||
solid = false;
|
||||
}
|
||||
else if (backsector->lightlevel != frontsector->lightlevel
|
||||
|| backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor)
|
||||
|| backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling)
|
||||
|| curline->sidedef->GetTexture(side_t::mid).isValid()
|
||||
|
||||
// killough 3/7/98: Take flats offsets into account:
|
||||
|| backsector->planes[sector_t::floor].xform != frontsector->planes[sector_t::floor].xform
|
||||
|| backsector->planes[sector_t::ceiling].xform != frontsector->planes[sector_t::ceiling].xform
|
||||
|
||||
|| backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor)
|
||||
|| backsector->GetPlaneLight(sector_t::ceiling) != frontsector->GetPlaneLight(sector_t::ceiling)
|
||||
|| backsector->GetVisFlags(sector_t::floor) != frontsector->GetVisFlags(sector_t::floor)
|
||||
|| backsector->GetVisFlags(sector_t::ceiling) != frontsector->GetVisFlags(sector_t::ceiling)
|
||||
|
||||
// [RH] Also consider colormaps
|
||||
|| backsector->ColorMap != frontsector->ColorMap
|
||||
|
||||
|
||||
|
||||
// kg3D - and fake lights
|
||||
|| (frontsector->e && frontsector->e->XFloor.lightlist.Size())
|
||||
|| (backsector->e && backsector->e->XFloor.lightlist.Size())
|
||||
)
|
||||
{
|
||||
solid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reject empty lines used for triggers and special events.
|
||||
// Identical floor and ceiling on both sides, identical light levels
|
||||
// on both sides, and no middle texture.
|
||||
|
||||
// When using GL nodes, do a clipping test for these lines so we can
|
||||
// mark their subsectors as visible for automap texturing.
|
||||
if (hasglnodes && !(InSubsector->flags & SSECF_DRAWN))
|
||||
{
|
||||
if (R_CheckClipWallSegment(WallC.sx1, WallC.sx2))
|
||||
{
|
||||
InSubsector->flags |= SSECF_DRAWN;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rw_prepped = false;
|
||||
|
||||
if (line->linedef->special == Line_Horizon)
|
||||
{
|
||||
// Be aware: Line_Horizon does not work properly with sloped planes
|
||||
fillshort (walltop+WallC.sx1, WallC.sx2 - WallC.sx1, centery);
|
||||
fillshort (wallbottom+WallC.sx1, WallC.sx2 - WallC.sx1, centery);
|
||||
}
|
||||
else
|
||||
{
|
||||
rw_ceilstat = R_CreateWallSegmentYSloped (walltop, frontsector->ceilingplane, &WallC, curline, MirrorFlags & RF_XFLIP);
|
||||
rw_floorstat = R_CreateWallSegmentYSloped (wallbottom, frontsector->floorplane, &WallC, curline, MirrorFlags & RF_XFLIP);
|
||||
|
||||
// [RH] treat off-screen walls as solid
|
||||
#if 0 // Maybe later...
|
||||
if (!solid)
|
||||
{
|
||||
if (rw_ceilstat == 12 && line->sidedef->GetTexture(side_t::top) != 0)
|
||||
{
|
||||
rw_mustmarkceiling = true;
|
||||
solid = true;
|
||||
}
|
||||
if (rw_floorstat == 3 && line->sidedef->GetTexture(side_t::bottom) != 0)
|
||||
{
|
||||
rw_mustmarkfloor = true;
|
||||
solid = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (R_ClipWallSegment(WallC.sx1, WallC.sx2, solid, R_StoreWallRange))
|
||||
{
|
||||
InSubsector->flags |= SSECF_DRAWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Checks BSP node/subtree bounding box.
|
||||
// Returns true if some part of the bbox might be visible.
|
||||
|
|
|
@ -32,6 +32,8 @@ EXTERN_CVAR (Bool, r_drawflat) // [RH] Don't texture segs?
|
|||
namespace swrenderer
|
||||
{
|
||||
|
||||
struct visplane_t;
|
||||
|
||||
// The 3072 below is just an arbitrary value picked to avoid
|
||||
// drawing lines the player is too close to that would overflow
|
||||
// the texture calculations.
|
||||
|
@ -44,11 +46,6 @@ enum
|
|||
FAKED_AboveCeiling
|
||||
};
|
||||
|
||||
extern subsector_t *InSubsector;
|
||||
|
||||
extern sector_t* frontsector;
|
||||
extern sector_t* backsector;
|
||||
|
||||
extern int WindowLeft, WindowRight;
|
||||
extern WORD MirrorFlags;
|
||||
|
||||
|
@ -57,6 +54,11 @@ void R_RenderBSPNode (void *node);
|
|||
// killough 4/13/98: fake floors/ceilings for deep water / fake ceilings:
|
||||
sector_t *R_FakeFlat(sector_t *, sector_t *, int *, int *, bool);
|
||||
|
||||
extern visplane_t *floorplane;
|
||||
extern visplane_t *ceilingplane;
|
||||
extern short floorclip[MAXWIDTH];
|
||||
extern short ceilingclip[MAXWIDTH];
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "r_utility.h"
|
||||
#include "r_things.h"
|
||||
#include "r_3dfloors.h"
|
||||
#include "r_segs.h"
|
||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||
#include "swrenderer/segments/r_clipsegment.h"
|
||||
#include "swrenderer/segments/r_drawsegment.h"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,52 +0,0 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
//
|
||||
// This source is available for distribution and/or modification
|
||||
// only under the terms of the DOOM Source Code License as
|
||||
// published by id Software. All rights reserved.
|
||||
//
|
||||
// The source is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||
// for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Refresh module, drawing LineSegs from BSP.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef __R_SEGS_H__
|
||||
#define __R_SEGS_H__
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
||||
struct drawseg_t;
|
||||
struct visplane_t;
|
||||
|
||||
bool R_StoreWallRange(int start, int stop);
|
||||
void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2);
|
||||
|
||||
|
||||
|
||||
void R_RenderSegLoop(int x1, int x2);
|
||||
|
||||
extern float rw_light; // [RH] Scale lights with viewsize adjustments
|
||||
extern float rw_lightstep;
|
||||
extern float rw_lightleft;
|
||||
extern fixed_t rw_offset;
|
||||
extern FTexture *rw_pic;
|
||||
|
||||
extern short floorclip[MAXWIDTH];
|
||||
extern short ceilingclip[MAXWIDTH];
|
||||
extern visplane_t *floorplane;
|
||||
extern visplane_t *ceilingplane;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -56,7 +56,6 @@
|
|||
#include "d_netinf.h"
|
||||
#include "p_effect.h"
|
||||
#include "r_bsp.h"
|
||||
#include "r_segs.h"
|
||||
#include "r_3dfloors.h"
|
||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||
#include "swrenderer/drawers/r_draw_pal.h"
|
||||
|
@ -108,8 +107,6 @@ struct FCoverageBuffer
|
|||
unsigned int NumLists;
|
||||
};
|
||||
|
||||
extern double globaluclip, globaldclip;
|
||||
|
||||
//
|
||||
// Sprite rotation 0 is facing the viewer,
|
||||
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "doomstat.h"
|
||||
#include "r_state.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_sky.h"
|
||||
#include "po_man.h"
|
||||
|
|
|
@ -6,21 +6,25 @@
|
|||
#include "i_system.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "p_setup.h"
|
||||
#include "swrenderer/r_main.h"
|
||||
#include "swrenderer/drawers/r_draw.h"
|
||||
#include "swrenderer/scene/r_things.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "g_level.h"
|
||||
#include "p_effect.h"
|
||||
#include "doomstat.h"
|
||||
#include "r_state.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_sky.h"
|
||||
#include "po_man.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "d_net.h"
|
||||
#include "swrenderer/r_main.h"
|
||||
#include "swrenderer/r_memory.h"
|
||||
#include "swrenderer/drawers/r_draw.h"
|
||||
#include "swrenderer/scene/r_things.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "swrenderer/line/r_wallsetup.h"
|
||||
#include "swrenderer/line/r_walldraw.h"
|
||||
#include "swrenderer/plane/r_fogboundary.h"
|
||||
#include "swrenderer/segments/r_drawsegment.h"
|
||||
|
||||
namespace swrenderer
|
||||
|
@ -73,4 +77,843 @@ namespace swrenderer
|
|||
|
||||
return ds_p++;
|
||||
}
|
||||
|
||||
// Clip a midtexture to the floor and ceiling of the sector in front of it.
|
||||
void ClipMidtex(int x1, int x2)
|
||||
{
|
||||
short most[MAXWIDTH];
|
||||
|
||||
R_CreateWallSegmentYSloped(most, curline->frontsector->ceilingplane, &WallC, curline, MirrorFlags & RF_XFLIP);
|
||||
for (int i = x1; i < x2; ++i)
|
||||
{
|
||||
if (wallupper[i] < most[i])
|
||||
wallupper[i] = most[i];
|
||||
}
|
||||
R_CreateWallSegmentYSloped(most, curline->frontsector->floorplane, &WallC, curline, MirrorFlags & RF_XFLIP);
|
||||
for (int i = x1; i < x2; ++i)
|
||||
{
|
||||
if (walllower[i] > most[i])
|
||||
walllower[i] = most[i];
|
||||
}
|
||||
}
|
||||
|
||||
void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2)
|
||||
{
|
||||
FTexture *tex;
|
||||
int i;
|
||||
sector_t tempsec; // killough 4/13/98
|
||||
double texheight, texheightscale;
|
||||
bool notrelevant = false;
|
||||
double rowoffset;
|
||||
bool wrap = false;
|
||||
|
||||
const sector_t *sec;
|
||||
|
||||
sprflipvert = false;
|
||||
|
||||
curline = ds->curline;
|
||||
|
||||
bool visible = R_SetPatchStyle(LegacyRenderStyles[curline->linedef->flags & ML_ADDTRANS ? STYLE_Add : STYLE_Translucent],
|
||||
(float)MIN(curline->linedef->alpha, 1.), 0, 0);
|
||||
|
||||
if (!visible && !ds->bFogBoundary && !ds->bFakeBoundary)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NetUpdate();
|
||||
|
||||
frontsector = curline->frontsector;
|
||||
backsector = curline->backsector;
|
||||
|
||||
tex = TexMan(curline->sidedef->GetTexture(side_t::mid), true);
|
||||
if (i_compatflags & COMPATF_MASKEDMIDTEX)
|
||||
{
|
||||
tex = tex->GetRawTexture();
|
||||
}
|
||||
|
||||
// killough 4/13/98: get correct lightlevel for 2s normal textures
|
||||
sec = R_FakeFlat(frontsector, &tempsec, nullptr, nullptr, false);
|
||||
|
||||
basecolormap = sec->ColorMap; // [RH] Set basecolormap
|
||||
|
||||
int wallshade = ds->shade;
|
||||
rw_lightstep = ds->lightstep;
|
||||
rw_light = ds->light + (x1 - ds->x1) * rw_lightstep;
|
||||
|
||||
if (fixedlightlev < 0)
|
||||
{
|
||||
if (!(fake3D & FAKE3D_CLIPTOP))
|
||||
{
|
||||
sclipTop = sec->ceilingplane.ZatPoint(ViewPos);
|
||||
}
|
||||
for (i = frontsector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
|
||||
{
|
||||
if (sclipTop <= frontsector->e->XFloor.lightlist[i].plane.Zat0())
|
||||
{
|
||||
lightlist_t *lit = &frontsector->e->XFloor.lightlist[i];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mfloorclip = openings + ds->sprbottomclip - ds->x1;
|
||||
mceilingclip = openings + ds->sprtopclip - ds->x1;
|
||||
|
||||
float *MaskedSWall, MaskedScaleY, rw_scalestep;
|
||||
|
||||
// [RH] Draw fog partition
|
||||
if (ds->bFogBoundary)
|
||||
{
|
||||
R_DrawFogBoundary(x1, x2, mceilingclip, mfloorclip, wallshade);
|
||||
if (ds->maskedtexturecol == -1)
|
||||
{
|
||||
goto clearfog;
|
||||
}
|
||||
}
|
||||
if ((ds->bFakeBoundary && !(ds->bFakeBoundary & 4)) || !visible)
|
||||
{
|
||||
goto clearfog;
|
||||
}
|
||||
|
||||
MaskedSWall = (float *)(openings + ds->swall) - ds->x1;
|
||||
MaskedScaleY = ds->yscale;
|
||||
fixed_t *maskedtexturecol = (fixed_t *)(openings + ds->maskedtexturecol) - ds->x1;
|
||||
spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
|
||||
rw_scalestep = ds->iscalestep;
|
||||
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != nullptr)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
|
||||
// find positioning
|
||||
texheight = tex->GetScaledHeightDouble();
|
||||
texheightscale = fabs(curline->sidedef->GetTextureYScale(side_t::mid));
|
||||
if (texheightscale != 1)
|
||||
{
|
||||
texheight = texheight / texheightscale;
|
||||
}
|
||||
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
dc_texturemid = MAX(frontsector->GetPlaneTexZ(sector_t::floor), backsector->GetPlaneTexZ(sector_t::floor)) + texheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc_texturemid = MIN(frontsector->GetPlaneTexZ(sector_t::ceiling), backsector->GetPlaneTexZ(sector_t::ceiling));
|
||||
}
|
||||
|
||||
rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid);
|
||||
|
||||
wrap = (curline->linedef->flags & ML_WRAP_MIDTEX) || (curline->sidedef->Flags & WALLF_WRAP_MIDTEX);
|
||||
if (!wrap)
|
||||
{ // Texture does not wrap vertically.
|
||||
double textop;
|
||||
|
||||
if (MaskedScaleY < 0)
|
||||
{
|
||||
MaskedScaleY = -MaskedScaleY;
|
||||
sprflipvert = true;
|
||||
}
|
||||
if (tex->bWorldPanning)
|
||||
{
|
||||
// rowoffset is added before the multiply so that the masked texture will
|
||||
// still be positioned in world units rather than texels.
|
||||
dc_texturemid += rowoffset - ViewPos.Z;
|
||||
textop = dc_texturemid;
|
||||
dc_texturemid *= MaskedScaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// rowoffset is added outside the multiply so that it positions the texture
|
||||
// by texels instead of world units.
|
||||
textop = dc_texturemid + rowoffset / MaskedScaleY - ViewPos.Z;
|
||||
dc_texturemid = (dc_texturemid - ViewPos.Z) * MaskedScaleY + rowoffset;
|
||||
}
|
||||
if (sprflipvert)
|
||||
{
|
||||
MaskedScaleY = -MaskedScaleY;
|
||||
dc_texturemid -= tex->GetHeight() << FRACBITS;
|
||||
}
|
||||
|
||||
// [RH] Don't bother drawing segs that are completely offscreen
|
||||
if (globaldclip * ds->sz1 < -textop && globaldclip * ds->sz2 < -textop)
|
||||
{ // Texture top is below the bottom of the screen
|
||||
goto clearfog;
|
||||
}
|
||||
|
||||
if (globaluclip * ds->sz1 > texheight - textop && globaluclip * ds->sz2 > texheight - textop)
|
||||
{ // Texture bottom is above the top of the screen
|
||||
goto clearfog;
|
||||
}
|
||||
|
||||
if ((fake3D & FAKE3D_CLIPBOTTOM) && textop < sclipBottom - ViewPos.Z)
|
||||
{
|
||||
notrelevant = true;
|
||||
goto clearfog;
|
||||
}
|
||||
if ((fake3D & FAKE3D_CLIPTOP) && textop - texheight > sclipTop - ViewPos.Z)
|
||||
{
|
||||
notrelevant = true;
|
||||
goto clearfog;
|
||||
}
|
||||
|
||||
WallC.sz1 = ds->sz1;
|
||||
WallC.sz2 = ds->sz2;
|
||||
WallC.sx1 = ds->sx1;
|
||||
WallC.sx2 = ds->sx2;
|
||||
|
||||
if (fake3D & FAKE3D_CLIPTOP)
|
||||
{
|
||||
R_CreateWallSegmentY(wallupper, textop < sclipTop - ViewPos.Z ? textop : sclipTop - ViewPos.Z, &WallC);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_CreateWallSegmentY(wallupper, textop, &WallC);
|
||||
}
|
||||
if (fake3D & FAKE3D_CLIPBOTTOM)
|
||||
{
|
||||
R_CreateWallSegmentY(walllower, textop - texheight > sclipBottom - ViewPos.Z ? textop - texheight : sclipBottom - ViewPos.Z, &WallC);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_CreateWallSegmentY(walllower, textop - texheight, &WallC);
|
||||
}
|
||||
|
||||
for (i = x1; i < x2; i++)
|
||||
{
|
||||
if (wallupper[i] < mceilingclip[i])
|
||||
wallupper[i] = mceilingclip[i];
|
||||
}
|
||||
for (i = x1; i < x2; i++)
|
||||
{
|
||||
if (walllower[i] > mfloorclip[i])
|
||||
walllower[i] = mfloorclip[i];
|
||||
}
|
||||
|
||||
if (CurrentSkybox)
|
||||
{ // Midtex clipping doesn't work properly with skyboxes, since you're normally below the floor
|
||||
// or above the ceiling, so the appropriate end won't be clipped automatically when adding
|
||||
// this drawseg.
|
||||
if ((curline->linedef->flags & ML_CLIP_MIDTEX) ||
|
||||
(curline->sidedef->Flags & WALLF_CLIP_MIDTEX))
|
||||
{
|
||||
ClipMidtex(x1, x2);
|
||||
}
|
||||
}
|
||||
|
||||
mfloorclip = walllower;
|
||||
mceilingclip = wallupper;
|
||||
|
||||
// draw the columns one at a time
|
||||
if (visible)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
for (dc_x = x1; dc_x < x2; ++dc_x)
|
||||
{
|
||||
if (fixedcolormap == nullptr && fixedlightlev < 0)
|
||||
{
|
||||
R_SetColorMapLight(basecolormap, rw_light, wallshade);
|
||||
}
|
||||
|
||||
dc_iscale = xs_Fix<16>::ToFix(MaskedSWall[dc_x] * MaskedScaleY);
|
||||
if (sprflipvert)
|
||||
sprtopscreen = CenterY + dc_texturemid * spryscale;
|
||||
else
|
||||
sprtopscreen = CenterY - dc_texturemid * spryscale;
|
||||
|
||||
R_DrawMaskedColumn(tex, maskedtexturecol[dc_x]);
|
||||
|
||||
rw_light += rw_lightstep;
|
||||
spryscale += rw_scalestep;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Texture does wrap vertically.
|
||||
if (tex->bWorldPanning)
|
||||
{
|
||||
// rowoffset is added before the multiply so that the masked texture will
|
||||
// still be positioned in world units rather than texels.
|
||||
dc_texturemid = (dc_texturemid - ViewPos.Z + rowoffset) * MaskedScaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// rowoffset is added outside the multiply so that it positions the texture
|
||||
// by texels instead of world units.
|
||||
dc_texturemid = (dc_texturemid - ViewPos.Z) * MaskedScaleY + rowoffset;
|
||||
}
|
||||
|
||||
WallC.sz1 = ds->sz1;
|
||||
WallC.sz2 = ds->sz2;
|
||||
WallC.sx1 = ds->sx1;
|
||||
WallC.sx2 = ds->sx2;
|
||||
|
||||
if (CurrentSkybox)
|
||||
{ // Midtex clipping doesn't work properly with skyboxes, since you're normally below the floor
|
||||
// or above the ceiling, so the appropriate end won't be clipped automatically when adding
|
||||
// this drawseg.
|
||||
if ((curline->linedef->flags & ML_CLIP_MIDTEX) ||
|
||||
(curline->sidedef->Flags & WALLF_CLIP_MIDTEX))
|
||||
{
|
||||
ClipMidtex(x1, x2);
|
||||
}
|
||||
}
|
||||
|
||||
if (fake3D & FAKE3D_CLIPTOP)
|
||||
{
|
||||
R_CreateWallSegmentY(wallupper, sclipTop - ViewPos.Z, &WallC);
|
||||
for (i = x1; i < x2; i++)
|
||||
{
|
||||
if (wallupper[i] < mceilingclip[i])
|
||||
wallupper[i] = mceilingclip[i];
|
||||
}
|
||||
mceilingclip = wallupper;
|
||||
}
|
||||
if (fake3D & FAKE3D_CLIPBOTTOM)
|
||||
{
|
||||
R_CreateWallSegmentY(walllower, sclipBottom - ViewPos.Z, &WallC);
|
||||
for (i = x1; i < x2; i++)
|
||||
{
|
||||
if (walllower[i] > mfloorclip[i])
|
||||
walllower[i] = mfloorclip[i];
|
||||
}
|
||||
mfloorclip = walllower;
|
||||
}
|
||||
|
||||
rw_offset = 0;
|
||||
rw_pic = tex;
|
||||
R_DrawDrawSeg(ds, x1, x2, mceilingclip, mfloorclip, MaskedSWall, maskedtexturecol, ds->yscale, wallshade);
|
||||
}
|
||||
|
||||
clearfog:
|
||||
R_FinishSetPatchStyle();
|
||||
if (ds->bFakeBoundary & 3)
|
||||
{
|
||||
R_RenderFakeWallRange(ds, x1, x2, wallshade);
|
||||
}
|
||||
if (!notrelevant)
|
||||
{
|
||||
if (fake3D & FAKE3D_REFRESHCLIP)
|
||||
{
|
||||
if (!wrap)
|
||||
{
|
||||
assert(ds->bkup >= 0);
|
||||
memcpy(openings + ds->sprtopclip, openings + ds->bkup, (ds->x2 - ds->x1) * 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fillshort(openings + ds->sprtopclip - ds->x1 + x1, x2 - x1, viewheight);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// kg3D - render one fake wall
|
||||
void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover, int wallshade)
|
||||
{
|
||||
int i;
|
||||
double xscale;
|
||||
double yscale;
|
||||
|
||||
fixed_t Alpha = Scale(rover->alpha, OPAQUE, 255);
|
||||
bool visible = R_SetPatchStyle(LegacyRenderStyles[rover->flags & FF_ADDITIVETRANS ? STYLE_Add : STYLE_Translucent],
|
||||
Alpha, 0, 0);
|
||||
|
||||
if (!visible) {
|
||||
R_FinishSetPatchStyle();
|
||||
return;
|
||||
}
|
||||
|
||||
rw_lightstep = ds->lightstep;
|
||||
rw_light = ds->light + (x1 - ds->x1) * rw_lightstep;
|
||||
|
||||
mfloorclip = openings + ds->sprbottomclip - ds->x1;
|
||||
mceilingclip = openings + ds->sprtopclip - ds->x1;
|
||||
|
||||
spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
|
||||
float *MaskedSWall = (float *)(openings + ds->swall) - ds->x1;
|
||||
|
||||
// find positioning
|
||||
side_t *scaledside;
|
||||
side_t::ETexpart scaledpart;
|
||||
if (rover->flags & FF_UPPERTEXTURE)
|
||||
{
|
||||
scaledside = curline->sidedef;
|
||||
scaledpart = side_t::top;
|
||||
}
|
||||
else if (rover->flags & FF_LOWERTEXTURE)
|
||||
{
|
||||
scaledside = curline->sidedef;
|
||||
scaledpart = side_t::bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
scaledside = rover->master->sidedef[0];
|
||||
scaledpart = side_t::mid;
|
||||
}
|
||||
xscale = rw_pic->Scale.X * scaledside->GetTextureXScale(scaledpart);
|
||||
yscale = rw_pic->Scale.Y * scaledside->GetTextureYScale(scaledpart);
|
||||
|
||||
double rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid);
|
||||
double planez = rover->model->GetPlaneTexZ(sector_t::ceiling);
|
||||
rw_offset = FLOAT2FIXED(curline->sidedef->GetTextureXOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureXOffset(side_t::mid));
|
||||
if (rowoffset < 0)
|
||||
{
|
||||
rowoffset += rw_pic->GetHeight();
|
||||
}
|
||||
dc_texturemid = (planez - ViewPos.Z) * yscale;
|
||||
if (rw_pic->bWorldPanning)
|
||||
{
|
||||
// rowoffset is added before the multiply so that the masked texture will
|
||||
// still be positioned in world units rather than texels.
|
||||
|
||||
dc_texturemid = dc_texturemid + rowoffset * yscale;
|
||||
rw_offset = xs_RoundToInt(rw_offset * xscale);
|
||||
}
|
||||
else
|
||||
{
|
||||
// rowoffset is added outside the multiply so that it positions the texture
|
||||
// by texels instead of world units.
|
||||
dc_texturemid += rowoffset;
|
||||
}
|
||||
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != nullptr)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
|
||||
WallC.sz1 = ds->sz1;
|
||||
WallC.sz2 = ds->sz2;
|
||||
WallC.sx1 = ds->sx1;
|
||||
WallC.sx2 = ds->sx2;
|
||||
WallC.tleft.X = ds->cx;
|
||||
WallC.tleft.Y = ds->cy;
|
||||
WallC.tright.X = ds->cx + ds->cdx;
|
||||
WallC.tright.Y = ds->cy + ds->cdy;
|
||||
WallT = ds->tmapvals;
|
||||
|
||||
R_CreateWallSegmentY(wallupper, sclipTop - ViewPos.Z, &WallC);
|
||||
R_CreateWallSegmentY(walllower, sclipBottom - ViewPos.Z, &WallC);
|
||||
|
||||
for (i = x1; i < x2; i++)
|
||||
{
|
||||
if (wallupper[i] < mceilingclip[i])
|
||||
wallupper[i] = mceilingclip[i];
|
||||
}
|
||||
for (i = x1; i < x2; i++)
|
||||
{
|
||||
if (walllower[i] > mfloorclip[i])
|
||||
walllower[i] = mfloorclip[i];
|
||||
}
|
||||
|
||||
PrepLWall(lwall, curline->sidedef->TexelLength*xscale, ds->sx1, ds->sx2);
|
||||
R_DrawDrawSeg(ds, x1, x2, wallupper, walllower, MaskedSWall, lwall, yscale, wallshade);
|
||||
R_FinishSetPatchStyle();
|
||||
}
|
||||
|
||||
// kg3D - walls of fake floors
|
||||
void R_RenderFakeWallRange(drawseg_t *ds, int x1, int x2, int wallshade)
|
||||
{
|
||||
FTexture *const DONT_DRAW = ((FTexture*)(intptr_t)-1);
|
||||
int i, j;
|
||||
F3DFloor *rover, *fover = nullptr;
|
||||
int passed, last;
|
||||
double floorHeight;
|
||||
double ceilingHeight;
|
||||
|
||||
sprflipvert = false;
|
||||
curline = ds->curline;
|
||||
|
||||
frontsector = curline->frontsector;
|
||||
backsector = curline->backsector;
|
||||
|
||||
if (backsector == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((ds->bFakeBoundary & 3) == 2)
|
||||
{
|
||||
sector_t *sec = backsector;
|
||||
backsector = frontsector;
|
||||
frontsector = sec;
|
||||
}
|
||||
|
||||
floorHeight = backsector->CenterFloor();
|
||||
ceilingHeight = backsector->CenterCeiling();
|
||||
|
||||
// maybe fix clipheights
|
||||
if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorHeight;
|
||||
if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingHeight;
|
||||
|
||||
// maybe not visible
|
||||
if (sclipBottom >= frontsector->CenterCeiling()) return;
|
||||
if (sclipTop <= frontsector->CenterFloor()) return;
|
||||
|
||||
if (fake3D & FAKE3D_DOWN2UP)
|
||||
{ // bottom to viewz
|
||||
last = 0;
|
||||
for (i = backsector->e->XFloor.ffloors.Size() - 1; i >= 0; i--)
|
||||
{
|
||||
rover = backsector->e->XFloor.ffloors[i];
|
||||
if (!(rover->flags & FF_EXISTS)) continue;
|
||||
|
||||
// visible?
|
||||
passed = 0;
|
||||
if (!(rover->flags & FF_RENDERSIDES) || rover->top.plane->isSlope() || rover->bottom.plane->isSlope() ||
|
||||
rover->top.plane->Zat0() <= sclipBottom ||
|
||||
rover->bottom.plane->Zat0() >= ceilingHeight ||
|
||||
rover->top.plane->Zat0() <= floorHeight)
|
||||
{
|
||||
if (!i)
|
||||
{
|
||||
passed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
rw_pic = nullptr;
|
||||
if (rover->bottom.plane->Zat0() >= sclipTop || passed)
|
||||
{
|
||||
if (last)
|
||||
{
|
||||
break;
|
||||
}
|
||||
// maybe wall from inside rendering?
|
||||
fover = nullptr;
|
||||
for (j = frontsector->e->XFloor.ffloors.Size() - 1; j >= 0; j--)
|
||||
{
|
||||
fover = frontsector->e->XFloor.ffloors[j];
|
||||
if (fover->model == rover->model)
|
||||
{ // never
|
||||
fover = nullptr;
|
||||
break;
|
||||
}
|
||||
if (!(fover->flags & FF_EXISTS)) continue;
|
||||
if (!(fover->flags & FF_RENDERSIDES)) continue;
|
||||
// no sloped walls, it's bugged
|
||||
if (fover->top.plane->isSlope() || fover->bottom.plane->isSlope()) continue;
|
||||
|
||||
// visible?
|
||||
if (fover->top.plane->Zat0() <= sclipBottom) continue; // no
|
||||
if (fover->bottom.plane->Zat0() >= sclipTop)
|
||||
{ // no, last possible
|
||||
fover = nullptr;
|
||||
break;
|
||||
}
|
||||
// it is, render inside?
|
||||
if (!(fover->flags & (FF_BOTHPLANES | FF_INVERTPLANES)))
|
||||
{ // no
|
||||
fover = nullptr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// nothing
|
||||
if (!fover || j == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
// correct texture
|
||||
if (fover->flags & rover->flags & FF_SWIMMABLE)
|
||||
{ // don't ever draw (but treat as something has been found)
|
||||
rw_pic = DONT_DRAW;
|
||||
}
|
||||
else if (fover->flags & FF_UPPERTEXTURE)
|
||||
{
|
||||
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::top), true);
|
||||
}
|
||||
else if (fover->flags & FF_LOWERTEXTURE)
|
||||
{
|
||||
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::bottom), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
rw_pic = TexMan(fover->master->sidedef[0]->GetTexture(side_t::mid), true);
|
||||
}
|
||||
}
|
||||
else if (frontsector->e->XFloor.ffloors.Size())
|
||||
{
|
||||
// maybe not visible?
|
||||
fover = nullptr;
|
||||
for (j = frontsector->e->XFloor.ffloors.Size() - 1; j >= 0; j--)
|
||||
{
|
||||
fover = frontsector->e->XFloor.ffloors[j];
|
||||
if (fover->model == rover->model) // never
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (!(fover->flags & FF_EXISTS)) continue;
|
||||
if (!(fover->flags & FF_RENDERSIDES)) continue;
|
||||
// no sloped walls, it's bugged
|
||||
if (fover->top.plane->isSlope() || fover->bottom.plane->isSlope()) continue;
|
||||
|
||||
// visible?
|
||||
if (fover->top.plane->Zat0() <= sclipBottom) continue; // no
|
||||
if (fover->bottom.plane->Zat0() >= sclipTop)
|
||||
{ // visible, last possible
|
||||
fover = nullptr;
|
||||
break;
|
||||
}
|
||||
if ((fover->flags & FF_SOLID) == (rover->flags & FF_SOLID) &&
|
||||
!(!(fover->flags & FF_SOLID) && (fover->alpha == 255 || rover->alpha == 255))
|
||||
)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (fover->flags & rover->flags & FF_SWIMMABLE)
|
||||
{ // don't ever draw (but treat as something has been found)
|
||||
rw_pic = DONT_DRAW;
|
||||
}
|
||||
fover = nullptr; // visible
|
||||
break;
|
||||
}
|
||||
if (fover && j != -1)
|
||||
{
|
||||
fover = nullptr;
|
||||
last = 1;
|
||||
continue; // not visible
|
||||
}
|
||||
}
|
||||
if (!rw_pic)
|
||||
{
|
||||
fover = nullptr;
|
||||
if (rover->flags & FF_UPPERTEXTURE)
|
||||
{
|
||||
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::top), true);
|
||||
}
|
||||
else if (rover->flags & FF_LOWERTEXTURE)
|
||||
{
|
||||
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::bottom), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
rw_pic = TexMan(rover->master->sidedef[0]->GetTexture(side_t::mid), true);
|
||||
}
|
||||
}
|
||||
// correct colors now
|
||||
basecolormap = frontsector->ColorMap;
|
||||
wallshade = ds->shade;
|
||||
if (fixedlightlev < 0)
|
||||
{
|
||||
if ((ds->bFakeBoundary & 3) == 2)
|
||||
{
|
||||
for (j = backsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
|
||||
{
|
||||
if (sclipTop <= backsector->e->XFloor.lightlist[j].plane.Zat0())
|
||||
{
|
||||
lightlist_t *lit = &backsector->e->XFloor.lightlist[j];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = frontsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
|
||||
{
|
||||
if (sclipTop <= frontsector->e->XFloor.lightlist[j].plane.Zat0())
|
||||
{
|
||||
lightlist_t *lit = &frontsector->e->XFloor.lightlist[j];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rw_pic != DONT_DRAW)
|
||||
{
|
||||
R_RenderFakeWall(ds, x1, x2, fover ? fover : rover, wallshade);
|
||||
}
|
||||
else rw_pic = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // top to viewz
|
||||
for (i = 0; i < (int)backsector->e->XFloor.ffloors.Size(); i++)
|
||||
{
|
||||
rover = backsector->e->XFloor.ffloors[i];
|
||||
if (!(rover->flags & FF_EXISTS)) continue;
|
||||
|
||||
// visible?
|
||||
passed = 0;
|
||||
if (!(rover->flags & FF_RENDERSIDES) ||
|
||||
rover->top.plane->isSlope() || rover->bottom.plane->isSlope() ||
|
||||
rover->bottom.plane->Zat0() >= sclipTop ||
|
||||
rover->top.plane->Zat0() <= floorHeight ||
|
||||
rover->bottom.plane->Zat0() >= ceilingHeight)
|
||||
{
|
||||
if ((unsigned)i == backsector->e->XFloor.ffloors.Size() - 1)
|
||||
{
|
||||
passed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
rw_pic = nullptr;
|
||||
if (rover->top.plane->Zat0() <= sclipBottom || passed)
|
||||
{ // maybe wall from inside rendering?
|
||||
fover = nullptr;
|
||||
for (j = 0; j < (int)frontsector->e->XFloor.ffloors.Size(); j++)
|
||||
{
|
||||
fover = frontsector->e->XFloor.ffloors[j];
|
||||
if (fover->model == rover->model)
|
||||
{ // never
|
||||
fover = nullptr;
|
||||
break;
|
||||
}
|
||||
if (!(fover->flags & FF_EXISTS)) continue;
|
||||
if (!(fover->flags & FF_RENDERSIDES)) continue;
|
||||
// no sloped walls, it's bugged
|
||||
if (fover->top.plane->isSlope() || fover->bottom.plane->isSlope()) continue;
|
||||
|
||||
// visible?
|
||||
if (fover->bottom.plane->Zat0() >= sclipTop) continue; // no
|
||||
if (fover->top.plane->Zat0() <= sclipBottom)
|
||||
{ // no, last possible
|
||||
fover = nullptr;
|
||||
break;
|
||||
}
|
||||
// it is, render inside?
|
||||
if (!(fover->flags & (FF_BOTHPLANES | FF_INVERTPLANES)))
|
||||
{ // no
|
||||
fover = nullptr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// nothing
|
||||
if (!fover || (unsigned)j == frontsector->e->XFloor.ffloors.Size())
|
||||
{
|
||||
break;
|
||||
}
|
||||
// correct texture
|
||||
if (fover->flags & rover->flags & FF_SWIMMABLE)
|
||||
{
|
||||
rw_pic = DONT_DRAW; // don't ever draw (but treat as something has been found)
|
||||
}
|
||||
else if (fover->flags & FF_UPPERTEXTURE)
|
||||
{
|
||||
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::top), true);
|
||||
}
|
||||
else if (fover->flags & FF_LOWERTEXTURE)
|
||||
{
|
||||
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::bottom), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
rw_pic = TexMan(fover->master->sidedef[0]->GetTexture(side_t::mid), true);
|
||||
}
|
||||
}
|
||||
else if (frontsector->e->XFloor.ffloors.Size())
|
||||
{ // maybe not visible?
|
||||
fover = nullptr;
|
||||
for (j = 0; j < (int)frontsector->e->XFloor.ffloors.Size(); j++)
|
||||
{
|
||||
fover = frontsector->e->XFloor.ffloors[j];
|
||||
if (fover->model == rover->model)
|
||||
{ // never
|
||||
break;
|
||||
}
|
||||
if (!(fover->flags & FF_EXISTS)) continue;
|
||||
if (!(fover->flags & FF_RENDERSIDES)) continue;
|
||||
// no sloped walls, its bugged
|
||||
if (fover->top.plane->isSlope() || fover->bottom.plane->isSlope()) continue;
|
||||
|
||||
// visible?
|
||||
if (fover->bottom.plane->Zat0() >= sclipTop) continue; // no
|
||||
if (fover->top.plane->Zat0() <= sclipBottom)
|
||||
{ // visible, last possible
|
||||
fover = nullptr;
|
||||
break;
|
||||
}
|
||||
if ((fover->flags & FF_SOLID) == (rover->flags & FF_SOLID) &&
|
||||
!(!(rover->flags & FF_SOLID) && (fover->alpha == 255 || rover->alpha == 255))
|
||||
)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (fover->flags & rover->flags & FF_SWIMMABLE)
|
||||
{ // don't ever draw (but treat as something has been found)
|
||||
rw_pic = DONT_DRAW;
|
||||
}
|
||||
fover = nullptr; // visible
|
||||
break;
|
||||
}
|
||||
if (fover && (unsigned)j != frontsector->e->XFloor.ffloors.Size())
|
||||
{ // not visible
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rw_pic == nullptr)
|
||||
{
|
||||
fover = nullptr;
|
||||
if (rover->flags & FF_UPPERTEXTURE)
|
||||
{
|
||||
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::top), true);
|
||||
}
|
||||
else if (rover->flags & FF_LOWERTEXTURE)
|
||||
{
|
||||
rw_pic = TexMan(curline->sidedef->GetTexture(side_t::bottom), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
rw_pic = TexMan(rover->master->sidedef[0]->GetTexture(side_t::mid), true);
|
||||
}
|
||||
}
|
||||
// correct colors now
|
||||
basecolormap = frontsector->ColorMap;
|
||||
wallshade = ds->shade;
|
||||
if (fixedlightlev < 0)
|
||||
{
|
||||
if ((ds->bFakeBoundary & 3) == 2)
|
||||
{
|
||||
for (j = backsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
|
||||
{
|
||||
if (sclipTop <= backsector->e->XFloor.lightlist[j].plane.Zat0())
|
||||
{
|
||||
lightlist_t *lit = &backsector->e->XFloor.lightlist[j];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = frontsector->e->XFloor.lightlist.Size() - 1; j >= 0; j--)
|
||||
{
|
||||
if (sclipTop <= frontsector->e->XFloor.lightlist[j].plane.Zat0())
|
||||
{
|
||||
lightlist_t *lit = &frontsector->e->XFloor.lightlist[j];
|
||||
basecolormap = lit->extra_colormap;
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != nullptr) + r_actualextralight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rw_pic != DONT_DRAW)
|
||||
{
|
||||
R_RenderFakeWall(ds, x1, x2, fover ? fover : rover, wallshade);
|
||||
}
|
||||
else
|
||||
{
|
||||
rw_pic = nullptr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,4 +45,8 @@ namespace swrenderer
|
|||
void R_FreeDrawSegs();
|
||||
|
||||
drawseg_t *R_AddDrawSegment();
|
||||
void ClipMidtex(int x1, int x2);
|
||||
void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2);
|
||||
void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover, int wallshade);
|
||||
void R_RenderFakeWallRange(drawseg_t *ds, int x1, int x2, int wallshade);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "doomstat.h"
|
||||
#include "r_state.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_sky.h"
|
||||
#include "po_man.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "swrenderer/segments/r_drawsegment.h"
|
||||
#include "swrenderer/scene/r_portal.h"
|
||||
#include "r_wallsprite.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "swrenderer/r_memory.h"
|
||||
|
||||
namespace swrenderer
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "d_netinf.h"
|
||||
#include "p_effect.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||
#include "swrenderer/drawers/r_draw_pal.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "d_netinf.h"
|
||||
#include "p_effect.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||
#include "swrenderer/drawers/r_draw_pal.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "d_netinf.h"
|
||||
#include "p_effect.h"
|
||||
#include "swrenderer/scene/r_bsp.h"
|
||||
#include "swrenderer/scene/r_segs.h"
|
||||
#include "swrenderer/scene/r_3dfloors.h"
|
||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||
#include "swrenderer/drawers/r_draw_pal.h"
|
||||
|
|
Loading…
Reference in a new issue