]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/minigames/cl_minigames_hud.qc
Merge branch 'master' into terencehill/translated_keys
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / minigames / cl_minigames_hud.qc
index c26109bfd39e488179eddba303a3d5f5b974aac2..f299af3c3a086c2cae4735b989c2c7396044a77a 100644 (file)
@@ -1,5 +1,6 @@
 #include "cl_minigames_hud.qh"
 
+#include <client/autocvars.qh>
 #include <common/ent_cs.qh>
 
 #include "minigames.qh"
@@ -35,7 +36,7 @@ void HUD_MinigameBoard ()
        if ( !hud_minigame )
                return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
 
        vector pos, mySize;
@@ -61,7 +62,7 @@ void HUD_MinigameStatus ()
        if ( !hud_minigame )
                return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
 
        vector pos, mySize;
@@ -143,7 +144,7 @@ void HUD_MinigameMenu_EraseEntry ( entity e )
        if ( HUD_MinigameMenu_activeitem == e )
                HUD_MinigameMenu_activeitem = NULL;
 
-       remove(e);
+       delete(e);
 }
 
 // Minigame menu options: create entry
@@ -193,7 +194,7 @@ bool HUD_MinigameMenu_Click_ExpandCollapse(entity this)
                        if ( e.flags & 2 )
                                HUD_MinigameMenu_Click(e);
                        this.list_next = e.list_next;
-                       remove(e);
+                       delete(e);
                }
                if ( this.list_next )
                        this.list_next.list_prev = this;
@@ -351,14 +352,11 @@ void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger)
                for ( e = HUD_MinigameMenu_entries; e != NULL; e = p )
                {
                        p = e.list_next;
-                       remove(e);
+                       delete(e);
                }
                HUD_MinigameMenu_entries = NULL;
                HUD_MinigameMenu_last_entry = NULL;
                HUD_MinigameMenu_activeitem = NULL;
-               if(autocvar_hud_cursormode)
-               if ( !autocvar__hud_configure )
-                       setcursormode(0);
        }
 }
 
@@ -419,17 +417,15 @@ void HUD_MinigameMenu_Open()
                        HUD_MinigameMenu_last_entry );
                HUD_MinigameMenu_CurrentButton();
                HUD_MinigameMenu_activeitem = NULL;
-               if(autocvar_hud_cursormode)
-                       setcursormode(1);
        }
 }
 
 // Handles mouse input on to minigame menu panel
 void HUD_MinigameMenu_MouseInput()
 {
-       panel = HUD_PANEL(MINIGAME_MENU);
+       panel = HUD_PANEL(MINIGAMEMENU);
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        if(panel_bg_padding)
        {
@@ -475,10 +471,10 @@ void HUD_MinigameMenu ()
        if ( !HUD_MinigameMenu_IsOpened() )
                return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
 
        if(panel_bg_padding)
        {
@@ -545,7 +541,7 @@ void HUD_MinigameHelp()
        if ( !help_message )
                return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
 
        vector pos, mySize;
@@ -575,7 +571,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(MINIGAMEBOARD)) )
                        active_minigame.minigame_event(active_minigame,"mouse_moved",mousepos);
                return true;
 
@@ -607,13 +603,13 @@ 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";
                        if ( nPrimary >= K_MOUSE1 && nPrimary <= K_MOUSE16 )
                        {
-                               if ( HUD_mouse_over(HUD_PANEL(MINIGAME_BOARD)) )
+                               if ( HUD_mouse_over(HUD_PANEL(MINIGAMEBOARD)) )
                                        device = "mouse";
                        }
                        else
@@ -629,7 +625,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary
                if ( bInputType == 0 )
                {
                        if ( nPrimary == K_MOUSE1 && HUD_MinigameMenu_activeitem &&
-                               HUD_mouse_over(HUD_PANEL(MINIGAME_MENU)) )
+                               HUD_mouse_over(HUD_PANEL(MINIGAMEMENU)) )
                        {
                                HUD_MinigameMenu_Click(HUD_MinigameMenu_activeitem);
                                return true;
@@ -682,21 +678,6 @@ void HUD_Minigame_Mouse()
        if( !HUD_MinigameMenu_IsOpened() || autocvar__hud_configure || mv_active )
                return;
 
-       if(!autocvar_hud_cursormode)
-       {
-               mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
-
-               mousepos_x = bound(0, mousepos_x, vid_conwidth);
-               mousepos_y = bound(0, mousepos_y, vid_conheight);
-       }
-
-       if ( HUD_MinigameMenu_IsOpened() && HUD_mouse_over(HUD_PANEL(MINIGAME_MENU)) )
+       if ( HUD_MinigameMenu_IsOpened() && HUD_mouse_over(HUD_PANEL(MINIGAMEMENU)) )
                HUD_MinigameMenu_MouseInput();
-
-       draw_cursor_normal(mousepos, '1 1 1', panel_fg_alpha);
-}
-
-bool HUD_Minigame_Showpanels()
-{
-       return (HUD_MinigameMenu_IsOpened() && minigame_isactive());
 }