static bool flow (struct anim *k) { struct pos hanged_pos; if (k->oaction != kid_unclimb) k->i = 14; if (k->oaction == kid_climb) k->i = 3; if (k->i == 0) { kid_hang (k); return false; } if (k->i == 14) { get_hanged_pos (&k->hang_pos, k->f.dir, &hanged_pos); place_frame (&k->f, &k->f, kid_climb_frameset[13].frame, &hanged_pos, 18, 25); } k->i--; k->fo.b = kid_climb_frameset[k->i].frame; k->fo.dx = -kid_climb_frameset[k->i + 1].dx; k->fo.dy = -kid_climb_frameset[k->i + 1].dy; if (k->oaction == kid_climb) k->fo.dx += +2; if (k->i == 1) k->fo.dx += -3; return true; }
static void physics_out (struct anim *k) { struct pos hanged_pos; /* depressible floors */ clear_depressible_floor (k); get_hanged_pos (&k->hang_pos, k->f.dir, &hanged_pos); press_depressible_floor (&hanged_pos); }
static void physics_out (struct anim *k) { struct pos hanged_pos; /* depressible floors */ clear_depressible_floor (k); get_hanged_pos (&k->hang_pos, k->f.dir, &hanged_pos); press_depressible_floor (&hanged_pos); /* sound */ if (! k->reverse && k->i == 4 && k->key.shift && ! k->key.up && ! k->hang_limit) play_audio (&hit_wall_audio, NULL, k->id); }
void draw_room_anim_fg_sub (ALLEGRO_BITMAP *bitmap, enum em em, enum vm vm, struct anim *a) { struct pos pm, ptl, ptr, ptl2, ptr2; struct frame *f = &a->f; struct coord c; frame2room (f, room_view, &c); int w = al_get_bitmap_width (f->b); int h = al_get_bitmap_height (f->b); survey (_m, posf, f, NULL, &pm, NULL); survey (_tl, posf, f, NULL, &ptl, NULL); survey (_tr, posf, f, NULL, &ptr, NULL); pos2room (&pm, room_view, &pm); pos2room (&ptl, room_view, &ptl); pos2room (&ptr, room_view, &ptr); survey (_tl, pos, f, NULL, &ptl2, NULL); survey (_tr, pos, f, NULL, &ptr2, NULL); pos2room (&ptl2, room_view, &ptl2); pos2room (&ptr2, room_view, &ptr2); push_clipping_rectangle (bitmap, c.x, c.y, w, h); /* SWORD */ if (fake (&pm) == CARPET && a->f.dir == RIGHT && a->xf.b) { struct coord c2; int w2 = al_get_bitmap_width (a->xf.b); int h2 = al_get_bitmap_height (a->xf.b); xframe_coord (&a->f, &a->xf, &c2); ignore_clipping_rectangle_intersection = true; push_clipping_rectangle (bitmap, c2.x, c2.y, w2, h2); push_drawn_rectangle (bitmap); draw_confg_right (bitmap, &pm, em, vm); redraw_drawn_rectangle (pop_drawn_rectangle (), &pm, em, vm); pop_clipping_rectangle (); ignore_clipping_rectangle_intersection = false; } /* CLIMBING STAIRS */ if (is_kid_stairs (f)) draw_level_door_fg (bitmap, &a->p, f, em, vm); /* FALLING */ if (is_anim_fall (f)) { push_clipping_rectangle (bitmap, PLACE_WIDTH * ptr2.place, PLACE_HEIGHT * ptr2.floor + 56, PLACE_WIDTH + 12, PLACE_HEIGHT - 53); push_drawn_rectangle (bitmap); if (! is_strictly_traversable_fake (&ptr2)) draw_confg (bitmap, &ptr2, em, vm); if (! is_strictly_traversable_fake (&ptr)) draw_confg (bitmap, &ptr, em, vm); redraw_drawn_rectangle (pop_drawn_rectangle (), &ptr2, em, vm); pop_clipping_rectangle (); } /* VERTICAL JUMP */ if (is_kid_vjump_touching_above (f)) { push_clipping_rectangle (bitmap, PLACE_WIDTH * ptl2.place, PLACE_HEIGHT * ptl2.floor + 56, 2 * PLACE_WIDTH, PLACE_HEIGHT - 56 + 3); push_drawn_rectangle (bitmap); draw_confg (bitmap, &ptl2, em, vm); draw_confg (bitmap, &ptr, em, vm); redraw_drawn_rectangle (pop_drawn_rectangle (), &ptl2, em, vm); pop_clipping_rectangle (); } /* HANGING */ if (is_kid_hang (f)) { struct pos p; get_hanged_pos (&a->hang_pos, f->dir, &p); struct pos pb; prel (&p, &pb, +0, f->dir == LEFT ? +1 : -1); pos2room (&p, room_view, &p); pos2room (&pb, room_view, &pb); if (f->dir == RIGHT) { push_clipping_rectangle (bitmap, PLACE_WIDTH * p.place, PLACE_HEIGHT * p.floor + 56, PLACE_WIDTH, PLACE_HEIGHT - 53); push_drawn_rectangle (bitmap); draw_confg (bitmap, &p, em, vm); redraw_drawn_rectangle (pop_drawn_rectangle (), &p, em, vm); } else { push_clipping_rectangle (bitmap, PLACE_WIDTH * pb.place, PLACE_HEIGHT * pb.floor + 56, PLACE_WIDTH, PLACE_HEIGHT - 53); push_drawn_rectangle (bitmap); draw_confg (bitmap, &pb, em, vm); redraw_drawn_rectangle (pop_drawn_rectangle (), &pb, em, vm); } pop_clipping_rectangle (); } /* CLIMBING FLOOR */ if (is_kid_climb (f)) { struct pos p; get_hanged_pos (&a->hang_pos, f->dir, &p); struct pos pb; prel (&p, &pb, +0, f->dir == LEFT ? +1 : -1); pos2room (&p, room_view, &p); pos2room (&pb, room_view, &pb); if (f->dir == RIGHT) { int dy, w; if (f->b == kid_climb_00 || f->b == kid_climb_01 || f->b == kid_climb_02 || f->b == kid_climb_08 || f->b == kid_climb_09) { dy = 55; w = 18; } else if (f->b == kid_climb_05 || f->b == kid_climb_06) { dy = 53; w = 22; } else if (f->b == kid_climb_03 || f->b == kid_climb_07 || f->b == kid_climb_04) { dy = 53; w = 21; } push_clipping_rectangle (bitmap, PLACE_WIDTH * p.place, PLACE_HEIGHT * p.floor + dy, w, PLACE_HEIGHT - dy + 3); push_drawn_rectangle (bitmap); draw_confg (bitmap, &p, em, vm); redraw_drawn_rectangle (pop_drawn_rectangle (), &p, em, vm); } else { push_clipping_rectangle (bitmap, PLACE_WIDTH * pb.place, PLACE_HEIGHT * pb.floor + 54, PLACE_WIDTH, PLACE_HEIGHT - 54 + 3); push_drawn_rectangle (bitmap); draw_confg (bitmap, &pb, em, vm); redraw_drawn_rectangle (pop_drawn_rectangle (), &pb, em, vm); } pop_clipping_rectangle (); } pop_clipping_rectangle (); draw_room_frame_fg (bitmap, em, vm, f); /* xframe */ if (a->xf.b) { struct frame xf; xframe_frame (&a->f, &a->xf, &xf); draw_room_frame_fg (bitmap, em, vm, &xf); } /* splash */ if (a->splash) { struct frame sf; splash_frame (&a->f, &sf); draw_room_frame_fg (bitmap, em, vm, &sf); } }