X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fsounds%2Fsound.qh;h=a462861f29b8401452b3c1d75becd2a4de24e555;hp=7e9ba263240f759de67320a778bbc9137612edea;hb=f72821fdcebe3ca01181a99727a06198de65ea08;hpb=f1a87492d9fed27a64d0e99c068705aba5509f26 diff --git a/qcsrc/common/sounds/sound.qh b/qcsrc/common/sounds/sound.qh index 7e9ba2632..a462861f2 100644 --- a/qcsrc/common/sounds/sound.qh +++ b/qcsrc/common/sounds/sound.qh @@ -76,7 +76,6 @@ const float VOL_BASEVOICE = 1.0; auto = true; \ __chan = fabs(__chan); \ entity tmp = __e = new(csqc_autochannel); \ - make_pure(tmp); \ tmp.think = SUB_Remove_self; \ tmp.nextthink = time + soundlength(__samp); \ } \ @@ -105,35 +104,28 @@ CLASS(Sound, Object) string _Sound_fixpath(string base) { if (base == "") return string_null; +#ifdef SVQC + return strcat(base, ".wav"); // let the client engine decide +#else #define extensions(x) \ x(wav) \ x(ogg) \ x(flac) \ /**/ - string relative; - #define tryext(ext) { if (fexists(strcat("sound/", relative = strcat(base, "." #ext)))) break; } - do - { - extensions(tryext); -#undef tryext -#undef extensions - LOG_WARNINGF("Missing sound: \"%s\"\n", strcat("sound/", base)); -#ifdef CSQC - return string_null; -#endif - } - while (0); -#ifdef SVQC - return strcat(base, ".wav"); // let the client engine decide -#else - return relative; + #define tryext(ext) { string s = strcat(base, "." #ext); if (fexists(strcat("sound/", s))) return s; } + extensions(tryext); + LOG_WARNINGF("Missing sound: \"%s\"\n", strcat("sound/", base)); + #undef tryext + #undef extensions + return string_null; #endif } - METHOD(Sound, sound_precache, void(entity this)) + METHOD(Sound, sound_precache, void(Sound this)) { + TC(Sound, this); string s = Sound_fixpath(this); if (!s) return; - LOG_TRACEF("precache_sound(\"%s\")\n", s); + LOG_DEBUGF("precache_sound(\"%s\")\n", s); precache_sound(s); } ENDCLASS(Sound)