summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/orb.cc
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2011-01-22 18:35:40 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2011-01-22 18:38:15 +1000
commit386b557d3b1dee061c2bf252446b4e2342fe4702 (patch)
treec0e16f75310ed14985b0130602bab689460f7344 /crawl-ref/source/orb.cc
parentc3209b6a252a60ca0c47d63ad0c03bf7ae95e9d8 (diff)
downloadcrawl-ref-386b557d3b1dee061c2bf252446b4e2342fe4702.tar.gz
crawl-ref-386b557d3b1dee061c2bf252446b4e2342fe4702.zip
Fix orb pickup noise when silenced.
Now, it flashes a variety of coloured, pretty lights, which have the same effect of waking up nearby monsters. This is achieved by "fake_noisy", which generates noise (but no message) regardless of whether or not the area is silenced. However, it has just occurred to me that the latter function might cause weird interactions with mesmerisation and fear. Might be something to keep in mind if its use is extended to areas where mermaids or other monsters might be causing fear/mesmerising.
Diffstat (limited to 'crawl-ref/source/orb.cc')
-rw-r--r--crawl-ref/source/orb.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/crawl-ref/source/orb.cc b/crawl-ref/source/orb.cc
new file mode 100644
index 0000000000..2e8308dffa
--- /dev/null
+++ b/crawl-ref/source/orb.cc
@@ -0,0 +1,48 @@
+/*
+ * File: orb.cc
+ * Summary: Orb-related functionality.
+ */
+
+#include "AppHdr.h"
+
+#include "areas.h"
+#include "message.h"
+#include "orb.h"
+#include "shout.h"
+#include "view.h"
+
+// Return true if it was an "actual" noise, flavour-wise.
+bool orb_noise (const coord_def& where, int loudness)
+{
+ 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);
+}
+
+void orb_pickup_noise (const coord_def& where, int loudness, const char* msg, const char* msg2)
+{
+ if (orb_noise(where, loudness))
+ {
+ if (msg)
+ mpr(msg, MSGCH_ORB);
+ else
+ mpr("The orb lets out a hideous shriek!", MSGCH_ORB);
+ }
+ else
+ {
+ if (msg2)
+ mpr(msg2, MSGCH_ORB);
+ else
+ mpr("The orb lets out a furious burst of light!", MSGCH_ORB);
+ }
+}