From ae3f6c5e791e116a050f46d7b41c1ef2cbf2d4df Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 25 Dec 2022 21:39:55 +0200 Subject: [PATCH] Renamed PointEffectAnimation -> EffectAnimation --- client/battle/BattleAnimationClasses.cpp | 42 +++++++++++----------- client/battle/BattleAnimationClasses.h | 16 ++++----- client/battle/BattleEffectsController.cpp | 2 +- client/battle/BattleEffectsController.h | 4 +-- client/battle/BattleInterface.cpp | 14 ++++---- client/battle/BattleObstacleController.cpp | 2 +- client/battle/BattleSiegeController.cpp | 2 +- 7 files changed, 41 insertions(+), 41 deletions(-) diff --git a/client/battle/BattleAnimationClasses.cpp b/client/battle/BattleAnimationClasses.cpp index 8111097b0..ef306ce75 100644 --- a/client/battle/BattleAnimationClasses.cpp +++ b/client/battle/BattleAnimationClasses.cpp @@ -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(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 hex, int effects): - PointEffectAnimation(owner, animationName, effects) +EffectAnimation::EffectAnimation(BattleInterface & owner, std::string animationName, std::vector 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 pos, int effects): - PointEffectAnimation(owner, animationName, effects) +EffectAnimation::EffectAnimation(BattleInterface & owner, std::string animationName, std::vector 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); } diff --git a/client/battle/BattleAnimationClasses.h b/client/battle/BattleAnimationClasses.h index eb25c764b..a42503259 100644 --- a/client/battle/BattleAnimationClasses.h +++ b/client/battle/BattleAnimationClasses.h @@ -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 pos , int effects = 0); + EffectAnimation(BattleInterface & owner, std::string animationName, Point pos , int effects = 0); + EffectAnimation(BattleInterface & owner, std::string animationName, std::vector 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 hex, int effects = 0); + EffectAnimation(BattleInterface & owner, std::string animationName, BattleHex hex , int effects = 0); + EffectAnimation(BattleInterface & owner, std::string animationName, std::vector 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; diff --git a/client/battle/BattleEffectsController.cpp b/client/battle/BattleEffectsController.cpp index fbdcf29f5..56106083e 100644 --- a/client/battle/BattleEffectsController.cpp +++ b/client/battle/BattleEffectsController.cpp @@ -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) diff --git a/client/battle/BattleEffectsController.h b/client/battle/BattleEffectsController.h index 6e6ce75cd..39c3bbee1 100644 --- a/client/battle/BattleEffectsController.h +++ b/client/battle/BattleEffectsController.h @@ -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; }; diff --git a/client/battle/BattleInterface.cpp b/client/battle/BattleInterface.cpp index 9caf7d4d2..94dc2a507 100644 --- a/client/battle/BattleInterface.cpp +++ b/client/battle/BattleInterface.cpp @@ -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)); } } } diff --git a/client/battle/BattleObstacleController.cpp b/client/battle/BattleObstacleController.cpp index 6f99a787c..d74b1596b 100644 --- a/client/battle/BattleObstacleController.cpp +++ b/client/battle/BattleObstacleController.cpp @@ -98,7 +98,7 @@ void BattleObstacleController::obstaclePlaced(const std::vector 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); diff --git a/client/battle/BattleSiegeController.cpp b/client/battle/BattleSiegeController.cpp index 24e1d9411..274e1c0fb 100644 --- a/client/battle/BattleSiegeController.cpp +++ b/client/battle/BattleSiegeController.cpp @@ -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);