summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-02-08 16:39:14 (GMT)
committer jacob1 <jfu614@gmail.com>2013-02-08 16:39:14 (GMT)
commitcd0af92fb316a3e3dc2de7082512ff2d650e7a70 (patch)
treedfb7b0dc5f12df7145ec84eea6efe2417c16748c /src
parent8e02443f0a294fcec9bcc8678dcf8b61f0d56f99 (diff)
downloadpowder-cd0af92fb316a3e3dc2de7082512ff2d650e7a70.zip
powder-cd0af92fb316a3e3dc2de7082512ff2d650e7a70.tar.gz
minor fixes to color picker / small speed improvement
Diffstat (limited to 'src')
-rw-r--r--src/colourpicker/ColourPickerActivity.cpp19
-rw-r--r--src/game/GameModel.cpp2
-rw-r--r--src/localbrowser/LocalBrowserController.cpp2
-rw-r--r--src/simulation/Simulation.cpp101
4 files changed, 67 insertions, 57 deletions
diff --git a/src/colourpicker/ColourPickerActivity.cpp b/src/colourpicker/ColourPickerActivity.cpp
index 65bccc9..966cd41 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+currentValue, offsetY+4+128, offsetX+currentValue, offsetY+13+128);
- g->xor_line(offsetX+currentValue+1, offsetY+4+128, offsetX+currentValue+1, offsetY+13+128);
+ 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);
+
+ //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 550328a..bc8ec4f 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 4719bf1..03c83f8 100644
--- a/src/localbrowser/LocalBrowserController.cpp
+++ b/src/localbrowser/LocalBrowserController.cpp
@@ -86,7 +86,7 @@ void LocalBrowserController::removeSelectedC()
};
std::vector<std::string> 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 8eb3094..1a090f7 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<YRES && pv[y/CELL+1][x/CELL]<3.5f)
- pv[y/CELL+1][x/CELL] += elements[t].HotAir*(3.5f-pv[y/CELL+1][x/CELL]);
- if (x+CELL<XRES)
+ if (t==PT_GAS||t==PT_NBLE)
{
- if (pv[y/CELL][x/CELL+1]<3.5f)
- pv[y/CELL][x/CELL+1] += elements[t].HotAir*(3.5f-pv[y/CELL][x/CELL+1]);
- if (y+CELL<YRES && pv[y/CELL+1][x/CELL+1]<3.5f)
- pv[y/CELL+1][x/CELL+1] += elements[t].HotAir*(3.5f-pv[y/CELL+1][x/CELL+1]);
+ 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<YRES && pv[y/CELL+1][x/CELL]<3.5f)
+ pv[y/CELL+1][x/CELL] += elements[t].HotAir*(3.5f-pv[y/CELL+1][x/CELL]);
+ if (x+CELL<XRES)
+ {
+ if (pv[y/CELL][x/CELL+1]<3.5f)
+ pv[y/CELL][x/CELL+1] += elements[t].HotAir*(3.5f-pv[y/CELL][x/CELL+1]);
+ if (y+CELL<YRES && pv[y/CELL+1][x/CELL+1]<3.5f)
+ pv[y/CELL+1][x/CELL+1] += elements[t].HotAir*(3.5f-pv[y/CELL+1][x/CELL+1]);
+ }
}
- }
- else//add the hotair variable to the pressure map, like black hole, or white hole.
- {
- pv[y/CELL][x/CELL] += elements[t].HotAir;
- if (y+CELL<YRES)
- pv[y/CELL+1][x/CELL] += elements[t].HotAir;
- if (x+CELL<XRES)
+ else//add the hotair variable to the pressure map, like black hole, or white hole.
{
- pv[y/CELL][x/CELL+1] += elements[t].HotAir;
+ pv[y/CELL][x/CELL] += elements[t].HotAir;
if (y+CELL<YRES)
- pv[y/CELL+1][x/CELL+1] += elements[t].HotAir;
+ pv[y/CELL+1][x/CELL] += elements[t].HotAir;
+ if (x+CELL<XRES)
+ {
+ pv[y/CELL][x/CELL+1] += elements[t].HotAir;
+ if (y+CELL<YRES)
+ pv[y/CELL+1][x/CELL+1] += elements[t].HotAir;
+ }
}
}
-
- //Gravity mode by Moach
- switch (gravityMode)
- {
- default:
- case 0:
- pGravX = 0.0f;
- pGravY = elements[t].Gravity;
- break;
- case 1:
- pGravX = pGravY = 0.0f;
- break;
- case 2:
- pGravD = 0.01f - hypotf((x - XCNTR), (y - YCNTR));
- pGravX = elements[t].Gravity * ((float)(x - XCNTR) / pGravD);
- pGravY = elements[t].Gravity * ((float)(y - YCNTR) / pGravD);
- break;
- }
- //Get some gravity from the gravity map
- if (t==PT_ANAR)
+ if (elements[t].Gravity || !(elements[t].Properties & TYPE_SOLID))
{
- // perhaps we should have a ptypes variable for this
- pGravX -= gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
- pGravY -= gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
- }
- else if(t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH && !(elements[t].Properties & TYPE_SOLID))
- {
- pGravX += gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
- pGravY += gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
+ //Gravity mode by Moach
+ switch (gravityMode)
+ {
+ default:
+ case 0:
+ pGravX = 0.0f;
+ pGravY = elements[t].Gravity;
+ break;
+ case 1:
+ pGravX = pGravY = 0.0f;
+ break;
+ case 2:
+ pGravD = 0.01f - hypotf((x - XCNTR), (y - YCNTR));
+ pGravX = elements[t].Gravity * ((float)(x - XCNTR) / pGravD);
+ pGravY = elements[t].Gravity * ((float)(y - YCNTR) / pGravD);
+ break;
+ }
+ //Get some gravity from the gravity map
+ if (t==PT_ANAR)
+ {
+ // perhaps we should have a ptypes variable for this
+ pGravX -= gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
+ pGravY -= gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
+ }
+ else if(t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH && !(elements[t].Properties & TYPE_SOLID))
+ {
+ pGravX += gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
+ pGravY += gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
+ }
}
+ else
+ pGravX = pGravY = 0;
//velocity updates for the particle
if (t != PT_SPNG || !(parts[i].flags&FLAG_MOVABLE))
{