diff options
| author | Simon <simon@hardwired.org.uk> | 2011-04-08 10:09:42 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2011-04-08 10:09:42 (GMT) |
| commit | 767d73c5fc51647dcb5da4ed8349da2186c5060c (patch) | |
| tree | e9cb3540858927af4887553068fd348a95195092 /src/elements | |
| parent | 1bdf72be1a306ac07641211adb2ec1539e3d0a48 (diff) | |
| download | powder-767d73c5fc51647dcb5da4ed8349da2186c5060c.zip powder-767d73c5fc51647dcb5da4ed8349da2186c5060c.tar.gz | |
astyle
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/O2.c | 62 | ||||
| -rw-r--r-- | src/elements/aray.c | 4 | ||||
| -rw-r--r-- | src/elements/glow.c | 2 | ||||
| -rw-r--r-- | src/elements/h2.c | 20 | ||||
| -rw-r--r-- | src/elements/prti.c | 16 | ||||
| -rw-r--r-- | src/elements/prto.c | 12 | ||||
| -rw-r--r-- | src/elements/qrtz.c | 36 | ||||
| -rw-r--r-- | src/elements/sing.c | 16 |
8 files changed, 84 insertions, 84 deletions
diff --git a/src/elements/O2.c b/src/elements/O2.c index f554d1f..a8be78b 100644 --- a/src/elements/O2.c +++ b/src/elements/O2.c @@ -2,47 +2,47 @@ int update_O2(UPDATE_FUNC_ARGS) { - int r,rx,ry; - for(rx=-2; rx<3; rx++) - for(ry=-2; ry<3; ry++) + int r,rx,ry; + 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_FIRE) - { - parts[r>>8].life+=(rand()/(RAND_MAX/100))*2; - parts[r>>8].temp+=(rand()/(RAND_MAX/100)); - parts[i].tmp++; - } + if ((r&0xFF)==PT_FIRE) + { + parts[r>>8].life+=(rand()/(RAND_MAX/100))*2; + parts[r>>8].temp+=(rand()/(RAND_MAX/100)); + parts[i].tmp++; + } - } + } - if(pv[y/CELL][x/CELL] > 8.0f) - { - 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_H2) - if(50<(rand()/(RAND_MAX/100))){ - part_change_type(i,x,y,PT_WATR); + if (pv[y/CELL][x/CELL] > 8.0f) + { + 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_H2) + if (50<(rand()/(RAND_MAX/100))) { + part_change_type(i,x,y,PT_WATR); part_change_type(r>>8,x+rx,y+ry,PT_WATR); } - } - } + } + } - if(parts[i].tmp>=50) - { - create_part(i,x,y,PT_FIRE); - parts[i].life+=(rand()/(RAND_MAX/100))+50; - parts[i].temp+=(rand()/(RAND_MAX/100)); - } - return 0; + if (parts[i].tmp>=50) + { + create_part(i,x,y,PT_FIRE); + parts[i].life+=(rand()/(RAND_MAX/100))+50; + parts[i].temp+=(rand()/(RAND_MAX/100)); + } + return 0; } diff --git a/src/elements/aray.c b/src/elements/aray.c index ac51f66..4f94f00 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) {//get color if passed through FILT colored = parts[r>>8].ctype; - //this if prevents BRAY from stopping on certain materials + //this if prevents BRAY from stopping on certain materials } 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); @@ -59,7 +59,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) { if ((r&0xFF)==PT_BRAY) { parts[r>>8].life = 1; docontinue = 1; - //this if prevents red BRAY from stopping on certain materials + //this if prevents red BRAY from stopping on certain materials } else if ((r&0xFF)==PT_INWR || (r&0xFF)==PT_ARAY || (r&0xFF)==PT_WIFI || (r&0xFF)==PT_FILT || ((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) { docontinue = 1; } else { diff --git a/src/elements/glow.c b/src/elements/glow.c index d692233..ecbb005 100644 --- a/src/elements/glow.c +++ b/src/elements/glow.c @@ -17,7 +17,7 @@ int update_GLOW(UPDATE_FUNC_ARGS) { } } parts[i].ctype = pv[y/CELL][x/CELL]*16; - + parts[i].tmp = abs((int)((vx[y/CELL][x/CELL]+vy[y/CELL][x/CELL])*16.0f)) + abs((int)((parts[i].vx+parts[i].vy)*64.0f)); //printf("%f %f\n", parts[i].vx, parts[i].vy); if (parts[i].type==PT_NONE) { diff --git a/src/elements/h2.c b/src/elements/h2.c index 0b93242..e3fee78 100644 --- a/src/elements/h2.c +++ b/src/elements/h2.c @@ -2,20 +2,20 @@ int update_H2(UPDATE_FUNC_ARGS) { - int r,rx,ry,rt; - for(rx=-2; rx<3; rx++) - for(ry=-2; ry<3; ry++) + int r,rx,ry,rt; + 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]; - rt = (r&0xFF); + rt = (r&0xFF); if ((r>>8)>=NPART || !r) continue; - if(pv[y/CELL][x/CELL] > 8.0f && rt == PT_DESL) // This will not work. DESL turns to fire above 5.0 pressure - { - part_change_type(r>>8,x+rx,y+ry,PT_WATR); - part_change_type(i,x,y,PT_OIL); - } - } + if (pv[y/CELL][x/CELL] > 8.0f && rt == PT_DESL) // This will not work. DESL turns to fire above 5.0 pressure + { + part_change_type(r>>8,x+rx,y+ry,PT_WATR); + part_change_type(i,x,y,PT_OIL); + } + } return 0; } diff --git a/src/elements/prti.c b/src/elements/prti.c index 5c34cf9..f51c21c 100644 --- a/src/elements/prti.c +++ b/src/elements/prti.c @@ -39,18 +39,18 @@ int update_PRTI(UPDATE_FUNC_ARGS) { break; } } - - - if(fe){ + + + if (fe) { int orbd[4] = {0, 0, 0, 0}; //Orbital distances int orbl[4] = {0, 0, 0, 0}; //Orbital locations - if(!parts[i].life) parts[i].life = rand(); - if(!parts[i].ctype) parts[i].life = rand(); + if (!parts[i].life) parts[i].life = rand(); + if (!parts[i].ctype) parts[i].life = rand(); orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl); - for(r = 0; r < 4; r++){ - if(orbd[r]>1){ + for (r = 0; r < 4; r++) { + if (orbd[r]>1) { orbd[r] -= 12; - if(orbd[r]<1){ + if (orbd[r]<1) { orbd[r] = (rand()%128)+128; orbl[r] = rand()%255; } else { diff --git a/src/elements/prto.c b/src/elements/prto.c index 40cf97c..46c7250 100644 --- a/src/elements/prto.c +++ b/src/elements/prto.c @@ -62,16 +62,16 @@ int update_PRTO(UPDATE_FUNC_ARGS) { } } } - if(fe){ + if (fe) { int orbd[4] = {0, 0, 0, 0}; //Orbital distances int orbl[4] = {0, 0, 0, 0}; //Orbital locations - if(!parts[i].life) parts[i].life = rand(); - if(!parts[i].ctype) parts[i].life = rand(); + if (!parts[i].life) parts[i].life = rand(); + if (!parts[i].ctype) parts[i].life = rand(); orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl); - for(r = 0; r < 4; r++){ - if(orbd[r]<254){ + for (r = 0; r < 4; r++) { + if (orbd[r]<254) { orbd[r] += 16; - if(orbd[r]>254){ + if (orbd[r]>254) { orbd[r] = 0; orbl[r] = rand()%255; } diff --git a/src/elements/qrtz.c b/src/elements/qrtz.c index 4d3662f..f8312c1 100644 --- a/src/elements/qrtz.c +++ b/src/elements/qrtz.c @@ -3,7 +3,7 @@ int update_QRTZ(UPDATE_FUNC_ARGS) { int r, tmp, trade, rx, ry, np, t; t = parts[i].type; - if(t == PT_QRTZ) + if (t == PT_QRTZ) { parts[i].pavg[0] = parts[i].pavg[1]; parts[i].pavg[1] = pv[y/CELL][x/CELL]; @@ -32,29 +32,29 @@ int update_QRTZ(UPDATE_FUNC_ARGS) { { rx = rand()%3-1; ry = rand()%3-1; - if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || 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 && parts[i].ctype!=0) { - r = pmap[y+ry][x+rx]; - if ((r>>8)<NPART && !r && parts[i].ctype!=0) + np = create_part(-1,x+rx,y+ry,PT_QRTZ); + if (np>0) { - np = create_part(-1,x+rx,y+ry,PT_QRTZ); - if (np>0) + parts[np].tmp = parts[i].tmp; + parts[i].ctype = 0; + if (5>rand()%10) { - parts[np].tmp = parts[i].tmp; - parts[i].ctype = 0; - if(5>rand()%10) - { - parts[np].ctype=-1;//dead qrtz - } - else if(1>rand()%15) - { - parts[i].ctype=-1; - } - - break; + parts[np].ctype=-1;//dead qrtz } + else if (1>rand()%15) + { + parts[i].ctype=-1; + } + + break; } } + } } } for ( trade = 0; trade<9; trade ++) diff --git a/src/elements/sing.c b/src/elements/sing.c index 6d1fac3..0bed688 100644 --- a/src/elements/sing.c +++ b/src/elements/sing.c @@ -22,26 +22,26 @@ int update_SING(UPDATE_FUNC_ARGS) { if (y+CELL>0) pv[y/CELL-1][x/CELL-1] += 0.1f*(singularity-pv[y/CELL-1][x/CELL-1]); } - if(parts[i].life<1){ + if (parts[i].life<1) { //Pop! - for(rx=-2; rx<3; rx++){ + for (rx=-2; rx<3; rx++) { crx = (x/CELL)+rx; - for(ry=-2; ry<3; ry++){ + for (ry=-2; ry<3; ry++) { cry = (y/CELL)+ry; - if(cry > 0 && crx > 0 && crx < (XRES/CELL) && cry < (YRES/CELL)){ - pv[cry][crx] += (float)parts[i].tmp; + if (cry > 0 && crx > 0 && crx < (XRES/CELL) && cry < (YRES/CELL)) { + pv[cry][crx] += (float)parts[i].tmp; } } } rad = (parts[i].tmp>255)?255:parts[i].tmp; - if(rad>=1){ + if (rad>=1) { rad = (int)(((float)rad)/8.0f); } - if(rad>=1){ + if (rad>=1) { for (nxj=-(rad+1); nxj<=(rad+1); nxj++) for (nxi=-(rad+1); nxi<=(rad+1); nxi++) if ((pow(nxi,2))/(pow((rad+1),2))+(pow(nxj,2))/(pow((rad+1),2))<=1) { - if(rand()%2){ + if (rand()%2) { nb = create_part(-1, x+nxi, y+nxj, PT_PHOT); } else { nb = create_part(-1, x+nxi, y+nxj, PT_NEUT); |
