]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Get prey list to work properly with the customizable HUD
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 2 Feb 2013 10:52:26 +0000 (12:52 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 2 Feb 2013 10:52:26 +0000 (12:52 +0200)
data/hudVT.cfg
data/qcsrc/client/hud.qc
data/qcsrc/server/vore.qc

index 7072a139c2972c91007d7bf09f801cd774e7dc32..a5f6b16626131a021a0a020d9dae181681c03b45 100644 (file)
@@ -23,6 +23,16 @@ 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_preylist_position "0 0 0"\r
-set hud_item_preylist_scale "0.25 0.25 0"\r
-set hud_item_preylist_items 9
\ No newline at end of file
+set hud_item_preylist_spacing 1.25\r
+set hud_item_preylist_entries 9\r
+set hud_item_preylist_position "110 475 0"\r
+set hud_item_preylist_scale "190 10 0"\r
+set hud_item_preylist_colors_location 0\r
+set hud_item_preylist_colors_length 0.1\r
+set hud_item_preylist_name_location 0.1\r
+set hud_item_preylist_name_length 0.75\r
+set hud_item_preylist_health_icon_location 0.85\r
+set hud_item_preylist_health_icon_length 0.05\r
+set hud_item_preylist_health_text_location 0.9\r
+set hud_item_preylist_health_text_length 0.1\r
+set hud_item_preylist_items 9\r
index 16251aad7c5b253c6e7a98db74d23ddf0513e0cf..7ad5b9d86a5a3ae0297d8f071698271b6ed0aac9 100644 (file)
@@ -959,6 +959,14 @@ void Sbar_PrintStomachboardItem(entity pl, vector position, vector dimensions)
        vector hl_color;\r
        field_number = 3; // the number of components each row has\r
 \r
+       // 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
+       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
+\r
        for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter)\r
        {\r
                vector pos, sz;\r
@@ -984,32 +992,32 @@ void Sbar_PrintStomachboardItem(entity pl, vector position, vector dimensions)
                }\r
 \r
                if(field == ST_NAME) {\r
-                       pos_x = position_x / 9;\r
-                       sz_x = dimensions_x / 9;\r
+                       pos_x = position_x + dimensions_x * cvar("hud_item_preylist_colors_location");\r
+                       sz_x = dimensions_x * cvar("hud_item_preylist_colors_length");\r
 \r
                        f = stof(getplayerkey(pl.sv_entnum, "colors"));\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 = position_x / 4;\r
-                       sz_x = dimensions_x / 4;\r
-                       drawcolorcodedstring(pos, textShortenToWidth(str, sz_x, '1 1 0' * sz_y, stringwidth_colors), '1 1 0' * sz_y, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       pos_x = position_x + dimensions_x * cvar("hud_item_preylist_name_location");\r
+                       sz_x = dimensions_x * cvar("hud_item_preylist_name_length");\r
+                       drawcolorcodedstring(pos, textShortenToWidth(str, sz_x, font_sz, stringwidth_colors), font_sz, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
 \r
                if(field == ST_HEALTH) {\r
-                       pos_x = position_x / 1.05;\r
-                       sz_x = sz_y = dimensions_y;\r
+                       pos_x = position_x + dimensions_x * cvar("hud_item_preylist_health_icon_location");\r
+                       sz_x = dimensions_x * cvar("hud_item_preylist_health_icon_length");\r
 \r
                        if(pl.sv_entnum == player_localentnum - 1 || (spectatee_status && pl.sv_entnum == spectatee_status - 1))\r
-                               drawcolorcodedstring(pos, "self", sz, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               drawcolorcodedstring(pos, textShortenToWidth("self", sz_x, font_sz, stringwidth_colors), font_sz, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                        else\r
                        {\r
                                drawpic(pos, "gfx/hud/sb_health", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
-                               pos_x = position_x / 1.05;\r
-                               sz_x = sz_y = dimensions_y;\r
-                               drawcolorcodedstring(pos, str, sz, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               pos_x = position_x + dimensions_x * cvar("hud_item_preylist_health_text_location");\r
+                               sz_x = dimensions_x * cvar("hud_item_preylist_health_text_length");\r
+                               drawcolorcodedstring(pos, textShortenToWidth(str, sz_x, font_sz, stringwidth_colors), font_sz, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                        }\r
                }\r
        }\r
@@ -1565,7 +1573,6 @@ void Sbar_DrawScoreboard()
 \r
        // print information about respawn status\r
        float respawn_time = getstatf(STAT_RESPAWN_TIME);\r
-       dprint(strcat(ftos(respawn_time), " --------\n"));\r
        if(respawn_time)\r
        {\r
                if(respawn_time < 0)\r
@@ -3269,8 +3276,9 @@ void Sbar_Draw (void)
                        entity pl, pred;\r
                        float f, l;\r
 \r
-                       pos = bottomleft;\r
                        hud_total_prey = 0;\r
+                       pos = stov(cvar_string("hud_item_preylist_position"));\r
+                       vector sz = stov(cvar_string("hud_item_preylist_scale"));\r
                        for(pl = players.sort_next; pl; pl = pl.sort_next)\r
                        {\r
                                if(pl.team == COLOR_SPECTATOR)\r
@@ -3288,10 +3296,12 @@ void Sbar_Draw (void)
 \r
                                if(f)\r
                                {\r
-                                       if(l <= 8) // limit the stomach board to 9 entries due to the HUD design\r
+                                       if(l < cvar("hud_item_preylist_entries")) // limit the stomach board to the given number of entries\r
                                        {\r
-                                               Sbar_PrintStomachboardItem(pl, stov(cvar_string("hud_item_preylist_position")), stov(cvar_string("hud_item_preylist_scale")));\r
-                                               pos_y += 1.1 * sbar_fontsize_y;\r
+                                               Sbar_PrintStomachboardItem(pl, pos, sz);\r
+\r
+                                               // advance y position for each entry\r
+                                               pos_y += sz_y * cvar("hud_item_preylist_spacing");\r
                                                l += 1;\r
                                        }\r
                                        ++hud_total_prey;\r
index 54faf616cc670a5a7ca604a38bfbb8364e1fbc56..719a2b18a8e0c8fe9f5fe23e82ac52b0049189ca 100644 (file)
@@ -360,8 +360,8 @@ void Vore_SwallowStep(entity e)
                fill = cvar("g_balance_vore_swallow_speed_fill_player") * frametime;\r
                if(cvar("g_healthsize") && cvar("g_balance_vore_swallow_speed_fill_scalediff_player")) // fill rate depends on predator size compared to prey size\r
                        fill *= pow(self.scale / e.scale, cvar("g_balance_vore_swallow_speed_fill_scalediff_player"));\r
-               if(cvar("g_balance_vore_swallow_speed_fill_player_stomachload") && e.stomach_load) // fill rate is influenced by the prey's stomach load\r
-                       fill *= (1 - ((e.stomach_load / e.stomach_maxload) * bound(0, cvar("g_balance_vore_swallow_speed_fill_player_stomachload"), 1)));\r
+               if(cvar("g_balance_vore_swallow_speed_fill_stomachload") && e.stomach_load) // fill rate is influenced by the prey's stomach load\r
+                       fill *= (1 - ((e.stomach_load / e.stomach_maxload) * bound(0, cvar("g_balance_vore_swallow_speed_fill_stomachload"), 1)));\r
 \r
                // skill-based speed offset for bots\r
                if(skill && cvar("skill_offset"))\r
@@ -933,4 +933,4 @@ void Vore()
 \r
        // always position camera at the center of the stomach, to reduce probability of the view poking out\r
        self.view_ofs_z = PL_PREY_VIEW_OFS_z * self.predator.scale;\r
-}
\ No newline at end of file
+}\r