Skip to content

Commit

Permalink
Visual effect for FILT when an ARAY or CRAY beam passes through it
Browse files Browse the repository at this point in the history
(increased opacity for up to 4 frames)
  • Loading branch information
jacksonmj committed May 22, 2014
1 parent 2946030 commit 1158647
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/simulation/elements/ARAY.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/CRAY.cpp
Expand Up @@ -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)) {
Expand Down
7 changes: 5 additions & 2 deletions src/simulation/elements/FILT.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1158647

Please sign in to comment.