本文整理汇总了C++中GetGlobalTeam函数的典型用法代码示例。如果您正苦于以下问题:C++ GetGlobalTeam函数的具体用法?C++ GetGlobalTeam怎么用?C++ GetGlobalTeam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetGlobalTeam函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetGlobalTeam
const char * C_PlayerResource::GetTeamName(int index)
{
C_Team *team = GetGlobalTeam( index );
if ( !team )
return "Unknown";
return team->Get_Name();
}
示例2: GetGlobalTeam
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTeamplayRules::Precache( void )
{
// Call the Team Manager's precaches
for ( int i = 0; i < GetNumberOfTeams(); i++ )
{
CTeam *pTeam = GetGlobalTeam( i );
pTeam->Precache();
}
}
示例3: CreateRagdollEntity
void CHL2MP_Player::Event_Killed( const CTakeDamageInfo &info )
{
//update damage info with our accumulated physics force
CTakeDamageInfo subinfo = info;
subinfo.SetDamageForce( m_vecTotalBulletForce );
#ifdef GE_DLL
// Since we fixed force application, give the ragdoll an extra oomph to emphasize his death
m_vecTotalBulletForce.x *= 2.5f;
m_vecTotalBulletForce.y *= 2.5f;
m_vecTotalBulletForce.z *= 2.0f;
#endif
// Note: since we're dead, it won't draw us on the client, but we don't set EF_NODRAW
// because we still want to transmit to the clients in our PVS.
CreateRagdollEntity();
#ifndef GE_DLL
DetonateTripmines();
#endif
BaseClass::Event_Killed( subinfo );
if ( info.GetDamageType() & DMG_DISSOLVE )
{
if ( m_hRagdoll )
{
m_hRagdoll->GetBaseAnimating()->Dissolve( NULL, gpGlobals->curtime, false, ENTITY_DISSOLVE_NORMAL );
}
}
#ifndef GE_DLL
CBaseEntity *pAttacker = info.GetAttacker();
if ( pAttacker )
{
int iScoreToAdd = 1;
if ( pAttacker == this )
{
iScoreToAdd = -1;
}
GetGlobalTeam( pAttacker->GetTeamNumber() )->AddMatchScore( iScoreToAdd );
}
#endif
FlashlightTurnOff();
m_lifeState = LIFE_DEAD;
RemoveEffects( EF_NODRAW ); // still draw player body
StopZooming();
}
示例4: switch
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTriggerAreaCapture::BreakCapture( bool bNotEnoughPlayers )
{
if( m_bCapturing )
{
// Remap team to get first game team = 1
switch ( m_nCapturingTeam - FIRST_GAME_TEAM+1 )
{
case 1:
m_OnBreakTeam1.FireOutput( this, this );
break;
case 2:
m_OnBreakTeam2.FireOutput( this, this );
break;
default:
Assert(0);
break;
}
m_BreakOutput.FireOutput(this,this);
m_bCapturing = false;
m_nCapturingTeam = TEAM_UNASSIGNED;
UpdateCappingTeam( TEAM_UNASSIGNED );
if ( bNotEnoughPlayers )
{
IncrementCapAttemptNumber();
}
SetCapTimeRemaining( 0 );
if( m_hPoint )
{
m_hPoint->CaptureEnd();
}
m_OnNumCappersChanged.Set( 0, this, this );
// tell all touching players to stop racking up capture points
CTeam *pTeam = GetGlobalTeam( m_nCapturingTeam );
if ( pTeam )
{
for ( int i=0;i<pTeam->GetNumPlayers();i++ )
{
CBaseMultiplayerPlayer *pPlayer = ToBaseMultiplayerPlayer( pTeam->GetPlayer(i) );
if ( pPlayer && IsTouching( pPlayer ) )
{
pPlayer->StopScoringEscortPoints();
}
}
}
}
}
示例5: Q_snprintf
void CTextureProxy::OnBind( void *pEntity )
{
// Bail if no base variable
if ( !m_pBaseTextureVar )
return;
char texture[128];
if (Q_stricmp(m_szTextureType, "hometeamcrest") == 0 && GetGlobalTeam(TEAM_A)->HasCrest())
Q_snprintf(texture, sizeof(texture), "%s/%s/teamcrest", TEAMKITS_PATH, GetGlobalTeam(TEAM_A)->GetFolderName());
else if (Q_stricmp(m_szTextureType, "awayteamcrest") == 0 && GetGlobalTeam(TEAM_B)->HasCrest())
Q_snprintf(texture, sizeof(texture), "%s/%s/teamcrest", TEAMKITS_PATH, GetGlobalTeam(TEAM_B)->GetFolderName());
else
Q_snprintf(texture, sizeof(texture), "%s", m_pDefaultTexture->GetName());
m_pNewTexture = materials->FindTexture(texture, NULL, true);
m_pBaseTextureVar->SetTextureValue(m_pNewTexture);
GetMaterial()->RecomputeStateSnapshots();
}
示例6: ChangeTeam
void CSDKPlayer::ChangeTeam( int iTeamNum )
{
if ( !GetGlobalTeam( iTeamNum ) )
{
Warning( "CSDKPlayer::ChangeTeam( %d ) - invalid team index.\n", iTeamNum );
return;
}
int iOldTeam = GetTeamNumber();
// if this is our current team, just abort
if ( iTeamNum == iOldTeam )
return;
m_bTeamChanged = true;
// do the team change:
BaseClass::ChangeTeam( iTeamNum );
// update client state
if ( iTeamNum == TEAM_UNASSIGNED )
{
State_Transition( STATE_OBSERVER_MODE );
}
else if ( iTeamNum == TEAM_SPECTATOR )
{
RemoveAllItems( true );
State_Transition( STATE_OBSERVER_MODE );
}
else // active player
{
if ( !IsDead() )
{
// Kill player if switching teams while alive
CommitSuicide();
// add 1 to frags to balance out the 1 subtracted for killing yourself
IncrementFragCount( 1 );
}
if( iOldTeam == TEAM_SPECTATOR )
SetMoveType( MOVETYPE_NONE );
//Tony; pop up the class menu if we're using classes, otherwise just spawn.
#if defined ( SDK_USE_PLAYERCLASSES )
// Put up the class selection menu.
State_Transition( STATE_PICKINGCLASS );
#else
State_Transition( STATE_ACTIVE );
#endif
}
}
示例7: GetGlobalTeam
//-----------------------------------------------------------------------------
// Purpose: Attach this spawnpoint to it's team
//-----------------------------------------------------------------------------
void CTeamSpawnPoint::Activate( void )
{
BaseClass::Activate();
if ( GetTeamNumber() > 0 && GetTeamNumber() <= MAX_TEAMS )
{
GetGlobalTeam( GetTeamNumber() )->AddSpawnpoint( this );
}
else
{
Warning( "info_player_teamspawn with invalid team number: %d\n", GetTeamNumber() );
UTIL_Remove( this );
}
}
示例8:
Color &C_Team::GetHudKitColor()
{
Color *color;
if (GetTeamNumber() == TEAM_HOME || GetTeamNumber() == TEAM_AWAY)
color = &m_pKitInfo->m_HudPrimaryColor;
else
color = &g_ColorGray;
if (GetTeamNumber() == TEAM_AWAY)
{
if (*color == GetGlobalTeam(TEAM_HOME)->GetHudKitColor())
{
color = &m_pKitInfo->m_HudSecondaryColor;
if (*color == GetGlobalTeam(TEAM_HOME)->GetHudKitColor())
color = &g_HudAlternativeColors[m_pKitInfo->m_HudPrimaryColorClass];
}
}
return *color;
}
示例9: TeamFortress_TeamGetScoreFrags
//=========================================================================
// Return the score/frags of a team, depending on whether TeamFrags is on
int TeamFortress_TeamGetScoreFrags(int tno)
{
CTeam *pTeam = GetGlobalTeam( tno );
if ( pTeam )
{
return pTeam->GetScore();
}
else
{
Assert( false );
return -1;
}
}
示例10: GetGlobalTeam
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTeamControlPoint::HandleScoring( int iTeam )
{
if ( TeamplayRoundBasedRules() && !TeamplayRoundBasedRules()->ShouldScorePerRound() )
{
GetGlobalTeam( iTeam )->AddScore( 1 );
TeamplayRoundBasedRules()->HandleTeamScoreModify( iTeam, 1 );
CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[0] : NULL;
if ( pMaster && !pMaster->WouldNewCPOwnerWinGame( this, iTeam ) )
{
CTeamRecipientFilter filter( iTeam );
EmitSound( filter, entindex(), "Hud.EndRoundScored" );
}
}
}
示例11: ToSOPlayer
void CNPC_SO_BaseZombie::Event_Killed( const CTakeDamageInfo &info )
{
CBaseEntity *pEnt = info.GetAttacker();
if ( pEnt && pEnt->IsPlayer() )
{
CSO_Player *pPlayer = ToSOPlayer( pEnt );
if ( pPlayer )
{
// Give players some credit for killing zombie NPCs
pPlayer->IncrementFragCount( 1 );
GetGlobalTeam( pPlayer->GetTeamNumber() )->AddScore( 1 );
}
}
BaseClass::Event_Killed( info );
}
示例12: CreateRagdollEntity
void CHL2MP_Player::Event_Killed( const CTakeDamageInfo &info )
{
//update damage info with our accumulated physics force
CTakeDamageInfo subinfo = info;
subinfo.SetDamageForce( m_vecTotalBulletForce );
// Note: since we're dead, it won't draw us on the client, but we don't set EF_NODRAW
// because we still want to transmit to the clients in our PVS.
CreateRagdollEntity();
//DHL - Skillet - SLAMs are removed, plus the sound is cheesy at death
//DetonateTripmines();
BaseClass::Event_Killed( subinfo );
if ( info.GetDamageType() & DMG_DISSOLVE )
{
if ( m_hRagdoll )
{
m_hRagdoll->GetBaseAnimating()->Dissolve( NULL, gpGlobals->curtime, false, ENTITY_DISSOLVE_NORMAL );
}
}
CBaseEntity *pAttacker = info.GetAttacker();
if ( pAttacker )
{
int iScoreToAdd = 1;
if ( pAttacker == this )
{
iScoreToAdd = -1;
}
if ( !DHLRules()->IsGameWaiting() ) //DHL
{
GetGlobalTeam( pAttacker->GetTeamNumber() )->AddScore( iScoreToAdd );
}
}
FlashlightTurnOff();
m_lifeState = LIFE_DEAD;
RemoveEffects( EF_NODRAW ); // still draw player body
StopZooming();
}
示例13: Warning
bool CHL2MP_Player::HandleCommand_JoinTeam( int team )
{
#ifndef GE_DLL
if ( !GetGlobalTeam( team ) || team == 0 )
{
Warning( "HandleCommand_JoinTeam( %d ) - invalid team index.\n", team );
return false;
}
if ( team == TEAM_SPECTATOR )
{
// Prevent this is the cvar is set
if ( !mp_allowspectators.GetInt() )
{
ClientPrint( this, HUD_PRINTCENTER, "#Cannot_Be_Spectator" );
return false;
}
if ( GetTeamNumber() != TEAM_UNASSIGNED && !IsDead() )
{
m_fNextSuicideTime = gpGlobals->curtime; // allow the suicide to work
CommitSuicide();
// add 1 to frags to balance out the 1 subtracted for killing yourself
IncrementFragCount( 1 );
}
ChangeTeam( TEAM_SPECTATOR );
return true;
}
else
{
StopObserverMode();
State_Transition(STATE_ACTIVE);
}
// Switch their actual team...
ChangeTeam( team );
return true;
#else
return false;
#endif
}
示例14: GetReplayStartTime
void CReplayManager::AddMatchEvent(match_event_t type, int team, CSDKPlayer *pPlayer1, CSDKPlayer *pPlayer2/* = NULL*/, CSDKPlayer *pPlayer3/* = NULL*/)
{
MatchEvent *pMatchEvent = new MatchEvent;
if (type == MATCH_EVENT_GOAL || type == MATCH_EVENT_OWNGOAL || type == MATCH_EVENT_MISS || type == MATCH_EVENT_KEEPERSAVE || type == MATCH_EVENT_REDCARD)
{
float replayStartTime = GetReplayStartTime() + 1.0f;
for (int i = 0; i < m_Snapshots.Count(); i++)
{
if (m_Snapshots[i]->snaptime >= replayStartTime)
{
pMatchEvent->snapshots.AddToTail(m_Snapshots[i]);
m_Snapshots[i]->replayCount += 1;
}
}
pMatchEvent->snapshotEndTime = gpGlobals->curtime + 1.0f;
}
else
pMatchEvent->snapshotEndTime = 0;
pMatchEvent->matchPeriod = SDKGameRules()->State_Get();
pMatchEvent->matchEventType = type;
pMatchEvent->second = SDKGameRules()->GetMatchDisplayTimeSeconds();
pMatchEvent->team = team;
pMatchEvent->atMinGoalPos = GetMatchBall()->GetPos().y < SDKGameRules()->m_vKickOff.GetY();
pMatchEvent->pPlayer1Data = pPlayer1 ? pPlayer1->GetPlayerData() : NULL;
pMatchEvent->pPlayer2Data = pPlayer2 ? pPlayer2->GetPlayerData() : NULL;
pMatchEvent->pPlayer3Data = pPlayer3 ? pPlayer3->GetPlayerData() : NULL;
m_MatchEvents.AddToTail(pMatchEvent);
if (type == MATCH_EVENT_GOAL || type == MATCH_EVENT_OWNGOAL || type == MATCH_EVENT_YELLOWCARD || type == MATCH_EVENT_SECONDYELLOWCARD || type == MATCH_EVENT_REDCARD)
{
char matchEventPlayerNames[MAX_MATCH_EVENT_PLAYER_NAME_LENGTH] = {};
if (pPlayer1 && !pPlayer2 && !pPlayer3)
Q_strncpy(matchEventPlayerNames, UTIL_VarArgs("%s", pPlayer1->GetPlayerName()), MAX_MATCH_EVENT_PLAYER_NAME_LENGTH);
else if (pPlayer1 && pPlayer2 && !pPlayer3)
Q_strncpy(matchEventPlayerNames, UTIL_VarArgs("%.15s (%.15s)", pPlayer1->GetPlayerName(), pPlayer2->GetPlayerName()), MAX_MATCH_EVENT_PLAYER_NAME_LENGTH);
else if (pPlayer1 && pPlayer2 && pPlayer3)
Q_strncpy(matchEventPlayerNames, UTIL_VarArgs("%.10s (%.10s, %.10s)", pPlayer1->GetPlayerName(), pPlayer2->GetPlayerName(), pPlayer3->GetPlayerName()), MAX_MATCH_EVENT_PLAYER_NAME_LENGTH);
GetGlobalTeam(pMatchEvent->team)->AddMatchEvent(pMatchEvent->matchPeriod, pMatchEvent->second, pMatchEvent->matchEventType, matchEventPlayerNames);
}
}
示例15: CreateRagdollEntity
void CHL2MP_Player::Event_Killed( const CTakeDamageInfo &info )
{
//update damage info with our accumulated physics force
CTakeDamageInfo subinfo = info;
subinfo.SetDamageForce( m_vecTotalBulletForce );
//BP empêche de créer un ragdoll si on change de team en mode spectateur
if(GetTeamNumber() != TEAM_SPECTATOR)
CreateRagdollEntity();
BaseClass::Event_Killed( subinfo );
if ( info.GetDamageType() & DMG_DISSOLVE )
if ( m_hRagdoll )
m_hRagdoll->GetBaseAnimating()->Dissolve( NULL, gpGlobals->curtime, false, ENTITY_DISSOLVE_NORMAL );
CBaseEntity *pAttacker = info.GetAttacker();
if ( pAttacker )
{
int iScoreToAdd = 1;
if ( pAttacker == this)
{
if(HL2MPRules()->GetGameType() == GAME_TDM)
iScoreToAdd = 0;
else
iScoreToAdd = -1;
}
if((HL2MPRules()->GetGameType() == GAME_FORTS) || (HL2MPRules()->GetGameType() == GAME_PUSH))
iScoreToAdd = 0;
GetGlobalTeam( pAttacker->GetTeamNumber() )->AddScore( iScoreToAdd );
}
FlashlightTurnOff();
m_lifeState = LIFE_DEAD;
RemoveEffects( EF_NODRAW ); // still draw player body
StopZooming();
DetonateTripmines();
//BP enregistre le tueur
SetKiller(info.GetAttacker());
}