]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Play OPEN/CLOSE sound when opening/closing dialog
authorSeverin Meyer <sev.ch@web.de>
Fri, 23 Jan 2015 21:19:01 +0000 (22:19 +0100)
committerSeverin Meyer <sev.ch@web.de>
Fri, 23 Jan 2015 21:19:01 +0000 (22:19 +0100)
qcsrc/menu/classes.c
qcsrc/menu/command/menu_cmd.qc
qcsrc/menu/item/button.c
qcsrc/menu/item/dialog.c
qcsrc/menu/item/nexposee.c
qcsrc/menu/menu.qh
qcsrc/menu/xonotic/maplist.c
qcsrc/menu/xonotic/serverlist.c

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 d2cb969f2568c20303562e12c310d6e554db97ae..385064e5dad5315c75f0e5376d813bf83a40e94f 100644 (file)
@@ -167,6 +167,11 @@ void Button_draw(entity me)
 }
 void Button_playClickSound(entity me)
 {
-       m_play_click_sound(MENU_SOUND_EXECUTE);
+       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 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 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 f336198a3ef0c669624434fc5e817057bfa68167..b5b12e2ef279db13aa68798f41cd9434460300c0 100644 (file)
@@ -42,7 +42,9 @@ 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_OPEN    = "sound/menu/open.wav";
 const string MENU_SOUND_SELECT  = "sound/menu/select.wav";
 const string MENU_SOUND_SLIDE   = "sound/menu/slide.wav";
 
index 0497fa08d458f41704f089b9ddfd951fdcc7844f..54166f6e045cc5e5c1e0ed06e5424313cacab5f3 100644 (file)
@@ -153,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));
                }
@@ -299,6 +300,7 @@ 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));
        }
index 641efbf2247f45fb5594f8424ad9bf91bb83aafa..3d848c9c59d78df666d39f87776c7a179363e7bb 100644 (file)
@@ -1247,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;