MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / beginHandStateChange

Method beginHandStateChange

game/state/battle/battleunit.cpp:5236–5261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5234}
5235
5236void BattleUnit::beginHandStateChange(HandState state)
5237{
5238 // This is ONLY called after confirming with canHandStateChange that change is valid
5239 // Therefore, we're not checking for conditions
5240
5241 if (target_hand_state == state)
5242 {
5243 return;
5244 }
5245
5246 int frameCount = agent->getAnimationPack()->getFrameCountHands(
5247 displayedItem, current_body_state, current_hand_state, state, current_movement_state,
5248 facing);
5249 int ticks = frameCount * TICKS_PER_FRAME_UNIT;
5250
5251 if (ticks > 0 && target_hand_state != state)
5252 {
5253 target_hand_state = state;
5254 hand_animation_ticks_remaining = ticks;
5255 }
5256 else
5257 {
5258 setHandState(state);
5259 }
5260 residual_aiming_ticks_remaining = 0;
5261}
5262
5263void BattleUnit::setHandState(HandState state)
5264{

Callers

nothing calls this directly

Calls 2

getFrameCountHandsMethod · 0.80
getAnimationPackMethod · 0.80

Tested by

no test coverage detected