MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / LoadGameArchives

Function LoadGameArchives

Source/init.cpp:283–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283void LoadGameArchives()
284{
285 auto paths = GetMPQSearchPaths();
286#ifdef UNPACKED_MPQS
287 diabdat_data_path = FindUnpackedMpqData(paths, "diabdat");
288 if (!diabdat_data_path) {
289 spawn_data_path = FindUnpackedMpqData(paths, "spawn");
290 if (spawn_data_path)
291 gbIsSpawn = true;
292 }
293 if (!HeadlessMode) {
294 AssetRef ref = FindAsset("ui_art\\title.clx");
295 if (!ref.ok()) {
296 LogError("{}", SDL_GetError());
297 InsertCDDlg(_("diabdat.mpq or spawn.mpq"));
298 }
299 }
300 hellfire_data_path = FindUnpackedMpqData(paths, "hellfire");
301 if (hellfire_data_path)
302 gbIsHellfire = true;
303 if (forceHellfire && !hellfire_data_path)
304 InsertCDDlg("hellfire");
305
306 const bool hasMonk = FileExists(*hellfire_data_path + "plrgfx/monk/mha/mhaas.clx");
307 const bool hasMusic = FileExists(*hellfire_data_path + "music/dlvlf.wav")
308 || FileExists(*hellfire_data_path + "music/dlvlf.mp3");
309 const bool hasVoice = FileExists(*hellfire_data_path + "sfx/hellfire/cowsut1.wav")
310 || FileExists(*hellfire_data_path + "sfx/hellfire/cowsut1.mp3");
311
312 // Bard and barbarian are not currently supported in unpacked mode
313 // because they use the same paths as rogue and warrior.
314 gbBard = false;
315 gbBarbarian = false;
316
317 if (gbIsHellfire && (!hasMonk || !hasMusic || !hasVoice)) {
318 UiErrorOkDialog(_("Some Hellfire MPQs are missing"), _("Not all Hellfire MPQs were found.\nPlease copy all the hf*.mpq files."));
319 diablo_quit(1);
320 }
321#else // !UNPACKED_MPQS
322 diabdat_mpq = LoadMPQ(paths, "DIABDAT.MPQ");
323 if (!diabdat_mpq) {
324 // DIABDAT.MPQ is uppercase on the original CD and the GOG version.
325 diabdat_mpq = LoadMPQ(paths, "diabdat.mpq");
326 }
327
328 if (!diabdat_mpq) {
329 spawn_mpq = LoadMPQ(paths, "spawn.mpq");
330 if (spawn_mpq)
331 gbIsSpawn = true;
332 }
333 if (!HeadlessMode) {
334 AssetRef ref = FindAsset("ui_art\\title.pcx");
335 if (!ref.ok()) {
336 LogError("{}", SDL_GetError());
337 InsertCDDlg(_("diabdat.mpq or spawn.mpq"));
338 }
339 }
340

Callers 2

RunTimedemoFunction · 0.85
DiabloMainFunction · 0.85

Calls 10

GetMPQSearchPathsFunction · 0.85
FindUnpackedMpqDataFunction · 0.85
FindAssetFunction · 0.85
LogErrorFunction · 0.85
InsertCDDlgFunction · 0.85
UiErrorOkDialogFunction · 0.85
diablo_quitFunction · 0.85
LoadMPQFunction · 0.85
FileExistsFunction · 0.50
okMethod · 0.45

Tested by 1

RunTimedemoFunction · 0.68