]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'sev/menu_sounds_reimplementation' into 'master'
authorMario <zacjardine@y7mail.com>
Sat, 24 Jan 2015 03:24:04 +0000 (03:24 +0000)
committerMario <zacjardine@y7mail.com>
Sat, 24 Jan 2015 03:24:04 +0000 (03:24 +0000)
Menu sounds reimplementation

This branch reimplements the menu sounds. It now plays different soundfiles for the following events:

OPEN: opening dialog
CLOSE: closing dialog
FOCUS: moving focus to new item
EXECUTE: pressing button, enter key, or double click
SELECT: using checkbox, radiobutton, or similar
SLIDE: using slider or colorpicker
CLEAR: clearing inputbox or keybind
WINNER: winning single player campaign

The soundfiles are moved into the dedicated directory *data/sound/menu*.

Unfortunately, I can't provide new soundfiles, since I have no experience with sound production,
so I've reused the legacy sounds or added placeholders.
However, I still think it is useful to merge this branch now,
because it improves the way that the sounds are played:

- It greatly reduces the "Geiger counter" effect of the focus sound when the cursor quickly moves across several items
- The focus sound plays for all interactive elements, e.g. also for the inputbox
- The execute (button) sound also plays for double clicks, e.g. in the gametypelist
- The audio settings tab gets a second checkbox to independently toggle focus sounds

See merge request !93

35 files changed:
qcsrc/menu/classes.c
qcsrc/menu/command/menu_cmd.qc
qcsrc/menu/item.c
qcsrc/menu/item/button.c
qcsrc/menu/item/checkbox.c
qcsrc/menu/item/dialog.c
qcsrc/menu/item/inputbox.c
qcsrc/menu/item/listbox.c
qcsrc/menu/item/nexposee.c
qcsrc/menu/item/slider.c
qcsrc/menu/menu.qc
qcsrc/menu/menu.qh
qcsrc/menu/xonotic/colorpicker.c
qcsrc/menu/xonotic/colorpicker_string.c
qcsrc/menu/xonotic/dialog_settings_audio.c
qcsrc/menu/xonotic/dialog_singleplayer_winner.c
qcsrc/menu/xonotic/gametypelist.c
qcsrc/menu/xonotic/keybinder.c
qcsrc/menu/xonotic/languagelist.c
qcsrc/menu/xonotic/maplist.c
qcsrc/menu/xonotic/playerlist.c
qcsrc/menu/xonotic/serverlist.c
qcsrc/menu/xonotic/skinlist.c
sound/menu/README [new file with mode: 0644]
sound/menu/clear.wav [new file with mode: 0644]
sound/menu/close.wav [new file with mode: 0644]
sound/menu/execute.wav [new file with mode: 0644]
sound/menu/focus.wav [new file with mode: 0644]
sound/menu/open.wav [new file with mode: 0644]
sound/menu/select.wav [new file with mode: 0644]
sound/menu/slide.wav [new file with mode: 0644]
sound/menu/winner.ogg [new file with mode: 0644]
sound/misc/menu1.wav [deleted file]
sound/misc/menu2.wav [deleted file]
sound/misc/mouseclick.wav [deleted file]

index 9f01ee3fbf08dc8c8a633916923eea028f0d14d1..857f071b2fa2d01984b99838fff9531ddbb1ac7c 100644 (file)
@@ -9,12 +9,12 @@
 #include "item/modalcontroller.c"
 #include "item/image.c"
 #include "item/label.c"
+#include "item/dialog.c"
 #include "item/button.c"
 #include "item/checkbox.c"
 #include "item/radiobutton.c"
 #include "item/borderimage.c"
 #include "item/slider.c"
-#include "item/dialog.c"
 #include "item/tab.c"
 #include "item/textslider.c"
 #include "item/listbox.c"
index c7499e58e40a8a94ba1f31f2c504f0310bb465a3..89086406699a995153b8df9a4f7e293b36945859 100644 (file)
@@ -85,7 +85,10 @@ void GameCommand(string theCommand)
                                }
                }
                else if(argc == 2 && !isdemo()) // don't allow this command in demos
+               {
+                       m_play_click_sound(MENU_SOUND_OPEN);
                        m_goto(strcat(filter, argv(1))); // switch to a menu item
+               }
                if(filter)
                        strunzone(filter);
                return;
index d055b1a051d535dbfd18736751eb2357c25003a0..d0bd40b03884c30d4e83c6727e82d89ac23019a3 100644 (file)
@@ -17,6 +17,7 @@ CLASS(Item) EXTENDS(Object)
        METHOD(Item, destroy, void(entity))
        ATTRIB(Item, focused, float, 0)
        ATTRIB(Item, focusable, float, 0)
+       ATTRIB(Item, allowFocusSound, float, 0)
        ATTRIB(Item, parent, entity, NULL)
        ATTRIB(Item, preferredFocusPriority, float, 0)
        ATTRIB(Item, origin, vector, '0 0 0')
@@ -121,6 +122,8 @@ float Item_mouseRelease(entity me, vector pos)
 
 void Item_focusEnter(entity me)
 {
+       if(me.allowFocusSound)
+               m_play_focus_sound();
 }
 
 void Item_focusLeave(entity me)
index 8bbdfa70406e125083dc6572acedf2f123aeb120..385064e5dad5315c75f0e5376d813bf83a40e94f 100644 (file)
@@ -8,7 +8,7 @@ CLASS(Button) EXTENDS(Label)
        METHOD(Button, mousePress, float(entity, vector))
        METHOD(Button, mouseDrag, float(entity, vector))
        METHOD(Button, mouseRelease, float(entity, vector))
-       METHOD(Button, focusEnter, void(entity))
+       METHOD(Button, playClickSound, void(entity))
        ATTRIB(Button, onClick, void(entity, entity), func_null)
        ATTRIB(Button, onClickEntity, entity, NULL)
        ATTRIB(Button, src, string, string_null)
@@ -18,6 +18,7 @@ CLASS(Button) EXTENDS(Label)
        ATTRIB(Button, srcMulti, float, 1) // 0: button square left, text right; 1: button stretched, text over it
        ATTRIB(Button, buttonLeftOfText, float, 0)
        ATTRIB(Button, focusable, float, 1)
+       ATTRIB(Button, allowFocusSound, float, 1)
        ATTRIB(Button, pressed, float, 0)
        ATTRIB(Button, clickTime, float, 0)
        ATTRIB(Button, disabled, float, 0)
@@ -53,6 +54,7 @@ float Button_keyDown(entity me, float key, float ascii, float shift)
 {
        if(key == K_ENTER || key == K_SPACE || key == K_KP_ENTER)
        {
+               me.playClickSound(me);
                me.clickTime = 0.1; // delayed for effect
                return 1;
        }
@@ -79,8 +81,7 @@ float Button_mouseRelease(entity me, vector pos)
        {
                if (!me.disabled)
                {
-                       if(cvar("menu_sounds"))
-                               localsound("sound/misc/menu2.wav");
+                       me.playClickSound(me);
                        if(me.onClick)
                                me.onClick(me, me.onClickEntity);
                }
@@ -92,12 +93,6 @@ void Button_showNotify(entity me)
 {
        me.focusable = !me.disabled;
 }
-void Button_focusEnter(entity me)
-{
-       if(cvar("menu_sounds") > 1)
-               localsound("sound/misc/menu1.wav");
-       SUPER(Button).focusEnter(me);
-}
 void Button_draw(entity me)
 {
        vector bOrigin, bSize;
@@ -170,4 +165,13 @@ void Button_draw(entity me)
 
        SUPER(Button).draw(me);
 }
+void Button_playClickSound(entity me)
+{
+       if(me.onClick == DialogOpenButton_Click)
+               m_play_click_sound(MENU_SOUND_OPEN);
+       else if(me.onClick == Dialog_Close)
+               m_play_click_sound(MENU_SOUND_CLOSE);
+       else
+               m_play_click_sound(MENU_SOUND_EXECUTE);
+}
 #endif
index 94f67ba709ef7422b1d0b3a76e488b1b9f8f5acf..2540cc846fdbddf80ef44a5d8f4bd022e7f1dee8 100644 (file)
@@ -3,6 +3,7 @@ void CheckBox_Click(entity me, entity other);
 CLASS(CheckBox) EXTENDS(Button)
        METHOD(CheckBox, configureCheckBox, void(entity, string, float, string))
        METHOD(CheckBox, draw, void(entity))
+       METHOD(CheckBox, playClickSound, void(entity))
        METHOD(CheckBox, toString, string(entity))
        METHOD(CheckBox, setChecked, void(entity, float))
        ATTRIB(CheckBox, useDownAsChecked, float, 0)
@@ -45,4 +46,8 @@ void CheckBox_draw(entity me)
        me.pressed = s;
        SUPER(CheckBox).draw(me);
 }
+void CheckBox_playClickSound(entity me)
+{
+       m_play_click_sound(MENU_SOUND_SELECT);
+}
 #endif
index 383578781544e96b900cca383fc702c377945de8..f60550103423b94c869f493ad4616897b5430fef 100644 (file)
@@ -182,6 +182,7 @@ float Dialog_keyDown(entity me, float key, float ascii, float shift)
        {
                if(key == K_ESCAPE)
                {
+                       m_play_click_sound(MENU_SOUND_CLOSE);
                        me.close(me);
                        return 1;
                }
index 1c1bf5189bc34a48a824a46f132e96e79e2f83cb..7b74ade9b0180e67ea982da477198bf48b5b5366 100644 (file)
@@ -18,6 +18,7 @@ CLASS(InputBox) EXTENDS(Label)
        ATTRIB(InputBox, scrollPos, float, 0) // widths
 
        ATTRIB(InputBox, focusable, float, 1)
+       ATTRIB(InputBox, allowFocusSound, float, 1)
        ATTRIB(InputBox, disabled, float, 0)
        ATTRIB(InputBox, lastChangeTime, float, 0)
        ATTRIB(InputBox, dragScrollTimer, float, 0)
@@ -38,7 +39,6 @@ CLASS(InputBox) EXTENDS(Label)
        ATTRIB(InputBox, cb_colorF, vector, '1 1 1')
        ATTRIB(InputBox, cb_colorC, vector, '1 1 1')
 ENDCLASS(InputBox)
-void InputBox_Clear_Click(entity btn, entity me);
 #endif
 
 #ifdef IMPLEMENTATION
@@ -66,11 +66,6 @@ void InputBox_setText(entity me, string txt)
        SUPER(InputBox).setText(me, strzone(txt));
 }
 
-void InputBox_Clear_Click(entity btn, entity me)
-{
-       me.setText(me, "");
-}
-
 float over_ClearButton(entity me, vector pos)
 {
        if (pos_x >= 1 + me.cb_offset - me.cb_width)
@@ -135,8 +130,9 @@ float InputBox_mouseRelease(entity me, vector pos)
        if(me.cb_pressed)
        if (over_ClearButton(me, pos))
        {
+               m_play_click_sound(MENU_SOUND_CLEAR);
+               me.setText(me, "");
                me.cb_pressed = 0;
-               InputBox_Clear_Click(world, me);
                return 1;
        }
        float r = InputBox_mouseDrag(me, pos);
@@ -204,7 +200,10 @@ float InputBox_keyDown(entity me, float key, float ascii, float shift)
                case K_KP_DEL:
                case K_DEL:
                        if(shift & S_CTRL)
+                       {
+                               m_play_click_sound(MENU_SOUND_CLEAR);
                                me.setText(me, "");
+                       }
                        else
                                me.setText(me, strcat(substring(me.text, 0, me.cursorPos), substring(me.text, me.cursorPos + 1, strlen(me.text) - me.cursorPos - 1)));
                        return 1;
index 275b99735b72529f974f015519770192fdb51509..3466b134bd708890b490879cf607dd4c824fff9d 100644 (file)
@@ -9,6 +9,7 @@ CLASS(ListBox) EXTENDS(Item)
        METHOD(ListBox, mouseRelease, float(entity, vector))
        METHOD(ListBox, focusLeave, void(entity))
        ATTRIB(ListBox, focusable, float, 1)
+       ATTRIB(ListBox, allowFocusSound, float, 1)
        ATTRIB(ListBox, selectedItem, float, 0)
        ATTRIB(ListBox, size, vector, '0 0 0')
        ATTRIB(ListBox, origin, vector, '0 0 0')
index ca7ab8fc3785c479c27bee31ee099268a80a3659..0adc399e0887c45a29931df8ef3fbfd4debf09e9 100644 (file)
@@ -219,6 +219,7 @@ float Nexposee_mousePress(entity me, vector pos)
                Nexposee_mouseMove(me, pos);
                if(me.mouseFocusedChild)
                {
+                       m_play_click_sound(MENU_SOUND_OPEN);
                        me.animationState = 1;
                        SUPER(Nexposee).setFocus(me, NULL);
                }
@@ -230,6 +231,7 @@ float Nexposee_mousePress(entity me, vector pos)
        {
                if (!(SUPER(Nexposee).mousePress(me, pos)))
                {
+                       m_play_click_sound(MENU_SOUND_CLOSE);
                        me.animationState = 3;
                        SUPER(Nexposee).setFocus(me, NULL);
                }
@@ -322,10 +324,12 @@ float Nexposee_keyDown(entity me, float scan, float ascii, float shift)
                        default:
                        case 0:
                        case 3:
+                               m_play_click_sound(MENU_SOUND_OPEN);
                                me.animationState = 1;
                                break;
                        case 1:
                        case 2:
+                               m_play_click_sound(MENU_SOUND_CLOSE);
                                me.animationState = 3;
                                break;
                }
index c92db27e984f84be22a86ff2ae8049d190c3d478..fb8cda906764b31effeafd48893ccc948d084188 100644 (file)
@@ -7,10 +7,10 @@ CLASS(Slider) EXTENDS(Label)
        METHOD(Slider, configureSliderValues, void(entity, float, float, float, float, float, float))
        METHOD(Slider, draw, void(entity))
        METHOD(Slider, keyDown, float(entity, float, float, float))
+       METHOD(Slider, keyUp, float(entity, float, float, float))
        METHOD(Slider, mousePress, float(entity, vector))
        METHOD(Slider, mouseDrag, float(entity, vector))
        METHOD(Slider, mouseRelease, float(entity, vector))
-       METHOD(Slider, focusEnter, void(entity))
        METHOD(Slider, valueToText, string(entity, float))
        METHOD(Slider, toString, string(entity))
        METHOD(Slider, setValue, void(entity, float))
@@ -18,6 +18,7 @@ CLASS(Slider) EXTENDS(Label)
        METHOD(Slider, showNotify, void(entity))
        ATTRIB(Slider, src, string, string_null)
        ATTRIB(Slider, focusable, float, 1)
+       ATTRIB(Slider, allowFocusSound, float, 1)
        ATTRIB(Slider, value, float, 0)
        ATTRIB(Slider, animated, float, 1)
        ATTRIB(Slider, sliderValue, float, 0)
@@ -146,7 +147,29 @@ float Slider_keyDown(entity me, float key, float ascii, float shift)
                me.setValue(me, me.valueMax);
                return 1;
        }
-       // TODO more keys
+       // TODO more keys (NOTE also add them to Slider_keyUp)
+       return 0;
+}
+float Slider_keyUp(entity me, float key, float ascii, float shift)
+{
+       if(me.disabled)
+               return 0;
+       switch(key)
+       {
+               case K_LEFTARROW:
+               case K_KP_LEFTARROW:
+               case K_RIGHTARROW:
+               case K_KP_RIGHTARROW:
+               case K_PGUP:
+               case K_KP_PGUP:
+               case K_PGDN:
+               case K_KP_PGDN:
+               case K_HOME:
+               case K_KP_HOME:
+               case K_END:
+               case K_KP_END:
+                       m_play_click_sound(MENU_SOUND_SLIDE);
+       }
        return 0;
 }
 float Slider_mouseDrag(entity me, vector pos)
@@ -242,20 +265,13 @@ float Slider_mouseRelease(entity me, vector pos)
        me.pressed = 0;
        if(me.disabled)
                return 0;
-       if(cvar("menu_sounds"))
-               localsound("sound/misc/menu2.wav");
+       m_play_click_sound(MENU_SOUND_SLIDE);
        return 1;
 }
 void Slider_showNotify(entity me)
 {
        me.focusable = !me.disabled;
 }
-void Slider_focusEnter(entity me)
-{
-       if(cvar("menu_sounds") > 1)
-               localsound("sound/misc/menu1.wav");
-       SUPER(Slider).focusEnter(me);
-}
 void Slider_draw(entity me)
 {
        float controlLeft;
index aa771649d663fa705e6980d4870ef3d5174624b0..85aa3a640e319a055b56926f053ec58d72c12558 100644 (file)
@@ -1001,3 +1001,20 @@ void m_goto(string itemname)
                }
        }
 }
+
+float menuLastFocusSoundTime;
+void m_play_focus_sound()
+{
+       if(cvar("menu_sounds") > 1)
+               if(time - menuLastFocusSoundTime > 0.25)
+               {
+                       localsound(MENU_SOUND_FOCUS);
+                       menuLastFocusSoundTime = time;
+               }
+}
+
+void m_play_click_sound(string soundfile)
+{
+       if(cvar("menu_sounds"))
+               localsound(soundfile);
+}
index b6c0795a8544424d505b8392d8d7f4f7cec59825..6f36a074e05311361c71b174afa796a03adeb02b 100644 (file)
@@ -38,3 +38,17 @@ void preMenuDraw(); // this is run before the menu is drawn. You may put some st
 void postMenuDraw(); // this is run just after the menu is drawn (or not). Useful to draw something over everything else.
 
 void m_sync();
+
+// sounds
+
+const string MENU_SOUND_CLEAR   = "sound/menu/clear.wav";
+const string MENU_SOUND_CLOSE   = "sound/menu/close.wav";
+const string MENU_SOUND_EXECUTE = "sound/menu/execute.wav";
+const string MENU_SOUND_FOCUS   = "sound/menu/focus.wav";
+const string MENU_SOUND_OPEN    = "sound/menu/open.wav";
+const string MENU_SOUND_SELECT  = "sound/menu/select.wav";
+const string MENU_SOUND_SLIDE   = "sound/menu/slide.wav";
+const string MENU_SOUND_WINNER  = "sound/menu/winner.wav";
+
+void m_play_focus_sound();
+void m_play_click_sound(string soundfile);
index e0727373c14b3a4795db1cde2f3caadaec45bfbc..a6be0a4d0476f4e2e7268b8265f4adee79d1fd53 100644 (file)
@@ -139,6 +139,7 @@ float XonoticColorpicker_mouseDrag(entity me, vector coords)
 
 float XonoticColorpicker_mouseRelease(entity me, vector coords)
 {
+       m_play_click_sound(MENU_SOUND_SLIDE);
        me.mouseDrag(me, coords);
        return 1;
 }
index 5d53135e9cca1967c7e3f0d68b8a4b631b7e1ef3..56b8100aaa3a5c816cb9e00e43f276be5240d519 100644 (file)
@@ -97,6 +97,7 @@ float XonoticColorpickerString_mouseDrag(entity me, vector coords)
 
 float XonoticColorpickerString_mouseRelease(entity me, vector coords)
 {
+       m_play_click_sound(MENU_SOUND_SLIDE);
        me.mouseDrag(me, coords);
        return 1;
 }
index 39bee32426c84bd771755266fc67bf3ab9d01e8d..cfbe229b551a2e643734d0ac7c7f0a8717ab2cab 100644 (file)
@@ -5,6 +5,7 @@ CLASS(XonoticAudioSettingsTab) EXTENDS(XonoticTab)
        ATTRIB(XonoticAudioSettingsTab, intendedWidth, float, 0.9)
        ATTRIB(XonoticAudioSettingsTab, rows, float, 15.5)
        ATTRIB(XonoticAudioSettingsTab, columns, float, 6.2) // added extra .2 for center space
+       ATTRIB(XonoticAudioSettingsTab, hiddenMenuSoundsSlider, entity, NULL)
 ENDCLASS(XonoticAudioSettingsTab)
 entity makeXonoticAudioSettingsTab();
 #endif
@@ -136,7 +137,10 @@ void XonoticAudioSettingsTab_fill(entity me)
        me.TR(me);
                me.TD(me, 1, 3, makeXonoticCheckBox(0, "con_chatsound", _("Chat message sound")));
        me.TR(me);
-               me.TD(me, 1, 3, makeXonoticCheckBoxEx(2, 0, "menu_sounds", _("Menu sounds")));
+               me.hiddenMenuSoundsSlider = makeXonoticSlider(1, 1, 1, "menu_sounds");
+               me.TD(me, 1, 1.2, makeXonoticSliderCheckBox(0, 1, me.hiddenMenuSoundsSlider, _("Menu sounds")));
+               me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(2, 0, me.hiddenMenuSoundsSlider, _("Focus sounds")));
+               setDependent(e, "menu_sounds", 1, 2);
        me.TR(me);
        me.TR(me);
                me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Time announcer:")));
index 8e584b8a8a259866636932eccce69630a840747a..0d1c05af44a10a89281bc4c668d06dd1827608ba 100644 (file)
@@ -1,6 +1,7 @@
 #ifdef INTERFACE
 CLASS(XonoticWinnerDialog) EXTENDS(XonoticDialog)
        METHOD(XonoticWinnerDialog, fill, void(entity))
+       METHOD(XonoticWinnerDialog, focusEnter, void(entity))
        ATTRIB(XonoticWinnerDialog, title, string, _("Winner"))
        ATTRIB(XonoticWinnerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
        ATTRIB(XonoticWinnerDialog, intendedWidth, float, 0.32)
@@ -22,4 +23,8 @@ void XonoticWinnerDialog_fill(entity me)
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
 }
+void XonoticWinnerDialog_focusEnter(entity me)
+{
+       m_play_click_sound(MENU_SOUND_WINNER);
+}
 #endif
index e3df84467708fc9ab1c47a04410e66fa15aa21b2..3fd45c329c306fdabe3fa6e532cf7fdb784a7a69 100644 (file)
@@ -8,6 +8,7 @@ CLASS(XonoticGametypeList) EXTENDS(XonoticListBox)
        METHOD(XonoticGametypeList, loadCvars, void(entity))
        METHOD(XonoticGametypeList, saveCvars, void(entity))
        METHOD(XonoticGametypeList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticGametypeList, clickListBoxItem, void(entity, float, vector))
 
        ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0')
        ATTRIB(XonoticGametypeList, realUpperMargin, float, 0)
@@ -45,7 +46,6 @@ void XonoticGametypeList_setSelected(entity me, float i)
        SUPER(XonoticGametypeList).setSelected(me, i);
        me.saveCvars(me);
 }
-
 void XonoticGametypeList_loadCvars(entity me)
 {
        float t;
@@ -111,15 +111,19 @@ void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSiz
        me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize + (0.5 * me.realFontSize_x);
        me.columnNameSize = 1 - me.columnIconSize - (1.5 * me.realFontSize_x);
 }
-
 float XonoticGametypeList_keyDown(entity me, float scan, float ascii, float shift)
 {
        if(scan == K_ENTER || scan == K_KP_ENTER)
        {
+               m_play_click_sound(MENU_SOUND_EXECUTE);
                me.parent.gameTypeSelectNotify(me.parent);
                return 1;
        }
 
        return SUPER(XonoticGametypeList).keyDown(me, scan, ascii, shift);
 }
+void XonoticGametypeList_clickListBoxItem(entity me, float i, vector where)
+{
+       m_play_click_sound(MENU_SOUND_SELECT);
+}
 #endif
index 60c44ddaf2436e8f6214b96c4641f0b54c46e3dc..272edd905311a65724514c70b445f368b455e3ec 100644 (file)
@@ -170,6 +170,7 @@ void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii)
                                localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
                }
        }
+       m_play_click_sound(MENU_SOUND_SELECT);
        localcmd("\nbind \"", keynumtostring(key), "\" \"", func, "\"\n");
        localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
        cvar_set("_hud_showbinds_reload", "1");
@@ -233,6 +234,7 @@ void KeyBinder_Bind_Clear(entity btn, entity me)
                        //localcmd("\nunbind \"", keynumtostring(k), "\"\n");
                        localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
        }
+       m_play_click_sound(MENU_SOUND_CLEAR);
        localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
        cvar_set("_hud_showbinds_reload", "1");
 }
index 38b8098ae0da2619d456ee0099e1c83a52fd271d..5697f823109d001bdc1a226165d62cb47fef3ef7 100644 (file)
@@ -140,12 +140,15 @@ void XonoticLanguageList_saveCvars(entity me)
 
 void XonoticLanguageList_doubleClickListBoxItem(entity me, float i, vector where)
 {
+       m_play_click_sound(MENU_SOUND_EXECUTE);
        me.setLanguage(me);
 }
 
 float XonoticLanguageList_keyDown(entity me, float scan, float ascii, float shift)
 {
-       if(scan == K_ENTER || scan == K_KP_ENTER) {
+       if(scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               m_play_click_sound(MENU_SOUND_EXECUTE);
                me.setLanguage(me);
                return 1;
        }
index e05c7644f4885ed724ba2e9b570159c02f7dcc3e..54166f6e045cc5e5c1e0ed06e5424313cacab5f3 100644 (file)
@@ -141,7 +141,10 @@ void XonoticMapList_clickListBoxItem(entity me, float i, vector where)
 {
        if(where_x <= me.columnPreviewOrigin + me.columnPreviewSize)
                if(where_x >= 0)
+               {
+                       m_play_click_sound(MENU_SOUND_SELECT);
                        me.g_maplistCacheToggle(me, i);
+               }
 }
 
 void XonoticMapList_doubleClickListBoxItem(entity me, float i, vector where)
@@ -150,6 +153,7 @@ void XonoticMapList_doubleClickListBoxItem(entity me, float i, vector where)
                if(where_x <= 1)
                {
                        // pop up map info screen
+                       m_play_click_sound(MENU_SOUND_OPEN);
                        main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me);
                        DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
                }
@@ -296,22 +300,30 @@ float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift)
        if(scan == K_MOUSE2 || scan == K_SPACE || scan == K_ENTER || scan == K_KP_ENTER)
        {
                // pop up map info screen
+               m_play_click_sound(MENU_SOUND_OPEN);
                main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, me.selectedItem, me);
                DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
        }
        else if(scan == K_MOUSE3 || scan == K_INS || scan == K_KP_INS)
        {
+               m_play_click_sound(MENU_SOUND_SELECT);
                me.g_maplistCacheToggle(me, me.selectedItem);
        }
        else if(ascii == 43) // +
        {
                if (!me.g_maplistCacheQuery(me, me.selectedItem))
+               {
+                       m_play_click_sound(MENU_SOUND_SELECT);
                        me.g_maplistCacheToggle(me, me.selectedItem);
+               }
        }
        else if(ascii == 45) // -
        {
                if(me.g_maplistCacheQuery(me, me.selectedItem))
+               {
+                       m_play_click_sound(MENU_SOUND_SELECT);
                        me.g_maplistCacheToggle(me, me.selectedItem);
+               }
        }
        else if(scan == K_BACKSPACE)
        {
index b3ee38670a04ad41117b82f3db7c0b2ee780b974..5579394ea7913cc39e917de99571b3489769ca7e 100644 (file)
@@ -3,6 +3,7 @@ CLASS(XonoticPlayerList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
        METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticPlayerList, drawListBoxItem, void(entity, float, vector, float))
+       ATTRIB(XonoticPlayerList, allowFocusSound, float, 0)
        ATTRIB(XonoticPlayerList, realFontSize, vector, '0 0 0')
        ATTRIB(XonoticPlayerList, columnNameOrigin, float, 0)
        ATTRIB(XonoticPlayerList, columnNameSize, float, 0)
index c78cba0e0667c931bb7d5ed23b40a256adf0c4da..3d848c9c59d78df666d39f87776c7a179363e7bb 100644 (file)
@@ -561,6 +561,7 @@ void XonoticServerList_refreshServerList(entity me, float mode)
 }
 void XonoticServerList_focusEnter(entity me)
 {
+       SUPER(XonoticServerList).focusEnter(me);
        if(time < me.nextRefreshTime)
        {
                //print("sorry, no refresh yet\n");
@@ -943,6 +944,7 @@ void ServerList_Favorite_Click(entity btn, entity me)
        ipstr = netaddress_resolve(me.ipAddressBox.text, 26000);
        if(ipstr != "")
        {
+               m_play_click_sound(MENU_SOUND_SELECT);
                me.toggleFavorite(me, me.ipAddressBox.text);
                me.ipAddressBoxFocused = -1;
        }
@@ -1245,6 +1247,7 @@ float XonoticServerList_keyDown(entity me, float scan, float ascii, float shift)
        {
                if(me.nItems != 0)
                {
+                       m_play_click_sound(MENU_SOUND_OPEN);
                        main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
                        DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
                        return 1;
index 034fb2584098490d291fd2eb123160e02a21970f..234f1237ec776a628f774a8e4b98a3ae3f7beff9 100644 (file)
@@ -181,12 +181,15 @@ void SetSkin_Click(entity btn, entity me)
 
 void XonoticSkinList_doubleClickListBoxItem(entity me, float i, vector where)
 {
+       m_play_click_sound(MENU_SOUND_EXECUTE);
        me.setSkin(me);
 }
 
 float XonoticSkinList_keyDown(entity me, float scan, float ascii, float shift)
 {
-       if(scan == K_ENTER || scan == K_KP_ENTER) {
+       if(scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               m_play_click_sound(MENU_SOUND_EXECUTE);
                me.setSkin(me);
                return 1;
        }
diff --git a/sound/menu/README b/sound/menu/README
new file mode 100644 (file)
index 0000000..eede58b
--- /dev/null
@@ -0,0 +1,10 @@
+SOUND    PLAYED WHEN
+
+open     opening dialog
+close    closing dialog
+focus    moving focus to new item
+execute  pressing button, enter key, or double click
+select   using checkbox, radiobutton, or similar
+slide    using slider or colorpicker
+clear    clearing inputbox or keybind
+winner   winning single player campaign
diff --git a/sound/menu/clear.wav b/sound/menu/clear.wav
new file mode 100644 (file)
index 0000000..a622af8
Binary files /dev/null and b/sound/menu/clear.wav differ
diff --git a/sound/menu/close.wav b/sound/menu/close.wav
new file mode 100644 (file)
index 0000000..c990fbd
Binary files /dev/null and b/sound/menu/close.wav differ
diff --git a/sound/menu/execute.wav b/sound/menu/execute.wav
new file mode 100644 (file)
index 0000000..58b3d1c
Binary files /dev/null and b/sound/menu/execute.wav differ
diff --git a/sound/menu/focus.wav b/sound/menu/focus.wav
new file mode 100644 (file)
index 0000000..a045d26
Binary files /dev/null and b/sound/menu/focus.wav differ
diff --git a/sound/menu/open.wav b/sound/menu/open.wav
new file mode 100644 (file)
index 0000000..c990fbd
Binary files /dev/null and b/sound/menu/open.wav differ
diff --git a/sound/menu/select.wav b/sound/menu/select.wav
new file mode 100644 (file)
index 0000000..58b3d1c
Binary files /dev/null and b/sound/menu/select.wav differ
diff --git a/sound/menu/slide.wav b/sound/menu/slide.wav
new file mode 100644 (file)
index 0000000..58b3d1c
Binary files /dev/null and b/sound/menu/slide.wav differ
diff --git a/sound/menu/winner.ogg b/sound/menu/winner.ogg
new file mode 100644 (file)
index 0000000..56b114e
Binary files /dev/null and b/sound/menu/winner.ogg differ
diff --git a/sound/misc/menu1.wav b/sound/misc/menu1.wav
deleted file mode 100644 (file)
index a045d26..0000000
Binary files a/sound/misc/menu1.wav and /dev/null differ
diff --git a/sound/misc/menu2.wav b/sound/misc/menu2.wav
deleted file mode 100644 (file)
index 58b3d1c..0000000
Binary files a/sound/misc/menu2.wav and /dev/null differ
diff --git a/sound/misc/mouseclick.wav b/sound/misc/mouseclick.wav
deleted file mode 100644 (file)
index a622af8..0000000
Binary files a/sound/misc/mouseclick.wav and /dev/null differ