don't be attracted to not allowed walls

This commit is contained in:
Virt 2025-04-15 15:43:19 +02:00
commit e5e2ad11e9
2 changed files with 5 additions and 6 deletions

View file

@ -16,6 +16,7 @@ wayneko \- Neko on Wayland but with phases
.OP \-\-background\-colour 0xRRGGBB[AA] .OP \-\-background\-colour 0xRRGGBB[AA]
.OP \-\-outline\-colour 0xRRGGBB[AA] .OP \-\-outline\-colour 0xRRGGBB[AA]
.OP \-\-type plain|striped|random .OP \-\-type plain|striped|random
.OP \-\-wall none|left|right|both
.OP \-\-idle-sleep seconds .OP \-\-idle-sleep seconds
.OP \-\-sleep-phase seconds-seconds .OP \-\-sleep-phase seconds-seconds
.OP \-\-awake-phase seconds-seconds .OP \-\-awake-phase seconds-seconds

View file

@ -1018,8 +1018,6 @@ static bool animation_next_state_awake (void)
case 6: case 6:
case 7: case 7:
case 8:
case 9:
if (surface.neko_x == 0 && (wall_behaviour & WALL_LEFT)) if (surface.neko_x == 0 && (wall_behaviour & WALL_LEFT))
animation_neko_do_wall_left(); animation_neko_do_wall_left();
else if (surface.neko_x + neko_size == surface.width && (wall_behaviour & WALL_RIGHT)) 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_1:
case NEKO_RUN_RIGHT_2: 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_do_run_right();
animation_neko_advance_right(true); animation_neko_advance_right(true);
} else if ( animation_can_run_right(false) && rand() % (attracted_right ? 8 : 4) != 0 ) { } 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_1:
case NEKO_RUN_LEFT_2: 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_do_run_left();
animation_neko_advance_left(true); animation_neko_advance_left(true);
} else if ( animation_can_run_left(false) && rand() % (attracted_left ? 8 : 4) != 0 ) { } else if ( animation_can_run_left(false) && rand() % (attracted_left ? 8 : 4) != 0 ) {