X-Git-Url: http://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fclient%2Fsbar.qc;h=1f2f4ebc12729f36649a06131dbca697ba37a377;hp=663c3c219f07cd00f2e8fffd7fec4a56f45ebc79;hb=8cbf6fa713ba7eb3380855c6a2746da220e10cd0;hpb=18eb9d6dd7612869dba71d30255c072fe73f654e diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 663c3c21..1f2f4ebc 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -29,7 +29,6 @@ float ps_primary, ps_secondary; float ts_primary, ts_secondary; vector color; -float SCOREBOARD_OFFSET = 50; void CSQC_kh_hudreset(); void CSQC_kh_hud(); @@ -70,12 +69,12 @@ vector Sbar_AccuracyColor(float accuracy) return rgb; } -void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, float lettersize, vector rgb, float highlighted, float stroke, float alpha, float dflags) +void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, float lettersize, vector rgb, float alpha, float dflags) { float l, i; string str, tmp, l_length; float minus, plus; - vector vsize, num_color; + vector vsize; vsize_x = vsize_y = lettersize; vsize_z = 0; @@ -87,7 +86,6 @@ void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, fl if((showminusplus == 2 && num >= 0) || (num > 0 && showminusplus == 3)) { plus = true; - pos_x -= lettersize; } else plus = false; @@ -95,7 +93,6 @@ void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, fl { minus = true; num = -num; - pos_x -= lettersize; } else minus = false; @@ -112,54 +109,21 @@ void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, fl if(l > digits) { - str = substring(str, l-digits, 999); + str = substring(str, l - digits, 999); l = strlen(str); - } else if(l < digits) - pos_x += (digits-l) * lettersize; - - if (highlighted == 1) { - vector hl_size; - hl_size_x = vsize_x * l + vsize_x * 0.2; - hl_size_y = vsize_y * 1.1; - hl_size_z = 0; - if(minus) - hl_size_x = hl_size_x + vsize_x; - - vector hl_pos; - hl_pos_x = pos_x - lettersize/10; - hl_pos_y = pos_y - lettersize/20; - hl_pos_z = 0; - - drawpic(hl_pos, strcat("gfx/hud/sb_highlight_", l_length), hl_size, '1 1 1', alpha, dflags); } - if (stroke == 1) - num_color = '1 1 1'; - else - num_color = rgb; - if(minus) { - if (stroke == 1) - drawpic(pos, "gfx/hud/num_minus_stroke", vsize, rgb, alpha, dflags); - drawpic(pos, "gfx/hud/num_minus", vsize, num_color, alpha, dflags); - pos_x += lettersize; + drawstring(pos, "-", vsize, rgb, alpha, dflags); + pos_x += lettersize / 2; } else if(plus) { - if (stroke == 1) - drawpic(pos, "gfx/hud/num_plus_stroke", vsize, rgb, alpha, dflags); - drawpic(pos, "gfx/hud/num_plus", vsize, num_color, alpha, dflags); - pos_x += lettersize; + drawstring(pos, "+", vsize, rgb, alpha, dflags); + pos_x += lettersize / 2; } - for(i = 0; i < l; ++i) - { - tmp = substring(str, i, 1); - if (stroke == 1) - drawpic(pos, strcat("gfx/hud/num_", tmp, "_stroke"), vsize, rgb, alpha, dflags); - drawpic(pos, strcat("gfx/hud/num_", tmp), vsize, num_color, alpha, dflags); - pos_x += lettersize; - } + drawstring(pos, str, vsize, rgb, alpha, dflags); } void Sbar_DrawXNum_Colored (vector pos, float x, float lettersize, float alpha) @@ -194,7 +158,7 @@ void Sbar_DrawXNum_Colored (vector pos, float x, float lettersize, float alpha) color_y = 0; color_z = 0; } - Sbar_DrawXNum(pos, x, 3, 0, lettersize, color, 0, 0, alpha, DRAWFLAG_NORMAL); + Sbar_DrawXNum(pos, x, 3, 0, lettersize, color, alpha, DRAWFLAG_NORMAL); } void Cmd_Sbar_SetFields(float argc); @@ -509,14 +473,15 @@ void Cmd_Sbar_SetFields(float argc) sbar_field[sbar_num_fields] = SP_SEPARATOR; have_separator = 1; } else { + if(gametype == GAME_RPG) + return; + for(j = 0; j < MAX_SCORE; ++j) if(str == strtolower(scores_label[j])) goto found; // sorry, but otherwise fteqcc -O3 miscompiles this and warns about "unreachable code" :notfound - if(str == "frags" && !(gametype == GAME_RPG)) - { + if(str == "frags") j = SP_FRAGS; - } else { if not(nocomplain) @@ -716,18 +681,11 @@ string Sbar_GetField(entity pl, float field) string Sbar_GetStomachField(entity pl, float field) { - sbar_field_rgb = '1 1 1'; - sbar_field_icon0 = ""; - sbar_field_icon1 = ""; - sbar_field_icon2 = ""; - sbar_field_icon0_rgb = '1 1 1'; - sbar_field_icon1_rgb = '1 1 1'; - sbar_field_icon2_rgb = '1 1 1'; - sbar_field_icon0_alpha = 1; - sbar_field_icon1_alpha = 1; - sbar_field_icon2_alpha = 1; switch(field) { + case ST_HIGHLIGHT: + return ""; // the returned value is not used, we only need the field + case ST_NAME: return GetPlayerName(pl.sv_entnum); @@ -740,6 +698,18 @@ string Sbar_GetStomachField(entity pl, float field) //return "error"; } +string Sbar_GetStomachFieldPred(entity pl, float field) +{ + switch(field) + { + case STP_NAME: + return GetPlayerName(pl.sv_entnum); + default: + return "N/A"; + } + //return "error"; +} + float xmin, xmax, ymin, ymax, sbwidth; float sbar_fixscoreboardcolumnwidth_len; float sbar_fixscoreboardcolumnwidth_iconlen; @@ -949,17 +919,26 @@ void Sbar_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_num float fieldcounter; void Sbar_PrintStomachboardItem(vector pos, entity pl) { + // lists all players in the stomach + string str; - float f, field; + float f, field, field_number; + field_number = 3; // the number of components each row has - for(fieldcounter = 1; fieldcounter <= 2; ++fieldcounter) + for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter) { field = -fieldcounter; - if(field == SP_SEPARATOR) - break; - str = Sbar_GetStomachField(pl, field); + // row highlighting + if(field == ST_HIGHLIGHT) + { + if(getstati(STAT_VORE_EATEN)) + drawfill(pos - '0 0 0', '193 11 0', stov(cvar_string("sbar_stomachboard_color2")), cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL); + else + drawfill(pos - '0 0 0', '193 11 0', stov(cvar_string("sbar_stomachboard_color1")), cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL); + } + if(field == ST_NAME) { f = stof(getplayerkey(pl.sv_entnum, "colors")); drawpic(pos, "gfx/sb_playercolor_base", '22 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); @@ -967,11 +946,11 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) drawpic(pos, "gfx/sb_playercolor_pants", '22 11 0', colormapPaletteColor(mod(f, 16), 1), sbar_alpha_fg, DRAWFLAG_NORMAL); pos_x += 24; - drawcolorcodedstring(pos, str, '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos, textShortenToWidth(str, 138, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); } if(field == ST_HEALTH) - if(g_vore_showpreyhealth && stof(str)) { // only if player health is not 0. Also used to hide the predators health + if(stof(str) > 0) { 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); @@ -986,6 +965,32 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) } } +float fieldcounter2; +void Sbar_PrintStomachboardItemPred(vector pos, entity pl) +{ + // shows the name of our predator + + string str; + float f, field, field_number; + field_number = 1; // the number of components each row has + + for(fieldcounter2 = 1; fieldcounter2 <= field_number; ++fieldcounter2) + { + field = -fieldcounter2; + str = Sbar_GetStomachFieldPred(pl, field); + + if(field == STP_NAME) { + f = stof(getplayerkey(pl.sv_entnum, "colors")); + drawpic(pos, "gfx/sb_playercolor_base", '22 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(pos, "gfx/sb_playercolor_shirt", '22 11 0', colormapPaletteColor(floor(f / 16), 0), sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(pos, "gfx/sb_playercolor_pants", '22 11 0', colormapPaletteColor(mod(f, 16), 1), sbar_alpha_fg, DRAWFLAG_NORMAL); + + pos_x += 24; + drawcolorcodedstring(pos, textShortenToWidth(str, 122, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + } + } +} + /* * Sbar_Scoreboard_MakeTable * @@ -1344,7 +1349,7 @@ void Sbar_DrawScoreboard() sbwidth = Sbar_GetWidth(6.5 * sbar_fontsize_y); xmin = 0.5 * (vid_conwidth - sbwidth); - ymin = SCOREBOARD_OFFSET; + ymin = cvar("sbar_scoreboard_offset"); xmax = vid_conwidth - xmin; ymax = vid_conheight - 0.2*vid_conheight; @@ -1356,7 +1361,10 @@ void Sbar_DrawScoreboard() // Heading drawfont = sbar_bigfont; - drawstringcenter('0 1 0' * ymin, "Scoreboard", '24 24 0', '1 1 1', sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL); + if(gametype == GAME_RPG) + drawstringcenter('0 1 0' * ymin, "Players", '24 24 0', '1 1 1', sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL); + else + drawstringcenter('0 1 0' * ymin, "Scoreboard", '24 24 0', '1 1 1', sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL); pos_y += 24 + 4; pos_y += sbar_fontsize_y; @@ -1375,10 +1383,10 @@ void Sbar_DrawScoreboard() continue; rgb = GetTeamRGB(tm.team); - Sbar_DrawXNum(pos - '9.5 0 0' * sbar_fontsize_y + '0 1 0' * sbar_fontsize_y, tm.(teamscores[ts_primary]), 6, 0, sbar_fontsize_y * 1.5, rgb, 0, 1, sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(pos - '9.5 0 0' * sbar_fontsize_y + '0 1 0' * sbar_fontsize_y, tm.(teamscores[ts_primary]), 6, 0, sbar_fontsize_y * 1.5, rgb, sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL); if(ts_primary != ts_secondary) - Sbar_DrawXNum(pos - '7.5 0 0' * sbar_fontsize_y + '0 2.5 0' * sbar_fontsize_y, tm.(teamscores[ts_secondary]), 6, 0, sbar_fontsize_y * 1, rgb, 0, 1, sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(pos - '7.5 0 0' * sbar_fontsize_y + '0 2.5 0' * sbar_fontsize_y, tm.(teamscores[ts_secondary]), 6, 0, sbar_fontsize_y * 1, rgb, sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL); pos = Sbar_Scoreboard_MakeTable(pos, tm, rgb, bg_size); } @@ -1437,7 +1445,10 @@ void Sbar_DrawScoreboard() // Print info string string str; float tl, fl, ll; - str = strcat("playing on ^2", shortmapname, "^7"); + if(gametype == GAME_RPG) + str = strcat("you are in ^2", shortmapname, "^7"); + else + str = strcat("playing on ^2", shortmapname, "^7"); tl = getstatf(STAT_TIMELIMIT); fl = getstatf(STAT_FRAGLIMIT); ll = getstatf(STAT_LEADLIMIT); @@ -1450,7 +1461,7 @@ void Sbar_DrawScoreboard() { if(tl > 0) str = strcat(str, " for ^1", ftos(tl), " minutes^7"); - if(fl > 0) + if(fl > 0 && !(gametype == GAME_RPG)) { if(tl > 0) str = strcat(str, " or"); @@ -1653,8 +1664,8 @@ void Sbar_Score() if(gametype == GAME_RPG) return; - score_pos = top + '-240 8 0'; - secondary_score_pos = score_pos + '210 -6 0'; + score_pos = top + '-80 8 0'; + secondary_score_pos = score_pos + '80 -6 0'; if((scores_flags[ps_primary] & SFL_TIME) && !teamplay) { // race/cts record display on HUD pl = players.sort_next; @@ -1694,20 +1705,16 @@ void Sbar_Score() distribution_color = '1 0 0'; minusplus = 2; // minusplus 1: always prefix with plus sign } - Sbar_DrawXNum(score_pos + '335 16 0' - '16 0 0' * TIME_DECIMALS, distmsec, -TIME_DECIMALS, 0, 16, distribution_color, 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - Sbar_DrawXNum(score_pos + '403 16 0' - '16 0 0' * TIME_DECIMALS, distsec, 4, minusplus, 16, distribution_color, 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - drawpic(score_pos + '335 16 0' - '16 0 0' * TIME_DECIMALS, "gfx/hud/num_dot", '16 16 0', distribution_color, sbar_alpha_fg, DRAWFLAG_ADDITIVE); + Sbar_DrawXNum(score_pos + '212 -4 0' - '16 0 0' * TIME_DECIMALS, distmsec, -TIME_DECIMALS, 0, 16, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(score_pos + '212 12 0' - '16 0 0' * TIME_DECIMALS, distsec, 4, minusplus, 16, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL); } - // race record display - if (distribution <= 0 || distribution == score) // draw the highlight background behind the timer if we have the lead - drawpic(score_pos + '335 0 0' - '32 0 0' * (4 + TIME_DECIMALS), "gfx/hud/sb_highlight_4", '0 28 0' + '32 0 0' * (4 + TIME_DECIMALS), '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - Sbar_DrawXNum(score_pos + '335 0 0' - TIME_DECIMALS * '30 0 0', racemsec, -TIME_DECIMALS, 0, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - Sbar_DrawXNum(score_pos + '335 0 0' - TIME_DECIMALS * '30 0 0' - '66 0 0', racesec, -2, 0, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - drawpic(score_pos + '335 0 0' - TIME_DECIMALS * '30 0 0' - '18 0 0', "gfx/hud/num_dot", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); + Sbar_DrawXNum(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0', racemsec, -TIME_DECIMALS, 0, 30, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0' - '66 0 0', racesec, -2, 0, 30, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0' - '21 0 0', ".", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); - Sbar_DrawXNum(score_pos + '335 0 0' - TIME_DECIMALS * '30 0 0' - '132 0 0', racemin, -2, 0, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - drawpic(score_pos + '335 0 0' - TIME_DECIMALS * '30 0 0' - '84 0 0', "gfx/hud/num_colon", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); + Sbar_DrawXNum(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0' - '132 0 0', racemin, -2, 0, 30, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0' - '88 0 0', ":", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } else if (!teamplay) { // non-teamgames, except race/cts // me vector := [team/connected frags id] @@ -1733,8 +1740,8 @@ void Sbar_Score() else distribution_color = '1 0 0'; - Sbar_DrawXNum(secondary_score_pos, distribution, 6, 0, 16, distribution_color, 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - Sbar_DrawXNum(score_pos, score, 6, 0, 34, distribution_color, leader, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(secondary_score_pos, distribution, 6, 0, 16, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(score_pos, score, 6, 0, 34, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL); } else { // teamgames float max_fragcount; max_fragcount = -999; @@ -1751,11 +1758,11 @@ void Sbar_Score() if(tm.team == myteam) { if (max_fragcount == score) leader = 1; - Sbar_DrawXNum(score_pos, score, 6, 0, 34, GetTeamRGB(tm.team) * 0.8, leader, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(score_pos, score, 6, 0, 34, GetTeamRGB(tm.team) * 0.8, sbar_alpha_fg, DRAWFLAG_NORMAL); } else { if (max_fragcount == score) leader = 1; - Sbar_DrawXNum(secondary_score_pos, score, 6, 0, 16, GetTeamRGB(tm.team) * 0.8, leader, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(secondary_score_pos, score, 6, 0, 16, GetTeamRGB(tm.team) * 0.8, sbar_alpha_fg, DRAWFLAG_NORMAL); secondary_score_pos = secondary_score_pos + '0 16 0'; } } @@ -1917,9 +1924,9 @@ void Sbar_Timer() if (minutes < 10) bgpos_x = topright_x - (54 + 17 + 12) * scale; else if (minutes < 100) // nudge the timer background left if more digits are drawn - bgpos_x = topright_x - (72 + 17 + 12) * scale; + bgpos_x = topright_x - (62 + 17 + 12) * scale; else - bgpos_x = topright_x - (90 + 17 + 12) * scale; + bgpos_x = topright_x - (70 + 17 + 12) * scale; bgpos_y = 0; bgpos_z = 0; } else { @@ -1949,11 +1956,12 @@ void Sbar_Timer() } } + 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) { - Sbar_DrawXNum(topright - ('103 -2 0' - '0 2 0') * scale, minutes, 3, 0, 18 * scale, timer_color, 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - drawpic(topright - ('53 0 0' - '0 1 0') * scale, "gfx/hud/num_colon", '18 18 0' * scale, timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(topright - ('50 -2 0' - '0 2 0') - (strlen(ftos(minutes)) * 18 * scale * '0.5 0 0'), minutes, 3, 0, 18 * scale, timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(topright - ('48 -2 0' - '0 1 0'), ":", '18 18 0' * scale, timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL); } - Sbar_DrawXNum(topright - ('36 -2 0' + '3 0 0' - '0 2 0') * scale, seconds, -2, 0, 18 * scale, timer_color, 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(topright - ('37 -2 0' + '3 0 0' - '0 2 0'), seconds, -2, 0, 18 * scale, timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL); } void CSQC_Strength_Timer() { @@ -1981,10 +1989,7 @@ void CSQC_Strength_Timer() { picsize = '22 22 0'; countdown_fontsize = 18; - if (vid_conwidth >= 800) - pos = bottomright - '34 48 0'; - else - pos = bottomright - '34 96 0'; + pos = bottomright - '34 48 0'; //strength strength_time = getstatf(STAT_STRENGTH_FINISHED); @@ -2003,7 +2008,7 @@ void CSQC_Strength_Timer() { { drawpic(pos, "gfx/hud/sb_str", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } - Sbar_DrawXNum(pos - '40 -2 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(pos - '20 -2 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } else if(dt > -1) { @@ -2026,7 +2031,7 @@ void CSQC_Strength_Timer() { { drawpic(pos - '0 -22 0', "gfx/hud/sb_invinc", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } - Sbar_DrawXNum(pos - '40 -24 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(pos - '20 -24 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } else if(dt > -1) { @@ -2357,17 +2362,17 @@ void Sbar_DrawAccuracyStats_Description_Hitscan(vector position) drawstring(position + '0 9 0' * sbar_fontsize_y, "Shots missed:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } -void Sbar_DrawAccuracyStats_Description_Splash(vector position) +/*void Sbar_DrawAccuracyStats_Description_Splash(vector position) { drawstring(position + '0 3 0' * sbar_fontsize_y, "Maximum damage:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); drawstring(position + '0 5 0' * sbar_fontsize_y, "Actual damage:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); drawstring(position + '0 7 0' * sbar_fontsize_y, "Accuracy:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); drawstring(position + '0 9 0' * sbar_fontsize_y, "Damage wasted:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); -} +}*/ // we have no splash damage weapons, but keep this code just in case void Sbar_DrawAccuracyStats() { - float i, count_hitscan, count_splash, row_hitscan, row_splash; // count is the number of 'colums' + float i, count_hitscan, /*count_splash,*/ row_hitscan/*, row_splash*/; // count is the number of 'colums' float weapon_hit, weapon_damage, weapon_stats; float left_border; // position where the weapons start, the description is in the border vector fill_colour, fill_size; @@ -2382,7 +2387,7 @@ void Sbar_DrawAccuracyStats() drawfont = sbar_bigfont; pos_x = 0; - pos_y = SCOREBOARD_OFFSET; + pos_y = cvar("sbar_scoreboard_offset"); pos_z = 0; drawstringcenter(pos, "Weapon Accuracy", 2 * sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); @@ -2408,11 +2413,11 @@ void Sbar_DrawAccuracyStats() return; } - float top_border_hitscan = SCOREBOARD_OFFSET + 55; // position where the hitscan row starts: pixels down the screen + float top_border_hitscan = cvar("sbar_scoreboard_offset") + 55; // position where the hitscan row starts: pixels down the screen Sbar_DrawAccuracyStats_Description_Hitscan('1 0 0' * col_margin + '0 1 0' * top_border_hitscan); - float top_border_splash = SCOREBOARD_OFFSET + 175; // position where the splash row starts: pixels down the screen - Sbar_DrawAccuracyStats_Description_Splash('1 0 0' * col_margin + '0 1 0' * top_border_splash); +// float top_border_splash = cvar("sbar_scoreboard_offset") + 175; // position where the splash row starts: pixels down the screen +// Sbar_DrawAccuracyStats_Description_Splash('1 0 0' * col_margin + '0 1 0' * top_border_splash); for(i = WEP_FIRST; i <= WEP_LAST; ++i) { @@ -2424,7 +2429,7 @@ void Sbar_DrawAccuracyStats() border_colour = (i == activeweapon) ? '1 1 1' : '0 0 0'; // white or black border if (weapon_damage) { - if (self.spawnflags & WEP_TYPE_SPLASH) { + /*if (self.spawnflags & WEP_TYPE_SPLASH) { weapon_stats = bound(0, floor(100 * weapon_hit / weapon_damage), 100); fill_colour_x = 1 - 0.015 * weapon_stats; @@ -2474,7 +2479,9 @@ void Sbar_DrawAccuracyStats() drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 9 0' * sbar_fontsize_y, ftos(max(0, weapon_damage - weapon_hit)), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); ++count_splash; - } else if (self.spawnflags & WEP_TYPE_HITSCAN) { + } else*/ // we have no splash damage weapons, but keep this code just in case + + if (self.spawnflags & WEP_TYPE_HITSCAN) { weapon_stats = bound(0, floor(100 * weapon_hit / weapon_damage), 100); fill_colour_x = 1 - 0.015 * weapon_stats; @@ -2545,7 +2552,7 @@ float GetAmmoStat(float i) { switch(i) { - case 1: return STAT_FUEL; + case 0: return STAT_FUEL; default: return -1; } } @@ -2554,7 +2561,7 @@ float GetAmmoItemCode(float i) { switch(i) { - case 1: return IT_FUEL; + case 0: return IT_FUEL; default: return -1; } } @@ -2563,7 +2570,7 @@ string GetAmmoPicture(float i) { switch(i) { - case 1: return "gfx/hud/sb_fuel"; + case 0: return "gfx/hud/sb_fuel"; default: return ""; } } @@ -2587,6 +2594,30 @@ float vote_prev; // previous state of vote_active to check for a change float vote_alpha; float vote_change; // "time" when vote_active changed +vector stomachstatus_colorfade_current; +vector StomachStatus_ColorFade(vector target_color) +{ + local float step; + step = cvar("sbar_stomachboard_status_fade") * frametime; + + if(stomachstatus_colorfade_current_x >= target_color_x + step) + stomachstatus_colorfade_current_x -= step; + else if(stomachstatus_colorfade_current_x <= target_color_x - step) + stomachstatus_colorfade_current_x += step; + + if(stomachstatus_colorfade_current_y >= target_color_y + step) + stomachstatus_colorfade_current_y -= step; + else if(stomachstatus_colorfade_current_y <= target_color_y - step) + stomachstatus_colorfade_current_y += step; + + if(stomachstatus_colorfade_current_z >= target_color_z + step) + stomachstatus_colorfade_current_z -= step; + else if(stomachstatus_colorfade_current_z <= target_color_z - step) + stomachstatus_colorfade_current_z += step; + + return stomachstatus_colorfade_current; +} + void Sbar_Draw (void) { // vectors for top right, bottom right, bottom and bottom left corners @@ -2831,15 +2862,9 @@ void Sbar_Draw (void) Sbar_UpdatePlayerTeams(); if (intermission == 2) // map voting screen { - if(spectatee_status != -1) { - Sbar_Score(); - Sbar_Timer(); - } - else if(sb_showscores) { - Sbar_DrawScoreboard(); - Sbar_Score(); - Sbar_Timer(); - } + Sbar_Timer(); + if(sb_showscores) + Sbar_DrawScoreboard(); else Sbar_FinaleOverlay(); @@ -2852,6 +2877,8 @@ void Sbar_Draw (void) Sbar_Timer(); Sbar_Reset(); + + StomachStatus_ColorFade('0 0 0'); } else { @@ -2860,7 +2887,7 @@ void Sbar_Draw (void) else Sbar_DrawScoreboard(); float armor, health; - armor = getstati(STAT_ARMOR); // armor is not used in Vore Tournament by default, but still exists for mods that might want it + armor = getstati(STAT_ARMOR); health = getstati(STAT_HEALTH); stat_items = getstati(STAT_ITEMS); @@ -2869,71 +2896,82 @@ void Sbar_Draw (void) fade = 3.2 - 2 * (time - weapontime); fade = bound(0.7, fade, 1); - if (cvar("viewsize") <= 100 && vid_conwidth <= 1600) { - if (teamplay) - 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"); + if(g_vore) // only when the vore system is active + { + // draw the stomach board + if (cvar("viewsize") <= 100) { + if (teamplay) + 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"); + + drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach", '256 256 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL); + } + } - drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach", '256 256 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL); + if(getstati(STAT_VORE_EATEN)) + { + 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") * sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(bottomleft - '-80 173 0', "predator:", '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } - if(getstati(STAT_STOMACH_EATEN)) - drawpic(bottomleft- '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', '1 0 0', sbar_alpha_bg, DRAWFLAG_NORMAL); else - drawpic(bottomleft- '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', '0 1 0', sbar_alpha_bg, DRAWFLAG_NORMAL); - } - float stomach_load; - stomach_load = getstati(STAT_STOMACH_LOAD); // shows the predator's stomach load when we are eaten, and ours otherwise - - Sbar_DrawXNum(bottomleft - '-18 170 0', bound(0, stomach_load, 9), 1, 0, 22, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - drawstring(bottomleft - '-40 170 0', "/", '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - 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); - if(getstati(STAT_STOMACH_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); + { + 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") * sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(bottomleft - '-80 173 0', "self:", '11 11 0', ' 1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + } - // draw the stomach board - entity pl; - float f; + float stomach_load; + stomach_load = getstati(STAT_VORE_LOAD); // shows the predator's stomach load when we are eaten, and ours otherwise - pos = bottomleft; - for(pl = players.sort_next; pl; pl = pl.sort_next) - { - if(pl.team == COLOR_SPECTATOR) - continue; + Sbar_DrawXNum(bottomleft - '-26 171 0', bound(0, stomach_load, 9), 1, 0, 22, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(bottomleft - '-41 171 0', "/", '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(bottomleft - '-50 171 0', bound(0, g_balance_vore_swallow_limit, 9), 1, 0, 22, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - if(getstati(STAT_STOMACH_EATEN)) - { - f = pl.pleater == getstati(STAT_STOMACH_EATEN); - } + 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); + + // draw the stomach board player list + entity pl; + float f; + + pos = bottomleft; + for(pl = players.sort_next; pl; pl = pl.sort_next) { - if(spectatee_status) - f = pl.pleater == spectatee_status; + if(pl.team == COLOR_SPECTATOR) + continue; + + if(getstati(STAT_VORE_EATEN)) + f = pl.plpredator == getstati(STAT_VORE_EATEN); else - f = pl.pleater == player_localentnum; - } + { + if(spectatee_status) + f = pl.plpredator == spectatee_status; + else + f = pl.plpredator == player_localentnum; + } - if(f) - { - Sbar_PrintStomachboardItem(pos - '-16 124 0', pl); - pos_y += 1.25 * sbar_fontsize_y; - } + if(f) + { + Sbar_PrintStomachboardItem(pos - '-16 124 0', pl); + pos_y += 1.1 * sbar_fontsize_y; + } - if(getstati(STAT_STOMACH_EATEN)) - if(pl.sv_entnum == getstati(STAT_STOMACH_EATEN) - 1) - Sbar_PrintStomachboardItem(bottomleft - '-76 156 0', pl); + 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 && vid_conwidth <= 1600) { + 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 { @@ -2946,29 +2984,73 @@ void Sbar_Draw (void) } } - vector health_pos; - health_pos = bottom - '77 58 0'; + vector health_pos, armor_pos; + health_pos = bottom - '60 58 0'; + armor_pos = bottom - '52.5 68 0'; + + // armor + x = armor; + if (x > 0) + { + drawpic(armor_pos + '0 -13.5 0', "gfx/hud/sb_armor", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + if(x < 100) armor_pos_x += 2.5; // always center + if(x < 10) armor_pos_x += 2.5; // always center + Sbar_DrawXNum_Colored(armor_pos, x, 12, sbar_alpha_fg); + } // health x = health; - drawpic(health_pos + '22 16 0', "gfx/hud/sb_health", '32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - if(x < 100) health_pos_x -= 9; // always center - if(x < 10) health_pos_x -= 11; // always center + drawpic(health_pos + '4.5 16 0', "gfx/hud/sb_health", '32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + if(x < 100) health_pos_x += 5; // always center + if(x < 10) health_pos_x += 5; // always center Sbar_DrawXNum_Colored(health_pos, x, 22, sbar_alpha_fg); - // fuel ammo - a = getstati(GetAmmoStat(1)); // how much fuel do we have? - - if (a > 0) { // if we have fuel, draw the amount - float invincibility_time, dt; - invincibility_time = getstatf(STAT_INVINCIBLE_FINISHED); - dt = invincibility_time - time; - pos_x = bottom_x + 140; - pos_y = bottom_y - 20; - drawpic(pos - '98 18 0', GetAmmoPicture(1), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - Sbar_DrawXNum(pos - '144 16 0', a, 3, 0, 16, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + // ammo + pos_x = bottom_x + 140; + pos_y = bottom_y - 20; + + float weapon_clipload, weapon_clipsize; + + // 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); + Sbar_DrawXNum(pos - '128 16 0', 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 + drawstring(pos - '128 23 0', "- -", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + else + Sbar_DrawXNum(pos - '128 23 0', weapon_clipload, 2, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(pos - '128 7 0', a, 3, 0, 12, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + } + else + Sbar_DrawXNum(pos - '128 16 0', 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); + // draw scores and timer Sbar_Score(); Sbar_Timer(); @@ -2983,6 +3065,16 @@ void Sbar_Draw (void) CSQC_ctf_hud(); else if(gametype == GAME_CTS || gametype == GAME_RACE) CSQC_race_hud(); + + // draw the canleave message + if(getstati(STAT_VORE_CANLEAVE)) + if not(spectatee_status) // this message doesn't address spectated players + { + s = strcat("^7Press ^3", getcommandkey("jump", "+jump"), " ^7to exit"); + pos_x = bottom_x - stringwidth(s, TRUE, '0 0 0') * 16 / 2; + pos_y = bottom_y - 120; + drawcolorcodedstring(pos, s, '16 16 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + } } return; }