describe a hidden monster; used for look_at during extended monster detection and for probing; also when looking at self and camera feedback */
| 183 | /* describe a hidden monster; used for look_at during extended monster |
| 184 | detection and for probing; also when looking at self and camera feedback */ |
| 185 | void |
| 186 | mhidden_description( |
| 187 | struct monst *mon, /* hidden monster to describe */ |
| 188 | unsigned mhid_flags, /* controls optional aspects of description */ |
| 189 | char *outbuf) /* output buffer */ |
| 190 | { |
| 191 | struct obj *otmp; |
| 192 | const char *what; |
| 193 | NhRegion *reg; |
| 194 | size_t buflen; |
| 195 | boolean incl_prefix = (mhid_flags & MHID_PREFIX) != 0, |
| 196 | incl_article = (mhid_flags & MHID_ARTICLE) != 0, |
| 197 | show_altmon = (mhid_flags & MHID_ALTMON) != 0, |
| 198 | force_region = (mhid_flags & MHID_REGION) != 0; |
| 199 | boolean fakeobj, isyou = (mon == &gy.youmonst); |
| 200 | coordxy x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my; |
| 201 | int glyph = (svl.level.flags.hero_memory && !isyou) ? levl[x][y].glyph |
| 202 | : glyph_at(x, y); |
| 203 | |
| 204 | *outbuf = '\0'; |
| 205 | if (M_AP_TYPE(mon) == M_AP_FURNITURE |
| 206 | || M_AP_TYPE(mon) == M_AP_OBJECT) { |
| 207 | if (incl_prefix) |
| 208 | Strcpy(outbuf, ", mimicking "); |
| 209 | if (M_AP_TYPE(mon) == M_AP_FURNITURE) { |
| 210 | what = defsyms[mon->mappearance].explanation; |
| 211 | if (incl_article) |
| 212 | what = an(what); |
| 213 | Strcat(outbuf, what); |
| 214 | } else if (M_AP_TYPE(mon) == M_AP_OBJECT |
| 215 | /* remembered glyph, not glyph_at() which is 'mon' */ |
| 216 | && glyph_is_object(glyph)) { |
| 217 | objfrommap: |
| 218 | otmp = (struct obj *) 0; |
| 219 | fakeobj = object_from_map(glyph, x, y, &otmp); |
| 220 | what = (otmp && otmp->otyp != STRANGE_OBJECT) |
| 221 | ? simpleonames(otmp) |
| 222 | : obj_descr[STRANGE_OBJECT].oc_name; |
| 223 | if (incl_article && (!otmp || otmp->quan == 1L)) |
| 224 | what = an(what); |
| 225 | Strcat(outbuf, what); |
| 226 | |
| 227 | if (fakeobj && otmp) { |
| 228 | otmp->where = OBJ_FREE; /* object_from_map set to OBJ_FLOOR */ |
| 229 | dealloc_obj(otmp); /* has no contents */ |
| 230 | } |
| 231 | } else { |
| 232 | Strcat(outbuf, something); |
| 233 | } |
| 234 | } else if (M_AP_TYPE(mon) == M_AP_MONSTER) { |
| 235 | if (show_altmon) { |
| 236 | if (incl_prefix) |
| 237 | Strcat(outbuf, ", masquerading as "); |
| 238 | what = pmname(&mons[mon->mappearance], Mgender(mon)); |
| 239 | if (incl_prefix) |
| 240 | what = an(what); |
| 241 | Strcat(outbuf, what); |
| 242 | } |
no test coverage detected