//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#include "cbase.h"
#include "hl2wars/rts_shareddefs.h"
#include "mp3player.h"

extern CMP3Player *GetMP3Player();

class C_MP3Control : public C_BaseEntity
{
public:
	DECLARE_CLASS( C_MP3Control , C_BaseEntity );
	DECLARE_CLIENTCLASS();

	// Constructor
	C_MP3Control( void );
	~C_MP3Control( void );

	virtual void	ReceiveMessage( int classID, bf_read &msg );

private:
	int m_iID;
	float m_fRadius;
	float m_fDelay;
};

IMPLEMENT_CLIENTCLASS_DT( C_MP3Control, DT_MP3Control, CMP3Control )
END_RECV_TABLE()

C_MP3Control::C_MP3Control()
{
}

C_MP3Control::~C_MP3Control()
{
}

void C_MP3Control::ReceiveMessage( int classID, bf_read &msg )
{

	if ( classID != GetClientClass()->m_ClassID )
	{
		// message is for subclass
		BaseClass::ReceiveMessage( classID, msg );
		return;
	}

	char song[512];

	msg.ReadString( song, sizeof(song) );

	//Msg("Adding song %s to playlist\n", song );

	GetMP3Player()->AddToPlayList( song, true );
}