LCOV - code coverage report
Current view: top level - core/animations/states - BodyStandAnimationState.cpp (source / functions) Coverage Total Hit
Test: coverage-src.info Lines: 0.0 % 28 0
Test Date: 2025-05-27 23:26:07 Functions: 0.0 % 2 0

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

Generated by: LCOV version 2.0-1