Changeset 190


Ignore:
Timestamp:
May 7, 2020, 10:33:59 AM (4 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Direct.pas

    r143 r190  
    129129          ShowModal;
    130130          if ModalResult = mrOK then
    131             OpenURL('http://c-evo.org/_sg/contact/cevobug.html');
     131            OpenURL(CevoContactBug);
    132132        end
    133133    *)
     
    218218    Application.MessageBox(PChar(Phrases.Lookup('NOAI')), 'C-evo', 0);
    219219    Close;
    220     exit
     220    exit;
    221221  end;
    222222  Quick := false;
     
    244244      begin
    245245        SimpleMessage(Phrases.Lookup('LOADERR'));
    246         Close
    247       end
    248     end
    249   end;
    250   if not Quick then
    251   begin
     246        Close;
     247      end;
     248    end;
     249  end;
     250  if not Quick then begin
    252251    background.Show;
    253     StartDlg.Show
    254   end
     252    StartDlg.Show;
     253  end;
    255254end;
    256255
     
    310309    PaintProgressBar(Canvas, 6, ClientWidth div 2 - 64, 40, State, 128 - State,
    311310      128, MainTexture);
    312   end
     311  end;
    313312end;
    314313
  • trunk/Global.pas

    r189 r190  
    77  CevoMapExt = '.cevo map';
    88  CevoHomepage = 'http://c-evo.org';
    9   CevoHomepageContact = 'http://c-evo.org/_sg/contact';
     9  CevoContact = 'http://c-evo.org/_sg/contact';
     10  CevoContactBug = 'http://c-evo.org/_sg/contact/cevobug.html';
    1011  AppRegistryKey = '\SOFTWARE\C-evo';
     12  AITemplateFileName = 'AI Template' + DirectorySeparator + 'AI development manual.html';
    1113
    1214implementation
  • trunk/LocalPlayer/Help.pas

    r189 r190  
    19481948      if Link shr 8 and $3F = hkInternet then
    19491949        case Link and $FF of
    1950           1: OpenDocument(pchar(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html'));
     1950          1: OpenDocument(HomeDir + AITemplateFileName);
    19511951          2: OpenURL(CevoHomepage);
    1952           3: OpenURL(CevoHomepageContact);
     1952          3: OpenURL(CevoContact);
    19531953        end
    19541954      else
  • trunk/LocalPlayer/MessgEx.pas

    r188 r190  
    345345        if UnitsInLine > LostUnitsPerLine then
    346346          UnitsInLine := LostUnitsPerLine;
    347       end
     347      end;
    348348    end;
    349349end;
     
    450450  if OpenSound <> '' then
    451451    PostMessage(Handle, WM_PLAYSOUND, 0, 0);
    452 end; { FormPaint }
     452end;
    453453
    454454procedure TMessgExDlg.Button1Click(Sender: TObject);
     
    469469procedure TMessgExDlg.Button3Click(Sender: TObject);
    470470begin
    471   ModalResult := mrCancel
     471  ModalResult := mrCancel;
    472472end;
    473473
    474474procedure TMessgExDlg.RemoveBtnClick(Sender: TObject);
    475475begin
    476   ModalResult := mrNo
     476  ModalResult := mrNo;
    477477end;
    478478
     
    485485      ModalResult := mrCancel
    486486    else if Button2.Visible then
    487       ModalResult := mrIgnore
     487      ModalResult := mrIgnore;
    488488end;
    489489
     
    497497    Kind := mkOk;
    498498    ShowModal;
    499   end
     499  end;
    500500end;
    501501
     
    522522    Kind := QueryKind;
    523523    ShowModal;
    524     result := ModalResult
    525   end
     524    result := ModalResult;
     525  end;
    526526end;
    527527
     
    537537    HelpNo := ContextNo;
    538538    ShowModal;
    539   end
     539  end;
    540540end;
    541541
     
    552552end;
    553553
     554
    554555initialization
    555556
  • trunk/LocalPlayer/TechTree.pas

    r188 r190  
    7878  X, w: Integer;
    7979begin
    80   with Canvas do
    81   begin
     80  with Canvas do begin
    8281    // black border
    8382    brush.color := $000000;
     
    120119procedure TTechTreeDlg.FormShow(Sender: TObject);
    121120var
    122   X, Y, ad, TexWidth, TexHeight: Integer;
     121  X, Y, ad: Integer;
    123122  s: string;
    124   SrcPixel, DstPixel: TPixelPointer;
    125 begin
    126   if Image = nil then
    127   begin
     123const
     124  TransparentColor = $7F007F;
     125begin
     126  if Image = nil then begin
    128127    Image := TBitmap.Create;
    129128    Image.PixelFormat := pf24bit;
    130129    LoadGraphicFile(Image, HomeDir + 'Help' + DirectorySeparator + 'AdvTree.png', gfNoGamma);
    131130
    132     with Image.Canvas do
    133     begin
     131    with Image.Canvas do begin
    134132      // write advance names
    135133      Font.Assign(UniFont[ftSmall]);
     
    147145            TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, s);
    148146            Pixels[xStart + X * xPitch + 10, yStart + Y * yPitch - 1]
    149               := $7F007F;
     147              := TransparentColor;
    150148          end
    151149        end;
     
    162160    end;
    163161
    164     // texturize background
    165     Image.BeginUpdate;
    166     TexWidth := Paper.Width;
    167     TexHeight := Paper.Height;
    168     DstPixel.Init(Image);
    169     SrcPixel.Init(Paper);
    170     for Y := 0 to Image.Height - 1 do begin
    171       for X := 0 to Image.Width - 1 do begin
    172         if (DstPixel.Pixel^.ARGB and $FFFFFF) = $7F007F then begin // transparent
    173           SrcPixel.SetXY(X mod TexWidth, Y mod TexHeight);
    174           DstPixel.Pixel^.B := SrcPixel.Pixel^.B;
    175           DstPixel.Pixel^.G := SrcPixel.Pixel^.G;
    176           DstPixel.Pixel^.R := SrcPixel.Pixel^.R;
    177         end;
    178         DstPixel.NextPixel;
    179       end;
    180       DstPixel.NextLine;
    181     end;
    182     Image.EndUpdate;
     162    Texturize(Image, Paper, TransparentColor);
    183163  end;
    184164
     
    205185    xDown := X;
    206186    yDown := Y;
    207   end
     187  end;
    208188end;
    209189
     
    235215
    236216    SmartInvalidate;
    237   end
     217  end;
    238218end;
    239219
     
    247227procedure TTechTreeDlg.CloseBtnClick(Sender: TObject);
    248228begin
    249   Close();
     229  Close;
    250230end;
    251231
  • trunk/LocalPlayer/Term.pas

    r189 r190  
    68576857  end
    68586858  else if Sender = mWebsite then
    6859     OpenURL('http://c-evo.org')
     6859    OpenURL(CevoHomepage)
    68606860  else if Sender = mRandomMap then
    68616861  begin
  • trunk/Packages/CevoComponents/Directories.pas

    r189 r190  
    3838  end;
    3939  if Lang = '' then begin
     40    T := '';
    4041    LazGetLanguageIDs(Lang, T);
    4142    Lang := Copy(Lang, 1, 2);
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r189 r190  
    8181function SetMainTextureByAge(Age: integer): boolean;
    8282procedure LoadPhrases;
     83procedure Texturize(Dest, Texture: TBitmap; TransparentColor: Integer);
    8384
    8485const
     
    13981399end;
    13991400
     1401procedure Texturize(Dest, Texture: TBitmap; TransparentColor: Integer);
     1402var
     1403  SrcPixel, DstPixel: TPixelPointer;
     1404  X, Y: Integer;
     1405  TexWidth, TexHeight: Integer;
     1406begin
     1407  // texturize background
     1408  Dest.BeginUpdate;
     1409  TexWidth := Texture.Width;
     1410  TexHeight := Texture.Height;
     1411  DstPixel.Init(Dest);
     1412  SrcPixel.Init(Texture);
     1413  for Y := 0 to Dest.Height - 1 do begin
     1414    for X := 0 to Dest.Width - 1 do begin
     1415      if (DstPixel.Pixel^.ARGB and $FFFFFF) = TransparentColor then begin
     1416        SrcPixel.SetXY(X mod TexWidth, Y mod TexHeight);
     1417        DstPixel.Pixel^.B := SrcPixel.Pixel^.B;
     1418        DstPixel.Pixel^.G := SrcPixel.Pixel^.G;
     1419        DstPixel.Pixel^.R := SrcPixel.Pixel^.R;
     1420      end;
     1421      DstPixel.NextPixel;
     1422    end;
     1423    DstPixel.NextLine;
     1424  end;
     1425  Dest.EndUpdate;
     1426end;
     1427
    14001428procedure LoadFonts;
    14011429var
  • trunk/Start.pas

    r189 r190  
    446446
    447447  ActionsOffered := [maConfig, maManual, maCredits, maWeb];
    448   if FileExists(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html') then
     448  if FileExists(HomeDir + AITemplateFileName) then
    449449    Include(ActionsOffered, maAIDev);
    450450
     
    16711671        DirectHelp(cStartCredits);
    16721672      maAIDev:
    1673         OpenDocument(pchar(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html'));
     1673        OpenDocument(HomeDir + AITemplateFileName);
    16741674      maWeb:
    16751675        OpenURL(CevoHomepage);
Note: See TracChangeset for help on using the changeset viewer.