summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2004-05-27 21:43:24 +0000
committerTim Angus <tim@ngus.net>2004-05-27 21:43:24 +0000
commit2ee76d11bb34641e021f69b3509da5c62e7afdb0 (patch)
treee1c45796114c1c66ca8cd0fed0a007d841637e8f /src
parent8f6fba34633ee7039655cb60497c3d71c629b2ff (diff)
* Added code to calculate the average number of players that are playing
* Added stats on game end to aid balancing * "itemact <weaponname>" now selects a weapon as well as activating an upgrade * Disabled chat balloon entirely
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_players.c5
-rw-r--r--src/game/g_cmds.c11
-rw-r--r--src/game/g_local.h5
-rw-r--r--src/game/g_main.c24
4 files changed, 40 insertions, 5 deletions
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index 1ea8d30d..9aba27a4 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -1697,8 +1697,9 @@ static void CG_PlayerSprites( centity_t *cent )
if( cent->currentState.eFlags & EF_TALK )
{
- CG_PlayerFloatSprite( cent, cgs.media.balloonShader );
- return;
+ //TA: the masses have decreed this to be wrong
+/* CG_PlayerFloatSprite( cent, cgs.media.balloonShader );
+ return;*/
}
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 1a631389..b382c28a 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1313,16 +1313,23 @@ Activate an item
void Cmd_ActivateItem_f( gentity_t *ent )
{
char s[ MAX_TOKEN_CHARS ];
- int upgrade;
+ int upgrade, weapon;
trap_Argv( 1, s, sizeof( s ) );
upgrade = BG_FindUpgradeNumForName( s );
+ weapon = BG_FindWeaponNumForName( s );
if( ent->client->pers.teamSelection != PTE_HUMANS )
return;
- if( BG_gotItem( upgrade, ent->client->ps.stats ) )
+ if( upgrade != UP_NONE && BG_gotItem( upgrade, ent->client->ps.stats ) )
BG_activateItem( upgrade, ent->client->ps.stats );
+ else if( weapon != WP_NONE )
+ {
+ //force a weapon change
+ ent->client->ps.pm_flags |= PMF_WEAPON_SWITCH;
+ trap_SendServerCommand( ent-g_entities, va( "weaponswitch %d", weapon ) );
+ }
else
trap_SendServerCommand( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) );
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 8d891279..82681dc5 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -531,6 +531,11 @@ typedef struct
int numAlienClients;
int numHumanClients;
+ float averageNumAlienClients;
+ int numAlienSamples;
+ float averageNumHumanClients;
+ int numHumanSamples;
+
int numLiveAlienClients;
int numLiveHumanClients;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 0fd433b7..5283ff35 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1129,6 +1129,17 @@ void CalculateRanks( void )
}
}
+ //calculate average number of clients for stats
+ level.averageNumAlienClients =
+ ( ( level.averageNumAlienClients * level.numAlienSamples )
+ + level.numAlienClients ) /
+ (float)( ++level.numAlienSamples );
+
+ level.averageNumHumanClients =
+ ( ( level.averageNumHumanClients * level.numHumanSamples )
+ + level.numHumanClients ) /
+ (float)( ++level.numHumanSamples );
+
qsort( level.sortedClients, level.numConnectedClients,
sizeof( level.sortedClients[ 0 ] ), SortRanks );
@@ -1549,8 +1560,11 @@ can see the last frag.
*/
void CheckExitRules( void )
{
- int i;
+ int i;
gclient_t *cl;
+ char s[ MAX_STRING_CHARS ];
+
+ trap_Cvar_VariableStringBuffer( "mapname", s, sizeof( s ) );
// if at the intermission, wait for all non-bots to
// signal ready, then go to next level
@@ -1589,6 +1603,10 @@ void CheckExitRules( void )
//humans win
level.lastWin = PTE_HUMANS;
trap_SendServerCommand( -1, "print \"Humans win.\n\"");
+ G_LogPrintf( "STATS T:H A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients,
+ level.averageNumHumanClients,
+ s, level.time - level.startTime );
+
LogExit( "Humans win." );
return;
}
@@ -1599,6 +1617,10 @@ void CheckExitRules( void )
//aliens win
level.lastWin = PTE_ALIENS;
trap_SendServerCommand( -1, "print \"Aliens win.\n\"");
+ G_LogPrintf( "STATS T:A A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients,
+ level.averageNumHumanClients,
+ s, level.time - level.startTime );
+
LogExit( "Aliens win." );
return;
}