From: Severin Meyer Date: Fri, 23 Jan 2015 20:05:11 +0000 (+0100) Subject: Play sounds when chosing or executing a listbox item changes the menu state X-Git-Tag: xonotic-v0.8.1~147^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dcee5884ca8f7e6cb626276a10916a3096a104c8;p=xonotic%2Fxonotic-data.pk3dir.git Play sounds when chosing or executing a listbox item changes the menu state --- diff --git a/qcsrc/menu/xonotic/gametypelist.c b/qcsrc/menu/xonotic/gametypelist.c index e3df84467..3fd45c329 100644 --- a/qcsrc/menu/xonotic/gametypelist.c +++ b/qcsrc/menu/xonotic/gametypelist.c @@ -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 diff --git a/qcsrc/menu/xonotic/keybinder.c b/qcsrc/menu/xonotic/keybinder.c index 60c44ddaf..272edd905 100644 --- a/qcsrc/menu/xonotic/keybinder.c +++ b/qcsrc/menu/xonotic/keybinder.c @@ -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"); } diff --git a/qcsrc/menu/xonotic/languagelist.c b/qcsrc/menu/xonotic/languagelist.c index 38b8098ae..5697f8231 100644 --- a/qcsrc/menu/xonotic/languagelist.c +++ b/qcsrc/menu/xonotic/languagelist.c @@ -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; } diff --git a/qcsrc/menu/xonotic/maplist.c b/qcsrc/menu/xonotic/maplist.c index e05c7644f..0497fa08d 100644 --- a/qcsrc/menu/xonotic/maplist.c +++ b/qcsrc/menu/xonotic/maplist.c @@ -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) { diff --git a/qcsrc/menu/xonotic/serverlist.c b/qcsrc/menu/xonotic/serverlist.c index fdbe9c3dd..641efbf22 100644 --- a/qcsrc/menu/xonotic/serverlist.c +++ b/qcsrc/menu/xonotic/serverlist.c @@ -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; } diff --git a/qcsrc/menu/xonotic/skinlist.c b/qcsrc/menu/xonotic/skinlist.c index 034fb2584..234f1237e 100644 --- a/qcsrc/menu/xonotic/skinlist.c +++ b/qcsrc/menu/xonotic/skinlist.c @@ -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; }