From 9b67d1abcd775afc341aa0160e86a8805cc86028 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Mon, 18 Jul 2011 19:26:21 +0300 Subject: [PATCH] Revert change I made to the text coloring function. It should always be centered around 100. --- data/qcsrc/client/sbar.qc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index cb86bf75..afaee4d6 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -122,32 +122,32 @@ void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, fl drawstring(pos, final_num, vsize, rgb, alpha, dflags); } -vector Sbar_NumColor (float x, float center) +vector Sbar_NumColor (float x) { - if(x > center*2) { + if(x > 200) { color_x = 0; color_y = 1; color_z = 0; } - else if(x > center*1.5) { - color_x = 0.4 - (x-center*1.5)*0.02 * 0.4; //red value between 0.4 -> 0 - color_y = 0.9 + (x-center*1.5)*0.02 * 0.1; // green value between 0.9 -> 1 + else if(x > 150) { + color_x = 0.4 - (x-150)*0.02 * 0.4; //red value between 0.4 -> 0 + color_y = 0.9 + (x-150)*0.02 * 0.1; // green value between 0.9 -> 1 color_z = 0; } - else if(x > center*1) { - color_x = 1 - (x-center*1)*0.02 * 0.6; //red value between 1 -> 0.4 - color_y = 1 - (x-center*1)*0.02 * 0.1; // green value between 1 -> 0.9 - color_z = 1 - (x-center*1)*0.02; // blue value between 1 -> 0 + else if(x > 100) { + color_x = 1 - (x-100)*0.02 * 0.6; //red value between 1 -> 0.4 + color_y = 1 - (x-100)*0.02 * 0.1; // green value between 1 -> 0.9 + color_z = 1 - (x-100)*0.02; // blue value between 1 -> 0 } - else if(x > center*0.5) { + else if(x > 50) { color_x = 1; color_y = 1; - color_z = 0.2 + (x-center*0.5)*0.02 * 0.8; // blue value between 0.2 -> 1 + color_z = 0.2 + (x-50)*0.02 * 0.8; // blue value between 0.2 -> 1 } - else if(x > center*0.25) { + else if(x > 25) { color_x = 1; - color_y = (x-center*0.25)*90/27/100; // green value between 0 -> 1 - color_z = (x-center*0.25)*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; @@ -3034,7 +3034,7 @@ void Sbar_Draw (void) vector status_pos; string status_text, status_color; float status_size; - status_color = rgb_to_hexcolor(Sbar_NumColor(stomach_maxload, cvar("g_balance_vore_load_pred_capacity"))); + status_color = rgb_to_hexcolor(Sbar_NumColor(stomach_maxload)); if(stomach_load) { status_text = strcat(ftos(stomach_load), "^8/", status_color, ftos(stomach_maxload), "%"); @@ -3120,14 +3120,14 @@ void Sbar_Draw (void) { 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, 100), sbar_alpha_fg, DRAWFLAG_NORMAL); + 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, 100), sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(health_pos, x, 3, 0, 22, Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL); // ammo pos_x = bottom_x + 140; -- 2.39.2