Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound support for vgui_movie_display #116

Merged
merged 4 commits into from
Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sp/src/game/client/c_movie_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
IMPLEMENT_CLIENTCLASS_DT( C_MovieDisplay, DT_MovieDisplay, CMovieDisplay )
RecvPropBool( RECVINFO( m_bEnabled ) ),
RecvPropBool( RECVINFO( m_bLooping ) ),
RecvPropBool( RECVINFO( m_bMuted ) ),
RecvPropString( RECVINFO( m_szMovieFilename ) ),
RecvPropString( RECVINFO( m_szGroupName ) ),
END_RECV_TABLE()
Expand Down
2 changes: 2 additions & 0 deletions sp/src/game/client/c_movie_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ class C_MovieDisplay : public C_BaseEntity

bool IsEnabled( void ) const { return m_bEnabled; }
bool IsLooping( void ) const { return m_bLooping; }
bool IsMuted(void) const { return m_bMuted; }

const char *GetMovieFilename( void ) const { return m_szMovieFilename; }
const char *GetGroupName( void ) const { return m_szGroupName; }

private:
bool m_bEnabled;
bool m_bLooping;
bool m_bMuted;
char m_szMovieFilename[128];
char m_szGroupName[128];
};
Expand Down
16 changes: 11 additions & 5 deletions sp/src/game/client/vgui_movie_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class CMovieDisplayScreen : public CVGuiScreenPanel
bool m_bBlackBackground;
bool m_bSlaved;
bool m_bInitialized;

bool m_bLastActiveState; // HACK: I'd rather get a real callback...

// VGUI specifics
Expand Down Expand Up @@ -110,10 +109,9 @@ CMovieDisplayScreen::CMovieDisplayScreen( vgui::Panel *parent, const char *panel
m_bBlackBackground = true;
m_bSlaved = false;
m_bInitialized = false;

// Add ourselves to the global list of movie displays
g_MovieDisplays.AddToTail( this );

//m_VideoMaterial->SetMuted(true);
m_bLastActiveState = IsActive();
}

Expand Down Expand Up @@ -295,6 +293,11 @@ void CMovieDisplayScreen::UpdateMovie( void )
// OnVideoOver();
// StopPlayback();
}

if (!m_hScreenEntity->IsMuted())
{
m_VideoMaterial->SetMuted(false);
}
}
}

Expand Down Expand Up @@ -376,14 +379,17 @@ bool CMovieDisplayScreen::BeginPlayback( const char *pFilename )
if ( m_VideoMaterial == NULL )
return false;

m_VideoMaterial->SetMuted( true ); // FIXME: Allow?


m_VideoMaterial->SetMuted(true); // FIXME: Allow?


if ( m_hScreenEntity->IsLooping() )
{
m_VideoMaterial->SetLooping( true );
}

if ( m_VideoMaterial->HasAudio() )
if ( m_VideoMaterial->HasAudio())
{
// We want to be the sole audio source
enginesound->NotifyBeginMoviePlayback();
Expand Down
6 changes: 6 additions & 0 deletions sp/src/game/server/movie_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class CMovieDisplay : public CBaseEntity
DECLARE_DATADESC();
DECLARE_SERVERCLASS();

CMovieDisplay() { m_bMuted = true; }

virtual ~CMovieDisplay();

virtual bool KeyValue( const char *szKeyName, const char *szValue );
Expand Down Expand Up @@ -53,6 +55,7 @@ class CMovieDisplay : public CBaseEntity
private:
CNetworkVar( bool, m_bEnabled );
CNetworkVar( bool, m_bLooping );
CNetworkVar( bool, m_bMuted);

CNetworkString( m_szDisplayText, 128 );

Expand Down Expand Up @@ -93,6 +96,7 @@ BEGIN_DATADESC( CMovieDisplay )
DEFINE_KEYFIELD( m_iScreenWidth, FIELD_INTEGER, "width" ),
DEFINE_KEYFIELD( m_iScreenHeight, FIELD_INTEGER, "height" ),
DEFINE_KEYFIELD( m_bLooping, FIELD_BOOLEAN, "looping" ),
DEFINE_KEYFIELD( m_bMuted, FIELD_BOOLEAN, "muted"),

DEFINE_FIELD( m_bDoFullTransmit, FIELD_BOOLEAN ),

Expand All @@ -108,6 +112,7 @@ END_DATADESC()
IMPLEMENT_SERVERCLASS_ST( CMovieDisplay, DT_MovieDisplay )
SendPropBool( SENDINFO( m_bEnabled ) ),
SendPropBool( SENDINFO( m_bLooping ) ),
SendPropBool( SENDINFO( m_bMuted ) ),
SendPropString( SENDINFO( m_szMovieFilename ) ),
SendPropString( SENDINFO( m_szGroupName ) ),
END_SEND_TABLE()
Expand All @@ -120,6 +125,7 @@ CMovieDisplay::~CMovieDisplay()
//-----------------------------------------------------------------------------
// Read in Hammer data
//-----------------------------------------------------------------------------

bool CMovieDisplay::KeyValue( const char *szKeyName, const char *szValue )
{
// NOTE: Have to do these separate because they set two values instead of one
Expand Down