X-Git-Url: http://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fclient%2Fsbar.qc;h=1f2f4ebc12729f36649a06131dbca697ba37a377;hp=9db2566f77d5ac6a276400a6eea580a685358f35;hb=8cbf6fa713ba7eb3380855c6a2746da220e10cd0;hpb=cf3ba5b1d3e30d29e0b8ac5c16957b42689a8a3a diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 9db2566f..1f2f4ebc 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -69,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; @@ -86,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; @@ -94,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; @@ -111,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) @@ -193,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); @@ -1418,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); } @@ -1699,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; @@ -1740,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] @@ -1779,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; @@ -1797,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'; } } @@ -1963,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 { @@ -1995,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() { @@ -2027,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); @@ -2049,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) { @@ -2072,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) { @@ -2903,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(); @@ -2934,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); @@ -2943,7 +2896,7 @@ void Sbar_Draw (void) fade = 3.2 - 2 * (time - weapontime); fade = bound(0.7, fade, 1); - if(g_vore) // only when the vore system is enabled + if(g_vore) // only when the vore system is active { // draw the stomach board if (cvar("viewsize") <= 100) { @@ -2962,20 +2915,20 @@ void Sbar_Draw (void) 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 172 0', "predator:", '10 10 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(bottomleft - '-80 173 0', "predator:", '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } else { 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 172 0', "self:", '10 10 0', ' 1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(bottomleft - '-80 173 0', "self:", '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 - 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); + 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_VORE_DIGESTING)) drawstring(bottomleft - '-76 142 0', "stomach digesting", '12 12 0', '1 0.5 0.5', sbar_alpha_fg, DRAWFLAG_NORMAL); @@ -3009,7 +2962,7 @@ void Sbar_Draw (void) if(f) { Sbar_PrintStomachboardItem(pos - '-16 124 0', pl); - pos_y += 1.25 * sbar_fontsize_y; + pos_y += 1.1 * sbar_fontsize_y; } if(getstati(STAT_VORE_EATEN)) @@ -3031,26 +2984,39 @@ 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); // 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 - '144 16 0', a, 3, 0, 16, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(pos - '128 16 0', a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } else { @@ -3061,7 +3027,20 @@ void Sbar_Draw (void) { 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); - Sbar_DrawXNum(pos - '144 16 0', a, 3, 0, 16, '1 1 1', 0, 0, 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); } } }