From 10a6bb7120315c1e0fb47895514260c9668d424d Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sat, 22 May 2021 21:48:06 +0100 Subject: [PATCH] Remove pastel glow on "inactive" GLOW, fix FIRE_ADD variables. FIRE_ADD, firea/r/g/b variables adjusted to work similar to v51.1. Use RNG to assist with smooth(er) transition from PMODE_FLAT to PMODE_ADD --- src/simulation/elements/GLOW.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/simulation/elements/GLOW.cpp b/src/simulation/elements/GLOW.cpp index 3e0548824..281542993 100644 --- a/src/simulation/elements/GLOW.cpp +++ b/src/simulation/elements/GLOW.cpp @@ -75,17 +75,25 @@ static int update(UPDATE_FUNC_ARGS) static int graphics(GRAPHICS_FUNC_ARGS) { - *firea = int(restrict_flt(64.0f+cpart->ctype, 0, 255)); - *firer = int(restrict_flt(cpart->temp-(275.13f+32.0f), 0, 128)/50.0f); - *fireg = int(restrict_flt(float(cpart->ctype), 0, 128)/50.0f); - *fireb = int(restrict_flt(float(cpart->tmp), 0, 128)/50.0f); + *firer = 16+int(restrict_flt(cpart->temp-(275.13f+32.0f), 0, 128)/2.0f); + *fireg = 16+int(restrict_flt(float(cpart->ctype), 0, 128)/2.0f); + *fireb = 16+int(restrict_flt(float(cpart->tmp), 0, 128)/2.0f); + *firea = 64; *colr = int(restrict_flt(64.0f+cpart->temp-(275.13f+32.0f), 0, 255)); *colg = int(restrict_flt(64.0f+cpart->ctype, 0, 255)); *colb = int(restrict_flt(64.0f+cpart->tmp, 0, 255)); - *pixel_mode |= FIRE_ADD; - *pixel_mode |= PMODE_GLOW | PMODE_ADD; - *pixel_mode &= ~PMODE_FLAT; + int rng = RNG::Ref().between(1, 32); // + if(((*colr) + (*colg) + (*colb)) > (256 + rng)) { + *colr -= 54; + *colg -= 54; + *colb -= 54; + *pixel_mode |= FIRE_ADD; + *pixel_mode |= PMODE_GLOW | PMODE_ADD; + *pixel_mode &= ~PMODE_FLAT; + } else { + *pixel_mode |= PMODE_BLUR; + } return 0; }