MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / drawRoutine2

Method drawRoutine2

src/Battlescape/UnitSprite.cpp:685–728  ·  view source on GitHub ↗

* Drawing routine for XCom tanks. */

Source from the content-addressed store, hash-verified

683 * Drawing routine for XCom tanks.
684 */
685void UnitSprite::drawRoutine2()
686{
687 if (_unit->isOut())
688 {
689 // unit is drawn as an item
690 return;
691 }
692
693 const int offX[8] = { -2, -7, -5, 0, 5, 7, 2, 0 }; // hovertank offsets
694 const int offy[8] = { -1, -3, -4, -5, -4, -3, -1, -1 }; // hovertank offsets
695
696 Surface *s = 0;
697
698 const int hoverTank = _unit->getArmor()->getMovementType() == MT_FLY ? 32 : 0;
699 const int turret = _unit->getTurretType();
700
701 // draw the animated propulsion below the hwp
702 if (_part > 0 && hoverTank != 0)
703 {
704 s = _unitSurface->getFrame(104 + ((_part-1) * 8) + _animationFrame);
705 s->blit(this);
706 }
707
708 // draw the tank itself
709 s = _unitSurface->getFrame(hoverTank + (_part * 8) + _unit->getDirection());
710 s->blit(this);
711
712 // draw the turret, together with the last part
713 if (_part == 3 && turret != -1)
714 {
715 s = _unitSurface->getFrame(64 + (turret * 8) + _unit->getTurretDirection());
716 int turretOffsetX = 0;
717 int turretOffsetY = -4;
718 if(hoverTank)
719 {
720 turretOffsetX += offX[_unit->getDirection()];
721 turretOffsetY += offy[_unit->getDirection()];
722 }
723 s->setX(turretOffsetX);
724 s->setY(turretOffsetY);
725 s->blit(this);
726 }
727
728}
729
730/**
731 * Drawing routine for cyberdiscs.

Callers

nothing calls this directly

Calls 10

isOutMethod · 0.80
getMovementTypeMethod · 0.80
getFrameMethod · 0.80
getTurretDirectionMethod · 0.80
getArmorMethod · 0.45
getTurretTypeMethod · 0.45
blitMethod · 0.45
getDirectionMethod · 0.45
setXMethod · 0.45
setYMethod · 0.45

Tested by

no test coverage detected