- Timestamp:
- Jan 14, 2017, 12:52:41 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 51 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Directories.pas
r38 r64 6 6 var 7 7 HomeDir, DataDir: string; 8 LocaleCode: string; 8 9 9 function LocalizedFilePath( path: string): string;10 function LocalizedFilePath(const Path: string): string; 10 11 11 12 … … 26 27 end; 27 28 28 function LocalizedFilePath( path: string): string;29 function LocalizedFilePath(const Path: string): string; 29 30 begin 30 result := DataDir + 'Localization' + DirectorySeparator + path; 31 if not FileExists(result) then 32 result := HomeDir + path 31 if LocaleCode <> '' then begin 32 Result := HomeDir + 'Localization' + DirectorySeparator + LocaleCode + DirectorySeparator + Path; 33 if not FileExists(Result) then 34 Result := HomeDir + Path; 35 end else Result := HomeDir + Path; 33 36 end; 34 37 35 38 procedure InitUnit; 36 39 begin 40 LocaleCode := ''; 37 41 HomeDir := ExtractFilePath(ParamStr(0)); 38 42 -
trunk/Inp.pas
r38 r64 6 6 uses 7 7 ScreenTools, Messg, 8 9 8 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, 10 9 ButtonA, StdCtrls; … … 39 38 TitleHeight := ClientHeight; 40 39 InitButtons(); 41 Center := true 40 Center := true; 42 41 end; 43 42 -
trunk/Integrated.lpi
r55 r64 173 173 </Item2> 174 174 </RequiredPackages> 175 <Units Count="4 3">175 <Units Count="44"> 176 176 <Unit0> 177 177 <Filename Value="Integrated.lpr"/> … … 238 238 <Filename Value="Inp.pas"/> 239 239 <IsPartOfProject Value="True"/> 240 <HasResources Value="True"/> 240 <ComponentName Value="InputDlg"/> 241 <HasResources Value="True"/> 242 <ResourceBaseClass Value="Form"/> 241 243 </Unit13> 242 244 <Unit14> … … 408 410 <IsPartOfProject Value="True"/> 409 411 </Unit42> 412 <Unit43> 413 <Filename Value="Locale.pas"/> 414 <IsPartOfProject Value="True"/> 415 <ComponentName Value="LocaleDlg"/> 416 <ResourceBaseClass Value="Form"/> 417 </Unit43> 410 418 </Units> 411 419 </ProjectOptions> -
trunk/Integrated.lpr
r55 r64 63 63 DotNetClient := nil; 64 64 Application.Initialize; 65 Application.Title := ' C-evo';65 Application.Title := 'c-evo'; 66 66 Application.CreateForm(TDirectDlg, DirectDlg); 67 67 Application.CreateForm(TStartDlg, StartDlg); -
trunk/LocalPlayer/Term.pas
r61 r64 1271 1271 begin 1272 1272 UnusedTribeFiles.Clear; 1273 ok := FindFirst(DataDir + 'Localization' + DirectorySeparator + 'Tribes' + 1274 DirectorySeparator + '*.tribe.txt', faArchive + faReadOnly, 1275 SearchRec) = 0; 1273 ok := FindFirst(LocalizedFilePath('Tribes') + DirectorySeparator + '*.tribe.txt', 1274 faArchive + faReadOnly, SearchRec) = 0; 1276 1275 if not ok then 1277 1276 begin 1278 1277 FindClose(SearchRec); 1279 ok := FindFirst( HomeDir + 'Tribes' + DirectorySeparator + '*.tribe.txt',1278 ok := FindFirst(LocalizedFilePath('Tribes' + DirectorySeparator + '*.tribe.txt'), 1280 1279 faArchive + faReadOnly, SearchRec) = 0; 1281 1280 end; -
trunk/ScreenTools.pas
r63 r64 8 8 Windows, 9 9 {$ENDIF} 10 StringTables, 11 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, 10 StringTables, LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, 12 11 Forms, Menus; 13 12 … … 116 115 procedure PaintLogo(ca: TCanvas; x, y, clLight, clShade: integer); 117 116 function SetMainTextureByAge(Age: integer): boolean; 117 procedure LoadPhrases; 118 118 119 119 const … … 1522 1522 end; 1523 1523 1524 procedure UnitInit; 1525 begin 1526 Reg := TRegistry.create; 1527 try 1528 Reg.OpenKey('SOFTWARE\cevo\RegVer9', true); 1529 if Reg.ValueExists('Gamma') then 1530 Gamma := Reg.ReadInteger('Gamma') 1531 else begin 1532 Gamma := 100; 1533 Reg.WriteInteger('Gamma', Gamma); 1534 end; 1535 finally 1536 Reg.Free; 1537 end; 1538 1539 if Gamma <> 100 then 1540 begin 1541 GammaLUT[0] := 0; 1542 for i := 1 to 255 do 1543 begin 1544 p := round(255.0 * exp(ln(i / 255.0) * 100.0 / Gamma)); 1545 assert((p >= 0) and (p < 256)); 1546 GammaLUT[i] := p; 1547 end; 1548 end; 1549 1550 {$IFDEF WINDOWS} 1551 EnumDisplaySettings(nil, $FFFFFFFF, StartResolution); 1552 {$ENDIF} 1553 ResolutionChanged := false; 1554 1555 Phrases := TStringTable.create; 1556 Phrases2 := TStringTable.create; 1524 procedure LoadPhrases; 1525 begin 1526 if Phrases = nil then Phrases := TStringTable.create; 1527 if Phrases2 = nil then Phrases2 := TStringTable.create; 1557 1528 Phrases2FallenBackToEnglish := false; 1558 if FileExists( DataDir + 'Localization' + DirectorySeparator + 'Language.txt') then1559 begin 1560 Phrases.loadfromfile( DataDir + 'Localization' + DirectorySeparator + 'Language.txt');1561 if FileExists( DataDir + 'Localization' + DirectorySeparator + 'Language2.txt') then1562 Phrases2.loadfromfile( DataDir + 'Localization' + DirectorySeparator + 'Language2.txt')1529 if FileExists(LocalizedFilePath('Language.txt')) then 1530 begin 1531 Phrases.loadfromfile(LocalizedFilePath('Language.txt')); 1532 if FileExists(LocalizedFilePath('Language2.txt')) then 1533 Phrases2.loadfromfile(LocalizedFilePath('Language2.txt')) 1563 1534 else 1564 1535 begin … … 1573 1544 end; 1574 1545 1575 Sounds := TStringTable.create;1546 if Sounds = nil then Sounds := TStringTable.create; 1576 1547 if not Sounds.loadfromfile(HomeDir + 'Sounds' + DirectorySeparator + 'sound.txt') then 1577 1548 begin 1578 Sounds.Free; 1579 Sounds := nil 1580 end; 1549 FreeAndNil(Sounds); 1550 end; 1551 end; 1552 1553 procedure UnitInit; 1554 begin 1555 Reg := TRegistry.create; 1556 with Reg do 1557 try 1558 OpenKey('SOFTWARE\cevo\RegVer9', true); 1559 if ValueExists('Gamma') then 1560 Gamma := ReadInteger('Gamma') 1561 else begin 1562 Gamma := 100; 1563 WriteInteger('Gamma', Gamma); 1564 end; 1565 if ValueExists('Locale') then LocaleCode := ReadString('Locale') 1566 else LocaleCode := ''; 1567 finally 1568 Free; 1569 end; 1570 1571 if Gamma <> 100 then 1572 begin 1573 GammaLUT[0] := 0; 1574 for i := 1 to 255 do 1575 begin 1576 p := round(255.0 * exp(ln(i / 255.0) * 100.0 / Gamma)); 1577 assert((p >= 0) and (p < 256)); 1578 GammaLUT[i] := p; 1579 end; 1580 end; 1581 1582 {$IFDEF WINDOWS} 1583 EnumDisplaySettings(nil, $FFFFFFFF, StartResolution); 1584 {$ENDIF} 1585 ResolutionChanged := false; 1586 1587 LoadPhrases; 1581 1588 1582 1589 for section := Low(TFontType) to High(TFontType) do … … 1655 1662 1656 1663 procedure UnitDone; 1657 begin 1664 var 1665 Reg: TRegistry; 1666 begin 1667 Reg := TRegistry.create; 1668 with Reg do 1669 try 1670 OpenKey('SOFTWARE\cevo\RegVer9', true); 1671 WriteString('Locale', LocaleCode); 1672 finally 1673 Free; 1674 end; 1675 1658 1676 RestoreResolution; 1659 1677 for i := 0 to nGrExt - 1 do -
trunk/Start.pas
r53 r64 107 107 108 108 uses 109 Directories, Protocol, Direct, ScreenTools, Inp, Back ;109 Directories, Protocol, Direct, ScreenTools, Inp, Back, Locale; 110 110 111 111 {$R *.lfm} … … 249 249 250 250 ActionsOffered := [maManual, maCredits, maWeb]; 251 if FileExists(HomeDir + 'Configurator.exe') then 252 Include(ActionsOffered, maConfig); 251 Include(ActionsOffered, maConfig); 253 252 if FileExists(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html') then 254 253 Include(ActionsOffered, maAIDev); … … 404 403 i: integer; 405 404 begin 406 F ormerGames.Free;407 Maps.Free;408 Mini.Free;409 EmptyPicture.Free;410 LogoBuffer.Free;405 FreeAndNil(FormerGames); 406 FreeAndNil(Maps); 407 FreeAndNil(Mini); 408 FreeAndNil(EmptyPicture); 409 FreeAndNil(LogoBuffer); 411 410 for i := 0 to nBrain - 1 do 412 BrainPicture[i].Free;411 FreeAndNil(BrainPicture[i]); 413 412 end; 414 413 … … 1565 1564 maConfig: 1566 1565 begin 1567 OpenDocument(pchar(HomeDir + 'Configurator.exe')); 1568 Close 1566 LocaleDlg := TLocaleDlg.Create(nil); 1567 if LocaleDlg.ShowModal = mrOk then begin 1568 LoadPhrases; 1569 Invalidate; 1570 end; 1571 FreeAndNil(LocaleDlg); 1569 1572 end; 1570 1573 maManual: … … 1573 1576 DirectHelp(cStartCredits); 1574 1577 maAIDev: 1575 1578 OpenDocument(pchar(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html')); 1576 1579 maWeb: 1577 1580 OpenURL('http://c-evo.org')
Note:
See TracChangeset
for help on using the changeset viewer.