r5793 - in trunk/data: gfx qcsrc/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Feb 7 04:59:17 EST 2009
Author: div0
Date: 2009-02-07 04:59:05 -0500 (Sat, 07 Feb 2009)
New Revision: 5793
Modified:
trunk/data/gfx/sb_invinc.tga
trunk/data/gfx/sb_str.tga
trunk/data/qcsrc/client/miscfunctions.qc
trunk/data/qcsrc/client/sbar.qc
Log:
better graphics for strength and invisible timer; now also indicates 5s or less
Modified: trunk/data/gfx/sb_invinc.tga
===================================================================
(Binary files differ)
Modified: trunk/data/gfx/sb_str.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/client/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/client/miscfunctions.qc 2009-02-07 08:51:07 UTC (rev 5792)
+++ trunk/data/qcsrc/client/miscfunctions.qc 2009-02-07 09:59:05 UTC (rev 5793)
@@ -432,3 +432,50 @@
vec_y *= vid_conheight / vid_height;
return vec;
}
+
+void dummyfunction(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8)
+{
+}
+
+float expandingbox_sizefactor_from_fadelerp(float fadelerp)
+{
+ return 1.2 / (1.2 - fadelerp);
+}
+
+vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor)
+{
+ boxsize_x *= boxxsizefactor; // easier interface for text
+ return boxsize * (0.5 * (1 - sz));
+}
+
+void drawpic_expanding(vector position, string pic, vector scale, vector rgb, float alpha, float flag, float fadelerp)
+{
+ float sz;
+ sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
+
+ drawpic(position + expandingbox_resize_centered_box_offset(sz, scale, 1), pic, scale * sz, rgb, alpha * (1 - fadelerp), flag);
+}
+
+void drawpic_expanding_two(vector position, string pic, vector scale, vector rgb, float alpha, float flag, float fadelerp)
+{
+ drawpic_expanding(position, pic, scale, rgb, alpha, flag, fadelerp);
+ drawpic(position, pic, scale, rgb, alpha * fadelerp, flag);
+}
+
+void drawstring_expanding(vector position, string text, vector scale, vector rgb, float alpha, float flag, float fadelerp)
+{
+ float sz;
+ sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
+
+ dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
+ drawstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, FALSE)), text, scale * sz, rgb, alpha * (1 - fadelerp), flag);
+}
+
+void drawcolorcodedstring_expanding(vector position, string text, vector scale, float alpha, float flag, float fadelerp)
+{
+ float sz;
+ sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
+
+ dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
+ drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, TRUE)), text, scale * sz, alpha * (1 - fadelerp), flag);
+}
Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc 2009-02-07 08:51:07 UTC (rev 5792)
+++ trunk/data/qcsrc/client/sbar.qc 2009-02-07 09:59:05 UTC (rev 5793)
@@ -1099,10 +1099,6 @@
return strcat(col, cpname, " (", timestr, " ", strcat(hisname, col, lapstr), ")");
}
-void dummyfunction(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8)
-{
-}
-
void Sbar_Score(float margin)
{
float timelimit, minutes, seconds, timeleft, minutesLeft, secondsLeft, distribution, myplace, score;
@@ -1273,10 +1269,8 @@
if(forcetime != "")
{
- float sz;
- a = bound(0, 1 - 2 * (time - race_checkpointtime), 1);
- sz = 1.2 / (a + 0.2);
- drawstring(m - '0 0 0' - '0 16 0' * (sz - 1) - '16 0 0' * sz * stringwidth(forcetime, FALSE), forcetime, '32 32 0' * sz, '1 1 1', sbar_alpha_fg * a, 0);
+ a = bound(0, (time - race_checkpointtime) / 0.5, 1);
+ drawstring_expanding(m - '0 16 0' - '16 0 0' * stringwidth(forcetime, FALSE), forcetime, '32 32 0', '1 1 1', sbar_alpha_fg, 0, a);
a = 1 - a;
}
else
@@ -1448,7 +1442,7 @@
}
void CSQC_Strength_Timer() {
- float stat_items;
+ float stat_items, dt;
stat_items = getstati(STAT_ITEMS);
if not(stat_items & IT_STRENGTH)
if not(stat_items & IT_INVINCIBLE)
@@ -1478,24 +1472,45 @@
pos_z = number_position_z = 0;
//strength
- if (stat_items & IT_STRENGTH) {
- drawpic(pos, "gfx/sb_str", picsize, '0 0.086 0.953'/*strength color*/, sbar_alpha_fg, DRAWFLAG_NORMAL);
- strength_time = getstatf(STAT_STRENGTH_FINISHED) - time;
- if (strength_time > 0) { //show countdown once we received the valid stats-value
- Sbar_DrawXNum(number_position, ceil(strength_time), 2, countdown_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+ strength_time = getstatf(STAT_STRENGTH_FINISHED);
+ invincibility_time = getstatf(STAT_INVINCIBLE_FINISHED);
+
+ if (strength_time) {
+ dt = strength_time - time;
+ if(dt > 0)
+ {
+ if(dt < 5)
+ {
+ drawpic_expanding_two(pos, "gfx/sb_str", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,
+ bound(0, (ceil(dt) - dt) / 0.5, 1));
+ }
+ else
+ {
+ drawpic(pos, "gfx/sb_str", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);
+ }
+ Sbar_DrawXNum(number_position, ceil(dt), 2, countdown_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
}
-
- //add some margin to the invincibility icon
- pos_y += picsize_y + 10;
- number_position_y += picsize_y + 10;
}
+ //add some margin to the invincibility icon
+ pos_y += picsize_y + 10;
+ number_position_y += picsize_y + 10;
+
//invincibility
- if (stat_items & IT_INVINCIBLE) {
- drawpic(pos, "gfx/sb_invinc", picsize, '0.976 0 0.165'/*invincibility color*/, sbar_alpha_fg, DRAWFLAG_NORMAL);
- invincibility_time = getstatf(STAT_INVINCIBLE_FINISHED) - time;
- if (invincibility_time > 0) { //show countdown once we received the valid stats-value
- Sbar_DrawXNum(number_position, ceil(invincibility_time), 2, countdown_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+ if (invincibility_time) {
+ dt = invincibility_time - time;
+ if(dt > 0)
+ {
+ if(dt < 5)
+ {
+ drawpic_expanding_two(pos, "gfx/sb_invinc", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,
+ bound(0, (ceil(dt) - dt) / 0.5, 1));
+ }
+ else
+ {
+ drawpic(pos, "gfx/sb_invinc", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);
+ }
+ Sbar_DrawXNum(number_position, ceil(dt), 2, countdown_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
}
}
}
More information about the nexuiz-commits
mailing list