summaryrefslogtreecommitdiff
path: root/src/powder.c
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-07-26 16:46:15 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-07-26 16:46:15 (GMT)
commit899969cc8a3453040ea2f5578942ae2375a79f59 (patch)
tree1a50a013f80ab9c5da9b8e89bb207f1cbdbdae2e /src/powder.c
parent7338545ab43b1871cea0f91a15746e534d7a9e9b (diff)
parentdbd3272933de7769ed1efdd0492e1a5a872ed3bd (diff)
downloadpowder-899969cc8a3453040ea2f5578942ae2375a79f59.zip
powder-899969cc8a3453040ea2f5578942ae2375a79f59.tar.gz
Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
Diffstat (limited to 'src/powder.c')
-rw-r--r--src/powder.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/powder.c b/src/powder.c
index 201ec97..dbf9c45 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -7,9 +7,8 @@
int gravwl_timeout = 0;
-int isplayer = 0;
-float player[27]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index, [19]-[26] are accelerations
-float player2[27];
+float player[28]; //[0] is a command cell, [3]-[18] are legs positions, [19]-[26] are accelerations, [27] shows if player was spawned
+float player2[28];
particle *parts;
particle *cb_parts;
@@ -291,13 +290,11 @@ int try_move(int i, int x, int y, int nx, int ny)
{
if (parts[i].type == PT_STKM)
{
- death = 1;
- isplayer = 0;
+ player[27] = 0;
}
if (parts[i].type == PT_STKM2)
{
- death2 = 1;
- isplayer2 = 0;
+ player2[27] = 0;
}
parts[i].type=PT_NONE;
return 0;
@@ -306,13 +303,11 @@ int try_move(int i, int x, int y, int nx, int ny)
{
if (parts[i].type == PT_STKM)
{
- death = 1;
- isplayer = 0;
+ player[27] = 0;
}
if (parts[i].type == PT_STKM2)
{
- death2 = 1;
- isplayer2 = 0;
+ player2[27] = 0;
}
parts[i].type=PT_NONE;
if (!legacy_enable)
@@ -576,13 +571,11 @@ void kill_part(int i)//kills particle number i
y = (int)(parts[i].y+0.5f);
if (parts[i].type == PT_STKM)
{
- death = 1;
- isplayer = 0;
+ player[27] = 0;
}
if (parts[i].type == PT_STKM2)
{
- death2 = 1;
- isplayer2 = 0;
+ player2[27] = 0;
}
if (parts[i].type == PT_SPAWN)
{
@@ -618,6 +611,13 @@ inline void part_change_type(int i, int x, int y, int t)//changes the type of pa
return;
if (!ptypes[t].enabled)
t = PT_NONE;
+
+ if (parts[i].type == PT_STKM)
+ player[27] = 0;
+
+ if (parts[i].type == PT_STKM2)
+ player2[27] = 0;
+
parts[i].type = t;
if (t==PT_PHOT || t==PT_NEUT)
{
@@ -900,7 +900,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
}
if (t==PT_STKM)
{
- if (isplayer==0)
+ if (player[27]==0)
{
parts[i].x = (float)x;
parts[i].y = (float)y;
@@ -931,7 +931,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
player[17] = x+3;
player[18] = y+12;
- isplayer = 1;
+ player[27] = 1;
}
else
{
@@ -942,7 +942,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
}
if (t==PT_STKM2)
{
- if (isplayer2==0)
+ if (player2[27]==0)
{
parts[i].x = (float)x;
parts[i].y = (float)y;
@@ -973,7 +973,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
player2[17] = x+3;
player2[18] = y+12;
- isplayer2 = 1;
+ player2[27] = 1;
}
else
{
@@ -2389,8 +2389,6 @@ void update_particles(pixel *vid)//doesn't update the particles themselves, but
pthread_t *InterThreads;
#endif
- isplayer = 0; //Needed for player spawning
- isplayer2 = 0;
memset(pmap, 0, sizeof(pmap));
memset(photons, 0, sizeof(photons));
r = rand()%2;