1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Renamed PointEffectAnimation -> EffectAnimation

This commit is contained in:
Ivan Savenko 2022-12-25 21:39:55 +02:00
parent 5b41ced427
commit ae3f6c5e79
7 changed files with 41 additions and 41 deletions

View File

@ -801,7 +801,7 @@ void CatapultAnimation::nextFrame()
std::string effectFilename = (catapultDamage > 0) ? "SGEXPL" : "CSGRCK";
CCS->soundh->playSound( soundFilename );
owner.stacksController->addNewAnim( new PointEffectAnimation(owner, effectFilename, shotTarget));
owner.stacksController->addNewAnim( new EffectAnimation(owner, effectFilename, shotTarget));
}
void CatapultAnimation::createProjectile(const Point & from, const Point & dest) const
@ -865,7 +865,7 @@ uint32_t CastAnimation::getAttackClimaxFrame() const
return maxFrames / 2;
}
PointEffectAnimation::PointEffectAnimation(BattleInterface & owner, std::string animationName, int effects):
EffectAnimation::EffectAnimation(BattleInterface & owner, std::string animationName, int effects):
BattleAnimation(owner),
animation(std::make_shared<CAnimation>(animationName)),
effectFlags(effects),
@ -874,40 +874,40 @@ PointEffectAnimation::PointEffectAnimation(BattleInterface & owner, std::string
logAnim->debug("CPointEffectAnimation::init: effect %s", animationName);
}
PointEffectAnimation::PointEffectAnimation(BattleInterface & owner, std::string animationName, std::vector<BattleHex> hex, int effects):
PointEffectAnimation(owner, animationName, effects)
EffectAnimation::EffectAnimation(BattleInterface & owner, std::string animationName, std::vector<BattleHex> hex, int effects):
EffectAnimation(owner, animationName, effects)
{
battlehexes = hex;
}
PointEffectAnimation::PointEffectAnimation(BattleInterface & owner, std::string animationName, BattleHex hex, int effects):
PointEffectAnimation(owner, animationName, effects)
EffectAnimation::EffectAnimation(BattleInterface & owner, std::string animationName, BattleHex hex, int effects):
EffectAnimation(owner, animationName, effects)
{
assert(hex.isValid());
battlehexes.push_back(hex);
}
PointEffectAnimation::PointEffectAnimation(BattleInterface & owner, std::string animationName, std::vector<Point> pos, int effects):
PointEffectAnimation(owner, animationName, effects)
EffectAnimation::EffectAnimation(BattleInterface & owner, std::string animationName, std::vector<Point> pos, int effects):
EffectAnimation(owner, animationName, effects)
{
positions = pos;
}
PointEffectAnimation::PointEffectAnimation(BattleInterface & owner, std::string animationName, Point pos, int effects):
PointEffectAnimation(owner, animationName, effects)
EffectAnimation::EffectAnimation(BattleInterface & owner, std::string animationName, Point pos, int effects):
EffectAnimation(owner, animationName, effects)
{
positions.push_back(pos);
}
PointEffectAnimation::PointEffectAnimation(BattleInterface & owner, std::string animationName, Point pos, BattleHex hex, int effects):
PointEffectAnimation(owner, animationName, effects)
EffectAnimation::EffectAnimation(BattleInterface & owner, std::string animationName, Point pos, BattleHex hex, int effects):
EffectAnimation(owner, animationName, effects)
{
assert(hex.isValid());
battlehexes.push_back(hex);
positions.push_back(pos);
}
bool PointEffectAnimation::init()
bool EffectAnimation::init()
{
animation->preload();
@ -965,7 +965,7 @@ bool PointEffectAnimation::init()
return true;
}
void PointEffectAnimation::nextFrame()
void EffectAnimation::nextFrame()
{
playEffect();
@ -977,27 +977,27 @@ void PointEffectAnimation::nextFrame()
}
}
bool PointEffectAnimation::alignToBottom() const
bool EffectAnimation::alignToBottom() const
{
return effectFlags & ALIGN_TO_BOTTOM;
}
bool PointEffectAnimation::forceOnTop() const
bool EffectAnimation::forceOnTop() const
{
return effectFlags & FORCE_ON_TOP;
}
bool PointEffectAnimation::screenFill() const
bool EffectAnimation::screenFill() const
{
return effectFlags & SCREEN_FILL;
}
void PointEffectAnimation::onEffectFinished()
void EffectAnimation::onEffectFinished()
{
effectFinished = true;
}
void PointEffectAnimation::playEffect()
void EffectAnimation::playEffect()
{
if ( effectFinished )
return;
@ -1018,7 +1018,7 @@ void PointEffectAnimation::playEffect()
}
}
void PointEffectAnimation::clearEffect()
void EffectAnimation::clearEffect()
{
auto & effects = owner.effectsController->battleEffects;
@ -1027,7 +1027,7 @@ void PointEffectAnimation::clearEffect()
});
}
PointEffectAnimation::~PointEffectAnimation()
EffectAnimation::~EffectAnimation()
{
assert(effectFinished);
}

View File

@ -302,7 +302,7 @@ public:
};
/// Class that plays effect at one or more positions along with (single) sound effect
class PointEffectAnimation : public BattleAnimation
class EffectAnimation : public BattleAnimation
{
std::string soundName;
bool effectFinished;
@ -330,18 +330,18 @@ public:
};
/// Create animation with screen-wide effect
PointEffectAnimation(BattleInterface & owner, std::string animationName, int effects = 0);
EffectAnimation(BattleInterface & owner, std::string animationName, int effects = 0);
/// Create animation positioned at point(s). Note that positions must be are absolute, including battleint position offset
PointEffectAnimation(BattleInterface & owner, std::string animationName, Point pos , int effects = 0);
PointEffectAnimation(BattleInterface & owner, std::string animationName, std::vector<Point> pos , int effects = 0);
EffectAnimation(BattleInterface & owner, std::string animationName, Point pos , int effects = 0);
EffectAnimation(BattleInterface & owner, std::string animationName, std::vector<Point> pos , int effects = 0);
/// Create animation positioned at certain hex(es)
PointEffectAnimation(BattleInterface & owner, std::string animationName, BattleHex hex , int effects = 0);
PointEffectAnimation(BattleInterface & owner, std::string animationName, std::vector<BattleHex> hex, int effects = 0);
EffectAnimation(BattleInterface & owner, std::string animationName, BattleHex hex , int effects = 0);
EffectAnimation(BattleInterface & owner, std::string animationName, std::vector<BattleHex> hex, int effects = 0);
PointEffectAnimation(BattleInterface & owner, std::string animationName, Point pos, BattleHex hex, int effects = 0);
~PointEffectAnimation();
EffectAnimation(BattleInterface & owner, std::string animationName, Point pos, BattleHex hex, int effects = 0);
~EffectAnimation();
bool init() override;
void nextFrame() override;

View File

@ -51,7 +51,7 @@ void BattleEffectsController::displayEffect(EBattleEffect effect, std::string so
CCS->soundh->playSound( soundFile );
owner.stacksController->addNewAnim(new PointEffectAnimation(owner, customAnim, destTile));
owner.stacksController->addNewAnim(new EffectAnimation(owner, customAnim, destTile));
}
void BattleEffectsController::battleTriggerEffect(const BattleTriggerEffect & bte)

View File

@ -24,7 +24,7 @@ class CAnimation;
class Canvas;
class BattleInterface;
class BattleRenderer;
class PointEffectAnimation;
class EffectAnimation;
/// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...
struct BattleEffect
@ -62,5 +62,5 @@ public:
void collectRenderableObjects(BattleRenderer & renderer);
friend class PointEffectAnimation;
friend class EffectAnimation;
};

View File

@ -413,8 +413,8 @@ void BattleInterface::spellCast(const BattleSpellCast * sc)
bool side = sc->side;
executeOnAnimationCondition(EAnimationEvents::AFTER_HIT, true, [=](){
stacksController->addNewAnim(new PointEffectAnimation(*this, side ? "SP07_A.DEF" : "SP07_B.DEF", leftHero));
stacksController->addNewAnim(new PointEffectAnimation(*this, side ? "SP07_B.DEF" : "SP07_A.DEF", rightHero));
stacksController->addNewAnim(new EffectAnimation(*this, side ? "SP07_A.DEF" : "SP07_B.DEF", leftHero));
stacksController->addNewAnim(new EffectAnimation(*this, side ? "SP07_B.DEF" : "SP07_A.DEF", rightHero));
});
}
}
@ -469,18 +469,18 @@ void BattleInterface::displaySpellAnimationQueue(const CSpell * spell, const CSp
int flags = 0;
if (isHit)
flags |= PointEffectAnimation::FORCE_ON_TOP;
flags |= EffectAnimation::FORCE_ON_TOP;
if (animation.verticalPosition == VerticalPosition::BOTTOM)
flags |= PointEffectAnimation::ALIGN_TO_BOTTOM;
flags |= EffectAnimation::ALIGN_TO_BOTTOM;
if (!destinationTile.isValid())
flags |= PointEffectAnimation::SCREEN_FILL;
flags |= EffectAnimation::SCREEN_FILL;
if (!destinationTile.isValid())
stacksController->addNewAnim(new PointEffectAnimation(*this, animation.resourceName, flags));
stacksController->addNewAnim(new EffectAnimation(*this, animation.resourceName, flags));
else
stacksController->addNewAnim(new PointEffectAnimation(*this, animation.resourceName, destinationTile, flags));
stacksController->addNewAnim(new EffectAnimation(*this, animation.resourceName, destinationTile, flags));
}
}
}

View File

@ -98,7 +98,7 @@ void BattleObstacleController::obstaclePlaced(const std::vector<std::shared_ptr<
// -> if we know how to blit obstacle, let's blit the effect in the same place
Point whereTo = getObstaclePosition(first, *oi);
CCS->soundh->playSound( spellObstacle->appearSound );
owner.stacksController->addNewAnim(new PointEffectAnimation(owner, spellObstacle->appearAnimation, whereTo, oi->pos));
owner.stacksController->addNewAnim(new EffectAnimation(owner, spellObstacle->appearAnimation, whereTo, oi->pos));
//so when multiple obstacles are added, they show up one after another
owner.waitForAnimationCondition(EAnimationEvents::ACTION, false);

View File

@ -346,7 +346,7 @@ void BattleSiegeController::stackIsCatapulting(const CatapultAttack & ca)
positions.push_back(owner.stacksController->getStackPositionAtHex(attackInfo.destinationTile, nullptr) + Point(99, 120));
CCS->soundh->playSound( "WALLHIT" );
owner.stacksController->addNewAnim(new PointEffectAnimation(owner, "SGEXPL.DEF", positions));
owner.stacksController->addNewAnim(new EffectAnimation(owner, "SGEXPL.DEF", positions));
}
owner.waitForAnimationCondition(EAnimationEvents::ACTION, false);