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