1 #ifndef DIALOG_MULTIPLAYER_CREATE_H
2 #define DIALOG_MULTIPLAYER_CREATE_H
4 CLASS(XonoticServerCreateTab, XonoticTab)
5 METHOD(XonoticServerCreateTab, fill, void(entity))
6 METHOD(XonoticServerCreateTab, gameTypeChangeNotify, void(entity))
7 METHOD(XonoticServerCreateTab, gameTypeSelectNotify, void(entity))
8 ATTRIB(XonoticServerCreateTab, title, string, _("Create"))
9 ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
10 ATTRIB(XonoticServerCreateTab, rows, float, 23)
11 ATTRIB(XonoticServerCreateTab, columns, float, 6.2) // added extra .2 for center space
13 ATTRIB(XonoticServerCreateTab, mapListBox, entity, NULL)
14 ATTRIB(XonoticServerCreateTab, sliderFraglimit, entity, NULL)
15 ATTRIB(XonoticServerCreateTab, sliderTeams, entity, NULL)
16 ATTRIB(XonoticServerCreateTab, sliderTimelimit, entity, NULL)
17 ATTRIB(XonoticServerCreateTab, labelFraglimit, entity, NULL)
18 ATTRIB(XonoticServerCreateTab, labelTeams, entity, NULL)
19 ENDCLASS(XonoticServerCreateTab)
20 entity makeXonoticServerCreateTab();
25 void GameType_ConfigureSliders(entity e, entity l, string pLabel, float pMin, float pMax, float pStep, string pCvar)
29 e.configureXonoticTextSlider(e, string_null);
31 e.disabled = l.disabled = true;
35 e.configureXonoticTextSlider(e, pCvar);
39 for(i = 0; i <= e.nValues; ++i);
41 if(e.(valueStrings[i])) { strunzone(e.(valueStrings[i])); }
42 if(e.(valueIdentifiers[i])) { strunzone(e.(valueIdentifiers[i])); }
47 e.addValue(e, strzone(_("Default")), strzone("-1"));
48 for(i = pMin; i <= pMax; i += pStep) { e.addValue(e, strzone(ftos(i)), strzone(ftos(i))); }
49 e.addValue(e, strzone(_("Unlimited")), strzone("0"));
50 e.configureXonoticTextSliderValues(e);
54 e.disabled = l.disabled = false;
58 entity makeXonoticServerCreateTab()
61 me = NEW(XonoticServerCreateTab);
62 me.configureDialog(me);
66 void XonoticServerCreateTab_fill(entity me)
70 // the left half begins here
72 me.gotoRC(me, 0.5, 0);
73 me.TD(me, 1, 3, makeXonoticHeaderLabel(_("Gametype")));
75 me.TD(me, 10.5, 3, e = makeXonoticGametypeList());
77 me.gotoRC(me, 12.5, 0);
78 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Time limit:")));
79 me.TD(me, 1, 2, e = makeXonoticTextSlider("timelimit_override"));
80 e.addValue(e, ZCTX(_("TIMLIM^Default")), "-1");
81 e.addValue(e, ZCTX(_("TIMLIM^1 minute")), "1");
82 e.addValue(e, ZCTX(_("TIMLIM^2 minutes")), "2");
83 e.addValue(e, ZCTX(_("TIMLIM^3 minutes")), "3");
84 e.addValue(e, ZCTX(_("TIMLIM^4 minutes")), "4");
85 e.addValue(e, ZCTX(_("TIMLIM^5 minutes")), "5");
86 e.addValue(e, ZCTX(_("TIMLIM^6 minutes")), "6");
87 e.addValue(e, ZCTX(_("TIMLIM^7 minutes")), "7");
88 e.addValue(e, ZCTX(_("TIMLIM^8 minutes")), "8");
89 e.addValue(e, ZCTX(_("TIMLIM^9 minutes")), "9");
90 e.addValue(e, ZCTX(_("TIMLIM^10 minutes")), "10");
91 e.addValue(e, ZCTX(_("TIMLIM^15 minutes")), "15");
92 e.addValue(e, ZCTX(_("TIMLIM^20 minutes")), "20");
93 e.addValue(e, ZCTX(_("TIMLIM^25 minutes")), "25");
94 e.addValue(e, ZCTX(_("TIMLIM^30 minutes")), "30");
95 e.addValue(e, ZCTX(_("TIMLIM^40 minutes")), "40");
96 e.addValue(e, ZCTX(_("TIMLIM^50 minutes")), "50");
97 e.addValue(e, ZCTX(_("TIMLIM^60 minutes")), "60");
98 e.addValue(e, ZCTX(_("TIMLIM^Infinite")), "0");
99 e.configureXonoticTextSliderValues(e);
101 me.TD(me, 1, 1, me.labelFraglimit = makeXonoticTextLabel(0, _("Frag limit:")));
102 me.TD(me, 1, 2, me.sliderFraglimit = makeXonoticTextSlider("fraglimit_override"));
103 GameType_ConfigureSliders(me.sliderFraglimit, me.labelFraglimit, _("Frag limit:"), 5, 100, 5, "fraglimit_override");
105 me.gotoRC(me, 15, 0);
106 me.TD(me, 1, 1, me.labelTeams = makeXonoticTextLabel(0, _("Teams:")));
107 me.TD(me, 1, 2, e = me.sliderTeams = makeXonoticTextSlider(string_null));
108 e.addValue(e, _("Default"), "0");
109 e.addValue(e, _("2 teams"), "2");
110 e.addValue(e, _("3 teams"), "3");
111 e.addValue(e, _("4 teams"), "4");
112 e.configureXonoticTextSliderValues(e);
114 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player slots:")));
115 me.TD(me, 1, 2, makeXonoticSlider(1, 32, 1, "menu_maxplayers"));
117 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Number of bots:")));
118 me.TD(me, 1, 2, makeXonoticSlider(0, 9, 1, "bot_number"));
120 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bot skill:")));
121 setDependent(e, "bot_number", 0, -1);
122 me.TD(me, 1, 2, e = makeXonoticTextSlider("skill"));
123 e.addValue(e, _("Botlike"), "0");
124 e.addValue(e, _("Beginner"), "1");
125 e.addValue(e, _("You will win"), "2");
126 e.addValue(e, _("You can win"), "3");
127 e.addValue(e, _("You might win"), "4");
128 e.addValue(e, _("Advanced"), "5");
129 e.addValue(e, _("Expert"), "6");
130 e.addValue(e, _("Pro"), "7");
131 e.addValue(e, _("Assassin"), "8");
132 e.addValue(e, _("Unhuman"), "9");
133 e.addValue(e, _("Godlike"), "10");
134 e.configureXonoticTextSliderValues(e);
135 setDependent(e, "bot_number", 0, -1);
137 me.gotoRC(me, me.rows - 3.8, 0);
138 me.TD(me, 1, 3, e0 = makeXonoticTextLabel(0.5, string_null));
139 e0.textEntity = main.mutatorsDialog;
143 // mapListBox is in the right column but the ref is needed for mutators dialog here
144 me.mapListBox = makeXonoticMapList();
145 // here we use the following line instead of me.TR(me) for better visual spacing;
146 // this decision was made in this poll: http://forums.xonotic.org/showthread.php?tid=5445
147 me.gotoRC(me, me.rows - 2.5, 0);
149 me.TD(me, 1, 2, e = makeXonoticButton(_("Mutators"), '0 0 0'));
150 e.onClick = DialogOpenButton_Click;
151 e.onClickEntity = main.mutatorsDialog;
152 main.mutatorsDialog.refilterEntity = me.mapListBox;
154 // The right half begins here
156 me.gotoRC(me, 0.5, 3.2); me.setFirstColumn(me, me.currentColumn);
158 me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Maplist")));
159 makeCallback(e, me.mapListBox, me.mapListBox.refilterCallback);
161 // we use 5.8 here to visually match the bottom line of the component on the left (Bot Skill)
162 me.TD(me, me.rows - 5.8, 3, me.mapListBox);
164 me.gotoRC(me, me.rows - 3.8, me.firstColumn);
165 // string filter label and box
166 me.TD(me, 1, 0.35, e = makeXonoticTextLabel(1, _("Filter:")));
167 me.mapListBox.stringFilterBox = makeXonoticMapListStringFilterBox(me, 0, string_null);
168 me.mapListBox.stringFilterBox.tooltip = getZonedTooltipForIdentifier("XonoticMultiplayerDialog_StringFilterBox");
169 me.TD(me, 1, me.columns - me.firstColumn - 0.35, e = me.mapListBox.stringFilterBox);
170 e.onChange = MapList_StringFilterBox_Change;
171 e.keyDown = MapList_StringFilterBox_keyDown;
172 e.onChangeEntity = me.mapListBox;
173 me.mapListBox.controlledTextbox = e;
175 // here we use the following line instead of me.TR(me) for better visual spacing;
176 // this decision was made in this poll: http://forums.xonotic.org/showthread.php?tid=5445
177 me.gotoRC(me, me.rows - 2.5, me.firstColumn);
178 // the selection buttons
179 me.TD(me, 1, 1, e = makeXonoticButton(_("Add shown"), '0 0 0'));
180 e.onClick = MapList_Add_Shown;
181 e.onClickEntity = me.mapListBox;
182 me.TD(me, 1, 1, e = makeXonoticButton(_("Remove shown"), '0 0 0'));
183 e.onClick = MapList_Remove_Shown;
184 e.onClickEntity = me.mapListBox;
185 me.TD(me, 1, 1, e = makeXonoticButton(_("Remove all"), '0 0 0'));
186 e.onClick = MapList_Remove_All;
187 e.onClickEntity = me.mapListBox;
189 // The big button at the bottom
191 me.gotoRC(me, me.rows - 1, 0);
192 me.TD(me, 1, me.columns, e = makeXonoticButton(_("Start Multiplayer!"), '0 0 0'));
193 e.onClick = MapList_LoadMap;
194 e.onClickEntity = me.mapListBox;
195 me.mapListBox.startButton = e;
197 me.gameTypeChangeNotify(me);
200 void XonoticServerCreateTab_gameTypeChangeNotify(entity me)
202 // tell the map list to update
205 gt = MapInfo_CurrentGametype();
206 e = me.sliderFraglimit;
207 l = me.labelFraglimit;
211 case MAPINFO_TYPE_CTF: GameType_ConfigureSliders(e, l, _("Capture limit:"), 1, 20, 1, "capturelimit_override"); break;
212 case MAPINFO_TYPE_DOMINATION: GameType_ConfigureSliders(e, l, _("Point limit:"), 50, 500, 10, "g_domination_point_limit"); break;
213 case MAPINFO_TYPE_KEYHUNT: GameType_ConfigureSliders(e, l, _("Point limit:"), 200, 1500, 50, "g_keyhunt_point_limit"); break;
214 case MAPINFO_TYPE_LMS: GameType_ConfigureSliders(e, l, _("Lives:"), 3, 50, 1, "g_lms_lives_override"); break;
215 case MAPINFO_TYPE_RACE: GameType_ConfigureSliders(e, l, _("Laps:"), 1, 25, 1, "g_race_laps_limit"); break;
216 case MAPINFO_TYPE_NEXBALL: GameType_ConfigureSliders(e, l, _("Goals:"), 1, 50, 1, "g_nexball_goallimit"); break;
217 case MAPINFO_TYPE_ASSAULT: GameType_ConfigureSliders(e, l, _("Point limit:"), 50, 500, 10, ""); break;
218 case MAPINFO_TYPE_ONSLAUGHT: GameType_ConfigureSliders(e, l, _("Point limit:"), 50, 500, 10, ""); break;
219 case MAPINFO_TYPE_CTS: GameType_ConfigureSliders(e, l, _("Point limit:"), 50, 500, 10, ""); break;
220 case MAPINFO_TYPE_INVASION: GameType_ConfigureSliders(e, l, _("Point limit:"), 5, 0, 5, ""); break;
221 case MAPINFO_TYPE_TEAM_DEATHMATCH:GameType_ConfigureSliders(e, l, _("Point limit:"), 5, 100, 5, "g_tdm_point_limit"); break;
222 default: GameType_ConfigureSliders(e, l, _("Frag limit:"), 5, 100, 5, "fraglimit_override"); break;
225 string x = string_null;
229 case MAPINFO_TYPE_CA: x = "g_ca_teams_override"; break;
230 case MAPINFO_TYPE_DOMINATION: x = "g_domination_teams_override"; break;
231 case MAPINFO_TYPE_FREEZETAG: x = "g_freezetag_teams_override"; break;
232 case MAPINFO_TYPE_KEYHUNT: x = "g_keyhunt_teams_override"; break;
233 case MAPINFO_TYPE_TEAM_DEATHMATCH: x = "g_tdm_teams_override"; break;
235 e.configureXonoticTextSlider(e, x);
236 e.configureXonoticTextSliderValues(e);
239 me.sliderTeams.disabled = me.labelTeams.disabled = !x;
241 me.mapListBox.refilter(me.mapListBox);
244 void XonoticServerCreateTab_gameTypeSelectNotify(entity me)
246 me.setFocus(me, me.mapListBox);