summaryrefslogtreecommitdiff
path: root/src/elements/ice.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/ice.c
parent855281295fbc23366e8b84d7c8e55816d6f47a87 (diff)
downloadpowder-54f9f872b9e4d5a0086d6de104e84d43b125c349.zip
powder-54f9f872b9e4d5a0086d6de104e84d43b125c349.tar.gz
Finish update function cleanup
Diffstat (limited to 'src/elements/ice.c')
-rw-r--r--src/elements/ice.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/elements/ice.c b/src/elements/ice.c
index 11817e8..e361fa6 100644
--- a/src/elements/ice.c
+++ b/src/elements/ice.c
@@ -1,36 +1,22 @@
#include <powder.h>
int update_ICEI(UPDATE_FUNC_ARGS) { //currently used for snow as well
- int r;
+ int r, rx, ry;
if (parts[i].ctype==PT_FRZW)
{
- parts[i].temp -= 1.0f;
- if (parts[i].temp<0)
- parts[i].temp = 0;
-
+ parts[i].temp = restrict_flt(parts[i].temp-1.0f, MIN_TEMP, MAX_TEMP);
}
- 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))
+ 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_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000))
{
- parts[i].type = PT_SLTW;
- parts[r>>8].type = PT_SLTW;
- }
- if (legacy_enable)
- {
- if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000))
- {
- parts[i].type = PT_ICEI;
- parts[r>>8].type = PT_ICEI;
- }
- if (parts[i].type==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000))
- parts[i].type = PT_WATR;
+ part_change_type(i,x,y,PT_SLTW);
+ part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
}
}
return 0;