]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove HUD_Minigame_Showpanels() and minigame_isactive(): it reduces function calls...
authorterencehill <piuntn@gmail.com>
Tue, 6 Sep 2016 17:09:00 +0000 (19:09 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 6 Sep 2016 17:09:00 +0000 (19:09 +0200)
qcsrc/client/hud/hud.qc
qcsrc/client/view.qc
qcsrc/common/minigames/cl_minigames.qh
qcsrc/common/minigames/cl_minigames_hud.qc

index 8ac6a4d991727ede9dbd1528eb5cb7c03667f2a5..c89fe08bc4f5f269298cf6c9d692ab2b8f8f2caa 100644 (file)
@@ -4,6 +4,7 @@
 #include "hud_config.qh"
 #include "../mapvoting.qh"
 #include "../teamradar.qh"
+#include <common/minigames/cl_minigames.qh>
 #include <common/t_items.qh>
 #include <common/deathtypes/all.qh>
 #include <common/items/_mod.qh>
@@ -409,8 +410,6 @@ void HUD_Vehicle()
        }
 }
 
-bool HUD_Minigame_Showpanels();
-
 void HUD_Panel_Draw(entity panent)
 {
        panel = panent;
@@ -425,7 +424,7 @@ void HUD_Panel_Draw(entity panent)
        }
 
        bool draw_allowed = false;
-       if (HUD_Minigame_Showpanels())
+       if (active_minigame && HUD_MinigameMenu_IsOpened())
        {
                if (panel.panel_showflags & PANEL_SHOW_MINIGAME)
                        draw_allowed = true;
index c375ccaa47c9aee3def6804eb33012935f1b9158..c272e3217952cfb258cfa292a034351e80e82981 100644 (file)
@@ -2249,7 +2249,7 @@ void CSQC_UpdateView(entity this, float w, float h)
 
        if(autocvar__hud_configure)
                HUD_Panel_Mouse();
-       else if ( HUD_MinigameMenu_IsOpened() || minigame_isactive() )
+       else if (HUD_MinigameMenu_IsOpened() || active_minigame)
                HUD_Minigame_Mouse();
        else if(QuickMenu_IsOpened())
                QuickMenu_Mouse();
index 602c7973585c1510e3903b4d6fe1d5d6d696ebaa..a0f6195d1232f6ec6ca994d4514de840b099c58a 100644 (file)
@@ -84,12 +84,6 @@ entity active_minigame;
 // minigame_player representing this client
 entity minigame_self;
 
-// Whethere there's an active minigame
-float minigame_isactive()
-{
-       return active_minigame != NULL;
-}
-
 // Execute a minigame command
 #define minigame_cmd(...) minigame_cmd_workaround(0,__VA_ARGS__)
 void minigame_cmd_workaround(float dummy, string...cmdargc);
@@ -100,7 +94,7 @@ void minigame_prompt();
 
 float HUD_MinigameMenu_IsOpened();
 void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger);
-float HUD_Minigame_Showpanels();
+
 // Adds a game-specific entry to the menu
 void HUD_MinigameMenu_CustomEntry(entity parent, string message, string event_arg);
 
index a359831dfdd3cb74535c790c34f71b5ba9723721..1a6d4ff52272e39e4204c9e892545e6688536f63 100644 (file)
@@ -575,7 +575,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary
        {
                mousepos_x = nPrimary;
                mousepos_y = nSecondary;
-               if ( minigame_isactive() && HUD_mouse_over(HUD_PANEL(MINIGAME_BOARD)) )
+               if ( active_minigame && HUD_mouse_over(HUD_PANEL(MINIGAME_BOARD)) )
                        active_minigame.minigame_event(active_minigame,"mouse_moved",mousepos);
                return true;
 
@@ -607,7 +607,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary
                                return false;
                }
 
-               if ( minigame_isactive() && ( bInputType == 0 || bInputType == 1 ) )
+               if ( active_minigame && ( bInputType == 0 || bInputType == 1 ) )
                {
                        string device = "";
                        string action = bInputType == 0 ? "pressed" : "released";
@@ -690,8 +690,3 @@ void HUD_Minigame_Mouse()
 
        draw_cursor_normal(mousepos, '1 1 1', panel_fg_alpha);
 }
-
-bool HUD_Minigame_Showpanels()
-{
-       return (HUD_MinigameMenu_IsOpened() && minigame_isactive());
-}