1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/**
* @file
* @brief Orb-related functionality.
**/
#include "AppHdr.h"
#include "areas.h"
#include "message.h"
#include "orb.h"
#include "shout.h"
#include "view.h"
/**
* Make a "noise" caused by the orb.
*
* Alerts monsters via fake_noisy. If the area is silenced, perform a "flashing
* lights" visual effect.
*
* @param where The location the "noise" comes from.
* @param loudness The loudness of the noise, determining distance travelled.
* @return True if the area was unsilenced and thus an actual noise
* occurred, otherwise false, denoting that flashing lights
* occurred.
**/
static bool _orb_noise(const coord_def& where, int loudness)
{
// XXX: Fake noisy doesn't work. Oops.
fake_noisy(loudness, where);
if (silenced(where))
{
flash_view_delay(MAGENTA, 100);
flash_view_delay(LIGHTMAGENTA, 100);
flash_view_delay(MAGENTA, 100);
flash_view_delay(LIGHTMAGENTA, 100);
return false;
}
return true;
}
/**
* Make a "noise" upon picking up the orb.
*
* Calls orb_noise(where, loudness), and, depending on the result of that
* function, prints one of two messages.
*
* @param where Passed to orb_noise.
* @param loudness Passed to orb_noise.
* @param msg The message to be printed if orb_noise returned true.
* @param msg2 The message to be printed if orb_noise returned false.
**/
void orb_pickup_noise(const coord_def& where, int loudness, const char* msg, const char* msg2)
{
if (_orb_noise(where, loudness))
{
if (msg)
mprf(MSGCH_ORB, "%s", msg);
else
mprf(MSGCH_ORB, "The orb lets out a hideous shriek!");
}
else
{
if (msg2)
mprf(MSGCH_ORB, "%s", msg2);
else
mprf(MSGCH_ORB, "The orb lets out a furious burst of light!");
}
}
|