From 6bc1a6c5152df074ee737f1db42a990cd422fe86 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 31 Jul 2023 14:24:46 +0200 Subject: [PATCH] software ffloorclip cleanup code looks nicer, since i accidentally ported the old deprecated thing, works good now --- src/r_main.c | 2 +- src/r_segs.c | 78 ++++++++++++++++++++++++++-------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 9ed8c4107..cd4c99b69 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -196,7 +196,7 @@ consvar_t cv_flipcam4 = {"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_ffloorclip = {"ffloorclip", "On", CV_SAVE, CV_OnOff, NULL}; +consvar_t cv_ffloorclip = {"ffloorclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_soniccd = {"soniccd", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_allowmlook = {"allowmlook", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showhud = {"showhud", "Yes", CV_CALL, CV_YesNo, R_SetViewSize, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/r_segs.c b/src/r_segs.c index a3d41a900..e93cbaecb 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -705,7 +705,7 @@ static boolean R_IsFFloorTranslucent(visffloor_t *pfloor) // Polyobjects have no ffloors, and they're handled in the conditional above. if (pfloor->ffloor != NULL) - return (pfloor->ffloor->flags & (FF_TRANSLUCENT|FF_FOG)); + return (pfloor->ffloor->flags & FF_TRANSLUCENT); return false; } @@ -1362,29 +1362,29 @@ static void R_RenderSegLoop (void) if (top_w <= bottom_w) { fftop = (INT16)top_w; - ffbottom = (INT16)bottom_w; + ffbottom = (INT16)bottom_w; - ffloor[i].plane->top[rw_x] = fftop; - ffloor[i].plane->bottom[rw_x] = ffbottom; + ffloor[i].plane->top[rw_x] = fftop; + ffloor[i].plane->bottom[rw_x] = ffbottom; - // Lactozilla: Cull part of the column by the 3D floor if it can't be seen - // "bottom" is the top pixel of the floor column - if (ffbottom >= bottom-1 && R_FFloorCanClip(&ffloor[i]) && !curline->polyseg) + // Lactozilla: Cull part of the column by the 3D floor if it can't be seen + // "bottom" is the top pixel of the floor column + if (ffbottom >= bottom-1 && R_FFloorCanClip(&ffloor[i])) + { + rw_floormarked = true; + floorclip[rw_x] = fftop; + if (yh > fftop) + yh = fftop; + + if (markfloor && floorplane) + floorplane->top[rw_x] = bottom; + + if (rw_silhouette) { - rw_floormarked = true; - floorclip[rw_x] = fftop; - if (yh > fftop) - yh = fftop; - - if (markfloor && floorplane) - floorplane->top[rw_x] = bottom; - - if (rw_silhouette) - { - (*rw_silhouette) |= SIL_BOTTOM; - (*rw_bsilheight) = INT32_MAX; - } + (*rw_silhouette) |= SIL_BOTTOM; + (*rw_bsilheight) = INT32_MAX; } + } } } else if (ffloor[i].height > viewz) @@ -1406,29 +1406,29 @@ static void R_RenderSegLoop (void) if (top_w <= bottom_w) { fftop = (INT16)top_w; - ffbottom = (INT16)bottom_w; + ffbottom = (INT16)bottom_w; - ffloor[i].plane->top[rw_x] = fftop; - ffloor[i].plane->bottom[rw_x] = ffbottom; + ffloor[i].plane->top[rw_x] = fftop; + ffloor[i].plane->bottom[rw_x] = ffbottom; - // Lactozilla: Cull part of the column by the 3D floor if it can't be seen - // "top" is the height of the ceiling column - if (fftop <= top+1 && R_FFloorCanClip(&ffloor[i]) && !curline->polyseg) + // Lactozilla: Cull part of the column by the 3D floor if it can't be seen + // "top" is the height of the ceiling column + if (fftop <= top+1 && R_FFloorCanClip(&ffloor[i])) + { + rw_ceilingmarked = true; + ceilingclip[rw_x] = ffbottom; + if (yl < ffbottom) + yl = ffbottom; + + if (markceiling && ceilingplane) + ceilingplane->bottom[rw_x] = top; + + if (rw_silhouette) { - rw_ceilingmarked = true; - ceilingclip[rw_x] = ffbottom; - if (yl < ffbottom) - yl = ffbottom; - - if (markceiling && ceilingplane) - ceilingplane->bottom[rw_x] = top; - - if (rw_silhouette) - { - (*rw_silhouette) |= SIL_TOP; - (*rw_tsilheight) = INT32_MIN; - } + (*rw_silhouette) |= SIL_TOP; + (*rw_tsilheight) = INT32_MIN; } + } } } }