[nexuiz-commits] r6975 - in trunk/data: . qcsrc/client qcsrc/common qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jun 10 23:58:12 EDT 2009


Author: mand1nga
Date: 2009-06-10 23:58:12 -0400 (Wed, 10 Jun 2009)
New Revision: 6975

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/client/Defs.qc
   trunk/data/qcsrc/client/Main.qc
   trunk/data/qcsrc/client/View.qc
   trunk/data/qcsrc/client/sbar.qc
   trunk/data/qcsrc/common/constants.qh
   trunk/data/qcsrc/common/items.qc
   trunk/data/qcsrc/common/items.qh
   trunk/data/qcsrc/server/bots.qc
   trunk/data/qcsrc/server/cl_weaponsystem.qc
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/g_damage.qc
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/nexball.qc
   trunk/data/qcsrc/server/w_campingrifle.qc
   trunk/data/qcsrc/server/w_common.qc
   trunk/data/qcsrc/server/w_crylink.qc
   trunk/data/qcsrc/server/w_electro.qc
   trunk/data/qcsrc/server/w_grenadelauncher.qc
   trunk/data/qcsrc/server/w_hagar.qc
   trunk/data/qcsrc/server/w_hlac.qc
   trunk/data/qcsrc/server/w_hook.qc
   trunk/data/qcsrc/server/w_laser.qc
   trunk/data/qcsrc/server/w_minstanex.qc
   trunk/data/qcsrc/server/w_nex.qc
   trunk/data/qcsrc/server/w_porto.qc
   trunk/data/qcsrc/server/w_rocketlauncher.qc
   trunk/data/qcsrc/server/w_seeker.qc
   trunk/data/qcsrc/server/w_shotgun.qc
   trunk/data/qcsrc/server/w_tuba.qc
   trunk/data/qcsrc/server/w_uzi.qc
Log:
Support for accuracy stats by Diabolik. See your stats with +showaccuracy or "sbar_hud_accuracy 1".

Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/defaultNexuiz.cfg	2009-06-11 03:58:12 UTC (rev 6975)
@@ -211,6 +211,7 @@
 vid_conwidth 800
 vid_conheight 600
 set sbar_hudselector 1	"0 = old style hud layout, 1 = new nexuiz hud layout, 2 = combined health and armor display"
+set sbar_hud_accuracy 0 "1 = weapon accuracy on HUD"
 v_deathtilt 0 // needed for spectators (who are dead to avoid prediction)
 sbar_info_pos 50
 

Modified: trunk/data/qcsrc/client/Defs.qc
===================================================================
--- trunk/data/qcsrc/client/Defs.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/client/Defs.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -150,6 +150,7 @@
 // Additional OPTIONAL Fields and Globals
 float		intermission;
 float		sb_showscores;
+float		sb_showaccuracy;
 .string		message;
 .float renderflags;
 // float		coop;

Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/client/Main.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -87,6 +87,7 @@
 	registercmd("-button3");
 	registercmd("+button4");
 	registercmd("-button4");
+	registercmd("+showaccuracy");registercmd("-showaccuracy");
 
 #ifndef CAMERATEST
 	if(isdemo())
@@ -331,6 +332,12 @@
 	} else if(strCmd == "-showscores") {
 		sb_showscores = false;
 		return true;
+	} else if(strCmd == "+showaccuracy") {
+		sb_showaccuracy = true;
+		return true;
+	} else if(strCmd == "-showaccuracy") {
+		sb_showaccuracy = false;
+		return true;
 	}
 
 	if(camera_active)

Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/client/View.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -353,6 +353,7 @@
 
 	sbar_alpha_fg = cvar("sbar_alpha_fg" );
 	sbar_hudselector = cvar("sbar_hudselector");
+	sbar_hud_accuracy = cvar("sbar_hud_accuracy");
 	ColorTranslateMode = cvar("cl_stripcolorcodes");
 	activeweapon = getstati(STAT_SWITCHWEAPON);
 	f = cvar("teamplay");

Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/client/sbar.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -1,3 +1,12 @@
+void drawstringright(vector, string, vector, vector, float, float);
+void drawstringcenter(vector, string, vector, vector, float, float);
+void Sbar_DrawStats();
+void Sbar_DrawStats_Description_Splash(vector);
+void Sbar_DrawStats_Description_Hitscan(vector);
+float weapon_hits[WEP_COUNT];
+float weapon_fired[WEP_COUNT];
+float weapon_number;
+
 float last_weapon;
 float weapontime;
 
@@ -4,6 +13,7 @@
 float sbar_alpha_fg;
 float sbar_alpha_bg;
 float sbar_hudselector;
+float sbar_hud_accuracy;
 
 float ps_primary, ps_secondary;
 float ts_primary, ts_secondary;
@@ -21,9 +31,9 @@
 	pos_x = (vid_conwidth - 1)/2;
 	pos_y = 16;
 	pos_z = 0;*/
-	
+
 	//drawpic(pos, "gfx/finale", '0 0 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
-	
+
 	//drawstring(pos, "END", sbar_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
 	MapVote_Draw();
 }
@@ -47,17 +57,19 @@
 		}
 	}
 }
-void Sbar_DrawWeapon(float nr, float fade, float active)
+void Sbar_DrawWeapon(float nr, float fade, float active, float wc)
 {
-	vector pos, vsize;
-	float value, idx, imp, sp;
+	vector pos, vsize, fill_colour;
+	float value, idx, imp, sp, weapon_hit, weapon_damage, weapon_stats;
 
 	imp = weaponimpulse[nr];
+	weapon_hit = weapon_hits[wc];
+ 	weapon_damage = weapon_fired[wc];
 	if(imp == 0)
 		idx = 9;
 	else
 		idx = imp - 1;
-	
+
 	value = (active) ? 1 : 0.6;
 	color_x = color_y = color_z = value;
 
@@ -66,7 +78,7 @@
 
 	sp = weaponspace[idx] + 1;
 	weaponspace[idx] = sp;
-	
+
 	pos_x = (vid_conwidth + 10 - w_width * 9) * 0.5 + w_width * idx;
 	pos_y = (vid_conheight - w_height * sp) - 38; // move 38 pixels up
 	pos_z = 0;
@@ -82,6 +94,15 @@
 	vsize_y = font_size;
 	vsize_z = 0;
 	drawstring(pos, ftos(imp), vsize, '1 1 1', sbar_alpha_fg, 0);
+
+	// draw the weapon accuracy on the HUD
+	if(sbar_hud_accuracy)
+ 	{
+ 		weapon_stats = rint(100*weapon_hit/weapon_damage);
+ 		fill_colour_x = 1 - 0.015 * weapon_stats;
+ 		fill_colour_y = 1 - 0.015 * (100 - weapon_stats);
+ 		drawstringright(pos + '22 0 0', strcat(ftos(weapon_stats),"%"), '6 6 0', fill_colour, sbar_alpha_fg, 0);
+ 	}
 }
 
 void Sbar_DrawXNum (vector pos, float num, float digits, float lettersize, vector rgb, float highlighted, float a, float dflags)
@@ -101,7 +122,7 @@
 		pos_x -= lettersize;
 	} else
 		minus = false;
-	
+
 	if(digits < 0)
 	{
 		tmp = ftos(num);
@@ -109,10 +130,10 @@
 		str = strcat(substring("0000000000", 0, digits - strlen(tmp)), tmp);
 	} else
 		str = ftos(num);
-	
+
 	l = strlen(str);
 	l_length = ftos(l);
-	
+
 	if(l > digits)
 	{
 		str = substring(str, l-digits, 999);
@@ -127,21 +148,21 @@
 		hl_size_z = 0;
 		if(minus)
 			hl_size_x = hl_size_x + vsize_x;
-		
+
 		vector hl_pos;
 		hl_pos_x = pos_x - lettersize/10;
 		hl_pos_y = pos_y - lettersize/30;
 		hl_pos_z = 0;
-		
+
 		drawpic(hl_pos, strcat("gfx/hud/sb_highlight_", l_length), hl_size, '1 1 1', sbar_alpha_fg, dflags);
 	}
-	
+
 	if(minus)
 	{
 		drawpic(pos, "gfx/hud/num_minus", vsize, rgb, a * sbar_alpha_fg, dflags);
 		pos_x += lettersize;
 	}
-	
+
 	for(i = 0; i < l; ++i)
 	{
 		drawpic(pos, strcat("gfx/hud/num_", substring(str, i, 1)), vsize, rgb, a * sbar_alpha_fg, dflags);
@@ -201,7 +222,7 @@
 	}
 	if(ps_secondary == -1)
 		ps_secondary = ps_primary;
-	
+
 	for(i = 0; i < MAX_TEAMSCORE; ++i)
 	{
 		f = (teamscores_flags[i] & SFL_SORT_PRIO_MASK);
@@ -257,7 +278,7 @@
 		vl = COLOR_SPECTATOR;
 	if(!right.gotscores)
 		vr = COLOR_SPECTATOR;
-	
+
 	if(vl > vr)
 		return true;
 	if(vl < vr)
@@ -285,7 +306,7 @@
 		return IS_INCREASING(scores_flags[ps_primary]);
 	if(vl < vr)
 		return IS_DECREASING(scores_flags[ps_primary]);
-	
+
 	vl = left.scores[ps_secondary];
 	vr = right.scores[ps_secondary];
 	if(scores_flags[ps_secondary] & SFL_ZERO_IS_WORST)
@@ -299,7 +320,7 @@
 		return IS_INCREASING(scores_flags[ps_secondary]);
 	if(vl < vr)
 		return IS_DECREASING(scores_flags[ps_secondary]);
-	
+
 	return false;
 }
 
@@ -323,14 +344,14 @@
 		return 1;
 	if(right.team == COLOR_SPECTATOR)
 		return 0;
-	
+
 	vl = left.teamscores[ts_primary];
 	vr = right.teamscores[ts_primary];
 	if(vl > vr)
 		return IS_INCREASING(teamscores_flags[ts_primary]);
 	if(vl < vr)
 		return IS_DECREASING(teamscores_flags[ts_primary]);
-	
+
 	vl = left.teamscores[ts_secondary];
 	vr = right.teamscores[ts_secondary];
 	if(vl > vr)
@@ -363,7 +384,7 @@
 	print("^2sbar_columns_set ^7filed1 field2 ...\n");
 	print("The following field names are recognized (case INsensitive):\n");
 	print("You can use a ^3|^7 to start the right-aligned fields.\n");
-	
+
 	print("^3name^7 or ^3nick^7             Name of a player\n");
 	print("^3ping^7                     Ping time\n\n");
 	print("^3kd^7 or ^3kdr^7 or ^3kdratio^7 or ^3k/d\n");
@@ -437,8 +458,8 @@
 			argc = tokenizebyseparator(strcat("x ", s), " ");
 		}
 	}
-		
-	
+
+
 	sbar_num_fields = 0;
 
 	drawfont = sbar_font;
@@ -622,7 +643,7 @@
 			tmp = max(0, min(220, stof(str)-80)) / 220;
 			sbar_field_rgb = '1 1 1' - '0 1 1'*tmp;
 			return str;
-		
+
 		case SP_PL:
 			if not(pl.gotscores)
 				return "N/A";
@@ -632,7 +653,7 @@
 			tmp = bound(0, stof(str), 20) / 20; // 20% is REALLY BAD pl
 			sbar_field_rgb = '1 0.5 0.5' - '0 0.5 0.5'*tmp;
 			return str;
-		
+
 		case SP_NAME:
 			if(ready_waiting && pl.ready)
 			{
@@ -668,12 +689,12 @@
 				str = ftos(num/denom);
 			} else
 				str = ftos(num/denom);
-		
+
 			tmp = strstrofs(str, ".", 0);
 			if(tmp > 0)
 				str = substring(str, 0, tmp+2);
 			return str;
-			
+
 		default:
 			tmp = pl.(scores[field]);
 			f = scores_flags[field];
@@ -720,7 +741,7 @@
 	}
 	else
 		sbar_fixscoreboardcolumnwidth_len = stringwidth(str, FALSE);
-	
+
 	sbar_fixscoreboardcolumnwidth_iconlen = 0;
 
 	if(sbar_field_icon0 != "")
@@ -776,9 +797,9 @@
 		tmp_x = sbwidth;
 		tmp_y = sbar_fontsize_y;
 		drawfill(pos - '1 1 0', tmp + '2 2 0', '1 1 1', 0.3, DRAWFLAG_NORMAL);
-	}	
+	}
 	tmp_y = 0;
-	
+
 	for(i = 0; i < sbar_num_fields; ++i)
 	{
 		field = sbar_field[i];
@@ -810,7 +831,7 @@
 		if(sbar_field_icon2 != "")
 			drawpic(pos - tmp, sbar_field_icon2, '0 1 0' * sbar_fontsize_y + '1 0 0' * sbar_fontsize_x * sbar_fixscoreboardcolumnwidth_iconlen, sbar_field_icon2_rgb, sbar_field_icon2_alpha, 0);
 	}
-	
+
 	if(sbar_field[i] == SP_SEPARATOR)
 	{
 		pos_x = xmax;
@@ -819,12 +840,12 @@
 			field = sbar_field[i];
 			if(field == SP_SEPARATOR)
 				break;
-			
+
 			if(is_spec && field != SP_NAME && field != SP_PING) {
 				pos_x -= sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
 				continue;
 			}
-			
+
 			str = Sbar_GetField(pl, field);
 			str = Sbar_FixScoreboardColumnWidth(i, str);
 
@@ -893,7 +914,7 @@
 	tmp_x = sbwidth;
 	tmp_y = sbar_fontsize_y;
 	drawfill(pos - '1 1 0', tmp + '2 2 0', '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
-	
+
 	drawfont = sbar_font;
 
 	for(i = 0; i < sbar_num_fields; ++i)
@@ -903,7 +924,7 @@
 		drawstring(pos, sbar_title[i], sbar_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
 		pos_x += sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
 	}
-	
+
 	if(sbar_field[i] == SP_SEPARATOR)
 	{
 		pos_x = xmax + sbar_fontsize_x;
@@ -925,13 +946,13 @@
 			drawstring(pos + tmp, sbar_title[i], sbar_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
 		}
 	}
-		
+
 	pos_x = xmin;
 	pos_y += 1.5 * sbar_fontsize_y;
 
 	sbar_save = sbar;
 	sbar = '0 0 0';
-	
+
 	if(teamplay)
 	{
 		//for(tm = sortedTeams.sort_next; tm; tm = tm.sort_next)
@@ -948,16 +969,16 @@
 
 			if(ts_primary != ts_secondary)
 			Sbar_DrawXNum(sbar + pos - '4.5 0 0' * sbar_fontsize_y + '0 1.5 0' * sbar_fontsize_y, tm.(teamscores[ts_secondary]), 4, sbar_fontsize_y * 1, rgb, 0, 1, DRAWFLAG_NORMAL);
-			
+
 			specs = tm.team_size;
 
 			if(specs < 2)
 				specs = 2;
-			
+
 			tmp_x = sbwidth;
 			tmp_y = 1.25 * sbar_fontsize_y * specs;
 			drawfill(pos - '1 1 0', tmp + '2 0 0', rgb, 0.2, DRAWFLAG_NORMAL);
-			
+
 			for(pl = players.sort_next; pl; pl = pl.sort_next)
 			{
 				if(pl.team != tm.team)
@@ -980,7 +1001,7 @@
 			pos += '0 1.25 0' * sbar_fontsize_y;
 			++specs;
 		}
-			
+
 		if(specs)
 			drawstring(rgb, "Spectators", sbar_fontsize, '1 1 1', 1, 0);
 	} else {
@@ -1006,7 +1027,7 @@
 			pos += '0 1.25 0' * sbar_fontsize_y;
 			++specs;
 		}
-			
+
 		if(specs)
 			drawstring(rgb, "Spectators", sbar_fontsize, '1 1 1', 1, 0);
 	}
@@ -1051,11 +1072,11 @@
 			}
 		}
 	}
-	
 
+
 	pos_y += 1.2 * sbar_fontsize_y;
 	drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - sbar_fontsize_x * stringwidth(str, TRUE)), str, sbar_fontsize, 0.8, 0);
-	
+
 	sbar = sbar_save;
 	scoreboard_bottom = pos_y + 2 * sbar_fontsize_y;
 }
@@ -1112,7 +1133,7 @@
 		cpname = strcat("Intermediate ", ftos(cp));
 	else
 		cpname = "Finish line";
-	
+
 	if(histime < 0)
 		return strcat(col, cpname);
 	else if(hisname == "")
@@ -1127,17 +1148,17 @@
 	vector sbar_save, place, timer_color, offset;
 	entity tm, pl, me;
 	sbar_save = sbar;
-	
+
  	vector bottomright;
  	bottomright_x = vid_conwidth;
  	bottomright_y = vid_conheight;
  	bottomright_z = 0;
- 	
+
  	vector topright;
  	topright_x = vid_conwidth;
  	topright_y = 0;
  	topright_z = 0;
- 	
+
  	sbar_alpha_bg = cvar("sbar_alpha_bg");
 	//get the ID (could be "me", or the player I'm spectating)
 	desiredPlayerId = player_localentnum - 1;
@@ -1146,12 +1167,12 @@
 			desiredPlayerId = spectatee_status - 1;
 		}
 	}
-	
+
 	myteam = GetPlayerColor(desiredPlayerId);
 
 	sbar_y = vid_conheight - (32+12);
 	sbar_x -= margin;
-	
+
 	offset = '0 0 0';
 	place_z = 0;
 	if(teamplay)
@@ -1165,13 +1186,13 @@
 		if (cvar("vid_conwidth") >= 800) {
 			place_x = 196;
 			place_y = 36;
-			
+
 		}
 		else {
 			place_x = 196;
 			place_y = 86;
 		}
-		
+
 		float max_fragcount;
 		max_fragcount = -999;
 
@@ -1181,12 +1202,12 @@
 				continue;
 			// -32*4 = -128
 			score = tm.(teamscores[ts_primary]);
-			
+
 			if (score > max_fragcount)
 				max_fragcount = score;
-				
+
 			if(tm.team == myteam) {
-				if (max_fragcount == score) 
+				if (max_fragcount == score)
 					Sbar_DrawXNum(bottomright - element_offset - place, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 1, 1, DRAWFLAG_NORMAL);
 				else
 					Sbar_DrawXNum(bottomright - element_offset - place, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 0, 1, DRAWFLAG_NORMAL);
@@ -1202,7 +1223,7 @@
 		}
 	} else {
 		// me vector := [team/connected frags id]
-		
+
 		myplace = 0;
 		for(me = players.sort_next; me; me = me.sort_next)
 		{
@@ -1211,11 +1232,11 @@
 			if(me.sv_entnum == desiredPlayerId)
 				break;
 		}
-		
+
 		pl = players.sort_next;
 		if(pl == me)
 			pl = pl.sort_next;
-		
+
 		if(pl) {
 			distribution = me.(scores[ps_primary]);
 			distribution -= pl.(scores[ps_primary]);
@@ -1225,40 +1246,40 @@
 		if (cvar("vid_conwidth") >= 800) {
 			place_x = 196;
 			place_y = 36;
-			
+
 		}
 		else { // move the scores if vid_conwidth < 800
 			place_x = 196;
 			place_y = 86;
 		}
 		score = me.(scores[ps_primary]);
-		
+
 		if(distribution >= 0)
 		{
-			if (distribution != 0) { 
+			if (distribution != 0) {
 				// draw a + sign in front of the score
 				if (distribution < 10) { drawpic(bottomright - element_offset - place + '132 -5 0' + '32 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); }
 				else if (distribution < 100) { drawpic(bottomright - element_offset - place + '132 -5 0' + '16 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); }
 				else if (distribution < 1000) { drawpic(bottomright - element_offset - place + '132 -5 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); }
 			}
-				
+
 			Sbar_DrawXNum(bottomright - element_offset - place + '132 -6 0', distribution, 4, 16, ' 1 1 1', 0, 1, DRAWFLAG_NORMAL);
 			Sbar_DrawXNum(bottomright - element_offset - place, score, 4, 34, '1 1 1', 1, 1, DRAWFLAG_NORMAL);
-		}	
+		}
 		else if(distribution >= -5)
 		{
 			Sbar_DrawXNum(bottomright - element_offset - place + '132 -6 0', distribution, 4, 16, ' 1 1 0', 0, 1, DRAWFLAG_NORMAL);
 			Sbar_DrawXNum(bottomright - element_offset - place, score, 4, 34, '1 1 0', 0, 1, DRAWFLAG_NORMAL);
-		} 
+		}
 		else {
 			Sbar_DrawXNum(bottomright - element_offset - place + '132 -6 0', distribution, 4, 16, ' 1 0 0', 0, 1, DRAWFLAG_NORMAL);
 			Sbar_DrawXNum(bottomright - element_offset - place, score, 4, 34, '1 0 0', 0, 1, DRAWFLAG_NORMAL);
 		}
 	}
-	
+
 	//draw the remaining or elapsed time
 	timelimit = getstatf(STAT_TIMELIMIT);
-	
+
 	vector bgpos;
 	if(timelimit > 0)
 	{
@@ -1266,7 +1287,7 @@
 		timeleft = ceil(timeleft);
 		minutesLeft = floor(timeleft / 60);
 		secondsLeft = timeleft - minutesLeft*60;
-		
+
 		if(minutesLeft >= 5) {
 			timer_color = '1 1 1'; //white
 		} else if(minutesLeft >= 1) {
@@ -1274,11 +1295,11 @@
 		} else {
 			timer_color = '1 0 0'; //red
 		}
-		
+
 		if (warmup_stage) {
 			timer_color = '1 1 1'; //don't use red or yellow for timer during warmup
 		}
-		
+
 		if (cvar("sbar_increment_maptime")) {
 			if (time < getstatf(STAT_GAMESTARTTIME)) {
 				//while restart is still active, show negative counter
@@ -1294,18 +1315,18 @@
 			minutes = minutesLeft;
 			seconds = secondsLeft;
 		}
-		
+
 		if (minutes == 0)
 			bgpos_x = topright_x - 36 - 7 - 12;
 		else if (minutes < 10) // nudge the timer background left if more digits are drawn
 			bgpos_x = topright_x - 54 - 17 - 12;
-		else if (minutes < 100)	
+		else if (minutes < 100)
 			bgpos_x = topright_x - 72 - 17 - 12;
 		else
 			bgpos_x = topright_x - 90 - 17 - 12;
 		bgpos_y = 0;
 		bgpos_z = 0;
-		
+
 		if (cvar("viewsize") <= 100) { // draw timer background when viewsize <= 100
 			if (teamplay)
 				drawpic(bgpos, "gfx/hud/sb_timerbg", '120 30 0', GetTeamRGB(myteam) * cvar("sbar_color_bg_team"), sbar_alpha_bg, 0); // timer bg color = myteam color
@@ -1313,11 +1334,11 @@
 				color_x = cvar("sbar_color_bg_r");
 				color_y = cvar("sbar_color_bg_g");
 				color_z = cvar("sbar_color_bg_b");
-				
+
 				drawpic(bgpos, "gfx/hud/sb_timerbg", '120 30 0', color, sbar_alpha_bg, 0);
 			}
 		}
-		
+
 		if(minutesLeft >= 1 || (cvar("sbar_increment_maptime") && minutes >= 1) ) {
 			Sbar_DrawXNum(topright - '103 0 0', minutes, 3, 18, timer_color, 0, sbar_alpha_fg, 0);
 			drawpic(topright - '53 0 0', "gfx/hud/num_colon", '18 18 0', timer_color, sbar_alpha_fg, 0);
@@ -1328,8 +1349,8 @@
 		timer_color = '1 1 1'; //white
 		minutes = floor(time / 60);
 		seconds = floor(time - minutes*60);
-		
-		if (minutes < 10) 
+
+		if (minutes < 10)
 			bgpos_x = topright_x - 54 - 17 - 12;
 		else if (minutes < 100)	// nudge the timer background left if more digits are drawn
 			bgpos_x = topright_x - 72 - 17 - 12;
@@ -1337,7 +1358,7 @@
 			bgpos_x = topright_x - 90 - 17 - 12;
 		bgpos_y = 0;
 		bgpos_z = 0;
-		
+
 		if (cvar("viewsize") <= 100) { // draw timer background when viewsize <= 100
 			if (teamplay)
 				drawpic(bgpos, "gfx/hud/sb_timerbg", '120 30 0', GetTeamRGB(myteam), sbar_alpha_bg, 0); // timer bg color = myteam color
@@ -1345,11 +1366,11 @@
 				color_x = cvar("sbar_color_bg_r");
 				color_y = cvar("sbar_color_bg_g");
 				color_z = cvar("sbar_color_bg_b");
-				
+
 				drawpic(bgpos, "gfx/hud/sb_timerbg", '120 30 0', color, sbar_alpha_bg, 0);
 			}
 		}
-		
+
 		Sbar_DrawXNum(topright - '103 0 0', minutes, 3, 18, timer_color, 0, 1, DRAWFLAG_NORMAL);
 		drawpic(topright - '53 0 0', "gfx/hud/num_colon", '18 18 0', timer_color, sbar_alpha_fg, 0);
 		Sbar_DrawXNum(topright - '36 0 0' - '3 0 0', seconds, -2, 18, timer_color, 0, 1, DRAWFLAG_NORMAL);
@@ -1463,10 +1484,10 @@
 		if not(stat_items & IT_INVINCIBLE)
 			return;
 	*/
-	
+
 	if (getstati(STAT_HEALTH) <= 0)
 		return;
-	
+
 	vector picsize;
 	float strength_time, invincibility_time, countdown_fontsize;
 
@@ -1524,8 +1545,8 @@
 }
 
 #define CENTERPRINT_MAX_LINES 30
-string centerprint_messages[CENTERPRINT_MAX_LINES]; 
-float centerprint_width[CENTERPRINT_MAX_LINES]; 
+string centerprint_messages[CENTERPRINT_MAX_LINES];
+float centerprint_width[CENTERPRINT_MAX_LINES];
 vector centerprint_start;
 float centerprint_expire;
 float centerprint_num;
@@ -1543,7 +1564,7 @@
 
 	if(cvar("scr_centertime") <= 0)
 		return;
-	
+
 	if(strMessage == "")
 		return;
 
@@ -1552,7 +1573,7 @@
 	while(substring(strMessage, j, 1) == "\n" && j >= 0)
 		j = j - 1;
 	strMessage = substring(strMessage, 0, j + 1);
-	
+
 	if(strMessage == "")
 		return;
 
@@ -1568,7 +1589,7 @@
 
 	// if we get here, we have a message. Initialize its height.
 	centerprint_num = 0;
-	
+
 	n = tokenizebyseparator(strMessage, "\n");
 	i = hcount = 0;
 	for(j = 0; j < n; ++j)
@@ -1676,14 +1697,14 @@
 
 	//if(time > centerprint_expire)
 	//	return;
-	
+
 	//a = bound(0, 1 - 2 * (time - centerprint_expire), 1);
 	a = bound(0, 1 - 4 * (time - centerprint_expire), 1);
 	//sz = 1.2 / (a + 0.2);
 
 	if(a <= 0)
 		return;
-	
+
 	pos = centerprint_start;
 	for (i=0; i<centerprint_num; i = i + 1)
 	{
@@ -1719,7 +1740,7 @@
 {
 	vector pos, bgsize;
 	float pressedkeys;
-	
+
 	pos = stov(cvar_string("cl_showpressedkeys_position"));
 
 	bgsize = '126 75 0';
@@ -1727,7 +1748,7 @@
 	pos = '1 0 0' * (vid_conwidth - bgsize_x) * pos_x
 	    + '0 1 0' * (vid_conheight - bgsize_y) * pos_y;
 	pos -= '-15 -6 0'; // adjust to the origin of these numbers
-	
+
 	pressedkeys = getstatf(STAT_PRESSED_KEYS);
 	drawpic(pos + '-15   -6   0', "gfx/hud/keys/key_bg.tga",           bgsize, '1 1 1', .1, DRAWFLAG_NORMAL);
 	drawpic(pos + ' 83.5  9   0', ((pressedkeys & KEY_CROUCH) ? "gfx/hud/keys/key_crouch_inv.tga" : "gfx/hud/keys/key_crouch.tga"), ' 24 24 0', '1 1 1', 1, DRAWFLAG_NORMAL);
@@ -1738,6 +1759,179 @@
 	drawpic(pos + ' 65   32   0', ((pressedkeys & KEY_RIGHT) ? "gfx/hud/keys/key_right_inv.tga" : "gfx/hud/keys/key_right.tga"),    ' 32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
 }
 
+void Sbar_DrawStats()
+{
+	float i, count_hitscan, count_splash, row;  // count is the number of 'colums'
+	float weapon_hit, weapon_damage, weapon_stats;
+	float left_border;  // position where the weapons start, the description is in the border
+	vector fill_colour, fill_size;
+	vector pos;
+
+	float col_margin = 20;  // pixels between the columns
+	float row_margin = 20;  // pixels between the rows
+	float top_border;  // position where the first row starts: pixels down the screen
+
+	fill_size_x = 5 * sbar_fontsize_x;  // width of the background
+	fill_size_y = 10 * sbar_fontsize_y;  // height of the background
+
+	// 45 pixels is the same as the 'Scoreboard' heading
+	drawfont = sbar_bigfont;
+	drawstringcenter('0 45 0', "Weapon Accuracy", 2 * sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+	left_border = col_margin + 11 * sbar_fontsize_x;
+
+	top_border = 80;
+	Sbar_DrawStats_Description_Hitscan('1 0 0' * col_margin + '0 1 0' * top_border);
+
+	top_border = 220;
+	Sbar_DrawStats_Description_Splash('1 0 0' * col_margin + '0 1 0' * top_border);
+
+
+	for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+	{
+		weapon_hit = weapon_hits[i];
+		weapon_damage = weapon_fired[i];
+		self = get_weaponinfo(i);
+
+		//if ((weapon_number != 42))  // print them all :)
+ 		if ((self.weapon_type == WEP_TYPE_SPLASH) && (weapon_damage))
+		{
+			top_border = 220;
+			weapon_stats = rint(100 * weapon_hit / weapon_damage);
+
+			fill_colour_x = 1 - 0.015 * weapon_stats;
+			fill_colour_y = 1 - 0.015 * (100 - weapon_stats);
+
+// 			how the background colour is calculated
+// 			%	red	green	red_2		green_2
+// 			0	1	0	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			10	0.85	0	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			20	0.70	0	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			30	0.55	0	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			40	0.40	0.10	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			50	0.25	0.25	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			60	0.10	0.40	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			70	0	0.55	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			80	0	0.70	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			90	0	0.85	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			100	0	1	1 - % * 0.015	1 - (100 - %) * 0.015
+
+			if ((left_border + count_splash * (fill_size_x + col_margin) + fill_size_x) >= vid_conwidth)
+			{
+				count_splash = 0;
+				++row;
+				Sbar_DrawStats_Description_Splash('1 0 0' * col_margin + '0 1 0' * (top_border + row * (fill_size_y + row_margin)));
+			}
+
+			pos_x = left_border + count_splash * (fill_size_x + col_margin);
+			pos_y = top_border + row * (fill_size_y + row_margin);
+
+			// background
+			drawfill(pos, fill_size , fill_colour, 0.4 * sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the weapon
+			drawpic(pos, strcat("gfx/inv_weapon", ftos(i-1)), '1 0.5 0' * fill_size_x , '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the amount of shots fired or max damage
+			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 3 0' * sbar_fontsize_y, ftos(weapon_damage), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the amount of hits or actual damage
+			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 5 0' * sbar_fontsize_y, ftos(weapon_hit), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the accuracy
+			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 7 0' * sbar_fontsize_y, strcat(ftos(weapon_stats),"%"), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the amount of shots missed or damage wasted
+			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 9 0' * sbar_fontsize_y, ftos(weapon_damage - weapon_hit), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			++count_splash;
+		}
+		else if ((self.weapon_type == WEP_TYPE_HITSCAN) && (weapon_damage))
+		{
+			top_border = 80;
+			weapon_stats = rint(100 * weapon_hit / weapon_damage);
+
+			fill_colour_x = 1 - 0.015 * weapon_stats;
+			fill_colour_y = 1 - 0.015 * (100 - weapon_stats);
+
+// 			how the background colour is calculated
+// 			%	red	green	red_2		green_2
+// 			0	1	0	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			10	0.85	0	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			20	0.70	0	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			30	0.55	0	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			40	0.40	0.10	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			50	0.25	0.25	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			60	0.10	0.40	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			70	0	0.55	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			80	0	0.70	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			90	0	0.85	1 - % * 0.015	1 - (100 - %) * 0.015
+// 			100	0	1	1 - % * 0.015	1 - (100 - %) * 0.015
+
+			if ((left_border + count_hitscan * (fill_size_x + col_margin) + fill_size_x + cvar("stats_right_margin")) >= vid_conwidth)
+			{
+				count_hitscan = 0;
+				++row;
+				Sbar_DrawStats_Description_Hitscan('1 0 0' * col_margin + '0 1 0' * (top_border + row * (fill_size_y + row_margin)));
+			}
+
+			pos_x = left_border + count_hitscan * (fill_size_x + col_margin);
+			pos_y = top_border + row * (fill_size_y + row_margin);
+
+			// background
+			drawfill(pos, fill_size , fill_colour, 0.4 * sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the weapon
+			drawpic(pos, strcat("gfx/inv_weapon", ftos(i-1)), '1 0.5 0' * fill_size_x , '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the amount of shots fired or max damage
+			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 3 0' * sbar_fontsize_y, ftos(weapon_damage), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the amount of hits or actual damage
+			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 5 0' * sbar_fontsize_y, ftos(weapon_hit), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the accuracy
+			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 7 0' * sbar_fontsize_y, strcat(ftos(weapon_stats),"%"), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			// the amount of shots missed or damage wasted
+			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 9 0' * sbar_fontsize_y, ftos(weapon_damage - weapon_hit), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+
+			++count_hitscan;
+		}
+	}
+}
+
+void Sbar_DrawStats_Description_Hitscan(vector position)
+{
+	drawfont = sbar_font;
+	 // hitscan stats
+	drawstring(position + '0 3 0' * sbar_fontsize_y, "Shots fired:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+	drawstring(position + '0 5 0' * sbar_fontsize_y, "Shots hit:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+	drawstring(position + '0 7 0' * sbar_fontsize_y, "Accuracy:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+	drawstring(position + '0 9 0' * sbar_fontsize_y, "Shots missed:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+}
+
+void Sbar_DrawStats_Description_Splash(vector position)
+{
+	//splash stats
+	drawfont = sbar_font;
+	drawstring(position + '0 3 0' * sbar_fontsize_y, "Maximum damage:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+	drawstring(position + '0 5 0' * sbar_fontsize_y, "Actual damage:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+	drawstring(position + '0 7 0' * sbar_fontsize_y, "Accuracy:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+	drawstring(position + '0 9 0' * sbar_fontsize_y, "Damage wasted:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+}
+
+void drawstringright(vector position, string text, vector scale, vector rgb, float alpha, float flag)
+{
+	position_x -= 2 / 3 * strlen(text) * scale_x;
+	drawstring(position, text, scale, rgb, alpha, flag);
+}
+
+void drawstringcenter(vector position, string text, vector scale, vector rgb, float alpha, float flag)
+{
+	position_x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * scale_x);
+	drawstring(position, text, scale, rgb, alpha, flag);
+}
+
 float GetAmmoStat(float i)
 {
 	switch(i)
@@ -1785,7 +1979,7 @@
 	vector bottom;
 	vector bottomright;
 	vector bottomleft;
-	
+
 	topright_x = vid_conwidth;
 	topright_y = 0;
 	topright_z = 0;
@@ -1793,7 +1987,7 @@
 	bottom_x = vid_conwidth/2;
 	bottom_y = vid_conheight;
 	bottom_z = 0;
-	
+
 	bottomright_x = vid_conwidth;
 	bottomright_y = vid_conheight;
 	bottomright_z = 0;
@@ -1801,20 +1995,29 @@
 	bottomleft_x = 0;
 	bottomleft_y = vid_conheight;
 	bottomleft_z = 0;
-	
+
 	sbar_alpha_bg = cvar("sbar_alpha_bg");
-	
+
 	float i;
+	float weapon_stats;
 	float x, fade;
 	float stat_items, stat_weapons;
-	
+
+	weapon_stats = getstati(STAT_DAMAGE_HITS);
+ 	weapon_number = weapon_stats & 63;
+ 	weapon_hits[weapon_number] = rint(weapon_stats / 64);
+
+ 	weapon_stats = getstati(STAT_DAMAGE_FIRED);
+ 	weapon_number = weapon_stats & 63;
+ 	weapon_fired[weapon_number] = rint(weapon_stats / 64);
+
 	vector o; o = '1 0 0' * vid_conwidth;
 	o_y = 28; // move spectator text slightly down to prevent overlapping the timer
-	
+
 	string s;
 
 	sbar_fontsize = Sbar_GetFontsize("sbar_fontsize");
-	
+
 	if(spectatee_status && !intermission)
 	{
 		if(spectatee_status == -1)
@@ -1854,7 +2057,7 @@
 		else
 			s = strcat("^1Press ^3", getcommandkey("jump", "+jump"), "^1 to join");
 		o = Sbar_DrawNoteLine(o, s);
-		
+
 		//show restart countdown:
 		if (time < getstatf(STAT_GAMESTARTTIME)) {
 			float countdown;
@@ -1883,21 +2086,21 @@
 	{
 		if(ready_waiting_for_me)
 		{
-			if(warmup_stage) 
+			if(warmup_stage)
 				s = strcat(blinkcolor, "Press ^3", getcommandkey("ready", "ready"), blinkcolor, " to end warmup");
 			else
 				s = strcat(blinkcolor, "Press ^3", getcommandkey("ready", "ready"), blinkcolor, " once you are ready");
 		}
 		else
 		{
-			if(warmup_stage) 
+			if(warmup_stage)
 				s = strcat("^2Waiting for others to ready up to end warmup...");
 			else
 				s = strcat("^2Waiting for others to ready up...");
 		}
 		o = Sbar_DrawNoteLine(o, s);
 	}
-	else if(warmup_stage && !intermission) 
+	else if(warmup_stage && !intermission)
 	{
 		s = strcat("^2Press ^3", getcommandkey("ready", "ready"), "^2 to end warmup");
 		o = Sbar_DrawNoteLine(o, s);
@@ -1967,6 +2170,10 @@
 		Sbar_FinaleOverlay();
 		Sbar_DrawCenterPrint();
 	}
+	else if(sb_showaccuracy == 1)
+ 	{
+ 		Sbar_DrawStats();
+ 	}
 	else
 	{
 		if (sb_showscores_force || (getstati(STAT_HEALTH) <= 0 && cvar("cl_deathscoreboard")))
@@ -1984,7 +2191,7 @@
 				Sbar_DrawScoreboard();
 				Sbar_DrawCenterPrint();
 			}
-			
+
 			float armor, health;
 			armor = getstati(STAT_ARMOR);
 			health = getstati(STAT_HEALTH);
@@ -1994,21 +2201,21 @@
 
 			fade = 3.2 - 2 * (time - weapontime);
 			fade = bound(0.7, fade, 1);
-			
+
 			vector bg_size; // hud background size
 			bg_size_x = 800;
 			if (vid_conwidth > 800) // if conwidth > 800, resize the background image
 				bg_size_x = vid_conwidth;
 			bg_size_y = 58;
 			bg_size_z = 0;
-			
+
 			vector bgoffset; // hud background offset
 			bgoffset_x = 0;
 			bgoffset_y = 0;
 			bgoffset_z = 0;
 			if (vid_conwidth < 800) // if conwidth < 800 we need to offset the background image to keep it centered, as it will be scaled up
 				bgoffset_x = (vid_conwidth - 800) / 2;
-			
+
 			if (cvar("viewsize") <= 100) {
 				if (teamplay) {
 					//if (myteam == 13) // 13 = blue shirt color
@@ -2021,11 +2228,11 @@
 					color_x = cvar("sbar_color_bg_r");
 					color_y = cvar("sbar_color_bg_g");
 					color_z = cvar("sbar_color_bg_b");
-				
+
 					drawpic(bottomleft - '0 58 0' + bgoffset, "gfx/hud/sbar", bg_size, color, sbar_alpha_bg, 0);
 				}
 			}
-			
+
 			if(health != 0)
 			{
 				if(sbar_hudselector == 2) // combined health and armor display
@@ -2035,10 +2242,10 @@
 					healthdamage = (health - 1) / (1 - armorblockpercent); // damage we can take if we could use more health
 					armordamage = armor + (health - 1); // damage we can take if we could use more armor
 					armorideal = healthdamage * armorblockpercent;
-					
+
 					vector num_pos;
 					num_pos = bottom - element_offset - '0 24 0' + '-96 0 0';
-					
+
 					if(armordamage < healthdamage)
 					{
 						// here, armorideal > armor
@@ -2054,37 +2261,37 @@
 					}
 					Sbar_DrawXNum_Colored(num_pos, x, 24); // draw the combined health and armor
 				}
-				
+
 				else
 				{
 					vector health_pos, armor_pos;
-					
+
 					if (sbar_hudselector == 0) { // old style layout with armor left of health
 						health_pos = bottom - element_offset - '0 24 0' + '14 0 0';
 						armor_pos = bottom - element_offset - '0 24 0' + '-96 0 0';
 					}
-					
+
 					else {
 						health_pos = bottom - element_offset - '0 24 0' + '-96 0 0';
 						armor_pos = bottom - element_offset - '0 24 0' + '14 0 0';
 					}
-					
+
 					// armor
 					x = armor;
 					if (x > 0)
 					{
-						drawpic(armor_pos + '78 -3 0', "gfx/hud/sb_armor", '32 32 0', '1 1 1', sbar_alpha_fg, 0);	
-						
+						drawpic(armor_pos + '78 -3 0', "gfx/hud/sb_armor", '32 32 0', '1 1 1', sbar_alpha_fg, 0);
+
 						Sbar_DrawXNum_Colored(armor_pos, x, 24);
 					}
-					
+
 					// health
 					x = health;
 					drawpic(health_pos + '78 -3 0', "gfx/hud/sb_health", '32 32 0', '1 1 1', sbar_alpha_fg, 0);
-					
+
 					Sbar_DrawXNum_Colored(health_pos, x, 24);
 				}
-				
+
 				// weapon icons
 				x = 1.0;
 				Sbar_DrawWeapon_Clear();
@@ -2093,19 +2300,19 @@
 					if(weaponimpulse[i-1] >= 0)
 					if(stat_weapons & x)
 					{
-						Sbar_DrawWeapon(i-1, fade, (i == activeweapon));
+						Sbar_DrawWeapon(i-1, fade, (i == activeweapon), i);
 					}
 					x *= 2;
 				}
-				
+
 				// ammo
 				float a; // i will be the ammo type (already declared), a will contain how much ammo there is of type i
 				vector pos;
 				pos_z = 0;
-				
+
 				for (i = 0; i < 4; ++i) {
-					a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i? 
-					
+					a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i?
+
 					if (a > 0) {
 						pos = '0 0 0';
 						if (cvar("vid_conwidth") >= 800)
@@ -2122,7 +2329,7 @@
 								case 2: pos_x = vid_conwidth - 84; pos_y = -150; break; // rockets
 								case 3: pos_x = vid_conwidth - 84; pos_y = -128; break; // cells
 							}
-							
+
 						if (stat_items & GetAmmoItemCode(i))
 							drawpic(bottomleft + pos + '0 1.5 0', "gfx/hud/sb_ammobg", '80 22 0', '1 1 1', sbar_alpha_fg, 0);
 						drawpic(bottomleft + pos + '56 3 0', GetAmmoPicture(i), '18 18 0', '1 1 1', sbar_alpha_fg, 0);
@@ -2132,10 +2339,10 @@
 							Sbar_DrawXNum(bottomleft + pos + '6 4 0', a, 3, 16, '0.7 0 0', 0, 1, 0);
 					}
 				}
-					
+
 				// fuel ammo
-				a = getstati(GetAmmoStat(4)); // how much fuel do we have? 
-				
+				a = getstati(GetAmmoStat(4)); // how much fuel do we have?
+
 				if (a > 0) { // if we have fuel, draw the amount
 					float invincibility_time, dt;
 					invincibility_time = getstatf(STAT_INVINCIBLE_FINISHED);
@@ -2154,11 +2361,11 @@
 					else
 						Sbar_DrawXNum(pos, a, 3, 16, '0.7 0 0', 0, 1, 0);
 				}
-				
+
 				// draw scores and timer
-				Sbar_Score(16); 
+				Sbar_Score(16);
 			}
-			
+
 			//show strength/invincibility ICON and timer:
 			CSQC_Strength_Timer();
 
@@ -2186,11 +2393,11 @@
 
 	float redflag, blueflag;
 	float stat_items;
-	
+
 	stat_items = getstati(STAT_ITEMS);
 	redflag = (stat_items/IT_RED_FLAG_TAKEN) & 3;
 	blueflag = (stat_items/IT_BLUE_FLAG_TAKEN) & 3;
-	
+
 	if (myteam == COLOR_TEAM1) { // always draw own flag on left
 		switch(redflag)
 		{
@@ -2214,7 +2421,7 @@
 					drawpic(bottomleft - element_offset - '-72 36 0', "gfx/hud/sb_flag_blue_shielded", '48 48 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); break;
 		}
 	}
-	
+
 	else {
 		switch(blueflag)
 		{
@@ -2226,7 +2433,7 @@
 				if(myteam == COLOR_TEAM1)
 					drawpic(bottomleft - element_offset - '-4 36 0', "gfx/hud/sb_flag_blue_shielded", '48 48 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); break;
 		}
-		
+
 		switch(redflag)
 		{
 		case 1: drawpic(bottomleft - element_offset - '-72 36 0', "gfx/hud/sb_flag_red_taken", '48 48 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); break;
@@ -2245,7 +2452,7 @@
 {
 	float kh_keys, kh_keys_status, kh_teams_set;
 	vector red_pos, blue_pos, yellow_pos, pink_pos, kh_size;
-	
+
 	vector bottomleft;
 	bottomleft_x = 0;
 	bottomleft_y = vid_conheight;
@@ -2254,15 +2461,15 @@
 	red_pos_x = 6;
 	red_pos_y = vid_conheight - 35 - 6;
 	red_pos_z = 0;
-	
+
 	blue_pos_x = 6 + (24 * 1);
 	blue_pos_y = vid_conheight - 35 - 6;
 	blue_pos_z = 0;
-	
+
 	yellow_pos_x = 6 + (24 * 2);
 	yellow_pos_y = vid_conheight - 35 - 6;
 	yellow_pos_z = 0;
-	
+
 	pink_pos_x = 6 + (24 * 3);
 	pink_pos_y = vid_conheight - 35 - 6;
 	pink_pos_z = 0;
@@ -2314,10 +2521,10 @@
 {
 	float stat_items, nb_pb_starttime, dt, p;
 	vector pos;
-	
+
 	stat_items = getstati(STAT_ITEMS);
 	nb_pb_starttime = getstatf(STAT_NB_METERSTART);
-	
+
 	pos_x = 4;
 	pos_y = vid_conheight - 42;
 	pos_z = 0;
@@ -2343,10 +2550,10 @@
 		drawline(NBPB_BT, pos + s, pos + '1 0 0' * s_x, NBPB_BRGB, NBPB_BALPH, NBPB_BFLAG);
 		drawline(NBPB_BT, pos + s, pos + '0 1 0' * s_y, NBPB_BRGB, NBPB_BALPH, NBPB_BFLAG);
 	}
-	
+
 	pos_x += 12; //horizontal margin to the picture
 	pos_y += 2; //vertical margin to the picture
-	
+
 	if (stat_items & IT_KEY1)
 		drawpic(pos, "gfx/hud/sb_nexball_carrying", '80 34 0', '1 1 1', 1, DRAWFLAG_NORMAL);
 }

Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/common/constants.qh	2009-06-11 03:58:12 UTC (rev 6975)
@@ -47,7 +47,7 @@
 const float TE_CSQC_RACE = 101;
 const float TE_CSQC_SPAWN = 102;
 const float TE_CSQC_ZCURVEPARTICLES = 103;
-const float TE_CSQC_NEXGUNBEAMPARTICLE = 104;
+const float TE_CSQC_NEXGUNBEAMPARTICLE = 104;
 const float TE_CSQC_LIGHTNINGARC = 105;
 
 const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
@@ -247,6 +247,8 @@
 const float STAT_GAMESTARTTIME = 37;
 const float STAT_STRENGTH_FINISHED = 38;
 const float STAT_INVINCIBLE_FINISHED = 39;
+const float STAT_DAMAGE_HITS = 40; // Used by the weapon stats code, represents the total amount of damage done to other players
+const float STAT_DAMAGE_FIRED = 41;// Used by the weapon stats code, represents the total amount of potential damage fired
 const float STAT_PRESSED_KEYS = 42;
 const float STAT_ALLOW_OLDNEXBEAM = 43; // this stat could later contain some other bits of info, like, more server-side particle config
 const float STAT_FUEL = 44;

Modified: trunk/data/qcsrc/common/items.qc
===================================================================
--- trunk/data/qcsrc/common/items.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/common/items.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -2,7 +2,7 @@
 entity weapon_info[24];
 entity dummy_weapon_info;
 
-void register_weapon_real(float id, float(float) func, float ammotype, float i, float normalweapon, float canclimb, float pickupbasevalue, string modelname, string shortname, string wname)
+void register_weapon_real(float id, float(float) func, float ammotype, float i, float normalweapon, float canclimb, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname)
 {
 	entity e;
 	weapon_info[id - 1] = e = spawn();
@@ -24,6 +24,7 @@
 	if(canclimb)
 		e.spawnflags |= WEPSPAWNFLAG_CANCLIMB;
 	e.impulse = i;
+	e.weapon_type = weapontype;
 	e.bot_pickupbasevalue = pickupbasevalue;
 }
 float w_null(float dummy)
@@ -45,6 +46,7 @@
 	dummy_weapon_info.model = "";
 	dummy_weapon_info.spawnflags = 0;
 	dummy_weapon_info.impulse = -1;
+	dummy_weapon_info.weapon_type = WEP_TYPE_OTHER;
 	dummy_weapon_info.bot_pickupbasevalue = 0;
 	dummy_weapon_info.model2 = "";
 
@@ -89,33 +91,33 @@
 }
 
 #ifdef SVQC
-#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname) \
-	register_weapon_real(id,func,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname)
+#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
+	register_weapon_real(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname)
 #else
 // no weapon funcs here!
-#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname) \
-	register_weapon_real(id,w_null,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname)
+#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
+	register_weapon_real(id,w_null,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname)
 #endif
 
 void RegisterWeapons()
 {
 	// %weaponaddpoint
-	register_weapon(WEP_LASER,            w_laser,        0,                1,  1, 1, 0,                      "laser",        "laser",           "Laser");
-	register_weapon(WEP_SHOTGUN,          w_shotgun,      IT_SHELLS,        2,  1, 0, BOT_PICKUP_RATING_LOW,  "shotgun",      "shotgun",         "Shotgun");
-	register_weapon(WEP_UZI,              w_uzi,          IT_NAILS,         3,  1, 0, BOT_PICKUP_RATING_MID,  "uzi",          "uzi",             "Machine Gun");
-	register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher,    IT_ROCKETS,       4,  1, 1, BOT_PICKUP_RATING_MID,  "gl",           "grenadelauncher", "Mortar");
-	register_weapon(WEP_ELECTRO,          w_electro,      IT_CELLS,         5,  1, 0, BOT_PICKUP_RATING_MID,  "electro",      "electro",         "Electro");
-	register_weapon(WEP_CRYLINK,          w_crylink,      IT_CELLS,         6,  1, 0, BOT_PICKUP_RATING_MID,  "crylink",      "crylink",         "Crylink");
-	register_weapon(WEP_NEX,              w_nex,          IT_CELLS,         7,  1, 0, BOT_PICKUP_RATING_HIGH, "nex",          "nex",             "Nex");
-	register_weapon(WEP_HAGAR,            w_hagar,        IT_ROCKETS,       8,  1, 1, BOT_PICKUP_RATING_MID,  "hagar",        "hagar",           "Hagar");
-	register_weapon(WEP_ROCKET_LAUNCHER,  w_rlauncher,    IT_ROCKETS,       9,  1, 1, BOT_PICKUP_RATING_HIGH, "rl",           "rocketlauncher",  "Rocket Launcher");
-	register_weapon(WEP_PORTO,            w_porto,        0,                0,  0, 0, 0,                      "porto" ,       "porto",           "Port-O-Launch");
-	register_weapon(WEP_MINSTANEX,        w_minstanex,    IT_CELLS,         7, -1, 1, BOT_PICKUP_RATING_HIGH, "minstanex",    "minstanex",       "MinstaNex");
-	register_weapon(WEP_HOOK,             w_hook,         IT_CELLS|IT_FUEL, 0,  0, 1, 0,                      "hookgun",      "hook",            "Grappling Hook");
-	register_weapon(WEP_SEEKER,           w_seeker,       IT_ROCKETS,       8,  0, 0, BOT_PICKUP_RATING_HIGH, "seeker",       "seeker",          "T.A.G. Seeker");
-	register_weapon(WEP_HLAC,             w_hlac,         IT_CELLS,         6,  1, 0, BOT_PICKUP_RATING_MID,  "hlac",         "hlac",            "Heavy Laser Assault Cannon");
-	register_weapon(WEP_CAMPINGRIFLE,     w_campingrifle, IT_NAILS,         3,  1, 0, BOT_PICKUP_RATING_MID,  "campingrifle", "campingrifle",    "Rifle");
-	register_weapon(WEP_TUBA,             w_tuba,         0,                1, -1, 0, BOT_PICKUP_RATING_MID,  "tuba",         "tuba",            "@!#%'n Tuba");
+	register_weapon(WEP_LASER,            w_laser,        0,                1,  1, 1, WEP_TYPE_SPLASH, 0,                      "laser",        "laser",           "Laser");
+	register_weapon(WEP_SHOTGUN,          w_shotgun,      IT_SHELLS,        2,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_LOW,  "shotgun",      "shotgun",         "Shotgun");
+	register_weapon(WEP_UZI,              w_uzi,          IT_NAILS,         3,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID,  "uzi",          "uzi",             "Machine Gun");
+	register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher,    IT_ROCKETS,       4,  1, 1, WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID,  "gl",           "grenadelauncher", "Mortar");
+	register_weapon(WEP_ELECTRO,          w_electro,      IT_CELLS,         5,  1, 0, WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID,  "electro",      "electro",         "Electro");
+	register_weapon(WEP_CRYLINK,          w_crylink,      IT_CELLS,         6,  1, 0, WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID,  "crylink",      "crylink",         "Crylink");
+	register_weapon(WEP_NEX,              w_nex,          IT_CELLS,         7,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "nex",          "nex",             "Nex");
+	register_weapon(WEP_HAGAR,            w_hagar,        IT_ROCKETS,       8,  1, 1, WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID,  "hagar",        "hagar",           "Hagar");
+	register_weapon(WEP_ROCKET_LAUNCHER,  w_rlauncher,    IT_ROCKETS,       9,  1, 1, WEP_TYPE_SPLASH, BOT_PICKUP_RATING_HIGH, "rl",           "rocketlauncher",  "Rocket Launcher");
+	register_weapon(WEP_PORTO,            w_porto,        0,                0,  0, 0, WEP_TYPE_OTHER, 0,                      "porto" ,       "porto",           "Port-O-Launch");
+	register_weapon(WEP_MINSTANEX,        w_minstanex,    IT_CELLS,         7, -1, 1, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "minstanex",    "minstanex",       "MinstaNex");
+	register_weapon(WEP_HOOK,             w_hook,         IT_CELLS|IT_FUEL, 0,  0, 1, WEP_TYPE_SPLASH, 0,                      "hookgun",      "hook",            "Grappling Hook");
+	register_weapon(WEP_SEEKER,           w_seeker,       IT_ROCKETS,       8,  0, 0, WEP_TYPE_SPLASH, BOT_PICKUP_RATING_HIGH, "seeker",       "seeker",          "T.A.G. Seeker");
+	register_weapon(WEP_HLAC,             w_hlac,         IT_CELLS,         6,  1, 0, WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID,  "hlac",         "hlac",            "Heavy Laser Assault Cannon");
+	register_weapon(WEP_CAMPINGRIFLE,     w_campingrifle, IT_NAILS,         3,  1, 0, WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID,  "campingrifle", "campingrifle",    "Rifle");
+	register_weapon(WEP_TUBA,             w_tuba,         0,                1, -1, 0, WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID,  "tuba",         "tuba",            "@!#%'n Tuba");
 
 	register_weapons_done();
 }

Modified: trunk/data/qcsrc/common/items.qh
===================================================================
--- trunk/data/qcsrc/common/items.qh	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/common/items.qh	2009-06-11 03:58:12 UTC (rev 6975)
@@ -24,6 +24,10 @@
 float BOT_PICKUP_RATING_MID	= 5000;
 float BOT_PICKUP_RATING_HIGH	= 10000;
 
+float WEP_TYPE_OTHER	= 0;	// e.g: Hook, Port-o-launch, etc
+float WEP_TYPE_SPLASH	= 1;
+float WEP_TYPE_HITSCAN	= 2;
+
 float	IT_UNLIMITED_WEAPON_AMMO  = 1;
 // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
 float	IT_UNLIMITED_SUPERWEAPONS = 2;
@@ -87,5 +91,6 @@
 .string model; // full name of g_ model
 .float spawnflags; // WEPSPAWNFLAG_... combined
 .float impulse; // weapon impulse
+.float weapon_type; // see WEP_TYPE_* constants
 .float bot_pickupbasevalue; // bot weapon priority
 .string model2; // wpn- sprite name

Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/bots.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -2679,7 +2679,7 @@
 		{
 			//navigation_testtracewalk = TRUE;
 			head = navigation_findnearestwaypoint(player, FALSE);
-			print("currently selected WP is ", etos(head), "\n");
+		//	print("currently selected WP is ", etos(head), "\n");
 			//navigation_testtracewalk = FALSE;
 			if (head)
 			{

Modified: trunk/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weaponsystem.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/cl_weaponsystem.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -126,7 +126,7 @@
 // this function calculates w_shotorg and w_shotdir based on the weapon model
 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
 // make sure you call makevectors first (FIXME?)
-void W_SetupShot_ProjectileSize(entity ent, vector mi, vector ma, float antilag, float recoil, string snd)
+void W_SetupShot_ProjectileSize(entity ent, vector mi, vector ma, float antilag, float recoil, string snd, float maxdamage)
 {
 	float nudge = 1; // added to traceline target and subtracted from result
 	local vector trueaimpoint;
@@ -136,6 +136,9 @@
 	ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
 	traceline(ent.origin + ent.view_ofs, ent.origin + ent.view_ofs + v_forward * MAX_SHOT_DISTANCE, MOVE_NOMONSTERS, ent); // no antilag needed
 	trueaimpoint = trace_endpos;
+	
+	self.max_damage[self.weapon] += maxdamage;
+	self.maxdamage_fired = self.weapon + 64 * rint(self.max_damage[self.weapon]);
 
 	W_HitPlotAnalysis(ent, v_forward, v_right, v_up);
 
@@ -294,9 +297,9 @@
 		sound (ent, CHAN_AUTO, "weapons/strength_fire.wav", VOL_BASE, ATTN_NORM);
 };
 
-void W_SetupShot(entity ent, float antilag, float recoil, string snd)
+void W_SetupShot(entity ent, float antilag, float recoil, string snd, float maxdamage)
 {
-	W_SetupShot_ProjectileSize(ent, '0 0 0', '0 0 0', antilag, recoil, snd);
+	W_SetupShot_ProjectileSize(ent, '0 0 0', '0 0 0', antilag, recoil, snd, maxdamage);
 }
 
 void LaserTarget_Think()

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/clientcommands.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -34,7 +34,7 @@
 		else
 			WriteString(MSG_ENTITY, "");
 	}
-	
+
 	if(nags & 1)
 	{
 		for(i = 1; i <= maxclients; i += 8)
@@ -335,7 +335,7 @@
 			// arguments:
 			//   effectname
 			effectnum = particleeffectnum(argv(1));
-			W_SetupShot(self, FALSE, FALSE, "");
+			W_SetupShot(self, FALSE, FALSE, "",0);
 			traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
 			trailparticles(self, effectnum, w_shotorg, trace_endpos);
 		}
@@ -347,7 +347,7 @@
 			// arguments:
 			//   modelname mode
 			f = stof(argv(2));
-			W_SetupShot(self, FALSE, FALSE, "");
+			W_SetupShot(self, FALSE, FALSE, "", 0);
 			traceline(w_shotorg, w_shotorg + w_shotdir * 2048, MOVE_NORMAL, self);
 			if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) || trace_fraction == 1)
 			{
@@ -431,7 +431,7 @@
 			else
 				self.nickspamcount += 1;
 			self.nickspamtime = time + cvar("g_nick_flood_penalty");
-			
+
 			if (timeoutStatus == 2) //when game is paused, no flood protection
 				self.nickspamcount = self.nickspamtime = 0;
 		}
@@ -456,10 +456,10 @@
 		newTL -= checkrules_overtimesadded * cvar("timelimit_overtime");
 		cvar_set("timelimit", ftos(newTL));
 	}
-	
+
 	checkrules_suddendeathend = checkrules_overtimesadded = checkrules_suddendeathwarning = 0;
-	
 
+
 	readyrestart_happened = 1;
 	game_starttime = time + RESTART_COUNTDOWN;
 	restart_mapalreadyrestarted = 0; //reset this var, needed when cvar sv_ready_restart_repeatable is in use
@@ -506,7 +506,7 @@
 	if(g_arena | g_assault | gameover | intermission_running | race_completing)
 		localcmd("restart\n");
 
-	// reset ALL scores, but only do that at the beginning 
+	// reset ALL scores, but only do that at the beginning
 	//of the countdown if sv_ready_restart_after_countdown is off!
 	//Otherwise scores could be manipulated during the countdown!
 	if (!cvar("sv_ready_restart_after_countdown"))

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/defs.qh	2009-06-11 03:58:12 UTC (rev 6975)
@@ -590,3 +590,5 @@
 string matchid;
 .float hitplotfh;
 .string noise4;
+
+.float damage_hits, maxdamage_fired;

Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/g_damage.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -576,7 +576,7 @@
         damage_inflictor = inflictor;
         damage_attacker = attacker;
 		attacker_save = attacker;
-	
+
 	if(targ.classname == "player")
 		if(targ.hook)
 			if(targ.hook.aiment)
@@ -921,6 +921,15 @@
 	return nearest;
 }
 
+.float actual_damage[WEP_COUNT]; //amount of damage done
+.float max_damage[WEP_COUNT]; //the maximum damage of the weapon
+
+FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(actual_damage);
+FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(max_damage);
+
+
+float RadiusDamage_EnemyDamageDone;
+float RadiusDamage_EnemyMaxDamage;
 float RadiusDamage_running;
 float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype, entity directhitentity)
 // Returns total damage applies to creatures
@@ -968,6 +977,9 @@
 			Damage_DamageInfo(blastorigin, coredamage, edgedamage, -rad, (-forceintensity) * force, deathtype);
 	}
 
+	RadiusDamage_EnemyDamageDone = 0;
+	RadiusDamage_EnemyMaxDamage = 0;
+
 	targ = findradius (blastorigin, rad);
 	while (targ)
 	{
@@ -1010,7 +1022,30 @@
 							    || cvar("g_throughfloor"))
 							{
 								if(targ.iscreature)
+								{
 									total_damage_to_creatures += finaldmg;
+
+									if(targ.flags & FL_CLIENT)
+									if(targ.deadflag == DEAD_NO)
+									if (targ != attacker)
+									{
+										if (!teamplay)
+										{
+											RadiusDamage_EnemyDamageDone += finaldmg;
+											//print("DmgDone:",ftos(RadiusDamage_EnemyDamageDone), "\n");
+											RadiusDamage_EnemyMaxDamage += coredamage;
+											//print("MaxDamage:",ftos(RadiusDamage_EnemyMaxDamage), "\n");
+										}
+										else if(targ.team != attacker.team)
+										{
+											RadiusDamage_EnemyDamageDone += finaldmg;
+											//print("DmgDone",ftos(RadiusDamage_EnemyDamageDone, "\n"));
+											RadiusDamage_EnemyMaxDamage += coredamage;
+											//print("MaxDamage",ftos(RadiusDamage_EnemyMaxDamage), "\n");
+										}
+									}
+								}
+
 								if(targ == directhitentity || DEATH_ISSPECIAL(deathtype))
 									Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
 								else
@@ -1029,5 +1064,17 @@
 
 	RadiusDamage_running = 0;
 
+	//Calculates stats for all RadiusDamage weapons
+	if not(self.isbot)
+	{
+		float f;
+		f = min(RadiusDamage_EnemyMaxDamage, RadiusDamage_EnemyDamageDone);
+		attacker.actual_damage[attacker.weapon] += f;  // actual damage done
+		//attacker.max_damage[attacker.weapon] += coredamage;  // max damage, potential damage
+		// update the client and store into addstat() in g_world
+		attacker.damage_hits = attacker.weapon + 64 * rint(attacker.actual_damage[attacker.weapon]);
+		attacker.maxdamage_fired = attacker.weapon + 64 * rint(attacker.max_damage[attacker.weapon]);
+	}
+
 	return total_damage_to_creatures;
 }

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/g_world.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -600,6 +600,8 @@
 	addstat(STAT_INVINCIBLE_FINISHED, AS_FLOAT, invincible_finished);
 	addstat(STAT_PRESSED_KEYS, AS_FLOAT, pressedkeys);
 	addstat(STAT_FUEL, AS_INT, ammo_fuel);
+	addstat(STAT_DAMAGE_HITS, AS_INT, damage_hits);
+ 	addstat(STAT_DAMAGE_FIRED, AS_INT, maxdamage_fired);
 	addstat(STAT_SHOTORG, AS_INT, stat_shotorg);
 
 	next_pingtime = time + 5;

Modified: trunk/data/qcsrc/server/nexball.qc
===================================================================
--- trunk/data/qcsrc/server/nexball.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/nexball.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -361,7 +361,7 @@
 		switch(e.team)
 		{
 			case COLOR_TEAM1: if(!t_r) { nb_spawnteam ("Red", e.team-1)   ; t_r = 1; } break;
-			case COLOR_TEAM2: if(!t_b) { nb_spawnteam ("Blue", e.team-1)  ; t_b = 1; } break; 
+			case COLOR_TEAM2: if(!t_b) { nb_spawnteam ("Blue", e.team-1)  ; t_b = 1; } break;
 			case COLOR_TEAM3: if(!t_y) { nb_spawnteam ("Yellow", e.team-1); t_y = 1; } break;
 			case COLOR_TEAM4: if(!t_p) { nb_spawnteam ("Pink", e.team-1)  ; t_p = 1; } break;
 		}
@@ -577,7 +577,7 @@
 	if (!(ball = self.ballcarried))
 		return;
 
-	W_SetupShot (self, FALSE, 4, "nexball/shoot1.wav");
+	W_SetupShot (self, FALSE, 4, "nexball/shoot1.wav",0);
 	tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world);
 	if(trace_startsolid)
 	{
@@ -608,7 +608,7 @@
 	local entity missile;
 	if (!(balls & BALL_BASKET))
 		return;
-	W_SetupShot (self, FALSE, 2, "nexball/shoot2.ogg");
+	W_SetupShot (self, FALSE, 2, "nexball/shoot2.ogg",0);
 //	pointparticles(particleeffectnum("grenadelauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 	missile = spawn ();
 
@@ -657,7 +657,7 @@
 			W_Nexball_Attack2();
 			weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_nexball_secondary_animtime"), w_ready);
 		}
-		
+
 		if (!self.BUTTON_ATCK && self.metertime && self.ballcarried)
 		{
 			W_Nexball_Attack(time - self.metertime);

Modified: trunk/data/qcsrc/server/w_campingrifle.qc
===================================================================
--- trunk/data/qcsrc/server/w_campingrifle.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_campingrifle.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -52,9 +52,9 @@
 		self.ammo_nails -= pAmmo;
 
 	if(deathtype & HITTYPE_SECONDARY)
-		W_SetupShot (self, cvar("g_antilag_bullets") && pSpeed >= cvar("g_antilag_bullets"), 2, "weapons/campingrifle_fire2.wav");
+		W_SetupShot (self, cvar("g_antilag_bullets") && pSpeed >= cvar("g_antilag_bullets"), 2, "weapons/campingrifle_fire2.wav", cvar("g_balance_campingrifle_secondary_damage"));
 	else
-		W_SetupShot (self, cvar("g_antilag_bullets") && pSpeed >= cvar("g_antilag_bullets"), 2, "weapons/campingrifle_fire.wav");
+		W_SetupShot (self, cvar("g_antilag_bullets") && pSpeed >= cvar("g_antilag_bullets"), 2, "weapons/campingrifle_fire.wav", cvar("g_balance_campingrifle_primary_damage"));
 
 	pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 2000, 1);
 

Modified: trunk/data/qcsrc/server/w_common.qc
===================================================================
--- trunk/data/qcsrc/server/w_common.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_common.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -1,4 +1,9 @@
+.float bullets_hit[WEP_COUNT]; 		//for hitscan bullets hit
+.float bullets_fired[WEP_COUNT];	//for hitscan bullets fired
 
+FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(bullets_hit);
+FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(bullets_fired);
+
 void W_GiveWeapon (entity e, float wep, string name)
 {
 	entity oldself;
@@ -28,7 +33,10 @@
 	local entity ent, endent;
 	local float endq3surfaceflags;
 	//local entity explosion;
-	
+	float did_hit;
+
+	did_hit = 0;
+
 	railgun_start = start;
 	railgun_end = end;
 
@@ -91,6 +99,15 @@
 		ent.railgunhitsolidbackup = SOLID_NOT;
 		ent.railgunhit = FALSE;
 
+		//for stats so that team hit will count as a miss
+		if(ent.flags & FL_CLIENT)
+		if(ent.deadflag == DEAD_NO)
+			did_hit = 1;
+
+		if(teams_matter)
+		if(ent.team == self.team)
+			did_hit = 0;
+
 		// apply the damage
 		if (ent.takedamage || ent.classname == "case")
 			Damage (ent, self, self, bdamage, deathtype, hitloc, force);
@@ -102,7 +119,18 @@
 		// advance to the next entity
 		ent = findfloat(ent, railgunhit, TRUE);
 	}
+	//calculate hits and fired shots for hitscan
+	if not(self.isbot)
+	{
+		self.bullets_fired[self.weapon] += 1;
+		if(did_hit)
+			self.bullets_hit[self.weapon] += 1;
 
+		// update the client and store in addstat() in g_world
+		self.damage_hits = self.weapon + 64 * rint(self.bullets_hit[self.weapon]);
+		self.maxdamage_fired = self.weapon + 64 * rint(self.bullets_fired[self.weapon]);
+	}
+
 	// we're done with the explosion entity, remove it
 	//remove(explosion);
 
@@ -118,6 +146,9 @@
 {
 	float f;
 
+	float hit;
+	hit = 0;
+
 	f = pow(bound(0, vlen(self.velocity) / vlen(self.oldvelocity), 1), 2); // energy multiplier
 
 	if(other.solid == SOLID_BSP)
@@ -131,6 +162,14 @@
 		railgun_start = self.origin - 2 * frametime * self.velocity;
 		railgun_end = self.origin + 2 * frametime * self.velocity;
 
+		if(other.flags & FL_CLIENT)
+		if(other.deadflag == DEAD_NO)
+			hit = 1;
+
+		if(teamplay)
+		if(other.team == self.owner.team)
+			hit = 0;
+
 		Damage(other, self, self.owner, self.dmg * f, self.projectiledeathtype, self.origin, self.dmg_force * normalize(self.velocity) * f);
 		damage_headshotbonus = 0;
 
@@ -142,6 +181,15 @@
 				announce(self.owner, "announcer/male/awesome.wav");
 		}
 
+		//calculate hits for ballistic weapons
+		if not(self.owner.isbot)
+		{
+			if(hit)
+				self.owner.bullets_hit[self.owner.weapon] += 1;
+			// update the client
+			self.owner.damage_hits = self.owner.weapon + 64 * rint(self.owner.bullets_hit[self.owner.weapon]);
+		}
+
 		//sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
 	}
 
@@ -170,7 +218,7 @@
 		f = pow(bound(0, vlen(self.velocity) / vlen(self.oldvelocity), 1), 2); // energy multiplier
 		Damage_DamageInfo(self.origin, 0, 0, 0, self.dmg_force * normalize(self.velocity) * -f, self.projectiledeathtype);
 	}
-	
+
 	UpdateCSQCProjectile(self);
 }
 
@@ -187,7 +235,7 @@
 float W_BallisticBullet_LeaveSolid(entity e, vector vel, float constant)
 {
 	// move the entity along its velocity until it's out of solid, then let it resume
-	
+
 	float dt, dst, velfactor, v0, vs;
 	float maxdist;
 	float E0_m, Es_m;
@@ -297,6 +345,13 @@
 
 	proj.oldvelocity = proj.velocity;
 
+	//calculate fired bullets for ballistics
+	if not(self.isbot)
+	{
+		self.bullets_fired[self.weapon] += 1;
+		self.maxdamage_fired = self.weapon + 64 * rint(self.bullets_fired[self.weapon]);
+	}
+
 	if(cvar("g_antilag_bullets"))
 	if(pSpeed >= cvar("g_antilag_bullets"))
 	{
@@ -335,6 +390,12 @@
 			self.velocity = v0;
 			self.gravity = g0;
 
+			if not(self.isbot)
+			{
+				self.bullets_fired[self.weapon] += 1;
+				self.maxdamage_fired = self.weapon + 64 * rint(self.bullets_fired[self.weapon]);
+			}
+
 			if(vlen(trace_endpos - self.origin) > 32)
 				zcurveparticles_from_tracetoss(particleeffectnum("tr_bullet"), self.origin, trace_endpos, self.velocity);
 			if(trace_fraction == 1)

Modified: trunk/data/qcsrc/server/w_crylink.qc
===================================================================
--- trunk/data/qcsrc/server/w_crylink.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_crylink.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -67,7 +67,7 @@
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
 
-	W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav");
+	W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots")));
 	forward = v_forward;
 	right = v_right;
 	up = v_up;
@@ -134,7 +134,7 @@
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
 
-	W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav");
+	W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav", (cvar("g_balance_crylink_secondary_damage")*cvar("g_balance_crylink_secondary_shots")));
 
 	shots = cvar("g_balance_crylink_secondary_shots");
 	pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);

Modified: trunk/data/qcsrc/server/w_electro.qc
===================================================================
--- trunk/data/qcsrc/server/w_electro.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_electro.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -69,7 +69,7 @@
 {
 	local entity proj;
 
-	W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire.wav");
+	W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire.wav", cvar("g_balance_electro_primary_damage"));
 
 	pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
@@ -105,7 +105,7 @@
 {
 	local entity proj;
 
-	W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire2.wav");
+	W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire2.wav", cvar("g_balance_electro_secondary_damage"));
 	w_shotdir = v_forward; // no TrueAim for grenades please
 
 	pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);

Modified: trunk/data/qcsrc/server/w_grenadelauncher.qc
===================================================================
--- trunk/data/qcsrc/server/w_grenadelauncher.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_grenadelauncher.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -76,7 +76,7 @@
 
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_rockets = self.ammo_rockets - cvar("g_balance_grenadelauncher_primary_ammo");
-	W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 4, "weapons/grenade_fire.wav");
+	W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 4, "weapons/grenade_fire.wav", cvar("g_balance_grenadelauncher_primary_damage"));
 	w_shotdir = v_forward; // no TrueAim for grenades please
 
 	pointparticles(particleeffectnum("grenadelauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
@@ -111,7 +111,7 @@
 
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_rockets = self.ammo_rockets - cvar("g_balance_grenadelauncher_secondary_ammo");
-	W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 4, "weapons/grenade_fire.wav");
+	W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 4, "weapons/grenade_fire.wav", cvar("g_balance_grenadelauncher_secondary_damage"));
 	w_shotdir = v_forward; // no TrueAim for grenades please
 
 	pointparticles(particleeffectnum("grenadelauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);

Modified: trunk/data/qcsrc/server/w_hagar.qc
===================================================================
--- trunk/data/qcsrc/server/w_hagar.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_hagar.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -42,7 +42,7 @@
 
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_primary_ammo");
-	W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav");
+	W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", cvar("g_balance_hagar_primary_damage"));
 
 	pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
@@ -76,7 +76,7 @@
 
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_secondary_ammo");
-	W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav");
+	W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", cvar("g_balance_hagar_secondary_damage"));
 	//W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav"); // TODO: move model a little to the right
 
 	pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);

Modified: trunk/data/qcsrc/server/w_hlac.qc
===================================================================
--- trunk/data/qcsrc/server/w_hlac.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_hlac.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -36,7 +36,7 @@
     if(self.crouch)
         spread = spread * cvar("g_balance_hlac_primary_spread_crouchmod");
 
-	W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav");
+	W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_hlac_primary_damage"));
 	pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 	if (!g_norecoil)
 	{
@@ -85,7 +85,7 @@
     if(self.crouch)
         spread = spread * cvar("g_balance_hlac_secondary_spread_crouchmod");
 
-	W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav");
+	W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_hlac_secondary_damage"));
 	pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
 	missile = spawn ();

Modified: trunk/data/qcsrc/server/w_hook.qc
===================================================================
--- trunk/data/qcsrc/server/w_hook.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_hook.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -60,7 +60,7 @@
 
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_cells = self.ammo_cells - cvar("g_balance_hook_secondary_ammo");
-	W_SetupShot (self, FALSE, 4, "weapons/hookbomb_fire.wav");
+	W_SetupShot (self, FALSE, 4, "weapons/hookbomb_fire.wav", cvar("g_balance_hook_secondary_damage"));
 
 	gren = spawn ();
 	gren.owner = self;

Modified: trunk/data/qcsrc/server/w_laser.qc
===================================================================
--- trunk/data/qcsrc/server/w_laser.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_laser.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -17,7 +17,7 @@
 {
 	local entity missile;
 
-	W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav");
+	W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_laser_secondary_damage"));
 	pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
 	missile = spawn ();

Modified: trunk/data/qcsrc/server/w_minstanex.qc
===================================================================
--- trunk/data/qcsrc/server/w_minstanex.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_minstanex.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -5,7 +5,7 @@
 	float flying;
 	flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
 
-	W_SetupShot (self, TRUE, 5, "weapons/minstanexfire.wav");
+	W_SetupShot (self, TRUE, 5, "weapons/minstanexfire.wav", 0);
 
 	yoda = 0;
 	damage_goodhits = 0;

Modified: trunk/data/qcsrc/server/w_nex.qc
===================================================================
--- trunk/data/qcsrc/server/w_nex.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_nex.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -15,7 +15,7 @@
 	float flying;
 	flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
 
-	W_SetupShot (self, TRUE, 5, "weapons/nexfire.wav");
+	W_SetupShot (self, TRUE, 5, "weapons/nexfire.wav", cvar("g_balance_nex_damage"));
 
 	yoda = 0;
 	FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, cvar("g_balance_nex_damage"), cvar("g_balance_nex_force"), WEP_NEX);

Modified: trunk/data/qcsrc/server/w_porto.qc
===================================================================
--- trunk/data/qcsrc/server/w_porto.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_porto.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -156,7 +156,7 @@
 
 	if not(self.items & IT_UNLIMITED_SUPERWEAPONS)
 		self.weapons = self.weapons - (self.weapons & WEPBIT_PORTO);
-	W_SetupShot (self, FALSE, 4, "porto/fire.wav");
+	W_SetupShot (self, FALSE, 4, "porto/fire.wav", 0);
 	// always shoot from the eye
 	w_shotdir = v_forward;
 	w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward;

Modified: trunk/data/qcsrc/server/w_rocketlauncher.qc
===================================================================
--- trunk/data/qcsrc/server/w_rocketlauncher.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_rocketlauncher.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -255,7 +255,7 @@
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_rockets = self.ammo_rockets - cvar("g_balance_rocketlauncher_ammo");
 
-	W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 5, "weapons/rocket_fire.wav");
+	W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 5, "weapons/rocket_fire.wav", cvar("g_balance_rocketlauncher_damage"));
 	pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
 	missile = spawn ();

Modified: trunk/data/qcsrc/server/w_seeker.qc
===================================================================
--- trunk/data/qcsrc/server/w_seeker.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_seeker.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -163,7 +163,7 @@
 		self.ammo_rockets = self.ammo_rockets - cvar("g_balance_seeker_missile_ammo");
 
 	makevectors(self.v_angle);
-	W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav");
+	W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav", cvar("g_balance_seeker_missile_damage"));
 	w_shotorg += f_diff;
 	pointparticles(particleeffectnum("seeker_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
@@ -317,7 +317,7 @@
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_rockets = self.ammo_rockets - cvar("g_balance_seeker_tag_ammo");
 
-	W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav");
+	W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", 0);
 
 	missile                 = spawn();
 	missile.owner           = self;
@@ -392,7 +392,7 @@
 			f_diff = '+1.25 +3.75 0';
 			break;
 	}
-	W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/flac_fire.wav");
+	W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/flac_fire.wav", cvar("g_balance_seeker_flac_damage"));
 	w_shotorg += f_diff;
 
 	pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);

Modified: trunk/data/qcsrc/server/w_shotgun.qc
===================================================================
--- trunk/data/qcsrc/server/w_shotgun.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_shotgun.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -19,7 +19,7 @@
 	bulletspeed = cvar("g_balance_shotgun_primary_speed");
 	bulletconstant = cvar("g_balance_shotgun_primary_bulletconstant");
 
-	W_SetupShot (self, cvar("g_antilag_bullets") && bulletspeed >= cvar("g_antilag_bullets"), 5, "weapons/shotgun_fire.wav");
+	W_SetupShot (self, cvar("g_antilag_bullets") && bulletspeed >= cvar("g_antilag_bullets"), 5, "weapons/shotgun_fire.wav", cvar("g_balance_shotgun_primary_damage"));
 	for (sc = 0;sc < bullets;sc = sc + 1)
 		fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN, 0, 1, bulletconstant);
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
@@ -62,7 +62,7 @@
 	bulletspeed = cvar("g_balance_shotgun_secondary_speed");
 	bulletconstant = cvar("g_balance_shotgun_secondary_bulletconstant");
 
-	W_SetupShot (self, cvar("g_antilag_bullets") && bulletspeed >= cvar("g_antilag_bullets"), 5, "weapons/shotgun_fire.wav");
+	W_SetupShot (self, cvar("g_antilag_bullets") && bulletspeed >= cvar("g_antilag_bullets"), 5, "weapons/shotgun_fire.wav", cvar("g_balance_shotgun_secondary_damage"));
 	for (sc = 0;sc < bullets;sc = sc + 1)
 		fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN | HITTYPE_SECONDARY, 0, 1, bulletconstant);
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)

Modified: trunk/data/qcsrc/server/w_tuba.qc
===================================================================
--- trunk/data/qcsrc/server/w_tuba.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_tuba.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -71,7 +71,7 @@
 void W_Tuba_Attack(float hittype)
 {
 	vector o;
-	W_SetupShot(self, FALSE, 2, "");
+	W_SetupShot(self, FALSE, 2, "", cvar("g_balance_tuba_damage"));
 	self.tuba_notecount = !self.tuba_notecount;
 	if(self.tuba_notecount)
 		sound(self, CHAN_WEAPON, TUBA_NOTE(Tuba_GetNote(self, hittype)), VOL_BASE, cvar("g_balance_tuba_attenuation"));

Modified: trunk/data/qcsrc/server/w_uzi.qc
===================================================================
--- trunk/data/qcsrc/server/w_uzi.qc	2009-06-11 03:31:07 UTC (rev 6974)
+++ trunk/data/qcsrc/server/w_uzi.qc	2009-06-11 03:58:12 UTC (rev 6975)
@@ -22,7 +22,7 @@
 		else
 			self.ammo_nails = self.ammo_nails - cvar("g_balance_uzi_sustained_ammo");
 	}
-	W_SetupShot (self, cvar("g_antilag_bullets") && cvar("g_balance_uzi_speed") >= cvar("g_antilag_bullets"), 0, "weapons/uzi_fire.wav");
+	W_SetupShot (self, cvar("g_antilag_bullets") && cvar("g_balance_uzi_speed") >= cvar("g_antilag_bullets"), 0, "weapons/uzi_fire.wav", cvar("g_balance_uzi_first_damage"));
 	if (!g_norecoil)
 	{
 		self.punchangle_x = random () - 0.5;



More information about the nexuiz-commits mailing list