From 1057bd0054b148aeebc98e90cc05ec735f791ba4 Mon Sep 17 00:00:00 2001 From: fruitiex Date: Sun, 11 Oct 2009 08:26:05 +0000 Subject: [PATCH] ctf icon-style ping when a new personal record is set git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8090 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/client/sbar.qc | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index e22e62789..f90921180 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -3036,11 +3036,14 @@ void CSQC_nb_hud(void) drawpic(pos, "gfx/hud/sb_nexball_carrying", '80 34 0', '1 1 1', 1, DRAWFLAG_NORMAL); } +float crecordtime_prev; // last remembered crecordtime +float crecordtime_change_time; // time when crecordtime last changed void CSQC_race_hud(void) { entity me; me = (spectatee_status > 0) ? playerslots[spectatee_status - 1] : playerslots[player_localentnum - 1]; float crecordtime, score; + float f; // yet another function has this score = me.(scores[ps_primary]); string rr; @@ -3053,6 +3056,12 @@ void CSQC_race_hud(void) if(score && score < crecordtime || !crecordtime) db_put(ClientProgsDB, strcat(shortmapname, rr, "time"), ftos(score)); + if(crecordtime != crecordtime_prev) { + crecordtime_prev = crecordtime; + crecordtime_change_time = time; + } + f = time - crecordtime_change_time; + vector pos; pos_x = 2; pos_y = vid_conheight - 48; @@ -3061,7 +3070,18 @@ void CSQC_race_hud(void) pmin = floor(crecordtime/(60 * TIME_FACTOR)); psec = floor((crecordtime - pmin*(60 * TIME_FACTOR))/TIME_FACTOR); pmsec = crecordtime - pmin*60*TIME_FACTOR - psec*TIME_FACTOR; + drawfont = sbar_bigfont; - drawstring(pos, "Personal best ", '10 10 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - drawstring(pos + '0 10 0', strcat(ftos(pmin),":", ftos(psec),":",ftos(pmsec)),'14 14 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + if (f > 1) { + drawstring(pos, "Personal best ", '10 10 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(pos + '0 10 0', strcat(ftos(pmin),":", ftos(psec),":",ftos(pmsec)),'14 14 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + } else { + drawstring(pos, "Personal best ", '10 10 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(pos + '0 10 0', strcat(ftos(pmin),":", ftos(psec),":",ftos(pmsec)),'14 14 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + + // expanding + drawstring(pos - '0 50 0' * f, "Personal best ", '10 10 0' + '30 30 0' * f, '1 1 1', sbar_alpha_fg * (1 - f), DRAWFLAG_NORMAL); + drawstring(pos + '0 10 0' - '0 30 0' * f, strcat(ftos(pmin),":", ftos(psec),":",ftos(pmsec)),'14 14 0' + '42 42 0' * f, '1 1 1', sbar_alpha_fg * (1 - f), DRAWFLAG_NORMAL); + } + drawfont = sbar_font; } -- 2.39.2