- (Re-)Added drawing of tiles (using the ghost tiles)

- Fixed ghost tiles to be in edit-mode
This commit is contained in:
Andreas Schneider 2009-12-04 02:33:59 +01:00
parent 20747a4e0c
commit b6dfd64d41
1 changed files with 16 additions and 37 deletions

View File

@ -543,6 +543,7 @@ var
targetRect: TRect; targetRect: TRect;
offsetX, offsetY: Integer; offsetX, offsetY: Integer;
tile: TWorldItem; tile: TWorldItem;
tileX, tileY: Word;
targetTiles: TWorldItemList; targetTiles: TWorldItemList;
targetTile: TWorldItem; targetTile: TWorldItem;
begin begin
@ -573,45 +574,22 @@ begin
begin begin
if acDraw.Checked then //***** Drawing Mode *****// if acDraw.Checked then //***** Drawing Mode *****//
begin begin
{if FGhostTile <> nil then for tileX := FSelection.Left to FSelection.Right do
begin for tileY := FSelection.Top to FSelection.Bottom do
for tileX := targetRect.Left to targetRect.Right - 1 do
begin begin
for tileY := targetRect.Top to targetRect.Bottom - 1 do map := FLandscape.MapCell[tileX, tileY];
begin if map.IsGhost then
tileInfo := nil; dmNetwork.Send(TDrawMapPacket.Create(tileX, tileY, map.Z,
if frmDrawSettings.rbTileList.Checked then map.TileID));
begin
node := vdtTiles.GetFirstSelected;
if node <> nil then
tileInfo := vdtTiles.GetNodeData(node);
end else if frmDrawSettings.rbRandom.Checked then
begin
node := vdtRandom.GetFirst;
for i := 1 to Random(vdtRandom.RootNodeCount) do
node := vdtRandom.GetNext(node);
if node <> nil then
tileInfo := vdtRandom.GetNodeData(node);
end;
if tileInfo^.ID < $4000 then
begin
map := FLandscape.MapCell[tileX, tileY];
if frmDrawSettings.cbForceAltitude.Checked then
map.Altitude := frmDrawSettings.seForceAltitude.Value;
if frmDrawSettings.cbRandomHeight.Checked then
map.Altitude := map.Altitude + Random(frmDrawSettings.seRandomHeight.Value);
dmNetwork.Send(TDrawMapPacket.Create(map.X, map.Y, map.Z, tileInfo^.ID));
end else
begin
dmNetwork.Send(TInsertStaticPacket.Create(tileX, tileY,
FGhostTile.Z, tileInfo^.ID - $4000,
TStaticItem(FGhostTile).Hue));
end;
end;
end; end;
end;}
for i := 0 to FVirtualTiles.Count - 1 do
begin
tile := FVirtualTiles[i];
if tile is TGhostTile then
dmNetwork.Send(TInsertStaticPacket.Create(tile.X, tile.Y, tile.Z,
tile.TileID, TGhostTile(tile).Hue));
end;
end else if (SelectedTile <> targetTile) or targetTile.CanBeEdited then end else if (SelectedTile <> targetTile) or targetTile.CanBeEdited then
begin begin
if (not acMove.Checked) or (SelectedTile <> targetTile) or if (not acMove.Checked) or (SelectedTile <> targetTile) or
@ -2344,6 +2322,7 @@ procedure TfrmMain.UpdateSelection;
ghostTile.UpdatePriorities(ResMan.Tiledata.StaticTiles[ghostTile.TileID], ghostTile.UpdatePriorities(ResMan.Tiledata.StaticTiles[ghostTile.TileID],
MaxInt); MaxInt);
ghostTile.CanBeEdited := True;
FVirtualTiles.Add(ghostTile); FVirtualTiles.Add(ghostTile);
blockInfo := FScreenBuffer.Insert(ghostTile); blockInfo := FScreenBuffer.Insert(ghostTile);