2 CLASS(XonoticServerCreateTab) EXTENDS(XonoticTab)
3 METHOD(XonoticServerCreateTab, fill, void(entity))
4 METHOD(XonoticServerCreateTab, gameTypeChangeNotify, void(entity))
5 ATTRIB(XonoticServerCreateTab, title, string, _("Create"))
6 ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
7 ATTRIB(XonoticServerCreateTab, rows, float, 22)
8 ATTRIB(XonoticServerCreateTab, columns, float, 6.5)
10 ATTRIB(XonoticServerCreateTab, mapListBox, entity, NULL)
11 ATTRIB(XonoticServerCreateTab, sliderFraglimit, entity, NULL)
12 ATTRIB(XonoticServerCreateTab, sliderTimelimit, entity, NULL)
13 ATTRIB(XonoticServerCreateTab, checkboxFraglimit, entity, NULL)
14 ATTRIB(XonoticServerCreateTab, checkboxFraglimitMapinfo, entity, NULL)
15 ENDCLASS(XonoticServerCreateTab)
16 entity makeXonoticServerCreateTab();
21 entity makeXonoticServerCreateTab()
24 me = spawnXonoticServerCreateTab();
25 me.configureDialog(me);
29 void XonoticServerCreateTab_fill(entity me)
34 me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Game type:")));
36 me.TD(me, 9, 3, e = makeXonoticGametypeList());
46 me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Match settings:")));
48 me.sliderTimelimit = makeXonoticSlider(1.0, 60.0, 0.5, "timelimit_override");
49 me.TD(me, 1, 1, e = makeXonoticSliderCheckBox(0, 1, me.sliderTimelimit, _("Time limit:")));
50 me.TD(me, 1, 2, me.sliderTimelimit);
53 me.TD(me, 1, 2.8, e = makeXonoticSliderCheckBox(-1, 0, me.sliderTimelimit, _("Use map specified default")));
55 me.sliderFraglimit = makeXonoticSlider(1.0, 2000.0, 5, "fraglimit_override");
56 me.TD(me, 1, 1, e = makeXonoticSliderCheckBox(0, 1, me.sliderFraglimit, _("Point limit:")));
57 me.checkboxFraglimit = e;
58 me.TD(me, 1, 2, me.sliderFraglimit);
61 me.TD(me, 1, 2.8, e = makeXonoticSliderCheckBox(-1, 0, me.sliderFraglimit, _("Use map specified default")));
62 me.checkboxFraglimitMapinfo = e;
64 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player slots:")));
65 me.TD(me, 1, 2, makeXonoticSlider(1, 32, 1, "menu_maxplayers"));
67 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Number of bots:")));
68 me.TD(me, 1, 2, makeXonoticSlider(0, 9, 1, "bot_number"));
71 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Bot skill:")));
72 setDependent(e, "bot_number", 0, -1);
73 me.TD(me, 1, 2, e = makeXonoticTextSlider("skill"));
74 e.addValue(e, _("Botlike"), "0");
75 e.addValue(e, _("Beginner"), "1");
76 e.addValue(e, _("You will win"), "2");
77 e.addValue(e, _("You can win"), "3");
78 e.addValue(e, _("You might win"), "4");
79 e.addValue(e, _("Advanced"), "5");
80 e.addValue(e, _("Expert"), "6");
81 e.addValue(e, _("Pro"), "7");
82 e.addValue(e, _("Assassin"), "8");
83 e.addValue(e, _("Unhuman"), "9");
84 e.addValue(e, _("Godlike"), "10");
85 e.configureXonoticTextSliderValues(e);
86 setDependent(e, "bot_number", 0, -1);
88 me.TD(me, 1, 1, e = makeXonoticButton(_("Mutators..."), '0 0 0'));
89 e.onClick = DialogOpenButton_Click;
90 e.onClickEntity = main.mutatorsDialog;
91 main.mutatorsDialog.refilterEntity = me.mapListBox;
92 me.TD(me, 1, 2, e0 = makeXonoticTextLabel(0, string_null));
93 e0.textEntity = main.mutatorsDialog;
97 me.TD(me, 1, 2, e = makeXonoticButton(_("Advanced settings..."), '0 0 0'));
98 e.onClick = DialogOpenButton_Click;
99 e.onClickEntity = main.advancedDialog;
100 main.advancedDialog.refilterEntity = me.mapListBox;
102 me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
103 me.mapListBox = makeXonoticMapList();
104 me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Map list:")));
105 makeCallback(e, me.mapListBox, me.mapListBox.refilterCallback);
107 me.TD(me, me.rows - 4, 3, me.mapListBox);
108 me.gotoRC(me, me.rows - 3, 3.5);
109 me.TDempty(me, 0.25);
110 me.TD(me, 1, 1.125, e = makeXonoticButton(_("Select all"), '0 0 0'));
111 e.onClick = MapList_All;
112 e.onClickEntity = me.mapListBox;
113 me.TD(me, 1, 1.125, e = makeXonoticButton(_("Select none"), '0 0 0'));
114 e.onClick = MapList_None;
115 e.onClickEntity = me.mapListBox;
116 me.TDempty(me, 0.25);
118 me.gotoRC(me, me.rows - 1, 0);
119 me.TD(me, 1, me.columns, e = makeXonoticButton(_("Start Multiplayer!"), '0 0 0'));
120 e.onClick = MapList_LoadMap;
121 e.onClickEntity = me.mapListBox;
122 me.mapListBox.startButton = e;
124 me.gameTypeChangeNotify(me);
127 void GameType_ConfigureSliders(entity e, entity l, entity l2, string pLabel, float pMin, float pMax, float pStep, string pCvar)
131 e.configureXonoticSlider(e, pMin, pMax, pStep, string_null);
132 l.setText(l, pLabel);
133 e.disabled = l.disabled = l2.disabled = TRUE;
137 e.configureXonoticSlider(e, pMin, pMax, pStep, pCvar);
138 l.setText(l, pLabel);
139 e.disabled = l.disabled = l2.disabled = FALSE;
143 void XonoticServerCreateTab_gameTypeChangeNotify(entity me)
145 // tell the map list to update
148 gt = MapInfo_CurrentGametype();
149 e = me.sliderFraglimit;
150 l = me.checkboxFraglimit;
151 l2 = me.checkboxFraglimitMapinfo;
154 case MAPINFO_TYPE_CTF: GameType_ConfigureSliders(e, l, l2, _("Capture limit:"), 1, 20, 1, "capturelimit_override"); break;
155 case MAPINFO_TYPE_DOMINATION: GameType_ConfigureSliders(e, l, l2, _("Point limit:"), 50, 500, 10, "g_domination_point_limit"); break;
156 case MAPINFO_TYPE_KEYHUNT: GameType_ConfigureSliders(e, l, l2, _("Point limit:"), 200, 1500, 50, "g_keyhunt_point_limit"); break;
157 case MAPINFO_TYPE_RUNEMATCH: GameType_ConfigureSliders(e, l, l2, _("Point limit:"), 50, 500, 10, "g_runematch_point_limit"); break;
158 case MAPINFO_TYPE_LMS: GameType_ConfigureSliders(e, l, l2, _("Lives:"), 3, 50, 1, "g_lms_lives_override"); break;
159 case MAPINFO_TYPE_RACE: GameType_ConfigureSliders(e, l, l2, _("Laps:"), 1, 25, 1, "g_race_laps_limit"); break;
160 case MAPINFO_TYPE_NEXBALL: GameType_ConfigureSliders(e, l, l2, _("Goals:"), 1, 50, 1, "g_nexball_goallimit"); break;
161 case MAPINFO_TYPE_ASSAULT: GameType_ConfigureSliders(e, l, l2, _("Point limit:"), 50, 500, 10, ""); break;
162 case MAPINFO_TYPE_ONSLAUGHT: GameType_ConfigureSliders(e, l, l2, _("Point limit:"), 50, 500, 10, ""); break;
163 case MAPINFO_TYPE_CTS: GameType_ConfigureSliders(e, l, l2, _("Point limit:"), 50, 500, 10, ""); break;
164 default: GameType_ConfigureSliders(e, l, l2, _("Frag limit:"), 5, 100, 5, "fraglimit_override"); break;
166 me.mapListBox.refilter(me.mapListBox);