mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Hero scheme: allow each hero to have a unique battle animation (#480)
* attribute for battle image added on hero class, allowing on hero schemes each hero have a unique battle .def in 'images' structures sided with portraits and specialties images
This commit is contained in:
parent
26fe5607ac
commit
47ba3b2476
@ -256,10 +256,17 @@ CBattleInterface::CBattleInterface(const CCreatureSet *army1, const CCreatureSet
|
||||
if(hero1) // attacking hero
|
||||
{
|
||||
std::string battleImage;
|
||||
if(hero1->sex)
|
||||
battleImage = hero1->type->heroClass->imageBattleFemale;
|
||||
if(!hero1->type->battleImage.empty())
|
||||
{
|
||||
battleImage = hero1->type->battleImage;
|
||||
}
|
||||
else
|
||||
battleImage = hero1->type->heroClass->imageBattleMale;
|
||||
{
|
||||
if(hero1->sex)
|
||||
battleImage = hero1->type->heroClass->imageBattleFemale;
|
||||
else
|
||||
battleImage = hero1->type->heroClass->imageBattleMale;
|
||||
}
|
||||
|
||||
attackingHero = std::make_shared<CBattleHero>(battleImage, false, hero1->tempOwner, hero1->tempOwner == curInt->playerID ? hero1 : nullptr, this);
|
||||
|
||||
@ -272,10 +279,18 @@ CBattleInterface::CBattleInterface(const CCreatureSet *army1, const CCreatureSet
|
||||
if(hero2) // defending hero
|
||||
{
|
||||
std::string battleImage;
|
||||
if(hero2->sex)
|
||||
battleImage = hero2->type->heroClass->imageBattleFemale;
|
||||
|
||||
if(!hero2->type->battleImage.empty())
|
||||
{
|
||||
battleImage = hero2->type->battleImage;
|
||||
}
|
||||
else
|
||||
battleImage = hero2->type->heroClass->imageBattleMale;
|
||||
{
|
||||
if(hero2->sex)
|
||||
battleImage = hero2->type->heroClass->imageBattleFemale;
|
||||
else
|
||||
battleImage = hero2->type->heroClass->imageBattleMale;
|
||||
}
|
||||
|
||||
defendingHero = std::make_shared<CBattleHero>(battleImage, true, hero2->tempOwner, hero2->tempOwner == curInt->playerID ? hero2 : nullptr, this);
|
||||
|
||||
|
@ -84,6 +84,11 @@
|
||||
"type":"string",
|
||||
"description": "Small image of hero specialty for use in exchange screen",
|
||||
"format" : "imageFile"
|
||||
},
|
||||
"battleImage": {
|
||||
"type":"string",
|
||||
"description": "Custom def used on battle",
|
||||
"format" : "defFile"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -322,6 +322,7 @@ CHero * CHeroHandler::loadFromJson(const JsonNode & node, const std::string & id
|
||||
hero->iconSpecLarge = node["images"]["specialtyLarge"].String();
|
||||
hero->portraitSmall = node["images"]["small"].String();
|
||||
hero->portraitLarge = node["images"]["large"].String();
|
||||
hero->battleImage = node["images"]["battleImage"].String();
|
||||
|
||||
loadHeroArmy(hero, node);
|
||||
loadHeroSkills(hero, node);
|
||||
|
@ -91,6 +91,7 @@ public:
|
||||
std::string iconSpecLarge;
|
||||
std::string portraitSmall;
|
||||
std::string portraitLarge;
|
||||
std::string battleImage;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -125,6 +126,10 @@ public:
|
||||
{
|
||||
h & identifier;
|
||||
}
|
||||
if(version >= 790)
|
||||
{
|
||||
h & battleImage;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../ConstTransitivePtr.h"
|
||||
#include "../GameConstants.h"
|
||||
|
||||
const ui32 SERIALIZATION_VERSION = 789;
|
||||
const ui32 SERIALIZATION_VERSION = 790;
|
||||
const ui32 MINIMAL_SERIALIZATION_VERSION = 753;
|
||||
const std::string SAVEGAME_MAGIC = "VCMISVG";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user