Ascender: fun with collisions, now considers space empty
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 16 Apr 2023 08:40:59 +0000 (08:40 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 16 Apr 2023 08:40:59 +0000 (08:40 +0000)
mmsoftware/ascender/src/collision.c
mmsoftware/ascender/src/main.c

index b22b673..e7c99a7 100644 (file)
@@ -55,8 +55,8 @@ point_in_shape(WINDOW *pad, int x, int y)
 {
        chtype c;
 
-       if ((c = mvwinch(pad, y, x) != ERR) &&
-           (c & A_CHARTEXT) == ' ')
+       if ((c = mvwinch(pad, y, x)) != ERR &&
+           (c & A_CHARTEXT) != ' ')
                return true;
 
        return false;
index 3cf58e0..ac47081 100644 (file)
@@ -324,6 +324,9 @@ anim_redraw(void)
                            &y1, &x1, &y2, &x2);
                        rev = point_in_rect(avatar.x, avatar.y,
                            x1 - 1, y1 - 1, x2 + 1, y2 + 1);
+                       if (rev)
+                               rev = point_in_shape(spads[o->s],
+                                   avatar.x - x1, avatar.y - y1);
                        shape_draw(o->s, o->y, o->x, rev);
                } else {
                        if (use_color && o->col != -1)