hedgewars/hwengine.dpr
changeset 564 17fb45c670c1
parent 529 812682c1ab62
child 565 092cb8deffc5
equal deleted inserted replaced
563:5131c641073f 564:17fb45c670c1
    61 
    61 
    62 procedure OnDestroy; forward;
    62 procedure OnDestroy; forward;
    63 
    63 
    64 ////////////////////////////////
    64 ////////////////////////////////
    65 procedure DoTimer(Lag: LongInt);
    65 procedure DoTimer(Lag: LongInt);
       
    66 const MusicTimerTicks: Longword = 0;
    66 var s: string;
    67 var s: string;
    67 begin
    68 begin
       
    69 inc(RealTicks, Lag);
       
    70 
       
    71 inc(MusicTimerTicks, Lag);
       
    72 if MusicTimerTicks > 3000 then
       
    73    begin
       
    74    PlayMusic;
       
    75    MusicTimerTicks:= 0
       
    76    end;
       
    77 
    68 case GameState of
    78 case GameState of
    69    gsLandGen: begin
    79    gsLandGen: begin
    70               GenMap;
    80               GenMap;
    71               GameState:= gsStart;
    81               GameState:= gsStart;
    72               end;
    82               end;
    78               AdjustColor(cWhiteColor);
    88               AdjustColor(cWhiteColor);
    79               StoreLoad;
    89               StoreLoad;
    80               AdjustColor(cConsoleSplitterColor);
    90               AdjustColor(cConsoleSplitterColor);
    81               ResetKbd;
    91               ResetKbd;
    82               SoundLoad;
    92               SoundLoad;
    83               PlayMusic;
    93               InitPlaylistChunk(GetRandom(High(LongWord)));
    84               if GameType = gmtSave then
    94               if GameType = gmtSave then
    85                  begin
    95                  begin
    86                  isSEBackup:= isSoundEnabled;
    96                  isSEBackup:= isSoundEnabled;
    87                  isSoundEnabled:= false
    97                  isSoundEnabled:= false
    88                  end;
    98                  end;
   101               end;
   111               end;
   102      gsExit : begin
   112      gsExit : begin
   103               OnDestroy;
   113               OnDestroy;
   104               end;
   114               end;
   105      end;
   115      end;
       
   116 
   106 SDL_Flip(SDLPrimSurface);
   117 SDL_Flip(SDLPrimSurface);
   107 if flagMakeCapture then
   118 if flagMakeCapture then
   108    begin
   119    begin
   109    flagMakeCapture:= false;
   120    flagMakeCapture:= false;
   110    s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.bmp';
   121    s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.bmp';