summaryrefslogtreecommitdiff
path: root/src/powder.c
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-11 13:44:52 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-11 13:44:52 (GMT)
commit4006bdf4c22564e916092d6d63ae63d1fa6bc5b5 (patch)
tree5cbe9ad22685a055f4d7849bd52afa0f9ab87f8d /src/powder.c
parentcf1ef725847a5dc5c9e796a10ff840f65dc1e885 (diff)
parentb3735bb84b5d53014e7e20085007ef380cc7a3c1 (diff)
downloadpowder-4006bdf4c22564e916092d6d63ae63d1fa6bc5b5.zip
powder-4006bdf4c22564e916092d6d63ae63d1fa6bc5b5.tar.gz
Merge branch 'upstream' into dev
Diffstat (limited to 'src/powder.c')
-rw-r--r--src/powder.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/src/powder.c b/src/powder.c
index ccca0c2..e59fd89 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -701,11 +701,7 @@ inline int create_part(int p, int x, int y, int t)
parts[i].vx = 3.0f*cosf(a);
parts[i].vy = 3.0f*sinf(a);
}
- if (t==PT_BIZR||t==PT_BIZRG)
- parts[i].ctype = 0x47FFFF;
- if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP
- pmap[y][x] = t|(i<<8);
- else if (t==PT_STKM)
+ if (t==PT_STKM)
{
if (isplayer==0)
{
@@ -755,11 +751,15 @@ inline int create_part(int p, int x, int y, int t)
isplayer = 1;
}
+ else
+ {
+ return -1;
+ }
//kill_part(playerspawn);
create_part(-1,x,y,PT_SPAWN);
ISSPAWN1 = 1;
}
- else if (t==PT_STKM2)
+ if (t==PT_STKM2)
{
if (isplayer2==0)
{
@@ -809,10 +809,18 @@ inline int create_part(int p, int x, int y, int t)
isplayer2 = 1;
}
+ else
+ {
+ return -1;
+ }
//kill_part(player2spawn);
create_part(-1,x,y,PT_SPAWN2);
ISSPAWN2 = 1;
}
+ if (t==PT_BIZR||t==PT_BIZRG)
+ parts[i].ctype = 0x47FFFF;
+ if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP
+ pmap[y][x] = t|(i<<8);
return i;
}
@@ -1425,16 +1433,16 @@ void update_particles_i(pixel *vid, int start, int inc)
j = a = nt = 0;
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++) {
- if (nx||ny){
+ if (nx||ny) {
surround[j] = r = pmap[y+ny][x+nx];
j++;
- if (!bmap[(y+ny)/CELL][(x+nx)/CELL] || bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_STREAM)
- {
- if (!(r&0xFF))
- a = 1;
- if ((r&0xFF)!=t)
- nt = 1;
- }
+ if (!bmap[(y+ny)/CELL][(x+nx)/CELL] || bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_STREAM)
+ {
+ if (!(r&0xFF))
+ a = 1;
+ if ((r&0xFF)!=t)
+ nt = 1;
+ }
}
}
@@ -1468,6 +1476,18 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[surround_hconduct[j]].temp = pt;
}
+ if (y-2 >= 0 && y-2 < YRES && ptypes[t].properties&TYPE_LIQUID) {
+ float swappage;
+ r = pmap[y-2][x];
+ if (!((r>>8)>=NPART || !r || parts[i].type != (r&0xFF))) {
+ if (parts[i].temp>parts[r>>8].temp) {
+ swappage = parts[i].temp;
+ parts[i].temp = parts[r>>8].temp;
+ parts[r>>8].temp = swappage;
+ }
+ }
+ }
+
s = 1;
if (pt>ptransitions[t].thv&&ptransitions[t].tht>-1) {
if (ptransitions[t].tht!=PT_NUM)