Browse Source

Fix playing mp3 in steam.

blackops
Night Owl 7 years ago
parent
commit
6b58b45536
  1. 17
      cl_dll/hud.cpp
  2. 15
      dlls/triggers.cpp

17
cl_dll/hud.cpp

@ -102,16 +102,29 @@ void __CmdFunc_ToggleServerBrowser( void )
int __MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf ) int __MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf )
{ {
const char *pszSound;
char cmd[64];
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
pszSound = READ_STRING();
gEngfuncs.pfnPrimeMusicStream( READ_STRING(), 0 ); if( !isXashFWGS() && gEngfuncs.pfnGetCvarPointer( "gl_overbright" ) )
{
sprintf( cmd, "mp3 play media/%s\n", pszSound );
gEngfuncs.pfnClientCmd( cmd );
}
else
gEngfuncs.pfnPrimeMusicStream( pszSound, 0 );
return 1; return 1;
} }
void __CmdFunc_StopMP3( void ) void __CmdFunc_StopMP3( void )
{ {
gEngfuncs.pfnPrimeMusicStream( 0, 0 ); if( !isXashFWGS() && gEngfuncs.pfnGetCvarPointer( "gl_overbright" ) )
gEngfuncs.pfnClientCmd( "mp3 stop\n" );
else
gEngfuncs.pfnPrimeMusicStream( 0, 0 );
} }
// TFFree Command Menu Message Handlers // TFFree Command Menu Message Handlers

15
dlls/triggers.cpp

@ -2100,6 +2100,8 @@ void CTriggerChangeTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, U
#define SF_CAMERA_PLAYER_TARGET 2 #define SF_CAMERA_PLAYER_TARGET 2
#define SF_CAMERA_PLAYER_TAKECONTROL 4 #define SF_CAMERA_PLAYER_TAKECONTROL 4
extern BOOL gPhysicsInterfaceInitialized;
class CTriggerCamera : public CBaseDelay class CTriggerCamera : public CBaseDelay
{ {
public: public:
@ -2127,6 +2129,7 @@ public:
float m_acceleration; float m_acceleration;
float m_deceleration; float m_deceleration;
int m_state; int m_state;
BOOL m_bPlaying;
}; };
LINK_ENTITY_TO_CLASS( trigger_camera, CTriggerCamera ) LINK_ENTITY_TO_CLASS( trigger_camera, CTriggerCamera )
@ -2147,6 +2150,7 @@ TYPEDESCRIPTION CTriggerCamera::m_SaveData[] =
DEFINE_FIELD( CTriggerCamera, m_acceleration, FIELD_FLOAT ), DEFINE_FIELD( CTriggerCamera, m_acceleration, FIELD_FLOAT ),
DEFINE_FIELD( CTriggerCamera, m_deceleration, FIELD_FLOAT ), DEFINE_FIELD( CTriggerCamera, m_deceleration, FIELD_FLOAT ),
DEFINE_FIELD( CTriggerCamera, m_state, FIELD_INTEGER ), DEFINE_FIELD( CTriggerCamera, m_state, FIELD_INTEGER ),
DEFINE_FIELD( CTriggerCamera, m_bPlaying, FIELD_BOOLEAN ),
}; };
IMPLEMENT_SAVERESTORE( CTriggerCamera, CBaseDelay ) IMPLEMENT_SAVERESTORE( CTriggerCamera, CBaseDelay )
@ -2163,6 +2167,8 @@ void CTriggerCamera::Spawn( void )
m_acceleration = 500; m_acceleration = 500;
if( m_deceleration == 0 ) if( m_deceleration == 0 )
m_deceleration = 500; m_deceleration = 500;
m_bPlaying = FALSE;
} }
void CTriggerCamera::KeyValue( KeyValueData *pkvd ) void CTriggerCamera::KeyValue( KeyValueData *pkvd )
@ -2274,6 +2280,15 @@ void CTriggerCamera::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
SetThink( &CTriggerCamera::FollowTarget ); SetThink( &CTriggerCamera::FollowTarget );
pev->nextthink = gpGlobals->time; pev->nextthink = gpGlobals->time;
if( FStrEq( STRING( pev->targetname ), "cam1" )
&& FStrEq( STRING( gpGlobals->mapname ), "ops_intro" )
&& !gPhysicsInterfaceInitialized
&& CVAR_GET_POINTER( "gl_overbright" )
&& !m_bPlaying ) // if we're not playing, start playing!
{
m_bPlaying = TRUE;
CLIENT_COMMAND( ENT( pActivator->pev ), "playaudio Half-Life03.mp3\n" );
}
m_moveDistance = 0; m_moveDistance = 0;
Move(); Move();
} }

Loading…
Cancel
Save