# HG changeset patch # User sheepluva # Date 1461946712 -7200 # Node ID ee85798d697466c78750edc16404471acac2372c # Parent 04d7aa06ede217c632024fd8067f53e5bdf13aa1 aggregate music credits into a single file (individual files can still be used to override. useful for .hwp etc.) diff -r 04d7aa06ede2 -r ee85798d6974 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Fri Apr 29 15:10:27 2016 +0200 +++ b/hedgewars/uSound.pas Fri Apr 29 18:18:32 2016 +0200 @@ -582,7 +582,16 @@ WriteLnToConsole(msgOK); // display music credits - s:= read1stLn(s + '_credits.txt'); + s:= s + '_credits.txt'; + + // if per-file credits not found check general music credits file + if pfsExists(s) then + s:= read1stLn(s) + else if SuddenDeath and (SDMusicFN <> '') then + s:= readValueFromINI(SDMusicFN, '/Music/credits.txt') + else + s:= readValueFromINI(MusicFN, '/Music/credits.txt'); + if Length(s) > 0 then AddChatString(char(2) + '© Music: ' + s); diff -r 04d7aa06ede2 -r ee85798d6974 hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Fri Apr 29 15:10:27 2016 +0200 +++ b/hedgewars/uUtils.pas Fri Apr 29 18:18:32 2016 +0200 @@ -71,6 +71,7 @@ function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; function read1stLn(filePath: shortstring): shortstring; +function readValueFromINI(key, filePath: shortstring): shortstring; {$IFNDEF PAS2C} procedure Write(var f: textfile; s: shortstring); @@ -527,6 +528,37 @@ end; end; +function readValueFromINI(key, filePath: shortstring): shortstring; +var f: pfsFile; + s: shortstring; + i: LongInt; +begin + s:= ''; + readValueFromINI:= ''; + + if pfsExists(filePath) then + begin + f:= pfsOpenRead(filePath); + + while (not pfsEOF(f)) and allOK do + begin pfsReadLn(f, s); + if Length(s) = 0 then + continue; + if s[1] = ';' then + continue; + + i:= Pos('=', s); + if Trim(Copy(s, 1, Pred(i))) = key then + begin + Delete(s, 1, i); + readValueFromINI:= s; + end; + end; + pfsClose(f); + f:= nil; + end; +end; + procedure initModule(isNotPreview: boolean); {$IFDEF DEBUGFILE} var logfileBase: shortstring; diff -r 04d7aa06ede2 -r ee85798d6974 share/hedgewars/Data/Music/CMakeLists.txt --- a/share/hedgewars/Data/Music/CMakeLists.txt Fri Apr 29 15:10:27 2016 +0200 +++ b/share/hedgewars/Data/Music/CMakeLists.txt Fri Apr 29 18:18:32 2016 +0200 @@ -1,7 +1,7 @@ file(GLOB BaseMusic *.ogg) -file(GLOB MusicCredits *_credits.txt) install(FILES ${BaseMusic} ${MusicCredits} + credits.txt DESTINATION ${SHAREPATH}Data/Music) diff -r 04d7aa06ede2 -r ee85798d6974 share/hedgewars/Data/Music/City.ogg_credits.txt --- a/share/hedgewars/Data/Music/City.ogg_credits.txt Fri Apr 29 15:10:27 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -HSR ( http://elhombresinremedio.com ) \ No newline at end of file diff -r 04d7aa06ede2 -r ee85798d6974 share/hedgewars/Data/Music/Compost.ogg_credits.txt --- a/share/hedgewars/Data/Music/Compost.ogg_credits.txt Fri Apr 29 15:10:27 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -HG \ No newline at end of file diff -r 04d7aa06ede2 -r ee85798d6974 share/hedgewars/Data/Music/EarthRise.ogg_credits.txt --- a/share/hedgewars/Data/Music/EarthRise.ogg_credits.txt Fri Apr 29 15:10:27 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Jonatan Nilsson \ No newline at end of file diff -r 04d7aa06ede2 -r ee85798d6974 share/hedgewars/Data/Music/Rock.ogg_credits.txt --- a/share/hedgewars/Data/Music/Rock.ogg_credits.txt Fri Apr 29 15:10:27 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -HSR ( http://elhombresinremedio.com ) \ No newline at end of file diff -r 04d7aa06ede2 -r ee85798d6974 share/hedgewars/Data/Music/credits.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Music/credits.txt Fri Apr 29 18:18:32 2016 +0200 @@ -0,0 +1,7 @@ +City.ogg=HSR ( http://elhombresinremedio.com ) +Compost.ogg=HG +EarthRise.ogg=Jonatan Nilsson +oriental.ogg=Jonatan Nilsson +Rock.ogg=HSR ( http://elhombresinremedio.com ) +sdmusic.ogg=Kevin MacLeod - "Hitman" [sheepluva edit] +snow.ogg=Jonatan Nilsson diff -r 04d7aa06ede2 -r ee85798d6974 share/hedgewars/Data/Music/oriental.ogg_credits.txt --- a/share/hedgewars/Data/Music/oriental.ogg_credits.txt Fri Apr 29 15:10:27 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Jonatan Nilsson \ No newline at end of file diff -r 04d7aa06ede2 -r ee85798d6974 share/hedgewars/Data/Music/sdmusic.ogg_credits.txt --- a/share/hedgewars/Data/Music/sdmusic.ogg_credits.txt Fri Apr 29 15:10:27 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Kevin MacLeod - "Hitman" [sheepluva edit] \ No newline at end of file diff -r 04d7aa06ede2 -r ee85798d6974 share/hedgewars/Data/Music/snow.ogg_credits.txt --- a/share/hedgewars/Data/Music/snow.ogg_credits.txt Fri Apr 29 15:10:27 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Jonatan Nilsson \ No newline at end of file