r2044 - in trunk/data: menu qcsrc/menu/custom
black at icculus.org
black at icculus.org
Tue Dec 12 19:10:48 EST 2006
Author: black
Date: 2006-12-12 19:10:48 -0500 (Tue, 12 Dec 2006)
New Revision: 2044
Modified:
trunk/data/menu/joingame.menu
trunk/data/qcsrc/menu/custom/joingame.qc
trunk/data/qcsrc/menu/custom/joingame.qh
Log:
Commit a new item (Nex_HostCache_Ping) that colors serverlist pings depending on the latency.
Modified: trunk/data/menu/joingame.menu
===================================================================
--- trunk/data/menu/joingame.menu 2006-12-12 17:06:07 UTC (rev 2043)
+++ trunk/data/menu/joingame.menu 2006-12-13 00:10:48 UTC (rev 2044)
@@ -151,7 +151,7 @@
size '824 15'
action Nex_Action_EntryConnect
- DeriveTemplate Nex_HostCache_ValueField Ping
+ DeriveTemplate Nex_HostCache_Ping Ping
{
pos '0 0'
size [SList_Ping]
Modified: trunk/data/qcsrc/menu/custom/joingame.qc
===================================================================
--- trunk/data/qcsrc/menu/custom/joingame.qc 2006-12-12 17:06:07 UTC (rev 2043)
+++ trunk/data/qcsrc/menu/custom/joingame.qc 2006-12-13 00:10:48 UTC (rev 2044)
@@ -111,3 +111,39 @@
self._update = Item_Nex_HostCache_Players_Update;
};
+
+//////////////////////////////////
+// Item_Nex_HostCache_Ping
+///////
+
+const vector HOSTCACHE_FAST_PING_COLOR = '1.0 1.0 0.0';
+const vector HOSTCACHE_MEDIUM_PING_COLOR = '0.0 1.0 0.0';
+const vector HOSTCACHE_SLOW_PING_COLOR = '1.0 0.0 0.0';
+
+const float HOSTCACHE_FAST_PING = 90;
+const float HOSTCACHE_SLOW_PING = 150;
+
+void() Item_Nex_HostCache_Ping_Update =
+{
+ local float ping;
+
+ Item_Nex_HostCache_ValueField_Update();
+
+ // AK 06 yes I know its not fast.. but its shorter..
+ ping = stof( self.text );
+ if( ping < HOSTCACHE_FAST_PING ) {
+ self.color = HOSTCACHE_FAST_PING_COLOR;
+ } else if( ping > HOSTCACHE_SLOW_PING ) {
+ self.color = HOSTCACHE_SLOW_PING_COLOR;
+ } else {
+ self.color = HOSTCACHE_MEDIUM_PING_COLOR;
+ }
+}
+
+void() Item_Nex_HostCache_Ping_Spawn =
+{
+ Item_Nex_HostCache_ValueField_Spawn();
+
+ self._update = Item_Nex_HostCache_Ping_Update;
+};
+
Modified: trunk/data/qcsrc/menu/custom/joingame.qh
===================================================================
--- trunk/data/qcsrc/menu/custom/joingame.qh 2006-12-12 17:06:07 UTC (rev 2043)
+++ trunk/data/qcsrc/menu/custom/joingame.qh 2006-12-13 00:10:48 UTC (rev 2044)
@@ -29,3 +29,7 @@
void() Item_Nex_HostCache_Players_Update;
void() Item_Nex_HostCache_Players_Spawn;
+// Item_Nex_HostCache_Ping Item_Nex_HostCache_ValueField
+void() Item_Nex_HostCache_Ping_Update;
+void() Item_Nex_HostCache_Ping_Spawn;
+
More information about the nexuiz-commits
mailing list