Skip to content

Commit

Permalink
mod: added most damage given award, refs #1197
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarquis committed Feb 7, 2019
1 parent feea746 commit 2acfa7f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/cgame/cg_debriefing.c
Original file line number Diff line number Diff line change
Expand Up @@ -3398,6 +3398,7 @@ const char *awardNames[NUM_ENDGAME_AWARDS] =
"Highest Accuracy",
"Highest Headshots Percentage",
"Best Survivor",
"Most Damage Given",
"Most Gibs",
"Most Selfkills",
"Most Deaths",
Expand Down Expand Up @@ -3442,7 +3443,7 @@ void CG_Debriefing_Awards_Draw(panel_button_t *button)
case TEAM_SPECTATOR: // fall through
default:
CG_DrawPic(button->rect.x + 6, y + 2, 18, 12, cgs.media.limboTeamButtonBack_on);
CG_DrawPic(button->rect.x + 6, y + 2, 18, 12, cgs.media.limboTeamButtonSpec); // TEAM_FREE shouldn't occure
CG_DrawPic(button->rect.x + 6, y + 2, 18, 12, cgs.media.limboTeamButtonSpec); // TEAM_FREE shouldn't occur
break;
}

Expand Down
4 changes: 2 additions & 2 deletions src/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1949,9 +1949,9 @@ typedef struct
} clientLocation_t;

#ifdef FEATURE_RATING
#define NUM_ENDGAME_AWARDS 20 ///< total number of endgame awards
#define NUM_ENDGAME_AWARDS 21 ///< total number of endgame awards
#else
#define NUM_ENDGAME_AWARDS 19 ///< total number of endgame awards
#define NUM_ENDGAME_AWARDS 20 ///< total number of endgame awards
#endif
#define NUMSHOW_ENDGAME_AWARDS 14 ///< number of awards to display that will fit on screen

Expand Down
41 changes: 40 additions & 1 deletion src/game/g_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,45 @@ void G_BuildEndgameStats(void)

best = NULL;

// most damage given - check damage given, then damage received
for (i = 0; i < level.numConnectedClients; i++)
{
gclient_t *cl = &level.clients[level.sortedClients[i]];

if (cl->sess.sessionTeam == TEAM_FREE)
{
continue;
}

if (cl->sess.damage_given <= 0)
{
continue;
}

if (!best || cl->sess.damage_given > best->sess.damage_given)
{
best = cl;
bestClientNum = level.sortedClients[i];
}
else if (cl->sess.damage_given == best->sess.damage_given && cl->sess.damage_received > best->sess.damage_received)
{
best = cl;
bestClientNum = level.sortedClients[i];
}
}

if (best)
{
best->hasaward = qtrue;
Q_strcat(buffer, 1024, va("%i %i %i ", bestClientNum, best->sess.damage_given, best->sess.sessionTeam));
}
else
{
Q_strcat(buffer, 1024, "-1 0 0 ");
}

best = NULL;

// most gibs - check gibs, then damage given
for (i = 0; i < level.numConnectedClients; i++)
{
Expand Down Expand Up @@ -1202,7 +1241,7 @@ void G_BuildEndgameStats(void)

best = NULL;

// welcome newbie! award - dont get this if any other award given or > 100 xp (this map)
// welcome newbie! award - don't get this if any other award given or > 100 xp (this map)
for (i = 0; i < level.numConnectedClients; i++)
{
gclient_t *cl = &level.clients[level.sortedClients[i]];
Expand Down

0 comments on commit 2acfa7f

Please sign in to comment.