From: Holger Schemel Date: Mon, 2 Mar 2015 22:33:57 +0000 (+0100) Subject: added manually edited non-preset audio volume values to select list X-Git-Tag: 4.0.0.0-rc1~258 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=3e6bcc5592d355bc582383b36566d08dd451aba9 added manually edited non-preset audio volume values to select list --- diff --git a/ChangeLog b/ChangeLog index d0f69ab6..ee347ccb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * added classic level sets to git repository * added element description files to git repository * changed mouse cursor on title screens not being always invisible + * added manually edited non-preset audio volume values to select list + (if sound, loops or music volume was manually edited in "setup.conf") 2015-02-27 * fixed using "background.TOOLBOX", which was simply ignored before diff --git a/src/screens.c b/src/screens.c index d7a2b63e..fe5f60a0 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4352,6 +4352,7 @@ static void execSetupSound() { if (volumes_simple == NULL) { + boolean current_volume_simple_found = FALSE; int i; for (i = 0; volumes_list[i].value != -1; i++) @@ -4373,6 +4374,31 @@ static void execSetupSound() setString(&ti->infotext, "Sound Volume"); pushTreeInfo(&volumes_simple, ti); + + if (value == setup.volume_simple) + current_volume_simple_found = TRUE; + } + + if (!current_volume_simple_found) + { + // add entry for non-preset volume value + + TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED); + char identifier[32], name[32]; + int value = setup.volume_simple; + + ti->node_top = &volumes_simple; + ti->sort_priority = value; + + sprintf(identifier, "%d", value); + sprintf(name, "%d %% (Current)", value); + + setString(&ti->identifier, identifier); + setString(&ti->name, name); + setString(&ti->name_sorting, name); + setString(&ti->infotext, "Sound Volume"); + + pushTreeInfo(&volumes_simple, ti); } /* sort volume values to start with lowest volume value */ @@ -4394,6 +4420,7 @@ static void execSetupSound() if (volumes_loops == NULL) { + boolean current_volume_loops_found = FALSE; int i; for (i = 0; volumes_list[i].value != -1; i++) @@ -4415,6 +4442,31 @@ static void execSetupSound() setString(&ti->infotext, "Loops Volume"); pushTreeInfo(&volumes_loops, ti); + + if (value == setup.volume_loops) + current_volume_loops_found = TRUE; + } + + if (!current_volume_loops_found) + { + // add entry for non-preset volume value + + TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED); + char identifier[32], name[32]; + int value = setup.volume_loops; + + ti->node_top = &volumes_loops; + ti->sort_priority = value; + + sprintf(identifier, "%d", value); + sprintf(name, "%d %% (Current)", value); + + setString(&ti->identifier, identifier); + setString(&ti->name, name); + setString(&ti->name_sorting, name); + setString(&ti->infotext, "Loops Volume"); + + pushTreeInfo(&volumes_loops, ti); } /* sort volume values to start with lowest volume value */ @@ -4436,6 +4488,7 @@ static void execSetupSound() if (volumes_music == NULL) { + boolean current_volume_music_found = FALSE; int i; for (i = 0; volumes_list[i].value != -1; i++) @@ -4457,6 +4510,31 @@ static void execSetupSound() setString(&ti->infotext, "Music Volume"); pushTreeInfo(&volumes_music, ti); + + if (value == setup.volume_music) + current_volume_music_found = TRUE; + } + + if (!current_volume_music_found) + { + // add entry for non-preset volume value + + TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED); + char identifier[32], name[32]; + int value = setup.volume_music; + + ti->node_top = &volumes_music; + ti->sort_priority = value; + + sprintf(identifier, "%d", value); + sprintf(name, "%d %% (Current)", value); + + setString(&ti->identifier, identifier); + setString(&ti->name, name); + setString(&ti->name_sorting, name); + setString(&ti->infotext, "Music Volume"); + + pushTreeInfo(&volumes_music, ti); } /* sort volume values to start with lowest volume value */