- 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;
|
||||
State: TOwnerDrawState);
|
||||
procedure lbHueSelectionChange(Sender: TObject; User: boolean);
|
||||
public
|
||||
function GetHue: Word;
|
||||
public
|
||||
class procedure DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
|
||||
ACaption: string);
|
||||
|
@ -115,7 +117,7 @@ begin
|
|||
lbRandom.Items.BeginUpdate;
|
||||
for i := 0 to lbHue.Count - 1 do
|
||||
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;
|
||||
end;
|
||||
|
||||
|
@ -151,6 +153,14 @@ begin
|
|||
edHue.Text := Format('$%x', [lbHue.ItemIndex]);
|
||||
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;
|
||||
ACaption: string);
|
||||
var
|
||||
|
|
|
@ -646,6 +646,7 @@ var
|
|||
offsetX, offsetY: Integer;
|
||||
tile: TWorldItem;
|
||||
tileX, tileY, newX, newY: Word;
|
||||
hue: Word;
|
||||
targetTiles: TWorldItemList;
|
||||
targetTile: TWorldItem;
|
||||
begin
|
||||
|
@ -799,14 +800,13 @@ begin
|
|||
begin
|
||||
tile := targetTiles.Items[i];
|
||||
|
||||
hue := frmHueSettings.GetHue;
|
||||
if (tile is TStaticItem) and
|
||||
(TStaticItem(tile).Hue <> frmHueSettings.lbHue.ItemIndex) then
|
||||
(TStaticItem(tile).Hue <> hue) then
|
||||
begin
|
||||
FUndoList.Add(THueStaticPacket.Create(tile.X, tile.Y, tile.Z,
|
||||
tile.TileID, frmHueSettings.lbHue.ItemIndex,
|
||||
TStaticItem(tile).Hue));
|
||||
dmNetwork.Send(THueStaticPacket.Create(TStaticItem(tile),
|
||||
frmHueSettings.lbHue.ItemIndex));
|
||||
tile.TileID, hue, TStaticItem(tile).Hue));
|
||||
dmNetwork.Send(THueStaticPacket.Create(TStaticItem(tile), hue));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -2845,7 +2845,7 @@ procedure TfrmMain.UpdateSelection;
|
|||
ABlockInfo^.HueOverride := AHighlighted;
|
||||
if AHighlighted then
|
||||
ABlockInfo^.LowRes := FTextureManager.GetStaticMaterial(
|
||||
TStaticItem(ABlockInfo^.Item), frmHueSettings.lbHue.ItemIndex)
|
||||
TStaticItem(ABlockInfo^.Item), frmHueSettings.GetHue)
|
||||
else
|
||||
ABlockInfo^.LowRes := FTextureManager.GetStaticMaterial(
|
||||
TStaticItem(ABlockInfo^.Item));
|
||||
|
@ -2903,7 +2903,7 @@ procedure TfrmMain.UpdateSelection;
|
|||
begin
|
||||
ghostTile := TGhostTile.Create(nil, nil, 0, 0);
|
||||
ghostTile.TileID := tileInfo^.ID - $4000;
|
||||
ghostTile.Hue := frmHueSettings.lbHue.ItemIndex;
|
||||
ghostTile.Hue := frmHueSettings.GetHue;
|
||||
ghostTile.X := AX;
|
||||
ghostTile.Y := AY;
|
||||
if not frmDrawSettings.cbForceAltitude.Checked then
|
||||
|
|
Loading…
Reference in New Issue