Skip to content

Commit

Permalink
Fix gravity being assigned rather than increased by some elements
Browse files Browse the repository at this point in the history
  • Loading branch information
LBPHacker committed Jan 7, 2023
1 parent 853c47b commit 94ea50d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/simulation/elements/GBMB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ static int update(UPDATE_FUNC_ARGS)
}
}
if (parts[i].life>20)
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 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;
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] += -80;
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/simulation/elements/GPMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static int update(UPDATE_FUNC_ARGS)
if (parts[i].temp<= -256.0f+273.15f)
parts[i].temp = -256.0f+273.15f;

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))
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/elements/GRVT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static int update(UPDATE_FUNC_ARGS)
if (parts[i].tmp <= -100)
parts[i].tmp = -100;

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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/simulation/simtools/NGRV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ void SimTool::Tool_NGRV()

static int perform(Simulation * sim, Particle * cpart, int x, int y, int brushX, int brushYy, float strength)
{
sim->gravmap[((y/CELL)*(XRES/CELL))+(x/CELL)] = strength*-5.0f;
sim->gravmap[((y/CELL)*(XRES/CELL))+(x/CELL)] += strength*-5.0f;
return 1;
}
2 changes: 1 addition & 1 deletion src/simulation/simtools/PGRV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ void SimTool::Tool_PGRV()

static int perform(Simulation * sim, Particle * cpart, int x, int y, int brushX, int brushY, float strength)
{
sim->gravmap[((y/CELL)*(XRES/CELL))+(x/CELL)] = strength*5.0f;
sim->gravmap[((y/CELL)*(XRES/CELL))+(x/CELL)] += strength*5.0f;
return 1;
}

0 comments on commit 94ea50d

Please sign in to comment.