X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fclient%2Fsbar.qc;h=40171815fb9890d12e0204ff9493b0c1117b7d7d;hb=0dd9283ba2b8da923c9e1ccab1c9591f0535e331;hp=8dde732f0e8eadeee13f976bba0b2c1fb80613c0;hpb=10dbb6a3ee8d8d8d39afc69d984aaa84ec7bca6f;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 8dde732f..40171815 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -122,7 +122,7 @@ void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, fl drawstring(pos, final_num, vsize, rgb, alpha, dflags); } -void Sbar_DrawXNum_Colored (vector pos, float x, float lettersize, float alpha) +vector Sbar_NumColor (float x) { if(x > 200) { color_x = 0; @@ -144,17 +144,17 @@ void Sbar_DrawXNum_Colored (vector pos, float x, float lettersize, float alpha) color_y = 1; color_z = 0.2 + (x-50)*0.02 * 0.8; // blue value between 0.2 -> 1 } - else if(x > 20) { + else if(x > 25) { color_x = 1; - color_y = (x-20)*90/27/100; // green value between 0 -> 1 - color_z = (x-20)*90/27/100 * 0.2; // blue value between 0 -> 0.2 + color_y = (x-25)*90/27/100; // green value between 0 -> 1 + color_z = (x-25)*90/27/100 * 0.2; // blue value between 0 -> 0.2 } else { color_x = 1; color_y = 0; color_z = 0; } - Sbar_DrawXNum(pos, x, 3, 0, lettersize, color, alpha, DRAWFLAG_NORMAL); + return color; } void Cmd_Sbar_SetFields(float argc); @@ -795,11 +795,9 @@ void Sbar_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_num float is_spec; is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR); - if((rgb == '1 1 1') && (!is_spec)) { - rgb_x = cvar("sbar_color_bg_r") + 0.5; - rgb_y = cvar("sbar_color_bg_g") + 0.5; - rgb_z = cvar("sbar_color_bg_b") + 0.5; } - + if((rgb == '1 1 1') && (!is_spec)) + rgb = stov(cvar_string("sbar_color_bg")) + '0.5 0.5 0.5'; + // Layout: tmp_x = sbwidth; tmp_y = sbar_fontsize_y * 1.25; @@ -932,7 +930,7 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) { if(getstati(STAT_VORE_EATEN)) { - if(teamplay && GetPlayerColor(pl.entnum - 1) == GetPlayerColor(player_localentnum - 1)) // same team + if(teamplay && (GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1) || GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(spectatee_status - 1))) // same team hl_color = stov(cvar_string("sbar_stomachboard_color2")); else hl_color = stov(cvar_string("sbar_stomachboard_color3")); @@ -952,8 +950,7 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) drawcolorcodedstring(pos, textShortenToWidth(str, 138, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); } - if(field == ST_HEALTH) - if(stof(str) > 0) { + if(field == ST_HEALTH) { pos_x += 138; if(pl.sv_entnum == player_localentnum - 1 || (spectatee_status && pl.sv_entnum == spectatee_status - 1)) drawcolorcodedstring(pos, "self", '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); @@ -1271,9 +1268,7 @@ vector Sbar_DrawScoreboardRankings(vector pos, entity pl, vector rgb, vector bg float is_spec; is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR); vector hl_rgb; - hl_rgb_x = cvar("sbar_color_bg_r") + 0.5; - hl_rgb_y = cvar("sbar_color_bg_g") + 0.5; - hl_rgb_z = cvar("sbar_color_bg_b") + 0.5; + hl_rgb = stov(cvar_string("sbar_color_bg")) + '0.5 0.5 0.5'; pos_y += sbar_fontsize_y; drawstring(pos, strcat("Rankings"), sbar_fontsize, '1 1 1', sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL); @@ -1396,9 +1391,7 @@ void Sbar_DrawScoreboard() } else { - rgb_x = cvar("sbar_color_bg_r"); - rgb_y = cvar("sbar_color_bg_g"); - rgb_z = cvar("sbar_color_bg_b"); + rgb = stov(cvar_string("sbar_color_bg")); for(tm = teams.sort_next; tm; tm = tm.sort_next) { @@ -1596,6 +1589,38 @@ float race_CheckName(string net_name) { // Does the name already exist in rankin return 0; } +float GetAmmoStat(float i) +{ + switch(i) + { + case 0: return STAT_FUEL; + default: return -1; + } +} + +float GetAmmoItemCode(float i) +{ + switch(i) + { + case 0: return IT_FUEL; + default: return -1; + } +} + +string GetAmmoPicture(float i) +{ + switch(i) + { + case 0: + if(getstati(STAT_ITEMS) & IT_FUEL_REGEN) + return "gfx/hud/sb_fuel_regen"; + else + return "gfx/hud/sb_fuel"; + default: + return ""; + } +} + float race_status_time; float race_status_prev; string race_status_name_prev; @@ -1892,6 +1917,108 @@ void Sbar_Score() } } +void Sbar_Status() +{ + vector bottom; + bottom_x = vid_conwidth/2; + bottom_y = vid_conheight; + bottom_z = 0; + + float armor, health, x, a; + armor = getstati(STAT_ARMOR); + health = getstati(STAT_HEALTH); + + float stat_items; + stat_items = getstati(STAT_ITEMS); + + vector health_pos, armor_pos, pos; + health_pos = bottom - '43 58 0'; + armor_pos = bottom - '43 68 0'; + + if (cvar("viewsize") <= 100) { + if (teamplay) + 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 + else { + // allow for custom HUD colors in non-teamgames + color = stov(cvar_string("sbar_color_bg")); + + drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL); + } + } + + // armor + x = armor; + if (x > 0) + { + drawpic(armor_pos + '-8 -13.5 0', "gfx/hud/sb_armor", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + armor_pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '12 12 0') * 0.5; + Sbar_DrawXNum(armor_pos, x, 3, 0, 12, Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL); + } + + // health + x = health; + drawpic(health_pos + '-11 16 0', "gfx/hud/sb_health", '32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + health_pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '22 22 0') * 0.5; + Sbar_DrawXNum(health_pos, x, 3, 0, 22, Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL); + + // ammo + pos_x = bottom_x + 140; + pos_y = bottom_y - 20; + + float weapon_clipload, weapon_clipsize; + vector ammo_pos_offset; + + // if we are using the jetpack, show fuel ammo. Otherwise show the ammo of our weapon + if(stat_items & IT_JETPACK && button_jetpack) + { + a = getstati(GetAmmoStat(0)); // how much fuel do we have? + drawpic(pos - '98 18 0', GetAmmoPicture(0), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '16 16 0') * 0.5; + Sbar_DrawXNum(pos - '118 16 0' - ammo_pos_offset, a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + } + else + { + float i; + for (i = 0; i < 1; ++i) + { + if (stat_items & GetAmmoItemCode(i)) + { + a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i? + drawpic(pos - '98 18 0', GetAmmoPicture(i), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE); + // if the weapon we're holding is reloadable, show both its ammo and load + if(weapon_clipsize) + { + weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD); + if(weapon_clipload < 0) // we're reloading + { + ammo_pos_offset = '1 0 0' * stringwidth("- -", FALSE, '16 16 0') * 0.5; + drawstring(pos - '118 23 0' - ammo_pos_offset, "- -", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + } + else + { + ammo_pos_offset = '1 0 0' * stringwidth(ftos(weapon_clipload), FALSE, '16 16 0') * 0.5; + Sbar_DrawXNum(pos - '118 23 0' - ammo_pos_offset, weapon_clipload, 2, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + } + ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '12 12 0') * 0.5; + Sbar_DrawXNum(pos - '118 7 0' - ammo_pos_offset, a, 3, 0, 12, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + } + else + { + ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '16 16 0') * 0.5; + Sbar_DrawXNum(pos - '118 16 0' - ammo_pos_offset, a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + } + } + } + } + + // weapon icon + entity e; + e = get_weaponinfo(activeweapon); + if (e && e.netname != "" && e.netname != "N/A") + drawpic(bottom - '96 96 0', strcat("gfx/hud/bg_status_activeweapon_", e.netname), '192 96 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); +} + void Sbar_Timer() { float timelimit, elapsedTime, minutes, seconds, timeleft, minutesLeft, secondsLeft; @@ -1944,14 +2071,12 @@ void Sbar_Timer() } else { minutes = minutesLeft; seconds = secondsLeft; - if (minutes == 0) - bgpos_x = topright_x - (58 + 7 + 12) * scale; - else if (minutes < 10) // nudge the timer background left if more digits are drawn - bgpos_x = topright_x - (66 + 17 + 12) * scale; + if (minutes < 10) // nudge the timer background left if more digits are drawn + bgpos_x = topright_x - (54 + 17 + 12) * scale; else if (minutes < 100) - bgpos_x = topright_x - (74 + 17 + 12) * scale; + bgpos_x = topright_x - (62 + 17 + 12) * scale; else - bgpos_x = topright_x - (82 + 17 + 12) * scale; + bgpos_x = topright_x - (70 + 17 + 12) * scale; bgpos_y = 0; bgpos_z = 0; } @@ -1960,18 +2085,14 @@ void Sbar_Timer() if (teamplay) drawpic(bgpos, "gfx/hud/bg_timer", '120 30 0' * scale, GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // timer bg color = myteam color else { - color_x = cvar("sbar_color_bg_r"); - color_y = cvar("sbar_color_bg_g"); - color_z = cvar("sbar_color_bg_b"); + color = stov(cvar_string("sbar_color_bg")); drawpic(bgpos, "gfx/hud/bg_timer", '120 30 0' * scale, color, sbar_alpha_bg, DRAWFLAG_NORMAL); } } drawpic(topright - ('19 0 0' + '3 0 0' - '0 2 0'), "gfx/hud/sb_time", '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - if(minutesLeft >= 1 || cvar("sbar_increment_maptime") || timelimit == 0 || warmup_stage) { - finaltime = strcat(ftos(minutes), ":"); - } + finaltime = strcat(ftos(minutes), ":"); if(seconds < 10) finaltime = strcat(finaltime, "0", ftos(seconds)); else @@ -1982,6 +2103,84 @@ void Sbar_Timer() drawstring(pos, finaltime, 18 * scale * '1 1 0', timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL); } +void Sbar_Ring() +{ + vector ring_pos, ring1_color, ring2_color; + vector text_pos, text1_size, text2_size; + float ring1_alpha, ring2_alpha, ring1_size, ring1_clip, ring2_size, ring2_clip; + string text1_msg, text2_msg; + + ring_pos_x = vid_conwidth / 2; + ring_pos_y = vid_conheight - vid_conheight / 3.5; + ring1_size = cvar("sbar_ring1_scale"); + ring2_size = cvar("sbar_ring2_scale"); + ring1_alpha = sbar_alpha_fg * cvar("sbar_ring1_alpha"); + ring2_alpha = sbar_alpha_fg * cvar("sbar_ring2_alpha"); + text1_size = '1 1 0' * cvar("sbar_ring1_text_scale"); + text2_size = '1 1 0' * cvar("sbar_ring2_text_scale"); + + switch(getstati(STAT_SBRING1_TYPE)) + { + case 0: + // ring disabled + break; + case 1: + // ring shows predator swallow progress, fills with progress + ring1_color = '0.5 1 0.5'; + text1_msg = "Swallowing..."; + break; + case 2: + // ring shows vore system delay, empties with progress + ring1_color = '0.5 0.5 1'; + text1_msg = "Vore delay"; + break; + case 3: + // ring shows stomach kick delay, empties with progress + ring1_color = '1 1 0.5'; + text1_msg = "Kick delay"; + break; + default: + print(strcat("^1Error:^7 Unknown ring type: ", ftos(getstati(STAT_SBRING1_TYPE)), "\n")); + break; + } + switch(getstati(STAT_SBRING2_TYPE)) + { + case 0: + // ring disabled + break; + case 1: + // ring shows prey swallow progress, fills with progress + ring2_color = '1 0.5 0.5'; + text2_msg = "Swallowed..."; + break; + case 2: + // ring shows regurgitation preparing, fills with progress + ring2_color = '1 0.5 1'; + text2_msg = "Regurgitating..."; + break; + default: + print(strcat("^1Error:^7 Unknown ring type: ", ftos(getstati(STAT_SBRING1_TYPE)), "\n")); + break; + } + ring1_clip = getstatf(STAT_SBRING1_CLIP); + ring2_clip = getstatf(STAT_SBRING2_CLIP); + + if(text1_msg != "" && cvar("sbar_ring1")) + { + DrawCircleClippedPic(ring_pos, ring1_size, "gfx/hud/sb_ring.tga", ring1_clip, ring1_color, ring1_alpha, DRAWFLAG_ADDITIVE); + text_pos_x = ring_pos_x - stringwidth(text1_msg, FALSE, text1_size) / 2; + text_pos_y = ring_pos_y - ring1_size / 2; + drawstring(text_pos, text1_msg, text1_size, ring1_color, sbar_alpha_fg, DRAWFLAG_NORMAL); + } + if(text2_msg != "" && cvar("sbar_ring2")) + { + DrawCircleClippedPic(ring_pos, ring2_size, "gfx/hud/sb_ring.tga", ring2_clip, ring2_color, ring2_alpha, DRAWFLAG_ADDITIVE); + text_pos_x = ring_pos_x - stringwidth(text2_msg, FALSE, text2_size) / 2; + text_pos_y = ring_pos_y + ring1_size / 2; + drawstring(text_pos, text2_msg, text2_size, ring2_color, sbar_alpha_fg, DRAWFLAG_NORMAL); + } +} + void CSQC_Strength_Timer() { vector pos; vector bottomright; @@ -2136,8 +2335,8 @@ void centerprint(string strMessage) havail = vid_conheight; if(cvar("con_chatpos") < 0) havail -= (-cvar("con_chatpos") + cvar("con_chat")) * cvar("con_chatsize"); // avoid overlapping chat - if(havail > vid_conheight - 70) - havail = vid_conheight - 70; // avoid overlapping HUD + if(havail > vid_conheight / 4) + havail = vid_conheight / 4; // avoid overlapping HUD centerprint_start_x = 0; @@ -2566,33 +2765,6 @@ void drawstringcenter(vector position, string text, vector scale, vector rgb, fl drawstring(position, text, scale, rgb, alpha, flag); } -float GetAmmoStat(float i) -{ - switch(i) - { - case 0: return STAT_FUEL; - default: return -1; - } -} - -float GetAmmoItemCode(float i) -{ - switch(i) - { - case 0: return IT_FUEL; - default: return -1; - } -} - -string GetAmmoPicture(float i) -{ - switch(i) - { - case 0: return "gfx/hud/sb_fuel"; - default: return ""; - } -} - void Sbar_Reset (void) { // reset gametype specific icons @@ -2666,8 +2838,7 @@ void Sbar_Draw (void) sbar_color_bg_team = cvar("sbar_color_bg_team"); float weapon_stats; - float x, fade; - float stat_items, stat_weapons; + float fade; weapon_stats = getstati(STAT_DAMAGE_HITS); weapon_number = weapon_stats & 63; @@ -2833,11 +3004,8 @@ void Sbar_Draw (void) if (teamplay) color = GetTeamRGB(myteam) * sbar_color_bg_team; - else { - color_x = cvar("sbar_color_bg_r"); - color_y = cvar("sbar_color_bg_g"); - color_z = cvar("sbar_color_bg_b"); - } + else + color = stov(cvar_string("sbar_color_bg")); vector voteorigin = bottomright - '290 135 0'; vector votesize = '280 70 0'; @@ -2893,6 +3061,8 @@ void Sbar_Draw (void) Sbar_DrawScoreboard(); Sbar_Score(); Sbar_Timer(); + if(getstati(STAT_VORE_EATEN)) + Sbar_Status(); Sbar_Reset(); @@ -2904,12 +3074,6 @@ void Sbar_Draw (void) Sbar_DrawAccuracyStats(); else Sbar_DrawScoreboard(); - float armor, health; - armor = getstati(STAT_ARMOR); - health = getstati(STAT_HEALTH); - - stat_items = getstati(STAT_ITEMS); - stat_weapons = getstati(STAT_WEAPONS); fade = 3.2 - 2 * (time - weapontime); fade = bound(0.7, fade, 1); @@ -2922,9 +3086,7 @@ void Sbar_Draw (void) 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 else { // allow for custom HUD colors in non-teamgames - color_x = cvar("sbar_color_bg_r"); - color_y = cvar("sbar_color_bg_g"); - color_z = cvar("sbar_color_bg_b"); + color = stov(cvar_string("sbar_color_bg")); drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach", '256 256 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL); } @@ -2934,7 +3096,7 @@ void Sbar_Draw (void) string hl_string; if(getstati(STAT_VORE_EATEN)) { - if(teamplay && GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1)) // same team + if(teamplay && (GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1) || GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(spectatee_status - 1))) // same team hl_color = stov(cvar_string("sbar_stomachboard_color2")); else hl_color = stov(cvar_string("sbar_stomachboard_color3")); @@ -2948,28 +3110,39 @@ void Sbar_Draw (void) drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', StomachStatus_ColorFade(hl_color), cvar("sbar_stomachboard_status_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL); drawstring(bottomleft - '-80 173 0', hl_string, '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - float stomach_load; - stomach_load = getstati(STAT_VORE_LOAD); // shows the predator's stomach load when we are eaten, and ours otherwise + float stomach_load, stomach_maxload; // shows the predator's stomach load when we are eaten, and ours otherwise + stomach_load = getstati(STAT_VORE_LOAD); + stomach_maxload = getstati(STAT_VORE_MAXLOAD); vector status_pos; - string status_text; - status_text = strcat(ftos(bound(0, stomach_load, 9)), "/", ftos(bound(0, g_balance_vore_swallow_limit, 9))); - status_pos = bottomleft - '-43 171 0'; - status_pos -= '1 0 0' * stringwidth(status_text, FALSE, '22 22 0') * 0.5; - drawstring(status_pos, status_text, '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - - if(getstati(STAT_VORE_DIGESTING)) - drawstring(bottomleft - '-76 142 0', "stomach digesting", '12 12 0', '1 0.5 0.5', sbar_alpha_fg, DRAWFLAG_NORMAL); - else if(stomach_load == g_balance_vore_swallow_limit) - drawstring(bottomleft - '-76 142 0', "stomach full", '12 12 0', '0.5 1 0.5', sbar_alpha_fg, DRAWFLAG_NORMAL); - else if(!stomach_load) - drawstring(bottomleft - '-76 142 0', "stomach empty", '12 12 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - else - drawstring(bottomleft - '-76 142 0', "stomach has prey", '12 12 0', '0.75 1 0.75', sbar_alpha_fg, DRAWFLAG_NORMAL); + string status_text, status_color; + float status_size; + status_color = rgb_to_hexcolor('0.5 0.5 0.5' + Sbar_NumColor(stomach_maxload) * 0.5); // twice brighter than health / armor colors + if(stomach_load) + { + status_text = strcat(ftos(stomach_load), "^8/", status_color, ftos(stomach_maxload)); + status_pos = bottomleft - '-43 168 0'; + status_size = 16; + } + else if(g_healthsize_center >= 0) // no point in showing it otherwise + { + status_text = strcat(status_color, ftos(stomach_maxload)); + status_pos = bottomleft - '-43 170 0'; + status_size = 20; + } + status_pos -= '1 0 0' * stringwidth(status_text, TRUE, '1 0 0' * status_size) * 0.5; + drawcolorcodedstring(status_pos, status_text, '1 1 0' * status_size, sbar_alpha_fg, DRAWFLAG_NORMAL); + + if(getstati(STAT_VORE_DIGESTING)) // we are currently digesting + drawpic(bottomleft - '-35 149 0', "gfx/hud/sb_digestion", '16 16 0', '0 1 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + else if(stomach_load) // we can digest at this time + drawpic(bottomleft - '-35 149 0', "gfx/hud/sb_digestion", '16 16 0', '0.25 0.25 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + else // we cannot digest at this time + drawpic(bottomleft - '-35 149 0', "gfx/hud/sb_digestion", '16 16 0', '0.25 0 0', sbar_alpha_fg, DRAWFLAG_NORMAL); // draw the stomach board player list - entity pl; - float f; + entity pl, pred; + float f, l; pos = bottomleft; for(pl = players.sort_next; pl; pl = pl.sort_next) @@ -2987,111 +3160,36 @@ void Sbar_Draw (void) f = pl.plpredator == player_localentnum; } - if(f) + if(f && l <= 8) // limit the stomach board to 9 entries due to the HUD design { Sbar_PrintStomachboardItem(pos - '-16 124 0', pl); pos_y += 1.1 * sbar_fontsize_y; + l += 1; } + // set the predator's name if(getstati(STAT_VORE_EATEN)) - if(pl.sv_entnum == getstati(STAT_VORE_EATEN) - 1) - Sbar_PrintStomachboardItemPred(bottomleft - '-76 156 0', pl); - } - } - - if (cvar("viewsize") <= 100) { - if (teamplay) - 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 - else { - // allow for custom HUD colors in non-teamgames - color_x = cvar("sbar_color_bg_r"); - color_y = cvar("sbar_color_bg_g"); - color_z = cvar("sbar_color_bg_b"); - - drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL); - } - } - - vector health_pos, armor_pos; - health_pos = bottom - '43 58 0'; - armor_pos = bottom - '43 68 0'; - - // armor - x = armor; - if (x > 0) - { - drawpic(armor_pos + '-8 -13.5 0', "gfx/hud/sb_armor", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - armor_pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '12 12 0') * 0.5; - Sbar_DrawXNum_Colored(armor_pos, x, 12, sbar_alpha_fg); - } - - // health - x = health; - drawpic(health_pos + '-11 16 0', "gfx/hud/sb_health", '32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - health_pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '22 22 0') * 0.5; - Sbar_DrawXNum_Colored(health_pos, x, 22, sbar_alpha_fg); - - // ammo - pos_x = bottom_x + 140; - pos_y = bottom_y - 20; - - float weapon_clipload, weapon_clipsize; - vector ammo_pos_offset; - - // if we are using the jetpack, show fuel ammo. Otherwise show the ammo of our weapon - if(stat_items & IT_JETPACK && button_jetpack) - { - a = getstati(GetAmmoStat(0)); // how much fuel do we have? - drawpic(pos - '98 18 0', GetAmmoPicture(0), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '16 16 0') * 0.5; - Sbar_DrawXNum(pos - '118 16 0' - ammo_pos_offset, a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - } - else - { - float i; - for (i = 0; i < 1; ++i) - { - if (stat_items & GetAmmoItemCode(i)) { - a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i? - drawpic(pos - '98 18 0', GetAmmoPicture(i), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE); - - // if the weapon we're holding is reloadable, show both its ammo and load - if(weapon_clipsize) - { - weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD); - if(weapon_clipload < 0) // we're reloading - { - ammo_pos_offset = '1 0 0' * stringwidth("- -", FALSE, '16 16 0') * 0.5; - drawstring(pos - '118 23 0' - ammo_pos_offset, "- -", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - } - else - { - ammo_pos_offset = '1 0 0' * stringwidth(ftos(weapon_clipload), FALSE, '16 16 0') * 0.5; - Sbar_DrawXNum(pos - '118 23 0' - ammo_pos_offset, weapon_clipload, 2, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - } - ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '12 12 0') * 0.5; - Sbar_DrawXNum(pos - '118 7 0' - ammo_pos_offset, a, 3, 0, 12, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - } - else - { - ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '16 16 0') * 0.5; - Sbar_DrawXNum(pos - '118 16 0' - ammo_pos_offset, a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - } + if(pl.sv_entnum == getstati(STAT_VORE_EATEN) - 1) + pred = pl; } + else if(pl.sv_entnum == player_localentnum - 1 || pl.sv_entnum == spectatee_status - 1) + pred = pl; // show us or the spectated player } + + // draw the predator's name + Sbar_PrintStomachboardItemPred(bottomleft - '-76 150 0', pred); } - // weapon icon - entity e; - e = get_weaponinfo(activeweapon); - if (e && e.netname != "" && e.netname != "N/A") - drawpic(bottom - '96 96 0', strcat("gfx/hud/bg_status_activeweapon_", e.netname), '192 96 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); +// if(getstati(STAT_HEALTH) > 0) +// if(getstati(STAT_ARMOR) < g_power) +// return; - // draw scores and timer + // draw status, scores, timer, and ring + Sbar_Status(); Sbar_Score(); Sbar_Timer(); + Sbar_Ring(); // draw strength/invincibility icon and timer CSQC_Strength_Timer();