diff options
| author | jacob1 <jfu614@gmail.com> | 2013-06-21 00:29:20 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-06-21 00:29:20 (GMT) |
| commit | 3aac957e501a2fc5fde868f1fe973c523968357e (patch) | |
| tree | 08653e5d4338f8b1b444eaa6081bcc2ed45f9427 /src/simulation | |
| parent | fcff2ecc7fdaf93c39086fa52ae6608982fd509c (diff) | |
| download | powder-3aac957e501a2fc5fde868f1fe973c523968357e.zip powder-3aac957e501a2fc5fde868f1fe973c523968357e.tar.gz | |
HUD displays the correct name of LIFE particles in the HUD, show mouse position in HUD on the edges of the screen
Diffstat (limited to 'src/simulation')
| -rw-r--r-- | src/simulation/Sample.h | 3 | ||||
| -rw-r--r-- | src/simulation/Simulation.cpp | 51 | ||||
| -rw-r--r-- | src/simulation/Simulation.h | 2 |
3 files changed, 31 insertions, 25 deletions
diff --git a/src/simulation/Sample.h b/src/simulation/Sample.h index d37d0c8..846101a 100644 --- a/src/simulation/Sample.h +++ b/src/simulation/Sample.h @@ -22,8 +22,9 @@ public: float GravityVelocityY; int NumParts; + bool isMouseInSim; - SimulationSample() : PositionX(0), PositionY(0), ParticleID(0), particle(), AirPressure(0), AirVelocityX(0), AirVelocityY(0), WallType(0), Gravity(0), GravityVelocityX(0), GravityVelocityY(0), AirTemperature(0), NumParts(0) {} + SimulationSample() : PositionX(0), PositionY(0), ParticleID(0), particle(), AirPressure(0), AirVelocityX(0), AirVelocityY(0), WallType(0), Gravity(0), GravityVelocityX(0), GravityVelocityY(0), AirTemperature(0), NumParts(0), isMouseInSim(true) {} }; #endif diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index fedb989..0fff552 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -478,36 +478,41 @@ int Simulation::flood_prop(int x, int y, size_t propoffset, void * propvalue, St return 0; } -SimulationSample Simulation::Get(int x, int y) +SimulationSample Simulation::GetSample(int x, int y) { SimulationSample sample; sample.PositionX = x; sample.PositionY = y; - if (photons[y][x]) + if (x >= 0 && x < XRES && y >= 0 && y < YRES) { - sample.particle = parts[photons[y][x]>>8]; - sample.ParticleID = photons[y][x]>>8; - } - else if (pmap[y][x]) - { - sample.particle = parts[pmap[y][x]>>8]; - sample.ParticleID = pmap[y][x]>>8; - } - if (bmap[y/CELL][x/CELL]) - { - sample.WallType = bmap[y/CELL][x/CELL]; - } - sample.AirPressure = pv[y/CELL][x/CELL]; - sample.AirTemperature = hv[y/CELL][x/CELL]; - sample.AirVelocityX = vx[y/CELL][x/CELL]; - sample.AirVelocityY = vy[y/CELL][x/CELL]; + if (photons[y][x]) + { + sample.particle = parts[photons[y][x]>>8]; + sample.ParticleID = photons[y][x]>>8; + } + else if (pmap[y][x]) + { + sample.particle = parts[pmap[y][x]>>8]; + sample.ParticleID = pmap[y][x]>>8; + } + if (bmap[y/CELL][x/CELL]) + { + sample.WallType = bmap[y/CELL][x/CELL]; + } + sample.AirPressure = pv[y/CELL][x/CELL]; + sample.AirTemperature = hv[y/CELL][x/CELL]; + sample.AirVelocityX = vx[y/CELL][x/CELL]; + sample.AirVelocityY = vy[y/CELL][x/CELL]; - if(grav->ngrav_enable) - { - sample.Gravity = gravp[(y/CELL)*(XRES/CELL)+(x/CELL)]; - sample.GravityVelocityX = gravx[(y/CELL)*(XRES/CELL)+(x/CELL)]; - sample.GravityVelocityY = gravy[(y/CELL)*(XRES/CELL)+(x/CELL)]; + if(grav->ngrav_enable) + { + sample.Gravity = gravp[(y/CELL)*(XRES/CELL)+(x/CELL)]; + sample.GravityVelocityX = gravx[(y/CELL)*(XRES/CELL)+(x/CELL)]; + sample.GravityVelocityY = gravy[(y/CELL)*(XRES/CELL)+(x/CELL)]; + } } + else + sample.isMouseInSim = false; sample.NumParts = NUM_PARTS; return sample; diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h index bc728b4..67f297e 100644 --- a/src/simulation/Simulation.h +++ b/src/simulation/Simulation.h @@ -120,7 +120,7 @@ public: int Load(int x, int y, GameSave * save); GameSave * Save(); GameSave * Save(int x1, int y1, int x2, int y2); - SimulationSample Get(int x, int y); + SimulationSample GetSample(int x, int y); Snapshot * CreateSnapshot(); void Restore(const Snapshot & snap); |
