X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=data%2Fqcsrc%2Fclient%2Fsbar.qc;h=73b6ee56dc5aedf20ede16f39f7a962e44e95993;hb=c185c5684681e7b63eb5ec6d5ef7da35a0b9d5d3;hp=bb210996291e90e185ffd6bfd3ef1ab98e3e8bd7;hpb=fc9d4e9e9407d9001ffa721bf91ca0252d999eac;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index bb210996..73b6ee56 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 = 100; void CSQC_kh_hudreset(); void CSQC_kh_hud(); @@ -509,14 +508,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) @@ -968,10 +968,10 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) // row highlighting if(field == ST_HIGHLIGHT) { - if(getstati(STAT_STOMACH_EATEN)) - drawfill(pos - '0 0 0', '193 11 0', stov(cvar_string("sbar_stomachboard_color2")), cvar("sbar_stomachboard_highlight_alpha"), DRAWFLAG_NORMAL); + 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"), DRAWFLAG_NORMAL); + 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) { @@ -985,7 +985,7 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) } if(field == ST_HEALTH) - if(g_vore_showpreyhealth) { + 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); @@ -1003,7 +1003,7 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) float fieldcounter2; void Sbar_PrintStomachboardItemPred(vector pos, entity pl) { - // shows the name of our eater + // shows the name of our predator string str; float f, field, field_number; @@ -1384,7 +1384,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; @@ -1396,7 +1396,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; @@ -1477,7 +1480,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); @@ -1490,7 +1496,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"); @@ -2397,17 +2403,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; @@ -2422,7 +2428,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); @@ -2448,11 +2454,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) { @@ -2464,7 +2470,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; @@ -2514,7 +2520,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; @@ -2631,7 +2639,7 @@ vector stomachstatus_colorfade_current; vector StomachStatus_ColorFade(vector target_color) { local float step; - step = cvar("sbar_stomachboard_status_fade"); + step = cvar("sbar_stomachboard_status_fade") * frametime; if(stomachstatus_colorfade_current_x >= target_color_x + step) stomachstatus_colorfade_current_x -= step; @@ -2904,9 +2912,7 @@ void Sbar_Draw (void) Sbar_Score(); Sbar_Timer(); } - else - Sbar_FinaleOverlay(); - + Sbar_FinaleOverlay(); Sbar_Reset(); } else if (sb_showscores_force || getstati(STAT_HEALTH) <= 0 || intermission == 1) @@ -2935,76 +2941,79 @@ void Sbar_Draw (void) fade = 3.2 - 2 * (time - weapontime); fade = bound(0.7, fade, 1); - // 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); - } - } - - if(getstati(STAT_STOMACH_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"), DRAWFLAG_NORMAL); - drawstring(bottomleft - '-80 172 0', "predator:", '10 10 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - } - else + if(g_vore) // only when the vore system is active { - 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"), DRAWFLAG_NORMAL); - drawstring(bottomleft - '-80 172 0', "self:", '10 10 0', ' 1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - } + // 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); + } + } - float stomach_load; - stomach_load = getstati(STAT_STOMACH_LOAD); // shows the predator's stomach load when we are eaten, and ours otherwise + 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); + } + 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); + } - 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); + float stomach_load; + stomach_load = getstati(STAT_VORE_LOAD); // shows the predator's stomach load when we are eaten, and ours otherwise - 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); + 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); - // draw the stomach board player list - entity pl; - float f; + 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); - pos = bottomleft; - for(pl = players.sort_next; pl; pl = pl.sort_next) - { - if(pl.team == COLOR_SPECTATOR) - continue; + // draw the stomach board player list + entity pl; + float f; - if(getstati(STAT_STOMACH_EATEN)) - f = pl.pleater == getstati(STAT_STOMACH_EATEN); - else + 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.25 * sbar_fontsize_y; + } - if(getstati(STAT_STOMACH_EATEN)) - if(pl.sv_entnum == getstati(STAT_STOMACH_EATEN) - 1) - Sbar_PrintStomachboardItemPred(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) { @@ -3075,6 +3084,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; }