summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-04-26 15:57:04 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-04-26 15:57:04 (GMT)
commit981e17927baaa97cd50ec9677de87e26d28b01be (patch)
tree0ecb4f868b0e334b81b4e2ad09f0cd611b17cc5c /src
parent06c0949beb5db99b718c8a8b9dbefaf6c1655006 (diff)
downloadpowder-981e17927baaa97cd50ec9677de87e26d28b01be.zip
powder-981e17927baaa97cd50ec9677de87e26d28b01be.tar.gz
Fix BMTL and gravity breaking
Diffstat (limited to 'src')
-rw-r--r--src/powder.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/powder.c b/src/powder.c
index 6335130..6a4290d 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1089,7 +1089,7 @@ int nearest_part(int ci, int t)
void update_particles_i(pixel *vid, int start, int inc)
{
int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors, createdsomething;
- float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp, ctemph, ctempl;
+ float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp, ctemph, ctempl, gravtot;
int fin_x, fin_y, clear_x, clear_y;
float fin_xf, fin_yf, clear_xf, clear_yf;
float nn, ct1, ct2, swappage;
@@ -1651,6 +1651,7 @@ void update_particles_i(pixel *vid, int start, int inc)
s = 1;
+ gravtot = fabsf(gravy[y/CELL][x/CELL])+fabsf(gravx[y/CELL][x/CELL]);
if (pv[y/CELL][x/CELL]>ptransitions[t].phv&&ptransitions[t].pht>-1) {
// particle type change due to high pressure
if (ptransitions[t].pht!=PT_NUM)
@@ -1668,10 +1669,17 @@ void update_particles_i(pixel *vid, int start, int inc)
if (ptransitions[t].plt!=PT_NUM)
t = ptransitions[t].plt;
else s = 0;
- } else if ((fabsf(gravy[y/CELL][x/CELL])+fabsf(gravx[y/CELL][x/CELL]))>(ptransitions[t].phv/4.0f)&&ptransitions[t].pht>-1) {
+ } else if (gravtot>(ptransitions[t].phv/4.0f)&&ptransitions[t].pht>-1) {
// particle type change due to high gravity
if (ptransitions[t].pht!=PT_NUM)
t = ptransitions[t].pht;
+ else if (t==PT_BMTL) {
+ if (gravtot>0.625f)
+ t = PT_BRMT;
+ else if (gravtot>0.25f && parts[i].tmp==1)
+ t = PT_BRMT;
+ else s = 0;
+ }
else s = 0;
} else s = 0;
if (s) { // particle type change occurred