[iortcw] 53/152: All: Fix 3D crosshairs

Simon McVittie smcv at debian.org
Fri Sep 8 10:39:58 UTC 2017


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

smcv pushed a commit to annotated tag 1.5a
in repository iortcw.

commit 498d3ad4c57d5db770b73888f004a5121828dfdc
Author: Donny <M4N4T4RMS at gmail.com>
Date:   Mon May 9 07:11:10 2016 -0400

    All: Fix 3D crosshairs
---
 MP/code/cgame/cg_draw.c | 20 +++++++++++++++++---
 SP/code/cgame/cg_draw.c | 21 ++++++---------------
 2 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/MP/code/cgame/cg_draw.c b/MP/code/cgame/cg_draw.c
index 8af29e4..90d01d2 100644
--- a/MP/code/cgame/cg_draw.c
+++ b/MP/code/cgame/cg_draw.c
@@ -1723,6 +1723,7 @@ static void CG_DrawCrosshair( void ) {
 	float f;
 	float x, y;
 	int weapnum;                // DHM - Nerve
+	vec4_t hcolor = {1, 1, 1, 1};
 
 	if ( cg.renderingThirdPerson ) {
 		return;
@@ -1793,8 +1794,6 @@ static void CG_DrawCrosshair( void ) {
 
 	// set color based on health
 	if ( cg_crosshairHealth.integer ) {
-		vec4_t hcolor;
-
 		CG_ColorForHealth( hcolor );
 		trap_R_SetColor( hcolor );
 	} else {
@@ -1875,7 +1874,6 @@ static void CG_DrawCrosshair3D( void ) {
 	qhandle_t hShader;
 	float f;
 	int weapnum;                // DHM - Nerve
-
 	trace_t trace;
 	vec3_t endpos;
 	float stereoSep, zProj, maxdist, xmax;
@@ -1980,7 +1978,23 @@ static void CG_DrawCrosshair3D( void ) {
 	ent.radius = w / 640 * xmax * trace.fraction * maxdist / zProj;
 	ent.customShader = hShader;
 
+	ent.shaderRGBA[0]=255;
+	ent.shaderRGBA[1]=255;
+	ent.shaderRGBA[2]=255;
+	ent.shaderRGBA[3]=255;
+
 	trap_R_AddRefEntityToScene(&ent);
+
+	if ( cg.crosshairShaderAlt[ cg_drawCrosshair.integer % NUM_CROSSHAIRS ] ) {
+		ent.customShader = cg.crosshairShaderAlt[ cg_drawCrosshair.integer % NUM_CROSSHAIRS ];
+
+		ent.shaderRGBA[0]=255;
+		ent.shaderRGBA[1]=255;
+		ent.shaderRGBA[2]=255;
+		ent.shaderRGBA[3]=255;
+
+		trap_R_AddRefEntityToScene(&ent);
+	}
 }
 
 
diff --git a/SP/code/cgame/cg_draw.c b/SP/code/cgame/cg_draw.c
index 65b1ce1..3f0f85a 100644
--- a/SP/code/cgame/cg_draw.c
+++ b/SP/code/cgame/cg_draw.c
@@ -2374,7 +2374,7 @@ static void CG_DrawCrosshair( void ) {
 	float f;
 	float x, y;
 	int weapnum;                // DHM - Nerve
-	vec4_t hcolor = {1, 1, 1, 0};
+	vec4_t hcolor = {1, 1, 1, 1};
 	qboolean friendInSights = qfalse;
 
 	if ( cg.renderingThirdPerson ) {
@@ -2556,7 +2556,7 @@ static void CG_DrawCrosshair3D( void ) {
 	qhandle_t hShader;
 	float f;
 	int weapnum;                // DHM - Nerve
-	vec4_t hcolor = {1, 1, 1, 0};
+	vec4_t hcolor = {1, 1, 1, 1};
 	qboolean friendInSights = qfalse;
 
 	trace_t trace;
@@ -2730,19 +2730,10 @@ static void CG_DrawCrosshair3D( void ) {
 	ent.radius = w / 640 * xmax * trace.fraction * maxdist / zProj;
 	ent.customShader = hShader;
 
-	// set color based on health
-	if ( cg_crosshairHealth.integer ) {
-		CG_ColorForHealth( hcolor );
-		ent.shaderRGBA[0]=(byte)(hcolor[0]*255.f);
-		ent.shaderRGBA[1]=(byte)(hcolor[1]*255.f);
-		ent.shaderRGBA[2]=(byte)(hcolor[2]*255.f);
-		ent.shaderRGBA[3]=(byte)(hcolor[3]*255.f);
-	} else {
-		ent.shaderRGBA[0]=255;
-		ent.shaderRGBA[1]=255;
-		ent.shaderRGBA[2]=255;
-		ent.shaderRGBA[3]=255;
-	}
+	ent.shaderRGBA[0]=255;
+	ent.shaderRGBA[1]=255;
+	ent.shaderRGBA[2]=255;
+	ent.shaderRGBA[3]=(byte)(hcolor[3]*255.f);
 
 	trap_R_AddRefEntityToScene(&ent);
 }

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