| 122 | } |
| 123 | |
| 124 | void CPHMovementControl::Calculate(Fvector& vAccel, const Fvector& camDir, float /**ang_speed/**/, float jump, float /**dt/**/, bool /**bLight/**/) |
| 125 | { |
| 126 | Fvector previous_position; |
| 127 | previous_position.set(vPosition); |
| 128 | m_character->IPosition(vPosition); |
| 129 | |
| 130 | if (bExernalImpulse) |
| 131 | { |
| 132 | vAccel.add(vExternalImpulse); |
| 133 | m_character->ApplyForce(vExternalImpulse); |
| 134 | vExternalImpulse.set(0.f, 0.f, 0.f); |
| 135 | |
| 136 | bExernalImpulse = false; |
| 137 | } |
| 138 | |
| 139 | float mAccel = vAccel.magnitude(); |
| 140 | m_character->SetCamDir(camDir); |
| 141 | m_character->SetMaximumVelocity(mAccel / 10.f); |
| 142 | m_character->SetAcceleration(vAccel); |
| 143 | if (!fis_zero(jump)) |
| 144 | m_character->Jump(vAccel); |
| 145 | |
| 146 | m_character->GetSavedVelocity(vVelocity); |
| 147 | fActualVelocity = vVelocity.magnitude(); |
| 148 | gcontact_Was = m_character->ContactWas(); |
| 149 | |
| 150 | ////// |
| 151 | UpdateCollisionDamage(); |
| 152 | if (m_character->LastMaterialIDX() != u16(-1)) |
| 153 | { |
| 154 | const SGameMtl* last_material = GMLib.GetMaterialByIdx(m_character->LastMaterialIDX()); |
| 155 | if (last_material->Flags.test(SGameMtl::flInjurious)) |
| 156 | { |
| 157 | gcontact_HealthLost += Device.fTimeDelta * last_material->fInjuriousSpeed; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | auto* cdi = CollisionDamageInfo(); |
| 162 | |
| 163 | if (auto* hcb = cdi->HitCallback()) |
| 164 | { |
| 165 | hcb->call(nullptr, fMinCrashSpeed, fMaxCrashSpeed, fContactSpeed, gcontact_HealthLost, cdi); |
| 166 | } |
| 167 | |
| 168 | TraceBorder(previous_position); |
| 169 | CheckEnvironment(vPosition); |
| 170 | bSleep = false; |
| 171 | m_character->Reinit(); |
| 172 | } |
| 173 | |
| 174 | void CPHMovementControl::UpdateCollisionDamage() |
| 175 | { |
nothing calls this directly
no test coverage detected