Changeset 551
- Timestamp:
- Apr 22, 2024, 10:38:13 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/IsoEngine.pas
r550 r551 69 69 ShowGrWall: Boolean; 70 70 ShowDebug: Boolean; 71 Fo W: Boolean;71 FogOfWar: Boolean; 72 72 function Connection4(Loc, Mask, Value: Integer): Integer; 73 73 function Connection8(Loc, Mask: Integer): Integer; 74 74 function OceanConnection(Loc: Integer): Integer; 75 procedure PaintLandOcean(X, Y, Loc, nx, ny: Integer); 75 76 procedure PaintShore(X, Y, Loc: Integer); 76 77 procedure PaintTileExtraTerrain(X, Y, Loc: Integer); … … 902 903 end; 903 904 905 procedure TIsoMap.PaintLandOcean(X, Y, Loc, nx, ny: Integer); 906 var 907 dy, dx: Integer; 908 ALoc, BLoc, ATer, BTer, Aix, bix: Integer; 909 begin 910 for dy := 0 to ny + 1 do 911 if (Loc + dy * G.lx >= 0) and (Loc + (dy - 3) * G.lx < G.lx * G.ly) then 912 for dx := 0 to nx do begin 913 ALoc := dLoc(Loc, dx - (dy + dx) and 1, dy - 2); 914 BLoc := dLoc(Loc, dx - (dy + dx + 1) and 1, dy - 1); 915 if (ALoc < 0) or (ALoc >= G.lx * G.ly) then 916 ATer := PoleTile(ALoc) and fTerrain 917 else 918 ATer := MyMap[ALoc] and fTerrain; 919 if (BLoc < 0) or (BLoc >= G.lx * G.ly) then 920 BTer := PoleTile(BLoc) and fTerrain 921 else 922 BTer := MyMap[BLoc] and fTerrain; 923 924 if (ATer <> fUNKNOWN) or (BTer <> fUNKNOWN) then 925 if ((ATer < fGrass) or (ATer = fUNKNOWN)) and 926 ((BTer < fGrass) or (BTer = fUNKNOWN)) then 927 begin 928 if ATer = fUNKNOWN then 929 Aix := 0 930 else if IsShoreTile(ALoc) then 931 if ATer = fOcean then 932 Aix := -1 933 else 934 Aix := 1 935 else 936 Aix := ATer + 2; 937 if BTer = fUNKNOWN then 938 bix := 0 939 else if IsShoreTile(BLoc) then 940 if BTer = fOcean then 941 bix := -1 942 else 943 bix := 1 944 else 945 bix := BTer + 2; 946 if (Aix > 1) or (bix > 1) then 947 begin 948 if Aix = -1 then 949 if bix = fOcean + 2 then begin 950 Aix := 0; 951 bix := 0; 952 end else begin 953 Aix := 0; 954 bix := 1; 955 end 956 else if bix = -1 then 957 if Aix = fOcean + 2 then begin 958 Aix := 1; 959 bix := 1; 960 end else begin 961 Aix := 1; 962 bix := 0; 963 end; 964 BitBltBitmapOutput(OceanPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt, 965 Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY); 966 end; 967 end else begin 968 if ATer = fUNKNOWN then 969 Aix := 0 970 else if (ALoc >= 0) and (ALoc < G.lx * G.ly) and 971 (MyMap[ALoc] and fDeadLands <> 0) then 972 Aix := -2 973 else if ATer = fOcean then 974 Aix := -1 975 else if ATer = fShore then 976 Aix := 1 977 else if ATer >= fForest then 978 Aix := 8 979 else 980 Aix := ATer; 981 if BTer = fUNKNOWN then 982 bix := 0 983 else if (BLoc >= 0) and (BLoc < G.lx * G.ly) and 984 (MyMap[BLoc] and fDeadLands <> 0) then 985 bix := -2 986 else if BTer = fOcean then 987 bix := -1 988 else if BTer = fShore then 989 bix := 1 990 else if BTer >= fForest then 991 bix := 8 992 else 993 bix := BTer; 994 if (Aix = -2) and (bix = -2) then begin 995 Aix := fDesert; 996 bix := fDesert; 997 end 998 else if Aix = -2 then 999 if bix < 2 then 1000 Aix := 8 1001 else 1002 Aix := bix 1003 else if bix = -2 then 1004 if Aix < 2 then 1005 bix := 8 1006 else 1007 bix := Aix; 1008 if Aix = -1 then 1009 BitBltBitmapOutput(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt, 1010 yyt, 1 + 6 * (xxt * 2 + 1) + (dx + dy + 1) and 1 * xxt, 1 + yyt, 1011 SRCCOPY) // arctic <-> ocean 1012 else if bix = -1 then 1013 BitBltBitmapOutput(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt, 1014 yyt, 1 + 6 * (xxt * 2 + 1) + xxt - (dx + dy + 1) and 1 * xxt, 1015 1 + yyt * 2, SRCCOPY) // arctic <-> ocean 1016 else 1017 BitBltBitmapOutput(LandPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt, 1018 Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY); 1019 end; 1020 end; 1021 end; 1022 904 1023 procedure TIsoMap.PaintShore(X, Y, Loc: Integer); 905 1024 var … … 1157 1276 end; { square not discovered } 1158 1277 1159 if not (Fo Wand (Tile and fObserved = 0)) then1278 if not (FogOfWar and (Tile and fObserved = 0)) then 1160 1279 PaintBorder(X, Y, Loc, Tile); 1161 1280 … … 1202 1321 Fog := Tile and fGrWall = 0 1203 1322 else 1204 Fog := Fo Wand (Tile and fObserved = 0);1323 Fog := FogOfWar and (Tile and fObserved = 0); 1205 1324 if Fog and ShowObjects then 1206 1325 if Loc < -G.lx then … … 1213 1332 TerrainSprite(X, Y, spGrid, xxt <> 33); 1214 1333 1215 if Fo Wand (Tile and fObserved = 0) then1334 if FogOfWar and (Tile and fObserved = 0) then 1216 1335 PaintBorder(X, Y, Loc, Tile); 1217 1336 … … 1480 1599 dx, dy, xm, ym, ALoc, BLoc, ATer, BTer, Aix, bix: Integer; 1481 1600 begin 1482 Fo W:= True;1601 FogOfWar := True; 1483 1602 ShowLoc := moLocCodes in MapOptions; 1484 1603 ShowDebug := pDebugMap >= 0; … … 1489 1608 ShowMyBorder := CityOwner < 0; 1490 1609 ShowGrWall := (CityOwner < 0) and (moGreatWall in MapOptions); 1491 if ShowDebug then 1492 Server(sGetDebugMap, Me, pDebugMap, DebugMap) 1493 else 1494 DebugMap := nil; 1495 with FOutput.Canvas do 1496 begin 1610 if ShowDebug then Server(sGetDebugMap, Me, pDebugMap, DebugMap) 1611 else DebugMap := nil; 1612 1613 with FOutput.Canvas do begin 1497 1614 RealTop := Y - ((Loc + 12345 * G.lx) div G.lx - 12345) * yyt; 1498 1615 RealBottom := Y + (G.ly - ((Loc + 12345 * G.lx) div G.lx - 12345) + … … 1512 1629 end; 1513 1630 1514 for dy := 0 to ny + 1 do 1515 if (Loc + dy * G.lx >= 0) and (Loc + (dy - 3) * G.lx < G.lx * G.ly) then 1516 for dx := 0 to nx do 1517 begin 1518 ALoc := dLoc(Loc, dx - (dy + dx) and 1, dy - 2); 1519 BLoc := dLoc(Loc, dx - (dy + dx + 1) and 1, dy - 1); 1520 if (ALoc < 0) or (ALoc >= G.lx * G.ly) then 1521 ATer := PoleTile(ALoc) and fTerrain 1522 else 1523 ATer := MyMap[ALoc] and fTerrain; 1524 if (BLoc < 0) or (BLoc >= G.lx * G.ly) then 1525 BTer := PoleTile(BLoc) and fTerrain 1526 else 1527 BTer := MyMap[BLoc] and fTerrain; 1528 1529 if (ATer <> fUNKNOWN) or (BTer <> fUNKNOWN) then 1530 if ((ATer < fGrass) or (ATer = fUNKNOWN)) and 1531 ((BTer < fGrass) or (BTer = fUNKNOWN)) then 1532 begin 1533 if ATer = fUNKNOWN then 1534 Aix := 0 1535 else if IsShoreTile(ALoc) then 1536 if ATer = fOcean then 1537 Aix := -1 1538 else 1539 Aix := 1 1540 else 1541 Aix := ATer + 2; 1542 if BTer = fUNKNOWN then 1543 bix := 0 1544 else if IsShoreTile(BLoc) then 1545 if BTer = fOcean then 1546 bix := -1 1547 else 1548 bix := 1 1549 else 1550 bix := BTer + 2; 1551 if (Aix > 1) or (bix > 1) then 1552 begin 1553 if Aix = -1 then 1554 if bix = fOcean + 2 then 1555 begin 1556 Aix := 0; 1557 bix := 0; 1558 end 1559 else 1560 begin 1561 Aix := 0; 1562 bix := 1; 1563 end 1564 else if bix = -1 then 1565 if Aix = fOcean + 2 then 1566 begin 1567 Aix := 1; 1568 bix := 1; 1569 end 1570 else 1571 begin 1572 Aix := 1; 1573 bix := 0; 1574 end; 1575 BitBltBitmapOutput(OceanPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt, 1576 Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY); 1577 end; 1578 end 1579 else 1580 begin 1581 if ATer = fUNKNOWN then 1582 Aix := 0 1583 else if (ALoc >= 0) and (ALoc < G.lx * G.ly) and 1584 (MyMap[ALoc] and fDeadLands <> 0) then 1585 Aix := -2 1586 else if ATer = fOcean then 1587 Aix := -1 1588 else if ATer = fShore then 1589 Aix := 1 1590 else if ATer >= fForest then 1591 Aix := 8 1592 else 1593 Aix := ATer; 1594 if BTer = fUNKNOWN then 1595 bix := 0 1596 else if (BLoc >= 0) and (BLoc < G.lx * G.ly) and 1597 (MyMap[BLoc] and fDeadLands <> 0) then 1598 bix := -2 1599 else if BTer = fOcean then 1600 bix := -1 1601 else if BTer = fShore then 1602 bix := 1 1603 else if BTer >= fForest then 1604 bix := 8 1605 else 1606 bix := BTer; 1607 if (Aix = -2) and (bix = -2) then 1608 begin 1609 Aix := fDesert; 1610 bix := fDesert; 1611 end 1612 else if Aix = -2 then 1613 if bix < 2 then 1614 Aix := 8 1615 else 1616 Aix := bix 1617 else if bix = -2 then 1618 if Aix < 2 then 1619 bix := 8 1620 else 1621 bix := Aix; 1622 if Aix = -1 then 1623 BitBltBitmapOutput(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt, 1624 yyt, 1 + 6 * (xxt * 2 + 1) + (dx + dy + 1) and 1 * xxt, 1 + yyt, 1625 SRCCOPY) // arctic <-> ocean 1626 else if bix = -1 then 1627 BitBltBitmapOutput(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt, 1628 yyt, 1 + 6 * (xxt * 2 + 1) + xxt - (dx + dy + 1) and 1 * xxt, 1629 1 + yyt * 2, SRCCOPY) // arctic <-> ocean 1630 else 1631 BitBltBitmapOutput(LandPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt, 1632 Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY); 1633 end; 1634 end; 1631 PaintLandOcean(X, Y, Loc, nx, ny); 1635 1632 1636 1633 for dy := -2 to ny + 1 do … … 1638 1635 if (dx + dy) and 1 = 0 then 1639 1636 PaintShore(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy)); 1637 1640 1638 for dy := -2 to ny + 1 do 1641 1639 for dx := -1 to nx do 1642 1640 if (dx + dy) and 1 = 0 then 1643 PaintTileExtraTerrain(X + xxt * dx, Y + yyt + yyt * dy, 1644 dLoc(Loc, dx, dy)); 1645 1646 if CityOwner >= 0 then 1647 begin 1641 PaintTileExtraTerrain(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy)); 1642 1643 if CityOwner >= 0 then begin 1644 // Paint objects outside radius 1648 1645 for dy := -2 to ny + 1 do 1649 1646 for dx := -2 to nx + 1 do … … 1655 1652 CityOwner, UseBlink); 1656 1653 end; 1654 1657 1655 dx := ((CityLoc mod G.lx * 2 + CityLoc div G.lx and 1) - 1658 1656 ((Loc + 666 * G.lx) mod G.lx * 2 + (Loc + 666 * G.lx) div G.lx and 1) + 3 … … 1663 1661 ShadeOutside(FLeft, FTop, FRight - FLeft, FBottom - FTop, xm, ym); 1664 1662 CityGrid(xm, ym, CityAllowClick); 1663 1664 // Paint objects inside radius 1665 1665 for dy := -2 to ny + 1 do 1666 1666 for dx := -2 to nx + 1 do … … 1672 1672 CityOwner, UseBlink); 1673 1673 end; 1674 end 1675 else 1676 begin 1677 if ShowLoc or (moEditMode in MapOptions) or 1678 (moGrid in MapOptions) then 1674 end else begin 1675 if ShowLoc or (moEditMode in MapOptions) or (moGrid in MapOptions) then 1679 1676 PaintGrid(X, Y, nx, ny); 1677 1680 1678 for dy := -2 to ny + 1 do 1681 1679 for dx := -2 to nx + 1 do … … 1684 1682 CityLoc, CityOwner, UseBlink); 1685 1683 end; 1686 1687 // frame(FOutput.Canvas,x+1,y+1,x+nx*33+33-2,y+ny*16+32-2,$FFFF,$FFFF);1688 1684 end; 1689 1685
Note:
See TracChangeset
for help on using the changeset viewer.