r5060 - in trunk/data: . qcsrc/menu/nexuiz
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Nov 19 09:35:07 EST 2008
Author: div0
Date: 2008-11-19 09:35:07 -0500 (Wed, 19 Nov 2008)
New Revision: 5060
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mutators.c
Log:
make weaponarena laser a checkbox (dirty hack)
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2008-11-19 13:05:29 UTC (rev 5059)
+++ trunk/data/defaultNexuiz.cfg 2008-11-19 14:35:07 UTC (rev 5060)
@@ -1015,6 +1015,9 @@
seta menu_slist_showfull 1
seta menu_slist_showempty 1
+// for menu weapon arena
+set menu_weaponarena_with_laser 0
+
// Q3A
set sv_q3acompat_machineshotgunswap 0 // settemp this in mapinfo for instant Q3A map conversion
Modified: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mutators.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mutators.c 2008-11-19 13:05:29 UTC (rev 5059)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mutators.c 2008-11-19 14:35:07 UTC (rev 5060)
@@ -7,7 +7,7 @@
ATTRIB(NexuizMutatorsDialog, title, string, "Mutators")
ATTRIB(NexuizMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
ATTRIB(NexuizMutatorsDialog, intendedWidth, float, 0.8)
- ATTRIB(NexuizMutatorsDialog, rows, float, 15)
+ ATTRIB(NexuizMutatorsDialog, rows, float, 16)
ATTRIB(NexuizMutatorsDialog, columns, float, 6)
ATTRIB(NexuizMutatorsDialog, refilterEntity, entity, NULL)
ENDCLASS(NexuizMutatorsDialog)
@@ -91,6 +91,61 @@
else
return substring(s, 2, strlen(s) - 2);
}
+
+
+
+// WARNING: dirty hack. TODO clean this up by putting this behaviour in extra classes.
+void loadCvarsLaserWeaponArenaWeaponButton(entity me)
+{
+ tokenize_sane(cvar_string("g_weaponarena"));
+ me.checked = (argv(0) == me.cvarValue);
+}
+
+void saveCvarsLaserWeaponArenaWeaponButton(entity me)
+{
+ string suffix;
+ suffix = "";
+ if(me.cvarValue != "laser")
+ if(cvar("menu_weaponarena_with_laser"))
+ suffix = " laser";
+ if(me.checked)
+ cvar_set(me.cvarName, strcat(me.cvarValue, suffix));
+ else
+ cvar_set(me.cvarName, me.cvarOffValue);
+}
+
+.void(entity) draw_weaponarena;
+.void(entity) saveCvars_weaponarena;
+void saveCvarsLaserWeaponArenaLaserButton(entity me)
+{
+ // run the old function
+ me.saveCvars_weaponarena(me);
+
+ me.disabled = ((cvar_string("g_weaponarena") == "0") || (cvar_string("g_weaponarena") == "laser"));
+
+ if not(me.disabled)
+ {
+ // check for the laser suffix
+ string s;
+ s = cvar_string("g_weaponarena");
+ if(me.checked && substring(s, strlen(s) - 6, 6) != " laser")
+ s = strcat(s, " laser");
+ else if(!me.checked && substring(s, strlen(s) - 6, 6) == " laser")
+ s = substring(s, 0, strlen(s) - 6);
+ cvar_set("g_weaponarena", s);
+ }
+}
+
+void preDrawLaserWeaponArenaLaserButton(entity me)
+{
+ me.disabled = ((cvar_string("g_weaponarena") == "0") || (cvar_string("g_weaponarena") == "laser"));
+ // run the old function
+ me.draw_weaponarena(me);
+}
+// WARNING: end of dirty hack. Do not try this at home.
+
+
+
void fillNexuizMutatorsDialog(entity me)
{
entity e, s, w;
@@ -133,15 +188,23 @@
me.TR(me);
str = w.netname;
hstr = w.message;
- if not(w.spawnflags & WEPSPAWNFLAG_CANCLIMB)
- {
- str = strcat(str, " laser");
- hstr = strcat(hstr, " & Laser");
- }
me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_weaponarena", strzone(str), strzone(hstr)));
e.cvarOffValue = "0";
+ // custom load/save logic that ignores a " laser" suffix, or adds it
+ e.loadCvars = loadCvarsLaserWeaponArenaWeaponButton;
+ e.saveCvars = saveCvarsLaserWeaponArenaWeaponButton;
+ e.loadCvars(e);
}
me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 3.8, e = makeNexuizCheckBox(0, "menu_weaponarena_with_laser", "with laser"));
+ // hook the draw function to gray it out
+ e.draw_weaponarena = e.draw;
+ e.draw = preDrawLaserWeaponArenaLaserButton;
+ // hook the save function to notify about the cvar
+ e.saveCvars_weaponarena = e.saveCvars;
+ e.saveCvars = saveCvarsLaserWeaponArenaLaserButton;
+ me.TR(me);
me.TD(me, 1, 4, makeNexuizTextLabel(0, "Special arenas:"));
me.TR(me);
me.TD(me, 1, 4, e = makeNexuizRadioButton(1, "g_minstagib", string_null, "MinstaGib"));
@@ -149,7 +212,7 @@
me.TD(me, 1, 4, e = makeNexuizRadioButton(1, "g_nixnex", string_null, "NixNex"));
me.TR(me);
me.TDempty(me, 0.2);
- me.TD(me, 1, 3.8, e = makeNexuizCheckBox(1, "g_nixnex_with_laser", "with laser"));
+ me.TD(me, 1, 3.8, e = makeNexuizCheckBox(0, "g_nixnex_with_laser", "with laser"));
setDependent(e, "g_nixnex", 1, 1);
me.TR(me);
me.TD(me, 1, 4, e = makeNexuizRadioButton(1, "g_weaponarena", "all", "All weapons"));
More information about the nexuiz-commits
mailing list