//-------------------------------------------------------------------
//
//  This code is copyright 2001 by G5 Software.
//  Any unauthorized usage, either in part or in whole of this code
//  is strictly prohibited. Violators WILL be prosecuted to the
//  maximum extent allowed by law.
//
//-------------------------------------------------------------------

class CMusicController extends CApplicationSettings
{
  void CMusicController()
  {
    string MusicPath = Core_GetRegistryValue("HKLM", m_AppRegistryPath, "MusicPath");

    if ("void" == MusicPath)
      MusicPath = "Music/";

    LoadSoundTrack(MusicPath + "MenuTrack.mst", "MUSIC_MenuTrack");

    LoadSoundTrack(MusicPath + "Track_01.mst", "MUSIC_Track_00");
    LoadSoundTrack(MusicPath + "Track_02.mst", "MUSIC_Track_01");
    LoadSoundTrack(MusicPath + "Track_03.mst", "MUSIC_Track_02");
    LoadSoundTrack(MusicPath + "Track_04.mst", "MUSIC_Track_03");
    LoadSoundTrack(MusicPath + "Track_05.mst", "MUSIC_Track_04");
  }

  void PlayMusicTrack(
      string _TrackName
    )
  {
    PlaySoundTrack(_TrackName, true);
  }

  void StopMusicPlaying()
  {
    StopAllMusic();
  }

  void PlayMenuMusic()
  {
    StopAllMusic();
    PlayMusicTrack("MUSIC_MenuTrack");
  }

  array m_MissionMusic = array(
      "MUSIC_Track_00",   // Mission 1
      "MUSIC_Track_01",   // Mission 2
      "MUSIC_Track_02",   // Mission 3
      "MUSIC_Track_02",   // Mission 4
      "MUSIC_Track_02",   // Mission 5
      "MUSIC_Track_04",   // Mission 6
      "MUSIC_Track_04",   // Mission 7
      "MUSIC_Track_01",   // Mission 8
      "MUSIC_Track_00",   // Mission 9
      "MUSIC_Track_04",   // Mission 10
      "MUSIC_Track_01",   // Mission 11
      "MUSIC_Track_00",   // Mission 12
      "MUSIC_Track_02",   // Mission 13
      "MUSIC_Track_00",   // Mission 14
      "MUSIC_Track_04"    // Mission 15
    );

  void PlayMissionMusic(
      int _MissionNumber
    )
  {
    StopAllMusic();
    PlayMusicTrack(m_MissionMusic[_MissionNumber - 1]);
  }
}
