From 108470471eff9c79d5771fb90d46fa6afc0ad277 Mon Sep 17 00:00:00 2001 From: nordsoft Date: Sun, 28 Aug 2022 06:16:42 +0400 Subject: [PATCH] Minor fixes --- client/battle/CBattleInterface.cpp | 4 +- config/obstacles.json | 252 ++++++++++++++--------------- config/schemas/obstacle.json | 4 +- lib/ObstacleHandler.cpp | 6 +- lib/ObstacleHandler.h | 13 +- lib/serializer/CSerializer.h | 4 +- 6 files changed, 145 insertions(+), 138 deletions(-) diff --git a/client/battle/CBattleInterface.cpp b/client/battle/CBattleInterface.cpp index e65532e6c..6051a3679 100644 --- a/client/battle/CBattleInterface.cpp +++ b/client/battle/CBattleInterface.cpp @@ -362,7 +362,7 @@ CBattleInterface::CBattleInterface(const CCreatureSet *army1, const CCreatureSet { if(elem->obstacleType == CObstacleInstance::USUAL) { - std::string animationName = elem->getInfo().defName; + std::string animationName = elem->getInfo().animation; auto cached = animationsCache.find(animationName); @@ -380,7 +380,7 @@ CBattleInterface::CBattleInterface(const CCreatureSet *army1, const CCreatureSet } else if (elem->obstacleType == CObstacleInstance::ABSOLUTE_OBSTACLE) { - std::string animationName = elem->getInfo().defName; + std::string animationName = elem->getInfo().animation; auto cached = animationsCache.find(animationName); diff --git a/config/obstacles.json b/config/obstacles.json index d2a7116c6..e5105febf 100644 --- a/config/obstacles.json +++ b/config/obstacles.json @@ -8,7 +8,7 @@ // * "blockedTiles": for absolute obstacles contains absolute coordinates. For usual obstacles contains offsets relative to the obstacle position (that is bottom left corner). If obstacle is placed in an odd row (counting from 0) and the blocked tile is in an even row, position will be shifted one tile to the left. Thanks to that ie. -16 is always top-right hex, no matter where the obstale will get placed. // * "width" for usual obstacles it's count of tiles that must be free to the right for obstacle to be placed. For absolute obstacles, it's x offset for the graphics. // * "height" for usual obstacles it's count of tiles that must be free to the top for obstacle to be placed. For absolute obstacles, it's y offset for the graphics. -// * "defname" is name of the graphics. It's def file for usual obstacles and bitmap for the absolute ones. +// * "animation" is name of the graphics. It's def file for usual obstacles and bitmap for the absolute ones. { "0": @@ -18,7 +18,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObDino1.def", + "animation" : "ObDino1.def", "unknown" : 1, "absolute" : false }, @@ -29,7 +29,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [0, 1, 2], - "defname" : "ObDino2.def", + "animation" : "ObDino2.def", "unknown" : 0, "absolute" : false }, @@ -40,7 +40,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [0, 1, -14, -15, -16], - "defname" : "ObDino3.def", + "animation" : "ObDino3.def", "unknown" : 1, "absolute" : false }, @@ -51,7 +51,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObSkel1.def", + "animation" : "ObSkel1.def", "unknown" : 1, "absolute" : false }, @@ -62,7 +62,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObSkel2.def", + "animation" : "ObSkel2.def", "unknown" : 1, "absolute" : false }, @@ -73,7 +73,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [1, 2, 3], - "defname" : "ObBDT01.def", + "animation" : "ObBDT01.def", "unknown" : 1, "absolute" : false }, @@ -84,7 +84,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [-15, -16], - "defname" : "ObDRk01.def", + "animation" : "ObDRk01.def", "unknown" : 1, "absolute" : false }, @@ -95,7 +95,7 @@ "width" : 2, "height" : 2, "blockedTiles" : [0, 1], - "defname" : "ObDRk02.def", + "animation" : "ObDRk02.def", "unknown" : 0, "absolute" : false }, @@ -106,7 +106,7 @@ "width" : 2, "height" : 2, "blockedTiles" : [-16], - "defname" : "ObDRk03.def", + "animation" : "ObDRk03.def", "unknown" : 1, "absolute" : false }, @@ -117,7 +117,7 @@ "width" : 2, "height" : 2, "blockedTiles" : [0, 1], - "defname" : "ObDRk04.def", + "animation" : "ObDRk04.def", "unknown" : 0, "absolute" : false }, @@ -128,7 +128,7 @@ "width" : 2, "height" : 2, "blockedTiles" : [0, 1], - "defname" : "ObDSh01.def", + "animation" : "ObDSh01.def", "unknown" : 0, "absolute" : false }, @@ -139,7 +139,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObDTF03.def", + "animation" : "ObDTF03.def", "unknown" : 0, "absolute" : false }, @@ -150,7 +150,7 @@ "width" : 3, "height" : 3, "blockedTiles" : [0, 1, 2, 3], - "defname" : "ObDtS03.def", + "animation" : "ObDtS03.def", "unknown" : 0, "absolute" : false }, @@ -161,7 +161,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [1, 2, -15], - "defname" : "ObDtS04.def", + "animation" : "ObDtS04.def", "unknown" : 1, "absolute" : false }, @@ -172,7 +172,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [2, -15, -16], - "defname" : "ObDtS14.def", + "animation" : "ObDtS14.def", "unknown" : 1, "absolute" : false }, @@ -183,7 +183,7 @@ "width" : 3, "height" : 3, "blockedTiles" : [1, -16, -33], - "defname" : "ObDtS15.def", + "animation" : "ObDtS15.def", "unknown" : 1, "absolute" : false }, @@ -194,7 +194,7 @@ "width" : 4, "height" : 4, "blockedTiles" : [-15, -16, -32, -33, -48, -49], - "defname" : "ObDsM01.def", + "animation" : "ObDsM01.def", "unknown" : 1, "absolute" : false }, @@ -205,7 +205,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [1, -15, -16], - "defname" : "ObDsS02.def", + "animation" : "ObDsS02.def", "unknown" : 1, "absolute" : false }, @@ -216,7 +216,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [1, 2, 3, -15, -16], - "defname" : "ObDsS17.def", + "animation" : "ObDsS17.def", "unknown" : 1, "absolute" : false }, @@ -227,7 +227,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObGLg01.def", + "animation" : "ObGLg01.def", "unknown" : 1, "absolute" : false }, @@ -238,7 +238,7 @@ "width" : 2, "height" : 2, "blockedTiles" : [0, 1], - "defname" : "ObGRk01.def", + "animation" : "ObGRk01.def", "unknown" : 0, "absolute" : false }, @@ -249,7 +249,7 @@ "width" : 1, "height" : 1, "blockedTiles" : [0], - "defname" : "ObGSt01.def", + "animation" : "ObGSt01.def", "unknown" : 1, "absolute" : false }, @@ -260,7 +260,7 @@ "width" : 6, "height" : 2, "blockedTiles" : [1, 2, 3, 4, -13, -14, -15, -16], - "defname" : "ObGrS01.def", + "animation" : "ObGrS01.def", "unknown" : 1, "absolute" : false }, @@ -271,7 +271,7 @@ "width" : 7, "height" : 1, "blockedTiles" : [1, 2], - "defname" : "OBGrS02.def", + "animation" : "OBGrS02.def", "unknown" : 1, "absolute" : false }, @@ -282,7 +282,7 @@ "width" : 3, "height" : 1, "blockedTiles" : [0, 1, 2], - "defname" : "ObSnS01.def", + "animation" : "ObSnS01.def", "unknown" : 1, "absolute" : false }, @@ -293,7 +293,7 @@ "width" : 5, "height" : 1, "blockedTiles" : [1, 2, 3, 4], - "defname" : "ObSnS02.def", + "animation" : "ObSnS02.def", "unknown" : 1, "absolute" : false }, @@ -304,7 +304,7 @@ "width" : 3, "height" : 3, "blockedTiles" : [0, -16, -33], - "defname" : "ObSnS03.def", + "animation" : "ObSnS03.def", "unknown" : 1, "absolute" : false }, @@ -315,7 +315,7 @@ "width" : 3, "height" : 1, "blockedTiles" : [0, 1, 2], - "defname" : "ObSnS04.def", + "animation" : "ObSnS04.def", "unknown" : 1, "absolute" : false }, @@ -326,7 +326,7 @@ "width" : 3, "height" : 1, "blockedTiles" : [1], - "defname" : "ObSnS05.def", + "animation" : "ObSnS05.def", "unknown" : 1, "absolute" : false }, @@ -337,7 +337,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [1, 2], - "defname" : "ObSnS06.def", + "animation" : "ObSnS06.def", "unknown" : 0, "absolute" : false }, @@ -348,7 +348,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObSnS07.def", + "animation" : "ObSnS07.def", "unknown" : 1, "absolute" : false }, @@ -359,7 +359,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [0, 1, 2], - "defname" : "ObSnS08.def", + "animation" : "ObSnS08.def", "unknown" : 0, "absolute" : false }, @@ -370,7 +370,7 @@ "width" : 7, "height" : 2, "blockedTiles" : [2, 3, 4, 5, -13, -14, -15, -16], - "defname" : "ObSnS09.def", + "animation" : "ObSnS09.def", "unknown" : 1, "absolute" : false }, @@ -381,7 +381,7 @@ "width" : 5, "height" : 5, "blockedTiles" : [3, -13, -14, -15, -33, -49, -66], - "defname" : "ObSnS10.def", + "animation" : "ObSnS10.def", "unknown" : 1, "absolute" : false }, @@ -392,7 +392,7 @@ "width" : 2, "height" : 2, "blockedTiles" : [0], - "defname" : "ObSwS01.def", + "animation" : "ObSwS01.def", "unknown" : 0, "absolute" : false }, @@ -403,7 +403,7 @@ "width" : 8, "height" : 3, "blockedTiles" : [-10, -11, -12, -13, -14, -15, -16], - "defname" : "ObSwS02.def", + "animation" : "ObSwS02.def", "unknown" : 1, "absolute" : false }, @@ -414,7 +414,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObSwS03.def", + "animation" : "ObSwS03.def", "unknown" : 0, "absolute" : false }, @@ -425,7 +425,7 @@ "width" : 3, "height" : 1, "blockedTiles" : [0, 1, 2], - "defname" : "ObSwS04.def", + "animation" : "ObSwS04.def", "unknown" : 0, "absolute" : false }, @@ -436,7 +436,7 @@ "width" : 5, "height" : 4, "blockedTiles" : [-13, -14, -15, -16, -30, -31, -32, -33], - "defname" : "ObSwS11b.def", + "animation" : "ObSwS11b.def", "unknown" : 1, "absolute" : false }, @@ -447,7 +447,7 @@ "width" : 4, "height" : 3, "blockedTiles" : [-16, -17, -31, -32, -33, -34], - "defname" : "ObSwS13a.def", + "animation" : "ObSwS13a.def", "unknown" : 1, "absolute" : false }, @@ -458,7 +458,7 @@ "width" : 2, "height" : 2, "blockedTiles" : [0, 1, -16], - "defname" : "ObRgS01.def", + "animation" : "ObRgS01.def", "unknown" : 1, "absolute" : false }, @@ -469,7 +469,7 @@ "width" : 4, "height" : 3, "blockedTiles" : [-14, -15, -16, -32, -33], - "defname" : "ObRgS02.def", + "animation" : "ObRgS02.def", "unknown" : 1, "absolute" : false }, @@ -480,7 +480,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [1, 2, -15, -16], - "defname" : "ObRgS03.def", + "animation" : "ObRgS03.def", "unknown" : 1, "absolute" : false }, @@ -491,7 +491,7 @@ "width" : 3, "height" : 3, "blockedTiles" : [-16, -32, -33], - "defname" : "ObRgS04.def", + "animation" : "ObRgS04.def", "unknown" : 1, "absolute" : false }, @@ -502,7 +502,7 @@ "width" : 3, "height" : 3, "blockedTiles" : [-15, -16, -32], - "defname" : "ObRgS05.def", + "animation" : "ObRgS05.def", "unknown" : 1, "absolute" : false }, @@ -513,7 +513,7 @@ "width" : 3, "height" : 3, "blockedTiles" : [0, 1, 2, -15, -16], - "defname" : "ObSuS01.def", + "animation" : "ObSuS01.def", "unknown" : 0, "absolute" : false }, @@ -524,7 +524,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [0, 1, 2], - "defname" : "ObSuS02.def", + "animation" : "ObSuS02.def", "unknown" : 0, "absolute" : false }, @@ -535,7 +535,7 @@ "width" : 4, "height" : 3, "blockedTiles" : [0, 1, 2, 3, -14, -15, -16], - "defname" : "ObSuS11b.def", + "animation" : "ObSuS11b.def", "unknown" : 0, "absolute" : false }, @@ -546,7 +546,7 @@ "width" : 4, "height" : 3, "blockedTiles" : [-14, -32, -33], - "defname" : "ObLvS01.def", + "animation" : "ObLvS01.def", "unknown" : 1, "absolute" : false }, @@ -557,7 +557,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [0, 1, 2, -14, -15, -16], - "defname" : "ObLvS02.def", + "animation" : "ObLvS02.def", "unknown" : 1, "absolute" : false }, @@ -568,7 +568,7 @@ "width" : 5, "height" : 3, "blockedTiles" : [-13, -14, -15, -30, -31, -32, -33], - "defname" : "ObLvS03.def", + "animation" : "ObLvS03.def", "unknown" : 1, "absolute" : false }, @@ -579,7 +579,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [0, 1, 2], - "defname" : "ObLvS04.def", + "animation" : "ObLvS04.def", "unknown" : 0, "absolute" : false }, @@ -590,7 +590,7 @@ "width" : 4, "height" : 4, "blockedTiles" : [-14, -15, -32, -33, -49, -50], - "defname" : "ObLvS09.def", + "animation" : "ObLvS09.def", "unknown" : 1, "absolute" : false }, @@ -601,7 +601,7 @@ "width" : 5, "height" : 3, "blockedTiles" : [-13, -14, -15, -16, -30, -31], - "defname" : "ObLvS17.def", + "animation" : "ObLvS17.def", "unknown" : 1, "absolute" : false }, @@ -612,7 +612,7 @@ "width" : 5, "height" : 3, "blockedTiles" : [-13, -14, -15, -16, -31, -32, -33], - "defname" : "ObLvS22.def", + "animation" : "ObLvS22.def", "unknown" : 1, "absolute" : false }, @@ -623,7 +623,7 @@ "width" : 3, "height" : 3, "blockedTiles" : [-15, -16, -33], - "defname" : "ObBtS04.def", + "animation" : "ObBtS04.def", "unknown" : 1, "absolute" : false }, @@ -634,7 +634,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [1, -15, -16], - "defname" : "ObBhS02.def", + "animation" : "ObBhS02.def", "unknown" : 1, "absolute" : false }, @@ -645,7 +645,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [0, 1, 2], - "defname" : "ObBhS03.def", + "animation" : "ObBhS03.def", "unknown" : 0, "absolute" : false }, @@ -656,7 +656,7 @@ "width" : 5, "height" : 2, "blockedTiles" : [1, 2, 3, -14, -15, -16], - "defname" : "ObBhS11a.def", + "animation" : "ObBhS11a.def", "unknown" : 1, "absolute" : false }, @@ -667,7 +667,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [1, 2, -14, -15], - "defname" : "ObBhS12b.def", + "animation" : "ObBhS12b.def", "unknown" : 1, "absolute" : false }, @@ -678,7 +678,7 @@ "width" : 2, "height" : 2, "blockedTiles" : [0, 1, -16], - "defname" : "ObBhS14b.def", + "animation" : "ObBhS14b.def", "unknown" : 1, "absolute" : false }, @@ -689,7 +689,7 @@ "width" : 1, "height" : 1, "blockedTiles" : [0], - "defname" : "ObHGs00.def", + "animation" : "ObHGs00.def", "unknown" : 0, "absolute" : false }, @@ -700,7 +700,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObHGs01.def", + "animation" : "ObHGs01.def", "unknown" : 0, "absolute" : false }, @@ -711,7 +711,7 @@ "width" : 3, "height" : 3, "blockedTiles" : [1], - "defname" : "ObHGs02.def", + "animation" : "ObHGs02.def", "unknown" : 0, "absolute" : false }, @@ -722,7 +722,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [0, 1, 2], - "defname" : "ObHGs03.def", + "animation" : "ObHGs03.def", "unknown" : 0, "absolute" : false }, @@ -733,7 +733,7 @@ "width" : 4, "height" : 3, "blockedTiles" : [0, 1, 2, 3], - "defname" : "ObHGs04.def", + "animation" : "ObHGs04.def", "unknown" : 0, "absolute" : false }, @@ -744,7 +744,7 @@ "width" : 1, "height" : 1, "blockedTiles" : [0], - "defname" : "ObEFs00.def", + "animation" : "ObEFs00.def", "unknown" : 0, "absolute" : false }, @@ -755,7 +755,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObEFs01.def", + "animation" : "ObEFs01.def", "unknown" : 0, "absolute" : false }, @@ -766,7 +766,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [0, 1, 2], - "defname" : "ObEFs02.def", + "animation" : "ObEFs02.def", "unknown" : 0, "absolute" : false }, @@ -777,7 +777,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [1, 2], - "defname" : "ObEFs03.def", + "animation" : "ObEFs03.def", "unknown" : 0, "absolute" : false }, @@ -788,7 +788,7 @@ "width" : 6, "height" : 2, "blockedTiles" : [1, 2, 3, -12, -13], - "defname" : "ObEFs04.def", + "animation" : "ObEFs04.def", "unknown" : 0, "absolute" : false }, @@ -799,7 +799,7 @@ "width" : 1, "height" : 1, "blockedTiles" : [0], - "defname" : "ObCFs00.def", + "animation" : "ObCFs00.def", "unknown" : 1, "absolute" : false }, @@ -810,7 +810,7 @@ "width" : 3, "height" : 1, "blockedTiles" : [0, 1, 2], - "defname" : "ObCFs01.def", + "animation" : "ObCFs01.def", "unknown" : 1, "absolute" : false }, @@ -821,7 +821,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [1, 2, -15, -16], - "defname" : "ObCFs02.def", + "animation" : "ObCFs02.def", "unknown" : 1, "absolute" : false }, @@ -832,7 +832,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [0, 1, 2, -14, -15, -16], - "defname" : "ObCFs03.def", + "animation" : "ObCFs03.def", "unknown" : 1, "absolute" : false }, @@ -843,7 +843,7 @@ "width" : 1, "height" : 1, "blockedTiles" : [0], - "defname" : "ObLPs00.def", + "animation" : "ObLPs00.def", "unknown" : 1, "absolute" : false }, @@ -854,7 +854,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObLPs01.def", + "animation" : "ObLPs01.def", "unknown" : 1, "absolute" : false }, @@ -865,7 +865,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [0, -15, -16], - "defname" : "ObLPs02.def", + "animation" : "ObLPs02.def", "unknown" : 1, "absolute" : false }, @@ -876,7 +876,7 @@ "width" : 5, "height" : 2, "blockedTiles" : [1, 2, 3, -13, -14, -15, -16], - "defname" : "ObLPs03.def", + "animation" : "ObLPs03.def", "unknown" : 1, "absolute" : false }, @@ -887,7 +887,7 @@ "width" : 1, "height" : 1, "blockedTiles" : [0], - "defname" : "ObFFs00.def", + "animation" : "ObFFs00.def", "unknown" : 0, "absolute" : false }, @@ -898,7 +898,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObFFs01.def", + "animation" : "ObFFs01.def", "unknown" : 0, "absolute" : false }, @@ -909,7 +909,7 @@ "width" : 3, "height" : 2, "blockedTiles" : [0, 1, 2, -15], - "defname" : "ObFFs02.def", + "animation" : "ObFFs02.def", "unknown" : 0, "absolute" : false }, @@ -920,7 +920,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [1, 2, 3, -15, -16], - "defname" : "ObFFs03.def", + "animation" : "ObFFs03.def", "unknown" : 0, "absolute" : false }, @@ -931,7 +931,7 @@ "width" : 3, "height" : 3, "blockedTiles" : [0, 1, 2, 3, -14, -15, -16], - "defname" : "ObFFs04.def", + "animation" : "ObFFs04.def", "unknown" : 0, "absolute" : false }, @@ -942,7 +942,7 @@ "width" : 1, "height" : 1, "blockedTiles" : [0], - "defname" : "ObRLs00.def", + "animation" : "ObRLs00.def", "unknown" : 0, "absolute" : false }, @@ -953,7 +953,7 @@ "width" : 2, "height" : 1, "blockedTiles" : [0, 1], - "defname" : "ObRLs01.def", + "animation" : "ObRLs01.def", "unknown" : 0, "absolute" : false }, @@ -964,7 +964,7 @@ "width" : 3, "height" : 1, "blockedTiles" : [0, 1, 2], - "defname" : "ObRLs02.def", + "animation" : "ObRLs02.def", "unknown" : 0, "absolute" : false }, @@ -975,7 +975,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [1, 2, 3, -15, -16], - "defname" : "ObRLs03.def", + "animation" : "ObRLs03.def", "unknown" : 0, "absolute" : false }, @@ -986,7 +986,7 @@ "width" : 1, "height" : 1, "blockedTiles" : [0], - "defname" : "ObMCs00.def", + "animation" : "ObMCs00.def", "unknown" : 1, "absolute" : false }, @@ -997,7 +997,7 @@ "width" : 2, "height" : 2, "blockedTiles" : [1, -16], - "defname" : "ObMCs01.def", + "animation" : "ObMCs01.def", "unknown" : 1, "absolute" : false }, @@ -1008,7 +1008,7 @@ "width" : 4, "height" : 2, "blockedTiles" : [0, 1, -14, -15], - "defname" : "ObMCs02.def", + "animation" : "ObMCs02.def", "unknown" : 1, "absolute" : false }, @@ -1020,7 +1020,7 @@ "width" : 124, "height" : 254, "blockedTiles" : [80, 94, 95, 96, 97, 105, 106, 107, 108, 109, 110], - "defname" : "ObDtL04.pcx", + "animation" : "ObDtL04.pcx", "absolute" : true }, "101": @@ -1030,7 +1030,7 @@ "width" : 256, "height" : 254, "blockedTiles" : [73, 91, 108, 109, 110, 111, 112, 113], - "defname" : "ObDtL06.pcx", + "animation" : "ObDtL06.pcx", "absolute" : true }, "102": @@ -1040,7 +1040,7 @@ "width" : 168, "height" : 212, "blockedTiles" : [60, 61, 62, 63, 64, 72, 73, 74, 75, 76, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149], - "defname" : "ObDtL10.pcx", + "animation" : "ObDtL10.pcx", "absolute" : true }, "103": @@ -1050,7 +1050,7 @@ "width" : 124, "height" : 254, "blockedTiles" : [88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98], - "defname" : "ObDtL02.pcx", + "animation" : "ObDtL02.pcx", "absolute" : true }, "104": @@ -1060,7 +1060,7 @@ "width" : 146, "height" : 254, "blockedTiles" : [76, 77, 78, 79, 80, 89, 90, 91, 92, 93], - "defname" : "ObDtL03.pcx", + "animation" : "ObDtL03.pcx", "absolute" : true }, "105": @@ -1070,7 +1070,7 @@ "width" : 173, "height" : 221, "blockedTiles" : [55, 56, 57, 58, 75, 76, 77, 95, 112, 113, 131], - "defname" : "ObGrL01.pcx", + "animation" : "ObGrL01.pcx", "absolute" : true }, "106": @@ -1080,7 +1080,7 @@ "width" : 180, "height" : 264, "blockedTiles" : [81, 91, 92, 93, 94, 95, 96, 97, 98, 106, 107, 123], - "defname" : "ObGrL02.pcx", + "animation" : "ObGrL02.pcx", "absolute" : true }, "107": @@ -1090,7 +1090,7 @@ "width" : 166, "height" : 255, "blockedTiles" : [76, 77, 78, 79, 91, 92, 93, 97, 98, 106, 107, 108], - "defname" : "ObSnL01.pcx", + "animation" : "ObSnL01.pcx", "absolute" : true }, "108": @@ -1100,7 +1100,7 @@ "width" : 302, "height" : 172, "blockedTiles" : [41, 42, 43, 58, 75, 92, 108, 126, 143], - "defname" : "ObSnL14.pcx", + "animation" : "ObSnL14.pcx", "absolute" : true }, "109": @@ -1110,7 +1110,7 @@ "width" : 300, "height" : 170, "blockedTiles" : [40, 41, 58, 59, 74, 75, 92, 93, 109, 110, 111, 127, 128, 129, 130], - "defname" : "ObSwL15.pcx", + "animation" : "ObSwL15.pcx", "absolute" : true }, "110": @@ -1120,7 +1120,7 @@ "width" : 278, "height" : 171, "blockedTiles" : [43, 60, 61, 77, 93, 94, 95, 109, 110, 126, 127], - "defname" : "ObSwL14.pcx", + "animation" : "ObSwL14.pcx", "absolute" : true }, "111": @@ -1130,7 +1130,7 @@ "width" : 256, "height" : 254, "blockedTiles" : [74, 75, 76, 77, 91, 92, 93, 94, 95, 109, 110, 111, 112], - "defname" : "ObSwL22.pcx", + "animation" : "ObSwL22.pcx", "absolute" : true }, "112": @@ -1140,7 +1140,7 @@ "width" : 124, "height" : 254, "blockedTiles" : [77, 78, 79, 80, 81, 91, 92, 93, 94, 105, 106, 107], - "defname" : "ObLvL01.pcx", + "animation" : "ObLvL01.pcx", "absolute" : true }, "113": @@ -1150,7 +1150,7 @@ "width" : 256, "height" : 128, "blockedTiles" : [43, 60, 61, 76, 77, 93, 109, 126, 127, 142, 143], - "defname" : "OBLvL02.pcx", + "animation" : "OBLvL02.pcx", "absolute" : true }, "114": @@ -1160,7 +1160,7 @@ "width" : 186, "height" : 212, "blockedTiles" : [55, 72, 90, 107, 125, 126, 127, 128, 129, 130, 131, 132], - "defname" : "ObRgL01.pcx", + "animation" : "ObRgL01.pcx", "absolute" : true }, "115": @@ -1170,7 +1170,7 @@ "width" : 347, "height" : 174, "blockedTiles" : [41, 59, 76, 94, 111, 129, 143, 144, 145], - "defname" : "ObRgL02.pcx", + "animation" : "ObRgL02.pcx", "absolute" : true }, "116": @@ -1180,7 +1180,7 @@ "width" : 294, "height" : 169, "blockedTiles" : [40, 41, 42, 43, 58, 75, 93, 110, 128, 145], - "defname" : "ObRgL03.pcx", + "animation" : "ObRgL03.pcx", "absolute" : true }, "117": @@ -1190,7 +1190,7 @@ "width" : 165, "height" : 257, "blockedTiles" : [72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 89, 105], - "defname" : "ObRgL04.pcx", + "animation" : "ObRgL04.pcx", "absolute" : true }, "118": @@ -1200,7 +1200,7 @@ "width" : 208, "height" : 268, "blockedTiles" : [72, 73, 74, 75, 76, 77, 78, 79, 80, 90, 91, 92, 93, 94, 95, 96, 97], - "defname" : "ObRgL05.pcx", + "animation" : "ObRgL05.pcx", "absolute" : true }, "119": @@ -1210,7 +1210,7 @@ "width" : 252, "height" : 254, "blockedTiles" : [73, 74, 75, 76, 77, 78, 91, 92, 93, 94], - "defname" : "ObRgL06.pcx", + "animation" : "ObRgL06.pcx", "absolute" : true }, "120": @@ -1220,7 +1220,7 @@ "width" : 278, "height" : 128, "blockedTiles" : [23, 40, 58, 75, 93, 110, 128, 145, 163], - "defname" : "ObRgL15.pcx", + "animation" : "ObRgL15.pcx", "absolute" : true }, "121": @@ -1230,7 +1230,7 @@ "width" : 208, "height" : 268, "blockedTiles" : [72, 73, 74, 75, 76, 77, 78, 79, 80, 90, 91, 92, 93, 94, 95, 96, 97], - "defname" : "ObRgL05.pcx", + "animation" : "ObRgL05.pcx", "absolute" : true }, "122": @@ -1240,7 +1240,7 @@ "width" : 168, "height" : 212, "blockedTiles" : [73, 74, 75, 76, 77, 78, 79, 90, 91, 92, 93, 94, 95, 96, 97, 106, 107, 108, 109, 110, 111, 112], - "defname" : "ObRgL22.pcx", + "animation" : "ObRgL22.pcx", "absolute" : true }, "123": @@ -1250,7 +1250,7 @@ "width" : 147, "height" : 264, "blockedTiles" : [72, 73, 74, 75, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98], - "defname" : "ObBhL02.pcx", + "animation" : "ObBhL02.pcx", "absolute" : true }, "124": @@ -1260,7 +1260,7 @@ "width" : 178, "height" : 262, "blockedTiles" : [71, 72, 73, 74, 75, 76, 77, 78, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98], - "defname" : "ObBhL03.pcx", + "animation" : "ObBhL03.pcx", "absolute" : true }, "125": @@ -1270,7 +1270,7 @@ "width" : 173, "height" : 257, "blockedTiles" : [72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 89, 90, 105, 106], - "defname" : "ObBhL05.pcx", + "animation" : "ObBhL05.pcx", "absolute" : true }, "126": @@ -1280,7 +1280,7 @@ "width" : 241, "height" : 272, "blockedTiles" : [73, 91, 108, 109, 110, 111, 112, 113], - "defname" : "ObBhL06.pcx", + "animation" : "ObBhL06.pcx", "absolute" : true }, "127": @@ -1290,7 +1290,7 @@ "width" : 261, "height" : 129, "blockedTiles" : [27, 28, 43, 44, 60, 61, 76, 77, 93, 94, 109, 110, 126, 127, 142, 143, 159], - "defname" : "ObBhL14.pcx", + "animation" : "ObBhL14.pcx", "absolute" : true }, "128": @@ -1300,7 +1300,7 @@ "width" : 180, "height" : 154, "blockedTiles" : [22, 38, 39, 40, 44, 45, 46, 55, 56, 57, 62, 63, 123, 124, 125, 130, 131, 140, 141, 146, 147, 148], - "defname" : "ObBhL16.pcx", + "animation" : "ObBhL16.pcx", "absolute" : true }, "129": @@ -1310,7 +1310,7 @@ "width" : 304, "height" : 264, "blockedTiles" : [76, 77, 92, 93, 94, 95, 109, 110, 111], - "defname" : "ObCFL00.pcx", + "animation" : "ObCFL00.pcx", "absolute" : true }, "130": @@ -1320,7 +1320,7 @@ "width" : 256, "height" : 257, "blockedTiles" : [76, 77, 78, 92, 93, 94, 107, 108, 109], - "defname" : "ObLPL00.pcx", + "animation" : "ObLPL00.pcx", "absolute" : true }, "131": @@ -1330,7 +1330,7 @@ "width" : 257, "height" : 255, "blockedTiles" : [76, 77, 91, 92, 93, 94, 95, 108, 109, 110, 111], - "defname" : "ObFFL00.pcx", + "animation" : "ObFFL00.pcx", "absolute" : true }, "132": @@ -1340,7 +1340,7 @@ "width" : 277, "height" : 218, "blockedTiles" : [60, 61, 75, 76, 77, 91, 92, 93, 94, 95], - "defname" : "ObRLL00.pcx", + "animation" : "ObRLL00.pcx", "absolute" : true }, "133": @@ -1350,7 +1350,7 @@ "width" : 300, "height" : 214, "blockedTiles" : [59, 60, 74, 75, 76, 93, 94, 95, 111, 112], - "defname" : "ObMCL00.pcx", + "animation" : "ObMCL00.pcx", "absolute" : true } } diff --git a/config/schemas/obstacle.json b/config/schemas/obstacle.json index f6a76f40b..5f383f27e 100644 --- a/config/schemas/obstacle.json +++ b/config/schemas/obstacle.json @@ -3,7 +3,7 @@ "$schema": "http://json-schema.org/draft-04/schema", "title" : "VCMI obstacle format", "description" : "Format used to define new obstacles in VCMI", - "required" : [ "defname" ], + "required" : [ "animation" ], "additionalProperties" : false, "properties":{ @@ -30,7 +30,7 @@ "description": "Blocked hexes - absolute or relative hex id", "items": { "type" : "number" } }, - "defname": { + "animation": { "type": "string", "description": "Image resource" }, diff --git a/lib/ObstacleHandler.cpp b/lib/ObstacleHandler.cpp index 58052d730..14535055e 100644 --- a/lib/ObstacleHandler.cpp +++ b/lib/ObstacleHandler.cpp @@ -80,9 +80,9 @@ ObstacleInfo * ObstacleHandler::loadFromJson(const std::string & scope, const Js { auto * info = new ObstacleInfo(Obstacle(index), identifier); - info->defName = json["defname"].String(); - info->width = static_cast(json["width"].Float()); - info->height = static_cast(json["height"].Float()); + info->animation = json["animation"].String(); + info->width = json["width"].Integer(); + info->height = json["height"].Integer(); for(auto & t : json["allowedTerrain"].Vector()) info->allowedTerrains.emplace_back(t.String()); for(auto & t : json["specialBattlefields"].Vector()) diff --git a/lib/ObstacleHandler.h b/lib/ObstacleHandler.h index 8752c8bd0..4c7105b10 100644 --- a/lib/ObstacleHandler.h +++ b/lib/ObstacleHandler.h @@ -16,8 +16,9 @@ #include "Terrain.h" #include "battle/BattleHex.h" -struct DLL_LINKAGE ObstacleInfo : public EntityT +class DLL_LINKAGE ObstacleInfo : public EntityT { +public: ObstacleInfo(): obstacle(-1), width(0), height(0), isAbsoluteObstacle(false), iconIndex(0) {} @@ -29,10 +30,13 @@ struct DLL_LINKAGE ObstacleInfo : public EntityT Obstacle obstacle; si32 iconIndex; std::string identifier; - std::string defName; + std::string appearAnimation, animation, dissapearAnimation; std::vector allowedTerrains; std::vector allowedSpecialBfields; + //TODO: here is extra field to implement it's logic in the future but save backward compatibility + int obstacleType = -1; + ui8 isAbsoluteObstacle; //there may only one such obstacle in battle and its position is always the same si32 width, height; //how much space to the right and up is needed to place obstacle (affects only placement algorithm) std::vector blockedTiles; //offsets relative to obstacle position (that is its left bottom corner) @@ -51,9 +55,12 @@ struct DLL_LINKAGE ObstacleInfo : public EntityT template void serialize(Handler &h, const int version) { h & obstacle; + h & obstacleType; h & iconIndex; h & identifier; - h & defName; + h & animation; + h & appearAnimation; + h & dissapearAnimation; h & allowedTerrains; h & allowedSpecialBfields; h & isAbsoluteObstacle; diff --git a/lib/serializer/CSerializer.h b/lib/serializer/CSerializer.h index e07e48d04..76b73331b 100644 --- a/lib/serializer/CSerializer.h +++ b/lib/serializer/CSerializer.h @@ -12,8 +12,8 @@ #include "../ConstTransitivePtr.h" #include "../GameConstants.h" -const ui32 SERIALIZATION_VERSION = 803; -const ui32 MINIMAL_SERIALIZATION_VERSION = 803; +const ui32 SERIALIZATION_VERSION = 804; +const ui32 MINIMAL_SERIALIZATION_VERSION = 804; const std::string SAVEGAME_MAGIC = "VCMISVG"; class CHero;