diff options
| author | oy <Tom_Adams@web.de> | 2010-09-12 17:15:09 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-09-12 17:15:09 +0200 |
| commit | c52ee7baa9b4bf5845b2eeff63b4f6b713341c86 (patch) | |
| tree | 6bb7f41b05f9566bc29b6874d5b6a17baf641799 /src/game/client | |
| parent | 901427809fe6aeee7b3b820f5447f59955269ff9 (diff) | |
| download | zcatch-c52ee7baa9b4bf5845b2eeff63b4f6b713341c86.tar.gz zcatch-c52ee7baa9b4bf5845b2eeff63b4f6b713341c86.zip | |
unbind a key with right mouse button in the controls menu. Closes #67
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/components/menus.cpp | 30 | ||||
| -rw-r--r-- | src/game/client/components/menus_settings.cpp | 6 |
2 files changed, 28 insertions, 8 deletions
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 2341ba5e..4a53d29b 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -449,10 +449,11 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key) // process static void *pGrabbedID = 0; static bool MouseReleased = true; + static int ButtonUsed = 0; int Inside = UI()->MouseInside(pRect); int NewKey = Key; - if(!UI()->MouseButton(0) && pGrabbedID == pID) + if(!UI()->MouseButton(0) && !UI()->MouseButton(1) && pGrabbedID == pID) MouseReleased = true; if(UI()->ActiveItem() == pID) @@ -467,14 +468,31 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key) MouseReleased = false; pGrabbedID = pID; } + + if(ButtonUsed == 1 && !UI()->MouseButton(1)) + { + if(Inside) + NewKey = 0; + UI()->SetActiveItem(0); + } } else if(UI()->HotItem() == pID) { - if(UI()->MouseButton(0) && MouseReleased) + if(MouseReleased) { - m_Binder.m_TakeKey = true; - m_Binder.m_GotKey = false; - UI()->SetActiveItem(pID); + if(UI()->MouseButton(0)) + { + m_Binder.m_TakeKey = true; + m_Binder.m_GotKey = false; + UI()->SetActiveItem(pID); + ButtonUsed = 0; + } + + if(UI()->MouseButton(1)) + { + UI()->SetActiveItem(pID); + ButtonUsed = 1; + } } } @@ -482,7 +500,7 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key) UI()->SetHotItem(pID); // draw - if (UI()->ActiveItem() == pID) + if (UI()->ActiveItem() == pID && ButtonUsed == 0) DoButton_KeySelect(pID, "???", 0, pRect); else { diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index c7ecbf2f..b4c82c63 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -337,8 +337,10 @@ void CMenus::UiDoGetButtons(int Start, int Stop, CUIRect View) int NewId = DoKeyReader((void *)&gs_aKeys[i].m_Name, &Button, OldId); if(NewId != OldId) { - m_pClient->m_pBinds->Bind(OldId, ""); - m_pClient->m_pBinds->Bind(NewId, gs_aKeys[i].m_pCommand); + if(OldId != 0 || NewId == 0) + m_pClient->m_pBinds->Bind(OldId, ""); + if(NewId != 0) + m_pClient->m_pBinds->Bind(NewId, gs_aKeys[i].m_pCommand); } View.HSplitTop(5.0f, 0, &View); } |