diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-28 12:19:34 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-28 12:19:34 (GMT) |
| commit | 29619e9ebfaa5d0358dd5d817631c7df329ebfda (patch) | |
| tree | 74899af926d061001d3ef9b8df9be289fa829b37 /src/simulation/elements/PLNT.cpp | |
| parent | df26523e10984b009570e06e0f056cfabdb002ac (diff) | |
| download | powder-29619e9ebfaa5d0358dd5d817631c7df329ebfda.zip powder-29619e9ebfaa5d0358dd5d817631c7df329ebfda.tar.gz | |
WOOD and PLNT turn grey when hot, bluish when cold
Diffstat (limited to 'src/simulation/elements/PLNT.cpp')
| -rw-r--r-- | src/simulation/elements/PLNT.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/simulation/elements/PLNT.cpp b/src/simulation/elements/PLNT.cpp index 9c87e22..84a83c2 100644 --- a/src/simulation/elements/PLNT.cpp +++ b/src/simulation/elements/PLNT.cpp @@ -43,7 +43,7 @@ Element_PLNT::Element_PLNT() HighTemperatureTransition = PT_FIRE; Update = &Element_PLNT::update; - + Graphics = &Element_PLNT::graphics; } //#TPT-Directive ElementHeader Element_PLNT static int update(UPDATE_FUNC_ARGS) @@ -99,6 +99,26 @@ int Element_PLNT::update(UPDATE_FUNC_ARGS) } parts[i].life = 0; } + if (parts[i].temp > 400 && parts[i].temp > parts[i].tmp2) + parts[i].tmp2 = (int)parts[i].temp; + return 0; +} + +//#TPT-Directive ElementHeader Element_PLNT static int graphics(GRAPHICS_FUNC_ARGS) +int Element_PLNT::graphics(GRAPHICS_FUNC_ARGS) +{ + float maxtemp = fmax(cpart->tmp2, cpart->temp); + if (maxtemp > 300) + { + *colr += (int)restrict_flt((maxtemp-300)/5,0,58); + *colg -= (int)restrict_flt((maxtemp-300)/2,0,102); + *colb += (int)restrict_flt((maxtemp-300)/5,0,70); + } + if (maxtemp < 273) + { + *colg += (int)restrict_flt((273-maxtemp)/4,0,255); + *colb += (int)restrict_flt((273-maxtemp)/1.5,0,255); + } return 0; } |
