Changeset 189 for trunk/LocalPlayer


Ignore:
Timestamp:
May 7, 2020, 12:46:55 AM (5 years ago)
Author:
chronos
Message:
  • Added: New Global unit with global constants.
  • Modified: Multiple occurence of string constants used for subdirectories replaced by functions.
Location:
trunk/LocalPlayer
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityScreen.pas

    r188 r189  
    216216  Template := TBitmap.Create;
    217217  Template.PixelFormat := pf24bit;
    218   LoadGraphicFile(Template, HomeDir + 'Graphics' + DirectorySeparator + 'City.png', gfNoGamma);
     218  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'City.png', gfNoGamma);
    219219  CityMapTemplate := TBitmap.Create;
    220220  CityMapTemplate.PixelFormat := pf24bit;
    221   LoadGraphicFile(CityMapTemplate, HomeDir + 'Graphics' + DirectorySeparator + 'BigCityMap.png', gfNoGamma);
     221  LoadGraphicFile(CityMapTemplate, GetGraphicsDir + DirectorySeparator + 'BigCityMap.png', gfNoGamma);
    222222  SmallCityMapTemplate := TBitmap.Create;
    223223  SmallCityMapTemplate.PixelFormat := pf24bit;
    224   LoadGraphicFile(SmallCityMapTemplate, HomeDir + 'Graphics' + DirectorySeparator + 'SmallCityMap.png',
     224  LoadGraphicFile(SmallCityMapTemplate, GetGraphicsDir + DirectorySeparator + 'SmallCityMap.png',
    225225    gfNoGamma);
    226226  SmallCityMap := TBitmap.Create;
  • trunk/LocalPlayer/Draft.pas

    r188 r189  
    9292  Template := TBitmap.Create;
    9393  Template.PixelFormat := pf24bit;
    94   LoadGraphicFile(Template, HomeDir + 'Graphics' + DirectorySeparator + 'MiliRes.png', gfNoGamma);
     94  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'MiliRes.png', gfNoGamma);
    9595end;
    9696
  • trunk/LocalPlayer/Help.pas

    r188 r189  
    55
    66uses
    7   Protocol, ScreenTools, BaseWin, StringTables, Math,
    8   LCLIntf, LCLType, LMessages, Messages, SysUtils, Classes, Graphics, Controls, Forms,
    9   ExtCtrls, ButtonB, PVSB, Types, fgl;
     7  Protocol, ScreenTools, BaseWin, StringTables, Math, LCLIntf, LCLType,
     8  LMessages, Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls,
     9  ButtonB, PVSB, Types, fgl;
    1010
    1111const
     
    123123  HelpDlg: THelpDlg;
    124124
     125
    125126implementation
    126127
    127128uses
    128   Directories, ClientTools, Term, Tribes, Inp, Messg, PixelPointer;
     129  Directories, ClientTools, Term, Tribes, Inp, Messg, PixelPointer, Global;
    129130
    130131{$R *.lfm}
     
    12291230    List := TStringList.Create;
    12301231    Plus := TStringList.Create;
    1231     if FindFirst(HomeDir + 'Graphics' + DirectorySeparator + '*.credits.txt', $27, sr) = 0 then
     1232    if FindFirst(GetGraphicsDir + DirectorySeparator + '*.credits.txt', $27, sr) = 0 then
    12321233      repeat
    1233         Plus.LoadFromFile(HomeDir + 'Graphics' + DirectorySeparator + sr.Name);
     1234        Plus.LoadFromFile(GetGraphicsDir + DirectorySeparator + sr.Name);
    12341235        List.AddStrings(Plus);
    12351236      until FindNext(sr) <> 0;
     
    12621263  begin
    12631264    List := TStringList.Create;
    1264     List.LoadFromFile(HomeDir + 'Sounds' + DirectorySeparator + 'sound.credits.txt');
     1265    List.LoadFromFile(GetSoundsDir + DirectorySeparator + 'sound.credits.txt');
    12651266    for i := 0 to List.Count - 1 do begin
    12661267      s := List[i];
     
    19481949        case Link and $FF of
    19491950          1: OpenDocument(pchar(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html'));
    1950           2: OpenURL('http://c-evo.org');
    1951           3: OpenURL('http://c-evo.org/_sg/contact');
     1951          2: OpenURL(CevoHomepage);
     1952          3: OpenURL(CevoHomepageContact);
    19521953        end
    19531954      else
  • trunk/LocalPlayer/IsoEngine.pas

    r188 r189  
    620620      if Flags and unFortified <> 0 then
    621621      begin
    622         { DataDC:=GrExt[HGrTerrain].Data.Canvas.Handle;
    623           MaskDC:=GrExt[HGrTerrain].Mask.Canvas.Handle;
     622        { DataCanvas:=GrExt[HGrTerrain].Data.Canvas;
     623          MaskCanvas:=GrExt[HGrTerrain].Mask.Canvas;
    624624          TSprite(x,y+16,12*9+7); }
    625625        Sprite(HGrStdUnits, x, y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1);
  • trunk/LocalPlayer/NatStat.pas

    r188 r189  
    9393  Template := TBitmap.Create;
    9494  Template.PixelFormat := pf24bit;
    95   LoadGraphicFile(Template, HomeDir + 'Graphics' + DirectorySeparator + 'Nation.png', gfNoGamma);
     95  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Nation.png', gfNoGamma);
    9696end;
    9797
  • trunk/LocalPlayer/Term.pas

    r188 r189  
    273273    procedure RectInvalidate(Left, Top, Rigth, Bottom: integer);
    274274    procedure SmartRectInvalidate(Left, Top, Rigth, Bottom: integer);
     275    procedure LoadSettings;
    275276    procedure SaveSettings;
    276277    procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     
    467468  Directories, IsoEngine, CityScreen, Draft, MessgEx, Select, CityType, Help,
    468469  UnitStat, Log, Diagram, NatStat, Wonders, Enhance, Nego, PixelPointer, Sound,
    469   Battle, Rates, TechTree, Registry;
     470  Battle, Rates, TechTree, Registry, Global;
    470471
    471472{$R *.lfm}
     
    34073408procedure TMainScreen.FormCreate(Sender: TObject);
    34083409var
    3409   DefaultOptionChecked: integer;
    3410   Reg: TRegistry;
    34113410  i, j: integer;
    34123411begin
     
    34373436  SaveOption[20] := mAlFastMoves.Tag;
    34383437  SaveOption[21] := mAlNoMoves.Tag;
    3439   DefaultOptionChecked := 1 shl 1 + 1 shl 7 + 1 shl 10 + 1 shl 12 + 1 shl 14 +
    3440     1 shl 18 + 1 shl 19;
    3441 
    3442   Reg := TRegistry.Create;
    3443   with Reg do
    3444   try
    3445     OpenKey(AppRegistryKey, false);
    3446     if ValueExists('TileWidth') then xxt := ReadInteger('TileWidth') div 2
    3447       else xxt := 48;
    3448     if ValueExists('TileHeight') then yyt := ReadInteger('TileHeight') div 2
    3449       else yyt := 24;
    3450     if ValueExists('OptionChecked') then OptionChecked := ReadInteger('OptionChecked')
    3451       else OptionChecked := DefaultOptionChecked;
    3452     if ValueExists('MapOptionChecked') then MapOptionChecked := ReadInteger('MapOptionChecked')
    3453       else MapOptionChecked := 1 shl moCityNames;
    3454     if ValueExists('CityReport') then CityRepMask := Cardinal(ReadInteger('CityReport'))
    3455       else CityRepMask := Cardinal(not chPopIncrease and not chNoGrowthWarning and
    3456           not chCaptured);
    3457     if OptionChecked and (7 shl 16) = 0 then
    3458       OptionChecked := OptionChecked or (1 shl 16);
    3459       // old regver with no scrolling
    3460   finally
    3461     Free;
    3462   end;
    3463 
    3464   if 1 shl 13 and OptionChecked <> 0 then
    3465     SoundMode := smOff
    3466   else if 1 shl 15 and OptionChecked <> 0 then
    3467     SoundMode := smOnAlt
    3468   else
    3469     SoundMode := smOn;
     3438
     3439  LoadSettings;
    34703440
    34713441  Screen.Cursors[crImpDrag] := LoadCursor(HInstance, 'DRAG');
     
    77777747end;
    77787748
     7749procedure TMainScreen.LoadSettings;
     7750var
     7751  Reg: TRegistry;
     7752  DefaultOptionChecked: Integer;
     7753begin
     7754  DefaultOptionChecked := 1 shl 1 + 1 shl 7 + 1 shl 10 + 1 shl 12 + 1 shl 14 +
     7755    1 shl 18 + 1 shl 19;
     7756  Reg := TRegistry.Create;
     7757  with Reg do try
     7758    OpenKey(AppRegistryKey, False);
     7759    if ValueExists('TileWidth') then xxt := ReadInteger('TileWidth') div 2
     7760      else xxt := 48;
     7761    if ValueExists('TileHeight') then yyt := ReadInteger('TileHeight') div 2
     7762      else yyt := 24;
     7763    if ValueExists('OptionChecked') then OptionChecked := ReadInteger('OptionChecked')
     7764      else OptionChecked := DefaultOptionChecked;
     7765    if ValueExists('MapOptionChecked') then MapOptionChecked := ReadInteger('MapOptionChecked')
     7766      else MapOptionChecked := 1 shl moCityNames;
     7767    if ValueExists('CityReport') then CityRepMask := Cardinal(ReadInteger('CityReport'))
     7768      else CityRepMask := Cardinal(not chPopIncrease and not chNoGrowthWarning and
     7769          not chCaptured);
     7770    if OptionChecked and (7 shl 16) = 0 then
     7771      OptionChecked := OptionChecked or (1 shl 16);
     7772      // old regver with no scrolling
     7773  finally
     7774    Free;
     7775  end;
     7776
     7777  if 1 shl 13 and OptionChecked <> 0 then
     7778    SoundMode := smOff
     7779  else if 1 shl 15 and OptionChecked <> 0 then
     7780    SoundMode := smOnAlt
     7781  else
     7782    SoundMode := smOn;
     7783end;
     7784
    77797785procedure TMainScreen.mRepClicked(Sender: TObject);
    77807786begin
  • trunk/LocalPlayer/UnitStat.pas

    r188 r189  
    8383  Template := TBitmap.Create;
    8484  Template.PixelFormat := pf24bit;
    85   LoadGraphicFile(Template, HomeDir + 'Graphics' + DirectorySeparator + 'Unit.png', gfNoGamma);
     85  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Unit.png', gfNoGamma);
    8686end;
    8787
Note: See TracChangeset for help on using the changeset viewer.