本文整理汇总了C++中Creature::CREPlaySound方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::CREPlaySound方法的具体用法?C++ Creature::CREPlaySound怎么用?C++ Creature::CREPlaySound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::CREPlaySound方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GO
void StatusTeleport::GO()
{
m_bGO = true;
//play teleport sound
Creature *pCre = (Creature *)IDPageQuery(m_owner);
if(pCre)
pCre->CREPlaySound(37);
}
示例2: Update
RETCODE StatusTeleport::Update()
{
RETCODE ret = RETCODE_SUCCESS;
Creature *pCre = (Creature *)IDPageQuery(m_owner);
if(m_bGO)
{
if(pCre)
{
hOBJ obj = pCre->GetOBJ(); assert(obj);
double t = TimeGetTime(&m_delay)/TimeGetDelay(&m_delay);
if(t >= 1)
{
t = 1;
TimeReset(&m_delay);
}
OBJSetAlpha(obj, m_bFading ? 1-t : t);
//are we done?
if(t == 1 && !m_bFading)
ret = RETCODE_STATUS_DONE;
else if(t == 1 && m_bFading)
{
m_bFading = false;
//set to new location
pCre->SetLoc(m_dest);
D3DXVECTOR3 zeroVel(0,0,0);
pCre->SetVel(zeroVel);
pCre->CREPlaySound(38);
}
}
else
ret = RETCODE_STATUS_DONE;
}
return ret;
}
示例3: Callback
int _Spit::Callback(unsigned int msg, unsigned int wParam, int lParam)
{
switch(msg)
{
case ENTITYMSG_UPDATE:
//update velocity
SetVel(GetDir()*m_spd.MoveUpdate(g_timeElapse));
//update sound position
if(m_tSnd)
{
BASS_3DVECTOR pos, orient, vel;
memcpy(&pos, (float*)GetLoc(), sizeof(pos)); pos.z *= -1;
memcpy(&orient, (float*)GetDir(), sizeof(orient)); orient.z *= -1;
memcpy(&vel, (float*)GetVel(), sizeof(vel)); vel.z *= -1;
BASS_ChannelSet3DPosition(m_tSnd, &pos, &orient, &vel);
}
break;
case ENTITYMSG_ENTITYCOLLIDE://, (WPARAM)pEntity
{
EntityCommon *pEntity = (EntityCommon *)wParam;
EntityCommon *pOwner = (EntityCommon *)IDPageQuery(GetOwner());
//check to see if the owner is not the same type as entity
if(pOwner)
{
if(pOwner->GetEntityType() != pEntity->GetEntityType())
{
//check to see if the entity is a creature
if((pEntity->GetEntityType() == ENTITY_TYPE_TATA
|| pEntity->GetEntityType() == ENTITY_TYPE_ENEMY)
&& !pEntity->CheckFlag(CRE_FLAG_SPITIMMUNE))
{
//hit this fella
Creature *pCre = (Creature *)pEntity;
if(pCre->Hit())
{
int sndInd = -1;
pOwner->Callback(ENTITYMSG_REQUESTSOUND, SND_REQ_PROJ_HIT_CRE, (LPARAM)&sndInd);
pCre->CREPlaySound(sndInd);
}
SetFlag(ENTITY_FLAG_POLLDEATH, true);
}
}
}
if(!m_bBounce || m_bounceCur == m_bounceMax)
SetFlag(ENTITY_FLAG_POLLDEATH, true);
else
{
//bounce off
gfxTrace *pTrace = (gfxTrace*)lParam;
D3DXVECTOR3 norm(pTrace->norm), refl;
float nd = D3DXVec3Dot(&GetDir(), &norm);
refl = GetDir() - (2*nd*norm);
SetDir(refl);
m_bounceCur++;
}
}
break;
case ENTITYMSG_WORLDCOLLIDE:
{
if(!m_bBounce || m_bounceCur == m_bounceMax)
SetFlag(ENTITY_FLAG_POLLDEATH, true);
else
{
//bounce off
gfxTrace *pTrace = (gfxTrace*)lParam;
D3DXVECTOR3 norm(pTrace->norm), refl;
float nd = D3DXVec3Dot(&GetDir(), &norm);
refl = GetDir() - (2*nd*norm);
SetDir(refl);
m_bounceCur++;
}
}
break;
case ENTITYMSG_DEATH:
//cool FX explosion
break;
case ENTITYMSG_ALLOWGRAVITY:
//simply don't allow gravity
//.........这里部分代码省略.........