static void SetBinds (const FBinding *array) { while (array->Key) { C_DoBind (array->Key, array->Bind, false); array++; } }
void FGameConfigFile::DoGameSetup (const char *gamename) { const char *key; const char *value; enum { Doom, Heretic, Hexen, Strife, Chex } game; if (strcmp (gamename, "Heretic") == 0) game = Heretic; else if (strcmp (gamename, "Hexen") == 0) game = Hexen; else if (strcmp (gamename, "Strife") == 0) game = Strife; else if (strcmp (gamename, "Chex") == 0) game = Chex; else game = Doom; if (bMigrating) { MigrateOldConfig (); } sublen = countof(section) - 1 - mysnprintf (section, countof(section), "%s.", gamename); subsection = section + countof(section) - sublen - 1; section[countof(section) - 1] = '\0'; strncpy (subsection, "UnknownConsoleVariables", sublen); if (SetSection (section)) { ReadCVars (0); } strncpy (subsection, "ConsoleVariables", sublen); if (SetSection (section)) { ReadCVars (0); } if (game != Doom && game != Strife && game != Chex) { SetRavenDefaults (game == Hexen); } // The NetServerInfo section will be read when it's determined that // a netgame is being played. strncpy (subsection, "LocalServerInfo", sublen); if (SetSection (section)) { ReadCVars (0); } strncpy (subsection, "Player", sublen); if (SetSection (section)) { ReadCVars (0); } strncpy (subsection, "Bindings", sublen); if (!SetSection (section)) { // Config has no bindings for the given game if (!bMigrating) { C_SetDefaultBindings (); } } else { C_UnbindAll (); while (NextInSection (key, value)) { C_DoBind (key, value, false); } } strncpy (subsection, "DoubleBindings", sublen); if (SetSection (section)) { while (NextInSection (key, value)) { C_DoBind (key, value, true); } } strncpy (subsection, "ConsoleAliases", sublen); if (SetSection (section)) { const char *name = NULL; while (NextInSection (key, value)) { if (stricmp (key, "Name") == 0) { name = value; } else if (stricmp (key, "Command") == 0 && name != NULL) { C_SetAlias (name, value); name = NULL; } } } }