Changeset 537


Ignore:
Timestamp:
Apr 16, 2024, 10:35:07 AM (7 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk/LocalPlayer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/IsoEngine.pas

    r536 r537  
    7878    procedure TextOut(X, Y, Color: Integer; const S: string);
    7979    procedure Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    80     procedure TSprite(xDst, yDst, grix: Integer; PureBlack: Boolean = False);
     80    procedure TerrainSprite(xDst, yDst, grix: Integer; PureBlack: Boolean = False);
    8181    procedure ApplyTileSize(ATileSize: TTileSize);
    8282  public
     
    115115    Borders: TBitmap;
    116116    BordersOk: Integer;
    117     TSpriteSize: TTerrainSpriteSize;
     117    TerrainSpriteSize: TTerrainSpriteSize;
    118118    HGrTerrain: TGraphicSet;
    119119    HGrCities: TGraphicSet;
     
    210210  IsoMap.LandPatch := LandPatch;
    211211  IsoMap.OceanPatch := OceanPatch;
    212   IsoMap.TerrainSpriteSize := TSpriteSize;
     212  IsoMap.TerrainSpriteSize := TerrainSpriteSize;
    213213  IsoMap.CitiesPictures := CitiesPictures;
    214214end;
     
    224224  HGrTerrain := nil;
    225225  HGrCities := nil;
    226   SetLength(TSpriteSize, TerrainIconLines * TerrainIconCols);
     226  SetLength(TerrainSpriteSize, TerrainIconLines * TerrainIconCols);
    227227  CitiesPictures := TCitiesPictures.Create;
    228228end;
     
    618618end;
    619619
    620 procedure TIsoMap.TSprite(xDst, yDst, grix: Integer;
     620procedure TIsoMap.TerrainSprite(xDst, yDst, grix: Integer;
    621621  PureBlack: Boolean = False);
    622622var
     
    709709        { DataCanvas := HGrTerrain.Data.Canvas;
    710710          MaskCanvas := HGrTerrain.Mask.Canvas;
    711           TSprite(X, Y + 16, 12 * 9 + 7);  }
     711          TerrainSprite(X, Y + 16, 12 * 9 + 7);  }
    712712        Sprite(HGrStdUnits, X, Y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1);
    713713      end;
     
    961961    then
    962962      Conn := Conn and not 9; // no connection to north
    963     TSprite(X, Y, yGr + Conn mod 8 + (Conn div 8) * TerrainIconCols);
     963    TerrainSprite(X, Y, yGr + Conn mod 8 + (Conn div 8) * TerrainIconCols);
    964964  end
    965965  else if Tile and fTerrain in [fHills, fMountains, fForest] then
     
    967967    yGr := 3 + 2 * (Tile and fTerrain - fForest);
    968968    Conn := Connection4(Loc, fTerrain, Tile and fTerrain);
    969     TSprite(X, Y, Conn mod 8 + (yGr + Conn div 8) * TerrainIconCols);
     969    TerrainSprite(X, Y, Conn mod 8 + (yGr + Conn div 8) * TerrainIconCols);
    970970  end
    971971  else if Tile and fDeadLands <> 0 then
    972     TSprite(X, Y, spRow2);
     972    TerrainSprite(X, Y, spRow2);
    973973
    974974  if ShowObjects then
    975975  begin
    976976    if Tile and fTerImp = tiFarm then
    977       TSprite(X, Y, spFarmLand)
     977      TerrainSprite(X, Y, spFarmLand)
    978978    else if Tile and fTerImp = tiIrrigation then
    979       TSprite(X, Y, spIrrigation);
     979      TerrainSprite(X, Y, spIrrigation);
    980980  end;
    981981  if Tile and fRiver <> 0 then
     
    984984      Connection4(Loc, fTerrain, fShore) or Connection4(Loc, fTerrain,
    985985      fUNKNOWN);
    986     TSprite(X, Y, spRiver + Conn mod 8 + (Conn div 8) * TerrainIconCols);
     986    TerrainSprite(X, Y, spRiver + Conn mod 8 + (Conn div 8) * TerrainIconCols);
    987987  end;
    988988
     
    992992    for Dir := 0 to 3 do
    993993      if Conn and (1 shl Dir) <> 0 then { river mouths }
    994         TSprite(X, Y, spRiverMouths + Dir);
     994        TerrainSprite(X, Y, spRiverMouths + Dir);
    995995    if ShowObjects then
    996996    begin
     
    998998      for Dir := 0 to 7 do
    999999        if Conn and (1 shl Dir) <> 0 then { canal mouths }
    1000           TSprite(X, Y, spCanalMouths + 1 + Dir);
     1000          TerrainSprite(X, Y, spCanalMouths + 1 + Dir);
    10011001    end;
    10021002  end;
     
    10101010      if Conn = 0 then begin
    10111011        if Tile and fCanal <> 0 then
    1012           TSprite(X, Y, spCanal);
     1012          TerrainSprite(X, Y, spCanal);
    10131013      end
    10141014      else
    10151015        for Dir := 0 to 7 do
    10161016          if (1 shl Dir) and Conn <> 0 then
    1017             TSprite(X, Y, spCanal + 1 + Dir);
     1017            TerrainSprite(X, Y, spCanal + 1 + Dir);
    10181018    end;
    10191019
     
    10271027      Conn := Connection8(Loc, fRoad or fRR or fCity) and not RRConn;
    10281028      if (Conn = 0) and (Tile and (fRR or fCity) = 0) then
    1029         TSprite(X, Y, spRoad)
     1029        TerrainSprite(X, Y, spRoad)
    10301030      else if Conn > 0 then
    10311031        for Dir := 0 to 7 do
    10321032          if (1 shl Dir) and Conn <> 0 then
    1033             TSprite(X, Y, spRoad + 1 + Dir);
     1033            TerrainSprite(X, Y, spRoad + 1 + Dir);
    10341034    end;
    10351035
    10361036    // Paint railroad connections
    10371037    if (Tile and fRR <> 0) and (RRConn = 0) then
    1038       TSprite(X, Y, spRailRoad)
     1038      TerrainSprite(X, Y, spRailRoad)
    10391039    else if RRConn > 0 then begin
    10401040      for Dir := 0 to 7 do
    10411041        if (1 shl Dir) and RRConn <> 0 then
    1042           TSprite(X, Y, spRailRoad + 1 + Dir);
     1042          TerrainSprite(X, Y, spRailRoad + 1 + Dir);
    10431043    end;
    10441044  end;
     
    10871087    if ShowObjects and not (moEditMode in MapOptions) and
    10881088      (Tile and fCity <> 0) and (CityInfo.Flags and ciSpacePort <> 0) then
    1089       TSprite(X + xxt, Y - 6, spSpacePort);
     1089      TerrainSprite(X + xxt, Y - 6, spSpacePort);
    10901090  end;
    10911091
     
    11561156
    11571157  if (Loc >= 0) and (Loc < G.lx * G.ly) and (Loc = FAdviceLoc) then
    1158     TSprite(X, Y, spPlain);
     1158    TerrainSprite(X, Y, spPlain);
    11591159
    11601160  if (Loc >= 0) and (Loc < G.lx * G.ly) and (Tile and fSpecial <> 0)
     
    11651165    SpecialRow := Tile and fSpecial shr 5;
    11661166    if SpecialCol < fForest then
    1167       TSprite(X, Y, SpecialCol + SpecialRow * TerrainIconCols)
     1167      TerrainSprite(X, Y, SpecialCol + SpecialRow * TerrainIconCols)
    11681168    else if (SpecialCol = fForest) and IsJungle(dy) then
    1169       TSprite(X, Y, spJungle - 1 + SpecialRow * TerrainIconCols)
     1169      TerrainSprite(X, Y, spJungle - 1 + SpecialRow * TerrainIconCols)
    11701170    else
    1171       TSprite(X, Y, spForest - 1 + ((SpecialCol - fForest) * 2 + SpecialRow) * TerrainIconCols);
     1171      TerrainSprite(X, Y, spForest - 1 + ((SpecialCol - fForest) * 2 + SpecialRow) * TerrainIconCols);
    11721172  end;
    11731173
     
    11751175  begin
    11761176    if Tile and fTerImp = tiMine then
    1177       TSprite(X, Y, spMine);
     1177      TerrainSprite(X, Y, spMine);
    11781178    if Tile and fTerImp = tiBase then
    1179       TSprite(X, Y, spBase);
     1179      TerrainSprite(X, Y, spBase);
    11801180    if Tile and fPoll <> 0 then
    1181       TSprite(X, Y, spPollution);
     1181      TerrainSprite(X, Y, spPollution);
    11821182    if Tile and fTerImp = tiFort then
    11831183    begin
    1184       TSprite(X, Y, spFortBack);
     1184      TerrainSprite(X, Y, spFortBack);
    11851185      if Tile and fObserved = 0 then
    1186         TSprite(X, Y, spFortFront);
     1186        TerrainSprite(X, Y, spFortFront);
    11871187    end;
    11881188  end;
    11891189  if (Tile and fDeadLands) <> 0 then
    1190     TSprite(X, Y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols);
     1190    TerrainSprite(X, Y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols);
    11911191
    11921192  if moEditMode in MapOptions then
     
    12061206        1 + yyt + 15 * (yyt * 3 + 1))
    12071207    else
    1208       TSprite(X, Y, spGrid, xxt <> 33);
     1208      TerrainSprite(X, Y, spGrid, xxt <> 33);
    12091209
    12101210  if FoW and (Tile and fObserved = 0) then
     
    12191219    if (Destination = Loc) and (Destination <> MyUn[UnFocus].Loc) then
    12201220      if not UseBlink or BlinkOn then
    1221         TSprite(X, Y, spBlink1)
     1221        TerrainSprite(X, Y, spBlink1)
    12221222      else
    1223         TSprite(X, Y, spBlink2)
     1223        TerrainSprite(X, Y, spBlink2)
    12241224  end;
    12251225{$ENDIF}
     
    12271227  begin
    12281228    if Tile and fPrefStartPos <> 0 then
    1229       TSprite(X, Y, spPrefStartPos)
     1229      TerrainSprite(X, Y, spPrefStartPos)
    12301230    else if Tile and fStartPos <> 0 then
    1231       TSprite(X, Y, spStartPos);
     1231      TerrainSprite(X, Y, spStartPos);
    12321232  end
    12331233  else if ShowObjects then
    12341234  begin
    12351235    { if (CityLoc < 0) and (UnFocus >= 0) and (Loc = MyUn[UnFocus].Loc) then
    1236       if BlinkOn then TSprite(X, Y, 8 + 9 * 0)
    1237       else TSprite(X, Y, 8 + 9 * 1); }
     1236      if BlinkOn then TerrainSprite(X, Y, 8 + 9 * 0)
     1237      else TerrainSprite(X, Y, 8 + 9 * 1); }
    12381238
    12391239    NameCity;
     
    12861286  if ShowObjects and (Tile and fTerImp = tiFort) and (Tile and fObserved <> 0)
    12871287  then
    1288     TSprite(X, Y, spFortFront);
     1288    TerrainSprite(X, Y, spFortFront);
    12891289
    12901290  if (Loc >= 0) and (Loc < G.lx * G.ly) then
  • trunk/LocalPlayer/Term.pas

    r535 r537  
    995995procedure TMainScreen.PaintZoomedTile(Dst: TBitmap; X, Y, Loc: Integer);
    996996
    997   procedure TSprite(xDst, yDst, xSrc, ySrc: Integer);
     997  procedure TerrainSprite(xDst, yDst, xSrc, ySrc: Integer);
    998998  begin
    999999    with NoMapPanel do
     
    10021002  end;
    10031003
    1004   procedure TSprite4(xSrc, ySrc: Integer);
     1004  procedure TerrainSprite4(xSrc, ySrc: Integer);
    10051005  begin
    10061006    with NoMapPanel do begin
     
    10421042
    10431043    if Tile and fTerrain >= fForest then
    1044       TSprite4(2, 2)
     1044      TerrainSprite4(2, 2)
    10451045    else
    1046       TSprite4(Tile and fTerrain, 0);
     1046      TerrainSprite4(Tile and fTerrain, 0);
    10471047    if Tile and fTerrain >= fForest then
    10481048    begin
     
    10511051      else
    10521052        ySrc := 3 + 2 * (Tile and fTerrain - fForest);
    1053       TSprite(xxt, 0, 6, ySrc);
    1054       TSprite(0, yyt, 3, ySrc);
    1055       TSprite((xxt * 2), yyt, 4, ySrc + 1);
    1056       TSprite(xxt, (yyt * 2), 1, ySrc + 1);
     1053      TerrainSprite(xxt, 0, 6, ySrc);
     1054      TerrainSprite(0, yyt, 3, ySrc);
     1055      TerrainSprite((xxt * 2), yyt, 4, ySrc + 1);
     1056      TerrainSprite(xxt, (yyt * 2), 1, ySrc + 1);
    10571057    end;
    10581058
     
    10601060    case Tile and fTerImp of
    10611061      tiIrrigation: begin
    1062         TSprite(xxt, 0, 0, 12);
    1063         TSprite(xxt * 2, yyt, 0, 12);
     1062        TerrainSprite(xxt, 0, 0, 12);
     1063        TerrainSprite(xxt * 2, yyt, 0, 12);
    10641064      end;
    10651065      tiFarm: begin
    1066         TSprite(xxt, 0, 1, 12);
    1067         TSprite(xxt * 2, yyt, 1, 12);
     1066        TerrainSprite(xxt, 0, 1, 12);
     1067        TerrainSprite(xxt * 2, yyt, 1, 12);
    10681068      end;
    10691069    end;
     
    10711071    // river/canal/road/railroad
    10721072    if Tile and fRiver <> 0 then begin
    1073       TSprite(0, yyt, 2, 14);
    1074       TSprite(xxt, (yyt * 2), 2, 14);
     1073      TerrainSprite(0, yyt, 2, 14);
     1074      TerrainSprite(xxt, (yyt * 2), 2, 14);
    10751075    end;
    10761076    if Tile and fCanal <> 0 then begin
    1077       TSprite(xxt, 0, 7, 11);
    1078       TSprite(xxt, 0, 3, 11);
    1079       TSprite(xxt * 2, yyt, 7, 11);
    1080       TSprite(xxt * 2, yyt, 3, 11);
     1077      TerrainSprite(xxt, 0, 7, 11);
     1078      TerrainSprite(xxt, 0, 3, 11);
     1079      TerrainSprite(xxt * 2, yyt, 7, 11);
     1080      TerrainSprite(xxt * 2, yyt, 3, 11);
    10811081    end;
    10821082    if Tile and fRR <> 0 then begin
    1083       TSprite((xxt * 2), yyt, 1, 10);
    1084       TSprite((xxt * 2), yyt, 5, 10);
    1085       TSprite(xxt, (yyt * 2), 1, 10);
    1086       TSprite(xxt, (yyt * 2), 5, 10);
     1083      TerrainSprite((xxt * 2), yyt, 1, 10);
     1084      TerrainSprite((xxt * 2), yyt, 5, 10);
     1085      TerrainSprite(xxt, (yyt * 2), 1, 10);
     1086      TerrainSprite(xxt, (yyt * 2), 5, 10);
    10871087    end
    10881088    else if Tile and fRoad <> 0 then begin
    1089       TSprite((xxt * 2), yyt, 8, 9);
    1090       TSprite((xxt * 2), yyt, 5, 9);
    1091       TSprite(xxt, (yyt * 2), 1, 9);
    1092       TSprite(xxt, (yyt * 2), 5, 9);
     1089      TerrainSprite((xxt * 2), yyt, 8, 9);
     1090      TerrainSprite((xxt * 2), yyt, 5, 9);
     1091      TerrainSprite(xxt, (yyt * 2), 1, 9);
     1092      TerrainSprite(xxt, (yyt * 2), 5, 9);
    10931093    end;
    10941094
    10951095    if Tile and fPoll <> 0 then
    1096       TSprite(xxt, (yyt * 2), 6, 12);
     1096      TerrainSprite(xxt, (yyt * 2), 6, 12);
    10971097
    10981098    // special
    1099     if Tile and (fTerrain or fSpecial) = fGrass or fSpecial1 then TSprite4(2, 1)
     1099    if Tile and (fTerrain or fSpecial) = fGrass or fSpecial1 then TerrainSprite4(2, 1)
    11001100    else if Tile and fSpecial <> 0 then
    11011101      if Tile and fTerrain < fForest then
    1102         TSprite(0, yyt, Tile and fTerrain, Tile and fSpecial shr 5)
     1102        TerrainSprite(0, yyt, Tile and fTerrain, Tile and fSpecial shr 5)
    11031103      else if (Tile and fTerrain = fForest) and IsJungle(Loc div G.lx) then
    1104         TSprite(0, yyt, 8, 17 + Tile and fSpecial shr 5)
     1104        TerrainSprite(0, yyt, 8, 17 + Tile and fSpecial shr 5)
    11051105      else
    1106         TSprite(0, yyt, 8, 2 + (Tile and fTerrain - fForest) * 2 + Tile and
     1106        TerrainSprite(0, yyt, 8, 2 + (Tile and fTerrain - fForest) * 2 + Tile and
    11071107          fSpecial shr 5)
    11081108    else if Tile and fDeadLands <> 0 then begin
    1109       TSprite4(6, 2);
    1110       TSprite(xxt, yyt, 8, 12 + Tile shr 25 and 3);
     1109      TerrainSprite4(6, 2);
     1110      TerrainSprite(xxt, yyt, 8, 12 + Tile shr 25 and 3);
    11111111    end;
    11121112
    11131113    // other improvements
    11141114    case Tile and fTerImp of
    1115       tiMine: TSprite(xxt, 0, 2, 12);
     1115      tiMine: TerrainSprite(xxt, 0, 2, 12);
    11161116      tiFort: begin
    1117         TSprite(xxt, 0, 7, 12);
    1118         TSprite(xxt, 0, 3, 12);
    1119       end;
    1120      tiBase: TSprite(xxt, 0, 4, 12);
     1117        TerrainSprite(xxt, 0, 7, 12);
     1118        TerrainSprite(xxt, 0, 3, 12);
     1119      end;
     1120     tiBase: TerrainSprite(xxt, 0, 4, 12);
    11211121    end;
    11221122  end;
Note: See TracChangeset for help on using the changeset viewer.