Changeset 361 for branches/highdpi/LocalPlayer/CityScreen.pas
- Timestamp:
- Apr 9, 2021, 5:56:50 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/CityScreen.pas
r349 r361 15 15 type 16 16 TCityCloseAction = (None, RestoreFocus, StepFocus); 17 TSmallMapMode = (smSupportedUnits, smImprovements); 17 18 18 19 TCityDlg = class(TBufferedDrawDlg) … … 59 60 cix: Integer; 60 61 cLoc: Integer; 61 Mode: Integer;62 SmallMapMode: TSmallMapMode; 62 63 ZoomArea: Integer; 63 64 Page: Integer; … … 73 74 CityAreaInfo: TCityAreaInfo; 74 75 AreaMap: TIsoMap; 76 NoMap: TIsoMap; 75 77 CityMapTemplate: TDpiBitmap; 76 78 SmallCityMapTemplate: TDpiBitmap; … … 82 84 ProdHint: Boolean; 83 85 AllowChange: Boolean; 86 RedTex: TTexture; 87 BarTex: TTexture; 84 88 procedure InitSmallCityMap; 85 89 procedure InitZoomCityMap; … … 109 113 110 114 const 111 { modes }112 mSupp = 1;113 mImp = 2;114 115 115 wBar = 106; 116 116 xDiv = 400; … … 197 197 begin 198 198 inherited; 199 RedTex := TTexture.Create; 200 BarTex := TTexture.Create; 201 NoMap := TIsoMap.Create; 199 202 AreaMap := TIsoMap.Create; 200 203 AreaMap.SetOutput(offscreen); 201 204 AreaMap.SetPaintBounds(xmArea - 192, ymArea - 96 - 32, xmArea + 192, 202 205 ymArea + 96); 203 Mode := mImp;206 SmallMapMode := smImprovements; 204 207 ZoomArea := 1; 205 208 ProdHint := false; … … 208 211 AgePrepared := -2; 209 212 Optimize_cixTileChange := -1; 210 InitButtons ();213 InitButtons; 211 214 // InitWindowRegion; 212 215 CloseBtn.Caption := Phrases.Lookup('BTN_OK'); … … 252 255 procedure TCityDlg.FormDestroy(Sender: TObject); 253 256 begin 257 FreeAndNil(NoMap); 254 258 FreeAndNil(AreaMap); 255 259 FreeAndNil(SmallCityMap); … … 259 263 FreeAndNil(Template); 260 264 FreeAndNil(Back); 265 FreeAndNil(RedTex); 266 FreeAndNil(BarTex); 261 267 end; 262 268 263 269 procedure TCityDlg.Reset; 264 270 begin 265 Mode := mImp;271 SmallMapMode := smImprovements; 266 272 ZoomArea := 1; 267 273 end; … … 269 275 procedure TCityDlg.CheckAge; 270 276 begin 271 if MainTextureAge <> AgePrepared then 272 begin 273 AgePrepared := MainTextureAge; 277 if MainTexture.Age <> AgePrepared then begin 278 AgePrepared := MainTexture.Age; 274 279 275 280 UnshareBitmap(Back); … … 370 375 DpiBitCanvas(ZoomCityMap.Canvas, 0, 0, wZoomMap, hZoomMap, 371 376 Back.Canvas, xZoomMap, yZoomMap); 372 if Mode = mImpthen begin377 if SmallMapMode = smImprovements then begin 373 378 if ZoomArea < 3 then begin 374 379 ImageOp_B(ZoomCityMap, CityMapTemplate, 0, 0, 376 * SizeClass, … … 388 393 procedure FillBar(x, y, pos, Growth, max, Kind: integer; 389 394 IndicateComplete: boolean); 390 var 391 Tex: TTexture; 392 begin 393 Tex := MainTexture; 394 if Kind = 3 then 395 begin 396 Tex.clBevelLight := HGrSystem.Data.Canvas.Pixels[104, 36]; 397 Tex.clBevelShade := Tex.clBevelLight; 395 begin 396 BarTex.Assign(MainTexture); 397 if Kind = 3 then begin 398 BarTex.ColorBevelLight := HGrSystem.Data.Canvas.Pixels[104, 36]; 399 BarTex.ColorBevelShade := BarTex.ColorBevelLight; 398 400 end; 399 401 PaintRelativeProgressBar(offscreen.Canvas, Kind, x - 3, y, wBar - 4, pos, 400 Growth, max, IndicateComplete, Tex);402 Growth, max, IndicateComplete, BarTex); 401 403 end; 402 404 … … 492 494 UnitInfo: TUnitInfo; 493 495 UnitReport: TUnitReport; 494 RedTex: TTexture;495 496 IsCityAlive, CanGrow: boolean; 496 497 begin … … 524 525 Report.Working := c.Size; 525 526 526 RedTex := MainTexture;527 RedTex. clBevelLight := $0000FF;528 RedTex. clBevelShade := $000000;529 RedTex. clTextLight := $000000;530 RedTex. clTextShade := $0000FF;527 RedTex.Assign(MainTexture); 528 RedTex.ColorBevelLight := $0000FF; 529 RedTex.ColorBevelShade := $000000; 530 RedTex.ColorTextLight := $000000; 531 RedTex.ColorTextShade := $0000FF; 531 532 532 533 DpiBitCanvas(offscreen.Canvas, 0, 0, 640, 480, Back.Canvas, 0, 0); … … 596 597 597 598 with AreaMap do begin 598 rx := (192 + xxt * 2 - 1) div (xxt * 2); 599 ry := (96 + yyt * 2 - 1) div (yyt * 2); 600 AreaMap.Paint(xmArea - xxt * 2 * rx, ymArea - yyt * 2 * ry - 3 * yyt, 601 dLoc(cLoc, -2 * rx + 1, -2 * ry - 1), 4 * rx - 1, 4 * ry + 1, cLoc, cOwner, 602 false, AllowChange and IsCityAlive and 603 (c.Status and csResourceWeightsMask = 0)); 604 DpiBitCanvas(offscreen.Canvas, xmArea + 102, 42, 90, 33, Back.Canvas, 605 xmArea + 102, 42); 606 607 if IsCityAlive then 608 for dy := -3 to 3 do 609 for dx := -3 to 3 do 610 if ((dx + dy) and 1 = 0) and (dx * dx * dy * dy < 81) then 611 begin 612 Loc1 := dLoc(cLoc, dx, dy); 613 av := CityAreaInfo.Available[(dy + 3) shl 2 + (dx + 3) shr 1]; 614 if ((av = faNotAvailable) or (av = faTreaty) or (av = faInvalid)) and 615 ((Loc1 < 0) or (Loc1 >= G.lx * G.ly) or (MyMap[Loc1] and fCity = 0)) 616 then 617 Sprite(offscreen, HGrTerrain, xmArea - xxt + xxt * dx, 618 ymArea - yyt + yyt * dy, xxt * 2, yyt * 2, 1 + 5 * (xxt * 2 + 1), 619 1 + yyt + 15 * (yyt * 3 + 1)); 620 if (1 shl ((dy + 3) shl 2 + (dx + 3) shr 1) and c.Tiles <> 0) then 621 PaintResources(xmArea - xxt + xxt * dx, ymArea - yyt + yyt * dy, 622 Loc1, (dx = 0) and (dy = 0)); 623 end; 599 rx := (192 + xxt * 2 - 1) div (xxt * 2); 600 ry := (96 + yyt * 2 - 1) div (yyt * 2); 601 AreaMap.Paint(xmArea - xxt * 2 * rx, ymArea - yyt * 2 * ry - 3 * yyt, 602 dLoc(cLoc, -2 * rx + 1, -2 * ry - 1), 4 * rx - 1, 4 * ry + 1, cLoc, cOwner, 603 false, AllowChange and IsCityAlive and 604 (c.Status and csResourceWeightsMask = 0)); 605 DpiBitCanvas(offscreen.Canvas, xmArea + 102, 42, 90, 33, Back.Canvas, 606 xmArea + 102, 42); 607 608 if IsCityAlive then 609 for dy := -3 to 3 do 610 for dx := -3 to 3 do 611 if ((dx + dy) and 1 = 0) and (dx * dx * dy * dy < 81) then begin 612 Loc1 := dLoc(cLoc, dx, dy); 613 av := CityAreaInfo.Available[(dy + 3) shl 2 + (dx + 3) shr 1]; 614 if ((av = faNotAvailable) or (av = faTreaty) or (av = faInvalid)) and 615 ((Loc1 < 0) or (Loc1 >= G.lx * G.ly) or (MyMap[Loc1] and fCity = 0)) 616 then 617 Sprite(offscreen, HGrTerrain, xmArea - xxt + xxt * dx, 618 ymArea - yyt + yyt * dy, xxt * 2, yyt * 2, 1 + 5 * (xxt * 2 + 1), 619 1 + yyt + 15 * (yyt * 3 + 1)); 620 if (1 shl ((dy + 3) shl 2 + (dx + 3) shr 1) and c.Tiles <> 0) then 621 PaintResources(xmArea - xxt + xxt * dx, ymArea - yyt + yyt * dy, 622 Loc1, (dx = 0) and (dy = 0)); 623 end; 624 624 end; 625 625 … … 794 794 DpiBitCanvas(offscreen.Canvas, xSmallMap, ySmallMap, wSmallMap, hSmallMap, 795 795 SmallCityMap.Canvas, 0, 0); 796 if Mode = mImpthen796 if SmallMapMode = smImprovements then 797 797 Frame(offscreen.Canvas, xSmallMap + 48 * (ZoomArea div 3), 798 798 ySmallMap + 24 * (ZoomArea mod 3), xSmallMap + 48 * (ZoomArea div 3) + 49, 799 ySmallMap + 24 * (ZoomArea mod 3) + 25, MainTexture. clMark,800 MainTexture. clMark);799 ySmallMap + 24 * (ZoomArea mod 3) + 25, MainTexture.ColorMark, 800 MainTexture.ColorMark); 801 801 Frame(offscreen.Canvas, xSmallMap - 1, ySmallMap - 1, xSmallMap + wSmallMap, 802 802 ySmallMap + hSmallMap, $B0B0B0, $FFFFFF); … … 810 810 x := xSupport + wSupport div 2; 811 811 y := ySupport + hSupport div 2; 812 if Mode = mSuppthen813 begin 814 offscreen.Canvas.brush.Color := MainTexture. clMark;812 if SmallMapMode = smSupportedUnits then 813 begin 814 offscreen.Canvas.brush.Color := MainTexture.ColorMark; 815 815 offscreen.Canvas.FillRect(Rect(x - 27, y - 6, x + 27, y + 6)); 816 816 offscreen.Canvas.brush.style := bsClear; … … 825 825 for i := 0 to 5 do 826 826 imix[i] := -1; 827 if Mode = mImpthen827 if SmallMapMode = smImprovements then 828 828 begin 829 829 if ZoomArea = 5 then … … 917 917 Imp5Area.Hint := ''; 918 918 end 919 else { if mode=mSuppthen }919 else { if SmallMapMode = smSupportedUnits then } 920 920 begin 921 921 LoweredTextout(offscreen.Canvas, -1, MainTexture, xZoomMap + 6, … … 934 934 y := ((Cnt - 6 * Page) div 3) * 52 + yZoomMap + 20; 935 935 MakeUnitInfo(me, MyUn[i], UnitInfo); 936 AreaMap.SetOutput(offscreen);937 AreaMap.PaintUnit(x, y, UnitInfo, MyUn[i].Status);936 NoMap.SetOutput(offscreen); 937 NoMap.PaintUnit(x, y, UnitInfo, MyUn[i].Status); 938 938 939 939 for j := 0 to UnitReport.FoodSupport - 1 do … … 1048 1048 else { enemy city } 1049 1049 begin 1050 Mode := mImp;1050 SmallMapMode := smImprovements; 1051 1051 Server(sGetCity, me, cLoc, GetCityData); 1052 1052 c := GetCityData.c; … … 1146 1146 (y >= ySmallMap) and (y < ySmallMap + hSmallMap) then 1147 1147 begin 1148 Mode := mImp;1148 SmallMapMode := smImprovements; 1149 1149 ZoomArea := (y - ySmallMap) * 3 div hSmallMap + 3 * 1150 1150 ((x - xSmallMap) * 2 div wSmallMap); … … 1157 1157 (y >= ySupport) and (y < ySupport + hSupport) then 1158 1158 begin 1159 Mode := mSupp;1159 SmallMapMode := smSupportedUnits; 1160 1160 Page := 0; 1161 1161 InitZoomCityMap; … … 1189 1189 ChooseProject; 1190 1190 end 1191 else if ( Mode = mImp) and (x >= xZoomMap) and (x < xZoomMap + wZoomMap) and1191 else if (SmallMapMode = smImprovements) and (x >= xZoomMap) and (x < xZoomMap + wZoomMap) and 1192 1192 (y >= yZoomMap) and (y < yZoomMap + hZoomMap) then 1193 1193 begin … … 1203 1203 if iix >= 0 then 1204 1204 if ssShift in Shift then 1205 HelpDlg.ShowNewContent( Mode or wmPersistent, hkImp, iix)1205 HelpDlg.ShowNewContent(FWindowMode or wmPersistent, hkImp, iix) 1206 1206 else if (ClientMode < scContact) then 1207 1207 with MessgExDlg do … … 1300 1300 end; 1301 1301 end 1302 else if ( Mode = mSupp) and (x >= xZoomMap) and (x < xZoomMap + wZoomMap) and1302 else if (SmallMapMode = smSupportedUnits) and (x >= xZoomMap) and (x < xZoomMap + wZoomMap) and 1303 1303 (y >= yZoomMap) and (y < yZoomMap + hZoomMap) then 1304 1304 begin … … 1321 1321 else if (x >= xmArea - 192) and (x < xmArea + 192) and (y >= ymArea - 96) 1322 1322 and (y < ymArea + 96) then 1323 with AreaMap do 1324 begin 1323 with AreaMap do begin 1325 1324 qx := ((4000 * xxt * yyt) + (x - xmArea) * (yyt * 2) + (y - ymArea + yyt) 1326 1325 * (xxt * 2)) div (xxt * yyt * 4) - 1000; … … 1335 1334 Loc1 := dLoc(cLoc, dx, dy); 1336 1335 if (Loc1 >= 0) and (Loc1 < G.lx * G.ly) then 1337 HelpOnTerrain(Loc1, Mode or wmPersistent)1336 HelpOnTerrain(Loc1, FWindowMode or wmPersistent) 1338 1337 end 1339 1338 else if (ClientMode < scContact) and (cGov <> gAnarchy) and
Note:
See TracChangeset
for help on using the changeset viewer.