From: FruitieX Date: Sat, 23 Oct 2010 16:53:59 +0000 (+0300) Subject: CA modicon panel X-Git-Tag: xonotic-v0.1.0preview~245^2~8^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0b426fa043d2c248328c3a913b0864c72839ffa1;p=xonotic%2Fxonotic-data.pk3dir.git CA modicon panel --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 357f8a0e3..966fdb385 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -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) diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 6f0eccfaf..db802cd46 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -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; diff --git a/qcsrc/server/arena.qc b/qcsrc/server/arena.qc index a6aea0a21..6b22df6f2 100644 --- a/qcsrc/server/arena.qc +++ b/qcsrc/server/arena.qc @@ -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; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 510e2c1b7..2697f726a 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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);