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

            Line data    Source code
       1              : #include "core/animations/states/LegsCrouchAnimationState.hpp"
       2              : 
       3              : #include "core/animations/states/LegsCrouchRunAnimationState.hpp"
       4              : #include "core/animations/states/LegsStandAnimationState.hpp"
       5              : #include "core/animations/states/LegsFallAnimationState.hpp"
       6              : #include "core/animations/states/LegsRunBackAnimationState.hpp"
       7              : #include "core/animations/states/LegsRunAnimationState.hpp"
       8              : #include "core/animations/states/LegsJumpAnimationState.hpp"
       9              : #include "core/animations/states/LegsProneAnimationState.hpp"
      10              : 
      11              : #include "core/animations/states/CommonAnimationStateTransitions.hpp"
      12              : 
      13              : #include "core/entities/Soldier.hpp"
      14              : #include "core/physics/Constants.hpp"
      15              : 
      16              : namespace Soldank
      17              : {
      18            0 : LegsCrouchAnimationState::LegsCrouchAnimationState(
      19            0 :   const AnimationDataManager& animation_data_manager)
      20            0 :     : AnimationState(animation_data_manager.Get(AnimationType::Crouch))
      21            0 :     , animation_data_manager_(animation_data_manager)
      22              : {
      23            0 : }
      24              : 
      25            0 : std::optional<std::shared_ptr<AnimationState>> LegsCrouchAnimationState::HandleInput(
      26              :   Soldier& soldier)
      27              : {
      28            0 :     if (soldier.control.prone) {
      29            0 :         return std::make_shared<LegsProneAnimationState>(animation_data_manager_);
      30              :     }
      31              : 
      32            0 :     if (!soldier.control.down) {
      33              :         auto maybe_running_animation_state =
      34            0 :           CommonAnimationStateTransitions::TryTransitionToRunning(soldier, animation_data_manager_);
      35            0 :         if (maybe_running_animation_state.has_value()) {
      36            0 :             return *maybe_running_animation_state;
      37              :         }
      38              : 
      39            0 :         if (soldier.on_ground) {
      40            0 :             return std::make_shared<LegsStandAnimationState>(animation_data_manager_);
      41              :         }
      42              : 
      43            0 :         return std::make_shared<LegsFallAnimationState>(animation_data_manager_);
      44            0 :     }
      45              : 
      46            0 :     if (soldier.control.up && soldier.on_ground) {
      47            0 :         return std::make_shared<LegsJumpAnimationState>(animation_data_manager_);
      48              :     }
      49              : 
      50              :     auto maybe_crouch_running_animation_state =
      51              :       CommonAnimationStateTransitions::TryTransitionToCrouchRunning(soldier,
      52            0 :                                                                     animation_data_manager_);
      53            0 :     if (maybe_crouch_running_animation_state.has_value()) {
      54            0 :         return *maybe_crouch_running_animation_state;
      55              :     }
      56              : 
      57            0 :     return std::nullopt;
      58            0 : }
      59              : 
      60            0 : void LegsCrouchAnimationState::Update(Soldier& soldier, const PhysicsEvents& physics_events)
      61              : {
      62            0 :     soldier.stance = PhysicsConstants::STANCE_CROUCH;
      63            0 : }
      64              : } // namespace Soldank
        

Generated by: LCOV version 2.0-1