- Use the new GetHue method to draw hues (refs #66)
This commit is contained in:
parent
6317841c9c
commit
34e723db75
|
@ -59,6 +59,8 @@ type
|
||||||
procedure lbHueDrawItem(Control: TWinControl; Index: Integer; ARect: TRect;
|
procedure lbHueDrawItem(Control: TWinControl; Index: Integer; ARect: TRect;
|
||||||
State: TOwnerDrawState);
|
State: TOwnerDrawState);
|
||||||
procedure lbHueSelectionChange(Sender: TObject; User: boolean);
|
procedure lbHueSelectionChange(Sender: TObject; User: boolean);
|
||||||
|
public
|
||||||
|
function GetHue: Word;
|
||||||
public
|
public
|
||||||
class procedure DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
|
class procedure DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
|
||||||
ACaption: string);
|
ACaption: string);
|
||||||
|
@ -115,7 +117,7 @@ begin
|
||||||
lbRandom.Items.BeginUpdate;
|
lbRandom.Items.BeginUpdate;
|
||||||
for i := 0 to lbHue.Count - 1 do
|
for i := 0 to lbHue.Count - 1 do
|
||||||
if lbHue.Selected[i] then
|
if lbHue.Selected[i] then
|
||||||
lbRandom.Items.AddObject(lbHue.Items.Strings[i], lbHue.Items.Objects[i]);
|
lbRandom.Items.AddObject(lbHue.Items.Strings[i], TObject(i));
|
||||||
lbRandom.Items.EndUpdate;
|
lbRandom.Items.EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -151,6 +153,14 @@ begin
|
||||||
edHue.Text := Format('$%x', [lbHue.ItemIndex]);
|
edHue.Text := Format('$%x', [lbHue.ItemIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TfrmHueSettings.GetHue: Word;
|
||||||
|
begin
|
||||||
|
if cbRandom.Checked and (lbRandom.Items.Count > 0) then
|
||||||
|
Result := PtrInt(lbRandom.Items.Objects[Random(lbRandom.Items.Count)])
|
||||||
|
else
|
||||||
|
Result := lbHue.ItemIndex;
|
||||||
|
end;
|
||||||
|
|
||||||
class procedure TfrmHueSettings.DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
|
class procedure TfrmHueSettings.DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
|
||||||
ACaption: string);
|
ACaption: string);
|
||||||
var
|
var
|
||||||
|
|
|
@ -646,6 +646,7 @@ var
|
||||||
offsetX, offsetY: Integer;
|
offsetX, offsetY: Integer;
|
||||||
tile: TWorldItem;
|
tile: TWorldItem;
|
||||||
tileX, tileY, newX, newY: Word;
|
tileX, tileY, newX, newY: Word;
|
||||||
|
hue: Word;
|
||||||
targetTiles: TWorldItemList;
|
targetTiles: TWorldItemList;
|
||||||
targetTile: TWorldItem;
|
targetTile: TWorldItem;
|
||||||
begin
|
begin
|
||||||
|
@ -799,14 +800,13 @@ begin
|
||||||
begin
|
begin
|
||||||
tile := targetTiles.Items[i];
|
tile := targetTiles.Items[i];
|
||||||
|
|
||||||
|
hue := frmHueSettings.GetHue;
|
||||||
if (tile is TStaticItem) and
|
if (tile is TStaticItem) and
|
||||||
(TStaticItem(tile).Hue <> frmHueSettings.lbHue.ItemIndex) then
|
(TStaticItem(tile).Hue <> hue) then
|
||||||
begin
|
begin
|
||||||
FUndoList.Add(THueStaticPacket.Create(tile.X, tile.Y, tile.Z,
|
FUndoList.Add(THueStaticPacket.Create(tile.X, tile.Y, tile.Z,
|
||||||
tile.TileID, frmHueSettings.lbHue.ItemIndex,
|
tile.TileID, hue, TStaticItem(tile).Hue));
|
||||||
TStaticItem(tile).Hue));
|
dmNetwork.Send(THueStaticPacket.Create(TStaticItem(tile), hue));
|
||||||
dmNetwork.Send(THueStaticPacket.Create(TStaticItem(tile),
|
|
||||||
frmHueSettings.lbHue.ItemIndex));
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -2845,7 +2845,7 @@ procedure TfrmMain.UpdateSelection;
|
||||||
ABlockInfo^.HueOverride := AHighlighted;
|
ABlockInfo^.HueOverride := AHighlighted;
|
||||||
if AHighlighted then
|
if AHighlighted then
|
||||||
ABlockInfo^.LowRes := FTextureManager.GetStaticMaterial(
|
ABlockInfo^.LowRes := FTextureManager.GetStaticMaterial(
|
||||||
TStaticItem(ABlockInfo^.Item), frmHueSettings.lbHue.ItemIndex)
|
TStaticItem(ABlockInfo^.Item), frmHueSettings.GetHue)
|
||||||
else
|
else
|
||||||
ABlockInfo^.LowRes := FTextureManager.GetStaticMaterial(
|
ABlockInfo^.LowRes := FTextureManager.GetStaticMaterial(
|
||||||
TStaticItem(ABlockInfo^.Item));
|
TStaticItem(ABlockInfo^.Item));
|
||||||
|
@ -2903,7 +2903,7 @@ procedure TfrmMain.UpdateSelection;
|
||||||
begin
|
begin
|
||||||
ghostTile := TGhostTile.Create(nil, nil, 0, 0);
|
ghostTile := TGhostTile.Create(nil, nil, 0, 0);
|
||||||
ghostTile.TileID := tileInfo^.ID - $4000;
|
ghostTile.TileID := tileInfo^.ID - $4000;
|
||||||
ghostTile.Hue := frmHueSettings.lbHue.ItemIndex;
|
ghostTile.Hue := frmHueSettings.GetHue;
|
||||||
ghostTile.X := AX;
|
ghostTile.X := AX;
|
||||||
ghostTile.Y := AY;
|
ghostTile.Y := AY;
|
||||||
if not frmDrawSettings.cbForceAltitude.Checked then
|
if not frmDrawSettings.cbForceAltitude.Checked then
|
||||||
|
|
Loading…
Reference in New Issue