hedgewars/hwengine.pas
changeset 7198 5debd5fe526e
parent 7180 53ffc8853008
child 7235 baa69bd025d9
equal deleted inserted replaced
7196:4fba5519c37f 7198:5debd5fe526e
    29 program hwengine;
    29 program hwengine;
    30 {$ENDIF}
    30 {$ENDIF}
    31 
    31 
    32 uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uInputHandler, uSound,
    32 uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uInputHandler, uSound,
    33      uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions,
    33      uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions,
    34      SysUtils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted, uVideoRec
    34      SysUtils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted
       
    35      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF}
    35      {$IFDEF SDL13}, uTouch{$ENDIF}{$IFDEF ANDROID}, GLUnit{$ENDIF};
    36      {$IFDEF SDL13}, uTouch{$ENDIF}{$IFDEF ANDROID}, GLUnit{$ENDIF};
    36 
    37 
    37 {$IFDEF HWLIBRARY}
    38 {$IFDEF HWLIBRARY}
    38 procedure initEverything(complete:boolean);
    39 procedure initEverything(complete:boolean);
    39 procedure freeEverything(complete:boolean);
    40 procedure freeEverything(complete:boolean);
    99             exit(false);
   100             exit(false);
   100             end;
   101             end;
   101 
   102 
   102     SwapBuffers;
   103     SwapBuffers;
   103 
   104 
       
   105 {$IFDEF USE_VIDEO_RECORDING}
   104     if flagPrerecording then
   106     if flagPrerecording then
   105         SaveCameraPosition;
   107         SaveCameraPosition;
       
   108 {$ENDIF}
   106 
   109 
   107     if flagMakeCapture then
   110     if flagMakeCapture then
   108         begin
   111         begin
   109         flagMakeCapture:= false;
   112         flagMakeCapture:= false;
   110         {$IFDEF PAS2C}
   113         {$IFDEF PAS2C}
   262         else SDL_Delay(1);
   265         else SDL_Delay(1);
   263         IPCCheckSock();
   266         IPCCheckSock();
   264     end;
   267     end;
   265 end;
   268 end;
   266 
   269 
   267 ////////////////
   270 {$IFDEF USE_VIDEO_RECORDING}
   268 procedure RecorderMainLoop;
   271 procedure RecorderMainLoop;
   269 var CurrTime, PrevTime: LongInt;
   272 var CurrTime, PrevTime: LongInt;
   270 begin
   273 begin
   271     if not BeginVideoRecording() then
   274     if not BeginVideoRecording() then
   272         exit;
   275         exit;
   287         DoTimer(CurrTime - PrevTime);
   290         DoTimer(CurrTime - PrevTime);
   288         IPCCheckSock();
   291         IPCCheckSock();
   289     end;
   292     end;
   290     StopVideoRecording();
   293     StopVideoRecording();
   291 end;
   294 end;
       
   295 {$ENDIF}
   292 
   296 
   293 ///////////////
   297 ///////////////
   294 procedure Game{$IFDEF HWLIBRARY}(gameArgs: PPChar); cdecl; export{$ENDIF};
   298 procedure Game{$IFDEF HWLIBRARY}(gameArgs: PPChar); cdecl; export{$ENDIF};
   295 var p: TPathType;
   299 var p: TPathType;
   296     s: shortstring;
   300     s: shortstring;
   570     if (ParamCount < 3) then
   574     if (ParamCount < 3) then
   571         GameType:= gmtSyntax
   575         GameType:= gmtSyntax
   572     else
   576     else
   573         if (ParamCount = 3) and ((ParamStr(3) = '--stats-only') or (ParamStr(3) = 'landpreview')) then
   577         if (ParamCount = 3) and ((ParamStr(3) = '--stats-only') or (ParamStr(3) = 'landpreview')) then
   574             internalSetGameTypeLandPreviewFromParameters()
   578             internalSetGameTypeLandPreviewFromParameters()
       
   579         else if ParamCount = cDefaultParamNum then
       
   580             internalStartGameWithParameters()
       
   581 {$IFDEF USE_VIDEO_RECORDING}
       
   582         else if ParamCount = cVideorecParamNum then
       
   583             internalStartVideoRecordingWithParameters()
       
   584 {$ENDIF}
   575         else
   585         else
   576             if (ParamCount = cDefaultParamNum) or (ParamCount = cDefaultParamNum+1) then
   586             playReplayFileWithParameters();
   577                 internalStartGameWithParameters()
       
   578             else
       
   579                 playReplayFileWithParameters();
       
   580 end;
   587 end;
   581 
   588 
   582 ////////////////////////////////////////////////////////////////////////////////
   589 ////////////////////////////////////////////////////////////////////////////////
   583 /////////////////////////////// m a i n ////////////////////////////////////////
   590 /////////////////////////////// m a i n ////////////////////////////////////////
   584 ////////////////////////////////////////////////////////////////////////////////
   591 ////////////////////////////////////////////////////////////////////////////////