summaryrefslogtreecommitdiff
path: root/src/elements/figh.c
diff options
context:
space:
mode:
authorsavask <savask@yandex.ru>2011-10-23 08:22:31 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-10-26 14:36:00 (GMT)
commit03902ec9a4c60e53a7f80649bcf3a1158a20465e (patch)
tree537a5a55461e1596b2e6fa7843e9351d217f08c9 /src/elements/figh.c
parent5652ecc5c20a6cce0745b20587ff4dfec8103ff3 (diff)
downloadpowder-03902ec9a4c60e53a7f80649bcf3a1158a20465e.zip
powder-03902ec9a4c60e53a7f80649bcf3a1158a20465e.tar.gz
Made a special structure for stick mans.
Diffstat (limited to 'src/elements/figh.c')
-rw-r--r--src/elements/figh.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/elements/figh.c b/src/elements/figh.c
index 74dcf14..fb172fb 100644
--- a/src/elements/figh.c
+++ b/src/elements/figh.c
@@ -2,40 +2,40 @@
int update_FIGH(UPDATE_FUNC_ARGS)
{
- float* figh = fighters[(unsigned char)parts[i].tmp];
+ playerst* figh = &fighters[(unsigned char)parts[i].tmp];
float tarx, tary;
parts[i].tmp2 = 0; //0 - stay in place, 1 - seek a stick man
//Set target cords
- if (player[27])
+ if (player.spwn)
{
- if (player2[27])
- if ((pow(player[5]-x, 2) + pow(player[6]-y, 2))<=
- (pow(player2[5]-x, 2) + pow(player2[6]-y, 2)))
+ if (player2.spwn)
+ 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)))
{
- tarx = player[5];
- tary = player[6];
+ tarx = player.legs[2];
+ tary = player.legs[3];
}
else
{
- tarx = player2[5];
- tary = player2[6];
+ tarx = player2.legs[2];
+ tary = player2.legs[3];
}
else
{
- tarx = player[5];
- tary = player[6];
+ tarx = player.legs[2];
+ tary = player.legs[3];
}
parts[i].tmp2 = 1;
}
else
- if (player2[27])
+ if (player2.spwn)
{
- tarx = player2[5];
- tary = player2[6];
+ tarx = player2.legs[2];
+ tary = player2.legs[3];
parts[i].tmp2 = 1;
}
@@ -45,29 +45,29 @@ int update_FIGH(UPDATE_FUNC_ARGS)
case 1:
if ((pow(tarx-x, 2) + pow(tary-y, 2))<600)
{
- if (figh[2] == PT_FIRE || figh[2] == PT_LIGH)
- figh[0] = (int)figh[0] | 0x08;
+ if (figh->elem == PT_FIRE || figh->elem == PT_LIGH)
+ figh->comm = (int)figh->comm | 0x08;
}
else
if (tarx<x)
{
- figh[0] = 0x01;
- if (!eval_move(PT_DUST, figh[7]-4, figh[8]-1, NULL) || !eval_move(PT_DUST, figh[15]-4, figh[16]-1, NULL))
- figh[0] = (int)figh[0] | 0x04;
+ figh->comm = 0x01;
+ if (!eval_move(PT_DUST, figh->legs[4]-4, figh->legs[5]-1, NULL) || !eval_move(PT_DUST, figh->legs[12]-4, figh->legs[13]-1, NULL))
+ figh->comm = (int)figh->comm | 0x04;
}
else
{
- figh[0] = 0x02;
- if (!eval_move(PT_DUST, figh[7]+4, figh[8]-1, NULL) || !eval_move(PT_DUST, figh[15]+4, figh[16]-1, NULL))
- figh[0] = (int)figh[0] | 0x04;
+ figh->comm = 0x02;
+ if (!eval_move(PT_DUST, figh->legs[4]+4, figh->legs[5]-1, NULL) || !eval_move(PT_DUST, figh->legs[12]+4, figh->legs[13]-1, NULL))
+ figh->comm = (int)figh->comm | 0x04;
}
break;
default:
- figh[0] = 0;
+ figh->comm = 0;
break;
}
- figh[1] = figh[0];
+ figh->pcomm = figh->comm;
run_stickman(figh, UPDATE_FUNC_SUBCALL_ARGS);
return 0;