Make TESC create LIGH with same deco color

This commit is contained in:
catsoften 2023-01-30 21:38:30 -05:00
parent b7a6663e08
commit f8761c3927
No known key found for this signature in database
GPG Key ID: E4F118C248F12055
3 changed files with 17 additions and 4 deletions

View File

@ -282,7 +282,7 @@ void Renderer::render_parts()
{
if (!elements[t].Graphics || (*(elements[t].Graphics))(this, &(sim->parts[i]), nx, ny, &pixel_mode, &cola, &colr, &colg, &colb, &firea, &firer, &fireg, &fireb)) //That's a lot of args, a struct might be better
{
graphicscache[t].isready = 1;
graphicscache[t].isready = t == PT_LIGH ? 0 : 1; // Glow effect depends on deco
graphicscache[t].pixel_mode = pixel_mode;
graphicscache[t].cola = cola;
graphicscache[t].colr = colr;

View File

@ -1,5 +1,7 @@
#include "simulation/ElementCommon.h"
#include "graphics/Pixel.h"
static int update(UPDATE_FUNC_ARGS);
static int graphics(GRAPHICS_FUNC_ARGS);
static void create(ELEMENT_CREATE_FUNC_ARGS);
@ -191,6 +193,7 @@ static bool create_LIGH(Simulation * sim, int x, int y, int c, float temp, int l
{
sim->parts[p].temp = float(temp);
sim->parts[p].tmp = tmp;
sim->parts[p].dcolour = sim->parts[i].dcolour;
if (last)
{
int nextSegmentLife = (int)(life/1.5 - RNG::Ref().between(0, 1));
@ -292,9 +295,18 @@ static void create_line_par(Simulation * sim, int x1, int y1, int x2, int y2, in
static int graphics(GRAPHICS_FUNC_ARGS)
{
*firea = 120;
*firer = *colr = 235;
*fireg = *colg = 245;
*fireb = *colb = 255;
if (cpart->dcolour)
{
*firer = *colr = PIXR(cpart->dcolour);
*fireg = *colg = PIXG(cpart->dcolour);
*fireb = *colb = PIXB(cpart->dcolour);
}
else
{
*firer = *colr = 235;
*fireg = *colg = 245;
*fireb = *colb = 255;
}
*pixel_mode |= PMODE_GLOW | FIRE_ADD;
return 1;
}

View File

@ -133,6 +133,7 @@ static int update(UPDATE_FUNC_ARGS)
parts[p].temp=parts[p].life*parts[i].tmp/2.5;
parts[p].tmp2=1;
parts[p].tmp=int(atan2(-ry, (float)rx)/TPT_PI_FLT*360);
parts[p].dcolour = parts[i].dcolour;
parts[i].temp-=parts[i].tmp*2+parts[i].temp/5; // slight self-cooling
if (fabs(sim->pv[y/CELL][x/CELL])!=0.0f)
{