diff options
Diffstat (limited to 'src/powder.c')
| -rw-r--r-- | src/powder.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/powder.c b/src/powder.c index 19a6d70..b8bfe85 100644 --- a/src/powder.c +++ b/src/powder.c @@ -548,6 +548,24 @@ int get_normal_interp(int pt, float x0, float y0, float dx, float dy, float *nx, return get_normal(pt, x, y, dx, dy, nx, ny); } +//For soap only +void detach(int i) +{ + if ((parts[i].ctype&2) == 2) + { + if ((parts[parts[i].tmp].ctype&4) == 4) + parts[parts[i].tmp].ctype ^= 4; + } + + if ((parts[i].ctype&4) == 4) + { + if ((parts[parts[i].tmp2].ctype&2) == 2) + parts[parts[i].tmp2].ctype ^= 2; + } + + parts[i].ctype = 0; +} + void kill_part(int i)//kills particle number i { int x, y; @@ -574,11 +592,7 @@ void kill_part(int i)//kills particle number i } if (parts[i].type == PT_SOAP) { - if ((parts[i].ctype&2) == 2) - parts[parts[i].tmp].ctype ^= 4; - - if ((parts[i].ctype&4) == 4) - parts[parts[i].tmp2].ctype ^= 2; + detach(i); } if (x>=0 && y>=0 && x<XRES && y<YRES) { if ((pmap[y][x]>>8)==i) |
