summaryrefslogtreecommitdiff
path: root/src/powder.c
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2012-08-11 08:53:02 (GMT)
committer jacksonmj <mj-pt@jacksonmj.co.uk>2012-08-13 22:48:55 (GMT)
commit8ec0f41fb143a6bda08d078232f3d70b36328dc4 (patch)
tree93b52bfef3bd66f04c62fa944728bb152079e56c /src/powder.c
parenta4c15746b8b3f6c187fbc7403fe5082883a8d9b7 (diff)
downloadpowder-8ec0f41fb143a6bda08d078232f3d70b36328dc4.zip
powder-8ec0f41fb143a6bda08d078232f3d70b36328dc4.tar.gz
Powered pipe, based on jacob1's commits
PSCN to turn on, NSCN to turn off, INST to reverse. Differences from jacob1's commit include: flood fill function that includes 1px diagonal pipes, powered/reversed state stored in tmp instead of flags, sparks from PSCN/NSCN/INST always take effect the following frame, single pixel pipe directions are a number from 0 to 7 so "if(coords)" does not check whether one is set (store another "transfers according to 1px pipe direction" bit for reverse flow).
Diffstat (limited to 'src/powder.c')
-rw-r--r--src/powder.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/powder.c b/src/powder.c
index b997174..188b54c 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1027,6 +1027,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
parts[i].life = 100;
break;
case PT_PIPE:
+ case PT_PPIP:
parts[i].life = 60;
break;
case PT_BCOL:
@@ -1788,6 +1789,20 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
+
+ if (ppip_changed)
+ {
+ for (i=0; i<=parts_lastActiveIndex; i++)
+ {
+ if (parts[i].type==PT_PPIP)
+ {
+ parts[i].tmp |= (parts[i].tmp&0xE0000000)>>3;
+ parts[i].tmp &= ~0xE0000000;
+ }
+ }
+ ppip_changed = 0;
+ }
+
//game of life!
if (ISGOL==1&&++CGOL>=GSPEED)//GSPEED is frames per generation
{
@@ -2599,7 +2614,7 @@ killed:
}
r = pmap[fin_y][fin_x];
- if ((r & 0xFF) == PT_PIPE && !(parts[r>>8].tmp&0xFF))
+ if (((r&0xFF)==PT_PIPE || (r&0xFF) == PT_PPIP) && !(parts[r>>8].tmp&0xFF))
{
parts[r>>8].tmp = (parts[r>>8].tmp&~0xFF) | parts[i].type;
parts[r>>8].temp = parts[i].temp;