r5446 - trunk/data/qcsrc/menu/nexuiz

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jan 8 03:09:17 EST 2009


Author: div0
Date: 2009-01-08 03:09:14 -0500 (Thu, 08 Jan 2009)
New Revision: 5446

Modified:
   trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_join_serverinfo.c
   trunk/data/qcsrc/menu/nexuiz/playerlist.c
   trunk/data/qcsrc/menu/nexuiz/serverlist.c
Log:
draw players from their teams


Modified: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_join_serverinfo.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_join_serverinfo.c	2009-01-08 07:41:19 UTC (rev 5445)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_join_serverinfo.c	2009-01-08 08:09:14 UTC (rev 5446)
@@ -41,7 +41,6 @@
 float SLIST_FIELD_NUMBOTS;
 float SLIST_FIELD_MOD;
 float SLIST_FIELD_PING;
-string CURRENT_IP; //used by join button
 void Join_Click(entity me);
 #endif
 
@@ -57,7 +56,6 @@
 
 	SLIST_FIELD_CNAME = gethostcacheindexforkey("cname");
 	me.currentServerCName = strzone(gethostcachestring(SLIST_FIELD_CNAME, i));
-	CURRENT_IP = me.currentServerCName; //used by join button
 	me.cnameLabel.setText(me.cnameLabel, me.currentServerCName);
 
 	SLIST_FIELD_QCSTATUS = gethostcacheindexforkey("qcstatus");
@@ -70,8 +68,8 @@
 	}
 	else
 	{
-		typestr = "N.A.";
-		versionstr = "N.A.";
+		typestr = "N/A";
+		versionstr = "N/A";
 	}
 	me.currentServerType = strzone(typestr);
 	me.typeLabel.setText(me.typeLabel, me.currentServerType);
@@ -178,9 +176,9 @@
 			e.onClickEntity = me;
 }
 
-void Join_Click(entity me)
+void Join_Click(entity me, entity dlg)
 {
-	localcmd("connect ", CURRENT_IP, "\n");
+	localcmd("connect ", dlg.currentServerCName, "\n");
 }
 
 #endif

Modified: trunk/data/qcsrc/menu/nexuiz/playerlist.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/playerlist.c	2009-01-08 07:41:19 UTC (rev 5445)
+++ trunk/data/qcsrc/menu/nexuiz/playerlist.c	2009-01-08 08:09:14 UTC (rev 5446)
@@ -55,25 +55,14 @@
 		{
 			bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_SCORE, argv(0)); // -666
 			bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_PING,  argv(1)); // 100
-			if(argv(2) == "0")
-				bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "-");
-			else if(argv(2) == "1")
-				bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "Red");
-			else if(argv(2) == "2")
-				bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "Blue");
-			else if(argv(2) == "3")
-				bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "Yellow");
-			else if(argv(2) == "4")
-				bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "Pink");
-			else
-				bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "unknown");
+			bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  argv(2)); // 0 for spec, else 1, 2, 3, 4
 			bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME,  argv(3)); // ^4Nex ^2Player
 		}
 		else
 		{
 			bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_SCORE, argv(0)); // -666
 			bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_PING,  argv(1)); // 100
-			bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "N/A");
+			bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "-1");
 			bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME,  argv(2)); // ^4Nex ^2Player
 		}
 	}
@@ -102,11 +91,35 @@
 void drawListBoxItemNexuizPlayerList(entity me, float i, vector absSize, float isSelected)
 {
 	string s;
+	float t;
+	vector rgb;
 
+	t = stof(me.getPlayerList(me, i, PLAYERPARM_TEAM));
+	if(t == 1)
+		rgb = colormapPaletteColor(4, 0);
+	else if(t == 2)
+		rgb = colormapPaletteColor(13, 0);
+	else if(t == 3)
+		rgb = colormapPaletteColor(12, 0);
+	else if(t == 4)
+		rgb = colormapPaletteColor(9, 0);
+	else
+		rgb = '1 1 1';
+	
 	s = me.getPlayerList(me, i, PLAYERPARM_NAME);
 
-	s = draw_TextShortenToWidth(s, me.columnNameSize / me.realFontSize_x, 1);
-	draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 1) * me.realFontSize_x)) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_AUTHOR, 1, 1);
+	print(s, "\n");
+
+	if(rgb != '1 1 1')
+		s = strdecolorize(s);
+
+	print(s, "\n");
+
+	s = draw_TextShortenToWidth(s, me.columnNameSize / me.realFontSize_x, rgb == '1 1 1');
+
+	print(s, "\n");
+
+	draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 1) * me.realFontSize_x)) * eX, s, me.realFontSize, rgb, 1, rgb == '1 1 1');
 }
 
 #endif

Modified: trunk/data/qcsrc/menu/nexuiz/serverlist.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/serverlist.c	2009-01-08 07:41:19 UTC (rev 5445)
+++ trunk/data/qcsrc/menu/nexuiz/serverlist.c	2009-01-08 08:09:14 UTC (rev 5446)
@@ -249,7 +249,7 @@
 		me.refreshServerList(me, 0);
 	}
 
-	owned = (me.selectedServer == me.ipAddressBox.text);
+	owned = ((me.selectedServer == me.ipAddressBox.text) && (me.ipAddressBox.text != ""));
 
 	me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT);
 




More information about the nexuiz-commits mailing list