summaryrefslogtreecommitdiff
path: root/src/simulation/elements/PHOT.cpp
diff options
context:
space:
mode:
authorcracker64 <cracker642@gmail.com>2013-03-02 05:42:07 (GMT)
committer cracker64 <cracker642@gmail.com>2013-03-02 05:42:07 (GMT)
commitd58100dc070be97073d1f02cdbb7a382a67c376b (patch)
treecc0fc022e7f8524b7f9bcf5ed93eb83980596f91 /src/simulation/elements/PHOT.cpp
parenta9f4b5fe343fb0ada8934030abe6363695ea43dc (diff)
downloadpowder-d58100dc070be97073d1f02cdbb7a382a67c376b.zip
powder-d58100dc070be97073d1f02cdbb7a382a67c376b.tar.gz
More fixes, redid a bunch of SPRK, so far everything I've tested works fine.
Diffstat (limited to 'src/simulation/elements/PHOT.cpp')
-rw-r--r--src/simulation/elements/PHOT.cpp56
1 files changed, 20 insertions, 36 deletions
diff --git a/src/simulation/elements/PHOT.cpp b/src/simulation/elements/PHOT.cpp
index 2c6c81f..9a69cbc 100644
--- a/src/simulation/elements/PHOT.cpp
+++ b/src/simulation/elements/PHOT.cpp
@@ -61,50 +61,34 @@ int Element_PHOT::update(UPDATE_FUNC_ARGS)
if (!(rand()%10)) Element_FIRE::update(UPDATE_FUNC_SUBCALL_ARGS);
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)) {
+ if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)==PT_ISOZ && !(rand()%400))
+ if ((r&0xFF)==PT_ISOZ || (r&0xFF)==PT_ISZS)
{
- parts[i].vx *= 0.90;
- parts[i].vy *= 0.90;
- sim->create_part(r>>8, x+rx, y+ry, PT_PHOT);
- rrr = (rand()%360)*3.14159f/180.0f;
- rr = (rand()%128+128)/127.0f;
- parts[r>>8].vx = rr*cosf(rrr);
- parts[r>>8].vy = rr*sinf(rrr);
- sim->pv[y/CELL][x/CELL] -= 15.0f * CFDS;
+ if (!(rand()%400))
+ {
+ parts[i].vx *= 0.90;
+ parts[i].vy *= 0.90;
+ sim->create_part(r>>8, x+rx, y+ry, PT_PHOT);
+ rrr = (rand()%360)*3.14159f/180.0f;
+ rr = (rand()%128+128)/127.0f;
+ parts[r>>8].vx = rr*cosf(rrr);
+ parts[r>>8].vy = rr*sinf(rrr);
+ sim->pv[y/CELL][x/CELL] -= 15.0f * CFDS;
+ }
}
- if ((r&0xFF)==PT_ISZS && !(rand()%400))
+ else if((r&0xFF) == PT_QRTZ && !ry && !rx)//if on QRTZ
{
- parts[i].vx *= 0.90;
- parts[i].vy *= 0.90;
- sim->create_part(r>>8, x+rx, y+ry, PT_PHOT);
- rr = (rand()%228+128)/127.0f;
- rrr = (rand()%360)*3.14159f/180.0f;
- parts[r>>8].vx = rr*cosf(rrr);
- parts[r>>8].vy = rr*sinf(rrr);
- sim->pv[y/CELL][x/CELL] -= 15.0f * CFDS;
+ float a = (rand()%360)*3.14159f/180.0f;
+ parts[i].vx = 3.0f*cosf(a);
+ parts[i].vy = 3.0f*sinf(a);
+ if(parts[i].ctype == 0x3FFFFFFF)
+ parts[i].ctype = 0x1F<<(rand()%26);
+ parts[i].life++; //Delay death
}
}
- r = pmap[y][x];
- if((r&0xFF) == PT_QRTZ)// && parts[i].ctype==0x3FFFFFFF)
- {
- float a = (rand()%360)*3.14159f/180.0f;
- parts[i].vx = 3.0f*cosf(a);
- parts[i].vy = 3.0f*sinf(a);
- if(parts[i].ctype == 0x3FFFFFFF)
- parts[i].ctype = 0x1F<<(rand()%26);
- parts[i].life++; //Delay death
- }
- //r = pmap[y][x];
- //rt = r&0xFF;
- /*if (rt==PT_CLNE || rt==PT_PCLN || rt==PT_BCLN || rt==PT_PBCN) {
- if (!parts[r>>8].ctype)
- parts[r>>8].ctype = PT_PHOT;
- }*/
-
return 0;
}