mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-31 11:41:51 +02:00
Preserve deco in pipe, as long as the pipe wasn't already decorated
This commit is contained in:
@@ -457,6 +457,13 @@ void Element_PIPE_transfer_pipe_to_part(Simulation * sim, Particle *pipe, Partic
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
pipe->ctype = 0;
|
pipe->ctype = 0;
|
||||||
|
|
||||||
|
// If deco originated from particle, and not PIPE, then copy it
|
||||||
|
if (pipe->tmp & PFLAG_PARTICLE_DECO)
|
||||||
|
{
|
||||||
|
part->dcolour = pipe->dcolour;
|
||||||
|
pipe->dcolour = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,6 +479,12 @@ static void transfer_part_to_pipe(Particle *part, Particle *pipe)
|
|||||||
pipe->tmp2 = part->life;
|
pipe->tmp2 = part->life;
|
||||||
pipe->tmp3 = part->tmp;
|
pipe->tmp3 = part->tmp;
|
||||||
pipe->tmp4 = part->ctype;
|
pipe->tmp4 = part->ctype;
|
||||||
|
|
||||||
|
if (part->dcolour && !pipe->dcolour)
|
||||||
|
{
|
||||||
|
pipe->dcolour = part->dcolour;
|
||||||
|
pipe->tmp |= PFLAG_PARTICLE_DECO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void transfer_pipe_to_pipe(Particle *src, Particle *dest, bool STOR)
|
static void transfer_pipe_to_pipe(Particle *src, Particle *dest, bool STOR)
|
||||||
@@ -486,6 +499,18 @@ static void transfer_pipe_to_pipe(Particle *src, Particle *dest, bool STOR)
|
|||||||
{
|
{
|
||||||
dest->ctype = src->ctype;
|
dest->ctype = src->ctype;
|
||||||
src->ctype = 0;
|
src->ctype = 0;
|
||||||
|
|
||||||
|
if (src->tmp & PFLAG_PARTICLE_DECO)
|
||||||
|
{
|
||||||
|
// Even if source pipe has particle deco, don't override existing pipe deco. Just delete source deco only.
|
||||||
|
if (!dest->dcolour)
|
||||||
|
{
|
||||||
|
dest->dcolour = src->dcolour;
|
||||||
|
dest->tmp |= PFLAG_PARTICLE_DECO;
|
||||||
|
}
|
||||||
|
src->dcolour = 0;
|
||||||
|
src->tmp &= ~PFLAG_PARTICLE_DECO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dest->tmp & PFLAG_CAN_CONDUCT) == 0)
|
if ((dest->tmp & PFLAG_CAN_CONDUCT) == 0)
|
||||||
|
@@ -15,6 +15,7 @@ void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy);
|
|||||||
// 0x000E0000 PIPE color data stored here
|
// 0x000E0000 PIPE color data stored here
|
||||||
|
|
||||||
constexpr int PFLAG_CAN_CONDUCT = 0x00000001;
|
constexpr int PFLAG_CAN_CONDUCT = 0x00000001;
|
||||||
|
constexpr int PFLAG_PARTICLE_DECO = 0x00000002; // differentiate particle deco from pipe deco
|
||||||
constexpr int PFLAG_NORMALSPEED = 0x00010000;
|
constexpr int PFLAG_NORMALSPEED = 0x00010000;
|
||||||
constexpr int PFLAG_INITIALIZING = 0x00020000; // colors haven't been set yet
|
constexpr int PFLAG_INITIALIZING = 0x00020000; // colors haven't been set yet
|
||||||
constexpr int PFLAG_COLOR_RED = 0x00040000;
|
constexpr int PFLAG_COLOR_RED = 0x00040000;
|
||||||
|
Reference in New Issue
Block a user