1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-15 13:33:36 +02:00

vcmi: add obstacle animation helper functions

This commit is contained in:
Konstantin 2023-03-26 20:11:51 +03:00
parent eff41f66ed
commit 179cee3e88
2 changed files with 39 additions and 0 deletions

View File

@ -60,6 +60,21 @@ bool CObstacleInstance::visibleForSide(ui8 side, bool hasNativeStack) const
return true;
}
const std::string & CObstacleInstance::getAnimation() const
{
return getInfo().animation;
}
const std::string & CObstacleInstance::getAppearAnimation() const
{
return getInfo().appearAnimation;
}
const std::string & CObstacleInstance::getAppearSound() const
{
return getInfo().appearSound;
}
int CObstacleInstance::getAnimationYOffset(int imageHeight) const
{
int offset = imageHeight % 42;
@ -219,6 +234,21 @@ void SpellCreatedObstacle::battleTurnPassed()
turnsRemaining--;
}
const std::string & SpellCreatedObstacle::getAnimation() const
{
return animation;
}
const std::string & SpellCreatedObstacle::getAppearAnimation() const
{
return appearAnimation;
}
const std::string & SpellCreatedObstacle::getAppearSound() const
{
return appearSound;
}
int SpellCreatedObstacle::getAnimationYOffset(int imageHeight) const
{
int offset = imageHeight % 42;

View File

@ -48,6 +48,11 @@ struct DLL_LINKAGE CObstacleInstance
virtual void battleTurnPassed(){};
//Client helper functions, make it easier to render animations
virtual const std::string & getAnimation() const;
virtual const std::string & getAppearAnimation() const;
virtual const std::string & getAppearSound() const;
virtual int getAnimationYOffset(int imageHeight) const;
void toInfo(ObstacleChanges & info, BattleChanges::EOperation operation = BattleChanges::EOperation::ADD);
@ -99,6 +104,10 @@ struct DLL_LINKAGE SpellCreatedObstacle : CObstacleInstance
void battleTurnPassed() override;
//Client helper functions, make it easier to render animations
const std::string & getAnimation() const override;
const std::string & getAppearAnimation() const override;
const std::string & getAppearSound() const override;
int getAnimationYOffset(int imageHeight) const override;
void fromInfo(const ObstacleChanges & info);