From c989f68e43775ed0a21e0827cae06b9eb78c883c Mon Sep 17 00:00:00 2001 From: div0 Date: Tue, 14 Jul 2009 05:37:16 +0000 Subject: [PATCH] race HUD git-svn-id: svn://svn.icculus.org/nexuiz/trunk@7219 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/build-compat-pack.sh | 1 + data/gfx/hud/num_dot.tga | Bin 0 -> 3034 bytes data/gfx/hud/num_dot_stroke.tga | Bin 0 -> 1433 bytes data/qcsrc/client/sbar.qc | 193 ++++++++++++++++++++++---------- 4 files changed, 135 insertions(+), 59 deletions(-) create mode 100644 data/gfx/hud/num_dot.tga create mode 100644 data/gfx/hud/num_dot_stroke.tga diff --git a/data/build-compat-pack.sh b/data/build-compat-pack.sh index 5c3458599..3fde39842 100755 --- a/data/build-compat-pack.sh +++ b/data/build-compat-pack.sh @@ -57,6 +57,7 @@ COMPAT_FILES=" gfx/hud/num_9.tga gfx/hud/num_colon_stroke.tga gfx/hud/num_colon.tga + gfx/hud/num_dot.tga gfx/hud/num_minus_stroke.tga gfx/hud/num_minus.tga gfx/hud/num_plus_stroke.tga diff --git a/data/gfx/hud/num_dot.tga b/data/gfx/hud/num_dot.tga new file mode 100644 index 0000000000000000000000000000000000000000..7fbfdd041850867fde2b109dfd0ac0a51f091e51 GIT binary patch literal 3034 zcmb`J?@yIw7{{;Y90CrQ+EJ{`l1yf;ELsLFS3?UMrqC#zn_FQ~!Df@Gu^MSU=ZG5; zBBmHQ@`bvosgtEn9nK$9rZQye)Q~CT59p2mz|;40A09e7^;K@4``pj{5mAvL_|6j9BF3&9Mq(o) z%<#=hc0^d=ZBb+GH13nFm<-MFohzOc<3(IdVC6(+CX9?Q!wO<$Jd{aEY}SZvqZySz z{|Uk3F#-b<#j|3Hm`dQ&n4LN@@{E32!Acxr4ht?jUaNZMvg0K10}1?~KThO{=fpJe zvUp9rDQ2MZxt;fDG>fvgu;|szIcQ%EA0?t_Vnm)R|oXV%gcug3k!Q=vDjZ)yFqXaBzu|oM7%F%ipL~7tZY)j zS;QL}8aAw3x9(nZb92zy*%=%?dNeq3;zV%f%$eZw<;(8(@ZrO5uCcK(sIIR5CoeB= zr}k3iL`<%zZY~%1db|iPR$97|^90AA-PP5#^U$F~PVUsHQ$bHpkCVH2@nUe{!i6A- z_85Bm_wNsq$z)JeRKyEiD!9!Q6|VrfqiXKIO1?%?PjDtZ5#76Y?~J~_KBv^%+w0Vt z=;X+kK%w2!Dr$~PiseaSoFEj^#fhcDQD@|pZ=>tPyz}SJf7IXKA8f>?;l58Vd)KaA zffiBG+++O3D%rrds7O6}VQx|{ue0oKiWWq!UcK5Uf-6_91RIGWi=G_crdb^2nIH`~ zi`fk4RI7SUA-wM{hAoV`yvXPH_3PLF6v4G?*8(JnVLjH3p3hLG3Icl^EF$<$zHu+* z?Pm3y5ak?BdECuZb|O-mE_**prQ1g?fnJQB!a1#K`&ku8@p4f^0n$!_Qvct%l<G82ut5#W4Qi^|)@NXJyW8nb$@%O%Cx?fJ xErTQ;KYrYf9XsY6(`%JF&c~O||2WH0@$a+BMWu_&J}s*#pSfgS*@Dv7?O)P(Sp)z8 literal 0 HcmV?d00001 diff --git a/data/gfx/hud/num_dot_stroke.tga b/data/gfx/hud/num_dot_stroke.tga new file mode 100644 index 0000000000000000000000000000000000000000..29ad696ac5270e825fd9b1f6c1d5dff601b5f365 GIT binary patch literal 1433 zcmbtUO=}Zj5T4y06c3hyy@^;n7KI#3FUg@wKw9cY@gjKWJ%`YX&_i1rl~AkACh0;; z590oS_6M|(qloAHfsl~z@9)HUX0jXWO%2S;J2TJByfgD;iEfem^OK+M-@F`;$Mipk zO>{vsnM`J$CCIYH;_UH}hSgz#1)g~u#gYgxSlwhvM)^oXi?eJb0f@T*ADhk(e+S%& z17Nv;RrdY-;sU<$<$(o2ET7LyiMs&21Hdd6i*~tO4%KS4z#c$mwOS37N~I8kZNU%& zziNU)p+Hc>(uh&1RJL2K*4#$~8k}N*0k-&n+Kfq6Hz>7>io^kL4&WfJ9aS4Uk^(+r zn^d@`4t~VdCjq052mXE?ysQrH!#M<4UZ4=}MDpFxSM~dSpB8U6n;|csqc7zI0*;8o z$Y!%Yy4~)2R36Z1G`79g!q)?y=rHkGz`vyZm_^3!Pw~)%WX+u@dTyf+xIdX zRNO%ugj)nQH^46&i1T(N;Pq$MdCnJ~5Fo)DAd}TamM}}oqfrVLp^;s$*9EjR0Xh48 zNh8deSeAs4rvPG&vpak&%k30Rop3{hAUc71%#)-8sK-zfyeI zm6!{pTtJN}*TfALcw{9qLJRrucdx$gHKl;(JwA(y^R0> literal 0 HcmV?d00001 diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 0c65f6629..61e1c1b10 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -1249,7 +1249,9 @@ string MakeRaceString(float cp, float mytime, float histime, float lapdelta, str void Sbar_Score(float margin) { float timelimit, minutes, seconds, timeleft, minutesLeft, secondsLeft, distribution, score, desiredPlayerId; - vector sbar_save, score_offset, timer_color, offset; + float racemin, racesec, racemsec; + float distsec, distmsec; + vector sbar_save, score_offset, timer_color, offset, distribution_color, minuspos; entity tm, pl, me; sbar_save = sbar; @@ -1285,78 +1287,151 @@ void Sbar_Score(float margin) } score_offset_z = 0; - if(teamplay) + if((scores_flags[ps_primary] & SFL_TIME) && !teamplay) { - // Layout: - // - // team1 team3 team4 - // - // TEAM2 - //for(i = 0; i < 4; ++i) + // me vector := [team/connected frags id] - float max_fragcount; - max_fragcount = -999; + pl = players.sort_next; + if(pl == me) + pl = pl.sort_next; + if(scores_flags[ps_primary] & SFL_ZERO_IS_WORST) + if(pl.scores[ps_primary] == 0) + pl = world; - for(tm = teams.sort_next; tm; tm = tm.sort_next) + score = me.(scores[ps_primary]); + + racemin = floor(score/600); + racesec = floor((score - racemin*600)/10); + racemsec = score - racemin*600 - racesec*10; + + if (pl && ((!(scores_flags[ps_primary] & SFL_ZERO_IS_WORST)) || score)) { + + // distribution display + distribution = me.(scores[ps_primary]); + distribution -= pl.(scores[ps_primary]); + + if (distribution < 10 && distribution > -10) + distmsec = fabs(distribution); + else { + distsec = floor(fabs(distribution)/10); + distmsec = fabs(distribution) - distsec*10; + } + + if (distribution < 100 && distribution > -100) + minuspos = bottomright - element_offset - score_offset + '130 -6 0' + '16 0 0'; + else if (distribution < 1000 && distribution > -1000) + minuspos = bottomright - element_offset - score_offset + '130 -6 0'; + else if (distribution < 10000 && distribution > -10000) + minuspos = bottomright - element_offset - score_offset + '130 -6 0' - '16 0 0'; + else + minuspos = bottomright - element_offset - score_offset + '130 -6 0' - '32 0 0'; + + if (distribution <= 0) { + distribution_color = '0 1 0'; + drawpic(minuspos, "gfx/hud/num_minus", '16 16 0', distribution_color, sbar_alpha_fg, DRAWFLAG_ADDITIVE); + } + else { + distribution_color = '1 0 0'; + drawpic(minuspos, "gfx/hud/num_plus", '16 16 0', distribution_color, sbar_alpha_fg, DRAWFLAG_ADDITIVE); + } + + Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distmsec, 4, 16, distribution_color, 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(bottomright - element_offset - score_offset + '112 -6 0', distsec, 4, 16, distribution_color, 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(bottomright - element_offset - score_offset + '170 -6 0', "gfx/hud/num_dot", '16 16 0', distribution_color, sbar_alpha_fg, DRAWFLAG_ADDITIVE); + } + if (distribution <= 0 || distribution == score) // draw the highlight background behind the timer if we have the lead + drawpic(bottomright - element_offset - score_offset + '20 10 0', "gfx/hud/sb_highlight_4", '178 28 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + + // big timer + Sbar_DrawXNum(bottomright - element_offset - score_offset + '76 10 0', racemsec, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(bottomright - element_offset - score_offset + '36 10 0', racesec, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + if (racesec < 10) + Sbar_DrawXNum(bottomright - element_offset - score_offset + '8 10 0', 0, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(bottomright - element_offset - score_offset + '145 10 0', "gfx/hud/num_dot", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); + + if (racemin < 10) { + Sbar_DrawXNum(bottomright - element_offset - score_offset + '-36 10 0', racemin, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(bottomright - element_offset - score_offset + '-66 10 0', 0, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + } + else { + Sbar_DrawXNum(bottomright - element_offset - score_offset + '-36 10 0', racemin, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + } + drawpic(bottomright - element_offset - score_offset + '76 8 0', "gfx/hud/num_colon", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); + } + else { + if(teamplay) { - if(tm.team == COLOR_SPECTATOR || !tm.team_size) // no players? don't display - continue; - // -32*4 = -128 - score = tm.(teamscores[ts_primary]); + // Layout: + // + // team1 team3 team4 + // + // TEAM2 + //for(i = 0; i < 4; ++i) - if (score > max_fragcount) - max_fragcount = score; + float max_fragcount; + max_fragcount = -999; - if(tm.team == myteam) { - if (max_fragcount == score) - Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 1, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); - else - Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 0, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); - } - else + for(tm = teams.sort_next; tm; tm = tm.sort_next) { - if (max_fragcount == score) - Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0' - offset, score, 4, 16, GetTeamRGB(tm.team) * 0.8, 1, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); + if(tm.team == COLOR_SPECTATOR || !tm.team_size) // no players? don't display + continue; + // -32*4 = -128 + score = tm.(teamscores[ts_primary]); + + if (score > max_fragcount) + max_fragcount = score; + + if(tm.team == myteam) { + if (max_fragcount == score) + Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 1, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); + else + Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 0, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); + } else - Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0' - offset, score, 4, 16, GetTeamRGB(tm.team) * 0.8, 0, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); - offset_y -= 16; + { + if (max_fragcount == score) + Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0' - offset, score, 4, 16, GetTeamRGB(tm.team) * 0.8, 1, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); + else + Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0' - offset, score, 4, 16, GetTeamRGB(tm.team) * 0.8, 0, 1, sbar_alpha_fg, DRAWFLAG_NORMAL); + offset_y -= 16; + } } - } - } else { - // me vector := [team/connected frags id] + } else { + // me vector := [team/connected frags id] - pl = players.sort_next; - if(pl == me) - pl = pl.sort_next; + pl = players.sort_next; + if(pl == me) + pl = pl.sort_next; - if(pl) { - distribution = me.(scores[ps_primary]); - distribution -= pl.(scores[ps_primary]); - } else - distribution = 0; + if(pl) { + distribution = me.(scores[ps_primary]); + distribution -= pl.(scores[ps_primary]); + } else + distribution = 0; - score = me.(scores[ps_primary]); + score = me.(scores[ps_primary]); - if(distribution >= 0) - { - if (distribution != 0) { - // draw a + sign in front of the score - if (distribution < 10) { drawpic(bottomright - element_offset - score_offset + '132 -6 0' + '32 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } - else if (distribution < 100) { drawpic(bottomright - element_offset - score_offset + '132 -6 0' + '16 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } - else if (distribution < 1000) { drawpic(bottomright - element_offset - score_offset + '132 -6 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } - } + if(distribution >= 0) + { + if (distribution != 0) { + // draw a + sign in front of the score + if (distribution < 10) { drawpic(bottomright - element_offset - score_offset + '132 -6 0' + '32 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } + else if (distribution < 100) { drawpic(bottomright - element_offset - score_offset + '132 -6 0' + '16 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } + else if (distribution < 1000) { drawpic(bottomright - element_offset - score_offset + '132 -6 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } + } - Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 1 1', 1, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - } - else if(distribution >= -5) - { - Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 1 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 1 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - } - else { - Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 0 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); - Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 0 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 1 1', 1, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + } + else if(distribution >= -5) + { + Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 1 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 1 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + } + else { + Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 0 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 0 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + } } } -- 2.39.2