| 64 | //========================================================================== |
| 65 | |
| 66 | static std::vector<std::string> ParseGameInfo(std::vector<std::string>& pwads, const char* fn, const char* data, int size) |
| 67 | { |
| 68 | FScanner sc; |
| 69 | std::vector<std::string> bases; |
| 70 | int pos = 0; |
| 71 | |
| 72 | const char* lastSlash = strrchr(fn, '/'); |
| 73 | |
| 74 | sc.OpenMem("GAMEINFO", data, size); |
| 75 | sc.SetCMode(true); |
| 76 | while (sc.GetToken()) |
| 77 | { |
| 78 | sc.TokenMustBe(TK_Identifier); |
| 79 | FString nextKey = sc.String; |
| 80 | sc.MustGetToken('='); |
| 81 | if (!nextKey.CompareNoCase("GAME")) |
| 82 | { |
| 83 | sc.MustGetString(); |
| 84 | bases.push_back(sc.String); |
| 85 | } |
| 86 | else if (!nextKey.CompareNoCase("LOAD")) |
| 87 | { |
| 88 | do |
| 89 | { |
| 90 | sc.MustGetString(); |
| 91 | |
| 92 | // Try looking for the wad in the same directory as the .wad |
| 93 | // before looking for it in the current directory. |
| 94 | |
| 95 | FString checkpath; |
| 96 | if (lastSlash != NULL) |
| 97 | { |
| 98 | checkpath = FString(fn, (lastSlash - fn) + 1); |
| 99 | checkpath += sc.String; |
| 100 | } |
| 101 | else |
| 102 | { |
| 103 | checkpath = sc.String; |
| 104 | } |
| 105 | if (!FileExists(checkpath)) |
| 106 | { |
| 107 | pos += D_AddFile(pwads, sc.String, true, pos, GameConfig); |
| 108 | } |
| 109 | else |
| 110 | { |
| 111 | pos += D_AddFile(pwads, checkpath.GetChars(), true, pos, GameConfig); |
| 112 | } |
| 113 | } while (sc.CheckToken(',')); |
| 114 | } |
| 115 | else if (!nextKey.CompareNoCase("STARTUPTITLE")) |
| 116 | { |
| 117 | sc.MustGetString(); |
| 118 | GameStartupInfo.Name = sc.String; |
| 119 | } |
| 120 | else if (!nextKey.CompareNoCase("STARTUPCOLORS")) |
| 121 | { |
| 122 | sc.MustGetString(); |
| 123 | GameStartupInfo.FgColor = V_GetColor(sc); |
no test coverage detected