* Handles the stepping sounds. */
| 544 | * Handles the stepping sounds. |
| 545 | */ |
| 546 | void UnitWalkBState::playMovementSound() |
| 547 | { |
| 548 | if ((!_unit->getVisible() && !_parent->getSave()->getDebugMode()) || !_parent->getMap()->getCamera()->isOnScreen(_unit->getPosition(), true)) return; |
| 549 | |
| 550 | if (_unit->getMoveSound() != -1) |
| 551 | { |
| 552 | // if a sound is configured in the ruleset, play that one |
| 553 | if (_unit->getWalkingPhase() == 0) |
| 554 | { |
| 555 | _parent->getResourcePack()->getSound("BATTLE.CAT", _unit->getMoveSound())->play(); |
| 556 | } |
| 557 | } |
| 558 | else |
| 559 | { |
| 560 | if (_unit->getStatus() == STATUS_WALKING) |
| 561 | { |
| 562 | Tile *tile = _unit->getTile(); |
| 563 | Tile *tileBelow = _parent->getSave()->getTile(tile->getPosition() + Position(0,0,-1)); |
| 564 | // play footstep sound 1 |
| 565 | if (_unit->getWalkingPhase() == 3) |
| 566 | { |
| 567 | if (tile->getFootstepSound(tileBelow)) |
| 568 | { |
| 569 | _parent->getResourcePack()->getSound("BATTLE.CAT", 22 + (tile->getFootstepSound(tileBelow)*2))->play(); |
| 570 | } |
| 571 | } |
| 572 | // play footstep sound 2 |
| 573 | if (_unit->getWalkingPhase() == 7) |
| 574 | { |
| 575 | if (tile->getFootstepSound(tileBelow)) |
| 576 | { |
| 577 | _parent->getResourcePack()->getSound("BATTLE.CAT", 23 + (tile->getFootstepSound(tileBelow)*2))->play(); |
| 578 | } |
| 579 | } |
| 580 | } |
| 581 | else |
| 582 | { |
| 583 | // play default flying sound |
| 584 | if (_unit->getWalkingPhase() == 1 && !_falling) |
| 585 | { |
| 586 | _parent->getResourcePack()->getSound("BATTLE.CAT", 15)->play(); |
| 587 | } |
| 588 | } |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | } |
nothing calls this directly
no test coverage detected