[iortcw] 419/497: SP: Add wide HUD option to cg_fixedAspect cvar / Some cleanup

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:39 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 eb95dff287435a5710a8107f31b5c0a87214e470
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Sat Nov 7 05:50:16 2015 -0500

    SP: Add wide HUD option to cg_fixedAspect cvar / Some cleanup
---
 SP/code/cgame/cg_draw.c      | 22 +++++++++++++------
 SP/code/cgame/cg_drawtools.c |  2 +-
 SP/code/cgame/cg_ents.c      |  4 ++++
 SP/code/cgame/cg_main.c      |  3 ---
 SP/code/cgame/cg_newdraw.c   | 51 ++++++++++++++++++++++++++++++++++++++++++--
 SP/code/cgame/cg_weapons.c   |  4 +++-
 6 files changed, 72 insertions(+), 14 deletions(-)

diff --git a/SP/code/cgame/cg_draw.c b/SP/code/cgame/cg_draw.c
index a39437e..375b22a 100644
--- a/SP/code/cgame/cg_draw.c
+++ b/SP/code/cgame/cg_draw.c
@@ -1199,6 +1199,12 @@ static void CG_DrawUpperRight(stereoFrame_t stereoFrame) {
 
 	y = 0;
 
+	if ( cg_fixedAspect.integer == 2 ) {
+		CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
+	} else if ( cg_fixedAspect.integer == 1 ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	if ( cgs.gametype >= GT_TEAM ) {
 		y = CG_DrawTeamOverlay( y );
 	}
@@ -1563,6 +1569,12 @@ static void CG_DrawPickupItem( void ) {
 	char pickupText[256];
 	float color[4];
 
+	if ( cg_fixedAspect.integer == 2 ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	} else if ( cg_fixedAspect.integer == 1 ) {
+		CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+	}
+
 	value = cg.itemPickup;
 	if ( value ) {
 		fadeColor = CG_FadeColor( cg.itemPickupTime, 3000 );
@@ -3149,7 +3161,6 @@ static void CG_DrawFlashFade( void ) {
 		if ( cg_fixedAspect.integer ) {
 			CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
 		 	CG_FillRect( 0, 0, 640, 480, col );
-			CG_PopScreenPlacement();
 		} else {	
 			CG_FillRect( 0, 0, 640, 480, col ); // why do a bunch of these extend outside 640x480?
 		}
@@ -3209,7 +3220,6 @@ static void CG_DrawFlashZoomTransition( void ) {
 		if ( cg_fixedAspect.integer ) {
 			CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
 			CG_FillRect( -10, -10, 650, 490, color );
-			CG_PopScreenPlacement();
 		} else {
 			CG_FillRect( -10, -10, 650, 490, color );
 		}
@@ -3245,7 +3255,6 @@ static void CG_DrawFlashDamage( void ) {
 		if ( cg_fixedAspect.integer ) {
 			CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
 			CG_FillRect( -10, -10, 650, 490, col );
-			CG_PopScreenPlacement();
 		} else {
 			CG_FillRect( -10, -10, 650, 490, col );
 		}
@@ -3565,7 +3574,6 @@ static void CG_DrawGameScreenFade( void ) {
 	if ( cg_fixedAspect.integer ) {
 		CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
 		CG_FillRect( 0, 0, 640, 480, col );
-		CG_PopScreenPlacement();
 	} else {
 		CG_FillRect( 0, 0, 640, 480, col );
 	}
@@ -3604,7 +3612,6 @@ static void CG_ScreenFade( void ) {
 		if ( cg_fixedAspect.integer ) {
 			CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
 			CG_FillRect( 0, 0, 640, 480, cg.fadeColor1 );
-			CG_PopScreenPlacement();
 		} else {
 			CG_FillRect( 0, 0, 640, 480, cg.fadeColor1 );
 		}
@@ -3621,7 +3628,6 @@ static void CG_ScreenFade( void ) {
 			if ( cg_fixedAspect.integer ) {
 				CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
 				CG_FillRect( 0, 0, 640, 480, color );
-				CG_PopScreenPlacement();
 			} else {
 				CG_FillRect( 0, 0, 640, 480, color );
 			}
@@ -3677,7 +3683,9 @@ static void CG_Draw2D(stereoFrame_t stereoFrame) {
 				CG_DrawCrosshair();
 
 			if ( cg_drawStatus.integer ) {
-				if ( cg_fixedAspect.integer ) {
+				if ( cg_fixedAspect.integer == 2 ) {
+					CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+				} else if ( cg_fixedAspect.integer == 1 ) {
 					CG_SetScreenPlacement(PLACE_CENTER, PLACE_BOTTOM);
 				}
 
diff --git a/SP/code/cgame/cg_drawtools.c b/SP/code/cgame/cg_drawtools.c
index 7b88f64..e5405af 100644
--- a/SP/code/cgame/cg_drawtools.c
+++ b/SP/code/cgame/cg_drawtools.c
@@ -198,7 +198,7 @@ void CG_FillRectGradient( float x, float y, float width, float height, const flo
 ==============
 CG_HorizontalPercentBar
 	Generic routine for pretty much all status indicators that show a fractional
-	value to the palyer by virtue of how full a drawn box is.
+	value to the player by virtue of how full a drawn box is.
 
 flags:
 	left		- 1
diff --git a/SP/code/cgame/cg_ents.c b/SP/code/cgame/cg_ents.c
index 78e3419..eb9f897 100644
--- a/SP/code/cgame/cg_ents.c
+++ b/SP/code/cgame/cg_ents.c
@@ -615,6 +615,10 @@ void CG_DrawHoldableSelect( void ) {
 	}
 	trap_R_SetColor( color );
 
+	if ( cg_fixedAspect.integer ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	// showing select clears pickup item display, but not the blend blob
 	cg.itemPickupTime = 0;
 
diff --git a/SP/code/cgame/cg_main.c b/SP/code/cgame/cg_main.c
index fa03b62..f7b07d5 100644
--- a/SP/code/cgame/cg_main.c
+++ b/SP/code/cgame/cg_main.c
@@ -1443,9 +1443,6 @@ static void CG_RegisterGraphics( void ) {
 		}
 	}
 
-	// can be used by HUD so always load it
-	CG_RegisterItemVisuals( 6 /* item_health_large */ );
-
 	// wall marks
 	cgs.media.bulletMarkShader = trap_R_RegisterShader( "gfx/damage/bullet_mrk" );
 	cgs.media.burnMarkShader = trap_R_RegisterShader( "gfx/damage/burn_med_mrk" );
diff --git a/SP/code/cgame/cg_newdraw.c b/SP/code/cgame/cg_newdraw.c
index 191e791..3bbe4e5 100644
--- a/SP/code/cgame/cg_newdraw.c
+++ b/SP/code/cgame/cg_newdraw.c
@@ -200,6 +200,12 @@ static void CG_DrawPlayerArmorValue( rectDef_t *rect, int font, float scale, vec
 
 	value = ps->stats[STAT_ARMOR];
 
+	if ( cg_fixedAspect.integer == 2 ) {
+		CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+	} else if ( cg_fixedAspect.integer == 1 ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	if ( shader ) {
 		trap_R_SetColor( color );
 		CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
@@ -269,6 +275,12 @@ static void CG_DrawPlayerWeaponIcon( rectDef_t *rect, qboolean drawHighlighted,
 		return;
 	}
 
+	if ( cg_fixedAspect.integer == 2 ) {
+		CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+	} else if ( cg_fixedAspect.integer == 1 ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	// DHM - Nerve :: special case for WP_CLASS_SPECIAL
 
 	realweap = cg.predictedPlayerState.weapon;
@@ -436,6 +448,10 @@ static void CG_DrawCursorhint( rectDef_t *rect ) {
 
 	icon = cgs.media.hintShaders[cg.cursorHintIcon];
 
+	if ( cg_fixedAspect.integer ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	switch ( cg.cursorHintIcon ) {
 	case HINT_NONE:
 	case HINT_FORCENONE:
@@ -586,6 +602,12 @@ static void CG_DrawPlayerAmmoValue( rectDef_t *rect, int font, float scale, vec4
 		return;
 	}
 
+	if ( cg_fixedAspect.integer == 2 ) {
+		CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+	} else if ( cg_fixedAspect.integer == 1 ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	switch ( weap ) {      // some weapons don't draw ammo count text
 	case WP_KNIFE:
 	case WP_CLASS_SPECIAL:              // DHM - Nerve
@@ -631,7 +653,12 @@ static void CG_DrawPlayerAmmoValue( rectDef_t *rect, int font, float scale, vec4
 		} else {
 			Com_sprintf( num, sizeof( num ), "%i", value );
 			value = CG_Text_Width( num, font, scale, 0 );
-			CG_Text_Paint( rect->x + ( rect->w - value ) / 2, rect->y + rect->h, font, scale, color, num, 0, 0, textStyle );
+			if ( type == 0 ) {
+				// Moved this up a little so it's not on top of the weapon heat bar
+				CG_Text_Paint( rect->x + ( rect->w - value ) / 2, -15 + rect->y + rect->h, font, scale, color, num, 0, 0, textStyle );
+			} else {
+				CG_Text_Paint( rect->x + ( rect->w - value ) / 2, rect->y + rect->h, font, scale, color, num, 0, 0, textStyle );
+			}
 
 //			if(special) {	// draw '0' for akimbo guns
 			if ( value2 || ( special && type == 1 ) ) {
@@ -875,8 +902,10 @@ static void CG_DrawHoldableItem( rectDef_t *rect, int font, float scale, qboolea
 		return;
 	}
 
-	if ( cg_fixedAspect.integer ) {
+	if ( cg_fixedAspect.integer == 2 ) {
 		CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
+	} else if ( cg_fixedAspect.integer == 1 ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
 	}
 
 	value   = cg.predictedPlayerState.holdable[cg.holdableSelect];
@@ -1050,6 +1079,12 @@ static void CG_DrawPlayerHealth( rectDef_t *rect, int font, float scale, vec4_t
 
 	value = ps->stats[STAT_HEALTH];
 
+	if ( cg_fixedAspect.integer == 2 ) {
+		CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+	} else if ( cg_fixedAspect.integer == 1 ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	if ( shader ) {
 		trap_R_SetColor( color );
 		CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
@@ -2142,6 +2177,12 @@ void CG_DrawWeapHeat( rectDef_t *rect, int align ) {
 		return;
 	}
 
+	if ( cg_fixedAspect.integer == 2 ) {
+		CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+	} else if ( cg_fixedAspect.integer == 1 ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	if ( align != HUD_HORIZONTAL ) {
 		flags |= 4;   // BAR_VERT
 
@@ -2168,6 +2209,12 @@ static void CG_DrawFatigue( rectDef_t *rect, vec4_t color, int align ) {
 	int flags = 0;
 	float chargeTime;       // DHM - Nerve
 
+	if ( cg_fixedAspect.integer == 2 ) {
+		CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+	} else if ( cg_fixedAspect.integer == 1 ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	if ( align != HUD_HORIZONTAL ) {
 		flags |= 4;   // BAR_VERT
 		flags |= 1;   // BAR_LEFT (left, when vertical means grow 'up')
diff --git a/SP/code/cgame/cg_weapons.c b/SP/code/cgame/cg_weapons.c
index 91d3662..29fff31 100644
--- a/SP/code/cgame/cg_weapons.c
+++ b/SP/code/cgame/cg_weapons.c
@@ -3112,7 +3112,9 @@ void CG_DrawWeaponSelect( void ) {
 	int bits[MAX_WEAPONS / ( sizeof( int ) * 8 )];
 	float       *color;
 
-	if ( cg_fixedAspect.integer ) {
+	if ( cg_fixedAspect.integer == 2 ) {
+		CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+	} else if ( cg_fixedAspect.integer == 1 ) {
 		CG_SetScreenPlacement(PLACE_CENTER, PLACE_BOTTOM);
 	}
 

-- 
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