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


C++ CBaseHandle::ToInt方法代码示例

本文整理汇总了C++中CBaseHandle::ToInt方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseHandle::ToInt方法的具体用法?C++ CBaseHandle::ToInt怎么用?C++ CBaseHandle::ToInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBaseHandle的用法示例。


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

示例1: IntHandleFromBaseHandle

//-----------------------------------------------------------------------------
// Returns an IntHandle from the given BaseHandle instance.
//-----------------------------------------------------------------------------
bool IntHandleFromBaseHandle( CBaseHandle hBaseHandle, unsigned int& output )
{
	if (!hBaseHandle.IsValid())
		return false;

	unsigned int iEntityHandle = hBaseHandle.ToInt();
	if (!iEntityHandle)
		return false;

	output = iEntityHandle;
	return true;
}
开发者ID:dsezen,项目名称:Source.Python,代码行数:15,代码来源:inthandle_from.cpp

示例2:

cell_t CHalfLife2::EntityToBCompatRef(CBaseEntity *pEntity)
{
	if (pEntity == NULL)
	{
		return INVALID_EHANDLE_INDEX;
	}

	IServerUnknown *pUnknown = (IServerUnknown *)pEntity;
	CBaseHandle hndl = pUnknown->GetRefEHandle();

	if (hndl == INVALID_EHANDLE_INDEX)
	{
		return INVALID_EHANDLE_INDEX;
	}
	
	if (hndl.GetEntryIndex() >= MAX_EDICTS)
	{
		return (hndl.ToInt() | (1<<31));
	}
	else
	{
		return hndl.GetEntryIndex();
	}
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:24,代码来源:HalfLife2.cpp

示例3: DrawModel

int CStaticProp::DrawModel( int flags )
{
#ifndef SWDS
	VPROF_BUDGET( "CStaticProp::DrawModel", VPROF_BUDGETGROUP_STATICPROP_RENDERING );

	if( !r_drawstaticprops.GetBool() )
	{
		return 0;
	}

#ifdef _DEBUG
	if (r_DrawSpecificStaticProp.GetInt() >= 0)
	{
		if ( (m_EntHandle.ToInt() & (~STATICPROP_EHANDLE_MASK) ) != r_DrawSpecificStaticProp.GetInt())
			return 0;
	}
#endif

	if ((m_Alpha == 0) || (!m_pModel))
		return 0;

	if( r_colorstaticprops.GetBool() )
	{
		Vector color;
		RandomColorFromModeInstanceHandle( m_ModelInstance, color );
		VectorCopy( color.Base(), r_colormod );
	}

	modelrender->UseLightcache( &m_LightCacheHandle );

#ifdef _DEBUG
	studiohdr_t *pStudioHdr = modelinfo->GetStudiomodel( m_pModel );
	Assert( pStudioHdr );
	if( !( pStudioHdr->flags & STUDIOHDR_FLAGS_STATIC_PROP ) )
	{
		return 0;
	}
#endif

	flags |= STUDIO_STATIC_LIGHTING;
#if 0
	Vector mins;
	Vector maxs;
	VectorAdd( m_RenderBBoxMin, m_Origin, mins );
	VectorAdd( m_RenderBBoxMax, m_Origin, maxs );
#endif	
	int drawn = modelrender->DrawModel( 
		flags, 
		this,
		m_ModelInstance,
		-1,		// no entity index
		m_pModel,
		m_Origin,
		m_Angles,
		0,		// sequence
		m_Skin,	// skin
		0,		// body
		0,		// hitboxset
#if 1
		NULL, NULL,
#else
		&mins, &maxs,
#endif
		&m_ModelToWorld
		);

	modelrender->UseLightcache();

	if ( vcollide_wireframe.GetBool() )
	{
		if ( m_pModel && m_nSolidType == SOLID_VPHYSICS )
		{
			// This works because VCollideForModel only uses modelindex for mod_brush
			// and props are always mod_Studio.
			vcollide_t * pCollide = CM_VCollideForModel( -1, m_pModel ); 
			if ( pCollide && pCollide->solidCount == 1 )
			{
				static color32 debugColor = {0,255,255,0};
				DebugDrawPhysCollide( pCollide->solids[0], NULL, m_ModelToWorld, debugColor );
			}
		}
	}

	return drawn;
#else
	return 0;
#endif
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:88,代码来源:staticpropmgr.cpp

示例4: IsStaticProp

bool CStaticPropMgr::IsStaticProp( CBaseHandle handle ) const
{
	return (handle.ToInt() & STATICPROP_EHANDLE_MASK) != 0;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:4,代码来源:staticpropmgr.cpp


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