本文整理汇总了C++中Fvector::getHP方法的典型用法代码示例。如果您正苦于以下问题:C++ Fvector::getHP方法的具体用法?C++ Fvector::getHP怎么用?C++ Fvector::getHP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fvector
的用法示例。
在下文中一共展示了Fvector::getHP方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: is_faced
bool CMonsterEnemyManager::is_faced(const CEntityAlive *object0, const CEntityAlive *object1)
{
if (object0->Position().distance_to(object1->Position()) > object0->ffGetRange())
{
return false;
}
float yaw1, pitch1, yaw2, pitch2, fYawFov, fPitchFov, fRange;
Fvector tPosition = object0->Position();
yaw1 = object0->Orientation().yaw;
pitch1 = object0->Orientation().pitch;
fYawFov = angle_normalize_signed(object0->ffGetFov()*PI/180.f);
fRange = object0->ffGetRange();
fYawFov = angle_normalize_signed((_abs(fYawFov) + _abs(atanf(1.f/tPosition.distance_to(object1->Position()))))/2.f);
fPitchFov = angle_normalize_signed(fYawFov*1.f);
tPosition.sub (object1->Position());
tPosition.mul (-1);
tPosition.getHP (yaw2,pitch2);
yaw1 = angle_normalize_signed(yaw1);
pitch1 = angle_normalize_signed(pitch1);
yaw2 = angle_normalize_signed(yaw2);
pitch2 = angle_normalize_signed(pitch2);
if ((angle_difference(yaw1,yaw2) <= fYawFov) && (angle_difference(pitch1,pitch2) <= fPitchFov))
return (true);
return (false);
}
示例2:
void CAI_Stalker::can_kill_entity_from (const Fvector &position, Fvector direction, float distance)
{
m_pick_distance = 0.f;
rq_storage.r_clear ();
can_kill_entity (position,direction,distance,rq_storage);
if (m_can_kill_member && m_can_kill_enemy)
return;
float yaw, pitch, safety_fire_angle = 1.f*PI_DIV_8*.5f;
direction.getHP (yaw,pitch);
direction.setHP (yaw - safety_fire_angle,pitch);
can_kill_entity (position,direction,distance,rq_storage);
if (m_can_kill_member && m_can_kill_enemy)
return;
direction.setHP (yaw + safety_fire_angle,pitch);
can_kill_entity (position,direction,distance,rq_storage);
if (m_can_kill_member && m_can_kill_enemy)
return;
direction.setHP (yaw,pitch - safety_fire_angle);
can_kill_entity (position,direction,distance,rq_storage);
if (m_can_kill_member && m_can_kill_enemy)
return;
direction.setHP (yaw,pitch + safety_fire_angle);
can_kill_entity (position,direction,distance,rq_storage);
}
示例3: DrawSpotLight
void CDrawUtilities::DrawSpotLight(const Fvector& p, const Fvector& d, float range, float phi, u32 clr)
{
Fmatrix T;
Fvector p1;
float H,P;
float da = PI_MUL_2/LINE_DIVISION;
float b = range*_cos(PI_DIV_2-phi/2);
float a = range*_sin(PI_DIV_2-phi/2);
d.getHP (H,P);
T.setHPB (H,P,0);
T.translate_over(p);
_VertexStream* Stream = &RCache.Vertex;
u32 vBase;
FVF::L* pv = (FVF::L*)Stream->Lock(LINE_DIVISION*2+2,vs_L->vb_stride,vBase);
for (float angle=0; angle<PI_MUL_2; angle+=da){
float _sa =_sin(angle);
float _ca =_cos(angle);
p1.x = b * _ca;
p1.y = b * _sa;
p1.z = a;
T.transform_tiny(p1);
// fill VB
pv->set (p,clr); pv++;
pv->set (p1,clr); pv++;
}
p1.mad (p,d,range);
pv->set (p,clr); pv++;
pv->set (p1,clr); pv++;
Stream->Unlock (LINE_DIVISION*2+2,vs_L->vb_stride);
// and Render it as triangle list
DU_DRAW_DP (D3DPT_LINELIST,vs_L,vBase,LINE_DIVISION+1);
}
示例4: HitSignal
void CActor::HitSignal(float perc, Fvector& vLocalDir, CObject* who, s16 element)
{
if (g_Alive())
{
// stop-motion
if (character_physics_support()->movement()->Environment()==CPHMovementControl::peOnGround || character_physics_support()->movement()->Environment()==CPHMovementControl::peAtWall)
{
Fvector zeroV;
zeroV.set (0,0,0);
character_physics_support()->movement()->SetVelocity(zeroV);
}
// check damage bone
Fvector D;
XFORM().transform_dir(D,vLocalDir);
float yaw, pitch;
D.getHP(yaw,pitch);
CKinematicsAnimated *tpKinematics = smart_cast<CKinematicsAnimated*>(Visual());
VERIFY(tpKinematics);
#pragma todo("Dima to Dima : forward-back bone impulse direction has been determined incorrectly!")
MotionID motion_ID = m_anims->m_normal.m_damage[iFloor(tpKinematics->LL_GetBoneInstance(element).get_param(1) + (angle_difference(r_model_yaw + r_model_yaw_delta,yaw) <= PI_DIV_2 ? 0 : 1))];
float power_factor = perc/100.f; clamp(power_factor,0.f,1.f);
VERIFY(motion_ID.valid());
tpKinematics->PlayFX(motion_ID,power_factor);
}
}
示例5: get_reject_pos
bool CLevelChanger::get_reject_pos(Fvector& p, Fvector& r)
{
p.set(0,0,0);
r.set(0,0,0);
//-- db.actor:set_actor_position(patrol("t_way"):point(0))
//-- local dir = patrol("t_look"):point(0):sub(patrol("t_way"):point(0))
//-- db.actor:set_actor_direction(-dir:getH())
if(m_ini_file && m_ini_file->section_exist("pt_move_if_reject"))
{
LPCSTR p_name = m_ini_file->r_string("pt_move_if_reject", "path");
const CPatrolPath* patrol_path = ai().patrol_paths().path(p_name);
VERIFY (patrol_path);
const CPatrolPoint* pt;
pt = &patrol_path->vertex(0)->data();
p = pt->position();
Fvector tmp;
pt = &patrol_path->vertex(1)->data();
tmp.sub (pt->position(),p);
tmp.getHP (r.y,r.x);
return true;
}
return false;
}
示例6: trace_geometry
bool CSnork::trace_geometry(const Fvector &d, float &range)
{
Fvector dir;
float h, p;
Fvector Pl,Pc,Pr;
Fvector center;
Center (center);
range = trace (d);
if (range > TRACE_RANGE) return false;
float angle = asin(1.f / range);
// trace center ray
dir = d;
dir.getHP (h,p);
p += angle;
dir.setHP (h,p);
dir.normalize_safe ();
range = trace (dir);
if (range > TRACE_RANGE) return false;
Pc.mad (center, dir, range);
// trace left ray
Fvector temp_p;
temp_p.mad (Pc, XFORM().i, Radius() / 2);
dir.sub (temp_p, center);
dir.normalize_safe ();
range = trace (dir);
if (range > TRACE_RANGE) return false;
Pl.mad (center, dir, range);
// trace right ray
Fvector inv = XFORM().i;
inv.invert ();
temp_p.mad (Pc, inv, Radius() / 2);
dir.sub (temp_p, center);
dir.normalize_safe ();
range = trace (dir);
if (range > TRACE_RANGE) return false;
Pr.mad (center, dir, range);
float h1,p1,h2,p2;
Fvector().sub(Pl, Pc).getHP(h1,p1);
Fvector().sub(Pc, Pr).getHP(h2,p2);
return (fsimilar(h1,h2,0.1f) && fsimilar(p1,p2,0.1f));
}
示例7: bfIf_I_SeePosition
bool CSightManager::bfIf_I_SeePosition(Fvector tPosition) const
{
float yaw, pitch;
Fvector tVector;
tVector.sub (tPosition,m_object->Position());
tVector.getHP (yaw,pitch);
yaw = angle_normalize_signed(-yaw);
pitch = angle_normalize_signed(-pitch);
return (angle_difference(yaw,object().movement().m_head.current.yaw) <= PI_DIV_6);// && angle_difference(pitch,object().movement().m_head.current.pitch,PI_DIV_6));
}
示例8: SetPointLookAngles
void CSightManager::SetPointLookAngles(const Fvector &tPosition, float &yaw, float &pitch, const CGameObject *object)
{
Fvector tTemp;
tTemp.sub (tPosition,m_object->eye_matrix.c);
tTemp.getHP (yaw,pitch);
VERIFY (_valid(yaw));
VERIFY (_valid(pitch));
yaw *= -1;
pitch *= -1;
}
示例9: death_glide_start
void CControllerPsyHit::death_glide_start()
{
if (!check_conditions_final()) {
m_man->deactivate (this);
return;
}
HUD().SetRenderable(false);
// Start effector
CEffectorCam* ce = Actor()->Cameras().GetCamEffector(eCEControllerPsyHit);
VERIFY(!ce);
Fvector src_pos = Actor()->cam_Active()->vPosition;
Fvector target_pos = m_object->Position();
target_pos.y += 1.2f;
Fvector dir;
dir.sub (target_pos,src_pos);
float dist = dir.magnitude();
dir.normalize ();
target_pos.mad (src_pos,dir,dist-4.8f);
Actor()->Cameras().AddCamEffector(new CControllerPsyHitCamEffector(eCEControllerPsyHit, src_pos,target_pos, m_man->animation().motion_time(m_stage[1], m_object->Visual())));
smart_cast<CController *>(m_object)->draw_fire_particles();
dir.sub(src_pos,target_pos);
dir.normalize();
float h,p;
dir.getHP(h,p);
dir.setHP(h,p+PI_DIV_3);
Actor()->character_physics_support()->movement()->ApplyImpulse(dir,Actor()->GetMass() * 530.f);
set_sound_state (eStart);
NET_Packet P;
Actor()->u_EventGen (P, GEG_PLAYER_WEAPON_HIDE_STATE, Actor()->ID());
P.w_u32 (INV_STATE_BLOCK_ALL);
P.w_u8 (u8(true));
Actor()->u_EventSend(P);
m_blocked = true;
//////////////////////////////////////////////////////////////////////////
// set direction
SControlDirectionData *ctrl_dir = (SControlDirectionData*)m_man->data(this, ControlCom::eControlDir);
VERIFY (ctrl_dir);
ctrl_dir->heading.target_speed = 3.f;
ctrl_dir->heading.target_angle = m_man->direction().angle_to_target(Actor()->Position());
//////////////////////////////////////////////////////////////////////////
}
示例10: hit_test
void CControlJump::hit_test()
{
if (m_object_hitted) return;
if (!m_data.target_object) return;
// ѕроверить на нанесение хита во врем¤ прыжка
Fvector trace_from;
m_object->Center(trace_from);
collide::rq_result l_rq;
if (Level().ObjectSpace.RayPick(trace_from, m_object->Direction(), m_hit_trace_range, collide::rqtObject, l_rq, m_object)) {
if ((l_rq.O == m_data.target_object) && (l_rq.range < m_hit_trace_range)) {
m_object_hitted = true;
}
}
if (!m_object_hitted && m_data.target_object) {
m_object_hitted = true;
// определить дистанцию до врага
Fvector d;
d.sub(m_data.target_object->Position(),m_object->Position());
if (d.magnitude() > m_hit_trace_range) m_object_hitted = false;
// проверка на Field-Of-Hit
float my_h,my_p;
float h,p;
m_object->Direction().getHP(my_h,my_p);
d.getHP(h,p);
float from = angle_normalize(my_h - PI_DIV_6);
float to = angle_normalize(my_h + PI_DIV_6);
if (!is_angle_between(h, from, to)) m_object_hitted = false;
from = angle_normalize(my_p - PI_DIV_6);
to = angle_normalize(my_p + PI_DIV_6);
if (!is_angle_between(p, from, to)) m_object_hitted = false;
}
if (m_object_hitted)
m_object->HitEntityInJump(smart_cast<CEntity*>(m_data.target_object));
}
示例11:
BOOL CCameraShotEffector::Process (Fvector &p, Fvector &d, Fvector &n, float& fFov, float& fFar, float& fAspect)
{
if (bActive){
float h,p;
d.getHP (h,p);
if (bSingleShoot)
{
if (bSSActive)
d.setHP (h+fLastDeltaHorz,p+fLastDeltaVert);
}
else
d.setHP (h+fAngleHorz,p+fAngleVert);
Update ();
}
return TRUE;
}
示例12: object
void CStalkerActionCombatBase::fire ()
{
Fvector enemy_position = object().memory().enemy().selected()->Position();
Fvector object_position = object().Position();
Fvector direction = Fvector().sub(enemy_position,object_position);
float yaw,pitch;
direction.getHP (yaw,pitch);
const MonsterSpace::SBoneRotation ¤t_angles = object().movement().head_orientation();
if (angle_difference(-yaw,current_angles.current.yaw) > start_fire_angle_difference) {
aim_ready ();
return;
}
u32 min_queue_size, max_queue_size, min_queue_interval, max_queue_interval;
float distance = enemy_position.distance_to(object_position);
select_queue_params (distance,min_queue_size, max_queue_size, min_queue_interval, max_queue_interval);
object().CObjectHandler::set_goal (eObjectActionFire1,object().best_weapon(),min_queue_size, max_queue_size, min_queue_interval, max_queue_interval);
}
示例13: LookAtActor
void CAI_Trader::LookAtActor(CBoneInstance *B)
{
Fvector dir;
dir.sub(Level().CurrentEntity()->Position(),Position());
float yaw,pitch;
dir.getHP(yaw, pitch);
float h,p,b;
XFORM().getHPB(h,p,b);
float cur_yaw = h;
float dy = _abs(angle_normalize_signed(yaw - cur_yaw));
if (angle_normalize_signed(yaw - cur_yaw) > 0) dy *= -1.f;
Fmatrix M;
M.setHPB (0.f, -dy, 0.f);
B->mTransform.mulB_43(M);
}
示例14: face_target
void CControlDirectionBase::face_target(const Fvector &position, u32 delay, float add_yaw)
{
if (m_time_last_faced + delay > Device.dwTimeGlobal) return;
m_delay = delay;
float yaw, pitch;
Fvector dir;
dir.sub (position, m_object->Position());
dir.getHP (yaw,pitch);
yaw *= -1;
yaw += (m_man->direction().is_from_right(position)) ? add_yaw : -add_yaw;
yaw = angle_normalize(yaw);
m_heading.target = yaw;
m_time_last_faced = Device.dwTimeGlobal;
}
示例15: check_hit
void CControlAnimationBase::check_hit(MotionID motion, float time_perc)
{
if (!m_object->EnemyMan.get_enemy()) return;
const CEntityAlive *enemy = m_object->EnemyMan.get_enemy();
SAAParam ¶ms = AA_GetParams(motion,time_perc);
m_object->sound().play (MonsterSound::eMonsterSoundAttackHit);
bool should_hit = true;
// определить дистанцию до врага
Fvector d;
d.sub(enemy->Position(),m_object->Position());
if (d.magnitude() > params.dist)
should_hit = false;
// проверка на Field-Of-Hit
float my_h,my_p;
float h,p;
m_object->Direction().getHP(my_h,my_p);
d.getHP(h,p);
float from = angle_normalize(my_h + params.foh.from_yaw);
float to = angle_normalize(my_h + params.foh.to_yaw);
if (!is_angle_between(h, from, to))
should_hit = false;
from = angle_normalize(my_p + params.foh.from_pitch);
to = angle_normalize(my_p + params.foh.to_pitch);
if (!is_angle_between(p, from, to))
should_hit = false;
if (should_hit)
m_object->HitEntity(enemy, params.hit_power, params.impulse, params.impulse_dir);
m_object->MeleeChecker.on_hit_attempt(should_hit);
}