X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fbgmscript.qc;h=9d024941e6bf00d4b8c7f53133deca7535edbde4;hb=2c6717ccae14cb530ee54a5e617725224bf9867e;hp=43255da5849ebf61752f43fb10b1ae5fd5f36a78;hpb=2a9df1dc726597e8943be9ef956620c36693d219;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/bgmscript.qc b/qcsrc/client/bgmscript.qc index 43255da58..9d024941e 100644 --- a/qcsrc/client/bgmscript.qc +++ b/qcsrc/client/bgmscript.qc @@ -17,10 +17,10 @@ float GetAttackDecaySustainAmplitude(float a, float d, float s, float t) // attack: from 0 to 1, in time a for a full length // decay: from 1 to s, in time d // sustain: s - + if(t < 0) return 0; - + if(a) if(t <= a) return t / a; @@ -38,10 +38,10 @@ float GetReleaseAmplitude(float d, float s, float r, float t) if(!r) return 0; - + if(t > r) return 0; - + releaseval = s * (1 - t / r); if(t < -d) @@ -70,7 +70,7 @@ float GetReleaseTime(float d, float s, float r, float amp) if(!s) return 0; - + // if amp > s, we may be in the attack or in the prolonged decay curve releasetime = (1 - amp / s) * r; @@ -131,8 +131,9 @@ void BGMScript_InitEntity(entity e) e.bgmscriptline = e.bgmscriptline0 = i; if(i >= bgmscriptbufsize) { - print("ERROR: bgmscript does not define ", e.bgmscript, "\n"); - e.bgmscript = ""; + printf("ERROR: bgmscript does not define %s\n", e.bgmscript); + strunzone(e.bgmscript); + e.bgmscript = string_null; } } } @@ -171,7 +172,7 @@ float BGMScript(entity e) if(e.bgmscript == "") return 1; - + if(autocvar_bgmvolume <= 0) return -1; @@ -182,7 +183,6 @@ float BGMScript(entity e) if(bgmtime < e.bgmscripttime) { - //print("reset ", e.bgmscript, "\n"); amp = GetCurrentAmplitude(e, e.bgmscripttime - e.bgmscriptstatetime + drawframetime); e.bgmscriptline = e.bgmscriptline0;