X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fclient%2Fsbar.qc;h=a8ba383336698978a9daaf9efd32e96a518bf2cd;hb=2a22fb7e4b83c62121f8fbb2038174ed368c7ca7;hp=303b9978e1fbe461f4d63f464015d2c4acfed3dd;hpb=222dfbe60dee579af84fc39de11523fd548644df;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 303b9978..a8ba3833 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -29,7 +29,7 @@ float ps_primary, ps_secondary; float ts_primary, ts_secondary; vector color; -float SCOREBOARD_OFFSET = 50; +float SCOREBOARD_OFFSET = cvar("sbar_scoreboard_offset"); void CSQC_kh_hudreset(); void CSQC_kh_hud(); @@ -963,9 +963,6 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter) { field = -fieldcounter; - if(field == SP_SEPARATOR) - break; - str = Sbar_GetStomachField(pl, field); // row highlighting @@ -984,7 +981,7 @@ 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) @@ -1015,9 +1012,6 @@ void Sbar_PrintStomachboardItemPred(vector pos, entity pl) for(fieldcounter2 = 1; fieldcounter2 <= field_number; ++fieldcounter2) { field = -fieldcounter2; - if(field == SP_SEPARATOR) - break; - str = Sbar_GetStomachFieldPred(pl, field); if(field == STP_NAME) { @@ -1027,7 +1021,7 @@ void Sbar_PrintStomachboardItemPred(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, 122, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); } } } @@ -2591,7 +2585,7 @@ float GetAmmoStat(float i) { switch(i) { - case 1: return STAT_FUEL; + case 0: return STAT_FUEL; default: return -1; } } @@ -2600,7 +2594,7 @@ float GetAmmoItemCode(float i) { switch(i) { - case 1: return IT_FUEL; + case 0: return IT_FUEL; default: return -1; } } @@ -2609,7 +2603,7 @@ string GetAmmoPicture(float i) { switch(i) { - case 1: return "gfx/hud/sb_fuel"; + case 0: return "gfx/hud/sb_fuel"; default: return ""; } } @@ -3036,18 +3030,36 @@ void Sbar_Draw (void) if(x < 10) health_pos_x -= 11; // always center Sbar_DrawXNum_Colored(health_pos, x, 22, sbar_alpha_fg); - // fuel ammo - a = getstati(GetAmmoStat(1)); // how much fuel do we have? + // ammo + pos_x = bottom_x + 140; + pos_y = bottom_y - 20; - 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); + // 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); } + 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); + Sbar_DrawXNum(pos - '144 16 0', a, 3, 0, 16, '1 1 1', 0, 0, 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();