Changeset 704


Ignore:
Timestamp:
Aug 12, 2025, 3:14:50 PM (21 hours ago)
Author:
chronos
Message:
  • Fixed: Enable map move keys also in editor mode.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r676 r704  
    71607160  if not Idle then Exit;
    71617161
     7162  // Map move
     7163  if BMapMoveLeftDown.Test(ShortCut) then DoMoveMap(-1, 1)
     7164  else if BMapMoveDown.Test(ShortCut) then DoMoveMap(0, 2)
     7165  else if BMapMoveRightDown.Test(ShortCut) then DoMoveMap(1, 1)
     7166  else if BMapMoveLeft.Test(ShortCut) then DoMoveMap(-2, 0)
     7167  else if BMapMoveRight.Test(ShortCut) then DoMoveMap(2, 0)
     7168  else if BMapMoveLeftUp.Test(ShortCut) then DoMoveMap(-1, -1)
     7169  else if BMapMoveUp.Test(ShortCut) then DoMoveMap(0, -2)
     7170  else if BMapMoveRightUp.Test(ShortCut) then DoMoveMap(1, -1);
     7171
    71627172  if ClientMode = cEditMap then begin
    71637173    if BResign.Test(ShortCut) then mResign.Click
     
    72787288    else if BUnitMoveLeftUp.Test(ShortCut) then DoMoveUnit(-1, -1)
    72797289    else if BUnitMoveUp.Test(ShortCut) then  DoMoveUnit(0, -2)
    7280     else if BUnitMoveRightUp.Test(ShortCut) then DoMoveUnit(1, -1)
    7281     // Map move
    7282     else if BMapMoveLeftDown.Test(ShortCut) then DoMoveMap(-1, 1)
    7283     else if BMapMoveDown.Test(ShortCut) then DoMoveMap(0, 2)
    7284     else if BMapMoveRightDown.Test(ShortCut) then DoMoveMap(1, 1)
    7285     else if BMapMoveLeft.Test(ShortCut) then DoMoveMap(-2, 0)
    7286     else if BMapMoveRight.Test(ShortCut) then DoMoveMap(2, 0)
    7287     else if BMapMoveLeftUp.Test(ShortCut) then DoMoveMap(-1, -1)
    7288     else if BMapMoveUp.Test(ShortCut) then DoMoveMap(0, -2)
    7289     else if BMapMoveRightUp.Test(ShortCut) then DoMoveMap(1, -1);
     7290    else if BUnitMoveRightUp.Test(ShortCut) then DoMoveUnit(1, -1);
    72907291  end;
    72917292end;
  • trunk/MiniMap.pas

    r703 r704  
    313313  xxt, xwMini: Integer);
    314314var
    315   x, y, Loc, i, hw, xm, cm, cmPolOcean, cmPolNone: integer;
     315  X, Y, Loc, I, HW, XM, CM, cmPolOcean, cmPolNone: integer;
    316316  PrevMiniPixel: TPixelPointer;
    317317  MiniPixel: TPixelPointer;
     
    321321  MyUnit: PUn;
    322322  EnemyUnit: PUnitInfo;
    323   xx, yy: Integer;
     323  XX, YY: Integer;
    324324begin
    325325  if not Assigned(MyMap) then Exit;
    326326  cmPolOcean := HGrSystem.Data.Canvas.Pixels[101, 67];
    327327  cmPolNone := HGrSystem.Data.Canvas.Pixels[102, 67];
    328   hw := MapWidth div (xxt * 2);
     328  HW := MapWidth div (xxt * 2);
    329329  with Bitmap.Canvas do begin
    330330    Brush.Color := $000000;
     
    337337  PrevMiniPixel := TPixelPointer.Create(Bitmap);
    338338
    339   xx := ScaleToNative(Size.X);
    340   yy := ScaleToNative(Size.Y);
    341   for y := 0 to yy - 1 do begin
    342     for x := 0 to xx - 1 do begin
    343       Loc := ScaleFromNative(x) + Size.X * ScaleFromNative(y);
     339  XX := ScaleToNative(Size.X);
     340  YY := ScaleToNative(Size.Y);
     341  for Y := 0 to YY - 1 do begin
     342    for X := 0 to XX - 1 do begin
     343      Loc := ScaleFromNative(X) + Size.X * ScaleFromNative(Y);
    344344      if (MyMap[Loc] and fTerrain) <> fUNKNOWN then begin
    345         for i := 0 to 1 do begin
    346           xm := ((x - ScaleToNative(xwMini)) * 2 + i + y and 1 - ScaleToNative(hw) +
    347             xx * 5) mod (xx * 2);
    348           MiniPixel.SetX(xm);
     345        for I := 0 to 1 do begin
     346          XM := ((X - ScaleToNative(xwMini)) * 2 + I + Y and 1 - ScaleToNative(HW) +
     347            XX * 5) mod (XX * 2);
     348          MiniPixel.SetX(XM);
    349349          TerrainTile := MyMap[Loc] and fTerrain;
    350350          if TerrainTile > 11 then TerrainTile := 0;
    351           cm := Colors[TerrainTile, i];
     351          CM := Colors[TerrainTile, I];
    352352          if ClientMode = cEditMap then begin
    353353            if MyMap[Loc] and (fPrefStartPos or fStartPos) <> 0 then
    354               cm := $FFFFFF;
     354              CM := $FFFFFF;
    355355          end
    356356          else if MyMap[Loc] and fCity <> 0 then begin
    357357            // City
    358358            MyCity := GetMyCityByLoc(Loc);
    359             if Assigned(MyCity) then cm := Tribe[me].Color
     359            if Assigned(MyCity) then CM := Tribe[me].Color
    360360            else begin
    361361              EnemyCity := GetEnemyCityByLoc(Loc);
    362362              if Assigned(EnemyCity) then
    363                 cm := Tribe[EnemyCity^.Owner].Color;
     363                CM := Tribe[EnemyCity^.Owner].Color;
    364364            end;
    365             cm := $808080 or cm shr 1; { increase brightness }
    366             if y > 0 then begin
     365            CM := $808080 or CM shr 1; { increase brightness }
     366            if Y > 0 then begin
    367367              // 2x2 city dot covers two lines
    368               PrevMiniPixel.SetX(xm);
     368              PrevMiniPixel.SetX(XM);
    369369              if (PByte(PrevMiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    370               (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + yy * PrevMiniPixel.BytesPerLine)) then begin
    371                 PrevMiniPixel.PixelB := (cm shr 16) and $ff;
    372                 PrevMiniPixel.PixelG := (cm shr 8) and $ff;
    373                 PrevMiniPixel.PixelR := (cm shr 0) and $ff;
     370              (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * PrevMiniPixel.BytesPerLine)) then begin
     371                PrevMiniPixel.PixelB := (CM shr 16) and $ff;
     372                PrevMiniPixel.PixelG := (CM shr 8) and $ff;
     373                PrevMiniPixel.PixelR := (CM shr 0) and $ff;
    374374              end;
    375375            end;
    376376          end
    377           else if (i = 0) and (MyMap[Loc] and fUnit <> 0) then begin
     377          else if (I = 0) and (MyMap[Loc] and fUnit <> 0) then begin
    378378            // Unit
    379379            MyUnit := GetMyUnitByLoc(Loc);
    380             if Assigned(MyUnit) then cm := Tribe[me].Color
     380            if Assigned(MyUnit) then CM := Tribe[me].Color
    381381            else begin
    382382              EnemyUnit := GetEnemyUnitByLoc(Loc);
    383383              if Assigned(EnemyUnit) then
    384                 cm := Tribe[EnemyUnit.Owner].Color;
     384                CM := Tribe[EnemyUnit.Owner].Color;
    385385            end;
    386             cm := $808080 or cm shr 1; { increase brightness }
     386            CM := $808080 or CM shr 1; { increase brightness }
    387387          end
    388388          else if moPolitical in MapOptions then begin
    389389            // Political
    390             if MyMap[Loc] and fTerrain < fGrass then cm := cmPolOcean
    391             else if MyRO.Territory[Loc] < 0 then cm := cmPolNone
    392             else cm := Tribe[MyRO.Territory[Loc]].Color;
     390            if MyMap[Loc] and fTerrain < fGrass then CM := cmPolOcean
     391            else if MyRO.Territory[Loc] < 0 then CM := cmPolNone
     392            else CM := Tribe[MyRO.Territory[Loc]].Color;
    393393          end;
    394394          if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    395           (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + yy * MiniPixel.BytesPerLine)) then begin
    396             MiniPixel.PixelB := (cm shr 16) and $ff;
    397             MiniPixel.PixelG := (cm shr 8) and $ff;
    398             MiniPixel.PixelR := (cm shr 0) and $ff;
     395          (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine)) then begin
     396            MiniPixel.PixelB := (CM shr 16) and $ff;
     397            MiniPixel.PixelG := (CM shr 8) and $ff;
     398            MiniPixel.PixelR := (CM shr 0) and $ff;
    399399          end;
    400400        end;
     
    402402    end;
    403403    MiniPixel.NextLine;
    404     if y > 0 then PrevMiniPixel.NextLine;
     404    if Y > 0 then PrevMiniPixel.NextLine;
    405405  end;
    406406  Bitmap.EndUpdate;
Note: See TracChangeset for help on using the changeset viewer.