Ignore:
Timestamp:
Nov 30, 2023, 10:16:14 PM (12 months ago)
Author:
chronos
Message:
  • Modified: Updated high dpi branch from trunk.
  • Modified: Use generics.collections instead of fgl.
  • Modified: Compile with Delphi syntax.
File:
1 edited

Legend:

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

    r361 r465  
    3232    uix, ToLoc: Integer;
    3333    Forecast: TBattleForecastEx;
    34     IsSuicideQuery: boolean;
    35   end;
    36 
    37 var
    38   BattleDlg: TBattleDlg;
     34    IsSuicideQuery: Boolean;
     35  end;
     36
    3937
    4038implementation
     
    6260  TextSize: TSize;
    6361  LabelText: string;
    64   FirstStrike: boolean;
     62  FirstStrike: Boolean;
    6563begin
    6664  MaxBar := 65;
     
    112110    VLightGradient(ca, xm - 8, ym + 8 + LABaseDamage, LADamage - LABaseDamage,
    113111      FanaticColor);
    114   DpiBitCanvas(ca, xm - 12, ym - 12, 24, 24,
     112  DpiBitBltCanvas(ca, xm - 12, ym - 12, 24, 24,
    115113    HGrSystem.Mask.Canvas, 26, 146, SRCAND);
    116   DpiBitCanvas(ca, xm - 12, ym - 12, 24, 24,
     114  DpiBitBltCanvas(ca, xm - 12, ym - 12, 24, 24,
    117115    HGrSystem.Data.Canvas, 26, 146, SRCPAINT);
    118116
     
    137135  if Forecast.EndHealthDef <= 0 then
    138136  begin
    139     DpiBitCanvas(ca, xm + 9 + LDDamage - 7, ym - 6, 14, 17,
     137    DpiBitBltCanvas(ca, xm + 9 + LDDamage - 7, ym - 6, 14, 17,
    140138      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    141     DpiBitCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
     139    DpiBitBltCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
    142140      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    143     DpiBitCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
     141    DpiBitBltCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
    144142      HGrSystem.Data.Canvas, 51, 153, SRCPAINT);
    145143  end;
     
    149147  begin
    150148    if Forecast.EndHealthDef > 0 then
    151       RisedTextOut(ca, xm + 10, ym - (TextSize.cy + 1) div 2, LabelText)
     149      RisedTextOut(ca, xm + 10, ym - (TextSize.cy + 1) div 2, LabelText);
    152150  end
    153151  else
     
    157155  if Forecast.EndHealthAtt <= 0 then
    158156  begin
    159     DpiBitCanvas(ca, xm - 6, ym + 9 + LADamage - 7, 14, 17,
     157    DpiBitBltCanvas(ca, xm - 6, ym + 9 + LADamage - 7, 14, 17,
    160158      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    161     DpiBitCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
     159    DpiBitBltCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
    162160      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    163     DpiBitCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
     161    DpiBitBltCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
    164162      HGrSystem.Data.Canvas, 51, 153, SRCPAINT);
    165163  end;
     
    171169    if Forecast.EndHealthAtt > 0 then
    172170      RisedTextOut(ca, xm - (TextSize.cx + 1) div 2, ym + 8 + LAAvoidedDamage,
    173         LabelText)
     171        LabelText);
    174172  end
    175173  else
     
    178176
    179177  IsoMap.SetOutput(Buffer);
    180   DpiBitCanvas(Buffer.Canvas, 0, 0, 66, 48, ca, xm + 8 + 4,
     178  DpiBitBltCanvas(Buffer.Canvas, 0, 0, 66, 48, ca, xm + 8 + 4,
    181179    ym - 8 - 12 - 48);
    182180  { if TerrType<fForest then
     
    190188    end; }
    191189  IsoMap.PaintUnit(1, 0, UnitInfo, 0);
    192   DpiBitCanvas(ca, xm + 8 + 4, ym - 8 - 12 - 48, 66, 48, Buffer.Canvas,
     190  DpiBitBltCanvas(ca, xm + 8 + 4, ym - 8 - 12 - 48, 66, 48, Buffer.Canvas,
    193191    0, 0);
    194192
    195   DpiBitCanvas(Buffer.Canvas, 0, 0, 66, 48, ca, xm - 8 - 4 - 66,
     193  DpiBitBltCanvas(Buffer.Canvas, 0, 0, 66, 48, ca, xm - 8 - 4 - 66,
    196194    ym + 8 + 12);
    197   MakeUnitInfo(me, MyUn[uix], UnitInfo);
     195  MakeUnitInfo(Me, MyUn[uix], UnitInfo);
    198196  UnitInfo.Flags := UnitInfo.Flags and not unFortified;
    199197  IsoMap.PaintUnit(1, 0, UnitInfo, 0);
    200   DpiBitCanvas(ca, xm - 8 - 4 - 66, ym + 8 + 12, 66, 48, Buffer.Canvas, 0, 0);
    201 end; { PaintBattleOutcome }
     198  DpiBitBltCanvas(ca, xm - 8 - 4 - 66, ym + 8 + 12, 66, 48, Buffer.Canvas, 0, 0);
     199end;
    202200
    203201procedure TBattleDlg.FormCreate(Sender: TObject);
     
    215213    ClientWidth := 300;
    216214    ClientHeight := 288;
    217     OKBtn.Visible := true;
    218     CancelBtn.Visible := true;
     215    OKBtn.Visible := True;
     216    CancelBtn.Visible := True;
    219217    Left := (DpiScreen.Width - ClientWidth) div 2; // center on screen
    220218    Top := (DpiScreen.Height - ClientHeight) div 2;
     
    224222    ClientWidth := 178;
    225223    ClientHeight := 178;
    226     OKBtn.Visible := false;
    227     CancelBtn.Visible := false;
     224    OKBtn.Visible := False;
     225    CancelBtn.Visible := False;
    228226  end;
    229227end;
     
    231229procedure TBattleDlg.FormPaint(Sender: TObject);
    232230var
    233   ym, cix, p: Integer;
    234   s, s1: string;
     231  ym, cix, P: Integer;
     232  S, s1: string;
    235233begin
    236234  with Canvas do
     
    240238    Brush.Style := bsClear;
    241239    PaintBackground(self, 3 + Border, 3 + Border,
    242       ClientWidth - (6 + 2 * Border), ClientHeight - (6 + 2 * Border))
     240      ClientWidth - (6 + 2 * Border), ClientHeight - (6 + 2 * Border));
    243241  end;
    244242  Frame(Canvas, Border + 1, Border + 1, ClientWidth - (2 + Border),
     
    252250  begin
    253251    Canvas.Font.Assign(UniFont[ftCaption]);
    254     s := Phrases.Lookup('TITLE_SUICIDE');
    255     RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s)) div 2,
    256       7 + Border, s);
     252    S := Phrases.Lookup('TITLE_SUICIDE');
     253    RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, S)) div 2,
     254      7 + Border, S);
    257255    Canvas.Font.Assign(UniFont[ftNormal]);
    258     s := Phrases.Lookup('SUICIDE');
    259     p := pos('\', s);
    260     if p = 0 then
    261       RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s))
    262         div 2, 205, s)
     256    S := Phrases.Lookup('SUICIDE');
     257    P := Pos('\', S);
     258    if P = 0 then
     259      RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, S))
     260        div 2, 205, S)
    263261    else
    264262    begin
    265       s1 := copy(s, 1, p - 1);
     263      s1 := Copy(S, 1, P - 1);
    266264      RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s1)) div 2,
    267265        205 - MessageLineSpacing div 2, s1);
    268       s1 := copy(s, p + 1, 255);
     266      s1 := Copy(S, P + 1, 255);
    269267      RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s1)) div 2,
    270268        205 + (MessageLineSpacing - MessageLineSpacing div 2), s1);
    271269    end;
    272     ym := 110
     270    ym := 110;
    273271  end
    274272  else
     
    297295begin
    298296  if not IsSuicideQuery then
    299     Close
     297    Close;
    300298end;
    301299
     
    309307    if Key <> VK_ESCAPE then
    310308      MainScreen.FormKeyDown(Sender, Key, Shift);
    311   end
     309  end;
    312310end;
    313311
Note: See TracChangeset for help on using the changeset viewer.