mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-29 21:49:20 +00:00
upload "kind" alien swarm
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "team_control_point_master.h"
|
||||
#include "teamplayroundbased_gamerules.h"
|
||||
|
||||
#if defined ( TF_DLL )
|
||||
#include "tf_gamerules.h"
|
||||
#endif
|
||||
// NOTE: This has to be the last file included!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
BEGIN_DATADESC( CTeamControlPointMaster )
|
||||
DEFINE_KEYFIELD( m_bDisabled, FIELD_BOOLEAN, "StartDisabled" ),
|
||||
@@ -24,9 +24,6 @@ BEGIN_DATADESC( CTeamControlPointMaster )
|
||||
|
||||
DEFINE_KEYFIELD( m_flPartialCapturePointsRate, FIELD_FLOAT, "partial_cap_points_rate" ),
|
||||
|
||||
DEFINE_KEYFIELD( m_flCustomPositionX, FIELD_FLOAT, "custom_position_x" ),
|
||||
DEFINE_KEYFIELD( m_flCustomPositionY, FIELD_FLOAT, "custom_position_y" ),
|
||||
|
||||
// DEFINE_FIELD( m_ControlPoints, CUtlMap < int , CTeamControlPoint * > ),
|
||||
// DEFINE_FIELD( m_bFoundPoints, FIELD_BOOLEAN ),
|
||||
// DEFINE_FIELD( m_ControlPointRounds, CUtlVector < CTeamControlPointRound * > ),
|
||||
@@ -43,8 +40,6 @@ BEGIN_DATADESC( CTeamControlPointMaster )
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "RoundSpawn", InputRoundSpawn ),
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "RoundActivate", InputRoundActivate ),
|
||||
DEFINE_INPUTFUNC( FIELD_STRING, "SetCapLayout", InputSetCapLayout ),
|
||||
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetCapLayoutCustomPositionX", InputSetCapLayoutCustomPositionX ),
|
||||
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetCapLayoutCustomPositionY", InputSetCapLayoutCustomPositionY ),
|
||||
|
||||
DEFINE_FUNCTION( CPMThink ),
|
||||
|
||||
@@ -75,8 +70,6 @@ int ControlPointRoundSort( CTeamControlPointRound* const *p1, CTeamControlPointR
|
||||
CTeamControlPointMaster::CTeamControlPointMaster()
|
||||
{
|
||||
m_flPartialCapturePointsRate = 0.0f;
|
||||
m_flCustomPositionX = -1.f;
|
||||
m_flCustomPositionY = -1.f;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -92,7 +85,6 @@ void CTeamControlPointMaster::Spawn( void )
|
||||
|
||||
m_iCurrentRoundIndex = -1;
|
||||
m_bFirstRoundAfterRestart = true;
|
||||
m_flLastOwnershipChangeTime = -1;
|
||||
|
||||
BaseClass::Spawn();
|
||||
|
||||
@@ -195,7 +187,7 @@ bool CTeamControlPointMaster::FindControlPoints( void )
|
||||
{
|
||||
CTeamControlPoint *pPoint = assert_cast<CTeamControlPoint *>(pEnt);
|
||||
|
||||
if( pPoint->IsActive() && !pPoint->IsMarkedForDeletion() )
|
||||
if( pPoint->IsActive() )
|
||||
{
|
||||
int index = pPoint->GetPointIndex();
|
||||
|
||||
@@ -275,7 +267,6 @@ bool CTeamControlPointMaster::FindControlPoints( void )
|
||||
ObjectiveResource()->SetCPPosition( iPointIndex, pPoint->GetAbsOrigin() );
|
||||
ObjectiveResource()->SetWarnOnCap( iPointIndex, pPoint->GetWarnOnCap() );
|
||||
ObjectiveResource()->SetWarnSound( iPointIndex, pPoint->GetWarnSound() );
|
||||
ObjectiveResource()->SetCPGroup( iPointIndex, pPoint->GetCPGroup() );
|
||||
for ( int team = 0; team < GetNumberOfTeams(); team++ )
|
||||
{
|
||||
ObjectiveResource()->SetCPIcons( iPointIndex, team, pPoint->GetHudIconIndexForTeam(team) );
|
||||
@@ -336,7 +327,6 @@ bool CTeamControlPointMaster::FindControlPointRounds( void )
|
||||
{
|
||||
g_pObjectiveResource->SetPlayingMiniRounds( bFoundRounds );
|
||||
g_pObjectiveResource->SetCapLayoutInHUD( STRING(m_iszCapLayoutInHUD) );
|
||||
g_pObjectiveResource->SetCapLayoutCustomPosition( m_flCustomPositionX, m_flCustomPositionY );
|
||||
}
|
||||
|
||||
return bFoundRounds;
|
||||
@@ -345,7 +335,7 @@ bool CTeamControlPointMaster::FindControlPointRounds( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CTeamControlPointMaster::IsInRound( CTeamControlPoint *pPoint )
|
||||
bool CTeamControlPointMaster::PointCanBeCapped( CTeamControlPoint *pPoint )
|
||||
{
|
||||
// are we playing a round and is this point in the round?
|
||||
if ( m_ControlPointRounds.Count() > 0 && m_iCurrentRoundIndex != -1 )
|
||||
@@ -359,10 +349,8 @@ bool CTeamControlPointMaster::IsInRound( CTeamControlPoint *pPoint )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
int CTeamControlPointMaster::NumPlayableControlPointRounds( void )
|
||||
bool CTeamControlPointMaster::FindControlPointRoundToPlay( void )
|
||||
{
|
||||
int nRetVal = 0;
|
||||
|
||||
for ( int i = 0 ; i < m_ControlPointRounds.Count() ; ++i )
|
||||
{
|
||||
CTeamControlPointRound *pRound = m_ControlPointRounds[i];
|
||||
@@ -372,12 +360,12 @@ int CTeamControlPointMaster::NumPlayableControlPointRounds( void )
|
||||
if ( pRound->IsPlayable() )
|
||||
{
|
||||
// we found one that's playable
|
||||
nRetVal++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nRetVal;
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -452,13 +440,6 @@ void CTeamControlPointMaster::RegisterRoundBeingPlayed( void )
|
||||
m_bFirstRoundAfterRestart = false;
|
||||
}
|
||||
}
|
||||
|
||||
IGameEvent *event = gameeventmanager->CreateEvent( "teamplay_round_selected" );
|
||||
if ( event )
|
||||
{
|
||||
event->SetString( "round", m_ControlPointRounds[m_iCurrentRoundIndex]->GetEntityName().ToCStr() );
|
||||
gameeventmanager->FireEvent( event );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -648,7 +629,7 @@ void CTeamControlPointMaster::CheckWinConditions( void )
|
||||
int iWinners = m_ControlPointRounds[m_iCurrentRoundIndex]->CheckWinConditions();
|
||||
if ( iWinners != -1 && iWinners >= FIRST_GAME_TEAM )
|
||||
{
|
||||
bool bForceMapReset = ( NumPlayableControlPointRounds() == 0 ); // are there any more rounds to play?
|
||||
bool bForceMapReset = ( FindControlPointRoundToPlay() == false ); // are there any more rounds to play?
|
||||
|
||||
if ( !bForceMapReset )
|
||||
{
|
||||
@@ -670,39 +651,11 @@ void CTeamControlPointMaster::CheckWinConditions( void )
|
||||
// Check that the points aren't all held by one team...if they are
|
||||
// this will reset the round and will reset all the points
|
||||
int iWinners = TeamOwnsAllPoints();
|
||||
if ( ( m_iInvalidCapWinner != 1 ) &&
|
||||
( iWinners >= FIRST_GAME_TEAM ) &&
|
||||
if ( ( iWinners >= FIRST_GAME_TEAM ) &&
|
||||
( iWinners != m_iInvalidCapWinner ) )
|
||||
{
|
||||
bool bWinner = true;
|
||||
|
||||
#if defined( TF_DLL)
|
||||
if ( TFGameRules() && TFGameRules()->IsInKothMode() )
|
||||
{
|
||||
CTeamRoundTimer *pTimer = NULL;
|
||||
if ( iWinners == TF_TEAM_RED )
|
||||
{
|
||||
pTimer = TFGameRules()->GetRedKothRoundTimer();
|
||||
}
|
||||
else if ( iWinners == TF_TEAM_BLUE )
|
||||
{
|
||||
pTimer = TFGameRules()->GetBlueKothRoundTimer();
|
||||
}
|
||||
|
||||
if ( pTimer )
|
||||
{
|
||||
if ( pTimer->GetTimeRemaining() > 0 || TFGameRules()->TimerMayExpire() == false )
|
||||
{
|
||||
bWinner = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if ( bWinner )
|
||||
{
|
||||
TeamplayGameRules()->SetWinningTeam( iWinners, WINREASON_ALL_POINTS_CAPTURED, true, m_bSwitchTeamsOnWin );
|
||||
FireTeamWinOutput( iWinners );
|
||||
}
|
||||
TeamplayGameRules()->SetWinningTeam( iWinners, WINREASON_ALL_POINTS_CAPTURED, true, m_bSwitchTeamsOnWin );
|
||||
FireTeamWinOutput( iWinners );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -747,7 +700,7 @@ void CTeamControlPointMaster::InternalSetWinner( int iTeam )
|
||||
if ( m_ControlPointRounds.Count() > 0 )
|
||||
{
|
||||
// if we're playing rounds and there are more to play, don't do a full reset
|
||||
bForceMapReset = ( NumPlayableControlPointRounds() == 0 );
|
||||
bForceMapReset = ( FindControlPointRoundToPlay() == false );
|
||||
}
|
||||
|
||||
if ( iTeam == TEAM_UNASSIGNED )
|
||||
@@ -841,6 +794,20 @@ void CTeamControlPointMaster::InputRoundSpawn( inputdata_t &input )
|
||||
FindControlPointRounds();
|
||||
|
||||
SetBaseControlPoints();
|
||||
|
||||
// init the ClientAreas
|
||||
int index = 0;
|
||||
|
||||
CBaseEntity *pEnt = gEntList.FindEntityByClassname( NULL, GetTriggerAreaCaptureName() );
|
||||
while( pEnt )
|
||||
{
|
||||
CTriggerAreaCapture *pArea = (CTriggerAreaCapture *)pEnt;
|
||||
Assert( pArea );
|
||||
pArea->SetAreaIndex( index );
|
||||
index++;
|
||||
|
||||
pEnt = gEntList.FindEntityByClassname( pEnt, GetTriggerAreaCaptureName() );
|
||||
}
|
||||
|
||||
ObjectiveResource()->ResetControlPoints();
|
||||
}
|
||||
@@ -883,24 +850,6 @@ void CTeamControlPointMaster::InputSetCapLayout( inputdata_t &inputdata )
|
||||
g_pObjectiveResource->SetCapLayoutInHUD( STRING(m_iszCapLayoutInHUD) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CTeamControlPointMaster::InputSetCapLayoutCustomPositionX( inputdata_t &inputdata )
|
||||
{
|
||||
m_flCustomPositionX = inputdata.value.Float();
|
||||
g_pObjectiveResource->SetCapLayoutCustomPosition( m_flCustomPositionX, m_flCustomPositionY );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CTeamControlPointMaster::InputSetCapLayoutCustomPositionY( inputdata_t &inputdata )
|
||||
{
|
||||
m_flCustomPositionY = inputdata.value.Float();
|
||||
g_pObjectiveResource->SetCapLayoutCustomPosition( m_flCustomPositionX, m_flCustomPositionY );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1067,7 +1016,7 @@ int CTeamControlPointMaster::GetBaseControlPoint( int iTeam )
|
||||
|
||||
if ( PlayingMiniRounds() && iTeam > LAST_SHARED_TEAM )
|
||||
{
|
||||
if ( IsInRound( pPoint ) ) // is this point in the current round?
|
||||
if ( PointCanBeCapped( pPoint ) ) // is this point in the current round?
|
||||
{
|
||||
if ( iPointIndex > nHighestValue )
|
||||
{
|
||||
@@ -1230,7 +1179,7 @@ int CTeamControlPointMaster::CalcNumRoundsRemaining( int iTeam )
|
||||
}
|
||||
}
|
||||
// this round is playable if all control points are not owned by one team (or owned by a team that can't win by capping them)
|
||||
bool bPlayable = ( ( iRoundOwningTeam < FIRST_GAME_TEAM ) || ( pRound->GetInvalidCapWinner() == 1 ) || ( iRoundOwningTeam == pRound->GetInvalidCapWinner() ) );
|
||||
bool bPlayable = ( ( iRoundOwningTeam < FIRST_GAME_TEAM ) || ( iRoundOwningTeam == pRound->GetInvalidCapWinner() ) );
|
||||
if ( !bPlayable )
|
||||
continue;
|
||||
|
||||
@@ -1266,7 +1215,6 @@ float CTeamControlPointMaster::GetPartialCapturePointRate( void )
|
||||
{
|
||||
return m_flPartialCapturePointsRate;
|
||||
}
|
||||
|
||||
/*
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@@ -1344,4 +1292,4 @@ void cc_PlayRound( const CCommand& args )
|
||||
}
|
||||
|
||||
static ConCommand playround( "playround", cc_PlayRound, "Play the selected round\n\tArgument: {round name given by \"listrounds\" command}", FCVAR_CHEAT );
|
||||
*/
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user