hedgewars/hwengine.pas
changeset 8057 93e16240f178
parent 8039 a3b86c1f63b4
parent 8025 07862ab415c8
child 8096 453917e94e55
child 8150 6b30a4cd7c7c
equal deleted inserted replaced
8051:f26422ef0333 8057:93e16240f178
    27 interface
    27 interface
    28 {$ELSE}
    28 {$ELSE}
    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,
    32 uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uInputHandler
    33      uSound, uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uAILandMarks, uLandTexture, uCollisions,
    33      , uSound, uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uAILandMarks, uLandTexture, uCollisions
    34      SysUtils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted
    34      , SysUtils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted
       
    35      , uPhysFSLayer
    35      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF}
    36      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF}
    36      {$IFDEF USE_TOUCH_INTERFACE}, uTouch {$ENDIF}
    37      {$IFDEF USE_TOUCH_INTERFACE}, uTouch {$ENDIF}
    37      {$IFDEF ANDROID}, GLUnit{$ENDIF}
    38      {$IFDEF ANDROID}, GLUnit{$ENDIF}
    38      ;
    39      ;
    39 
    40 
   341     AddFileLog('UserPrefix: "' + UserPathPrefix +'"');
   342     AddFileLog('UserPrefix: "' + UserPathPrefix +'"');
   342     
   343     
   343     for i:= 0 to ParamCount do
   344     for i:= 0 to ParamCount do
   344         AddFileLog(inttostr(i) + ': ' + ParamStr(i));
   345         AddFileLog(inttostr(i) + ': ' + ParamStr(i));
   345 
   346 
   346     for p:= Succ(Low(TPathType)) to High(TPathType) do
       
   347         if (p <> ptMapCurrent) and (p <> ptData) then
       
   348             UserPathz[p]:= UserPathPrefix + '/Data/' + Pathz[p];
       
   349 
       
   350     UserPathz[ptData]:= UserPathPrefix + '/Data';
       
   351 
       
   352     for p:= Succ(Low(TPathType)) to High(TPathType) do
       
   353         if p <> ptMapCurrent then
       
   354             Pathz[p]:= PathPrefix + '/' + Pathz[p];
       
   355 
       
   356     WriteToConsole('Init SDL... ');
   347     WriteToConsole('Init SDL... ');
   357     if not cOnlyStats then SDLTry(SDL_Init(SDL_INIT_VIDEO or SDL_INIT_NOPARACHUTE) >= 0, true);
   348     if not cOnlyStats then SDLTry(SDL_Init(SDL_INIT_VIDEO or SDL_INIT_NOPARACHUTE) >= 0, true);
   358     WriteLnToConsole(msgOK);
   349     WriteLnToConsole(msgOK);
   359 
   350 
   360     SDL_EnableUNICODE(1);
   351     SDL_EnableUNICODE(1);
   379 
   370 
   380     ControllerInit(); // has to happen before InitKbdKeyTable to map keys
   371     ControllerInit(); // has to happen before InitKbdKeyTable to map keys
   381     InitKbdKeyTable();
   372     InitKbdKeyTable();
   382     AddProgress();
   373     AddProgress();
   383 
   374 
   384     LoadLocale(UserPathz[ptLocale] + '/en.txt');  // Do an initial load with english
   375     LoadLocale(cPathz[ptLocale] + '/en.txt');  // Do an initial load with english
   385     LoadLocale(Pathz[ptLocale] + '/en.txt');  // Do an initial load with english
       
   386     if cLocaleFName <> 'en.txt' then
   376     if cLocaleFName <> 'en.txt' then
   387         begin
   377         begin
   388         // Try two letter locale first before trying specific locale overrides
   378         // Try two letter locale first before trying specific locale overrides
   389         if (Length(cLocale) > 3) and (Copy(cLocale,1,2) <> 'en') then
   379         if (Length(cLocale) > 3) and (Copy(cLocale, 1, 2) <> 'en') then
   390             begin
   380             begin
   391             LoadLocale(UserPathz[ptLocale] + '/' + Copy(cLocale,1,2)+'.txt');
   381             LoadLocale(cPathz[ptLocale] + '/' + Copy(cLocale, 1, 2) + '.txt')
   392             LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocale,1,2)+'.txt')
       
   393             end;
   382             end;
   394         LoadLocale(UserPathz[ptLocale] + '/' + cLocaleFName);
   383         LoadLocale(cPathz[ptLocale] + '/' + cLocaleFName)
   395         LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName)
       
   396         end
   384         end
   397     else cLocale := 'en';
   385     else cLocale := 'en';
   398 
   386 
   399     WriteLnToConsole(msgGettingConfig);
   387     WriteLnToConsole(msgGettingConfig);
   400 
   388 
   457     uLandPainted.initModule;        // computes drawn land
   445     uLandPainted.initModule;        // computes drawn land
   458     uIO.initModule;                 // sets up sockets
   446     uIO.initModule;                 // sets up sockets
   459 
   447 
   460     if complete then
   448     if complete then
   461     begin
   449     begin
       
   450         uPhysFSLayer.initModule;
   462 {$IFDEF ANDROID}GLUnit.initModule;{$ENDIF}
   451 {$IFDEF ANDROID}GLUnit.initModule;{$ENDIF}
   463 {$IFDEF USE_TOUCH_INTERFACE}uTouch.initModule;{$ENDIF}
   452 {$IFDEF USE_TOUCH_INTERFACE}uTouch.initModule;{$ENDIF}
   464 {$IFDEF USE_VIDEO_RECORDING}uVideoRec.initModule;{$ENDIF}   //stub
   453 {$IFDEF USE_VIDEO_RECORDING}uVideoRec.initModule;{$ENDIF}   //stub
   465         uAI.initModule;
   454         uAI.initModule;
   466         uAIMisc.initModule;
   455         uAIMisc.initModule;
   508         uAmmos.freeModule;
   497         uAmmos.freeModule;
   509         uStore.freeModule;          // closes SDL
   498         uStore.freeModule;          // closes SDL
   510 {$IFDEF USE_VIDEO_RECORDING}uVideoRec.freeModule;{$ENDIF}
   499 {$IFDEF USE_VIDEO_RECORDING}uVideoRec.freeModule;{$ENDIF}
   511 {$IFDEF USE_TOUCH_INTERFACE}uTouch.freeModule;{$ENDIF}  //stub
   500 {$IFDEF USE_TOUCH_INTERFACE}uTouch.freeModule;{$ENDIF}  //stub
   512 {$IFDEF ANDROID}GLUnit.freeModule;{$ENDIF}
   501 {$IFDEF ANDROID}GLUnit.freeModule;{$ENDIF}
       
   502         uPhysFSLayer.freeModule;
   513     end;
   503     end;
   514 
   504 
   515     uIO.freeModule;
   505     uIO.freeModule;
   516     uLand.freeModule;
   506     uLand.freeModule;
   517     uLandPainted.freeModule;
   507     uLandPainted.freeModule;