summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-05-14 11:48:44 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-19 14:53:23 (GMT)
commite4b03fb2e210cc9a72e326de3a9c3692dbd8f3aa (patch)
treed0530098a2cb9680bd85e94c44bb04b95622d4d2
parentaf68469f6af3dd1e7a856b2a69f7a31b1b9b2d89 (diff)
downloadpowder-e4b03fb2e210cc9a72e326de3a9c3692dbd8f3aa.zip
powder-e4b03fb2e210cc9a72e326de3a9c3692dbd8f3aa.tar.gz
Photons and neutrons go through portal instead of reflecting
-rw-r--r--src/powder.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/powder.c b/src/powder.c
index af333bb..5c3a6d9 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);
}
}