Implement folder loading
This is the folder loading branch from @LZA's repository (https://github.com/Lactozilla/SRB2/tree/folder)
with a minor QoL improvement to the -file
and -folder
CLI arguments.
With this branch, you can load an add-on from a PK3-structured folder, making development easier for modders, as instead of having to import and export resources to and from SLADE, they can instead manipulate them as files using any external software they like.
When ready for a public release, the folder can be turned into a PK3 by simply zipping it and renaming the extension from .zip to .pk3, making it easy to distribute.
There are currently two ways to load folders:
- by passing the
-folder <folder path>
argument from the command-line, - by using the
addfolder <folder path>
console command. In both cases, the path should be either absolute, or relative to SRB2's folder.
Due to a number of quirks in the PK3 (and more generally ZIP) format, there are a few things to be aware of when converting your add-on to a folder, including:
- If your add-on contains maps, make sure they are stored as WAD files;
you must not have the
MAPXX
,SECTORS
,LINEDEFS
, etc lumps contained directly inside yourMaps/
folder. - If your add-on contains sprites, make sure each sprite definition is contained in its own folder,
so for instance
POSSA3A7
andPOSSA1
should be in the same folder, butSPOSA3A7
in a different one. - Be careful not to have multiple lumps with the same name, even with different cases,
as there can't be multiple files with the same name in a real folder.
This will typically happen if you have a
TEXTURES
lump at the root, since there is already a folder namedTextures/
there. To solve this specific case, you can add an arbitrary extension, such asTEXTURES.gfz
orTEXTURES.thz
. This is especially important to keep in mind if you are using a OS other than Windows, as it would be case-sensitive and thus may appear to work locally, but break for other users. - Character sprites will probably not work because they rely on ordered markers.
- More generally, if you have anything that relies on markers or file ordering, you should change that; markers are only really necessary in WAD archives.
Do note that this feature is only intended for add-on development, not for distribution. As such, the in-game downloader does not support transferring add-ons.
Additionally, the limit of 65535 lumps in WADs and PK3s also applies to folder add-ons.