From cd0af92fb316a3e3dc2de7082512ff2d650e7a70 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Fri, 8 Feb 2013 11:39:14 -0500 Subject: [PATCH] minor fixes to color picker / small speed improvement --- src/colourpicker/ColourPickerActivity.cpp | 17 ++-- src/game/GameModel.cpp | 2 - src/localbrowser/LocalBrowserController.cpp | 2 +- src/simulation/Simulation.cpp | 101 +++++++++++--------- 4 files changed, 66 insertions(+), 56 deletions(-) diff --git a/src/colourpicker/ColourPickerActivity.cpp b/src/colourpicker/ColourPickerActivity.cpp index 65bccc99a..966cd41ad 100644 --- a/src/colourpicker/ColourPickerActivity.cpp +++ b/src/colourpicker/ColourPickerActivity.cpp @@ -169,7 +169,7 @@ void ColourPickerActivity::OnMouseDown(int x, int y, unsigned button) { x -= Position.X+5; y -= Position.Y+5; - if(x >= 0 && x <= 256 && y >= 0 && y < 127) + if(x >= 0 && x < 256 && y >= 0 && y <= 128) { mouseDown = true; currentHue = (float(x)/float(255))*359.0f; @@ -185,7 +185,7 @@ void ColourPickerActivity::OnMouseDown(int x, int y, unsigned button) currentHue = 0; } - if(x >= 0 && x <= 256 && y >= 131 && y < 142) + if(x >= 0 && x < 256 && y >= 132 && y <= 142) { valueMouseDown = true; currentValue = x; @@ -295,13 +295,18 @@ void ColourPickerActivity::OnDraw() g->blendpixel(value+offsetX, i+offsetY+127+5, cr, cg, cb, currentAlpha); } + //draw color square pointer int currentHueX = clamp_flt(currentHue, 0, 359); int currentSaturationY = ((255-currentSaturation)/2); - g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY-5, offsetX+currentHueX, offsetY+currentSaturationY+5); - g->xor_line(offsetX+currentHueX-5, offsetY+currentSaturationY, offsetX+currentHueX+5, offsetY+currentSaturationY); + g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY-5, offsetX+currentHueX, offsetY+currentSaturationY-1); + g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY+1, offsetX+currentHueX, offsetY+currentSaturationY+5); + g->xor_line(offsetX+currentHueX-5, offsetY+currentSaturationY, offsetX+currentHueX-1, offsetY+currentSaturationY); + g->xor_line(offsetX+currentHueX+1, offsetY+currentSaturationY, offsetX+currentHueX+5, offsetY+currentSaturationY); - g->xor_line(offsetX+currentValue, offsetY+4+128, offsetX+currentValue, offsetY+13+128); - g->xor_line(offsetX+currentValue+1, offsetY+4+128, offsetX+currentValue+1, offsetY+13+128); + //draw brightness bar pointer + int currentValueX = restrict_flt(currentValue, 0, 254); + g->xor_line(offsetX+currentValueX, offsetY+4+128, offsetX+currentValueX, offsetY+13+128); + g->xor_line(offsetX+currentValueX+1, offsetY+4+128, offsetX+currentValueX+1, offsetY+13+128); } ColourPickerActivity::~ColourPickerActivity() { diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 550328a3d..bc8ec4fda 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -843,13 +843,11 @@ void GameModel::FrameStep(int frames) void GameModel::ClearSimulation() { - //Load defaults sim->gravityMode = 0; sim->air->airMode = 0; sim->legacy_enable = false; sim->water_equal_test = false; - sim->grav->stop_grav_async(); sim->SetEdgeMode(edgeMode); sim->clear_sim(); diff --git a/src/localbrowser/LocalBrowserController.cpp b/src/localbrowser/LocalBrowserController.cpp index 4719bf1bf..03c83f8bd 100644 --- a/src/localbrowser/LocalBrowserController.cpp +++ b/src/localbrowser/LocalBrowserController.cpp @@ -86,7 +86,7 @@ void LocalBrowserController::removeSelectedC() }; std::vector selected = browserModel->GetSelected(); - new TaskWindow("Removing saves", new RemoveSavesTask(this, selected)); + new TaskWindow("Removing stamps", new RemoveSavesTask(this, selected)); } void LocalBrowserController::RescanStamps() diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 8eb309438..1a090f7f9 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -3663,62 +3663,69 @@ void Simulation::update_particles_i(int start, int inc) vx[y/CELL][x/CELL] = vx[y/CELL][x/CELL]*elements[t].AirLoss + elements[t].AirDrag*parts[i].vx; vy[y/CELL][x/CELL] = vy[y/CELL][x/CELL]*elements[t].AirLoss + elements[t].AirDrag*parts[i].vy; - if (t==PT_GAS||t==PT_NBLE) + if (elements[t].HotAir) { - if (pv[y/CELL][x/CELL]<3.5f) - pv[y/CELL][x/CELL] += elements[t].HotAir*(3.5f-pv[y/CELL][x/CELL]); - if (y+CELL