Changeset 349 for branches/highdpi/LocalPlayer/CityScreen.pas
- Timestamp:
- Apr 6, 2021, 8:11:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/CityScreen.pas
r303 r349 5 5 6 6 uses 7 UDpiControls, {$IFDEF LINUX} 8 LMessages, 9 {$ENDIF} 7 UDpiControls, {$IFDEF LINUX}LMessages,{$ENDIF} 10 8 Protocol, ClientTools, Term, ScreenTools, IsoEngine, BaseWin, 11 9 LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls, … … 53 51 procedure PageUpBtnClick(Sender: TObject); 54 52 procedure PageDownBtnClick(Sender: TObject); 55 53 private 54 c: TCity; 55 Report: TCityReportNew; 56 cOwner: Integer; 57 cGov: Integer; 58 emix: Integer; { enemy model index of produced unit } 59 cix: Integer; 60 cLoc: Integer; 61 Mode: Integer; 62 ZoomArea: Integer; 63 Page: Integer; 64 PageCount: Integer; 65 BlinkTime: Integer; 66 OpenSoundEvent: Integer; 67 SizeClass: Integer; 68 AgePrepared: Integer; 69 Optimize_cixTileChange: Integer; 70 Optimize_TilesBeforeChange: Integer; 71 Happened: cardinal; 72 imix: array [0 .. 15] of integer; 73 CityAreaInfo: TCityAreaInfo; 74 AreaMap: TIsoMap; 75 CityMapTemplate: TDpiBitmap; 76 SmallCityMapTemplate: TDpiBitmap; 77 Back: TDpiBitmap; 78 SmallCityMap: TDpiBitmap; 79 ZoomCityMap: TDpiBitmap; 80 Template: TDpiBitmap; 81 IsPort: Boolean; 82 ProdHint: Boolean; 83 AllowChange: Boolean; 84 procedure InitSmallCityMap; 85 procedure InitZoomCityMap; 86 procedure ChooseProject; 87 procedure ChangeCity(d: integer); 88 procedure ChangeResourceWeights(iResourceWeights: integer); 89 procedure OnPlaySound(var Msg: TMessage); message WM_PLAYSOUND; 56 90 public 57 91 RestoreUnFocus: integer; … … 61 95 procedure Reset; 62 96 procedure CheckAge; 63 64 private65 c: TCity;66 Report: TCityReportNew;67 cOwner, cGov, emix { enemy model index of produced unit } , cix, cLoc, Mode,68 ZoomArea, Page, PageCount, BlinkTime, OpenSoundEvent, SizeClass,69 AgePrepared: integer;70 Optimize_cixTileChange, Optimize_TilesBeforeChange: integer;71 Happened: cardinal;72 imix: array [0 .. 15] of integer;73 CityAreaInfo: TCityAreaInfo;74 AreaMap: TIsoMap;75 CityMapTemplate, SmallCityMapTemplate, Back, SmallCityMap, ZoomCityMap,76 Template: TDpiBitmap;77 IsPort, ProdHint, AllowChange: boolean;78 procedure InitSmallCityMap;79 procedure InitZoomCityMap;80 procedure ChooseProject;81 procedure ChangeCity(d: integer);82 procedure ChangeResourceWeights(iResourceWeights: integer);83 procedure OnPlaySound(var Msg: TMessage); message WM_PLAYSOUND;84 97 end; 85 98 … … 87 100 CityDlg: TCityDlg; 88 101 102 89 103 implementation 90 104 91 105 uses 92 Select, Messg, MessgEx, Help, Tribes, Directories, Math, UPixelPointer,Sound;106 Select, Messg, MessgEx, Help, Tribes, Directories, Math, Sound; 93 107 94 108 {$R *.lfm} … … 259 273 AgePrepared := MainTextureAge; 260 274 261 // TODO: FillRect should not be needed as BitBlt is with SRCCOPY 262 Back.Canvas.FillRect(0, 0, ClientWidth, ClientHeight); 263 275 UnshareBitmap(Back); 264 276 DpiBitCanvas(Back.Canvas, 0, 0, ClientWidth, ClientHeight, 265 277 MainTexture.Image.Canvas, 0, 0); … … 280 292 c := MyCity[cix]; 281 293 case MyMap[cLoc] and fTerrain of 282 fPrairie: 283 cli1 := cliPrairie; 284 fHills: 285 cli1 := cliHills; 286 fTundra: 287 cli1 := cliTundra; 294 fPrairie: cli1 := cliPrairie; 295 fHills: cli1 := cliHills; 296 fTundra: cli1 := cliTundra; 288 297 else 289 298 cli1 := cliPlains; … … 316 325 for i := 0 to 29 do 317 326 begin 318 for iix := 28to nImp - 1 do327 for iix := nWonder to nImp - 1 do 319 328 if (ImpPosition[iix] = i) and (c.Built[iix] > 0) then 320 329 begin … … 327 336 i := 30; 328 337 for iix := 0 to nImp do 329 if (c.Built[iix] > 0) and ((iix < 28) or (ImpPosition[iix] < 0)) then338 if (c.Built[iix] > 0) and ((iix < nWonder) or (ImpPosition[iix] < 0)) then 330 339 begin 331 340 FillRect(Rect(5 + 16 * (i mod 3) + 48 * (i div 18), … … 341 350 if iix <> imTrGoods then 342 351 begin 343 if (iix >= 28) and (ImpPosition[iix] >= 0) then352 if (iix >= nWonder) and (ImpPosition[iix] >= 0) then 344 353 i := ImpPosition[iix]; 345 354 if i < 36 then … … 358 367 procedure TCityDlg.InitZoomCityMap; 359 368 begin 360 // TODO: FillRect should not be needed as BitBlt is with SRCCOPY 361 ZoomCityMap.Canvas.FillRect(0, 0, ZoomCityMap.Width, ZoomCityMap.Height); 362 369 UnshareBitmap(ZoomCityMap); 363 370 DpiBitCanvas(ZoomCityMap.Canvas, 0, 0, wZoomMap, hZoomMap, 364 371 Back.Canvas, xZoomMap, yZoomMap); … … 387 394 if Kind = 3 then 388 395 begin 389 Tex.clBevelLight := GrExt[HGrSystem].Data.Canvas.Pixels[104, 36];396 Tex.clBevelLight := HGrSystem.Data.Canvas.Pixels[104, 36]; 390 397 Tex.clBevelShade := Tex.clBevelLight; 391 398 end; … … 400 407 rare: boolean; 401 408 begin 409 with AreaMap do begin 402 410 if Server(sGetCityTileInfo, me, Loc, TileInfo) <> eOk then 403 411 begin … … 435 443 Sprite(offscreen, HGrSystem, x + xxt - 5 + d * (2 * i + 1 - Total), 436 444 y + yyt - 5, 10, 10, xGr, yGr); 445 end; 437 446 end; 438 447 end; … … 586 595 end; 587 596 597 with AreaMap do begin 588 598 rx := (192 + xxt * 2 - 1) div (xxt * 2); 589 599 ry := (96 + yyt * 2 - 1) div (yyt * 2); … … 612 622 Loc1, (dx = 0) and (dy = 0)); 613 623 end; 624 end; 614 625 615 626 if Report.Working > 1 then … … 624 635 xGr := 141; 625 636 DpiBitCanvas(offscreen.Canvas, xmArea - 192 + 5 + i * d, ymArea - 96 - 29, 626 27, 30, GrExt[HGrSystem].Mask.Canvas, xGr, 171, SRCAND); { shadow }637 27, 30, HGrSystem.Mask.Canvas, xGr, 171, SRCAND); { shadow } 627 638 Sprite(offscreen, HGrSystem, xmArea - 192 + 4 + i * d, ymArea - 96 - 30, 27, 628 639 30, xGr, 171); … … 636 647 xGr := 1 + 112; 637 648 DpiBitCanvas(offscreen.Canvas, xmArea + 192 - 27 + 1 - i * d, 29 + 1, 27, 638 30, GrExt[HGrSystem].Mask.Canvas, xGr, 171, SRCAND); { shadow }649 30, HGrSystem.Mask.Canvas, xGr, 171, SRCAND); { shadow } 639 650 Sprite(offscreen, HGrSystem, xmArea + 192 - 27 - i * d, 29, 27, 30, 640 651 xGr, 171); … … 820 831 Cnt := 0; 821 832 for iix := 0 to nImp - 1 do 822 if ((iix < 28) or (ImpPosition[iix] < 0)) and (c.Built[iix] > 0) then833 if ((iix < nWonder) or (ImpPosition[iix] < 0)) and (c.Built[iix] > 0) then 823 834 begin 824 835 i := Cnt - Page * 6; … … 831 842 else 832 843 begin 833 for iix := 28to nImp - 1 do844 for iix := nWonder to nImp - 1 do 834 845 begin 835 846 i := ImpPosition[iix] - 6 * ZoomArea; … … 923 934 y := ((Cnt - 6 * Page) div 3) * 52 + yZoomMap + 20; 924 935 MakeUnitInfo(me, MyUn[i], UnitInfo); 925 NoMap.SetOutput(offscreen);926 NoMap.PaintUnit(x, y, UnitInfo, MyUn[i].Status);936 AreaMap.SetOutput(offscreen); 937 AreaMap.PaintUnit(x, y, UnitInfo, MyUn[i].Status); 927 938 928 939 for j := 0 to UnitReport.FoodSupport - 1 do … … 1052 1063 (integer(MyRO.EnemyModel[emix].mix) <> c.Project and cpIndex)) do 1053 1064 dec(emix); 1054 if Tribe[cOwner].ModelPicture[c.Project and cpIndex].HGr = 0then1065 if not Assigned(Tribe[cOwner].ModelPicture[c.Project and cpIndex].HGr) then 1055 1066 InitEnemyModel(emix); 1056 1067 end; … … 1310 1321 else if (x >= xmArea - 192) and (x < xmArea + 192) and (y >= ymArea - 96) 1311 1322 and (y < ymArea + 96) then 1323 with AreaMap do 1312 1324 begin 1313 1325 qx := ((4000 * xxt * yyt) + (x - xmArea) * (yyt * 2) + (y - ymArea + yyt) … … 1344 1356 not csResourceWeightsMask; // off 1345 1357 c.Status := MyCity[cix].Status; 1346 SmartUpdateContent 1358 SmartUpdateContent; 1347 1359 end; 1348 1360 exit; … … 1736 1748 end; } 1737 1749 1738 var1739 i, j, k: integer;1740 1741 1750 procedure TCityDlg.PageUpBtnClick(Sender: TObject); 1742 1751 begin … … 1744 1753 begin 1745 1754 dec(Page); 1746 SmartUpdateContent 1755 SmartUpdateContent; 1747 1756 end; 1748 1757 end; … … 1753 1762 begin 1754 1763 inc(Page); 1755 SmartUpdateContent 1764 SmartUpdateContent; 1756 1765 end; 1757 1766 end; … … 1775 1784 end; 1776 1785 1786 procedure SortImprovements; 1787 var 1788 i, j, k: integer; 1789 begin 1790 for i := 0 to nImp - 1 do 1791 ImpSorted[i] := i; 1792 for i := 0 to nImp - 2 do 1793 for j := i + 1 to nImp - 1 do 1794 if Prio(ImpSorted[i]) > Prio(ImpSorted[j]) then begin 1795 k := ImpSorted[i]; 1796 ImpSorted[i] := ImpSorted[j]; 1797 ImpSorted[j] := k; 1798 end; 1799 end; 1800 1777 1801 initialization 1778 1802 1779 for i := 0 to nImp - 1 do 1780 ImpSorted[i] := i; 1781 for i := 0 to nImp - 2 do 1782 for j := i + 1 to nImp - 1 do 1783 if Prio(ImpSorted[i]) > Prio(ImpSorted[j]) then 1784 begin 1785 k := ImpSorted[i]; 1786 ImpSorted[i] := ImpSorted[j]; 1787 ImpSorted[j] := k; 1788 end; 1803 SortImprovements; 1789 1804 1790 1805 end.
Note:
See TracChangeset
for help on using the changeset viewer.