]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Play sounds when chosing or executing a listbox item changes the menu state
authorSeverin Meyer <sev.ch@web.de>
Fri, 23 Jan 2015 20:05:11 +0000 (21:05 +0100)
committerSeverin Meyer <sev.ch@web.de>
Fri, 23 Jan 2015 20:05:11 +0000 (21:05 +0100)
qcsrc/menu/xonotic/gametypelist.c
qcsrc/menu/xonotic/keybinder.c
qcsrc/menu/xonotic/languagelist.c
qcsrc/menu/xonotic/maplist.c
qcsrc/menu/xonotic/serverlist.c
qcsrc/menu/xonotic/skinlist.c

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..0497fa08d458f41704f089b9ddfd951fdcc7844f 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)
@@ -301,17 +304,24 @@ float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift)
        }
        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 fdbe9c3dd7cd976a8f1b07fa1bb3711ce7cbff9a..641efbf2247f45fb5594f8424ad9bf91bb83aafa 100644 (file)
@@ -944,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;
        }
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;
        }