diff options
| author | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-07 16:18:22 (GMT) |
|---|---|---|
| committer | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-07 16:18:22 (GMT) |
| commit | f3ded5f08c0bbb3523a0ab2ee6e07538fabd79c2 (patch) | |
| tree | 804bfff0e558daf780b4330db417e93e2ef695a2 /src/powder.c | |
| parent | b661418d7ecd44960f0e24eb7abd79cfc5eb5f0e (diff) | |
| download | powder-f3ded5f08c0bbb3523a0ab2ee6e07538fabd79c2.zip powder-f3ded5f08c0bbb3523a0ab2ee6e07538fabd79c2.tar.gz | |
More function pointers.
Diffstat (limited to 'src/powder.c')
| -rw-r--r-- | src/powder.c | 897 |
1 files changed, 5 insertions, 892 deletions
diff --git a/src/powder.c b/src/powder.c index 8bd89d5..5345eea 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1610,7 +1610,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].life = rand()%50+120; } } - + s = 1; if (pv[y/CELL][x/CELL]>ptransitions[t].phv&&ptransitions[t].pht>-1) { if (ptransitions[t].pht!=PT_NUM) @@ -1638,7 +1638,7 @@ void update_particles_i(pixel *vid, int start, int inc) goto killed; } } - + if (t==PT_GLAS) { parts[i].pavg[0] = parts[i].pavg[1]; @@ -1876,39 +1876,8 @@ void update_particles_i(pixel *vid, int start, int inc) set_emap(nx, ny); fe = 0; - if (t==PT_THDR) - { - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT || (r&0xFF)==PT_NBLE || (r&0xFF)==PT_INWR) && parts[r>>8].ctype!=PT_SPRK) - { - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - } - else if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) - { - pv[y/CELL][x/CELL] += 100.0f; - if (legacy_enable&&1>(rand()%200)) - { - parts[i].life = rand()%50+120; - t = parts[i].type = PT_FIRE; - } - else - { - t = parts[i].type = PT_NONE; - } - } - } - } - else if (t==PT_ICEI || t==PT_SNOW) + + if (t==PT_ICEI || t==PT_SNOW) { if (parts[i].ctype==PT_FRZW) { @@ -1942,50 +1911,6 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if (t==PT_BMTL) { - if (parts[i].tmp>1) { - parts[i].tmp--; - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - rt =parts[r>>8].type; - if ((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100))) - { - parts[r>>8].type=PT_BMTL; - 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) { - parts[i].tmp = 0; - t = parts[i].type = PT_BRMT; - } - } - - else if (t==PT_IRON) { - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if ((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) || - ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) || - ((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) || - ((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) || - ((r&0xFF) == PT_LO2))&& - (!(parts[i].life)) - ) - { - parts[i].type=PT_BMTL; - parts[i].tmp=(rand()/(RAND_MAX/10))+20; - } - } - } else if ((t==PT_SPRK||parts[i].type==PT_SPRK) && parts[i].ctype==PT_IRON) { for (nx=-1; nx<2; nx++) for (ny=-1; ny<2; ny++) @@ -2003,217 +1928,6 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if (t==PT_COAL) - { - if (parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - create_part(-1, x, y, PT_FIRE); - goto killed; - } else if (parts[i].life < 100) { - parts[i].life--; - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); - } - if ((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40) - parts[i].tmp=39; - else if (parts[i].tmp<40&&parts[i].tmp>0) - parts[i].tmp--; - else if (parts[i].tmp<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_BCOL); - goto killed; - } - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) - { - if (parts[i].life>100) { - parts[i].life = 99; - } - } - } - } - else if (t==PT_BCOL) - { - if (parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - create_part(-1, x, y, PT_FIRE); - goto killed; - } else if (parts[i].life < 100) { - parts[i].life--; - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); - } - - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) - { - if (parts[i].life>100) { - parts[i].life = 99; - } - } - } - } - else if (t==PT_ARAY && parts[i].life==0) { - int colored =0; - for (nx=-1; nx<2; nx++) { - for (ny=-1; ny<2; ny++) { - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if ((r&0xFF)==PT_SPRK) { - int destroy = (parts[r>>8].ctype==PT_PSCN)?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) { - if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) { - break; - } - r = pmap[y+nyi+nyy][x+nxi+nxx]; - if (!((r>>8)>=NPART)) { - if (!r) { - int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY); - if (nr!=-1) { - if (destroy) { - parts[nr].tmp = 2; - parts[nr].life = 2; - } else - parts[nr].ctype = colored; - } - } else if (!destroy) { - if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0) { - if (nyy!=0 || nxx!=0) { - parts[r>>8].type = PT_BRAY; - parts[r>>8].life = 1020; - parts[r>>8].tmp = 1; - if (!parts[r>>8].ctype) - parts[r>>8].ctype = colored; - } - docontinue = 0; - } else if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1) { - parts[r>>8].life = 1020; - //docontinue = 1; - } - else if (parts[r>>8].type==PT_FILT) { - 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) { - if (nyy!=0 || nxx!=0) { - create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK); - } - if (!(nostop && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))) { - docontinue = 0; - } else { - docontinue = 1; - } - } - } else if (destroy) { - if (parts[r>>8].type==PT_BRAY) { - parts[r>>8].life = 1; - docontinue = 1; - } else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI) { - docontinue = 1; - } else { - docontinue = 0; - } - } - } - } - } - //parts[i].life = 4; - } - } - } - } - else if (t==PT_FUSE) - { - if (parts[i].life<=0) { - //t = parts[i].life = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - if (r!=-1) - parts[r].life = 50; - goto killed; - } else if (parts[i].life < 40) { - parts[i].life--; - if ((rand()%100)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - if (r!=-1) - parts[r].life = 50; - } - } - if ((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40) - parts[i].tmp=39; - else if (parts[i].tmp<40&&parts[i].tmp>0) - parts[i].tmp--; - else if (parts[i].tmp<=0) { - //t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_FSEP); - goto killed; - } - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if ((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20))) - { - if (parts[i].life>40) { - parts[i].life = 39; - } - } - } - } - else if (t==PT_FSEP) - { - if (parts[i].life<=0) { - //t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - if (r!=-1) - parts[r].life = 50; - goto killed; - } else if (parts[i].life < 40) { - parts[i].life--; - if ((rand()%10)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - if (r!=-1) - parts[r].life = 50; - } - } - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15)) - { - if (parts[i].life>40) { - parts[i].life = 39; - } - } - } - } else if (t==PT_NTCT||t==PT_PTCT||t==PT_INWR) { for (nx=-2; nx<3; nx++) @@ -2230,210 +1944,6 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if (t==PT_PLNT) - { - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if ((r&0xFF)==PT_WATR && 1>(rand()%250)) - { - t = parts[i].type = PT_PLNT; - parts[r>>8].type = PT_PLNT; - parts[r>>8].life = 0; - } - else if ((r&0xFF)==PT_LAVA && 1>(rand()%250)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - else if ((r&0xFF)==PT_SMKE && (1>rand()%250)) - { - parts[r>>8].type = PT_NONE; - parts[i].life = rand()%60 + 60; - } - else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE) - { - int nnx = rand()%3 -1; - int nny = rand()%3 -1; - if (x+nx+nnx>=0 && y+ny+nny>0 && - 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]) - continue; - if (create_part(-1,x+nx+nnx,y+ny+nny,PT_VINE)) - parts[pmap[y+ny+nny][x+nx+nnx]>>8].temp = parts[i].temp; - } - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - if (parts[i].life==2) - { - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART) - continue; - if (!r) - create_part(-1,x+nx,y+ny,PT_O2); - } - parts[i].life = 0; - } - } - else if (t==PT_VINE) - { - nx=(rand()%3)-1; - ny=(rand()%3)-1; - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART) - continue; - if (1>rand()%15) - parts[i].type=PT_PLNT; - else if (!r) - { - create_part(-1,x+nx,y+ny,PT_VINE); - parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp; - parts[i].type=PT_PLNT; - } - } - } - else if (t==PT_THRM) - { - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA)) - { - if (1>(rand()%500)) { - t = parts[i].type = PT_LAVA; - parts[i].ctype = PT_BMTL; - pt = parts[i].temp = 3500.0f; - pv[y/CELL][x/CELL] += 50.0f; - } else { - t = parts[i].type = PT_LAVA; - parts[i].life = 400; - parts[i].ctype = PT_THRM; - pt = parts[i].temp = 3500.0f; - parts[i].tmp = 20; - } - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if (t==PT_WATR||t==PT_DSTW) - { - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_WTRV; - } - else if ((r&0xFF)==PT_SALT && 1>(rand()%250)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if ((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_WATR; - } - if (((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_SLTW; - } - if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - if (((r&0xFF)==PT_CNCT&&t==PT_WATR) && 1>(rand()%500)) - { - t = parts[i].type = PT_PSTE; - parts[r>>8].type = PT_NONE; - } - } - } - else if (t==PT_SLTW) - { - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; - } - else if ((r&0xFF)==PT_SALT && 1>(rand()%10000)) - { - parts[r>>8].type = PT_NONE; - } - if ((r&0xFF)==PT_PLNT&&5>(rand()%1000)) - parts[r>>8].type = PT_NONE; - if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if (t==PT_WTRV) - { - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - parts[r>>8].type = PT_WATR; - } - - if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - if (((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - if (1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } - } - } else if (t==PT_YEST) { for (nx=-2; nx<3; nx++) @@ -2450,40 +1960,6 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if (t==PT_ACID) - { - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if ((r&0xFF)!=PT_ACID) - { - if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) - { - t = parts[i].type = PT_FIRE; - parts[i].life = 4; - parts[r>>8].type = PT_FIRE; - parts[r>>8].life = 4; - } - else if (((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) - { - if (parts_avg(i, r>>8,PT_GLAS)!= PT_GLAS) - { - parts[i].life--; - parts[r>>8].type = PT_NONE; - } - } - else if (parts[i].life<=50) - { - parts[i].life = 0; - t = parts[i].type = PT_NONE; - } - } - } - } else if (t==PT_NEUT) { rt = 3 + (int)pv[y/CELL][x/CELL]; @@ -2632,23 +2108,6 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if (t==PT_GLOW) - { - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (parts[r>>8].type==PT_WATR&&5>(rand()%2000)) - { - t = parts[i].type = PT_NONE; - parts[r>>8].type = PT_DEUT; - parts[r>>8].life = 10; - } - } - } else if (t==PT_MORT) { create_part(-1, x, y-1, PT_SMKE); } @@ -2664,216 +2123,7 @@ void update_particles_i(pixel *vid, int start, int inc) ISLOLZ=1; else if (t==PT_GRAV) ISGRAV=1; - else if (t==PT_SPNG) - { - if (pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3) - { - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r || parts[i].temp>374.0f) - continue; - if (parts[r>>8].type==PT_WATR&&33>=rand()/(RAND_MAX/100)+1) - { - parts[i].life++; - parts[r>>8].type=PT_NONE; - } - } - } - else - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART) - 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|| - 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)) - continue; - if ((!r)&&parts[i].life>=1)//if nothing then create water - { - create_part(-1,x+nx,y+ny,PT_WATR); - parts[i].life--; - } - } - for ( trade = 0; trade<9; trade ++) - { - nx = rand()%5-2; - ny = rand()%5-2; - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion - { - int temp = parts[i].life - parts[r>>8].life; - if (temp ==1) - { - parts[r>>8].life ++; - parts[i].life --; - trade = 9; - } - else if (temp>0) - { - parts[r>>8].life += temp/2; - parts[i].life -= temp/2; - trade = 9; - } - } - } - } - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (parts[r>>8].type==PT_FIRE&&parts[i].life>0) - { - if (parts[i].life<=2) - parts[i].life --; - parts[i].life -= parts[i].life/3; - } - } - if (parts[i].temp>=374) - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART) - 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)) - continue; - if ((!r)&&parts[i].life>=1)//if nothing then create steam - { - create_part(-1,x+nx,y+ny,PT_WTRV); - parts[i].life--; - parts[i].temp -= 40.0f; - } - } - } - else if (t==PT_FOG) - { - if (parts[i].temp>=373.15) - t = parts[i].type = PT_WTRV; - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (pstates[parts[r>>8].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>8].type==PT_CLNE||parts[r>>8].type==PT_PCLN)) - { - t = parts[i].type = PT_RIME; - } - if (parts[r>>8].type==PT_SPRK) - { - parts[i].life += rand()%20; - } - } - } - else if (t==PT_RIME) - { - parts[i].vx = 0; - parts[i].vy = 0; - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if (rt==PT_SPRK) - { - t = parts[i].type = PT_FOG; - parts[i].life = rand()%50 + 60; - } - else if (rt==PT_FOG&&parts[r>>8].life>0) - { - t = parts[i].type = PT_FOG; - parts[i].life = parts[r>>8].life; - } - } - } - else if (t==PT_DEUT) - { - int maxlife = ((10000/(parts[i].temp + 1))-1); - if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1)) - maxlife ++; - if (parts[i].life < maxlife) - { - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r || (parts[i].life >=maxlife)) - continue; - if (parts[r>>8].type==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1) - { - if ((parts[i].life + parts[r>>8].life + 1) <= maxlife) - { - parts[i].life += parts[r>>8].life + 1; - parts[r>>8].type=PT_NONE; - } - } - } - } - else - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || (parts[i].life<=maxlife)) - 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|| - 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)) - continue; - if ((!r)&&parts[i].life>=1)//if nothing then create deut - { - create_part(-1,x+nx,y+ny,PT_DEUT); - parts[i].life--; - parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp; - parts[pmap[y+ny][x+nx]>>8].life = 0; - } - } - for ( trade = 0; trade<4; trade ++) - { - nx = rand()%5-2; - ny = rand()%5-2; - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion - { - int temp = parts[i].life - parts[r>>8].life; - if (temp ==1) - { - parts[r>>8].life ++; - parts[i].life --; - } - else if (temp>0) - { - parts[r>>8].life += temp/2; - parts[i].life -= temp/2; - } - } - } - } - } + else if (t==PT_WARP) { for ( trade = 0; trade<5; trade ++) @@ -3067,143 +2317,6 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if (t==PT_PIPE) - { - if (!parts[i].ctype && parts[i].life<=10) - { - if (parts[i].temp<272.15) - { - if (parts[i].temp>173.25&&parts[i].temp<273.15) - { - parts[i].ctype = 2; - parts[i].life = 0; - } - if (parts[i].temp>73.25&&parts[i].temp<=173.15) - { - parts[i].ctype = 3; - parts[i].life = 0; - } - if (parts[i].temp>=0&&parts[i].temp<=73.15) - { - parts[i].ctype = 4; - parts[i].life = 0; - } - } - else - { - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART ) - continue; - if (!r) - create_part(-1,x+nx,y+ny,PT_BRCK); - } - if (parts[i].life==1) - parts[i].ctype = 1; - } - } - if (parts[i].ctype==1) - { - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART) - continue; - if (!r&&!parts[i].life) - parts[i].life=50; - } - if (parts[i].life==2) - { - parts[i].ctype = 2; - parts[i].life = 6; - } - } - if (parts[i].ctype>1) - for ( q = 0; q<3; q++) - for ( ctype = 2; ctype<5; ctype++) - { - if (parts[i].ctype==ctype) - { - if (parts[i].life==3) - { - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (parts[r>>8].type==PT_PIPE&&parts[r>>8].ctype==1) - { - parts[r>>8].ctype = (((ctype)%3)+2);//reverse - parts[r>>8].life = 6; - } - } - } - else - { - nx = rand()%3-1; - ny = rand()%3-1; - if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART) - continue; - else if (!r&&parts[i].tmp!=0) - { - if (create_part(-1,x+nx,y+ny,parts[i].tmp)) - { - parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;//pipe saves temp and life now - parts[pmap[y+ny][x+nx]>>8].life = parts[i].flags; - } - parts[i].tmp = 0; - continue; - } - else if (!r) - continue; - else if (parts[i].tmp == 0 && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS)) - { - parts[i].tmp = parts[r>>8].type; - parts[i].temp = parts[r>>8].temp; - parts[i].flags = parts[r>>8].life; - parts[r>>8].type = PT_NONE; - } - else if (parts[r>>8].type==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0) - { - parts[r>>8].tmp = parts[i].tmp; - parts[r>>8].temp = parts[i].temp; - parts[r>>8].flags = parts[i].flags; - parts[i].tmp = 0; - } - } - } - } - } - } - else if (t==PT_FRZZ) - { - for (nx=-1; nx<2; nx++) - for (ny=-1; ny<2; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) - { - r = pmap[y+ny][x+nx]; - if ((r>>8)>=NPART || !r) - continue; - if (parts[r>>8].type==PT_WATR&&5>rand()%100) - { - parts[r>>8].type=PT_FRZW; - parts[r>>8].life = 100; - t = parts[i].type = PT_NONE; - } - - } - } else if (t==PT_FRZW) { for (nx=-1; nx<2; nx++) |
