Преглед изворни кода

obstacle: remove trigger animation and sound

It was not working anyway. Now it is handled by trigger ability.
Trigger ability hit animation + trigger ability cast sound.
Konstantin пре 2 година
родитељ
комит
1100bc7a5b

+ 2 - 7
lib/ObstacleHandler.h

@@ -31,7 +31,7 @@ public:
 	Obstacle obstacle;
 	si32 iconIndex;
 	std::string identifier;
-	std::string appearSound, appearAnimation, triggerAnimation, triggerSound, animation;
+	std::string appearSound, appearAnimation, animation;
 	std::vector<TerrainId> allowedTerrains;
 	std::vector<std::string> allowedSpecialBfields;
 	
@@ -62,12 +62,7 @@ public:
 		h & identifier;
 		h & animation;
 		h & appearAnimation;
-		h & triggerAnimation;
-		if (version > 806)
-		{
-			h & appearSound;
-			h & triggerSound;
-		}
+		h & appearSound;
 		h & allowedTerrains;
 		h & allowedSpecialBfields;
 		h & isAbsoluteObstacle;

+ 0 - 2
lib/battle/CObstacleInstance.cpp

@@ -173,8 +173,6 @@ void SpellCreatedObstacle::serializeJson(JsonSerializeFormat & handler)
 
 	handler.serializeString("appearSound", appearSound);
 	handler.serializeString("appearAnimation", appearAnimation);
-	handler.serializeString("triggerSound", triggerSound);
-	handler.serializeString("triggerAnimation", triggerAnimation);
 	handler.serializeString("animation", animation);
 
 	handler.serializeInt("animationYOffset", animationYOffset);

+ 0 - 2
lib/battle/CObstacleInstance.h

@@ -82,8 +82,6 @@ struct DLL_LINKAGE SpellCreatedObstacle : CObstacleInstance
 
 	std::string appearSound;
 	std::string appearAnimation;
-	std::string triggerSound;
-	std::string triggerAnimation;
 	std::string animation;
 
 	int animationYOffset;

+ 3 - 7
lib/spells/effects/Moat.cpp

@@ -34,7 +34,6 @@ VCMI_REGISTER_SPELL_EFFECT(Moat, EFFECT_NAME);
 void Moat::serializeJsonEffect(JsonSerializeFormat & handler)
 {
 	handler.serializeBool("hidden", hidden);
-	handler.serializeBool("passable", passable);
 	handler.serializeBool("trigger", trigger);
 	handler.serializeBool("trap", trap);
 	handler.serializeBool("removeOnTrigger", removeOnTrigger);
@@ -100,13 +99,10 @@ void Moat::placeObstacles(ServerCallback * server, const Mechanics * m, const Ef
 		obstacle.trap = trap;
 		obstacle.removeOnTrigger = removeOnTrigger;
 		obstacle.nativeVisible = false; //Moats is invisible for native terrain
-
-		// Moats should not have appear sound and appear animation (they are always exists)
-		// Only trigger animation may exists
-		obstacle.triggerSound = sideOptions.triggerSound;
-		obstacle.triggerAnimation = sideOptions.triggerAnimation;
+		obstacle.appearSound = sideOptions.appearSound; //For dispellable moats
+		obstacle.appearAnimation = sideOptions.appearAnimation; //For dispellable moats
 		obstacle.animation = sideOptions.animation;
-
+		obstacle.customSize.emplace_back(obstacle.pos); //All moat hexes are different obstacles
 		obstacle.animationYOffset = sideOptions.offsetY;
 		pack.changes.emplace_back();
 		obstacle.toInfo(pack.changes.back());

+ 0 - 4
lib/spells/effects/Obstacle.cpp

@@ -91,8 +91,6 @@ void ObstacleSideOptions::serializeJson(JsonSerializeFormat & handler)
 
 	handler.serializeString("appearSound", appearSound);
 	handler.serializeString("appearAnimation", appearAnimation);
-	handler.serializeString("triggerSound", triggerSound);
-	handler.serializeString("triggerAnimation", triggerAnimation);
 	handler.serializeString("animation", animation);
 
 	handler.serializeInt("offsetY", offsetY);
@@ -307,8 +305,6 @@ void Obstacle::placeObstacles(ServerCallback * server, const Mechanics * m, cons
 
 		obstacle.appearSound = options.appearSound;
 		obstacle.appearAnimation = options.appearAnimation;
-		obstacle.triggerSound = options.triggerSound;
-		obstacle.triggerAnimation = options.triggerAnimation;
 		obstacle.animation = options.animation;
 
 		obstacle.animationYOffset = options.offsetY;

+ 1 - 3
lib/spells/effects/Obstacle.h

@@ -32,8 +32,6 @@ public:
 
 	std::string appearSound;
 	std::string appearAnimation;
-	std::string triggerSound;
-	std::string triggerAnimation;
 	std::string animation;
 
 	int offsetY = 0;
@@ -58,7 +56,6 @@ protected:
 	virtual void placeObstacles(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const;
 
 	bool hidden = false;
-	bool passable = false;
 	bool trigger = false;
 	bool trap = false;
 	bool removeOnTrigger = false;
@@ -66,6 +63,7 @@ protected:
 	SpellID triggerAbility;
 private:
 	int32_t patchCount = 0; //random patches to place, for massive spells should be >= 1, for non-massive ones if >= 1, then place only this number inside a target (like H5 landMine)
+	bool passable = false;
 	int32_t turnsRemaining = -1;
 
 	std::array<ObstacleSideOptions, 2> sideOptions;