Changeset 100


Ignore:
Timestamp:
Sep 28, 2022, 7:14:22 PM (2 years ago)
Author:
chronos
Message:
  • Added: New game mode carrier where user needs to play existing cities and gradually unlock them by reaching exprected transported number of passengers.
Location:
trunk
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormImages.lfm

    r98 r100  
    787787    Stretch = True
    788788  end
     789  object ImageAchievement: TImage
     790    Left = 345
     791    Height = 71
     792    Top = 208
     793    Width = 64
     794    Picture.Data = {
     795      1754506F727461626C654E6574776F726B47726170686963DD05000089504E47
     796      0D0A1A0A0000000D49484452000000400000004008030000009DB781EC000002
     797      0A504C5445000000000000000000000000000000000000000000000000000000
     798      0000000000000000000000000000000000000000000000000000000000000000
     799      0000000000000000000000000000000000000000000000000000000000000000
     800      0000000000000000000000000000000000000000000000000000000000000000
     801      0000000000000000000000000000000000000000000000000000000000000000
     802      0000000000000000000000000000000000000000000000000000000000000000
     803      0000000000000000000000000000000000000000000000000000000000000000
     804      0000000000000000000000000000000000000000000000000000000000000000
     805      0000000000000000000000000000000000000000000000000000000000000000
     806      0000000000000000000000000000000000000000000000000000000000000000
     807      0000000000000000000000000000000000000000000000000000000000000000
     808      0000000000000000000000000000000000000000000000000000000000000000
     809      0000000000000000000000000000000000000000000000000000000000000000
     810      0000000000000000000000000000000000000000000000000000000000000000
     811      0000000000000000000000000000000000000000000000000000000000000000
     812      0000000000000000000000000000000000000000000000000000000000000000
     813      000000000000000000000000000000884D8C6A000000AD74524E530001020304
     814      050708090A0C0E0F101112131415161718191A1B1E202122242526282B2D2F30
     815      313334353638393A3E414243454648494A4B4F51525357585A5C5E5F60616266
     816      686A6C6D6E70727374757677797A7B7C7E7F8082838687888A8D909192949798
     817      999A9B9C9FA0A1A3A4A7A8A9ABAEB0B2B3B4B5B6B8BCBEBFC1C3C4C8C9CACDCE
     818      CFD2D3D4D5D6D7D8D9DADBDCDDDEE0E1E2E3E5E6E7E8E9EBECEEEFF0F1F2F3F4
     819      F5F6F7F8FAFBFCFD5CCA7DDC000002D549444154789CED96E95B125114C60F22
     820      26214A8B1564496A9B956161645656B6D966B6D12269B699A6A6660B569ADAA6
     821      D91EEDA4AD24F03F76CE0C30C330772EF03C3DF6C1F7CB3D73CEFBFE9E99CB2C
     822      004CEBFFD3AC5BAF3475C3C201D48639AAE5008EF100C73980A33CC0110EA08E
     823      07D8CF085ABB8605F978802FE266DEB42A00DDBCA0521D0AC0935401030AC030
     824      F6BEFAFDFE0985AFB58B01B8AB00F461AF00D745F1B680D51E8CEFCC459319D7
     825      1E05A01D7B65B866C5FB2F0174C4357EE9D0548CC57905E024F67653F1526EFF
     826      B81060C96779E71179AAB038A80050AF858ADEA8F56775699E38B3ACDE3119ED
     827      5EA386070BA7025080BDE7D15311D5101BEA9A63CD7A3A1E088743B315007883
     828      533BAE15D2E99E8D8C322E4A3D071EE7072397122732B96987FF48EE53E2A851
     829      F6AB18F1782F169E048003BB3E0316FD92BD4D1CC9EE522F5DD0632C962700F4
     830      B4FDBBB03824D90F8823B7D4A1B7C1265C1F24E401F661FF03EEBB2D14B3AF83
     831      C2CE369B901035390F20FB1916DB5500D9F42076E27DE28DF9D75EC00D09346E
     832      88357AD1D784EB48A60A00B692055F389561A6D603D4D0AABC0922EAA1D9095D
     833      C6282B3FA4831ABAA55AD4F3601923D7F505552C80D324DC11834606000ADFD3
     834      FCBB674C3D3F78F8132D4FF359797C9899672FE9BE461E20E72A271E6A9AA195
     835      47950F69E5FB5672E22447FBB87ADAD7BC2C89382973D59E730FE3C35EF7167B
     836      92E9887247E4F93B86D4D2A4E2DF52DE3F3FF53C408304E07D92D595F72D9A7F
     837      979516002E4701A7D3CB83330A589126C014F9CE4DE8D30480D12C6866BAF9A9
     838      5339EB3FDEB624019B59CF62DDBF05984A042DD606D84457AE0AA0E887607AAB
     839      0DB827148152B553A80C260D50FB30A1EA93059C616D436B72806E1D0BB05404
     840      54F819DA2902CA5879F3A808D012015ECF519FE96FD3698E6F74A17212C706EA
     841      BB5E90A75FFD0523FB27132E491CE7CAC657D4F26BE4575B943837CBE72EE635
     842      4E6B2AF4175050B7AFF09D59AE0000000049454E44AE426082
     843    }
     844    Proportional = True
     845    Stretch = True
     846  end
    789847end
  • trunk/Forms/UFormImages.pas

    r96 r100  
    1111
    1212  TFormImages = class(TForm)
     13    ImageAchievement: TImage;
    1314    ImageLine: TImage;
    1415    ImageCarriage: TImage;
  • trunk/Forms/UFormMain.lfm

    r94 r100  
    99  Color = clBlack
    1010  DesignTimePPI = 144
    11   OnActivate = FormActivate
    1211  OnClose = FormClose
    1312  OnCreate = FormCreate
  • trunk/Forms/UFormMain.pas

    r96 r100  
    1818    Timer1: TTimer;
    1919    Translator1: TTranslator;
    20     procedure FormActivate(Sender: TObject);
    2120    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2221    procedure FormCreate(Sender: TObject);
     
    8584
    8685  Engine := TEngine.Create;
     86  Engine.RegistryContext := ApplicationInfo1.GetRegistryContext;
    8787  LoadConfig;
     88  // Load cities after language core is loaded to have city names translated
     89  Engine.InitCities;
     90  Engine.LoadFromRegistry;
    8891  //PaintBox1.ControlStyle := [csOpaque];
    8992  Randomize;
    90 end;
    91 
    92 procedure TFormMain.FormActivate(Sender: TObject);
    93 begin
    9493end;
    9594
     
    217216      Translator1.Language := Translator1.Languages.SearchByCode(LangCode);
    218217    end else Translator1.Language := Translator1.Languages.SearchByCode('');
    219     Engine.LoadFromRegistry(CurrentContext);
     218    Engine.LoadFromRegistry;
    220219  finally
    221220    Free;
     
    232231      WriteString('LanguageCode', Translator1.Language.Code)
    233232      else DeleteValue('LanguageCode');
    234     Engine.SaveToRegistry(CurrentContext);
     233    Engine.SaveToRegistry;
    235234  finally
    236235    Free;
     
    260259  CopyImage(Engine.ImageFastForward.Bitmap, FormImages.ImageFastForward.Picture.Bitmap);
    261260  CopyImage(Engine.ImageFastForward.BitmapDisabled, FormImages.ImageFastForward.Picture.Bitmap, True);
     261  CopyImage(Engine.ImageAchievement.Bitmap, FormImages.ImageAchievement.Picture.Bitmap);
     262  CopyImage(Engine.ImageAchievement.BitmapDisabled, FormImages.ImageAchievement.Picture.Bitmap, True);
    262263  if Engine.DarkMode then begin
    263264    BitmapInvert(Engine.ImagePassenger.Bitmap);
     
    281282    BitmapInvert(Engine.ImageFastForward.Bitmap);
    282283    BitmapInvert(Engine.ImageFastForward.BitmapDisabled);
     284    BitmapInvert(Engine.ImageAchievement.Bitmap);
     285    BitmapInvert(Engine.ImageAchievement.BitmapDisabled);
    283286  end;
    284287  Engine.ImageNewTrain.Bitmap.Assign(Engine.ImageLocomotive.Bitmap);
  • trunk/Languages/BigMetro.cs.po

    r99 r100  
    4040msgstr "Big Metro"
    4141
     42#: uengine.scareer
     43msgid "Career"
     44msgstr "Kariéra"
     45
    4246#: uengine.scarriage
    4347msgid "Carriage"
     
    172176msgstr "Stanice musí mít MapStation"
    173177
     178#: uengine.ssuccess
     179msgid "Success"
     180msgstr "Úspěch"
     181
     182#: uengine.ssuccessreason
     183msgid "Your metro transported enough passengers and you have reached your goal for this city."
     184msgstr "Tvé metro přepravilo dostatek cestujících a dosáhl jsi tvého cíle pro toto město."
     185
    174186#: uengine.sterminal
    175187msgid "Terminal"
     
    187199msgid "Tunnel"
    188200msgstr "Tunel"
     201
     202#: uengine.sunlockedcity
     203#, object-pascal-format
     204msgid "City %s is now unlocked."
     205msgstr "Město %s je nyní odemčeno."
    189206
    190207#: uengine.sweek
  • trunk/Languages/BigMetro.de.po

    r99 r100  
    4343msgstr "Big Metro"
    4444
     45#: uengine.scareer
     46msgid "Career"
     47msgstr ""
     48
    4549#: uengine.scarriage
    4650msgid "Carriage"
     
    187191msgstr ""
    188192
     193#: uengine.ssuccess
     194msgid "Success"
     195msgstr ""
     196
     197#: uengine.ssuccessreason
     198msgid "Your metro transported enough passengers and you have reached your goal for this city."
     199msgstr ""
     200
    189201#: uengine.sterminal
    190202msgid "Terminal"
     
    201213#: uengine.stunnel
    202214msgid "Tunnel"
     215msgstr ""
     216
     217#: uengine.sunlockedcity
     218#, object-pascal-format
     219msgid "City %s is now unlocked."
    203220msgstr ""
    204221
  • trunk/Languages/BigMetro.fr.po

    r99 r100  
    4343msgstr "Big Metro"
    4444
     45#: uengine.scareer
     46msgid "Career"
     47msgstr ""
     48
    4549#: uengine.scarriage
    4650msgid "Carriage"
     
    187191msgstr ""
    188192
     193#: uengine.ssuccess
     194msgid "Success"
     195msgstr ""
     196
     197#: uengine.ssuccessreason
     198msgid "Your metro transported enough passengers and you have reached your goal for this city."
     199msgstr ""
     200
    189201#: uengine.sterminal
    190202msgid "Terminal"
     
    201213#: uengine.stunnel
    202214msgid "Tunnel"
     215msgstr ""
     216
     217#: uengine.sunlockedcity
     218#, object-pascal-format
     219msgid "City %s is now unlocked."
    203220msgstr ""
    204221
  • trunk/Languages/BigMetro.pot

    r99 r100  
    3030msgstr ""
    3131
     32#: uengine.scareer
     33msgid "Career"
     34msgstr ""
     35
    3236#: uengine.scarriage
    3337msgid "Carriage"
     
    162166msgstr ""
    163167
     168#: uengine.ssuccess
     169msgid "Success"
     170msgstr ""
     171
     172#: uengine.ssuccessreason
     173msgid "Your metro transported enough passengers and you have reached your goal for this city."
     174msgstr ""
     175
    164176#: uengine.sterminal
    165177msgid "Terminal"
     
    176188#: uengine.stunnel
    177189msgid "Tunnel"
     190msgstr ""
     191
     192#: uengine.sunlockedcity
     193#, object-pascal-format
     194msgid "City %s is now unlocked."
    178195msgstr ""
    179196
  • trunk/UCity.pas

    r93 r100  
    44
    55uses
    6   Classes, SysUtils, Generics.Collections;
     6  Classes, SysUtils, Graphics, Generics.Collections, URegistry;
    77
    88type
     9
     10  { TCity }
     11
    912  TCity = class
     13    SysName: string;
    1014    Name: string;
     15    Population: Integer;
    1116    Locked: Boolean;
     17    LineColors: array of TColor;
     18    InitialLineCount: Integer;
    1219    PassengersCountToUnlock: Integer;
     20    HighestServedPassengerCount: Integer;
     21    HighestServedDaysCount: Integer;
     22    procedure LoadFromRegistry(Context: TRegistryContext);
     23    procedure SaveToRegistry(Context: TRegistryContext);
     24    constructor Create;
    1325  end;
    1426
     
    1628
    1729  TCities = class(TObjectList<TCity>)
    18     function AddNew(Name: string): TCity;
     30    function AddNew(SysName, Name: string; Population: Integer): TCity;
     31    procedure LoadFromRegistry(Context: TRegistryContext);
     32    procedure SaveToRegistry(Context: TRegistryContext);
    1933  end;
     34
     35const
     36  clDarkYellow = TColor($00dede);
     37  clOrange = TColor($0080ff);
     38  clBrown = TColor($003090);
     39  clCyan = TColor($FFFF00);
     40  clPink = TColor($ff69b4);
    2041
    2142
    2243implementation
    2344
     45{ TCity }
     46
     47procedure TCity.LoadFromRegistry(Context: TRegistryContext);
     48begin
     49  with TRegistryEx.Create do
     50  try
     51    CurrentContext := Context;
     52    Locked := ReadBoolWithDefault('Locked', Locked);
     53    HighestServedPassengerCount := ReadIntegerWithDefault('HighestServedPassengerCount', HighestServedPassengerCount);
     54    HighestServedDaysCount := ReadIntegerWithDefault('HighestServedDaysCount', HighestServedDaysCount);
     55  finally
     56    Free;
     57  end;
     58end;
     59
     60procedure TCity.SaveToRegistry(Context: TRegistryContext);
     61begin
     62  with TRegistryEx.Create do
     63  try
     64    CurrentContext := Context;
     65    WriteBool('Locked', Locked);
     66    WriteInteger('HighestServedPassengerCount', HighestServedPassengerCount);
     67    WriteInteger('HighestServedDaysCount', HighestServedDaysCount);
     68  finally
     69    Free;
     70  end;
     71end;
     72
     73constructor TCity.Create;
     74begin
     75  PassengersCountToUnlock := 500;
     76  InitialLineCount := 1;
     77  LineColors := [clBlue, clRed, clDarkYellow, clGreen,
     78     clPurple, clGray, clOrange, clBrown, clCyan];
     79end;
     80
    2481{ TCities }
    2582
    26 function TCities.AddNew(Name: string): TCity;
     83function TCities.AddNew(SysName, Name: string; Population: Integer): TCity;
    2784begin
    2885  Result := TCity.Create;
     86  Result.SysName := SysName;
    2987  Result.Name := Name;
     88  Result.Population := Population;
    3089  Add(Result);
     90end;
     91
     92procedure TCities.LoadFromRegistry(Context: TRegistryContext);
     93var
     94  City: TCity;
     95begin
     96  for City in Self do begin
     97    City.LoadFromRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '/' + City.SysName));
     98  end;
     99end;
     100
     101procedure TCities.SaveToRegistry(Context: TRegistryContext);
     102var
     103  City: TCity;
     104begin
     105  for City in Self do begin
     106    City.SaveToRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '/' + City.SysName));
     107  end;
    31108end;
    32109
  • trunk/UColors.pas

    r95 r100  
    1616    ShapeBackground: TColor;
    1717    MenuItemText: TColor;
     18    MenuItemDisabledText: TColor;
    1819    MenuItemBackground: TColor;
    1920    MenuItemBackgroundSelected: TColor;
     
    3435    ShapeBackground := clBlack;
    3536    MenuItemText := $cccccc;
     37    MenuItemDisabledText := $888888;
    3638    MenuItemBackground := $b75C01;
    3739    MenuItemBackgroundSelected := $070C81;
     
    4244    ShapeBackground := clWhite;
    4345    MenuItemText := clWhite;
     46    MenuItemDisabledText := clSilver;
    4447    MenuItemBackground := $e78C31;
    4548    MenuItemBackgroundSelected := $f7bC61;
  • trunk/UControls.pas

    r98 r100  
    1616    procedure SetEnabled(AValue: Boolean);
    1717  public
     18    Ref: TObject;
    1819    Bounds: TRect;
    1920    Canvas: TCanvas;
  • trunk/UEngine.pas

    r99 r100  
    8585  TMetroLines = class(TObjectList<TMetroLine>)
    8686    Engine: TEngine;
    87     function AddNew: TMetroLine;
     87    function AddNew(Color: TColor): TMetroLine;
    8888    function SearchByColor(Color: TColor): TMetroLine;
    8989  end;
     
    141141  end;
    142142
     143  { TMap }
     144
    143145  TMap = class
    144146    Size: TPoint;
     
    149151
    150152  TGameState = (gsNotStarted, gsRunning, gsPaused, gsGameOver, gsMenu, gsNewWeek,
    151     gsNewImprovement);
    152 
    153   TMetroImprovement = (miNone, miTunnel, miTerminal, miLine, miCarriage);
     153    gsNewImprovement, gsSuccess);
     154
     155  TMetroImprovement = (miNone, miTunnel, miTerminal, miLine, miCarriage,
     156    miFastTrain);
    154157  TMetroImprovementSet = set of TMetroImprovement;
    155158
     
    175178    MenuMain: TMenu;
    176179    MenuOptions: TMenu;
     180    MenuCareer: TMenu;
    177181    MenuGame: TMenu;
    178182    LastState: TGameState;
     
    180184    ImprovementImageSize: Integer;
    181185    IconSize: Integer;
     186    LineColors: array of TColor;
    182187    function GetServedDaysCount: Integer;
    183188    procedure ResizeView;
     
    194199    procedure DrawTrains(Canvas: TCanvas);
    195200    procedure DrawGameOver(Canvas: TCanvas; CanvasSize: TPoint);
     201    procedure DrawHighScore(Canvas: TCanvas; CanvasSize: TPoint; Y: Integer);
     202    procedure DrawSuccess(Canvas: TCanvas; CanvasSize: TPoint);
    196203    procedure DrawNewWeek(Canvas: TCanvas; CanvasSize: TPoint);
    197204    procedure DrawNewImprovement(Canvas: TCanvas; CanvasSize: TPoint);
     
    209216    procedure ShiftTrackPoints;
    210217    procedure MenuItemExit(Sender: TObject);
     218    procedure MenuItemCity(Sender: TObject);
    211219    procedure MenuItemPlay(Sender: TObject);
     220    procedure MenuItemCareer(Sender: TObject);
    212221    procedure MenuItemOptions(Sender: TObject);
    213222    procedure MenuItemGameContinue(Sender: TObject);
     
    226235    procedure FullScreenChanged(Sender: TObject);
    227236    procedure UpdateInterface;
    228     procedure InitCities;
    229237    function GetImprovementText(Improvement: TMetroImprovement): string;
    230238    function GetImprovementBitmap(Improvement: TMetroImprovement): TBitmap;
     
    242250    View: TView;
    243251    Cities: TCities;
     252    City: TCity;
    244253    SelectedLine: TMetroLine;
    245254    SelectedTrain: TMetroTrain;
     
    255264    ImagePause: TImage;
    256265    ImageFastForward: TImage;
     266    ImageAchievement: TImage;
    257267    ImageCarriage: TImage;
    258268    ImageTerminal: TImage;
     
    267277    HighestServedPassengerCount: Integer;
    268278    HighestServedDaysCount: Integer;
     279    RegistryContext: TRegistryContext;
    269280    procedure InitMenus;
     281    procedure InitCities;
    270282    procedure MouseMove(Position: TPoint);
    271283    procedure MouseUp(Button: TMouseButton; Position: TPoint);
     
    276288    procedure NewGame;
    277289    procedure Redraw;
    278     procedure LoadFromRegistry(Context: TRegistryContext);
    279     procedure SaveToRegistry(Context: TRegistryContext);
     290    procedure LoadFromRegistry;
     291    procedure SaveToRegistry;
    280292    constructor Create;
    281293    destructor Destroy; override;
     
    291303
    292304const
    293   clDarkYellow = TColor($00dede);
    294   clOrange = TColor($0080ff);
    295   clBrown = TColor($003090);
    296   clCyan = TColor($FFFF00);
    297   LineColors: array[0..8] of TColor = (clBlue, clRed, clDarkYellow, clGreen,
    298     clPurple, clGray, clOrange, clBrown, clCyan);
    299305  StationSize = 30;
    300306  StationOverloadSize = 60;
     
    352358  SFrench = 'French';
    353359  SGerman = 'German';
     360  SAutomatic = 'Automatic';
    354361  SBack = 'Back';
    355   SAutomatic = 'Automatic';
    356362  SFullScreen = 'Full screen';
    357363  SContinue = 'Continue';
     
    361367  SCarriage = 'Carriage';
    362368  STunnel = 'Tunnel';
     369  SCareer = 'Career';
     370  SSuccess = 'Success';
     371  SSuccessReason = 'Your metro transported enough passengers and you have reached your goal for this city.';
     372  SUnlockedCity = 'City %s is now unlocked.';
    363373
    364374  // Cities
     
    532542{ TMetroLines }
    533543
    534 function TMetroLines.AddNew: TMetroLine;
     544function TMetroLines.AddNew(Color: TColor): TMetroLine;
    535545begin
    536546  Result := TMetroLine.Create;
    537   Result.Color := LineColors[Count];
    538547  Result.Engine := Engine;
    539548  Result.Index := Count;
     549  Result.Color := Color;
    540550  Add(Result);
    541551end;
     
    16941704end;
    16951705
     1706procedure TEngine.MenuItemCity(Sender: TObject);
     1707begin
     1708  if Sender is TMenuItemButton then begin;
     1709    City := TCity(TMenuItemButton(Sender).Ref);
     1710    NewGame;
     1711  end;
     1712end;
     1713
    16961714procedure TEngine.MenuItemPlay(Sender: TObject);
    16971715begin
     1716  City := nil;
    16981717  NewGame;
    16991718end;
    17001719
     1720procedure TEngine.MenuItemCareer(Sender: TObject);
     1721var
     1722  City: TCity;
     1723begin
     1724  MenuCareer.Parent := MenuMain;
     1725  with MenuCareer, Items do begin
     1726    Clear;
     1727    for City in Cities do
     1728    with AddButton(City.Name, MenuItemCity) do begin
     1729      Ref := City;
     1730      Enabled := not City.Locked;
     1731      TextSize := 40;
     1732      TextColor := Colors.MenuItemText;
     1733      TextDisabledColor := Colors.MenuItemDisabledText;
     1734      BackgroundColor := Colors.MenuItemBackground;
     1735      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
     1736    end;
     1737    with AddButton(SBack, MenuItemBack) do begin
     1738      TextSize := 40;
     1739      TextColor := Colors.MenuItemText;
     1740      TextDisabledColor := Colors.MenuItemDisabledText;
     1741      BackgroundColor := Colors.MenuItemBackground;
     1742      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
     1743    end;
     1744    OnExit := MenuItemBack;
     1745  end;
     1746
     1747  Menu := MenuCareer;
     1748  Redraw;
     1749end;
     1750
    17011751procedure TEngine.MenuItemOptions(Sender: TObject);
    17021752begin
     1753  MenuOptions.Parent := MenuMain;
     1754  with MenuOptions, Items do begin
     1755    Clear;
     1756    with AddComboBox(SLanguage, [], LanguageChanged) do begin
     1757      TextSize := 40;
     1758      TextColor := Colors.MenuItemText;
     1759      TextDisabledColor := Colors.MenuItemDisabledText;
     1760      BackgroundColor := Colors.MenuItemBackground;
     1761      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
     1762      FormMain.Translator1.LanguageListToStrings(States);
     1763      Index := States.IndexOfObject(FormMain.Translator1.Language);
     1764      if Index = -1 then Index := 0;
     1765    end;
     1766    with AddCheckBox(SDarkMode, DarkModeChanged) do begin
     1767      TextSize := 40;
     1768      TextColor := Colors.MenuItemText;
     1769      TextDisabledColor := Colors.MenuItemDisabledText;
     1770      BackgroundColor := Colors.MenuItemBackground;
     1771      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
     1772      Checked := DarkMode;
     1773    end;
     1774    with AddCheckBox(SFullScreen, FullScreenChanged) do begin
     1775      TextSize := 40;
     1776      TextColor := Colors.MenuItemText;
     1777      TextDisabledColor := Colors.MenuItemDisabledText;
     1778      BackgroundColor := Colors.MenuItemBackground;
     1779      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
     1780      Checked := FormMain.FullScreen;
     1781    end;
     1782    with AddButton(SBack, MenuItemBack) do begin
     1783      TextSize := 40;
     1784      TextColor := Colors.MenuItemText;
     1785      TextDisabledColor := Colors.MenuItemDisabledText;
     1786      BackgroundColor := Colors.MenuItemBackground;
     1787      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
     1788    end;
     1789    OnExit := MenuItemBack;
     1790  end;
     1791
    17031792  Menu := MenuOptions;
    17041793  Redraw;
     
    17911880begin
    17921881  State := LastState;
     1882  Redraw;
    17931883end;
    17941884
     
    18211911    FormMain.Translator1.Translate;
    18221912    InitMenus;
     1913
     1914    // Recreate cities with translated names
     1915    SaveToRegistry;
     1916    InitCities;
     1917    LoadFromRegistry;
    18231918  end;
    18241919end;
     
    18381933
    18391934procedure TEngine.InitCities;
     1935var
     1936  I: Integer;
    18401937begin
    18411938  with Cities do begin
    1842     AddNew(SLondon);
    1843     AddNew(SNewYork);
    1844     AddNew(SPrague);
    1845     AddNew(SParis);
    1846     AddNew(STokyo);
    1847   end;
     1939    Clear;
     1940    with AddNew('Prague', SPrague, 1275406) do begin
     1941      LineColors := [clRed, clGreen, clYellow];
     1942      InitialLineCount := 1;
     1943      PassengersCountToUnlock := 200;
     1944    end;
     1945    with AddNew('Paris', SParis, 2138551) do begin
     1946      LineColors := [clRed, clGreen, clYellow, clBlue, clBrown, clOrange,
     1947        clPurple, clOlive, clAqua, clDarkYellow, clPink];
     1948      InitialLineCount := 1;
     1949      PassengersCountToUnlock := 300;
     1950    end;
     1951    with AddNew('Rome', SRome, 2872800) do begin
     1952      LineColors := [clRed, clGreen, clYellow];
     1953      InitialLineCount := 1;
     1954      PassengersCountToUnlock := 500;
     1955    end;
     1956    with AddNew('NewYork', SNewYork, 8804190) do begin
     1957      InitialLineCount := 1;
     1958      PassengersCountToUnlock := 700;
     1959    end;
     1960    with AddNew('London', SLondon, 9002488) do begin
     1961      InitialLineCount := 3;
     1962      PassengersCountToUnlock := 1000;
     1963    end;
     1964    with AddNew('Tokyo', STokyo, 13960236) do begin
     1965      InitialLineCount := 3;
     1966      PassengersCountToUnlock := 2000;
     1967    end;
     1968  end;
     1969  for I := 1 to Cities.Count - 1 do
     1970    Cities[I].Locked := True;
    18481971end;
    18491972
     
    18711994begin
    18721995  case Improvement of
    1873     miLine: Lines.AddNew;
     1996    miLine: Lines.AddNew(LineColors[Lines.Count]);
    18741997    miCarriage: Carriages.AddNew;
    18751998    //miTunnel: Tunnels.AddNew;
     
    18842007    with AddButton(SBigMetro, nil) do begin
    18852008      Enabled := False;
    1886       FontSize := 60;
    1887       FontColor := Colors.Text;
     2009      TextSize := 60;
     2010      TextColor := Colors.Text;
     2011      TextDisabledColor := Colors.Text;
    18882012      BackgroundColor := clNone;
    18892013      BackgroundSelectedColor := clNone;
    18902014    end;
    18912015    with AddButton(SPlay, MenuItemPlay) do begin
    1892       FontSize := 40;
    1893       FontColor := Colors.MenuItemText;
     2016      TextSize := 40;
     2017      TextColor := Colors.MenuItemText;
     2018      TextDisabledColor := Colors.MenuItemDisabledText;
    18942019      BackgroundColor := Colors.MenuItemBackground;
    18952020      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
    18962021    end;
    1897     with AddButton(SOptions, MenuItemOptions) do begin
    1898       FontSize := 40;
    1899       FontColor := Colors.MenuItemText;
     2022    with AddButton(SCareer, MenuItemCareer) do begin
     2023      TextSize := 40;
     2024      TextColor := Colors.MenuItemText;
     2025      TextDisabledColor := Colors.MenuItemDisabledText;
    19002026      BackgroundColor := Colors.MenuItemBackground;
    19012027      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
    19022028    end;
    1903     with AddButton(SExit, MenuItemExit) do begin
    1904       FontSize := 40;
    1905       FontColor := Colors.MenuItemText;
     2029    with AddButton(SOptions, MenuItemOptions) do begin
     2030      TextSize := 40;
     2031      TextColor := Colors.MenuItemText;
     2032      TextDisabledColor := Colors.MenuItemDisabledText;
    19062033      BackgroundColor := Colors.MenuItemBackground;
    19072034      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
    19082035    end;
    1909     OnExit := MenuItemExit;
    1910   end;
    1911 
    1912   MenuOptions.Parent := MenuMain;
    1913   with MenuOptions, Items do begin
    1914     Clear;
    1915     with AddComboBox(SLanguage, [], LanguageChanged) do begin
    1916       FontSize := 40;
    1917       FontColor := Colors.MenuItemText;
     2036    with AddButton(SExit, MenuItemExit) do begin
     2037      TextSize := 40;
     2038      TextColor := Colors.MenuItemText;
     2039      TextDisabledColor := Colors.MenuItemDisabledText;
    19182040      BackgroundColor := Colors.MenuItemBackground;
    19192041      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
    1920       FormMain.Translator1.LanguageListToStrings(States);
    1921       Index := States.IndexOfObject(FormMain.Translator1.Language);
    1922       if Index = -1 then Index := 0;
    1923     end;
    1924     with AddCheckBox(SDarkMode, DarkModeChanged) do begin
    1925       FontSize := 40;
    1926       FontColor := Colors.MenuItemText;
    1927       BackgroundColor := Colors.MenuItemBackground;
    1928       BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
    1929       Checked := DarkMode;
    1930     end;
    1931     with AddCheckBox(SFullScreen, FullScreenChanged) do begin
    1932       FontSize := 40;
    1933       FontColor := Colors.MenuItemText;
    1934       BackgroundColor := Colors.MenuItemBackground;
    1935       BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
    1936       Checked := FormMain.FullScreen;
    1937     end;
    1938     with AddButton(SBack, MenuItemBack) do begin
    1939       FontSize := 40;
    1940       FontColor := Colors.MenuItemText;
    1941       BackgroundColor := Colors.MenuItemBackground;
    1942       BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
    1943     end;
    1944     OnExit := MenuItemBack;
     2042    end;
     2043    OnExit := MenuItemExit;
    19452044  end;
    19462045
     
    19482047    Clear;
    19492048    with AddButton(SContinue, MenuItemGameContinue) do begin
    1950       FontSize := 40;
    1951       FontColor := Colors.MenuItemText;
     2049      TextSize := 40;
     2050      TextColor := Colors.MenuItemText;
     2051      TextDisabledColor := Colors.MenuItemDisabledText;
    19522052      BackgroundColor := Colors.MenuItemBackground;
    19532053      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
    19542054    end;
    19552055    with AddButton(SRestart, MenuItemGameRestart) do begin
    1956       FontSize := 40;
    1957       FontColor := Colors.MenuItemText;
     2056      TextSize := 40;
     2057      TextColor := Colors.MenuItemText;
     2058      TextDisabledColor := Colors.MenuItemDisabledText;
    19582059      BackgroundColor := Colors.MenuItemBackground;
    19592060      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
    19602061    end;
    19612062    with AddButton(SExit, MenuItemGameExit) do begin
    1962       FontSize := 40;
    1963       FontColor := Colors.MenuItemText;
     2063      TextSize := 40;
     2064      TextColor := Colors.MenuItemText;
     2065      TextDisabledColor := Colors.MenuItemDisabledText;
    19642066      BackgroundColor := Colors.MenuItemBackground;
    19652067      BackgroundSelectedColor := Colors.MenuItemBackgroundSelected;
     
    19712073procedure TEngine.ButtonBackClick(Sender: TObject);
    19722074begin
    1973   Menu := MenuGame;
    1974   LastState := State;
    1975   State := gsMenu;
    1976   Redraw;
     2075  if State = gsSuccess then begin
     2076    State := gsMenu;
     2077    MenuItemCareer(Self);
     2078  end else begin
     2079    Menu := MenuGame;
     2080    LastState := State;
     2081    State := gsMenu;
     2082    Redraw;
     2083  end;
    19772084end;
    19782085
     
    21272234begin
    21282235  with Canvas do begin
    2129     DrawFrame(Canvas, Bounds(CanvasSize.X div 8,  ScaleY(90, 96),
     2236    DrawFrame(Canvas, Bounds(CanvasSize.X div 8, ScaleY(90, 96),
    21302237      Round(CanvasSize.X / 4 * 3), ScaleY(210, 96)));
    21312238
     
    21372244
    21382245    Font.Size := 40;
    2139     TextOut((CanvasSize.X - TextWidth(SGameOver)) div 2, Y, SGameOver);
    2140     Y := Y + Round(TextHeight(SGameOver) * 1.1);
     2246    Text := SGameOver;
     2247    TextOut((CanvasSize.X - TextWidth(Text)) div 2, Y, Text);
     2248    Y := Y + Round(TextHeight(Text) * 1.1);
    21412249
    21422250    Font.Size := 14;
    2143     TextOut((CanvasSize.X - TextWidth(SGameOverReason)) div 2, Y, SGameOverReason);
    2144     Y := Y + Round(TextHeight(SGameOverReason) * 1.1);
     2251    Text := SGameOverReason;
     2252    TextOut((CanvasSize.X - TextWidth(Text)) div 2, Y, Text);
     2253    Y := Y + Round(TextHeight(Text) * 1.1);
    21452254
    21462255    Text := Format(SGameOverStatistic, [ServedPassengerCount, ServedDaysCount]);
     
    21502259    Y := Y + ScaleY(16, 96);
    21512260
     2261    DrawHighScore(Canvas, CanvasSize, Y);
     2262  end;
     2263end;
     2264
     2265procedure TEngine.DrawHighScore(Canvas: TCanvas; CanvasSize: TPoint; Y: Integer);
     2266var
     2267  Text: string;
     2268begin
     2269  with Canvas do begin
    21522270    // Calculate new highest score
    21532271    Text := '';
     
    21642282    if (ServedDaysCount > HighestServedDaysCount) then
    21652283      HighestServedDaysCount := ServedDaysCount;
     2284
     2285    if Assigned(City) then begin
     2286      if (ServedPassengerCount > City.HighestServedPassengerCount) then
     2287        City.HighestServedPassengerCount := ServedPassengerCount;
     2288      if (ServedDaysCount > City.HighestServedDaysCount) then
     2289        City.HighestServedDaysCount := ServedDaysCount;
     2290    end;
     2291  end;
     2292end;
     2293
     2294procedure TEngine.DrawSuccess(Canvas: TCanvas; CanvasSize: TPoint);
     2295var
     2296  Y: Integer;
     2297  Text: string;
     2298  Index: Integer;
     2299begin
     2300  with Canvas do begin
     2301    DrawFrame(Canvas, Bounds(CanvasSize.X div 8, ScaleY(90, 96),
     2302      Round(CanvasSize.X / 4 * 3), ScaleY(230, 96)));
     2303
     2304    Canvas.Font.Color := Self.Colors.Text;
     2305    Brush.Style := bsClear;
     2306    Pen.Style := psClear;
     2307
     2308    Y := ScaleY(100, 96);
     2309
     2310    Font.Size := 40;
     2311    Text := SSuccess;
     2312    TextOut((CanvasSize.X - TextWidth(Text)) div 2, Y, Text);
     2313    Y := Y + Round(TextHeight(Text) * 1.1);
     2314
     2315    Font.Size := 14;
     2316    Text := SSuccessReason;
     2317    TextOut((CanvasSize.X - TextWidth(Text)) div 2, Y, Text);
     2318    Y := Y + Round(TextHeight(Text) * 1.1);
     2319
     2320    // Unlock next city
     2321    if Assigned(City) then begin
     2322      Index := Cities.IndexOf(City);
     2323      if (Index >= 0) and ((Index + 1) < Cities.Count) then begin
     2324        Cities[Index + 1].Locked := False;
     2325        Font.Size := 14;
     2326        Text := Format(SUnlockedCity, [Cities[Index + 1].Name]);
     2327        TextOut((CanvasSize.X - TextWidth(Text)) div 2, Y, Text);
     2328        Y := Y + Round(TextHeight(Text) * 1.1);
     2329      end;
     2330    end;
     2331
     2332    Text := Format(SGameOverStatistic, [ServedPassengerCount, ServedDaysCount]);
     2333    TextOut((CanvasSize.X - TextWidth(Text)) div 2, Y, Text);
     2334    Y := Y + Round(TextHeight(SGameOverStatistic) * 1.1);
     2335
     2336    Y := Y + ScaleY(16, 96);
     2337
     2338    DrawHighScore(Canvas, CanvasSize, Y);
    21662339  end;
    21672340end;
     
    24992672
    25002673  // Passenger count
    2501   X := CanvasSize.X - ScaleX(30, 96);
    2502   Text := IntToStr(ServedPassengerCount);
    2503   ImagePassenger.Bounds := Bounds(X - Canvas.TextWidth(Text), Y - IconSize div 2,
     2674  X := CanvasSize.X - ScaleX(10, 96);
     2675  ImagePassenger.Bounds := Bounds(X - IconSize, Y - IconSize div 2,
    25042676    IconSize, IconSize);
    25052677  ImagePassenger.Canvas := Canvas;
    25062678  ImagePassenger.Paint;
    2507   X := X - Canvas.TextWidth(Text) - SeparatorSize div 3;
     2679  X := X - IconSize - SeparatorSize div 3;
    25082680
    25092681  Canvas.Brush.Style := bsClear;
    25102682  Canvas.Font.Size := 14;
    25112683  Canvas.Font.Color := Colors.Text;
     2684  Text := IntToStr(ServedPassengerCount);
    25122685  Canvas.TextOut(X - Canvas.TextWidth(Text),
    25132686    Y - Canvas.TextHeight(Text) div 2, Text);
     
    25222695  ButtonBack.Bounds.Top := 10;
    25232696  ButtonBack.Paint;
     2697
     2698  // City name
     2699  if Assigned(City) then begin
     2700    Canvas.Brush.Style := bsClear;
     2701    Canvas.Font.Color := Colors.Text;
     2702    Canvas.Font.Size := 20;
     2703    Text := City.Name;
     2704    Canvas.TextOut(20, CanvasSize.Y -
     2705      Canvas.TextHeight(Text) - 20, Text);
     2706
     2707    X := CanvasSize.X - ScaleX(10, 96);
     2708    ImageAchievement.Bounds := Bounds(X - IconSize, Y - 2 * IconSize,
     2709      IconSize, IconSize);
     2710    ImageAchievement.Canvas := Canvas;
     2711    ImageAchievement.Paint;
     2712
     2713    X := X - IconSize - SeparatorSize div 3;
     2714
     2715    Canvas.Brush.Style := bsClear;
     2716    Canvas.Font.Size := 14;
     2717    Canvas.Font.Color := Colors.Text;
     2718    Text := IntToStr(City.PassengersCountToUnlock);
     2719    Canvas.TextOut(X - Canvas.TextWidth(Text),
     2720      Y - Round(1.5 * IconSize) - Canvas.TextHeight(Text) div 2, Text);
     2721  end;
    25242722
    25252723  // Show train grabbed by mouse
     
    26332831        Redraw;
    26342832      end;
     2833    end;
     2834
     2835    if Assigned(City) and (ServedPassengerCount >= City.PassengersCountToUnlock) then begin
     2836      State := gsSuccess;
     2837      Redraw;
    26352838    end;
    26362839  end;
     
    27112914      Redraw;
    27122915    end else
    2713     if State = gsGameOver then begin
     2916    if State in [gsGameOver, gsSuccess] then begin
    27142917      ButtonBack.MouseUp(Position);
    27152918    end else
     
    28903093  KeyF5 = 116;
    28913094  KeyF6 = 117;
     3095  KeyF7 = 118;
     3096  KeyT = 84;
     3097  KeyC = 67;
     3098  KeyF = 70;
     3099  KeyP = 80;
    28923100begin
    28933101  if Key = KeyEsc then begin
     
    28993107    end;
    29003108  end;
     3109  if State in [gsRunning, gsPaused] then begin
     3110    if Key = KeyT then begin
     3111      if Trains.GetUnusedCount > 0 then begin
     3112        SelectedTrain := Trains.GetUnused;
     3113        Redraw;
     3114      end;
     3115    end else
     3116    if Key = KeyC then begin
     3117      if Carriages.GetUnusedCount > 0 then begin
     3118        SelectedCarriage := Carriages.GetUnused;
     3119        Redraw;
     3120      end;
     3121    end else
     3122    if Key = KeyF then begin
     3123      ButtonFastForward(Self);
     3124    end else
     3125    if Key = KeyP then begin
     3126      ButtonPlay(Self);
     3127    end;
     3128  end;
    29013129  {$IFDEF DEBUG}
    29023130  if State in [gsRunning, gsPaused] then begin
     
    29213149      ResizeView;
    29223150      Redraw;
     3151    end else
     3152    if Key = KeyF7 then begin
     3153      State := gsSuccess;
     3154      Redraw;
    29233155    end;
    29243156  end;
     
    29343166procedure TEngine.Clear;
    29353167begin
     3168  ServedPassengerCount := 0;
    29363169  Week := 1;
    29373170  Trains.Clear;
     
    29483181  NewStation: TMapStation;
    29493182  InitialStationCount: Integer;
     3183  InitialLineCount: Integer;
    29503184begin
    29513185  Clear;
     3186  if Assigned(City) then begin
     3187    LineColors := City.LineColors;
     3188    InitialLineCount := City.InitialLineCount;
     3189  end else begin
     3190    LineColors := [clBlue, clRed, clDarkYellow, clGreen,
     3191       clPurple, clGray, clOrange, clBrown, clCyan];
     3192    InitialLineCount := 3;
     3193  end;
    29523194  AvailableImprovements := [miCarriage, miLine];
    29533195  ShapeCount := 3;
    2954   ServedPassengerCount := 0;
    29553196
    29563197  // Start with 3 stations with each different shape
     
    29633204  end;
    29643205
    2965   for I := 0 to 2 do begin
    2966     Lines.AddNew;
     3206  for I := 0 to InitialLineCount - 1 do begin
     3207    Lines.AddNew(LineColors[Lines.Count]);
    29673208    NewTrain := TMetroTrain.Create;
    29683209    Trains.Add(NewTrain);
     
    29883229end;
    29893230
    2990 procedure TEngine.LoadFromRegistry(Context: TRegistryContext);
     3231procedure TEngine.LoadFromRegistry;
    29913232begin
    29923233  with TRegistryEx.Create do
    29933234  try
    2994     CurrentContext := Context;
     3235    CurrentContext := RegistryContext;
    29953236    DarkMode := ReadBoolWithDefault('DarkMode', False);
    29963237    HighestServedPassengerCount := ReadIntegerWithDefault('HighestPassengers', 0);
    29973238    HighestServedDaysCount := ReadIntegerWithDefault('HighestDays', 0);
     3239    Cities.LoadFromRegistry(TRegistryContext.Create(RegistryContext.RootKey, RegistryContext.Key + '/Cities'));
    29983240  finally
    29993241    Free;
     
    30013243end;
    30023244
    3003 procedure TEngine.SaveToRegistry(Context: TRegistryContext);
     3245procedure TEngine.SaveToRegistry;
    30043246begin
    30053247  with TRegistryEx.Create do
    30063248  try
    3007     CurrentContext := Context;
     3249    CurrentContext := RegistryContext;
    30083250
    30093251    WriteBool('DarkMode', DarkMode);
    30103252    WriteInteger('HighestPassengers', HighestServedPassengerCount);
    30113253    WriteInteger('HighestDays', HighestServedDaysCount);
     3254    Cities.SaveToRegistry(TRegistryContext.Create(RegistryContext.RootKey, RegistryContext.Key + '/Cities'));
    30123255  finally
    30133256    Free;
     
    30233266  ButtonBack.OnClick := ButtonBackClick;
    30243267  ButtonBack.Bounds := Bounds(0, 0, ScaleX(80, 96), ScaleY(80, 96));
     3268  Cities := TCities.Create;
     3269  InitCities;
    30253270  MenuMain := TMenu.Create;
    30263271  MenuOptions := TMenu.Create;
     3272  MenuCareer := TMenu.Create;
    30273273  MenuGame := TMenu.Create;
    30283274  Menu := MenuMain;
     
    30493295  ImageFastForward := TImage.Create;
    30503296  ImageFastForward.OnClick := ButtonFastForward;
     3297  ImageAchievement := TImage.Create;
    30513298  ImageNewTrain := TImage.Create;
    30523299  ImageNewTrain.OnClick := ButtonNewTrain;
     
    30563303  ImageNewImprovement2.OnClick := ButtonNewImprovement2;
    30573304  MetaCanvas := TMetaCanvas.Create;
    3058   Cities := TCities.Create;
    3059   InitCities;
    30603305  Colors.Init(FDarkMode);
    30613306end;
     
    30633308destructor TEngine.Destroy;
    30643309begin
    3065   FreeAndNil(Cities);
    30663310  FreeAndNil(MetaCanvas);
    30673311  FreeAndNil(Trains);
     
    30753319  FreeAndNil(ImagePlay);
    30763320  FreeAndNil(ImageFastForward);
     3321  FreeAndNil(ImageAchievement);
    30773322  FreeAndNil(ImagePause);
    30783323  FreeAndNil(ImageCarriage);
     
    30863331  FreeAndNil(MenuMain);
    30873332  FreeAndNil(MenuOptions);
     3333  FreeAndNil(MenuCareer);
    30883334  FreeAndNil(MenuGame);
     3335  FreeAndNil(Cities);
    30893336  FreeAndNil(ButtonBack);
    30903337  inherited;
     
    31123359  MetaCanvas.DrawTo(Canvas);
    31133360
    3114   // Game over
    31153361  if State = gsGameOver then
    31163362  begin
    31173363    DrawGameOver(Canvas, CanvasSize);
     3364    DrawGameControls(Canvas, CanvasSize);
     3365  end else
     3366  if State = gsSuccess then
     3367  begin
     3368    DrawSuccess(Canvas, CanvasSize);
    31183369    DrawGameControls(Canvas, CanvasSize);
    31193370  end else
  • trunk/UMenu.pas

    r95 r100  
    1414    BackgroundColor: TColor;
    1515    BackgroundSelectedColor: TColor;
     16    TextColor: TColor;
     17    TextDisabledColor: TColor;
    1618    Kind: TMenuItemKind;
    1719    Text: string;
    1820    Selected: Boolean;
    19     FontSize: Integer;
    20     FontColor: Integer;
     21    TextSize: Integer;
    2122    function GetOutputText: string; virtual;
    2223    constructor Create; override;
     
    125126begin
    126127  Enabled := True;
    127   FontSize := 40;
    128   FontColor := clWhite;
     128  TextSize := 40;
     129  TextColor := clWhite;
     130  TextDisabledColor := clSilver;
    129131end;
    130132
     
    180182    if Items[I].Bounds.Contains(Position) then begin
    181183      if (Items[I] is TMenuItemButton) then begin
    182         if Assigned(TMenuItemButton(Items[I]).OnClick) then
    183           TMenuItemButton(Items[I]).OnClick(Items[I]);
     184        TMenuItemButton(Items[I]).MouseUp(Position);
    184185      end else
    185186      if (Items[I] is TMenuItemCheckBox) then begin
     
    215216    Brush.Style := bsSolid;
    216217    for I := 0 to Items.Count - 1 do begin
    217       Font.Size := Items[I].FontSize;
     218      Font.Size := Items[I].TextSize;
    218219      if TotalWidth < TextWidth(Items[I].GetOutputText) then
    219220        TotalWidth := TextWidth(Items[I].GetOutputText);
     
    229230    Brush.Style := bsSolid;
    230231    for I := 0 to Items.Count - 1 do begin
    231       Font.Size := Items[I].FontSize;
    232       Font.Color := Items[I].FontColor;
     232      Font.Size := Items[I].TextSize;
     233      if Items[I].Enabled then Font.Color := Items[I].TextColor
     234        else Font.Color := Items[I].TextDisabledColor;
    233235      Items[I].Bounds.Left := X;
    234236      Items[I].Bounds.Top := Y;
Note: See TracChangeset for help on using the changeset viewer.