mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Make object fade-out / fade-in instant on instant movement speed
This commit is contained in:
parent
45215f12f3
commit
e9fb0c9b8c
@ -247,6 +247,20 @@ void MapViewController::afterRender()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MapViewController::isEventInstant(const CGObjectInstance * obj)
|
||||||
|
{
|
||||||
|
if (!isEventVisible(obj))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(!LOCPLINT->makingTurn && settings["adventure"]["enemyMoveTime"].Float() <= 0)
|
||||||
|
return true; // instant movement speed
|
||||||
|
|
||||||
|
if(LOCPLINT->makingTurn && settings["adventure"]["heroMoveTime"].Float() <= 0)
|
||||||
|
return true; // instant movement speed
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool MapViewController::isEventVisible(const CGObjectInstance * obj)
|
bool MapViewController::isEventVisible(const CGObjectInstance * obj)
|
||||||
{
|
{
|
||||||
if(adventureContext == nullptr)
|
if(adventureContext == nullptr)
|
||||||
@ -358,7 +372,8 @@ void MapViewController::onBeforeHeroEmbark(const CGHeroInstance * obj, const int
|
|||||||
{
|
{
|
||||||
if(isEventVisible(obj, from, dest))
|
if(isEventVisible(obj, from, dest))
|
||||||
{
|
{
|
||||||
fadeOutObject(obj);
|
if (!isEventInstant(obj))
|
||||||
|
fadeOutObject(obj);
|
||||||
setViewCenter(obj->getSightCenter());
|
setViewCenter(obj->getSightCenter());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -381,7 +396,8 @@ void MapViewController::onAfterHeroDisembark(const CGHeroInstance * obj, const i
|
|||||||
{
|
{
|
||||||
if(isEventVisible(obj, from, dest))
|
if(isEventVisible(obj, from, dest))
|
||||||
{
|
{
|
||||||
fadeInObject(obj);
|
if (!isEventInstant(obj))
|
||||||
|
fadeInObject(obj);
|
||||||
setViewCenter(obj->getSightCenter());
|
setViewCenter(obj->getSightCenter());
|
||||||
}
|
}
|
||||||
addObject(obj);
|
addObject(obj);
|
||||||
@ -391,7 +407,7 @@ void MapViewController::onObjectFadeIn(const CGObjectInstance * obj)
|
|||||||
{
|
{
|
||||||
assert(!hasOngoingAnimations());
|
assert(!hasOngoingAnimations());
|
||||||
|
|
||||||
if(isEventVisible(obj))
|
if(isEventVisible(obj) && !isEventInstant(obj) )
|
||||||
fadeInObject(obj);
|
fadeInObject(obj);
|
||||||
|
|
||||||
addObject(obj);
|
addObject(obj);
|
||||||
@ -401,7 +417,7 @@ void MapViewController::onObjectFadeOut(const CGObjectInstance * obj)
|
|||||||
{
|
{
|
||||||
assert(!hasOngoingAnimations());
|
assert(!hasOngoingAnimations());
|
||||||
|
|
||||||
if(isEventVisible(obj))
|
if(isEventVisible(obj) && !isEventInstant(obj) )
|
||||||
fadeOutObject(obj);
|
fadeOutObject(obj);
|
||||||
else
|
else
|
||||||
removeObject(obj);
|
removeObject(obj);
|
||||||
|
@ -50,6 +50,7 @@ class MapViewController : public IMapObjectObserver
|
|||||||
std::shared_ptr<MapRendererPuzzleMapContext> puzzleMapContext;
|
std::shared_ptr<MapRendererPuzzleMapContext> puzzleMapContext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isEventInstant(const CGObjectInstance * obj);
|
||||||
bool isEventVisible(const CGObjectInstance * obj);
|
bool isEventVisible(const CGObjectInstance * obj);
|
||||||
bool isEventVisible(const CGHeroInstance * obj, const int3 & from, const int3 & dest);
|
bool isEventVisible(const CGHeroInstance * obj, const int3 & from, const int3 & dest);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user