2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2010-05-25 10:56:00 +00:00
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
This file is part of EDuke32.
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "duke3d.h"
|
|
|
|
#include "animlib.h"
|
2006-12-12 04:31:51 +00:00
|
|
|
#include "mouse.h"
|
2008-02-16 22:27:08 +00:00
|
|
|
#include "compat.h"
|
2012-06-03 16:11:22 +00:00
|
|
|
#include "input.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
#include "anim.h"
|
|
|
|
|
2011-07-18 19:06:29 +00:00
|
|
|
#ifdef USE_LIBVPX
|
|
|
|
# include "animvpx.h"
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
|
|
|
|
uint16_t anim_hi_numsounds[NUM_HARDCODED_ANIMS], *anim_hi_sounds[NUM_HARDCODED_ANIMS];
|
2011-07-18 19:06:29 +00:00
|
|
|
#endif
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
static void endanimsounds(int32_t fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (ud.volume_number)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
switch (fr)
|
|
|
|
{
|
|
|
|
case 1:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(WIND_AMBIENCE);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 26:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(ENDSEQVOL2SND1);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 36:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(ENDSEQVOL2SND2);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 54:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(THUD);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 62:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(ENDSEQVOL2SND3);
|
2006-04-13 20:47:06 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
case 75:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(ENDSEQVOL2SND4);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 81:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(ENDSEQVOL2SND5);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 115:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(ENDSEQVOL2SND6);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 124:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(ENDSEQVOL2SND7);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
switch (fr)
|
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
case 1:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(WIND_REPEAT);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 98:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(DUKE_GRUNT);
|
2006-04-13 20:47:06 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
case 82+20:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(THUD);
|
|
|
|
S_PlaySound(SQUISHED);
|
2006-04-13 20:47:06 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
case 104+20:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(ENDSEQVOL3SND3);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 114+20:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(ENDSEQVOL3SND2);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 158:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(PIPEBOMB_EXPLODE);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
static void logoanimsounds(int32_t fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 1:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(FLY_BY);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 19:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(PIPEBOMB_EXPLODE);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
static void intro4animsounds(int32_t fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 1:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(INTRO4_B);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
case 34:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(SHORT_CIRCUIT);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 18:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(INTRO4_5);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
static void first4animsounds(int32_t fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 1:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(INTRO4_1);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 12:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(INTRO4_2);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(INTRO4_3);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 26:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(INTRO4_4);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
static void intro42animsounds(int32_t fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 10:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(INTRO4_6);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
static void endanimvol41(int32_t fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 3:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(DUKE_UNDERWATER);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 35:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(VOL4ENDSND1);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
static void endanimvol42(int32_t fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 11:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(DUKE_UNDERWATER);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 20:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(VOL4ENDSND1);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 39:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(VOL4ENDSND2);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 50:
|
|
|
|
FX_StopAllSounds();
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
static void endanimvol43(int32_t fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (fr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 1:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(BOSS4_DEADSPEECH);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 40:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(VOL4ENDSND1);
|
|
|
|
S_PlaySound(DUKE_UNDERWATER);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 50:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(BIGBANG);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-12 14:02:30 +00:00
|
|
|
int32_t G_PlayAnim(const char *fn, char t)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-03-31 18:57:59 +00:00
|
|
|
uint8_t *animbuf;
|
2010-03-14 11:42:13 +00:00
|
|
|
int32_t i, length=0, numframes=0;
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t ogltexfiltermode=gltexfiltermode;
|
2007-03-04 19:52:57 +00:00
|
|
|
#endif
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t handle=-1;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t frametime = 0;
|
2014-01-12 14:02:30 +00:00
|
|
|
int32_t running = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
// t parameter:
|
|
|
|
//
|
|
|
|
// 1: cineov2
|
|
|
|
// 2: cineov3
|
|
|
|
// 3: RADLOGO
|
|
|
|
// 4: DUKETEAM
|
|
|
|
// 5: logo
|
|
|
|
// 6: vol41a
|
|
|
|
// 7: vol42a
|
|
|
|
// 8: vol4e1
|
|
|
|
// 9: vol43a
|
|
|
|
// 10: vol4e2
|
|
|
|
// 11: vol4e3
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t != 7 && t != 9 && t != 10 && t != 11)
|
2012-06-03 16:11:22 +00:00
|
|
|
I_ClearAllInput();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-06-03 16:11:22 +00:00
|
|
|
if (I_CheckAllInput())
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
FX_StopAllSounds();
|
2014-01-12 14:02:30 +00:00
|
|
|
running = 0;
|
2013-03-31 18:57:59 +00:00
|
|
|
goto end_anim;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2011-07-18 19:06:29 +00:00
|
|
|
#ifdef USE_LIBVPX
|
2012-12-30 20:34:34 +00:00
|
|
|
while (getrendermode() >= REND_POLYMOST && glinfo.glsl) // if, really
|
2011-07-18 19:06:29 +00:00
|
|
|
{
|
|
|
|
char vpxfn[BMAX_PATH], *dot;
|
|
|
|
animvpx_ivf_header_t info;
|
|
|
|
|
|
|
|
animvpx_codec_ctx codec;
|
|
|
|
uint8_t *pic;
|
|
|
|
uint32_t msecsperframe, nextframetime;
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
int32_t animidx, framenum=0, soundidx=0, numtotalsounds=0; // custom anim sounds
|
2011-07-18 19:06:29 +00:00
|
|
|
|
2012-03-28 19:43:21 +00:00
|
|
|
Bstrncpyz(vpxfn, fn, BMAX_PATH);
|
2011-07-18 19:06:29 +00:00
|
|
|
|
|
|
|
dot = Bstrrchr(vpxfn, '.');
|
|
|
|
if (!dot || (dot-vpxfn)+4 >= BMAX_PATH)
|
|
|
|
break;
|
|
|
|
|
|
|
|
dot[1] = 'i';
|
|
|
|
dot[2] = 'v';
|
|
|
|
dot[3] = 'f';
|
|
|
|
dot[4] = 0;
|
|
|
|
|
|
|
|
handle = kopen4loadfrommod(vpxfn, 0);
|
|
|
|
if (handle == -1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
i = animvpx_read_ivf_header(handle, &info);
|
|
|
|
if (i)
|
|
|
|
{
|
|
|
|
OSD_Printf("Failed reading IVF file: %s\n",
|
|
|
|
animvpx_read_ivf_header_errmsg[i]);
|
|
|
|
kclose(handle);
|
2014-01-12 14:02:30 +00:00
|
|
|
return 0;
|
2011-07-18 19:06:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
animvpx_setup_glstate();
|
|
|
|
if (animvpx_init_codec(&info, handle, &codec))
|
|
|
|
{
|
2013-03-31 18:57:59 +00:00
|
|
|
OSD_Printf("Error initializing VPX codec.\n");
|
2011-07-18 19:06:29 +00:00
|
|
|
animvpx_restore_glstate();
|
2014-01-12 14:02:30 +00:00
|
|
|
return 0;
|
2011-07-18 19:06:29 +00:00
|
|
|
}
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
animidx = t-1;
|
|
|
|
if ((unsigned)animidx < NUM_HARDCODED_ANIMS && anim_hi_sounds[animidx])
|
|
|
|
numtotalsounds = anim_hi_numsounds[animidx];
|
|
|
|
|
2011-07-18 19:06:29 +00:00
|
|
|
msecsperframe = ((uint64_t)info.fpsdenom*1000)/info.fpsnumer;
|
|
|
|
// OSD_Printf("msecs per frame: %d\n", msecsperframe);
|
|
|
|
|
|
|
|
nextframetime = getticks();
|
|
|
|
|
|
|
|
while (running)
|
|
|
|
{
|
|
|
|
nextframetime += msecsperframe;
|
|
|
|
|
|
|
|
i = animvpx_nextpic(&codec, &pic);
|
|
|
|
if (i)
|
|
|
|
{
|
|
|
|
OSD_Printf("Failed getting next pic: %s\n",
|
|
|
|
animvpx_nextpic_errmsg[i]);
|
|
|
|
if (codec.errmsg)
|
|
|
|
{
|
|
|
|
OSD_Printf(" %s\n", codec.errmsg);
|
|
|
|
if (codec.errmsg_detail)
|
|
|
|
OSD_Printf(" detail: %s\n", codec.errmsg_detail);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pic)
|
|
|
|
break; // no more pics!
|
|
|
|
|
|
|
|
animvpx_render_frame(&codec);
|
|
|
|
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
// after rendering the frame but before displaying: maybe play sound...
|
|
|
|
framenum++;
|
2012-01-10 23:44:09 +00:00
|
|
|
while (soundidx < numtotalsounds && anim_hi_sounds[animidx][2*soundidx] == framenum)
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
{
|
2012-01-10 23:44:09 +00:00
|
|
|
S_PlaySound(anim_hi_sounds[animidx][2*soundidx+1]);
|
|
|
|
soundidx++;
|
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
|
|
|
}
|
|
|
|
|
2011-07-18 19:06:29 +00:00
|
|
|
// this and showframe() instead of nextpage() are so that
|
|
|
|
// nobody tramples on our carefully set up GL state!
|
|
|
|
palfadedelta = 0;
|
|
|
|
showframe(0);
|
|
|
|
|
2012-07-13 18:20:58 +00:00
|
|
|
// I_ClearAllInput();
|
2012-06-03 16:11:22 +00:00
|
|
|
|
2011-12-21 18:41:03 +00:00
|
|
|
do
|
2011-07-18 19:06:29 +00:00
|
|
|
{
|
2012-09-05 17:25:34 +00:00
|
|
|
G_HandleAsync();
|
2011-07-18 19:06:29 +00:00
|
|
|
|
2012-06-03 16:11:22 +00:00
|
|
|
if (I_CheckAllInput())
|
2011-07-18 19:06:29 +00:00
|
|
|
{
|
|
|
|
running = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-12-21 18:41:03 +00:00
|
|
|
while (getticks() < nextframetime);
|
2011-07-18 19:06:29 +00:00
|
|
|
}
|
|
|
|
|
2012-07-13 18:20:55 +00:00
|
|
|
animvpx_print_stats(&codec);
|
|
|
|
|
2011-07-18 19:06:29 +00:00
|
|
|
//
|
|
|
|
kclose(handle);
|
|
|
|
animvpx_restore_glstate();
|
|
|
|
animvpx_uninit_codec(&codec);
|
|
|
|
|
2012-06-03 16:11:22 +00:00
|
|
|
I_ClearAllInput();
|
2014-01-12 14:02:30 +00:00
|
|
|
return !running; // done with playing VP8!
|
2011-07-18 19:06:29 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// ANM playback --- v v v ---
|
|
|
|
|
2013-03-31 18:57:59 +00:00
|
|
|
handle = kopen4load(fn, 0);
|
|
|
|
if (handle == -1)
|
2014-01-12 14:02:30 +00:00
|
|
|
return 0;
|
2013-03-31 18:57:59 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
length = kfilelength(handle);
|
2013-03-31 18:57:59 +00:00
|
|
|
if (length == 0)
|
|
|
|
{
|
|
|
|
OSD_Printf("Warning: skipping playback of empty ANM file \"%s\".\n", fn);
|
|
|
|
goto end_anim;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
walock[TILE_ANIM] = 219+t;
|
|
|
|
|
2013-03-31 18:57:59 +00:00
|
|
|
allocache((intptr_t *)&animbuf, length+1, &walock[TILE_ANIM]);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
tilesizx[TILE_ANIM] = 200;
|
|
|
|
tilesizy[TILE_ANIM] = 320;
|
|
|
|
|
2013-03-31 18:57:59 +00:00
|
|
|
kread(handle, animbuf, length);
|
2006-04-13 20:47:06 +00:00
|
|
|
kclose(handle);
|
|
|
|
|
2013-03-31 18:57:59 +00:00
|
|
|
if (ANIM_LoadAnim(animbuf, length) < 0)
|
|
|
|
{
|
|
|
|
// XXX: ANM_LoadAnim() still checks less than the bare minimum,
|
|
|
|
// e.g. ANM file could still be too small and not contain any frames.
|
|
|
|
OSD_Printf("Error: malformed ANM file \"%s\".\n", fn);
|
|
|
|
goto end_anim;
|
|
|
|
}
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
numframes = ANIM_NumFrames();
|
2011-07-18 19:06:29 +00:00
|
|
|
|
2012-03-22 22:47:13 +00:00
|
|
|
basepaltable[ANIMPAL] = ANIM_GetPalette();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
//setpalette(0L,256L,tempbuf);
|
|
|
|
//setbrightness(ud.brightness>>2,tempbuf,2);
|
2011-08-17 18:52:54 +00:00
|
|
|
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8+2);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2007-03-04 19:52:57 +00:00
|
|
|
gltexfiltermode = 0;
|
|
|
|
gltexapplyprops();
|
|
|
|
#endif
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
ototalclock = totalclock + 10;
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=1; i<numframes; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-07 20:45:40 +00:00
|
|
|
if (i > 4 && totalclock > frametime + 60)
|
2008-09-28 11:00:59 +00:00
|
|
|
{
|
2013-03-31 18:57:59 +00:00
|
|
|
OSD_Printf("WARNING: slowdown in %s, skipping playback\n", fn);
|
|
|
|
goto end_anim_restore_gl;
|
2008-09-28 11:00:59 +00:00
|
|
|
}
|
2010-05-07 20:45:40 +00:00
|
|
|
|
2008-09-28 11:00:59 +00:00
|
|
|
frametime = totalclock;
|
2010-05-07 20:45:40 +00:00
|
|
|
|
|
|
|
waloff[TILE_ANIM] = (intptr_t)ANIM_DrawFrame(i);
|
|
|
|
invalidatetile(TILE_ANIM, 0, 1<<4); // JBF 20031228
|
|
|
|
|
2012-06-03 16:11:22 +00:00
|
|
|
I_ClearAllInput();
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (totalclock < ototalclock)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-05 17:25:34 +00:00
|
|
|
G_HandleAsync();
|
2010-05-07 20:45:40 +00:00
|
|
|
|
2012-06-03 16:11:22 +00:00
|
|
|
if (I_CheckAllInput())
|
2014-01-12 14:02:30 +00:00
|
|
|
{
|
|
|
|
running = 0;
|
2013-03-31 18:57:59 +00:00
|
|
|
goto end_anim_restore_gl;
|
2014-01-12 14:02:30 +00:00
|
|
|
}
|
2010-05-07 20:45:40 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (g_restorePalette == 1)
|
2006-12-08 16:45:12 +00:00
|
|
|
{
|
2011-08-17 18:52:54 +00:00
|
|
|
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 0);
|
2008-11-20 14:06:36 +00:00
|
|
|
g_restorePalette = 0;
|
2006-12-08 16:45:12 +00:00
|
|
|
}
|
2010-05-07 20:45:40 +00:00
|
|
|
|
2012-08-19 12:53:24 +00:00
|
|
|
clearallviews(0);
|
2012-04-04 18:57:06 +00:00
|
|
|
|
2012-02-02 17:35:05 +00:00
|
|
|
rotatesprite_fs(0<<16,0<<16,65536L,512,TILE_ANIM,0,0,2+4+8+16+64+(ud.bgstretch?1024:0));
|
2010-05-07 20:45:40 +00:00
|
|
|
nextpage();
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t == 10) ototalclock += 14;
|
|
|
|
else if (t == 9) ototalclock += 10;
|
|
|
|
else if (t == 7) ototalclock += 18;
|
|
|
|
else if (t == 6) ototalclock += 14;
|
|
|
|
else if (t == 5) ototalclock += 9;
|
|
|
|
else if (ud.volume_number == 3) ototalclock += 10;
|
|
|
|
else if (ud.volume_number == 2) ototalclock += 10;
|
|
|
|
else if (ud.volume_number == 1) ototalclock += 18;
|
2006-04-13 20:47:06 +00:00
|
|
|
else ototalclock += 10;
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t == 8) endanimvol41(i);
|
|
|
|
else if (t == 10) endanimvol42(i);
|
|
|
|
else if (t == 11) endanimvol43(i);
|
|
|
|
else if (t == 9) intro42animsounds(i);
|
|
|
|
else if (t == 7) intro4animsounds(i);
|
|
|
|
else if (t == 6) first4animsounds(i);
|
|
|
|
else if (t == 5) logoanimsounds(i);
|
|
|
|
else if (t < 4) endanimsounds(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-03-31 18:57:59 +00:00
|
|
|
end_anim_restore_gl:
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2007-03-04 19:52:57 +00:00
|
|
|
gltexfiltermode = ogltexfiltermode;
|
|
|
|
gltexapplyprops();
|
2007-08-25 01:05:00 +00:00
|
|
|
#endif
|
2013-03-31 18:57:59 +00:00
|
|
|
end_anim:
|
2012-06-03 16:11:22 +00:00
|
|
|
I_ClearAllInput();
|
2006-11-14 21:35:50 +00:00
|
|
|
ANIM_FreeAnim();
|
2006-04-13 20:47:06 +00:00
|
|
|
walock[TILE_ANIM] = 1;
|
2014-01-12 14:02:30 +00:00
|
|
|
|
|
|
|
return !running;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|