Skip to content

Commit

Permalink
fix slant issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nytelytee committed Mar 4, 2024
1 parent 8ffe00f commit 191d64f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.0.3

- fix slant issue

# v1.0.2

- fix interaction with slopes
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"android": "2.205",
"win": "2.204"
},
"version": "v1.0.2",
"version": "v1.0.3",
"id": "nytelyte.wave_trail_drag_fix",
"name": "Wave Trail Drag Fix",
"developer": "NyteLyte",
Expand Down
8 changes: 5 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class $modify(PlayerObject) {

void update(float p0) {
if (!m_isDart) return PlayerObject::update(p0);


CCPoint position = getRealPosition();

// (part of the) fix for the wave interacting badly with slopes
if (!m_isOnSlope && m_wasOnSlope && m_yVelocity != 0)
m_waveTrail->addPoint(m_fields->prev_position);
Expand All @@ -22,14 +24,14 @@ class $modify(PlayerObject) {
// entering a straight area, put the point on the current
// frame's position (the wave just landed on the straight area)
else if (m_yVelocity == 0 && m_fields->prev_yVelocity != 0 && !m_fields->dont_add_point)
m_waveTrail->addPoint(m_position);
m_waveTrail->addPoint(position);
// when starting a new wave, a point may become stale, leading to
// the wave getting connected to a point from the previous wave
// this accounts for that
else if (m_fields->dont_add_point)
m_fields->dont_add_point = false;
m_fields->prev_yVelocity = m_yVelocity;
m_fields->prev_position = m_position;
m_fields->prev_position = position;

// result: straight line on straight area
PlayerObject::update(p0);
Expand Down

0 comments on commit 191d64f

Please sign in to comment.