summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2012-01-20 15:35:28 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-25 13:33:22 (GMT)
commita9c198dd469579711043838f5960283ed848c471 (patch)
tree95e011f7ff2a0e9ca0cb151eb947af3a8f37efc8 /src
parent32c9ff30999eecad31c096c9f6a677a458e91c25 (diff)
downloadpowder-a9c198dd469579711043838f5960283ed848c471.zip
powder-a9c198dd469579711043838f5960283ed848c471.tar.gz
Fix WARP destroying DMND
If WARP moved in its update function, then the x/y variables in the main loop were out of date. When the normal movement code ran, changes were made to the wrong place in the pmap. This resulted in some particles with low IDs being destroyed by the addition of WARP+SING. This change might also fix the WARP+PRTI crash that I never managed to reproduce.
Diffstat (limited to 'src')
-rw-r--r--src/powder.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/powder.c b/src/powder.c
index 22a9f87..00b558a 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1706,8 +1706,6 @@ void update_particles_i(pixel *vid, int start, int inc)
for (i=0; i<=parts_lastActiveIndex; i++)
if (parts[i].type)
{
- lx = parts[i].x;
- ly = parts[i].y;
t = parts[i].type;
if (t<0 || t>=PT_NUM)
{
@@ -2121,12 +2119,21 @@ void update_particles_i(pixel *vid, int start, int inc)
{
if ((*(ptypes[t].update_func))(i,x,y,surround_space,nt))
continue;
+ else if (t==PT_WARP)
+ {
+ // Warp does some movement in its update func, update variables to avoid incorrect data in pmap
+ x = (int)(parts[i].x+0.5f);
+ y = (int)(parts[i].y+0.5f);
+ }
}
#ifdef LUACONSOLE
if(lua_el_mode[t])
{
if(luacon_part_update(t,i,x,y,surround_space,nt))
continue;
+ // Need to update variables, in case they've been changed by Lua
+ x = (int)(parts[i].x+0.5f);
+ y = (int)(parts[i].y+0.5f);
}
#endif
if (legacy_enable)//if heat sim is off