]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
remove all aspect ratio forcing stuff from the resizing code. next step is to make...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index 95304ee500379d79cd126e19765ad72aecfbda4a..537e971730f5795b696b6cc04e430992639d8316 100644 (file)
@@ -75,9 +75,30 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
        }
 }
 
+// drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box
+void drawpic_aspect(vector pos, string pic, vector sz, vector color, float alpha, float drawflag) {
+       vector imgsize;
+       imgsize = drawgetimagesize(pic);
+       float imgaspect;
+       imgaspect = imgsize_x/imgsize_y;
+
+       vector oldsz;
+       oldsz = sz;
+       float aspect;
+       aspect = sz_x/sz_y;
+
+       if(aspect > imgaspect) {
+               sz_x = sz_y * imgaspect;
+               drawpic(pos + eX * (oldsz_x - sz_x) * 0.5, pic, sz, color, alpha, drawflag);
+       } else {
+               sz_y = sz_x / imgaspect; 
+               drawpic(pos + eY * (oldsz_y - sz_y) * 0.5, pic, sz, color, alpha, drawflag);
+       }
+}
+
 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
 void drawpic_skin(vector pos, string pic, vector sz, vector color, float alpha, float drawflag) {
-       drawpic(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, color, alpha, drawflag);
+       drawpic_aspect(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, color, alpha, drawflag);
 }
 
 void drawpic_skin_expanding(vector pos, string pic, vector sz, vector rgb, float alpha, float flag, float fadelerp) {
@@ -570,7 +591,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                fputs(fh, strcat("seta hud_bg_alpha \"", cvar_string("hud_bg_alpha"), "\"", "\n"));
                fputs(fh, strcat("seta hud_bg_border \"", cvar_string("hud_bg_border"), "\"", "\n"));
                fputs(fh, strcat("seta hud_bg_padding \"", cvar_string("hud_bg_padding"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_fg_alpha) \"", cvar_string("hud_fg_alpha"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_fg_alpha \"", cvar_string("hud_fg_alpha"), "\"", "\n"));
                fputs(fh, "\n");
 
                fputs(fh, strcat("seta hud_dock \"", cvar_string("hud_dock"), "\"", "\n"));
@@ -634,57 +655,6 @@ void HUD_Panel_ExportCfg(string cfgname)
        fclose(fh);
 }
 
-vector HUD_Panel_GetMinSize(float id)
-{
-       vector mySize;
-       // note: please only set mySize_y on aspect ratio forced panels
-       switch(id) {
-               case 0: 
-                       mySize_x = 1/10; // at least 1/10 * height
-                       mySize_y = 1/26; // at least 1/26 * width
-                       break;
-               case 1: 
-                       if(cvar("hud_inventory_onlycurrent"))
-                               mySize_y = 2/5; //  2/5 width
-                       else
-                               mySize_x = 0.7; // at least 0.7 * height
-                       break;
-               case 3: 
-                       if(cvar("hud_healtharmor") == 2)
-                       {
-                               mySize_x = 4.35; // 4.35 * height, trial and error...
-                               mySize_y = 0.01; // "unlimited" ;)
-                       }
-                       break;
-               case 4: 
-                       mySize_x = 1.1; // 4/5 * height, trial and error...
-                       mySize_y = 1/3; // 1/3 * width, trial and error...
-                       break;
-               case 5: 
-                       mySize_y = 1/4.1; // 1/4.1 * width, trial and error...
-                       break;
-               case 7: 
-                       mySize_y = 1/4; // 1/4 * width
-                       break;
-               case 8: 
-                       mySize_y = 1/4; // 1/4 * width
-                       break;
-               case 9: 
-                       mySize_y = 1/4; // 1/4 * width
-                       break;
-               case 10: 
-                       mySize_y = 1/2; // 1/2 * width
-                       break;
-               case 11: 
-                       mySize_y = 0.5898; // 0.5898 * width, reason: bg has weird dimensions...
-                       break;
-               case 13: 
-                       mySize_y = 0.25; // 0.25 * width, trial and error...
-                       break;
-       }
-       return mySize;
-}
-
 // return active status of panel
 float HUD_Panel_CheckActive(float id)
 {
@@ -1016,8 +986,8 @@ void HUD_Panel_SetPos(float id, vector pos)
 
        if(cvar("hud_configure_grid"))
        {
-               pos_x = floor(pos_x/cvar("hud_configure_grid_x") + 0.5) * cvar("hud_configure_grid_x");
-               pos_y = floor(pos_y/cvar("hud_configure_grid_y") + 0.5) * cvar("hud_configure_grid_y");
+               pos_x = floor((pos_x/vid_conwidth)/bound(0.005, cvar("hud_configure_grid_x"), 0.2) + 0.5) * cvar("hud_configure_grid_x") * vid_conwidth;
+               pos_y = floor((pos_y/vid_conheight)/bound(0.005, cvar("hud_configure_grid_y"), 0.2) + 0.5) * cvar("hud_configure_grid_y") * vid_conheight;
        }
 
        string s;
@@ -1027,7 +997,7 @@ void HUD_Panel_SetPos(float id, vector pos)
 }
 
 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
-vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin, float ratio) {
+vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) {
        float i;
 
        float targBorder;
@@ -1069,7 +1039,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin, float
                        // in this case resizeorigin (bottom-right point) and the bottom-right point of the panel
                        dist_x = resizeorigin_x - targEndPos_x;
                        dist_y = resizeorigin_y - targEndPos_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       if (dist_y < 0)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -1087,7 +1057,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin, float
 
                        dist_x = targPos_x - resizeorigin_x;
                        dist_y = resizeorigin_y - targEndPos_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       if (dist_y < 0)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -1105,7 +1075,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin, float
 
                        dist_x = resizeorigin_x - targEndPos_x;
                        dist_y = targPos_y - resizeorigin_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       if (dist_y < 0)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -1123,7 +1093,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin, float
 
                        dist_x = targPos_x - resizeorigin_x;
                        dist_y = targPos_y - resizeorigin_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       if (dist_y < 0)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -1165,30 +1135,6 @@ void HUD_Panel_SetPosSize(float id)
                mySize_y = max(2 * cvar("con_chatsize") + 2 * HUD_Panel_GetPadding(id), mySize_y);
        }
 
-       // cap against panel's own limits
-       vector minSize;
-       minSize = HUD_Panel_GetMinSize(id); // mySize_x at least minSize_x * mySize_y, and vice versa
-       float fixedRatio;
-       if(!minSize_x && minSize_y) // forced aspect ratio
-       {
-               minSize_x = 1/minSize_y;
-               fixedRatio = minSize_x;
-               mySize_x = max(minSize_x * mySize_y, mySize_x);
-               mySize_y = max(minSize_y * mySize_x, mySize_y);
-       }
-       else if(minSize_x && !minSize_y) // hybrid aspect ratio, currently supported only in one dimension
-       {
-               if (mySize_x/mySize_y < minSize_x) // resizing in x direction allows free aspect ratio
-               {
-                       fixedRatio = minSize_x;
-                       minSize_y = 1/minSize_x;
-                       mySize_y = max(minSize_y * mySize_x, mySize_y);
-                       mySize_x = max(minSize_x * mySize_y, mySize_x);
-               }
-               else
-                       fixedRatio = -minSize_x; //negative so that it will be used ONLY after checkResize
-       }
-
        // collision testing|
        // -----------------+
 
@@ -1225,55 +1171,26 @@ void HUD_Panel_SetPosSize(float id)
        // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
        if(cvar("hud_configure_grid"))
        {
-               mySize_x = floor(mySize_x/cvar("hud_configure_grid_x") + 0.5) * cvar("hud_configure_grid_x");
-               mySize_y = floor(mySize_y/cvar("hud_configure_grid_y") + 0.5) * cvar("hud_configure_grid_y");
-       }
-
-       if (fixedRatio > 0)
-       {
-               // keep aspect ratio _MAXIMIZING_ the size
-               if (mySize_x / mySize_y > fixedRatio)
-                       mySize_y = mySize_x / fixedRatio;
-               else
-                       mySize_x = mySize_y * fixedRatio;
+               mySize_x = floor((mySize_x/vid_conwidth)/bound(0.005, cvar("hud_configure_grid_x"), 0.2) + 0.5) * cvar("hud_configure_grid_x") * vid_conwidth;
+               mySize_y = floor((mySize_y/vid_conheight)/bound(0.005, cvar("hud_configure_grid_y"), 0.2) + 0.5) * cvar("hud_configure_grid_y") * vid_conheight;
        }
 
        if(cvar("hud_configure_checkcollisions"))
        {
-               if (fixedRatio > 0)
-               {
-                       mySize = HUD_Panel_CheckResize(id, mySize, resizeorigin, fixedRatio);
-
-                       // Make sure once more that we DON'T cross the screen edges
-                       // left/top screen edges
-                       if(myPos_x < 0)
-                               mySize_x = mySize_x + myPos_x;
-                       if(myPos_y < 0)
-                               mySize_y = mySize_y + myPos_y;
-
-                       // bottom/right screen edges
-                       if(myPos_x + mySize_x > vid_conwidth)
-                               mySize_x = vid_conwidth - myPos_x;
-                       if(myPos_y + mySize_y > vid_conheight)
-                               mySize_y = vid_conheight - myPos_y;
-
-                       // restore again aspect ratio, _minimizing_ the size
-                       if (mySize_x / mySize_y < fixedRatio)
-                               mySize_y = mySize_x / fixedRatio;
-                       else
-                               mySize_x = mySize_y * fixedRatio;
-               }
-               else
-               {
-                       mySize = HUD_Panel_CheckResize(id, mySize, resizeorigin, mySize_x / mySize_y);
-                       if (fixedRatio < 0)
-                       {
-                               fixedRatio = -fixedRatio;
-                               // restore again aspect ratio, _minimizing_ the size
-                               if (mySize_x / mySize_y < fixedRatio)
-                                       mySize_y = mySize_x / fixedRatio;
-                       }
-               }
+               mySize = HUD_Panel_CheckResize(id, mySize, resizeorigin);
+
+               // Make sure once more that we DON'T cross the screen edges
+               // left/top screen edges
+               if(myPos_x < 0)
+                       mySize_x = mySize_x + myPos_x;
+               if(myPos_y < 0)
+                       mySize_y = mySize_y + myPos_y;
+
+               // bottom/right screen edges
+               if(myPos_x + mySize_x > vid_conwidth)
+                       mySize_x = vid_conwidth - myPos_x;
+               if(myPos_y + mySize_y > vid_conheight)
+                       mySize_y = vid_conheight - myPos_y;
        }
 
        // minimum panel size cap, do this once more so we NEVER EVER EVER have a panel smaller than this, JUST IN CASE above code still makes the panel eg negative (impossible to resize back without changing cvars manually then)
@@ -1529,7 +1446,7 @@ void HUD_WeaponIcons(void)
        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
        {
                self = get_weaponinfo(i);
-               if(self.weapons && (self.impulse >= 0) && (stat_weapons & self.weapons) || hud_configure)
+               if(self.impulse >= 0)
                {
                        weaponorder[weapon_cnt] = self;
                        ++weapon_cnt;
@@ -1578,36 +1495,40 @@ void HUD_WeaponIcons(void)
        for(i = 0; i < weapon_cnt; ++i)
        {
                self = weaponorder[i];
-               if((self.weapons && (self.impulse >= 0) && (stat_weapons & self.weapons)) || hud_configure)
-               {
-                       weapid = self.impulse;
+               weapid = self.impulse;
 
-                       alpha = (self.weapon == activeweapon) ? 1 : 0.6;
+               alpha = (self.weapon == activeweapon) ? 1 : 0.6;
 
-                       weapon_hit = weapon_hits[self.weapon-WEP_FIRST];
-                       weapon_damage = weapon_fired[self.weapon-WEP_FIRST];
+               weapon_hit = weapon_hits[self.weapon-WEP_FIRST];
+               weapon_damage = weapon_fired[self.weapon-WEP_FIRST];
 
-                       // draw background behind currently selected weapon
-                       if(self.weapon == activeweapon)
-                               drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_current_bg", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+               // draw background behind currently selected weapon
+               if(self.weapon == activeweapon)
+                       drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_current_bg", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
 
-                       // draw the weapon accuracy on the HUD
-                       if(hud_accuracy_hud && !(gametype == GAME_RACE || gametype == GAME_CTS))
-                       {
-                               if(weapon_damage)
-                                       weapon_stats = floor(100 * weapon_hit / weapon_damage);
+               // draw the weapon accuracy on the HUD
+               if(hud_accuracy_hud && !(gametype == GAME_RACE || gametype == GAME_CTS))
+               {
+                       if(weapon_damage)
+                               weapon_stats = floor(100 * weapon_hit / weapon_damage);
 
-                               accuracy_color = HUD_AccuracyColor(weapon_stats);
-                               if(weapon_damage)
-                                       drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_accuracy", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), accuracy_color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       }
+                       accuracy_color = HUD_AccuracyColor(weapon_stats);
+                       if(weapon_damage)
+                               drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_accuracy", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), accuracy_color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+               }
 
-                       // draw the weapon icon
+               // draw the weapon icon
+               if((self.impulse >= 0) && (stat_weapons & self.weapons))
+               {
                        drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
 
                        if(cvar_or("hud_weaponicons_number", 1))
                                drawstring(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                }
+               else
+               {
+                       drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '0 0 0', HUD_Panel_GetFgAlpha(id) * 0.5, DRAWFLAG_NORMAL);
+               }
 
                ++row;
                if(row >= rows)
@@ -2333,8 +2254,8 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
                        HUD_KillNotify_Push(s1, "", 0, DEATH_CAMP);
                        if (alsoprint)
                                print ("^1",s1, "^1 thought they found a nice camping ground\n");
-               } else if (type == DEATH_MIRRORDAMAGE) {
-                       HUD_KillNotify_Push(s1, "", 0, DEATH_MIRRORDAMAGE);
+               } else if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
+                       HUD_KillNotify_Push(s1, "", 0, type);
                        if (alsoprint)
                                print ("^1",s1, "^1 didn't become friends with the Lord of Teamplay\n");
                } else if (type == DEATH_CHEAT) {
@@ -2360,8 +2281,8 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
                        if (alsoprint)
                                print("^1", s1, "^1 ", Weapon_KillMessage(type), "\n");
                }
-               else if(type == KILL_TEAM || type == KILL_TEAM_SPREE) {
-                       HUD_KillNotify_Push(s1, s2, 1, DEATH_MIRRORDAMAGE);
+               else if(type == KILL_TEAM_RED || type == KILL_TEAM_BLUE || type == KILL_TEAM_SPREE) {
+                       HUD_KillNotify_Push(s1, s2, 1, type);
                        if(alsoprint)
                        {
                                if(cvar("cl_gentle")) {
@@ -2372,15 +2293,15 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
                        }
                        if (stof(s2) > 2 && type == KILL_TEAM_SPREE) {
                                if(cvar("cl_gentle"))
-                                       print ("^1",s1,"^1 ended a ",s2," scoring spree by going against a team mate\n");
+                                       print ("^1",s1,"^1 ended a ",s3," scoring spree by going against a team mate\n");
                                else
-                                       print ("^1",s1,"^1 ended a ",s2," kill spree by killing a team mate\n");
+                                       print ("^1",s1,"^1 ended a ",s3," kill spree by killing a team mate\n");
                        }
                        else if (stof(s2) > 2) {
                                if(cvar("cl_gentle"))
-                                       print ("^1",s1,"'s ^1",s2," scoring spree was ended by a team mate!\n");
+                                       print ("^1",s1,"'s ^1",s3," scoring spree was ended by a team mate!\n");
                                else
-                                       print ("^1",s1,"'s ^1",s2," kill spree was ended by a team mate!\n");
+                                       print ("^1",s1,"'s ^1",s3," kill spree was ended by a team mate!\n");
                        }
                }
                else if(type == KILL_FIRST_BLOOD)
@@ -2653,7 +2574,7 @@ void HUD_Centerprint(string s1, string s2, float type, float msg)
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You need to preserve your health"));
                        else
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You grew too old without taking your medicine"));
-               } else if (type == DEATH_MIRRORDAMAGE) {
+               } else if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
                        if(cvar("cl_gentle"))
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Don't go against team mates!"));
                        else
@@ -2667,9 +2588,9 @@ void HUD_Centerprint(string s1, string s2, float type, float msg)
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You killed your own dumb self!"));
                }
        } else if(msg == MSG_KILL) {
-               if (type == KILL_TEAM) {
+               if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
                        if(cvar("cl_gentle")) {
-                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Moron! You went against a team mate!"));
+                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Moron! You went against", s1, ",a team mate!"));
                        } else {
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Moron! You fragged ", s1, ", a team mate!"));
                        }
@@ -2687,13 +2608,13 @@ void HUD_Centerprint(string s1, string s2, float type, float msg)
                        }
                } else if (type == KILL_TYPEFRAG) { // s2 contains "advanced kill messages" such as ping, handicap...
                        if(cvar("cl_gentle")) {
-                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You scored against ^7", s1, "^7 who was typing!", s2));
+                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You scored against ^7", s1, "^1 who was typing!", s2));
                        } else {
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You typefragged ^7", s1, s2));
                        }
                } else if (type == KILL_TYPEFRAGGED) {
                        if(cvar("cl_gentle")) {
-                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were scored against by ^7", s1, "^7 while you were typing!", s2));
+                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were scored against by ^7", s1, "^1 while you were typing!", s2));
                        } else {
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were typefragged by ^7", s1, s2));
                        }
@@ -2705,14 +2626,14 @@ void HUD_Centerprint(string s1, string s2, float type, float msg)
                        }
                } else if (type == KILL_FRAGGED) {
                        if(cvar("cl_gentle")) {
-                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^4You were scored against by ^7", s1, s2));
+                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were scored against by ^7", s1, s2));
                        } else {
-                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^4You were fragged by ^7", s1, s2));
+                               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were fragged by ^7", s1, s2));
                        }
                }
        } else if(msg == MSG_KILL_ACTION) {
                // TODO: invent more centerprints here?
-               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Watch your step!", s1));
+               centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Watch your step!"));
        }
 }
 
@@ -2811,9 +2732,14 @@ void HUD_Notify (void)
                                drawpic_skin(weap_pos, "notify_camping", '2 1 0' * height, '1 1 1', HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
                                drawcolorcodedstring(pos_attacker, attacker, fontsize, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
                        }
-                       else if(killnotify_deathtype[j] == DEATH_MIRRORDAMAGE)
+                       else if(killnotify_deathtype[j] == KILL_TEAM_RED)
                        {
-                               drawpic_skin(weap_pos, "notify_teamkill", '2 1 0' * height, '1 1 1', HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+                               drawpic_skin(weap_pos, "notify_teamkill", '2 1 0' * height, '1 0 0', HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+                               drawcolorcodedstring(pos_attacker, attacker, fontsize, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+                       }
+                       else if(killnotify_deathtype[j] == KILL_TEAM_BLUE)
+                       {
+                               drawpic_skin(weap_pos, "notify_teamkill", '2 1 0' * height, '0 0 1', HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
                                drawcolorcodedstring(pos_attacker, attacker, fontsize, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
                        }
                        else if(killnotify_deathtype[j] == DEATH_DROWN)
@@ -2907,9 +2833,15 @@ void HUD_Notify (void)
                                drawcolorcodedstring(pos_attacker, attacker, fontsize, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
                                drawcolorcodedstring(pos_victim, victim, fontsize, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
                        }
-                       else if(killnotify_deathtype[j] == DEATH_MIRRORDAMAGE)
+                       else if(killnotify_deathtype[j] == KILL_TEAM_RED)
                        {
-                               drawpic_skin(weap_pos, "notify_teamkill", '2 1 0' * height, '1 1 1', HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+                               drawpic_skin(weap_pos, "notify_teamkill", '2 1 0' * height, '1 0 0', HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+                               drawcolorcodedstring(pos_attacker, attacker, fontsize, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+                               drawcolorcodedstring(pos_victim, victim, fontsize, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
+                       }
+                       else if(killnotify_deathtype[j] == KILL_TEAM_BLUE)
+                       {
+                               drawpic_skin(weap_pos, "notify_teamkill", '2 1 0' * height, '0 0 1', HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
                                drawcolorcodedstring(pos_attacker, attacker, fontsize, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
                                drawcolorcodedstring(pos_victim, victim, fontsize, HUD_Panel_GetFgAlpha(id) * a, DRAWFLAG_NORMAL);
                        }
@@ -4256,7 +4188,7 @@ void HUD_EngineInfo(void)
 
        vector color;
        color = HUD_Get_Num_Color (prevfps, 100);
-       drawstring(pos, strcat("FPS: ", ftos_decimals(prevfps, cvar("hud_engineinfo_framecounter_decimals"))), '1 1 0' * 0.5 * mySize_y, color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+       drawstring(pos, strcat("FPS: ", ftos_decimals(prevfps, cvar("hud_engineinfo_framecounter_decimals"))), '1 1 0' * mySize_y, color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
 }
 /*
 ==================
@@ -4393,20 +4325,23 @@ void HUD_Main (void)
        {
                float i;
                // x-axis
-               for(i = 0; i < vid_conwidth/max(2, cvar("hud_configure_grid_x")); ++i)
+               for(i = 0; i < 1/bound(0.005, bound(0.005, cvar("hud_configure_grid_x"), 0.2), 0.2); ++i)
                {
-                       drawfill(eX * i * max(2, cvar("hud_configure_grid_x")), eX + eY * vid_conheight, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
+                       drawfill(eX * i * vid_conwidth * bound(0.005, bound(0.005, cvar("hud_configure_grid_x"), 0.2), 0.2), eX + eY * vid_conheight, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
                }
                // y-axis
-               for(i = 0; i < vid_conheight/max(2, cvar("hud_configure_grid_y")); ++i)
+               for(i = 0; i < 1/bound(0.005, bound(0.005, cvar("hud_configure_grid_y"), 0.2), 0.2); ++i)
                {
-                       drawfill(eY * i * max(2, cvar("hud_configure_grid_y")), eY + eX * vid_conwidth, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
+                       drawfill(eY * i * vid_conheight * bound(0.005, bound(0.005, cvar("hud_configure_grid_y"), 0.2), 0.2), eY + eX * vid_conwidth, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
                }
        }
 
        if(cvar_string("hud_dock") != "")
                drawpic_skin('0 0 0', cvar_string("hud_dock"), eX * vid_conwidth + eY * vid_conheight, HUD_Panel_Dock_GetColor(), cvar("hud_dock_alpha") * menu_fade_alpha, DRAWFLAG_NORMAL);
 
+       if(HUD_Panel_CheckActive(HUD_PANEL_RADAR) || hud_configure)
+               if(cvar_string("hud_radar") != "0" && (cvar("hud_radar") == 2 || teamplay))
+                       HUD_Radar();
        if(HUD_Panel_CheckActive(HUD_PANEL_WEAPONICONS) || hud_configure)
                HUD_WeaponIcons();
        if(HUD_Panel_CheckActive(HUD_PANEL_INVENTORY) || hud_configure)
@@ -4419,10 +4354,6 @@ void HUD_Main (void)
                HUD_Notify();
        if(HUD_Panel_CheckActive(HUD_PANEL_TIMER) || hud_configure)
                HUD_Timer();
-       // TODO hud'ify
-       if(HUD_Panel_CheckActive(HUD_PANEL_RADAR) || hud_configure)
-               if(cvar_string("hud_radar") != "0" && (cvar("hud_radar") == 2 || teamplay))
-                       HUD_Radar();
        if(HUD_Panel_CheckActive(HUD_PANEL_SCORE) || hud_configure)
                HUD_Score();
        if(HUD_Panel_CheckActive(HUD_PANEL_RACETIMER) || hud_configure)
@@ -4439,7 +4370,7 @@ void HUD_Main (void)
        if(HUD_Panel_CheckActive(HUD_PANEL_CHAT) || hud_configure)
                HUD_Chat();
        else
-               cvar_set("con_csqcpositioning", "0");
+               cvar_set("con_chatrect", "0");
        if(HUD_Panel_CheckActive(HUD_PANEL_ENGINEINFO) || hud_configure)
                HUD_EngineInfo();