X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fmainwindow.qc;h=2a100c5b45a5f173c53518e455d74d8c5a2c3954;hb=415aa53e6a5e50a97d95e14f48fb3589f04f64d5;hp=55f922929fde71fc0b3670ebde078e19ae7d0efc;hpb=06a08d0c6b573f2562297147171aff3d990fa42d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/mainwindow.qc b/qcsrc/menu/xonotic/mainwindow.qc index 55f922929..2a100c5b4 100644 --- a/qcsrc/menu/xonotic/mainwindow.qc +++ b/qcsrc/menu/xonotic/mainwindow.qc @@ -4,6 +4,7 @@ #include "nexposee.qh" #include "inputbox.qh" +#include "dialog_termsofservice.qh" #include "dialog_firstrun.qh" #include "dialog_hudsetup_exit.qh" #include "dialog_hudpanel_notification.qh" @@ -25,6 +26,7 @@ #include "dialog_hudpanel_centerprint.qh" #include "dialog_hudpanel_itemstime.qh" #include "dialog_hudpanel_quickmenu.qh" +#include "dialog_hudpanel_strafehud.qh" #include "dialog_settings_input_userbind.qh" #include "dialog_settings_bindings_reset.qh" @@ -49,46 +51,21 @@ #include "dialog_credits.qh" #include "dialog_quit.qh" -#include "dialog_disconnect.qh" - - - void MainWindow_draw(entity me) { SUPER(MainWindow).draw(me); - if(me.dialogToShow) - { - DialogOpenButton_Click_withCoords(NULL, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight); - me.dialogToShow = NULL; - } - - //------------------------------------- - // Part of Disconnect Dialog button: - // In case of this function is recalling every time, need to use condition of visibility - - if (me.disconnectDialogVisibility && !(gamestatus & (GAME_ISSERVER | GAME_CONNECTED))) - { - // If gamestate is not "ingame" (and it is a first "frame" of drawing (or dialog is visible)), - // disconnect button is unnecessary, remove it - me.removeItem(me.mainNexposee, me.disconnectDialog); - me.disconnectDialogVisibility = 0; - - } else if(!me.disconnectDialogVisibility && (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))) { + if (me.firstDraw) { + if (me.ToSDialog.shouldShow()) + { + me.ToSDialog.loadXonoticToS(me.ToSDialog); + DialogOpenButton_Click_withCoords(NULL, me.ToSDialog, '0 0 0', eX * conwidth + eY * conheight); + } + else if(me.firstRunDialog.shouldShow()) + DialogOpenButton_Click_withCoords(NULL, me.firstRunDialog, '0 0 0', eX * conwidth + eY * conheight); - // If gamestate is "ingame" (and dialog is not visible), - // make disconnect button visible - entity n, i; - n = me.mainNexposee; - i = me.disconnectDialog; - n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); - n.setNexposee(n, i, '0.5 1.2 0.0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y); - me.disconnectDialogVisibility = 1; + me.firstDraw = false; } - - // I haven't found the best solution for making button visible. - // Alpha channel is the worst thing, because dialog with alpha is also clickable - //------------------------------------- } void DemoButton_Click(entity me, entity other) @@ -103,6 +80,11 @@ void MainWindow_configureMainWindow(entity me) { entity n, i; + // terms of service dialog + me.ToSDialog = i = NEW(XonoticToSDialog); + i.configureDialog(i); + me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + // dialog run upon startup me.firstRunDialog = i = NEW(XonoticFirstRunDialog); i.configureDialog(i); @@ -190,6 +172,10 @@ void MainWindow_configureMainWindow(entity me) i.configureDialog(i); me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + i = NEW(XonoticHUDStrafeHUDDialog); + i.configureDialog(i); + me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + // dialogs used by settings me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog); i.configureDialog(i); @@ -276,7 +262,7 @@ void MainWindow_configureMainWindow(entity me) // main dialogs/windows me.mainNexposee = n = NEW(XonoticNexposee); - + /* if(checkextension("DP_GECKO_SUPPORT")) { @@ -286,7 +272,7 @@ void MainWindow_configureMainWindow(entity me) n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y); } */ - + i = NEW(XonoticSingleplayerDialog); i.configureDialog(i); n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); @@ -308,14 +294,6 @@ void MainWindow_configureMainWindow(entity me) n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y); n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight)); - //Disconnect dialog at center of screen (between credits and quit) - i = NEW(XonoticDisconnectDialog); - i.configureDialog(i); - n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); - n.setNexposee(n, i, '0.5 1.2 0.0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y); - n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight)); - me.disconnectDialog = i; - i = NEW(XonoticQuitDialog); i.configureDialog(i); n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); @@ -326,8 +304,4 @@ void MainWindow_configureMainWindow(entity me) me.moveItemAfter(me, n, NULL); me.initializeDialog(me, n); - me.disconnectDialogVisibility = 1; - - if(cvar_string("_cl_name") == cvar_defstring("_cl_name")) - me.dialogToShow = me.firstRunDialog; }