1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-28 23:06:24 +02:00

Use dummy animations

This commit is contained in:
AlexVinS 2015-03-22 16:47:20 +03:00
parent 98ea8bf314
commit 075b65b31b
3 changed files with 53 additions and 33 deletions

View File

@ -1244,11 +1244,6 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc )
const std::string & castSoundPath = spell.getCastSound();
std::string casterName("Something");
if(sc->castedByHero)
casterName = curInt->cb->battleGetHeroInfo(sc->side).name;
if(!castSoundPath.empty())
CCS->soundh->playSound(castSoundPath);
@ -1261,7 +1256,6 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc )
const CStack * casterStack = curInt->cb->battleGetStackByID(casterStackID);
if(casterStack != nullptr)
{
casterName = casterStack->type->namePl;
srccoord = CClickableHex::getXYUnitAnim(casterStack->position, casterStack, this);
srccoord.x += 250;
srccoord.y += 240;
@ -1269,10 +1263,8 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc )
}
}
//TODO: play custom cast animation
{
}
//todo: play custom cast animation
displaySpellCast(spellID, BattleHex::INVALID, false);
//playing projectile animation
if(sc->tile.isValid())
@ -1319,18 +1311,6 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc )
displaySpellEffect(spellID, position);
}
switch(sc->id)
{
case SpellID::SUMMON_FIRE_ELEMENTAL:
case SpellID::SUMMON_EARTH_ELEMENTAL:
case SpellID::SUMMON_WATER_ELEMENTAL:
case SpellID::SUMMON_AIR_ELEMENTAL:
case SpellID::CLONE:
case SpellID::REMOVE_OBSTACLE:
addNewAnim(new CDummyAnimation(this, 2)); //interface won't return until animation is played. TODO: make it smarter?
break;
} //switch(sc->id)
//displaying message in console
std::vector<std::string> logLines;
@ -1436,6 +1416,31 @@ void CBattleInterface::displayEffect(ui32 effect, int destTile, bool areaEffect)
addNewAnim(new CSpellEffectAnimation(this, effect, destTile, 0, 0, false));
}
void CBattleInterface::displaySpellAnimation(const CSpell::TAnimation & animation, BattleHex destinationTile, bool areaEffect)
{
if(animation.pause > 0)
{
addNewAnim(new CDummyAnimation(this, animation.pause));
}
else
{
addNewAnim(new CSpellEffectAnimation(this, animation.resourceName, destinationTile, false, animation.verticalPosition == VerticalPosition::BOTTOM));
}
}
void CBattleInterface::displaySpellCast(SpellID spellID, BattleHex destinationTile, bool areaEffect)
{
const CSpell * spell = spellID.toSpell();
if(spell == nullptr)
return;
for(const CSpell::TAnimation & animation : spell->animationInfo.cast)
{
displaySpellAnimation(animation, destinationTile, areaEffect);
}
}
void CBattleInterface::displaySpellEffect(SpellID spellID, BattleHex destinationTile, bool areaEffect)
{
const CSpell * spell = spellID.toSpell();
@ -1445,7 +1450,7 @@ void CBattleInterface::displaySpellEffect(SpellID spellID, BattleHex destination
for(const CSpell::TAnimation & animation : spell->animationInfo.affect)
{
addNewAnim(new CSpellEffectAnimation(this, animation.resourceName, destinationTile, false, animation.verticalPosition == VerticalPosition::BOTTOM));
displaySpellAnimation(animation, destinationTile, areaEffect);
}
}
@ -1458,11 +1463,10 @@ void CBattleInterface::displaySpellHit(SpellID spellID, BattleHex destinationTil
for(const CSpell::TAnimation & animation : spell->animationInfo.hit)
{
addNewAnim(new CSpellEffectAnimation(this, animation.resourceName, destinationTile, false, animation.verticalPosition == VerticalPosition::BOTTOM));
displaySpellAnimation(animation, destinationTile, areaEffect);
}
}
void CBattleInterface::battleTriggerEffect(const BattleTriggerEffect & bte)
{
const CStack * stack = curInt->cb->battleGetStackByID(bte.stackID);

View File

@ -1,12 +1,12 @@
#pragma once
//#include "../../lib/CCreatureSet.h"
#include "../../lib/ConstTransitivePtr.h" //may be reundant
#include "../../lib/GameConstants.h"
#include "CBattleAnimations.h"
#include "../../lib/spells/CSpellHandler.h" //CSpell::TAnimation
/*
* CBattleInterface.h, part of VCMI engine
*
@ -319,8 +319,12 @@ public:
void battleStacksEffectsSet(const SetStackEffect & sse); //called when a specific effect is set to stacks
void castThisSpell(SpellID spellID); //called when player has chosen a spell from spellbook
void displayEffect(ui32 effect, int destTile, bool areaEffect = true); //displays custom effect on the battlefield
void displaySpellCast(SpellID spellID, BattleHex destinationTile, bool areaEffect = true); //displays spell`s cast animation
void displaySpellEffect(SpellID spellID, BattleHex destinationTile, bool areaEffect = true); //displays spell`s affected animation
void displaySpellHit(SpellID spellID, BattleHex destinationTile, bool areaEffect = true); //displays spell`s affected animation
void displaySpellAnimation(const CSpell::TAnimation & animation, BattleHex destinationTile, bool areaEffect = true);
void battleTriggerEffect(const BattleTriggerEffect & bte);
void setBattleCursor(const int myNumber); //really complex and messy, sets attackingHex

View File

@ -242,7 +242,9 @@
"removeObstacle" : {
"index" : 64,
"targetType" : "OBSTACLE",
"animation":{
"cast":[2]
},
"sounds": {
"cast": "REMOVEOB"
},
@ -258,7 +260,9 @@
"clone" : {
"index" : 65,
"targetType" : "CREATURE",
"animation":{
"cast":[2]
},
"sounds": {
"cast": "CLONE"
},
@ -278,7 +282,9 @@
"fireElemental" : {
"index" : 66,
"targetType" : "NO_TARGET",
"animation":{
"cast":[2]
},
"sounds": {
"cast": "SUMNELM"
},
@ -294,7 +300,9 @@
"earthElemental" : {
"index" : 67,
"targetType" : "NO_TARGET",
"animation":{
"cast":[2]
},
"sounds": {
"cast": "SUMNELM"
},
@ -310,7 +318,9 @@
"waterElemental" : {
"index" : 68,
"targetType" : "NO_TARGET",
"animation":{
"cast":[2]
},
"sounds": {
"cast": "SUMNELM"
},
@ -326,7 +336,9 @@
"airElemental" : {
"index" : 69,
"targetType" : "NO_TARGET",
"animation":{
"cast":[2]
},
"sounds": {
"cast": "SUMNELM"
},