hedgewars/hwengine.pas
changeset 11769 8b17caab10ec
parent 11685 a2e86a867fb5
child 11770 68f26b6a3a7d
--- a/hedgewars/hwengine.pas	Thu Apr 28 21:28:22 2016 +0200
+++ b/hedgewars/hwengine.pas	Fri Apr 29 00:56:04 2016 +0200
@@ -52,6 +52,39 @@
 procedure freeEverything(complete:boolean); forward;
 {$ENDIF}
 
+function read1stLn(filePath: shortstring): shortstring;
+var f: pfsFile;
+begin
+    read1stLn:= '';
+    if pfsExists(filePath) then
+        begin
+        f:= pfsOpenRead(filePath);
+        if (not pfsEOF(f)) and allOK then
+            pfsReadLn(f, read1stLn);
+        pfsClose(f);
+        f:= nil;
+        end;
+end;
+
+// TODO localization support
+procedure ShowCredits();
+var themeCredits, mapCredits: shortstring;
+begin
+    if Length(cMapName) > 0 then
+        begin
+        mapCredits:= read1stLn(cPathz[ptMapCurrent] + '/credits.txt');
+        if Length(mapCredits) > 0 then
+            AddChatString(char(6) + '© Map: ' + mapCredits);
+        end;
+
+        themeCredits:= read1stLn(cPathz[ptCurrTheme] + '/credits.txt');
+        if Length(themeCredits) > 0 then
+            AddChatString(char(8) + '© Theme: ' + themeCredits);
+
+        //AddChatString(char(9) + '© Hats : TODO');
+        //AddChatString(char(2) + '© Music : TODO');
+end;
+
 ///////////////////////////////////////////////////////////////////////////////
 function DoTimer(Lag: LongInt): boolean;
 var s: shortstring;
@@ -96,6 +129,7 @@
                 with TeamsArray[t]^ do
                     MaxTeamHealth:= TeamHealth;
             RecountAllTeamsHealth;
+            ShowCredits;
             GameState:= gsGame;
             end;
         gsConfirm, gsGame, gsChat: