- Fixed ghost tiles to use the proper priorities
- Fixed mouse-up handling to correctly reset the selected tile - Moved ghost tile adding to the appropriate single- and multi-select blocks - Fixed AddGhostTile to use the correct tile (current <> selected) as base for certain assumptions
This commit is contained in:
parent
fda2be2b8c
commit
211866d6c1
|
@ -551,7 +551,12 @@ begin
|
||||||
|
|
||||||
UpdateCurrentTile(X, Y);
|
UpdateCurrentTile(X, Y);
|
||||||
tmMovement.Enabled := False;
|
tmMovement.Enabled := False;
|
||||||
if CurrentTile = nil then Exit;
|
if CurrentTile = nil then
|
||||||
|
begin
|
||||||
|
SelectedTile := nil;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
targetTile := CurrentTile;
|
targetTile := CurrentTile;
|
||||||
|
|
||||||
if acSelect.Checked and tmGrabTileInfo.Enabled then
|
if acSelect.Checked and tmGrabTileInfo.Enabled then
|
||||||
|
@ -2274,7 +2279,7 @@ procedure TfrmMain.UpdateSelection;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure AddGhostTile(AX, AY: Word);
|
procedure AddGhostTile(AX, AY: Word; ABaseTile: TWorldItem);
|
||||||
var
|
var
|
||||||
blockInfo: PBlockInfo;
|
blockInfo: PBlockInfo;
|
||||||
tileInfo: PTileInfo;
|
tileInfo: PTileInfo;
|
||||||
|
@ -2325,13 +2330,15 @@ procedure TfrmMain.UpdateSelection;
|
||||||
ghostTile.Y := AY;
|
ghostTile.Y := AY;
|
||||||
if not frmDrawSettings.cbForceAltitude.Checked then
|
if not frmDrawSettings.cbForceAltitude.Checked then
|
||||||
begin
|
begin
|
||||||
ghostTile.Z := CurrentTile.Z;
|
ghostTile.Z := ABaseTile.Z;
|
||||||
if CurrentTile is TStaticItem then
|
if ABaseTile is TStaticItem then
|
||||||
ghostTile.Z := ghostTile.Z +
|
ghostTile.Z := ghostTile.Z +
|
||||||
ResMan.Tiledata.StaticTiles[CurrentTile.TileID].Height;
|
ResMan.Tiledata.StaticTiles[ABaseTile.TileID].Height;
|
||||||
end else
|
end else
|
||||||
ghostTile.Z := frmDrawSettings.seForceAltitude.Value;
|
ghostTile.Z := frmDrawSettings.seForceAltitude.Value;
|
||||||
ghostTile.PrioritySolver := MaxInt;
|
|
||||||
|
ghostTile.UpdatePriorities(ResMan.Tiledata.StaticTiles[ghostTile.TileID],
|
||||||
|
MaxInt);
|
||||||
|
|
||||||
FVirtualTiles.Add(ghostTile);
|
FVirtualTiles.Add(ghostTile);
|
||||||
blockInfo := FScreenBuffer.Insert(ghostTile);
|
blockInfo := FScreenBuffer.Insert(ghostTile);
|
||||||
|
@ -2367,43 +2374,31 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Logger.Send([lcClient, lcDebug], 'FSelection', FSelection);
|
Logger.Send([lcClient, lcDebug], 'FSelection', FSelection);
|
||||||
if FSelection.Left > -1 then
|
for tileX := FSelection.Left to FSelection.Right do
|
||||||
for tileX := FSelection.Left to FSelection.Right do
|
for tileY := FSelection.Top to FSelection.Bottom do
|
||||||
for tileY := FSelection.Top to FSelection.Bottom do
|
if not IsInRect(tileX, tileY, selectedRect) then
|
||||||
if not IsInRect(tileX, tileY, selectedRect) then
|
begin
|
||||||
|
cell := FLandscape.MapCell[tileX, tileY];
|
||||||
|
if (cell <> nil) and cell.IsGhost then
|
||||||
begin
|
begin
|
||||||
cell := FLandscape.MapCell[tileX, tileY];
|
cell.IsGhost := False;
|
||||||
if (cell <> nil) and cell.IsGhost then
|
OnMapChanged(cell);
|
||||||
begin
|
|
||||||
cell.IsGhost := False;
|
|
||||||
OnMapChanged(cell);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if (CurrentTile <> nil) and (not acSelect.Checked) then
|
if (CurrentTile <> nil) and (not acSelect.Checked) then
|
||||||
begin
|
begin
|
||||||
if acDraw.Checked then
|
|
||||||
begin
|
|
||||||
if FSelection.Left = -1 then
|
|
||||||
begin
|
|
||||||
FSelection := Rect(CurrentTile.X - 1, CurrentTile.Y - 1,
|
|
||||||
CurrentTile.X - 1, CurrentTile.Y - 1);
|
|
||||||
AddGhostTile(CurrentTile.X, CurrentTile.Y);
|
|
||||||
end else
|
|
||||||
begin
|
|
||||||
//set new ghost tiles
|
|
||||||
for tileX := selectedRect.Left to selectedRect.Right do
|
|
||||||
for tileY := selectedRect.Top to selectedRect.Bottom do
|
|
||||||
if not IsInRect(tileX, tileY, FSelection) then
|
|
||||||
AddGhostTile(tileX, tileY);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
blockInfo := nil;
|
blockInfo := nil;
|
||||||
if (SelectedTile <> nil) and (CurrentTile <> SelectedTile) then
|
if (SelectedTile <> nil) and (CurrentTile <> SelectedTile) then
|
||||||
begin
|
begin
|
||||||
Logger.Send([lcClient, lcDebug], 'Multiple Targets');
|
Logger.Send([lcClient, lcDebug], 'Multiple Targets');
|
||||||
Logger.Send([lcClient, lcDebug], 'SelectedRect', selectedRect);
|
Logger.Send([lcClient, lcDebug], 'SelectedRect', selectedRect);
|
||||||
|
//set new ghost tiles
|
||||||
|
if acDraw.Checked then
|
||||||
|
for tileX := selectedRect.Left to selectedRect.Right do
|
||||||
|
for tileY := selectedRect.Top to selectedRect.Bottom do
|
||||||
|
if not IsInRect(tileX, tileY, FSelection) then
|
||||||
|
AddGhostTile(tileX, tileY, SelectedTile);
|
||||||
while FScreenBuffer.Iterate(blockInfo) do
|
while FScreenBuffer.Iterate(blockInfo) do
|
||||||
if (blockInfo^.State = ssNormal) then
|
if (blockInfo^.State = ssNormal) then
|
||||||
SetHighlight(blockInfo, IsInRect(blockInfo^.Item.X, blockInfo^.Item.Y,
|
SetHighlight(blockInfo, IsInRect(blockInfo^.Item.X, blockInfo^.Item.Y,
|
||||||
|
@ -2411,6 +2406,8 @@ begin
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
Logger.Send([lcClient, lcDebug], 'Single Target');
|
Logger.Send([lcClient, lcDebug], 'Single Target');
|
||||||
|
if acDraw.Checked then
|
||||||
|
AddGhostTile(CurrentTile.X, CurrentTile.Y, CurrentTile);
|
||||||
while FScreenBuffer.Iterate(blockInfo) do
|
while FScreenBuffer.Iterate(blockInfo) do
|
||||||
if blockInfo^.State = ssNormal then
|
if blockInfo^.State = ssNormal then
|
||||||
SetHighlight(blockInfo, (blockInfo^.Item = CurrentTile) and
|
SetHighlight(blockInfo, (blockInfo^.Item = CurrentTile) and
|
||||||
|
|
Loading…
Reference in New Issue