mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fix ranged attack animations
This commit is contained in:
parent
bbd4d361e4
commit
2442d38b9a
@ -738,7 +738,7 @@ bool CRangedAttackAnimation::init()
|
||||
void CRangedAttackAnimation::setAnimationGroup()
|
||||
{
|
||||
Point shooterPos = stackAnimation(attackingStack)->pos.topLeft();
|
||||
Point shotTarget = owner->stacksController->getStackPositionAtHex(dest, attackedStack) + Point(225, 225);
|
||||
Point shotTarget = owner->stacksController->getStackPositionAtHex(dest, attackedStack);
|
||||
|
||||
//maximal angle in radians between straight horizontal line and shooting line for which shot is considered to be straight (absoulte value)
|
||||
static const double straightAngle = 0.2;
|
||||
@ -761,17 +761,17 @@ void CRangedAttackAnimation::initializeProjectile()
|
||||
Point shotOrigin = stackAnimation(attackingStack)->pos.topLeft() + Point(222, 265);
|
||||
int multiplier = stackFacingRight(attackingStack) ? 1 : -1;
|
||||
|
||||
if (group == CCreatureAnim::SHOOT_UP)
|
||||
if (group == getUpwardsGroup())
|
||||
{
|
||||
shotOrigin.x += ( -25 + shooterInfo->animation.upperRightMissleOffsetX ) * multiplier;
|
||||
shotOrigin.y += shooterInfo->animation.upperRightMissleOffsetY;
|
||||
}
|
||||
else if (group == CCreatureAnim::SHOOT_DOWN)
|
||||
else if (group == getDownwardsGroup())
|
||||
{
|
||||
shotOrigin.x += ( -25 + shooterInfo->animation.lowerRightMissleOffsetX ) * multiplier;
|
||||
shotOrigin.y += shooterInfo->animation.lowerRightMissleOffsetY;
|
||||
}
|
||||
else if (group == CCreatureAnim::SHOOT_FRONT)
|
||||
else if (group == getForwardGroup())
|
||||
{
|
||||
shotOrigin.x += ( -25 + shooterInfo->animation.rightMissleOffsetX ) * multiplier;
|
||||
shotOrigin.y += shooterInfo->animation.rightMissleOffsetY;
|
||||
@ -819,8 +819,6 @@ void CRangedAttackAnimation::nextFrame()
|
||||
{
|
||||
const CCreature *shooterInfo = getCreature();
|
||||
|
||||
assert(stackAnimation(attackingStack)->isShooting());
|
||||
|
||||
logAnim->info("Ranged attack executing, %d / %d / %d",
|
||||
stackAnimation(attackingStack)->getCurrentFrame(),
|
||||
shooterInfo->animation.attackClimaxFrame,
|
||||
@ -967,7 +965,8 @@ CCreatureAnim::EAnimType CCastAnimation::getDownwardsGroup() const
|
||||
|
||||
void CCastAnimation::createProjectile(const Point & from, const Point & dest) const
|
||||
{
|
||||
owner->projectilesController->createSpellProjectile(attackingStack, attackedStack, from, dest, spell);
|
||||
if (!spell->animationInfo.projectile.empty())
|
||||
owner->projectilesController->createSpellProjectile(attackingStack, attackedStack, from, dest, spell);
|
||||
}
|
||||
|
||||
CPointEffectAnimation::CPointEffectAnimation(CBattleInterface * _owner, soundBase::soundID sound, std::string animationName, int effects):
|
||||
|
@ -343,14 +343,14 @@ void CBattleProjectileController::createProjectile(const CStack * shooter, const
|
||||
missileProjectile->animation = getProjectileImage(shooter);
|
||||
missileProjectile->reverse = !owner->stacksController->facingRight(shooter);
|
||||
missileProjectile->frameNum = computeProjectileFrameID(from, dest, shooter);
|
||||
missileProjectile->steps = computeProjectileFlightTime(from, dest, AnimationControls::getProjectileSpeed());
|
||||
}
|
||||
|
||||
projectile->from = from;
|
||||
projectile->dest = dest;
|
||||
projectile->steps = computeProjectileFlightTime(from, dest, AnimationControls::getProjectileSpeed());
|
||||
projectile->from = from;
|
||||
projectile->dest = dest;
|
||||
projectile->shooterID = shooter->ID;
|
||||
projectile->step = 0;
|
||||
projectile->playing = false;
|
||||
projectile->step = 0;
|
||||
projectile->playing = false;
|
||||
|
||||
projectiles.push_back(projectile);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user