| 364 | } |
| 365 | |
| 366 | DISABLE_WARNING_FORMAT_NONLITERAL |
| 367 | |
| 368 | boolean |
| 369 | make_hallucinated( |
| 370 | long xtime, /* nonzero if this is an attempt to turn on hallucination */ |
| 371 | boolean talk, |
| 372 | long mask) /* nonzero if resistance status should change by mask */ |
| 373 | { |
| 374 | long old = HHallucination; |
| 375 | boolean changed = 0; |
| 376 | const char *message, *verb; |
| 377 | |
| 378 | if (Unaware) |
| 379 | talk = FALSE; |
| 380 | |
| 381 | message = (!xtime) ? "Everything %s SO boring now." |
| 382 | : "Oh wow! Everything %s so cosmic!"; |
| 383 | verb = (!Blind) ? "looks" : "feels"; |
| 384 | |
| 385 | if (mask) { |
| 386 | if (HHallucination) |
| 387 | changed = TRUE; |
| 388 | |
| 389 | if (!xtime) |
| 390 | EHalluc_resistance |= mask; |
| 391 | else |
| 392 | EHalluc_resistance &= ~mask; |
| 393 | } else { |
| 394 | if (!EHalluc_resistance && (!!HHallucination != !!xtime)) |
| 395 | changed = TRUE; |
| 396 | set_itimeout(&HHallucination, xtime); |
| 397 | |
| 398 | /* clearing temporary hallucination without toggling vision */ |
| 399 | if (!changed && !HHallucination && old && talk) { |
| 400 | if (!haseyes(gy.youmonst.data)) { |
| 401 | strange_feeling((struct obj *) 0, (char *) 0); |
| 402 | } else if (Blind) { |
| 403 | const char *eyes = body_part(EYE); |
| 404 | |
| 405 | if (eyecount(gy.youmonst.data) != 1) |
| 406 | eyes = makeplural(eyes); |
| 407 | Your(eyemsg, eyes, vtense(eyes, "itch")); |
| 408 | } else { /* Grayswandir */ |
| 409 | Your(vismsg, "flatten", "normal"); |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | if (changed) { |
| 415 | /* in case we're mimicking an orange (hallucinatory form |
| 416 | of mimicking gold) update the mimicking's-over message */ |
| 417 | if (!Hallucination) |
| 418 | eatmupdate(); |
| 419 | |
| 420 | if (u.uswallow) { |
| 421 | swallowed(0); /* redraw swallow display */ |
| 422 | } else { |
| 423 | /* The see_* routines should be called *before* the pline. */ |
no test coverage detected