| 99 | //--------------------------------------------------------------------------- |
| 100 | |
| 101 | static void LoadDefinitions(TilesetBuildInfo& info) |
| 102 | { |
| 103 | for (unsigned i = 0; i < info.tile.Size(); i++) |
| 104 | { |
| 105 | if (info.tile[i].extinfo.tiletovox > info.nextvoxid) info.nextvoxid = info.tile[i].extinfo.tiletovox; |
| 106 | } |
| 107 | info.nextvoxid++; |
| 108 | const char* defsfile = G_DefFile(); |
| 109 | FString razedefsfile = defsfile; |
| 110 | razedefsfile.Substitute(".def", "-raze.def"); |
| 111 | |
| 112 | loaddefinitionsfile(info, "engine/engine.def", true, true); // Internal stuff that is required. |
| 113 | |
| 114 | // check what we have. |
| 115 | // user .defs override the default ones and are not cumulative. |
| 116 | // if we fine even one Raze-specific file, all of those will be loaded cumulatively. |
| 117 | // otherwise the default rules inherited from older ports apply. |
| 118 | if (userConfig.UserDef.IsNotEmpty()) |
| 119 | { |
| 120 | loaddefinitionsfile(info, userConfig.UserDef.GetChars(), false); |
| 121 | } |
| 122 | else |
| 123 | { |
| 124 | if (fileSystem.FileExists(razedefsfile.GetChars())) |
| 125 | { |
| 126 | loaddefinitionsfile(info, razedefsfile.GetChars(), true); |
| 127 | } |
| 128 | else if (fileSystem.FileExists(defsfile)) |
| 129 | { |
| 130 | loaddefinitionsfile(info, defsfile, false); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | if (userConfig.AddDefs) |
| 135 | { |
| 136 | for (auto& m : *userConfig.AddDefs) |
| 137 | { |
| 138 | loaddefinitionsfile(info, m.GetChars(), false); |
| 139 | } |
| 140 | userConfig.AddDefs.reset(); |
| 141 | } |
| 142 | |
| 143 | if (GameStartupInfo.def.IsNotEmpty()) |
| 144 | { |
| 145 | loaddefinitionsfile(info, GameStartupInfo.def.GetChars()); // Stuff from gameinfo. |
| 146 | } |
| 147 | |
| 148 | // load the widescreen replacements last. This ensures that mods still get the correct CRCs for their own tile replacements. |
| 149 | if (fileSystem.FindFile("engine/widescreen.def") >= 0 && !Args->CheckParm("-nowidescreen")) |
| 150 | { |
| 151 | loaddefinitionsfile(info, "engine/widescreen.def"); |
| 152 | } |
| 153 | fileSystem.InitHashChains(); // make sure that any resources that got added can be found again. |
| 154 | } |
| 155 | |
| 156 | //========================================================================== |
| 157 | // |
no test coverage detected