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

Legend:

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

    r303 r349  
    55
    66uses
    7   Protocol, ScreenTools, LazFileUtils, Classes, Graphics, SysUtils, Global;
     7  Protocol, ScreenTools, LazFileUtils, Classes, Graphics, SysUtils, Global,
     8  UGraphicSet;
    89
    910type
     
    1415
    1516  TModelPicture = record
    16     HGr: Integer;
     17    HGr: TGraphicSet;
    1718    pix: Integer;
    1819    xShield: Integer;
     
    2930
    3031  TTribe = class
    31     symHGr: Integer;
     32    symHGr: TGraphicSet;
    3233    sympix: Integer;
    33     faceHGr: Integer;
     34    faceHGr: TGraphicSet;
    3435    facepix: Integer;
    35     cHGr: Integer;
     36    cHGr: TGraphicSet;
    3637    cpix: Integer;
    3738    // symbol and city graphics
     
    6263var
    6364  Tribe: array [0 .. nPl - 1] of TTribe;
    64   HGrStdUnits: Integer;
     65  HGrStdUnits: TGraphicSet;
    6566
    6667procedure Init;
     
    7071procedure FindStdModelPicture(Code: Integer; var pix: Integer; var Name: string);
    7172function GetTribeInfo(FileName: string; var Name: string; var Color: TColor): Boolean;
    72 procedure FindPosition(HGr, x, y, xmax, ymax: Integer; Mark: TColor;
     73procedure FindPosition(HGr: TGraphicSet; x, y, xmax, ymax: Integer; Mark: TColor;
    7374  var xp, yp: Integer);
    7475
     
    8283  TChosenModelPictureInfo = record
    8384    Hash: Integer;
    84     HGr: Integer;
     85    HGr: TGraphicSet;
    8586    pix: Integer;
    8687    ModelName: ShortString;
     
    328329end;
    329330
    330 procedure FindPosition(HGr, x, y, xmax, ymax: Integer; Mark: TColor;
     331procedure FindPosition(HGr: TGraphicSet; x, y, xmax, ymax: Integer; Mark: TColor;
    331332  var xp, yp: Integer);
    332333begin
    333334  xp := 0;
    334   while (xp < xmax) and (GrExt[HGr].Data.Canvas.Pixels[x + 1 + xp, y] <> Mark) do
     335  while (xp < xmax) and (HGr.Data.Canvas.Pixels[x + 1 + xp, y] <> Mark) do
    335336    Inc(xp);
    336337  yp := 0;
    337   while (yp < ymax) and (GrExt[HGr].Data.Canvas.Pixels[x, y + 1 + yp] <> Mark) do
     338  while (yp < ymax) and (HGr.Data.Canvas.Pixels[x, y + 1 + yp] <> Mark) do
    338339    Inc(yp);
    339340end;
     
    447448      end
    448449      else
    449         cHGr := -1;
     450        cHGr := nil;
    450451
    451452{$IFNDEF SCR}
     
    454455      Item := Get;
    455456      if Item = '' then
    456         faceHGr := -1
     457        faceHGr := nil
    457458      else
    458459      begin
    459460        faceHGr := LoadGraphicSet(Item + '.png');
    460461        facepix := GetNum;
    461         if GrExt[faceHGr].Data.Canvas.Pixels[facepix mod 10 * 65,
     462        if faceHGr.Data.Canvas.Pixels[facepix mod 10 * 65,
    462463          facepix div 10 * 49 + 48] = $00FFFF then
    463464        begin // generate shield picture
    464           GrExt[faceHGr].Data.Canvas.Pixels[facepix mod 10 * 65,
     465          faceHGr.Data.Canvas.Pixels[facepix mod 10 * 65,
    465466            facepix div 10 * 49 + 48] := $000000;
    466467          Gray := $B8B8B8;
    467           ImageOp_BCC(GrExt[faceHGr].Data, Templates,
     468          ImageOp_BCC(faceHGr.Data, Templates.Data,
    468469            facepix mod 10 * 65 + 1, facepix div 10 * 49 + 1, 1, 25, 64, 48,
    469470            Gray, Color);
     
    500501        HGr := LoadGraphicSet(GrName);
    501502        pix := Info.pix;
    502         Inc(GrExt[HGr].pixUsed[pix]);
     503        Inc(HGr.pixUsed[pix]);
    503504      end;
    504505      ModelName[mix] := '';
     
    558559  Code, Turn: Integer; ForceNew: Boolean): Boolean;
    559560var
    560   i, Cnt, HGr, Used, LeastUsed: Integer;
     561  i: Integer;
     562  Cnt: Integer;
     563  HGr: TGraphicSet;
     564  Used: Integer;
     565  LeastUsed: Integer;
    561566  TestPic: TModelPictureInfo;
    562567  ok: Boolean;
     
    567572    if Code = GetNum then
    568573    begin
    569       if ForceNew or (HGr < 0) then
     574      if ForceNew or (not Assigned(HGr)) then
    570575        Used := 0
    571576      else
    572577      begin
    573         Used := 4 * GrExt[HGr].pixUsed[TestPic.pix];
     578        Used := 4 * HGr.pixUsed[TestPic.pix];
    574579        if HGr = HGrStdUnits then
    575580          Inc(Used, 2); // prefer units not from StdUnits
     
    596601      if PictureList[i].Hash = Picture.Hash then
    597602      begin
    598         Picture.GrName := GrExt[PictureList[i].HGr].Name;
     603        Picture.GrName := PictureList[i].HGr.Name;
    599604        Picture.pix := PictureList[i].pix;
    600605        Result := False;
     
    623628      ok := True;
    624629      TestPic.GrName := Copy(Input, 8, 255) + '.png';
    625       HGr := nGrExt - 1;
    626       while (HGr >= 0) and (GrExt[HGr].Name <> TestPic.GrName) do
    627         Dec(HGr);
     630      HGr := GrExt.SearchByName(TestPic.GrName);
    628631    end
    629632    else if (Input <> '') and (Input[1] = '#') then
Note: See TracChangeset for help on using the changeset viewer.