From d1318515a8a9d2b8369e136fa91ff1a1f159a168 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sat, 28 Feb 2004 16:35:39 +0000 Subject: * Added missing \n after server speech * Added auto select option to team menu * g_teamForceBalance now works * Added "reload" command * cg_lagometer now works --- src/game/bg_pmove.c | 10 +++------- src/game/bg_public.h | 24 ++++++++++++------------ src/game/g_cmds.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- src/game/g_local.h | 2 +- src/game/g_main.c | 5 ++++- src/game/g_svcmds.c | 4 ++-- 6 files changed, 64 insertions(+), 26 deletions(-) (limited to 'src/game') diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index fdfc1074..1ab23c62 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2767,8 +2767,10 @@ static void PM_Weapon( void ) } // check for end of clip - if( !ammo && clips ) + if( ( !ammo && clips ) || pm->ps->pm_flags & PMF_WEAPON_RELOAD ) { + pm->ps->pm_flags &= ~PMF_WEAPON_RELOAD; + pm->ps->weaponstate = WEAPON_RELOADING; //drop the weapon @@ -3323,12 +3325,6 @@ void PmoveSingle( pmove_t *pmove ) if( pm->ps->pm_type == PM_JETPACK ) PM_JetPackMove( ); - else if( pm->ps->pm_flags & PMF_GRAPPLE_PULL ) - { - PM_GrappleMove( ); - // We can wiggle a bit - PM_AirMove( ); - } else if( pm->ps->pm_flags & PMF_TIME_WATERJUMP ) PM_WaterJumpMove( ); else if( pm->waterlevel > 1 ) diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 02b494db..31c50d8e 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -127,19 +127,19 @@ typedef enum #define PMF_DUCKED 1 #define PMF_JUMP_HELD 2 #define PMF_CROUCH_HELD 4 -#define PMF_BACKWARDS_JUMP 8 // go into backwards land -#define PMF_BACKWARDS_RUN 16 // coast down to backwards run -#define PMF_TIME_LAND 32 // pm_time is time before rejump -#define PMF_TIME_KNOCKBACK 64 // pm_time is an air-accelerate only time -#define PMF_TIME_WATERJUMP 256 // pm_time is waterjump -#define PMF_RESPAWNED 512 // clear after attack and jump buttons come up +#define PMF_BACKWARDS_JUMP 8 // go into backwards land +#define PMF_BACKWARDS_RUN 16 // coast down to backwards run +#define PMF_TIME_LAND 32 // pm_time is time before rejump +#define PMF_TIME_KNOCKBACK 64 // pm_time is an air-accelerate only time +#define PMF_TIME_WATERJUMP 256 // pm_time is waterjump +#define PMF_RESPAWNED 512 // clear after attack and jump buttons come up #define PMF_USE_ITEM_HELD 1024 -#define PMF_GRAPPLE_PULL 2048 // pull towards grapple location -#define PMF_FOLLOW 4096 // spectate following another player -#define PMF_SCOREBOARD 8192 // spectate as a scoreboard -#define PMF_TIME_WALLJUMP 16384 //TA: for limiting wall jumping -#define PMF_CHARGE 32768 //TA: keep track of pouncing -#define PMF_WEAPON_SWITCH 65536 //TA: force a weapon switch +#define PMF_WEAPON_RELOAD 2048 //TA: force a weapon switch +#define PMF_FOLLOW 4096 // spectate following another player +#define PMF_SCOREBOARD 8192 // spectate as a scoreboard +#define PMF_TIME_WALLJUMP 16384 //TA: for limiting wall jumping +#define PMF_CHARGE 32768 //TA: keep track of pouncing +#define PMF_WEAPON_SWITCH 65536 //TA: force a weapon switch #define PMF_ALL_TIMES (PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK|PMF_TIME_WALLJUMP) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index bdc0a994..d9d9922c 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -356,12 +356,39 @@ void Cmd_Team_f( gentity_t *ent ) return; } - if( !Q_stricmp( s, "0" ) || !Q_stricmp( s, "spectate" ) ) + if( !Q_stricmp( s, "spectate" ) ) ent->client->pers.teamSelection = PTE_NONE; - else if( !Q_stricmp( s, "1" ) || !Q_stricmp( s, "aliens" ) ) + else if( !Q_stricmp( s, "aliens" ) ) + { + if( g_teamForceBalance.integer && level.numAlienClients > level.numHumanClients ) + { + //FIXME: pleasant dialog + trap_SendServerCommand( ent-g_entities, "The alien team has too many players\n" ); + return; + } + ent->client->pers.teamSelection = PTE_ALIENS; - else if( !Q_stricmp( s, "2" ) || !Q_stricmp( s, "humans" ) ) + } + else if( !Q_stricmp( s, "humans" ) ) + { + if( g_teamForceBalance.integer && level.numHumanClients > level.numAlienClients ) + { + //FIXME: pleasant dialog + trap_SendServerCommand( ent-g_entities, "The human team has too many players\n" ); + return; + } + ent->client->pers.teamSelection = PTE_HUMANS; + } + else if( !Q_stricmp( s, "auto" ) ) + { + if( level.numHumanClients > level.numAlienClients ) + ent->client->pers.teamSelection = PTE_ALIENS; + else if( level.numHumanClients < level.numAlienClients ) + ent->client->pers.teamSelection = PTE_HUMANS; + else + ent->client->pers.teamSelection = PTE_ALIENS + ( rand( ) % 2 ); + } if( oldTeam != ent->client->pers.teamSelection ) { @@ -1676,6 +1703,16 @@ void Cmd_Boost_f( gentity_t *ent ) ent->client->ps.stats[ STAT_STATE ] |= SS_SPEEDBOOST; } +/* +================= +Cmd_Reload_f +================= +*/ +void Cmd_Reload_f( gentity_t *ent ) +{ + ent->client->ps.pm_flags |= PMF_WEAPON_RELOAD; +} + /* ================= Cmd_Test_f @@ -1775,6 +1812,8 @@ void ClientCommand( int clientNum ) Cmd_Destroy_f( ent, qfalse ); else if( Q_stricmp( cmd, "deconstruct" ) == 0 ) Cmd_Destroy_f( ent, qtrue ); + else if( Q_stricmp( cmd, "reload" ) == 0 ) + Cmd_Reload_f( ent ); else if( Q_stricmp( cmd, "echo" ) == 0 ) Cmd_Echo_f( ent ); else if( Q_stricmp( cmd, "boost" ) == 0 ) diff --git a/src/game/g_local.h b/src/game/g_local.h index ff8b7595..926cecb0 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -401,7 +401,7 @@ typedef struct spawnQueue_s #define QUEUE_PLUS1(x) (((x)+1)%MAX_CLIENTS) #define QUEUE_MINUS1(x) (((x)-1)%MAX_CLIENTS) -int G_InitSpawnQueue( spawnQueue_t *sq ); +void G_InitSpawnQueue( spawnQueue_t *sq ); int G_GetSpawnQueueLength( spawnQueue_t *sq ); int G_PopSpawnQueue( spawnQueue_t *sq ); void G_PushSpawnQueue( spawnQueue_t *sq, int clientNum ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 53b61108..eb81594d 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -674,7 +674,7 @@ G_InitSpawnQueue Initialise a spawn queue ============ */ -int G_InitSpawnQueue( spawnQueue_t *sq ) +void G_InitSpawnQueue( spawnQueue_t *sq ) { sq->back = sq->front = 0; sq->back = QUEUE_MINUS1( sq->back ); @@ -1734,6 +1734,9 @@ void G_RunFrame( int levelTime ) level.time = levelTime; msec = level.time - level.previousTime; + //TA: seed the rng + srand( level.framenum ); + // get any cvar changes G_UpdateCvars( ); diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c index 003d6893..c86ac2b6 100644 --- a/src/game/g_svcmds.c +++ b/src/game/g_svcmds.c @@ -567,12 +567,12 @@ qboolean ConsoleCommand( void ) { if( Q_stricmp( cmd, "say" ) == 0 ) { - trap_SendServerCommand( -1, va( "print \"server: %s\"", ConcatArgs( 1 ) ) ); + trap_SendServerCommand( -1, va( "print \"server: %s\n\"", ConcatArgs( 1 ) ) ); return qtrue; } // everything else will also be printed as a say command - trap_SendServerCommand( -1, va( "print \"server: %s\"", ConcatArgs( 0 ) ) ); + trap_SendServerCommand( -1, va( "print \"server: %s\n\"", ConcatArgs( 0 ) ) ); return qtrue; } -- cgit