clean up portals
This commit is contained in:
1 parent
c3dd1755dc
commit
bf44c95d00
10 files changed
+64
-33
No files matched your search
@@ -48,6 +48,7 @@
|
||||
#include "../m_cheat.h"
|
||||
#include "../m_argv.h" // parm functions for msaa
|
||||
#include "../p_slopes.h"
|
||||
#include "../r_portal.h"
|
||||
|
||||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
||||
|
||||
|
||||
+2
-1
@@ -25,7 +25,8 @@ extern side_t *sidedef;
|
||||
extern line_t *linedef;
|
||||
extern sector_t *frontsector;
|
||||
extern sector_t *backsector;
|
||||
extern portal_pair *g_portal; // is curline a portal seg?
|
||||
typedef struct portal_s portal_t;
|
||||
extern portal_t *g_portal; // is curline a portal seg?
|
||||
|
||||
// drawsegs are allocated on the fly... see r_segs.c
|
||||
|
||||
|
||||
+11
-8
@@ -1481,8 +1481,8 @@ static void R_PortalFrame(portal_t *portal)
|
||||
viewz = portal->viewz;
|
||||
|
||||
viewangle = portal->viewangle;
|
||||
// newview->sin = FINESINE(newview->angle>>ANGLETOFINESHIFT);
|
||||
// newview->cos = FINECOSINE(newview->angle>>ANGLETOFINESHIFT);
|
||||
// viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
// viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
portalclipstart = portal->start;
|
||||
portalclipend = portal->end;
|
||||
@@ -1490,12 +1490,14 @@ static void R_PortalFrame(portal_t *portal)
|
||||
if (portal->clipline != -1)
|
||||
{
|
||||
portalclipline = &lines[portal->clipline];
|
||||
viewsector = portalcullsector = portalclipline->frontsector;
|
||||
portalcullsector = portalclipline->frontsector;
|
||||
viewsector = portalclipline->frontsector;
|
||||
}
|
||||
else
|
||||
{
|
||||
portalclipline = NULL;
|
||||
viewsector = portalcullsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
portalcullsector = NULL;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1511,7 +1513,6 @@ static void R_PortalFrame(portal_t *portal)
|
||||
|
||||
void R_RenderPlayerView(player_t *player)
|
||||
{
|
||||
portal_t *portal;
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
UINT8 i;
|
||||
|
||||
@@ -1617,10 +1618,14 @@ void R_RenderPlayerView(player_t *player)
|
||||
// Portal rendering. Hijacks the BSP traversal.
|
||||
if (portal_base)
|
||||
{
|
||||
for(portal = portal_base; portal; portal = portal_base)
|
||||
portal_t *portal;
|
||||
|
||||
for (portal = portal_base; portal; portal = portal_base)
|
||||
{
|
||||
portalrender = portal->pass; // Recursiveness depth.
|
||||
|
||||
R_ClearFFloorClips();
|
||||
|
||||
// Apply the viewpoint stored for the portal.
|
||||
R_PortalFrame(portal);
|
||||
|
||||
@@ -1642,8 +1647,6 @@ void R_RenderPlayerView(player_t *player)
|
||||
|
||||
validcount++;
|
||||
}
|
||||
|
||||
portalcullsector = NULL; // Just in case...
|
||||
}
|
||||
PS_STOP_TIMING(ps_sw_portaltime);
|
||||
|
||||
|
||||
+18
-6
@@ -28,6 +28,7 @@
|
||||
#include "z_zone.h"
|
||||
#include "p_tick.h"
|
||||
#include "r_fps.h"
|
||||
#include "r_portal.h"
|
||||
|
||||
//
|
||||
// opening
|
||||
@@ -39,12 +40,6 @@
|
||||
// good night sweet prince
|
||||
//#define SHITPLANESPARENCY
|
||||
|
||||
//SoM: 3/23/2000: Use Boom visplane hashing.
|
||||
#define VISPLANEHASHBITS 9
|
||||
#define VISPLANEHASHMASK ((1<<VISPLANEHASHBITS)-1)
|
||||
// the last visplane list is outside of the hash table and is used for fof planes
|
||||
#define MAXVISPLANES ((1<<VISPLANEHASHBITS)+1)
|
||||
|
||||
static visplane_t *visplanes[MAXVISPLANES];
|
||||
static visplane_t *freetail;
|
||||
static visplane_t **freehead = &freetail;
|
||||
@@ -263,6 +258,23 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||
spanfunc();
|
||||
}
|
||||
|
||||
void R_ClearFFloorClips (void)
|
||||
{
|
||||
INT32 i, p;
|
||||
|
||||
// opening / clipping determination
|
||||
for (i = 0; i < viewwidth; i++)
|
||||
{
|
||||
for (p = 0; p < MAXFFLOORS; p++)
|
||||
{
|
||||
ffloor[p].f_clip[i] = (INT16)viewheight;
|
||||
ffloor[p].c_clip[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
numffloors = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// R_ClearPlanes
|
||||
// At begining of frame.
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "r_data.h"
|
||||
#include "p_polyobj.h"
|
||||
|
||||
//SoM: 3/23/2000: Use Boom visplane hashing.
|
||||
#define VISPLANEHASHBITS 9
|
||||
#define VISPLANEHASHMASK ((1<<VISPLANEHASHBITS)-1)
|
||||
// the last visplane list is outside of the hash table and is used for fof planes
|
||||
@@ -76,6 +77,7 @@ extern lighttable_t **planezlight;
|
||||
|
||||
void R_InitPlanes(void);
|
||||
void R_ClearPlanes(void);
|
||||
void R_ClearFFloorClips (void);
|
||||
|
||||
void R_MapPlane(INT32 y, INT32 x1, INT32 x2);
|
||||
void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2);
|
||||
|
||||
+19
-13
@@ -1,8 +1,9 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 2024 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1996 by id Software, Inc.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -15,17 +16,19 @@
|
||||
#include "r_plane.h"
|
||||
#include "r_main.h" // viewheight, viewwidth
|
||||
#include "z_zone.h"
|
||||
#include "r_things.h"
|
||||
#include "r_sky.h"
|
||||
|
||||
UINT8 portalrender; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */
|
||||
sector_t *portalcullsector;
|
||||
|
||||
// Linked list for portals.
|
||||
portal_t *portal_base, *portal_cap;
|
||||
|
||||
line_t *portalclipline;
|
||||
sector_t *portalcullsector;
|
||||
INT32 portalclipstart, portalclipend;
|
||||
|
||||
boolean portalline; // is curline a portal seg?
|
||||
portal_t *g_portal; // is curline a portal seg?
|
||||
|
||||
void Portal_InitList (void)
|
||||
{
|
||||
@@ -33,13 +36,14 @@ void Portal_InitList (void)
|
||||
portal_base = portal_cap = NULL;
|
||||
}
|
||||
|
||||
|
||||
/** Store the clipping window for a portal in its given range.
|
||||
*
|
||||
* The window is copied from the current window at the time
|
||||
* the function is called, so it is useful for converting one-sided
|
||||
* lines into portals.
|
||||
*/
|
||||
void Portal_ClipStoreFromRange (portal_t* portal)
|
||||
static void Portal_ClipRange (portal_t* portal)
|
||||
{
|
||||
INT32 start = portal->start;
|
||||
INT32 end = portal->end;
|
||||
@@ -59,6 +63,7 @@ void Portal_ClipStoreFromRange (portal_t* portal)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Apply the clipping window from a portal.
|
||||
*/
|
||||
void Portal_ClipApply (const portal_t* portal)
|
||||
@@ -93,12 +98,12 @@ void Portal_ClipApply (const portal_t* portal)
|
||||
}
|
||||
}
|
||||
|
||||
portal_t* Portal_Add (const INT16 x1, const INT16 x2)
|
||||
static portal_t* Portal_Add (const INT16 x1, const INT16 x2)
|
||||
{
|
||||
portal_t *portal = Z_Malloc(sizeof(portal_t), PU_LEVEL, NULL);
|
||||
INT16 *ceilingclipsave = Z_Malloc(sizeof(INT16)*(x2-x1), PU_LEVEL, NULL);
|
||||
INT16 *floorclipsave = Z_Malloc(sizeof(INT16)*(x2-x1), PU_LEVEL, NULL);
|
||||
fixed_t *frontscalesave = Z_Malloc(sizeof(fixed_t)*(x2-x1), PU_LEVEL, NULL);
|
||||
INT16 *ceilingclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL);
|
||||
INT16 *floorclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL);
|
||||
fixed_t *frontscalesave = Z_Malloc(sizeof(fixed_t)*(x2-x1 + 1), PU_LEVEL, NULL);
|
||||
|
||||
// Linked list.
|
||||
if (!portal_base)
|
||||
@@ -128,6 +133,7 @@ portal_t* Portal_Add (const INT16 x1, const INT16 x2)
|
||||
|
||||
void Portal_Remove (portal_t* portal)
|
||||
{
|
||||
portalcullsector = NULL;
|
||||
portal_base = portal->next;
|
||||
Z_Free(portal->ceilingclip);
|
||||
Z_Free(portal->floorclip);
|
||||
@@ -179,9 +185,9 @@ void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, con
|
||||
|
||||
portal->clipline = line2;
|
||||
|
||||
Portal_ClipStoreFromRange(portal);
|
||||
Portal_ClipRange(portal);
|
||||
|
||||
portalline = true; // this tells R_StoreWallRange that curline is a portal seg
|
||||
g_portal = portal; // this tells R_StoreWallRange that curline is a portal seg
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -11,6 +11,9 @@
|
||||
/// \file r_portal.h
|
||||
/// \brief Software renderer portal struct, functions, linked list extern.
|
||||
|
||||
#ifndef __R_PORTAL__
|
||||
#define __R_PORTAL__
|
||||
|
||||
#include "r_data.h"
|
||||
|
||||
|
||||
@@ -41,9 +44,14 @@ extern portal_t* portal_base;
|
||||
extern portal_t* portal_cap;
|
||||
extern UINT8 portalrender;
|
||||
|
||||
extern line_t *portalclipline;
|
||||
extern sector_t *portalcullsector;
|
||||
extern INT32 portalclipstart, portalclipend;
|
||||
|
||||
void Portal_InitList (void);
|
||||
void Portal_Remove (portal_t* portal);
|
||||
void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, const INT32 x2);
|
||||
|
||||
void Portal_ClipStoreFromRange (portal_t* portal);
|
||||
void Portal_ClipApply (const portal_t* portal);
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "r_local.h"
|
||||
#include "r_sky.h"
|
||||
|
||||
#include "r_portal.h"
|
||||
#include "r_splats.h"
|
||||
|
||||
#include "w_wad.h"
|
||||
|
||||
@@ -94,10 +94,6 @@ extern boolean viewsky, skyVisible;
|
||||
extern boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible of each splitscreen player
|
||||
extern sector_t *viewsector;
|
||||
extern player_t *viewplayer;
|
||||
extern UINT8 portalrender;
|
||||
extern sector_t *portalcullsector;
|
||||
extern line_t *portalclipline;
|
||||
extern INT32 portalclipstart, portalclipend;
|
||||
|
||||
extern consvar_t cv_allowmlook;
|
||||
extern consvar_t cv_maxportals;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "dehacked.h" // get_number (for thok)
|
||||
#include "d_netfil.h" // blargh. for nameonly().
|
||||
#include "m_cheat.h" // objectplace
|
||||
#include "r_portal.h"
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "p_local.h" // stplyr
|
||||
#ifdef HWRENDER
|
||||
|
||||
Reference in new issue
Block a user