From 0eae6b4e266e3476fc5d54b0fd47ca6274b37886 Mon Sep 17 00:00:00 2001 From: NyteLyte Date: Wed, 27 Nov 2024 21:12:35 +0100 Subject: [PATCH] fix teleport trigger + spider orb interaction --- changelog.md | 4 ++++ mod.json | 2 +- src/main.cpp | 8 +++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 5588894..dd7ce9a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +# v1.4.1 +- fix teleport trigger + spider orb interaction + - credit: hiimjustin000 for identifying the cause + # v1.4.0 - update to 2.2074 - fix teleportation diff --git a/mod.json b/mod.json index 84ab5c4..00bcc08 100644 --- a/mod.json +++ b/mod.json @@ -1,7 +1,7 @@ { "geode": "4.0.1", "gd": {"android": "2.2074", "win": "2.2074"}, - "version": "v1.4.0", + "version": "v1.4.1", "id": "nytelyte.wave_trail_drag_fix", "name": "Wave Trail Drag Fix", "developer": "NyteLyte", diff --git a/src/main.cpp b/src/main.cpp index 5b98034..b82a348 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -280,9 +280,11 @@ class $modify(PlayLayer) { class $modify(GJBaseGameLayer) { void teleportPlayer(TeleportPortalObject *portal, PlayerObject *player) { GJBaseGameLayer::teleportPlayer(portal, player); - // no idea why player can be null, but it happened in one level and thus caused a crash - // it was a platformer level, if anyone has an explanation, let me know - if (LevelEditorLayer::get() || !player || !player->m_isDart) return; + // teleport trigger passes the player as null, the original function falls back to player 1 + // this does mean that the teleport trigger does not let you teleport player 2. lol. + // thank you hiimjustin000 for identifying the case where player can be null + if (!player) player = m_player1; + if (LevelEditorLayer::get() || !player->m_isDart) return; static_cast(player)->m_fields->previousPos = player->getRealPosition(); static_cast(player)->m_fields->justTeleported = true; }