* Close the drawbridge located at x,y */
| 772 | * Close the drawbridge located at x,y |
| 773 | */ |
| 774 | void |
| 775 | close_drawbridge(coordxy x, coordxy y) |
| 776 | { |
| 777 | struct rm *lev1, *lev2; |
| 778 | struct trap *t; |
| 779 | coordxy x2, y2; |
| 780 | |
| 781 | lev1 = &levl[x][y]; |
| 782 | if (lev1->typ != DRAWBRIDGE_DOWN) |
| 783 | return; |
| 784 | x2 = x; |
| 785 | y2 = y; |
| 786 | get_wall_for_db(&x2, &y2); |
| 787 | if (cansee(x, y) || cansee(x2, y2)) { |
| 788 | You_see("a drawbridge %s up!", |
| 789 | (((u.ux == x || u.uy == y) && !Underwater) |
| 790 | || distu(x2, y2) < distu(x, y)) |
| 791 | ? "coming" |
| 792 | : "going"); |
| 793 | } else { /* "5 gears turn" for castle drawbridge tune */ |
| 794 | Soundeffect(se_chains_rattling_gears_turning, 75); |
| 795 | You_hear("chains rattling and gears turning."); |
| 796 | } |
| 797 | lev1->typ = DRAWBRIDGE_UP; |
| 798 | lev2 = &levl[x2][y2]; |
| 799 | lev2->typ = DBWALL; |
| 800 | switch (lev1->drawbridgemask & DB_DIR) { |
| 801 | case DB_NORTH: |
| 802 | case DB_SOUTH: |
| 803 | lev2->horizontal = TRUE; |
| 804 | break; |
| 805 | case DB_WEST: |
| 806 | case DB_EAST: |
| 807 | lev2->horizontal = FALSE; |
| 808 | break; |
| 809 | } |
| 810 | lev2->wall_info = W_NONDIGGABLE; |
| 811 | set_entity(x, y, &(go.occupants[0])); |
| 812 | set_entity(x2, y2, &(go.occupants[1])); |
| 813 | do_entity(&(go.occupants[0])); /* Do set_entity after first */ |
| 814 | set_entity(x2, y2, &(go.occupants[1])); /* do_entity for worm tail */ |
| 815 | do_entity(&(go.occupants[1])); |
| 816 | if (OBJ_AT(x, y) && !Deaf) { |
| 817 | Soundeffect(se_smashing_and_crushing, 75); |
| 818 | You_hear("smashing and crushing."); |
| 819 | } |
| 820 | (void) revive_nasty(x, y, (char *) 0); |
| 821 | (void) revive_nasty(x2, y2, (char *) 0); |
| 822 | delallobj(x, y); |
| 823 | delallobj(x2, y2); |
| 824 | if ((t = t_at(x, y)) != 0) |
| 825 | deltrap(t); |
| 826 | if ((t = t_at(x2, y2)) != 0) |
| 827 | deltrap(t); |
| 828 | del_engr_at(x, y); |
| 829 | del_engr_at(x2, y2); |
| 830 | newsym(x, y); |
| 831 | newsym(x2, y2); |
no test coverage detected