if (q3compat)
{
- // CPMA adds these fields for overriding the engine sounds
+ // CPMA adds these fields for overriding the Q3 default sounds
string s = GetField_fullspawndata(this, "sound_start", true);
string e = GetField_fullspawndata(this, "sound_end", true);
if (s)
this.noise2 = strzone(s);
+ else
+ {
+ // PK3s supporting Q3A sometimes include custom sounds at Q3 default paths
+ s = "sound/movers/doors/dr1_strt.wav";
+ if (FindFileInMapPack(s))
+ this.noise2 = s;
+ }
+
if (e)
this.noise1 = strzone(e);
+ else
+ {
+ e = "sound/movers/doors/dr1_end.wav";
+ if (FindFileInMapPack(e))
+ this.noise1 = e;
+ }
}
// sound when door stops moving
if (q3compat)
{
- // CPMA adds these fields for overriding the engine sounds
+ // CPMA adds these fields for overriding the Q3 default sounds
string s = GetField_fullspawndata(this, "sound_start", true);
string e = GetField_fullspawndata(this, "sound_end", true);
if (s)
this.noise = strzone(s);
+ else
+ {
+ // PK3s supporting Q3A sometimes include custom sounds at Q3 default paths
+ s = "sound/movers/plats/pt1_strt.wav";
+ if (FindFileInMapPack(s))
+ this.noise = s;
+ }
+
if (e)
this.noise1 = strzone(e);
+ else
+ {
+ e = "sound/movers/plats/pt1_end.wav";
+ if (FindFileInMapPack(e))
+ this.noise1 = e;
+ }
}
if(this.noise && this.noise != "")
return v;
}
+/*
+=============
+FindFileInMapPack
+
+Returns the first matching VFS file path that exists in the current map's pack.
+Returns string_null if no files match or the map isn't packaged.
+=============
+*/
+string FindFileInMapPack(string pattern)
+{
+ if (!checkextension("DP_QC_FS_SEARCH_PACKFILE"))
+ return string_null;
+
+ string base_pack = whichpack(strcat("maps/", mapname, ".bsp"));
+ if (base_pack == "" || !base_pack) // this map isn't packaged or there was an error
+ return string_null;
+
+ int glob = search_packfile_begin(pattern, true, true, base_pack);
+ if (glob < 0)
+ return string_null;
+
+ string file = search_getfilename(glob, 0);
+ search_end(glob);
+ return file;
+}
+
void WarpZone_PostInitialize_Callback()
{
// create waypoint links for warpzones