# HG changeset patch # User nemo # Date 1401808158 14400 # Node ID eb28335df0884d0193d43dcf4c98a6bec273668a # Parent ea57f2f2b98d906ef0584b6383ea06b6d4ffeb04 theme configurable sudden death music. untested diff -r ea57f2f2b98d -r eb28335df088 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sun Jun 01 16:13:47 2014 -0400 +++ b/hedgewars/uGears.pas Tue Jun 03 11:09:18 2014 -0400 @@ -321,19 +321,19 @@ end; AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState); playSound(sndSuddenDeath); - StopMusic //No SDMusic for now - //ChangeMusic(SDMusic) - end - else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then - begin - i:= cSuddenDTurns - TotalRounds; - s:= ansistring(inttostr(i)); - if i = 1 then - AddCaption(trmsg[sidRoundSD], cWhiteColor, capgrpGameState) - else if (i = 2) or ((i > 0) and ((i mod 50 = 0) or ((i <= 25) and (i mod 5 = 0)))) then - AddCaption(FormatA(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState); - end; + StopMusic; + if SDMusicFN <> '' then PlayMusic + end + else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then + begin + i:= cSuddenDTurns - TotalRounds; + s:= ansistring(inttostr(i)); + if i = 1 then + AddCaption(trmsg[sidRoundSD], cWhiteColor, capgrpGameState) + else if (i = 2) or ((i > 0) and ((i mod 50 = 0) or ((i <= 25) and (i mod 5 = 0)))) then + AddCaption(FormatA(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState); end; + end; if bBetweenTurns or isInMultiShoot or (TotalRounds = -1) then diff -r ea57f2f2b98d -r eb28335df088 hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Sun Jun 01 16:13:47 2014 -0400 +++ b/hedgewars/uLandObjects.pas Tue Jun 03 11:09:18 2014 -0400 @@ -604,7 +604,9 @@ SDWaterOpacity:= WaterOpacity end else if key = 'music' then - SetMusicName(Trim(s)) + MusicFN:= Trim(s) + else if key = 'sd-music' then + SDMusicFN:= Trim(s) else if key = 'clouds' then begin cCloudsNumber:= Word(StrToInt(Trim(s))) * cScreenSpace div 4096; diff -r ea57f2f2b98d -r eb28335df088 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Sun Jun 01 16:13:47 2014 -0400 +++ b/hedgewars/uSound.pas Tue Jun 03 11:09:18 2014 -0400 @@ -104,6 +104,8 @@ // Returns a pointer to the voicepack with the given name. function AskForVoicepack(name: shortstring): Pointer; +var MusicFN: shortstring; // music file name + SDMusicFN: shortstring; // SD music file name var Volume: LongInt; SoundTimerTicks: Longword; @@ -117,7 +119,6 @@ voicepacks: array[0..cMaxTeams] of TVoicepack; defVoicepack: PVoicepack; Mus: PMixMusic; // music pointer - MusicFN: shortstring; // music file name isMusicEnabled: boolean; isSoundEnabled: boolean; isSEBackup: boolean; @@ -554,8 +555,9 @@ begin if (MusicFN = '') or (not isMusicEnabled) then exit; - - s:= '/Music/' + MusicFN; + if SuddenDeath and (SDMusicFN <> '') then + s:= '/Music/' + SDMusicFN + else s:= '/Music/' + MusicFN; WriteToConsole(msgLoading + s + ' '); Mus:= Mix_LoadMUS_RW(rwopsOpenRead(s));