Basic Double gamedir support
Posted: Sat Jan 29, 2011 12:33 am
This example is done by modifying FitzQuake but doing so is virtually identical in GLQuake/WinQuake (if it isn't exactly identical --- I didn't check)
Open common.c and find this:
And add this immediately after:
Commentary on the functionality:
Open common.c and find this:
Code: Select all
i = COM_CheckParm ("-game");
if (i && i < com_argc-1)
{
com_modified = true;
COM_AddGameDirectory (va("%s/%s", basedir, com_argv[i+1]));
}
Code: Select all
// Baker: begin "game2" modification
i = COM_CheckParm ("-game2");
if (i && i < com_argc-1)
{
com_modified = true;
COM_AddGameDirectory (va("%s/%s", basedir, com_argv[i+1]));
}
// Baker: end "game2" modification
If you modify, say, FitzQuake using the above, start the engine with this command as an example:
// Note: you need to have maps or models or such in both gamedirs for this to be interesting
c:\quake\fitzquake085.exe -game mymod -game2 mymod2
Now here is how multiple gamedir works.
Folder priority is this:
Content chain of priority: game2 > game > id1
Quake's file system will first search for data in -game2 (mymod2 folder) and then fall back to -game (mymod folder) and then to id1 folder.
It will not run multiple progs.dat at the same time like some newcomers would hope. Like "-game ctf -game2 slide" would not suddenly give you Capture The Flag with hoverboards (it would run the progs.dat in -game2, in this case "Slide" and you'd be playing the Slide mod with the CTF folder models and maps available where not superceded by anything with the same filename in the Slide folder).
Anyway, as far as file priority goes -game2 has priority over -game.
So the progs.dat in -game2 would be used over a progs.dat in -game, which in turn has priority over a progs.dat in id1.
One thing this can be used for is doing an additive mod where you are extending some other mod while keeping the content separate. The Quoth mod uses this philosophy where a mapper can make their own stuff and put in "my_mapmod_folder" while falling back to the extended Quoth content.