diff options
| author | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-11 13:44:52 (GMT) |
|---|---|---|
| committer | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-11 13:44:52 (GMT) |
| commit | 4006bdf4c22564e916092d6d63ae63d1fa6bc5b5 (patch) | |
| tree | 5cbe9ad22685a055f4d7849bd52afa0f9ab87f8d /src | |
| parent | cf1ef725847a5dc5c9e796a10ff840f65dc1e885 (diff) | |
| parent | b3735bb84b5d53014e7e20085007ef380cc7a3c1 (diff) | |
| download | powder-4006bdf4c22564e916092d6d63ae63d1fa6bc5b5.zip powder-4006bdf4c22564e916092d6d63ae63d1fa6bc5b5.tar.gz | |
Merge branch 'upstream' into dev
Diffstat (limited to 'src')
| -rw-r--r-- | src/elements/aray.c | 4 | ||||
| -rw-r--r-- | src/elements/boyl.c | 43 | ||||
| -rw-r--r-- | src/elements/neut.c | 8 | ||||
| -rw-r--r-- | src/elements/prti.c | 1 | ||||
| -rw-r--r-- | src/elements/prto.c | 2 | ||||
| -rw-r--r-- | src/elements/stkm.c | 5 | ||||
| -rw-r--r-- | src/elements/stkm2.c | 5 | ||||
| -rw-r--r-- | src/elements/swch.c | 8 | ||||
| -rw-r--r-- | src/graphics.c | 7 | ||||
| -rw-r--r-- | src/powder.c | 48 |
10 files changed, 108 insertions, 23 deletions
diff --git a/src/elements/aray.c b/src/elements/aray.c index 136158a..a931b1a 100644 --- a/src/elements/aray.c +++ b/src/elements/aray.c @@ -44,7 +44,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) { } else if ((r&0xFF)==PT_FILT) { colored = parts[r>>8].ctype; - } else if ((r&0xFF)!=PT_INWR && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI) { + } else if ((r&0xFF)!=PT_INWR && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI && !((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) { if (nyy!=0 || nxx!=0) { create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK); } @@ -58,7 +58,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) { 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) { + } else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI || parts[r>>8].type==PT_FILT || (parts[r>>8].type==PT_SWCH && parts[r>>8].life>=10)) { docontinue = 1; } else { docontinue = 0; diff --git a/src/elements/boyl.c b/src/elements/boyl.c new file mode 100644 index 0000000..7486d2e --- /dev/null +++ b/src/elements/boyl.c @@ -0,0 +1,43 @@ +#include <powder.h> + +int update_BOYL(UPDATE_FUNC_ARGS) { + int r, rx, ry; + if (pv[y/CELL][x/CELL]<(parts[i].temp/100)) + pv[y/CELL][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL]); + if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<(parts[i].temp/100)) + pv[y/CELL+1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL]); + if (x+CELL<XRES) + { + pv[y/CELL][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL+1]); + if (y+CELL<YRES) + pv[y/CELL+1][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL+1]); + } + if (y+CELL>0 && pv[y/CELL-1][x/CELL]<(parts[i].temp/100)) + pv[y/CELL-1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL]); + if (x+CELL>0) + { + pv[y/CELL][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL-1]); + if (y+CELL>0) + pv[y/CELL-1][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL-1]); + } + for (rx=-1; rx<2; rx++) + for (ry=-1; ry<2; 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_WATR && 1>rand()%30) + { + part_change_type(r>>8,x+rx,y+ry,PT_FOG); + } + else if ((r&0xFF)==PT_O2 && 1>rand()%9) + { + kill_part(r>>8); + part_change_type(i,x,y,PT_WATR); + pv[y/CELL][x/CELL] += 4.0; + } + } + return 0; +} diff --git a/src/elements/neut.c b/src/elements/neut.c index 61511d1..564b74c 100644 --- a/src/elements/neut.c +++ b/src/elements/neut.c @@ -57,12 +57,8 @@ int update_NEUT(UPDATE_FUNC_ARGS) { part_change_type(i,x,y,PT_DUST); else if ((r&0xFF)==PT_DYST && 15>(rand()%1000)) part_change_type(i,x,y,PT_YEST); - else if ((r&0xFF)==PT_YEST) { - if (15>(rand()%100000)&&isplayer==0) - create_part(r>>8, x+rx, y+ry, PT_STKM); - else - part_change_type(i,x,y,PT_DYST); - } + else if ((r&0xFF)==PT_YEST) + part_change_type(i,x,y,PT_DYST); else if ((r&0xFF)==PT_WATR && 15>(rand()%100)) part_change_type(r>>8,x+rx,y+ry,PT_DSTW); else if ((r&0xFF)==PT_PLEX && 15>(rand()%1000)) diff --git a/src/elements/prti.c b/src/elements/prti.c index 4d3a4be..a7e2013 100644 --- a/src/elements/prti.c +++ b/src/elements/prti.c @@ -18,6 +18,7 @@ int update_PRTI(UPDATE_FUNC_ARGS) { { portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type; portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp; + portalctype[parts[i].tmp][count-1][nnx] = parts[r>>8].ctype; if (parts[r>>8].type==PT_SPRK) part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype); else diff --git a/src/elements/prto.c b/src/elements/prto.c index a5d2c7e..4889e89 100644 --- a/src/elements/prto.c +++ b/src/elements/prto.c @@ -40,8 +40,10 @@ int update_PRTO(UPDATE_FUNC_ARGS) { np = create_part(-1,x+rx,y+ry,portal[parts[i].tmp][randomness-1][nnx]); if (np<0) continue; parts[np].temp = portaltemp[parts[i].tmp][randomness-1][nnx]; + parts[np].ctype = portalctype[parts[i].tmp][randomness-1][nnx]; portal[parts[i].tmp][randomness-1][nnx] = 0; portaltemp[parts[i].tmp][randomness-1][nnx] = 0; + portalctype[parts[i].tmp][randomness-1][nnx] = 0; break; } } diff --git a/src/elements/stkm.c b/src/elements/stkm.c index 2403bc2..66f9b2e 100644 --- a/src/elements/stkm.c +++ b/src/elements/stkm.c @@ -20,6 +20,11 @@ int update_STKM(UPDATE_FUNC_ARGS) { if ((parts[i].temp<309.6f) && (parts[i].temp>=243)) parts[i].temp += 1; + if (isplayer) { //Already a stickman in the simulation + death = 1; + parts[i].type = PT_NONE; + } + //Death if (parts[i].life<1 || death || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... { diff --git a/src/elements/stkm2.c b/src/elements/stkm2.c index b0a2be3..7c02043 100644 --- a/src/elements/stkm2.c +++ b/src/elements/stkm2.c @@ -20,6 +20,11 @@ int update_STKM2(UPDATE_FUNC_ARGS) { if ((parts[i].temp<309.6f) && (parts[i].temp>=243)) parts[i].temp += 1; + if (isplayer2) { //Already a stickman2 in the simulation + death2 = 1; + parts[i].type = PT_NONE; + } + //Death if (parts[i].life<1 || death2 || (pv[y/CELL][x/CELL]>=4.5f && player2[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... { diff --git a/src/elements/swch.c b/src/elements/swch.c index 2c538cc..5d623cd 100644 --- a/src/elements/swch.c +++ b/src/elements/swch.c @@ -25,5 +25,13 @@ int update_SWCH(UPDATE_FUNC_ARGS) { } } } + if (parts[i].life==10 && (!(pmap[y-1][x-1]&0xFF) && ((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) && !(pmap[y-1][x+1]&0xFF) && ((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2))) + { + parts[i].life = 9; + } + else if (parts[i].life<=5 && (!(pmap[y-1][x-1]&0xFF) && (((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) || ((pmap[y+1][x]&0xFF)==PT_BRAY&&parts[pmap[y+1][x]>>8].tmp==2)) && !(pmap[y-1][x+1]&0xFF) && (((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2) || ((pmap[y][x-1]&0xFF)==PT_BRAY&&parts[pmap[y][x-1]>>8].tmp==2)))) + { + parts[i].life = 14; + } return 0; } diff --git a/src/graphics.c b/src/graphics.c index ab7cc31..6c0123f 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1478,7 +1478,12 @@ void draw_parts(pixel *vid) cb = 0; blendpixel(vid, nx, ny, cr, cg, cb, 255); } - else if (cmode==CM_FANCY) + else if (cmode==CM_FANCY && + t!=PT_FIRE && t!=PT_PLSM && t!=PT_WTRV && + t!=PT_HFLM && t!=PT_SPRK && t!=PT_FIRW && + t!=PT_DUST && t!=PT_FIRW && t!=PT_FWRK && + t!=PT_NEUT && t!=PT_LAVA && t!=PT_BOMB && + t!=PT_PHOT && t!=PT_THDR && t!=PT_SMKE) { if (ptypes[parts[i].type].properties&TYPE_LIQUID) { diff --git a/src/powder.c b/src/powder.c index ccca0c2..e59fd89 100644 --- a/src/powder.c +++ b/src/powder.c @@ -701,11 +701,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].vx = 3.0f*cosf(a); parts[i].vy = 3.0f*sinf(a); } - if (t==PT_BIZR||t==PT_BIZRG) - parts[i].ctype = 0x47FFFF; - if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP - pmap[y][x] = t|(i<<8); - else if (t==PT_STKM) + if (t==PT_STKM) { if (isplayer==0) { @@ -755,11 +751,15 @@ inline int create_part(int p, int x, int y, int t) isplayer = 1; } + else + { + return -1; + } //kill_part(playerspawn); create_part(-1,x,y,PT_SPAWN); ISSPAWN1 = 1; } - else if (t==PT_STKM2) + if (t==PT_STKM2) { if (isplayer2==0) { @@ -809,10 +809,18 @@ inline int create_part(int p, int x, int y, int t) isplayer2 = 1; } + else + { + return -1; + } //kill_part(player2spawn); create_part(-1,x,y,PT_SPAWN2); ISSPAWN2 = 1; } + if (t==PT_BIZR||t==PT_BIZRG) + parts[i].ctype = 0x47FFFF; + if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP + pmap[y][x] = t|(i<<8); return i; } @@ -1425,16 +1433,16 @@ void update_particles_i(pixel *vid, int start, int inc) j = a = nt = 0; for (nx=-1; nx<2; nx++) for (ny=-1; ny<2; ny++) { - if (nx||ny){ + if (nx||ny) { surround[j] = r = pmap[y+ny][x+nx]; j++; - if (!bmap[(y+ny)/CELL][(x+nx)/CELL] || bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_STREAM) - { - if (!(r&0xFF)) - a = 1; - if ((r&0xFF)!=t) - nt = 1; - } + if (!bmap[(y+ny)/CELL][(x+nx)/CELL] || bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_STREAM) + { + if (!(r&0xFF)) + a = 1; + if ((r&0xFF)!=t) + nt = 1; + } } } @@ -1468,6 +1476,18 @@ void update_particles_i(pixel *vid, int start, int inc) parts[surround_hconduct[j]].temp = pt; } + if (y-2 >= 0 && y-2 < YRES && ptypes[t].properties&TYPE_LIQUID) { + float swappage; + r = pmap[y-2][x]; + if (!((r>>8)>=NPART || !r || parts[i].type != (r&0xFF))) { + if (parts[i].temp>parts[r>>8].temp) { + swappage = parts[i].temp; + parts[i].temp = parts[r>>8].temp; + parts[r>>8].temp = swappage; + } + } + } + s = 1; if (pt>ptransitions[t].thv&&ptransitions[t].tht>-1) { if (ptransitions[t].tht!=PT_NUM) |
