Adapt predator entry to customizable HUD. Also stup using sbar_fontsize for the HUD...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 2 Feb 2013 12:07:14 +0000 (14:07 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 2 Feb 2013 12:07:14 +0000 (14:07 +0200)
data/hudVT.cfg
data/qcsrc/client/hud.qc
data/qcsrc/client/main.qh

index a5f6b16..0e0e1b0 100644 (file)
@@ -23,6 +23,13 @@ set hud_item_ammo_load_text_scale 12
 set hud_item_clip_load_text_position "0.03 -0.89 0"\r
 set hud_item_clip_load_text_scale 16\r
 \r
+set hud_item_predator_position "140 450 0"\r
+set hud_item_predator_scale "130 10 0"\r
+set hud_item_predator_colors_location 0\r
+set hud_item_predator_colors_length 0.15\r
+set hud_item_predator_name_location 0.15\r
+set hud_item_predator_name_length 0.85\r
+\r
 set hud_item_preylist_spacing 1.25\r
 set hud_item_preylist_entries 9\r
 set hud_item_preylist_position "110 475 0"\r
index 7ad5b9d..b91c6a2 100644 (file)
@@ -962,10 +962,9 @@ void Sbar_PrintStomachboardItem(entity pl, vector position, vector dimensions)
        // center defined position on the x axis\r
        position_x -= dimensions_x / 2;\r
 \r
-       // limit the font size to the maximum of the HUD\r
+       // set font size to the height of each entry\r
        vector font_sz;\r
-       font_sz_x = bound(0, sbar_fontsize_x, dimensions_y);\r
-       font_sz_y = bound(0, sbar_fontsize_y, dimensions_y);\r
+       font_sz_x = font_sz_y = dimensions_y;\r
 \r
        for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter)\r
        {\r
@@ -1030,21 +1029,51 @@ void Sbar_PrintStomachboardItemPred(entity pl, vector position, vector dimension
 \r
        string str;\r
        float f, field, field_number;\r
-       field_number = 1; // the number of components each row has\r
+       vector hl_color;\r
+       field_number = 2; // the number of components each row has\r
+\r
+       // center defined position on the x axis\r
+       position_x -= dimensions_x / 2;\r
+\r
+       // set font size to the height of each entry\r
+       vector font_sz;\r
+       font_sz_x = font_sz_y = dimensions_y;\r
 \r
        for(fieldcounter2 = 1; fieldcounter2 <= field_number; ++fieldcounter2)\r
        {\r
+               vector pos, sz;\r
                field = -fieldcounter2;\r
                str = Sbar_GetStomachFieldPred(pl, field);\r
 \r
+               // row highlighting\r
+               if(field == ST_HIGHLIGHT)\r
+               {\r
+                       pos = position;\r
+                       sz = dimensions;\r
+\r
+                       if(getstati(STAT_VORE_EATEN))\r
+                       {\r
+                               if(teamplay && (GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1) || GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(spectatee_status - 1))) // same team\r
+                                       hl_color = stov(cvar_string("sbar_stomachboard_color2"));\r
+                               else\r
+                                       hl_color = stov(cvar_string("sbar_stomachboard_color3"));\r
+                       }\r
+                       else\r
+                               hl_color = stov(cvar_string("sbar_stomachboard_color1"));\r
+                       drawfill(pos, sz, hl_color, cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+               }\r
+\r
                if(field == STP_NAME) {\r
+                       pos_x = position_x + dimensions_x * cvar("hud_item_predator_colors_location");\r
+                       sz_x = dimensions_x * cvar("hud_item_predator_colors_length");\r
                        f = stof(getplayerkey(pl.sv_entnum, "colors"));\r
-                       drawpic(position, "gfx/sb_playercolor_base", '22 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-                       drawpic(position, "gfx/sb_playercolor_shirt", '22 11 0', colormapPaletteColor(floor(f / 16), 0), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-                       drawpic(position, "gfx/sb_playercolor_pants", '22 11 0', colormapPaletteColor(mod(f, 16), 1), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       drawpic(pos, "gfx/sb_playercolor_base", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       drawpic(pos, "gfx/sb_playercolor_shirt", sz, colormapPaletteColor(floor(f / 16), 0), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       drawpic(pos, "gfx/sb_playercolor_pants", sz, colormapPaletteColor(mod(f, 16), 1), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
-                       //pos_x += 24;\r
-                       drawcolorcodedstring(position, textShortenToWidth(str, 122, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       pos_x = position_x + dimensions_x * cvar("hud_item_predator_name_location");\r
+                       sz_x = dimensions_x * cvar("hud_item_predator_name_length");\r
+                       drawcolorcodedstring(pos, textShortenToWidth(str, sz_x, font_sz, stringwidth_colors), font_sz, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
        }\r
 }\r
@@ -3318,7 +3347,7 @@ void Sbar_Draw (void)
                        }\r
 \r
                        // draw the predator's name\r
-//                     Sbar_PrintStomachboardItemPred(bottomleft - '-76 150 0', pred);\r
+                       Sbar_PrintStomachboardItemPred(pred, stov(cvar_string("hud_item_predator_position")), stov(cvar_string("hud_item_predator_scale")));\r
                }\r
 \r
                // draw status, scores, timer, ring and portrait\r
index a868ae4..e16c108 100644 (file)
@@ -80,6 +80,7 @@ const float COLOR_SPECTATOR = 1337;
 #define ST_NAME -2\r
 #define ST_HEALTH -3\r
 \r
+#define STP_HIGHLIGHT -2\r
 #define STP_NAME -1\r
 \r
 float sbar_field[MAX_SBAR_FIELDS + 1];\r