MCPcopy Create free account
hub / github.com/assaultcube/AC / menuselect

Function menuselect

source/src/menus.cpp:100–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void menuselect(void *menu, int sel)
101{
102 gmenu &m = *(gmenu *)menu;
103 sel = normalizemenuselection(sel, m.items.length());
104 if(m.items.inrange(sel))
105 {
106 int oldsel = m.menusel;
107 m.menusel = sel;
108 if(m.allowinput)
109 {
110 if(sel!=oldsel)
111 {
112 if(m.items.inrange(oldsel)) m.items[oldsel]->focus(false);
113 if(!m.items[sel]->greyedout) m.items[sel]->focus(true);
114 audiomgr.playsound(S_MENUSELECT, SP_HIGHEST);
115 if(m.persistentselection)
116 {
117 defformatstring(val)("%d", sel);
118 alias(persistentmenuselectionalias(m.name), val);
119 }
120 }
121 }
122 }
123}
124
125void drawarrow(int dir, int x, int y, int size, float r = 1.0f, float g = 1.0f, float b = 1.0f)
126{

Callers 3

menuselectionpersistentFunction · 0.85
menuselectionFunction · 0.85
menukeyFunction · 0.85

Calls 7

normalizemenuselectionFunction · 0.85
aliasFunction · 0.85
inrangeMethod · 0.80
playsoundMethod · 0.80
lengthMethod · 0.45
focusMethod · 0.45

Tested by

no test coverage detected