hedgewars/hwengine.pas
changeset 3449 033e4a8a9c74
parent 3444 9d501dc22f71
child 3463 23c50be687a9
equal deleted inserted replaced
3448:b79908461a11 3449:033e4a8a9c74
    88 procedure DoTimer(Lag: LongInt);
    88 procedure DoTimer(Lag: LongInt);
    89 {$IFNDEF IPHONEOS}
    89 {$IFNDEF IPHONEOS}
    90 var s: shortstring;
    90 var s: shortstring;
    91 {$ENDIF}
    91 {$ENDIF}
    92 begin
    92 begin
    93     inc(RealTicks, Lag);
    93     if not isPaused then inc(RealTicks, Lag);
    94 
    94 
    95     case GameState of
    95     case GameState of
    96         gsLandGen: begin
    96         gsLandGen: begin
    97                 GenMap;
    97                 GenMap;
    98                 GameState:= gsStart;
    98                 GameState:= gsStart;
   119                 end;
   119                 end;
   120         gsConfirm,
   120         gsConfirm,
   121         gsGame: begin
   121         gsGame: begin
   122                 DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
   122                 DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
   123                 ProcessKbd;
   123                 ProcessKbd;
   124                 DoGameTick(Lag);
   124                 if not isPaused then
   125                 if not isPaused then ProcessVisualGears(Lag);
   125                     begin
       
   126                     DoGameTick(Lag);
       
   127                     ProcessVisualGears(Lag);
       
   128                     end;
   126                 end;
   129                 end;
   127         gsChat: begin
   130         gsChat: begin
   128                 DrawWorld(Lag);
   131                 DrawWorld(Lag);
   129                 DoGameTick(Lag);
   132                 if not isPaused then
   130                 ProcessVisualGears(Lag);
   133                     begin
       
   134                     DoGameTick(Lag);
       
   135                     ProcessVisualGears(Lag);
       
   136                     end;
   131                 end;
   137                 end;
   132         gsExit: begin
   138         gsExit: begin
   133                 isTerminated:= true;
   139                 isTerminated:= true;
   134                 end;
   140                 end;
   135         end;
   141         end;
   154 ////////////////////
   160 ////////////////////
   155 procedure OnDestroy;
   161 procedure OnDestroy;
   156 begin
   162 begin
   157     WriteLnToConsole('Freeing resources...');
   163     WriteLnToConsole('Freeing resources...');
   158     if isSoundEnabled then ReleaseSound();
   164     if isSoundEnabled then ReleaseSound();
       
   165     FreeActionsList();
   159     StoreRelease();
   166     StoreRelease();
   160     FreeGearsList();
   167     FreeGearsList();
   161     FreeVisualGears();
   168     FreeVisualGears();
   162     FreeLand();
   169     FreeLand();
   163     ControllerClose();
   170     ControllerClose();