Changeset 313 for trunk/LocalPlayer/IsoEngine.pas
- Timestamp:
- Mar 17, 2021, 11:11:55 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/IsoEngine.pas
r301 r313 51 51 procedure FillRect(x, y, Width, Height, Color: integer); 52 52 procedure Textout(x, y, Color: integer; const s: string); 53 procedure Sprite(HGr ,xDst, yDst, Width, Height, xGr, yGr: integer);53 procedure Sprite(HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer); 54 54 procedure TSprite(xDst, yDst, grix: integer; PureBlack: boolean = false); 55 55 … … 139 139 function ApplyTileSize(xxtNew, yytNew: integer): boolean; 140 140 var 141 i, x, y, xSrc, ySrc, HGrTerrainNew, HGrCitiesNew, age, size: integer; 141 i: Integer; 142 x: Integer; 143 y: Integer; 144 xSrc: Integer; 145 ySrc: Integer; 146 HGrTerrainNew: TGrExtDescr; 147 HGrCitiesNew: TGrExtDescr; 148 Age: Integer; 149 Size: Integer; 142 150 LandMore, OceanMore, DitherMask, Mask24: TBitmap; 143 151 MaskLine: array [0 .. 50 * 3 - 1] of TPixelPointer; // 32 = assumed maximum for yyt … … 147 155 HGrTerrainNew := LoadGraphicSet(Format('Terrain%dx%d.png', 148 156 [xxtNew * 2, yytNew * 2])); 149 if HGrTerrainNew < 0then157 if not Assigned(HGrTerrainNew) then 150 158 exit; 151 159 HGrCitiesNew := LoadGraphicSet(Format('Cities%dx%d.png', 152 160 [xxtNew * 2, yytNew * 2])); 153 if HGrCitiesNew < 0then161 if not Assigned(HGrCitiesNew) then 154 162 exit; 155 163 xxt := xxtNew; … … 196 204 DitherMask.Canvas.FillRect(0, 0, DitherMask.Width, DitherMask.Height); 197 205 BitBltCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt * 2, 198 GrExt[HGrTerrain].Mask.Canvas, 1 + 7 * (xxt * 2 + 1),206 HGrTerrain.Mask.Canvas, 1 + 7 * (xxt * 2 + 1), 199 207 1 + yyt + 15 * (yyt * 3 + 1), SRCAND); 200 208 … … 218 226 for y := -1 to 6 do 219 227 BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt, 220 xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);228 xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc); 221 229 for y := -2 to 6 do 222 230 BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt, xxt, 223 yyt, GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt,231 yyt, HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, 224 232 SRCPAINT); 225 233 for y := -2 to 6 do 226 234 BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2) + xxt, (y + 2) * yyt, 227 xxt, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt,235 xxt, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, 228 236 SRCPAINT); 229 237 for y := -2 to 6 do … … 254 262 for x := -2 to 6 do 255 263 BitBltCanvas(LandMore.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt, 256 xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);264 xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc); 257 265 BitBltCanvas(LandMore.Canvas, xxt * 2, (y + 2) * yyt, xxt, yyt, 258 GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt, SRCPAINT);266 HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, SRCPAINT); 259 267 for x := 0 to 7 do 260 268 BitBltCanvas(LandMore.Canvas, (x + 2) * (xxt * 2) - xxt, (y + 2) * yyt, 261 xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt,269 xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, 262 270 SRCPAINT); 263 271 for x := -2 to 6 do … … 276 284 if (x >= 1) = (y >= 2) then 277 285 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt, 278 GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);286 HGrTerrain.Data.Canvas, xSrc, ySrc); 279 287 if (x >= 1) and ((y < 2) or (x >= 2)) then 280 288 begin 281 289 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt, yyt, 282 GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt,290 HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, 283 291 SRCPAINT); 284 292 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt, 285 GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);293 HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT); 286 294 end; 287 295 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt, yyt, … … 301 309 if (x < 1) or (y >= 2) then 302 310 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt, 303 GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);311 HGrTerrain.Data.Canvas, xSrc, ySrc); 304 312 if (x = 1) and (y < 2) or (x >= 2) and (y >= 1) then 305 313 begin 306 314 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt, yyt, 307 GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt,315 HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, 308 316 SRCPAINT); 309 317 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt, 310 GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);318 HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT); 311 319 end; 312 320 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt, … … 317 325 DitherMask.Canvas, 0, 0, DSTINVERT); { invert dither mask } 318 326 BitBltCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt * 2, 319 GrExt[HGrTerrain].Mask.Canvas, 1, 1 + yyt, SRCPAINT);327 HGrTerrain.Mask.Canvas, 1, 1 + yyt, SRCPAINT); 320 328 321 329 for x := -1 to 6 do … … 351 359 end; 352 360 BitBltCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt, 353 GrExt[HGrTerrain].Mask.Canvas, 1, 1 + yyt);361 HGrTerrain.Mask.Canvas, 1, 1 + yyt); 354 362 355 363 for x := 0 to 6 do … … 369 377 // reduce size of terrain icons 370 378 Mask24 := TBitmap.Create; 371 Mask24.Assign( GrExt[HGrTerrain].Mask);379 Mask24.Assign(HGrTerrain.Mask); 372 380 Mask24.PixelFormat := pf24bit; 373 381 Mask24.BeginUpdate; … … 526 534 end; 527 535 528 procedure TIsoMap.Sprite(HGr ,xDst, yDst, Width, Height, xGr, yGr: integer);529 begin 530 BitBltBitmap( GrExt[HGr].Mask, xDst, yDst, Width, Height, xGr, yGr, SRCAND);531 BitBltBitmap( GrExt[HGr].Data, xDst, yDst, Width, Height, xGr, yGr, SRCPAINT);536 procedure TIsoMap.Sprite(HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer); 537 begin 538 BitBltBitmap(HGr.Mask, xDst, yDst, Width, Height, xGr, yGr, SRCAND); 539 BitBltBitmap(HGr.Data, xDst, yDst, Width, Height, xGr, yGr, SRCPAINT); 532 540 end; 533 541 … … 579 587 else 580 588 mixShow := mix; 581 if (Tribe[Owner].ModelPicture[mixShow].HGr = 0) and589 if (Tribe[Owner].ModelPicture[mixShow].HGr = HGrSystem) and 582 590 (@OnInitEnemyModel <> nil) then 583 591 if not OnInitEnemyModel(emix) then … … 612 620 xGr := 121 + j mod 7 * 9; 613 621 yGr := 1 + j div 7 * 9; 614 BitBltBitmap( GrExt[HGrSystem].Mask, x + xsh + 3, y + ysh + 9, 8, 8, xGr,622 BitBltBitmap(HGrSystem.Mask, x + xsh + 3, y + ysh + 9, 8, 8, xGr, 615 623 yGr, SRCAND); 616 624 Sprite(HGrSystem, x + xsh + 2, y + ysh + 8, 8, 8, xGr, yGr); … … 631 639 accessory: boolean); 632 640 var 633 age, cHGr, cpix, xGr, xShield, yShield, LabelTextColor, LabelLength: integer; 641 age: Integer; 642 cHGr: TGrExtDescr; 643 cpix: Integer; 644 xGr: Integer; 645 xShield: Integer; 646 yShield: Integer; 647 LabelTextColor: Integer; 648 LabelLength: Integer; 634 649 cpic: TCityPicture; 635 650 s: string; … … 650 665 cpix := Tribe[CityInfo.Owner].cpix; 651 666 if (ciWalled and CityInfo.Flags = 0) or 652 ( GrExt[cHGr].Data.Canvas.Pixels[(xGr + 4) * 65, cpix * 49 + 48] = $00FFFF)667 (cHGr.Data.Canvas.Pixels[(xGr + 4) * 65, cpix * 49 + 48] = $00FFFF) 653 668 then 654 669 Sprite(cHGr, x - xxc, y - 2 * yyc, xxc * 2, yyc * 3, … … 819 834 exit; 820 835 821 BitBltBitmap( GrExt[HGrTerrain].Data, x + xxt div 2, y, xxt, yyt,836 BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y, xxt, yyt, 822 837 1 + (Conn shr 6 + Conn and 1 shl 2) * (xxt * 2 + 1), 823 838 1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 824 BitBltBitmap( GrExt[HGrTerrain].Data, x + xxt, y + yyt div 2, xxt, yyt,839 BitBltBitmap(HGrTerrain.Data, x + xxt, y + yyt div 2, xxt, yyt, 825 840 1 + (Conn and 7) * (xxt * 2 + 1) + xxt, 826 841 1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 827 BitBltBitmap( GrExt[HGrTerrain].Data, x + xxt div 2, y + yyt, xxt, yyt,842 BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y + yyt, xxt, yyt, 828 843 1 + (Conn shr 2 and 7) * (xxt * 2 + 1) + xxt, 829 844 1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 830 BitBltBitmap( GrExt[HGrTerrain].Data, x, y + yyt div 2, xxt, yyt,845 BitBltBitmap(HGrTerrain.Data, x, y + yyt div 2, xxt, yyt, 831 846 1 + (Conn shr 4 and 7) * (xxt * 2 + 1), 832 847 1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 833 848 Conn := Connection4(Loc, fTerrain, fUNKNOWN); { dither to black } 834 849 if Conn and 1 <> 0 then 835 BitBltBitmap( GrExt[HGrTerrain].Mask, x + xxt, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) +850 BitBltBitmap(HGrTerrain.Mask, x + xxt, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) + 836 851 xxt, 1 + yyt + 15 * (yyt * 3 + 1), SRCAND); 837 852 if Conn and 2 <> 0 then 838 BitBltBitmap( GrExt[HGrTerrain].Mask, x + xxt, y + yyt, xxt, yyt,853 BitBltBitmap(HGrTerrain.Mask, x + xxt, y + yyt, xxt, yyt, 839 854 1 + 7 * (xxt * 2 + 1) + xxt, 1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND); 840 855 if Conn and 4 <> 0 then 841 BitBltBitmap( GrExt[HGrTerrain].Mask, x, y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1),856 BitBltBitmap(HGrTerrain.Mask, x, y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1), 842 857 1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND); 843 858 if Conn and 8 <> 0 then 844 BitBltBitmap( GrExt[HGrTerrain].Mask, x, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1),859 BitBltBitmap(HGrTerrain.Mask, x, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1), 845 860 1 + yyt + 15 * (yyt * 3 + 1), SRCAND); 846 861 end; … … 1012 1027 1013 1028 BitBltCanvas(Borders.Canvas, 0, p1 * (yyt * 2), xxt * 2, 1014 yyt * 2, GrExt[HGrTerrain].Data.Canvas,1029 yyt * 2, HGrTerrain.Data.Canvas, 1015 1030 1 + 8 * (xxt * 2 + 1), 1 + yyt + 16 * (yyt * 3 + 1)); 1016 1031 Borders.BeginUpdate; … … 1043 1058 if p2 <> p1 then 1044 1059 begin 1045 BitBltBitmap( GrExt[HGrTerrain].Mask, x + dx * xxt, y + dy * yyt, xxt,1060 BitBltBitmap(HGrTerrain.Mask, x + dx * xxt, y + dy * yyt, xxt, 1046 1061 yyt, 1 + 8 * (xxt * 2 + 1) + dx * xxt, 1047 1062 1 + yyt + 16 * (yyt * 3 + 1) + dy * yyt, SRCAND); … … 1536 1551 bix := Aix; 1537 1552 if Aix = -1 then 1538 BitBltBitmap( GrExt[HGrTerrain].Data, x + dx * xxt, y + dy * yyt, xxt,1553 BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y + dy * yyt, xxt, 1539 1554 yyt, 1 + 6 * (xxt * 2 + 1) + (dx + dy + 1) and 1 * xxt, 1 + yyt, 1540 1555 SRCCOPY) // arctic <-> ocean 1541 1556 else if bix = -1 then 1542 BitBltBitmap( GrExt[HGrTerrain].Data, x + dx * xxt, y + dy * yyt, xxt,1557 BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y + dy * yyt, xxt, 1543 1558 yyt, 1 + 6 * (xxt * 2 + 1) + xxt - (dx + dy + 1) and 1 * xxt, 1544 1559 1 + yyt * 2, SRCCOPY) // arctic <-> ocean … … 1549 1564 end; 1550 1565 1551 DataCanvas := GrExt[HGrTerrain].Data.Canvas;1552 MaskCanvas := GrExt[HGrTerrain].Mask.Canvas;1566 DataCanvas := HGrTerrain.Data.Canvas; 1567 MaskCanvas := HGrTerrain.Mask.Canvas; 1553 1568 for dy := -2 to ny + 1 do 1554 1569 for dx := -1 to nx do
Note:
See TracChangeset
for help on using the changeset viewer.