diff --git a/src/powder.c b/src/powder.c index af333bb33..5c3a6d9f5 100644 --- a/src/powder.c +++ b/src/powder.c @@ -172,6 +172,37 @@ int try_move(int i, int x, int y, int nx, int ny) if (!parts[r>>8].ctype) parts[r>>8].ctype = PT_NEUT; } + if ((r&0xFF)==PT_PRTI && (parts[i].type==PT_PHOT || parts[i].type==PT_NEUT)) + { + int nnx, count; + if (nx-x<0) + { + if (ny-y<0) count = 1; + else if (ny-y==0) count = 2; + else count = 3; + } + else if (nx-x==0) + { + if (ny-y<0) count = 4; + else count = 5; + } + else + { + if (ny-y<0) count = 6; + else if (ny-y==0) count = 7; + else count = 8; + } + parts[r>>8].tmp = (int)((parts[r>>8].temp-73.15f)/100+1); + if (parts[r>>8].tmp>=CHANNELS) parts[r>>8].tmp = CHANNELS-1; + else if (parts[r>>8].tmp<0) parts[r>>8].tmp = 0; + for ( nnx=0; nnx<80; nnx++) + if (!portalp[parts[r>>8].tmp][count-1][nnx].type) + { + portalp[parts[r>>8].tmp][count-1][nnx] = parts[i]; + parts[i].type=PT_NONE; + break; + } + } return 0; } @@ -327,7 +358,7 @@ int do_move(int i, int x, int y, float nxf, float nyf) } if (t==PT_PHOT||t==PT_NEUT) photons[ny][nx] = t|(i<<8); - else + else if (t) pmap[ny][nx] = t|(i<<8); } }