]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mutators.c
the usual (forgot two files)
[divverent/nexuiz.git] / data / qcsrc / menu / nexuiz / dialog_multiplayer_create_mutators.c
1 #ifdef INTERFACE
2 CLASS(NexuizMutatorsDialog) EXTENDS(NexuizDialog)
3         METHOD(NexuizMutatorsDialog, toString, string(entity))
4         METHOD(NexuizMutatorsDialog, fill, void(entity))
5         METHOD(NexuizMutatorsDialog, showNotify, void(entity))
6         METHOD(NexuizMutatorsDialog, close, void(entity))
7         ATTRIB(NexuizMutatorsDialog, title, string, "Mutators")
8         ATTRIB(NexuizMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
9         ATTRIB(NexuizMutatorsDialog, intendedWidth, float, 0.6)
10         ATTRIB(NexuizMutatorsDialog, rows, float, 9)
11         ATTRIB(NexuizMutatorsDialog, columns, float, 4)
12         ATTRIB(NexuizMutatorsDialog, refilterEntity, entity, NULL)
13 ENDCLASS(NexuizMutatorsDialog)
14 #endif
15
16 #ifdef IMPLEMENTATION
17 void showNotifyNexuizMutatorsDialog(entity me)
18 {
19         loadAllCvars(me);
20 }
21 string toStringNexuizMutatorsDialog(entity me)
22 {
23         string s;
24         s = "";
25         if(cvar("g_minstagib"))
26                 s = strcat(s, ", MinstaGib");
27         if(cvar("g_nixnex"))
28                 s = strcat(s, ", NixNex");
29         if(cvar("g_rocketarena"))
30                 s = strcat(s, ", RL arena");
31         if(cvar("sv_gravity") < 800)
32                 s = strcat(s, ", Low gravity");
33         if(cvar("g_cloaked"))
34                 s = strcat(s, ", Cloaked");
35         if(cvar("g_footsteps"))
36                 s = strcat(s, ", Steps");
37         if(cvar("g_grappling_hook"))
38                 s = strcat(s, ", Hook");
39         if(cvar("g_laserguided_missile"))
40                 s = strcat(s, ", LG missiles");
41         if(cvar("g_midair"))
42                 s = strcat(s, ", Mid-air");
43         if(cvar("g_vampire"))
44                 s = strcat(s, ", Vampire");
45         if(s == "")
46                 return "None";
47         else
48                 return substring(s, 2, strlen(s) - 2);
49 }
50 void fillNexuizMutatorsDialog(entity me)
51 {
52         entity e, s;
53         me.TR(me);
54                 me.TD(me, 1, 2, makeNexuizTextLabel(0, "Game mutators:"));
55         me.TR(me);
56                 me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_cloaked", "Cloaked"));
57         me.TR(me);
58                 me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_footsteps", "Foot steps"));
59         me.TR(me);
60                 me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_grappling_hook", "Grappling hook"));
61         me.TR(me);
62                 me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_laserguided_missile", "Laser guided missiles"));
63         me.TR(me);
64                 me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_midair", "Mid-air"));
65         me.TR(me);
66                 me.TD(me, 1, 2, e = makeNexuizCheckBox(0, "g_vampire", "Vampire"));
67
68         me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
69                 me.TD(me, 1, 2, makeNexuizTextLabel(0, "Arena mutators:"));
70         me.TR(me);
71                 me.TD(me, 1, 2, e = makeNexuizRadioButton(1, string_null, string_null, "Regular"));
72         me.TR(me);
73                 me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_minstagib", string_null, "MinstaGib"));
74         me.TR(me);
75                 me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_nixnex", string_null, "NixNex"));
76         me.TR(me);
77                 me.TDempty(me, 0.2);
78                 me.TD(me, 1, 1.8, e = makeNexuizCheckBox(1, "g_nixnex_with_laser", "with laser"));
79                         setDependent(e, "g_nixnex", 1, 1);
80         me.TR(me);
81                 me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_rocketarena", string_null, "Rocket launcher arena"));
82
83         me.gotoRC(me, me.rows - 2, 0);
84                 s = makeNexuizSlider(80, 400, 8, "sv_gravity");
85                         s.valueDigits = 0;
86                         s.valueDisplayMultiplier = 0.125; // show gravity in percent
87                 me.TD(me, 1, 1, e = makeNexuizSliderCheckBox(800, 1, s, "Low gravity"));
88                         e.savedValue = 200; // good on silvercity
89                 me.TD(me, 1, 3, s);
90
91         me.gotoRC(me, me.rows - 1, 0);
92                 me.TD(me, 1, me.columns, e = makeNexuizButton("OK", '0 0 0'));
93                         e.onClick = Dialog_Close;
94                         e.onClickEntity = me;
95 }
96
97 void closeNexuizMutatorsDialog(entity me)
98 {
99         if(me.refilterEntity)
100                 me.refilterEntity.refilter(me.refilterEntity);
101         closeDialog(me);
102 }
103 #endif