r4054 - in trunk/data/qcsrc: common menu menu/nexuiz server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Aug 8 04:17:05 EDT 2008
Author: div0
Date: 2008-08-08 04:17:03 -0400 (Fri, 08 Aug 2008)
New Revision: 4054
Modified:
trunk/data/qcsrc/common/util.qc
trunk/data/qcsrc/menu/msys.qh
trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_join.c
trunk/data/qcsrc/menu/nexuiz/serverlist.c
trunk/data/qcsrc/server/extensions.qh
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/scores.qc
trunk/data/qcsrc/server/scores.qh
Log:
use DP_SV_QCSTATUS to show frags to qstat again; make menu aware of player lists (currently they are not shown, but they can be searched); add a game type column
Modified: trunk/data/qcsrc/common/util.qc
===================================================================
--- trunk/data/qcsrc/common/util.qc 2008-08-07 19:27:23 UTC (rev 4053)
+++ trunk/data/qcsrc/common/util.qc 2008-08-08 08:17:03 UTC (rev 4054)
@@ -418,6 +418,7 @@
else if (g == GAME_CTF) return "ctf";
else if (g == GAME_RUNEMATCH) return "rune";
else if (g == GAME_LMS) return "lms";
+ else if (g == GAME_ARENA) return "arena";
else if (g == GAME_KEYHUNT) return "kh";
else if (g == GAME_ONSLAUGHT) return "ons";
else if (g == GAME_ASSAULT) return "as";
Modified: trunk/data/qcsrc/menu/msys.qh
===================================================================
--- trunk/data/qcsrc/menu/msys.qh 2008-08-07 19:27:23 UTC (rev 4053)
+++ trunk/data/qcsrc/menu/msys.qh 2008-08-08 08:17:03 UTC (rev 4054)
@@ -106,6 +106,8 @@
float SLIST_TEST_GREATER = 5;
float SLIST_TEST_GREATEREQUAL = 6;
float SLIST_TEST_NOTEQUAL = 7;
+float SLIST_TEST_STARTSWITH = 8;
+float SLIST_TEST_NOTSTARTSWITH = 9;
float SLIST_MASK_AND = 0;
float SLIST_MASK_OR = 512;
Modified: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_join.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_join.c 2008-08-07 19:27:23 UTC (rev 4053)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_join.c 2008-08-08 08:17:03 UTC (rev 4054)
@@ -48,9 +48,10 @@
me.TD(me, 1, 1, slist.sortButton2 = makeNexuizButton(string_null, '0 0 0'));
me.TD(me, 1, 1, slist.sortButton3 = makeNexuizButton(string_null, '0 0 0'));
me.TD(me, 1, 1, slist.sortButton4 = makeNexuizButton(string_null, '0 0 0'));
+ me.TD(me, 1, 1, slist.sortButton5 = makeNexuizButton(string_null, '0 0 0'));
me.TR(me);
me.TD(me, me.rows - 3, me.columns, slist);
-
+
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeNexuizButton("Join!", '0 0 0'));
e.onClick = ServerList_Connect_Click;
Modified: trunk/data/qcsrc/menu/nexuiz/serverlist.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/serverlist.c 2008-08-07 19:27:23 UTC (rev 4053)
+++ trunk/data/qcsrc/menu/nexuiz/serverlist.c 2008-08-08 08:17:03 UTC (rev 4054)
@@ -16,6 +16,8 @@
ATTRIB(NexuizServerList, columnNameSize, float, 0)
ATTRIB(NexuizServerList, columnMapOrigin, float, 0)
ATTRIB(NexuizServerList, columnMapSize, float, 0)
+ ATTRIB(NexuizServerList, columnTypeOrigin, float, 0)
+ ATTRIB(NexuizServerList, columnTypeSize, float, 0)
ATTRIB(NexuizServerList, columnPlayersOrigin, float, 0)
ATTRIB(NexuizServerList, columnPlayersSize, float, 0)
@@ -35,6 +37,7 @@
ATTRIB(NexuizServerList, sortButton2, entity, NULL)
ATTRIB(NexuizServerList, sortButton3, entity, NULL)
ATTRIB(NexuizServerList, sortButton4, entity, NULL)
+ ATTRIB(NexuizServerList, sortButton5, entity, NULL)
ATTRIB(NexuizServerList, connectButton, entity, NULL)
ATTRIB(NexuizServerList, currentSortOrder, float, 0)
ATTRIB(NexuizServerList, currentSortField, float, -1)
@@ -61,6 +64,8 @@
float SLIST_FIELD_NUMBOTS;
float SLIST_FIELD_PROTOCOL;
float SLIST_FIELD_FREESLOTS;
+float SLIST_FIELD_PLAYERS;
+float SLIST_FIELD_QCSTATUS;
void ServerList_UpdateFieldIDs()
{
SLIST_FIELD_CNAME = gethostcacheindexforkey( "cname" );
@@ -75,6 +80,8 @@
SLIST_FIELD_NUMBOTS = gethostcacheindexforkey( "numbots" );
SLIST_FIELD_PROTOCOL = gethostcacheindexforkey( "protocol" );
SLIST_FIELD_FREESLOTS = gethostcacheindexforkey( "freeslots" );
+ SLIST_FIELD_PLAYERS = gethostcacheindexforkey( "players" );
+ SLIST_FIELD_QCSTATUS = gethostcacheindexforkey( "qcstatus" );
}
entity makeNexuizServerList()
@@ -124,17 +131,35 @@
else */
{
float m;
+ string s, typestr;
+ s = me.filterString;
+
+ m = strstrofs(s, ":", 0);
+ if(m >= 0)
+ {
+ typestr = substring(s, 0, m);
+ s = substring(s, m + 1, strlen(s) - m - 1);
+ while(substring(s, 0, 1) == " ")
+ s = substring(s, 1, strlen(s) - 1);
+ }
+ else
+ typestr = "";
+
m = SLIST_MASK_AND - 1;
resethostcachemasks();
if(!me.filterShowFull)
sethostcachemasknumber(++m, SLIST_FIELD_FREESLOTS, 1, SLIST_TEST_GREATEREQUAL);
if(!me.filterShowEmpty)
sethostcachemasknumber(++m, SLIST_FIELD_NUMHUMANS, 1, SLIST_TEST_GREATEREQUAL);
+ if(typestr != "")
+ sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(typestr, ":"), SLIST_TEST_STARTSWITH);
m = SLIST_MASK_OR - 1;
- if(me.filterString)
+ if(s != "")
{
- sethostcachemaskstring(++m, SLIST_FIELD_NAME, me.filterString, SLIST_TEST_CONTAINS);
- sethostcachemaskstring(++m, SLIST_FIELD_MAP, me.filterString, SLIST_TEST_CONTAINS);
+ sethostcachemaskstring(++m, SLIST_FIELD_NAME, s, SLIST_TEST_CONTAINS);
+ sethostcachemaskstring(++m, SLIST_FIELD_MAP, s, SLIST_TEST_CONTAINS);
+ sethostcachemaskstring(++m, SLIST_FIELD_PLAYERS, s, SLIST_TEST_CONTAINS);
+ sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(s, ":"), SLIST_TEST_STARTSWITH);
}
sethostcachesort(me.currentSortField, me.currentSortOrder < 0);
resorthostcache();
@@ -217,6 +242,52 @@
{
me.setSortOrder(me, SLIST_FIELD_NUMHUMANS, -1);
}
+void ServerList_TypeSort_Click(entity btn, entity me)
+{
+ string s, t;
+ float i, m;
+ s = me.filterString;
+ m = strstrofs(s, ":", 0);
+ if(m >= 0)
+ {
+ s = substring(s, 0, m);
+ while(substring(s, m+1, 1) == " ") // skip spaces
+ ++m;
+ }
+ else
+ s = "";
+
+ for(i = 1; ; ++i) // 20 modes ought to be enough for anyone
+ {
+ t = GametypeNameFromType(i);
+ if(i > 1)
+ if(t == GametypeNameFromType(0)) // it repeats (default case)
+ {
+ // no type was found
+ // choose the first one
+ s = t;
+ break;
+ }
+ if(s == GametypeNameFromType(i))
+ {
+ // the type was found
+ // choose the next one
+ s = GametypeNameFromType(i + 1);
+ if(s == GametypeNameFromType(0))
+ s = "";
+ break;
+ }
+ }
+
+ if(s != "")
+ s = strcat(s, ":");
+ s = strcat(s, substring(me.filterString, m+1, strlen(me.filterString) - m - 1));
+
+ me.controlledTextbox.setText(me.controlledTextbox, s);
+ me.controlledTextbox.keyDown(me.controlledTextbox, K_END, 0, 0);
+ me.controlledTextbox.keyUp(me.controlledTextbox, K_END, 0, 0);
+ //ServerList_Filter_Change(me.controlledTextbox, me);
+}
void ServerList_Filter_Change(entity box, entity me)
{
if(me.filterString)
@@ -246,7 +317,8 @@
me.sortButton1.forcePressed = (field == SLIST_FIELD_PING);
me.sortButton2.forcePressed = (field == SLIST_FIELD_NAME);
me.sortButton3.forcePressed = (field == SLIST_FIELD_MAP);
- me.sortButton4.forcePressed = (field == SLIST_FIELD_NUMHUMANS);
+ me.sortButton4.forcePressed = 0;
+ me.sortButton5.forcePressed = (field == SLIST_FIELD_NUMHUMANS);
me.selectedItem = 0;
if(me.selectedServer)
strunzone(me.selectedServer);
@@ -281,16 +353,19 @@
me.columnPingOrigin = 0;
me.columnPingSize = me.realFontSize_x * 4;
me.columnMapSize = me.realFontSize_x * 12;
+ me.columnTypeSize = me.realFontSize_x * 4;
me.columnPlayersSize = me.realFontSize_x * 6;
- me.columnNameSize = 1 - me.columnPlayersSize - me.columnMapSize - me.columnPingSize - 3 * me.realFontSize_x;
+ me.columnNameSize = 1 - me.columnPlayersSize - me.columnMapSize - me.columnPingSize - me.columnTypeSize - 4 * me.realFontSize_x;
me.columnNameOrigin = me.columnPingOrigin + me.columnPingSize + me.realFontSize_x;
me.columnMapOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize_x;
- me.columnPlayersOrigin = me.columnMapOrigin + me.columnMapSize + me.realFontSize_x;
+ me.columnTypeOrigin = me.columnMapOrigin + me.columnMapSize + me.realFontSize_x;
+ me.columnPlayersOrigin = me.columnTypeOrigin + me.columnTypeSize + me.realFontSize_x;
me.positionSortButton(me, me.sortButton1, me.columnPingOrigin, me.columnPingSize, "Ping", ServerList_PingSort_Click);
me.positionSortButton(me, me.sortButton2, me.columnNameOrigin, me.columnNameSize, "Host name", ServerList_NameSort_Click);
me.positionSortButton(me, me.sortButton3, me.columnMapOrigin, me.columnMapSize, "Map", ServerList_MapSort_Click);
- me.positionSortButton(me, me.sortButton4, me.columnPlayersOrigin, me.columnPlayersSize, "Players", ServerList_PlayerSort_Click);
+ me.positionSortButton(me, me.sortButton4, me.columnTypeOrigin, me.columnTypeSize, "Type", ServerList_TypeSort_Click);
+ me.positionSortButton(me, me.sortButton5, me.columnPlayersOrigin, me.columnPlayersSize, "Players", ServerList_PlayerSort_Click);
float f;
f = me.currentSortField;
@@ -352,13 +427,21 @@
theColor = eX;
theAlpha *= SKINALPHA_SERVERLIST_HIGHPING;
}
-
+
s = ftos(p);
draw_Text(me.realUpperMargin * eY + (me.columnPingSize - draw_TextWidth(s, 0) * me.realFontSize_x) * eX, s, me.realFontSize, theColor, theAlpha, 0);
s = draw_TextShortenToWidth(gethostcachestring(SLIST_FIELD_NAME, i), me.columnNameSize / me.realFontSize_x, 0);
draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, theColor, theAlpha, 0);
s = draw_TextShortenToWidth(gethostcachestring(SLIST_FIELD_MAP, i), me.columnMapSize / me.realFontSize_x, 0);
draw_Text(me.realUpperMargin * eY + (me.columnMapOrigin + (me.columnMapSize - draw_TextWidth(s, 0) * me.realFontSize_x) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0);
+ s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
+ p = strstrofs(s, ":", 0);
+ if(p >= 0)
+ s = substring(s, 0, p);
+ else
+ s = "";
+ s = draw_TextShortenToWidth(s, me.columnMapSize / me.realFontSize_x, 0);
+ draw_Text(me.realUpperMargin * eY + (me.columnTypeOrigin + (me.columnTypeSize - draw_TextWidth(s, 0) * me.realFontSize_x) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0);
s = strcat(ftos(gethostcachenumber(SLIST_FIELD_NUMHUMANS, i)), "/", ftos(gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i)));
draw_Text(me.realUpperMargin * eY + (me.columnPlayersOrigin + (me.columnPlayersSize - draw_TextWidth(s, 0) * me.realFontSize_x) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0);
}
Modified: trunk/data/qcsrc/server/extensions.qh
===================================================================
--- trunk/data/qcsrc/server/extensions.qh 2008-08-07 19:27:23 UTC (rev 4053)
+++ trunk/data/qcsrc/server/extensions.qh 2008-08-08 08:17:03 UTC (rev 4054)
@@ -1235,6 +1235,14 @@
//description:
//this extension allows precache_model and precache_sound (and any variants) to be used during the game (with automatic messages to clients to precache the new model/sound indices), also setmodel/sound/ambientsound can be called without precaching first (they will cause an automatic precache).
+//DP_SV_QCSTATUS
+//idea: div0
+//darkplaces implementation: div0
+//Fields whose contents are used instead of frags, or set as "qcstatus" field
+//in the getstatus/getinfo response.
+string worldstatus;
+.string clientstatus;
+
//DP_SV_ROTATINGBMODEL
//idea: id Software
//darkplaces implementation: LordHavoc
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2008-08-07 19:27:23 UTC (rev 4053)
+++ trunk/data/qcsrc/server/g_world.qc 2008-08-08 08:17:03 UTC (rev 4054)
@@ -975,7 +975,7 @@
fputs(file, strcat(s, "\n"));
}
- s = strcat(":labels:player:", GetPlayerScoreString(world));
+ s = strcat(":labels:player:", GetPlayerScoreString(world, 0));
if(to_console)
ServerConsoleEcho(s, TRUE);
if(to_eventlog)
@@ -985,12 +985,11 @@
FOR_EACH_CLIENT(other)
{
- // FIXME make this use the new score system
if ((clienttype(other) == CLIENTTYPE_REAL) || (clienttype(other) == CLIENTTYPE_BOT && cvar("sv_logscores_bots")))
{
- s = strcat(":player:see-labels:", GetPlayerScoreString(other), ":");
+ s = strcat(":player:see-labels:", GetPlayerScoreString(other, 0), ":");
s = strcat(s, ftos(rint(time - other.jointime)), ":");
- if(other.classname == "player")
+ if(other.classname == "player" || g_arena || g_lms)
s = strcat(s, ftos(other.team), ":");
else
s = strcat(s, "spectator:");
@@ -1006,7 +1005,7 @@
if(teamplay)
{
- s = strcat(":labels:teamscores:", GetTeamScoreString(0));
+ s = strcat(":labels:teamscores:", GetTeamScoreString(0, 0));
if(to_console)
ServerConsoleEcho(s, TRUE);
if(to_eventlog)
@@ -1016,7 +1015,7 @@
for(i = 1; i < 16; ++i)
{
- s = strcat(":teamscores:see-labels:", GetTeamScoreString(i));
+ s = strcat(":teamscores:see-labels:", GetTeamScoreString(i, 0));
s = strcat(s, ":", ftos(i));
if(to_console)
ServerConsoleEcho(s, TRUE);
Modified: trunk/data/qcsrc/server/scores.qc
===================================================================
--- trunk/data/qcsrc/server/scores.qc 2008-08-07 19:27:23 UTC (rev 4053)
+++ trunk/data/qcsrc/server/scores.qc 2008-08-08 08:17:03 UTC (rev 4054)
@@ -274,9 +274,20 @@
void WinningConditionHelper()
{
float c;
+ string s;
+ entity p;
+ s = GetGametype();
+ s = strcat(s, ":", GetPlayerScoreString(world, 2)); // make this 1 once we can
+
if(teamscores_entities_count)
{
float t;
+
+ s = strcat(s, ":", GetTeamScoreString(0, 1));
+ for(t = 0; t < 16; ++t)
+ if(teamscorekeepers[t])
+ s = strcat(s, ":", ftos(t+1), ":", GetTeamScoreString(t+1, 1));
+
WinningConditionHelper_equality = 1;
WinningConditionHelper_winnerteam = 0;
for(t = 1; t < 16; ++t)
@@ -304,7 +315,6 @@
}
else
{
- entity p;
WinningConditionHelper_equality = 1;
WinningConditionHelper_winner = world;
FOR_EACH_PLAYER(p)
@@ -325,6 +335,33 @@
WinningConditionHelper_winner = world;
WinningConditionHelper_winnerteam = -1;
}
+
+ if(worldstatus)
+ strunzone(worldstatus);
+ worldstatus = strzone(s);
+
+ FOR_EACH_CLIENT(p)
+ {
+ /* this breaks qstat :( find a way to make qstat parse this at least as an int first
+ s = GetPlayerScoreString(p, 1);
+ if(clienttype(p) == CLIENTTYPE_REAL)
+ s = strcat(s, ":human");
+ else
+ s = strcat(s, ":bot");
+ if(p.classname == "player" || g_arena || g_lms)
+ s = strcat(s, ":", ftos(p.team));
+ else
+ s = strcat(s, ":spectator");
+ */
+ if(p.classname == "player" || g_arena || g_lms)
+ s = "-666";
+ else
+ s = GetPlayerScoreString(p, 2);
+
+ if(p.clientstatus)
+ strunzone(p.clientstatus);
+ p.clientstatus = strzone(s);
+ }
}
void Score_DebugPrint()
@@ -373,7 +410,7 @@
return label;
}
-string GetPlayerScoreString(entity pl)
+string GetPlayerScoreString(entity pl, float shortString)
{
string out;
entity sk;
@@ -391,6 +428,7 @@
l = scores_label[i];
out = strcat(out, GetScoreLogLabel(l, f), ",");
}
+ if(shortString < 2)
for(i = 0; i < MAX_SCORE; ++i)
if(scores_flags[i] & SFL_SORT_PRIO_MASK == SFL_SORT_PRIO_SECONDARY)
{
@@ -398,6 +436,7 @@
l = scores_label[i];
out = strcat(out, GetScoreLogLabel(l, f), ",");
}
+ if(shortString < 1)
for(i = 0; i < MAX_SCORE; ++i)
if(scores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_PRIMARY)
if(scores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_SECONDARY)
@@ -413,9 +452,11 @@
for(i = 0; i < MAX_SCORE; ++i)
if(scores_flags[i] & SFL_SORT_PRIO_MASK == SFL_SORT_PRIO_PRIMARY)
out = strcat(out, ftos(sk.(scores[i])), ",");
+ if(shortString < 2)
for(i = 0; i < MAX_SCORE; ++i)
if(scores_flags[i] & SFL_SORT_PRIO_MASK == SFL_SORT_PRIO_SECONDARY)
out = strcat(out, ftos(sk.(scores[i])), ",");
+ if(shortString < 1)
for(i = 0; i < MAX_SCORE; ++i)
if(scores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_PRIMARY)
if(scores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_SECONDARY)
@@ -425,7 +466,7 @@
return out;
}
-string GetTeamScoreString(float tm)
+string GetTeamScoreString(float tm, float shortString)
{
string out;
entity sk;
@@ -443,6 +484,7 @@
l = teamscores_label[i];
out = strcat(out, GetScoreLogLabel(l, f), ",");
}
+ if(shortString < 2)
for(i = 0; i < MAX_SCORE; ++i)
if(teamscores_flags[i] & SFL_SORT_PRIO_MASK == SFL_SORT_PRIO_SECONDARY)
{
@@ -450,6 +492,7 @@
l = teamscores_label[i];
out = strcat(out, GetScoreLogLabel(l, f), ",");
}
+ if(shortString < 1)
for(i = 0; i < MAX_SCORE; ++i)
if(teamscores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_PRIMARY)
if(teamscores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_SECONDARY)
@@ -465,9 +508,11 @@
for(i = 0; i < MAX_TEAMSCORE; ++i)
if(teamscores_flags[i] & SFL_SORT_PRIO_MASK == SFL_SORT_PRIO_PRIMARY)
out = strcat(out, ftos(sk.(teamscores[i])), ",");
+ if(shortString < 2)
for(i = 0; i < MAX_TEAMSCORE; ++i)
if(teamscores_flags[i] & SFL_SORT_PRIO_MASK == SFL_SORT_PRIO_SECONDARY)
out = strcat(out, ftos(sk.(teamscores[i])), ",");
+ if(shortString < 1)
for(i = 0; i < MAX_TEAMSCORE; ++i)
if(teamscores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_PRIMARY)
if(teamscores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_SECONDARY)
Modified: trunk/data/qcsrc/server/scores.qh
===================================================================
--- trunk/data/qcsrc/server/scores.qh 2008-08-07 19:27:23 UTC (rev 4053)
+++ trunk/data/qcsrc/server/scores.qh 2008-08-08 08:17:03 UTC (rev 4054)
@@ -100,6 +100,7 @@
* Labels get an appended < if the scores are better if smaller (e.g. deaths).
* High priorities always come first.
* Example label string: score!!,kills,deaths<,suicides<
+ * If shortString is set, only the sort keys are returned.
*/
-string GetPlayerScoreString(entity pl);
-string GetTeamScoreString(float tm);
+string GetPlayerScoreString(entity pl, float shortString);
+string GetTeamScoreString(float tm, float shortString);
More information about the nexuiz-commits
mailing list