[iortcw] 452/497: All: Add missing 4:3 case / reticle scaling for sniper / FG42

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 4f6ccf027fc202367a0dd5956e3b8458f8bd585f
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Thu Dec 3 12:50:06 2015 -0500

    All: Add missing 4:3 case / reticle scaling for sniper / FG42
---
 MP/code/cgame/cg_draw.c | 33 +++++++++++++++++++------------
 SP/code/cgame/cg_draw.c | 52 ++++++++++++++++++++++++++++++-------------------
 2 files changed, 53 insertions(+), 32 deletions(-)

diff --git a/MP/code/cgame/cg_draw.c b/MP/code/cgame/cg_draw.c
index f2d00f8..8a84319 100644
--- a/MP/code/cgame/cg_draw.c
+++ b/MP/code/cgame/cg_draw.c
@@ -1506,6 +1506,7 @@ CG_DrawWeapReticle
 static void CG_DrawWeapReticle( void ) {
 	qboolean snooper, sniper;
 	vec4_t color = {0, 0, 0, 1};
+	float mask = 0, lb = 0;
 
 	// DHM - Nerve :: So that we will draw reticle
 	if ( cgs.gametype >= GT_WOLF && ( ( cg.snap->ps.pm_flags & PMF_FOLLOW ) || cg.demoPlayback ) ) {
@@ -1522,17 +1523,15 @@ static void CG_DrawWeapReticle( void ) {
 			// sides
 			if ( cg_fixedAspect.integer ) {
 				if ( cgs.glconfig.vidWidth * 480.0 > cgs.glconfig.vidHeight * 640.0 ) {
-					float mask = 0.5 * ( ( cgs.glconfig.vidWidth - ( cgs.screenXScale * 480.0 ) ) / cgs.screenXScale );
+					mask = 0.5 * ( ( cgs.glconfig.vidWidth - ( cgs.screenXScale * 480.0 ) ) / cgs.screenXScale );
 
 					CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
 					CG_FillRect( 0, 0, mask, 480, color );
 					CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
 					CG_FillRect( 640 - mask, 0, mask, 480, color );
-				}
-
-				// sides with letterbox
-				if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
-					float lb = 0.5 * ( ( cgs.glconfig.vidHeight - ( cgs.screenYScale * 480.0 ) ) / cgs.screenYScale );
+				} else if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+					// sides with letterbox
+					lb = 0.5 * ( ( cgs.glconfig.vidHeight - ( cgs.screenYScale * 480.0 ) ) / cgs.screenYScale );
 
 					CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
 					CG_FillRect( 0, 0, 80, 480, color );
@@ -1543,6 +1542,12 @@ static void CG_DrawWeapReticle( void ) {
 					CG_FillRect( 0, 480 - lb, 640, lb, color );
 					CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
 					CG_FillRect( 0, 0, 640, lb, color );
+				} else {
+					// resolution is 4:3
+					CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
+					CG_FillRect( 0, 0, 80, 480, color );
+					CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
+					CG_FillRect( 560, 0, 80, 480, color );
 				}
 			} else {
 				CG_FillRect( 0, 0, 80, 480, color );
@@ -1570,17 +1575,15 @@ static void CG_DrawWeapReticle( void ) {
 			// sides
 			if ( cg_fixedAspect.integer ) {
 				if ( cgs.glconfig.vidWidth * 480.0 > cgs.glconfig.vidHeight * 640.0 ) {
-					float mask = 0.5 * ( ( cgs.glconfig.vidWidth - ( cgs.screenXScale * 480.0 ) ) / cgs.screenXScale );
+					mask = 0.5 * ( ( cgs.glconfig.vidWidth - ( cgs.screenXScale * 480.0 ) ) / cgs.screenXScale );
 
 					CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
 					CG_FillRect( 0, 0, mask, 480, color );
 					CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
 					CG_FillRect( 640 - mask, 0, mask, 480, color );
-				}
-
-				// sides with letterbox
-				if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
-					float lb = 0.5 * ( ( cgs.glconfig.vidHeight - ( cgs.screenYScale * 480.0 ) ) / cgs.screenYScale );
+				} else if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+					// sides with letterbox
+					lb = 0.5 * ( ( cgs.glconfig.vidHeight - ( cgs.screenYScale * 480.0 ) ) / cgs.screenYScale );
 
 					CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
 					CG_FillRect( 0, 0, 80, 480, color );
@@ -1591,6 +1594,12 @@ static void CG_DrawWeapReticle( void ) {
 					CG_FillRect( 0, 480 - lb, 640, lb, color );
 					CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
 					CG_FillRect( 0, 0, 640, lb, color );
+				} else {
+					// resolution is 4:3
+					CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
+					CG_FillRect( 0, 0, 80, 480, color );
+					CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
+					CG_FillRect( 560, 0, 80, 480, color );
 				}
 			} else {
 				CG_FillRect( 0, 0, 80, 480, color );
diff --git a/SP/code/cgame/cg_draw.c b/SP/code/cgame/cg_draw.c
index 54cef3e..36daf81 100644
--- a/SP/code/cgame/cg_draw.c
+++ b/SP/code/cgame/cg_draw.c
@@ -2109,10 +2109,8 @@ static void CG_DrawWeapReticle( void ) {
 				CG_FillRect( 0, 0, mask, 480, color );
 				CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
 				CG_FillRect( 640 - mask, 0, mask, 480, color );
-			}
-
-			// sides with letterbox
-			if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+			} else if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+				// sides with letterbox
 				lb = 0.5 * ( ( cgs.glconfig.vidHeight - ( cgs.screenYScale * 480.0 ) ) / cgs.screenYScale );
 
 				CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
@@ -2124,6 +2122,12 @@ static void CG_DrawWeapReticle( void ) {
 				CG_FillRect( 0, 480 - lb, 640, lb, color );
 				CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
 				CG_FillRect( 0, 0, 640, lb, color );
+			} else {
+				// resolution is 4:3
+				CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
+				CG_FillRect( 0, 0, 80, 480, color );
+				CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
+				CG_FillRect( 560, 0, 80, 480, color );
 			}
 		} else {
 			CG_FillRect( 0, 0, 80, 480, color );
@@ -2137,10 +2141,10 @@ static void CG_DrawWeapReticle( void ) {
 
 		if ( cgs.media.reticleShaderSimpleQ ) {
 			if ( cg_fixedAspect.integer ) {
-				trap_R_DrawStretchPic( x, lb, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ );         // tl
-				trap_R_DrawStretchPic( x + w, lb, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ );     // tr
-				trap_R_DrawStretchPic( x, h + lb, w, h, 0, 1, 1, 0, cgs.media.reticleShaderSimpleQ );     // bl
-				trap_R_DrawStretchPic( x + w, h + lb, w, h, 1, 1, 0, 0, cgs.media.reticleShaderSimpleQ ); // br
+				trap_R_DrawStretchPic( x, lb * cgs.screenYScale, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ );         // tl
+				trap_R_DrawStretchPic( x + w, lb * cgs.screenYScale, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ );     // tr
+				trap_R_DrawStretchPic( x, h + lb * cgs.screenYScale, w, h, 0, 1, 1, 0, cgs.media.reticleShaderSimpleQ );     // bl
+				trap_R_DrawStretchPic( x + w, h + lb * cgs.screenYScale, w, h, 1, 1, 0, 0, cgs.media.reticleShaderSimpleQ ); // br
 			} else {
 				trap_R_DrawStretchPic( x, 0, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ );      // tl
 				trap_R_DrawStretchPic( x + w, 0, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ );  // tr
@@ -2164,10 +2168,8 @@ static void CG_DrawWeapReticle( void ) {
 				CG_FillRect( 0, 0, mask, 480, color );
 				CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
 				CG_FillRect( 640 - mask, 0, mask, 480, color );
-			}
-
-			// sides with letterbox
-			if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+			} else if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+				// sides with letterbox
 				lb = 0.5 * ( ( cgs.glconfig.vidHeight - ( cgs.screenYScale * 480.0 ) ) / cgs.screenYScale );
 
 				CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
@@ -2179,6 +2181,12 @@ static void CG_DrawWeapReticle( void ) {
 				CG_FillRect( 0, 480 - lb, 640, lb, color );
 				CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
 				CG_FillRect( 0, 0, 640, lb, color );
+			} else {
+				// resolution is 4:3
+				CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
+				CG_FillRect( 0, 0, 80, 480, color );
+				CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
+				CG_FillRect( 560, 0, 80, 480, color );
 			}
 		} else {
 			CG_FillRect( 0, 0, 80, 480, color );
@@ -2232,10 +2240,8 @@ static void CG_DrawWeapReticle( void ) {
 				CG_FillRect( 0, 0, mask, 480, color );
 				CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
 				CG_FillRect( 640 - mask, 0, mask, 480, color );
-			}
-
-			// sides with letterbox
-			if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+			} else if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+				// sides with letterbox
 				lb = 0.5 * ( ( cgs.glconfig.vidHeight - ( cgs.screenYScale * 480.0 ) ) / cgs.screenYScale );
 
 				CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
@@ -2247,6 +2253,12 @@ static void CG_DrawWeapReticle( void ) {
 				CG_FillRect( 0, 480 - lb, 640, lb, color );
 				CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
 				CG_FillRect( 0, 0, 640, lb, color );
+			} else {
+				// resolution is 4:3
+				CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
+				CG_FillRect( 0, 0, 80, 480, color );
+				CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
+				CG_FillRect( 560, 0, 80, 480, color );
 			}
 		} else {
 			CG_FillRect( 0, 0, 80, 480, color );
@@ -2260,10 +2272,10 @@ static void CG_DrawWeapReticle( void ) {
 
 		if ( cgs.media.reticleShaderSimpleQ ) {
 			if ( cg_fixedAspect.integer ) {
-				trap_R_DrawStretchPic( x, lb, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ );         // tl
-				trap_R_DrawStretchPic( x + w, lb, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ );     // tr
-				trap_R_DrawStretchPic( x, h + lb, w, h, 0, 1, 1, 0, cgs.media.reticleShaderSimpleQ );     // bl
-				trap_R_DrawStretchPic( x + w, h + lb, w, h, 1, 1, 0, 0, cgs.media.reticleShaderSimpleQ ); // br
+				trap_R_DrawStretchPic( x, lb * cgs.screenYScale, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ );         // tl
+				trap_R_DrawStretchPic( x + w, lb * cgs.screenYScale, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ );     // tr
+				trap_R_DrawStretchPic( x, h + lb * cgs.screenYScale, w, h, 0, 1, 1, 0, cgs.media.reticleShaderSimpleQ );     // bl
+				trap_R_DrawStretchPic( x + w, h + lb * cgs.screenYScale, w, h, 1, 1, 0, 0, cgs.media.reticleShaderSimpleQ ); // br
 			} else {
 				trap_R_DrawStretchPic( x, 0, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ );     // tl
 				trap_R_DrawStretchPic( x + w, 0, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ ); // tr

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list