hedgewars/hwengine.dpr
changeset 564 17fb45c670c1
parent 529 812682c1ab62
child 565 092cb8deffc5
--- a/hedgewars/hwengine.dpr	Fri Jul 20 13:46:27 2007 +0000
+++ b/hedgewars/hwengine.dpr	Fri Jul 20 19:04:24 2007 +0000
@@ -63,8 +63,18 @@
 
 ////////////////////////////////
 procedure DoTimer(Lag: LongInt);
+const MusicTimerTicks: Longword = 0;
 var s: string;
 begin
+inc(RealTicks, Lag);
+
+inc(MusicTimerTicks, Lag);
+if MusicTimerTicks > 3000 then
+   begin
+   PlayMusic;
+   MusicTimerTicks:= 0
+   end;
+
 case GameState of
    gsLandGen: begin
               GenMap;
@@ -80,7 +90,7 @@
               AdjustColor(cConsoleSplitterColor);
               ResetKbd;
               SoundLoad;
-              PlayMusic;
+              InitPlaylistChunk(GetRandom(High(LongWord)));
               if GameType = gmtSave then
                  begin
                  isSEBackup:= isSoundEnabled;
@@ -103,6 +113,7 @@
               OnDestroy;
               end;
      end;
+
 SDL_Flip(SDLPrimSurface);
 if flagMakeCapture then
    begin