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 692e2ba86d)
This commit is contained in:
jacksonmj 2011-07-06 17:21:07 +08:00 committed by Simon Robertshaw
parent 11dbdb9314
commit 6fb69f591f
2 changed files with 20 additions and 23 deletions

View File

@ -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++) {

View File

@ -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;