LCOV - code coverage report
Current view: top level - core/animations/states - BodyAimAnimationState.cpp (source / functions) Coverage Total Hit
Test: coverage-src.info Lines: 0.0 % 24 0
Test Date: 2025-12-21 01:16:59 Functions: 0.0 % 2 0

            Line data    Source code
       1              : #include "core/animations/states/BodyAimAnimationState.hpp"
       2              : 
       3              : #include "core/animations/states/BodyChangeAnimationState.hpp"
       4              : #include "core/animations/states/BodyPunchAnimationState.hpp"
       5              : #include "core/animations/states/BodyStandAnimationState.hpp"
       6              : #include "core/animations/states/BodyProneAnimationState.hpp"
       7              : #include "core/animations/states/BodyThrowWeaponAnimationState.hpp"
       8              : 
       9              : #include "core/animations/states/CommonAnimationStateTransitions.hpp"
      10              : 
      11              : #include "core/animations/AnimationData.hpp"
      12              : #include "core/entities/Soldier.hpp"
      13              : #include "core/physics/Constants.hpp"
      14              : 
      15              : namespace Soldank
      16              : {
      17            0 : BodyAimAnimationState::BodyAimAnimationState(const AnimationDataManager& animation_data_manager)
      18            0 :     : AnimationState(animation_data_manager.Get(AnimationType::Aim))
      19            0 :     , animation_data_manager_(animation_data_manager)
      20              : {
      21            0 : }
      22              : 
      23            0 : std::optional<std::shared_ptr<AnimationState>> BodyAimAnimationState::HandleInput(Soldier& soldier)
      24              : {
      25            0 :     if (soldier.control.change) {
      26            0 :         return std::make_shared<BodyChangeAnimationState>(animation_data_manager_);
      27              :     }
      28              : 
      29            0 :     if (soldier.control.drop &&
      30            0 :         soldier.weapons[0].GetWeaponParameters().kind != WeaponType::NoWeapon) {
      31            0 :         return std::make_shared<BodyThrowWeaponAnimationState>(animation_data_manager_);
      32              :     }
      33              : 
      34              :     auto maybe_throw_grenade_animation_state =
      35              :       CommonAnimationStateTransitions::TryTransitionToThrowingGrenade(soldier,
      36            0 :                                                                       animation_data_manager_);
      37            0 :     if (maybe_throw_grenade_animation_state.has_value()) {
      38            0 :         return *maybe_throw_grenade_animation_state;
      39              :     }
      40              : 
      41            0 :     if (soldier.control.fire &&
      42            0 :         (soldier.weapons[soldier.active_weapon].GetWeaponParameters().kind ==
      43            0 :            WeaponType::NoWeapon ||
      44            0 :          soldier.weapons[soldier.active_weapon].GetWeaponParameters().kind == WeaponType::Knife)) {
      45            0 :         return std::make_shared<BodyPunchAnimationState>(animation_data_manager_);
      46              :     }
      47              : 
      48            0 :     if (soldier.stance == PhysicsConstants::STANCE_STAND) {
      49            0 :         return std::make_shared<BodyStandAnimationState>(animation_data_manager_);
      50              :     }
      51              : 
      52            0 :     if (soldier.stance == PhysicsConstants::STANCE_PRONE) {
      53            0 :         return std::make_shared<BodyProneAnimationState>(animation_data_manager_);
      54              :     }
      55              : 
      56            0 :     return std::nullopt;
      57            0 : }
      58              : } // namespace Soldank
        

Generated by: LCOV version 2.0-1