From 8273534967272444d3fb79b1260ca14c05933ce1 Mon Sep 17 00:00:00 2001 From: Sryder Date: Mon, 6 May 2019 16:57:32 +0100 Subject: [PATCH] Add a cvar for sprite billboarding, off by default. --- src/hardware/hw_main.c | 6 +++--- src/hardware/hw_main.h | 1 + src/r_main.c | 1 + src/v_video.c | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 272da06d8..7e0b369eb 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4249,7 +4249,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t // This is expecting a pointer to an array containing 4 wallVerts for a sprite static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts) { - if (spr && spr->mobj && wallVerts) + if (cv_grspritebillboarding.value && spr && spr->mobj && wallVerts) { float basey = FIXED_TO_FLOAT(spr->mobj->z); float lowy = wallVerts[0].y; @@ -4530,7 +4530,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) wallVerts[1].y = endbot; // The x and y only need to be adjusted in the case that it's not a papersprite - if (spr->mobj) + if (cv_grspritebillboarding.value && spr->mobj) { // Get the x and z of the vertices so billboarding draws correctly realheight = realbot - realtop; @@ -4559,7 +4559,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) wallVerts[0].y = wallVerts[1].y = bot; // The x and y only need to be adjusted in the case that it's not a papersprite - if (spr->mobj) + if (cv_grspritebillboarding.value && spr->mobj) { // Get the x and z of the vertices so billboarding draws correctly realheight = realbot - realtop; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 59042cf3b..f86b198a1 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -95,6 +95,7 @@ extern consvar_t cv_grcorrecttricks; extern consvar_t cv_voodoocompatibility; extern consvar_t cv_grfovchange; extern consvar_t cv_grsolvetjoin; +extern consvar_t cv_grspritebillboarding; extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy; diff --git a/src/r_main.c b/src/r_main.c index 94945af5b..08b1ab2f0 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1407,6 +1407,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_grcoronasize); #endif CV_RegisterVar(&cv_grmd2); + CV_RegisterVar(&cv_grspritebillboarding); #endif #ifdef HWRENDER diff --git a/src/v_video.c b/src/v_video.c index cfe7d0360..c3b29e157 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -81,6 +81,7 @@ consvar_t cv_grcoronasize = {"gr_coronasize", "1", CV_SAVE| CV_FLOAT, 0, NULL, 0 static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}}; // console variables in development consvar_t cv_grmd2 = {"gr_md2", "Off", CV_SAVE, CV_MD2, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #endif const UINT8 gammatable[5][256] =