diff --git a/mp/src/game/server/ff/ff_sv_player.cpp b/mp/src/game/server/ff/ff_sv_player.cpp index d6271b8f..9e05a4df 100644 --- a/mp/src/game/server/ff/ff_sv_player.cpp +++ b/mp/src/game/server/ff/ff_sv_player.cpp @@ -1544,7 +1544,6 @@ bool CFF_SV_Player::CanHearAndReadChatFrom( CBasePlayer *pPlayer ) // do any eg class cleanup here etc void CFF_SV_Player::PreChangeTeam( int iOldTeam, int iNewTeam ) { - // set team unassigned // set class unassigned // remove items // special infection stuff, @@ -1552,6 +1551,14 @@ void CFF_SV_Player::PreChangeTeam( int iOldTeam, int iNewTeam ) // clear state (might do w/ player func) // check kill // lua player_killed + RemoveAllItems( true ); + + if ( IsAlive() && GetTeamNumber( ) >= TEAM_BLUE ) + { + KillPlayer( ); + + // TODO: lua killed predicate + } } // called by team manager once a valid team is found, and after new team set @@ -1560,4 +1567,22 @@ void CFF_SV_Player::PostChangeTeam( int iOldTeam, int iNewTeam ) { // reset state // spawn called + + if ( iOldTeam == TEAM_SPECTATOR ) + { + StopObserverMode( ); + } + + // dont force spawn here right now, death think will spawn the player + //Spawn( ); +} + + +void CFF_SV_Player::KillPlayer( void ) +{ + // TODO: FF stuff + m_iHealth = 0; + // slam it + SetThink(&CBasePlayer::PlayerDeathThink); + SetNextThink(gpGlobals->curtime); } \ No newline at end of file diff --git a/mp/src/game/server/ff/ff_sv_player.h b/mp/src/game/server/ff/ff_sv_player.h index 1425fc56..148e5ead 100644 --- a/mp/src/game/server/ff/ff_sv_player.h +++ b/mp/src/game/server/ff/ff_sv_player.h @@ -141,6 +141,8 @@ public: void PreChangeTeam( int iOldTeam, int iNewTeam ); // called by team manager once a valid team is found, and after new team set void PostChangeTeam( int iOldTeam, int iNewTeam ); + + void KillPlayer( void ); private: CNetworkQAngle( m_angEyeAngles ); diff --git a/mp/src/game/server/player.cpp b/mp/src/game/server/player.cpp index 91a58a0c..d1c6ecc0 100644 --- a/mp/src/game/server/player.cpp +++ b/mp/src/game/server/player.cpp @@ -2151,11 +2151,11 @@ void CBasePlayer::PlayerDeathThink(void) // if the player has been dead for one second longer than allowed by forcerespawn, // forcerespawn isn't on. Send the player off to an intermission camera until they // choose to respawn. - if ( g_pGameRules->IsMultiplayer() && ( gpGlobals->curtime > (m_flDeathTime + DEATH_ANIMATION_TIME) ) && !IsObserver() ) - { - // go to dead camera. - StartObserverMode( m_iObserverLastMode ); - } + //if ( g_pGameRules->IsMultiplayer() && ( gpGlobals->curtime > (m_flDeathTime + DEATH_ANIMATION_TIME) ) && !IsObserver() ) + //{ + // // go to dead camera. + // StartObserverMode( m_iObserverLastMode ); + //} // wait for any button down, or mp_forcerespawn is set and the respawn time is up if (!fAnyButtonDown diff --git a/mp/src/game/shared/ff/ff_sh_gamerules.cpp b/mp/src/game/shared/ff/ff_sh_gamerules.cpp index 4ec3c22e..ec44aeeb 100644 --- a/mp/src/game/shared/ff/ff_sh_gamerules.cpp +++ b/mp/src/game/shared/ff/ff_sh_gamerules.cpp @@ -199,6 +199,9 @@ CFF_SH_Rules::CFF_SH_Rules() { #ifndef CLIENT_DLL // Create the team managers + // TODO: right now this creates a team for every team name string, + // hook this into lua and have it create teams as needed per map + // or something cool like that for ( int i = 0; i < ARRAYSIZE( sTeamNames ); i++ ) { CFF_SH_TeamManager *pTeam = static_cast(CreateEntityByName( "ff_team_manager" )); @@ -207,7 +210,9 @@ CFF_SH_Rules::CFF_SH_Rules() g_Teams.AddToTail( pTeam ); } - m_bTeamPlayEnabled = teamplay.GetBool(); + // Dexter: slammed this to always true instead of the cvar for now + //m_bTeamPlayEnabled = teamplay.GetBool(); + m_bTeamPlayEnabled = true; m_flIntermissionEndTime = 0.0f; m_flGameStartTime = 0; diff --git a/mp/src/game/shared/ff/ff_sh_team_manager.cpp b/mp/src/game/shared/ff/ff_sh_team_manager.cpp index 109fe6e5..17ac3b09 100644 --- a/mp/src/game/shared/ff/ff_sh_team_manager.cpp +++ b/mp/src/game/shared/ff/ff_sh_team_manager.cpp @@ -343,6 +343,9 @@ bool CFF_SH_TeamManager::HandlePlayerTeamCommand( CFF_SV_Player &pPlayer, const int CFF_SH_TeamManager::PickAutoJoinTeam( ) { // TODO: + // it is me, the auto picker thingy majig + + return TEAM_BLUE; } @@ -351,7 +354,7 @@ bool CFF_SH_TeamManager::IsTeamFull() const if (m_iMaxPlayers == 0) return false; - int numActive = 0; + int numActive = 0; for( int i = 1; i <= gpGlobals->maxClients; i++ ) { CFF_SV_Player *pPlayer = (CFF_SV_Player *) UTIL_PlayerByIndex( i ); @@ -359,7 +362,7 @@ bool CFF_SH_TeamManager::IsTeamFull() const numActive++; } - return numActive > m_iMaxPlayers; + return m_iMaxPlayers == 0 ||numActive > m_iMaxPlayers; // GetNumPlayers( ) > m_iMaxPlayers; } #endif @@ -386,6 +389,19 @@ void DebugSetTeamName_f( const CCommand &args ) DevMsg("Team name after set ='%s'\n", pTeam->GetName()); } ConCommand cc_ffdbg_setteamname("ffdbg_set_team_name", DebugSetTeamName_f); + +void DebugCurTeam_f( const CCommand &args ) +{ + CBasePlayer* pPlayer = UTIL_GetCommandClient(); + if ( !pPlayer ) + return; + CTeam *pPlayerTeam = pPlayer->GetTeam(); + if ( !pPlayerTeam ) + return; + pPlayerTeam->GetNumPlayers( ); + DevMsg("Player team=%i name='%s' players on team=%d\n", pPlayerTeam->GetTeamNumber( ), pPlayerTeam->GetName( ), pPlayerTeam->GetNumPlayers( ) ); +} +ConCommand cc_ffdbg_curteam("ffdbg_curteam", DebugCurTeam_f); #endif