mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
* fixed bug with looping animation supposed to be played once
* minor changes
This commit is contained in:
@ -1526,7 +1526,7 @@ CPath * CGameState::getPath(int3 src, int3 dest, const CGHeroInstance * hero)
|
|||||||
else
|
else
|
||||||
blockLandSea = boost::logic::indeterminate;
|
blockLandSea = boost::logic::indeterminate;
|
||||||
|
|
||||||
//graph initialization
|
//graph initialization
|
||||||
std::vector< std::vector<CPathNode> > graph;
|
std::vector< std::vector<CPathNode> > graph;
|
||||||
graph.resize(map->width);
|
graph.resize(map->width);
|
||||||
for(size_t i=0; i<graph.size(); ++i)
|
for(size_t i=0; i<graph.size(); ++i)
|
||||||
@ -1924,9 +1924,9 @@ std::vector<CStack> BattleInfo::getStackQueue()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int3 CPath::startPos()
|
int3 CPath::startPos() const
|
||||||
{
|
{
|
||||||
return int3(nodes[nodes.size()-1].coord.x,nodes[nodes.size()-1].coord.y,nodes[nodes.size()-1].coord.z);
|
return nodes[nodes.size()-1].coord;
|
||||||
}
|
}
|
||||||
void CPath::convert(ui8 mode) //mode=0 -> from 'manifest' to 'object'
|
void CPath::convert(ui8 mode) //mode=0 -> from 'manifest' to 'object'
|
||||||
{
|
{
|
||||||
@ -1939,7 +1939,7 @@ void CPath::convert(ui8 mode) //mode=0 -> from 'manifest' to 'object'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int3 CPath::endPos()
|
int3 CPath::endPos() const
|
||||||
{
|
{
|
||||||
return int3(nodes[0].coord.x,nodes[0].coord.y,nodes[0].coord.z);
|
return nodes[0].coord;
|
||||||
}
|
}
|
||||||
|
32
CGameState.h
32
CGameState.h
@ -197,22 +197,22 @@ struct UpgradeInfo
|
|||||||
UpgradeInfo(){oldID = -1;};
|
UpgradeInfo(){oldID = -1;};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CPathNode
|
struct CPathNode
|
||||||
{
|
{
|
||||||
bool accesible; //true if a hero can be on this node
|
bool accesible; //true if a hero can be on this node
|
||||||
int dist; //distance from the first node of searching; -1 is infinity
|
int dist; //distance from the first node of searching; -1 is infinity
|
||||||
CPathNode * theNodeBefore;
|
CPathNode * theNodeBefore;
|
||||||
int3 coord; //coordiantes
|
int3 coord; //coordiantes
|
||||||
bool visited;
|
bool visited;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DLL_EXPORT CPath
|
struct DLL_EXPORT CPath
|
||||||
{
|
{
|
||||||
std::vector<CPathNode> nodes; //just get node by node
|
std::vector<CPathNode> nodes; //just get node by node
|
||||||
|
|
||||||
int3 startPos(); // start point
|
int3 startPos() const; // start point
|
||||||
int3 endPos(); //destination point
|
int3 endPos() const; //destination point
|
||||||
void convert(ui8 mode); //mode=0 -> from 'manifest' to 'object'
|
void convert(ui8 mode); //mode=0 -> from 'manifest' to 'object'
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_EXPORT CGameState
|
class DLL_EXPORT CGameState
|
||||||
|
@ -110,11 +110,10 @@ void CCreatureAnimation::incrementFrame()
|
|||||||
{
|
{
|
||||||
if(type!=-1) //when a specific part of animation is played
|
if(type!=-1) //when a specific part of animation is played
|
||||||
{
|
{
|
||||||
internalFrame = (internalFrame + 1) % frameGroups[type].size();
|
++internalFrame;
|
||||||
curFrame = frameGroups[type][internalFrame];
|
|
||||||
|
|
||||||
if(internalFrame == frameGroups[type].size()) //rewind
|
if(internalFrame == frameGroups[type].size()) //rewind
|
||||||
{
|
{
|
||||||
|
internalFrame = 0;
|
||||||
if(once) //playing animation once - return to standing animation
|
if(once) //playing animation once - return to standing animation
|
||||||
{
|
{
|
||||||
type = 2;
|
type = 2;
|
||||||
@ -126,6 +125,7 @@ void CCreatureAnimation::incrementFrame()
|
|||||||
curFrame = frameGroups[type][0];
|
curFrame = frameGroups[type][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
curFrame = frameGroups[type][internalFrame];
|
||||||
}
|
}
|
||||||
else //when whole animation is played
|
else //when whole animation is played
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user