From 1158647285f853c6ce5b01061dba804fcbb3a597 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Thu, 22 May 2014 14:30:23 +0100 Subject: [PATCH] Visual effect for FILT when an ARAY or CRAY beam passes through it (increased opacity for up to 4 frames) --- src/simulation/elements/ARAY.cpp | 5 +++++ src/simulation/elements/CRAY.cpp | 1 + src/simulation/elements/FILT.cpp | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/simulation/elements/ARAY.cpp b/src/simulation/elements/ARAY.cpp index d41f0eb81..be43af46f 100644 --- a/src/simulation/elements/ARAY.cpp +++ b/src/simulation/elements/ARAY.cpp @@ -104,6 +104,7 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS) if (!colored) break; } + 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)) { if (nyy!=0 || nxx!=0) { @@ -151,6 +152,10 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS) parts[r>>8].tmp = 0; parts[r>>8].life = 0; } + else if ((r&0xFF)==PT_FILT) + { + parts[r>>8].life = 2; + } docontinue = 1; } else { docontinue = 0; diff --git a/src/simulation/elements/CRAY.cpp b/src/simulation/elements/CRAY.cpp index 1cdb66ea9..b226a8ecf 100644 --- a/src/simulation/elements/CRAY.cpp +++ b/src/simulation/elements/CRAY.cpp @@ -107,6 +107,7 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS) { colored = wavelengthToDecoColour(Element_FILT::getWavelengths(&parts[r>>8])); } + parts[r>>8].life = 4; } else if ((r&0xFF) == PT_CRAY || nostop) { docontinue = 1; } else if(destroy && r && ((r&0xFF) != PT_DMND)) { diff --git a/src/simulation/elements/FILT.cpp b/src/simulation/elements/FILT.cpp index 7e8ae996f..be0672845 100644 --- a/src/simulation/elements/FILT.cpp +++ b/src/simulation/elements/FILT.cpp @@ -31,7 +31,7 @@ Element_FILT::Element_FILT() Description = "Filter for photons, changes the color."; State = ST_SOLID; - Properties = TYPE_SOLID | PROP_NOAMBHEAT; + Properties = TYPE_SOLID | PROP_NOAMBHEAT | PROP_LIFE_DEC; LowPressure = IPL; LowPressureTransition = NT; @@ -60,7 +60,10 @@ int Element_FILT::graphics(GRAPHICS_FUNC_ARGS) for (x=0; x<12; x++) *colg += (wl >> (x+9)) & 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; *colg *= x; *colb *= x;