[openjk] 03/32: [MP/SP] Fix rendering of radar arrows

Simon McVittie smcv at debian.org
Sun Mar 12 18:03:01 UTC 2017


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

smcv pushed a commit to branch debian/master
in repository openjk.

commit 47df6ee400c233addd41b8945edb5f5c2b6e3b64
Author: Ensiform <ensiform at gmail.com>
Date:   Thu Feb 23 15:13:53 2017 -0600

    [MP/SP] Fix rendering of radar arrows
    
    This bug was unintentionally introduced during the fixing of RB_RotatePic similar to the bug previously introduced with rocket lock wedges. The arrow for players on the radar contain `rgbGen identity` which does not work with setting 2d color (trap->SetColor) but due to how the code previously worked, it rendered correctly.
    
    Fixes #910
---
 code/rd-vanilla/tr_shader.cpp   | 19 +++++++++++++++++++
 codemp/rd-vanilla/tr_shader.cpp | 19 +++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/code/rd-vanilla/tr_shader.cpp b/code/rd-vanilla/tr_shader.cpp
index 0ebcdf6..12f12fe 100644
--- a/code/rd-vanilla/tr_shader.cpp
+++ b/code/rd-vanilla/tr_shader.cpp
@@ -42,6 +42,10 @@ static	texModInfo_t	texMods[MAX_SHADER_STAGES][TR_MAX_TEXMODS];
 // retail JKA shader for gfx/2d/wedge.
 #define RETAIL_ROCKET_WEDGE_SHADER_HASH (1217042)
 
+// Hash value (generated using the generateHashValueForText function) for the original
+// retail JKA shader for gfx/menus/radar/arrow_w.
+#define RETAIL_ARROW_W_SHADER_HASH (1650186)
+
 
 #define FILE_HASH_SIZE		1024
 static	shader_t*		sh_hashTable[FILE_HASH_SIZE];
@@ -2461,6 +2465,21 @@ Ghoul2 Insert End
 		stages[0].stateBits |= GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA;
 	}
 
+	// The basejka radar arrow contains an incorrect rgbGen of identity
+	// It only worked because the original code didn't check shaders at all,
+	// thus setcolor worked fine but with fixing RB_RotatePic it no longer
+	// functioned because rgbGen identity doesn't work with setcolor.
+	//
+	// We match against retail version of gfx/menus/radar/arrow_w by calculating
+	// the hash value of the shader text, and comparing it against a 
+	// precalculated value.
+	if ( shaderHash == RETAIL_ARROW_W_SHADER_HASH &&
+		Q_stricmp( shader.name, "gfx/menus/radar/arrow_w" ) == 0 )
+	{
+		stages[0].rgbGen = CGEN_VERTEX;
+		stages[0].alphaGen = AGEN_VERTEX;
+	}
+
 	COM_EndParseSession();
 	return qtrue;
 }
diff --git a/codemp/rd-vanilla/tr_shader.cpp b/codemp/rd-vanilla/tr_shader.cpp
index e7ecccc..326f039 100644
--- a/codemp/rd-vanilla/tr_shader.cpp
+++ b/codemp/rd-vanilla/tr_shader.cpp
@@ -37,6 +37,10 @@ static	texModInfo_t	texMods[MAX_SHADER_STAGES][TR_MAX_TEXMODS];
 // retail JKA shader for gfx/2d/wedge.
 #define RETAIL_ROCKET_WEDGE_SHADER_HASH (1217042)
 
+// Hash value (generated using the generateHashValueForText function) for the original
+// retail JKA shader for gfx/menus/radar/arrow_w.
+#define RETAIL_ARROW_W_SHADER_HASH (1650186)
+
 #define FILE_HASH_SIZE		1024
 static	shader_t*		hashTable[FILE_HASH_SIZE];
 
@@ -2363,6 +2367,21 @@ static qboolean ParseShader( const char **text )
 		stages[0].stateBits |= GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA;
 	}
 
+	// The basejka radar arrow contains an incorrect rgbGen of identity
+	// It only worked because the original code didn't check shaders at all,
+	// thus setcolor worked fine but with fixing RB_RotatePic it no longer
+	// functioned because rgbGen identity doesn't work with setcolor.
+	//
+	// We match against retail version of gfx/menus/radar/arrow_w by calculating
+	// the hash value of the shader text, and comparing it against a 
+	// precalculated value.
+	if ( shaderHash == RETAIL_ARROW_W_SHADER_HASH &&
+		Q_stricmp( shader.name, "gfx/menus/radar/arrow_w" ) == 0 )
+	{
+		stages[0].rgbGen = CGEN_VERTEX;
+		stages[0].alphaGen = AGEN_VERTEX;
+	}
+
 	return qtrue;
 }
 

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



More information about the Pkg-games-commits mailing list