From f3820bc81a248fdd329b8a201c4cc39a64cb813b Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 19 Feb 2016 17:12:27 +0100 Subject: [PATCH] Fixed using SOUND_CLICK instead of SOUND_NONE, some sound documentation fixes --- src/object/crash_sphere.h | 10 +++++++++- src/object/motion/motionhuman.cpp | 8 ++++---- src/object/motion/motiontoto.cpp | 4 ++-- src/physics/physics.cpp | 4 ++-- src/sound/sound_type.h | 33 ++++++++++++++++++------------- src/ui/displaytext.cpp | 4 ++-- 6 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/object/crash_sphere.h b/src/object/crash_sphere.h index c40755f8..3cc30dbe 100644 --- a/src/object/crash_sphere.h +++ b/src/object/crash_sphere.h @@ -19,6 +19,8 @@ #pragma once +#include "common/logger.h" + #include "math/sphere.h" #include "math/vector.h" @@ -37,7 +39,13 @@ struct CrashSphere : sphere(pos, radius) , sound(_sound) , hardness(_hardness) - {} + { + if (sound == SOUND_CLICK) + { + GetLogger()->Warn("Crash sphere using SOUND_CLICK, using SOUND_NONE instead.\n"); // TODO: Make sure v3 model files don't use this ~krzys_h + sound = SOUND_NONE; + } + } //! Sphere (position + radius) //! Sphere position is given in either object or world coordinates diff --git a/src/object/motion/motionhuman.cpp b/src/object/motion/motionhuman.cpp index 51983f87..cd70d450 100644 --- a/src/object/motion/motionhuman.cpp +++ b/src/object/motion/motionhuman.cpp @@ -1540,8 +1540,8 @@ bool CMotionHuman::EventFrame(const Event &event) } volume[1] = volume[0]; freq[1] = freq[0]; - sound[0] = SOUND_CLICK; - sound[1] = SOUND_CLICK; + sound[0] = SOUND_NONE; + sound[1] = SOUND_NONE; pos = m_object->GetPosition(); @@ -1581,11 +1581,11 @@ bool CMotionHuman::EventFrame(const Event &event) } } - if ( sound[0] != SOUND_CLICK ) + if ( sound[0] != SOUND_NONE ) { m_sound->Play(sound[0], pos, volume[0], freq[0]); } - if ( sound[1] != SOUND_CLICK ) + if ( sound[1] != SOUND_NONE ) { m_sound->Play(sound[1], pos, volume[1], freq[1]); } diff --git a/src/object/motion/motiontoto.cpp b/src/object/motion/motiontoto.cpp index 58263cce..18db7471 100644 --- a/src/object/motion/motiontoto.cpp +++ b/src/object/motion/motiontoto.cpp @@ -819,13 +819,13 @@ Error CMotionToto::SetAction(int action, float time) m_bStartAction = true; - sound = SOUND_CLICK; + sound = SOUND_NONE; if ( action == MT_ERROR ) sound = SOUND_ERROR; if ( action == MT_WARNING ) sound = SOUND_WARNING; if ( action == MT_INFO ) sound = SOUND_INFO; if ( action == MT_MESSAGE ) sound = SOUND_MESSAGE; - if ( sound != SOUND_CLICK ) + if ( sound != SOUND_NONE ) { m_soundChannel = m_sound->Play(sound, m_object->GetPosition()); } diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index 589e4a15..aec572b1 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -2555,7 +2555,7 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle) m_bCollision = true; m_bObstacle = true; - if (crashSphere.sound != SOUND_CLICK) + if (crashSphere.sound != SOUND_NONE) { force = fabs(m_linMotion.realSpeed.x); force *= crashSphere.hardness*2.0f; @@ -2569,7 +2569,7 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle) force *= crashSphere.hardness; volume = fabs(force*0.05f); if ( volume > 1.0f ) volume = 1.0f; - if ( crashSphere.sound != SOUND_CLICK ) + if ( crashSphere.sound != SOUND_NONE ) { m_sound->Play(crashSphere.sound, m_object->GetPosition(), volume); } diff --git a/src/sound/sound_type.h b/src/sound/sound_type.h index 84a5ca86..5d85e0b5 100644 --- a/src/sound/sound_type.h +++ b/src/sound/sound_type.h @@ -21,6 +21,11 @@ #include +/** + * \file sound/sound_type.h + * \brief Defines the SoundType enum + */ + /** * \public * \enum SoundType @@ -29,7 +34,7 @@ enum SoundType { SOUND_NONE = -1, /*!< Mute. */ - SOUND_CLICK = 0, /*!< Blank sound sample. Unused? */ + SOUND_CLICK = 0, /*!< Keybinding change. */ SOUND_BOUM = 1, /*!< Landing on ground bump. */ SOUND_EXPLO = 2, /*!< Building explosion. */ SOUND_FLYh = 3, /*!< Jet engine (SpaceShip) landing. */ @@ -44,7 +49,7 @@ enum SoundType SOUND_PLOUF = 12, /*!< Water splash. */ SOUND_BLUP = 13, /*!< Swimming #1. */ SOUND_WARNING = 14, /*!< DisplayWarning message. */ - SOUND_DERRICK = 15, /*!< Derrick digging. (?) */ + SOUND_DERRICK = 15, /*!< Derrick digging. */ SOUND_LABO = 16, /*!< AutoLab processing sample. */ SOUND_STATION = 17, /*!< PowerStation recharging #2/Sparkle in menu #2. */ SOUND_REPAIR = 18, /*!< RepairCenter/Sniffer working. */ @@ -52,15 +57,15 @@ enum SoundType SOUND_INSECTs = 20, /*!< AlienSpider roar. */ SOUND_BURN = 21, /*!< Burning. */ SOUND_TZOING = 22, /*!< EPSITEC's Brand "TZOING!". */ - SOUND_GGG = 23, /*!< Electricity. */ + SOUND_GGG = 23, /*!< Electricity/Menu particle sound #2. */ SOUND_MANIP = 24, /*!< Bot's mechanic arm manipulating. */ SOUND_FIRE = 25, /*!< ShooterBots shooting. */ SOUND_HUMAN1 = 26, /*!< Astronaut breathing. */ SOUND_STEPw = 27, /*!< Step under the water. */ SOUND_SWIM = 28, /*!< Swimming #2. */ - SOUND_RADAR = 29, /*!< RadarStation "DING!". */ - SOUND_BUILD = 30, /*!< Building processing/Sparkle in menu #3. */ - SOUND_ALARM = 31, /*!< Bot energy alarm. */ + SOUND_RADAR = 29, /*!< RadarStation "DING!"/Sparkle in menu #5. */ + SOUND_BUILD = 30, /*!< Building processing */ + SOUND_ALARM = 31, /*!< Bot energy alarm/Sparkle in menu #3. */ SOUND_SLIDE = 32, /*!< WingedBot engine. */ SOUND_EXPLOi = 33, /*!< AlienInsect exploding scream. */ SOUND_INSECTa = 34, /*!< AlienAnt roar. */ @@ -68,9 +73,9 @@ enum SoundType SOUND_INSECTw = 36, /*!< AlienWorm roar. */ SOUND_INSECTm = 37, /*!< AlienQueen roar. */ SOUND_TREMBLE = 38, /*!< Building ambient. */ - SOUND_PSHHH = 39, /*!< SpecialBot engine "PSHHH!". */ + SOUND_PSHHH = 39, /*!< SpecialBot engine "PSHHH!"/Menu particle sound #1. */ SOUND_NUCLEAR = 40, /*!< NuclearPlant processing. */ - SOUND_INFO = 41, /*!< DisplayInfo message. */ + SOUND_INFO = 41, /*!< DisplayInfo message/Sparkle in menu #4. */ SOUND_OPEN = 42, /*!< Converter open/close. */ SOUND_CLOSE = 43, /*!< Converter slam. */ SOUND_FACTORY = 44, /*!< BotFactory processing. */ @@ -93,16 +98,16 @@ enum SoundType SOUND_POWERON = 61, /*!< Power on. */ SOUND_POWEROFF = 62, /*!< Power off. */ SOUND_AIE = 63, /*!< Astronaut pain "AIE!". */ - SOUND_WAYPOINT = 64, /*!< WayPoint/Target2 activate. */ - SOUND_RECOVER = 65, /*!< Neutralized AlienInsect's fire under the shield. */ /*!< POSSIBLY DUPLICATE OF SOUND_GUNDEL=50 */ + SOUND_WAYPOINT = 64, /*!< WayPoint/Target2 activate, placing a flag. */ + SOUND_RECOVER = 65, /*!< Recycler sound. */ /* DUPLICATE OF SOUND_GUNDEL=50 */ SOUND_DEADi = 66, /*!< AlienInsect dying scream. */ SOUND_JOSTLE = 67, /*!< Leaf shaking. */ - SOUND_GFLAT = 68, /*!< FlatGround probing. */ + SOUND_GFLAT = 68, /*!< FlatGround probing/Sparkle in menu #6. */ SOUND_DEADg = 69, /*!< Astronaut death "AU!". */ SOUND_DEADw = 70, /*!< Astronaut drown "AHU!AHU!". */ SOUND_FLYf = 71, /*!< Jet engine Overheating. */ - SOUND_ALARMt = 72, /*!< Bot temperature alarm/Sparkle in menu #4. */ - SOUND_FINDING = 73, /*!< ProxyActivating an object. */ /*!< POSSIBLY DUPLICATE OF SOUND_WAYPOINT=64 */ + SOUND_ALARMt = 72, /*!< Bot temperature alarm/Sparkle in menu #7. */ + SOUND_FINDING = 73, /*!< ProxyActivating an object, opening Vault. */ /* DUPLICATE OF SOUND_WAYPOINT=64 */ SOUND_THUMP = 74, /*!< Thumper thumping. */ SOUND_TOUCH = 75, /*!< Bot getting damage. */ SOUND_BLITZ = 76, /*!< Thunder. */ @@ -114,4 +119,4 @@ enum SoundType SOUND_MAX /** number of items in enum */ }; -SoundType ParseSoundType(const std::string& str); \ No newline at end of file +SoundType ParseSoundType(const std::string& str); diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp index d3a84b3a..f0d5bd92 100644 --- a/src/ui/displaytext.cpp +++ b/src/ui/displaytext.cpp @@ -284,13 +284,13 @@ void CDisplayText::DisplayText(const char *text, Math::Vector goal, float height } else { - sound = SOUND_CLICK; + sound = SOUND_NONE; if ( type == TT_ERROR ) sound = SOUND_ERROR; if ( type == TT_WARNING ) sound = SOUND_WARNING; if ( type == TT_INFO ) sound = SOUND_INFO; if ( type == TT_MESSAGE ) sound = SOUND_MESSAGE; - if ( sound != SOUND_CLICK ) + if ( sound != SOUND_NONE ) { m_sound->Play(sound); }