Page 1 of 1

$include for SNDINFO

Posted: Wed Jan 02, 2019 12:19 am
by Marrub
I would submit a PR for this but unfortunately I don't have a proper development environment right now, my suggestion is to add an $include directive to SNDINFO so that files can be included from it, for instance:

Code: Select all

$include "my/cool_file.txt"
My mod currently has 17 SNDINFO files for organization purposes, but they're all stuffed in the root directory with different extensions, which is rather awful. It's made worse since "SNDINFO" is 7 characters, so you can only have one extension, i.e. "sndinfo.1_thing" instead of "sndinfo.1_thing.txt".

EDIT: Seems all that would need to be added is a recursion in S_AddSNDINFO and a new SI_ enum.
EDIT EDIT: Actually, here's a diff, but I can't test it:

Code: Select all

@@ -133,10 +133,11 @@ enum SICommands
 	SI_Rolloff,
 	SI_Volume,
 	SI_MusicAlias,
 	SI_EDFOverride,
 	SI_Attenuation,
+	SI_Include,
 };
 
 // Blood was a cool game. If Monolith ever releases the source for it,
 // you can bet I'll port it.
 
@@ -230,10 +231,11 @@ static const char *SICommandStrings[] =
 	"$rolloff",
 	"$volume",
 	"$musicalias",
 	"$edfoverride",
 	"$attenuation",
+	"$include",
 	NULL
 };
 
 static TArray<FRandomSoundList> S_rnd;
 static FMusicVolume *MusicVolumes;
@@ -1482,10 +1484,17 @@ static void S_AddSNDINFO (int lump)
 			case SI_IfStrife:
 			case SI_IfHeretic:
 			case SI_IfHexen:
 				skipToEndIf = !CheckGame(sc.String+3, true);
 				break;
+			case SI_Include:
+				sc.MustGetString();
+				if (Wads.CheckNumForName (sc.String))
+				{
+					S_AddSNDINFO (lump);
+				}
+				break;
 			}
 		}
 		else
 		{ // Got a logical sound mapping
 			FString name (sc.String);