MCPcopy Index your code
hub / github.com/NetHack/NetHack / fall_through

Function fall_through

src/trap.c:601–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601void
602fall_through(
603 boolean td, /* td == TRUE : trap door or hole */
604 unsigned ftflags)
605{
606 d_level dtmp;
607 char msgbuf[BUFSZ];
608 const char *dont_fall = 0;
609 int newlevel;
610 struct trap *t = (struct trap *) 0;
611 boolean controlled_flight = FALSE;
612
613 /* we'll fall even while levitating in Sokoban; otherwise, if we
614 won't fall and won't be told that we aren't falling, give up now */
615 if (Blind && Levitation && !Sokoban)
616 return;
617
618 newlevel = dunlev(&u.uz); /* current level */
619 newlevel++;
620
621 if (td) {
622 t = t_at(u.ux, u.uy);
623 feeltrap(t);
624 if (!Sokoban && !(ftflags & TOOKPLUNGE)) {
625 if (t->ttyp == TRAPDOOR)
626 pline("A trap door opens up under you!");
627 else
628 pline("There's a gaping hole under you!");
629 }
630 } else
631 pline_The("%s opens up under you!", surface(u.ux, u.uy));
632
633 if (Sokoban && Can_fall_thru(&u.uz)) {
634 ; /* KMH -- You can't escape the Sokoban level traps */
635 } else if (Levitation || u.ustuck
636 || (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig)
637 || ((Flying || is_clinger(gy.youmonst.data)
638 || (ceiling_hider(gy.youmonst.data) && u.uundetected))
639 && !(ftflags & TOOKPLUNGE))) {
640 dont_fall = "don't fall in.";
641 } else if (gy.youmonst.data->msize >= MZ_HUGE) {
642 dont_fall = "don't fit through.";
643 } else if (!next_to_u()) {
644 dont_fall = "are jerked back by your pet!";
645 }
646 if (dont_fall) {
647 You1(dont_fall);
648 /* hero didn't fall through, but any objects here might */
649 impact_drop((struct obj *) 0, u.ux, u.uy, 0);
650 if (!td) {
651 display_nhwindow(WIN_MESSAGE, FALSE);
652 pline_The("opening under you closes up.");
653 }
654 return;
655 }
656 if ((Flying || is_clinger(gy.youmonst.data))
657 && (ftflags & TOOKPLUNGE) && td && t) {
658 if (Flying)

Callers 2

trapeffect_holeFunction · 0.85
kick_nondoorFunction · 0.85

Calls 15

dunlevFunction · 0.85
t_atFunction · 0.85
feeltrapFunction · 0.85
pline_TheFunction · 0.85
surfaceFunction · 0.85
Can_fall_thruFunction · 0.85
next_to_uFunction · 0.85
impact_dropFunction · 0.85
YouFunction · 0.85
shopdigFunction · 0.85
find_hellFunction · 0.85
assign_levelFunction · 0.85

Tested by

no test coverage detected