diff --git a/src/r_3dfloors.cpp b/src/r_3dfloors.cpp index b3e0ed062..fbdc34edc 100644 --- a/src/r_3dfloors.cpp +++ b/src/r_3dfloors.cpp @@ -12,7 +12,7 @@ #include "r_local.h" #include "r_bsp.h" #include "r_plane.h" - +#include "c_cvars.h" #include "r_3dfloors.h" // external variables @@ -28,6 +28,8 @@ HeightLevel *height_cur = NULL; int CurrentMirror = 0; int CurrentSkybox = 0; +CVAR(Int, r_3dfloors, true, 0); + // private variables int height_max = -1; TArray toplist; diff --git a/src/r_3dfloors.h b/src/r_3dfloors.h index d7cf87eeb..f04325349 100644 --- a/src/r_3dfloors.h +++ b/src/r_3dfloors.h @@ -37,13 +37,13 @@ enum FAKE3D_FAKECEILING = 2, // fake ceiling, mark seg as FAKE FAKE3D_FAKEBACK = 4, // R_AddLine with fake backsector, mark seg as FAKE FAKE3D_FAKEMASK = 7, + FAKE3D_CLIPBOTFRONT = 8, // use front sector clipping info (bottom) + FAKE3D_CLIPTOPFRONT = 16, // use front sector clipping info (top) // sorting stage: FAKE3D_CLIPBOTTOM = 1, // clip bottom FAKE3D_CLIPTOP = 2, // clip top FAKE3D_REFRESHCLIP = 4, // refresh clip info - FAKE3D_DOWN2UP = 8, // rendering from down to up (floors) - FAKE3D_16 = 16, // what is this? }; extern int fake3D; @@ -57,6 +57,7 @@ extern HeightLevel *height_top; extern HeightLevel *height_cur; extern int CurrentMirror; extern int CurrentSkybox; +EXTERN_CVAR(Int, r_3dfloors); // functions void R_3D_DeleteHeights(); diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index a69b0170b..49c48804e 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -1238,7 +1238,7 @@ void R_Subsector (subsector_t *sub) ) : NULL; // kg3D - fake planes rendering - if (frontsector->e && frontsector->e->XFloor.ffloors.Size()) + if (r_3dfloors && frontsector->e && frontsector->e->XFloor.ffloors.Size()) { backupfp = floorplane; backupcp = ceilingplane; @@ -1399,7 +1399,7 @@ void R_Subsector (subsector_t *sub) if (!outersubsector || line->sidedef == NULL || !(line->sidedef->Flags & WALLF_POLYOBJ)) { // kg3D - fake planes bounding calculation - if (line->backsector && frontsector->e && line->backsector->e->XFloor.ffloors.Size()) + if (r_3dfloors && line->backsector && frontsector->e && line->backsector->e->XFloor.ffloors.Size()) { backupfp = floorplane; backupcp = ceilingplane; @@ -1423,11 +1423,11 @@ void R_Subsector (subsector_t *sub) } if (frontsector->CenterFloor() >= backsector->CenterFloor()) { - fake3D |= FAKE3D_DOWN2UP; + fake3D |= FAKE3D_CLIPBOTFRONT; } if (frontsector->CenterCeiling() <= backsector->CenterCeiling()) { - fake3D |= FAKE3D_16; + fake3D |= FAKE3D_CLIPTOPFRONT; } R_AddLine(line); // fake } @@ -1455,7 +1455,6 @@ void R_Subsector (subsector_t *sub) void R_RenderBSPNode (void *node) { if (numnodes == 0) - { R_Subsector (subsectors); return; } diff --git a/src/r_segs.cpp b/src/r_segs.cpp index abe7b8670..e2b0aaafc 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1614,7 +1614,7 @@ void R_RenderSegLoop () // kg3D - fake planes clipping if (fake3D & FAKE3D_REFRESHCLIP) { - if (fake3D & FAKE3D_DOWN2UP) + if (fake3D & FAKE3D_CLIPBOTFRONT) { memcpy (fakeFloor->floorclip+x1, wallbottom+x1, (x2-x1)*sizeof(short)); } @@ -1626,7 +1626,7 @@ void R_RenderSegLoop () } memcpy (fakeFloor->floorclip+x1, walllower+x1, (x2-x1)*sizeof(short)); } - if (fake3D & FAKE3D_16) + if (fake3D & FAKE3D_CLIPTOPFRONT) { memcpy (fakeFloor->ceilingclip+x1, walltop+x1, (x2-x1)*sizeof(short)); } @@ -2241,7 +2241,7 @@ void R_StoreWallRange (int start, int stop) } } - if(!ds_p->fake && backsector->e && backsector->e->XFloor.ffloors.Size()) { + if(!ds_p->fake && r_3dfloors && backsector->e && backsector->e->XFloor.ffloors.Size()) { for(i = 0; i < (int)backsector->e->XFloor.ffloors.Size(); i++) { F3DFloor *rover = backsector->e->XFloor.ffloors[i]; if(rover->flags & FF_RENDERSIDES && (!(rover->flags & FF_INVERTSIDES) || rover->flags & FF_ALLSIDES)) { @@ -2250,7 +2250,7 @@ void R_StoreWallRange (int start, int stop) } } } - if(!ds_p->fake && frontsector->e && frontsector->e->XFloor.ffloors.Size()) { + if(!ds_p->fake && r_3dfloors && frontsector->e && frontsector->e->XFloor.ffloors.Size()) { for(i = 0; i < (int)frontsector->e->XFloor.ffloors.Size(); i++) { F3DFloor *rover = frontsector->e->XFloor.ffloors[i]; if(rover->flags & FF_RENDERSIDES && (rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES)) { @@ -2274,6 +2274,10 @@ void R_StoreWallRange (int start, int stop) maskedtexture = true; + // kg3D - backup for mid and fake walls + ds_p->bkup = R_NewOpening(stop - start); + memcpy(openings + ds_p->bkup, &ceilingclip[start], sizeof(short)*(stop - start)); + ds_p->bFogBoundary = IsFogBoundary (frontsector, backsector); if (sidedef->GetTexture(side_t::mid).isValid() || ds_p->bFakeBoundary) { @@ -2369,9 +2373,6 @@ void R_StoreWallRange (int start, int stop) { ds_p->sprtopclip = R_NewOpening (stop - start); memcpy (openings + ds_p->sprtopclip, &ceilingclip[start], sizeof(short)*(stop-start)); - // kg3D - backup for mid and fake walls - ds_p->bkup = R_NewOpening (stop - start); - memcpy (openings + ds_p->bkup, &ceilingclip[start], sizeof(short)*(stop-start)); } if ( ((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && ds_p->sprbottomclip == -1) diff --git a/src/r_things.cpp b/src/r_things.cpp index a94873597..e07cfd25f 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -3410,7 +3410,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade, vis->cx = tx; vis->gx = particle->x; vis->gy = particle->y; - vis->texturemid = particle->z; // kg3D + vis->gz = particle->z; // kg3D vis->gzb = y1; vis->gzt = y2; vis->x1 = x1;