summaryrefslogtreecommitdiff
path: root/src/elements/prti.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-05-07 16:59:50 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-05-07 16:59:50 (GMT)
commit51b17badf4c72270bb762ea795d05d51c8b355e3 (patch)
treeb66671e0496b68114c6e91eedb58bf783d5343c0 /src/elements/prti.cpp
parentfb111f42d00dd8a2041bae970c0913e096ac5101 (diff)
downloadpowder-51b17badf4c72270bb762ea795d05d51c8b355e3.zip
powder-51b17badf4c72270bb762ea795d05d51c8b355e3.tar.gz
A bit of refactoring (elements)
Diffstat (limited to 'src/elements/prti.cpp')
-rw-r--r--src/elements/prti.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/src/elements/prti.cpp b/src/elements/prti.cpp
deleted file mode 100644
index cb2030d..0000000
--- a/src/elements/prti.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "simulation/Element.h"
-/*these are the count values of where the particle gets stored, depending on where it came from
- 0 1 2
- 7 . 3
- 6 5 4
- PRTO does (count+4)%8, so that it will come out at the opposite place to where it came in
- PRTO does +/-1 to the count, so it doesn't jam as easily
-*/
-
-int update_PRTI(UPDATE_FUNC_ARGS) {
- int r, nnx, rx, ry, fe = 0;
- int count =0;
- parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
- if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1;
- else if (parts[i].tmp<0) parts[i].tmp = 0;
- for (count=0; count<8; count++)
- {
- rx = sim->portal_rx[count];
- ry = sim->portal_ry[count];
- if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
- {
- r = pmap[y+ry][x+rx];
- if (!r)
- fe = 1;
- if (!r || (r&0xFF)==PT_PRTI || (r&0xFF)==PT_PRTO || (sim->ptypes[r&0xFF].falldown== 0 && sim->ptypes[r&0xFF].state != ST_GAS && (r&0xFF)!=PT_SPRK))
- {
- r = sim->photons[y+ry][x+rx];
- if (!r || (r&0xFF)==PT_PRTI || (r&0xFF)==PT_PRTO || (sim->ptypes[r&0xFF].falldown== 0 && sim->ptypes[r&0xFF].state != ST_GAS && (r&0xFF)!=PT_SPRK))
- continue;
- }
-
- if ((r&0xFF)==PT_STKM || (r&0xFF)==PT_STKM2 || (r&0xFF)==PT_FIGH)
- continue;// Handling these is a bit more complicated, and is done in STKM_interact()
-
- if ((r&0xFF) == PT_SOAP)
- sim->detach(r>>8);
-
- for ( nnx=0; nnx<80; nnx++)
- if (!sim->portalp[parts[i].tmp][count][nnx].type)
- {
- sim->portalp[parts[i].tmp][count][nnx] = parts[r>>8];
- if ((r&0xFF)==PT_SPRK)
- sim->part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype);
- else
- sim->kill_part(r>>8);
- fe = 1;
- break;
- }
- }
- }
-
-
- if (fe) {
- int orbd[4] = {0, 0, 0, 0}; //Orbital distances
- int orbl[4] = {0, 0, 0, 0}; //Orbital locations
- if (!sim->parts[i].life) parts[i].life = rand()*rand()*rand();
- if (!sim->parts[i].ctype) parts[i].ctype = rand()*rand()*rand();
- sim->orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
- for (r = 0; r < 4; r++) {
- if (orbd[r]>1) {
- orbd[r] -= 12;
- if (orbd[r]<1) {
- orbd[r] = (rand()%128)+128;
- orbl[r] = rand()%255;
- } else {
- orbl[r] += 2;
- orbl[r] = orbl[r]%255;
- }
- } else {
- orbd[r] = (rand()%128)+128;
- orbl[r] = rand()%255;
- }
- }
- sim->orbitalparts_set(&parts[i].life, &parts[i].ctype, orbd, orbl);
- } else {
- parts[i].life = 0;
- parts[i].ctype = 0;
- }
- return 0;
-}