Skip to content

Commit

Permalink
Fixes to loop edge mode from later commits that I forgot about (also …
Browse files Browse the repository at this point in the history
…includes some maybe fixes not in tpt++) ccec5fb 1506855

d334209
  • Loading branch information
jacob1 committed Mar 23, 2016
1 parent b975cf8 commit b7ef4c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/simulation/Movement.cpp
Expand Up @@ -841,9 +841,9 @@ int Simulation::Move(int i, int x, int y, float nxf, float nyf)
bool y_ok = (ny >= CELL && ny < YRES-CELL);
int oldnx = nx, oldny = ny;
if (!x_ok)
nxf = remainder_p(nxf-CELL, XRES-CELL*2.5f)+CELL;
nxf = remainder_p(nxf-CELL+.5f, XRES-CELL*2.0f)+CELL-.5f;
if (!y_ok)
nyf = remainder_p(nyf-CELL, YRES-CELL*2.5f)+CELL;
nyf = remainder_p(nyf-CELL+.5f, YRES-CELL*2.0f)+CELL-.5f;

if (!x_ok || !y_ok)
{
Expand Down Expand Up @@ -873,8 +873,8 @@ int Simulation::Move(int i, int x, int y, float nxf, float nyf)
{
for (int j = 0; j < 16; j += 2)
{
stickman->legs[j] += (nx-oldnx)+.5f;
stickman->legs[j+1] += (ny-oldny)+.5f;
stickman->legs[j] += (nx-oldnx);
stickman->legs[j+1] += (ny-oldny);
stickman->accs[j/2] *= .95f;
}
parts[i].vy *= .95f;
Expand Down
8 changes: 4 additions & 4 deletions src/simulation/Simulation.cpp
Expand Up @@ -1018,12 +1018,12 @@ bool Simulation::UpdateParticle(int i)
fin_y = (int)(fin_yf+0.5f);
if (GetEdgeMode() == 2)
{
bool x_ok = (fin_x >= CELL && fin_x < XRES-CELL);
bool y_ok = (fin_y >= CELL && fin_y < YRES-CELL);
bool x_ok = (fin_x >= CELL-.5f && fin_x < XRES-CELL-.5f);
bool y_ok = (fin_y >= CELL-.5f && fin_y < YRES-CELL-.5f);
if (!x_ok)
fin_xf = remainder_p(fin_xf-CELL, XRES-CELL*2.5f)+CELL;
fin_xf = remainder_p(fin_xf-CELL+.5f, XRES-CELL*2.0f)+CELL-.5f;
if (!y_ok)
fin_yf = remainder_p(fin_yf-CELL, YRES-CELL*2.5f)+CELL;
fin_yf = remainder_p(fin_yf-CELL+.5f, YRES-CELL*2.0f)+CELL-.5f;
fin_x = (int)(fin_xf+0.5f);
fin_y = (int)(fin_yf+0.5f);
}
Expand Down

0 comments on commit b7ef4c8

Please sign in to comment.