]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
CA modicon panel
authorFruitieX <rasse@rasse-laptop.(none)>
Sat, 23 Oct 2010 16:53:59 +0000 (19:53 +0300)
committerFruitieX <rasse@rasse-laptop.(none)>
Sat, 23 Oct 2010 16:53:59 +0000 (19:53 +0300)
qcsrc/client/hud.qc
qcsrc/common/constants.qh
qcsrc/server/arena.qc
qcsrc/server/g_world.qc

index 357f8a0e3502a726436461bc9163bf0b861e459f..966fdb3857214a2508a927de7863ee5dc786c208 100644 (file)
@@ -3859,6 +3859,35 @@ void HUD_VoteWindow(void)
 
 float mod_active; // is there any active mod icon?
 
+// Clan Arena HUD modicons
+void HUD_Mod_CA(vector pos, vector mySize)
+{
+       mod_active = 1; // CA should never hide the mod icons panel
+       float redalive, bluealive;
+       redalive = getstati(STAT_REDALIVE);
+       bluealive = getstati(STAT_BLUEALIVE);
+
+       vector redpos, bluepos;
+       if(mySize_x > mySize_y)
+       {
+               redpos = pos;
+               bluepos = pos + eX * 0.5 * mySize_x;
+               drawpic_aspect_skin(redpos, "player_red.tga", 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(redpos + eX * 0.5 * mySize_x, ftos(redalive), 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawpic_aspect_skin(bluepos, "player_blue.tga", 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(bluepos + eX * 0.5 * mySize_x, ftos(bluealive), 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       }
+       else
+       {
+               redpos = pos;
+               bluepos = pos + eY * 0.5 * mySize_y;
+               drawpic_aspect_skin(redpos, "player_red.tga", eX * mySize_x + eY * 0.3 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(redpos + eY * 0.3 * mySize_y, ftos(redalive), eX * mySize_x + eY * 0.2 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawpic_aspect_skin(bluepos, "player_blue.tga", eX * mySize_x + eY * 0.3 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(bluepos + eY * 0.3 * mySize_y, ftos(bluealive), eX * mySize_x + eY * 0.2 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       }
+}
+
 // CTF HUD modicon section
 float redflag_prevframe, blueflag_prevframe; // status during previous frame
 float redflag_prevstatus, blueflag_prevstatus; // last remembered status
@@ -4392,6 +4421,8 @@ void HUD_ModIcons(void)
                HUD_Mod_NexBall(pos, mySize);
        else if(gametype == GAME_CTS || gametype == GAME_RACE)
                HUD_Mod_Race(pos, mySize);
+       else if(gametype == GAME_CA)
+               HUD_Mod_CA(pos, mySize);
 }
 
 // Draw pressed keys (#11)
index 6f0eccfafb8af72f94a556ad5709a0554c0ccfab..db802cd46b662293673b96baa592c678d90ad605 100644 (file)
@@ -310,6 +310,8 @@ const float STAT_SHOTORG = 46; // compressShotOrigin
 const float STAT_LEADLIMIT = 47;
 const float STAT_BULLETS_LOADED = 48;
 const float STAT_NEX_CHARGE = 49;
+const float STAT_REDALIVE = 50;
+const float STAT_BLUEALIVE = 51;
 
 // see DP source, quakedef.h
 const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222;
index a6aea0a21278dc7915a64f713df89505e13cd5e9..6b22df6f2ae686904dcf344c15692156e305ff70 100644 (file)
@@ -262,6 +262,7 @@ void Arena_Warmup()
 
 float next_round;
 float stopalivecheck;
+float redalive, bluealive;
 /**
  * This function finds out whether an arena round is over 1 player is left.
  * It determines the last player who's still alive and saves it's entity reference
@@ -283,7 +284,7 @@ void Spawnqueue_Check()
                }
                // this is STUPID to perform again, but has to be done so that we can give instant feedback when a round ends
                // and so the code won't start searching for a champion using find() before all players are actually REMOVED
-               float redalive, bluealive;
+               redalive = 0; bluealive = 0;
                FOR_EACH_PLAYER(self) {
                        if (self.team == COLOR_TEAM1 && self.health >= 1) redalive += 1;
                        else if (self.team == COLOR_TEAM2 && self.health >= 1) bluealive += 1;
index 510e2c1b705a1f58c1251fbac122dfa1df69449b..2697f726a46e4ce79d5e7597af22a979eab4bd60 100644 (file)
@@ -644,6 +644,11 @@ void spawnfunc_worldspawn (void)
 
        addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge);
 
+       if(g_ca)
+       {
+               addstat(STAT_REDALIVE, AS_INT, redalive);
+               addstat(STAT_BLUEALIVE, AS_INT, bluealive);
+       }
        // g_movementspeed hack
        addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw);
        addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw);