summaryrefslogtreecommitdiff
path: root/src/simulation/Simulation.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-06-21 00:29:20 (GMT)
committer jacob1 <jfu614@gmail.com>2013-06-21 00:29:20 (GMT)
commit3aac957e501a2fc5fde868f1fe973c523968357e (patch)
tree08653e5d4338f8b1b444eaa6081bcc2ed45f9427 /src/simulation/Simulation.cpp
parentfcff2ecc7fdaf93c39086fa52ae6608982fd509c (diff)
downloadpowder-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/Simulation.cpp')
-rw-r--r--src/simulation/Simulation.cpp51
1 files changed, 28 insertions, 23 deletions
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;