[nexuiz-commits] r7102 - in trunk/data: . qcsrc/client qcsrc/menu/nexuiz qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jun 25 01:36:34 EDT 2009


Author: div0
Date: 2009-06-25 01:36:34 -0400 (Thu, 25 Jun 2009)
New Revision: 7102

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/client/View.qc
   trunk/data/qcsrc/client/sbar.qc
   trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c
   trunk/data/qcsrc/server/constants.qh
   trunk/data/tooltips.db
Log:
crosshair_hittest: new feature: enlarge when aiming at enemy (optional)


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-06-25 03:38:40 UTC (rev 7101)
+++ trunk/data/defaultNexuiz.cfg	2009-06-25 05:36:34 UTC (rev 7102)
@@ -24,7 +24,7 @@
 seta g_configversion 0	"Configuration file version (used to upgrade settings) 0: first run, or previous start was <2.4.1  Later, it's overridden by config.cfg, version ranges are defined in config_update.cfg"
 
 // default.cfg versioning (update using update-cvarcount.sh, run that every time after adding a new cvar)
-set cvar_check_default 40e11dd2f984335c9e27adf5beccb2d1
+set cvar_check_default 53ad20239e3fbf681eb91c2436691158
 
 // Nexuiz version (formatted for machines)
 // used to determine if a client version is compatible
@@ -95,7 +95,7 @@
 crosshair 5
 seta crosshair_per_weapon 0	"when 1, each gun will display a different crosshair"
 seta crosshair_color_override 0	"when 1, crosshair_color_* overrides the per-weapon color"
-seta crosshair_hittest 1 "when 1, the crosshair is blurred if the shot wouldn't hit the crosshair because of obstructions"
+seta crosshair_hittest 1 "when not 0, the crosshair is blurred if the shot wouldn't hit the crosshair because of obstructions; also, the crosshair is scaled by the given number when aiming at an enemy"
 seta crosshair_laser ""	"crosshair to display when wielding the laser"
 seta crosshair_laser_color_red 1	"crosshair color red component to display when wielding the laser"
 seta crosshair_laser_color_green 0.35	"crosshair color green component to display when wielding the laser"

Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc	2009-06-25 03:38:40 UTC (rev 7101)
+++ trunk/data/qcsrc/client/View.qc	2009-06-25 05:36:34 UTC (rev 7102)
@@ -8,6 +8,7 @@
 entity porto;
 vector polyline[16];
 float trace_dphitcontents;
+float trace_networkentity;
 float Q3SURFACEFLAG_SLICK = 2; // low friction surface
 float DPCONTENTS_SOLID = 1; // blocks player movement
 float DPCONTENTS_BODY = 32; // blocks player movement
@@ -213,6 +214,23 @@
 	trueaim.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
 }
 
+float EnemyHitCheck(vector start, vector mi, vector ma, vector end)
+{
+	float t;
+	tracebox(start, mi, ma, end, MOVE_NORMAL, trueaim);
+	if(trace_networkentity < 1)
+		return 0;
+	if(trace_networkentity > maxclients)
+		return 0;
+	t = GetPlayerColor(trace_networkentity - 1);
+	if(teamplay)
+	if(t == myteam)
+		return 0;
+	if(t == COLOR_SPECTATOR)
+		return 0;
+	return 1;
+}
+
 float TrueAimCheck()
 {
 	float nudge = 1; // added to traceline target and subtracted from result
@@ -230,7 +248,7 @@
 			return 1;
 		case WEP_CAMPINGRIFLE:
 			if(zoomscript_caught)
-				return 1; // shoots from eye when zoomed
+				return 1 + EnemyHitCheck(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * MAX_SHOT_DISTANCE);
 			break;
 		case WEP_ROCKET_LAUNCHER: // projectile has a size!
 			mi = '-3 -3 -3';
@@ -263,6 +281,9 @@
 	tracebox(w_shotorg, mi, ma, w_shotorg + view_forward * (vecs_x + nudge), MOVE_NORMAL, trueaim); // FIXME this MOVE_NORMAL part will misbehave a little in csqc
 	w_shotorg = trace_endpos - view_forward * nudge;
 
+	if(EnemyHitCheck(w_shotorg, mi, ma, trueaimpoint))
+		return 2;
+
 	// now test whether we will actually hit the trueaimpoint...
 	tracebox(w_shotorg, mi, ma, trueaimpoint, MOVE_NOMONSTERS, trueaim);
 
@@ -290,6 +311,8 @@
 	dprint_load();
 	WaypointSprite_Load();
 
+	myteam = GetPlayerColor(player_localentnum - 1);
+
 	ticrate = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
 
 	// Render the Scene
@@ -530,7 +553,7 @@
             if(cvar("crosshair_hittest"))
                 goodshot = TrueAimCheck();
             else
-                goodshot = TRUE;
+                goodshot = 1;
 
             string wcross_style;
             wcross_style = cvar_string("crosshair");
@@ -568,6 +591,9 @@
 
                 wcross_name = strcat("gfx/crosshair", wcross_style);
 
+				if(goodshot > 1)
+					wcross_sizefloat *= cvar("crosshair_hittest"); // is not queried if hittest is 0
+
                 wcross_size = drawgetimagesize(wcross_name);
                 wcross_size_x *= wcross_sizefloat;
                 wcross_size_y *= wcross_sizefloat;

Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2009-06-25 03:38:40 UTC (rev 7101)
+++ trunk/data/qcsrc/client/sbar.qc	2009-06-25 05:36:34 UTC (rev 7102)
@@ -1194,8 +1194,6 @@
 		}
 	}
 
-	myteam = GetPlayerColor(desiredPlayerId);
-
 	sbar_y = vid_conheight - (32+12);
 	sbar_x -= margin;
 

Modified: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c	2009-06-25 03:38:40 UTC (rev 7101)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c	2009-06-25 05:36:34 UTC (rev 7102)
@@ -139,7 +139,12 @@
 		me.TD(me, 1, 2, e = makeNexuizSlider(0, 1, 0.01, "crosshair_color_blue"));
 		setDependentOR(e, "crosshair_per_weapon", 0, 0, "crosshair_color_override", 1, 1);
 	me.TR(me);
+		me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Hit test:"));
+		me.TD(me, 1, 2/3, e = makeNexuizRadioButton(1, "crosshair_hittest", "0",    "None"));
+		me.TD(me, 1, 2/3, e = makeNexuizRadioButton(1, "crosshair_hittest", "1",    "TrueAim"));
+		me.TD(me, 1, 2/3, e = makeNexuizRadioButton(1, "crosshair_hittest", "1.25", "Enemies"));
 	me.TR(me);
+	me.TR(me);
 		me.TDempty(me, 0.4);
 		me.TD(me, 1, 2.2, e = makeNexuizButton("Radar, HUD & Waypoints...", '0 0 0'));
 			e.onClick = DialogOpenButton_Click;

Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh	2009-06-25 03:38:40 UTC (rev 7101)
+++ trunk/data/qcsrc/server/constants.qh	2009-06-25 05:36:34 UTC (rev 7102)
@@ -1,4 +1,4 @@
-string CVAR_CHECK_DEFAULT = "40e11dd2f984335c9e27adf5beccb2d1";
+string CVAR_CHECK_DEFAULT = "53ad20239e3fbf681eb91c2436691158";
 string CVAR_CHECK_WEAPONS = "4f7b4c1e2feeef4988b02a93ff35a2ca";
 
 float	FALSE					= 0;

Modified: trunk/data/tooltips.db
===================================================================
--- trunk/data/tooltips.db	2009-06-25 03:38:40 UTC (rev 7101)
+++ trunk/data/tooltips.db	2009-06-25 05:36:34 UTC (rev 7102)
@@ -201,3 +201,5 @@
 \cl_teamradar_background_alpha\-
 \cl_hidewaypoints\-
 \cl_shownames\-
+
+\crosshair_hittest\None: do not do hit tests for the crosshair; TrueAim: blur the crosshair when you would not hit the wall; Enemies: also enlarge the crosshair when you would hit an enemy



More information about the nexuiz-commits mailing list