summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorenneract <trem.redman@gmail.com>2014-12-20 13:33:55 +0100
committerenneract <trem.redman@gmail.com>2014-12-20 13:33:55 +0100
commit1cd59c900d16f038f13fb5f392f346cb8c2154a6 (patch)
treec8837b8082c91ab78ab9280af2db8fd7f8deaab6 /src
parent3a7015bd646110a378c3b5f0a8638368f2827788 (diff)
Track self damage in combat statistics.
Diffstat (limited to 'src')
-rw-r--r--src/game/g_admin.c23
-rw-r--r--src/game/g_combat.c12
-rw-r--r--src/game/g_local.h1
3 files changed, 26 insertions, 10 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 36fa6be..90afa5c 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -4432,7 +4432,7 @@ qboolean G_admin_stats( gentity_t *ent )
if( !header )
{
ADMBP( va( "^3stats: ^7combat statistics of %s^7:\n", targ->client->pers.netname ) );
- ADMBP( va( "^3%*s Dmg Acc FAc BAC FBA^7\n",
+ ADMBP( va( "^3%*s Dmg Acc FAc BAC FBA SAc^7\n",
CSW_MAX_NAME_LEN, "Weapon" ) );
header = qtrue;
}
@@ -4444,7 +4444,7 @@ if( (b) == 0 ) \
ADMBP( " ^0n/a" ); \
else \
{ \
- int _t = round( (float)(a)/(b) * 100.0f ); \
+ int _t = MIN( (int)round( (float)(a)/(b) * 100.0f ), 999 ); \
ADMBP( va( " ^7%3d", _t ) ); \
}
@@ -4452,25 +4452,36 @@ else \
cs->total -
cs->friendly -
cs->enemy_buildable -
- cs->friendly_buildable )
+ cs->friendly_buildable -
+ cs->self )
PRINT_ACC( cs->friendly,
cs->total -
cs->enemy -
cs->enemy_buildable -
- cs->friendly_buildable )
+ cs->friendly_buildable -
+ cs->self )
PRINT_ACC( cs->enemy_buildable,
cs->total -
cs->enemy -
cs->friendly -
- cs->friendly_buildable )
+ cs->friendly_buildable -
+ cs->self )
PRINT_ACC( cs->friendly_buildable,
cs->total -
cs->enemy -
cs->enemy_buildable -
- cs->friendly )
+ cs->friendly -
+ cs->self )
+
+ PRINT_ACC( cs->self,
+ cs->total -
+ cs->enemy -
+ cs->friendly -
+ cs->enemy_buildable -
+ cs->friendly_buildable )
#undef PRINT_ACC
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index c8090d4..0e8db92 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -1819,7 +1819,9 @@ void G_CombatStats_Hit( gentity_t *ent, gentity_t *hit, combatStatsWeapon_t weap
cs = ent->client->pers.combatStats + weapon;
- if( hit->s.eType == ET_BUILDABLE )
+ if( hit == ent )
+ stat = &cs->self;
+ else if( hit->s.eType == ET_BUILDABLE )
{
if( ent->client->pers.teamSelection == hit->buildableTeam )
stat = &cs->friendly_buildable;
@@ -1843,7 +1845,8 @@ void G_CombatStats_Hit( gentity_t *ent, gentity_t *hit, combatStatsWeapon_t weap
( stat == &cs->friendly_buildable ) ? "a friendly buildable" :
( stat == &cs->enemy_buildable ) ? "an enemy buildable" :
( stat == &cs->friendly ) ? "a friendly player" :
- "an enemy player",
+ ( stat == &cs->enemy ) ? "an enemy player" :
+ "themselves",
hit - g_entities,
cswStrings[ weapon ],
damage );
@@ -1871,13 +1874,14 @@ void G_LogCombatStats( gentity_t *ent )
Com_sprintf(
p, 4096 - ( p - buffer ),
- " %s %i,%i,%i,%i,%i",
+ " %s %i,%i,%i,%i,%i,%i",
cswStrings[ i ],
cs->total,
cs->enemy,
cs->friendly,
cs->enemy_buildable,
- cs->friendly_buildable );
+ cs->friendly_buildable,
+ cs->self );
while( *p ) p++;
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 918a809..0717e47 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -324,6 +324,7 @@ typedef struct
int enemy_buildable;
int friendly;
int friendly_buildable;
+ int self;
} combatStats_t;
// client data that stays across multiple respawns, but is cleared