[nexuiz-commits] r8489 - in trunk/data: . qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jan 6 12:15:40 EST 2010


Author: fruitiex
Date: 2010-01-06 12:15:35 -0500 (Wed, 06 Jan 2010)
New Revision: 8489

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/client/View.qc
   trunk/data/qcsrc/client/miscfunctions.qc
Log:
flag pickup notification by centerprint


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2010-01-06 15:55:02 UTC (rev 8488)
+++ trunk/data/defaultNexuiz.cfg	2010-01-06 17:15:35 UTC (rev 8489)
@@ -860,6 +860,7 @@
 sv_sound_land ""
 sv_sound_watersplash ""
 seta cl_sound_maptime_warning "1" "play announcer sound telling you the remaining maptime - 0: do not play at all, 1: play at one minute, 2: play at five minutes, 3: play both"
+seta cl_notify_carried_items "3" "notify you of carried items when you obtain them (e.g. flags in CTF) - 0: disabled, 1: notify of taken items, 2: notify of picking up dropped items, 3: notify of both"
 
 seta cl_hitsound 1 "play a hit notifier sound when you have hit an enemy"
 

Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc	2010-01-06 15:55:02 UTC (rev 8488)
+++ trunk/data/qcsrc/client/View.qc	2010-01-06 17:15:35 UTC (rev 8489)
@@ -411,6 +411,7 @@
 
 	CheckForGamestartChange();
 	maptimeAnnouncer();
+	carrierAnnouncer();
 
 	fov = cvar("fov");
 	if(button_zoom || fov <= 59.5)

Modified: trunk/data/qcsrc/client/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/client/miscfunctions.qc	2010-01-06 15:55:02 UTC (rev 8488)
+++ trunk/data/qcsrc/client/miscfunctions.qc	2010-01-06 17:15:35 UTC (rev 8489)
@@ -81,7 +81,56 @@
 	}
 }
 
+ /**
+ * Announce carried items (e.g. flags in CTF).
+ */
+float redflag_prev;
+float blueflag_prev;
+void carrierAnnouncer() {
+	float stat_items, redflag, blueflag;
+	float pickup;
+	string item;
+
+	if not(cvar("cl_notify_carried_items"))
+		return;
+
+	stat_items = getstati(STAT_ITEMS);
+
+	redflag = (stat_items/IT_RED_FLAG_TAKEN) & 3;
+	blueflag = (stat_items/IT_BLUE_FLAG_TAKEN) & 3;
+
+	if (redflag == 3 && redflag != redflag_prev) {
+		item = "^1RED^7 flag";
+		pickup = (redflag_prev == 2);
+	}
+
+	if (blueflag == 3 && blueflag != blueflag_prev) {
+		item = "^4BLUE^7 flag";
+		pickup = (blueflag_prev == 2);
+	}
+
+	if (item)
+	{
+		if (pickup) {
+			if (cvar("cl_notify_carried_items") & 2)
+				centerprint(strcat("You picked up the ", item, "!"));
+		}
+		else {
+			if (cvar("cl_notify_carried_items") & 1)
+				centerprint(strcat("You got the ", item, "!"));
+		}
+	}
+
+	blueflag_prev = blueflag;
+	redflag_prev = redflag;
+}
+
 /**
+  * Add all future announcer sounds precaches here.
+  * TODO: make all announcer sound() calls client-side in the end, to allow queues etc.
+  */
+
+/**
  * Add all future announcer sounds precaches here.
  * TODO: make all announcer sound() calls client-side in the end, to allow queues etc.
  */



More information about the nexuiz-commits mailing list