mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Fixed embarking & disembarking timings
This commit is contained in:
parent
b5ad3a0559
commit
57d906a01c
@ -455,8 +455,11 @@ void ApplyFirstClientNetPackVisitor::visitTryMoveHero(TryMoveHero & pack)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!CGI->mh)
|
if(CGI->mh && pack.result == TryMoveHero::EMBARK)
|
||||||
return;
|
{
|
||||||
|
CGI->mh->onObjectFadeOut(h);
|
||||||
|
CGI->mh->waitForOngoingAnimations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyClientNetPackVisitor::visitTryMoveHero(TryMoveHero & pack)
|
void ApplyClientNetPackVisitor::visitTryMoveHero(TryMoveHero & pack)
|
||||||
@ -480,7 +483,8 @@ void ApplyClientNetPackVisitor::visitTryMoveHero(TryMoveHero & pack)
|
|||||||
CGI->mh->onHeroRotated(h, pack.start, pack.end);
|
CGI->mh->onHeroRotated(h, pack.start, pack.end);
|
||||||
break;
|
break;
|
||||||
case TryMoveHero::EMBARK:
|
case TryMoveHero::EMBARK:
|
||||||
CGI->mh->onObjectFadeOut(h);
|
// handled in ApplyFirst
|
||||||
|
//CGI->mh->onObjectFadeOut(h);
|
||||||
break;
|
break;
|
||||||
case TryMoveHero::DISEMBARK:
|
case TryMoveHero::DISEMBARK:
|
||||||
CGI->mh->onObjectFadeIn(h);
|
CGI->mh->onObjectFadeIn(h);
|
||||||
|
@ -462,9 +462,15 @@ MapViewController::MapViewController(std::shared_ptr<MapRendererContext> context
|
|||||||
|
|
||||||
void MapViewController::update(uint32_t timeDelta)
|
void MapViewController::update(uint32_t timeDelta)
|
||||||
{
|
{
|
||||||
static const double fadeOutDuration = 1.0;
|
// confirmed to match H3 for
|
||||||
static const double fadeInDuration = 1.0;
|
// - hero embarking on boat (500 ms)
|
||||||
static const double heroTeleportDuration = 1.0;
|
// - hero disembarking from boat (500 ms)
|
||||||
|
// - TODO: picking up resources
|
||||||
|
// - TODO: killing mosters
|
||||||
|
// - teleporting ( 250 ms)
|
||||||
|
static const double fadeOutDuration = 500;
|
||||||
|
static const double fadeInDuration = 500;
|
||||||
|
static const double heroTeleportDuration = 250;
|
||||||
|
|
||||||
//FIXME: remove code duplication?
|
//FIXME: remove code duplication?
|
||||||
|
|
||||||
@ -494,14 +500,14 @@ void MapViewController::update(uint32_t timeDelta)
|
|||||||
|
|
||||||
if (context->teleportAnimation)
|
if (context->teleportAnimation)
|
||||||
{
|
{
|
||||||
context->teleportAnimation->progress += heroTeleportDuration * timeDelta / 1000;
|
context->teleportAnimation->progress += timeDelta / heroTeleportDuration;
|
||||||
if (context->teleportAnimation->progress >= 1.0)
|
if (context->teleportAnimation->progress >= 1.0)
|
||||||
context->teleportAnimation.reset();
|
context->teleportAnimation.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->fadeOutAnimation)
|
if (context->fadeOutAnimation)
|
||||||
{
|
{
|
||||||
context->fadeOutAnimation->progress += fadeOutDuration * timeDelta / 1000;
|
context->fadeOutAnimation->progress += timeDelta / fadeOutDuration;
|
||||||
if (context->fadeOutAnimation->progress >= 1.0)
|
if (context->fadeOutAnimation->progress >= 1.0)
|
||||||
{
|
{
|
||||||
context->removeObject(context->getObject(context->fadeOutAnimation->target));
|
context->removeObject(context->getObject(context->fadeOutAnimation->target));
|
||||||
@ -511,7 +517,7 @@ void MapViewController::update(uint32_t timeDelta)
|
|||||||
|
|
||||||
if (context->fadeInAnimation)
|
if (context->fadeInAnimation)
|
||||||
{
|
{
|
||||||
context->fadeInAnimation->progress += fadeInDuration * timeDelta / 1000;
|
context->fadeInAnimation->progress += timeDelta / fadeInDuration;
|
||||||
if (context->fadeInAnimation->progress >= 1.0)
|
if (context->fadeInAnimation->progress >= 1.0)
|
||||||
context->fadeInAnimation.reset();
|
context->fadeInAnimation.reset();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user