summaryrefslogtreecommitdiff
path: root/src/simulation/Simulation.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-02-10 00:42:31 (GMT)
committer jacob1 <jfu614@gmail.com>2013-02-10 00:42:31 (GMT)
commit28e8b9eb39c79071d5748cced73790c493d7aa29 (patch)
treeff2045f7354e47776453335c6acc16d9ec330ae6 /src/simulation/Simulation.cpp
parentdc6398a33e3be47a83ff38b9bbabedcbe6756341 (diff)
downloadpowder-28e8b9eb39c79071d5748cced73790c493d7aa29.zip
powder-28e8b9eb39c79071d5748cced73790c493d7aa29.tar.gz
make smudge tool more similar to the old one
Diffstat (limited to 'src/simulation/Simulation.cpp')
-rw-r--r--src/simulation/Simulation.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index ad5ed63..a9d1b62 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -987,25 +987,27 @@ void Simulation::ApplyDecoration(int x, int y, int colR_, int colG_, int colB_,
int rx, ry;
float num = 0;
- for (rx=-1; rx<2; rx++)
- for (ry=-1; ry<2; ry++)
+ for (rx=-2; rx<3; rx++)
+ for (ry=-2; ry<3; ry++)
{
- if ((pmap[y+ry][x+rx]&0xFF) && parts[pmap[y+ry][x+rx]>>8].dcolour)
+ if (abs(rx)+abs(ry) > 2 && (pmap[y+ry][x+rx]&0xFF) && parts[pmap[y+ry][x+rx]>>8].dcolour)
{
Particle part = parts[pmap[y+ry][x+rx]>>8];
num += 1.0f;
- tas += ((float)((part.dcolour>>24)&0xFF))/255.0f;
- trs += ((float)((part.dcolour>>16)&0xFF))/255.0f;
- tgs += ((float)((part.dcolour>>8)&0xFF))/255.0f;
- tbs += ((float)((part.dcolour)&0xFF))/255.0f;
+ tas += ((float)((part.dcolour>>24)&0xFF));
+ trs += ((float)((part.dcolour>>16)&0xFF));
+ tgs += ((float)((part.dcolour>>8)&0xFF));
+ tbs += ((float)((part.dcolour)&0xFF));
}
}
if (num == 0)
return;
- ta = ((tas/num));//*0.8f) + (ta*0.2f);
- tr = ((trs/num));//*0.8f) + (tr*0.2f);
- tg = ((tgs/num));//*0.8f) + (tg*0.2f);
- tb = ((tbs/num));//*0.8f) + (tb*0.2f);
+ ta = (tas/num)/255.0f;
+ tr = (trs/num)/255.0f;
+ tg = (tgs/num)/255.0f;
+ tb = (tbs/num)/255.0f;
+ if (!parts[rp>>8].dcolour)
+ ta -= 3/255.0f;
}
ta *= 255.0f; tr *= 255.0f; tg *= 255.0f; tb *= 255.0f;