本文整理汇总了C++中CEntity::g_fireParams方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntity::g_fireParams方法的具体用法?C++ CEntity::g_fireParams怎么用?C++ CEntity::g_fireParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEntity
的用法示例。
在下文中一共展示了CEntity::g_fireParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HUD
void CWeaponRPG7::switch2_Fire()
{
m_iShotNum = 0;
m_bFireSingleShot = true;
bWorking = false;
if(GetState()==eFire && getRocketCount())
{
Fvector p1, d1, p;
Fvector p2, d2, d;
p1.set (get_LastFP());
d1.set (get_LastFD());
p = p1;
d = d1;
CEntity* E = smart_cast<CEntity*> (H_Parent());
if(E)
{
E->g_fireParams (this, p2,d2);
p = p2;
d = d2;
if(IsHudModeNow())
{
Fvector p0;
float dist = HUD().GetCurrentRayQuery().range;
p0.mul (d2,dist);
p0.add (p1);
p = p1;
d.sub (p0,p1);
d.normalize_safe();
}
}
Fmatrix launch_matrix;
launch_matrix.identity ();
launch_matrix.k.set (d);
Fvector::generate_orthonormal_basis(launch_matrix.k,
launch_matrix.j, launch_matrix.i);
launch_matrix.c.set (p);
d.normalize ();
d.mul (m_fLaunchSpeed);
CRocketLauncher::LaunchRocket (launch_matrix, d, zero_vel);
CExplosiveRocket* pGrenade = smart_cast<CExplosiveRocket*>(getCurrentRocket());
VERIFY (pGrenade);
pGrenade->SetInitiator (H_Parent()->ID());
if (OnServer())
{
NET_Packet P;
u_EventGen (P,GE_LAUNCH_ROCKET,ID());
P.w_u16 (u16(getCurrentRocket()->ID()));
u_EventSend (P);
}
}
}
示例2: LaunchGrenade
void CWeaponMagazinedWGrenade::LaunchGrenade()
{
if(!getRocketCount()) return;
R_ASSERT (m_bGrenadeMode);
{
Fvector p1, d;
p1.set (get_LastFP2());
d.set (get_LastFD());
CEntity* E = smart_cast<CEntity*>(H_Parent());
if (E){
CInventoryOwner* io = smart_cast<CInventoryOwner*>(H_Parent());
if(NULL == io->inventory().ActiveItem())
{
Log("current_state", GetState() );
Log("next_state", GetNextState());
Log("item_sect", cNameSect().c_str());
Log("H_Parent", H_Parent()->cNameSect().c_str());
}
E->g_fireParams (this, p1,d);
}
if (IsGameTypeSingle())
p1.set (get_LastFP2());
Fmatrix launch_matrix;
launch_matrix.identity ();
launch_matrix.k.set (d);
Fvector::generate_orthonormal_basis(launch_matrix.k,
launch_matrix.j,
launch_matrix.i);
launch_matrix.c.set (p1);
if(IsZoomed() && smart_cast<CActor*>(H_Parent()))
{
H_Parent()->setEnabled (FALSE);
setEnabled (FALSE);
collide::rq_result RQ;
BOOL HasPick = Level().ObjectSpace.RayPick(p1, d, 300.0f, collide::rqtStatic, RQ, this);
setEnabled (TRUE);
H_Parent()->setEnabled (TRUE);
if(HasPick)
{
Fvector Transference;
Transference.mul (d, RQ.range);
Fvector res[2];
#ifdef DEBUG
//. DBG_OpenCashedDraw();
//. DBG_DrawLine(p1,Fvector().add(p1,d),D3DCOLOR_XRGB(255,0,0));
#endif
u8 canfire0 = TransferenceAndThrowVelToThrowDir(Transference,
CRocketLauncher::m_fLaunchSpeed,
EffectiveGravity(),
res);
#ifdef DEBUG
//. if(canfire0>0)DBG_DrawLine(p1,Fvector().add(p1,res[0]),D3DCOLOR_XRGB(0,255,0));
//. if(canfire0>1)DBG_DrawLine(p1,Fvector().add(p1,res[1]),D3DCOLOR_XRGB(0,0,255));
//. DBG_ClosedCashedDraw(30000);
#endif
if (canfire0 != 0)
{
d = res[0];
};
}
};
d.normalize ();
d.mul (CRocketLauncher::m_fLaunchSpeed);
VERIFY2 (_valid(launch_matrix),"CWeaponMagazinedWGrenade::SwitchState. Invalid launch_matrix!");
CRocketLauncher::LaunchRocket (launch_matrix, d, zero_vel);
CExplosiveRocket* pGrenade = smart_cast<CExplosiveRocket*>(getCurrentRocket());
VERIFY (pGrenade);
pGrenade->SetInitiator (H_Parent()->ID());
if (Local() && OnServer())
{
VERIFY (m_magazine.size());
m_magazine.pop_back ();
--iAmmoElapsed;
VERIFY((u32)iAmmoElapsed == m_magazine.size());
NET_Packet P;
u_EventGen (P,GE_LAUNCH_ROCKET,ID());
P.w_u16 (getCurrentRocket()->ID());
u_EventSend (P);
};
}
}