mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-27 07:15:31 +03:00
Added new "mute" keyvalue and StopMovie input to logic_playmovie
This commit is contained in:
parent
c4abb0b07f
commit
9432ecc40c
@ -36,18 +36,19 @@ void VGui_ClearVideoPanels()
|
||||
|
||||
struct VideoPanelParms_t
|
||||
{
|
||||
VideoPanelParms_t( bool _interrupt = true, bool _loop = false, float _fadein = 0.0f, float _fadeout = 0.0f )
|
||||
VideoPanelParms_t( bool _interrupt = true, bool _loop = false, bool _mute = false )
|
||||
{
|
||||
bAllowInterrupt = _interrupt;
|
||||
bLoop = _loop;
|
||||
flFadeIn = _fadein;
|
||||
flFadeOut = _fadeout;
|
||||
bMute = _mute;
|
||||
}
|
||||
|
||||
bool bAllowInterrupt;
|
||||
bool bLoop;
|
||||
float flFadeIn;
|
||||
float flFadeOut;
|
||||
bool bMute;
|
||||
|
||||
//float flFadeIn;
|
||||
//float flFadeOut;
|
||||
};
|
||||
|
||||
VideoPanel::VideoPanel( unsigned int nXPos, unsigned int nYPos, unsigned int nHeight, unsigned int nWidth, bool allowAlternateMedia ) :
|
||||
@ -182,6 +183,13 @@ bool VideoPanel::BeginPlayback( const char *pFilename )
|
||||
m_VideoMaterial->SetLooping( true );
|
||||
}
|
||||
|
||||
#ifdef MAPBASE
|
||||
if ( m_bMuted )
|
||||
{
|
||||
m_VideoMaterial->SetMuted( true );
|
||||
}
|
||||
#endif
|
||||
|
||||
m_bStarted = true;
|
||||
|
||||
// We want to be the sole audio source
|
||||
@ -482,8 +490,17 @@ bool VideoPanel_Create( unsigned int nXPos, unsigned int nYPos,
|
||||
// Toggle if we want the panel to loop (inspired by Portal 2)
|
||||
pVideoPanel->SetLooping( parms.bLoop );
|
||||
|
||||
// Fade parameters
|
||||
pVideoPanel->SetFade( parms.flFadeIn, parms.flFadeOut );
|
||||
// Toggle if we want the panel to be muted
|
||||
pVideoPanel->SetMuted( parms.bMute );
|
||||
|
||||
// TODO: Unique "Stop All Sounds" parameter
|
||||
if (parms.bMute)
|
||||
{
|
||||
pVideoPanel->SetStopAllSounds( false );
|
||||
}
|
||||
|
||||
// Fade parameters (unfinished)
|
||||
//pVideoPanel->SetFade( parms.flFadeIn, parms.flFadeOut );
|
||||
#endif
|
||||
|
||||
// Start it going
|
||||
@ -622,13 +639,16 @@ CON_COMMAND( playvideo_complex, "Plays a video with various parameters to simpli
|
||||
VideoPanelParms_t parms;
|
||||
|
||||
if (args.ArgC() >= 3)
|
||||
parms.bAllowInterrupt = atoi( args[3] ) != 1;
|
||||
parms.bAllowInterrupt = atoi( args[3] ) != 0;
|
||||
if (args.ArgC() >= 4)
|
||||
parms.bLoop = atoi( args[4] ) != 0;
|
||||
if (args.ArgC() >= 5)
|
||||
parms.flFadeIn = atof( args[5] );
|
||||
if (args.ArgC() >= 6)
|
||||
parms.flFadeOut = atof( args[6] );
|
||||
parms.bMute = atoi( args[5] ) != 0;
|
||||
|
||||
//if (args.ArgC() >= 5)
|
||||
// parms.flFadeIn = atof( args[5] );
|
||||
//if (args.ArgC() >= 6)
|
||||
// parms.flFadeOut = atof( args[6] );
|
||||
|
||||
// Stop a softlock
|
||||
if (parms.bAllowInterrupt == false && parms.bLoop)
|
||||
|
@ -49,8 +49,10 @@ public:
|
||||
|
||||
void SetBlackBackground( bool bBlack ){ m_bBlackBackground = bBlack; }
|
||||
void SetAllowInterrupt( bool bAllowInterrupt ) { m_bAllowInterruption = bAllowInterrupt; }
|
||||
void SetStopAllSounds( bool bStopAllSounds ) { m_bStopAllSounds = bStopAllSounds; }
|
||||
#ifdef MAPBASE
|
||||
void SetLooping( bool bLooping ) { m_bLooping = bLooping; }
|
||||
void SetMuted( bool bMuted ) { m_bMuted = bMuted; }
|
||||
void SetFade( float flStartFade, float flEndFade ) { m_flFadeIn = flStartFade; m_flFadeOut = flEndFade; }
|
||||
#endif
|
||||
|
||||
@ -75,6 +77,7 @@ protected:
|
||||
#ifdef MAPBASE
|
||||
float m_flFadeIn;
|
||||
float m_flFadeOut;
|
||||
bool m_bMuted;
|
||||
#endif
|
||||
bool m_bStopAllSounds;
|
||||
bool m_bAllowInterruption;
|
||||
|
@ -24,12 +24,18 @@ public:
|
||||
private:
|
||||
|
||||
void InputPlayMovie( inputdata_t &data );
|
||||
#ifdef MAPBASE
|
||||
void InputStopMovie( inputdata_t &data );
|
||||
#endif
|
||||
void InputMovieFinished( inputdata_t &data );
|
||||
|
||||
string_t m_strMovieFilename;
|
||||
bool m_bAllowUserSkip;
|
||||
#ifdef MAPBASE
|
||||
bool m_bLooping;
|
||||
bool m_bMuted;
|
||||
|
||||
bool m_bPlayingVideo;
|
||||
#endif
|
||||
|
||||
COutputEvent m_OnPlaybackFinished;
|
||||
@ -43,9 +49,15 @@ BEGIN_DATADESC( CLogicPlayMovie )
|
||||
DEFINE_KEYFIELD( m_bAllowUserSkip, FIELD_BOOLEAN, "allowskip" ),
|
||||
#ifdef MAPBASE
|
||||
DEFINE_KEYFIELD( m_bLooping, FIELD_BOOLEAN, "loopvideo" ),
|
||||
DEFINE_KEYFIELD( m_bMuted, FIELD_BOOLEAN, "mute" ),
|
||||
|
||||
DEFINE_FIELD( m_bPlayingVideo, FIELD_BOOLEAN ),
|
||||
#endif
|
||||
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "PlayMovie", InputPlayMovie ),
|
||||
#ifdef MAPBASE
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "StopMovie", InputStopMovie ),
|
||||
#endif
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "__MovieFinished", InputMovieFinished ),
|
||||
|
||||
DEFINE_OUTPUT( m_OnPlaybackFinished, "OnPlaybackFinished" ),
|
||||
@ -75,21 +87,41 @@ void CLogicPlayMovie::InputPlayMovie( inputdata_t &data )
|
||||
|
||||
char szClientCmd[256];
|
||||
Q_snprintf( szClientCmd, sizeof(szClientCmd),
|
||||
"playvideo_complex %s \"ent_fire %s __MovieFinished\" %d %d\n",
|
||||
"playvideo_complex %s \"ent_fire %s __MovieFinished\" %d %d %d\n",
|
||||
STRING(m_strMovieFilename),
|
||||
GetEntityNameAsCStr(),
|
||||
m_bAllowUserSkip,
|
||||
#ifdef MAPBASE
|
||||
m_bLooping
|
||||
m_bLooping,
|
||||
m_bMuted
|
||||
#else
|
||||
0,
|
||||
0
|
||||
#endif
|
||||
);
|
||||
|
||||
// Send it on
|
||||
engine->ServerCommand( szClientCmd );
|
||||
|
||||
#ifdef MAPBASE
|
||||
m_bPlayingVideo = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MAPBASE
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CLogicPlayMovie::InputStopMovie( inputdata_t &data )
|
||||
{
|
||||
if (m_bPlayingVideo)
|
||||
{
|
||||
// Send it on
|
||||
engine->ServerCommand( "stopvideos\n" );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -97,4 +129,8 @@ void CLogicPlayMovie::InputMovieFinished( inputdata_t &data )
|
||||
{
|
||||
// Simply fire our output
|
||||
m_OnPlaybackFinished.FireOutput( this, this );
|
||||
|
||||
#ifdef MAPBASE
|
||||
m_bPlayingVideo = false;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user