本文整理汇总了C++中CBaseEntity::GetModel方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseEntity::GetModel方法的具体用法?C++ CBaseEntity::GetModel怎么用?C++ CBaseEntity::GetModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseEntity
的用法示例。
在下文中一共展示了CBaseEntity::GetModel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StandardFilterRules
//-----------------------------------------------------------------------------
// A standard filter to be applied to just about everything.
//-----------------------------------------------------------------------------
bool StandardFilterRules( IHandleEntity *pHandleEntity, int fContentsMask )
{
CBaseEntity *pCollide = EntityFromEntityHandle( pHandleEntity );
// Static prop case...
if ( !pCollide )
return true;
SolidType_t solid = pCollide->GetSolid();
const model_t *pModel = pCollide->GetModel();
if ( ( modelinfo->GetModelType( pModel ) != mod_brush ) || (solid != SOLID_BSP && solid != SOLID_VPHYSICS) )
{
if ( (fContentsMask & CONTENTS_MONSTER) == 0 )
return false;
}
// This code is used to cull out tests against see-thru entities
if ( !(fContentsMask & CONTENTS_WINDOW) && pCollide->IsTransparent() )
return false;
// FIXME: this is to skip BSP models that are entities that can be
// potentially moved/deleted, similar to a monster but doors don't seem to
// be flagged as monsters
// FIXME: the FL_WORLDBRUSH looked promising, but it needs to be set on
// everything that's actually a worldbrush and it currently isn't
if ( !(fContentsMask & CONTENTS_MOVEABLE) && (pCollide->GetMoveType() == MOVETYPE_PUSH))// !(touch->flags & FL_WORLDBRUSH) )
return false;
return true;
}
示例2: ShouldHitEntity
virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
{
static const char *ppszIgnoredClasses[] =
{
"weapon_*",
"item_*",
"prop_ragdoll",
"prop_dynamic",
"prop_static",
"prop_physics",
"npc_bullseye", // Tracker 15335
};
CBaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );
// Tracker 15335: Never impact decals against entities which are not rendering, either.
if ( pEntity->IsEffectActive( EF_NODRAW ) )
return false;
for ( int i = 0; i < ARRAYSIZE(ppszIgnoredClasses); i++ )
{
if ( pEntity->ClassMatches( ppszIgnoredClasses[i] ) )
return false;
}
if ( modelinfo->GetModelType( pEntity->GetModel() ) != mod_brush )
return false;
return CTraceFilterSimple::ShouldHitEntity( pServerEntity, contentsMask );
}
示例3: Build
void CToySource::Build() const
{
Save();
CGeppetto g(true, FindAbsolutePath(GetDirectory(m_sFilename)));
bool bSuccess = g.BuildFromInputScript(FindAbsolutePath(m_sFilename));
if (bSuccess)
{
if (CModelLibrary::FindModel(m_sToyFile) != ~0)
{
CModel* pModel = CModelLibrary::GetModel(CModelLibrary::FindModel(m_sToyFile));
TAssert(pModel);
if (pModel)
{
for (size_t i = 0; i < GameServer()->GetMaxEntities(); i++)
{
CBaseEntity* pEntity = CBaseEntity::GetEntity(i);
if (!pEntity)
continue;
if (pEntity->GetModel() == pModel)
pEntity->RemoveFromPhysics();
}
pModel->Reload();
}
}
else
CModelLibrary::AddModel(m_sToyFile);
}
}
示例4: FrameStageNotify
void __stdcall FrameStageNotify(ClientFrameStage_t curStage)
{
originalFrameStageNotify(interfaces::client, curStage);
if (curStage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
{
if (cvar::misc_skinchanger)
{
player_info_t info;
CBaseEntity* local = interfaces::entitylist->GetClientEntity(interfaces::engine->GetLocalPlayer());
if (!local
|| local->GetLifeState() != LIFE_ALIVE
|| !interfaces::engine->GetPlayerInfo(local->GetIndex(), &info))
return;
for (int i = 1; i <= interfaces::entitylist->GetHighestEntityIndex(); i++)
{
if (i == local->GetIndex())
continue;
CBaseEntity* entity = interfaces::entitylist->GetClientEntity(i);
if (!entity)
continue;
std::string modelName = interfaces::modelinfo->GetModelName(entity->GetModel());
if (modelName.find(charenc("models/weapons")) == std::string::npos)
continue;
CBaseEntity* owner = interfaces::entitylist->GetClientEntityFromHandle(entity->GetOwner());
if (!owner
|| owner != local)
continue;
CBaseCombatWeapon* weapon = (CBaseCombatWeapon*)entity;
if (!weapon)
return;
if (!weapon->IsKnife())
{
weapon->SetPattern(info, config.skincfg[weapon->GetItemDefinitionIndex()].skin, config.skincfg[weapon->GetItemDefinitionIndex()].wear, config.skincfg[weapon->GetItemDefinitionIndex()].seed, config.skincfg[weapon->GetItemDefinitionIndex()].stattrak, config.skincfg[weapon->GetItemDefinitionIndex()].name);
}
else
{
if (cvar::misc_knifechanger)
{
if (cvar::misc_knifechanger_model == 0)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_BAYONET;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_BAYONET].skin, config.skincfg[WEAPON_KNIFE_BAYONET].wear, config.skincfg[WEAPON_KNIFE_BAYONET].seed, config.skincfg[WEAPON_KNIFE_BAYONET].stattrak, config.skincfg[WEAPON_KNIFE_BAYONET].name);
}
else if (cvar::misc_knifechanger_model == 1)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_FLIP;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_FLIP].skin, config.skincfg[WEAPON_KNIFE_FLIP].wear, config.skincfg[WEAPON_KNIFE_FLIP].seed, config.skincfg[WEAPON_KNIFE_FLIP].stattrak, config.skincfg[WEAPON_KNIFE_FLIP].name);
}
else if (cvar::misc_knifechanger_model == 2)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_GUT;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_GUT].skin, config.skincfg[WEAPON_KNIFE_GUT].wear, config.skincfg[WEAPON_KNIFE_GUT].seed, config.skincfg[WEAPON_KNIFE_GUT].stattrak, config.skincfg[WEAPON_KNIFE_GUT].name);
}
else if (cvar::misc_knifechanger_model == 3)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_KARAMBIT;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_KARAMBIT].skin, config.skincfg[WEAPON_KNIFE_KARAMBIT].wear, config.skincfg[WEAPON_KNIFE_KARAMBIT].seed, config.skincfg[WEAPON_KNIFE_KARAMBIT].stattrak, config.skincfg[WEAPON_KNIFE_KARAMBIT].name);
}
else if (cvar::misc_knifechanger_model == 4)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_M9BAYONET;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_M9BAYONET].skin, config.skincfg[WEAPON_KNIFE_M9BAYONET].wear, config.skincfg[WEAPON_KNIFE_M9BAYONET].seed, config.skincfg[WEAPON_KNIFE_M9BAYONET].stattrak, config.skincfg[WEAPON_KNIFE_M9BAYONET].name);
}
else if (cvar::misc_knifechanger_model == 5)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_HUNTSMAN;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_HUNTSMAN].skin, config.skincfg[WEAPON_KNIFE_HUNTSMAN].wear, config.skincfg[WEAPON_KNIFE_HUNTSMAN].seed, config.skincfg[WEAPON_KNIFE_HUNTSMAN].stattrak, config.skincfg[WEAPON_KNIFE_HUNTSMAN].name);
}
else if (cvar::misc_knifechanger_model == 6)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_FALCHION;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_FALCHION].skin, config.skincfg[WEAPON_KNIFE_FALCHION].wear, config.skincfg[WEAPON_KNIFE_FALCHION].seed, config.skincfg[WEAPON_KNIFE_FALCHION].stattrak, config.skincfg[WEAPON_KNIFE_FALCHION].name);
}
else if (cvar::misc_knifechanger_model == 7)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_BUTTERFLY;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_BUTTERFLY].skin, config.skincfg[WEAPON_KNIFE_BUTTERFLY].wear, config.skincfg[WEAPON_KNIFE_BUTTERFLY].seed, config.skincfg[WEAPON_KNIFE_BUTTERFLY].stattrak, config.skincfg[WEAPON_KNIFE_BUTTERFLY].name);
}
else if (cvar::misc_knifechanger_model == 8)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_DAGGER;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_DAGGER].skin, config.skincfg[WEAPON_KNIFE_DAGGER].wear, config.skincfg[WEAPON_KNIFE_DAGGER].seed, config.skincfg[WEAPON_KNIFE_DAGGER].stattrak, config.skincfg[WEAPON_KNIFE_DAGGER].name);
}
else if (cvar::misc_knifechanger_model == 9)
{
*(int*)((DWORD)weapon + offsets::weapon::m_iItemDefinitionIndex) = WEAPON_KNIFE_BOWIE;
weapon->SetPattern(info, config.skincfg[WEAPON_KNIFE_BOWIE].skin, config.skincfg[WEAPON_KNIFE_BOWIE].wear, config.skincfg[WEAPON_KNIFE_BOWIE].seed, config.skincfg[WEAPON_KNIFE_BOWIE].stattrak, config.skincfg[WEAPON_KNIFE_BOWIE].name);
}
}
}
}
}
//.........这里部分代码省略.........