Permalink
Browse files

simpler version of 9a2b774 (gravity wall change)

All gravity sources are now prevented, now just the specific elements that create gravity.
  • Loading branch information...
jacob1 committed Jan 6, 2016
1 parent adf0fa7 commit 85d89e9f87f6456d21ad2fc55792d2f1cfaf00e9
@@ -308,6 +308,7 @@ void Gravity::update_grav()
{
th_gravchanged = 1;
membwand(th_gravmap, gravmask, (XRES/CELL)*(YRES/CELL)*sizeof(float), (XRES/CELL)*(YRES/CELL)*sizeof(unsigned));
//copy gravmap into padded gravmap array
for (y=0; y<YRES/CELL; y++)
{
@@ -385,6 +386,7 @@ void Gravity::update_grav(void)
memset(th_gravx, 0, (XRES/CELL)*(YRES/CELL)*sizeof(float));
#endif
th_gravchanged = 1;
membwand(th_gravmap, gravmask, (XRES/CELL)*(YRES/CELL)*sizeof(float), (XRES/CELL)*(YRES/CELL)*sizeof(unsigned));
for (i = 0; i < YRES / CELL; i++) {
for (j = 0; j < XRES / CELL; j++) {
#ifdef GRAV_DIFF
@@ -69,13 +69,10 @@ int Element_GBMB::update(UPDATE_FUNC_ARGS)
}
}
}
if (sim->grav->gravmask[(y/CELL)*(XRES/CELL)+(x/CELL)])
{
if (parts[i].life>20)
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 20;
else if (parts[i].life>=1)
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = -80;
}
if (parts[i].life>20)
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 20;
else if (parts[i].life>=1)
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = -80;
return 0;
}
@@ -61,8 +61,7 @@ int Element_GPMP::update(UPDATE_FUNC_ARGS)
if (parts[i].temp<= -256.0+273.15)
parts[i].temp = -256.0+273.15;
if (sim->grav->gravmask[(y/CELL)*(XRES/CELL)+(x/CELL)])
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 0.2f*(parts[i].temp-273.15);
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 0.2f*(parts[i].temp-273.15);
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (BOUNDS_CHECK && (rx || ry))
@@ -54,8 +54,7 @@ int Element_GRVT::update(UPDATE_FUNC_ARGS)
if (parts[i].tmp <= -100)
parts[i].tmp = -100;
if (sim->grav->gravmask[(y/CELL)*(XRES/CELL)+(x/CELL)])
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 0.2f*parts[i].tmp;
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 0.2f*parts[i].tmp;
return 0;
}
@@ -47,13 +47,10 @@ Element_NBHL::Element_NBHL()
//#TPT-Directive ElementHeader Element_NBHL static int update(UPDATE_FUNC_ARGS)
int Element_NBHL::update(UPDATE_FUNC_ARGS)
{
if (sim->grav->gravmask[(y/CELL)*(XRES/CELL)+(x/CELL)])
{
if (parts[i].tmp)
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] += restrict_flt(0.001f*parts[i].tmp, 0.1f, 51.2f);
else
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] += 0.1f;
}
if (parts[i].tmp)
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] += restrict_flt(0.001f*parts[i].tmp, 0.1f, 51.2f);
else
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] += 0.1f;
return 0;
}

0 comments on commit 85d89e9

Please sign in to comment.