diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-05 13:03:54 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-05 13:03:54 (GMT) |
| commit | 351ce1525f570a52d571d1da720ae4f6a5815a22 (patch) | |
| tree | 8d368a20635c6ac5901acc8ad0d90adf2afacdbc | |
| parent | 05024cc7870606ea9a2ca3840811a665748d52fb (diff) | |
| download | powder-351ce1525f570a52d571d1da720ae4f6a5815a22.zip powder-351ce1525f570a52d571d1da720ae4f6a5815a22.tar.gz | |
Update gravity walls, fixes issue #52
| -rw-r--r-- | src/simulation/Simulation.cpp | 15 | ||||
| -rw-r--r-- | src/simulation/Simulation.h | 2 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 59ff5d1..8717faa 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -114,7 +114,7 @@ int Simulation::Load(int fullX, int fullY, GameSave * save) } } - grav->gravity_mask(); + gravWallChanged = true; return 0; } @@ -232,6 +232,8 @@ void Simulation::clear_area(int area_x, int area_y, int area_w, int area_h) { for (cx=0; cx<area_w; cx++) { + if(bmap[(cy+area_y)/CELL][(cx+area_x)/CELL] == WL_GRAV) + gravWallChanged = true; bmap[(cy+area_y)/CELL][(cx+area_x)/CELL] = 0; delete_part(cx+area_x, cy+area_y, 0); } @@ -1240,6 +1242,10 @@ int Simulation::CreateWalls(int x, int y, int rx, int ry, int c, int flags, Brus fvx[j][i] = 0.0f; fvy[j][i] = 0.0f; } + if (b==WL_GRAV || bmap[j][i]==WL_GRAV) + { + gravWallChanged = true; + } if (b==WL_STREAM) { i = x + rx/2; @@ -1253,7 +1259,6 @@ int Simulation::CreateWalls(int x, int y, int rx, int ry, int c, int flags, Brus bmap[j][i] = WL_STREAM; continue; } - if (b==0 && bmap[j][i]==WL_GRAV) gravwl_timeout = 60; bmap[j][i] = b; } } @@ -4341,6 +4346,12 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu gravy = grav->gravy; gravp = grav->gravp; gravmap = grav->gravmap; + + if(gravWallChanged) + { + grav->gravity_mask(); + gravWallChanged = false; + } } } diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h index 31a0a07..e4f4311 100644 --- a/src/simulation/Simulation.h +++ b/src/simulation/Simulation.h @@ -62,7 +62,7 @@ public: playerst fighters[256]; //255 is the maximum number of fighters unsigned char fighcount; //Contains the number of fighters int lighting_recreate; - int gravwl_timeout; + bool gravWallChanged; Particle portalp[CHANNELS][8][80]; Particle emptyparticle; int portal_rx[8]; |
