MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / g_Physics

Method g_Physics

ogsr_engine/xrGame/Actor.cpp:698–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

696}
697
698void CActor::g_Physics(Fvector& _accel, float jump, float dt)
699{
700 // Correct accel
701 Fvector accel;
702 accel.set(_accel);
703 hit_slowmo -= dt;
704 if (hit_slowmo < 0)
705 hit_slowmo = 0.f;
706
707 accel.mul(1.f - hit_slowmo);
708
709 if (g_Alive())
710 {
711 if (mstate_real & mcClimb && !cameras[eacFirstEye]->bClampYaw)
712 accel.set(0.f, 0.f, 0.f);
713 character_physics_support()->movement()->Calculate(accel, cameras[cam_active]->vDirection, 0, jump, dt, false);
714 bool new_border_state = character_physics_support()->movement()->isOutBorder();
715 if (m_bOutBorder != new_border_state && Level().CurrentControlEntity() == this)
716 {
717 SwitchOutBorder(new_border_state);
718 }
719 character_physics_support()->movement()->GetPosition(Position());
720 character_physics_support()->movement()->bSleep = false;
721 }
722
723 if (Local() && g_Alive())
724 {
725 if (character_physics_support()->movement()->gcontact_Was)
726 Cameras().AddCamEffector(xr_new<CEffectorFall>(character_physics_support()->movement()->gcontact_Power));
727 if (!fis_zero(character_physics_support()->movement()->gcontact_HealthLost))
728 {
729 ICollisionDamageInfo* di = character_physics_support()->movement()->CollisionDamageInfo();
730 bool b_hit_initiated = di->GetAndResetInitiated();
731 Fvector hdir;
732 di->HitDir(hdir);
733 SetHitInfo(this, NULL, 0, Fvector().set(0, 0, 0), hdir);
734 // Hit
735 //(m_PhysicMovementControl->gcontact_HealthLost,hdir,di->DamageInitiator(),m_PhysicMovementControl->ContactBone(),di->HitPos(),0.f,ALife::eHitTypeStrike);//s16(6 +
736 //2*::Random.randI(0,2))
737 if (Level().CurrentControlEntity() == this)
738 {
739 SHit HDS = SHit(character_physics_support()->movement()->gcontact_HealthLost, hdir, di->DamageInitiator(), character_physics_support()->movement()->ContactBone(),
740 di->HitPos(), 0.f, di->HitType(), 0.0f, b_hit_initiated);
741 // Hit(&HDS);
742
743 NET_Packet l_P;
744 HDS.GenHeader(GE_HIT, ID());
745 HDS.whoID = di->DamageInitiator()->ID();
746 HDS.weaponID = di->DamageInitiator()->ID();
747 HDS.Write_Packet(l_P);
748
749 u_EventSend(l_P);
750 }
751 }
752 }
753}
754float g_fov = 67.5f; // 75.0f - SWM
755

Callers

nothing calls this directly

Calls 15

g_AliveFunction · 0.85
fis_zeroFunction · 0.85
IDFunction · 0.85
movementMethod · 0.80
isOutBorderMethod · 0.80
CurrentControlEntityMethod · 0.80
AddCamEffectorMethod · 0.80
GetAndResetInitiatedMethod · 0.80
DamageInitiatorMethod · 0.80
HitTypeMethod · 0.80
GenHeaderMethod · 0.80

Tested by

no test coverage detected