Bladeren bron

Added workaround for Dungeon towers

Ivan Savenko 2 jaren geleden
bovenliggende
commit
4eed0b2c9e
2 gewijzigde bestanden met toevoegingen van 8 en 3 verwijderingen
  1. 6 2
      client/battle/BattleStacksController.cpp
  2. 2 1
      lib/GameConstants.h

+ 6 - 2
client/battle/BattleStacksController.cpp

@@ -184,7 +184,6 @@ void BattleStacksController::stackReset(const CStack * stack)
 void BattleStacksController::stackAdded(const CStack * stack, bool instant)
 {
 	// 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;
 
 	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]->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);
 	}
@@ -207,10 +211,10 @@ void BattleStacksController::stackAdded(const CStack * stack, bool instant)
 		stackAnimation[stack->ID] = AnimationControls::getAnimation(stack->getCreature());
 		stackAnimation[stack->ID]->onAnimationReset += std::bind(&onAnimationFinished, stack, stackAnimation[stack->ID]);
 		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.y = coords.y;
-	stackAnimation[stack->ID]->pos.w = stackAnimation[stack->ID]->getWidth();
 	stackAnimation[stack->ID]->setType(ECreatureAnimType::HOLDING);
 
 	if (!instant)

+ 2 - 1
lib/GameConstants.h

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