| 2019 | } |
| 2020 | |
| 2021 | void |
| 2022 | youhiding(boolean via_enlghtmt, /* enlightenment line vs topl message */ |
| 2023 | int msgflag) /* for variant message phrasing */ |
| 2024 | { |
| 2025 | char *bp, buf[BUFSZ]; |
| 2026 | |
| 2027 | Strcpy(buf, "hiding"); |
| 2028 | if (U_AP_TYPE != M_AP_NOTHING) { |
| 2029 | /* mimic; hero is only able to mimic a strange object or gold |
| 2030 | or hallucinatory alternative to gold, so we skip the details |
| 2031 | for the hypothetical furniture and monster cases */ |
| 2032 | bp = eos(strcpy(buf, "mimicking")); |
| 2033 | if (U_AP_TYPE == M_AP_OBJECT) { |
| 2034 | Sprintf(bp, " %s", an(simple_typename(gy.youmonst.mappearance))); |
| 2035 | } else if (U_AP_TYPE == M_AP_FURNITURE) { |
| 2036 | Strcpy(bp, " something"); |
| 2037 | } else if (U_AP_TYPE == M_AP_MONSTER) { |
| 2038 | Strcpy(bp, " someone"); |
| 2039 | } else { |
| 2040 | ; /* something unexpected; leave 'buf' as-is */ |
| 2041 | } |
| 2042 | } else if (u.uundetected) { |
| 2043 | bp = eos(buf); /* points past "hiding" */ |
| 2044 | if (gy.youmonst.data->mlet == S_EEL) { |
| 2045 | if (is_pool(u.ux, u.uy)) |
| 2046 | Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy)); |
| 2047 | } else if (hides_under(gy.youmonst.data)) { |
| 2048 | struct obj *o = svl.level.objects[u.ux][u.uy]; |
| 2049 | |
| 2050 | if (o) |
| 2051 | Sprintf(bp, " underneath %s", ansimpleoname(o)); |
| 2052 | } else if (is_clinger(gy.youmonst.data) || Flying) { |
| 2053 | /* Flying: 'lurker above' hides on ceiling but doesn't cling */ |
| 2054 | Sprintf(bp, " on the %s", ceiling(u.ux, u.uy)); |
| 2055 | } else { |
| 2056 | /* on floor; is_hider() but otherwise not special: 'trapper' */ |
| 2057 | if (u.utrap && u.utraptype == TT_PIT) { |
| 2058 | struct trap *t = t_at(u.ux, u.uy); |
| 2059 | |
| 2060 | Sprintf(bp, " in a %spit", |
| 2061 | (t && t->ttyp == SPIKED_PIT) ? "spiked " : ""); |
| 2062 | } else |
| 2063 | Sprintf(bp, " on the %s", surface(u.ux, u.uy)); |
| 2064 | } |
| 2065 | } else { |
| 2066 | ; /* shouldn't happen; will result in generic "you are hiding" */ |
| 2067 | } |
| 2068 | |
| 2069 | if (via_enlghtmt) { |
| 2070 | int final = msgflag; /* 'final' is used by you_are() macro */ |
| 2071 | |
| 2072 | you_are(buf, ""); |
| 2073 | } else { |
| 2074 | /* for dohide(), when player uses '#monster' command */ |
| 2075 | You("are %s %s.", msgflag ? "already" : "now", buf); |
| 2076 | } |
| 2077 | } |
| 2078 |
no test coverage detected