From 8f50cda97f1813357af437e13a75228c13974743 Mon Sep 17 00:00:00 2001 From: James De Ricco Date: Thu, 1 Aug 2024 16:08:11 -0400 Subject: [PATCH] Display author, title, license in the level editor music browser (#2617) Whenever any of author, title and license fields are defined for music files, help text showing this music metadata is displayed when hovering over ".music" files in the level editor music object file browser. This commit adds both the software implementation and author, title, and license values added to SuperTux music files in data/music. The game credits and data/AUTHORS are updated in some cases where there is new authorship data. Fixes #2617. --- data/AUTHORS | 19 +++-- data/credits.stxt | 28 ++++++- data/music/antarctic/airship_remix-2.music | 3 + data/music/antarctic/airship_remix.music | 3 + data/music/antarctic/arctic_breeze.music | 3 + data/music/antarctic/arctic_cave.music | 3 + data/music/antarctic/bossattack.music | 3 + data/music/antarctic/cave.music | 3 + data/music/antarctic/cavetheme.music | 2 + data/music/antarctic/cavetheme_alt.music | 2 + data/music/antarctic/chipdisko.music | 3 + data/music/antarctic/crystalmine_intro.music | 2 + data/music/antarctic/crystalmine_main.music | 2 + data/music/antarctic/glacier.music | 2 + data/music/antarctic/jewels.music | 3 + data/music/antarctic/midday.music | 2 + data/music/antarctic/midday_alt.music | 2 + data/music/antarctic/night.music | 2 + data/music/antarctic/salcon.music | 3 + data/music/antarctic/skylevel.music | 2 + data/music/antarctic/snowfort.music | 2 + data/music/antarctic/sunset.music | 2 + data/music/antarctic/underwater.music | 2 + data/music/antarctic/voc-boss.music | 2 + data/music/antarctic/voc-dark.music | 2 + data/music/antarctic/voc-daytime.music | 2 + data/music/antarctic/voc-daytime2.music | 2 + data/music/antarctic/voc-night.music | 2 + data/music/antarctic/worldmap_ice.music | 2 + data/music/antarctic/yetiboss.music | 2 + data/music/castle/darkforestkeep.music | 3 + data/music/castle/fortress.music | 3 + data/music/castle/icecastle.music | 2 + .../forest/beneath_the_rabbit_hole.music | 3 + data/music/forest/bright_thunders.music | 2 + .../forest/call_of_the_winding_path.music | 2 + data/music/forest/clavelian_march.music | 2 + data/music/forest/forest-cave.music | 2 + data/music/forest/forest-sprint.music | 2 + data/music/forest/forest.music | 3 + data/music/forest/forest2.music | 3 + data/music/forest/forest3.music | 3 + data/music/forest/forest_midday.music | 2 + data/music/forest/forest_midday_alt.music | 2 + data/music/forest/forest_theme.music | 3 + data/music/forest/ghostforest.music | 3 + data/music/forest/ghostforest2.music | 3 + data/music/forest/ghostforest_map.music | 2 + data/music/forest/greatgigantic.music | 3 + .../forest/march_of_the_malevolent.music | 3 + data/music/forest/new_forest_map.music | 2 + data/music/forest/shallow-green.music | 3 + data/music/forest/treeboss.music | 2 + data/music/forest/wisphunt.music | 2 + data/music/misc/battle_theme.music | 3 + data/music/misc/bonuscave.music | 3 + data/music/misc/credits.music | 3 + data/music/misc/halloween_1.music | 2 + data/music/misc/intro.music | 3 + data/music/misc/theme.music | 3 + data/music/retro/cave_old.music | 3 + data/music/retro/classic.music | 1 + data/music/retro/fortress_old.music | 3 + data/music/retro/ice_music.music | 2 + data/music/retro/worldmap_old.music | 2 + data/music/tropical/saharan_penguin.music | 2 + data/music/tropical/tropicalbreeze.music | 3 + src/audio/sound_file.cpp | 75 ++++++++++++++++--- src/audio/sound_file.hpp | 9 ++- src/editor/object_option.cpp | 8 +- src/editor/object_option.hpp | 5 +- src/editor/object_settings.cpp | 8 +- src/editor/object_settings.hpp | 4 +- src/gui/menu.cpp | 12 ++- src/gui/menu.hpp | 3 +- src/gui/menu_filesystem.cpp | 10 ++- src/gui/menu_filesystem.hpp | 4 +- ...u_filesystem_item_processor_music_help.cpp | 60 +++++++++++++++ ...u_filesystem_item_processor_music_help.hpp | 27 +++++++ src/supertux/menu/editor_converters_menu.cpp | 20 ++--- 80 files changed, 402 insertions(+), 48 deletions(-) create mode 100644 src/gui/menu_filesystem_item_processor_music_help.cpp create mode 100644 src/gui/menu_filesystem_item_processor_music_help.hpp diff --git a/data/AUTHORS b/data/AUTHORS index 28245a32652..411ba966932 100644 --- a/data/AUTHORS +++ b/data/AUTHORS @@ -27,18 +27,19 @@ License should be included with them. == Music == All files in data/music created by wansti and licensed under GPLv2+CC-by-sa, unless stated otherwise. -* airship_remix.ogg - from remaxim at OpenGameArt.org, permission to release under CC-BY-SA and GPL version 2 or later +* airship_remix.ogg - by Bart Kelsey submitted by remaxim at OpenGameArt.org, permission to release under CC-BY-SA and GPL version 2 or later * airship_2.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA * arctic_cave.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA -* battle_theme.ogg - from remaxim at OpenGameArt.org, permission to release under CC-BY-SA and GPL version 2 or later +* battle_theme.ogg - from remaxim at OpenGameArt.org, permission to release under CC-BY-SA 3.0 and GPL version 2 or later * beneath_the_rabbit_hole.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA * bonuscave.ogg * bossattack.ogg -* bright_thunders.ogg - by Krobonil, licensed under CC-BY-SA +* bright_thunders.ogg - by Chris "Krobonil" Leutwyler, licensed under CC-BY-SA * cave.ogg +* cave_old.ogg * call_of_the_winding_path.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA * chipdisko.ogg - Mortimer's Chipdisko by Lukas Nystrand as Mortimer Twang - explicit permission granted to release unter GPL and CC-by-sa. -* clavelian_march.ogg +* clavelian_march.ogg by Treskalle * credits.ogg * darkforestkeep.ogg * forest-cave.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA @@ -49,20 +50,22 @@ All files in data/music created by wansti and licensed under GPLv2+CC-by-sa, unl * forest_theme.ogg - Forest Prophecy reEducated, by Wansti and Tobias "ToBeFree" Frei (GPLv2+CC-by-sa) * forest-sprint.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA * fortress.ogg +* fortress_old.ogg * ghostforest_map.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA * ghostforest.ogg * ghostforest2.ogg -* greatgigantic.ogg - Based on a work by Chris Huelsbeck - We have his permission to release this under GPL. +* greatgigantic.ogg - by Wansti based on a work by Chris Huelsbeck - We have his permission to release this under GPL. * shallow-green.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA * halloween_1.ogg - By Forty-Two - licensed under CC-BY-SA 4.0 * ice_music.ogg - By ZhayTee * intro.ogg * invincible.ogg * arctic_breeze.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA -* jewels.ogg - By cynicmusic/congusbongus - - CC-BY 3.0/CC-BY-SA 3.0/GPL 3.0 +* jewels.ogg - By Alex \"cynicmusic\" Smith edited by congusbongus - - CC-BY 3.0/CC-BY-SA 3.0/GPL 3.0 * leveldone.ogg +* march_of_the_malevolent.ogg - Servalot, Wansti (original forest/'ghost' forest theme), licensed CC-BY-SA 4.0 * new_forest_map.ogg - Jason Lavallée, dual-licensed: GPL version 2 or later and CC-BY-SA -* salcon.ogg - Salsa Con Carne by Mystical - Replaced due to licensing issues (some non-free samples are used) +* salcon.ogg - Salsa Con Carne by DJ Gentoo based on work by Asbjorn \"Mystical\" Andersen - Replaced due to licensing issues (some non-free samples are used) by a work-in-progress remix in trunk and the 0.3.x branch (r4585), for which we have permission to release under GPL and CC-by-sa. - wansti * saharan_penguin.ogg - by Enol "Meji" Monte, licensed CC BY-SA * theme.ogg @@ -81,7 +84,7 @@ All files in data/music created by wansti and licensed under GPLv2+CC-by-sa, unl * cavetheme_alt.ogg - By SnugglyBun, cover of the original cave theme by Wansti. licensed under CC-BY-SA 4.0 * crystalmine_intro.ogg - By SnugglyBun, licensed under CC-BY-SA 4.0 * crystalmine_main.ogg - By SnugglyBun, licensed under CC-BY-SA 4.0 -* crystalmine_underwater.ogg - By SnugglyBun, licensed under CC-BY-SA 4.0 +* underwater.ogg - By SnugglyBun, licensed under CC-BY-SA 4.0 * glacier.ogg - By SnugglyBun, licensed under CC-BY-SA 4.0 * snowfort.ogg - By SnugglyBun, licensed under CC-BY-SA 4.0 * icecastle.ogg - By SnugglyBun, based on the original fortress theme by Wansti. licensed under CC-BY-SA 4.0 diff --git a/data/credits.stxt b/data/credits.stxt index 209f650f45d..ffbb1a0bc26 100644 --- a/data/credits.stxt +++ b/data/credits.stxt @@ -338,7 +338,7 @@ ) (text (type "normal") - (string "Bart K.") + (string "Bart Kelsey") ) (text (type "normal") @@ -350,7 +350,7 @@ ) (text (type "normal") - (string "Chris Leutwyler") + (string "Chris \"Krobonil\" Leutwyler") ) (text (type "normal") @@ -360,6 +360,30 @@ (type "normal") (string "Tobias \"ToBeFree\" Frei") ) + (text + (type "normal") + (string "Alex \"cynicmusic\" Smith") + ) + (text + (type "normal") + (string "congusbongus") + ) + (text + (type "normal") + (string "Enol \"Meji\" Monte") + ) + (text + (type "normal") + (string "Flan") + ) + (text + (type "normal") + (string "Alasdair \"Servalot\"") + ) + (text + (type "normal") + (string "ZhayTee") + ) (blank) (blank) (text diff --git a/data/music/antarctic/airship_remix-2.music b/data/music/antarctic/airship_remix-2.music index 92246ccca97..0cf21778411 100644 --- a/data/music/antarctic/airship_remix-2.music +++ b/data/music/antarctic/airship_remix-2.music @@ -1,5 +1,8 @@ (supertux-music (file "airship_2.ogg") + (title "Airship 2") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at 202) ) diff --git a/data/music/antarctic/airship_remix.music b/data/music/antarctic/airship_remix.music index 65fc926d7b5..8d3f239b52f 100644 --- a/data/music/antarctic/airship_remix.music +++ b/data/music/antarctic/airship_remix.music @@ -1,5 +1,8 @@ (supertux-music (file "airship_remix.ogg") + (title "Airship Song Orchestral Mix") + (authors "Bart Kelsey") + (license "CC-BY-SA 3.0 / GPL 3.0 / GPL 2.0") (loop-begin 4) (loop-at 58) ) diff --git a/data/music/antarctic/arctic_breeze.music b/data/music/antarctic/arctic_breeze.music index 870a1eac9d8..873547337bb 100644 --- a/data/music/antarctic/arctic_breeze.music +++ b/data/music/antarctic/arctic_breeze.music @@ -1,5 +1,8 @@ (supertux-music (file "arctic_breeze.ogg") + (title "Antarctic Breeze") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at 197) ) \ No newline at end of file diff --git a/data/music/antarctic/arctic_cave.music b/data/music/antarctic/arctic_cave.music index 6cd8706def1..fc6914acfe3 100644 --- a/data/music/antarctic/arctic_cave.music +++ b/data/music/antarctic/arctic_cave.music @@ -1,5 +1,8 @@ (supertux-music (file "arctic_cave.ogg") + (title "Eyes in the Deep") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at 267) ) diff --git a/data/music/antarctic/bossattack.music b/data/music/antarctic/bossattack.music index 31c98c3b897..b37461d4cf1 100644 --- a/data/music/antarctic/bossattack.music +++ b/data/music/antarctic/bossattack.music @@ -1,5 +1,8 @@ (supertux-music (file "bossattack.ogg") + (title "Boss Attack") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") (loop-begin 0.5) (loop-at -1) ) diff --git a/data/music/antarctic/cave.music b/data/music/antarctic/cave.music index 343374d7731..ea388ebd6ea 100644 --- a/data/music/antarctic/cave.music +++ b/data/music/antarctic/cave.music @@ -1,5 +1,8 @@ (supertux-music (file "cave.ogg") + (title "The Cave (Milestone 2 Version)") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/cavetheme.music b/data/music/antarctic/cavetheme.music index da5176ded6e..ba46878d35f 100644 --- a/data/music/antarctic/cavetheme.music +++ b/data/music/antarctic/cavetheme.music @@ -1,5 +1,7 @@ (supertux-music (file "cavetheme.ogg") + (authors "SnugglyBun" "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA 4.0") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/cavetheme_alt.music b/data/music/antarctic/cavetheme_alt.music index 94aac10472c..24f0ea226ba 100644 --- a/data/music/antarctic/cavetheme_alt.music +++ b/data/music/antarctic/cavetheme_alt.music @@ -1,5 +1,7 @@ (supertux-music (file "cavetheme_alt.ogg") + (authors "SnugglyBun" "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA 4.0") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/chipdisko.music b/data/music/antarctic/chipdisko.music index af56b72bd6c..1a57508600d 100644 --- a/data/music/antarctic/chipdisko.music +++ b/data/music/antarctic/chipdisko.music @@ -1,5 +1,8 @@ (supertux-music (file "chipdisko.ogg") + (title "Mortimer's Chipdisko") + (authors "Lukas Nystrand (as Mortimer Twang)") + (license "CC-BY-SA / GPL") (loop-begin 0) (loop-at 158) ) diff --git a/data/music/antarctic/crystalmine_intro.music b/data/music/antarctic/crystalmine_intro.music index 3d7f518e699..1e21f0f03ab 100644 --- a/data/music/antarctic/crystalmine_intro.music +++ b/data/music/antarctic/crystalmine_intro.music @@ -1,5 +1,7 @@ (supertux-music (file "crystalmine_intro.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/crystalmine_main.music b/data/music/antarctic/crystalmine_main.music index 094da920c1d..5cc9c3f9e54 100644 --- a/data/music/antarctic/crystalmine_main.music +++ b/data/music/antarctic/crystalmine_main.music @@ -1,5 +1,7 @@ (supertux-music (file "crystalmine_main.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 7.499) (loop-at 146.250) ) diff --git a/data/music/antarctic/glacier.music b/data/music/antarctic/glacier.music index 2807fb0ea62..6573880cec6 100644 --- a/data/music/antarctic/glacier.music +++ b/data/music/antarctic/glacier.music @@ -1,5 +1,7 @@ (supertux-music (file "glacier.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 12.311) (loop-at 86.154) ) diff --git a/data/music/antarctic/jewels.music b/data/music/antarctic/jewels.music index ed2342e1489..fbe07d47911 100644 --- a/data/music/antarctic/jewels.music +++ b/data/music/antarctic/jewels.music @@ -1,5 +1,8 @@ (supertux-music (file "jewels.ogg") + (authors "Alex \"cynicmusic\" Smith" "congusbongus") + (title "Crystal Cave + Mysterious Ambience (seamless loop)") + (license "CC-BY 3.0 / CC-BY-SA 3.0 / GPL 3.0") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/midday.music b/data/music/antarctic/midday.music index 43008159038..d5e97d5a357 100644 --- a/data/music/antarctic/midday.music +++ b/data/music/antarctic/midday.music @@ -1,5 +1,7 @@ (supertux-music (file "midday.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/midday_alt.music b/data/music/antarctic/midday_alt.music index fbb7595234a..38be65e4056 100644 --- a/data/music/antarctic/midday_alt.music +++ b/data/music/antarctic/midday_alt.music @@ -1,5 +1,7 @@ (supertux-music (file "midday_alt.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/night.music b/data/music/antarctic/night.music index ce54c5a8810..5db829c448c 100644 --- a/data/music/antarctic/night.music +++ b/data/music/antarctic/night.music @@ -1,5 +1,7 @@ (supertux-music (file "night.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 2.912) (loop-at 72.727) ) diff --git a/data/music/antarctic/salcon.music b/data/music/antarctic/salcon.music index 06d4adb4fbd..d26c16437a6 100644 --- a/data/music/antarctic/salcon.music +++ b/data/music/antarctic/salcon.music @@ -1,5 +1,8 @@ (supertux-music (file "salcon.ogg") + (authors "DJ Gentoo" "Asbjorn \"Mystical\" Andersen") + (title "Salsa Con Carne (remix)") + (license "CC-BY-SA / GPL") (loop-begin 0) (loop-at 56) ) \ No newline at end of file diff --git a/data/music/antarctic/skylevel.music b/data/music/antarctic/skylevel.music index c7bbf618720..a468ebe5235 100644 --- a/data/music/antarctic/skylevel.music +++ b/data/music/antarctic/skylevel.music @@ -1,5 +1,7 @@ (supertux-music (file "skylevel.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 11.639) (loop-at 81.445) ) diff --git a/data/music/antarctic/snowfort.music b/data/music/antarctic/snowfort.music index 139d7818eab..6bda58cad1e 100644 --- a/data/music/antarctic/snowfort.music +++ b/data/music/antarctic/snowfort.music @@ -1,5 +1,7 @@ (supertux-music (file "snowfort.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 7.683) (loop-at 88.320) ) diff --git a/data/music/antarctic/sunset.music b/data/music/antarctic/sunset.music index 3b5f70f6ff6..f4b61675f55 100644 --- a/data/music/antarctic/sunset.music +++ b/data/music/antarctic/sunset.music @@ -1,5 +1,7 @@ (supertux-music (file "sunset.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 34.912) (loop-at 104.727) ) diff --git a/data/music/antarctic/underwater.music b/data/music/antarctic/underwater.music index 21daed9984b..47a9a39957c 100644 --- a/data/music/antarctic/underwater.music +++ b/data/music/antarctic/underwater.music @@ -1,5 +1,7 @@ (supertux-music (file "underwater.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 19.198) (loop-at 115.200) ) diff --git a/data/music/antarctic/voc-boss.music b/data/music/antarctic/voc-boss.music index c10981308ba..99c92ec3921 100644 --- a/data/music/antarctic/voc-boss.music +++ b/data/music/antarctic/voc-boss.music @@ -1,5 +1,7 @@ (supertux-music (file "voc-boss.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/voc-dark.music b/data/music/antarctic/voc-dark.music index 6939f43b32d..83e1bf86ca7 100644 --- a/data/music/antarctic/voc-dark.music +++ b/data/music/antarctic/voc-dark.music @@ -1,5 +1,7 @@ (supertux-music (file "voc-dark.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/voc-daytime.music b/data/music/antarctic/voc-daytime.music index 60110cd742f..857a0f3b7bd 100644 --- a/data/music/antarctic/voc-daytime.music +++ b/data/music/antarctic/voc-daytime.music @@ -1,5 +1,7 @@ (supertux-music (file "voc-daytime.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/voc-daytime2.music b/data/music/antarctic/voc-daytime2.music index 7567c1405fd..95bc95106cd 100644 --- a/data/music/antarctic/voc-daytime2.music +++ b/data/music/antarctic/voc-daytime2.music @@ -1,5 +1,7 @@ (supertux-music (file "voc-daytime2.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/voc-night.music b/data/music/antarctic/voc-night.music index b065c811431..2dc36181c78 100644 --- a/data/music/antarctic/voc-night.music +++ b/data/music/antarctic/voc-night.music @@ -1,5 +1,7 @@ (supertux-music (file "voc-night.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") (loop-begin 4.648) (loop-at 73.231) ) diff --git a/data/music/antarctic/worldmap_ice.music b/data/music/antarctic/worldmap_ice.music index 42dddf842d4..422e5dc1974 100644 --- a/data/music/antarctic/worldmap_ice.music +++ b/data/music/antarctic/worldmap_ice.music @@ -1,5 +1,7 @@ (supertux-music (file "worldmap_ice.ogg") + (authors "SnugglyBun") + (license "CC-BY-SA 4.0") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/antarctic/yetiboss.music b/data/music/antarctic/yetiboss.music index aa122855de9..bb3c5ad8332 100644 --- a/data/music/antarctic/yetiboss.music +++ b/data/music/antarctic/yetiboss.music @@ -1,5 +1,7 @@ (supertux-music (file "yetiboss.ogg") + (authors "SnugglyBun" "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA 4.0") (loop-begin 1.446) (loop-at 82.410) ) diff --git a/data/music/castle/darkforestkeep.music b/data/music/castle/darkforestkeep.music index d93fae2398d..a56e4fc3f66 100644 --- a/data/music/castle/darkforestkeep.music +++ b/data/music/castle/darkforestkeep.music @@ -1,5 +1,8 @@ (supertux-music (file "darkforestkeep.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Dark Forest Keep") (loop-begin 0) (loop-at 199) ) diff --git a/data/music/castle/fortress.music b/data/music/castle/fortress.music index b7fbc9e3e6e..0a519a242aa 100644 --- a/data/music/castle/fortress.music +++ b/data/music/castle/fortress.music @@ -1,5 +1,8 @@ (supertux-music (file "fortress.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "The Fortress (Milestone 2 Version)") (loop-begin 11.37) (loop-at -1) ) diff --git a/data/music/castle/icecastle.music b/data/music/castle/icecastle.music index b5602209fa9..44f2d45f61c 100644 --- a/data/music/castle/icecastle.music +++ b/data/music/castle/icecastle.music @@ -1,5 +1,7 @@ (supertux-music (file "icecastle.ogg") + (authors "SnugglyBun" "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA 4.0") (loop-begin 9.235) (loop-at 80.000) ) diff --git a/data/music/forest/beneath_the_rabbit_hole.music b/data/music/forest/beneath_the_rabbit_hole.music index 8f19b5f9096..27601b611cb 100644 --- a/data/music/forest/beneath_the_rabbit_hole.music +++ b/data/music/forest/beneath_the_rabbit_hole.music @@ -1,5 +1,8 @@ (supertux-music (file "beneath_the_rabbit_hole.ogg") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") + (title "Beneath the Rabbit Holes") (loop-begin 0) (loop-at 178) ) diff --git a/data/music/forest/bright_thunders.music b/data/music/forest/bright_thunders.music index e14a7768dce..b51df2d7150 100644 --- a/data/music/forest/bright_thunders.music +++ b/data/music/forest/bright_thunders.music @@ -1,5 +1,7 @@ (supertux-music (file "bright_thunders.ogg") + (authors "Chris \"Krobonil\" Leutwyler") + (license "CC-BY-SA") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/forest/call_of_the_winding_path.music b/data/music/forest/call_of_the_winding_path.music index 7cffe5aea13..701713cb3ca 100644 --- a/data/music/forest/call_of_the_winding_path.music +++ b/data/music/forest/call_of_the_winding_path.music @@ -1,5 +1,7 @@ (supertux-music (file "call_of_the_winding_path.ogg") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at 394) ) diff --git a/data/music/forest/clavelian_march.music b/data/music/forest/clavelian_march.music index d31bcffc976..d705096df2a 100644 --- a/data/music/forest/clavelian_march.music +++ b/data/music/forest/clavelian_march.music @@ -1,5 +1,7 @@ (supertux-music (file "clavelian_march.ogg") + (authors "Treskalle") + (title "Clavelian March") (loop-begin 0.5) (loop-at -1) ) diff --git a/data/music/forest/forest-cave.music b/data/music/forest/forest-cave.music index 5ff3074f8f9..ddf9cd8927d 100644 --- a/data/music/forest/forest-cave.music +++ b/data/music/forest/forest-cave.music @@ -1,5 +1,7 @@ (supertux-music (file "forest-cave.ogg") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at 149) ) \ No newline at end of file diff --git a/data/music/forest/forest-sprint.music b/data/music/forest/forest-sprint.music index 8d2536ecbb6..16d978e841b 100644 --- a/data/music/forest/forest-sprint.music +++ b/data/music/forest/forest-sprint.music @@ -1,5 +1,7 @@ (supertux-music (file "forest-sprint.ogg") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at 207) ) \ No newline at end of file diff --git a/data/music/forest/forest.music b/data/music/forest/forest.music index a5503a1bfe6..0143d4d15ef 100644 --- a/data/music/forest/forest.music +++ b/data/music/forest/forest.music @@ -1,5 +1,8 @@ (supertux-music (file "forest.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Forest Dance") (loop-begin 54.818) (loop-at 95.955) ) diff --git a/data/music/forest/forest2.music b/data/music/forest/forest2.music index 206ae9e1234..65907915283 100644 --- a/data/music/forest/forest2.music +++ b/data/music/forest/forest2.music @@ -1,5 +1,8 @@ (supertux-music (file "forest2.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Rabbit Holes") (loop-begin 0) (loop-at 143) ) \ No newline at end of file diff --git a/data/music/forest/forest3.music b/data/music/forest/forest3.music index cae89201777..a45fed337b6 100644 --- a/data/music/forest/forest3.music +++ b/data/music/forest/forest3.music @@ -1,5 +1,8 @@ (supertux-music (file "forest3.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Riding The Wind") (loop-begin 0) (loop-at 99) ) \ No newline at end of file diff --git a/data/music/forest/forest_midday.music b/data/music/forest/forest_midday.music index 32262f97744..4860b61b689 100644 --- a/data/music/forest/forest_midday.music +++ b/data/music/forest/forest_midday.music @@ -1,5 +1,7 @@ (supertux-music (file "forest_midday.ogg") + (authors "SnugglyBun" "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA 4.0") (loop-begin 8.067) (loop-at 112.941) ) diff --git a/data/music/forest/forest_midday_alt.music b/data/music/forest/forest_midday_alt.music index 9429d197311..e1a6716a447 100644 --- a/data/music/forest/forest_midday_alt.music +++ b/data/music/forest/forest_midday_alt.music @@ -1,5 +1,7 @@ (supertux-music (file "forest_midday_alt.ogg") + (authors "SnugglyBun" "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA 4.0") (loop-begin 7.215) (loop-at 101.053) ) diff --git a/data/music/forest/forest_theme.music b/data/music/forest/forest_theme.music index 1431a78002c..44d83df392e 100644 --- a/data/music/forest/forest_theme.music +++ b/data/music/forest/forest_theme.music @@ -1,5 +1,8 @@ (supertux-music (file "forest_theme.ogg") + (authors "Marek \"Wansti\" Moeckel" "Tobias \"ToBeFree\" Frei") + (license "CC-BY-SA / GPL 2+") + (title "Forest Prophecy reEducated") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/forest/ghostforest.music b/data/music/forest/ghostforest.music index 2bd02201995..a6f04756688 100644 --- a/data/music/forest/ghostforest.music +++ b/data/music/forest/ghostforest.music @@ -1,5 +1,8 @@ (supertux-music (file "ghostforest.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Ghost Forest") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/forest/ghostforest2.music b/data/music/forest/ghostforest2.music index 05e2ea58add..e3e4d90cf03 100644 --- a/data/music/forest/ghostforest2.music +++ b/data/music/forest/ghostforest2.music @@ -1,5 +1,8 @@ (supertux-music (file "ghostforest2.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Ghost Forest 2") (loop-begin 0) (loop-at 91) ) diff --git a/data/music/forest/ghostforest_map.music b/data/music/forest/ghostforest_map.music index 25b52953474..45c5e277824 100644 --- a/data/music/forest/ghostforest_map.music +++ b/data/music/forest/ghostforest_map.music @@ -1,5 +1,7 @@ (supertux-music (file "ghostforest_map.ogg") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at 236) ) \ No newline at end of file diff --git a/data/music/forest/greatgigantic.music b/data/music/forest/greatgigantic.music index 63dec8b0043..a45f548ffee 100644 --- a/data/music/forest/greatgigantic.music +++ b/data/music/forest/greatgigantic.music @@ -1,5 +1,8 @@ (supertux-music (file "greatgigantic.ogg") + (authors "Marek \"Wansti\" Moeckel" "Chris Huelsbeck") + (license "GPL") + (title "The Great Gigantic Secret (with kind permission from Chris Huelsbeck)") (loop-begin 0) (loop-at -1) ) diff --git a/data/music/forest/march_of_the_malevolent.music b/data/music/forest/march_of_the_malevolent.music index cd63e90034c..1dbff8a7c15 100644 --- a/data/music/forest/march_of_the_malevolent.music +++ b/data/music/forest/march_of_the_malevolent.music @@ -1,5 +1,8 @@ (supertux-music (file "march_of_the_malevolent.ogg") + (authors "Servalot" "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA 4.0") + (title "March of the Malevolent") (loop-begin 0) (loop-at 109.09) ) diff --git a/data/music/forest/new_forest_map.music b/data/music/forest/new_forest_map.music index e2b33054aa2..f6aa39eea1b 100644 --- a/data/music/forest/new_forest_map.music +++ b/data/music/forest/new_forest_map.music @@ -1,5 +1,7 @@ (supertux-music (file "new_forest_map.ogg") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") (loop-begin 0) (loop-at 105) ) diff --git a/data/music/forest/shallow-green.music b/data/music/forest/shallow-green.music index e18c84346b1..90fc7941d44 100644 --- a/data/music/forest/shallow-green.music +++ b/data/music/forest/shallow-green.music @@ -1,5 +1,8 @@ (supertux-music (file "shallow-green.ogg") + (authors "Jason Lavallée") + (license "CC-BY-SA / GPL 2+") + (title "Forest Stroll") (loop-begin 0) (loop-at 255) ) diff --git a/data/music/forest/treeboss.music b/data/music/forest/treeboss.music index a54cef0861e..73f488419ed 100644 --- a/data/music/forest/treeboss.music +++ b/data/music/forest/treeboss.music @@ -1,5 +1,7 @@ (supertux-music (file "treeboss.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") (loop-begin 32.15) (loop-at -1) ) diff --git a/data/music/forest/wisphunt.music b/data/music/forest/wisphunt.music index 70719bdea1b..11fe4781bc9 100644 --- a/data/music/forest/wisphunt.music +++ b/data/music/forest/wisphunt.music @@ -1,5 +1,7 @@ (supertux-music (file "wisphunt.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") (loop-begin 21.08) (loop-at -1) ) diff --git a/data/music/misc/battle_theme.music b/data/music/misc/battle_theme.music index 5c43b1ef269..c98dcb60825 100644 --- a/data/music/misc/battle_theme.music +++ b/data/music/misc/battle_theme.music @@ -1,5 +1,8 @@ (supertux-music (file "battle_theme.ogg") + (authors "remaxim") + (license "CC-BY-SA 3.0 / GPL 2+") + (title "Battle Theme") (loop-begin 30) (loop-at 200) ) diff --git a/data/music/misc/bonuscave.music b/data/music/misc/bonuscave.music index 456fc199678..0f20a3d673a 100644 --- a/data/music/misc/bonuscave.music +++ b/data/music/misc/bonuscave.music @@ -1,5 +1,8 @@ (supertux-music (file "bonuscave.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Bonus Cave") (loop-begin 0) (loop-at 10) ) diff --git a/data/music/misc/credits.music b/data/music/misc/credits.music index b5da39b9508..de0efcc0c58 100644 --- a/data/music/misc/credits.music +++ b/data/music/misc/credits.music @@ -1,5 +1,8 @@ (supertux-music (file "credits.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "SuperTux Credits Theme") (loop-begin 0) (loop-at 107) ) diff --git a/data/music/misc/halloween_1.music b/data/music/misc/halloween_1.music index 97a033bcfbb..d4992ed9d8e 100644 --- a/data/music/misc/halloween_1.music +++ b/data/music/misc/halloween_1.music @@ -1,5 +1,7 @@ (supertux-music (file "halloween_1.ogg") + (authors "Forty-Two") + (license "CC-BY-SA 4.0") (loop-begin 37.60) (loop-at 124.95) ) diff --git a/data/music/misc/intro.music b/data/music/misc/intro.music index da774dbaeb2..0aa56754fed 100644 --- a/data/music/misc/intro.music +++ b/data/music/misc/intro.music @@ -1,5 +1,8 @@ (supertux-music (file "intro.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Intro Theme") (loop-begin 0) (loop-at 34) ) diff --git a/data/music/misc/theme.music b/data/music/misc/theme.music index 36335bd0747..576a905f55f 100644 --- a/data/music/misc/theme.music +++ b/data/music/misc/theme.music @@ -1,5 +1,8 @@ (supertux-music (file "theme.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "SuperTux Theme (Milestone 2 Version)") (loop-begin 9) (loop-at 135) ) diff --git a/data/music/retro/cave_old.music b/data/music/retro/cave_old.music index d1eab70114e..76919ec7664 100644 --- a/data/music/retro/cave_old.music +++ b/data/music/retro/cave_old.music @@ -1,5 +1,8 @@ (supertux-music (file "cave_old.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Super Tux - The Cave") (loop-begin 0) (loop-at 77) ) diff --git a/data/music/retro/classic.music b/data/music/retro/classic.music index c4f62a06c77..4b085919e66 100644 --- a/data/music/retro/classic.music +++ b/data/music/retro/classic.music @@ -1,5 +1,6 @@ (supertux-music (file "classic.ogg") + (title "SuperTux 0.0.4 music") (loop-begin 0) (loop-at 97) ) diff --git a/data/music/retro/fortress_old.music b/data/music/retro/fortress_old.music index 1eaa3cfb4aa..2136e588c21 100644 --- a/data/music/retro/fortress_old.music +++ b/data/music/retro/fortress_old.music @@ -1,5 +1,8 @@ (supertux-music (file "fortress_old.ogg") + (authors "Marek \"Wansti\" Moeckel") + (license "CC-BY-SA / GPL 2+") + (title "Super Tux - Fortress") (loop-begin 0) (loop-at 46) ) diff --git a/data/music/retro/ice_music.music b/data/music/retro/ice_music.music index 9674125e0f8..0ace650a3ea 100644 --- a/data/music/retro/ice_music.music +++ b/data/music/retro/ice_music.music @@ -1,5 +1,7 @@ (supertux-music (file "ice_music.ogg") + (authors "ZhayTee") + (title "supertux ice level") (loop-begin 0) (loop-at 137) ) diff --git a/data/music/retro/worldmap_old.music b/data/music/retro/worldmap_old.music index 783038e679a..f6bf6e1f8c0 100644 --- a/data/music/retro/worldmap_old.music +++ b/data/music/retro/worldmap_old.music @@ -1,5 +1,7 @@ (supertux-music (file "worldmap_old.ogg") + (authors "ZhayTee") + (title "supertux title") (loop-begin 0) (loop-at 40) ) diff --git a/data/music/tropical/saharan_penguin.music b/data/music/tropical/saharan_penguin.music index dd61680eb9f..65905f510f9 100644 --- a/data/music/tropical/saharan_penguin.music +++ b/data/music/tropical/saharan_penguin.music @@ -1,5 +1,7 @@ (supertux-music (file "saharan_penguin.ogg") + (authors "Enol \"Meji\" Monte") + (license "CC-BY-SA") (loop-begin 0) (loop-at 96) ) diff --git a/data/music/tropical/tropicalbreeze.music b/data/music/tropical/tropicalbreeze.music index a6fa849ade8..626986a5bcb 100644 --- a/data/music/tropical/tropicalbreeze.music +++ b/data/music/tropical/tropicalbreeze.music @@ -1,5 +1,8 @@ (supertux-music (file "tropicalbreeze.ogg") + (authors "Flan") + (license "CC-BY-SA 4.0") + (title "Tropical Breeze") (loop-begin 0) (loop-at 73) ) diff --git a/src/audio/sound_file.cpp b/src/audio/sound_file.cpp index acb44a63304..2fabbe87922 100644 --- a/src/audio/sound_file.cpp +++ b/src/audio/sound_file.cpp @@ -84,14 +84,20 @@ std::unique_ptr load_music_file(const std::string& filename_original) throw SoundError(msg.str()); } auto format = SoundFile::get_file_format(file, raw_music_file); - if (format == SoundFile::FORMAT_WAV) - { - return std::make_unique(file); - } - else - { - return std::make_unique(file, loop_begin, loop_at); + + std::unique_ptr sound_file; + + if (format == SoundFile::FORMAT_WAV) { + sound_file = std::make_unique(file); + } else { + sound_file = std::make_unique(file, loop_begin, loop_at); } + + music.get("authors", sound_file->m_authors); + music.get("license", sound_file->m_license); + music.get("title", sound_file->m_title); + + return sound_file; } } @@ -157,6 +163,7 @@ SoundFile::get_file_format(PHYSFS_File* file, const std::string& filename) namespace { // List obtained with the help of sed: +// cd data/music // find | sort | sed 's:^\.:/music:; /\./ !d; s:\(.*/\)\([^/]*$\):{"\2", "\1\2"},:g' std::unordered_map fallback_paths = { {"airship_2.ogg", "/music/antarctic/airship_2.ogg"}, @@ -171,12 +178,36 @@ std::unordered_map fallback_paths = { {"bossattack.ogg", "/music/antarctic/bossattack.ogg"}, {"cave.music", "/music/antarctic/cave.music"}, {"cave.ogg", "/music/antarctic/cave.ogg"}, + {"cavetheme_alt.music", "/music/antarctic/cavetheme_alt.music"}, + {"cavetheme_alt.ogg", "/music/antarctic/cavetheme_alt.ogg"}, + {"cavetheme.music", "/music/antarctic/cavetheme.music"}, + {"cavetheme.ogg", "/music/antarctic/cavetheme.ogg"}, {"chipdisko.music", "/music/antarctic/chipdisko.music"}, {"chipdisko.ogg", "/music/antarctic/chipdisko.ogg"}, + {"crystalmine_intro.music", "/music/antarctic/crystalmine_intro.music"}, + {"crystalmine_intro.ogg", "/music/antarctic/crystalmine_intro.ogg"}, + {"crystalmine_main.music", "/music/antarctic/crystalmine_main.music"}, + {"crystalmine_main.ogg", "/music/antarctic/crystalmine_main.ogg"}, + {"glacier.music", "/music/antarctic/glacier.music"}, + {"glacier.ogg", "/music/antarctic/glacier.ogg"}, {"jewels.music", "/music/antarctic/jewels.music"}, {"jewels.ogg", "/music/antarctic/jewels.ogg"}, + {"midday_alt.music", "/music/antarctic/midday_alt.music"}, + {"midday_alt.ogg", "/music/antarctic/midday_alt.ogg"}, + {"midday.music", "/music/antarctic/midday.music"}, + {"midday.ogg", "/music/antarctic/midday.ogg"}, + {"night.music", "/music/antarctic/night.music"}, + {"night.ogg", "/music/antarctic/night.ogg"}, {"salcon.music", "/music/antarctic/salcon.music"}, {"salcon.ogg", "/music/antarctic/salcon.ogg"}, + {"skylevel.music", "/music/antarctic/skylevel.music"}, + {"skylevel.ogg", "/music/antarctic/skylevel.ogg"}, + {"snowfort.music", "/music/antarctic/snowfort.music"}, + {"snowfort.ogg", "/music/antarctic/snowfort.ogg"}, + {"sunset.music", "/music/antarctic/sunset.music"}, + {"sunset.ogg", "/music/antarctic/sunset.ogg"}, + {"underwater.music", "/music/antarctic/underwater.music"}, + {"underwater.ogg", "/music/antarctic/underwater.ogg"}, {"voc-boss.music", "/music/antarctic/voc-boss.music"}, {"voc-boss.ogg", "/music/antarctic/voc-boss.ogg"}, {"voc-dark.music", "/music/antarctic/voc-dark.music"}, @@ -187,14 +218,22 @@ std::unordered_map fallback_paths = { {"voc-daytime.ogg", "/music/antarctic/voc-daytime.ogg"}, {"voc-night.music", "/music/antarctic/voc-night.music"}, {"voc-night.ogg", "/music/antarctic/voc-night.ogg"}, + {"worldmap_ice.music", "/music/antarctic/worldmap_ice.music"}, + {"worldmap_ice.ogg", "/music/antarctic/worldmap_ice.ogg"}, + {"yetiboss.music", "/music/antarctic/yetiboss.music"}, + {"yetiboss.ogg", "/music/antarctic/yetiboss.ogg"}, {"darkforestkeep.music", "/music/castle/darkforestkeep.music"}, {"darkforestkeep.ogg", "/music/castle/darkforestkeep.ogg"}, {"fortress.music", "/music/castle/fortress.music"}, {"fortress.ogg", "/music/castle/fortress.ogg"}, + {"icecastle.music", "/music/castle/icecastle.music"}, + {"icecastle.ogg", "/music/castle/icecastle.ogg"}, {"beneath_the_rabbit_hole.music", "/music/forest/beneath_the_rabbit_hole.music"}, {"beneath_the_rabbit_hole.ogg", "/music/forest/beneath_the_rabbit_hole.ogg"}, {"bright_thunders.music", "/music/forest/bright_thunders.music"}, {"bright_thunders.ogg", "/music/forest/bright_thunders.ogg"}, + {"call_of_the_winding_path.music", "/music/forest/call_of_the_winding_path.music"}, + {"call_of_the_winding_path.ogg", "/music/forest/call_of_the_winding_path.ogg"}, {"clavelian_march.music", "/music/forest/clavelian_march.music"}, {"clavelian_march.ogg", "/music/forest/clavelian_march.ogg"}, {"forest2.music", "/music/forest/forest2.music"}, @@ -203,8 +242,10 @@ std::unordered_map fallback_paths = { {"forest3.ogg", "/music/forest/forest3.ogg"}, {"forest-cave.music", "/music/forest/forest-cave.music"}, {"forest-cave.ogg", "/music/forest/forest-cave.ogg"}, - {"forest-map.music", "/music/forest/forest-map.music"}, - {"forestmap.ogg", "/music/forest/forestmap.ogg"}, + {"forest_midday_alt.music", "/music/forest/forest_midday_alt.music"}, + {"forest_midday_alt.ogg", "/music/forest/forest_midday_alt.ogg"}, + {"forest_midday.music", "/music/forest/forest_midday.music"}, + {"forest_midday.ogg", "/music/forest/forest_midday.ogg"}, {"forest.music", "/music/forest/forest.music"}, {"forest.ogg", "/music/forest/forest.ogg"}, {"forest-sprint.music", "/music/forest/forest-sprint.music"}, @@ -219,6 +260,8 @@ std::unordered_map fallback_paths = { {"ghostforest.ogg", "/music/forest/ghostforest.ogg"}, {"greatgigantic.music", "/music/forest/greatgigantic.music"}, {"greatgigantic.ogg", "/music/forest/greatgigantic.ogg"}, + {"march_of_the_malevolent.music", "/music/forest/march_of_the_malevolent.music"}, + {"march_of_the_malevolent.ogg", "/music/forest/march_of_the_malevolent.ogg"}, {"new_forest_map.music", "/music/forest/new_forest_map.music"}, {"new_forest_map.ogg", "/music/forest/new_forest_map.ogg"}, {"shallow-green.music", "/music/forest/shallow-green.music"}, @@ -243,6 +286,20 @@ std::unordered_map fallback_paths = { {"leveldone.ogg", "/music/misc/leveldone.ogg"}, {"theme.music", "/music/misc/theme.music"}, {"theme.ogg", "/music/misc/theme.ogg"}, + {"cave_old.music", "/music/retro/cave_old.music"}, + {"cave_old.ogg", "/music/retro/cave_old.ogg"}, + {"classic.music", "/music/retro/classic.music"}, + {"classic.ogg", "/music/retro/classic.ogg"}, + {"fortress_old.music", "/music/retro/fortress_old.music"}, + {"fortress_old.ogg", "/music/retro/fortress_old.ogg"}, + {"ice_music.music", "/music/retro/ice_music.music"}, + {"ice_music.ogg", "/music/retro/ice_music.ogg"}, + {"worldmap_old.music", "/music/retro/worldmap_old.music"}, + {"worldmap_old.ogg", "/music/retro/worldmap_old.ogg"}, + {"saharan_penguin.music", "/music/tropical/saharan_penguin.music"}, + {"saharan_penguin.ogg", "/music/tropical/saharan_penguin.ogg"}, + {"tropicalbreeze.music", "/music/tropical/tropicalbreeze.music"}, + {"tropicalbreeze.ogg", "/music/tropical/tropicalbreeze.ogg"}, }; const std::string& get_fallback_path(const std::string& file_path) diff --git a/src/audio/sound_file.hpp b/src/audio/sound_file.hpp index 1dffb6fb04d..7e6761e3bbe 100644 --- a/src/audio/sound_file.hpp +++ b/src/audio/sound_file.hpp @@ -19,6 +19,7 @@ #include #include +#include struct PHYSFS_File; @@ -38,7 +39,10 @@ class SoundFile m_channels(), m_rate(), m_bits_per_sample(), - m_size() + m_size(), + m_authors(), + m_license(), + m_title() {} virtual ~SoundFile() {} @@ -52,6 +56,9 @@ class SoundFile int m_bits_per_sample; /// size in bytes size_t m_size; + std::vector m_authors; + std::string m_license; + std::string m_title; private: SoundFile(const SoundFile&) = delete; diff --git a/src/editor/object_option.cpp b/src/editor/object_option.cpp index 06f70b2bfa7..1ac2497ef5b 100644 --- a/src/editor/object_option.cpp +++ b/src/editor/object_option.cpp @@ -406,12 +406,14 @@ FileObjectOption::FileObjectOption(const std::string& text, std::string* pointer std::vector filter, const std::string& basedir, bool path_relative_to_basedir, - unsigned int flags) : + unsigned int flags, + const std::function item_processor) : ObjectOption(text, key, flags, pointer), m_default_value(std::move(default_value)), m_filter(std::move(filter)), m_basedir(basedir), - m_path_relative_to_basedir(path_relative_to_basedir) + m_path_relative_to_basedir(path_relative_to_basedir), + m_item_processor(item_processor) { } @@ -440,7 +442,7 @@ FileObjectOption::to_string() const void FileObjectOption::add_to_menu(Menu& menu) const { - menu.add_file(get_text(), m_value_pointer, m_filter, m_basedir, m_path_relative_to_basedir); + menu.add_file(get_text(), m_value_pointer, m_filter, m_basedir, m_path_relative_to_basedir, m_item_processor, -1); } ColorObjectOption::ColorObjectOption(const std::string& text, Color* pointer, const std::string& key, diff --git a/src/editor/object_option.hpp b/src/editor/object_option.hpp index ede074fc842..8f2cf2c7996 100644 --- a/src/editor/object_option.hpp +++ b/src/editor/object_option.hpp @@ -24,6 +24,7 @@ #include #include "gui/menu_action.hpp" +#include "gui/menu_item.hpp" #include "object/path_walker.hpp" #include "video/color.hpp" @@ -286,7 +287,8 @@ class FileObjectOption final : public ObjectOption std::vector filter, const std::string& basedir, bool path_relative_to_basedir, - unsigned int flags); + unsigned int flags, + const std::function item_processor = {}); virtual void save(Writer& write) const override; virtual std::string to_string() const override; @@ -297,6 +299,7 @@ class FileObjectOption final : public ObjectOption const std::vector m_filter; std::string m_basedir; bool m_path_relative_to_basedir; + const std::function m_item_processor; private: FileObjectOption(const FileObjectOption&) = delete; diff --git a/src/editor/object_settings.cpp b/src/editor/object_settings.cpp index 45ee96e4ca2..3555eac2a54 100644 --- a/src/editor/object_settings.cpp +++ b/src/editor/object_settings.cpp @@ -19,6 +19,7 @@ #include #include +#include "gui/menu_filesystem_item_processor_music_help.hpp" #include "util/gettext.hpp" #include "video/color.hpp" @@ -219,9 +220,10 @@ ObjectSettings::add_file(const std::string& text, std::string* value_ptr, const std::vector& filter, const std::string& basedir, bool path_relative_to_basedir, - unsigned int flags) + unsigned int flags, + const std::function item_processor) { - add_option(std::make_unique(text, value_ptr, default_value, key, filter, basedir, path_relative_to_basedir, flags)); + add_option(std::make_unique(text, value_ptr, default_value, key, filter, basedir, path_relative_to_basedir, flags, item_processor)); } void @@ -294,7 +296,7 @@ ObjectSettings::add_music(const std::string& text, std::string* value_ptr, std::optional default_value, unsigned int flags) { - add_file(text, value_ptr, key, std::move(default_value), {".music"}, {"/music"}, false, flags); + add_file(text, value_ptr, key, std::move(default_value), {".music"}, {"/music"}, false, flags, item_processor_music_help); } void diff --git a/src/editor/object_settings.hpp b/src/editor/object_settings.hpp index b9ba078d970..dbd980e442d 100644 --- a/src/editor/object_settings.hpp +++ b/src/editor/object_settings.hpp @@ -22,6 +22,7 @@ #include #include "editor/object_option.hpp" +#include "gui/menu_item.hpp" #include "object/path_walker.hpp" class Color; @@ -145,7 +146,8 @@ class ObjectSettings final const std::vector& filter = {}, const std::string& basedir = {}, bool path_relative_to_basedir = true, - unsigned int flags = 0); + unsigned int flags = 0, + const std::function item_processor = {}); void add_sexp(const std::string& text, const std::string& key, sexp::Value& value, unsigned int flags = 0); void add_string_array(const std::string& text, const std::string& key, std::vector& items); diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index 8c235b05dcf..f441b9a8a53 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -16,6 +16,7 @@ #include "gui/menu.hpp" +#include "audio/sound_file.hpp" #include "control/input_manager.hpp" #include "gui/item_action.hpp" #include "gui/item_back.hpp" @@ -47,6 +48,7 @@ #include "supertux/gameconfig.hpp" #include "supertux/globals.hpp" #include "supertux/resources.hpp" +#include "util/file_system.hpp" #include "video/drawing_context.hpp" #include "video/renderer.hpp" #include "video/video_system.hpp" @@ -54,6 +56,8 @@ #include "supertux/error_handler.hpp" +static const float HELP_MARGIN_Y = 16.f; + Menu::Menu() : m_pos(Vector(static_cast(SCREEN_WIDTH) / 2.0f, static_cast(SCREEN_HEIGHT) / 2.0f)), @@ -239,7 +243,7 @@ Menu::add_string_select(int id, const std::string& text, int default_item, const ItemAction& Menu::add_file(const std::string& text, std::string* input, const std::vector& extensions, const std::string& basedir, bool path_relative_to_basedir, - const std::function& item_processor, int id) + const std::function item_processor, int id) { return add_item(text, id, [input, extensions, basedir, path_relative_to_basedir, item_processor]() @@ -522,9 +526,9 @@ Menu::draw(DrawingContext& context) const int text_height = static_cast(Resources::normal_font->get_text_height(m_items[m_active_item]->get_help())); const Rectf text_rect(m_pos.x - static_cast(text_width) / 2.0f - 8.0f, - static_cast(SCREEN_HEIGHT) - 48.0f - static_cast(text_height) / 2.0f - 4.0f, + static_cast(SCREEN_HEIGHT) - HELP_MARGIN_Y - static_cast(text_height) - 4.0f, m_pos.x + static_cast(text_width) / 2.0f + 8.0f, - static_cast(SCREEN_HEIGHT) - 48.0f + static_cast(text_height) / 2.0f + 4.0f); + static_cast(SCREEN_HEIGHT) - HELP_MARGIN_Y + 4.0f); context.color().draw_filled_rect(Rectf(text_rect.p1() - Vector(4,4), text_rect.p2() + Vector(4,4)), @@ -538,7 +542,7 @@ Menu::draw(DrawingContext& context) LAYER_GUI); context.color().draw_text(Resources::normal_font, m_items[m_active_item]->get_help(), - Vector(m_pos.x, static_cast(SCREEN_HEIGHT) - 48.0f - static_cast(text_height) / 2.0f), + Vector(m_pos.x, static_cast(SCREEN_HEIGHT) - HELP_MARGIN_Y - static_cast(text_height)), ALIGN_CENTER, LAYER_GUI); } } diff --git a/src/gui/menu.hpp b/src/gui/menu.hpp index 0e0a1d05053..a861ab13725 100644 --- a/src/gui/menu.hpp +++ b/src/gui/menu.hpp @@ -96,7 +96,8 @@ class Menu ItemFloatField& add_floatfield(const std::string& text, float* input, int id = -1, bool positive = false); ItemAction& add_file(const std::string& text, std::string* input, const std::vector& extensions, const std::string& basedir, bool path_relative_to_basedir, - const std::function& item_processor = {}, int id = -1); + const std::function item_processor = {}, + int id = -1); ItemColor& add_color(const std::string& text, Color* color, int id = -1); ItemColorDisplay& add_color_display(Color* color, int id = -1); diff --git a/src/gui/menu_filesystem.cpp b/src/gui/menu_filesystem.cpp index 31c1e683a91..43c5b403411 100644 --- a/src/gui/menu_filesystem.cpp +++ b/src/gui/menu_filesystem.cpp @@ -29,8 +29,9 @@ #include "util/string_util.hpp" FileSystemMenu::FileSystemMenu(std::string* filename, const std::vector& extensions, - const std::string& basedir, bool path_relative_to_basedir, std::function callback, - const std::function& item_processor) : + const std::string& basedir, bool path_relative_to_basedir, + std::function callback, + const std::function item_processor) : m_filename(filename), // when a basedir is given, 'filename' is relative to basedir, so // it's useless as a starting point @@ -107,9 +108,10 @@ FileSystemMenu::refresh_items() const bool in_basedir = m_directory == FileSystem::normalize(m_basedir); for (const auto& item : m_files) { + std::string file_path = FileSystem::join(m_directory, item); MenuItem& menu_item = add_entry(item_id, item); - if (in_basedir && m_item_processor) - m_item_processor(menu_item); + if (m_item_processor) + m_item_processor(menu_item, file_path, in_basedir); item_id++; } diff --git a/src/gui/menu_filesystem.hpp b/src/gui/menu_filesystem.hpp index 5143b9ce29e..16ff21cc300 100644 --- a/src/gui/menu_filesystem.hpp +++ b/src/gui/menu_filesystem.hpp @@ -24,7 +24,7 @@ class FileSystemMenu final : public Menu public: FileSystemMenu(std::string* filename, const std::vector& extensions, const std::string& basedir, bool path_relative_to_basedir, const std::function callback = nullptr, - const std::function& item_processor = {}); + const std::function item_processor = {}); ~FileSystemMenu() override; void menu_action(MenuItem& item) override; @@ -42,7 +42,7 @@ class FileSystemMenu final : public Menu std::vector m_files; bool m_path_relative_to_basedir; std::function m_callback; - std::function m_item_processor; + std::function m_item_processor; private: FileSystemMenu(const FileSystemMenu&) = delete; diff --git a/src/gui/menu_filesystem_item_processor_music_help.cpp b/src/gui/menu_filesystem_item_processor_music_help.cpp new file mode 100644 index 00000000000..facb61fe9e7 --- /dev/null +++ b/src/gui/menu_filesystem_item_processor_music_help.cpp @@ -0,0 +1,60 @@ +// SuperTux +// Copyright (C) 2024 James De Ricco +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "gui/menu_filesystem_item_processor_music_help.hpp" + +#include "fmt/format.h" +#include "util/file_system.hpp" +#include "util/gettext.hpp" + +void item_processor_music_help(MenuItem& menu_item, const std::string& file_path, bool in_basedir) { + std::unique_ptr sound_file; + try { + sound_file = load_sound_file(file_path); + } catch (...) { + menu_item.set_help(""); + return; + } + + const std::vector& authors = sound_file->m_authors; + const std::string& license = sound_file->m_license; + const std::string& title = sound_file->m_title; + + if (title.empty() && authors.empty() && license.empty()) { + menu_item.set_help(""); + return; + } + + const std::string filename = FileSystem::basename(file_path); + const std::string title_or_filename_line = title.empty() ? filename : "\"" + title + "\""; // assumes path is just a filename + + std::string author_lines = ""; + + for (const std::string& author : authors) { + author_lines.append("\n" + fmt::format(fmt::runtime(_("Author") +": {}"), author)); + } + + const std::string license_line = fmt::format(fmt::runtime(_("License") + ": {}"), license); + + const std::string help_text = + title_or_filename_line + + author_lines + + (license.empty() ? "" : "\n" + license_line); + + menu_item.set_help(help_text); +} + +/* EOF */ diff --git a/src/gui/menu_filesystem_item_processor_music_help.hpp b/src/gui/menu_filesystem_item_processor_music_help.hpp new file mode 100644 index 00000000000..5315adc43bc --- /dev/null +++ b/src/gui/menu_filesystem_item_processor_music_help.hpp @@ -0,0 +1,27 @@ +// SuperTux +// Copyright (C) 2024 James De Ricco +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#ifndef HEADER_SUPERTUX_GUI_MENU_FILESYSTEM_ITEM_PROCESSOR_MUSIC_HELP_HPP +#define HEADER_SUPERTUX_GUI_MENU_FILESYSTEM_ITEM_PROCESSOR_MUSIC_HELP_HPP + +#include "audio/sound_file.hpp" +#include "gui/menu_item.hpp" + +void item_processor_music_help(MenuItem& menu_item, const std::string& file_path, bool in_basedir); + +#endif + +/* EOF */ diff --git a/src/supertux/menu/editor_converters_menu.cpp b/src/supertux/menu/editor_converters_menu.cpp index 0cf10cc4402..5853aa561b3 100644 --- a/src/supertux/menu/editor_converters_menu.cpp +++ b/src/supertux/menu/editor_converters_menu.cpp @@ -62,15 +62,17 @@ EditorConvertersMenu::EditorConvertersMenu() : add_hl(); add_file(_("Select Tile Conversion File"), &m_tile_conversion_file, { "sttc" }, "images/converters", false, - [this](MenuItem& item) { - auto it = m_converters.find(item.get_text()); - if (it == m_converters.end()) - return; - - item.set_text("\"" + it->second.title + "\""); - item.set_help(it->second.description + (it->second.author.empty() ? "" : - "\n\n" + fmt::format(fmt::runtime(_("By: {}")), it->second.author))); - }); + [this](MenuItem& item, const std::string& file_path, bool in_basedir) { + if (in_basedir) { + std::string basename = FileSystem::basename(file_path); + auto it = m_converters.find(basename); + if (it == m_converters.end()) + return; + + item.set_text("\"" + it->second.title + "\""); + item.set_help(it->second.description + (it->second.author.empty() ? "" : + "\n\n" + fmt::format(fmt::runtime(_("By: {}")), it->second.author))); + }}); add_entry(MNID_CONVERT_TILES, _("Convert Tiles By File")) .set_help(_("Convert all tiles in the current level by a file, specified above."));