More update functions cleanup.

This commit is contained in:
jacksonmj 2011-01-10 00:46:34 +00:00
parent 88d107f18a
commit 855281295f
16 changed files with 247 additions and 266 deletions

View File

@ -1,30 +1,26 @@
#include <powder.h> #include <powder.h>
int update_AMTR(UPDATE_FUNC_ARGS) { int update_AMTR(UPDATE_FUNC_ARGS) {
int r, rt; int r, rx, ry;
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
rt = parts[r>>8].type;
if ((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL && (r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO) if ((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL && (r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO)
{ {
parts[i].life++; parts[i].life++;
if (parts[i].life==3) if (parts[i].life==3)
{ {
parts[i].type = PT_NONE;
kill_part(i); kill_part(i);
return 1; return 1;
} }
parts[r>>8].life = 0;
parts[r>>8].type = PT_NONE;
kill_part(r>>8);
if (2>(rand()/(RAND_MAX/100))) if (2>(rand()/(RAND_MAX/100)))
create_part(-1, x+nx, y+ny, PT_PHOT); create_part(r>>8, x+rx, y+ry, PT_PHOT);
else
kill_part(r>>8);
pv[y/CELL][x/CELL] -= 5.0f; pv[y/CELL][x/CELL] -= 5.0f;
} }
} }

View File

@ -1,19 +1,20 @@
#include <powder.h> #include <powder.h>
int update_ARAY(UPDATE_FUNC_ARGS) { int update_ARAY(UPDATE_FUNC_ARGS) {
int r, nxx, nyy, docontinue, nxi, nyi; int r, nxx, nyy, docontinue, nxi, nyi, rx, ry, nr;
if (parts[i].life==0) { if (parts[i].life==0) {
int colored =0; int colored =0;
for (nx=-1; nx<2; nx++) { for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) { for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) { if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
r = pmap[y+ny][x+nx]; {
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if ((r&0xFF)==PT_SPRK) { if ((r&0xFF)==PT_SPRK) {
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0; int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
int nostop = (parts[r>>8].ctype==PT_INST)?1:0; int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
for (docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) { for (docontinue = 1, nxx = 0, nyy = 0, nxi = rx*-1, nyi = ry*-1; docontinue; nyy+=nyi, nxx+=nxi) {
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) { if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) {
break; break;
} }
@ -29,22 +30,21 @@ int update_ARAY(UPDATE_FUNC_ARGS) {
parts[nr].ctype = colored; parts[nr].ctype = colored;
} }
} else if (!destroy) { } else if (!destroy) {
if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0) { if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==0) {
if (nyy!=0 || nxx!=0) { if (nyy!=0 || nxx!=0) {
parts[r>>8].type = PT_BRAY;
parts[r>>8].life = 1020; parts[r>>8].life = 1020;
parts[r>>8].tmp = 1; parts[r>>8].tmp = 1;
if (!parts[r>>8].ctype) if (!parts[r>>8].ctype)
parts[r>>8].ctype = colored; parts[r>>8].ctype = colored;
} }
docontinue = 0; docontinue = 0;
} else if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1) { } else if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==1) {
parts[r>>8].life = 1020; parts[r>>8].life = 1020;
//docontinue = 1; //docontinue = 1;
} }
else if (parts[r>>8].type==PT_FILT) { else if ((r&0xFF)==PT_FILT) {
colored = parts[r>>8].ctype; colored = parts[r>>8].ctype;
} else if (parts[r>>8].type!=PT_INWR && parts[r>>8].type!=PT_ARAY && parts[r>>8].type!=PT_WIFI) { } else if ((r&0xFF)!=PT_INWR && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI) {
if (nyy!=0 || nxx!=0) { if (nyy!=0 || nxx!=0) {
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK); create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
} }
@ -70,7 +70,5 @@ int update_ARAY(UPDATE_FUNC_ARGS) {
//parts[i].life = 4; //parts[i].life = 4;
} }
} }
}
}
return 0; return 0;
} }

View File

@ -13,18 +13,18 @@ int update_BCLN(UPDATE_FUNC_ARGS) {
} }
if (!parts[i].ctype) if (!parts[i].ctype)
{ {
for (nx=-1; nx<2; nx++) int rx, ry;
for (ny=-1; ny<2; ny++) for (rx=-1; rx<2; rx++)
if (x+nx>=0 && y+ny>0 && for (ry=-1; ry<2; ry++)
x+nx<XRES && y+ny<YRES && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES &&
pmap[y+ny][x+nx] && pmap[y+ry][x+rx] &&
(pmap[y+ny][x+nx]&0xFF)!=PT_CLNE && (pmap[y+ry][x+rx]&0xFF)!=PT_CLNE &&
(pmap[y+ny][x+nx]&0xFF)!=PT_BCLN && (pmap[y+ry][x+rx]&0xFF)!=PT_BCLN &&
(pmap[y+ny][x+nx]&0xFF)!=PT_PCLN && (pmap[y+ry][x+rx]&0xFF)!=PT_PCLN &&
(pmap[y+ny][x+nx]&0xFF)!=PT_STKM && (pmap[y+ry][x+rx]&0xFF)!=PT_STKM &&
(pmap[y+ny][x+nx]&0xFF)!=PT_STKM2 && (pmap[y+ry][x+rx]&0xFF)!=PT_STKM2 &&
(pmap[y+ny][x+nx]&0xFF)!=0xFF) (pmap[y+ry][x+rx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ny][x+nx]&0xFF; parts[i].ctype = pmap[y+ry][x+rx]&0xFF;
} }
else { else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);

View File

@ -1,23 +1,20 @@
#include <powder.h> #include <powder.h>
int update_BCOL(UPDATE_FUNC_ARGS) { int update_BCOL(UPDATE_FUNC_ARGS) {
int r; int r, rx, ry;
if (parts[i].life<=0) { if (parts[i].life<=0) {
parts[i].type = PT_NONE; create_part(i, x, y, PT_FIRE);
kill_part(i);
create_part(-1, x, y, PT_FIRE);
return 1; return 1;
} else if (parts[i].life < 100) { } else if (parts[i].life < 100) {
parts[i].life--; parts[i].life--;
create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
} }
for (nx=-2; nx<3; nx++) for (rx=-2; rx<3; rx++)
for (ny=-2; ny<3; ny++) for (ry=-2; ry<3; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))

View File

@ -1,26 +1,26 @@
#include <powder.h> #include <powder.h>
int update_BMTL(UPDATE_FUNC_ARGS) { int update_BMTL(UPDATE_FUNC_ARGS) {
int r, rt; int r, rx, ry, rt;
if (parts[i].tmp>1) { if (parts[i].tmp>1) {
parts[i].tmp--; parts[i].tmp--;
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
rt =parts[r>>8].type; rt = parts[r>>8].type;
if ((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100))) if ((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100)))
{ {
parts[r>>8].type=PT_BMTL; part_change_type(r>>8,x+rx,y+ry,PT_BMTL);
parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100; parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
} }
} }
} else if (parts[i].tmp==1 && 1>rand()%1000) { } else if (parts[i].tmp==1 && 1>rand()%1000) {
parts[i].tmp = 0; parts[i].tmp = 0;
parts[i].type = PT_BRMT; part_change_type(i,x,y,PT_BRMT);
} }
return 0; return 0;
} }

View File

@ -1,29 +1,29 @@
#include <powder.h> #include <powder.h>
int update_BOMB(UPDATE_FUNC_ARGS) { int update_BOMB(UPDATE_FUNC_ARGS) {
int r, nb; int r, rx, ry, nb;
if (parts[i].tmp==1) { if (parts[i].tmp==1) {
for (nx=-2; nx<3; nx++) for (rx=-2; rx<3; rx++)
for (ny=-2; ny<3; ny++) for (ry=-2; ry<3; ry++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if (parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB) { if ((r&0xFF)!=PT_BOMB) {
parts[i].type = PT_NONE; kill_part(i);
return 1; return 1;
} }
} }
} else if (parts[i].tmp==0) { } else if (parts[i].tmp==0) {
for (nx=-2; nx<3; nx++) for (rx=-2; rx<3; rx++)
for (ny=-2; ny<3; ny++) for (ry=-2; ry<3; ry++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if (parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB && parts[r>>8].type!=PT_DMND && parts[r>>8].type!=PT_CLNE && parts[r>>8].type!=PT_PCLN && parts[r>>8].type!=PT_BCLN) { if ((r&0xFF)!=PT_BOMB && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_BCLN) {
int rad = 8; int rad = 8;
int nxi; int nxi;
int nxj; int nxj;
@ -55,7 +55,7 @@ int update_BOMB(UPDATE_FUNC_ARGS) {
} }
//create_parts(x, y, 9, 9, PT_BOMB); //create_parts(x, y, 9, 9, PT_BOMB);
//create_parts(x, y, 8, 8, PT_NONE); //create_parts(x, y, 8, 8, PT_NONE);
parts[i].type = PT_NONE; kill_part(i);
return 1; return 1;
} }
} }

View File

@ -3,18 +3,18 @@
int update_CLNE(UPDATE_FUNC_ARGS) { int update_CLNE(UPDATE_FUNC_ARGS) {
if (!parts[i].ctype) if (!parts[i].ctype)
{ {
for (nx=-1; nx<2; nx++) int rx, ry;
for (ny=-1; ny<2; ny++) for (rx=-1; rx<2; rx++)
if (x+nx>=0 && y+ny>0 && for (ry=-1; ry<2; ry++)
x+nx<XRES && y+ny<YRES && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES &&
pmap[y+ny][x+nx] && pmap[y+ry][x+rx] &&
(pmap[y+ny][x+nx]&0xFF)!=PT_CLNE && (pmap[y+ry][x+rx]&0xFF)!=PT_CLNE &&
(pmap[y+ny][x+nx]&0xFF)!=PT_BCLN && (pmap[y+ry][x+rx]&0xFF)!=PT_BCLN &&
(pmap[y+ny][x+nx]&0xFF)!=PT_PCLN && (pmap[y+ry][x+rx]&0xFF)!=PT_PCLN &&
(pmap[y+ny][x+nx]&0xFF)!=PT_STKM && (pmap[y+ry][x+rx]&0xFF)!=PT_STKM &&
(pmap[y+ny][x+nx]&0xFF)!=PT_STKM2 && (pmap[y+ry][x+rx]&0xFF)!=PT_STKM2 &&
(pmap[y+ny][x+nx]&0xFF)!=0xFF) (pmap[y+ry][x+rx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ny][x+nx]&0xFF; parts[i].ctype = pmap[y+ry][x+rx]&0xFF;
} }
else { else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);

View File

@ -1,42 +1,41 @@
#include <powder.h> #include <powder.h>
int update_PLNT(UPDATE_FUNC_ARGS) { int update_PLNT(UPDATE_FUNC_ARGS) {
int r; int r, rx, ry, np;
for (nx=-2; nx<3; nx++) for (rx=-2; rx<3; rx++)
for (ny=-2; ny<3; ny++) for (ry=-2; ry<3; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if ((r&0xFF)==PT_WATR && 1>(rand()%250)) if ((r&0xFF)==PT_WATR && 1>(rand()%250))
{ {
parts[i].type = PT_PLNT; np = create_part(r>>8,x+rx,y+ry,PT_PLNT);
parts[r>>8].type = PT_PLNT; if (np<0) continue;
parts[r>>8].life = 0; parts[np].life = 0;
} }
else if ((r&0xFF)==PT_LAVA && 1>(rand()%250)) else if ((r&0xFF)==PT_LAVA && 1>(rand()%250))
{ {
part_change_type(i,x,y,PT_FIRE);
parts[i].life = 4; parts[i].life = 4;
parts[i].type = PT_FIRE;
} }
else if ((r&0xFF)==PT_SMKE && (1>rand()%250)) else if ((r&0xFF)==PT_SMKE && (1>rand()%250))
{ {
parts[r>>8].type = PT_NONE; kill_part(r>>8);
parts[i].life = rand()%60 + 60; parts[i].life = rand()%60 + 60;
} }
else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE) else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE)
{ {
int nnx = rand()%3 -1; int nnx = rand()%3 -1;
int nny = rand()%3 -1; int nny = rand()%3 -1;
if (x+nx+nnx>=0 && y+ny+nny>0 && if (x+rx+nnx>=0 && y+ry+nny>0 && x+rx+nnx<XRES && y+ry+nny<YRES && (nnx || nny))
x+nx+nnx<XRES && y+ny+nny<YRES && (nnx || nny))
{ {
if ((pmap[y+ny+nny][x+nx+nnx]>>8)>=NPART||pmap[y+ny+nny][x+nx+nnx]) if ((pmap[y+ry+nny][x+rx+nnx]>>8)>=NPART||pmap[y+ry+nny][x+rx+nnx])
continue; continue;
if (create_part(-1,x+nx+nnx,y+ny+nny,PT_VINE)) np = create_part(-1,x+rx+nnx,y+ry+nny,PT_VINE);
parts[pmap[y+ny+nny][x+nx+nnx]>>8].temp = parts[i].temp; if (np<0) continue;
parts[np].temp = parts[i].temp;
} }
} }
//if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
@ -44,16 +43,15 @@ int update_PLNT(UPDATE_FUNC_ARGS) {
} }
if (parts[i].life==2) if (parts[i].life==2)
{ {
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART) if ((r>>8)>=NPART)
continue; continue;
if (!r) if (!r)
create_part(-1,x+nx,y+ny,PT_O2); create_part(-1,x+rx,y+ry,PT_O2);
} }
parts[i].life = 0; parts[i].life = 0;
} }

View File

@ -1,28 +1,27 @@
#include <powder.h> #include <powder.h>
int update_PRTI(UPDATE_FUNC_ARGS) { int update_PRTI(UPDATE_FUNC_ARGS) {
int r, nnx; int r, nnx, rx, ry;
int count =0; int count =0;
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1); parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
for (ny=-1; ny<2; ny++) for (rx=-1; rx<2; rx++)
for (nx=-1; nx<2; nx++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ry][x+rx];
count ++; count ++;
r = pmap[y+ny][x+nx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if (parts[r>>8].type==PT_SPRK || (parts[r>>8].type!=PT_PRTI && parts[r>>8].type!=PT_PRTO && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS))) if ((r&0xFF)==PT_SPRK || ((r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO && (ptypes[r&0xFF].falldown!= 0 || pstates[r&0xFF].state == ST_GAS)))
for ( nnx=0; nnx<80; nnx++) for ( nnx=0; nnx<80; nnx++)
if (!portal[parts[i].tmp][count-1][nnx]) if (!portal[parts[i].tmp][count-1][nnx])
{ {
portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type; portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type;
portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp; portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp;
if (parts[r>>8].type==PT_SPRK) if (parts[r>>8].type==PT_SPRK)
parts[r>>8].type = parts[r>>8].ctype; part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype);
else else
parts[r>>8].type = PT_NONE; kill_part(r>>8);
break; break;
} }
} }

View File

@ -1,16 +1,15 @@
#include <powder.h> #include <powder.h>
int update_PRTO(UPDATE_FUNC_ARGS) { int update_PRTO(UPDATE_FUNC_ARGS) {
int r, nnx; int r, nnx, rx, ry, np;
int count = 0; int count = 0;
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1); parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
for (ny=1; ny>-2; ny--) for (rx=-1; rx<2; rx++)
for (nx=1; nx>-2; nx--) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ry][x+rx];
count ++; count ++;
r = pmap[y+ny][x+nx];
if ((r>>8)>=NPART || r) if ((r>>8)>=NPART || r)
continue; continue;
if (!r) if (!r)
@ -22,7 +21,7 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
randomness=1; randomness=1;
if (randomness>8) if (randomness>8)
randomness=8; randomness=8;
if (portal[parts[i].tmp][randomness-1][nnx]==PT_SPRK)//todo. make it look better if (portal[parts[i].tmp][randomness-1][nnx]==PT_SPRK)// TODO: make it look better
{ {
create_part(-1,x+1,y,portal[parts[i].tmp][randomness-1][nnx]); create_part(-1,x+1,y,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x+1,y+1,portal[parts[i].tmp][randomness-1][nnx]); create_part(-1,x+1,y+1,portal[parts[i].tmp][randomness-1][nnx]);
@ -38,8 +37,9 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
} }
else if (portal[parts[i].tmp][randomness-1][nnx]) else if (portal[parts[i].tmp][randomness-1][nnx])
{ {
create_part(-1,x+nx,y+ny,portal[parts[i].tmp][randomness-1][nnx]); np = create_part(-1,x+rx,y+ry,portal[parts[i].tmp][randomness-1][nnx]);
parts[pmap[y+ny][x+nx]>>8].temp = portaltemp[parts[i].tmp][randomness-1][nnx]; if (np<0) continue;
parts[np].temp = portaltemp[parts[i].tmp][randomness-1][nnx];
portal[parts[i].tmp][randomness-1][nnx] = 0; portal[parts[i].tmp][randomness-1][nnx] = 0;
portaltemp[parts[i].tmp][randomness-1][nnx] = 0; portaltemp[parts[i].tmp][randomness-1][nnx] = 0;
break; break;

View File

@ -1,7 +1,7 @@
#include <powder.h> #include <powder.h>
int update_PUMP(UPDATE_FUNC_ARGS) { int update_PUMP(UPDATE_FUNC_ARGS) {
int r; int r, rx, ry;
if (parts[i].life==10) if (parts[i].life==10)
{ {
if (parts[i].temp>=256.0+273.15) if (parts[i].temp>=256.0+273.15)
@ -19,12 +19,11 @@ int update_PUMP(UPDATE_FUNC_ARGS) {
if (y+CELL<YRES) if (y+CELL<YRES)
pv[y/CELL+1][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL+1]); pv[y/CELL+1][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL+1]);
} }
for (nx=-2; nx<3; nx++) for (rx=-2; rx<3; rx++)
for (ny=-2; ny<3; ny++) for (ry=-2; ry<3; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if ((r&0xFF)==PT_PUMP) if ((r&0xFF)==PT_PUMP)

View File

@ -1,26 +1,24 @@
#include <powder.h> #include <powder.h>
int update_RIME(UPDATE_FUNC_ARGS) { int update_RIME(UPDATE_FUNC_ARGS) {
int r, rt; int r, rx, ry;
parts[i].vx = 0; parts[i].vx = 0;
parts[i].vy = 0; parts[i].vy = 0;
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
rt = parts[r>>8].type; if ((r&0xFF)==PT_SPRK)
if (rt==PT_SPRK)
{ {
parts[i].type = PT_FOG; part_change_type(i,x,y,PT_FOG);
parts[i].life = rand()%50 + 60; parts[i].life = rand()%50 + 60;
} }
else if (rt==PT_FOG&&parts[r>>8].life>0) else if ((r&0xFF)==PT_FOG&&parts[r>>8].life>0)
{ {
parts[i].type = PT_FOG; part_change_type(i,x,y,PT_FOG);
parts[i].life = parts[r>>8].life; parts[i].life = parts[r>>8].life;
} }
} }

View File

@ -1,33 +1,34 @@
#include <powder.h> #include <powder.h>
int update_SHLD1(UPDATE_FUNC_ARGS) { int update_SHLD1(UPDATE_FUNC_ARGS) {
int r, nnx, nny; int r, nnx, nny, rx, ry;
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
else if (parts[r>>8].type==PT_SPRK&&parts[i].life==0) else if ((r&0xFF)==PT_SPRK&&parts[i].life==0)
{
if (55>rand()%200&&parts[i].life==0)
{
part_change_type(i,x,y,PT_SHLD2);
parts[i].life = 7;
}
for ( nnx=-1; nnx<2; nnx++) for ( nnx=-1; nnx<2; nnx++)
for ( nny=-1; nny<2; nny++) for ( nny=-1; nny<2; nny++)
{ {
if (7>rand()%200&&parts[i].life==0) if (!pmap[y+ry+nny][x+rx+nnx])
{ {
parts[i].type = PT_SHLD2; create_part(-1,x+rx+nnx,y+ry+nny,PT_SHLD1);
parts[i].life = 7;
}
else if (!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
//parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7; //parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
} }
} }
else if (parts[r>>8].type==PT_SHLD3&&4>rand()%10) }
else if ((r&0xFF)==PT_SHLD3&&4>rand()%10)
{ {
parts[i].type=PT_SHLD2; part_change_type(i,x,y,PT_SHLD2);
parts[i].life = 7; parts[i].life = 7;
} }
} }
@ -35,37 +36,39 @@ int update_SHLD1(UPDATE_FUNC_ARGS) {
} }
int update_SHLD2(UPDATE_FUNC_ARGS) { int update_SHLD2(UPDATE_FUNC_ARGS) {
int r, nnx, nny; int r, nnx, nny, rx, ry, np;
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART) if ((r>>8)>=NPART)
continue; continue;
if (!r && parts[i].life>0) if (!r && parts[i].life>0)
create_part(-1,x+nx,y+ny,PT_SHLD1); create_part(-1,x+rx,y+ry,PT_SHLD1);
if (!r) if (!r)
continue; continue;
else if (parts[r>>8].type==PT_SPRK&&parts[i].life==0) else if ((r&0xFF)==PT_SPRK&&parts[i].life==0)
{
if (25>rand()%200&&parts[i].life==0)
{
part_change_type(i,x,y,PT_SHLD3);
parts[i].life = 7;
}
for ( nnx=-1; nnx<2; nnx++) for ( nnx=-1; nnx<2; nnx++)
for ( nny=-1; nny<2; nny++) for ( nny=-1; nny<2; nny++)
{ {
if (3>rand()%200&&parts[i].life==0) if (!pmap[y+ry+nny][x+rx+nnx])
{ {
parts[i].type = PT_SHLD3; np = create_part(-1,x+rx+nnx,y+ry+nny,PT_SHLD1);
parts[i].life = 7; if (np<0) continue;
} parts[np].life=7;
else if (!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
} }
} }
else if (parts[r>>8].type==PT_SHLD4&&4>rand()%10) }
else if ((r&0xFF)==PT_SHLD4&&4>rand()%10)
{ {
parts[i].type=PT_SHLD3; part_change_type(i,x,y,PT_SHLD3);
parts[i].life = 7; parts[i].life = 7;
} }
} }
@ -73,45 +76,49 @@ int update_SHLD2(UPDATE_FUNC_ARGS) {
} }
int update_SHLD3(UPDATE_FUNC_ARGS) { int update_SHLD3(UPDATE_FUNC_ARGS) {
int r, nnx, nny; int r, nnx, nny, rx, ry, np;
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART) if ((r>>8)>=NPART)
continue; continue;
if (!r) if (!r)
{ {
if (1>rand()%2500) if (1>rand()%2500)
{ {
create_part(-1,x+nx,y+ny,PT_SHLD1); np = create_part(-1,x+rx,y+ry,PT_SHLD1);
parts[pmap[y+ny][x+nx]>>8].life=7; if (np<0) continue;
parts[i].type = PT_SHLD2; parts[np].life=7;
part_change_type(i,x,y,PT_SHLD2);
} }
else else
continue; continue;
} }
if (parts[r>>8].type==PT_SHLD1 && parts[i].life>3) if ((r&0xFF)==PT_SHLD1 && parts[i].life>3)
{ {
parts[r>>8].type = PT_SHLD2; part_change_type(r>>8,x+rx,y+ry,PT_SHLD2);
parts[r>>8].life=7; parts[r>>8].life=7;
} }
else if (parts[r>>8].type==PT_SPRK&&parts[i].life==0) else if ((r&0xFF)==PT_SPRK&&parts[i].life==0)
{
if (18>rand()%3000&&parts[i].life==0)
{
part_change_type(i,x,y,PT_SHLD4);
parts[i].life = 7;
}
for ( nnx=-1; nnx<2; nnx++) for ( nnx=-1; nnx<2; nnx++)
for ( nny=-1; nny<2; nny++) for ( nny=-1; nny<2; nny++)
{ {
if (2>rand()%3000&&parts[i].life==0)
if (!pmap[y+ry+nny][x+rx+nnx])
{ {
parts[i].type = PT_SHLD4; np = create_part(-1,x+rx+nnx,y+ry+nny,PT_SHLD1);
parts[i].life = 7; if (np<0) continue;
parts[np].life=7;
} }
else if (!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
} }
} }
} }
@ -119,40 +126,41 @@ int update_SHLD3(UPDATE_FUNC_ARGS) {
} }
int update_SHLD4(UPDATE_FUNC_ARGS) { int update_SHLD4(UPDATE_FUNC_ARGS) {
int r, nnx, nny; int r, nnx, nny, rx, ry, np;
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART) if ((r>>8)>=NPART)
continue; continue;
if (!r) if (!r)
{ {
if (1>rand()%5500) if (1>rand()%5500)
{ {
create_part(-1,x+nx,y+ny,PT_SHLD1); np = create_part(-1,x+rx,y+ry,PT_SHLD1);
parts[pmap[y+ny][x+nx]>>8].life=7; if (np<0) continue;
parts[i].type = PT_SHLD2; parts[np].life=7;
part_change_type(i,x,y,PT_SHLD2);
} }
else else
continue; continue;
} }
if (parts[r>>8].type==PT_SHLD2 && parts[i].life>3) if ((r&0xFF)==PT_SHLD2 && parts[i].life>3)
{ {
parts[r>>8].type = PT_SHLD3; part_change_type(r>>8,x+rx,y+ry,PT_SHLD3);
parts[r>>8].life = 7; parts[r>>8].life = 7;
} }
else if (parts[r>>8].type==PT_SPRK&&parts[i].life==0) else if ((r&0xFF)==PT_SPRK&&parts[i].life==0)
for ( nnx=-1; nnx<2; nnx++) for ( nnx=-1; nnx<2; nnx++)
for ( nny=-1; nny<2; nny++) for ( nny=-1; nny<2; nny++)
{ {
if (!pmap[y+ny+nny][x+nx+nnx]) if (!pmap[y+ry+nny][x+rx+nnx])
{ {
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1); np = create_part(-1,x+rx+nnx,y+ry+nny,PT_SHLD1);
parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7; if (np<0) continue;
parts[np].life=7;
} }
} }
} }

View File

@ -1,7 +1,7 @@
#include <powder.h> #include <powder.h>
int update_SING(UPDATE_FUNC_ARGS) { int update_SING(UPDATE_FUNC_ARGS) {
int r; int r, rx, ry;
int singularity = -parts[i].life; int singularity = -parts[i].life;
if (pv[y/CELL][x/CELL]<singularity) if (pv[y/CELL][x/CELL]<singularity)
@ -22,17 +22,16 @@ int update_SING(UPDATE_FUNC_ARGS) {
if (y+CELL>0) if (y+CELL>0)
pv[y/CELL-1][x/CELL-1] += 0.1f*(singularity-pv[y/CELL-1][x/CELL-1]); pv[y/CELL-1][x/CELL-1] += 0.1f*(singularity-pv[y/CELL-1][x/CELL-1]);
} }
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
x+nx<XRES && y+ny<YRES && (nx || ny))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if (parts[r>>8].type!=PT_DMND&&33>=rand()/(RAND_MAX/100)+1) if ((r&0xFF)!=PT_DMND&&33>=rand()/(RAND_MAX/100)+1)
{ {
if (parts[r>>8].type==PT_SING && parts[r>>8].life >10) if ((r&0xFF)==PT_SING && parts[r>>8].life >10)
{ {
if (parts[i].life+parts[r>>8].life > 255) if (parts[i].life+parts[r>>8].life > 255)
continue; continue;
@ -44,15 +43,16 @@ int update_SING(UPDATE_FUNC_ARGS) {
{ {
if (parts[r>>8].type!=PT_SING && 1>rand()%100) if (parts[r>>8].type!=PT_SING && 1>rand()%100)
{ {
parts[r>>8].type = PT_SING; int np;
parts[r>>8].life = rand()%50+60; np = create_part(r>>8,x+rx,y+ry,PT_SING);
parts[np].life = rand()%50+60;
} }
continue; continue;
} }
parts[i].life += 3; parts[i].life += 3;
} }
parts[i].temp = restrict_flt(parts[r>>8].temp+parts[i].temp, MIN_TEMP, MAX_TEMP); parts[i].temp = restrict_flt(parts[r>>8].temp+parts[i].temp, MIN_TEMP, MAX_TEMP);
parts[r>>8].type=PT_NONE; kill_part(r>>8);
} }
} }
return 0; return 0;

View File

@ -1,75 +1,75 @@
#include <powder.h> #include <powder.h>
int update_SPNG(UPDATE_FUNC_ARGS) { int update_SPNG(UPDATE_FUNC_ARGS) {
int r, trade; int r, trade, rx, ry, tmp;
if (pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3) if (pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3&&parts[i].temp<=374.0f)
{ {
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r || parts[i].temp>374.0f) if ((r>>8)>=NPART || !r || parts[i].temp>374.0f)
continue; continue;
if (parts[r>>8].type==PT_WATR&&33>=rand()/(RAND_MAX/100)+1) if ((r&0xFF)==PT_WATR&&33>=rand()/(RAND_MAX/100)+1)
{ {
parts[i].life++; parts[i].life++;
parts[r>>8].type=PT_NONE; kill_part(r>>8);
} }
} }
} }
else else
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART) if ((r>>8)>=NPART)
continue; continue;
if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL|| if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_EWALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||
bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS)) bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWAIR||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWGAS))
continue; continue;
if ((!r)&&parts[i].life>=1)//if nothing then create water if ((!r)&&parts[i].life>=1)//if nothing then create water
{ {
create_part(-1,x+nx,y+ny,PT_WATR); create_part(-1,x+rx,y+ry,PT_WATR);
parts[i].life--; parts[i].life--;
} }
} }
for ( trade = 0; trade<9; trade ++) for ( trade = 0; trade<9; trade ++)
{ {
nx = rand()%5-2; rx = rand()%5-2;
ny = rand()%5-2; ry = rand()%5-2;
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if (parts[r>>8].type==PT_SPNG&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion if ((r&0xFF)==PT_SPNG&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
{ {
int temp = parts[i].life - parts[r>>8].life; tmp = parts[i].life - parts[r>>8].life;
if (temp ==1) if (tmp ==1)
{ {
parts[r>>8].life ++; parts[r>>8].life ++;
parts[i].life --; parts[i].life --;
trade = 9; trade = 9;
} }
else if (temp>0) else if (tmp>0)
{ {
parts[r>>8].life += temp/2; parts[r>>8].life += tmp/2;
parts[i].life -= temp/2; parts[i].life -= tmp/2;
trade = 9; trade = 9;
} }
} }
} }
} }
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)
continue; continue;
if (parts[r>>8].type==PT_FIRE&&parts[i].life>0) if ((r&0xFF)==PT_FIRE&&parts[i].life>0)
{ {
if (parts[i].life<=2) if (parts[i].life<=2)
parts[i].life --; parts[i].life --;
@ -77,18 +77,18 @@ int update_SPNG(UPDATE_FUNC_ARGS) {
} }
} }
if (parts[i].temp>=374) if (parts[i].temp>=374)
for (nx=-1; nx<2; nx++) for (rx=-1; rx<2; rx++)
for (ny=-1; ny<2; ny++) for (ry=-1; ry<2; ry++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ny][x+nx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART) if ((r>>8)>=NPART)
continue; continue;
if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWLIQUID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID)) if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWLIQUID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID))
continue; continue;
if ((!r)&&parts[i].life>=1)//if nothing then create steam if ((!r)&&parts[i].life>=1)//if nothing then create steam
{ {
create_part(-1,x+nx,y+ny,PT_WTRV); create_part(-1,x+rx,y+ry,PT_WTRV);
parts[i].life--; parts[i].life--;
parts[i].temp -= 40.0f; parts[i].temp -= 40.0f;
} }

View File

@ -12,22 +12,10 @@ int update_WIFI(UPDATE_FUNC_ARGS) {
continue; continue;
if (wireless[parts[i].tmp][0]) if (wireless[parts[i].tmp][0])
{ {
if ((r&0xFF)==PT_NSCN&&parts[r>>8].life==0 && wireless[parts[i].tmp][0]) if (((r&0xFF)==PT_NSCN||(r&0xFF)==PT_PSCN||(r&0xFF)==PT_INWR)&&parts[r>>8].life==0 && wireless[parts[i].tmp][0])
{ {
parts[r>>8].ctype = r&0xFF;
part_change_type(r>>8,x+rx,y+ry,PT_SPRK); part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
parts[r>>8].ctype = PT_NSCN;
parts[r>>8].life = 4;
}
else if ((r&0xFF)==PT_PSCN&&parts[r>>8].life==0 && wireless[parts[i].tmp][0])
{
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
parts[r>>8].ctype = PT_PSCN;
parts[r>>8].life = 4;
}
else if ((r&0xFF)==PT_INWR&&parts[r>>8].life==0 && wireless[parts[i].tmp][0])
{
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
parts[r>>8].ctype = PT_INWR;
parts[r>>8].life = 4; parts[r>>8].life = 4;
} }
} }