summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/noise.h
Commit message (Collapse)AuthorAgeFilesLines
* Use std namespace.Raphael Langella2012-08-261-4/+4
| | | | | | | | | | | | | I had to rename distance() (in coord.h) to distance2() because it conflicts with the STL function to compare 2 iterators. Not a bad change given how it returns the square of the distance anyway. I also had to rename the message global variable (in message.cc) to buffer. I tried to fix and improve the coding style has much as I could, but I probably missed a few given how huge and tedious it is. I also didn't touch crawl-gdb.py, and the stuff in prebuilt, rltiles/tool and util/levcomp.*, because I have no clue about those.
* Permarock walls completely block noise.Raphael Langella2012-03-031-0/+1
| | | | | | This fixes zig spring which rely on room isolation (and maybe other vaults). Since the gameplay purpose or permarock is complete isolation, this should work well.
* Walls don't completely block noise.Raphael Langella2012-03-021-1/+0
| | | | They attenuate noise with a factor of 12 (compared to 8 for doors).
* Reduce ambient noise in Hive from 20->5; Orc, Lair 5->4.Darshan Shaligram2011-01-121-2/+1
| | | | | The very high ambient noise in Hive (20) made it practically impossible to wake the bees.
* Fix bad type to noise_intensity_millis causing overflow.Darshan Shaligram2011-01-071-1/+1
|
* New noise propagation system.Darshan Shaligram2011-01-071-0/+157
The old noise propagation system alerted all monsters within `loudness' radius of the noise source, ignoring obstacles between the observer and the noise source. The new noise system applies only to monsters; the player is still messaged as before. This is for two reasons: 1. noisy() must return if the player heard the noise, which forces us to propagate the noise immediately for each noise, an unacceptable overhead on busy maps (such as Sprint). Therefore we cheat and use the old noise rules for the player. This is relatively simple to work around, since not many code paths rely on the noisy() return code, and these places can be changed to work around this lack of information. 2. The new noise system allows loud noises to drown out quiet noises. This may be an unacceptable loss of information for the player. The new system keeps track of noises produced by noisy(), but does not act on them immediately. Instead, all noises are processed in world_reacts. Noises are processed by a simple flood-out from their sources, attenuated by distance, terrain (such as closed doors, trees), and by twists in the noise's path (a winding corridor attenuates noise more than a straight line). Noise propagation and attenuation uses movement geometry, not LOS geometry, *but* attenuation assumes it is harder for the noise to change direction than to keep going in its old direction. To simplify handling of noises, it is assumed that louder noises overwhelm quieter noises. An actor exposed to both a loud and a quiet noise at the same distance will hear only the loud noise. However, an actor closer to the quiet noise than the loud noise will hear first the quiet noise, then the loud noise (because the floodfill visits points at an increasing radius from each noise source). Given two equally loud noises, the closer noise will always win. Multiple quiet noises emitted close together do not combined into a louder noise. Monsters hearing a noise at a distance from its source may not correctly guess the noise's origin if the noise did not travel in a straight line to the monster. Noises are currently processed before and after handle_monsters() so that monsters can react to noises produced by the player and by each other. We could conceivably drop one of the apply_noises() calls (probably the one after handle_monsters()) without adverse effects. Since the new noise system allows closed doors to cut off sound, I've dropped the Sprint noise attenuation from 1/3 to 1/2. If Crawl is compiled with DEBUG_NOISE_PROPAGATION, it will write a noise-grid.html dump file showing noise sources and intensities on the map for each call to apply_noises that processed a noise.