Ignore:
Timestamp:
Apr 6, 2021, 8:11:02 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Merged trunk branch version r348 into highdpi branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/Battle.pas

    r210 r349  
    66uses
    77  UDpiControls, ScreenTools, Protocol, ButtonBase, ButtonA, Types, LCLIntf, LCLType,
    8   SysUtils, Classes, Graphics, Controls, Forms, DrawDlg;
     8  SysUtils, Classes, Graphics, Controls, Forms, DrawDlg, IsoEngine;
    99
    1010type
     11
     12  { TBattleDlg }
     13
    1114  TBattleDlg = class(TDrawDlg)
    1215    OKBtn: TButtonA;
    1316    CancelBtn: TButtonA;
     17    procedure FormDestroy(Sender: TObject);
    1418    procedure FormPaint(Sender: TObject);
    1519    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
     
    2125    procedure OKBtnClick(Sender: TObject);
    2226    procedure CancelBtnClick(Sender: TObject);
     27    procedure PaintBattleOutcome(ca: TDpiCanvas; xm, ym, uix, ToLoc: Integer;
     28      Forecast: TBattleForecastEx);
     29  private
     30    IsoMap: TIsoMap;
    2331  public
    2432    uix, ToLoc: Integer;
     
    3038  BattleDlg: TBattleDlg;
    3139
    32 procedure PaintBattleOutcome(ca: TDpiCanvas; xm, ym, uix, ToLoc: Integer;
    33   Forecast: TBattleForecastEx);
    34 
    3540implementation
    3641
    3742uses
    38   Term, ClientTools, IsoEngine;
     43  Term, ClientTools;
    3944
    4045{$R *.lfm}
     
    4853  FirstStrikeColor = $A0A0A0;
    4954
    50 procedure PaintBattleOutcome(ca: TDpiCanvas; xm, ym, uix, ToLoc: Integer;
     55procedure TBattleDlg.PaintBattleOutcome(ca: TDpiCanvas; xm, ym, uix, ToLoc: Integer;
    5156  Forecast: TBattleForecastEx);
    5257var
     
    108113      FanaticColor);
    109114  DpiBitCanvas(ca, xm - 12, ym - 12, 24, 24,
    110     GrExt[HGrSystem].Mask.Canvas, 26, 146, SRCAND);
     115    HGrSystem.Mask.Canvas, 26, 146, SRCAND);
    111116  DpiBitCanvas(ca, xm - 12, ym - 12, 24, 24,
    112     GrExt[HGrSystem].Data.Canvas, 26, 146, SRCPAINT);
     117    HGrSystem.Data.Canvas, 26, 146, SRCPAINT);
    113118
    114119  LabelText := Format('%d', [Forecast.AStr]);
     
    133138  begin
    134139    DpiBitCanvas(ca, xm + 9 + LDDamage - 7, ym - 6, 14, 17,
    135       GrExt[HGrSystem].Mask.Canvas, 51, 153, SRCAND);
     140      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    136141    DpiBitCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
    137       GrExt[HGrSystem].Mask.Canvas, 51, 153, SRCAND);
     142      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    138143    DpiBitCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
    139       GrExt[HGrSystem].Data.Canvas, 51, 153, SRCPAINT);
     144      HGrSystem.Data.Canvas, 51, 153, SRCPAINT);
    140145  end;
    141146  LabelText := Format('%d', [DDamage]);
     
    153158  begin
    154159    DpiBitCanvas(ca, xm - 6, ym + 9 + LADamage - 7, 14, 17,
    155       GrExt[HGrSystem].Mask.Canvas, 51, 153, SRCAND);
     160      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    156161    DpiBitCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
    157       GrExt[HGrSystem].Mask.Canvas, 51, 153, SRCAND);
     162      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    158163    DpiBitCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
    159       GrExt[HGrSystem].Data.Canvas, 51, 153, SRCPAINT);
     164      HGrSystem.Data.Canvas, 51, 153, SRCPAINT);
    160165  end;
    161166  LabelText := Format('%d', [MyUn[uix].Health - Forecast.EndHealthAtt]);
     
    172177      (LADamage - LAAvoidedDamage - TextSize.cy) div 2, LabelText);
    173178
    174   NoMap.SetOutput(Buffer);
     179  IsoMap.SetOutput(Buffer);
    175180  DpiBitCanvas(Buffer.Canvas, 0, 0, 66, 48, ca, xm + 8 + 4,
    176181    ym - 8 - 12 - 48);
     
    184189    else Sprite(Buffer,HGrTerrain,0,16,66,32,1+7*(xxt*2+1),1+yyt+2*(2+TerrType-fForest)*(yyt*3+1));
    185190    end; }
    186   NoMap.PaintUnit(1, 0, UnitInfo, 0);
     191  IsoMap.PaintUnit(1, 0, UnitInfo, 0);
    187192  DpiBitCanvas(ca, xm + 8 + 4, ym - 8 - 12 - 48, 66, 48, Buffer.Canvas,
    188193    0, 0);
     
    192197  MakeUnitInfo(me, MyUn[uix], UnitInfo);
    193198  UnitInfo.Flags := UnitInfo.Flags and not unFortified;
    194   NoMap.PaintUnit(1, 0, UnitInfo, 0);
     199  IsoMap.PaintUnit(1, 0, UnitInfo, 0);
    195200  DpiBitCanvas(ca, xm - 8 - 4 - 66, ym + 8 + 12, 66, 48, Buffer.Canvas, 0, 0);
    196201end; { PaintBattleOutcome }
     
    198203procedure TBattleDlg.FormCreate(Sender: TObject);
    199204begin
     205  IsoMap := TIsoMap.Create;
    200206  OKBtn.Caption := Phrases.Lookup('BTN_YES');
    201207  CancelBtn.Caption := Phrases.Lookup('BTN_NO');
     
    276282end;
    277283
     284procedure TBattleDlg.FormDestroy(Sender: TObject);
     285begin
     286  FreeAndNil(IsoMap);
     287end;
     288
    278289procedure TBattleDlg.FormMouseDown(Sender: TObject; Button: TMouseButton;
    279290  Shift: TShiftState; X, Y: Integer);
Note: See TracChangeset for help on using the changeset viewer.