From e5e2ad11e951a51a3b61bf2a3fcd83f18d931003 Mon Sep 17 00:00:00 2001 From: Virt <41426325+VirtCode@users.noreply.github.com> Date: Tue, 15 Apr 2025 15:43:19 +0200 Subject: [PATCH] don't be attracted to not allowed walls --- wayneko.1 | 1 + wayneko.c | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/wayneko.1 b/wayneko.1 index 69daee8..0dd6187 100644 --- a/wayneko.1 +++ b/wayneko.1 @@ -16,6 +16,7 @@ wayneko \- Neko on Wayland but with phases .OP \-\-background\-colour 0xRRGGBB[AA] .OP \-\-outline\-colour 0xRRGGBB[AA] .OP \-\-type plain|striped|random +.OP \-\-wall none|left|right|both .OP \-\-idle-sleep seconds .OP \-\-sleep-phase seconds-seconds .OP \-\-awake-phase seconds-seconds diff --git a/wayneko.c b/wayneko.c index 91fac29..a52f44e 100644 --- a/wayneko.c +++ b/wayneko.c @@ -1018,8 +1018,6 @@ static bool animation_next_state_awake (void) case 6: case 7: - case 8: - case 9: if (surface.neko_x == 0 && (wall_behaviour & WALL_LEFT)) animation_neko_do_wall_left(); else if (surface.neko_x + neko_size == surface.width && (wall_behaviour & WALL_RIGHT)) @@ -1035,9 +1033,9 @@ static bool animation_next_state_awake (void) case NEKO_RUN_RIGHT_1: case NEKO_RUN_RIGHT_2: - bool attracted_right = surface.width - surface.neko_x + neko_size < neko_x_wall_attraction; + bool attracted_right = surface.width - surface.neko_x + neko_size < neko_x_wall_attraction && (wall_behaviour & WALL_RIGHT); - if (!animation_can_run_right(false) && animation_can_run_right(true) && rand() % 8 != 0) { + if ((wall_behaviour & WALL_RIGHT) && !animation_can_run_right(false) && animation_can_run_right(true) && rand() % 8 != 0) { animation_neko_do_run_right(); animation_neko_advance_right(true); } else if ( animation_can_run_right(false) && rand() % (attracted_right ? 8 : 4) != 0 ) { @@ -1050,9 +1048,9 @@ static bool animation_next_state_awake (void) case NEKO_RUN_LEFT_1: case NEKO_RUN_LEFT_2: - bool attracted_left = surface.neko_x < neko_x_wall_attraction; + bool attracted_left = surface.neko_x < neko_x_wall_attraction && (wall_behaviour & WALL_LEFT); - if (!animation_can_run_left(false) && animation_can_run_left(true) && rand() % 8 != 0) { + if ((wall_behaviour & WALL_LEFT) && !animation_can_run_left(false) && animation_can_run_left(true) && rand() % 8 != 0) { animation_neko_do_run_left(); animation_neko_advance_left(true); } else if ( animation_can_run_left(false) && rand() % (attracted_left ? 8 : 4) != 0 ) {