Changeset 349 for branches/highdpi/LocalPlayer/Tribes.pas
- Timestamp:
- Apr 6, 2021, 8:11:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Tribes.pas
r303 r349 5 5 6 6 uses 7 Protocol, ScreenTools, LazFileUtils, Classes, Graphics, SysUtils, Global; 7 Protocol, ScreenTools, LazFileUtils, Classes, Graphics, SysUtils, Global, 8 UGraphicSet; 8 9 9 10 type … … 14 15 15 16 TModelPicture = record 16 HGr: Integer;17 HGr: TGraphicSet; 17 18 pix: Integer; 18 19 xShield: Integer; … … 29 30 30 31 TTribe = class 31 symHGr: Integer;32 symHGr: TGraphicSet; 32 33 sympix: Integer; 33 faceHGr: Integer;34 faceHGr: TGraphicSet; 34 35 facepix: Integer; 35 cHGr: Integer;36 cHGr: TGraphicSet; 36 37 cpix: Integer; 37 38 // symbol and city graphics … … 62 63 var 63 64 Tribe: array [0 .. nPl - 1] of TTribe; 64 HGrStdUnits: Integer;65 HGrStdUnits: TGraphicSet; 65 66 66 67 procedure Init; … … 70 71 procedure FindStdModelPicture(Code: Integer; var pix: Integer; var Name: string); 71 72 function GetTribeInfo(FileName: string; var Name: string; var Color: TColor): Boolean; 72 procedure FindPosition(HGr ,x, y, xmax, ymax: Integer; Mark: TColor;73 procedure FindPosition(HGr: TGraphicSet; x, y, xmax, ymax: Integer; Mark: TColor; 73 74 var xp, yp: Integer); 74 75 … … 82 83 TChosenModelPictureInfo = record 83 84 Hash: Integer; 84 HGr: Integer;85 HGr: TGraphicSet; 85 86 pix: Integer; 86 87 ModelName: ShortString; … … 328 329 end; 329 330 330 procedure FindPosition(HGr ,x, y, xmax, ymax: Integer; Mark: TColor;331 procedure FindPosition(HGr: TGraphicSet; x, y, xmax, ymax: Integer; Mark: TColor; 331 332 var xp, yp: Integer); 332 333 begin 333 334 xp := 0; 334 while (xp < xmax) and ( GrExt[HGr].Data.Canvas.Pixels[x + 1 + xp, y] <> Mark) do335 while (xp < xmax) and (HGr.Data.Canvas.Pixels[x + 1 + xp, y] <> Mark) do 335 336 Inc(xp); 336 337 yp := 0; 337 while (yp < ymax) and ( GrExt[HGr].Data.Canvas.Pixels[x, y + 1 + yp] <> Mark) do338 while (yp < ymax) and (HGr.Data.Canvas.Pixels[x, y + 1 + yp] <> Mark) do 338 339 Inc(yp); 339 340 end; … … 447 448 end 448 449 else 449 cHGr := -1;450 cHGr := nil; 450 451 451 452 {$IFNDEF SCR} … … 454 455 Item := Get; 455 456 if Item = '' then 456 faceHGr := -1457 faceHGr := nil 457 458 else 458 459 begin 459 460 faceHGr := LoadGraphicSet(Item + '.png'); 460 461 facepix := GetNum; 461 if GrExt[faceHGr].Data.Canvas.Pixels[facepix mod 10 * 65,462 if faceHGr.Data.Canvas.Pixels[facepix mod 10 * 65, 462 463 facepix div 10 * 49 + 48] = $00FFFF then 463 464 begin // generate shield picture 464 GrExt[faceHGr].Data.Canvas.Pixels[facepix mod 10 * 65,465 faceHGr.Data.Canvas.Pixels[facepix mod 10 * 65, 465 466 facepix div 10 * 49 + 48] := $000000; 466 467 Gray := $B8B8B8; 467 ImageOp_BCC( GrExt[faceHGr].Data, Templates,468 ImageOp_BCC(faceHGr.Data, Templates.Data, 468 469 facepix mod 10 * 65 + 1, facepix div 10 * 49 + 1, 1, 25, 64, 48, 469 470 Gray, Color); … … 500 501 HGr := LoadGraphicSet(GrName); 501 502 pix := Info.pix; 502 Inc( GrExt[HGr].pixUsed[pix]);503 Inc(HGr.pixUsed[pix]); 503 504 end; 504 505 ModelName[mix] := ''; … … 558 559 Code, Turn: Integer; ForceNew: Boolean): Boolean; 559 560 var 560 i, Cnt, HGr, Used, LeastUsed: Integer; 561 i: Integer; 562 Cnt: Integer; 563 HGr: TGraphicSet; 564 Used: Integer; 565 LeastUsed: Integer; 561 566 TestPic: TModelPictureInfo; 562 567 ok: Boolean; … … 567 572 if Code = GetNum then 568 573 begin 569 if ForceNew or ( HGr < 0) then574 if ForceNew or (not Assigned(HGr)) then 570 575 Used := 0 571 576 else 572 577 begin 573 Used := 4 * GrExt[HGr].pixUsed[TestPic.pix];578 Used := 4 * HGr.pixUsed[TestPic.pix]; 574 579 if HGr = HGrStdUnits then 575 580 Inc(Used, 2); // prefer units not from StdUnits … … 596 601 if PictureList[i].Hash = Picture.Hash then 597 602 begin 598 Picture.GrName := GrExt[PictureList[i].HGr].Name;603 Picture.GrName := PictureList[i].HGr.Name; 599 604 Picture.pix := PictureList[i].pix; 600 605 Result := False; … … 623 628 ok := True; 624 629 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); 628 631 end 629 632 else if (Input <> '') and (Input[1] = '#') then
Note:
See TracChangeset
for help on using the changeset viewer.