1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-05 13:04:54 +02:00
This commit is contained in:
AlexVinS 2017-09-06 15:50:59 +03:00
parent 3bbff27127
commit c30d9f2fd6

View File

@ -154,7 +154,13 @@ CCreatureAnimation::CCreatureAnimation(const std::string & name_, TSpeedControll
//todo: optimize //todo: optimize
forward->preload(); forward->preload();
reverse->preload(); reverse->preload();
reverse->verticalFlip();
// if necessary, add one frame into vcmi-only group DEAD
if(forward->size(CCreatureAnim::DEAD) == 0)
{
forward->duplicateImage(CCreatureAnim::DEATH, forward->size(CCreatureAnim::DEATH)-1, CCreatureAnim::DEAD);
reverse->duplicateImage(CCreatureAnim::DEATH, reverse->size(CCreatureAnim::DEATH)-1, CCreatureAnim::DEAD);
}
//TODO: get dimensions form CAnimation //TODO: get dimensions form CAnimation
IImage * first = forward->getImage(0, type, true); IImage * first = forward->getImage(0, type, true);
@ -168,12 +174,7 @@ CCreatureAnimation::CCreatureAnimation(const std::string & name_, TSpeedControll
fullWidth = first->width(); fullWidth = first->width();
fullHeight = first->height(); fullHeight = first->height();
// if necessary, add one frame into vcmi-only group DEAD reverse->verticalFlip();
if(forward->size(CCreatureAnim::DEAD) == 0)
{
forward->duplicateImage(CCreatureAnim::DEATH, forward->size(CCreatureAnim::DEATH)-1, CCreatureAnim::DEAD);
reverse->duplicateImage(CCreatureAnim::DEATH, reverse->size(CCreatureAnim::DEATH)-1, CCreatureAnim::DEAD);
}
play(); play();
} }
@ -327,8 +328,8 @@ void CCreatureAnimation::pause()
void CCreatureAnimation::play() void CCreatureAnimation::play()
{ {
logAnim->trace("Play %s group %d at %d:%d", name, static_cast<int>(getType()), pos.x, pos.y); //logAnim->trace("Play %s group %d at %d:%d", name, static_cast<int>(getType()), pos.x, pos.y);
speed = 0; speed = 0;
if (speedController(this, type) != 0) if(speedController(this, type) != 0)
speed = 1 / speedController(this, type); speed = 1 / speedController(this, type);
} }