MCPcopy Create free account
hub / github.com/ZDoom/Raze / DoKeySetup

Method DoKeySetup

source/core/gameconfigfile.cpp:395–426  ·  view source on GitHub ↗

Moved from DoGameSetup so that it can happen after wads are loaded

Source from the content-addressed store, hash-verified

393
394// Moved from DoGameSetup so that it can happen after wads are loaded
395void FGameConfigFile::DoKeySetup(const char *gamename)
396{
397 static const struct { const char *label; FKeyBindings *bindings; } binders[] =
398 {
399 { "Bindings", &Bindings },
400 { "DoubleBindings", &DoubleBindings },
401 { "AutomapBindings", &AutomapBindings },
402 { NULL, NULL }
403 };
404 const char *key, *value;
405
406 sublen = countof(section) - 1 - mysnprintf(section, countof(section), "%s.", gamename);
407 subsection = section + countof(section) - sublen - 1;
408 section[countof(section) - 1] = '\0';
409
410 C_SetDefaultBindings ();
411
412 for (int i = 0; binders[i].label != NULL; ++i)
413 {
414 strncpy(subsection, binders[i].label, sublen);
415 if (SetSection(section))
416 {
417 FKeyBindings *bindings = binders[i].bindings;
418 bindings->UnbindAll();
419 while (NextInSection(key, value))
420 {
421 bindings->DoBind(key, value);
422 }
423 }
424 }
425 OkayToWrite = true;
426}
427
428void FGameConfigFile::ReadNetVars ()
429{

Callers 1

G_ReadConfigFunction · 0.80

Calls 3

C_SetDefaultBindingsFunction · 0.85
DoBindMethod · 0.80
UnbindAllMethod · 0.45

Tested by

no test coverage detected