r4685 - in trunk/data: . qcsrc/client qcsrc/menu/nexuiz qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Oct 9 06:49:20 EDT 2008


Author: div0
Date: 2008-10-09 06:49:20 -0400 (Thu, 09 Oct 2008)
New Revision: 4685

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/client/teamradar.qc
   trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_radar.c
   trunk/data/qcsrc/server/builtins.qh
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/sv_main.qc
Log:
cl_teamradar_foreground_alpha cvar



Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-10-09 09:28:25 UTC (rev 4684)
+++ trunk/data/defaultNexuiz.cfg	2008-10-09 10:49:20 UTC (rev 4685)
@@ -1148,6 +1148,7 @@
 
 seta cl_teamradar 1
 seta cl_teamradar_background_alpha 0.25 // set to -1 to disable
+seta cl_teamradar_foreground_alpha 1 // alpha of the map
 seta cl_teamradar_scale 4096
 seta cl_teamradar_rotation 0 // rotation mode: you set what points up. 0 = player, 1 = west, 2 = south, 3 = east, 4 = north
 seta cl_teamradar_size "128 128"

Modified: trunk/data/qcsrc/client/teamradar.qc
===================================================================
--- trunk/data/qcsrc/client/teamradar.qc	2008-10-09 09:28:25 UTC (rev 4684)
+++ trunk/data/qcsrc/client/teamradar.qc	2008-10-09 10:49:20 UTC (rev 4685)
@@ -43,27 +43,30 @@
 	return v;
 }
 
-void draw_teamradar_background(float a)
+void draw_teamradar_background(float fg, float bg)
 {
-	if(a <= 0)
-		return;
+	if(bg > 0)
+	{
+		R_BeginPolygon("", 0);
+		R_PolygonVertex('1 0 0' * (teamradar_origin2d_x - teamradar_size2d_x * 0.5) + '0 1 0' * (teamradar_origin2d_y - teamradar_size2d_y * 0.5), '0 0 0', '0 0 0', bg);
+		R_PolygonVertex('1 0 0' * (teamradar_origin2d_x + teamradar_size2d_x * 0.5) + '0 1 0' * (teamradar_origin2d_y - teamradar_size2d_y * 0.5), '0 0 0', '0 0 0', bg);
+		R_PolygonVertex('1 0 0' * (teamradar_origin2d_x + teamradar_size2d_x * 0.5) + '0 1 0' * (teamradar_origin2d_y + teamradar_size2d_y * 0.5), '0 0 0', '0 0 0', bg);
+		R_PolygonVertex('1 0 0' * (teamradar_origin2d_x - teamradar_size2d_x * 0.5) + '0 1 0' * (teamradar_origin2d_y + teamradar_size2d_y * 0.5), '0 0 0', '0 0 0', bg);
+		R_EndPolygon();
+	}
 
-	R_BeginPolygon("", 0);
-	R_PolygonVertex('1 0 0' * (teamradar_origin2d_x - teamradar_size2d_x * 0.5) + '0 1 0' * (teamradar_origin2d_y - teamradar_size2d_y * 0.5), '0 0 0', '0 0 0', a);
-	R_PolygonVertex('1 0 0' * (teamradar_origin2d_x + teamradar_size2d_x * 0.5) + '0 1 0' * (teamradar_origin2d_y - teamradar_size2d_y * 0.5), '0 0 0', '0 0 0', a);
-	R_PolygonVertex('1 0 0' * (teamradar_origin2d_x + teamradar_size2d_x * 0.5) + '0 1 0' * (teamradar_origin2d_y + teamradar_size2d_y * 0.5), '0 0 0', '0 0 0', a);
-	R_PolygonVertex('1 0 0' * (teamradar_origin2d_x - teamradar_size2d_x * 0.5) + '0 1 0' * (teamradar_origin2d_y + teamradar_size2d_y * 0.5), '0 0 0', '0 0 0', a);
-	R_EndPolygon();
-
-	if(csqc_flags & CSQC_FLAG_READPICTURE) // not 2.4.2
-		R_BeginPolygon(minimapname, DRAWFLAG_ADDITIVE | DRAWFLAG_MIPMAP);
-	else
-		R_BeginPolygon(minimapname, DRAWFLAG_ADDITIVE);
-	R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), '1 1 1', 1);
-	R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), '1 1 1', 1);
-	R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), '1 1 1', 1);
-	R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), '1 1 1', 1);
-	R_EndPolygon();
+	if(fg > 0)
+	{
+		if(csqc_flags & CSQC_FLAG_READPICTURE) // not 2.4.2
+			R_BeginPolygon(minimapname, DRAWFLAG_ADDITIVE | DRAWFLAG_MIPMAP);
+		else
+			R_BeginPolygon(minimapname, DRAWFLAG_ADDITIVE);
+		R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), '1 1 1', fg);
+		R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), '1 1 1', fg);
+		R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), '1 1 1', fg);
+		R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), '1 1 1', fg);
+		R_EndPolygon();
+	}
 }
 
 void(vector coord3d, vector pangles, vector rgb) draw_teamradar_player =
@@ -118,6 +121,7 @@
 
 float cl_teamradar_scale;
 float cl_teamradar_background_alpha;
+float cl_teamradar_foreground_alpha;
 float cl_teamradar_rotation;
 vector cl_teamradar_size;
 vector cl_teamradar_position;
@@ -127,6 +131,7 @@
 {
 	cl_teamradar_scale = cvar("cl_teamradar_scale");
 	cl_teamradar_background_alpha = cvar("cl_teamradar_background_alpha");
+	cl_teamradar_foreground_alpha = cvar("cl_teamradar_background_alpha");
 	cl_teamradar_rotation = cvar("cl_teamradar_rotation");
 	cl_teamradar_size = stov(cvar_string("cl_teamradar_size"));
 	cl_teamradar_position = stov(cvar_string("cl_teamradar_position"));
@@ -136,6 +141,7 @@
 	// match this to defaultNexuiz.cfg!
 	if(!cl_teamradar_scale) cl_teamradar_scale = 4096;
 	if(!cl_teamradar_background_alpha) cl_teamradar_background_alpha = 0.25;
+	if(!cl_teamradar_foreground_alpha) cl_teamradar_background_alpha = 1;
 	if(!cl_teamradar_size_x) cl_teamradar_size_x = 128;
 	if(!cl_teamradar_size_y) cl_teamradar_size_y = cl_teamradar_size_x;
 
@@ -234,7 +240,7 @@
 		teamradar_size2d_y
 	);
 
-	draw_teamradar_background(cl_teamradar_background_alpha);
+	draw_teamradar_background(cl_teamradar_background_alpha, cl_teamradar_foreground_alpha);
 	for(tm = world; (tm = findflags(tm, teamradar_icon, 0xFFFFFF)); )
 		draw_teamradar_icon(tm.origin, tm.teamradar_icon, tm.teamradar_time, tm.teamradar_color, tm.alpha);
 	for(tm = world; (tm = find(tm, classname, "entcs_receiver")); )

Modified: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_radar.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_radar.c	2008-10-09 09:28:25 UTC (rev 4684)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_radar.c	2008-10-09 10:49:20 UTC (rev 4685)
@@ -6,7 +6,7 @@
 	ATTRIB(NexuizRadarDialog, title, string, "Radar & Waypoints")
 	ATTRIB(NexuizRadarDialog, color, vector, SKINCOLOR_DIALOG_RADAR)
 	ATTRIB(NexuizRadarDialog, intendedWidth, float, 0.7)
-	ATTRIB(NexuizRadarDialog, rows, float, 17)
+	ATTRIB(NexuizRadarDialog, rows, float, 18)
 	ATTRIB(NexuizRadarDialog, columns, float, 4)
 ENDCLASS(NexuizRadarDialog)
 #endif
@@ -85,6 +85,10 @@
 		me.TDempty(me, 1);
 	me.TR(me);
 		me.TDempty(me, 0.2);
+		me.TD(me, 1, 0.8, e = makeNexuizTextLabel(0, "Foreground:"));
+		me.TD(me, 1, 3, makeNexuizSlider(0.1, 1.0, 0.01, "cl_teamradar_foreground_alpha"));
+	me.TR(me);
+		me.TDempty(me, 0.2);
 		sl = makeNexuizSlider(0.1, 1.0, 0.01, "cl_teamradar_background_alpha");
 		me.TD(me, 1, 0.8, e = makeNexuizSliderCheckBox(-1, 1, sl, "Background:"));
 		me.TD(me, 1, 3, sl);

Modified: trunk/data/qcsrc/server/builtins.qh
===================================================================
--- trunk/data/qcsrc/server/builtins.qh	2008-10-09 09:28:25 UTC (rev 4684)
+++ trunk/data/qcsrc/server/builtins.qh	2008-10-09 10:49:20 UTC (rev 4685)
@@ -13,7 +13,7 @@
 float	vlen (vector v)									= #12;
 float	vectoyaw (vector v)								= #13;
 entity	spawn (void)									= #14;
-void	remove (entity e)								= #15;
+void	remove_builtin (entity e)								= #15;
 void	traceline (vector v1, vector v2, float nomonst, entity forent)			= #16;
 entity	checkclient (void)								= #17;
 entity	find (entity start, .string fld, string match)					= #18;

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2008-10-09 09:28:25 UTC (rev 4684)
+++ trunk/data/qcsrc/server/g_world.qc	2008-10-09 10:49:20 UTC (rev 4685)
@@ -208,6 +208,8 @@
 		error("world already spawned - you may have EXACTLY ONE worldspawn!");
 	world_already_spawned = TRUE;
 
+	remove = remove_safely; // during spawning, watch what you remove!
+
 	compressShortVector_init();
 
 	local entity head;

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2008-10-09 09:28:25 UTC (rev 4684)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2008-10-09 10:49:20 UTC (rev 4685)
@@ -1,3 +1,4 @@
+var void remove(entity e);
 void objerror(string s);
 void droptofloor();
 .vector dropped_origin;
@@ -1261,6 +1262,12 @@
 	objerror_builtin(s);
 }
 
+void remove_safely(entity e)
+{
+	make_safe_for_remove(e);
+	remove_builtin(e);
+}
+
 void InitializeEntity(entity e, void(void) func, float order)
 {
 	entity prev, cur;
@@ -1310,7 +1317,7 @@
 		{
 			entity e_old;
 			e_old = self.enemy;
-			remove(self);
+			remove_builtin(self);
 			self = e_old;
 		}
 		dprint("Delayed initialization: ", self.classname, "\n");

Modified: trunk/data/qcsrc/server/sv_main.qc
===================================================================
--- trunk/data/qcsrc/server/sv_main.qc	2008-10-09 09:28:25 UTC (rev 4684)
+++ trunk/data/qcsrc/server/sv_main.qc	2008-10-09 10:49:20 UTC (rev 4685)
@@ -133,6 +133,8 @@
 entity SelectSpawnPoint (float anypoint);
 void StartFrame (void)
 {
+	remove = remove_builtin; // not during spawning!
+
 	dprint_load(); // load dprint status from cvar
 
 	if(RedirectionThink())




More information about the nexuiz-commits mailing list