add revive progress indicator to hud
authorFruitieX <fruitiex@gmail.com>
Tue, 16 Nov 2010 19:40:06 +0000 (21:40 +0200)
committerFruitieX <fruitiex@gmail.com>
Tue, 16 Nov 2010 19:40:06 +0000 (21:40 +0200)
defaultXonotic.cfg
qcsrc/client/View.qc
qcsrc/common/constants.qh
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/mutators/gamemode_freezetag.qc

index 583b5a3..61f8800 100644 (file)
@@ -216,6 +216,7 @@ seta crosshair_fireball_color_blue 0.2      "crosshair color blue component to displa
 seta crosshair_fireball_alpha 1        "crosshair alpha value to display when wielding the fireball"
 seta crosshair_fireball_size 1 "crosshair size when wielding the fireball"
 seta crosshair_ring_size 2     "bullet counter ring size for Rifle, velocity ring for Nex"
+seta crosshair_ring_alpha 0.2  "ring alpha"
 seta crosshair_campingrifle_bulletcounter_alpha 0.15
 
 seta crosshair_nexvelocity_alpha 0.15
index b3bb787..09061eb 100644 (file)
@@ -696,8 +696,15 @@ void CSQC_UpdateView(float w, float h)
        else
        {
                if(gametype == GAME_FREEZETAG)
+               {
                        if(getstati(STAT_FROZEN))
                                drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, '0.25 0.90 1', cvar_or("hud_colorflash_alpha", 0.5), DRAWFLAG_ADDITIVE);
+                       if(getstatf(STAT_REVIVE_PROGRESS))
+                       {
+                               DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_REVIVE_PROGRESS), '0.25 0.90 1', cvar("hud_colorflash_alpha"), DRAWFLAG_ADDITIVE);
+                               drawstring_aspect(eY * 0.64 * vid_conheight, "Revival progress", eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
+                       }
+               }
 
                if(cvar("r_letterbox") == 0)
                        if(cvar("viewsize") < 120)
index c072213..442f70c 100644 (file)
@@ -347,6 +347,7 @@ const float STAT_PINKALIVE = 103;
 
 // freeze tag
 const float STAT_FROZEN = 104;
+const float STAT_REVIVE_PROGRESS = 105;
 
 //const float STAT_SPIDERBOT_AIM     53 // compressShotOrigin
 //const float STAT_SPIDERBOT_TARGET  54 // compressShotOrigin
index 31f103e..c5a20b3 100644 (file)
@@ -664,3 +664,4 @@ float serverflags;
 
 .float freezetag_frozen;
 .float freezetag_beginrevive_time;
+.float freezetag_revive_progress;
index 126a6e7..9d6524a 100644 (file)
@@ -817,7 +817,10 @@ void spawnfunc_worldspawn (void)
                addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
        }
        if(g_freezetag)
+       {
                addstat(STAT_FROZEN, AS_INT, freezetag_frozen);
+               addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, freezetag_revive_progress);
+       }
 
        // g_movementspeed hack
        addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw);
index bcb7e3e..3e5deb2 100644 (file)
@@ -179,9 +179,13 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink)
                if(self.freezetag_beginrevive_time == -9999)
                {
                        self.freezetag_beginrevive_time = time;
+                       self.freezetag_revive_progress = 0;
+                       other.freezetag_revive_progress = 0;
                }
                else
                {
+                       self.freezetag_revive_progress = (time - self.freezetag_beginrevive_time) / cvar("g_freezetag_revive_time");
+                       other.freezetag_revive_progress = (time - self.freezetag_beginrevive_time) / cvar("g_freezetag_revive_time");
                        if(time - self.freezetag_beginrevive_time >= cvar("g_freezetag_revive_time"))
                        {
                                freezetag_Unfreeze();
@@ -191,12 +195,16 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink)
                                bprint("^7", other.netname, "^5 revived ^7", self.netname, ".\n");
 
                                self.freezetag_beginrevive_time = -9999;
+                               self.freezetag_revive_progress = 0;
+                               other.freezetag_revive_progress = 0;
                        }
                }
        }
        else
        {
                self.freezetag_beginrevive_time = -9999;
+               self.freezetag_revive_progress = 0;
+               other.freezetag_revive_progress = 0;
        }
 
        return 1;