core/MenuStyle_Base.cpp
changeset 1220 4f111b467bfa
parent 1163 0bb03cb6277b
child 1231 17badaf66ce4
     1.1 --- a/core/MenuStyle_Base.cpp	Tue Jul 31 02:08:25 2007 +0000
     1.2 +++ b/core/MenuStyle_Base.cpp	Tue Jul 31 18:56:55 2007 +0000
     1.3 @@ -18,6 +18,7 @@
     1.4  #include "PlayerManager.h"
     1.5  #include "MenuManager.h"
     1.6  #include "HandleSys.h"
     1.7 +#include "CellRecipientFilter.h"
     1.8  #if defined MENU_DEBUG
     1.9  #include "Logger.h"
    1.10  #endif
    1.11 @@ -276,6 +277,42 @@
    1.12  	} else {
    1.13  		ItemSelection type = states.slots[key_press].type;
    1.14  
    1.15 +		/* Check if we should play a sound about the type */
    1.16 +		if (g_Menus.MenuSoundsEnabled())
    1.17 +		{
    1.18 +			CellRecipientFilter filter;
    1.19 +			cell_t clients[1];
    1.20 +
    1.21 +			clients[0] = client;
    1.22 +			filter.Initialize(clients, 1);
    1.23 +
    1.24 +			const char *sound = g_Menus.GetMenuSound(type);
    1.25 +
    1.26 +			if (sound != NULL)
    1.27 +			{
    1.28 +				edict_t *pEdict = engine->PEntityOfEntIndex(client);
    1.29 +				if (pEdict)
    1.30 +				{
    1.31 +					ICollideable *pCollideable = pEdict->GetCollideable();
    1.32 +
    1.33 +					if (pCollideable)
    1.34 +					{
    1.35 +						const Vector & pos = pCollideable->GetCollisionOrigin();
    1.36 +		
    1.37 +						enginesound->EmitSound(filter, 
    1.38 +							client, 
    1.39 +							CHAN_AUTO, 
    1.40 +							sound, 
    1.41 +							VOL_NORM, 
    1.42 +							ATTN_NORM, 
    1.43 +							0, 
    1.44 +							PITCH_NORM, 
    1.45 +							&pos);
    1.46 +					}
    1.47 +				}
    1.48 +			}
    1.49 +		}
    1.50 +
    1.51  		/* For navigational items, we're going to redisplay */
    1.52  		if (type == ItemSel_Back)
    1.53  		{