From d2af4470a56265155f63cd9fe54ed3e33825fac7 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 4 Oct 2012 12:35:11 -0400 Subject: [PATCH] show # of parts, [GRID X], PIPE/PPIP with X, and molten X (with debug on) in HUD --- src/game/GameView.cpp | 28 +++++++++++++++++++++++----- src/simulation/Sample.h | 4 +++- src/simulation/Simulation.cpp | 2 ++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index bb76c9762..7ba1fe728 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -1882,11 +1882,22 @@ void GameView::OnDraw() { if(showDebug) { - sampleInfo << c->ElementResolve(sample.particle.type); - if(sample.particle.ctype > 0 && sample.particle.ctype < PT_NUM) - sampleInfo << " (" << c->ElementResolve(sample.particle.ctype) << ")"; + int ctype = sample.particle.ctype; + if (sample.particle.type == PT_PIPE || sample.particle.type == PT_PPIP) + ctype = sample.particle.tmp; + + if (sample.particle.type == PT_LAVA && ctype > 0 && ctype < PT_NUM) + sampleInfo << "Molten " << c->ElementResolve(ctype); + else if((sample.particle.type == PT_PIPE || sample.particle.type == PT_PPIP) && ctype > 0 && ctype < PT_NUM) + sampleInfo << c->ElementResolve(sample.particle.type) << " with " << c->ElementResolve(ctype); else - sampleInfo << " ()"; + { + sampleInfo << c->ElementResolve(sample.particle.type); + if(ctype > 0 && ctype < PT_NUM) + sampleInfo << " (" << c->ElementResolve(ctype) << ")"; + else + sampleInfo << " ()"; + } sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f; sampleInfo << ", Life: " << sample.particle.life; sampleInfo << ", Tmp: " << sample.particle.tmp; @@ -1894,8 +1905,10 @@ void GameView::OnDraw() } else { - if(sample.particle.type == PT_LAVA && sample.particle.ctype > 0 && sample.particle.ctype < PT_NUM) + if (sample.particle.type == PT_LAVA && sample.particle.ctype > 0 && sample.particle.ctype < PT_NUM) sampleInfo << "Molten " << c->ElementResolve(sample.particle.ctype); + else if((sample.particle.type == PT_PIPE || sample.particle.type == PT_PPIP) && sample.particle.tmp > 0 && sample.particle.tmp < PT_NUM) + sampleInfo << c->ElementResolve(sample.particle.type) << " with " << c->ElementResolve(sample.particle.tmp); else sampleInfo << c->ElementResolve(sample.particle.type); sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f; @@ -1984,6 +1997,11 @@ void GameView::OnDraw() #endif fpsInfo << "FPS: " << std::fixed << ui::Engine::Ref().GetFps(); + if (showDebug) + fpsInfo << " Parts: " << sample.NumParts; + if (ren->GetGridSize()) + fpsInfo << " [GRID: " << ren->GetGridSize() << "]"; + textWidth = Graphics::textwidth((char*)fpsInfo.str().c_str()); g->fillrect(12, 12, textWidth+8, 15, 0, 0, 0, 255*0.5); g->drawtext(16, 16, (const char*)fpsInfo.str().c_str(), 32, 216, 255, 255*0.75); diff --git a/src/simulation/Sample.h b/src/simulation/Sample.h index 0e67331af..3605a5d95 100644 --- a/src/simulation/Sample.h +++ b/src/simulation/Sample.h @@ -21,7 +21,9 @@ public: float GravityVelocityX; float GravityVelocityY; - SimulationSample() : PositionX(0), PositionY(0), ParticleID(0), particle(), AirPressure(0), AirVelocityX(0), AirVelocityY(0), WallType(0), Gravity(0), GravityVelocityX(0), GravityVelocityY(0), AirTemperature(0) {} + int NumParts; + + 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) {} }; #endif \ No newline at end of file diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 7ad22502d..be114e1a6 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -439,6 +439,8 @@ SimulationSample Simulation::Get(int x, int y) sample.GravityVelocityX = gravx[(y/CELL)*(XRES/CELL)+(x/CELL)]; sample.GravityVelocityY = gravy[(y/CELL)*(XRES/CELL)+(x/CELL)]; } + + sample.NumParts = NUM_PARTS; return sample; }