-// alias for switching the teamselect menu
-bind f5 menu_showteamselect
-
-bind f6 team_auto
-
-bind f7 menu_showsandboxtools
-
-bind f9 "cl_cmd hud minigame"
-
// movement
bind w +forward
bind a +moveleft
bind DOWNARROW +back
bind RIGHTARROW +moveright
bind SHIFT +crouch
-bind ENTER +jump
bind SPACE +jump
+bind ENTER +jump
// weapons
bind 0 weapon_group_0
bind MWHEELUP weapnext
bind MWHEELDOWN weapprev
bind r reload
-bind BACKSPACE dropweapon
bind g dropweapon
+bind BACKSPACE dropweapon
bind f +use
bind v +button8 // drag object
bind b "quickmenu"
bind i +show_info
bind PAUSE pause
+
+bind F1 vyes
+bind F2 vno
+bind F3 spec // used for spectate/observer mode
+bind F4 ready
+
+bind f5 menu_showteamselect // alias for switching the teamselect menu
+bind f6 team_auto
+bind f7 menu_showsandboxtools
+bind f8 menu_showvcall
+
bind F9 "cl_cmd hud minigame"
bind F10 menu_showquitdialog
bind F11 disconnect
bind F12 screenshot
-bind F4 ready
-bind ALT +showaccuracy
-// Gamepad defaults. Tested with Logitech Rumblepad 2, I hope similar ones works as well.
+// Gamepad defaults. Tested with Logitech Rumblepad 2, I hope similar ones work as well.
bind JOY1 "+crouch"
bind JOY2 "+jump"
bind JOY3 "weapprev"
bind kp_plus "+userbind 17"
bind kp_minus "+userbind 18"
-bind F1 vyes
-bind F2 vno
-
-//used for spectate/observer mode
-bind F3 spec
-
// usercommands. These can be edited and bound by the menu.
seta "userbind1_press" "say_team quad soon"; seta "userbind1_release" ""; seta "userbind1_description" "team: quad soon"
seta "userbind2_press" "say_team free item %x^7 (l:%y^7); g_waypointsprite_team_here_p"; seta "userbind2_release" ""; seta "userbind2_description" "team: free item, icon"
seta "userbind32_press" ""; seta "userbind32_release" ""; seta "userbind32_description" ""
alias _userbind_call "${$1}"
alias +userbind "_userbind_call userbind${1}_press"
-alias -userbind "_userbind_call userbind${1}_release"
\ No newline at end of file
+alias -userbind "_userbind_call userbind${1}_release"
alias menu_showhudexit "menu_cmd directmenu HUDExit"
alias menu_showhudoptions "menu_cmd directpanelhudmenu ${* ?}"
alias menu_showsandboxtools "menu_cmd directmenu SandboxTools"
+alias menu_showvcall "menu_cmd directmenu Vcall"
alias menu_showquitdialog "menu_cmd directmenu Quit"
alias menu_showmonstertools "menu_cmd directmenu MonsterTools"
#define CONSOLE_COMMANDS_NORMAL() \
CONSOLE_COMMAND("+showscores", { scoreboard_showscores = true; }) \
CONSOLE_COMMAND("-showscores", { scoreboard_showscores = false; }) \
- CONSOLE_COMMAND("+showaccuracy", { scoreboard_showaccuracy = true; }) \
- CONSOLE_COMMAND("-showaccuracy", { scoreboard_showaccuracy = false; }) \
/* nothing */
#define CONSOLE_COMMANDS_MOVEMENT() \
// Additional OPTIONAL Fields and Globals
//float intermission;
float scoreboard_showscores;
-float scoreboard_showaccuracy;
.string message;
.int renderflags;
// float coop;
g_trueaim_minrange = ReadCoord();
+ #define X(out) MACRO_BEGIN { \
+ out = ""; for (string s; (s = ReadString()) != ""; ) out = cons(out, s); \
+ } MACRO_END
+ string votes; X(votes);
+ localcmd("\nset __vcall \"", votes, "\"\n");
+ string maps; X(maps);
+ localcmd("\nset __vcall_chmap \"", maps, "\"\n");
+ localcmd("\nset __vcall_gotomap \"", maps, "\"\n");
+ localcmd("\nset __vcall_nextmap \"", maps, "\"\n");
+ #undef X
return = true;
MUTATOR_CALLHOOK(Ent_Init);
#include "xonotic/dialog_singleplayer.qc"
#include "xonotic/dialog_singleplayer_winner.qc"
#include "xonotic/dialog_teamselect.qc"
+#include "xonotic/dialog_vcall.qc"
#include "xonotic/gametypelist.qc"
#include "xonotic/hudskinlist.qc"
#include "xonotic/image.qc"
#include "xonotic/tab.qc"
#include "xonotic/textlabel.qc"
#include "xonotic/textslider.qc"
+#include "xonotic/votelist.qc"
#include "xonotic/weaponarenacheckbox.qc"
#include "xonotic/weaponslist.qc"
--- /dev/null
+#ifndef DIALOG_VCALL_H
+#define DIALOG_VCALL_H
+#include "rootdialog.qc"
+CLASS(XonoticVcallDialog, XonoticRootDialog)
+ ATTRIB(XonoticVcallDialog, title, string, _("Call a vote"))
+ ATTRIB(XonoticVcallDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticVcallDialog, intendedWidth, float, 1)
+ ATTRIB(XonoticVcallDialog, rows, float, 16)
+ ATTRIB(XonoticVcallDialog, columns, float, 20)
+ ATTRIB(XonoticVcallDialog, name, string, "Vcall")
+
+ ATTRIB(XonoticVcallDialog, voteList, entity, NULL)
+ ATTRIB(XonoticVcallDialog, optionList, entity, NULL)
+ ATTRIB(XonoticVcallDialog, inputBox, entity, NULL)
+
+ METHOD(XonoticVcallDialog, fill, void(XonoticVcallDialog this));
+ METHOD(XonoticVcallDialog, setFocus, void(XonoticVcallDialog this, entity a));
+ENDCLASS(XonoticVcallDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+METHOD(XonoticVcallDialog, setFocus, void(XonoticVcallDialog this, entity a))
+{
+ SUPER(XonoticVcallDialog).setFocus(this, a);
+ entity vlist = this.voteList;
+ vlist.refilter(vlist);
+}
+
+STATIC_METHOD(XonoticVcallDialog, Send, void(entity, XonoticVcallDialog this))
+{
+ localcmd("vcall ", this.inputBox.text, "\n");
+ this.close(this);
+}
+
+STATIC_METHOD(XonoticVcallDialog, Change, void(entity, XonoticVcallDialog this))
+{
+ entity vlist = this.voteList;
+ entity options = this.optionList;
+ vlist.source.getEntry(vlist.source, vlist.selectedItem, XonoticVoteList_cb);
+ string vote = XonoticVoteList_cb_name;
+ options.source.getEntry(options.source, options.selectedItem, XonoticVoteList_cb);
+ string option = XonoticVoteList_cb_name;
+ string s = (option != "") ? strcat(vote, " ", option) : vote;
+ entity t = this.inputBox;
+ t.setText(t, s);
+ t.cursorPos = strlen(s);
+}
+
+STATIC_METHOD(XonoticVcallDialog, ChangeVote, void(entity, XonoticVcallDialog this))
+{
+ entity vlist = this.voteList;
+ entity entries = this.optionList;
+ int i = vlist.selectedItem;
+ vlist.source.getEntry(vlist.source, i, XonoticVoteList_cb);
+ if (entries.source.CvarStringSource_cvar) strunzone(entries.source.CvarStringSource_cvar);
+ entries.source.CvarStringSource_cvar = strzone(strcat("__vcall_", XonoticVoteList_cb_name));
+ entries.refilter(entries);
+ entries.setSelected(entries, 0);
+ XonoticVcallDialog_Change(NULL, this);
+}
+
+METHOD(XonoticVcallDialog, fill, void(XonoticVcallDialog this))
+{
+ entity vlist, olist;
+ this.TR(this);
+ {
+ this.TD(this, 1, 10, makeXonoticTextLabel(0, _("Available votes:")));
+ this.TD(this, 1, 10, makeXonoticTextLabel(0, _("Available options:")));
+ }
+ this.TR(this);
+ {
+ DataSource votes = NEW(CvarStringSource, "__vcall", " ");
+ this.TD(this, 13, 10, vlist = this.voteList = NEW(XonoticVoteList, votes));
+ {
+ vlist.onChange = XonoticVcallDialog_ChangeVote;
+ vlist.onChangeEntity = this;
+ }
+ DataSource options = NEW(CvarStringSource, string_null, " ");
+ this.TD(this, 13, 10, olist = this.optionList = NEW(XonoticVoteList, options));
+ {
+ olist.onChange = XonoticVcallDialog_Change;
+ olist.onChangeEntity = this;
+ }
+ this.gotoRC(this, this.rows - 2, 0);
+ this.TD(this, 1, 20, this.inputBox = makeXonoticInputBox(1, string_null));
+ }
+ this.TR(this);
+ {
+ entity e;
+ this.TD(this, 1, 10, e = makeXonoticButton(_("Call the vote"), '0 0 0'));
+ {
+ e.onClick = XonoticVcallDialog_Send;
+ e.onClickEntity = this;
+ }
+ this.TD(this, 1, 10, e = makeXonoticCommandButton(_("Cancel"), '0 0 0', "", 1));
+ {
+ e.onClick = Dialog_Close;
+ e.onClickEntity = this;
+ }
+ }
+}
+#endif
KEYBIND_DEF("messagemode" , _("public chat"));
KEYBIND_DEF("messagemode2" , _("team chat"));
KEYBIND_DEF("+con_chat_maximize" , _("show chat history"));
+ KEYBIND_DEF("menu_showvcall" , _("call a vote"));
KEYBIND_DEF("vyes" , _("vote YES"));
KEYBIND_DEF("vno" , _("vote NO"));
KEYBIND_DEF("ready" , _("ready"));
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
+ i = NEW(XonoticVcallDialog);
+ i.configureDialog(i);
+ me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
// main dialogs/windows
me.mainNexposee = n = NEW(XonoticNexposee);
--- /dev/null
+#ifndef VOTELIST_H
+#define VOTELIST_H
+
+#include "listbox.qc"
+CLASS(XonoticVoteList, XonoticListBox)
+ METHOD(XonoticVoteList, resizeNotify, void(XonoticVoteList this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
+ {
+ SUPER(XonoticVoteList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+ this.realFontSize_y = this.fontSize / (absSize.y * this.itemHeight);
+ this.realFontSize_x = this.fontSize / (absSize.x * (1 - this.controlWidth));
+ }
+
+ ATTRIB(XonoticVoteList, source, DataSource, NULL)
+
+ METHOD(XonoticVoteList, refilter, void(XonoticVoteList this));
+ METHOD(XonoticVoteList, setSelected, void(XonoticVoteList this, int i));
+ METHOD(XonoticVoteList, drawListBoxItem, void(XonoticVoteList this, int i, vector absSize, bool isSelected, bool isFocused));
+
+ CONSTRUCTOR(XonoticVoteList, DataSource _source)
+ {
+ CONSTRUCT(XonoticVoteList);
+ this.source = _source;
+ this.refilter(this);
+ }
+
+ENDCLASS(XonoticVoteList)
+
+string XonoticVoteList_cb_name;
+void XonoticVoteList_cb(string _name, string _icon) { XonoticVoteList_cb_name = _name; }
+
+#endif
+
+#ifdef IMPLEMENTATION
+
+METHOD(XonoticVoteList, refilter, void(XonoticVoteList this))
+{
+ if (!this.source)
+ {
+ this.nItems = 0;
+ return;
+ }
+ this.nItems = this.source.reload(this.source, "");
+}
+
+METHOD(XonoticVoteList, setSelected, void(XonoticVoteList this, int i))
+{
+ SUPER(XonoticVoteList).setSelected(this, i);
+ if (!this.source.getEntry(this.source, i, XonoticVoteList_cb)) return;
+ if (this.onChange) this.onChange(this, this.onChangeEntity);
+}
+
+METHOD(XonoticVoteList, drawListBoxItem, void(XonoticVoteList this, int i, vector absSize, bool isSelected, bool isFocused))
+{
+ if (!this.source.getEntry(this.source, i, XonoticVoteList_cb)) return;
+ if (isSelected) draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ string s = XonoticVoteList_cb_name;
+ draw_Text(this.realUpperMargin * eY + this.columnNameOrigin * eX, s, this.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+}
+
+#endif
ClientInit_misc();
MUTATOR_CALLHOOK(Ent_Init);
}
+
+string vcall_maps()
+{
+ static string it;
+ if (it) return it;
+ for (int i = 0; i < MapInfo_count; ++i)
+ {
+ if ((MapInfo_Get_ByID(i)) && !(MapInfo_Map_flags & MapInfo_ForbiddenFlags()))
+ it = cons(it, MapInfo_Map_bspname);
+ }
+ MapInfo_ClearTemps();
+ return it = strzone(it);
+}
+
void ClientInit_misc()
{
int channel = MSG_ONE;
WriteByte(channel, self.count * 255.0); // g_balance_armor_blockpercent
WriteByte(channel, serverflags); // client has to know if it should zoom or not
WriteCoord(channel, autocvar_g_trueaim_minrange);
+ #define X(list) \
+ MACRO_BEGIN { \
+ FOREACH_WORD(list, true, { \
+ WriteString(channel, it); \
+ }); \
+ WriteString(channel, ""); \
+ } MACRO_END
+ X(autocvar_sv_vote_commands);
+ X(vcall_maps());
+ #undef X
}
void ClientInit_CheckUpdate()