If an ANM is upgraded to an IVF, use the sounds defined for the .ivf if any have been.

git-svn-id: https://svn.eduke32.com/eduke32@6286 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-06-25 11:24:39 +00:00
parent d57234e668
commit 35b3cea5a6

View file

@ -235,21 +235,38 @@ int32_t Anim_Play(const char *fn)
uint16_t framenum = 0;
while (getrendermode() >= REND_POLYMOST) // if, really
{
char vpxfn[BMAX_PATH];
Bstrncpyz(vpxfn, fn, BMAX_PATH);
char *dot = Bstrrchr(vpxfn, '.');
if (!dot || (dot - vpxfn) + 4 >= BMAX_PATH)
char *dot = Bstrrchr(fn, '.');
if (!dot)
break;
dot[1] = 'i';
dot[2] = 'v';
dot[3] = 'f';
dot[4] = 0;
int32_t handle = -1;
if (!Bstrcmp(dot, ".ivf"))
{
handle = kopen4loadfrommod(fn, 0);
if (handle == -1)
break;
}
else
{
char vpxfn[BMAX_PATH];
Bstrncpyz(vpxfn, fn, BMAX_PATH);
int32_t handle = kopen4loadfrommod(vpxfn, 0);
if (handle == -1)
break;
ptrdiff_t dotpos = dot - fn;
if (dotpos + 4 >= BMAX_PATH)
break;
char *vpxfndot = vpxfn + dotpos;
vpxfndot[1] = 'i';
vpxfndot[2] = 'v';
vpxfndot[3] = 'f';
vpxfndot[4] = '\0';
handle = kopen4loadfrommod(vpxfn, 0);
if (handle == -1)
break;
anim = Anim_Find(vpxfn);
}
animvpx_ivf_header_t info;
i = animvpx_read_ivf_header(handle, &info);
@ -302,15 +319,18 @@ int32_t Anim_Play(const char *fn)
// after rendering the frame but before displaying: maybe play sound...
framenum++;
while (soundidx < anim->numsounds && anim->sounds[soundidx].frame == framenum)
if (anim)
{
int16_t sound = anim->sounds[soundidx].sound;
if (sound == -1)
FX_StopAllSounds();
else
S_PlaySound(sound);
while (soundidx < anim->numsounds && anim->sounds[soundidx].frame == framenum)
{
int16_t sound = anim->sounds[soundidx].sound;
if (sound == -1)
FX_StopAllSounds();
else
S_PlaySound(sound);
soundidx++;
soundidx++;
}
}
// this and showframe() instead of nextpage() are so that