MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / OnSourceModLevelChange

Method OnSourceModLevelChange

core/MenuStyle_Radio.cpp:82–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void CRadioStyle::OnSourceModLevelChange(const char *mapName)
83{
84 if (g_bRadioInit)
85 {
86 return;
87 }
88
89 g_bRadioInit = true;
90
91 // Always register the style. Use IsSupported() to check for validity before use.
92 g_Menus.AddStyle(this);
93
94 const char *msg = g_pGameConf->GetKeyValue("HudRadioMenuMsg");
95 if (!msg || msg[0] == '\0')
96 {
97 return;
98 }
99
100 g_ShowMenuId = g_UserMsgs.GetMessageIndex(msg);
101
102 if (!IsSupported())
103 {
104 return;
105 }
106
107 const char *val = g_pGameConf->GetKeyValue("RadioMenuTimeout");
108 if (val != NULL)
109 {
110 g_RadioMenuTimeout = atoi(val);
111 }
112 else
113 {
114 g_RadioMenuTimeout = 0;
115 }
116
117 const char *items = g_pGameConf->GetKeyValue("RadioMenuMaxPageItems");
118 if (items != NULL)
119 {
120 int value = atoi(items);
121
122 // Only override the mostly-safe default if it's a sane value
123 if (value > MAX_PAGINATION_OPTIONS && value <= MAX_MENUSLOT_KEYS)
124 {
125 s_RadioMaxPageItems = value;
126 }
127 }
128
129 const char *closes = g_pGameConf->GetKeyValue("RadioMenuClosesOnInvalidSlot");
130 if (closes != nullptr && strcmp(closes, "yes") == 0)
131 {
132 s_RadioClosesOnInvalidSlot = true;
133 }
134
135 g_Menus.SetDefaultStyle(this);
136
137 g_UserMsgs.HookUserMessage(g_ShowMenuId, this, false);
138}
139

Callers

nothing calls this directly

Calls 5

AddStyleMethod · 0.80
GetMessageIndexMethod · 0.80
SetDefaultStyleMethod · 0.80
HookUserMessageMethod · 0.80
GetKeyValueMethod · 0.45

Tested by

no test coverage detected