From 9e3f627378645774427a184b530b33bcec59a459 Mon Sep 17 00:00:00 2001 From: PinguLinux Date: Tue, 22 Oct 2024 11:59:27 +0200 Subject: [PATCH] Another try to fix slopes --- SAUCE/functions/collision.h | 15 +++++++++++---- SAUCE/functions/x_movement.h | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/SAUCE/functions/collision.h b/SAUCE/functions/collision.h index aefe7557..2f2a15e5 100644 --- a/SAUCE/functions/collision.h +++ b/SAUCE/functions/collision.h @@ -343,6 +343,10 @@ char bg_side_coll_common() { } dblocked[currplayer] = 0; if (was_on_slope_counter) return 0; + } else { + if (bg_coll_slope()) { + high_byte(currplayer_y) += (high_byte(currplayer_vel_y) & 0x80 ? 2 : -2); + } } bg_coll_spikes(); @@ -442,15 +446,18 @@ char bg_coll_slope() { tmp8 = (temp_y) & 0x0f; switch (collision) { case COL_NO_SIDE: + return 1; // 45 degrees case COL_ALL: - if (was_on_slope_counter && gamemode == 6) { - high_byte(currplayer_y) -= (currplayer_gravity ? -2 : 2); + if (was_on_slope_counter | slope_frames) { + high_byte(currplayer_y) += (high_byte(currplayer_y) - player_old_posy[1] & 0x80 ? high_byte(currplayer_vel_x) : -high_byte(currplayer_vel_x)); + return 1; } - return 0; + return 0; + case COL_SLOPE_LU45: tmp7 = (temp_x & 0x0f); // = 0x0F - (temp_x & 0x0F) @@ -619,7 +626,7 @@ char bg_coll_slope() { if ((uint8_t)(tmp4) >= tmp7) { tmp8 = tmp4 - tmp7 + (mini ? 2 : ((slope_type == SLOPE_66DEG_UP) ? 1 : 0)); - if (controllingplayer->a && gamemode != 6) { + if (controllingplayer->a && (gamemode == 0 || gamemode == 4)) { slope_frames = 0; slope_type = 0; } else { diff --git a/SAUCE/functions/x_movement.h b/SAUCE/functions/x_movement.h index f80db2f4..4bc547e9 100644 --- a/SAUCE/functions/x_movement.h +++ b/SAUCE/functions/x_movement.h @@ -29,8 +29,8 @@ void x_movement_coll() { // we we're on an slope and now we aren't, so push the player upwards a bit tmp8 = slope_type; slope_exit_vel(); - if (!(slope_type & 0b1000)) { - if (!(slope_type & 1)) { + if ((slope_type & 1)) { + if ((slope_type & 0b1000)) { currplayer_vel_y = tmp5 + 0x200; } else { currplayer_vel_y = (tmp5 + 0x200)^0xFFFF;