From: terencehill Date: Tue, 1 Jun 2021 10:45:37 +0000 (+0200) Subject: Show "Quit multiplayer / Disconnect from the server" as tooltip when hovering over... X-Git-Tag: xonotic-v0.8.5~129^2~16 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b2c8061ff37c1b23de780356450df2fa54f90c92;p=xonotic%2Fxonotic-data.pk3dir.git Show "Quit multiplayer / Disconnect from the server" as tooltip when hovering over the "Quit multiplayer" button --- diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create.qc b/qcsrc/menu/xonotic/dialog_multiplayer_create.qc index b2c8de1f7..8b2873e5d 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create.qc @@ -71,6 +71,7 @@ void XonoticServerCreateTab_draw(entity me) entity e = me.quitGameButton; e.disabled = !(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)); e.setText(e, quitGameButton_getText(e)); + setZonedTooltip(e, quitGameButton_getTooltip(e), string_null); SUPER(XonoticServerCreateTab).draw(me); } diff --git a/qcsrc/menu/xonotic/dialog_quit.qc b/qcsrc/menu/xonotic/dialog_quit.qc index 1bd90038a..dbab87aad 100644 --- a/qcsrc/menu/xonotic/dialog_quit.qc +++ b/qcsrc/menu/xonotic/dialog_quit.qc @@ -15,6 +15,7 @@ void XonoticQuitDialog_draw(entity me) entity e = me.disconnectButton; e.disabled = !(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)); e.setText(e, quitGameButton_getText(e)); + setZonedTooltip(e, quitGameButton_getTooltip(e), string_null); SUPER(XonoticQuitDialog).draw(me); } diff --git a/qcsrc/menu/xonotic/dialog_singleplayer.qc b/qcsrc/menu/xonotic/dialog_singleplayer.qc index 775f4a5b9..41b5c9f55 100644 --- a/qcsrc/menu/xonotic/dialog_singleplayer.qc +++ b/qcsrc/menu/xonotic/dialog_singleplayer.qc @@ -145,6 +145,7 @@ void XonoticSingleplayerDialog_draw(entity me) entity e = me.quitGameButton; e.disabled = !(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)); e.setText(e, quitGameButton_getText(e)); + setZonedTooltip(e, quitGameButton_getTooltip(e), string_null); SUPER(XonoticSingleplayerDialog).draw(me); } diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 3283476b1..5d5b2d166 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -835,6 +835,18 @@ string quitGameButton_getText(entity btn) return _("Quit multiplayer"); } +string quitGameButton_getTooltip(entity btn) +{ + if (btn.disabled) + return "-"; + else if(cvar("g_campaign")) + return "-"; + else if (cvar_string("net_address") == "127.0.0.1" && cvar_string("net_address_ipv6") == "::1") + return "-"; + else + return _("Quit multiplayer / Disconnect from the server"); +} + float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha) { if(startAlpha < targetAlpha) diff --git a/qcsrc/menu/xonotic/util.qh b/qcsrc/menu/xonotic/util.qh index a4e37c7c9..4fa6e66db 100644 --- a/qcsrc/menu/xonotic/util.qh +++ b/qcsrc/menu/xonotic/util.qh @@ -41,6 +41,7 @@ void dialog_hudpanel_main_settings(entity me, string panelname); void makeServerSingleplayer(); string quitGameButton_getText(entity btn); +string quitGameButton_getTooltip(entity btn); float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha);