hedgewars/hwengine.pas
branchcursor_issues
changeset 5189 dc1fe432b293
parent 5174 f5294509783e
child 5217 5612e01252ce
equal deleted inserted replaced
5149:9aa840fdf922 5189:dc1fe432b293
    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, uKeys, uSound,
    32 uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uKeys, uSound,
    33      uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, uMobile,
    33      uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions,
    34      sysutils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted;
    34      sysutils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted;
    35 
    35 
    36 {$IFDEF HWLIBRARY}
    36 {$IFDEF HWLIBRARY}
    37 procedure initEverything(complete:boolean);
    37 procedure initEverything(complete:boolean);
    38 procedure freeEverything(complete:boolean);
    38 procedure freeEverything(complete:boolean);
   130     TTF_Quit();
   130     TTF_Quit();
   131 {$IFDEF SDL13}
   131 {$IFDEF SDL13}
   132     SDL_RenderClear(SDLrender);
   132     SDL_RenderClear(SDLrender);
   133     SDL_DestroyRenderer(SDLrender);
   133     SDL_DestroyRenderer(SDLrender);
   134     SDL_DestroyWindow(SDLwindow);
   134     SDL_DestroyWindow(SDLwindow);
       
   135     SDLrender:= nil;
       
   136     SDLwindow:= nil;
   135 {$ENDIF}
   137 {$ENDIF}
   136     SDL_Quit();
   138     SDL_Quit();
   137     isTerminated:= false;
   139     isTerminated:= false;
   138 end;
   140 end;
   139 
   141 
   252     SDL_putenv(str2pchar('SDL_VIDEO_CENTERED=' + s));
   254     SDL_putenv(str2pchar('SDL_VIDEO_CENTERED=' + s));
   253 {$ELSE}
   255 {$ELSE}
   254     ShowMainWindow();
   256     ShowMainWindow();
   255 {$ENDIF}
   257 {$ENDIF}
   256 
   258 
   257     AddProgress();
       
   258 
       
   259     ControllerInit(); // has to happen before InitKbdKeyTable to map keys
   259     ControllerInit(); // has to happen before InitKbdKeyTable to map keys
   260     InitKbdKeyTable();
   260     InitKbdKeyTable();
       
   261     AddProgress();
   261 
   262 
   262     LoadLocale(Pathz[ptLocale] + '/en.txt');  // Do an initial load with english
   263     LoadLocale(Pathz[ptLocale] + '/en.txt');  // Do an initial load with english
   263     if (Length(cLocaleFName) > 6) then cLocale := Copy(cLocaleFName,1,5)
   264     if (Length(cLocaleFName) > 6) then cLocale := Copy(cLocaleFName,1,5)
   264     else cLocale := Copy(cLocaleFName,1,2);
   265     else cLocale := Copy(cLocaleFName,1,2);
   265     if cLocaleFName <> 'en.txt' then
   266     if cLocaleFName <> 'en.txt' then
   277         begin
   278         begin
   278         InitIPC;
   279         InitIPC;
   279         SendIPCAndWaitReply('C');        // ask for game config
   280         SendIPCAndWaitReply('C');        // ask for game config
   280         end
   281         end
   281     else
   282     else
   282         begin
       
   283         LoadRecordFromFile(recordFileName);
   283         LoadRecordFromFile(recordFileName);
   284         perfExt_SaveBeganSynching();
       
   285         end;
       
   286 
   284 
   287     ScriptOnGameInit;
   285     ScriptOnGameInit;
   288 
   286 
   289     s:= 'eproto ' + inttostr(cNetProtoVersion);
   287     s:= 'eproto ' + inttostr(cNetProtoVersion);
   290     SendIPCRaw(@s[0], Length(s) + 1); // send proto version
   288     SendIPCRaw(@s[0], Length(s) + 1); // send proto version