Attempt to use Mix_SetMusicPosition to speed up MOD music. (Not very good)
[supertux.git] / src / gameloop.c
index f8ed6e5..e65180e 100644 (file)
@@ -123,6 +123,8 @@ char song_title[20];
 char levelname[20];
 char leveltheme[20];
 char str[10];
+int sound_pos;
+
 
 /* Local function prototypes: */
 
@@ -1121,10 +1123,28 @@ int game_action(void)
           current_music = LEVEL_MUSIC;
           halt_music();
         }
+
       if (!playing_music())
+      {
         play_music( level_song, 1 );
+       sound_pos = 0;
+      }
+      
       if (tux_invincible_time > 0)
         tux_invincible_time--;
+
+      if (current_music == LEVEL_MUSIC && time_left < 250)
+      {
+       if ((frame % 10) == 0)
+       {
+         set_music_position(sound_pos);
+         sound_pos++;
+       }
+      }
+      else
+      {
+       sound_pos = 0;
+      }
     }