mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-13 22:06:58 +02:00
further battle fixes
This commit is contained in:
parent
e94e6ac78a
commit
c5a5cb7b38
@ -501,7 +501,7 @@ void CBattleInterface::mouseMoved(const SDL_MouseMotionEvent &sEvent)
|
|||||||
fromHex = b;
|
fromHex = b;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(fromHex!=-1 && fromHex%17!=0 && fromHex%17!=16)
|
if(fromHex!=-1 && fromHex%17!=0 && fromHex%17!=16 && vstd::contains(shadedHexes, fromHex))
|
||||||
{
|
{
|
||||||
switch(BattleInfo::mutualPosition(fromHex, myNumber))
|
switch(BattleInfo::mutualPosition(fromHex, myNumber))
|
||||||
{
|
{
|
||||||
@ -723,9 +723,9 @@ void CBattleInterface::stackMoved(int number, int destHex, bool endMoving)
|
|||||||
int hexWbase = 44, hexHbase = 42;
|
int hexWbase = 44, hexHbase = 42;
|
||||||
bool twoTiles = LOCPLINT->cb->battleGetCreature(number).isDoubleWide();
|
bool twoTiles = LOCPLINT->cb->battleGetCreature(number).isDoubleWide();
|
||||||
|
|
||||||
|
deactivate();
|
||||||
if(startMoving) //animation of starting move; some units don't have this animation (ie. halberdier)
|
if(startMoving) //animation of starting move; some units don't have this animation (ie. halberdier)
|
||||||
{
|
{
|
||||||
deactivate();
|
|
||||||
CGI->curh->hide();
|
CGI->curh->hide();
|
||||||
for(int i=0; i<creAnims[number]->framesInGroup(20)*getAnimSpeedMultiplier()-1; ++i)
|
for(int i=0; i<creAnims[number]->framesInGroup(20)*getAnimSpeedMultiplier()-1; ++i)
|
||||||
{
|
{
|
||||||
@ -812,11 +812,11 @@ void CBattleInterface::stackMoved(int number, int destHex, bool endMoving)
|
|||||||
if((animCount+1)%(4/animSpeed)==0)
|
if((animCount+1)%(4/animSpeed)==0)
|
||||||
creAnims[number]->incrementFrame();
|
creAnims[number]->incrementFrame();
|
||||||
}
|
}
|
||||||
activate();
|
|
||||||
}
|
}
|
||||||
creAnims[number]->setType(2); //resetting to default
|
creAnims[number]->setType(2); //resetting to default
|
||||||
CGI->curh->show();
|
CGI->curh->show();
|
||||||
}
|
}
|
||||||
|
activate();
|
||||||
|
|
||||||
CStack curs = *LOCPLINT->cb->battleGetStackByID(number);
|
CStack curs = *LOCPLINT->cb->battleGetStackByID(number);
|
||||||
if(endMoving) //resetting to default
|
if(endMoving) //resetting to default
|
||||||
@ -1140,6 +1140,8 @@ void CBattleInterface::stackIsShooting(int ID, int dest)
|
|||||||
spi.y = xycoord.second + 125 - LOCPLINT->cb->battleGetCreature(ID).rightMissleOffsetY;
|
spi.y = xycoord.second + 125 - LOCPLINT->cb->battleGetCreature(ID).rightMissleOffsetY;
|
||||||
}
|
}
|
||||||
spi.lastStep = sqrt((float)((destcoord.first - spi.x)*(destcoord.first - spi.x) + (destcoord.second - spi.y) * (destcoord.second - spi.y))) / 40;
|
spi.lastStep = sqrt((float)((destcoord.first - spi.x)*(destcoord.first - spi.x) + (destcoord.second - spi.y) * (destcoord.second - spi.y))) / 40;
|
||||||
|
if(spi.lastStep == 0)
|
||||||
|
spi.lastStep = 1;
|
||||||
spi.dx = (destcoord.first - spi.x) / spi.lastStep;
|
spi.dx = (destcoord.first - spi.x) / spi.lastStep;
|
||||||
spi.dy = (destcoord.second - spi.y) / spi.lastStep;
|
spi.dy = (destcoord.second - spi.y) / spi.lastStep;
|
||||||
//set starting frame
|
//set starting frame
|
||||||
|
Loading…
x
Reference in New Issue
Block a user