From 8c09bf578774fdf9daec5ff40d95ff9518deb798 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Wed, 5 Sep 2012 09:07:49 +0100 Subject: [PATCH] Also fix bugs with energy particles that pass directly from PIPE to portal --- src/elements/prto.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/elements/prto.c b/src/elements/prto.c index 68ea0f59a..d7eb6425a 100644 --- a/src/elements/prto.c +++ b/src/elements/prto.c @@ -87,7 +87,19 @@ int update_PRTO(UPDATE_FUNC_ARGS) { fighters[(unsigned char)parts[np].tmp].spwn = 0; fighters[(unsigned char)portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 1; } - parts[np] = portalp[parts[i].tmp][randomness][nnx]; + if (portalp[parts[i].tmp][randomness][nnx].vx == 0.0f && portalp[parts[i].tmp][randomness][nnx].vy == 0.0f) + { + // particles that have passed from PIPE into PRTI have lost their velocity, so use the velocity of the newly created particle if the particle in the portal has no velocity + float tmp_vx = parts[np].vx; + float tmp_vy = parts[np].vy; + parts[np] = portalp[parts[i].tmp][randomness][nnx]; + parts[np].vx = tmp_vx; + parts[np].vy = tmp_vy; + } + else + { + parts[np] = portalp[parts[i].tmp][randomness][nnx]; + } parts[np].x = x+rx; parts[np].y = y+ry; portalp[parts[i].tmp][randomness][nnx] = emptyparticle;