From 7aa960d6d54abc0432fb3247ffcdd045c19a2177 Mon Sep 17 00:00:00 2001
From: Sryder13 <sryder13@gmail.com>
Date: Thu, 20 Mar 2014 10:29:53 +0000
Subject: [PATCH] Software Cropped Patches

Fixed the stupid error I made that was causing software to not draw
cropped patches.
---
 src/screen.c  | 13 +++++++++++--
 src/v_video.c |  2 ++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/screen.c b/src/screen.c
index 4389a15d57..0850560655 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -227,7 +227,11 @@ void SCR_Startup(void)
 	vid.dupx = vid.dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
 	vid.fdupx = FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT);
 	vid.fdupy = FixedDiv(vid.height*FRACUNIT, BASEVIDHEIGHT*FRACUNIT);
-	//vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy); // This was just placing it incorrectly at non aspect correct resolutions
+
+#ifdef HWRENDER
+	if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions, not sure if it does anything in software
+#endif
+		vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
 
 	vid.meddupx = (UINT8)(vid.dupx >> 1) + 1;
 	vid.meddupy = (UINT8)(vid.dupy >> 1) + 1;
@@ -269,7 +273,12 @@ void SCR_Recalc(void)
 	vid.dupx = vid.dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
 	vid.fdupx = FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT);
 	vid.fdupy = FixedDiv(vid.height*FRACUNIT, BASEVIDHEIGHT*FRACUNIT);
-	//vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy); // This was just placing it incorrectly at non aspect correct resolutions
+
+#ifdef HWRENDER
+	if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions, not sure if it does anything in software
+#endif
+		vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
+
 	//vid.baseratio = FixedDiv(vid.height << FRACBITS, BASEVIDHEIGHT << FRACBITS);
 	vid.baseratio = FRACUNIT;
 
diff --git a/src/v_video.c b/src/v_video.c
index 034c521476..76728a35db 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -1042,8 +1042,10 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, INT32 scrn, patch_t *patch, fixed_
 #ifdef HWRENDER
 	// Done
 	if (rendermode != render_soft && rendermode != render_none)
+	{
 		HWR_DrawCroppedPatch((GLPatch_t *)patch, x, y, scrn, science, sx, sy, w, h);
 		return;
+	}
 #endif
 
 	// only use one dup, to avoid stretching (har har)
-- 
GitLab