Skip to content

Commit

Permalink
FILT with black deco causes ARAY/CRAY beams passing through it to hav…
Browse files Browse the repository at this point in the history
…e black deco.

The black deco is turned off if the beam passes through some FILT that isn't decorated black.
  • Loading branch information
jacksonmj committed May 22, 2014
1 parent 1158647 commit 91b4d1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/simulation/elements/ARAY.cpp
Expand Up @@ -59,6 +59,7 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
if (!r)
continue;
if ((r&0xFF)==PT_SPRK && parts[r>>8].life==3) {
bool isBlackDeco = false;
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
int colored = 0;
Expand All @@ -76,6 +77,8 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
} else
parts[nr].ctype = colored;
parts[nr].temp = parts[i].temp;
if (isBlackDeco)
parts[nr].dcolour = 0xFF000000;
}
} else if (!destroy) {
if ((r&0xFF)==PT_BRAY) {
Expand All @@ -97,13 +100,16 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
//docontinue = 1;
break;
}
if (isBlackDeco)
parts[r>>8].dcolour = 0xFF000000;
} else if ((r&0xFF)==PT_FILT) {//get color if passed through FILT
if (parts[r>>8].tmp != 6)
{
colored = Element_FILT::interactWavelengths(&parts[r>>8], colored);
if (!colored)
break;
}
isBlackDeco = (parts[r>>8].dcolour==0xFF000000);
parts[r>>8].life = 4;
//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)) {
Expand Down Expand Up @@ -145,7 +151,9 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
parts[r>>8].tmp = 2;
parts[r>>8].life = 1;
docontinue = 1;
//this if prevents red BRAY from stopping on certain materials
if (isBlackDeco)
parts[r>>8].dcolour = 0xFF000000;
//this if prevents red 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_FILT || ((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) {
if((r&0xFF)==PT_STOR)
{
Expand All @@ -154,6 +162,7 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
}
else if ((r&0xFF)==PT_FILT)
{
isBlackDeco = (parts[r>>8].dcolour==0xFF000000);
parts[r>>8].life = 2;
}
docontinue = 1;
Expand Down
6 changes: 5 additions & 1 deletion src/simulation/elements/CRAY.cpp
Expand Up @@ -78,6 +78,7 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
continue;
if ((r&0xFF)==PT_SPRK && parts[r>>8].life==3) { //spark found, start creating
unsigned int colored = 0;
bool isBlackDeco = false;
bool destroy = parts[r>>8].ctype==PT_PSCN;
bool nostop = parts[r>>8].ctype==PT_INST;
bool createSpark = (parts[r>>8].ctype==PT_INWR);
Expand Down Expand Up @@ -105,7 +106,10 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
} else if ((r&0xFF)==PT_FILT) { // get color if passed through FILT
if (parts[r>>8].tmp==0)
{
colored = wavelengthToDecoColour(Element_FILT::getWavelengths(&parts[r>>8]));
if (parts[r>>8].dcolour == 0xFF000000)
colored = 0xFF000000;
else
colored = wavelengthToDecoColour(Element_FILT::getWavelengths(&parts[r>>8]));
}
parts[r>>8].life = 4;
} else if ((r&0xFF) == PT_CRAY || nostop) {
Expand Down

0 comments on commit 91b4d1b

Please sign in to comment.