X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fmenu.qc;h=af14e0842b4dc749897a45e7fc2f18ae2dcaf6c4;hb=e87123e5fba23f7a8907e6fbab241c5eec5be168;hp=913cdbe34b43f6bb068c7e8748e301da57386397;hpb=4d27b8affb4defa4f2d14eaf9d87b996c57459f3;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 913cdbe34..af14e0842 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -17,8 +17,8 @@ #include "xonotic/util.qh" -#include "../common/items/all.qh" -#include +#include "../common/items/_mod.qh" +#include #include "../common/mapinfo.qh" #include "../common/mutators/base.qh" @@ -69,7 +69,7 @@ void m_init() cvar_set("_menu_prvm_language", prvm_language); #ifdef WATERMARK - LOG_INFOF("^4MQC Build information: ^1%s\n", WATERMARK); + LOG_INFOF("^4MQC Build information: ^1%s", WATERMARK); #endif // list all game dirs (TEST) @@ -237,7 +237,7 @@ void m_keyup(float key, float ascii) if (mouseButtonsPressed < 0) { mouseButtonsPressed = 0; - LOG_TRACE("Warning: released an already released button\n"); + LOG_TRACE("Warning: released an already released button"); } } if (key == K_ALT) menuShiftState &= ~S_ALT; @@ -270,7 +270,8 @@ void m_keydown(float key, float ascii) else { draw_reset_cropped(); - if (!mouseButtonsPressed && key >= K_MOUSE1 && key <= K_MOUSE3) main.mousePress(main, menuMousePos); + if (!mouseButtonsPressed && key >= K_MOUSE1 && key <= K_MOUSE3) + main.mousePress(main, menuMousePos); if (!main.keyDown(main, key, ascii, menuShiftState)) { // disable menu on unhandled ESC @@ -285,7 +286,7 @@ void m_keydown(float key, float ascii) if (mouseButtonsPressed > 10) { mouseButtonsPressed = 10; - LOG_TRACE("Warning: pressed an already pressed button\n"); + LOG_TRACE("Warning: pressed an already pressed button"); } } if (key == K_ALT) menuShiftState |= S_ALT; @@ -588,9 +589,11 @@ void m_tooltip(vector pos) int i = 0; float w = 0; - for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining; ++i) + for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining && i <= 16; ++i) { string s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors); + if (i == 16) + s = "..."; float f = draw_TextWidth(s, false, fontsize); if (f > w) w = f; } @@ -660,18 +663,36 @@ void m_tooltip(vector pos) p = menuTooltipOrigin; p.x += SKINMARGIN_TOOLTIP_x / conwidth; p.y += SKINMARGIN_TOOLTIP_y / conheight; - for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining; p.y += fontsize.y) + int i = 0; + for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining && i <= 16; ++i, p.y += fontsize.y) { string s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors); + if (i == 16) + s = "..."; draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, false); } } } } +float autocvar_menu_force_on_disconnection; void m_draw(float width, float height) { - if (clientstate() == CS_DISCONNECTED) m_toggle(true); + if (autocvar_menu_force_on_disconnection > 0) + { + static float connected_time; + if (clientstate() == CS_DISCONNECTED) + { + if (connected_time && time - connected_time > autocvar_menu_force_on_disconnection) + { + m_toggle(true); + connected_time = 0; + } + } + else + connected_time = time; + } + m_gamestatus(); execute_next_frame(); @@ -790,15 +811,11 @@ void m_draw(float width, float height) draw_alpha *= menuAlpha; - if (!Menu_Active) - { - // do not update mouse position - // it prevents mouse jumping to '0 0 0' when menu is fading out - } - else if (menuMouseMode) + if (menuMouseMode) { - vector newMouse = globalToBox(getmousepos(), draw_shift, draw_scale); - if (newMouse != '0 0 0' && newMouse != menuMousePos) + vector rawMousePos = getmousepos(); + vector newMouse = globalToBox(rawMousePos, draw_shift, draw_scale); + if (rawMousePos != '0 0 0' && newMouse != menuMousePos) { menuMousePos = newMouse; if (mouseButtonsPressed) main.mouseDrag(main, menuMousePos); @@ -832,6 +849,7 @@ void m_draw(float width, float height) postMenuDraw(); frametime = 0; + IL_ENDFRAME(); } void m_display() @@ -959,6 +977,8 @@ void m_goto(string itemname) if ((e) && (!e.requiresConnection || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED)))) { + if(!Menu_Active) + e.hideMenuOnClose = true; m_hide(); m_activate_window(e); m_setpointerfocus(e);