当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectiveResource函数代码示例

本文整理汇总了C++中ObjectiveResource函数的典型用法代码示例。如果您正苦于以下问题:C++ ObjectiveResource函数的具体用法?C++ ObjectiveResource怎么用?C++ ObjectiveResource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ObjectiveResource函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: STRING

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTriggerAreaCapture::InputRoundSpawn( inputdata_t &inputdata )
{
	// find the flag we're linked to
	if( !m_hPoint )
	{
		m_hPoint = dynamic_cast<CTeamControlPoint*>( gEntList.FindEntityByName(NULL, STRING(m_iszCapPointName) ) );

		if ( m_hPoint )
		{
			m_nOwningTeam = m_hPoint->GetOwner();

			for ( int i = FIRST_GAME_TEAM; i < GetNumberOfTeams(); i++ )
			{
				m_hPoint->SetCappersRequiredForTeam( i, m_TeamData[i].iNumRequiredToCap );

				ObjectiveResource()->SetCPRequiredCappers( m_hPoint->GetPointIndex(), i, m_TeamData[i].iNumRequiredToCap );
				ObjectiveResource()->SetTeamCanCap( m_hPoint->GetPointIndex(), i, m_TeamData[i].bCanCap );

				if ( CaptureModeScalesWithPlayers() )
				{
					ObjectiveResource()->SetCPCapTime( m_hPoint->GetPointIndex(), i, (m_flCapTime * 2) * m_TeamData[i].iNumRequiredToCap );
				}
				else
				{
					ObjectiveResource()->SetCPCapTime( m_hPoint->GetPointIndex(), i, m_flCapTime );
				}

				ObjectiveResource()->SetCPCapTimeScalesWithPlayers( m_hPoint->GetPointIndex(), CaptureModeScalesWithPlayers() );
			}
		}
	}
}
开发者ID:Baer42,项目名称:Source-SDK-2014,代码行数:35,代码来源:trigger_area_capture.cpp

示例2: ShutdownIcons

//-----------------------------------------------------------------------------
// Purpose: Create the icons we need to display the state of this map's control points
//-----------------------------------------------------------------------------
void CHudControlPointIcons::InitIcons( void )
{
	ShutdownIcons();

	CTFHudObjectiveStatus *pStatus = GET_HUDELEMENT( CTFHudObjectiveStatus );
	if ( pStatus )
	{
		CControlPointProgressBar *pProgressBar = pStatus->GetControlPointProgressBar();

		if ( pProgressBar )
		{
			m_iCurrentCP = -1;
			pProgressBar->SetupForPoint( NULL );
		}
	}

	// Create an icon for each visible control point in this miniround
	int iPoints = ObjectiveResource()->GetNumControlPoints();
	for ( int i = 0; i < iPoints; i++ )
	{
		if ( ObjectiveResource()->IsInMiniRound(i) && ObjectiveResource()->IsCPVisible(i) )
		{
			CControlPointIcon *pIcon = new CControlPointIcon( this, VarArgs( "ControlPointIcon%d", i ), i );
			m_Icons.AddToTail( vgui::SETUP_PANEL(pIcon) );
		}
	}

	InvalidateLayout();
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:32,代码来源:hud_controlpointicons.cpp

示例3: ObjectiveResource

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointIcon::UpdateImage( void )
{
	int iOwner = ObjectiveResource()->GetOwningTeam( m_iCPIndex );

	if ( m_pBaseImage )
	{
		int iOwnerIcon = ObjectiveResource()->GetCPCurrentOwnerIcon( m_iCPIndex, iOwner );
		const char *szMatName = GetMaterialNameFromIndex( iOwnerIcon );

		if ( IsPointLocked() )
		{
			m_pBaseImage->SetImage( VarArgs("..\\%s_locked", szMatName ) );
		}
		else
		{
			m_pBaseImage->SetImage( VarArgs("..\\%s", szMatName ) );
		}
	}

	if ( m_pOverlayImage )
	{
		int iOverlayIcon = ObjectiveResource()->GetOverlayForTeam( m_iCPIndex, iOwner );
		if ( iOverlayIcon )
		{
			const char *szMatName = GetMaterialNameFromIndex( iOverlayIcon );
			m_pOverlayImage->SetImage( VarArgs("..\\%s", szMatName ) );
			m_pOverlayImage->SetVisible( true );
		}
		else
		{
			m_pOverlayImage->SetVisible( false );
		}
	}

	// Whenever a successful cap occurs, flash the cap point
	if ( m_pCapPulseImage )
	{
		if ( m_iPrevCappers != 0 && iOwner == m_iPrevCappers )
		{
			m_iPrevCappers = 0;

			if ( ShouldDraw() )
			{
				m_pCapPulseImage->SetVisible( true );
				m_pCapPulseImage->StartPulse( gpGlobals->curtime, GetWide() );
			}
			m_pBaseImage->StartPulsing( FINISHCAPANIM_SWOOP_LENGTH, 0.5, false );
		}
		
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:54,代码来源:hud_controlpointicons.cpp

示例4: ObjectiveResource

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTriggerAreaCapture::UpdateCappingTeam( int iTeam )
{
	if ( m_hPoint )
	{
		ObjectiveResource()->SetCappingTeam( m_hPoint->GetPointIndex(), iTeam );
	}
}
开发者ID:Baer42,项目名称:Source-SDK-2014,代码行数:10,代码来源:trigger_area_capture.cpp

示例5: Q_strncpy

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTriggerAreaCapture::InputSetTeamCanCap( inputdata_t &inputdata )
{
	// Get the interaction name & target
	char parseString[255];
	Q_strncpy(parseString, inputdata.value.String(), sizeof(parseString));

	char *pszParam = strtok(parseString," ");
	if ( pszParam && pszParam[0] )
	{
		int iTeam = atoi( pszParam );
		pszParam = strtok(NULL," ");

		if ( pszParam && pszParam[0] )
		{
			bool bCanCap = (atoi(pszParam) != 0);

			if ( iTeam >= 0 && iTeam < GetNumberOfTeams() )
			{
				m_TeamData[iTeam].bCanCap = bCanCap;
				if ( m_hPoint )
				{
					ObjectiveResource()->SetTeamCanCap( m_hPoint->GetPointIndex(), iTeam, m_TeamData[iTeam].bCanCap );
				}
				return;
			}
		}
	}

	Warning("%s(%s) received SetTeamCanCap input with invalid format. Format should be: <team number> <can cap (0/1)>.\n", GetClassname(), GetDebugName() );
}
开发者ID:Baer42,项目名称:Source-SDK-2014,代码行数:33,代码来源:trigger_area_capture.cpp

示例6: while

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamRoundTimer::SetActiveTimer( CTeamRoundTimer *pNewlyActive )
{
	CBaseEntity *pChosenTimer = pNewlyActive;	

	// Ensure all other timers are off.
	CBaseEntity *pEntity = NULL;
	while ((pEntity = gEntList.FindEntityByClassname( pEntity, "team_round_timer" )) != NULL)
	{
		if ( pEntity == pNewlyActive )
			continue;

		CTeamRoundTimer *pTimer = assert_cast< CTeamRoundTimer* >( pEntity );
		if ( !pTimer->IsDisabled() && pTimer->ShowInHud() )
		{
			if ( pChosenTimer )
			{
				// Turn off all other hud timers
				pTimer->SetShowInHud( false );
			}
			else
			{
				// Found a timer. Use it.
				pChosenTimer = pTimer;
			}
		}
	}

	ObjectiveResource()->SetTimerInHUD( pChosenTimer );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:32,代码来源:teamplay_round_timer.cpp

示例7: GET_HUDELEMENT

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CHudControlPointIcons::UpdateProgressBarFor( int iIndex )
{
	// If they tell us to update all progress bars, update only the one we're standing on
	if ( iIndex == -1 )
	{
		iIndex = m_iCurrentCP;
	}

	// Ignore requests to display progress bars for points we're not standing on
	if ( ( m_iCurrentCP != iIndex ) )
		return;

	// This can happen at level load
	CTFHudObjectiveStatus *pStatus = GET_HUDELEMENT( CTFHudObjectiveStatus );
	if ( pStatus && pStatus->GetControlPointProgressBar() )
	{
		CControlPointProgressBar *pProgressBar = pStatus->GetControlPointProgressBar();
		if ( !IsVisible() || iIndex < 0 || iIndex >= ObjectiveResource()->GetNumControlPoints() )
		{
			pProgressBar->SetupForPoint( NULL );
		}
		else
		{
			for (int i = 0; i < m_Icons.Count(); i++)
			{
				if ( m_Icons[i]->GetCapIndex() == iIndex )
				{
					pProgressBar->SetupForPoint( m_Icons[i] );
					break;
				}
			}
		}
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:37,代码来源:hud_controlpointicons.cpp

示例8: Assert

//-----------------------------------------------------------------------------
// Purpose: Used by Area caps to set the owner
//-----------------------------------------------------------------------------
void CTeamControlPoint::InputSetOwner( inputdata_t &input )
{
	int iCapTeam = input.value.Int();

	Assert( iCapTeam >= 0 && iCapTeam < GetNumberOfTeams() );

	Assert( input.pCaller );

	if ( GetOwner() == iCapTeam )
		return;

	if ( TeamplayGameRules()->PointsMayBeCaptured() )
	{
		// must be done before setting the owner
		HandleScoring( iCapTeam );

		if ( input.pCaller->IsPlayer() )
		{
			int iCappingPlayer = input.pCaller->entindex();
			InternalSetOwner( iCapTeam, true, 1, &iCappingPlayer );
		}
		else
		{
			InternalSetOwner( iCapTeam, false );
		}

		ObjectiveResource()->SetOwningTeam( GetPointIndex(), m_iTeam );
	}
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:32,代码来源:team_control_point.cpp

示例9: InternalSetOwner

//-----------------------------------------------------------------------------
// Purpose: Used by ControlMaster to this point to its default owner
//-----------------------------------------------------------------------------
void CTeamControlPoint::InputReset( inputdata_t &input )
{
	m_flLastContestedAt = -1;
	InternalSetOwner( m_iDefaultOwner, false );
	ObjectiveResource()->SetOwningTeam( GetPointIndex(), m_iTeam );
	TeamplayRoundBasedRules()->RecalculateControlPointState();
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:10,代码来源:team_control_point.cpp

示例10: TeamplayRoundBasedRules

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointProgressBar::SetupForPoint( CControlPointIcon *pIcon )
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer )
		return;

	m_pAttachedToIcon = pIcon;

	bool bInWinState = TeamplayRoundBasedRules() ? TeamplayRoundBasedRules()->RoundHasBeenWon() : false;

	if ( m_pAttachedToIcon && !bInWinState )
	{
		SetVisible( true );

		int iCP = m_pAttachedToIcon->GetCapIndex();
		int iCappingTeam = ObjectiveResource()->GetCappingTeam( iCP );
		int iOwnerTeam = ObjectiveResource()->GetOwningTeam( iCP );
		int iPlayerTeam = pPlayer->GetTeamNumber();
		bool bCapBlocked = ObjectiveResource()->CapIsBlocked( iCP );

		if ( !bCapBlocked && iCappingTeam != TEAM_UNASSIGNED && iCappingTeam != iOwnerTeam && iCappingTeam == iPlayerTeam )
		{
			m_pBar->SetBgImage( ObjectiveResource()->GetGameSpecificCPBarBG( iCP, iCappingTeam ) );
			m_pBar->SetFgImage( ObjectiveResource()->GetGameSpecificCPBarFG( iCP, iOwnerTeam ) );
			m_pBar->SetVisible( true );
			m_pBlocked->SetVisible( false );
			m_pBarText->SetVisible( false );
		}
		else
		{
			m_pBar->SetVisible( false );
			m_pBlocked->SetVisible( true );
			
			UpdateBarText();
		}

		InvalidateLayout();
	}
	else
	{
		SetVisible( false );
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:46,代码来源:hud_controlpointicons.cpp

示例11: STRING

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamControlPoint::InternalSetLocked( bool bLocked )
{
	if ( !bLocked && m_bLocked )
	{
		// unlocked this point
		IGameEvent *event = gameeventmanager->CreateEvent( "teamplay_point_unlocked" );
		if ( event )
		{
			event->SetInt( "cp", m_iPointIndex );
			event->SetString( "cpname", STRING( m_iszPrintName ) );
			event->SetInt( "team", m_iTeam );
			gameeventmanager->FireEvent( event );
		}
	}
	else if ( bLocked && !m_bLocked )
	{
		// locked this point
		IGameEvent *event = gameeventmanager->CreateEvent( "teamplay_point_locked" );
		if ( event )
		{
			event->SetInt( "cp", m_iPointIndex );
			event->SetString( "cpname", STRING( m_iszPrintName ) );
			event->SetInt( "team", m_iTeam );
			gameeventmanager->FireEvent( event );
		}
	}

	m_bLocked = bLocked;

	if ( ObjectiveResource() && GetPointIndex() < ObjectiveResource()->GetNumControlPoints() )
	{
		ObjectiveResource()->SetCPLocked( GetPointIndex(), m_bLocked );
		ObjectiveResource()->SetCPUnlockTime( GetPointIndex(), 0.0f );
	}

	if ( !m_bLocked )
	{
		m_flUnlockTime = -1;
		m_OnUnlocked.FireOutput( this, this );
		SetContextThink( NULL, 0, CONTROL_POINT_UNLOCK_THINK );
	}
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:45,代码来源:team_control_point.cpp

示例12: ObjectiveResource

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
float CTeamControlPoint::GetTeamCapPercentage( int iTeam )
{
	int iCappingTeam = ObjectiveResource()->GetCappingTeam( GetPointIndex() );
	if ( iCappingTeam == TEAM_UNASSIGNED )
	{
		// No-one's capping this point.
		if ( iTeam == m_iTeam )
			return 1.0;

		return 0.0;
	}

	float flCapPerc = ObjectiveResource()->GetCPCapPercentage( GetPointIndex() );
	if ( iTeam == iCappingTeam )
		return (1.0 - flCapPerc);
	if ( iTeam == m_iTeam )
		return flCapPerc;

	return 0.0;
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:23,代码来源:team_control_point.cpp

示例13: HandleScoring

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamControlPoint::SetOwner( int iCapTeam, bool bMakeSound, int iNumCappers, int *pCappingPlayers )
{
	if ( TeamplayGameRules()->PointsMayBeCaptured() )
	{
		// must be done before setting the owner
		HandleScoring( iCapTeam );

		InternalSetOwner( iCapTeam, bMakeSound, iNumCappers, pCappingPlayers );
		ObjectiveResource()->SetOwningTeam( GetPointIndex(), m_iTeam );
	}
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:14,代码来源:team_control_point.cpp

示例14: IsPointLocked

//-----------------------------------------------------------------------------
// Purpose: Lock cap points when neither team can cap them for map-specific reasons
//-----------------------------------------------------------------------------
bool CControlPointIcon::IsPointLocked( void )
{
	bool bAnyTeamCanCap = false;
	for ( int gameteam = FIRST_GAME_TEAM; gameteam < GetNumberOfTeams(); gameteam++ )
	{
		// Ignore teams that already own the point
		if ( ObjectiveResource()->GetOwningTeam(m_iCPIndex) != gameteam )
		{
			if ( (ObjectiveResource()->TeamCanCapPoint( m_iCPIndex, gameteam)) )
			{
				if ( TeamplayGameRules()->TeamMayCapturePoint( gameteam, m_iCPIndex ) )
				{
					bAnyTeamCanCap = true;
				}
			}
		}
	}

	return ( !bAnyTeamCanCap );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:23,代码来源:hud_controlpointicons.cpp

示例15: InternalSetLocked

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamControlPoint::InputSetUnlockTime( inputdata_t &inputdata )
{
	// never lock/unlock the point if we're in waiting for players
	if ( TeamplayRoundBasedRules() && TeamplayRoundBasedRules()->IsInWaitingForPlayers() )
		return;

	int nTime = inputdata.value.Int();

	if ( nTime <= 0 )
	{
		InternalSetLocked( false );
		return;
	}

	m_flUnlockTime = gpGlobals->curtime + nTime;

	if ( ObjectiveResource() )
	{
		ObjectiveResource()->SetCPUnlockTime( GetPointIndex(), m_flUnlockTime );
	}

	SetContextThink( &CTeamControlPoint::UnlockThink, gpGlobals->curtime + 0.1, CONTROL_POINT_UNLOCK_THINK );
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:26,代码来源:team_control_point.cpp


注:本文中的ObjectiveResource函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。