Changeset 505 for trunk


Ignore:
Timestamp:
Dec 24, 2023, 11:24:57 PM (11 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Battle.pas

    r496 r505  
    112112    VLightGradient(ca, xm - 8, ym + 8 + LABaseDamage, LADamage - LABaseDamage,
    113113      FanaticColor);
    114   BitBltCanvas(ca, xm - 12, ym - 12, 24, 24,
    115     HGrSystem.Mask.Canvas, 26, 146, SRCAND);
    116   BitBltCanvas(ca, xm - 12, ym - 12, 24, 24,
    117     HGrSystem.Data.Canvas, 26, 146, SRCPAINT);
     114  Sprite(ca, HGrSystem, xm - 12, ym - 12, 24, 24, 26, 146);
    118115
    119116  LabelText := Format('%d', [Forecast.AStr]);
     
    139136    BitBltCanvas(ca, xm + 9 + LDDamage - 7, ym - 6, 14, 17,
    140137      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    141     BitBltCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
    142       HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    143     BitBltCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
    144       HGrSystem.Data.Canvas, 51, 153, SRCPAINT);
     138    Sprite(ca, HGrSystem, xm + 8 + LDDamage - 7, ym - 7, 14, 17, 51, 153);
    145139  end;
    146140  LabelText := Format('%d', [DDamage]);
     
    159153    BitBltCanvas(ca, xm - 6, ym + 9 + LADamage - 7, 14, 17,
    160154      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    161     BitBltCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
    162       HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    163     BitBltCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
    164       HGrSystem.Data.Canvas, 51, 153, SRCPAINT);
     155    Sprite(ca, HGrSystem, xm - 7, ym + 8 + LADamage - 7, 14, 17, 51, 153);
    165156  end;
    166157  LabelText := Format('%d', [MyUn[uix].Health - Forecast.EndHealthAtt]);
  • trunk/LocalPlayer/MessgEx.pas

    r484 r505  
    195195  if GameMode = cMovie then
    196196  begin
    197     if not((GameMode = cMovie) and (MovieSpeed = 4)) then
     197    if not ((GameMode = cMovie) and (MovieSpeed = 4)) then
    198198    begin
    199199      MovieCancelled := False;
     
    230230  ix, iy, xDst, yDst, dx, dy, xIcon, yIcon: Integer;
    231231  BookRect: TRect;
    232   x1, xR, yR, share: Single;
     232  x1, xR, yR, Share: Single;
    233233  Screwed: TScrewed;
    234234  SrcPtr: TPixelPointer;
     
    257257          for dy := 0 to 1 do begin
    258258            if dx = 0 then
    259               share := 1 - xR
     259              Share := 1 - xR
    260260            else
    261               share := xR;
     261              Share := xR;
    262262            if dy = 0 then
    263               share := share * (1 - yR)
     263              Share := Share * (1 - yR)
    264264            else
    265               share := share * yR;
     265              Share := Share * yR;
    266266            if (xDst + dx < wScrewed) and
    267267            (yDst + dy < hScrewed) then begin
    268268              Screwed[xDst + dx, yDst + dy, 0] := Screwed[xDst + dx, yDst + dy, 0]
    269                 + share * SrcPtr.Pixel^.B;
     269                + Share * SrcPtr.Pixel^.B;
    270270              Screwed[xDst + dx, yDst + dy, 1] := Screwed[xDst + dx, yDst + dy, 1]
    271                 + share * SrcPtr.Pixel^.G;
     271                + Share * SrcPtr.Pixel^.G;
    272272              Screwed[xDst + dx, yDst + dy, 2] := Screwed[xDst + dx, yDst + dy, 2]
    273                 + share * SrcPtr.Pixel^.R;
     273                + Share * SrcPtr.Pixel^.R;
    274274              Screwed[xDst + dx, yDst + dy, 3] := Screwed[xDst + dx, yDst + dy,
    275                 3] + share;
     275                3] + Share;
    276276            end;
    277277        end;
     
    313313procedure TMessgExDlg.PaintEnemyArmy;
    314314var
    315   emix, ix, iy, X, Y, count, UnitsInLine: Integer;
     315  emix, ix, iy, X, Y, Count, UnitsInLine: Integer;
    316316begin
    317317  ix := 0;
     
    322322    UnitsInLine := nLostArmy;
    323323  for emix := 0 to MyRO.nEnemyModel - 1 do
    324     for count := 0 to LostArmy[emix] - 1 do
     324    for Count := 0 to LostArmy[emix] - 1 do
    325325    begin
    326326      X := Width div 2 + ix * 64 - UnitsInLine * 32;
     
    328328      with MyRO.EnemyModel[emix], Tribe[Owner].ModelPicture[mix] do
    329329      begin
    330         BitBltCanvas(Canvas, X, Y, 64, 48, HGr.Mask.Canvas,
    331           pix mod 10 * 65 + 1, pix div 10 * 49 + 1, SRCAND);
    332         BitBltCanvas(Canvas, X, Y, 64, 48, HGr.Data.Canvas,
    333           pix mod 10 * 65 + 1, pix div 10 * 49 + 1, SRCPAINT);
     330        Sprite(Canvas, HGr, X, Y, 64, 48, pix mod 10 * 65 + 1, pix div 10 * 49 + 1);
    334331      end;
    335332
     
    401398        FrameImage(Canvas, BigImp, Width div 2 - 28, 24, xSizeBig,
    402399          ySizeBig, 0, 0);
    403         BitBltCanvas(Canvas, Width div 2 - 32, 20, 64, 44,
    404           HGr.Mask.Canvas, pix mod 10 * 65 + 1,
    405           pix div 10 * 49 + 1, SRCAND);
    406         BitBltCanvas(Canvas, Width div 2 - 32, 20, 64, 44,
    407           HGr.Data.Canvas, pix mod 10 * 65 + 1,
    408           pix div 10 * 49 + 1, SRCPAINT);
     400        Sprite(Canvas, HGr, Width div 2 - 32, 20, 64, 44, pix mod 10 * 65 + 1,
     401          pix div 10 * 49 + 1);
    409402      end;
    410403    mikBook:
  • trunk/Packages/CevoComponents/ButtonN.pas

    r471 r505  
    3636
    3737procedure Register;
     38
    3839
    3940implementation
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r502 r505  
    3232function LoadGraphicFile(Bmp: TBitmap; FileName: string; Options: TLoadGraphicFileOptions = []): Boolean;
    3333function LoadGraphicSet(const Name: string; Transparency: Boolean = True): TGraphicSet;
    34 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
     34procedure Dump(Dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    3535procedure BitmapReplaceColor(Dst: TBitmap; X, Y, Width, Height: Integer; OldColor, NewColor: TColor);
    3636procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    3737  overload;
    38 procedure Sprite(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
     38procedure Sprite(Canvas: TCanvas; xDst, yDst: Integer; GraphicSetItem: TGraphicSetItem);
     39  overload;
     40procedure Sprite(Dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    3941  overload;
    4042procedure MakeBlue(Dst: TBitmap; X, Y, Width, Height: Integer);
     
    8587procedure VDarkGradient(Canvas: TCanvas; X, Y, Height, Kind: Integer);
    8688procedure UnderlinedTitleValue(Canvas: TCanvas; Title, Value: string; X, Y, Width: Integer);
    87 procedure NumberBar(dst: TBitmap; X, Y: Integer; Cap: string; val: Integer;
     89procedure NumberBar(Dst: TBitmap; X, Y: Integer; Cap: string; val: Integer;
    8890  T: TTexture);
    89 procedure CountBar(dst: TBitmap; X, Y, W: Integer; Kind: Integer;
     91procedure CountBar(Dst: TBitmap; X, Y, W: Integer; Kind: Integer;
    9092  Cap: string; val: Integer; T: TTexture);
    9193procedure PaintProgressBar(Canvas: TCanvas; Kind, X, Y, Pos, Growth, Max: Integer;
     
    562564end;
    563565
    564 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    565 begin
    566   BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height,
     566procedure Dump(Dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
     567begin
     568  BitBltCanvas(Dst.Canvas, xDst, yDst, Width, Height,
    567569    HGr.Data.Canvas, xGr, yGr);
    568570end;
     
    863865procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    864866begin
    865   BitBltCanvas(Canvas, xDst, yDst, Width, Height,
    866     HGr.Mask.Canvas, xGr, yGr, SRCAND);
    867   BitBltCanvas(Canvas, xDst, yDst, Width, Height,
    868     HGr.Data.Canvas, xGr, yGr, SRCPAINT);
    869 end;
    870 
    871 procedure Sprite(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    872 begin
    873   BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height,
    874     HGr.Mask.Canvas, xGr, yGr, SRCAND);
    875   BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height,
    876     HGr.Data.Canvas, xGr, yGr, SRCPAINT);
     867  BitBltCanvas(Canvas, xDst, yDst, Width, Height, HGr.Mask.Canvas, xGr, yGr, SRCAND);
     868  BitBltCanvas(Canvas, xDst, yDst, Width, Height, HGr.Data.Canvas, xGr, yGr, SRCPAINT);
     869end;
     870
     871procedure Sprite(Canvas: TCanvas; xDst, yDst: Integer; GraphicSetItem: TGraphicSetItem);
     872begin
     873  Sprite(Canvas, GraphicSetItem.GraphicSet, xDst, yDst, GraphicSetItem.Width,
     874    GraphicSetItem.Height, GraphicSetItem.Left, GraphicSetItem.Top);
     875end;
     876
     877procedure Sprite(Dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
     878begin
     879  Sprite(Dst.Canvas, HGr, xDst, yDst, Width, Height, xGr, yGr);
    877880end;
    878881
     
    12111214  procedure PaintIcon(X, Y, Kind: Integer);
    12121215  begin
    1213     BitBltCanvas(Canvas, X, Y + 6, 10, 10, HGrSystem.Mask.Canvas,
    1214       66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCAND);
    1215     BitBltCanvas(Canvas, X, Y + 6, 10, 10, HGrSystem.Data.Canvas,
    1216       66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCPAINT);
     1216    Sprite(Canvas, HGrSystem, X, Y + 6, 10, 10,
     1217      66 + Kind mod 11 * 11, 115 + Kind div 11 * 11);
    12171218  end;
    12181219
     
    13831384end;
    13841385
    1385 procedure NumberBar(dst: TBitmap; X, Y: Integer; Cap: string;
     1386procedure NumberBar(Dst: TBitmap; X, Y: Integer; Cap: string;
    13861387  val: Integer; T: TTexture);
    13871388var
     
    13901391  if val > 0 then
    13911392  begin
    1392     DLine(dst.Canvas, X - 2, X + 170, Y + 16, T.ColorBevelShade,
     1393    DLine(Dst.Canvas, X - 2, X + 170, Y + 16, T.ColorBevelShade,
    13931394      T.ColorBevelLight);
    1394     LoweredTextOut(dst.Canvas, -1, T, X - 2, Y, Cap);
     1395    LoweredTextOut(Dst.Canvas, -1, T, X - 2, Y, Cap);
    13951396    S := IntToStr(val);
    1396     RisedTextOut(dst.Canvas, X + 170 - BiColorTextWidth(dst.Canvas,
     1397    RisedTextOut(Dst.Canvas, X + 170 - BiColorTextWidth(Dst.Canvas,
    13971398      S), Y, S);
    13981399  end;
    13991400end;
    14001401
    1401 procedure CountBar(dst: TBitmap; X, Y, W: Integer; Kind: Integer;
     1402procedure CountBar(Dst: TBitmap; X, Y, W: Integer; Kind: Integer;
    14021403  Cap: string; val: Integer; T: TTexture);
    14031404var
     
    14091410    Exit;
    14101411  Assert(Kind >= 0);
    1411   with dst.Canvas do
     1412  with Dst.Canvas do
    14121413  begin
    14131414    // xIcon:=x+100;
    14141415    // yIcon:=y;
    1415     // DLine(dst.Canvas,x-2,x+170+32,y+16,T.ColorBevelShade,T.ColorBevelLight);
     1416    // DLine(Dst.Canvas,x-2,x+170+32,y+16,T.ColorBevelShade,T.ColorBevelLight);
    14161417
    14171418    xIcon := X - 5;
    14181419    yIcon := Y + 15;
    1419     DLine(dst.Canvas, X - 2, xIcon + W + 2, yIcon + 16, T.ColorBevelShade,
     1420    DLine(Dst.Canvas, X - 2, xIcon + W + 2, yIcon + 16, T.ColorBevelShade,
    14201421      T.ColorBevelLight);
    14211422
     
    14251426    else
    14261427      cl := -1;
    1427     LoweredTextOut(dst.Canvas, cl, T, X - 2, Y, Cap);
    1428     LoweredTextOut(dst.Canvas, cl, T,
    1429       xIcon + W + 2 - BiColorTextWidth(dst.Canvas, S), yIcon, S);
     1428    LoweredTextOut(Dst.Canvas, cl, T, X - 2, Y, Cap);
     1429    LoweredTextOut(Dst.Canvas, cl, T,
     1430      xIcon + W + 2 - BiColorTextWidth(Dst.Canvas, S), yIcon, S);
    14301431
    14311432    if (Kind = 12) and (val >= 100) then
     
    14411442      for I := 0 to val mod 10 - 1 do
    14421443      begin
    1443         BitBltCanvas(dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 2 + 1, 14,
     1444        BitBltCanvas(Dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 2 + 1, 14,
    14441445          14, HGrSystem.Mask.Canvas, 67 + Kind mod 8 * 15,
    14451446          70 + Kind div 8 * 15, SRCAND);
    1446         Sprite(dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2,
     1447        Sprite(Dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2,
    14471448          14, 14, 67 + Kind mod 8 * 15, 70 + Kind div 8 * 15);
    14481449      end;
    14491450      for I := 0 to val div 10 - 1 do
    14501451      begin
    1451         BitBltCanvas(dst.Canvas, xIcon + 4 + (val mod 10) *
     1452        BitBltCanvas(Dst.Canvas, xIcon + 4 + (val mod 10) *
    14521453          (14 * ld div sd) + I * (14 * ld div sd), yIcon + 3, 14, 14,
    14531454          HGrSystem.Mask.Canvas, 67 + 7 mod 8 * 15,
    14541455          70 + 7 div 8 * 15, SRCAND);
    1455         Sprite(dst, HGrSystem, xIcon + 3 + (val mod 10) *
     1456        Sprite(Dst, HGrSystem, xIcon + 3 + (val mod 10) *
    14561457          (14 * ld div sd) + I * (14 * ld div sd), yIcon + 2, 14,
    14571458          14, 67 + 7 mod 8 * 15,
     
    14741475      for I := 0 to val div 10 - 1 do
    14751476      begin
    1476         BitBltCanvas(dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 3, 14, 14,
     1477        BitBltCanvas(Dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 3, 14, 14,
    14771478          HGrSystem.Mask.Canvas, 67 + Kind mod 8 * 15,
    14781479          70 + Kind div 8 * 15, SRCAND);
    1479         Sprite(dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2,
     1480        Sprite(Dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2,
    14801481          14, 14, 67 + Kind mod 8 * 15, 70 + Kind div 8 * 15);
    14811482      end;
    14821483      for I := 0 to val mod 10 - 1 do
    14831484      begin
    1484         BitBltCanvas(dst.Canvas, xIcon + 4 + (val div 10) *
     1485        BitBltCanvas(Dst.Canvas, xIcon + 4 + (val div 10) *
    14851486          (14 * ld div sd) + I * (10 * ld div sd), yIcon + 7, 10, 10,
    14861487          HGrSystem.Mask.Canvas, 66 + Kind mod 11 * 11,
    14871488          115 + Kind div 11 * 11, SRCAND);
    1488         Sprite(dst, HGrSystem, xIcon + 3 + (val div 10) *
     1489        Sprite(Dst, HGrSystem, xIcon + 3 + (val div 10) *
    14891490          (14 * ld div sd) + I * (10 * ld div sd), yIcon + 6, 10,
    14901491          10, 66 + Kind mod 11 * 11,
  • trunk/Start.pas

    r496 r505  
    649649
    650650  if Page = pgMain then begin
    651     if SelectedAction <> maNone then // mark selected action
     651   if SelectedAction <> maNone then // mark selected action
    652652      for I := 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do
    653653      begin
     
    714714      for I := 12 to 19 do
    715715        if (I < 13) or (I > 17) then begin
    716           BitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    717             HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND);
    718           BitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    719             HGrSystem2.Data.Canvas, Ornament.Left, Ornament.Top, SRCPAINT);
     716          Sprite(Canvas, 9 + I * 27, yLogo - 2, Ornament);
    720717        end;
    721718      PaintLogo(Canvas, 69 + 11 * 27, yLogo, MainTexture.ColorBevelLight,
     
    796793      S := Phrases.Lookup('AUTODIFF', AutoDiff - 1);
    797794      RisedTextOut(Canvas, 272 - BiColorTextWidth(Canvas, S), y0Mini + 61, S);
    798 
    799795      for I := 0 to 19 do
    800796        if (I < 2) or (I > 6) then begin
    801           BitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    802             HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND);
    803           BitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    804             HGrSystem2.Data.Canvas, Ornament.Left, Ornament.Top, SRCPAINT);
     797          Sprite(Canvas, 9 + I * 27, yLogo - 2, Ornament);
    805798        end;
    806799      PaintLogo(Canvas, 69, yLogo, MainTexture.ColorBevelLight,
Note: See TracChangeset for help on using the changeset viewer.