FILT with black deco causes ARAY/CRAY beams passing through it to have black deco.

The black deco is turned off if the beam passes through some FILT that isn't decorated black.
This commit is contained in:
jacksonmj
2014-05-22 14:55:18 +01:00
parent 1158647285
commit 91b4d1bf23
2 changed files with 15 additions and 2 deletions

View File

@@ -59,6 +59,7 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
if (!r) if (!r)
continue; continue;
if ((r&0xFF)==PT_SPRK && parts[r>>8].life==3) { if ((r&0xFF)==PT_SPRK && parts[r>>8].life==3) {
bool isBlackDeco = false;
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0; int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
int nostop = (parts[r>>8].ctype==PT_INST)?1:0; int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
int colored = 0; int colored = 0;
@@ -76,6 +77,8 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
} else } else
parts[nr].ctype = colored; parts[nr].ctype = colored;
parts[nr].temp = parts[i].temp; parts[nr].temp = parts[i].temp;
if (isBlackDeco)
parts[nr].dcolour = 0xFF000000;
} }
} else if (!destroy) { } else if (!destroy) {
if ((r&0xFF)==PT_BRAY) { if ((r&0xFF)==PT_BRAY) {
@@ -97,6 +100,8 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
//docontinue = 1; //docontinue = 1;
break; break;
} }
if (isBlackDeco)
parts[r>>8].dcolour = 0xFF000000;
} else if ((r&0xFF)==PT_FILT) {//get color if passed through FILT } else if ((r&0xFF)==PT_FILT) {//get color if passed through FILT
if (parts[r>>8].tmp != 6) if (parts[r>>8].tmp != 6)
{ {
@@ -104,6 +109,7 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
if (!colored) if (!colored)
break; break;
} }
isBlackDeco = (parts[r>>8].dcolour==0xFF000000);
parts[r>>8].life = 4; parts[r>>8].life = 4;
//this if prevents BRAY from stopping on certain materials //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)) { } 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)) {
@@ -145,7 +151,9 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
parts[r>>8].tmp = 2; parts[r>>8].tmp = 2;
parts[r>>8].life = 1; parts[r>>8].life = 1;
docontinue = 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)) { } 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) if((r&0xFF)==PT_STOR)
{ {
@@ -154,6 +162,7 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
} }
else if ((r&0xFF)==PT_FILT) else if ((r&0xFF)==PT_FILT)
{ {
isBlackDeco = (parts[r>>8].dcolour==0xFF000000);
parts[r>>8].life = 2; parts[r>>8].life = 2;
} }
docontinue = 1; docontinue = 1;

View File

@@ -78,6 +78,7 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
continue; continue;
if ((r&0xFF)==PT_SPRK && parts[r>>8].life==3) { //spark found, start creating if ((r&0xFF)==PT_SPRK && parts[r>>8].life==3) { //spark found, start creating
unsigned int colored = 0; unsigned int colored = 0;
bool isBlackDeco = false;
bool destroy = parts[r>>8].ctype==PT_PSCN; bool destroy = parts[r>>8].ctype==PT_PSCN;
bool nostop = parts[r>>8].ctype==PT_INST; bool nostop = parts[r>>8].ctype==PT_INST;
bool createSpark = (parts[r>>8].ctype==PT_INWR); bool createSpark = (parts[r>>8].ctype==PT_INWR);
@@ -105,7 +106,10 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
} else if ((r&0xFF)==PT_FILT) { // get color if passed through FILT } else if ((r&0xFF)==PT_FILT) { // get color if passed through FILT
if (parts[r>>8].tmp==0) 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; parts[r>>8].life = 4;
} else if ((r&0xFF) == PT_CRAY || nostop) { } else if ((r&0xFF) == PT_CRAY || nostop) {