本文整理汇总了C++中IEntitySoundProxy::PlaySoundEx方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntitySoundProxy::PlaySoundEx方法的具体用法?C++ IEntitySoundProxy::PlaySoundEx怎么用?C++ IEntitySoundProxy::PlaySoundEx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntitySoundProxy
的用法示例。
在下文中一共展示了IEntitySoundProxy::PlaySoundEx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlayRotationSound
tSoundID CHeavyMountedWeapon::PlayRotationSound()
{
tSoundID result = 0;
IEntitySoundProxy* pSoundProxy = GetSoundProxy(true);
if (pSoundProxy)
{
const ItemString& soundName = m_stats.fp ? m_sharedparams->pMountParams->rotate_sound_fp : m_sharedparams->pMountParams->rotate_sound_tp;
result = pSoundProxy->PlaySoundEx(soundName.c_str(), ZERO, FORWARD_DIRECTION, FLAG_SOUND_DEFAULT_3D, 0, 1.0f, 0, 0, eSoundSemantic_Weapon);
}
return result;
}
示例2: PlayAction
//------------------------------------------------------------------------
tSoundID CItem::PlayAction(const ItemString &actionName, int layer, bool loop, uint32 flags, float speedOverride)
{
if(!m_enableAnimations || !IsOwnerInGame())
return (tSoundID)-1;
TActionMap::iterator it = m_sharedparams->actions.find(CONST_TEMPITEM_STRING(actionName));
if(it == m_sharedparams->actions.end())
{
// GameWarning("Action '%s' not found on item '%s'!", actionName, GetEntity()->GetName());
for(int i=0; i<eIGS_Last; i++)
{
m_animationTime[i]=0;
m_animationSpeed[i]=1.0f;
m_animationEnd[i]=0;
}
return 0;
}
bool fp = m_stats.fp;
if(m_parentId)
{
CItem *pParent=static_cast<CItem *>(m_pItemSystem->GetItem(m_parentId));
if(pParent)
fp=pParent->GetStats().fp;
}
if(flags&eIPAF_ForceFirstPerson)
fp = true;
if(flags&eIPAF_ForceThirdPerson)
fp = false;
int sid=fp?eIGS_FirstPerson:eIGS_ThirdPerson;
SAction &action = it->second;
tSoundID result = INVALID_SOUNDID;
if((flags&eIPAF_Sound) && !action.sound[sid].name.empty() && IsSoundEnabled() && g_pGameCVars->i_soundeffects)
{
int nSoundFlags = FLAG_SOUND_DEFAULT_3D;
nSoundFlags |= flags&eIPAF_SoundStartPaused?FLAG_SOUND_START_PAUSED:0;
IEntitySoundProxy *pSoundProxy = GetSoundProxy(true);
//GetSound proxy from dualwield master if neccesary
if(IsDualWieldSlave())
{
CItem *pMaster = static_cast<CItem *>(GetDualWieldMaster());
if(pMaster)
{
pSoundProxy = pMaster->GetSoundProxy(true);
}
}
EntityId pSkipEnts[3];
int nSkipEnts = 0;
// TODO for Marcio :)
// check code changes
// Skip the Item
pSkipEnts[nSkipEnts] = GetEntity()->GetId();
++nSkipEnts;
// Skip the Owner
if(GetOwner())
{
pSkipEnts[nSkipEnts] = GetOwner()->GetId();
++nSkipEnts;
}
if(pSoundProxy)
{
TempResourceName name;
FixResourceName(action.sound[sid].name, name, flags);
//nSoundFlags = nSoundFlags | (fp?FLAG_SOUND_DEFAULT_3D|FLAG_SOUND_RELATIVE:FLAG_SOUND_DEFAULT_3D);
Vec3 vOffset(0,0,0);
if(fp)
vOffset.x = 0.3f; // offset for first person weapon to the front
if(!g_pGameCVars->i_staticfiresounds)
{
result = pSoundProxy->PlaySoundEx(name, vOffset, FORWARD_DIRECTION, nSoundFlags, 1.0f, 0, 0, eSoundSemantic_Weapon, pSkipEnts, nSkipEnts);
ISound *pSound = pSoundProxy->GetSound(result);
if(pSound && action.sound[sid].sphere>0.0f)
pSound->SetSphereSpec(action.sound[sid].sphere);
}
else
{
SInstanceAudio *pInstanceAudio=0;
//.........这里部分代码省略.........