X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fmenu%2Fmenu.qc;h=f195574449379ceec441847d1605267878b38789;hp=96d98b9c502149cfe54d18461cbc08ec9ff0c1e6;hb=e0012447bfce1b551df3dc01b043655aa93dafad;hpb=10c0e93c75ef6f408e3357bd5fb46c721e7e0576 diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 96d98b9c5..f19557444 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) @@ -217,8 +217,7 @@ void m_init_delayed() if (m_goto_buffer) { m_goto(m_goto_buffer); - strunzone(m_goto_buffer); - m_goto_buffer = string_null; + strfree(m_goto_buffer); } if (Menu_Active) m_display(); // delayed menu display @@ -237,7 +236,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 +269,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 +285,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; @@ -335,7 +335,8 @@ void drawBackground(string img, float a, string algn, float force1) if (main.mainNexposee.ModalController_state == 0) return; vector v = '0 0 0'; int scalemode = SCALEMODE_CROP; - for (int i = 0, l = 0; i < strlen(algn); ++i) + int len = strlen(algn); + for (int i = 0, l = 0; i < len; ++i) { string c = substring(algn, i, 1); switch (c) @@ -549,8 +550,7 @@ void m_tooltip(vector pos) { // fade out if tooltip of a certain item has changed menuTooltipState = 3; - if (prev_tooltip) strunzone(prev_tooltip); - prev_tooltip = strzone(it.tooltip); + strcpy(prev_tooltip, it.tooltip); } else if (menuTooltipItem && !m_testmousetooltipbox(pos)) { @@ -583,8 +583,7 @@ void m_tooltip(vector pos) menuTooltipOrigin.x = -1; // unallocated - if (menuTooltipText) strunzone(menuTooltipText); - menuTooltipText = strzone(gettooltip()); + strcpy(menuTooltipText, gettooltip()); int i = 0; float w = 0; @@ -634,11 +633,7 @@ void m_tooltip(vector pos) if (menuTooltipItem == NULL) { - if (menuTooltipText) - { - strunzone(menuTooltipText); - menuTooltipText = string_null; - } + strfree(menuTooltipText); return; } else @@ -848,6 +843,7 @@ void m_draw(float width, float height) postMenuDraw(); frametime = 0; + IL_ENDFRAME(); } void m_display() @@ -951,8 +947,7 @@ void m_goto(string itemname) { if (!menuInitialized) { - if (m_goto_buffer) strunzone(m_goto_buffer); - m_goto_buffer = strzone(itemname); + strcpy(m_goto_buffer, itemname); return; } if (itemname == "") // this can be called by GameCommand @@ -975,6 +970,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);