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


C++ Creature::CREPlaySound方法代码示例

本文整理汇总了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);
}
开发者ID:ddionisio,项目名称:TaTaMahatta,代码行数:10,代码来源:tata_creature_status.cpp

示例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;
}
开发者ID:ddionisio,项目名称:TaTaMahatta,代码行数:44,代码来源:tata_creature_status.cpp

示例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
//.........这里部分代码省略.........
开发者ID:ddionisio,项目名称:TaTaMahatta,代码行数:101,代码来源:projectile_spit.cpp


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