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/cgame/cg_consolecmds.c | 4 +--- src/cgame/cg_draw.c | 3 +++ 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 ++-- src/ui/ui_local.h | 2 +- src/ui/ui_main.c | 11 ++++++++--- 10 files changed, 77 insertions(+), 33 deletions(-) diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c index 80cd1293..468cdeac 100644 --- a/src/cgame/cg_consolecmds.c +++ b/src/cgame/cg_consolecmds.c @@ -279,9 +279,7 @@ void CG_InitConsoleCommands( void ) trap_AddCommand( "build" ); trap_AddCommand( "buy" ); trap_AddCommand( "sell" ); - trap_AddCommand( "deposit" ); - trap_AddCommand( "withdraw" ); - trap_AddCommand( "spawnbody" ); + trap_AddCommand( "reload" ); trap_AddCommand( "itemact" ); trap_AddCommand( "itemdeact" ); trap_AddCommand( "itemtoggle" ); diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index e4c0402a..fa046dbb 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -1905,6 +1905,9 @@ static void CG_DrawLagometer( rectDef_t *rect, qhandle_t shader ) if( cg.snap->ps.pm_type == PM_INTERMISSION ) return; + if( !cg_lagometer.integer ) + return; + // // draw the graph // 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; } diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h index 0519abdf..aa8d7aa7 100644 --- a/src/ui/ui_local.h +++ b/src/ui/ui_local.h @@ -854,7 +854,7 @@ typedef struct { int tremInfoPaneCount; //TA: tremulous menus - tremMenuItem_t tremTeamList[ 3 ]; + tremMenuItem_t tremTeamList[ 4 ]; int tremTeamCount; int tremTeamIndex; diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 4fb2ecf3..941ec2f0 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -3318,7 +3318,8 @@ UI_LoadTremTeams */ static void UI_LoadTremTeams( void ) { - uiInfo.tremTeamCount = 3; + uiInfo.tremTeamCount = 4; + uiInfo.tremTeamList[ 0 ].text = String_Alloc( "Aliens" ); uiInfo.tremTeamList[ 0 ].cmd = String_Alloc( "cmd team aliens\n" ); uiInfo.tremTeamList[ 0 ].infopane = UI_FindInfoPaneByName( "alienteam" ); @@ -3330,6 +3331,10 @@ static void UI_LoadTremTeams( void ) uiInfo.tremTeamList[ 2 ].text = String_Alloc( "Spectate" ); uiInfo.tremTeamList[ 2 ].cmd = String_Alloc( "cmd team spectate\n" ); uiInfo.tremTeamList[ 2 ].infopane = UI_FindInfoPaneByName( "spectateteam" ); + + uiInfo.tremTeamList[ 3 ].text = String_Alloc( "Auto select" ); + uiInfo.tremTeamList[ 3 ].cmd = String_Alloc( "cmd team auto\n" ); + uiInfo.tremTeamList[ 3 ].infopane = UI_FindInfoPaneByName( "autoteam" ); } /* @@ -3475,7 +3480,7 @@ static void UI_LoadTremHumanArmouryBuys( ) uiInfo.tremHumanArmouryBuyCount = 0; - for( i = WP_NONE +1; i < WP_NUM_WEAPONS; i++ ) + for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { if( BG_FindTeamForWeapon( i ) == WUT_HUMANS && BG_FindPurchasableForWeapon( i ) && @@ -3496,7 +3501,7 @@ static void UI_LoadTremHumanArmouryBuys( ) } } - for( i = UP_NONE +1; i < UP_NUM_UPGRADES; i++ ) + for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { if( BG_FindTeamForUpgrade( i ) == WUT_HUMANS && BG_FindStagesForUpgrade( i, stage ) && -- cgit