Visual effect for FILT when an ARAY or CRAY beam passes through it

(increased opacity for up to 4 frames)
This commit is contained in:
jacksonmj 2014-05-22 14:30:23 +01:00
parent 2946030517
commit 1158647285
3 changed files with 11 additions and 2 deletions

View File

@ -104,6 +104,7 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
if (!colored) if (!colored)
break; break;
} }
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)) {
if (nyy!=0 || nxx!=0) { if (nyy!=0 || nxx!=0) {
@ -151,6 +152,10 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
parts[r>>8].tmp = 0; parts[r>>8].tmp = 0;
parts[r>>8].life = 0; parts[r>>8].life = 0;
} }
else if ((r&0xFF)==PT_FILT)
{
parts[r>>8].life = 2;
}
docontinue = 1; docontinue = 1;
} else { } else {
docontinue = 0; docontinue = 0;

View File

@ -107,6 +107,7 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
{ {
colored = wavelengthToDecoColour(Element_FILT::getWavelengths(&parts[r>>8])); colored = wavelengthToDecoColour(Element_FILT::getWavelengths(&parts[r>>8]));
} }
parts[r>>8].life = 4;
} else if ((r&0xFF) == PT_CRAY || nostop) { } else if ((r&0xFF) == PT_CRAY || nostop) {
docontinue = 1; docontinue = 1;
} else if(destroy && r && ((r&0xFF) != PT_DMND)) { } else if(destroy && r && ((r&0xFF) != PT_DMND)) {

View File

@ -31,7 +31,7 @@ Element_FILT::Element_FILT()
Description = "Filter for photons, changes the color."; Description = "Filter for photons, changes the color.";
State = ST_SOLID; State = ST_SOLID;
Properties = TYPE_SOLID | PROP_NOAMBHEAT; Properties = TYPE_SOLID | PROP_NOAMBHEAT | PROP_LIFE_DEC;
LowPressure = IPL; LowPressure = IPL;
LowPressureTransition = NT; LowPressureTransition = NT;
@ -60,7 +60,10 @@ int Element_FILT::graphics(GRAPHICS_FUNC_ARGS)
for (x=0; x<12; x++) for (x=0; x<12; x++)
*colg += (wl >> (x+9)) & 1; *colg += (wl >> (x+9)) & 1;
x = 624/(*colr+*colg+*colb+1); x = 624/(*colr+*colg+*colb+1);
*cola = 127; if (cpart->life>0 && cpart->life<=4)
*cola = 127+cpart->life*30;
else
*cola = 127;
*colr *= x; *colr *= x;
*colg *= x; *colg *= x;
*colb *= x; *colb *= x;