Example #1
0
void CWeaponDrainGrenade::Detonate()
{
	trace_t		tr;
	Vector		vecSpot;// trace starts here!

	SetThink( NULL );

	vecSpot = GetAbsOrigin() + Vector ( 0 , 0 , 8 );
	UTIL_TraceLine ( vecSpot, vecSpot + Vector ( 0, 0, -32 ), MASK_SHOT_HULL, this, COLLISION_GROUP_NONE, & tr);

	if( tr.startsolid )
	{
		// Since we blindly moved the explosion origin vertically, we may have inadvertently moved the explosion into a solid,
		// in which case nothing is going to be harmed by the grenade's explosion because all subsequent traces will startsolid.
		// If this is the case, we do the downward trace again from the actual origin of the grenade. (sjb) 3/8/2007  (for ep2_outland_09)
		UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, -32), MASK_SHOT_HULL, this, COLLISION_GROUP_NONE, &tr );
	}

#if !defined( CLIENT_DLL )

	Explode( GetThrower(), 
			this, 
			NULL, 
			tr.endpos, 
			GetDamage(), 
			GetDamageRadius(),
			GetFocusDrain());

	//CSoundEnt::InsertSound ( SOUND_COMBAT, GetAbsOrigin(), BASEGRENADE_EXPLOSION_VOLUME, 3.0 );

#endif //!defined( CLIENT_DLL )

	RemoveMe();
} 
Example #2
0
void CItem::OnRun(void)
{
	if (m_dwLifeTime == 0xffffffff)
        return;

	if ((int)(timeGetTime() - m_dwLifeTime) > 0)
        RemoveMe();
}
Example #3
0
void TFutureProgressPrivate::_q_FadeAway()
   {
      Q_Q(TFutureProgress);
      FaderWidget->raise();
      QSequentialAnimationGroup *Group = new QSequentialAnimationGroup(q);
      QPropertyAnimation *Animation = new QPropertyAnimation(FaderWidget, "Opacity");
      Animation->setDuration(600);
      Animation->setEndValue(1.0);
      Group->addAnimation(Animation);

      Animation = new QPropertyAnimation(q, "maximumHeight");
      Animation->setDuration(120);
      Animation->setEasingCurve(QEasingCurve::InCurve);
      Animation->setStartValue(q->sizeHint().height());
      Animation->setEndValue(0.0);
      Group->addAnimation(Animation);
      Group->start(QAbstractAnimation::DeleteWhenStopped);

      QObject::connect(Group, SIGNAL(finished()), q, SIGNAL(RemoveMe()));
   }
Example #4
0
BOOL CItem::StartDispatch(CPlayer *pChecker)
{
	MY_ASSERT(pChecker->m_dwTeamID);

	std::map<DWORD, Team>::iterator it = teamManagerMap.find(pChecker->m_dwTeamID);
	if (it == teamManagerMap.end())
		return FALSE;

	static CPlayer *pTeamMember[MAX_TEAM_MEMBER] = {0};

	std::vector<CPlayer *> fullMember;

	for (size_t i = 0; i < it->second.byMemberNum; i++)
	{
		pTeamMember[i] = it->second.stTeamPlayer[i].PlayerRef;
		fullMember.push_back(pTeamMember[i]);
	}

	if (m_Money)				// 先把钱分了
	{
		m_Money = 0;

		if (0 == --m_Remain)	// 这个包裹除了钱,没别的了		
		{
			RemoveMe();
			return FALSE;
		}
	}

	// 挨个查看每个道具
	for (size_t i = 0; i < m_ItemsInPack; i++)
	{
		const SItemBaseData *pData = CItemService::GetInstance().GetItemBaseData(m_GroundItem[i].wIndex);
		if (!pData)
			return FALSE;

		if (pData->m_Color < it->second.byGiveColor)
		{
			rfalse(2, 1, "位置为%d的道具颜色小于分配品级,直接自由拾取~", i);
			m_PickStatus[i] = PIPT_FREE;
		}
		else
		{
			switch (it->second.byGiveMode)
			{
			case Team::TGM_TEAMLEADER:		// 队长分配
				{
					m_PickStatus[i] = PIPT_LEADER;
				}
				break;

			case Team::TGM_SCHOOL:			// 门派分配
				{
					std::vector<CPlayer *> onlySchool;
					std::vector<CPlayer *> otherSchool;
					
					for (size_t j = 0; j < it->second.byMemberNum; j++)
					{
						std::vector<CPlayer *> &destList = (pData->m_School == pTeamMember[j]->m_Property.m_School) ? onlySchool : otherSchool;
						destList.push_back(pTeamMember[j]);
					}

					if (onlySchool.empty())			// 没有对应门派,那么所有人摇号(包含道具无门派需求的情况!)
					{
						CGroundItemWinner::GetInstance().AddChanceItem(otherSchool, this, i);
					}
					else if (otherSchool.empty())	// 没有闲散人员,那么门派内摇号
					{
						CGroundItemWinner::GetInstance().AddChanceItem(onlySchool, this, i);
					}
					else
					{
						CGroundItemWinner::GetInstance().AddChanceItem(onlySchool, this, i);
						CGroundItemWinner::GetInstance().AddDummyChance(otherSchool, this, i);
					}

					m_PickStatus[i] = PIPT_TAKECHANCE;
				}
				break;

			case Team::TGM_FREE:			// 自由分配
				CGroundItemWinner::GetInstance().AddChanceItem(fullMember, this, i);
				m_PickStatus[i] = PIPT_TAKECHANCE;
				break;
			}
		}
	}

	m_IsDispatched = true;

	return TRUE;
}