本文整理汇总了C++中H_Parent函数的典型用法代码示例。如果您正苦于以下问题:C++ H_Parent函数的具体用法?C++ H_Parent怎么用?C++ H_Parent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了H_Parent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activate_physic_shell
void CPhysicsShellHolder::activate_physic_shell()
{
VERIFY (!m_pPhysicsShell);
create_physic_shell ();
Fvector l_fw, l_up;
l_fw.set (XFORM().k);
l_up.set (XFORM().j);
l_fw.mul (2.f);
l_up.mul (2.f);
Fmatrix l_p1, l_p2;
l_p1.set (XFORM());
l_p2.set (XFORM());
l_fw.mul (2.f);
l_p2.c.add (l_fw);
m_pPhysicsShell->Activate (l_p1, 0, l_p2);
if(H_Parent()&&H_Parent()->Visual())
{
smart_cast<CKinematics*>(H_Parent()->Visual())->CalculateBones_Invalidate ();
smart_cast<CKinematics*>(H_Parent()->Visual())->CalculateBones ();
}
smart_cast<CKinematics*>(Visual())->CalculateBones_Invalidate ();
smart_cast<CKinematics*>(Visual())->CalculateBones();
if(!IsGameTypeSingle())
{
if(!smart_cast<CCustomRocket*>(this)&&!smart_cast<CGrenade*>(this)) PPhysicsShell()->SetIgnoreDynamic();
}
// XFORM().set (l_p1);
correct_spawn_pos();
m_pPhysicsShell->set_LinearVel(l_fw);
m_pPhysicsShell->GetGlobalTransformDynamic(&XFORM());
}
示例2: VERIFY
void CBlackGraviArtefact::UpdateCLChild()
{
VERIFY(!ph_world->Processing());
inherited::UpdateCLChild ();
if (getVisible() && m_pPhysicsShell) {
if (m_bStrike) {
Fvector P;
P.set(Position());
feel_touch_update(P,m_fRadius);
GraviStrike();
CParticlesObject* pStaticPG;
pStaticPG = CParticlesObject::Create(*m_sParticleName,TRUE);
Fmatrix pos;
pos.set(XFORM());
Fvector vel;
//vel.sub(Position(),ps_Element(0).vPosition);
//vel.div((Level().timeServer()-ps_Element(0).dwTime)/1000.f);
vel.set(0,0,0);
pStaticPG->UpdateParent(pos, vel);
pStaticPG->Play();
m_bStrike = false;
}
}else if(H_Parent()) XFORM().set(H_Parent()->XFORM());
}
示例3: PlayAnimIdle
void CWeaponMagazined::OnZoomIn()
{
inherited::OnZoomIn();
if (GetState() == eIdle)
PlayAnimIdle();
CActor* pActor = smart_cast<CActor*>(H_Parent());
if (pActor)
{
HUD_SOUND::StopSound(sndSightsUp); //daemonion - iron sight audio - sights being raised
HUD_SOUND::StopSound(sndSightsDown); //
bool b_hud_mode = (Level().CurrentEntity() == H_Parent()); //
HUD_SOUND::PlaySound(sndSightsUp, H_Parent()->Position(), H_Parent(), b_hud_mode); //--END
CEffectorZoomInertion* S = smart_cast<CEffectorZoomInertion*> (pActor->Cameras().GetCamEffector(eCEZoom));
if (!S)
{
S = (CEffectorZoomInertion*)pActor->Cameras().AddCamEffector(xr_new<CEffectorZoomInertion>());
S->Init(this);
};
S->SetRndSeed(pActor->GetZoomRndSeed());
R_ASSERT(S);
}
}
示例4: while
void CWeaponKnife::KnifeStrike(const Fvector& pos, const Fvector& dir)
{
CCartridge cartridge;
cartridge.param_s.buckShot = 1;
cartridge.param_s.impair = 1.0f;
cartridge.param_s.kDisp = 1.0f;
cartridge.param_s.kHit = 1.0f;
cartridge.param_s.kCritical = 1.0f;
cartridge.param_s.kImpulse = 1.0f;
cartridge.param_s.kAP = 1.0f;
cartridge.m_flags.set (CCartridge::cfTracer, FALSE);
cartridge.m_flags.set (CCartridge::cfRicochet, FALSE);
cartridge.param_s.fWallmarkSize = fWallmarkSize;
cartridge.bullet_material_idx = knife_material_idx;
while(m_magazine.size() < 2) m_magazine.push_back(cartridge);
iAmmoElapsed = m_magazine.size();
bool SendHit = SendHitAllowed(H_Parent());
PlaySound ("sndShot",pos);
Level().BulletManager().AddBullet( pos,
dir,
m_fStartBulletSpeed,
fCurrentHit,
fCurrentHitCritical,
fHitImpulse_cur,
H_Parent()->ID(),
ID(),
m_eHitType,
fireDistance,
cartridge,
SendHit);
}
示例5: Actor
// Function for callbacks added by Cribbledirge.
void CWeaponMagazined::StateSwitchCallback(GameObject::ECallbackType actor_type, GameObject::ECallbackType npc_type)
{
xr_string ammo_type;
if (GetAmmoElapsed() == 0 || m_magazine.empty())
{
ammo_type = *m_ammoTypes[m_ammoType];
}
else
{
ammo_type = *m_ammoTypes[m_magazine.back().m_LocalAmmoType];
}
if (g_actor)
{
if (smart_cast<CActor*>(H_Parent())) // This is an actor.
{
Actor()->callback(actor_type)(
lua_game_object(), // The weapon as a game object.
ammo_type.c_str() // The caliber of the weapon.
);
}
else if (smart_cast<CEntityAlive*>(H_Parent())) // This is an NPC.
{
Actor()->callback(npc_type)(
smart_cast<CEntityAlive*>(H_Parent())->lua_game_object(), // The owner of the weapon.
lua_game_object(), // The weapon itself.
ammo_type.c_str() // The caliber of the weapon.
);
}
}
}
示例6: Msg
void CWeapon::SwitchState(u32 S)
{
if (OnClient()) return;
#ifndef MASTER_GOLD
if ( bDebug )
{
Msg("---Server is going to send GE_WPN_STATE_CHANGE to [%d], weapon_section[%s], parent[%s]",
S, cNameSect().c_str(), H_Parent() ? H_Parent()->cName().c_str() : "NULL Parent");
}
#endif // #ifndef MASTER_GOLD
SetNextState ( S );
if (CHudItem::object().Local() && !CHudItem::object().getDestroy() && m_pInventory && OnServer())
{
// !!! Just single entry for given state !!!
NET_Packet P;
CHudItem::object().u_EventGen (P,GE_WPN_STATE_CHANGE,CHudItem::object().ID());
P.w_u8 (u8(S));
P.w_u8 (u8(m_sub_state));
P.w_u8 (m_ammoType);
P.w_u8 (u8(iAmmoElapsed & 0xff));
P.w_u8 (m_set_next_ammoType_on_reload);
CHudItem::object().u_EventSend (P, net_flags(TRUE, TRUE, FALSE, TRUE));
}
}
示例7: VERIFY
void CArtefact::UpdateWorkload (u32 dt)
{
VERIFY(!physics_world()->Processing());
// particles - velocity
Fvector vel = {0, 0, 0};
if (H_Parent())
{
CPhysicsShellHolder* pPhysicsShellHolder = smart_cast<CPhysicsShellHolder*>(H_Parent());
if(pPhysicsShellHolder) pPhysicsShellHolder->PHGetLinearVell(vel);
}
CParticlesPlayer::SetParentVel (vel);
//
UpdateLights ();
if(m_activationObj && m_activationObj->IsInProgress()) {
CPHUpdateObject::Activate ();
m_activationObj->UpdateActivation ();
return;
}
// custom-logic
if(!CAttachableItem::enabled())
UpdateCLChild ();
}
示例8: VERIFY
void CArtefact::ActivateArtefact ()
{
VERIFY(m_bCanSpawnZone);
VERIFY( H_Parent() );
m_activationObj = xr_new<SArtefactActivation>(this,H_Parent()->ID());
m_activationObj->Start();
}
示例9: UpdateHUDAddonsVisibility
void CWeapon::UpdateCL ()
{
inherited::UpdateCL ();
UpdateHUDAddonsVisibility();
//подсветка от выстрела
UpdateLight ();
//нарисовать партиклы
UpdateFlameParticles ();
UpdateFlameParticles2 ();
if(!IsGameTypeSingle())
make_Interpolation ();
if( (GetNextState()==GetState()) && IsGameTypeSingle() && H_Parent()==Level().CurrentEntity())
{
CActor* pActor = smart_cast<CActor*>(H_Parent());
if(pActor && !pActor->AnyMove() && this==pActor->inventory().ActiveItem())
{
if (hud_adj_mode==0 &&
GetState()==eIdle &&
(Device.dwTimeGlobal-m_dw_curr_substate_time>20000) &&
!IsZoomed()&&
g_player_hud->attached_item(1)==NULL)
{
if(AllowBore())
SwitchState (eBore);
ResetSubStateTime ();
}
}
}
if(m_zoom_params.m_pNight_vision && !need_renderable())
{
if(!m_zoom_params.m_pNight_vision->IsActive())
{
CActor *pA = smart_cast<CActor *>(H_Parent());
R_ASSERT(pA);
CTorch* pTorch = smart_cast<CTorch*>( pA->inventory().ItemFromSlot(TORCH_SLOT) );
if ( pTorch && pTorch->GetNightVisionStatus() )
{
m_bRememberActorNVisnStatus = pTorch->GetNightVisionStatus();
pTorch->SwitchNightVision(false, false);
}
m_zoom_params.m_pNight_vision->Start(m_zoom_params.m_sUseZoomPostprocess, pA, false);
}
}
else if(m_bRememberActorNVisnStatus)
{
m_bRememberActorNVisnStatus = false;
EnableActorNVisnAfterZoom();
}
if(m_zoom_params.m_pVision)
m_zoom_params.m_pVision->Update();
}
示例10: VERIFY
void CWeaponMagazined::state_Fire(float dt)
{
VERIFY(fTimeToFire > 0.f);
Fvector p1, d;
p1.set(get_LastFP());
d.set(get_LastFD());
if (!H_Parent()) return;
CInventoryOwner* io = smart_cast<CInventoryOwner*>(H_Parent());
if (NULL == io->inventory().ActiveItem())
{
Log("current_state", GetState());
Log("next_state", GetNextState());
Log("state_time", m_dwStateTime);
Log("item_sect", cNameSect().c_str());
Log("H_Parent", H_Parent()->cNameSect().c_str());
}
smart_cast<CEntity*> (H_Parent())->g_fireParams(this, p1, d);
if (m_iShotNum == 0)
{
m_vStartPos = p1;
m_vStartDir = d;
};
VERIFY(!m_magazine.empty());
// Msg("%d && %d && (%d || %d) && (%d || %d)", !m_magazine.empty(), fTime<=0, IsWorking(), m_bFireSingleShot, m_iQueueSize < 0, m_iShotNum < m_iQueueSize);
while (!m_magazine.empty() && fTime <= 0 && (IsWorking() || m_bFireSingleShot) && (m_iQueueSize < 0 || m_iShotNum < m_iQueueSize))
{
m_bFireSingleShot = false;
VERIFY(fTimeToFire > 0.f);
fTime += fTimeToFire;
++m_iShotNum;
OnShot();
static int i = 0;
if (i || m_iShotNum > m_iShootEffectorStart)
{
// Do Weapon Callback. (Cribbledirge)
StateSwitchCallback(GameObject::eOnActorWeaponFire, GameObject::eOnNPCWeaponFire);
FireTrace(p1, d);
}
else
{
FireTrace(m_vStartPos, m_vStartDir);
}
}
if (m_iShotNum == m_iQueueSize)
m_bStopedAfterQueueFired = true;
UpdateSounds();
}
示例11: 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);
}
}
}
示例12: H_Parent
void CPda::feel_touch_delete(CObject* O)
{
if(!H_Parent()) return;
if ( CInventoryOwner* pLostContactInvOwner = smart_cast<CInventoryOwner*>(O) )
{
CInventoryOwner* pOwner = smart_cast<CInventoryOwner*>( H_Parent() );VERIFY(pOwner);
pOwner->LostPdaContact (pLostContactInvOwner);
}
}
示例13: shedule_Update
void CScientificDetector::shedule_Update(u32 dt)
{
inherited::shedule_Update (dt);
if(!H_Parent()) return;
Fvector P;
P.set (H_Parent()->Position());
m_zones.feel_touch_update (P,m_fAfDetectRadius);
}
示例14: net_Import
void CWeapon::net_Import(NET_Packet& P)
{
inherited::net_Import (P);
float _cond;
P.r_float_q8 (_cond,0.0f,1.0f);
SetCondition (_cond);
u8 flags = 0;
P.r_u8 (flags);
u16 ammo_elapsed = 0;
P.r_u16 (ammo_elapsed);
u8 NewAddonState;
P.r_u8 (NewAddonState);
m_flagsAddOnState = NewAddonState;
UpdateAddonsVisibility ();
u8 ammoType, wstate;
P.r_u8 (ammoType);
P.r_u8 (wstate);
u8 Zoom;
P.r_u8 ((u8)Zoom);
if (H_Parent() && H_Parent()->Remote())
{
if (Zoom) OnZoomIn();
else OnZoomOut();
};
switch (wstate)
{
case eFire:
case eFire2:
case eSwitch:
case eReload:
{
}break;
default:
{
if (ammoType >= m_ammoTypes.size())
Msg("!! Weapon [%d], State - [%d]", ID(), wstate);
else
{
m_ammoType = ammoType;
SetAmmoElapsed((ammo_elapsed));
}
}break;
}
VERIFY((u32)iAmmoElapsed == m_magazine.size());
}
示例15: correct_spawn_pos
void CPhysicsShellHolder::correct_spawn_pos()
{
VERIFY (PPhysicsShell());
if( H_Parent() )
{
CPhysicsShellHolder * P = smart_cast<CPhysicsShellHolder*>(H_Parent());
if( P && P->has_shell_collision_place(this) )
return;
}
Fvector size;
Fvector c;
get_box (PPhysicsShell(),XFORM(),size,c);
R_ASSERT2( _valid( c ), make_string( "object: %s model: %s ", cName().c_str(), cNameVisual().c_str() ) );
R_ASSERT2( _valid( size ), make_string( "object: %s model: %s ", cName().c_str(), cNameVisual().c_str() ) );
R_ASSERT2( _valid( XFORM() ), make_string( "object: %s model: %s ", cName().c_str(), cNameVisual().c_str() ) );
CPHActivationShape activation_shape;
activation_shape.Create (c,size,this);
activation_shape.set_rotation (XFORM());
PPhysicsShell()->DisableCollision ();
activation_shape.Activate (size,1,1.f,M_PI/8.f);
//// VERIFY (valid_pos(activation_shape.Position(),phBoundaries));
// if (!valid_pos(activation_shape.Position(),phBoundaries)) {
// CPHActivationShape activation_shape;
// activation_shape.Create (c,size,this);
// activation_shape.set_rotation (XFORM());
// activation_shape.Activate (size,1,1.f,M_PI/8.f);
//// VERIFY (valid_pos(activation_shape.Position(),phBoundaries));
// }
PPhysicsShell()->EnableCollision ();
Fvector ap = activation_shape.Position();
#ifdef DEBUG
if (!valid_pos(ap,phBoundaries)) {
Msg("not valid position %f,%f,%f",ap.x,ap.y,ap.z);
Msg("size %f,%f,%f",size.x,size.y,size.z);
Msg("Object: %s",Name());
Msg("Visual: %s",*(cNameVisual()));
Msg("Object pos %f,%f,%f",Position().x,Position().y,Position().z);
}
#endif // DEBUG
VERIFY (valid_pos(activation_shape.Position(),phBoundaries));
Fmatrix trans;
trans.identity ();
trans.c.sub (ap,c);
PPhysicsShell()->TransformPosition (trans);
PPhysicsShell()->GetGlobalTransformDynamic(&XFORM());
activation_shape.Destroy ();
}