hedgewars/hwengine.pas
changeset 7392 bc3306c59a08
parent 7386 e82a076df09b
child 7442 9bb6abdb5675
equal deleted inserted replaced
7390:27bfd8bbde7e 7392:bc3306c59a08
    80             ScriptCall('onGameStart');
    80             ScriptCall('onGameStart');
    81             GameState:= gsGame;
    81             GameState:= gsGame;
    82             end;
    82             end;
    83         gsConfirm, gsGame:
    83         gsConfirm, gsGame:
    84             begin
    84             begin
       
    85             DrawWorld(Lag);
    85             DoGameTick(Lag);
    86             DoGameTick(Lag);
    86             ProcessVisualGears(Lag);
    87             ProcessVisualGears(Lag);
    87             DrawWorld(Lag);
       
    88             end;
    88             end;
    89         gsChat:
    89         gsChat:
    90             begin
    90             begin
       
    91             DrawWorld(Lag);
    91             DoGameTick(Lag);
    92             DoGameTick(Lag);
    92             ProcessVisualGears(Lag);
    93             ProcessVisualGears(Lag);
    93             DrawWorld(Lag);
       
    94             end;
    94             end;
    95         gsExit:
    95         gsExit:
    96             begin
    96             begin
    97             DoTimer:= true;
    97             DoTimer:= true;
    98             end;
    98             end;
   271     end;
   271     end;
   272 end;
   272 end;
   273 
   273 
   274 {$IFDEF USE_VIDEO_RECORDING}
   274 {$IFDEF USE_VIDEO_RECORDING}
   275 procedure RecorderMainLoop;
   275 procedure RecorderMainLoop;
   276 var CurrTime, PrevTime: LongInt;
   276 var oldGameTicks, oldRealTicks, newGameTicks, newRealTicks: LongInt;
   277 begin
   277 begin
   278     if not BeginVideoRecording() then
   278     if not BeginVideoRecording() then
   279         exit;
   279         exit;
   280     DoTimer(0); // gsLandGen -> gsStart
   280     DoTimer(0); // gsLandGen -> gsStart
   281     DoTimer(0); // gsStart -> gsGame
   281     DoTimer(0); // gsStart -> gsGame
   282 
   282 
   283     CurrTime:= LoadNextCameraPosition();
   283     if not LoadNextCameraPosition(newRealTicks, newGameTicks) then
       
   284         exit;
   284     fastScrolling:= true;
   285     fastScrolling:= true;
   285     DoTimer(CurrTime);
   286     DoGameTick(newGameTicks);
   286     fastScrolling:= false;
   287     fastScrolling:= false;
   287     while true do
   288     oldRealTicks:= 0;
       
   289     oldGameTicks:= newGameTicks;
       
   290 
       
   291     while LoadNextCameraPosition(newRealTicks, newGameTicks) do
   288     begin
   292     begin
       
   293         IPCCheckSock();
       
   294         DoGameTick(newGameTicks - oldGameTicks);
       
   295         if GameState = gsExit then
       
   296             break;
       
   297         ProcessVisualGears(newRealTicks - oldRealTicks);
       
   298         DrawWorld(newRealTicks - oldRealTicks);
   289         EncodeFrame();
   299         EncodeFrame();
   290         PrevTime:= CurrTime;
   300         oldRealTicks:= newRealTicks;
   291         CurrTime:= LoadNextCameraPosition();
   301         oldGameTicks:= newGameTicks;
   292         if CurrTime = -1 then
       
   293             break;
       
   294         if DoTimer(CurrTime - PrevTime) then
       
   295             break;
       
   296         IPCCheckSock();
       
   297     end;
   302     end;
   298     StopVideoRecording();
   303     StopVideoRecording();
   299 end;
   304 end;
   300 {$ENDIF}
   305 {$ENDIF}
   301 
   306