From 1100bc7a5bc6a192afa9e45949fade97a1f36287 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Mon, 20 Mar 2023 11:59:43 +0300 Subject: [PATCH] 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. --- lib/ObstacleHandler.h | 9 ++------- lib/battle/CObstacleInstance.cpp | 2 -- lib/battle/CObstacleInstance.h | 2 -- lib/spells/effects/Moat.cpp | 10 +++------- lib/spells/effects/Obstacle.cpp | 4 ---- lib/spells/effects/Obstacle.h | 4 +--- 6 files changed, 6 insertions(+), 25 deletions(-) diff --git a/lib/ObstacleHandler.h b/lib/ObstacleHandler.h index 9cb783162..de2018ef7 100644 --- a/lib/ObstacleHandler.h +++ b/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 allowedTerrains; std::vector 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; diff --git a/lib/battle/CObstacleInstance.cpp b/lib/battle/CObstacleInstance.cpp index 1d23a8692..7ea0f5eb7 100644 --- a/lib/battle/CObstacleInstance.cpp +++ b/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); diff --git a/lib/battle/CObstacleInstance.h b/lib/battle/CObstacleInstance.h index fb4a3744d..f4a5ccb96 100644 --- a/lib/battle/CObstacleInstance.h +++ b/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; diff --git a/lib/spells/effects/Moat.cpp b/lib/spells/effects/Moat.cpp index a8aacffb6..1fba587c7 100644 --- a/lib/spells/effects/Moat.cpp +++ b/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()); diff --git a/lib/spells/effects/Obstacle.cpp b/lib/spells/effects/Obstacle.cpp index e1451870c..a6f7722f8 100644 --- a/lib/spells/effects/Obstacle.cpp +++ b/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; diff --git a/lib/spells/effects/Obstacle.h b/lib/spells/effects/Obstacle.h index 31ab4bdfe..4bf9159b3 100644 --- a/lib/spells/effects/Obstacle.h +++ b/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 sideOptions;