]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/miscfunctions.qc
Entity debugger
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / miscfunctions.qc
index 449d89cd0e94b5dcde1d0bcf35bf6d78c83ed7f8..036c9570f1df2a3b4da7ed475c1db368e89c947c 100644 (file)
@@ -1,9 +1,14 @@
 #include "miscfunctions.qh"
 
-#include "../common/urllib.qh"
+#include "hud.qh"
 
 #include "../common/command/generic.qh"
 
+#include "../common/teams.qh"
+
+#include "../lib/csqcmodel/cl_model.qh"
+
+
 void AuditLists()
 {
        entity e;
@@ -100,7 +105,7 @@ void RemoveTeam(entity Team)
 
        if(!tm)
        {
-               print(_("Trying to remove a team which is not in the teamlist!"));
+               LOG_INFO(_("Trying to remove a team which is not in the teamlist!"));
                return;
        }
        parent.sort_next = Team.sort_next;
@@ -118,7 +123,8 @@ entity GetTeam(int Team, bool add)
                return teamslots[num];
        if (!add)
                return world;
-       entity tm = spawn();
+       entity tm = new(team);
+       make_pure(tm);
        tm.team = Team;
        teamslots[num] = tm;
        RegisterTeam(tm);
@@ -129,11 +135,11 @@ vector HUD_GetFontsize(string cvarname)
 {
        vector v;
        v = stov(cvar_string(cvarname));
-       if(v_x == 0)
+       if(v.x == 0)
                v = '8 8 0';
-       if(v_y == 0)
-               v_y = v.x;
-       v_z = 0;
+       if(v.y == 0)
+               v.y = v.x;
+       v.z = 0;
        return v;
 }
 
@@ -154,19 +160,11 @@ vector rotate(vector v, float a)
 {
        vector w = '0 0 0';
        // FTEQCC SUCKS AGAIN
-       w_x =      v.x * cos(a) + v.y * sin(a);
-       w_y = -1 * v.x * sin(a) + v.y * cos(a);
+       w.x =      v.x * cos(a) + v.y * sin(a);
+       w.y = -1 * v.x * sin(a) + v.y * cos(a);
        return w;
 }
 
-string ColorTranslateRGB(string s)
-{
-       if(ColorTranslateMode & 1)
-               return strdecolorize(s);
-       else
-               return s;
-}
-
 // decolorizes and team colors the player name when needed
 string playername(string thename, float teamid)
 {
@@ -222,15 +220,15 @@ void drawborderlines(float thickness, vector pos, vector dim, vector color, floa
 
        // left and right lines
        pos.x -= thickness;
-       line_dim_x = thickness;
-       line_dim_y = dim.y;
+       line_dim.x = thickness;
+       line_dim.y = dim.y;
        drawfill(pos, line_dim, color, theAlpha, drawflag);
        drawfill(pos + (dim.x + thickness) * '1 0 0', line_dim, color, theAlpha, drawflag);
 
        // upper and lower lines
        pos.y -= thickness;
-       line_dim_x = dim.x + thickness * 2; // make upper and lower lines longer
-       line_dim_y = thickness;
+       line_dim.x = dim.x + thickness * 2; // make upper and lower lines longer
+       line_dim.y = thickness;
        drawfill(pos, line_dim, color, theAlpha, drawflag);
        drawfill(pos + (dim.y + thickness) * '0 1 0', line_dim, color, theAlpha, drawflag);
 }
@@ -240,16 +238,16 @@ void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color,
        vector current_pos = '0 0 0', end_pos, new_size = '0 0 0', ratio = '0 0 0';
        end_pos = pos + area;
 
-       current_pos_y = pos.y;
+       current_pos.y = pos.y;
        while (current_pos.y < end_pos.y)
        {
-               current_pos_x = pos.x;
+               current_pos.x = pos.x;
                while (current_pos.x < end_pos.x)
                {
-                       new_size_x = min(sz.x, end_pos.x - current_pos.x);
-                       new_size_y = min(sz.y, end_pos.y - current_pos.y);
-                       ratio_x = new_size.x / sz.x;
-                       ratio_y = new_size.y / sz.y;
+                       new_size.x = min(sz.x, end_pos.x - current_pos.x);
+                       new_size.y = min(sz.y, end_pos.y - current_pos.y);
+                       ratio.x = new_size.x / sz.x;
+                       ratio.y = new_size.y / sz.y;
                        drawsubpic(current_pos, new_size, pic, '0 0 0', ratio, color, theAlpha, drawflag);
                        current_pos.x += sz.x;
                }
@@ -349,11 +347,11 @@ void PolyDrawModel(entity e)
                        break;
 }
 
-void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vector rgb, float a, float drawflag)
+void DrawCircleClippedPic(vector centre, float radi, string pic, float f, vector rgb, float a, float drawflag)
 {
        float x, y, q, d;
        vector ringsize, v, t;
-       ringsize = radius * '1 1 0';
+       ringsize = radi * '1 1 0';
 
        x = cos(f * 2 * M_PI);
        y = sin(f * 2 * M_PI);
@@ -567,7 +565,7 @@ void URI_Get_Callback(int id, float status, string data)
        }
        else
        {
-               printf("Received HTTP request data for an invalid id %d.\n", id);
+               LOG_INFOF("Received HTTP request data for an invalid id %d.\n", id);
        }
 }
 
@@ -592,7 +590,7 @@ void Accuracy_LoadLevels()
                if(acc_levels > MAX_ACCURACY_LEVELS)
                        acc_levels = MAX_ACCURACY_LEVELS;
                if(acc_levels < 2)
-                       print("Warning: accuracy_color_levels must contain at least 2 values\n");
+                       LOG_INFO("Warning: accuracy_color_levels must contain at least 2 values\n");
 
                int i;
                for(i = 0; i < acc_levels; ++i)