hedgewars/hwengine.pas
changeset 11769 8b17caab10ec
parent 11685 a2e86a867fb5
child 11770 68f26b6a3a7d
equal deleted inserted replaced
11768:b58dd09ea950 11769:8b17caab10ec
    49 {$ELSE}
    49 {$ELSE}
    50 procedure preInitEverything(); forward;
    50 procedure preInitEverything(); forward;
    51 procedure initEverything(complete:boolean); forward;
    51 procedure initEverything(complete:boolean); forward;
    52 procedure freeEverything(complete:boolean); forward;
    52 procedure freeEverything(complete:boolean); forward;
    53 {$ENDIF}
    53 {$ENDIF}
       
    54 
       
    55 function read1stLn(filePath: shortstring): shortstring;
       
    56 var f: pfsFile;
       
    57 begin
       
    58     read1stLn:= '';
       
    59     if pfsExists(filePath) then
       
    60         begin
       
    61         f:= pfsOpenRead(filePath);
       
    62         if (not pfsEOF(f)) and allOK then
       
    63             pfsReadLn(f, read1stLn);
       
    64         pfsClose(f);
       
    65         f:= nil;
       
    66         end;
       
    67 end;
       
    68 
       
    69 // TODO localization support
       
    70 procedure ShowCredits();
       
    71 var themeCredits, mapCredits: shortstring;
       
    72 begin
       
    73     if Length(cMapName) > 0 then
       
    74         begin
       
    75         mapCredits:= read1stLn(cPathz[ptMapCurrent] + '/credits.txt');
       
    76         if Length(mapCredits) > 0 then
       
    77             AddChatString(char(6) + '© Map: ' + mapCredits);
       
    78         end;
       
    79 
       
    80         themeCredits:= read1stLn(cPathz[ptCurrTheme] + '/credits.txt');
       
    81         if Length(themeCredits) > 0 then
       
    82             AddChatString(char(8) + '© Theme: ' + themeCredits);
       
    83 
       
    84         //AddChatString(char(9) + '© Hats : TODO');
       
    85         //AddChatString(char(2) + '© Music : TODO');
       
    86 end;
    54 
    87 
    55 ///////////////////////////////////////////////////////////////////////////////
    88 ///////////////////////////////////////////////////////////////////////////////
    56 function DoTimer(Lag: LongInt): boolean;
    89 function DoTimer(Lag: LongInt): boolean;
    57 var s: shortstring;
    90 var s: shortstring;
    58     t: LongWord;
    91     t: LongWord;
    94             ScriptCall('onGameStart');
   127             ScriptCall('onGameStart');
    95             for t:= 0 to Pred(TeamsCount) do
   128             for t:= 0 to Pred(TeamsCount) do
    96                 with TeamsArray[t]^ do
   129                 with TeamsArray[t]^ do
    97                     MaxTeamHealth:= TeamHealth;
   130                     MaxTeamHealth:= TeamHealth;
    98             RecountAllTeamsHealth;
   131             RecountAllTeamsHealth;
       
   132             ShowCredits;
    99             GameState:= gsGame;
   133             GameState:= gsGame;
   100             end;
   134             end;
   101         gsConfirm, gsGame, gsChat:
   135         gsConfirm, gsGame, gsChat:
   102             begin
   136             begin
   103             // disable screenshot flash effect when about to make another screenshot
   137             // disable screenshot flash effect when about to make another screenshot