Fixed the bug with fighters running away from stick mans, but now
boundary check is worser so fighters won't usually notice holes on their way.
This commit is contained in:
parent
fe82685257
commit
2b4d0442b5
@ -4,41 +4,41 @@ int update_FIGH(UPDATE_FUNC_ARGS)
|
|||||||
{
|
{
|
||||||
playerst* figh = &fighters[(unsigned char)parts[i].tmp];
|
playerst* figh = &fighters[(unsigned char)parts[i].tmp];
|
||||||
|
|
||||||
float tarx, tary;
|
unsigned int tarx, tary;
|
||||||
|
|
||||||
parts[i].tmp2 = 0; //0 - stay in place, 1 - seek a stick man
|
parts[i].tmp2 = 0; //0 - stay in place, 1 - seek a stick man
|
||||||
|
|
||||||
//Set target cords
|
//Set target cords
|
||||||
if (player.spwn)
|
if (player.spwn && player2.spwn)
|
||||||
{
|
{
|
||||||
if (player2.spwn)
|
|
||||||
if ((pow(player.legs[2]-x, 2) + pow(player.legs[3]-y, 2))<=
|
if ((pow(player.legs[2]-x, 2) + pow(player.legs[3]-y, 2))<=
|
||||||
(pow(player2.legs[2]-x, 2) + pow(player2.legs[3]-y, 2)))
|
(pow(player2.legs[2]-x, 2) + pow(player2.legs[3]-y, 2)))
|
||||||
{
|
{
|
||||||
tarx = player.legs[2];
|
tarx = (unsigned int)player.legs[2];
|
||||||
tary = player.legs[3];
|
tary = (unsigned int)player.legs[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tarx = player2.legs[2];
|
tarx = (unsigned int)player2.legs[2];
|
||||||
tary = player2.legs[3];
|
tary = (unsigned int)player2.legs[3];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
tarx = player.legs[2];
|
|
||||||
tary = player.legs[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
parts[i].tmp2 = 1;
|
parts[i].tmp2 = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (player.spwn)
|
||||||
|
{
|
||||||
|
tarx = (unsigned int)player.legs[2];
|
||||||
|
tary = (unsigned int)player.legs[3];
|
||||||
|
parts[i].tmp2 = 1;
|
||||||
|
}
|
||||||
if (player2.spwn)
|
if (player2.spwn)
|
||||||
{
|
{
|
||||||
tarx = player2.legs[2];
|
tarx = (unsigned int)player2.legs[2];
|
||||||
tary = player2.legs[3];
|
tary = (unsigned int)player2.legs[3];
|
||||||
|
|
||||||
parts[i].tmp2 = 1;
|
parts[i].tmp2 = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (parts[i].tmp2)
|
switch (parts[i].tmp2)
|
||||||
{
|
{
|
||||||
@ -53,7 +53,8 @@ int update_FIGH(UPDATE_FUNC_ARGS)
|
|||||||
else
|
else
|
||||||
if (tarx<x)
|
if (tarx<x)
|
||||||
{
|
{
|
||||||
if(!eval_move(PT_DUST, figh->legs[4]-10, figh->legs[5]+6, NULL))
|
if(!(eval_move(PT_DUST, figh->legs[4]-10, figh->legs[5]+6, NULL)
|
||||||
|
&& eval_move(PT_DUST, figh->legs[4]-10, figh->legs[5]+3, NULL)))
|
||||||
figh->comm = 0x01;
|
figh->comm = 0x01;
|
||||||
else
|
else
|
||||||
figh->comm = 0x02;
|
figh->comm = 0x02;
|
||||||
@ -65,7 +66,8 @@ int update_FIGH(UPDATE_FUNC_ARGS)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!eval_move(PT_DUST, figh->legs[12]+10, figh->legs[13]+6, NULL))
|
if (!(eval_move(PT_DUST, figh->legs[12]+10, figh->legs[13]+6, NULL)
|
||||||
|
&& eval_move(PT_DUST, figh->legs[12]+10, figh->legs[13]+3, NULL)))
|
||||||
figh->comm = 0x02;
|
figh->comm = 0x02;
|
||||||
else
|
else
|
||||||
figh->comm = 0x01;
|
figh->comm = 0x01;
|
||||||
|
Reference in New Issue
Block a user