MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / SelectMeleeAttackAnimation

Method SelectMeleeAttackAnimation

PanzerChasm/server/monster.cpp:856–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

854}
855
856int Monster::SelectMeleeAttackAnimation()
857{
858 int possible_animations[3];
859 int possible_animation_count= 0u;
860
861 const int left_hand_animation= GetAnimation( AnimationId::MeleeAttackLeftHand );
862 const int right_hand_animation= GetAnimation( AnimationId::MeleeAttackRightHand );
863 const int head_animation= GetAnimation( AnimationId::MeleeAttackHead );
864 if( have_left_hand_ && left_hand_animation >= 0 )
865 {
866 possible_animations[ possible_animation_count ]= left_hand_animation;
867 possible_animation_count++;
868 }
869 if( have_right_hand_ && right_hand_animation >= 0 )
870 {
871 possible_animations[ possible_animation_count ]= right_hand_animation;
872 possible_animation_count++;
873 }
874 if( have_head_ && head_animation >= 0 )
875 {
876 possible_animations[ possible_animation_count ]= head_animation;
877 possible_animation_count++;
878 }
879
880 if( possible_animation_count == 0u )
881 return -1;
882
883 return possible_animations[ random_generator_->Rand() % possible_animation_count ];
884}
885
886void Monster::SpawnBodyPart( Map& map, const unsigned char part_id )
887{

Callers

nothing calls this directly

Calls 1

RandMethod · 0.80

Tested by

no test coverage detected