[openjk] 120/130: JK2: Fix rendering of weapon icons

Simon McVittie smcv at debian.org
Fri Oct 28 11:09:27 UTC 2016


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

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

commit c97a368aa7f8e3846431101ef9845d5ae2d25a2f
Author: Ensiform <ensiform at gmail.com>
Date:   Mon Oct 24 23:05:28 2016 -0500

    JK2: Fix rendering of weapon icons
    
    Fixed rendering of weapon icons in datapad and scroll wheel.
    
    Previously, Raven neglected to actually check the player's ammo counts.
---
 codeJK2/cgame/cg_weapons.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/codeJK2/cgame/cg_weapons.cpp b/codeJK2/cgame/cg_weapons.cpp
index 4b5366b..6bfbbd5 100644
--- a/codeJK2/cgame/cg_weapons.cpp
+++ b/codeJK2/cgame/cg_weapons.cpp
@@ -1267,7 +1267,7 @@ int CG_WeaponCheck( int weaponIndex )
 {
 	int				value;
 
-	if ( weaponIndex == WP_SABER)
+	if ( weaponIndex == WP_SABER || weaponIndex == WP_STUN_BATON )
 	{
 		return qtrue;
 	}
@@ -1276,14 +1276,20 @@ int CG_WeaponCheck( int weaponIndex )
 							? weaponData[weaponIndex].energyPerShot
 							: weaponData[weaponIndex].altEnergyPerShot;
 
-	if (value > 0)
+	if( !cg.snap )
 	{
-		value = qtrue;
+		return qfalse;
 	}
-	else
+
+	// check how much energy(ammo) it takes to fire this weapon against how much ammo we have
+	if ( value > cg.snap->ps.ammo[weaponData[weaponIndex].ammoIndex] )
 	{
 		value = qfalse;
 	}
+	else
+	{
+		value = qtrue;
+	}
 
 	return value;
 }

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