]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/sbar.qc
Restore color smoothing again
[voretournament/voretournament.git] / data / qcsrc / client / sbar.qc
index 2ef328c0d6c67f98368e40b3d5e98e8cd678e6c4..06fdcc215af57ad6d1d7d99c80c848316fe5af96 100644 (file)
@@ -949,16 +949,11 @@ void Sbar_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_num
 float fieldcounter;\r
 void Sbar_PrintStomachboardItem(vector pos, entity pl)\r
 {\r
-       vector tmp, rgb;\r
-       rgb = GetTeamRGB(pl.team);\r
+       // list the players in the stomach\r
+\r
        string str;\r
        float f, field;\r
 \r
-       // Layout:\r
-       tmp_x = sbwidth;\r
-       tmp_y = sbar_fontsize_y * 1.25;\r
-       tmp_z = 0;\r
-\r
        for(fieldcounter = 1; fieldcounter <= 2; ++fieldcounter)\r
        {\r
                field = -fieldcounter;\r
@@ -967,6 +962,14 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl)
 \r
                str = Sbar_GetStomachField(pl, field);\r
 \r
+               if(field == ST_NAME) // do this for one field, or we get multiple highlights in the same spot\r
+               {\r
+                       if(getstati(STAT_STOMACH_EATEN))\r
+                               drawfill(pos - '0 0 0', '193 11 0', '1 0 0' * cvar("sbar_stomachboard_highlight_brightness"), cvar("sbar_stomachboard_highlight_alpha"), DRAWFLAG_NORMAL);\r
+                       else\r
+                               drawfill(pos - '0 0 0', '193 11 0', '0 1 0' * cvar("sbar_stomachboard_highlight_brightness"), cvar("sbar_stomachboard_highlight_alpha"), DRAWFLAG_NORMAL);\r
+               }\r
+\r
                if(field == ST_NAME) {\r
                        f = stof(getplayerkey(pl.sv_entnum, "colors"));\r
                        drawpic(pos, "gfx/sb_playercolor_base", '22 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
@@ -977,14 +980,46 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl)
                        drawcolorcodedstring(pos, str, '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
 \r
-               if(field == ST_HEALTH) {\r
+               if(field == ST_HEALTH)\r
+               if(g_vore_showpreyhealth) {\r
                        pos_x += 138;\r
-                       if(g_vore_showpreyhealth)\r
-                               drawpic(pos, "gfx/hud/sb_health", '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               if(pl.sv_entnum == player_localentnum - 1 || (spectatee_status && pl.sv_entnum == spectatee_status - 1))\r
+                                       drawcolorcodedstring(pos, "self", '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               else\r
+                               {\r
+                                       drawpic(pos, "gfx/hud/sb_health", '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+\r
+                                       pos_x += 9;\r
+                                               drawcolorcodedstring(pos, str, '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               }\r
+               }\r
+       }\r
+}\r
+\r
+float fieldcounter2;\r
+void Sbar_PrintStomachboardItem2(vector pos, entity pl)\r
+{\r
+       // show the name of our eater\r
+\r
+       string str;\r
+       float f, field;\r
+\r
+       for(fieldcounter2 = 1; fieldcounter2 <= 2; ++fieldcounter2)\r
+       {\r
+               field = -fieldcounter2;\r
+               if(field == SP_SEPARATOR)\r
+                       break;\r
+\r
+               str = Sbar_GetStomachField(pl, field);\r
+\r
+               if(field == ST_NAME) {\r
+                       f = stof(getplayerkey(pl.sv_entnum, "colors"));\r
+                       drawpic(pos, "gfx/sb_playercolor_base", '22 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       drawpic(pos, "gfx/sb_playercolor_shirt", '22 11 0', colormapPaletteColor(floor(f / 16), 0), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       drawpic(pos, "gfx/sb_playercolor_pants", '22 11 0', colormapPaletteColor(mod(f, 16), 1), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
-                       pos_x += 9;\r
-                       if(g_vore_showpreyhealth)\r
-                               drawcolorcodedstring(pos, str, '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       pos_x += 24;\r
+                       drawcolorcodedstring(pos, str, '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
        }\r
 }\r
@@ -2590,6 +2625,30 @@ float vote_prev; // previous state of vote_active to check for a change
 float vote_alpha;\r
 float vote_change; // "time" when vote_active changed\r
 \r
+vector colortrans_current;\r
+vector Stomachstatus_Colortrans(vector target_color)\r
+{\r
+       local float step;\r
+       step = 0.0125;\r
+\r
+       if(colortrans_current_x > target_color_x + step)\r
+               colortrans_current_x -= step;\r
+       else if(colortrans_current_x < target_color_x - step)\r
+               colortrans_current_x += step;\r
+\r
+       if(colortrans_current_y > target_color_y + step)\r
+               colortrans_current_y -= step;\r
+       else if(colortrans_current_y < target_color_y - step)\r
+               colortrans_current_y += step;\r
+\r
+       if(colortrans_current_z > target_color_z + step)\r
+               colortrans_current_z -= step;\r
+       else if(colortrans_current_z < target_color_z - step)\r
+               colortrans_current_z += step;\r
+\r
+       return colortrans_current;\r
+}\r
+\r
 void Sbar_Draw (void)\r
 {\r
        // vectors for top right, bottom right, bottom and bottom left corners\r
@@ -2855,6 +2914,8 @@ void Sbar_Draw (void)
                Sbar_Timer();\r
 \r
                Sbar_Reset();\r
+\r
+               Stomachstatus_Colortrans('0 0 0');\r
        }\r
        else\r
        {\r
@@ -2883,6 +2944,17 @@ void Sbar_Draw (void)
 \r
                                drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach", '256 256 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
                        }\r
+\r
+                       if(getstati(STAT_STOMACH_EATEN))\r
+                       {\r
+                               drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', Stomachstatus_Colortrans('1 0 0' * cvar("sbar_stomachboard_status_brightness")), cvar("sbar_stomachboard_status_alpha"), DRAWFLAG_NORMAL);\r
+                               drawstring(bottomleft - '-80 172 0', "predator:", '10 10 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       }\r
+                       else\r
+                       {\r
+                               drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', Stomachstatus_Colortrans('0 1 0' * cvar("sbar_stomachboard_status_brightness")), cvar("sbar_stomachboard_status_alpha"), DRAWFLAG_NORMAL);\r
+                               drawstring(bottomleft - '-80 172 0', "self:", '10 10 0', ' 1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       }\r
                }\r
                float stomach_load;\r
                stomach_load = getstati(STAT_STOMACH_LOAD); // shows the predator's stomach load when we are eaten, and ours otherwise\r
@@ -2929,7 +3001,7 @@ void Sbar_Draw (void)
 \r
                        if(getstati(STAT_STOMACH_EATEN))\r
                        if(pl.sv_entnum == getstati(STAT_STOMACH_EATEN) - 1)\r
-                               Sbar_PrintStomachboardItem(pos - '-76 156 0', pl);\r
+                               Sbar_PrintStomachboardItem2(bottomleft - '-76 156 0', pl);\r
                }\r
 \r
                if (cvar("viewsize") <= 100 && vid_conwidth <= 1600) {\r