From 997053573f965d56d4eff383755a83ca1f9b24af Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 2 Jul 2016 16:06:21 +0200 Subject: [PATCH] Implement the uid2name dialog in the menu, but keep the existing one implemented in the HUD vote panel for compatibility sake, so clients with an older menu can still see it --- qcsrc/client/hud/panel/vote.qc | 7 +++++++ qcsrc/menu/xonotic/_mod.inc | 1 + qcsrc/menu/xonotic/_mod.qh | 1 + qcsrc/menu/xonotic/dialog_uid2name.qc | 18 ++++++++++++++++++ qcsrc/menu/xonotic/dialog_uid2name.qh | 13 +++++++++++++ qcsrc/menu/xonotic/mainwindow.qc | 5 +++++ 6 files changed, 45 insertions(+) create mode 100644 qcsrc/menu/xonotic/dialog_uid2name.qc create mode 100644 qcsrc/menu/xonotic/dialog_uid2name.qh diff --git a/qcsrc/client/hud/panel/vote.qc b/qcsrc/client/hud/panel/vote.qc index 89c784a10..f85d304c5 100644 --- a/qcsrc/client/hud/panel/vote.qc +++ b/qcsrc/client/hud/panel/vote.qc @@ -7,6 +7,13 @@ void HUD_Vote() { if(autocvar_cl_allow_uid2name == -1 && (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (serverflags & SERVERFLAG_PLAYERSTATS))) { + // this dialog gets overriden by the uid2name menu dialog, if it exists + // TODO remove this client side uid2name dialog in the next release + if (!uid2name_dialog) + localcmd("menu_cmd directmenu Uid2Name\n"); + if(autocvar__menu_alpha) + hud_fade_alpha = 0; + vote_active = 1; if (autocvar__hud_configure) { diff --git a/qcsrc/menu/xonotic/_mod.inc b/qcsrc/menu/xonotic/_mod.inc index 867f77b84..577c82258 100644 --- a/qcsrc/menu/xonotic/_mod.inc +++ b/qcsrc/menu/xonotic/_mod.inc @@ -79,6 +79,7 @@ #include #include #include +#include #include #include #include diff --git a/qcsrc/menu/xonotic/_mod.qh b/qcsrc/menu/xonotic/_mod.qh index adfefc05d..b6e34eff2 100644 --- a/qcsrc/menu/xonotic/_mod.qh +++ b/qcsrc/menu/xonotic/_mod.qh @@ -79,6 +79,7 @@ #include #include #include +#include #include #include #include diff --git a/qcsrc/menu/xonotic/dialog_uid2name.qc b/qcsrc/menu/xonotic/dialog_uid2name.qc new file mode 100644 index 000000000..1cd77b0ca --- /dev/null +++ b/qcsrc/menu/xonotic/dialog_uid2name.qc @@ -0,0 +1,18 @@ +#include "dialog_uid2name.qh" + +#include "textlabel.qh" +#include "commandbutton.qh" + +void XonoticUid2NameDialog_fill(entity me) +{ + entity e; + me.TR(me); + me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Allow player statistics to use your nickname?"))); + me.TR(me); + me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Answering \"No\" you will appear as \"Anonymous player\""))); + me.TR(me); + me.TR(me); + me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Yes"), '0 0 0', "vyes; setreport cl_allow_uid2name 1", COMMANDBUTTON_CLOSE)); + e.preferredFocusPriority = 1; + me.TD(me, 1, 1, e = makeXonoticCommandButton(_("No"), '0 0 0', "vno; setreport cl_allow_uid2name 0", COMMANDBUTTON_CLOSE)); +} diff --git a/qcsrc/menu/xonotic/dialog_uid2name.qh b/qcsrc/menu/xonotic/dialog_uid2name.qh new file mode 100644 index 000000000..7072682e9 --- /dev/null +++ b/qcsrc/menu/xonotic/dialog_uid2name.qh @@ -0,0 +1,13 @@ +#pragma once + +#include "rootdialog.qh" +CLASS(XonoticUid2NameDialog, XonoticRootDialog) + METHOD(XonoticUid2NameDialog, fill, void(entity)); + ATTRIB(XonoticUid2NameDialog, title, string, _("Name in stats")) + ATTRIB(XonoticUid2NameDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT) + ATTRIB(XonoticUid2NameDialog, intendedWidth, float, 0.5) + ATTRIB(XonoticUid2NameDialog, rows, float, 4) + ATTRIB(XonoticUid2NameDialog, columns, float, 2) + ATTRIB(XonoticUid2NameDialog, name, string, "Uid2Name") + ATTRIB(XonoticUid2NameDialog, closable, float, 0) +ENDCLASS(XonoticUid2NameDialog) diff --git a/qcsrc/menu/xonotic/mainwindow.qc b/qcsrc/menu/xonotic/mainwindow.qc index fb25eebde..0e071c2e7 100644 --- a/qcsrc/menu/xonotic/mainwindow.qc +++ b/qcsrc/menu/xonotic/mainwindow.qc @@ -39,6 +39,7 @@ #include "dialog_sandboxtools.qh" #include "dialog_monstertools.qh" #include "dialog_teamselect.qh" +#include "dialog_uid2name.qh" #include "dialog_singleplayer.qh" #include "dialog_multiplayer.qh" #include "dialog_settings.qh" @@ -224,6 +225,10 @@ void MainWindow_configureMainWindow(entity me) i.configureDialog(i); me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + i = NEW(XonoticUid2NameDialog); + i.configureDialog(i); + me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + i = NEW(XonoticMonsterToolsDialog); i.configureDialog(i); me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS); -- 2.39.2