Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
dialog_multiplayer_create.qc File Reference
#include "dialog_multiplayer_create.qh"
#include "dialog_multiplayer_create_mapinfo.qh"
#include "dialog_multiplayer_create_mutators.qh"
#include "gametypelist.qh"
#include "maplist.qh"
#include <common/mapinfo.qh>
#include "checkbox.qh"
#include "image.qh"
#include "mixedslider.qh"
#include "textlabel.qh"
#include "slider.qh"
#include "mainwindow.qh"
#include "button.qh"
#include "commandbutton.qh"
#include "leavematchbutton.qh"
#include "inputbox.qh"
Include dependency graph for dialog_multiplayer_create.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

float allowBotSkill (entity e)
float allowBotVsHuman (entity e)
void GameType_ConfigureSliders (entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip)
void GameType_ConfigureSliders_for_CurrentGametype (entity me)
entity makeXonoticServerCreateTab ()
void XonoticServerCreateTab_fill (entity me)
void XonoticServerCreateTab_gameTypeChangeNotify (entity me)
void XonoticServerCreateTab_gameTypeSelectNotify (entity me)

Function Documentation

◆ allowBotSkill()

float allowBotSkill ( entity e)

Definition at line 72 of file dialog_multiplayer_create.qc.

73{
74 // returns true if there will be bots
75 return ((allowBotVsHuman(e) && (cvar("bot_vs_human")))
76 || (!cvar("g_campaign") && !cvar("bot_vs_human") && cvar("bot_number") > 0));
77}
float allowBotVsHuman(entity e)
float cvar(string name)

References allowBotVsHuman(), cvar(), and entity().

Referenced by XonoticServerCreateTab_fill().

◆ allowBotVsHuman()

float allowBotVsHuman ( entity e)

Definition at line 65 of file dialog_multiplayer_create.qc.

66{
67 if (cvar("g_campaign"))
68 return false;
69 return e.parent.sliderTeams.value < 2; // either default (2) or 2 teams
70}

References cvar(), and entity().

Referenced by allowBotSkill(), and XonoticServerCreateTab_fill().

◆ GameType_ConfigureSliders()

void GameType_ConfigureSliders ( entity me,
string pLabel,
float pMin,
float pMax,
float pStep,
string pCvar,
string tCvar,
string pTooltip )

Definition at line 21 of file dialog_multiplayer_create.qc.

22{
23 entity e = me.sliderFraglimit;
24 entity l = me.labelFraglimit;
25 e.configureXonoticMixedSlider(e, pCvar, pTooltip);
26 e.disabled = l.disabled = !pCvar;
27 l.setText(l, pLabel);
28
29 // clear old values
30 for (int i = 0; i < e.nValues; ++i)
31 strfree(e.(valueStrings[i]));
32 e.clearValues(e);
33
34 if (pCvar != "")
35 {
36 // set new values
37 e.addText(e, strzone(_("Default")), -1);
38 e.addRange(e, pMin, pMax, pStep);
39 e.addText(e, strzone(_("Unlimited")), 0);
40 }
41 e.configureXonoticMixedSliderValues(e);
42
43
44 entity t = me.sliderTeams;
45 entity tl = me.labelTeams;
46 t.configureXonoticMixedSlider(t, tCvar, string_null);
47 tl.disabled = t.disabled = !tCvar;
48 t.nValues = (tCvar == "") ? 0 : 4; // instead of clearing / readding the very same values
49 t.configureXonoticMixedSliderValues(t);
50}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
string strzone(string s)
string string_null
Definition nil.qh:9
#define strfree(this)
Definition string.qh:57

References entity(), strfree, string_null, and strzone().

Referenced by GameType_ConfigureSliders_for_CurrentGametype().

◆ GameType_ConfigureSliders_for_CurrentGametype()

void GameType_ConfigureSliders_for_CurrentGametype ( entity me)

Definition at line 52 of file dialog_multiplayer_create.qc.

53{
56}
virtual void m_configuremenu()
Definition mapinfo.qh:91
void GameType_ConfigureSliders(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip)
Gametype MapInfo_CurrentGametype()
Definition mapinfo.qc:1487

References entity(), GameType_ConfigureSliders(), Gametype::m_configuremenu(), and MapInfo_CurrentGametype().

Referenced by XonoticServerCreateTab_fill(), and XonoticServerCreateTab_gameTypeChangeNotify().

◆ makeXonoticServerCreateTab()

entity makeXonoticServerCreateTab ( )

Definition at line 58 of file dialog_multiplayer_create.qc.

59{
61 me.configureDialog(me);
62 return me;
63}
#define NEW(cname,...)
Definition oo.qh:120

References entity(), and NEW.

Referenced by XonoticServerCreateTab::ATTRIB(), and XonoticMultiplayerDialog_fill().

◆ XonoticServerCreateTab_fill()

void XonoticServerCreateTab_fill ( entity me)

Definition at line 79 of file dialog_multiplayer_create.qc.

80{
81 entity e, e0;
82
83 // the left half begins here
84
85 me.gotoRC(me, 0.5, 0);
86 me.TD(me, 1, 3, makeXonoticHeaderLabel(_("Gametype")));
87 me.TR(me);
88 me.TD(me, 11, 3, e = makeXonoticGametypeList());
89
90 me.gotoRC(me, 12.5, 0);
91 me.TDempty(me, 0.1);
92 me.TD(me, 1, 2.9, e = makeXonoticCheckBox_T(0, "menu_create_show_all", _("Show all"),
93 _("Show all available gametypes")));
94 me.gotoRC(me, 14, 0);
95 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Time limit:")));
96 me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("timelimit_override",
97 _("Time limit in minutes that when hit, will end the match")));
98 e.formatString = "m";
99 e.addText(e, ZCTX(_("TIMLIM^Default")), -1);
100 e.addRange(e, 1, 10, 1);
101 e.addRange(e, 15, 30, 5);
102 e.addRange(e, 40, 60, 10);
103 e.addText(e, ZCTX(_("TIMLIM^Infinite")), 0);
104 e.configureXonoticMixedSliderValues(e);
105 me.TR(me);
106 me.TD(me, 1, 1, me.labelFraglimit = makeXonoticTextLabel(0, _("Frag limit:")));
107 me.TD(me, 1, 2, e = me.sliderFraglimit = makeXonoticMixedSlider("fraglimit_override"));
108
109 me.gotoRC(me, 16.5, 0);
110 me.TD(me, 1, 1, me.labelTeams = makeXonoticTextLabel(0, _("Teams:")));
111 me.TD(me, 1, 2, e = me.sliderTeams = makeXonoticMixedSlider(string_null));
112 e.addText(e, _("Default"), 0);
113 e.addText(e, _("2 teams"), 2);
114 e.addText(e, _("3 teams"), 3);
115 e.addText(e, _("4 teams"), 4);
116 e.configureXonoticMixedSliderValues(e);
117 me.TR(me);
118 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player slots:")));
119 me.TD(me, 1, 2, e = makeXonoticSlider_T(1, 32, 1, "menu_maxplayers",
120 _("The maximum number of players or bots that can be connected to your server at once")));
121 me.TR(me);
122 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Number of bots:")));
123 setDependent(e, "g_campaign", 0, 0);
124 setDependentAND(e, "bot_vs_human", 0, 0);
125 me.TD(me, 1, 2, e = makeXonoticSlider_T(0, 9, 1, "bot_number",
126 _("Number of bots on your server")));
127 setDependent(e, "g_campaign", 0, 0);
128 setDependentAND(e, "bot_vs_human", 0, 0);
129 me.TR(me);
130 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bot skill:")));
132 me.TD(me, 1, 2, e = makeXonoticMixedSlider_T("skill",
133 _("Specify how experienced the bots will be")));
134 e.addText(e, _("Botlike"), 0);
135 e.addText(e, _("Beginner"), 1);
136 e.addText(e, _("You will win"), 2);
137 e.addText(e, _("You can win"), 3);
138 e.addText(e, _("You might win"), 4);
139 e.addText(e, _("Advanced"), 5);
140 e.addText(e, _("Expert"), 6);
141 e.addText(e, _("Pro"), 7);
142 e.addText(e, _("Assassin"), 8);
143 e.addText(e, _("Unhuman"), 9);
144 e.addText(e, _("Godlike"), 10);
145 e.configureXonoticMixedSliderValues(e);
147 me.TR(me);
148 me.TDempty(me, 0.1);
149 me.TD(me, 1, 2.9, e = makeXonoticCheckBox_T(0, "bot_vs_human", _("Bots against humans"),
150 _("Force humans to play on the same team against an equal-sized team of bots")));
152
153 // The right half begins here
154
155 me.mapListBox = makeXonoticMapList();
156 me.gotoRC(me, 0.5, 3.2); me.setFirstColumn(me, me.currentColumn);
157 // the maplistbox
158 me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Maplist")));
159 makeCallback(e, me.mapListBox, me.mapListBox.refilterCallback);
160 me.TR(me);
161 // we use 7.8 here to visually match the component on the left
162 me.TD(me, me.rows - 7.8, 3, me.mapListBox);
163
164 me.gotoRC(me, me.rows - 6, me.firstColumn);
165 // string filter label and box
166 me.TD(me, 1, 0.35, e = makeXonoticTextLabel(1, _("Filter:")));
167 me.mapListBox.stringFilterBox = makeXonoticInputBox_T(0, string_null,
168 _("Click here or CTRL+F to provide a keyword to narrow down the list; CTRL+DEL to clear; ENTER when done."));
169 me.TD(me, 1, me.columns - me.firstColumn - 0.35, e = me.mapListBox.stringFilterBox);
172 e.onChangeEntity = me.mapListBox;
173
174 me.gotoRC(me, me.rows - 5, me.firstColumn);
175 // the selection buttons
176 me.TDempty(me, 0.2);
177 me.TD(me, 1, 1.3, e = makeXonoticButton_T(_("Add shown"), '0 0 0',
178 _("Add the maps shown in the list to your selection")));
179 e.onClick = MapList_Add_Shown;
180 e.onClickEntity = me.mapListBox;
181 me.TD(me, 1, 1.3, e = makeXonoticButton_T(_("Remove shown"), '0 0 0',
182 _("Remove the maps shown in the list from your selection")));
183 e.onClick = MapList_Remove_Shown;
184 e.onClickEntity = me.mapListBox;
185 me.gotoRC(me, me.rows - 4, me.firstColumn);
186 me.TDempty(me, 0.2);
187 me.TD(me, 1, 1.3, e = makeXonoticButton_T(_("Add all"), '0 0 0',
188 _("Add every available map to your selection")));
189 e.onClick = MapList_Add_All;
190 e.onClickEntity = me.mapListBox;
191 me.TD(me, 1, 1.3, e = makeXonoticButton_T(_("Remove all"), '0 0 0',
192 _("Remove all the maps from your selection")));
193 e.onClick = MapList_Remove_All;
194 e.onClickEntity = me.mapListBox;
195
196 // here we use the following line instead of me.TR(me) for better visual spacing;
197 // this decision was made in this poll: http://forums.xonotic.org/showthread.php?tid=5445
198 me.gotoRC(me, me.rows - 2.5, me.firstColumn);
199 me.TDempty(me, 0.5);
200 me.TD(me, 1, 2, e = makeXonoticButton_T(_("Mutators..."), '0 0 0',
201 _("Mutators and weapon arenas")));
202 e.onClick = DialogOpenButton_Click;
203 e.onClickEntity = main.mutatorsDialog;
204 main.mutatorsDialog.refilterEntity = me.mapListBox;
205 setDependent(e, "g_campaign", 0, 0);
206
207 // bottom row
208 me.gotoRC(me, me.rows - 1, 0);
209 me.TDempty(me, me.columns * 1/12);
210 me.TD(me, 1, me.columns * 5/12, e = makeXonoticLeaveMatchButton('0 0 0', 0));
211 me.TD(me, 1, me.columns * 5/12, e = makeXonoticButton(_("Start multiplayer!"), '0 1 0'));
212 e.onClick = MapList_LoadMap;
213 e.onClickEntity = me.mapListBox;
214 me.mapListBox.startButton = e;
215
217}
void GameType_ConfigureSliders_for_CurrentGametype(entity me)
float allowBotSkill(entity e)
entity makeXonoticGametypeList()
#define ZCTX(s)
Definition i18n.qh:70
entity makeXonoticLeaveMatchButton(vector theColor, int theFlags)
#define main
Definition _all.inc:204
void MapList_StringFilterBox_Change(entity box, entity me)
Definition maplist.qc:226
float MapList_StringFilterBox_keyDown(entity me, float scan, float ascii, float shift)
Definition maplist.qc:385
void MapList_Remove_All(entity btn, entity me)
Definition maplist.qc:268
entity makeXonoticMapList()
Definition maplist.qc:15
void MapList_Add_Shown(entity btn, entity me)
Definition maplist.qc:235
void MapList_Add_All(entity btn, entity me)
Definition maplist.qc:258
void MapList_Remove_Shown(entity btn, entity me)
Definition maplist.qc:247
void MapList_LoadMap(entity btn, entity me)
Definition maplist.qc:274
entity makeXonoticButton_T(string theText, vector theColor, string theTooltip)
Definition button.qc:3
entity makeXonoticButton(string theText, vector theColor)
Definition button.qc:9
void setDependentWeird(entity e, float(entity) func)
Definition util.qc:249
void makeCallback(entity e, entity cbent, void(entity, entity) cbfunc)
Definition util.qc:107
void setDependentAND(entity e, string theCvarName, float theCvarMin, float theCvarMax)
Definition util.qc:213
void setDependent(entity e, string theCvarName, float theCvarMin, float theCvarMax)
Definition util.qc:180
void DialogOpenButton_Click(entity button, entity tab)
entity makeXonoticTextLabel(float theAlign, string theText)
Definition textlabel.qc:3
entity makeXonoticHeaderLabel(string theText)
Definition textlabel.qc:9
entity makeXonoticCheckBox_T(float isInverted, string theCvar, string theText, string theTooltip)
Definition checkbox.qc:3
entity makeXonoticInputBox_T(bool doEditColorCodes, string theCvar, string theTooltip)
Definition inputbox.qc:3
entity makeXonoticMixedSlider(string theCvar)
Definition mixedslider.qc:9
entity makeXonoticMixedSlider_T(string theCvar, string theTooltip)
Definition mixedslider.qc:3
entity makeXonoticSlider_T(float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
Definition slider.qc:3

References allowBotSkill(), allowBotVsHuman(), DialogOpenButton_Click(), entity(), GameType_ConfigureSliders_for_CurrentGametype(), main, makeCallback(), makeXonoticButton(), makeXonoticButton_T(), makeXonoticCheckBox_T(), makeXonoticGametypeList(), makeXonoticHeaderLabel(), makeXonoticInputBox_T(), makeXonoticLeaveMatchButton(), makeXonoticMapList(), makeXonoticMixedSlider(), makeXonoticMixedSlider_T(), makeXonoticSlider_T(), makeXonoticTextLabel(), MapList_Add_All(), MapList_Add_Shown(), MapList_LoadMap(), MapList_Remove_All(), MapList_Remove_Shown(), MapList_StringFilterBox_Change(), MapList_StringFilterBox_keyDown(), setDependent(), setDependentAND(), setDependentWeird(), string_null, and ZCTX.

◆ XonoticServerCreateTab_gameTypeChangeNotify()

void XonoticServerCreateTab_gameTypeChangeNotify ( entity me)

Definition at line 219 of file dialog_multiplayer_create.qc.

220{
222
223 me.mapListBox.refilter(me.mapListBox);
224}

References entity(), and GameType_ConfigureSliders_for_CurrentGametype().

◆ XonoticServerCreateTab_gameTypeSelectNotify()

void XonoticServerCreateTab_gameTypeSelectNotify ( entity me)

Definition at line 226 of file dialog_multiplayer_create.qc.

227{
228 me.setFocus(me, me.mapListBox);
229}

References entity().