Fix PIPE graphics hack giving Lua graphics functions bad particle IDs
This commit is contained in:
parent
ae253ebc75
commit
c603c41b92
@ -1,6 +1,4 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
//Temp particle used for graphics
|
|
||||||
Particle tpart;
|
|
||||||
|
|
||||||
int Element_PIPE_update(UPDATE_FUNC_ARGS);
|
int Element_PIPE_update(UPDATE_FUNC_ARGS);
|
||||||
int Element_PIPE_graphics(GRAPHICS_FUNC_ARGS);
|
int Element_PIPE_graphics(GRAPHICS_FUNC_ARGS);
|
||||||
@ -55,8 +53,6 @@ void Element::Element_PIPE()
|
|||||||
|
|
||||||
Update = &Element_PIPE_update;
|
Update = &Element_PIPE_update;
|
||||||
Graphics = &Element_PIPE_graphics;
|
Graphics = &Element_PIPE_graphics;
|
||||||
|
|
||||||
memset(&tpart, 0, sizeof(Particle));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x000000FF element
|
// 0x000000FF element
|
||||||
@ -374,24 +370,31 @@ int Element_PIPE_graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Emulate the graphics of stored particle
|
// Temp particle used for graphics.
|
||||||
tpart.type = t;
|
Particle tpart = *cpart;
|
||||||
tpart.temp = cpart->temp;
|
|
||||||
tpart.life = cpart->tmp2;
|
// Emulate the graphics of stored particle.
|
||||||
tpart.tmp = cpart->tmp3;
|
memset(cpart, 0, sizeof(Particle));
|
||||||
tpart.ctype = cpart->tmp4;
|
cpart->type = t;
|
||||||
|
cpart->temp = tpart.temp;
|
||||||
|
cpart->life = tpart.tmp2;
|
||||||
|
cpart->tmp = tpart.tmp3;
|
||||||
|
cpart->ctype = tpart.tmp4;
|
||||||
|
|
||||||
*colr = PIXR(ren->sim->elements[t].Colour);
|
*colr = PIXR(ren->sim->elements[t].Colour);
|
||||||
*colg = PIXG(ren->sim->elements[t].Colour);
|
*colg = PIXG(ren->sim->elements[t].Colour);
|
||||||
*colb = PIXB(ren->sim->elements[t].Colour);
|
*colb = PIXB(ren->sim->elements[t].Colour);
|
||||||
if (ren->sim->elements[t].Graphics)
|
if (ren->sim->elements[t].Graphics)
|
||||||
{
|
{
|
||||||
(*(ren->sim->elements[t].Graphics))(ren, &tpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb);
|
(*(ren->sim->elements[t].Graphics))(ren, cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Element::defaultGraphics(ren, &tpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb);
|
Element::defaultGraphics(ren, cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore original particle data.
|
||||||
|
*cpart = tpart;
|
||||||
}
|
}
|
||||||
//*colr = PIXR(elements[t].pcolors);
|
//*colr = PIXR(elements[t].pcolors);
|
||||||
//*colg = PIXG(elements[t].pcolors);
|
//*colg = PIXG(elements[t].pcolors);
|
||||||
|
Reference in New Issue
Block a user