Fix BMTL and gravity breaking

This commit is contained in:
Simon Robertshaw 2011-04-26 16:57:04 +01:00
parent 06c0949beb
commit 981e17927b

View File

@ -1089,7 +1089,7 @@ int nearest_part(int ci, int t)
void update_particles_i(pixel *vid, int start, int inc) 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; 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; int fin_x, fin_y, clear_x, clear_y;
float fin_xf, fin_yf, clear_xf, clear_yf; float fin_xf, fin_yf, clear_xf, clear_yf;
float nn, ct1, ct2, swappage; float nn, ct1, ct2, swappage;
@ -1651,6 +1651,7 @@ void update_particles_i(pixel *vid, int start, int inc)
s = 1; 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) { if (pv[y/CELL][x/CELL]>ptransitions[t].phv&&ptransitions[t].pht>-1) {
// particle type change due to high pressure // particle type change due to high pressure
if (ptransitions[t].pht!=PT_NUM) 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) if (ptransitions[t].plt!=PT_NUM)
t = ptransitions[t].plt; t = ptransitions[t].plt;
else s = 0; 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 // particle type change due to high gravity
if (ptransitions[t].pht!=PT_NUM) if (ptransitions[t].pht!=PT_NUM)
t = ptransitions[t].pht; 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;
} else s = 0; } else s = 0;
if (s) { // particle type change occurred if (s) { // particle type change occurred