mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-10 07:11:36 +00:00
playerstats
This commit is contained in:
parent
1981b279da
commit
4acc3b34d7
8 changed files with 133 additions and 12 deletions
|
@ -843,6 +843,8 @@ void CG_InitConsoleCommands( void ) {
|
|||
//Elder: added to give drop weapon auto-complete
|
||||
trap_AddCommand ("dropweapon");
|
||||
trap_AddCommand ("dropitem");
|
||||
//Blaze: to get weapon stats
|
||||
trap_AddCommand ("playerstats");
|
||||
//Elder: try this
|
||||
trap_AddCommand ("weapon");
|
||||
trap_AddCommand ("specialweapon");
|
||||
|
|
|
@ -435,9 +435,6 @@ typedef struct {
|
|||
|
||||
// callbacks to test the world
|
||||
// these will be different functions during game and cgame
|
||||
//This one is needed by cgame
|
||||
//void (*trace)( trace_t *results, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask );
|
||||
//This one is needed by game
|
||||
void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask );
|
||||
|
||||
int (*pointcontents)( const vec3_t point, int passEntityNum );
|
||||
|
|
|
@ -1046,6 +1046,25 @@ void ClientSpawn(gentity_t *ent) {
|
|||
int savedPing;
|
||||
// char *savedAreaBits;
|
||||
int accuracy_hits, accuracy_shots;
|
||||
int knifeShots = 0;
|
||||
int knifeHits = 0;
|
||||
int mk23Shots = 0;
|
||||
int mk23Hits = 0;
|
||||
int m4Shots =0;
|
||||
int m4Hits = 0;
|
||||
int mp5Shots = 0;
|
||||
int mp5Hits = 0;
|
||||
int m3Shots = 0;
|
||||
int m3Hits = 0;
|
||||
int hcShots = 0;
|
||||
int hcHits = 0;
|
||||
int ssgShots = 0;
|
||||
int ssgHits = 0;
|
||||
int akimboShots = 0;
|
||||
int akimboHits = 0;
|
||||
int grenShots = 0;
|
||||
int grenHits = 0;
|
||||
|
||||
int eventSequence;
|
||||
char userinfo[MAX_INFO_STRING];
|
||||
|
||||
|
@ -1109,6 +1128,23 @@ void ClientSpawn(gentity_t *ent) {
|
|||
// savedAreaBits = client->areabits;
|
||||
accuracy_hits = client->accuracy_hits;
|
||||
accuracy_shots = client->accuracy_shots;
|
||||
knifeShots = client->knifeShots;
|
||||
knifeHits = client->knifeHits;
|
||||
mk23Shots = client->mk23Shots;
|
||||
mk23Hits = client->mk23Hits;
|
||||
m4Shots = client->m4Shots;
|
||||
m4Hits = client->m4Hits;
|
||||
mp5Shots = client->mp5Shots;
|
||||
mp5Hits = client->mp5Hits;
|
||||
m3Shots = client->m3Shots;
|
||||
m3Hits = client->m3Hits;
|
||||
hcShots = client->hcShots;
|
||||
hcHits = client->hcHits;
|
||||
akimboShots = client->akimboShots;
|
||||
akimboHits = client->akimboHits;
|
||||
grenShots = client->grenShots;
|
||||
grenHits = client->grenHits;
|
||||
|
||||
for ( i = 0 ; i < MAX_PERSISTANT ; i++ ) {
|
||||
persistant[i] = client->ps.persistant[i];
|
||||
}
|
||||
|
|
|
@ -2367,8 +2367,31 @@ void Cmd_DropItem_f( gentity_t *ent )
|
|||
ThrowItem( ent );
|
||||
}
|
||||
}
|
||||
/*
|
||||
=================
|
||||
PlayerStats
|
||||
=================
|
||||
*/
|
||||
void Cmd_PlayerStats_f( gentity_t *ent )
|
||||
{
|
||||
char textbuf[1024];
|
||||
|
||||
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"%s:\n\"",ent->client->pers.netname ));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"----------------------------------\n\""));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"| Weapon | Accuracy | Hits/Shots |\n\""));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"----------------------------------\n\""));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"| Knife | %.1f | %d/%d |\n\"", (float)(ent->client->knifeHits / (ent->client->knifeShots ? ent->client->knifeShots : 1)), ent->client->knifeHits, ent->client->knifeShots));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"| MK23 | %.1f | %d/%d |\n\"", (float)(ent->client->mk23Hits / (ent->client->mk23Shots ? ent->client->mk23Shots : 1)), ent->client->mk23Hits, ent->client->mk23Shots));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"| Akimbo | %.1f | %d/%d |\n\"", (float)(ent->client->akimboHits / (ent->client->akimboShots ? ent->client->akimboShots : 1)), ent->client->akimboHits, ent->client->akimboShots));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"| M4 | %.1f | %d/%d |\n\"", (float)(ent->client->m4Hits / (ent->client->m4Shots ? ent->client->m4Shots : 1)), ent->client->m4Hits, ent->client->m4Shots));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"| MP5 | %.1f | %d/%d |\n\"", (float)(ent->client->mp5Hits / (ent->client->mp5Shots ? ent->client->mp5Shots : 1)), ent->client->mp5Hits, ent->client->mp5Shots));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"| M3 | %.1f | %d/%d |\n\"", (float)(ent->client->m3Hits / (ent->client->m3Shots ? ent->client->m3Shots : 1)), ent->client->m3Hits, ent->client->m3Shots));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"| HC | %.1f | %d/%d |\n\"", (float)(ent->client->hcHits / (ent->client->hcShots ? ent->client->hcShots : 1)), ent->client->hcHits, ent->client->hcShots));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"| SSG | %.1f | %d/%d |\n\"", (float)(ent->client->ssgHits / (ent->client->ssgShots ? ent->client->ssgShots : 1)), ent->client->ssgHits, ent->client->ssgShots));
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"----------------------------------\n\""));
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
ClientCommand
|
||||
|
@ -2503,6 +2526,10 @@ void ClientCommand( int clientNum ) {
|
|||
//Elder: stuff for dropping items
|
||||
else if (Q_stricmp (cmd, "dropitem") == 0)
|
||||
Cmd_DropItem_f( ent );
|
||||
else if (Q_stricmp (cmd, "playerstats") == 0)
|
||||
{
|
||||
Cmd_PlayerStats_f( ent );
|
||||
}
|
||||
else
|
||||
trap_SendServerCommand( clientNum, va("print \"unknown cmd %s\n\"", cmd ) );
|
||||
}
|
||||
|
|
|
@ -262,6 +262,7 @@ typedef struct {
|
|||
int teamVoteCount; // to prevent people from constantly calling votes
|
||||
qboolean teamInfo; // send team overlay updates?
|
||||
qboolean hadUniqueWeapon[MAX_WEAPONS]; //Elder: for "ammo" in last gun
|
||||
|
||||
} clientPersistant_t;
|
||||
|
||||
|
||||
|
@ -301,8 +302,28 @@ struct gclient_s {
|
|||
|
||||
int accuracy_shots; // total number of shots
|
||||
int accuracy_hits; // total number of hits
|
||||
//Blaze: For weapon stats
|
||||
//Will need to pass these along in g_client to the new client after spawn
|
||||
int knifeShots;
|
||||
int knifeHits;
|
||||
int mk23Shots;
|
||||
int mk23Hits;
|
||||
int m4Shots;
|
||||
int m4Hits;
|
||||
int mp5Shots;
|
||||
int mp5Hits;
|
||||
int m3Shots;
|
||||
int m3Hits;
|
||||
int hcShots;
|
||||
int hcHits;
|
||||
int ssgShots;
|
||||
int ssgHits;
|
||||
int akimboShots;
|
||||
int akimboHits;
|
||||
int grenShots;
|
||||
int grenHits;
|
||||
|
||||
|
||||
//
|
||||
int lastkilled_client; // last client that this client killed
|
||||
int lasthurt_client; // last client that damaged this client
|
||||
int lasthurt_mod; // type of damage the client did
|
||||
|
|
|
@ -65,6 +65,8 @@ void G_ExplodeMissile( gentity_t *ent ) {
|
|||
if( G_RadiusDamage( ent->r.currentOrigin, ent->parent, ent->splashDamage, ent->splashRadius, ent
|
||||
, ent->splashMethodOfDeath ) ) {
|
||||
g_entities[ent->r.ownerNum].client->accuracy_hits++;
|
||||
if (ent->s.weapon == WP_KNIFE)g_entities[ent->r.ownerNum].client->knifeHits++;
|
||||
if (ent->s.weapon == WP_GRENADE)g_entities[ent->r.ownerNum].client->grenHits++;
|
||||
}
|
||||
}
|
||||
//Elder: huhh?
|
||||
|
@ -308,6 +310,8 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
|
|||
|
||||
if( LogAccuracyHit( other, &g_entities[ent->r.ownerNum] ) ) {
|
||||
g_entities[ent->r.ownerNum].client->accuracy_hits++;
|
||||
if (ent->s.weapon == WP_KNIFE)g_entities[ent->r.ownerNum].client->knifeHits++;
|
||||
if (ent->s.weapon == WP_GRENADE)g_entities[ent->r.ownerNum].client->grenHits++;
|
||||
hitClient = qtrue;
|
||||
}
|
||||
BG_EvaluateTrajectoryDelta( &ent->s.pos, level.time, velocity );
|
||||
|
@ -500,6 +504,8 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
|
|||
other, ent->splashMethodOfDeath ) ) {
|
||||
if( !hitClient ) {
|
||||
g_entities[ent->r.ownerNum].client->accuracy_hits++;
|
||||
if (ent->s.weapon == WP_KNIFE)g_entities[ent->r.ownerNum].client->knifeHits++;
|
||||
if (ent->s.weapon == WP_GRENADE)g_entities[ent->r.ownerNum].client->grenHits++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -378,6 +378,23 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
|
|||
tent->s.eventParm = traceEnt->s.number;
|
||||
if( LogAccuracyHit( traceEnt, ent ) ) {
|
||||
ent->client->accuracy_hits++;
|
||||
switch (MOD)
|
||||
{
|
||||
case MOD_PISTOL:
|
||||
ent->client->mk23Hits++;
|
||||
break;
|
||||
case MOD_M4:
|
||||
ent->client->m4Hits++;
|
||||
break;
|
||||
case MOD_MP5:
|
||||
ent->client->mp5Hits++;
|
||||
break;
|
||||
case MOD_AKIMBO:
|
||||
ent->client->akimboHits++;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_WALL );
|
||||
|
@ -570,6 +587,15 @@ void ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, gentity_t *ent, in
|
|||
if( ShotgunPellet( origin, end, ent ) && !hitClient ) {
|
||||
hitClient = qtrue;
|
||||
ent->client->accuracy_hits++;
|
||||
switch (shotType)
|
||||
{
|
||||
case WP_M3:
|
||||
ent->client->m3Hits++;
|
||||
break;
|
||||
case WP_HANDCANNON:
|
||||
ent->client->hcHits++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1483,6 +1509,7 @@ void Weapon_SSG3000_Fire (gentity_t *ent) {
|
|||
ent->client->rewardTime = level.time + REWARD_SPRITE_TIME;
|
||||
}
|
||||
ent->client->accuracy_hits++;
|
||||
ent->client->ssgHits++;
|
||||
}
|
||||
|
||||
//Elder: bolt action plus save last zoom
|
||||
|
@ -1787,31 +1814,40 @@ void FireWeapon( gentity_t *ent ) {
|
|||
//Blaze: The functions get called when you shoot your gun
|
||||
case WP_KNIFE:
|
||||
Weapon_Knife_Fire (ent);
|
||||
ent->client->knifeShots++;
|
||||
break;
|
||||
case WP_GRENADE:
|
||||
Weapon_Grenade_Fire ( ent );
|
||||
ent->client->grenShots++;
|
||||
break;
|
||||
case WP_PISTOL:
|
||||
Weapon_MK23_Fire ( ent );
|
||||
ent->client->mk23Shots++;
|
||||
break;
|
||||
case WP_M4:
|
||||
Weapon_M4_Fire ( ent );
|
||||
ent->client->m4Shots++;
|
||||
break;
|
||||
case WP_SSG3000:
|
||||
//Weapon_SSG3000_FireOld( ent );
|
||||
Weapon_SSG3000_Fire ( ent );
|
||||
ent->client->ssgShots++;
|
||||
break;
|
||||
case WP_MP5:
|
||||
Weapon_MP5_Fire ( ent );
|
||||
ent->client->mp5Shots++;
|
||||
break;
|
||||
case WP_HANDCANNON:
|
||||
Weapon_HandCannon_Fire ( ent );
|
||||
ent->client->hcShots++;
|
||||
break;
|
||||
case WP_M3:
|
||||
Weapon_M3_Fire ( ent );
|
||||
ent->client->m3Shots++;
|
||||
break;
|
||||
case WP_AKIMBO:
|
||||
Weapon_Akimbo_Fire ( ent );
|
||||
ent->client->akimboShots++;
|
||||
break;
|
||||
#ifdef MISSIONPACK
|
||||
case WP_NAILGUN:
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
--------------------Configuration: game - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2F3.tmp" with contents
|
||||
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPED.tmp" with contents
|
||||
[
|
||||
/nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "BUILDING_REF_GL" /D "DEBUG" /FR"c:\reactionoutput/" /Fp"c:\reactionoutput/game.pch" /YX /Fo"c:\reactionoutput/" /Fd"c:\reactionoutput/" /FD /c
|
||||
"c:\reaction\game\ai_chat.c"
|
||||
|
@ -41,12 +41,10 @@ Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2F3.tmp" with con
|
|||
"c:\reaction\game\g_trigger.c"
|
||||
"c:\reaction\game\g_utils.c"
|
||||
"c:\reaction\game\g_weapon.c"
|
||||
"c:\reaction\game\q_math.c"
|
||||
"c:\reaction\game\q_shared.c"
|
||||
"c:\reaction\game\rxn_game.c"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2F3.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2F4.tmp" with contents
|
||||
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPED.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPEE.tmp" with contents
|
||||
[
|
||||
kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:yes /pdb:"c:\reactionoutput/qagamex86.pdb" /map:"c:\reactionoutput/qagamex86.map" /debug /machine:I386 /def:".\game.def" /out:"..\Debug/qagamex86.dll" /implib:"c:\reactionoutput/qagamex86.lib"
|
||||
\reactionoutput\ai_chat.obj
|
||||
|
@ -85,7 +83,7 @@ kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows
|
|||
\reactionoutput\q_shared.obj
|
||||
\reactionoutput\rxn_game.obj
|
||||
]
|
||||
Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2F4.tmp"
|
||||
Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPEE.tmp"
|
||||
<h3>Output Window</h3>
|
||||
Compiling...
|
||||
ai_chat.c
|
||||
|
@ -121,8 +119,6 @@ g_team.c
|
|||
g_trigger.c
|
||||
g_utils.c
|
||||
g_weapon.c
|
||||
q_math.c
|
||||
q_shared.c
|
||||
rxn_game.c
|
||||
Linking...
|
||||
Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp
|
||||
|
|
Loading…
Reference in a new issue