Final fixes and improvements. This branch can now be merged
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 5 Sep 2010 11:10:30 +0000 (14:10 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 5 Sep 2010 11:10:30 +0000 (14:10 +0300)
data/qcsrc/client/main.qh
data/qcsrc/client/sbar.qc

index 8eefe03ca8845e75fb65f1dcf2206996786e85a3..e01962667423c10d65bd6373ea328af16d16435b 100644 (file)
@@ -76,8 +76,9 @@ const float COLOR_SPECTATOR = 1337;
 \r
 #define SP_SEPARATOR -100\r
 \r
-#define ST_NAME -1\r
-#define ST_HEALTH -2\r
+#define ST_HIGHLIGHT -1\r
+#define ST_NAME -2\r
+#define ST_HEALTH -3\r
 \r
 float sbar_field[MAX_SBAR_FIELDS + 1];\r
 float sbar_size[MAX_SBAR_FIELDS + 1];\r
index 5b61c3af09e52451a70fee11f7f430bf4ded459f..0022a7c11e137cc0a1c0a7b0454d09f141038f5b 100644 (file)
@@ -728,6 +728,9 @@ string Sbar_GetStomachField(entity pl, float field)
        sbar_field_icon2_alpha = 1;\r
        switch(field)\r
        {\r
+               case ST_HIGHLIGHT:\r
+                       return ""; // the returned value is not used, we only need the field\r
+\r
                case ST_NAME:\r
                        return GetPlayerName(pl.sv_entnum);\r
 \r
@@ -949,12 +952,13 @@ 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
-       // list the players in the stomach\r
+       // lists all players in the stomach\r
 \r
        string str;\r
-       float f, field;\r
+       float f, field, field_number;\r
+       field_number = 3; // the number of components each row has\r
 \r
-       for(fieldcounter = 1; fieldcounter <= 2; ++fieldcounter)\r
+       for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter)\r
        {\r
                field = -fieldcounter;\r
                if(field == SP_SEPARATOR)\r
@@ -962,7 +966,8 @@ 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
+               // row highlighting\r
+               if(field == ST_HIGHLIGHT)\r
                {\r
                        if(getstati(STAT_STOMACH_EATEN))\r
                                drawfill(pos - '0 0 0', '193 11 0', stov(cvar_string("sbar_stomachboard_color2")), cvar("sbar_stomachboard_highlight_alpha"), DRAWFLAG_NORMAL);\r
@@ -997,14 +1002,15 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl)
 }\r
 \r
 float fieldcounter2;\r
-void Sbar_PrintStomachboardItem2(vector pos, entity pl)\r
+void Sbar_PrintStomachboardItemPred(vector pos, entity pl)\r
 {\r
-       // show the name of our eater\r
+       // shows the name of our eater\r
 \r
        string str;\r
-       float f, field;\r
+       float f, field, field_number;\r
+       field_number = 1; // the number of components each row has\r
 \r
-       for(fieldcounter2 = 1; fieldcounter2 <= 2; ++fieldcounter2)\r
+       for(fieldcounter2 = 1; fieldcounter2 <= field_number; ++fieldcounter2)\r
        {\r
                field = -fieldcounter2;\r
                if(field == SP_SEPARATOR)\r
@@ -2625,28 +2631,28 @@ 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
+vector stomachstatus_colorfade_current;\r
+vector StomachStatus_ColorFade(vector target_color)\r
 {\r
        local float step;\r
        step = cvar("sbar_stomachboard_status_fade");\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
+       if(stomachstatus_colorfade_current_x >= target_color_x + step)\r
+               stomachstatus_colorfade_current_x -= step;\r
+       else if(stomachstatus_colorfade_current_x <= target_color_x - step)\r
+               stomachstatus_colorfade_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
+       if(stomachstatus_colorfade_current_y >= target_color_y + step)\r
+               stomachstatus_colorfade_current_y -= step;\r
+       else if(stomachstatus_colorfade_current_y <= target_color_y - step)\r
+               stomachstatus_colorfade_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
+       if(stomachstatus_colorfade_current_z >= target_color_z + step)\r
+               stomachstatus_colorfade_current_z -= step;\r
+       else if(stomachstatus_colorfade_current_z <= target_color_z - step)\r
+               stomachstatus_colorfade_current_z += step;\r
 \r
-       return colortrans_current;\r
+       return stomachstatus_colorfade_current;\r
 }\r
 \r
 void Sbar_Draw (void)\r
@@ -2915,7 +2921,7 @@ void Sbar_Draw (void)
 \r
                Sbar_Reset();\r
 \r
-               Stomachstatus_Colortrans('0 0 0');\r
+               StomachStatus_ColorFade('0 0 0');\r
        }\r
        else\r
        {\r
@@ -2933,7 +2939,8 @@ void Sbar_Draw (void)
                fade = 3.2 - 2 * (time - weapontime);\r
                fade = bound(0.7, fade, 1);\r
 \r
-               if (cvar("viewsize") <= 100 && vid_conwidth <= 1600) {\r
+               // draw the stomach board\r
+               if (cvar("viewsize") <= 100) {\r
                        if (teamplay)\r
                                drawpic(bottomleft- '0 256 0', "gfx/hud/bg_stomach", '256 256 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
                        else {\r
@@ -2944,24 +2951,26 @@ 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
 \r
-                       if(getstati(STAT_STOMACH_EATEN))\r
-                       {\r
-                               drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', Stomachstatus_Colortrans(stov(cvar_string("sbar_stomachboard_color2"))), 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(stov(cvar_string("sbar_stomachboard_color1"))), 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
+               if(getstati(STAT_STOMACH_EATEN))\r
+               {\r
+                       drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', StomachStatus_ColorFade(stov(cvar_string("sbar_stomachboard_color2"))), 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_ColorFade(stov(cvar_string("sbar_stomachboard_color1"))), 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
 \r
                Sbar_DrawXNum(bottomleft - '-18 170 0', bound(0, stomach_load, 9), 1, 0, 22, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                drawstring(bottomleft - '-40 170 0', "/", '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                Sbar_DrawXNum(bottomleft - '-50 170 0', bound(0, g_balance_vore_swallow_limit, 9), 1, 0, 22, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+\r
                if(getstati(STAT_STOMACH_DIGESTING))\r
                        drawstring(bottomleft - '-76 142 0', "stomach digesting", '12 12 0', '1 0.5 0.5', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                else if(stomach_load == g_balance_vore_swallow_limit)\r
@@ -2971,7 +2980,7 @@ void Sbar_Draw (void)
                else\r
                        drawstring(bottomleft - '-76 142 0', "stomach has prey", '12 12 0', '0.75 1 0.75', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
-               // draw the stomach board\r
+               // draw the stomach board player list\r
                entity pl;\r
                float f;\r
 \r
@@ -2982,9 +2991,7 @@ void Sbar_Draw (void)
                                continue;\r
 \r
                        if(getstati(STAT_STOMACH_EATEN))\r
-                       {\r
                                f = pl.pleater == getstati(STAT_STOMACH_EATEN);\r
-                       }\r
                        else\r
                        {\r
                                if(spectatee_status)\r
@@ -3001,10 +3008,10 @@ void Sbar_Draw (void)
 \r
                        if(getstati(STAT_STOMACH_EATEN))\r
                        if(pl.sv_entnum == getstati(STAT_STOMACH_EATEN) - 1)\r
-                               Sbar_PrintStomachboardItem2(bottomleft - '-76 156 0', pl);\r
+                               Sbar_PrintStomachboardItemPred(bottomleft - '-76 156 0', pl);\r
                }\r
 \r
-               if (cvar("viewsize") <= 100 && vid_conwidth <= 1600) {\r
+               if (cvar("viewsize") <= 100) {\r
                        if (teamplay)\r
                                drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
                        else {\r