summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-08-19 16:53:56 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-08-19 16:53:56 (GMT)
commitac4ffb8d5dbb2e3fe10a979e0cdc6c34a2a8a31f (patch)
tree5d944a09c2a8e77919d3358ae3e987e19eb024f0 /src/elements
parenta85121d767432b7754bf9a6dce04eca37be52f1a (diff)
downloadpowder-ac4ffb8d5dbb2e3fe10a979e0cdc6c34a2a8a31f.zip
powder-ac4ffb8d5dbb2e3fe10a979e0cdc6c34a2a8a31f.tar.gz
Fancy Coal effects
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/bcol.c34
-rw-r--r--src/elements/coal.c34
2 files changed, 66 insertions, 2 deletions
diff --git a/src/elements/bcol.c b/src/elements/bcol.c
index de394bc..bc8713c 100644
--- a/src/elements/bcol.c
+++ b/src/elements/bcol.c
@@ -1,7 +1,7 @@
#include <element.h>
int update_BCOL(UPDATE_FUNC_ARGS) {
- int r, rx, ry;
+ int r, rx, ry, trade, temp;
if (parts[i].life<=0) {
create_part(i, x, y, PT_FIRE);
return 1;
@@ -32,5 +32,37 @@ int update_BCOL(UPDATE_FUNC_ARGS) {
}
}
}
+ /*if(100-parts[i].life > parts[i].tmp2)
+ parts[i].tmp2 = 100-parts[i].life;
+ if(parts[i].tmp2 < 0) parts[i].tmp2 = 0;
+ for ( trade = 0; trade<4; trade ++)
+ {
+ rx = rand()%5-2;
+ ry = rand()%5-2;
+ 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_COAL || (r&0xFF)==PT_BCOL)&&(parts[i].tmp2>parts[r>>8].tmp2)&&parts[i].tmp2>0)//diffusion
+ {
+ int temp = parts[i].tmp2 - parts[r>>8].tmp2;
+ if(temp < 10)
+ continue;
+ if (temp ==1)
+ {
+ parts[r>>8].tmp2 ++;
+ parts[i].tmp2 --;
+ }
+ else if (temp>0)
+ {
+ parts[r>>8].tmp2 += temp/2;
+ parts[i].tmp2 -= temp/2;
+ }
+ }
+ }
+ }*/
+ if(parts[i].temp > parts[i].tmp2)
+ parts[i].tmp2 = parts[i].temp;
return 0;
}
diff --git a/src/elements/coal.c b/src/elements/coal.c
index 424a1a1..e111890 100644
--- a/src/elements/coal.c
+++ b/src/elements/coal.c
@@ -1,7 +1,7 @@
#include <element.h>
int update_COAL(UPDATE_FUNC_ARGS) {
- int r, rx, ry;
+ int r, rx, ry, trade, temp;
if (parts[i].life<=0) {
create_part(i, x, y, PT_FIRE);
return 1;
@@ -39,5 +39,37 @@ int update_COAL(UPDATE_FUNC_ARGS) {
}
}
}
+ /*if(100-parts[i].life > parts[i].tmp2)
+ parts[i].tmp2 = 100-parts[i].life;
+ if(parts[i].tmp2 < 0) parts[i].tmp2 = 0;
+ for ( trade = 0; trade<4; trade ++)
+ {
+ rx = rand()%5-2;
+ ry = rand()%5-2;
+ 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_COAL || (r&0xFF)==PT_BCOL)&&(parts[i].tmp2>parts[r>>8].tmp2)&&parts[i].tmp2>0)//diffusion
+ {
+ int temp = parts[i].tmp2 - parts[r>>8].tmp2;
+ if(temp < 10)
+ continue;
+ if (temp ==1)
+ {
+ parts[r>>8].tmp2 ++;
+ parts[i].tmp2 --;
+ }
+ else if (temp>0)
+ {
+ parts[r>>8].tmp2 += temp/2;
+ parts[i].tmp2 -= temp/2;
+ }
+ }
+ }
+ }*/
+ if(parts[i].temp > parts[i].tmp2)
+ parts[i].tmp2 = parts[i].temp;
return 0;
}