summaryrefslogtreecommitdiff
path: root/src/elements/prti.c
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-07 20:03:58 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-07 20:03:58 (GMT)
commitb69712bbdbaf32fef65e15141458cb27f9f7ec88 (patch)
tree622d2d413fe4edbe683c729d500206c447624b8d /src/elements/prti.c
parentfa1868314c1d48de9000c45dc8bcde36d92472cb (diff)
downloadpowder-b69712bbdbaf32fef65e15141458cb27f9f7ec88.zip
powder-b69712bbdbaf32fef65e15141458cb27f9f7ec88.tar.gz
Some more function pointers
Diffstat (limited to 'src/elements/prti.c')
-rw-r--r--src/elements/prti.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/elements/prti.c b/src/elements/prti.c
new file mode 100644
index 0000000..33b449f
--- /dev/null
+++ b/src/elements/prti.c
@@ -0,0 +1,32 @@
+#include <powder.h>
+
+int update_PRTI(UPDATE_FUNC_ARGS) {
+ int r, temp, nnx, temprange = 100;
+ int count =0;
+ for ( temp = 0; temp < MAX_TEMP; temp += temprange)
+ if (parts[i].temp-73.15>temp&&parts[i].temp-73.15 <temp+temprange)
+ parts[i].tmp = temp/100;
+ for (ny=-1; ny<2; ny++)
+ for (nx=-1; nx<2; nx++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ count ++;
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (parts[r>>8].type==PT_SPRK || (parts[r>>8].type!=PT_PRTI && parts[r>>8].type!=PT_PRTO && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS)))
+ for ( nnx=0; nnx<80; nnx++)
+ if (!portal[parts[i].tmp][count-1][nnx])
+ {
+ portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type;
+ portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp;
+ if (parts[r>>8].type==PT_SPRK)
+ parts[r>>8].type = parts[r>>8].ctype;
+ else
+ parts[r>>8].type = PT_NONE;
+ break;
+ }
+ }
+ return 0;
+}