update audio randomizer
authorhgn <hgodden00@gmail.com>
Sat, 23 Oct 2021 16:55:31 +0000 (17:55 +0100)
committerhgn <hgodden00@gmail.com>
Sat, 23 Oct 2021 16:55:31 +0000 (17:55 +0100)
13 files changed:
fishladder.c
sound/mod00.ogg [deleted file]
sound/mod01.ogg [deleted file]
sound/mod02.ogg [deleted file]
sound/mod03.ogg [deleted file]
sound/mod04.ogg [deleted file]
sound/mod_01.ogg [new file with mode: 0644]
sound/mod_02.ogg [new file with mode: 0644]
sound/mod_03.ogg [new file with mode: 0644]
sound/mod_04.ogg [new file with mode: 0644]
sound/mod_05.ogg [new file with mode: 0644]
sound/mod_06.ogg [new file with mode: 0644]
vg/vg_audio.h

index 6d6486be3cbb1741602233b1a25505594dfb1141..b8fbb2a452fb3a93ce78358b5f2305c76a8fdb40 100644 (file)
@@ -193,10 +193,12 @@ sfx_system_t audio_system_sfx =
 sfx_set_t audio_tile_mod = 
 {
  .sources = "\
-sound/mod00.ogg\0\
-sound/mod01.ogg\0\
-sound/mod02.ogg\0\
-sound/mod03.ogg\0",
+sound/mod_01.ogg\0\
+sound/mod_02.ogg\0\
+sound/mod_03.ogg\0\
+sound/mod_04.ogg\0\
+sound/mod_05.ogg\0\
+sound/mod_06.ogg\0",
  .flags = 0
 };
 
@@ -728,7 +730,11 @@ void vg_update(void)
                        if( vg_get_button_down("primary") )
                        {
                                world.data[ world.selected ].state ^= FLAG_CANAL;
-                               sfx_set_playrnd( &audio_tile_mod, &audio_system_sfx );
+                               
+                               if( world.data[ world.selected ].state & FLAG_CANAL )
+                                       sfx_set_playrnd( &audio_tile_mod, &audio_system_sfx, 3, 6 );
+                               else
+                                       sfx_set_playrnd( &audio_tile_mod, &audio_system_sfx, 0, 3 );
                        }
                }
                else
diff --git a/sound/mod00.ogg b/sound/mod00.ogg
deleted file mode 100644 (file)
index 0e98c8a..0000000
Binary files a/sound/mod00.ogg and /dev/null differ
diff --git a/sound/mod01.ogg b/sound/mod01.ogg
deleted file mode 100644 (file)
index 07cbae6..0000000
Binary files a/sound/mod01.ogg and /dev/null differ
diff --git a/sound/mod02.ogg b/sound/mod02.ogg
deleted file mode 100644 (file)
index 43d1bc0..0000000
Binary files a/sound/mod02.ogg and /dev/null differ
diff --git a/sound/mod03.ogg b/sound/mod03.ogg
deleted file mode 100644 (file)
index f0866d0..0000000
Binary files a/sound/mod03.ogg and /dev/null differ
diff --git a/sound/mod04.ogg b/sound/mod04.ogg
deleted file mode 100644 (file)
index 0ecf86c..0000000
Binary files a/sound/mod04.ogg and /dev/null differ
diff --git a/sound/mod_01.ogg b/sound/mod_01.ogg
new file mode 100644 (file)
index 0000000..7c4b24e
Binary files /dev/null and b/sound/mod_01.ogg differ
diff --git a/sound/mod_02.ogg b/sound/mod_02.ogg
new file mode 100644 (file)
index 0000000..a340f18
Binary files /dev/null and b/sound/mod_02.ogg differ
diff --git a/sound/mod_03.ogg b/sound/mod_03.ogg
new file mode 100644 (file)
index 0000000..7314564
Binary files /dev/null and b/sound/mod_03.ogg differ
diff --git a/sound/mod_04.ogg b/sound/mod_04.ogg
new file mode 100644 (file)
index 0000000..01ff4ba
Binary files /dev/null and b/sound/mod_04.ogg differ
diff --git a/sound/mod_05.ogg b/sound/mod_05.ogg
new file mode 100644 (file)
index 0000000..f48c52d
Binary files /dev/null and b/sound/mod_05.ogg differ
diff --git a/sound/mod_06.ogg b/sound/mod_06.ogg
new file mode 100644 (file)
index 0000000..f8b67a4
Binary files /dev/null and b/sound/mod_06.ogg differ
index 330be30a17319588d572247737d2ff3aa3231905..6d797717f5c7bf77987e8b011645707a9a93b40a 100644 (file)
@@ -668,15 +668,15 @@ void sfx_set_init( sfx_set_t *dest, char *sources )
 }
 
 // Pick a random sound from the buffer and play it into system
-void sfx_set_playrnd( sfx_set_t *source, sfx_system_t *sys )
+void sfx_set_playrnd( sfx_set_t *source, sfx_system_t *sys, int min_id, int max_id )
 {
        if( !source->numsegments )
        {
                return;
        }
 
-       int pick = rand() % source->numsegments;
-       
+       int pick = (rand() % (max_id-min_id)) + min_id;
+
        sys->source = source->main;
        sys->cur        = source->segments[ pick*2 + 0 ];
        sys->end        = source->segments[ pick*2 + 1 ];