diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2011-07-06 09:21:07 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-07-06 09:44:57 (GMT) |
| commit | 6fb69f591f6f093ce1114dc5f1a4f3d10fe996aa (patch) | |
| tree | c4f869ad9962a36177988ff156e7b51a205702cc /src | |
| parent | 11dbdb9314e4f1a4d60201ae5b2d6a5f6f7fc310 (diff) | |
| download | powder-6fb69f591f6f093ce1114dc5f1a4f3d10fe996aa.zip powder-6fb69f591f6f093ce1114dc5f1a4f3d10fe996aa.tar.gz | |
Change PBCN switching method
PCLN is different for compatibility with some existing saves relying on the exact
time taken for a switch on/off to spread through adjacent PCLN dots
(commit 692e2ba86d694103bfcad00ddd6816fc96d595bd)
Diffstat (limited to 'src')
| -rw-r--r-- | src/elements/pbcn.c | 41 | ||||
| -rw-r--r-- | src/elements/sprk.c | 2 |
2 files changed, 20 insertions, 23 deletions
diff --git a/src/elements/pbcn.c b/src/elements/pbcn.c index bfd65d5..3c41820 100644 --- a/src/elements/pbcn.c +++ b/src/elements/pbcn.c @@ -17,28 +17,6 @@ int update_PBCN(UPDATE_FUNC_ARGS) { return 1; } } - for (rx=-2; rx<3; rx++) - for (ry=-2; ry<3; ry++) - if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) - { - r = pmap[y+ry][x+rx]; - if ((r>>8)>=NPART || !r) - continue; - if ((r&0xFF)==PT_SPRK) - { - if (parts[r>>8].ctype==PT_PSCN) - parts[i].life = 10; - else if (parts[r>>8].ctype==PT_NSCN) - parts[i].life = 9; - } - if ((r&0xFF)==PT_PBCN) - { - if (parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - parts[i].life = 9; - else if (parts[i].life==0&&parts[r>>8].life==10) - parts[i].life = 10; - } - } if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM) for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) @@ -56,6 +34,25 @@ int update_PBCN(UPDATE_FUNC_ARGS) { (r&0xFF)!=PT_PBCN && (r&0xFF)<PT_NUM) parts[i].ctype = r&0xFF; } + if (parts[i].life==10) + { + + for (rx=-2; rx<3; rx++) + for (ry=-2; ry<3; ry++) + if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) + { + r = pmap[y+ry][x+rx]; + if ((r>>8)>=NPART || !r) + continue; + if ((r&0xFF)==PT_PBCN) + { + if (parts[r>>8].life<10&&parts[r>>8].life>0) + parts[i].life = 9; + else if (parts[r>>8].life==0) + parts[r>>8].life = 10; + } + } + } if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].life==10) { if (parts[i].ctype==PT_PHOT) {//create photons a different way for (rx=-1; rx<2; rx++) { diff --git a/src/elements/sprk.c b/src/elements/sprk.c index fdb0fa3..039453f 100644 --- a/src/elements/sprk.c +++ b/src/elements/sprk.c @@ -94,7 +94,7 @@ int update_SPRK(UPDATE_FUNC_ARGS) { parts[r>>8].life = 9; } } - else if ((ct==PT_PSCN||ct==PT_NSCN) && (rt==PT_PUMP||rt==PT_GPMP||rt==PT_HSWC||(rt==PT_LCRY&&abs(rx)<2&&abs(ry)<2))) // PROP_PTOGGLE, Maybe? We seem to use 2 different methods for handling actived elements, this one seems better + else if ((ct==PT_PSCN||ct==PT_NSCN) && (rt==PT_PUMP||rt==PT_GPMP||rt==PT_HSWC||rt==PT_PBCN||(rt==PT_LCRY&&abs(rx)<2&&abs(ry)<2))) // PROP_PTOGGLE, Maybe? We seem to use 2 different methods for handling actived elements, this one seems better. Yes, use this one for new elements, PCLN is different for compatibility with existing saves { if (ct==PT_PSCN) parts[r>>8].life = 10; else if (ct==PT_NSCN && parts[r>>8].life>=10) parts[r>>8].life = 9; |
