本文整理汇总了C++中IEntitySoundProxy::CheckVisibilityForTailName方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntitySoundProxy::CheckVisibilityForTailName方法的具体用法?C++ IEntitySoundProxy::CheckVisibilityForTailName怎么用?C++ IEntitySoundProxy::CheckVisibilityForTailName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntitySoundProxy
的用法示例。
在下文中一共展示了IEntitySoundProxy::CheckVisibilityForTailName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FixResourceName
//------------------------------------------------------------------------
void CItem::FixResourceName(const ItemString &inName, TempResourceName &name, int flags, const char *hand, const char *suffix, const char *pose, const char *pov, const char *env)
{
// the whole thing of fixing is not nice, but at least we don't allocate too often
// StringHelper<TempResourceName::SIZE> name (inName.c_str(), inName.length());
name.assign(inName.c_str(), inName.length());
if(!hand)
{
if(m_stats.hand == eIH_Left)
hand = "left";
else
hand = "right";
}
name.replace("%hand%", hand);
if(m_stats.hand == eIH_Left)
name.replace("%offhand%", "right");
else
name.replace("%offhand%", "left");
if(!suffix)
suffix = m_actionSuffix.c_str();
name.replace("%suffix%", suffix);
if(!pose)
{
if(!m_sharedparams->params.pose.empty())
pose = m_sharedparams->params.pose.c_str();
else
pose = "";
}
name.replace("%pose%", "");
if(!pov)
{
if((m_stats.fp || flags&eIPAF_ForceFirstPerson) && !(flags&eIPAF_ForceThirdPerson))
pov = ITEM_FIRST_PERSON_TOKEN;
else
pov = ITEM_THIRD_PERSON_TOKEN;
}
name.replace("%pov%", pov);
if(!env)
{
// Instead if the weapons sound proxy, the owners is used to retrieve the tail name
IEntity *pOwner = GetOwner();
if(GetIWeapon() && pOwner) // restricting to weapon sounds only
{
if(pOwner)
{
IEntitySoundProxy *pSoundProxy = (IEntitySoundProxy *)pOwner->GetProxy(ENTITY_PROXY_SOUND);
if(!pSoundProxy)
pSoundProxy = (IEntitySoundProxy *)pOwner->CreateProxy(ENTITY_PROXY_SOUND);
if(pSoundProxy)
{
// check for a roof 10m above the Owner
// recalculate visibility when owner move more than 2 meters
pSoundProxy->CheckVisibilityForTailName(10.0f, 2.0f);
env = pSoundProxy->GetTailName();
}
}
}
if(!env || !env[0] || !stricmp("indoor", env))
name.replace("%env%", "");
else
{
static const size_t MAX_LEN = 256;
char envstr[MAX_LEN];
envstr[0] = '_';
strncpy(envstr+1, env, MAX_LEN-1); // no 0 pad, if MAX_LEN-1 are copied
envstr[MAX_LEN-1] = '\0'; // always zero-terminate
name.replace("%env%", envstr);
}
}
else
name.replace("%env%", env);
}