r2971 - in trunk/data: gfx qcsrc/common qcsrc/menu-div0test qcsrc/menu-div0test/defaultskin qcsrc/menu-div0test/nexuiz
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Nov 16 10:22:24 EST 2007
Author: div0
Date: 2007-11-16 10:22:19 -0500 (Fri, 16 Nov 2007)
New Revision: 2971
Added:
trunk/data/gfx/font_user0.tga
trunk/data/gfx/font_user0.width
trunk/data/qcsrc/menu-div0test/defaultskin/checkmark.tga
trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_create_mutators.c
trunk/data/qcsrc/menu-div0test/nexuiz/maplist.c
Modified:
trunk/data/qcsrc/common/mapinfo.qc
trunk/data/qcsrc/common/mapinfo.qh
trunk/data/qcsrc/menu-div0test/classes.c
trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_create.c
trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
trunk/data/qcsrc/menu-div0test/nexuiz/radiobutton.c
trunk/data/qcsrc/menu-div0test/skin.qh
Log:
add server browser, and somewhat broken font. When will Ubuntu fix perl-fu?
Added: trunk/data/gfx/font_user0.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/gfx/font_user0.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/data/gfx/font_user0.width
===================================================================
--- trunk/data/gfx/font_user0.width (rev 0)
+++ trunk/data/gfx/font_user0.width 2007-11-16 15:22:19 UTC (rev 2971)
@@ -0,0 +1,17 @@
+extraspacing 0.1
+0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000
+0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000
+0.28125 0.37500 0.43750 0.68750 0.56250 0.81250 0.71875 0.25000 0.37500 0.37500 0.43750 0.68750 0.31250 0.34375 0.31250 0.31250
+0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.31250 0.31250 0.68750 0.68750 0.68750 0.46875
+0.81250 0.62500 0.62500 0.59375 0.68750 0.56250 0.56250 0.65625 0.68750 0.31250 0.37500 0.65625 0.53125 0.81250 0.68750 0.68750
+0.59375 0.68750 0.62500 0.59375 0.56250 0.65625 0.62500 0.90625 0.62500 0.59375 0.59375 0.37500 0.31250 0.37500 0.68750 0.40625
+0.40625 0.56250 0.59375 0.46875 0.59375 0.56250 0.37500 0.59375 0.59375 0.28125 0.31250 0.56250 0.28125 0.84375 0.59375 0.56250
+0.59375 0.59375 0.40625 0.46875 0.37500 0.59375 0.53125 0.75000 0.53125 0.53125 0.46875 0.59375 0.31250 0.59375 0.68750 0.90000
+0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000
+0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000 0.90000
+0.28125 0.37500 0.43750 0.59375 0.56250 0.81250 0.71875 0.25000 0.37500 0.40625 0.43750 0.68750 0.37500 0.34375 0.31250 0.43750
+0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.56250 0.31250 0.37500 0.68750 0.68750 0.68750 0.46875
+0.81250 0.68750 0.62500 0.59375 0.68750 0.59375 0.59375 0.65625 0.68750 0.34375 0.43750 0.68750 0.53125 0.81250 0.68750 0.68750
+0.59375 0.68750 0.62500 0.59375 0.62500 0.65625 0.68750 0.93750 0.71875 0.65625 0.62500 0.37500 0.31250 0.40625 0.68750 0.43750
+0.40625 0.56250 0.59375 0.46875 0.59375 0.56250 0.43750 0.59375 0.59375 0.34375 0.46875 0.59375 0.34375 0.84375 0.59375 0.56250
+0.62500 0.59375 0.43750 0.46875 0.43750 0.59375 0.56250 0.75000 0.59375 0.56250 0.46875 0.59375 0.31250 0.59375 0.68750 0.90000
Modified: trunk/data/qcsrc/common/mapinfo.qc
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qc 2007-11-16 13:24:52 UTC (rev 2970)
+++ trunk/data/qcsrc/common/mapinfo.qc 2007-11-16 15:22:19 UTC (rev 2971)
@@ -165,6 +165,13 @@
{
if(startsWith(s, "\"classname\" \"worldspawn\""))
inWorldspawn = 1;
+ else if((v = extractRestOfLine(s, "\"author\" \"")))
+ {
+ for(l = strlen(v) - 1; l > 0; --l)
+ if(substring(v, l, 1) == "\"")
+ break;
+ MapInfo_Map_author = substring(v, 0, l);
+ }
else if((v = extractRestOfLine(s, "\"message\" \"")))
{
for(l = strlen(v) - 1; l > 0; --l)
@@ -248,6 +255,7 @@
{
MapInfo_Map_title = "Untitled1";
MapInfo_Map_description = "Bleh.";
+ MapInfo_Map_author = "He-Who-Must-Not-Be-Named";
MapInfo_Map_supportedGametypes = 0;
MapInfo_Map_supportedFeatures = 0;
MapInfo_Map_diameter = 0;
@@ -304,6 +312,8 @@
r = 1;
+ MapInfo_Map_bspname = pFilename;
+
// default all generic fields so they have "good" values in case something fails
fn = strcat("maps/", pFilename, ".mapinfo");
fh = fopen(fn, FILE_READ);
@@ -318,6 +328,7 @@
fh = fopen(fn, FILE_WRITE);
fputs(fh, strcat("title ", MapInfo_Map_title, "\n"));
fputs(fh, strcat("description ", MapInfo_Map_description, "\n"));
+ fputs(fh, strcat("author ", MapInfo_Map_author, "\n"));
fputs(fh, strcat("_diameter ", ftos(MapInfo_Map_diameter), "\n"));
fputs(fh, strcat("_spawnpoints ", ftos(MapInfo_Map_spawnpoints), "\n"));
if(MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) fputs(fh, "has weapons\n");
@@ -346,9 +357,11 @@
break;
t = car(s); s = cdr(s);
if (t == "title")
- MapInfo_Map_title = t;
+ MapInfo_Map_title = s;
else if(t == "description")
- MapInfo_Map_description = substring(s, 12, strlen(s) - 12);
+ MapInfo_Map_description = s;
+ else if(t == "author")
+ MapInfo_Map_author = s;
else if(t == "_diameter")
MapInfo_Map_diameter = stof(s);
else if(t == "_spawnpoints")
@@ -382,22 +395,23 @@
return 0;
}
-string MapInfo_FixName(string s)
+string _MapInfo_FindName_match;
+float MapInfo_FindName(string s)
{
// if there is exactly one map of prefix s, return it
// if not, return the null string
// note that DP sorts glob results... so I can use a binary search
- string match;
float l, r, m, cmp;
l = 0;
r = MapInfo_count;
+ _MapInfo_FindName_match = string_null;
// invariants: r is behind s, l-1 is equal or before
while(l != r)
{
m = floor((l + r) / 2);
cmp = strcasecmp(_MapInfo_GlobItem(HugeSetOfIntegers_get(_MapInfo_filtered, m)), s);
if(cmp == 0)
- return s; // found and good
+ return m; // found and good
if(cmp < 0)
l = m + 1; // l-1 is before s
else
@@ -407,17 +421,23 @@
// SO: if there is any, l is the one with the right prefix
// and l+1 may be one too
if(l == MapInfo_count)
- return string_null; // no match, behind last item
- match = _MapInfo_GlobItem(HugeSetOfIntegers_get(_MapInfo_filtered, l));
- if(!startsWith(match, s))
- return string_null; // wrong prefix
+ return -1; // no _MapInfo_FindName_match, behind last item
+ _MapInfo_FindName_match = _MapInfo_GlobItem(HugeSetOfIntegers_get(_MapInfo_filtered, l));
+ if(!startsWith(_MapInfo_FindName_match, s))
+ return -1; // wrong prefix
if(l == MapInfo_count - 1)
- return match; // last one, nothing can follow => unique
+ return l; // last one, nothing can follow => unique
if(startsWith(_MapInfo_GlobItem(HugeSetOfIntegers_get(_MapInfo_filtered, l + 1)), s))
- return string_null; // ambigous match
- return match;
+ return -1; // ambigous _MapInfo_FindName_match
+ return l;
}
+string MapInfo_FixName(string s)
+{
+ MapInfo_FindName(s);
+ return _MapInfo_FindName_match;
+}
+
float MapInfo_CurrentFeatures()
{
float req;
Modified: trunk/data/qcsrc/common/mapinfo.qh
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qh 2007-11-16 13:24:52 UTC (rev 2970)
+++ trunk/data/qcsrc/common/mapinfo.qh 2007-11-16 15:22:19 UTC (rev 2971)
@@ -15,8 +15,10 @@
float MapInfo_count;
// info about a map that MapInfo loads
+string MapInfo_Map_bspname;
string MapInfo_Map_title;
string MapInfo_Map_description;
+string MapInfo_Map_author;
float MapInfo_Map_supportedGametypes;
float MapInfo_Map_supportedFeatures;
float MapInfo_Map_diameter;
@@ -38,6 +40,7 @@
float MapInfo_Get_ByName(string s, float allowGenerate, float gametypeToSet); // 1 on success, 0 on failure, 2 if it autogenerated a mapinfo file
// look for a map by a prefix, returns the actual map name on success, string_null on failure or ambigous match
+float MapInfo_FindName(string s);
string MapInfo_FixName(string s);
// play a map
Modified: trunk/data/qcsrc/menu-div0test/classes.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/classes.c 2007-11-16 13:24:52 UTC (rev 2970)
+++ trunk/data/qcsrc/menu-div0test/classes.c 2007-11-16 15:22:19 UTC (rev 2971)
@@ -43,4 +43,6 @@
#include "nexuiz/inputbox.c"
#include "nexuiz/dialog_quit.c"
#include "nexuiz/dialog_multiplayer_create.c"
+#include "nexuiz/dialog_multiplayer_create_mutators.c"
#include "nexuiz/gametypebutton.c"
+#include "nexuiz/maplist.c"
Added: trunk/data/qcsrc/menu-div0test/defaultskin/checkmark.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/qcsrc/menu-div0test/defaultskin/checkmark.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_create.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_create.c 2007-11-16 13:24:52 UTC (rev 2970)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_create.c 2007-11-16 15:22:19 UTC (rev 2971)
@@ -7,6 +7,7 @@
ATTRIB(NexuizServerCreateTab, rows, float, 22)
ATTRIB(NexuizServerCreateTab, columns, float, 6.5)
+ ATTRIB(NexuizServerCreateTab, mapListBox, entity, NULL)
ATTRIB(NexuizServerCreateTab, sliderFraglimit, entity, NULL)
ATTRIB(NexuizServerCreateTab, checkboxFraglimit, entity, NULL)
ENDCLASS(NexuizServerCreateTab)
@@ -27,23 +28,23 @@
entity e, e0;
me.TR(me);
- me.TD(me, 1, me.columns / 9, e = makeNexuizGametypeButton(1, "g_dm", "DM"));
+ me.TD(me, 2, me.columns / 9, e = makeNexuizGametypeButton(1, "g_dm", "Deathmatch"));
e0 = e;
- me.TD(me, 1, me.columns / 9, e = makeNexuizGametypeButton(1, "g_tdm", "TDM"));
+ me.TD(me, 2, me.columns / 9, e = makeNexuizGametypeButton(1, "g_tdm", "TDM"));
if(e.checked) e0 = NULL;
- me.TD(me, 1, me.columns / 9, e = makeNexuizGametypeButton(1, "g_lms", "LMS"));
+ me.TD(me, 2, me.columns / 9, e = makeNexuizGametypeButton(1, "g_lms", "LMS"));
if(e.checked) e0 = NULL;
- me.TD(me, 1, me.columns / 9, e = makeNexuizGametypeButton(1, "g_arena", "Arena"));
+ me.TD(me, 2, me.columns / 9, e = makeNexuizGametypeButton(1, "g_arena", "Arena"));
if(e.checked) e0 = NULL;
- me.TD(me, 1, me.columns / 9, e = makeNexuizGametypeButton(1, "g_runematch", "Rune"));
+ me.TD(me, 2, me.columns / 9, e = makeNexuizGametypeButton(1, "g_runematch", "Rune"));
if(e.checked) e0 = NULL;
- me.TD(me, 1, me.columns / 9, e = makeNexuizGametypeButton(1, "g_keyhunt", "Key Hunt"));
+ me.TD(me, 2, me.columns / 9, e = makeNexuizGametypeButton(1, "g_keyhunt", "Key Hunt"));
if(e.checked) e0 = NULL;
- me.TD(me, 1, me.columns / 9, e = makeNexuizGametypeButton(1, "g_ctf", "CTF"));
+ me.TD(me, 2, me.columns / 9, e = makeNexuizGametypeButton(1, "g_ctf", "CTF"));
if(e.checked) e0 = NULL;
- me.TD(me, 1, me.columns / 9, e = makeNexuizGametypeButton(1, "g_assault", "Assault"));
+ me.TD(me, 2, me.columns / 9, e = makeNexuizGametypeButton(1, "g_assault", "Assault"));
if(e.checked) e0 = NULL;
- me.TD(me, 1, me.columns / 9, e = makeNexuizGametypeButton(1, "g_onslaught", "Onslaught"));
+ me.TD(me, 2, me.columns / 9, e = makeNexuizGametypeButton(1, "g_onslaught", "Onslaught"));
if(e.checked) e0 = NULL;
if(e0)
{
@@ -52,9 +53,15 @@
}
me.TR(me);
me.TR(me);
+ me.TR(me);
me.TD(me, 1, 3, e = makeNexuizTextLabel(0, "Map list:"));
+ me.TR(me);
+ me.TD(me, me.rows - 5, 3, e = makeNexuizMapList());
+ me.mapListBox = e;
- me.gotoXY(me, 2, 3.5); me.setFirstColumn(me, me.currentColumn);
+ me.gotoXY(me, 3, 3.5); me.setFirstColumn(me, me.currentColumn);
+ me.TD(me, 1, 3, e = makeNexuizTextLabel(0, "Settings:"));
+ me.TR(me);
me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Time limit:"));
me.TD(me, 1, 2, e = makeNexuizSlider(1.0, 60.0, 0.5, "timelimit_override"));
me.TR(me);
@@ -62,6 +69,10 @@
me.checkboxFraglimit = e;
me.TD(me, 1, 2, e = makeNexuizSlider(1.0, 2000.0, 5, "fraglimit_override"));
me.sliderFraglimit = e;
+ me.TR(me);
+ me.TD(me, 1, 1, e = makeNexuizButton("Mutators", '0 0 0'));
+ e.onClick = DialogOpenButton_Click;
+ e.onClickEntity = main.mutatorsDialog;
me.gotoXY(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeNexuizButton("Start!", '0 0 0'));
@@ -92,8 +103,7 @@
case MAPINFO_TYPE_LMS: GameType_ConfigureSliders(e, l, "Lives:", 3, 50, 1, "g_lms_lives_override"); break;
default: GameType_ConfigureSliders(e, l, "Frag limit:", 5, 100, 5, "fraglimit_override"); break;
}
- MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures());
- print(ftos(MapInfo_count), " maps\n");
+ me.mapListBox.refilter(me.mapListBox);
}
#endif
Added: trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_create_mutators.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_create_mutators.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_create_mutators.c 2007-11-16 15:22:19 UTC (rev 2971)
@@ -0,0 +1,58 @@
+#ifdef INTERFACE
+CLASS(NexuizMutatorsDialog) EXTENDS(NexuizDialog)
+ METHOD(NexuizMutatorsDialog, fill, void(entity))
+ METHOD(NexuizMutatorsDialog, showNotify, void(entity))
+ ATTRIB(NexuizMutatorsDialog, title, string, "Mutators")
+ ATTRIB(NexuizMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
+ ATTRIB(NexuizMutatorsDialog, intendedWidth, float, 0.6)
+ ATTRIB(NexuizMutatorsDialog, rows, float, 8)
+ ATTRIB(NexuizMutatorsDialog, columns, float, 4)
+ENDCLASS(NexuizMutatorsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void showNotifyNexuizMutatorsDialog(entity me)
+{
+ loadAllCvars(me);
+}
+void fillNexuizMutatorsDialog(entity me)
+{
+ entity e;
+ me.TR(me);
+ me.TD(me, 1, 2, makeNexuizTextLabel(0, "Game mutators:"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_cloaked", "Cloaked"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_footsteps", "Foot steps"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_grappling_hook", "Grappling hook"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_laserguided_missile", "Laser guided missiles"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_midair", "Mid-air"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_vampire", "Vampire"));
+
+ me.gotoXY(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
+ me.TD(me, 1, 2, makeNexuizTextLabel(0, "Arena mutators:"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizRadioButton(1, string_null, string_null, "Regular"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_instagib", string_null, "InstaGib"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_minstagib", string_null, "MinstaGib"));
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_nixnex", string_null, "NixNex"));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.8, e = makeNexuizCheckBox(1, "g_nixnex_with_laser", "with laser"));
+ setDependent(e, "g_nixnex", 1, 1);
+ me.TR(me);
+ me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_rocketarena", string_null, "Rocket launcher arena"));
+
+ me.gotoXY(me, me.rows - 1, 0);
+ me.TD(me, 1, me.columns, e = makeNexuizButton("OK", '0 0 0'));
+ e.onClick = Dialog_Close;
+ e.onClickEntity = me;
+}
+#endif
Modified: trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c 2007-11-16 13:24:52 UTC (rev 2970)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c 2007-11-16 15:22:19 UTC (rev 2971)
@@ -1,6 +1,7 @@
#ifdef INTERFACE
CLASS(MainWindow) EXTENDS(ModalController)
METHOD(MainWindow, configureMainWindow, void(entity))
+ ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
ENDCLASS(MainWindow)
#endif
@@ -18,6 +19,14 @@
{
entity n, i;
+ i = spawnNexuizTeamSelectDialog();
+ i.configureDialog(i);
+ me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
+
+ me.mutatorsDialog = i = spawnNexuizMutatorsDialog();
+ i.configureDialog(i);
+ me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
+
n = spawnNexuizNexposee();
i = spawnNexuizSettingsDialog();
i.configureDialog(i);
@@ -34,11 +43,8 @@
n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
n.setNexposee(n, i, '0.9 1.2 0', 0.5, 0.8);
me.addItem(me, n, '0 0 0', '1 1 0', 1);
+ me.moveItemAfter(me, n, NULL);
- i = spawnNexuizTeamSelectDialog();
- i.configureDialog(i);
- me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
-
me.initializeDialog(me, n);
}
#endif
Added: trunk/data/qcsrc/menu-div0test/nexuiz/maplist.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/maplist.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/maplist.c 2007-11-16 15:22:19 UTC (rev 2971)
@@ -0,0 +1,159 @@
+#ifdef INTERFACE
+CLASS(NexuizMapList) EXTENDS(NexuizListBox)
+ METHOD(NexuizMapList, configureNexuizMapList, void(entity))
+ ATTRIB(NexuizMapList, rowsPerItem, float, 4)
+ METHOD(NexuizMapList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(NexuizMapList, clickListBoxItem, void(entity, float, vector))
+ METHOD(NexuizMapList, resizeNotify, void(entity, vector, vector, vector, vector))
+ METHOD(NexuizMapList, refilter, void(entity))
+
+ ATTRIB(NexuizMapList, realFontSize, vector, '0 0 0')
+ ATTRIB(NexuizMapList, columnPreviewOrigin, float, 0)
+ ATTRIB(NexuizMapList, columnPreviewSize, float, 0)
+ ATTRIB(NexuizMapList, columnNameOrigin, float, 0)
+ ATTRIB(NexuizMapList, columnNameSize, float, 0)
+ ATTRIB(NexuizMapList, checkMarkOrigin, vector, '0 0 0')
+ ATTRIB(NexuizMapList, checkMarkSize, vector, '0 0 0')
+ ATTRIB(NexuizMapList, realUpperMargin1, float, 0)
+ ATTRIB(NexuizMapList, realUpperMargin2, float, 0)
+
+ ATTRIB(NexuizMapList, lastClickedMap, float, -1)
+ ATTRIB(NexuizMapList, lastClickedTime, float, 0)
+
+ ATTRIB(NexuizMapList, g_maplistCache, string, string_null)
+ METHOD(NexuizMapList, g_maplistCacheToggle, void(entity, float))
+ METHOD(NexuizMapList, g_maplistCacheQuery, float(entity, float))
+ENDCLASS(NexuizMapList)
+entity makeNexuizMapList();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeNexuizMapList()
+{
+ entity me;
+ me = spawnNexuizMapList();
+ me.configureNexuizMapList(me);
+ return me;
+}
+void configureNexuizMapListNexuizMapList(entity me)
+{
+ me.configureNexuizListBox(me);
+ me.refilter(me);
+}
+
+float g_maplistCacheQueryNexuizMapList(entity me, float i)
+{
+ return stof(substring(me.g_maplistCache, i, 1));
+}
+void g_maplistCacheToggleNexuizMapList(entity me, float i)
+{
+ string a, b, c, s;
+ s = me.g_maplistCache;
+ if not(s)
+ return;
+ b = substring(s, i, 1);
+ if(b == "0")
+ b = "1";
+ else if(b == "1")
+ b = "0";
+ else
+ return; // nothing happens
+ a = substring(s, 0, i);
+ c = substring(s, i+1, strlen(s) - (i+1));
+ strunzone(s);
+ me.g_maplistCache = strzone(strcat(a, b, c));
+}
+
+void resizeNotifyNexuizMapList(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+ vector itemAbsSize;
+ itemAbsSize = '0 0 0';
+
+ resizeNotifyNexuizListBox(me, relOrigin, relSize, absOrigin, absSize);
+
+ me.realFontSize_y = me.fontSize / (itemAbsSize_y = (absSize_y * me.itemHeight));
+ me.realFontSize_x = me.fontSize / (itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
+ me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize_y);
+ me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize_y;
+
+ me.columnPreviewOrigin = 0;
+ me.columnPreviewSize = itemAbsSize_y / itemAbsSize_x * 4 / 3;
+ me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize_x;
+ me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize_x;
+
+ me.checkMarkSize = (eX * (itemAbsSize_y / itemAbsSize_x) + eY) * 0.5;
+ me.checkMarkOrigin = eY + eX * (me.columnPreviewOrigin + me.columnPreviewSize) - me.checkMarkSize;
+}
+void clickListBoxItemNexuizMapList(entity me, float i, vector where)
+{
+ if(i == me.lastClickedMap)
+ if(time < me.lastClickedTime + 0.3)
+ {
+ // DOUBLE CLICK!
+ // insert/remove into/from maplist
+ me.g_maplistCacheToggle(me, i);
+ // TODO also update the actual cvar
+ }
+ me.lastClickedMap = i;
+ me.lastClickedTime = time;
+}
+void drawListBoxItemNexuizMapList(entity me, float i, vector absSize, float isSelected)
+{
+ // layout: Ping, Map name, Map name, NP, TP, MP
+ string s;
+ float p;
+ vector theColor;
+ float theAlpha;
+ float included;
+
+ theColor = '1 1 1';
+
+ if(!MapInfo_Get_ByID(i))
+ return;
+
+ included = me.g_maplistCacheQuery(me, i);
+ if(included)
+ theAlpha = 1;
+ else
+ theAlpha = 0.4;
+
+ if(isSelected)
+ draw_Fill('0 0 0', '1 1 0', '0 0 1', 0.5);
+ else if(included)
+ draw_Fill('0 0 0', '1 1 0', '0 0 0', 0.5);
+
+ s = ftos(p);
+ draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", MapInfo_Map_bspname), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+ if(included)
+ draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1);
+ s = draw_TextShortenToWidth(strcat(MapInfo_Map_bspname, ": ", MapInfo_Map_title), me.columnNameSize / me.realFontSize_x, 0);
+ draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0) * me.realFontSize_x)) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_TITLE, theAlpha, 0);
+ s = draw_TextShortenToWidth(MapInfo_Map_author, me.columnNameSize / me.realFontSize_x, 0);
+ draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 1.00 * (me.columnNameSize - draw_TextWidth(s, 0) * me.realFontSize_x)) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_AUTHOR, theAlpha, 0);
+}
+
+void refilterNexuizMapList(entity me)
+{
+ float i, j, n;
+ string s;
+ MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures());
+ me.nItems = MapInfo_count;
+ if(me.g_maplistCache)
+ strunzone(me.g_maplistCache);
+ s = "0";
+ for(i = 1; i < MapInfo_count; i *= 2)
+ s = strcat(s, s);
+ n = tokenize(cvar_string("g_maplist"));
+ for(i = 0; i < n; ++i)
+ {
+ j = MapInfo_FindName(argv(i));
+ if(j >= 0)
+ s = strcat(
+ substring(s, 0, j),
+ "1",
+ substring(s, j+1, MapInfo_count - (j+1))
+ );
+ }
+ me.g_maplistCache = strzone(s);
+}
+#endif
Modified: trunk/data/qcsrc/menu-div0test/nexuiz/radiobutton.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/radiobutton.c 2007-11-16 13:24:52 UTC (rev 2970)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/radiobutton.c 2007-11-16 15:22:19 UTC (rev 2971)
@@ -1,6 +1,7 @@
#ifdef INTERFACE
CLASS(NexuizRadioButton) EXTENDS(RadioButton)
METHOD(NexuizRadioButton, configureNexuizRadioButton, void(entity, float, string, string, string))
+ METHOD(NexuizRadioButton, draw, void(entity))
METHOD(NexuizRadioButton, setChecked, void(entity, float))
ATTRIB(NexuizRadioButton, fontSize, float, SKINFONTSIZE_NORMAL)
ATTRIB(NexuizRadioButton, image, string, SKINGFX_RADIOBUTTON)
@@ -45,11 +46,56 @@
}
void loadCvarsNexuizRadioButton(entity me)
{
- me.checked = (cvar_string(me.cvarName) == me.cvarValue);
+ if(me.cvarValue)
+ me.checked = (cvar_string(me.cvarName) == me.cvarValue);
+ else
+ {
+ if(me.cvarName)
+ {
+ me.checked = !!cvar(me.cvarName);
+ }
+ else
+ {
+ // this is difficult
+ // this is the "generic" selection... but at this time, not
+ // everything is constructed yet.
+ // we need to set this later in draw()
+ me.checked = 0;
+ }
+ }
}
+void drawNexuizRadioButton(entity me)
+{
+ if not(me.cvarValue)
+ if not(me.cvarName)
+ {
+ // this is the "other" option
+ // always select this if none other is
+ entity e;
+ float found;
+ found = 0;
+ for(e = me.parent.firstChild; e; e = e.nextSibling)
+ if(e.group == me.group)
+ if(e.checked)
+ found = 1;
+ if(!found)
+ me.setChecked(me, 1);
+ }
+ drawCheckBox(me);
+}
void saveCvarsNexuizRadioButton(entity me)
{
- if(me.checked)
- cvar_set(me.cvarName, me.cvarValue);
+ if(me.cvarValue)
+ {
+ if(me.checked)
+ cvar_set(me.cvarName, me.cvarValue);
+ }
+ else
+ {
+ if(me.cvarName)
+ {
+ cvar_set(me.cvarName, ftos(me.checked));
+ }
+ }
}
#endif
Modified: trunk/data/qcsrc/menu-div0test/skin.qh
===================================================================
--- trunk/data/qcsrc/menu-div0test/skin.qh 2007-11-16 13:24:52 UTC (rev 2970)
+++ trunk/data/qcsrc/menu-div0test/skin.qh 2007-11-16 15:22:19 UTC (rev 2971)
@@ -29,11 +29,13 @@
const vector SKINCOLOR_DIALOG_SETTINGS = '0.7 0.7 1';
const vector SKINCOLOR_DIALOG_TEAMSELECT = '1 1 1';
const vector SKINCOLOR_DIALOG_QUIT = '1 0 0';
+const vector SKINCOLOR_DIALOG_MUTATORS = '0.7 0.7 1';
/* ideal for xaw skin:
const vector SKINCOLOR_DIALOG_MULTIPLAYER = '1 1 1';
const vector SKINCOLOR_DIALOG_SETTINGS = '1 1 1';
const vector SKINCOLOR_DIALOG_TEAMSELECT = '1 1 1';
const vector SKINCOLOR_DIALOG_QUIT = '1 1 1';
+const vector SKINCOLOR_DIALOG_MUTATORS = '1 1 1';
*/
const string SKINGFX_SLIDER = "slider";
@@ -63,3 +65,6 @@
const vector SKINCOLOR_INPUTBOX_N = '1 1 1';
const vector SKINCOLOR_INPUTBOX_F = '1 1 1';
const float SKINMARGIN_INPUTBOX = 0.02;
+
+const vector SKINCOLOR_MAPLIST_TITLE = '1 1 1';
+const vector SKINCOLOR_MAPLIST_AUTHOR = '0.4 0.4 0.7';
More information about the nexuiz-commits
mailing list