MCPcopy Create free account
hub / github.com/demoth/jake2 / AddGameDirectory

Method AddGameDirectory

qcommon/src/main/java/jake2/qcommon/filesystem/FS.java:515–547  ·  view source on GitHub ↗

Sets fs_gamedir, adds the directory to the head of the path, then loads and adds pak2.pak, pak1.pak, pak0.pak ... @param isGame true for mod directories, false for baseq2

(String dir, boolean isGame)

Source from the content-addressed store, hash-verified

513 * @param isGame true for mod directories, false for baseq2
514 */
515 private static void AddGameDirectory(String dir, boolean isGame) {
516 if (!isGame)
517 searchPaths.add(new SearchPath(dir, null, false));
518
519 fs_gamedir = dir;
520 // add the directory to the search path
521 // ensure fs_userdir is first in searchpath
522
523 // todo add custom packs (like cool_models.pk3) before pak0.pak
524
525 //
526 // add any pak files in the format pak0.pak pak1.pak, ...
527 //
528 int maxPacks = 9;
529 for (int i = maxPacks; i >= 0; i--) {
530 int pakIndex = isGame ? maxPacks - i : i;
531 String pakfile = dir + "/pak" + pakIndex + ".pak";
532 if (!(new File(pakfile).canRead()))
533 continue;
534
535 pack_t pak = LoadPackFile(pakfile);
536 if (pak == null)
537 continue;
538
539 if (isGame)
540 searchPaths.push(new SearchPath(dir, pak, true));
541 else
542 searchPaths.add(new SearchPath(dir, pak, false));
543 }
544
545 if (isGame)
546 searchPaths.push(new SearchPath(dir, null, true));
547 }
548
549 /**
550 * Called to find where to write a file (demos, savegames, etc)

Callers 4

setWriteDirMethod · 0.95
SetGamedirMethod · 0.95
InitFilesystemMethod · 0.95
setCDDirMethod · 0.95

Calls 2

LoadPackFileMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected