]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/all.qc
Merge branch 'master' into TimePath/effectinfo
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / all.qc
index 046298a4c4f97c7bd2111a74503b2ac7483d46c6..b972cfdec4adfa1a74a6d7ef24b4c6c7dc6b9498 100644 (file)
@@ -331,7 +331,16 @@ int GetAmmoStat(.int ammotype)
 
 string W_Sound(string w_snd)
 {
-       string output = strcat("weapons/", w_snd, ".wav");
+       #define extensions(X) X(wav) X(ogg)
+       #define tryext(ext) { if (fexists(strcat("sound/", output = strcat("weapons/", w_snd, "."#ext)))) break; }
+       string output;
+       do {
+               extensions(tryext);
+               #undef tryext
+               #undef extensions
+               output = strcat("weapons/", w_snd);
+       } while (0);
+
 #ifdef SVQC
        MUTATOR_CALLHOOK(WeaponSound, w_snd, output);
        return weapon_sound_output;