From a59e1bf12d2fe0091eeb3ef3df8ce5a82baa1c8b Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 26 Feb 2006 11:00:56 +0000 Subject: * Fixed bogus tutorial text when spectating * Fixed tesla/reactor trails getting too long --- src/cgame/cg_consolecmds.c | 13 +++++++++++-- src/cgame/cg_ents.c | 18 ++++++++++++++++-- src/cgame/cg_local.h | 1 + src/cgame/cg_main.c | 2 ++ src/cgame/cg_tutorial.c | 46 +++++++++++++++++++++++----------------------- 5 files changed, 53 insertions(+), 27 deletions(-) diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c index 65faa0ba..fcbdd72d 100644 --- a/src/cgame/cg_consolecmds.c +++ b/src/cgame/cg_consolecmds.c @@ -84,8 +84,7 @@ static void CG_Viewpos_f( void ) (int)cg.refdefViewAngles[ YAW ] ); } - -static void CG_ScoresDown_f( void ) +qboolean CG_RequestScores( void ) { if( cg.scoresRequestTime + 2000 < cg.time ) { @@ -95,6 +94,16 @@ static void CG_ScoresDown_f( void ) //TA: added \n SendClientCommand doesn't call flush( )? trap_SendClientCommand( "score\n" ); + return qtrue; + } + else + return qfalse; +} + +static void CG_ScoresDown_f( void ) +{ + if( CG_RequestScores( ) ) + { // leave the current scores up if they were already // displayed, but if this is the first hit, clear them out if( !cg.showScores ) diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 0c279a31..1c7d6a05 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -249,8 +249,22 @@ static void CG_EntityEffects( centity_t *cent ) trap_R_AddLightToScene( cent->lerpOrigin, i, r, g, b ); } - if( cg.time > cent->muzzleTSDeathTime && CG_IsTrailSystemValid( ¢->muzzleTS ) ) - CG_DestroyTrailSystem( ¢->muzzleTS ); + if( CG_IsTrailSystemValid( ¢->muzzleTS ) ) + { + if( cent->currentState.eType == ET_BUILDABLE ) + { + vec3_t front, back; + + CG_AttachmentPoint( ¢->muzzleTS->frontAttachment, front ); + CG_AttachmentPoint( ¢->muzzleTS->backAttachment, back ); + + if( Distance( front, back ) > TESLAGEN_RANGE ) + CG_DestroyTrailSystem( ¢->muzzleTS ); + } + + if( cg.time > cent->muzzleTSDeathTime && CG_IsTrailSystemValid( ¢->muzzleTS ) ) + CG_DestroyTrailSystem( ¢->muzzleTS ); + } } diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 6fbd815c..320e060d 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1726,6 +1726,7 @@ void CG_ProcessSnapshots( void ); // qboolean CG_ConsoleCommand( void ); void CG_InitConsoleCommands( void ); +qboolean CG_RequestScores( void ); // // cg_servercmds.c diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index d5903ce7..6bd9d455 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -1003,6 +1003,8 @@ int CG_PlayerCount( void ) { int i, count = 0; + CG_RequestScores( ); + for( i = 0; i < cg.numScores; i++ ) { if( cg.scores[ i ].team == PTE_ALIENS || diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c index 59d83625..aa4a6c79 100644 --- a/src/cgame/cg_tutorial.c +++ b/src/cgame/cg_tutorial.c @@ -496,36 +496,33 @@ CG_SpectatorText */ static void CG_SpectatorText( char *text, playerState_t *ps ) { - if( ps->pm_type == PM_SPECTATOR ) + if( ps->pm_flags & PMF_FOLLOW ) + { + Q_strcat( text, MAX_TUTORIAL_TEXT, + va( "Press %s to return to free spectator mode\n", + CG_KeyNameForCommand( "+button2" ) ) ); + + if( CG_PlayerCount( ) > 1 ) + { + Q_strcat( text, MAX_TUTORIAL_TEXT, + va( "Press %s or ", + CG_KeyNameForCommand( "weapprev" ) ) ); + Q_strcat( text, MAX_TUTORIAL_TEXT, + va( "%s to change player\n", + CG_KeyNameForCommand( "weapnext" ) ) ); + } + } + else if( ps->pm_type == PM_SPECTATOR ) { Q_strcat( text, MAX_TUTORIAL_TEXT, va( "Press %s to join a team\n", CG_KeyNameForCommand( "+attack" ) ) ); - if( ps->pm_flags & PMF_FOLLOW ) + if( CG_PlayerCount( ) > 0 ) { Q_strcat( text, MAX_TUTORIAL_TEXT, - va( "Press %s to return to free spectator mode\n", + va( "Press %s to enter spectator follow mode\n", CG_KeyNameForCommand( "+button2" ) ) ); - - if( CG_PlayerCount( ) > 1 ) - { - Q_strcat( text, MAX_TUTORIAL_TEXT, - va( "Press %s or ", - CG_KeyNameForCommand( "weapprev" ) ) ); - Q_strcat( text, MAX_TUTORIAL_TEXT, - va( "%s to change player\n", - CG_KeyNameForCommand( "weapnext" ) ) ); - } - } - else - { - if( CG_PlayerCount( ) > 0 ) - { - Q_strcat( text, MAX_TUTORIAL_TEXT, - va( "Press %s to enter spectator follow mode\n", - CG_KeyNameForCommand( "+button2" ) ) ); - } } } else @@ -555,8 +552,11 @@ const char *CG_TutorialText( void ) if( !cg.intermissionStarted ) { - if( ps->persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) + if( ps->persistant[ PERS_TEAM ] == TEAM_SPECTATOR || + ps->pm_flags & PMF_FOLLOW ) + { CG_SpectatorText( text, ps ); + } else if( ps->stats[ STAT_HEALTH ] > 0 ) { switch( ps->stats[ STAT_PCLASS ] ) -- cgit