Permalink
Browse files

fix / change 2, 3, and 4 from http://tpt.io/.265916

mostly makes BRAY act more like PHOT in some cases
  • Loading branch information...
jacob1 committed Mar 27, 2014
1 parent 20cbcf8 commit a71cb3b2546abd82dc9389d5827ca04e399e4d07
Showing with 11 additions and 3 deletions.
  1. +2 −0 src/simulation/Simulation.cpp
  2. +2 −0 src/simulation/elements/ARAY.cpp
  3. +7 −3 src/simulation/elements/DTEC.cpp
@@ -3027,6 +3027,8 @@ int Simulation::create_part(int p, int x, int y, int tv)
parts[i].ctype = 0x3FFFFFFF;
parts[i].vx = 3.0f*cosf(a);
parts[i].vy = 3.0f*sinf(a);
if ((pmap[y][x]&0xFF) == PT_FILT)
parts[i].ctype = Element_FILT::interactWavelengths(&parts[pmap[y][x]>>8], parts[i].ctype);
break;
}
case PT_ELEC:
@@ -99,6 +99,8 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
}
} else if ((r&0xFF)==PT_FILT) {//get color if passed through FILT
colored = Element_FILT::interactWavelengths(&parts[r>>8], colored);
if (!colored)
break;
//this if prevents BRAY from stopping on certain materials
} else if ((r&0xFF)!=PT_STOR && (r&0xFF)!=PT_INWR && ((r&0xFF)!=PT_SPRK || parts[r>>8].ctype!=PT_INWR) && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI && !((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) {
if (nyy!=0 || nxx!=0) {
@@ -73,6 +73,7 @@ int Element_DTEC::update(UPDATE_FUNC_ARGS)
}
}
}
bool setFilt = false;
int photonWl = 0;
for (rx=-rd; rx<rd+1; rx++)
for (ry=-rd; ry<rd+1; ry++)
@@ -83,12 +84,15 @@ int Element_DTEC::update(UPDATE_FUNC_ARGS)
r = sim->photons[y+ry][x+rx];
if(!r)
continue;
if (parts[r>>8].type == parts[i].ctype && (parts[i].ctype != PT_LIFE || parts[i].tmp == parts[r>>8].ctype || !parts[i].tmp))
if ((r&0xFF) == parts[i].ctype && (parts[i].ctype != PT_LIFE || parts[i].tmp == parts[r>>8].ctype || !parts[i].tmp))
parts[i].life = 1;
if (parts[r>>8].type == PT_PHOT)
if ((r&0xFF) == PT_PHOT || (r&0xFF) == PT_BRAY)
{
setFilt = true;
photonWl = parts[r>>8].ctype;
}
}
if (photonWl)
if (setFilt)
{
int nx, ny;
for (rx=-1; rx<2; rx++)

0 comments on commit a71cb3b

Please sign in to comment.