Skip to content

Allow Jumping Over Ledges with Acro Bike

EvelynTSMG edited this page Dec 16, 2023 · 7 revisions

By Devolov

Goal: To allow the player to jump over both sides of a ledge with the Acro Bike.

joop

In event_object_movement.c, add the following Includes:

#include "constants/mauville_old_man.h"
#include "constants/trainer_types.h"
#include "constants/union_room.h"
+#include "constants/metatile_behaviors.h"
+#include "bike.h"

Then, in GetLedgeJumpDirection, make the following change:

u8 GetLedgeJumpDirection(s16 x, s16 y, u8 direction)
{
    static bool8 (*const ledgeBehaviorFuncs[])(u8) = {
        [DIR_SOUTH - 1] = MetatileBehavior_IsJumpSouth,
        [DIR_NORTH - 1] = MetatileBehavior_IsJumpNorth,
        [DIR_WEST - 1]  = MetatileBehavior_IsJumpWest,
        [DIR_EAST - 1]  = MetatileBehavior_IsJumpEast,
    };

    u8 behavior;
    u8 index = direction;

    if (index == DIR_NONE)
        return DIR_NONE;
    else if (index > DIR_EAST)
        index -= DIR_EAST;

    index--;
    behavior = MapGridGetMetatileBehaviorAt(x, y);

-    if (ledgeBehaviorFuncs[index](behavior) == TRUE)
+    if (ledgeBehaviorFuncs[index](behavior) == TRUE || (gPlayerAvatar.acroBikeState == ACRO_STATE_BUNNY_HOP
+    && MB_JUMP_EAST <= behavior && behavior <= MB_JUMP_SOUTH))
        return index + 1;

    return DIR_NONE;
}
Clone this wiki locally