From ee845bc3a56677c86eaceccad911e4222d309ee0 Mon Sep 17 00:00:00 2001 From: z411 Date: Mon, 16 May 2022 19:35:31 -0400 Subject: [PATCH] Initial welcome dialog update --- qcsrc/menu/xonotic/dialog_teamselect.qc | 13 +---- qcsrc/menu/xonotic/dialog_welcome.qc | 65 +++++++++++++++++++++---- qcsrc/menu/xonotic/dialog_welcome.qh | 9 +++- qcsrc/menu/xonotic/util.qc | 14 ++++++ qcsrc/menu/xonotic/util.qh | 3 ++ 5 files changed, 80 insertions(+), 24 deletions(-) diff --git a/qcsrc/menu/xonotic/dialog_teamselect.qc b/qcsrc/menu/xonotic/dialog_teamselect.qc index e23a8706c..812214326 100644 --- a/qcsrc/menu/xonotic/dialog_teamselect.qc +++ b/qcsrc/menu/xonotic/dialog_teamselect.qc @@ -1,17 +1,6 @@ #include "dialog_teamselect.qh" -#include "bigcommandbutton.qh" - -entity makeTeamButton_T(string theName, vector theColor, string commandtheName, string theTooltip) -{ - entity b; - b = makeXonoticBigCommandButton_T(theName, theColor, commandtheName, COMMANDBUTTON_CLOSE, theTooltip); - return b; -} -entity makeTeamButton(string theName, vector theColor, string commandtheName) -{ - return makeTeamButton_T(theName, theColor, commandtheName, string_null); -} +#include "util.qh" void XonoticTeamSelectDialog_showNotify(entity me) { diff --git a/qcsrc/menu/xonotic/dialog_welcome.qc b/qcsrc/menu/xonotic/dialog_welcome.qc index ca80ef4dd..4485d93a9 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qc +++ b/qcsrc/menu/xonotic/dialog_welcome.qc @@ -6,6 +6,8 @@ #include "radiobutton.qh" #include "commandbutton.qh" #include "slider.qh" +#include "util.qh" + void welcomeDialog_resetStrings(entity me) { @@ -17,11 +19,11 @@ float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shif { switch(key) { - case K_KP_ENTER: - case K_ENTER: - case K_SPACE: - me.close(me); - return true; + //case K_KP_ENTER: + //case K_ENTER: + //case K_SPACE: + // me.close(me); + // return true; default: return SUPER(XonoticWelcomeDialog).keyDown(me, key, ascii, shift); } @@ -63,9 +65,21 @@ void XonoticWelcomeDialog_readInputArgs(entity me, int argsbuf) } ++i; } - //me.serverinfo_name_ent.setText(me.serverinfo_name_ent, me.serverinfo_name); + me.serverinfo_name_ent.setText(me.serverinfo_name_ent, me.serverinfo_name); me.serverinfo_MOTD_ent.setText(me.serverinfo_MOTD_ent, me.serverinfo_MOTD); - me.frame.setText(me.frame, me.serverinfo_name); + me.frame.setText(me.frame, "Welcome to Xonotic git"); +} + +void XonoticWelcomeDialog_showNotify(entity me) +{ + SUPER(XonoticWelcomeDialog).showNotify(me); + float teams, nTeams; + teams = cvar("_teams_available"); + nTeams = 0; + me.team1.disabled = !(teams & 1); nTeams += boolean(teams & 1); + me.team2.disabled = !(teams & 2); nTeams += boolean(teams & 2); + me.team3.disabled = !(teams & 4); nTeams += boolean(teams & 4); + me.team4.disabled = !(teams & 8); nTeams += boolean(teams & 8); } void XonoticWelcomeDialog_draw(entity me) @@ -90,13 +104,44 @@ void XonoticWelcomeDialog_fill(entity me) entity e; me.TR(me); - me.TD(me, me.rows - 1, me.columns, me.serverinfo_MOTD_ent = makeXonoticTextBox()); + me.TD(me, 1, me.columns, me.serverinfo_name_ent = makeXonoticHeaderLabel("Server")); + me.serverinfo_name_ent.allowColors = true; + me.TR(me); + me.TD(me, 2, 1, makeXonoticImage("/gfx/menu/luma/gametype_ca", 1)); + me.TD(me, 1, 3, makeXonoticTextLabel(0, "Game type: Clan Arena")); + me.TR(me); + me.TDempty(me, 1); + me.TD(me, 1, 4, makeXonoticTextLabel(0, "Players: 4/24 (Warmup)")); + me.TR(me); + me.TD(me, 1, 2, makeXonoticTextLabel(0, "Frag limit: 0")); + me.TR(me); + me.TD(me, 1, 4, makeXonoticTextLabel(0, "Time limit: 10")); + me.TR(me); + me.TD(me, 1, 4, e = makeXonoticTextLabel(0, "Active modifications: Test\nNew line test")); + e.escapedNewLines = true; + me.TR(me); + me.TR(me); + me.TD(me, 2, 4, e = makeTeamButton_T(_("join"), '0 0 0', "cmd selectteam auto; cmd join", + _("Autoselect team (recommended)"))); + e.preferredFocusPriority = 1; + me.TR(me); + me.TR(me); + me.TD(me, 2, 1, e = me.team1 = makeTeamButton(_("red"), '1 0.5 0.5', "cmd selectteam red; cmd join")); + me.TD(me, 2, 1, e = me.team2 = makeTeamButton(_("blue"), '0.5 0.5 1', "cmd selectteam blue; cmd join")); + me.TD(me, 2, 1, e = me.team3 = makeTeamButton(_("yellow"), '1 1 0.5', "cmd selectteam yellow; cmd join")); + me.TD(me, 2, 1, e = me.team4 = makeTeamButton(_("pink"), '1 0.5 1', "cmd selectteam pink; cmd join")); + me.TR(me); + me.TR(me); + me.TD(me, 1, 4, makeXonoticCommandButton(_("spectate"), '0 0 0', "cmd spectate", COMMANDBUTTON_CLOSE)); + + me.gotoRC(me, 1, 4); + me.TD(me, me.rows - 1, 4, me.serverinfo_MOTD_ent = makeXonoticTextBox()); me.serverinfo_MOTD_ent.align = 0.5; me.serverinfo_MOTD_ent.allowColors = true; me.serverinfo_MOTD_ent.escapedNewLines = true; - me.gotoRC(me, me.rows - 1, 0); + /*me.gotoRC(me, me.rows - 1, 0); me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0')); e.onClick = Dialog_Close; e.onClickEntity = me; - e.preferredFocusPriority = 1; + e.preferredFocusPriority = 1;*/ } diff --git a/qcsrc/menu/xonotic/dialog_welcome.qh b/qcsrc/menu/xonotic/dialog_welcome.qh index d02cd6e73..a01d13516 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qh +++ b/qcsrc/menu/xonotic/dialog_welcome.qh @@ -7,17 +7,22 @@ CLASS(XonoticWelcomeDialog, XonoticRootDialog) ATTRIB(XonoticWelcomeDialog, color, vector, SKINCOLOR_DIALOG_WELCOME); ATTRIB(XonoticWelcomeDialog, intendedWidth, float, 0.8); ATTRIB(XonoticWelcomeDialog, rows, float, 12); - ATTRIB(XonoticWelcomeDialog, columns, float, 4); + ATTRIB(XonoticWelcomeDialog, columns, float, 8); ATTRIB(XonoticWelcomeDialog, name, string, "Welcome"); METHOD(XonoticWelcomeDialog, draw, void(entity)); METHOD(XonoticWelcomeDialog, mouseRelease, bool(entity, vector)); METHOD(XonoticWelcomeDialog, keyDown, float(entity, float, float, float)); + METHOD(XonoticWelcomeDialog, showNotify, void(entity)); METHOD(XonoticWelcomeDialog, destroy, void(entity)); METHOD(XonoticWelcomeDialog, readInputArgs, void(entity, int)); ATTRIB(XonoticWelcomeDialog, serverinfo_name, string, string_null); - //ATTRIB(XonoticWelcomeDialog, serverinfo_name_ent, entity, world); + ATTRIB(XonoticWelcomeDialog, serverinfo_name_ent, entity, world); ATTRIB(XonoticWelcomeDialog, serverinfo_MOTD, string, string_null); ATTRIB(XonoticWelcomeDialog, serverinfo_MOTD_ent, entity, world); + ATTRIB(XonoticWelcomeDialog, team1, entity); + ATTRIB(XonoticWelcomeDialog, team2, entity); + ATTRIB(XonoticWelcomeDialog, team3, entity); + ATTRIB(XonoticWelcomeDialog, team4, entity); ATTRIB(XonoticWelcomeDialog, requiresConnection, bool, true); ENDCLASS(XonoticWelcomeDialog) diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 691404ac1..a265efc1c 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -1,5 +1,6 @@ #include "util.qh" #include "dialog.qh" +#include "bigcommandbutton.qh" #include "../item.qh" @@ -854,3 +855,16 @@ void CheckSendCvars(entity me, string cvarnamestring) } } } + +entity makeTeamButton_T(string theName, vector theColor, string commandtheName, string theTooltip) +{ + entity b; + b = makeXonoticBigCommandButton_T(theName, theColor, commandtheName, COMMANDBUTTON_CLOSE, theTooltip); + return b; +} + +entity makeTeamButton(string theName, vector theColor, string commandtheName) +{ + return makeTeamButton_T(theName, theColor, commandtheName, string_null); +} + diff --git a/qcsrc/menu/xonotic/util.qh b/qcsrc/menu/xonotic/util.qh index bb5de1b51..4ba5a1cb9 100644 --- a/qcsrc/menu/xonotic/util.qh +++ b/qcsrc/menu/xonotic/util.qh @@ -53,3 +53,6 @@ float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh; float _Nex_ExtResponseSystem_NewToS; void CheckSendCvars(entity me, string cvarnamestring); + +entity makeTeamButton_T(string theName, vector theColor, string commandtheName, string theTooltip); +entity makeTeamButton(string theName, vector theColor, string commandtheName); -- 2.39.2