mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
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:
parent
d57234e668
commit
35b3cea5a6
1 changed files with 39 additions and 19 deletions
|
@ -235,21 +235,38 @@ int32_t Anim_Play(const char *fn)
|
||||||
uint16_t framenum = 0;
|
uint16_t framenum = 0;
|
||||||
while (getrendermode() >= REND_POLYMOST) // if, really
|
while (getrendermode() >= REND_POLYMOST) // if, really
|
||||||
{
|
{
|
||||||
char vpxfn[BMAX_PATH];
|
char *dot = Bstrrchr(fn, '.');
|
||||||
Bstrncpyz(vpxfn, fn, BMAX_PATH);
|
if (!dot)
|
||||||
|
|
||||||
char *dot = Bstrrchr(vpxfn, '.');
|
|
||||||
if (!dot || (dot - vpxfn) + 4 >= BMAX_PATH)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
dot[1] = 'i';
|
int32_t handle = -1;
|
||||||
dot[2] = 'v';
|
if (!Bstrcmp(dot, ".ivf"))
|
||||||
dot[3] = 'f';
|
{
|
||||||
dot[4] = 0;
|
handle = kopen4loadfrommod(fn, 0);
|
||||||
|
if (handle == -1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char vpxfn[BMAX_PATH];
|
||||||
|
Bstrncpyz(vpxfn, fn, BMAX_PATH);
|
||||||
|
|
||||||
int32_t handle = kopen4loadfrommod(vpxfn, 0);
|
ptrdiff_t dotpos = dot - fn;
|
||||||
if (handle == -1)
|
if (dotpos + 4 >= BMAX_PATH)
|
||||||
break;
|
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;
|
animvpx_ivf_header_t info;
|
||||||
i = animvpx_read_ivf_header(handle, &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...
|
// after rendering the frame but before displaying: maybe play sound...
|
||||||
framenum++;
|
framenum++;
|
||||||
while (soundidx < anim->numsounds && anim->sounds[soundidx].frame == framenum)
|
if (anim)
|
||||||
{
|
{
|
||||||
int16_t sound = anim->sounds[soundidx].sound;
|
while (soundidx < anim->numsounds && anim->sounds[soundidx].frame == framenum)
|
||||||
if (sound == -1)
|
{
|
||||||
FX_StopAllSounds();
|
int16_t sound = anim->sounds[soundidx].sound;
|
||||||
else
|
if (sound == -1)
|
||||||
S_PlaySound(sound);
|
FX_StopAllSounds();
|
||||||
|
else
|
||||||
|
S_PlaySound(sound);
|
||||||
|
|
||||||
soundidx++;
|
soundidx++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this and showframe() instead of nextpage() are so that
|
// this and showframe() instead of nextpage() are so that
|
||||||
|
|
Loading…
Reference in a new issue