]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
changed weapons bar in nexuiz hud to use alpha rather than additive
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 18 Apr 2007 06:20:32 +0000 (06:20 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 18 Apr 2007 06:20:32 +0000 (06:20 +0000)
blend, and have full opacity for 1 second and then fade over half a second

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7121 d7cf8633-e32d-0410-b094-e92efae38249

sbar.c

diff --git a/sbar.c b/sbar.c
index af30d244691b2aefd51801b9715b788e95df5025..c660db8833cc24f81db406d12a284cff6013728a 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -715,11 +715,8 @@ static void Sbar_DrawWeapon(int nr, float fade, int active)
        const int w_width = 300, w_height = 100, w_space = 10;
        const float w_scale = 0.4;
 
-       DrawQ_Pic(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, sb_weapons[0][nr], w_width * w_scale, w_height * w_scale, (active) ? 1 : 0.6, active ? 1 : 0.6, active ? 1 : 1, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
+       DrawQ_Pic(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, sb_weapons[0][nr], w_width * w_scale, w_height * w_scale, (active) ? 1 : 0.6, active ? 1 : 0.6, active ? 1 : 1, fade * sbar_alpha_fg.value, DRAWFLAG_NORMAL);
        //DrawQ_String(vid_conwidth.integer - (w_space + font_size ), (w_height + w_space) * w_scale * nr + w_space, va("%i",nr+1), 0, font_size, font_size, 1, 0, 0, fade, 0, NULL, true);
-
-       if (active)
-               DrawQ_Fill(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, w_width * w_scale, w_height * w_scale, 0.3, 0.3, 0.3, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
 }
 
 /*
@@ -1157,15 +1154,14 @@ void Sbar_Draw (void)
                        else if (sb_lines)
                        {
                                int i;
-                               double time;
                                float fade;
                                int redflag, blueflag;
 
-                               // we have a max time 2s (min time = 0)
-                               if ((time = max(0, cl.time - cl.weapontime)) < 2)
+                               // calculate intensity to draw weapons bar at
+                               fade = 3 - 2 * (cl.time - cl.weapontime);
+                               if (fade > 0)
                                {
-                                       fade = (1.0 - 0.5 * time);
-                                       fade *= fade;
+                                       fade = min(fade, 1);
                                        for (i = 0; i < 8;i++)
                                                if (cl.stats[STAT_ITEMS] & (1 << i))
                                                        Sbar_DrawWeapon(i + 1, fade, (i + 2 == cl.stats[STAT_ACTIVEWEAPON]));