hedgewars/uSound.pas
changeset 10254 eb28335df088
parent 10108 c68cf030eded
child 10490 b30b8d39d662
equal deleted inserted replaced
10253:ea57f2f2b98d 10254:eb28335df088
   102 function  ChangeVolume(voldelta: LongInt): LongInt;
   102 function  ChangeVolume(voldelta: LongInt): LongInt;
   103 
   103 
   104 // Returns a pointer to the voicepack with the given name.
   104 // Returns a pointer to the voicepack with the given name.
   105 function  AskForVoicepack(name: shortstring): Pointer;
   105 function  AskForVoicepack(name: shortstring): Pointer;
   106 
   106 
       
   107 var MusicFN: shortstring; // music file name
       
   108     SDMusicFN: shortstring; // SD music file name
   107 
   109 
   108 var Volume: LongInt;
   110 var Volume: LongInt;
   109     SoundTimerTicks: Longword;
   111     SoundTimerTicks: Longword;
   110 implementation
   112 implementation
   111 uses uVariables, uConsole, uCommands, uDebug, uPhysFSLayer;
   113 uses uVariables, uConsole, uCommands, uDebug, uPhysFSLayer;
   115     previousVolume: LongInt; // cached volume value
   117     previousVolume: LongInt; // cached volume value
   116     lastChan: array [TSound] of LongInt;
   118     lastChan: array [TSound] of LongInt;
   117     voicepacks: array[0..cMaxTeams] of TVoicepack;
   119     voicepacks: array[0..cMaxTeams] of TVoicepack;
   118     defVoicepack: PVoicepack;
   120     defVoicepack: PVoicepack;
   119     Mus: PMixMusic; // music pointer
   121     Mus: PMixMusic; // music pointer
   120     MusicFN: shortstring; // music file name
       
   121     isMusicEnabled: boolean;
   122     isMusicEnabled: boolean;
   122     isSoundEnabled: boolean;
   123     isSoundEnabled: boolean;
   123     isSEBackup: boolean;
   124     isSEBackup: boolean;
   124     VoiceList : array[0..7] of TVoice =  (
   125     VoiceList : array[0..7] of TVoice =  (
   125                     ( snd: sndNone; voicepack: nil),
   126                     ( snd: sndNone; voicepack: nil),
   552 procedure PlayMusic;
   553 procedure PlayMusic;
   553 var s: shortstring;
   554 var s: shortstring;
   554 begin
   555 begin
   555     if (MusicFN = '') or (not isMusicEnabled) then
   556     if (MusicFN = '') or (not isMusicEnabled) then
   556         exit;
   557         exit;
   557 
   558     if SuddenDeath and (SDMusicFN <> '') then 
   558     s:= '/Music/' + MusicFN;
   559          s:= '/Music/' + SDMusicFN
       
   560     else s:= '/Music/' + MusicFN;
   559     WriteToConsole(msgLoading + s + ' ');
   561     WriteToConsole(msgLoading + s + ' ');
   560 
   562 
   561     Mus:= Mix_LoadMUS_RW(rwopsOpenRead(s));
   563     Mus:= Mix_LoadMUS_RW(rwopsOpenRead(s));
   562     SDLTry(Mus <> nil, false);
   564     SDLTry(Mus <> nil, false);
   563     WriteLnToConsole(msgOK);
   565     WriteLnToConsole(msgOK);