| 1 | /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ |
| 2 | /* If you are missing that file, acquire a complete release at teeworlds.com. */ |
| 3 | #include "menus.h" |
| 4 | |
| 5 | #include <engine/shared/config.h> |
| 6 | #include <engine/sound.h> |
| 7 | |
| 8 | #include <game/localization.h> |
| 9 | |
| 10 | void CMenus::(CUIRect MainView) |
| 11 | { |
| 12 | CUIRect Button; |
| 13 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 14 | if(DoButton_CheckBox(pId: &g_Config.m_SndEnable, pText: Localize(pStr: "Use sounds" ), Checked: g_Config.m_SndEnable, pRect: &Button)) |
| 15 | { |
| 16 | g_Config.m_SndEnable ^= 1; |
| 17 | UpdateMusicState(); |
| 18 | } |
| 19 | |
| 20 | m_NeedRestartSound = g_Config.m_SndEnable && !Sound()->IsSoundEnabled(); |
| 21 | |
| 22 | if(!g_Config.m_SndEnable) |
| 23 | return; |
| 24 | |
| 25 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 26 | if(DoButton_CheckBox(pId: &g_Config.m_SndMusic, pText: Localize(pStr: "Play background music" ), Checked: g_Config.m_SndMusic, pRect: &Button)) |
| 27 | { |
| 28 | g_Config.m_SndMusic ^= 1; |
| 29 | UpdateMusicState(); |
| 30 | } |
| 31 | |
| 32 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 33 | if(DoButton_CheckBox(pId: &g_Config.m_SndNonactiveMute, pText: Localize(pStr: "Mute when not active" ), Checked: g_Config.m_SndNonactiveMute, pRect: &Button)) |
| 34 | g_Config.m_SndNonactiveMute ^= 1; |
| 35 | |
| 36 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 37 | if(DoButton_CheckBox(pId: &g_Config.m_SndGame, pText: Localize(pStr: "Enable game sounds" ), Checked: g_Config.m_SndGame, pRect: &Button)) |
| 38 | g_Config.m_SndGame ^= 1; |
| 39 | |
| 40 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 41 | if(DoButton_CheckBox(pId: &g_Config.m_SndGun, pText: Localize(pStr: "Enable gun sound" ), Checked: g_Config.m_SndGun, pRect: &Button)) |
| 42 | g_Config.m_SndGun ^= 1; |
| 43 | |
| 44 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 45 | if(DoButton_CheckBox(pId: &g_Config.m_SndLongPain, pText: Localize(pStr: "Enable long pain sound (used when shooting in freeze)" ), Checked: g_Config.m_SndLongPain, pRect: &Button)) |
| 46 | g_Config.m_SndLongPain ^= 1; |
| 47 | |
| 48 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 49 | if(DoButton_CheckBox(pId: &g_Config.m_SndServerMessage, pText: Localize(pStr: "Enable server message sound" ), Checked: g_Config.m_SndServerMessage, pRect: &Button)) |
| 50 | g_Config.m_SndServerMessage ^= 1; |
| 51 | |
| 52 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 53 | if(DoButton_CheckBox(pId: &g_Config.m_SndChat, pText: Localize(pStr: "Enable regular chat sound" ), Checked: g_Config.m_SndChat, pRect: &Button)) |
| 54 | g_Config.m_SndChat ^= 1; |
| 55 | |
| 56 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 57 | if(DoButton_CheckBox(pId: &g_Config.m_SndTeamChat, pText: Localize(pStr: "Enable team chat sound" ), Checked: g_Config.m_SndTeamChat, pRect: &Button)) |
| 58 | g_Config.m_SndTeamChat ^= 1; |
| 59 | |
| 60 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 61 | if(DoButton_CheckBox(pId: &g_Config.m_SndHighlight, pText: Localize(pStr: "Enable highlighted chat sound" ), Checked: g_Config.m_SndHighlight, pRect: &Button)) |
| 62 | g_Config.m_SndHighlight ^= 1; |
| 63 | |
| 64 | // volume slider |
| 65 | { |
| 66 | MainView.HSplitTop(Cut: 5.0f, pTop: nullptr, pBottom: &MainView); |
| 67 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 68 | Ui()->DoScrollbarOption(pId: &g_Config.m_SndVolume, pOption: &g_Config.m_SndVolume, pRect: &Button, pStr: Localize(pStr: "Sound volume" ), Min: 0, Max: 100, pScale: &CUi::ms_LogarithmicScrollbarScale, Flags: 0u, pSuffix: "%" ); |
| 69 | } |
| 70 | |
| 71 | // volume slider game sounds |
| 72 | { |
| 73 | MainView.HSplitTop(Cut: 5.0f, pTop: nullptr, pBottom: &MainView); |
| 74 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 75 | Ui()->DoScrollbarOption(pId: &g_Config.m_SndGameVolume, pOption: &g_Config.m_SndGameVolume, pRect: &Button, pStr: Localize(pStr: "Game sound volume" ), Min: 0, Max: 100, pScale: &CUi::ms_LogarithmicScrollbarScale, Flags: 0u, pSuffix: "%" ); |
| 76 | } |
| 77 | |
| 78 | // volume slider gui sounds |
| 79 | { |
| 80 | MainView.HSplitTop(Cut: 5.0f, pTop: nullptr, pBottom: &MainView); |
| 81 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 82 | Ui()->DoScrollbarOption(pId: &g_Config.m_SndChatVolume, pOption: &g_Config.m_SndChatVolume, pRect: &Button, pStr: Localize(pStr: "Chat sound volume" ), Min: 0, Max: 100, pScale: &CUi::ms_LogarithmicScrollbarScale, Flags: 0u, pSuffix: "%" ); |
| 83 | } |
| 84 | |
| 85 | // volume slider map sounds |
| 86 | { |
| 87 | MainView.HSplitTop(Cut: 5.0f, pTop: nullptr, pBottom: &MainView); |
| 88 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 89 | Ui()->DoScrollbarOption(pId: &g_Config.m_SndMapVolume, pOption: &g_Config.m_SndMapVolume, pRect: &Button, pStr: Localize(pStr: "Map sound volume" ), Min: 0, Max: 100, pScale: &CUi::ms_LogarithmicScrollbarScale, Flags: 0u, pSuffix: "%" ); |
| 90 | } |
| 91 | |
| 92 | // volume slider background music |
| 93 | { |
| 94 | MainView.HSplitTop(Cut: 5.0f, pTop: nullptr, pBottom: &MainView); |
| 95 | MainView.HSplitTop(Cut: 20.0f, pTop: &Button, pBottom: &MainView); |
| 96 | Ui()->DoScrollbarOption(pId: &g_Config.m_SndBackgroundMusicVolume, pOption: &g_Config.m_SndBackgroundMusicVolume, pRect: &Button, pStr: Localize(pStr: "Background music volume" ), Min: 0, Max: 100, pScale: &CUi::ms_LogarithmicScrollbarScale, Flags: 0u, pSuffix: "%" ); |
| 97 | } |
| 98 | } |
| 99 | |