Skip to content

Commit

Permalink
fix / change 2, 3, and 4 from http://tpt.io/.265916
Browse files Browse the repository at this point in the history
mostly makes BRAY act more like PHOT in some cases
  • Loading branch information
jacob1 committed Mar 27, 2014
1 parent 20cbcf8 commit a71cb3b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/simulation/Simulation.cpp
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions src/simulation/elements/ARAY.cpp
Expand Up @@ -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) {
Expand Down
10 changes: 7 additions & 3 deletions src/simulation/elements/DTEC.cpp
Expand Up @@ -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++)
Expand All @@ -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++)
Expand Down

0 comments on commit a71cb3b

Please sign in to comment.