forked from virt-mirrors/wayneko
don't be attracted to not allowed walls
This commit is contained in:
parent
8892e69e93
commit
e5e2ad11e9
2 changed files with 5 additions and 6 deletions
|
@ -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
|
||||
|
|
10
wayneko.c
10
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 ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue