From 9df4b20b08ec247e4bb0d2419eb1ec37f4655068 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Fri, 6 Mar 2026 02:44:18 -0500 Subject: [PATCH] Revert "Add new floor stuff to hw_plane.c" This reverts commit cbb873844639ec98c2eab70c15be9d3e0989ccb3. --- src/hardware/hw_glob.h | 29 +++++++++-- src/hardware/hw_main.c | 106 ++++++++++++++++++++++++++++++++++++++-- src/hardware/hw_main.h | 58 ---------------------- src/hardware/hw_plane.c | 60 ----------------------- 4 files changed, 127 insertions(+), 126 deletions(-) diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 62cf48b1b..01c1dc8db 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -31,6 +31,31 @@ extern "C" { // SRB2Kart +// ----------- +// structures +// ----------- + +// a vertex of a Doom 'plane' polygon +typedef struct +{ + float x; + float y; + float z; +} polyvertex_t; + +// a convex 'plane' polygon, clockwise order +typedef struct +{ + INT32 numpts; + polyvertex_t pts[]; +} poly_t; + +// holds extra info for 3D render, for each subsector in subsectors[] +typedef struct +{ + poly_t *planepoly; // the generated convex polygon +} extrasubsector_t; + // needed for sprite rendering // equivalent of the software renderer's vissprites typedef struct gl_vissprite_s @@ -150,10 +175,6 @@ void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isc void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, levelflat_t *levelflat, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap); - -void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap); -void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, - INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap); // -------- // hw_segs.c // -------- diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4111a5ca0..ad86ae9b7 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -57,6 +57,14 @@ // the hardware driver object // ========================================================================== +// ========================================================================== +// PROTOS +// ========================================================================== + +void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap); +void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, + INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap); + #define ABS(x) ((x) < 0 ? -(x) : (x)) // ========================================================================== @@ -1217,11 +1225,40 @@ static void HWR_RenderBSPNode(INT32 bspnum) wallinfo_t *wallinfo = NULL; size_t numwalls = 0; // a list of transparent walls to be drawn -size_t numplanes = 0; // a list of transparent floors to be drawn -planeinfo_t *planeinfo = NULL; +typedef struct +{ + extrasubsector_t *xsub; + boolean isceiling; + fixed_t fixedheight; + INT32 lightlevel; + levelflat_t *levelflat; + INT32 alpha; + sector_t *FOFSector; + FBITFIELD blend; + boolean fogplane; + extracolormap_t *planecolormap; + INT32 drawcount; +} planeinfo_t; -size_t numpolyplanes = 0; // a list of transparent poyobject floors to be drawn -polyplaneinfo_t *polyplaneinfo = NULL; +static size_t numplanes = 0; // a list of transparent floors to be drawn +static planeinfo_t *planeinfo = NULL; + +typedef struct +{ + polyobj_t *polysector; + boolean isceiling; + fixed_t fixedheight; + INT32 lightlevel; + levelflat_t *levelflat; + INT32 alpha; + sector_t *FOFSector; + FBITFIELD blend; + extracolormap_t *planecolormap; + INT32 drawcount; +} polyplaneinfo_t; + +static size_t numpolyplanes = 0; // a list of transparent poyobject floors to be drawn +static polyplaneinfo_t *polyplaneinfo = NULL; //Hurdler: 3D water sutffs typedef struct gl_drawnode_s @@ -1237,6 +1274,67 @@ typedef struct gl_drawnode_s INT32 drawcount = 0; +#define MAX_TRANSPARENTFLOOR 512 + +// This will likely turn into a copy of HWR_Add3DWater and replace it. +void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap) +{ + static size_t allocedplanes = 0; + + // Force realloc if buffer has been freed + if (!planeinfo) + allocedplanes = 0; + + if (allocedplanes < numplanes + 1) + { + allocedplanes += MAX_TRANSPARENTFLOOR; + Z_Realloc(planeinfo, allocedplanes * sizeof (*planeinfo), PU_LEVEL, &planeinfo); + } + + planeinfo[numplanes].isceiling = isceiling; + planeinfo[numplanes].fixedheight = fixedheight; + planeinfo[numplanes].lightlevel = ((planecolormap && (planecolormap->flags & CMF_FOG)) || mapnamespace == MNS_SRB2KART) ? lightlevel : 255; + planeinfo[numplanes].levelflat = levelflat; + planeinfo[numplanes].xsub = xsub; + planeinfo[numplanes].alpha = alpha; + planeinfo[numplanes].FOFSector = FOFSector; + planeinfo[numplanes].blend = blend; + planeinfo[numplanes].fogplane = fogplane; + planeinfo[numplanes].planecolormap = planecolormap; + planeinfo[numplanes].drawcount = drawcount++; + + numplanes++; +} + +// Adding this for now until I can create extrasubsector info for polyobjects +// When that happens it'll just be done through HWR_AddTransparentFloor and HWR_RenderPlane +void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap) +{ + static size_t allocedpolyplanes = 0; + + // Force realloc if buffer has been freed + if (!polyplaneinfo) + allocedpolyplanes = 0; + + if (allocedpolyplanes < numpolyplanes + 1) + { + allocedpolyplanes += MAX_TRANSPARENTFLOOR; + Z_Realloc(polyplaneinfo, allocedpolyplanes * sizeof (*polyplaneinfo), PU_LEVEL, &polyplaneinfo); + } + + polyplaneinfo[numpolyplanes].isceiling = isceiling; + polyplaneinfo[numpolyplanes].fixedheight = fixedheight; + polyplaneinfo[numpolyplanes].lightlevel = ((planecolormap && (planecolormap->flags & CMF_FOG)) || mapnamespace == MNS_SRB2KART) ? lightlevel : 255; + polyplaneinfo[numpolyplanes].levelflat = levelflat; + polyplaneinfo[numpolyplanes].polysector = polysector; + polyplaneinfo[numpolyplanes].alpha = alpha; + polyplaneinfo[numpolyplanes].FOFSector = FOFSector; + polyplaneinfo[numpolyplanes].blend = blend; + polyplaneinfo[numpolyplanes].planecolormap = planecolormap; + polyplaneinfo[numpolyplanes].drawcount = drawcount++; + numpolyplanes++; +} + // putting sortindex and sortnode here so the comparator function can see them gl_drawnode_t *sortnode; size_t *sortindex; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index f75e435f6..87178ede7 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -165,64 +165,6 @@ extern size_t numwalls; // a list of transparent walls to be drawn #define MAX_TRANSPARENTWALL 256 -// a vertex of a Doom 'plane' polygon -typedef struct -{ - float x; - float y; - float z; -} polyvertex_t; - -// a convex 'plane' polygon, clockwise order -typedef struct -{ - INT32 numpts; - polyvertex_t pts[]; -} poly_t; - -// holds extra info for 3D render, for each subsector in subsectors[] -typedef struct -{ - poly_t *planepoly; // the generated convex polygon -} extrasubsector_t; - -typedef struct -{ - extrasubsector_t *xsub; - boolean isceiling; - fixed_t fixedheight; - INT32 lightlevel; - levelflat_t *levelflat; - INT32 alpha; - sector_t *FOFSector; - FBITFIELD blend; - boolean fogplane; - extracolormap_t *planecolormap; - INT32 drawcount; -} planeinfo_t; - -extern size_t numplanes; // a list of transparent floors to be drawn -extern planeinfo_t *planeinfo; - -#define MAX_TRANSPARENTFLOOR 512 - -typedef struct -{ - polyobj_t *polysector; - boolean isceiling; - fixed_t fixedheight; - INT32 lightlevel; - levelflat_t *levelflat; - INT32 alpha; - sector_t *FOFSector; - FBITFIELD blend; - extracolormap_t *planecolormap; - INT32 drawcount; -} polyplaneinfo_t; - -extern size_t numpolyplanes; // a list of transparent poyobject floors to be drawn -extern polyplaneinfo_t *polyplaneinfo; - // Render stats extern precise_t ps_hw_skyboxtime; extern precise_t ps_hw_nodesorttime; diff --git a/src/hardware/hw_plane.c b/src/hardware/hw_plane.c index 4236b28c4..a65f4d5a1 100644 --- a/src/hardware/hw_plane.c +++ b/src/hardware/hw_plane.c @@ -423,64 +423,4 @@ void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t HWR_ProcessPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode, shader, false); } - -// This will likely turn into a copy of HWR_Add3DWater and replace it. -void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap) -{ - static size_t allocedplanes = 0; - - // Force realloc if buffer has been freed - if (!planeinfo) - allocedplanes = 0; - - if (allocedplanes < numplanes + 1) - { - allocedplanes += MAX_TRANSPARENTFLOOR; - Z_Realloc(planeinfo, allocedplanes * sizeof (*planeinfo), PU_LEVEL, &planeinfo); - } - - planeinfo[numplanes].isceiling = isceiling; - planeinfo[numplanes].fixedheight = fixedheight; - planeinfo[numplanes].lightlevel = ((planecolormap && (planecolormap->flags & CMF_FOG)) || mapnamespace == MNS_SRB2KART) ? lightlevel : 255; - planeinfo[numplanes].levelflat = levelflat; - planeinfo[numplanes].xsub = xsub; - planeinfo[numplanes].alpha = alpha; - planeinfo[numplanes].FOFSector = FOFSector; - planeinfo[numplanes].blend = blend; - planeinfo[numplanes].fogplane = fogplane; - planeinfo[numplanes].planecolormap = planecolormap; - planeinfo[numplanes].drawcount = drawcount++; - - numplanes++; -} - -// Adding this for now until I can create extrasubsector info for polyobjects -// When that happens it'll just be done through HWR_AddTransparentFloor and HWR_RenderPlane -void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap) -{ - static size_t allocedpolyplanes = 0; - - // Force realloc if buffer has been freed - if (!polyplaneinfo) - allocedpolyplanes = 0; - - if (allocedpolyplanes < numpolyplanes + 1) - { - allocedpolyplanes += MAX_TRANSPARENTFLOOR; - Z_Realloc(polyplaneinfo, allocedpolyplanes * sizeof (*polyplaneinfo), PU_LEVEL, &polyplaneinfo); - } - - polyplaneinfo[numpolyplanes].isceiling = isceiling; - polyplaneinfo[numpolyplanes].fixedheight = fixedheight; - polyplaneinfo[numpolyplanes].lightlevel = ((planecolormap && (planecolormap->flags & CMF_FOG)) || mapnamespace == MNS_SRB2KART) ? lightlevel : 255; - polyplaneinfo[numpolyplanes].levelflat = levelflat; - polyplaneinfo[numpolyplanes].polysector = polysector; - polyplaneinfo[numpolyplanes].alpha = alpha; - polyplaneinfo[numpolyplanes].FOFSector = FOFSector; - polyplaneinfo[numpolyplanes].blend = blend; - polyplaneinfo[numpolyplanes].planecolormap = planecolormap; - polyplaneinfo[numpolyplanes].drawcount = drawcount++; - numpolyplanes++; -} - #endif