From 844b79084579641580b160ef0312b8b15847186e Mon Sep 17 00:00:00 2001 From: esteel Date: Wed, 12 Nov 2008 13:38:46 +0000 Subject: [PATCH] Ronans server info dialog git-svn-id: svn://svn.icculus.org/nexuiz/trunk@5040 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/gfx/menu/default/skinvalues.txt | 5 + data/gfx/menu/silver/skinvalues.txt | 5 + data/gfx/menu/simplygray/skinvalues.txt | 5 + data/gfx/menu/wickedblack/skinvalues.txt | 5 + data/gfx/menu/wickedblue/skinvalues.txt | 5 + data/gfx/menu/wickedgreen/skinvalues.txt | 5 + data/gfx/menu/wickedred/skinvalues.txt | 5 + data/gfx/menu/wickedwhite/skinvalues.txt | 5 + data/gfx/menu/wickedyellow/skinvalues.txt | 5 + data/gfx/menu/wickedz/skinvalues.txt | 5 + data/gfx/menu/xaw/skinvalues.txt | 5 + data/qcsrc/menu/classes.c | 2 + data/qcsrc/menu/mbuiltin.qh | 2 +- .../dialog_multiplayer_join_serverinfo.c | 195 ++++++++++++++++++ data/qcsrc/menu/nexuiz/mainwindow.c | 5 + data/qcsrc/menu/nexuiz/playerlist.c | 137 ++++++++++++ data/qcsrc/menu/nexuiz/serverlist.c | 17 ++ data/qcsrc/menu/skin-customizables.inc | 5 + 18 files changed, 417 insertions(+), 1 deletion(-) create mode 100644 data/qcsrc/menu/nexuiz/dialog_multiplayer_join_serverinfo.c create mode 100644 data/qcsrc/menu/nexuiz/playerlist.c diff --git a/data/gfx/menu/default/skinvalues.txt b/data/gfx/menu/default/skinvalues.txt index 6aa0fdcc7..73913499f 100644 --- a/data/gfx/menu/default/skinvalues.txt +++ b/data/gfx/menu/default/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '1 1 0.7' COLOR_DIALOG_CREDITS '0.7 0.7 1' COLOR_DIALOG_WEAPONS '1 0.7 0.7' COLOR_DIALOG_RADAR '0.7 0.7 1' +COLOR_DIALOG_SERVERINFO '0.7 0.7 1' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.4 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '0.4 0.4 0.7' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.4 0.4 0.7' diff --git a/data/gfx/menu/silver/skinvalues.txt b/data/gfx/menu/silver/skinvalues.txt index f3db33352..005e3ee5b 100644 --- a/data/gfx/menu/silver/skinvalues.txt +++ b/data/gfx/menu/silver/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '1 1 0.95' COLOR_DIALOG_CREDITS '0.7 0.7 1' COLOR_DIALOG_WEAPONS '0.8 0.8 0.8' COLOR_DIALOG_RADAR '0.8 0.8 0.8' +COLOR_DIALOG_SERVERINFO '0.6 0.7 0.8' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.2 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '0.2 0.7 0.2' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.4 0.4 0.7' diff --git a/data/gfx/menu/simplygray/skinvalues.txt b/data/gfx/menu/simplygray/skinvalues.txt index c1c3c90b9..6db7b70eb 100644 --- a/data/gfx/menu/simplygray/skinvalues.txt +++ b/data/gfx/menu/simplygray/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '0.9 0.9 0.9' COLOR_DIALOG_CREDITS '0.7 0.7 0.7' COLOR_DIALOG_WEAPONS '0.7 0.7 0.7' COLOR_DIALOG_RADAR '0.7 0.7 0.7' +COLOR_DIALOG_SERVERINFO '0.7 0.7 0.7' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.2 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '0 0.9 0.9' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.4 0.4 0.7' diff --git a/data/gfx/menu/wickedblack/skinvalues.txt b/data/gfx/menu/wickedblack/skinvalues.txt index bb6771bd5..a59cb5b4f 100644 --- a/data/gfx/menu/wickedblack/skinvalues.txt +++ b/data/gfx/menu/wickedblack/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '1 1 1' COLOR_DIALOG_WEAPONS '1 0.7 0.7' COLOR_DIALOG_RADAR '1 1 1' COLOR_DIALOG_CREDITS '1 1 1' +COLOR_DIALOG_SERVERINFO '1 1 1' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.4 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '0.9 0.9 0.9' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.75 0.75 0.75' diff --git a/data/gfx/menu/wickedblue/skinvalues.txt b/data/gfx/menu/wickedblue/skinvalues.txt index 99e3d7699..3b6dd9846 100644 --- a/data/gfx/menu/wickedblue/skinvalues.txt +++ b/data/gfx/menu/wickedblue/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '0.5 0.75 1' COLOR_DIALOG_CREDITS '0.5 0.75 1' COLOR_DIALOG_WEAPONS '0.5 0.75 1' COLOR_DIALOG_RADAR '0.5 0.75 1' +COLOR_DIALOG_SERVERINFO '0.5 0.75 1' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.4 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '0.5 0.75 1' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.75 0.75 0.75' diff --git a/data/gfx/menu/wickedgreen/skinvalues.txt b/data/gfx/menu/wickedgreen/skinvalues.txt index fb9856d98..9e2a4205d 100644 --- a/data/gfx/menu/wickedgreen/skinvalues.txt +++ b/data/gfx/menu/wickedgreen/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '0.5 1 0' COLOR_DIALOG_CREDITS '0.5 1 0' COLOR_DIALOG_WEAPONS '0.5 1 0' COLOR_DIALOG_RADAR '0.5 1 0' +COLOR_DIALOG_SERVERINFO '0.5 1 0' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.4 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '0.5 1 0' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.75 0.75 0.75' diff --git a/data/gfx/menu/wickedred/skinvalues.txt b/data/gfx/menu/wickedred/skinvalues.txt index c03b6812b..19ff2b2d5 100644 --- a/data/gfx/menu/wickedred/skinvalues.txt +++ b/data/gfx/menu/wickedred/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '1 0 0' COLOR_DIALOG_CREDITS '1 0 0' COLOR_DIALOG_WEAPONS '1 0 0' COLOR_DIALOG_RADAR '1 0 0' +COLOR_DIALOG_SERVERINFO '1 0 0' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.4 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '1 0 0' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.75 0.75 0.75' diff --git a/data/gfx/menu/wickedwhite/skinvalues.txt b/data/gfx/menu/wickedwhite/skinvalues.txt index 179f55fc8..0e39677f9 100644 --- a/data/gfx/menu/wickedwhite/skinvalues.txt +++ b/data/gfx/menu/wickedwhite/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '1 1 1' COLOR_DIALOG_CREDITS '1 1 1' COLOR_DIALOG_WEAPONS '1 1 1' COLOR_DIALOG_RADAR '1 1 1' +COLOR_DIALOG_SERVERINFO '1 1 1' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.4 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '0.9 0.9 0.9' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.75 0.75 0.75' diff --git a/data/gfx/menu/wickedyellow/skinvalues.txt b/data/gfx/menu/wickedyellow/skinvalues.txt index f39451d8f..cafe0f9d2 100644 --- a/data/gfx/menu/wickedyellow/skinvalues.txt +++ b/data/gfx/menu/wickedyellow/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '1 0.875 0' COLOR_DIALOG_CREDITS '1 0.875 0' COLOR_DIALOG_WEAPONS '1 0.875 0' COLOR_DIALOG_RADAR '1 0.875 0' +COLOR_DIALOG_SERVERINFO '1 0.875 0' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.4 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '1 0.875 0' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.75 0.75 0.75' diff --git a/data/gfx/menu/wickedz/skinvalues.txt b/data/gfx/menu/wickedz/skinvalues.txt index 93528b152..1496d50f1 100644 --- a/data/gfx/menu/wickedz/skinvalues.txt +++ b/data/gfx/menu/wickedz/skinvalues.txt @@ -34,6 +34,7 @@ COLOR_DIALOG_SINGLEPLAYER '0.4 0.8 0.9' COLOR_DIALOG_CREDITS '0.4 0.8 0.9' COLOR_DIALOG_WEAPONS '0.4 0.8 0.9' COLOR_DIALOG_RADAR '0.4 0.8 0.9' +COLOR_DIALOG_SERVERINFO '0.4 0.8 0.9' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -173,6 +174,10 @@ ALPHA_SERVERLIST_HIGHPING 0.4 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '0.6 0.4 0.1' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.75 0.75 0.75' diff --git a/data/gfx/menu/xaw/skinvalues.txt b/data/gfx/menu/xaw/skinvalues.txt index b59fadac3..c0a3d8b2a 100644 --- a/data/gfx/menu/xaw/skinvalues.txt +++ b/data/gfx/menu/xaw/skinvalues.txt @@ -20,6 +20,7 @@ COLOR_DIALOG_SINGLEPLAYER '1 1 1' COLOR_DIALOG_CREDITS '1 1 1' COLOR_DIALOG_WEAPONS '1 1 1' COLOR_DIALOG_RADAR '1 1 1' +COLOR_DIALOG_SERVERINFO '1 1 1' // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -159,6 +160,10 @@ ALPHA_SERVERLIST_HIGHPING 0.2 ALPHA_SERVERLIST_FAVORITE 0.8 COLOR_SERVERLIST_FAVORITE '1 1 1' +// item: server info +COLOR_SERVERINFO_NAME '1 1 1' +COLOR_SERVERINFO_IP '0 0 0' + // item: skin list COLOR_SKINLIST_TITLE '1 1 1' COLOR_SKINLIST_AUTHOR '0.5 0.5 0.5' diff --git a/data/qcsrc/menu/classes.c b/data/qcsrc/menu/classes.c index 1163670df..a58781859 100644 --- a/data/qcsrc/menu/classes.c +++ b/data/qcsrc/menu/classes.c @@ -42,6 +42,8 @@ #include "nexuiz/textslider.c" #include "nexuiz/colorbutton.c" #include "nexuiz/dialog_multiplayer_join.c" +#include "nexuiz/dialog_multiplayer_join_serverinfo.c" +#include "nexuiz/playerlist.c" #include "nexuiz/listbox.c" #include "nexuiz/serverlist.c" #include "nexuiz/inputbox.c" diff --git a/data/qcsrc/menu/mbuiltin.qh b/data/qcsrc/menu/mbuiltin.qh index e9d751200..c581de0a5 100644 --- a/data/qcsrc/menu/mbuiltin.qh +++ b/data/qcsrc/menu/mbuiltin.qh @@ -259,7 +259,7 @@ float(string s1, string s2, float len) strncmp = #228; float(string s1, string s2) strcasecmp = #229; float(string s1, string s2, float len) strncasecmp = #230; -string(string s) strdecolorize(string s) = #477; +string(string s) strdecolorize = #477; //DP_QC_STRINGBUFFERS //idea: ?? diff --git a/data/qcsrc/menu/nexuiz/dialog_multiplayer_join_serverinfo.c b/data/qcsrc/menu/nexuiz/dialog_multiplayer_join_serverinfo.c new file mode 100644 index 000000000..bc0752e4f --- /dev/null +++ b/data/qcsrc/menu/nexuiz/dialog_multiplayer_join_serverinfo.c @@ -0,0 +1,195 @@ +#ifdef INTERFACE +CLASS(NexuizServerInfoDialog) EXTENDS(NexuizDialog) + METHOD(NexuizServerInfoDialog, fill, void(entity)) + METHOD(NexuizServerInfoDialog, loadServerInfo, void(entity, float)) + ATTRIB(NexuizServerInfoDialog, title, string, "Server Information") + ATTRIB(NexuizServerInfoDialog, color, vector, SKINCOLOR_DIALOG_SERVERINFO) + ATTRIB(NexuizServerInfoDialog, intendedWidth, float, 0.60) + ATTRIB(NexuizServerInfoDialog, rows, float, 11) + ATTRIB(NexuizServerInfoDialog, columns, float, 12) + + ATTRIB(NexuizServerInfoDialog, currentServerName, string, string_null) + ATTRIB(NexuizServerInfoDialog, currentServerCName, string, string_null) + ATTRIB(NexuizServerInfoDialog, currentServerType, string, string_null) + ATTRIB(NexuizServerInfoDialog, currentServerMap, string, string_null) + ATTRIB(NexuizServerInfoDialog, currentServerPlayers, string, string_null) + ATTRIB(NexuizServerInfoDialog, currentServerNumPlayers, string, string_null) + ATTRIB(NexuizServerInfoDialog, currentServerNumBots, string, string_null) + ATTRIB(NexuizServerInfoDialog, currentServerMod, string, string_null) + ATTRIB(NexuizServerInfoDialog, currentServerVersion, string, string_null) + ATTRIB(NexuizServerInfoDialog, currentServerPing, string, string_null) + + ATTRIB(NexuizServerInfoDialog, nameLabel, entity, NULL) + ATTRIB(NexuizServerInfoDialog, cnameLabel, entity, NULL) + ATTRIB(NexuizServerInfoDialog, typeLabel, entity, NULL) + ATTRIB(NexuizServerInfoDialog, mapLabel, entity, NULL) + ATTRIB(NexuizServerInfoDialog, rawPlayerList, entity, NULL) + ATTRIB(NexuizServerInfoDialog, numPlayersLabel, entity, NULL) + ATTRIB(NexuizServerInfoDialog, numBotsLabel, entity, NULL) + ATTRIB(NexuizServerInfoDialog, modLabel, entity, NULL) + ATTRIB(NexuizServerInfoDialog, versionLabel, entity, NULL) + ATTRIB(NexuizServerInfoDialog, pingLabel, entity, NULL) + +ENDCLASS(NexuizServerInfoDialog) +#endif +float SLIST_FIELD_NAME; +float SLIST_FIELD_CNAME; +float SLIST_FIELD_QCSTATUS; +float SLIST_FIELD_MAP; +float SLIST_FIELD_PLAYERS; +float SLIST_FIELD_NUMHUMANS; +float SLIST_FIELD_MAXPLAYERS; +float SLIST_FIELD_NUMBOTS; +float SLIST_FIELD_MOD; +float SLIST_FIELD_PING; +string CURRENT_IP; //used by join button +void Join_Click(entity me); +#ifdef IMPLEMENTATION +void loadServerInfoNexuizServerInfoDialog(entity me, float i) +{ + float m; + string s, typestr, versionstr, numh, maxp; + + SLIST_FIELD_NAME = gethostcacheindexforkey("name"); + me.currentServerName = strzone(gethostcachestring(SLIST_FIELD_NAME, i)); + me.nameLabel.setText(me.nameLabel, me.currentServerName); + + 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"); + s = gethostcachestring(SLIST_FIELD_QCSTATUS, i); + m = tokenizebyseparator(s, ":"); + if(m > 1) + { + typestr = argv (0); + versionstr = argv(1); + } + else + { + typestr = "N.A."; + versionstr = "N.A."; + } + me.currentServerType = strzone(typestr); + me.typeLabel.setText(me.typeLabel, me.currentServerType); + + + SLIST_FIELD_MAP = gethostcacheindexforkey("map"); + me.currentServerMap = strzone(gethostcachestring(SLIST_FIELD_MAP, i)); + me.mapLabel.setText(me.mapLabel, me.currentServerMap); + + SLIST_FIELD_PLAYERS = gethostcacheindexforkey("players"); + me.currentServerPlayers = strzone(gethostcachestring(SLIST_FIELD_PLAYERS, i)); + me.rawPlayerList.setPlayerList(me.rawPlayerList, me.currentServerPlayers); + + SLIST_FIELD_NUMHUMANS = gethostcacheindexforkey("numhumans"); + numh = ftos(gethostcachenumber(SLIST_FIELD_NUMHUMANS, i)); + SLIST_FIELD_MAXPLAYERS = gethostcacheindexforkey("maxplayers"); + maxp = ftos(gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i)); + me.currentServerNumPlayers = strzone(strcat(numh,"/",maxp)); + me.numPlayersLabel.setText(me.numPlayersLabel, me.currentServerNumPlayers); + + SLIST_FIELD_NUMBOTS = gethostcacheindexforkey("numbots"); + s = ftos(gethostcachenumber(SLIST_FIELD_NUMBOTS, i)); + me.currentServerNumBots = strzone(s); + me.numBotsLabel.setText(me.numBotsLabel, me.currentServerNumBots); + + SLIST_FIELD_MOD = gethostcacheindexforkey("mod"); + me.currentServerMod = strzone(gethostcachestring(SLIST_FIELD_MOD, i)); + me.modLabel.setText(me.modLabel, me.currentServerMod); + + me.currentServerVersion = strzone(versionstr); + me.versionLabel.setText(me.versionLabel, me.currentServerVersion); + + SLIST_FIELD_PING = gethostcacheindexforkey("ping"); + s = ftos(gethostcachenumber(SLIST_FIELD_PING, i)); + me.currentServerPing = strzone(s); + me.pingLabel.setText(me.pingLabel, me.currentServerPing); +} + +void fillNexuizServerInfoDialog(entity me) +{ + entity e; + me.TR(me); + me.TD(me, 1, me.columns, e = makeNexuizTextLabel(0.5, "")); + e.alpha = 1; + e.colorL = SKINCOLOR_SERVERINFO_NAME; + e.allowCut = 1; + me.nameLabel = e; + me.TR(me); + me.TD(me, 1, me.columns, e = makeNexuizTextLabel(0.5, "")); + e.alpha = 1; + e.colorL = SKINCOLOR_SERVERINFO_IP; + e.allowCut = 1; + me.cnameLabel = e; + + me.TR(me); + me.TD(me, 1, 6, e = makeNexuizTextLabel(0, "Players :")); + e.alpha = 1; + me.TR(me); + me.TD(me, me.rows - 4, 5.5, e = makeNexuizPlayerList()); + me.rawPlayerList = e; + + me.gotoRC(me, 1, 6); me.setFirstColumn(me, me.currentColumn); + + me.TR(me); + me.TD(me, 1, 1.75, e = makeNexuizTextLabel(0, "Type :")); + e.alpha = 1; + me.TD(me, 1, 4.5, e = makeNexuizTextLabel(0, "")); + e.allowCut = 1; + me.typeLabel = e; + me.TR(me); + me.TD(me, 1, 1.75, e = makeNexuizTextLabel(0, "Map :")); + e.alpha = 1; + me.TD(me, 1, 4.5, e = makeNexuizTextLabel(0, "")); + e.allowCut = 1; + me.mapLabel = e; + me.TR(me); + me.TD(me, 1, 1.75, e = makeNexuizTextLabel(0, "Players :")); + e.alpha = 1; + me.TD(me, 1, 4.5, e = makeNexuizTextLabel(0, "")); + e.allowCut = 1; + me.numPlayersLabel = e; + me.TR(me); + me.TD(me, 1, 1.75, e = makeNexuizTextLabel(0, "Bots :")); + e.alpha = 1; + me.TD(me, 1, 4.5, e = makeNexuizTextLabel(0, "")); + e.allowCut = 1; + me.numBotsLabel = e; + me.TR(me); + me.TD(me, 1, 1.75, e = makeNexuizTextLabel(0, "Mod :")); + e.alpha = 1; + me.TD(me, 1, 4.5, e = makeNexuizTextLabel(0, "")); + e.allowCut = 1; + me.modLabel = e; + me.TR(me); + me.TD(me, 1, 1.75, e = makeNexuizTextLabel(0, "Version :")); + e.alpha = 1; + me.TD(me, 1, 4.5, e = makeNexuizTextLabel(0, "")); + e.allowCut = 1; + me.versionLabel = e; + me.TR(me); + me.TD(me, 1, 1.75, e = makeNexuizTextLabel(0, "Ping :")); + e.alpha = 1; + me.TD(me, 1, 4.5, e = makeNexuizTextLabel(0, "")); + e.allowCut = 1; + me.pingLabel = e; + + me.gotoRC(me, me.rows - 1, 0); + + me.TD(me, 1, me.columns - 6, e = makeNexuizButton("OK", '0 0 0')); + e.onClick = Dialog_Close; + e.onClickEntity = me; + me.TD(me, 1, me.columns - 6, e = makeNexuizButton("Join!", '0 0 0')); + e.onClick = Join_Click; + e.onClickEntity = me; +} + +void Join_Click(entity me) +{ + localcmd("connect ", CURRENT_IP, "\n"); +} + +#endif diff --git a/data/qcsrc/menu/nexuiz/mainwindow.c b/data/qcsrc/menu/nexuiz/mainwindow.c index 2243d5af8..e47ddb88c 100644 --- a/data/qcsrc/menu/nexuiz/mainwindow.c +++ b/data/qcsrc/menu/nexuiz/mainwindow.c @@ -7,6 +7,7 @@ CLASS(MainWindow) EXTENDS(ModalController) ATTRIB(MainWindow, userbindEditDialog, entity, NULL) ATTRIB(MainWindow, winnerDialog, entity, NULL) ATTRIB(MainWindow, radarDialog, entity, NULL) + ATTRIB(MainWindow, serverInfoDialog, entity, NULL) ATTRIB(MainWindow, mainNexposee, entity, NULL) ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND) ENDCLASS(MainWindow) @@ -54,6 +55,10 @@ void configureMainWindowMainWindow(entity me) i.configureDialog(i); me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + me.serverInfoDialog = i = spawnNexuizServerInfoDialog(); + i.configureDialog(i); + me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + me.mainNexposee = n = spawnNexuizNexposee(); /* if(checkextension("DP_GECKO_SUPPORT")) diff --git a/data/qcsrc/menu/nexuiz/playerlist.c b/data/qcsrc/menu/nexuiz/playerlist.c new file mode 100644 index 000000000..ca1600b61 --- /dev/null +++ b/data/qcsrc/menu/nexuiz/playerlist.c @@ -0,0 +1,137 @@ +#ifdef INTERFACE +CLASS(NexuizPlayerList) EXTENDS(NexuizListBox) + ATTRIB(NexuizPlayerList, rowsPerItem, float, 1) + METHOD(NexuizPlayerList, resizeNotify, void(entity, vector, vector, vector, vector)) + METHOD(NexuizPlayerList, drawListBoxItem, void(entity, float, vector, float)) + ATTRIB(NexuizPlayerList, realFontSize, vector, '0 0 0') + ATTRIB(NexuizPlayerList, columnNameOrigin, float, 0) + ATTRIB(NexuizPlayerList, columnNameSize, float, 0) + ATTRIB(NexuizPlayerList, realUpperMargin, float, 0) + ATTRIB(NexuizPlayerList, origin, vector, '0 0 0') + ATTRIB(NexuizPlayerList, itemAbsSize, vector, '0 0 0') + METHOD(NexuizPlayerList, setPlayerList, void(entity, string)) + METHOD(NexuizPlayerList, getPlayerList, string(entity, float, float)) + ATTRIB(NexuizPlayerList, playerList, float, -1) +ENDCLASS(NexuizPlayerList) +entity makeNexuizPlayerList(); +#endif + +#ifdef IMPLEMENTATION + +#define PLAYERPARM_SCORE 0 +#define PLAYERPARM_PING 1 +#define PLAYERPARM_NAME 2 +#define PLAYERPARM_COUNT 3 + +entity makeNexuizPlayerList() +{ + entity me; + me = spawnNexuizPlayerList(); + me.configureNexuizListBox(me); + return me; +} + +void setPlayerListNexuizPlayerList(entity me, string plist) +{ + dprint(plist,"------------\n"); + + float buf,i; + string s; + + buf = buf_create(); + me.nItems = tokenizebyseparator(plist, "\n"); + for(i = 0; i < me.nItems; ++i) + { + bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME, argv(i)); // -666 100 "^4Nex ^2Player" + } + + for(i = 0; i < me.nItems; ++i) + { + s = bufstr_get(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME); + tokenize_sane(s); + 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_NAME, argv(2)); // ^4Nex ^2Player + } + me.playerList = buf; +} + +string getPlayerListNexuizPlayerList(entity me, float i, float key) +{ + return bufstr_get(me.playerList, i * PLAYERPARM_COUNT + key); +} + +void resizeNotifyNexuizPlayerList(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) +{ + me.origin = absOrigin; + me.itemAbsSize = '0 0 0'; + resizeNotifyNexuizListBox(me, relOrigin, relSize, absOrigin, absSize); + + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); + me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + + me.columnNameOrigin = me.realFontSize_x; + me.columnNameSize = 1 - 2 * me.realFontSize_x; +} + +void drawListBoxItemNexuizPlayerList(entity me, float i, vector absSize, float isSelected) +{ + string s, ch, ch2; + float maxTextLen, textLen; + float j; + vector theOrigin, theSize, theColor; + float theAlpha; + float brightness; + + + s = me.getPlayerList(me, i, PLAYERPARM_NAME); + maxTextLen = strlen(draw_TextShortenToWidth(strdecolorize(s), 0.95 * me.columnNameSize / me.realFontSize_x, 0)); + brightness = cvar("r_textbrightness"); + theOrigin = me.realUpperMargin * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0) * me.realFontSize_x)) * eX ; + theSize = me.realFontSize; + theColor = '1 1 1'; + theAlpha = 1; + + for(j = 0; j < strlen(s); ++j) + { + ch = substring(s, j, 1); + if(ch == "^") + { + ch2 = substring(s, j+1, 1); + if(ch2 == "0" || stof(ch2))// digit? + { + switch(stof(ch2)) + { + case 0: theColor = '0 0 0'; theAlpha = 1; break; + case 1: theColor = '1 0 0'; theAlpha = 1; break; + case 2: theColor = '0 1 0'; theAlpha = 1; break; + case 3: theColor = '1 1 0'; theAlpha = 1; break; + case 4: theColor = '0 0 1'; theAlpha = 1; break; + case 5: theColor = '0 1 1'; theAlpha = 1; break; + case 6: theColor = '1 0 1'; theAlpha = 1; break; + case 7: theColor = '1 1 1'; theAlpha = 1; break; + case 8: theColor = '1 1 1'; theAlpha = 0.5; break; + case 9: theColor = '0.5 0.5 0.5'; theAlpha = 1; break; + } + theColor = theColor * (1 - brightness) + brightness * '1 1 1'; + ++j; + continue; + } + } + + if (textLen < maxTextLen) + { + draw_Text(theOrigin, ch, theSize, theColor, theAlpha, 0); + theOrigin += eX * draw_TextWidth(ch, 0) * me.realFontSize_x; + ++textLen; + } + else + { + draw_Text(theOrigin, "...", theSize, theColor, theAlpha, 0); + break; + } + } +} + +#endif diff --git a/data/qcsrc/menu/nexuiz/serverlist.c b/data/qcsrc/menu/nexuiz/serverlist.c index 6b62837f6..c19c2b56d 100644 --- a/data/qcsrc/menu/nexuiz/serverlist.c +++ b/data/qcsrc/menu/nexuiz/serverlist.c @@ -545,6 +545,23 @@ float keyDownNexuizServerList(entity me, float scan, float ascii, float shift) if(i < me.nItems) ToggleFavorite(me.selectedServer); } + else if(scan == K_MOUSE2) + { + if(i == me.lastClickedDemo) + if(time < me.lastClickedTime + 0.3) + { + // DOUBLE CLICK! + main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem); + DialogOpenButton_Click(NULL, main.serverInfoDialog); + } + me.lastClickedServer = i; + me.lastClickedTime = time; + } + else if(scan == K_MOUSE3 || scan == K_SPACE) + { + main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem); + DialogOpenButton_Click(NULL, main.serverInfoDialog); + } else if(keyDownListBox(me, scan, ascii, shift)) return 1; else if(!me.controlledTextbox) diff --git a/data/qcsrc/menu/skin-customizables.inc b/data/qcsrc/menu/skin-customizables.inc index 55966f57a..0b54a1051 100644 --- a/data/qcsrc/menu/skin-customizables.inc +++ b/data/qcsrc/menu/skin-customizables.inc @@ -53,6 +53,7 @@ SKINBEGIN SKINVECTOR(COLOR_DIALOG_WEAPONS, '1 0.7 0.7'); SKINVECTOR(COLOR_DIALOG_RADAR, '0.7 0.7 1'); SKINVECTOR(COLOR_DIALOG_DEMOBROSWER, '0.7 0.7 1'); + SKINVECTOR(COLOR_DIALOG_SERVERINFO, '0.7 0.7 1'); // nexposee positions of windows (they are the scale transformation // centers, NOT the actual positions of the windows!) @@ -192,6 +193,10 @@ SKINBEGIN SKINFLOAT(ALPHA_SERVERLIST_FAVORITE, 0.8); SKINVECTOR(COLOR_SERVERLIST_FAVORITE, '1 1 1'); + // item: server info + SKINVECTOR(COLOR_SERVERINFO_NAME, '1 1 1'); + SKINVECTOR(COLOR_SERVERINFO_IP, '0.4 0.4 0.7'); + // item: skin list SKINVECTOR(COLOR_SKINLIST_TITLE, '1 1 1'); SKINVECTOR(COLOR_SKINLIST_AUTHOR, '0.4 0.4 0.7'); -- 2.39.2