]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/radar.qc
Merge branch 'master' into Mario/cursor
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / radar.qc
index 2c71c8e63dc7ab6d37085a4d055fad51722ed390..9176aa0ff99782b05ed207495bacf5134675ff4c 100644 (file)
@@ -1,21 +1,25 @@
 #include "radar.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 #include <common/ent_cs.qh>
 #include <common/mapinfo.qh>
 #include <client/mapvoting.qh>
+#include <client/resources.qh>
 #include <client/teamradar.qh>
 #include <common/mutators/mutator/waypoints/all.qh>
 
 // Radar (#6)
 
-float HUD_Radar_Clickable()
+bool HUD_Radar_Clickable()
 {
        return hud_panel_radar_mouse && !hud_panel_radar_temp_hidden;
 }
 
-void HUD_Radar_Show_Maximized(bool doshow,float clickable)
+void HUD_Radar_Show_Maximized(bool doshow, bool clickable)
 {
-    TC(bool, doshow);
+       TC(bool, doshow);
        hud_panel_radar_maximized = doshow;
        hud_panel_radar_temp_hidden = 0;
 
@@ -23,8 +27,6 @@ void HUD_Radar_Show_Maximized(bool doshow,float clickable)
        {
                if (clickable)
                {
-                       if(autocvar_hud_cursormode)
-                               setcursormode(1);
                        hud_panel_radar_mouse = 1;
 
                        // we must unset the player's buttons, as they aren't released elsewhere
@@ -39,9 +41,6 @@ void HUD_Radar_Show_Maximized(bool doshow,float clickable)
        {
                hud_panel_radar_mouse = 0;
                mouseClicked = 0;
-               if(autocvar_hud_cursormode)
-               if(!mv_active)
-                       setcursormode(0);
        }
 }
 void HUD_Radar_Hide_Maximized()
@@ -52,7 +51,7 @@ void HUD_Radar_Hide_Maximized()
 
 float HUD_Radar_InputEvent(int bInputType, float nPrimary, float nSecondary)
 {
-    TC(int, bInputType);
+       TC(int, bInputType);
        if(!hud_panel_radar_maximized || !hud_panel_radar_mouse ||
                autocvar__hud_configure || mv_active)
                return false;
@@ -137,14 +136,6 @@ void HUD_Radar_Mouse()
                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);
-       }
-
        panel = HUD_PANEL(RADAR);
        HUD_Panel_LoadCvars();
 
@@ -170,9 +161,6 @@ void HUD_Radar_Mouse()
                HUD_Radar_Hide_Maximized();
                return;
        }
-
-
-       draw_cursor_normal(mousepos, '1 1 1', 0.8);
 }
 
 void HUD_Radar()
@@ -216,9 +204,7 @@ void HUD_Radar()
                        panel_bg = "gfx/hud/default/border_default"; // fallback
                if(!radar_panel_modified && panel_bg != panel.current_panel_bg)
                        radar_panel_modified = true;
-               if(panel.current_panel_bg)
-                       strunzone(panel.current_panel_bg);
-               panel.current_panel_bg = strzone(panel_bg);
+               strcpy(panel.current_panel_bg, panel_bg);
 
                switch(hud_panel_radar_maximized_zoommode)
                {
@@ -317,10 +303,10 @@ void HUD_Radar()
        else
        {
                vector c0, c1, c2, c3, span;
-               c0 = rotate(mi_min, teamradar_angle * DEG2RAD);
-               c1 = rotate(mi_max, teamradar_angle * DEG2RAD);
-               c2 = rotate('1 0 0' * mi_min.x + '0 1 0' * mi_max.y, teamradar_angle * DEG2RAD);
-               c3 = rotate('1 0 0' * mi_max.x + '0 1 0' * mi_min.y, teamradar_angle * DEG2RAD);
+               c0 = Rotate(mi_min, teamradar_angle * DEG2RAD);
+               c1 = Rotate(mi_max, teamradar_angle * DEG2RAD);
+               c2 = Rotate('1 0 0' * mi_min.x + '0 1 0' * mi_max.y, teamradar_angle * DEG2RAD);
+               c3 = Rotate('1 0 0' * mi_max.x + '0 1 0' * mi_min.y, teamradar_angle * DEG2RAD);
                span = '0 0 0';
                span.x = max(c0_x, c1_x, c2_x, c3_x) - min(c0_x, c1_x, c2_x, c3_x);
                span.y = max(c0_y, c1_y, c2_y, c3_y) - min(c0_y, c1_y, c2_y, c3_y);
@@ -356,7 +342,7 @@ void HUD_Radar()
 
        IL_EACH(g_radaricons, it.teamradar_icon, {
                if ( hud_panel_radar_mouse )
-               if ( it.health >= 0 )
+               if ( GetResourceAmount(it, RESOURCE_HEALTH) >= 0 )
                if ( it.team == myteam + 1 || gametype == MAPINFO_TYPE_RACE || !teamplay )
                {
                        vector coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(it.origin));