summaryrefslogtreecommitdiff
path: root/src/elements/fog.c
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-10 14:41:03 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-10 14:41:03 (GMT)
commit54f9f872b9e4d5a0086d6de104e84d43b125c349 (patch)
treeb567fb9d3710acbce22f8193bfe2585bb2988bed /src/elements/fog.c
parent855281295fbc23366e8b84d7c8e55816d6f47a87 (diff)
downloadpowder-54f9f872b9e4d5a0086d6de104e84d43b125c349.zip
powder-54f9f872b9e4d5a0086d6de104e84d43b125c349.tar.gz
Finish update function cleanup
Diffstat (limited to 'src/elements/fog.c')
-rw-r--r--src/elements/fog.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/elements/fog.c b/src/elements/fog.c
index 59c432f..2273b91 100644
--- a/src/elements/fog.c
+++ b/src/elements/fog.c
@@ -1,22 +1,19 @@
#include <powder.h>
int update_FOG(UPDATE_FUNC_ARGS) {
- int r;
- if (parts[i].temp>=373.15)
- 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))
+ int r, rx, ry;
+ 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+ny][x+nx];
+ r = pmap[y+ry][x+rx];
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))
+ if (pstates[r&0xFF].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!((r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN)) // TODO: should this also exclude BCLN?
{
- parts[i].type = PT_RIME;
+ part_change_type(i,x,y,PT_RIME);
}
- if (parts[r>>8].type==PT_SPRK)
+ if ((r&0xFF)==PT_SPRK)
{
parts[i].life += rand()%20;
}