diff options
author | James Haley | 2013-09-15 15:32:21 +0000 |
---|---|---|
committer | James Haley | 2013-09-15 15:32:21 +0000 |
commit | 3ce2a53bc95e3e58383e2b0a982eacba5b396b4a (patch) | |
tree | 1242210c950fd105daf17fc1bc3e5abccc6b9b47 /src/strife | |
parent | f2c204ccca3b93b318cda3aebf29592aa30385e4 (diff) | |
download | chocolate-doom-3ce2a53bc95e3e58383e2b0a982eacba5b396b4a.tar.gz chocolate-doom-3ce2a53bc95e3e58383e2b0a982eacba5b396b4a.tar.bz2 chocolate-doom-3ce2a53bc95e3e58383e2b0a982eacba5b396b4a.zip |
Frags are displayed on keys popup during deathmatch
Subversion-branch: /branches/v2-branch
Subversion-revision: 2645
Diffstat (limited to 'src/strife')
-rw-r--r-- | src/strife/st_stuff.c | 66 |
1 files changed, 63 insertions, 3 deletions
diff --git a/src/strife/st_stuff.c b/src/strife/st_stuff.c index 3761f141..cec833fc 100644 --- a/src/strife/st_stuff.c +++ b/src/strife/st_stuff.c @@ -1134,6 +1134,28 @@ void ST_Drawer (boolean fullscreen, boolean refresh) } // +// ST_calcFrags +// +// haleyjd [STRIFE] New function. +// Calculate frags for display on the frags popup. +// +static int ST_calcFrags(int pnum) +{ + int i; + int result = 0; + + for(i = 0; i < MAXPLAYERS; i++) + { + if(i == pnum) // self-frags + result -= players[pnum].frags[i]; + else + result += players[pnum].frags[i]; + } + + return result; +} + +// // ST_drawTime // // villsa [STRIFE] New function. @@ -1172,7 +1194,7 @@ static void ST_drawTime(int x, int y, int time) // static boolean ST_drawKeysPopup(void) { - int x, y, key, keycount; + int x, y, yt, key, keycount; mobjinfo_t *info; V_DrawXlaPatch(0, 56, invpbak2); @@ -1180,8 +1202,46 @@ static boolean ST_drawKeysPopup(void) if(deathmatch) { - // STRIFE-TODO: In deathmatch, the keys popup is replaced by a chart - // of frag counts + int pnum; + patch_t *colpatch; + char buffer[128]; + int frags; + + // In deathmatch, the keys popup is replaced by a chart of frag counts + + // first column + y = 64; + yt = 66; + for(pnum = 0; pnum < MAXPLAYERS/2; pnum++) + { + DEH_snprintf(buffer, sizeof(buffer), "stcolor%d", pnum+1); + colpatch = W_CacheLumpName(buffer, PU_CACHE); + V_DrawPatchDirect(28, y, colpatch); + frags = ST_calcFrags(pnum); + DEH_snprintf(buffer, sizeof(buffer), "%s%d", pnameprefixes[pnum], frags); + HUlib_drawYellowText(38, yt, buffer); + if(!playeringame[pnum]) + HUlib_drawYellowText(28, pnum*17 + 65, "X"); + y += 17; + yt += 17; + } + + // second column + y = 64; + yt = 66; + for(pnum = MAXPLAYERS/2; pnum < MAXPLAYERS; pnum++) + { + DEH_snprintf(buffer, sizeof(buffer), "stcolor%d", pnum+1); + colpatch = W_CacheLumpName(buffer, PU_CACHE); + V_DrawPatchDirect(158, y, colpatch); + frags = ST_calcFrags(pnum); + DEH_snprintf(buffer, sizeof(buffer), "%s%d", pnameprefixes[pnum], frags); + HUlib_drawYellowText(168, yt, buffer); + if(!playeringame[pnum]) + HUlib_drawYellowText(158, pnum*17 - 3, "X"); + y += 17; + yt += 17; + } } else { |