1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Added workaround for Dungeon towers

This commit is contained in:
Ivan Savenko 2023-03-25 19:58:05 +02:00
parent 49fa628e9b
commit 4eed0b2c9e
2 changed files with 8 additions and 3 deletions

View File

@ -184,7 +184,6 @@ void BattleStacksController::stackReset(const CStack * stack)
void BattleStacksController::stackAdded(const CStack * stack, bool instant) void BattleStacksController::stackAdded(const CStack * stack, bool instant)
{ {
// Tower shooters have only their upper half visible // Tower shooters have only their upper half visible
// FIXME: causes issues in Dungeon - visible animation of Medusa tails (animation disabled in H3)
static const int turretCreatureAnimationHeight = 232; static const int turretCreatureAnimationHeight = 232;
stackFacingRight[stack->ID] = stack->side == BattleSide::ATTACKER; // must be set before getting stack position stackFacingRight[stack->ID] = stack->side == BattleSide::ATTACKER; // must be set before getting stack position
@ -199,6 +198,11 @@ void BattleStacksController::stackAdded(const CStack * stack, bool instant)
stackAnimation[stack->ID] = AnimationControls::getAnimation(turretCreature); stackAnimation[stack->ID] = AnimationControls::getAnimation(turretCreature);
stackAnimation[stack->ID]->pos.h = turretCreatureAnimationHeight; stackAnimation[stack->ID]->pos.h = turretCreatureAnimationHeight;
stackAnimation[stack->ID]->pos.w = stackAnimation[stack->ID]->getWidth();
// FIXME: workaround for visible animation of Medusa tails (animation disabled in H3)
if (turretCreature->idNumber == CreatureID::MEDUSA )
stackAnimation[stack->ID]->pos.w = 250;
coords = owner.siegeController->getTurretCreaturePosition(stack->initialPosition); coords = owner.siegeController->getTurretCreaturePosition(stack->initialPosition);
} }
@ -207,10 +211,10 @@ void BattleStacksController::stackAdded(const CStack * stack, bool instant)
stackAnimation[stack->ID] = AnimationControls::getAnimation(stack->getCreature()); stackAnimation[stack->ID] = AnimationControls::getAnimation(stack->getCreature());
stackAnimation[stack->ID]->onAnimationReset += std::bind(&onAnimationFinished, stack, stackAnimation[stack->ID]); stackAnimation[stack->ID]->onAnimationReset += std::bind(&onAnimationFinished, stack, stackAnimation[stack->ID]);
stackAnimation[stack->ID]->pos.h = stackAnimation[stack->ID]->getHeight(); stackAnimation[stack->ID]->pos.h = stackAnimation[stack->ID]->getHeight();
stackAnimation[stack->ID]->pos.w = stackAnimation[stack->ID]->getWidth();
} }
stackAnimation[stack->ID]->pos.x = coords.x; stackAnimation[stack->ID]->pos.x = coords.x;
stackAnimation[stack->ID]->pos.y = coords.y; stackAnimation[stack->ID]->pos.y = coords.y;
stackAnimation[stack->ID]->pos.w = stackAnimation[stack->ID]->getWidth();
stackAnimation[stack->ID]->setType(ECreatureAnimType::HOLDING); stackAnimation[stack->ID]->setType(ECreatureAnimType::HOLDING);
if (!instant) if (!instant)

View File

@ -1120,6 +1120,7 @@ public:
LICHES = 64, LICHES = 64,
BONE_DRAGON = 68, BONE_DRAGON = 68,
TROGLODYTES = 70, TROGLODYTES = 70,
MEDUSA = 76,
HYDRA = 110, HYDRA = 110,
CHAOS_HYDRA = 111, CHAOS_HYDRA = 111,
AIR_ELEMENTAL = 112, AIR_ELEMENTAL = 112,
@ -1245,7 +1246,7 @@ class ObstacleInfo;
class Obstacle : public BaseForID<Obstacle, si32> class Obstacle : public BaseForID<Obstacle, si32>
{ {
INSTID_LIKE_CLASS_COMMON(Obstacle, si32) INSTID_LIKE_CLASS_COMMON(Obstacle, si32)
DLL_LINKAGE const ObstacleInfo * getInfo() const; DLL_LINKAGE const ObstacleInfo * getInfo() const;
DLL_LINKAGE operator std::string() const; DLL_LINKAGE operator std::string() const;
DLL_LINKAGE static Obstacle fromString(const std::string & identifier); DLL_LINKAGE static Obstacle fromString(const std::string & identifier);