summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-01 16:32:02 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-01 16:32:02 (GMT)
commite41a3af8c516c5c3698b29ce95954a5941c2c06a (patch)
treed6618205fa9cf729996b2a4923c1b9ced342e2fe /src/elements
parent6fd4b2a80c8d155de278aca22f6dd77987f34273 (diff)
downloadpowder-e41a3af8c516c5c3698b29ce95954a5941c2c06a.zip
powder-e41a3af8c516c5c3698b29ce95954a5941c2c06a.tar.gz
BRMT + BREL = THRM at high temperatures
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/bmtl.c9
-rw-r--r--src/elements/brmt.c35
2 files changed, 41 insertions, 3 deletions
diff --git a/src/elements/bmtl.c b/src/elements/bmtl.c
index 04d9f3a..97ad699 100644
--- a/src/elements/bmtl.c
+++ b/src/elements/bmtl.c
@@ -1,8 +1,9 @@
#include <element.h>
int update_BMTL(UPDATE_FUNC_ARGS) {
- int r, rx, ry, rt;
- if (parts[i].tmp>1) {
+ int r, rx, ry, rt, tempFactor;
+ if (parts[i].tmp>1)
+ {
parts[i].tmp--;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
@@ -18,7 +19,9 @@ int update_BMTL(UPDATE_FUNC_ARGS) {
parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
}
}
- } else if (parts[i].tmp==1 && 1>rand()%1000) {
+ }
+ else if (parts[i].tmp==1 && 1>rand()%1000)
+ {
parts[i].tmp = 0;
part_change_type(i,x,y,PT_BRMT);
}
diff --git a/src/elements/brmt.c b/src/elements/brmt.c
new file mode 100644
index 0000000..ca785c8
--- /dev/null
+++ b/src/elements/brmt.c
@@ -0,0 +1,35 @@
+#include <element.h>
+
+int update_BRMT(UPDATE_FUNC_ARGS) {
+ int r, rx, ry, rt, tempFactor;
+ if (parts[i].temp > (250.0f+273.15f))
+ {
+ printf("%f\n", (250.0f+273.15f)-parts[i].temp);
+ 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+ry][x+rx];
+ if (!r)
+ continue;
+ rt = parts[r>>8].type;
+ tempFactor = 1000 - (((250.0f+273.15f)-parts[i].temp)*2);
+ if(tempFactor < 2)
+ tempFactor = 2;
+ if ((rt==PT_BREC) && 1 > (rand()%tempFactor))
+ {
+ if(rand()%2)
+ {
+ create_part(r>>8, x+rx, y+ry, PT_THRM);
+ }
+ else
+ { create_part(i, x, y, PT_THRM);
+ }
+ return 1;
+ //part_change_type(r>>8,x+rx,y+ry,PT_BMTL);
+ //parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
+ }
+ }
+ }
+ return 0;
+}