From: <ufo...@li...> - 2011-12-15 23:10:29
|
Revision: 1172 http://ufo2000.svn.sourceforge.net/ufo2000/?rev=1172&view=rev Author: ssvb Date: 2011-12-15 23:10:22 +0000 (Thu, 15 Dec 2011) Log Message: ----------- Play "error" sound when showing status message From: Siarhei Siamashka <sia...@gm...> Modified Paths: -------------- trunk/src/main.cpp Modified: trunk/src/main.cpp =================================================================== --- trunk/src/main.cpp 2011-12-15 22:53:55 UTC (rev 1171) +++ trunk/src/main.cpp 2011-12-15 23:10:22 UTC (rev 1172) @@ -1461,6 +1461,16 @@ */ void set_status_message(int color, const std::string &msg, unsigned int timeout_sec) { + bool old_message_has_timed_out = status_message_timeout <= + g_1s_timer_ticks - status_message_timestamp; + + if (msg != status_message_text || old_message_has_timed_out) { + static SAMPLE *sound_sample; + if (!sound_sample) + sound_sample = wav_sample("$(ufo2000)/sfx/freesound.org/135125__ecfike__computer-error.wav"); + ASSERT(sound_sample); + play_sample(sound_sample, 255, 127, 1000, 0); + } status_message_text = msg; status_message_timestamp = g_1s_timer_ticks; status_message_timeout = timeout_sec; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |