Skip to content

Commit

Permalink
fix cbf again
Browse files Browse the repository at this point in the history
  • Loading branch information
nytelytee committed Nov 28, 2024
1 parent 0eae6b4 commit 6d7af26
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v1.4.2
- fix the doubling up points with Click Between Frames (again)

# v1.4.1
- fix teleport trigger + spider orb interaction
- credit: hiimjustin000 for identifying the cause
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"geode": "4.0.1",
"gd": {"android": "2.2074", "win": "2.2074"},
"version": "v1.4.1",
"version": "v1.4.2",
"id": "nytelyte.wave_trail_drag_fix",
"name": "Wave Trail Drag Fix",
"developer": "NyteLyte",
Expand Down
13 changes: 12 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@ class $modify(WTDFPlayerObject, PlayerObject) {
// slopes aren't stored in m_collidedObject for some reason
GameObject* collidedSlope = nullptr;

// Click Between Frames messes with the delta factor when collision checking
// so we fetch it from PlayerObject::update and use that inside
// PlayerObject::postCollision instead of the one passed to it
float deltaFactor = 0;
};

static void onModify(auto& self) {
Result res = self.setHookPriorityAfter("PlayerObject::update", "syzzi.click_between_frames");
if (!res && res != Err("Mod not found"))
log::error("Failed to set hook priority of PlayerObject::update.");
}

void resetObject() {
WTDFPlayerObject::Fields defaultFields;
*m_fields.operator->() = defaultFields;
Expand All @@ -53,6 +63,7 @@ class $modify(WTDFPlayerObject, PlayerObject) {
PlayerObject::update(deltaFactor);
m_fields->nextPosNoCollision = getRealPosition();
m_fields->collidedSlope = nullptr;
m_fields->deltaFactor = deltaFactor;
}

void postCollision(float deltaFactor) {
Expand Down Expand Up @@ -119,7 +130,7 @@ class $modify(WTDFPlayerObject, PlayerObject) {

// make the error margin inversely proportional to the delta factor
// if 2 updates are extremely close together calculating the angle between them may lead to inaccuracies
float errorMargin = 0.004/deltaFactor;
float errorMargin = 0.004/m_fields->deltaFactor;

// save the current point as prevPoint only if it is placed as a streak point
// this makes it so that even smooth paths where
Expand Down

0 comments on commit 6d7af26

Please sign in to comment.