From: Holger Schemel Date: Thu, 1 Jun 2023 21:22:37 +0000 (+0200) Subject: added options "played_header" and "played" to music file info X-Git-Tag: 4.3.7.0~52 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0de8deae39ba2513085fda971cd122542b8d946b;p=rocksndiamonds.git added options "played_header" and "played" to music file info If option "played" is specified in the music file info, it overrides a potentially detected level number to be displayed for this option. The option "played_header" can be used to replace the text "played in" with a different header text. --- diff --git a/src/files.c b/src/files.c index 47dfe119..c934db0f 100644 --- a/src/files.c +++ b/src/files.c @@ -12839,11 +12839,13 @@ static struct MusicFileInfo *get_music_file_info_ext(char *basename, int music, { "artist_header", &tmp_music_file_info.artist_header }, { "album_header", &tmp_music_file_info.album_header }, { "year_header", &tmp_music_file_info.year_header }, + { "played_header", &tmp_music_file_info.played_header }, { "title", &tmp_music_file_info.title }, { "artist", &tmp_music_file_info.artist }, { "album", &tmp_music_file_info.album }, { "year", &tmp_music_file_info.year }, + { "played", &tmp_music_file_info.played }, { NULL, NULL }, }; @@ -12957,11 +12959,13 @@ void LoadMusicInfo(void) checked_free(music_file_info->artist_header); checked_free(music_file_info->album_header); checked_free(music_file_info->year_header); + checked_free(music_file_info->played_header); checked_free(music_file_info->title); checked_free(music_file_info->artist); checked_free(music_file_info->album); checked_free(music_file_info->year); + checked_free(music_file_info->played); free(music_file_info); diff --git a/src/main.h b/src/main.h index a107a65e..dc4ea9ac 100644 --- a/src/main.h +++ b/src/main.h @@ -3779,11 +3779,13 @@ struct MusicFileInfo char *artist_header; char *album_header; char *year_header; + char *played_header; char *title; char *artist; char *album; char *year; + char *played; int music; diff --git a/src/screens.c b/src/screens.c index a7e16439..d48ba4ec 100644 --- a/src/screens.c +++ b/src/screens.c @@ -3595,11 +3595,23 @@ void HandleInfoScreen_Music(int dx, int dy, int button) ystart += ystep_head; } - int music_level_nr = -1; - int i; + if (!strEqual(list->played, UNKNOWN_NAME)) + { + if (!strEqual(list->played_header, UNKNOWN_NAME)) + DrawTextSCentered(ystart, font_head, list->played_header); + else + DrawTextSCentered(ystart, font_head, "played in"); - if (!list->is_sound) + ystart += ystep_head; + + DrawTextFCentered(ystart, font_text, "%s", list->played); + ystart += ystep_head; + } + else if (!list->is_sound) { + int music_level_nr = -1; + int i; + // check if this music is configured for a certain level for (i = leveldir_current->first_level; i <= leveldir_current->last_level; i++) @@ -3616,7 +3628,11 @@ void HandleInfoScreen_Music(int dx, int dy, int button) if (music_level_nr != -1) { - DrawTextSCentered(ystart, font_head, "played in"); + if (!strEqual(list->played_header, UNKNOWN_NAME)) + DrawTextSCentered(ystart, font_head, list->played_header); + else + DrawTextSCentered(ystart, font_head, "played in"); + ystart += ystep_head; DrawTextFCentered(ystart, font_text, "level %03d", music_level_nr);