summaryrefslogtreecommitdiff
path: root/src/elements/dstw.c
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-09 19:23:05 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-09 19:23:05 (GMT)
commit144e4bdb6991a042f9b985a9719299f612420dd0 (patch)
tree3da5132fc731dea1334048c707f4c074e390a86c /src/elements/dstw.c
parent56a3ad373c126da22be05e4c5b64a446c7d7dff0 (diff)
downloadpowder-144e4bdb6991a042f9b985a9719299f612420dd0.zip
powder-144e4bdb6991a042f9b985a9719299f612420dd0.tar.gz
Begin cleanup of update functions
Diffstat (limited to 'src/elements/dstw.c')
-rw-r--r--src/elements/dstw.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/elements/dstw.c b/src/elements/dstw.c
index 1e98851..ae6db18 100644
--- a/src/elements/dstw.c
+++ b/src/elements/dstw.c
@@ -1,36 +1,31 @@
#include <powder.h>
int update_DSTW(UPDATE_FUNC_ARGS) {
- int r;
- 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))
+ 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+ny][x+nx];
+ r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
- if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
+ if ((r&0xFF)==PT_SALT && 1>(rand()%250))
{
- parts[i].type = PT_WTRV;
- }
- else if ((r&0xFF)==PT_SALT && 1>(rand()%250))
- {
- parts[i].type = PT_SLTW;
- parts[r>>8].type = PT_SLTW;
+ part_change_type(i,x,y,PT_SLTW);
+ part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
}
if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW) && 1>(rand()%500))
{
- parts[i].type = PT_WATR;
+ part_change_type(i,x,y,PT_WATR);
}
if ((r&0xFF)==PT_SLTW && 1>(rand()%500))
{
- parts[i].type = PT_SLTW;
+ part_change_type(i,x,y,PT_SLTW);
}
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||parts[i].temp>12.0f) && 1>(rand()%500))
{
+ part_change_type(i,x,y,PT_FIRE);
parts[i].life = 4;
- parts[i].type = PT_FIRE;
}
}
return 0;