diff --git a/src/player.c b/src/player.c index 2a3740c..58ee7d0 100644 --- a/src/player.c +++ b/src/player.c @@ -17,10 +17,9 @@ #define JUMP_SPD (-128 * PXS) #define GRACE_UNITS (int)(UPS / 5) #define EARLY_UNITS (int)(UPS / 5) -#define H_CLIP_MARGIN (TILE_SIZE / 2) +#define H_CLIP_MARGIN (TILE_SIZE / 4) #define V_CLIP_MARGIN (TILE_SIZE / 3) #define SGN(x) (((x) > 0) ? (1) : (((x) < 0) ? (-1) : (0))) -#define ABS(x) (((x) > 0) ? (x) : (-(x))) #define PLAYER_COLLIDE(pos) player_collide(player, pos, level, level->solid_layer) void player_move(Player *player, const Level *level) { @@ -34,10 +33,7 @@ void player_move(Player *player, const Level *level) { if (PLAYER_COLLIDE(destination)) { /* Used for clipping and positionning. */ int offset = destination.y % TILE_SIZE; - if (offset > TILE_SIZE / 2) { - offset -= TILE_SIZE; - } - if (ABS(offset) > H_CLIP_MARGIN) { + if (offset > H_CLIP_MARGIN) { offset = 0; } destination.y -= offset;