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

View File

@ -302,7 +302,7 @@ public:
}; };
/// Class that plays effect at one or more positions along with (single) sound effect /// 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; std::string soundName;
bool effectFinished; bool effectFinished;
@ -330,18 +330,18 @@ public:
}; };
/// Create animation with screen-wide effect /// 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 /// 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); EffectAnimation(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, std::vector<Point> pos , int effects = 0);
/// Create animation positioned at certain hex(es) /// Create animation positioned at certain hex(es)
PointEffectAnimation(BattleInterface & owner, std::string animationName, BattleHex hex , int effects = 0); EffectAnimation(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, std::vector<BattleHex> hex, int effects = 0);
PointEffectAnimation(BattleInterface & owner, std::string animationName, Point pos, BattleHex hex, int effects = 0); EffectAnimation(BattleInterface & owner, std::string animationName, Point pos, BattleHex hex, int effects = 0);
~PointEffectAnimation(); ~EffectAnimation();
bool init() override; bool init() override;
void nextFrame() override; void nextFrame() override;

View File

@ -51,7 +51,7 @@ void BattleEffectsController::displayEffect(EBattleEffect effect, std::string so
CCS->soundh->playSound( soundFile ); 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) void BattleEffectsController::battleTriggerEffect(const BattleTriggerEffect & bte)

View File

@ -24,7 +24,7 @@ class CAnimation;
class Canvas; class Canvas;
class BattleInterface; class BattleInterface;
class BattleRenderer; class BattleRenderer;
class PointEffectAnimation; class EffectAnimation;
/// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,... /// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...
struct BattleEffect struct BattleEffect
@ -62,5 +62,5 @@ public:
void collectRenderableObjects(BattleRenderer & renderer); 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; bool side = sc->side;
executeOnAnimationCondition(EAnimationEvents::AFTER_HIT, true, [=](){ executeOnAnimationCondition(EAnimationEvents::AFTER_HIT, true, [=](){
stacksController->addNewAnim(new PointEffectAnimation(*this, side ? "SP07_A.DEF" : "SP07_B.DEF", leftHero)); stacksController->addNewAnim(new EffectAnimation(*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_B.DEF" : "SP07_A.DEF", rightHero));
}); });
} }
} }
@ -469,18 +469,18 @@ void BattleInterface::displaySpellAnimationQueue(const CSpell * spell, const CSp
int flags = 0; int flags = 0;
if (isHit) if (isHit)
flags |= PointEffectAnimation::FORCE_ON_TOP; flags |= EffectAnimation::FORCE_ON_TOP;
if (animation.verticalPosition == VerticalPosition::BOTTOM) if (animation.verticalPosition == VerticalPosition::BOTTOM)
flags |= PointEffectAnimation::ALIGN_TO_BOTTOM; flags |= EffectAnimation::ALIGN_TO_BOTTOM;
if (!destinationTile.isValid()) if (!destinationTile.isValid())
flags |= PointEffectAnimation::SCREEN_FILL; flags |= EffectAnimation::SCREEN_FILL;
if (!destinationTile.isValid()) if (!destinationTile.isValid())
stacksController->addNewAnim(new PointEffectAnimation(*this, animation.resourceName, flags)); stacksController->addNewAnim(new EffectAnimation(*this, animation.resourceName, flags));
else 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 // -> if we know how to blit obstacle, let's blit the effect in the same place
Point whereTo = getObstaclePosition(first, *oi); Point whereTo = getObstaclePosition(first, *oi);
CCS->soundh->playSound( spellObstacle->appearSound ); 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 //so when multiple obstacles are added, they show up one after another
owner.waitForAnimationCondition(EAnimationEvents::ACTION, false); 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)); positions.push_back(owner.stacksController->getStackPositionAtHex(attackInfo.destinationTile, nullptr) + Point(99, 120));
CCS->soundh->playSound( "WALLHIT" ); 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); owner.waitForAnimationCondition(EAnimationEvents::ACTION, false);