- Changed rendering to build the draw list for the whole range
- Added CanBeEdited flag to TWorldItem - Changed list sorting from custom heap sort implementation to the FCL standard (QuickSort)
This commit is contained in:
parent
c20a160543
commit
2f560a7738
|
@ -253,10 +253,8 @@
|
||||||
</CodeGeneration>
|
</CodeGeneration>
|
||||||
<Linking>
|
<Linking>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<UseLineInfoUnit Value="False"/>
|
<GenerateDebugInfo Value="True"/>
|
||||||
<StripSymbols Value="True"/>
|
|
||||||
</Debugging>
|
</Debugging>
|
||||||
<LinkSmart Value="True"/>
|
|
||||||
<Options>
|
<Options>
|
||||||
<Win32>
|
<Win32>
|
||||||
<GraphicApplication Value="True"/>
|
<GraphicApplication Value="True"/>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2007 Andreas Schneider
|
* Portions Copyright 2009 Andreas Schneider
|
||||||
*)
|
*)
|
||||||
unit ULandscape;
|
unit ULandscape;
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ type
|
||||||
constructor Create(AWidth, AHeight: Word);
|
constructor Create(AWidth, AHeight: Word);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
protected
|
protected
|
||||||
|
{ Members }
|
||||||
FWidth: Word;
|
FWidth: Word;
|
||||||
FHeight: Word;
|
FHeight: Word;
|
||||||
FCellWidth: Word;
|
FCellWidth: Word;
|
||||||
|
@ -110,7 +111,7 @@ type
|
||||||
FBlockCache: TCacheManager;
|
FBlockCache: TCacheManager;
|
||||||
FOnChange: TLandscapeChangeEvent;
|
FOnChange: TLandscapeChangeEvent;
|
||||||
FOpenRequests: array of Boolean;
|
FOpenRequests: array of Boolean;
|
||||||
function Compare(left, right: TObject): Integer;
|
{ Methods }
|
||||||
function GetNormals(AX, AY: Word): TNormals;
|
function GetNormals(AX, AY: Word): TNormals;
|
||||||
function GetMapCell(AX, AY: Word): TMapCell;
|
function GetMapCell(AX, AY: Word): TMapCell;
|
||||||
function GetStaticList(AX, AY: Word): TList;
|
function GetStaticList(AX, AY: Word): TList;
|
||||||
|
@ -118,7 +119,6 @@ type
|
||||||
function GetStaticBlock(AX, AY: Word): TSeperatedStaticBlock;
|
function GetStaticBlock(AX, AY: Word): TSeperatedStaticBlock;
|
||||||
procedure UpdateStaticsPriority(AStaticItem: TStaticItem;
|
procedure UpdateStaticsPriority(AStaticItem: TStaticItem;
|
||||||
APrioritySolver: Integer);
|
APrioritySolver: Integer);
|
||||||
procedure OnBlockChanged(ABlock: TMulBlock);
|
|
||||||
procedure OnRemoveCachedObject(AObject: TObject);
|
procedure OnRemoveCachedObject(AObject: TObject);
|
||||||
|
|
||||||
procedure OnBlocksPacket(ABuffer: TEnhancedMemoryStream);
|
procedure OnBlocksPacket(ABuffer: TEnhancedMemoryStream);
|
||||||
|
@ -129,6 +129,7 @@ type
|
||||||
procedure OnMoveStaticPacket(ABuffer: TEnhancedMemoryStream);
|
procedure OnMoveStaticPacket(ABuffer: TEnhancedMemoryStream);
|
||||||
procedure OnHueStaticPacket(ABuffer: TEnhancedMemoryStream);
|
procedure OnHueStaticPacket(ABuffer: TEnhancedMemoryStream);
|
||||||
public
|
public
|
||||||
|
{ Fields }
|
||||||
property Width: Word read FWidth;
|
property Width: Word read FWidth;
|
||||||
property Height: Word read FHeight;
|
property Height: Word read FHeight;
|
||||||
property CellWidth: Word read FCellWidth;
|
property CellWidth: Word read FCellWidth;
|
||||||
|
@ -137,10 +138,11 @@ type
|
||||||
property StaticList[X, Y: Word]: TList read GetStaticList;
|
property StaticList[X, Y: Word]: TList read GetStaticList;
|
||||||
property Normals[X, Y: Word]: TNormals read GetNormals;
|
property Normals[X, Y: Word]: TNormals read GetNormals;
|
||||||
property OnChange: TLandscapeChangeEvent read FOnChange write FOnChange;
|
property OnChange: TLandscapeChangeEvent read FOnChange write FOnChange;
|
||||||
|
{ Methods }
|
||||||
function GetDrawList(AX, AY: Word; AMinZ, AMaxZ: ShortInt;
|
function GetDrawList(AX, AY, AWidth, AHeight: Word; AMinZ, AMaxZ: ShortInt;
|
||||||
AGhostTile: TWorldItem; AVirtualLayer: TStaticItem; AMap,
|
AGhostTile: TWorldItem; AVirtualLayer: TStaticItem; AMap,
|
||||||
AStatics: Boolean; ANoDraw:Boolean; AStaticsFilter: TStaticFilter): TList;
|
AStatics: Boolean; ANoDraw:Boolean; AStaticsFilter: TStaticFilter): TList;
|
||||||
|
procedure UpdateDrawListItems(AList: TList);
|
||||||
function GetEffectiveAltitude(ATile: TMapCell): ShortInt;
|
function GetEffectiveAltitude(ATile: TMapCell): ShortInt;
|
||||||
function GetLandAlt(AX, AY: Word; ADefault: ShortInt): ShortInt;
|
function GetLandAlt(AX, AY: Word; ADefault: ShortInt): ShortInt;
|
||||||
|
|
||||||
|
@ -204,15 +206,6 @@ begin
|
||||||
Result := ((AX and $7FFF) shl 15) or (AY and $7FFF);
|
Result := ((AX and $7FFF) shl 15) or (AY and $7FFF);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{operator=(AStaticItem: TStaticItem; AStaticInfo: TStaticInfo): Boolean;
|
|
||||||
begin
|
|
||||||
Result := (AStaticItem.X = AStaticInfo.X) and
|
|
||||||
(AStaticItem.Y = AStaticInfo.Y) and
|
|
||||||
(AStaticItem.Z = AStaticInfo.Z) and
|
|
||||||
(AStaticItem.TileID = AStaticInfo.TileID) and
|
|
||||||
(AStaticItem.Hue = AStaticInfo.Hue);
|
|
||||||
end;}
|
|
||||||
|
|
||||||
{ TLandTextureManager }
|
{ TLandTextureManager }
|
||||||
|
|
||||||
constructor TLandTextureManager.Create;
|
constructor TLandTextureManager.Create;
|
||||||
|
@ -410,40 +403,50 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLandscape.Compare(left, right: TObject): Integer;
|
function Compare(AItem1, AItem2: Pointer): Integer;
|
||||||
begin
|
begin
|
||||||
Result := TWorldItem(right).Priority - TWorldItem(left).Priority;
|
if TWorldItem(AItem1).X <> TWorldItem(AItem2).X then
|
||||||
|
Exit(TWorldItem(AItem1).X - TWorldItem(AItem2).X);
|
||||||
|
|
||||||
|
if TWorldItem(AItem1).Y <> TWorldItem(AItem2).Y then
|
||||||
|
Exit(TWorldItem(AItem1).Y - TWorldItem(AItem2).Y);
|
||||||
|
|
||||||
|
Result := TWorldItem(AItem1).Priority - TWorldItem(AItem2).Priority;
|
||||||
if Result = 0 then
|
if Result = 0 then
|
||||||
begin
|
begin
|
||||||
if (left is TMapCell) and (right is TStaticItem) then
|
if (TObject(AItem1) is TMapCell) and (TObject(AItem2) is TStaticItem) then
|
||||||
Result := 1
|
Result := -1
|
||||||
else if (left is TStaticItem) and (right is TMapCell) then
|
else if (TObject(AItem1) is TStaticItem) and (TObject(AItem2) is TMapCell) then
|
||||||
Result := -1;
|
Result := 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Result = 0 then
|
if Result = 0 then
|
||||||
Result := TWorldItem(right).PriorityBonus - TWorldItem(left).PriorityBonus;
|
Result := TWorldItem(AItem1).PriorityBonus - TWorldItem(AItem2).PriorityBonus;
|
||||||
|
|
||||||
if Result = 0 then
|
if Result = 0 then
|
||||||
Result := TWorldItem(right).PrioritySolver - TWorldItem(left).PrioritySolver;
|
Result := TWorldItem(AItem1).PrioritySolver - TWorldItem(AItem2).PrioritySolver;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLandscape.GetDrawList(AX, AY: Word; AMinZ, AMaxZ: ShortInt;
|
function TLandscape.GetDrawList(AX, AY, AWidth, AHeight: Word;
|
||||||
AGhostTile: TWorldItem; AVirtualLayer: TStaticItem; AMap,
|
AMinZ, AMaxZ: ShortInt; AGhostTile: TWorldItem; AVirtualLayer: TStaticItem;
|
||||||
AStatics: Boolean; ANoDraw:Boolean; AStaticsFilter: TStaticFilter): TList;
|
AMap, AStatics: Boolean; ANoDraw: Boolean;
|
||||||
|
AStaticsFilter: TStaticFilter): TList;
|
||||||
var
|
var
|
||||||
landAlt: ShortInt;
|
landAlt: ShortInt;
|
||||||
drawMapCell: TMapCell;
|
drawMapCell: TMapCell;
|
||||||
drawStatics: TList;
|
drawStatics: TList;
|
||||||
i: Integer;
|
i, x, y: Integer;
|
||||||
begin
|
begin
|
||||||
Result := TList.Create;
|
Result := TList.Create;
|
||||||
|
for x := AX to AX + AWidth do
|
||||||
|
for y := AY to AY + AWidth do
|
||||||
|
begin
|
||||||
if AMap then
|
if AMap then
|
||||||
begin
|
begin
|
||||||
landAlt := GetLandAlt(AX, AY, 0);
|
landAlt := GetLandAlt(x, y, 0);
|
||||||
if (landAlt >= AMinZ) and (landAlt <= AMaxZ) then
|
if (landAlt >= AMinZ) and (landAlt <= AMaxZ) then
|
||||||
begin
|
begin
|
||||||
drawMapCell := GetMapCell(AX, AY);
|
drawMapCell := GetMapCell(x, y);
|
||||||
if (drawMapCell <> nil) and (ANoDraw or (drawMapCell.TileID > 2)) then
|
if (drawMapCell <> nil) and (ANoDraw or (drawMapCell.TileID > 2)) then
|
||||||
begin
|
begin
|
||||||
drawMapCell.Priority := GetEffectiveAltitude(drawMapCell);
|
drawMapCell.Priority := GetEffectiveAltitude(drawMapCell);
|
||||||
|
@ -454,8 +457,8 @@ begin
|
||||||
|
|
||||||
if AGhostTile is TMapCell then
|
if AGhostTile is TMapCell then
|
||||||
begin
|
begin
|
||||||
AGhostTile.X := AX;
|
AGhostTile.X := x;
|
||||||
AGhostTile.Y := AY;
|
AGhostTile.Y := y;
|
||||||
AGhostTile.Priority := GetEffectiveAltitude(TMapCell(AGhostTile));
|
AGhostTile.Priority := GetEffectiveAltitude(TMapCell(AGhostTile));
|
||||||
AGhostTile.PriorityBonus := 0;
|
AGhostTile.PriorityBonus := 0;
|
||||||
AGhostTile.PrioritySolver := 0;
|
AGhostTile.PrioritySolver := 0;
|
||||||
|
@ -466,7 +469,7 @@ begin
|
||||||
|
|
||||||
if AStatics then
|
if AStatics then
|
||||||
begin
|
begin
|
||||||
drawStatics := GetStaticList(AX, AY);
|
drawStatics := GetStaticList(x, y);
|
||||||
if drawStatics <> nil then
|
if drawStatics <> nil then
|
||||||
for i := 0 to drawStatics.Count - 1 do
|
for i := 0 to drawStatics.Count - 1 do
|
||||||
if (TStaticItem(drawStatics[i]).Z >= AMinZ) and
|
if (TStaticItem(drawStatics[i]).Z >= AMinZ) and
|
||||||
|
@ -485,13 +488,28 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AVirtualLayer <> nil then
|
//TODO : re add virtual layer
|
||||||
|
{if AVirtualLayer <> nil then
|
||||||
begin
|
begin
|
||||||
UpdateStaticsPriority(AVirtualLayer, MaxInt-1);
|
UpdateStaticsPriority(AVirtualLayer, MaxInt-1);
|
||||||
Result.Add(AVirtualLayer);
|
Result.Add(AVirtualLayer);
|
||||||
|
end;}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ListSort(Result, @Compare);
|
Result.Sort(@Compare);
|
||||||
|
//ListSort(Result, @Compare);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLandscape.UpdateDrawListItems(AList: TList);
|
||||||
|
var
|
||||||
|
worldItem: TWorldItem;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
for i := 0 to AList.Count - 1 do
|
||||||
|
begin
|
||||||
|
worldItem := TWorldItem(AList.Items[i]);
|
||||||
|
worldItem.CanBeEdited := dmNetwork.CanWrite(worldItem.X, worldItem.Y);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLandscape.GetEffectiveAltitude(ATile: TMapCell): ShortInt;
|
function TLandscape.GetEffectiveAltitude(ATile: TMapCell): ShortInt;
|
||||||
|
@ -591,37 +609,6 @@ begin
|
||||||
Result[3] := VectorNorm(VectorAdd(VectorAdd(VectorAdd(north, west), east), south));
|
Result[3] := VectorNorm(VectorAdd(VectorAdd(VectorAdd(north, west), east), south));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLandscape.OnBlockChanged(ABlock: TMulBlock);
|
|
||||||
var
|
|
||||||
block, old: TWorldBlock;
|
|
||||||
mode: Byte;
|
|
||||||
id, blockID: Integer;
|
|
||||||
begin
|
|
||||||
{block := ABlock as TWorldBlock;
|
|
||||||
if block <> nil then
|
|
||||||
begin
|
|
||||||
if block is TSeperatedStaticBlock then
|
|
||||||
mode := mStatics
|
|
||||||
else
|
|
||||||
mode := mMap;
|
|
||||||
id := GetID(block.X, block.Y, mode);
|
|
||||||
blockID := (block.X * FHeight) + block.Y;
|
|
||||||
if block.Changed or (block.RefCount > 0) then
|
|
||||||
begin
|
|
||||||
if FPersistentBlocks[blockID][mode] = nil then
|
|
||||||
begin
|
|
||||||
FPersistentBlocks[blockID][mode] := block;
|
|
||||||
FBlockCache.DiscardID(id);
|
|
||||||
end;
|
|
||||||
end else
|
|
||||||
begin
|
|
||||||
FPersistentBlocks[blockID][mode] := nil;
|
|
||||||
if not FBlockCache.QueryID(id, TObject(old)) then
|
|
||||||
FBlockCache.StoreID(id, block);
|
|
||||||
end;
|
|
||||||
end;}
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TLandscape.MoveStatic(AStatic: TStaticItem; AX, AY: Word);
|
procedure TLandscape.MoveStatic(AStatic: TStaticItem; AX, AY: Word);
|
||||||
var
|
var
|
||||||
sourceBlock, targetBlock: TSeperatedStaticBlock;
|
sourceBlock, targetBlock: TSeperatedStaticBlock;
|
||||||
|
@ -639,7 +626,8 @@ begin
|
||||||
targetStaticList.Add(AStatic);
|
targetStaticList.Add(AStatic);
|
||||||
for i := 0 to targetStaticList.Count - 1 do
|
for i := 0 to targetStaticList.Count - 1 do
|
||||||
UpdateStaticsPriority(TStaticItem(targetStaticList.Items[i]), i);
|
UpdateStaticsPriority(TStaticItem(targetStaticList.Items[i]), i);
|
||||||
ListSort(targetStaticList, @Compare);
|
targetStaticList.Sort(@Compare);
|
||||||
|
//ListSort(targetStaticList, @Compare);
|
||||||
AStatic.UpdatePos(AX, AY, AStatic.Z);
|
AStatic.UpdatePos(AX, AY, AStatic.Z);
|
||||||
AStatic.Owner := targetBlock;
|
AStatic.Owner := targetBlock;
|
||||||
end;
|
end;
|
||||||
|
@ -788,7 +776,8 @@ begin
|
||||||
targetStaticList.Add(staticItem);
|
targetStaticList.Add(staticItem);
|
||||||
for i := 0 to targetStaticList.Count - 1 do
|
for i := 0 to targetStaticList.Count - 1 do
|
||||||
UpdateStaticsPriority(TStaticItem(targetStaticList.Items[i]), i);
|
UpdateStaticsPriority(TStaticItem(targetStaticList.Items[i]), i);
|
||||||
ListSort(targetStaticList, @Compare);
|
targetStaticList.Sort(@Compare);
|
||||||
|
//ListSort(targetStaticList, @Compare);
|
||||||
staticItem.Owner := block;
|
staticItem.Owner := block;
|
||||||
if Assigned(FOnChange) then FOnChange;
|
if Assigned(FOnChange) then FOnChange;
|
||||||
end;
|
end;
|
||||||
|
@ -846,7 +835,8 @@ begin
|
||||||
staticItem.Z := ABuffer.ReadShortInt;
|
staticItem.Z := ABuffer.ReadShortInt;
|
||||||
for j := 0 to statics.Count - 1 do
|
for j := 0 to statics.Count - 1 do
|
||||||
UpdateStaticsPriority(TStaticItem(statics.Items[j]), j);
|
UpdateStaticsPriority(TStaticItem(statics.Items[j]), j);
|
||||||
ListSort(statics, @Compare);
|
statics.Sort(@Compare);
|
||||||
|
//ListSort(statics, @Compare);
|
||||||
if Assigned(FOnChange) then FOnChange;
|
if Assigned(FOnChange) then FOnChange;
|
||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
|
@ -906,7 +896,8 @@ begin
|
||||||
statics.Add(staticItem);
|
statics.Add(staticItem);
|
||||||
for i := 0 to statics.Count - 1 do
|
for i := 0 to statics.Count - 1 do
|
||||||
UpdateStaticsPriority(TStaticItem(statics.Items[i]), i);
|
UpdateStaticsPriority(TStaticItem(statics.Items[i]), i);
|
||||||
ListSort(statics, @Compare);
|
statics.Sort(@Compare);
|
||||||
|
//ListSort(statics, @Compare);
|
||||||
staticItem.Owner := targetBlock;
|
staticItem.Owner := targetBlock;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -987,7 +978,6 @@ var
|
||||||
pixel: TColor32Rec;
|
pixel: TColor32Rec;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
//writeln(FGraphic.Width, ',', FGraphic.Height, ',', AX, ',', AY);
|
|
||||||
if InRange(AX, 0, FGraphic.Width - 1) and
|
if InRange(AX, 0, FGraphic.Width - 1) and
|
||||||
InRange(AY, 0, FGraphic.Height - 1) then
|
InRange(AY, 0, FGraphic.Height - 1) then
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
object frmMain: TfrmMain
|
object frmMain: TfrmMain
|
||||||
Left = 247
|
Left = 236
|
||||||
Height = 603
|
Height = 603
|
||||||
Top = 91
|
Top = 126
|
||||||
Width = 766
|
Width = 766
|
||||||
ActiveControl = pcLeft
|
ActiveControl = pcLeft
|
||||||
Caption = 'UO CentrED'
|
Caption = 'UO CentrED'
|
||||||
|
@ -41,7 +41,7 @@ object frmMain: TfrmMain
|
||||||
Left = 88
|
Left = 88
|
||||||
Height = 14
|
Height = 14
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 11
|
Width = 10
|
||||||
Caption = 'Y:'
|
Caption = 'Y:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
|
@ -54,10 +54,10 @@ object frmMain: TfrmMain
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lblTip: TLabel
|
object lblTip: TLabel
|
||||||
Left = 554
|
Left = 528
|
||||||
Height = 31
|
Height = 31
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 204
|
Width = 230
|
||||||
Align = alRight
|
Align = alRight
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
|
@ -66,10 +66,10 @@ object frmMain: TfrmMain
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lblTipC: TLabel
|
object lblTipC: TLabel
|
||||||
Left = 530
|
Left = 498
|
||||||
Height = 31
|
Height = 31
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 24
|
Width = 30
|
||||||
Align = alRight
|
Align = alRight
|
||||||
Caption = 'Tip: '
|
Caption = 'Tip: '
|
||||||
Font.Height = -11
|
Font.Height = -11
|
||||||
|
@ -80,7 +80,7 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object edX: TSpinEdit
|
object edX: TSpinEdit
|
||||||
Left = 24
|
Left = 24
|
||||||
Height = 23
|
Height = 19
|
||||||
Top = 3
|
Top = 3
|
||||||
Width = 55
|
Width = 55
|
||||||
MaxValue = 100000
|
MaxValue = 100000
|
||||||
|
@ -88,7 +88,7 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object edY: TSpinEdit
|
object edY: TSpinEdit
|
||||||
Left = 104
|
Left = 104
|
||||||
Height = 23
|
Height = 19
|
||||||
Top = 3
|
Top = 3
|
||||||
Width = 52
|
Width = 52
|
||||||
MaxValue = 100000
|
MaxValue = 100000
|
||||||
|
@ -116,31 +116,31 @@ object frmMain: TfrmMain
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object tsTiles: TTabSheet
|
object tsTiles: TTabSheet
|
||||||
Caption = 'Tiles'
|
Caption = 'Tiles'
|
||||||
ClientHeight = 492
|
ClientHeight = 500
|
||||||
ClientWidth = 218
|
ClientWidth = 222
|
||||||
object pnlTileListSettings: TPanel
|
object pnlTileListSettings: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 56
|
Height = 56
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 218
|
Width = 222
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 56
|
ClientHeight = 56
|
||||||
ClientWidth = 218
|
ClientWidth = 222
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object lblFilter: TLabel
|
object lblFilter: TLabel
|
||||||
Left = 84
|
Left = 84
|
||||||
Height = 14
|
Height = 14
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 29
|
Width = 30
|
||||||
Caption = 'Filter:'
|
Caption = 'Filter:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object cbTerrain: TCheckBox
|
object cbTerrain: TCheckBox
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 22
|
Height = 18
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 60
|
Width = 57
|
||||||
Caption = 'Terrain'
|
Caption = 'Terrain'
|
||||||
Checked = True
|
Checked = True
|
||||||
OnChange = cbTerrainChange
|
OnChange = cbTerrainChange
|
||||||
|
@ -149,9 +149,9 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object cbStatics: TCheckBox
|
object cbStatics: TCheckBox
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 22
|
Height = 18
|
||||||
Top = 32
|
Top = 32
|
||||||
Width = 60
|
Width = 56
|
||||||
Caption = 'Statics'
|
Caption = 'Statics'
|
||||||
Checked = True
|
Checked = True
|
||||||
OnChange = cbStaticsChange
|
OnChange = cbStaticsChange
|
||||||
|
@ -160,7 +160,7 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object edFilter: TEdit
|
object edFilter: TEdit
|
||||||
Left = 84
|
Left = 84
|
||||||
Height = 23
|
Height = 19
|
||||||
Top = 24
|
Top = 24
|
||||||
Width = 112
|
Width = 112
|
||||||
OnEditingDone = edFilterEditingDone
|
OnEditingDone = edFilterEditingDone
|
||||||
|
@ -170,9 +170,9 @@ object frmMain: TfrmMain
|
||||||
object vdtTiles: TVirtualDrawTree
|
object vdtTiles: TVirtualDrawTree
|
||||||
Tag = 1
|
Tag = 1
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 238
|
Height = 246
|
||||||
Top = 56
|
Top = 56
|
||||||
Width = 218
|
Width = 222
|
||||||
Align = alClient
|
Align = alClient
|
||||||
DefaultNodeHeight = 44
|
DefaultNodeHeight = 44
|
||||||
DragMode = dmAutomatic
|
DragMode = dmAutomatic
|
||||||
|
@ -193,6 +193,7 @@ object frmMain: TfrmMain
|
||||||
Text = 'Name'
|
Text = 'Name'
|
||||||
Width = 100
|
Width = 100
|
||||||
end>
|
end>
|
||||||
|
Header.DefaultHeight = 17
|
||||||
Header.MainColumn = 2
|
Header.MainColumn = 2
|
||||||
Header.Options = [hoVisible]
|
Header.Options = [hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
|
@ -215,12 +216,12 @@ object frmMain: TfrmMain
|
||||||
object gbRandom: TGroupBox
|
object gbRandom: TGroupBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 193
|
Height = 193
|
||||||
Top = 299
|
Top = 307
|
||||||
Width = 218
|
Width = 222
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
Caption = 'Random pool'
|
Caption = 'Random pool'
|
||||||
ClientHeight = 179
|
ClientHeight = 179
|
||||||
ClientWidth = 216
|
ClientWidth = 220
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object vdtRandom: TVirtualDrawTree
|
object vdtRandom: TVirtualDrawTree
|
||||||
Tag = 1
|
Tag = 1
|
||||||
|
@ -228,7 +229,7 @@ object frmMain: TfrmMain
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 127
|
Height = 127
|
||||||
Top = 22
|
Top = 22
|
||||||
Width = 216
|
Width = 220
|
||||||
Align = alClient
|
Align = alClient
|
||||||
DefaultNodeHeight = 44
|
DefaultNodeHeight = 44
|
||||||
DragType = dtVCL
|
DragType = dtVCL
|
||||||
|
@ -248,6 +249,7 @@ object frmMain: TfrmMain
|
||||||
Text = 'Name'
|
Text = 'Name'
|
||||||
Width = 100
|
Width = 100
|
||||||
end>
|
end>
|
||||||
|
Header.DefaultHeight = 17
|
||||||
Header.Options = [hoColumnResize, hoDrag, hoVisible]
|
Header.Options = [hoColumnResize, hoDrag, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
Header.Style = hsFlatButtons
|
Header.Style = hsFlatButtons
|
||||||
|
@ -265,11 +267,11 @@ object frmMain: TfrmMain
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 216
|
Width = 220
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 22
|
ClientHeight = 22
|
||||||
ClientWidth = 216
|
ClientWidth = 220
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object btnAddRandom: TSpeedButton
|
object btnAddRandom: TSpeedButton
|
||||||
Left = 2
|
Left = 2
|
||||||
|
@ -420,12 +422,12 @@ object frmMain: TfrmMain
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 153
|
Top = 153
|
||||||
Width = 208
|
Width = 212
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 4
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 22
|
ClientHeight = 22
|
||||||
ClientWidth = 208
|
ClientWidth = 212
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object btnRandomPresetSave: TSpeedButton
|
object btnRandomPresetSave: TSpeedButton
|
||||||
Left = 158
|
Left = 158
|
||||||
|
@ -527,7 +529,7 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object cbRandomPreset: TComboBox
|
object cbRandomPreset: TComboBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 29
|
Height = 25
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 152
|
Width = 152
|
||||||
AutoComplete = False
|
AutoComplete = False
|
||||||
|
@ -543,14 +545,14 @@ object frmMain: TfrmMain
|
||||||
Cursor = crVSplit
|
Cursor = crVSplit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 5
|
Height = 5
|
||||||
Top = 294
|
Top = 302
|
||||||
Width = 218
|
Width = 222
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
ResizeAnchor = akBottom
|
ResizeAnchor = akBottom
|
||||||
end
|
end
|
||||||
object edSearchID: TEdit
|
object edSearchID: TEdit
|
||||||
Left = 118
|
Left = 118
|
||||||
Height = 23
|
Height = 19
|
||||||
Hint = 'Append S or T to restrict the search to Statics or Terrain.'
|
Hint = 'Append S or T to restrict the search to Statics or Terrain.'
|
||||||
Top = 256
|
Top = 256
|
||||||
Width = 96
|
Width = 96
|
||||||
|
@ -565,13 +567,13 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object tsClients: TTabSheet
|
object tsClients: TTabSheet
|
||||||
Caption = 'Clients'
|
Caption = 'Clients'
|
||||||
ClientHeight = 492
|
ClientHeight = 500
|
||||||
ClientWidth = 218
|
ClientWidth = 222
|
||||||
object lbClients: TListBox
|
object lbClients: TListBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 492
|
Height = 500
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 218
|
Width = 222
|
||||||
Align = alClient
|
Align = alClient
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
OnDblClick = mnuGoToClientClick
|
OnDblClick = mnuGoToClientClick
|
||||||
|
@ -583,14 +585,14 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object tsLocations: TTabSheet
|
object tsLocations: TTabSheet
|
||||||
Caption = 'Locations'
|
Caption = 'Locations'
|
||||||
ClientHeight = 492
|
ClientHeight = 500
|
||||||
ClientWidth = 218
|
ClientWidth = 222
|
||||||
object vstLocations: TVirtualStringTree
|
object vstLocations: TVirtualStringTree
|
||||||
Cursor = 63
|
Cursor = 63
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 456
|
Height = 464
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 210
|
Width = 214
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 4
|
||||||
BorderStyle = bsSingle
|
BorderStyle = bsSingle
|
||||||
|
@ -607,6 +609,7 @@ object frmMain: TfrmMain
|
||||||
Text = 'Name'
|
Text = 'Name'
|
||||||
Width = 135
|
Width = 135
|
||||||
end>
|
end>
|
||||||
|
Header.DefaultHeight = 17
|
||||||
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoVisible]
|
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
Header.Style = hsFlatButtons
|
Header.Style = hsFlatButtons
|
||||||
|
@ -624,13 +627,13 @@ object frmMain: TfrmMain
|
||||||
object pnlLocationControls: TPanel
|
object pnlLocationControls: TPanel
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 464
|
Top = 472
|
||||||
Width = 210
|
Width = 214
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 4
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 24
|
ClientHeight = 24
|
||||||
ClientWidth = 210
|
ClientWidth = 214
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object btnClearLocations: TSpeedButton
|
object btnClearLocations: TSpeedButton
|
||||||
Left = 112
|
Left = 112
|
||||||
|
@ -1010,7 +1013,7 @@ object frmMain: TfrmMain
|
||||||
object vstChat: TVirtualStringTree
|
object vstChat: TVirtualStringTree
|
||||||
Cursor = 63
|
Cursor = 63
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 99
|
Height = 103
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 542
|
Width = 542
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
@ -1032,6 +1035,7 @@ object frmMain: TfrmMain
|
||||||
Text = 'Message'
|
Text = 'Message'
|
||||||
Width = 392
|
Width = 392
|
||||||
end>
|
end>
|
||||||
|
Header.DefaultHeight = 17
|
||||||
Header.MainColumn = 2
|
Header.MainColumn = 2
|
||||||
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoVisible]
|
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
|
@ -1047,8 +1051,8 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object edChat: TEdit
|
object edChat: TEdit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 19
|
||||||
Top = 99
|
Top = 103
|
||||||
Width = 542
|
Width = 542
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
OnKeyPress = edChatKeyPress
|
OnKeyPress = edChatKeyPress
|
||||||
|
@ -1343,7 +1347,6 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object ImageList1: TImageList
|
object ImageList1: TImageList
|
||||||
Masked = False
|
|
||||||
left = 264
|
left = 264
|
||||||
top = 32
|
top = 32
|
||||||
Bitmap = {
|
Bitmap = {
|
||||||
|
@ -1991,7 +1994,7 @@ object frmMain: TfrmMain
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
object pmTileList: TPopupMenu
|
object pmTileList: TPopupMenu
|
||||||
left = 184
|
left = 185
|
||||||
top = 128
|
top = 128
|
||||||
object mnuAddToRandom: TMenuItem
|
object mnuAddToRandom: TMenuItem
|
||||||
Caption = 'Add to random pool'
|
Caption = 'Add to random pool'
|
||||||
|
@ -1999,13 +2002,6 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object ApplicationProperties1: TApplicationProperties
|
object ApplicationProperties1: TApplicationProperties
|
||||||
CaptureExceptions = True
|
|
||||||
HintColor = clInfoBk
|
|
||||||
HintHidePause = 2500
|
|
||||||
HintPause = 500
|
|
||||||
HintShortCuts = True
|
|
||||||
HintShortPause = 0
|
|
||||||
ShowHint = True
|
|
||||||
OnIdle = ApplicationProperties1Idle
|
OnIdle = ApplicationProperties1Idle
|
||||||
left = 295
|
left = 295
|
||||||
top = 33
|
top = 33
|
||||||
|
@ -2375,7 +2371,6 @@ object frmMain: TfrmMain
|
||||||
Category = 'Tools'
|
Category = 'Tools'
|
||||||
Caption = 'Select'
|
Caption = 'Select'
|
||||||
Checked = True
|
Checked = True
|
||||||
DisableIfNoHandler = True
|
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
Hint = 'Select'
|
Hint = 'Select'
|
||||||
ImageIndex = 4
|
ImageIndex = 4
|
||||||
|
@ -2385,7 +2380,6 @@ object frmMain: TfrmMain
|
||||||
object acDraw: TAction
|
object acDraw: TAction
|
||||||
Category = 'Tools'
|
Category = 'Tools'
|
||||||
Caption = 'Draw tiles'
|
Caption = 'Draw tiles'
|
||||||
DisableIfNoHandler = True
|
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
Hint = 'Draw tiles'
|
Hint = 'Draw tiles'
|
||||||
ImageIndex = 5
|
ImageIndex = 5
|
||||||
|
@ -2395,7 +2389,6 @@ object frmMain: TfrmMain
|
||||||
object acMove: TAction
|
object acMove: TAction
|
||||||
Category = 'Tools'
|
Category = 'Tools'
|
||||||
Caption = 'Move tiles'
|
Caption = 'Move tiles'
|
||||||
DisableIfNoHandler = True
|
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
Hint = 'Move tiles'
|
Hint = 'Move tiles'
|
||||||
ImageIndex = 6
|
ImageIndex = 6
|
||||||
|
@ -2405,7 +2398,6 @@ object frmMain: TfrmMain
|
||||||
object acElevate: TAction
|
object acElevate: TAction
|
||||||
Category = 'Tools'
|
Category = 'Tools'
|
||||||
Caption = 'Elevate tiles'
|
Caption = 'Elevate tiles'
|
||||||
DisableIfNoHandler = True
|
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
Hint = 'Elevate tiles'
|
Hint = 'Elevate tiles'
|
||||||
ImageIndex = 7
|
ImageIndex = 7
|
||||||
|
@ -2415,7 +2407,6 @@ object frmMain: TfrmMain
|
||||||
object acDelete: TAction
|
object acDelete: TAction
|
||||||
Category = 'Tools'
|
Category = 'Tools'
|
||||||
Caption = 'Delete tiles'
|
Caption = 'Delete tiles'
|
||||||
DisableIfNoHandler = True
|
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
Hint = 'Delete tiles'
|
Hint = 'Delete tiles'
|
||||||
ImageIndex = 8
|
ImageIndex = 8
|
||||||
|
@ -2425,7 +2416,6 @@ object frmMain: TfrmMain
|
||||||
object acHue: TAction
|
object acHue: TAction
|
||||||
Category = 'Tools'
|
Category = 'Tools'
|
||||||
Caption = 'Hue tiles'
|
Caption = 'Hue tiles'
|
||||||
DisableIfNoHandler = True
|
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
Hint = 'Hue tiles'
|
Hint = 'Hue tiles'
|
||||||
ImageIndex = 12
|
ImageIndex = 12
|
||||||
|
@ -2435,7 +2425,6 @@ object frmMain: TfrmMain
|
||||||
object acBoundaries: TAction
|
object acBoundaries: TAction
|
||||||
Category = 'Settings'
|
Category = 'Settings'
|
||||||
Caption = 'Boundaries'
|
Caption = 'Boundaries'
|
||||||
DisableIfNoHandler = True
|
|
||||||
Hint = 'Boundaries'
|
Hint = 'Boundaries'
|
||||||
ImageIndex = 9
|
ImageIndex = 9
|
||||||
OnExecute = acBoundariesExecute
|
OnExecute = acBoundariesExecute
|
||||||
|
@ -2445,7 +2434,6 @@ object frmMain: TfrmMain
|
||||||
Category = 'Settings'
|
Category = 'Settings'
|
||||||
AutoCheck = True
|
AutoCheck = True
|
||||||
Caption = 'Filter'
|
Caption = 'Filter'
|
||||||
DisableIfNoHandler = True
|
|
||||||
Hint = 'Filter'
|
Hint = 'Filter'
|
||||||
ImageIndex = 16
|
ImageIndex = 16
|
||||||
OnExecute = acFilterExecute
|
OnExecute = acFilterExecute
|
||||||
|
@ -2453,7 +2441,6 @@ object frmMain: TfrmMain
|
||||||
object acVirtualLayer: TAction
|
object acVirtualLayer: TAction
|
||||||
Category = 'Settings'
|
Category = 'Settings'
|
||||||
Caption = 'Virtual Layer'
|
Caption = 'Virtual Layer'
|
||||||
DisableIfNoHandler = True
|
|
||||||
Hint = 'Virtual Layer'
|
Hint = 'Virtual Layer'
|
||||||
ImageIndex = 15
|
ImageIndex = 15
|
||||||
OnExecute = acVirtualLayerExecute
|
OnExecute = acVirtualLayerExecute
|
||||||
|
@ -2462,7 +2449,6 @@ object frmMain: TfrmMain
|
||||||
object acFlat: TAction
|
object acFlat: TAction
|
||||||
Category = 'Settings'
|
Category = 'Settings'
|
||||||
Caption = 'Flat view'
|
Caption = 'Flat view'
|
||||||
DisableIfNoHandler = True
|
|
||||||
Hint = 'Flat view'
|
Hint = 'Flat view'
|
||||||
ImageIndex = 17
|
ImageIndex = 17
|
||||||
OnExecute = acFlatExecute
|
OnExecute = acFlatExecute
|
||||||
|
@ -2471,7 +2457,6 @@ object frmMain: TfrmMain
|
||||||
Category = 'Settings'
|
Category = 'Settings'
|
||||||
Caption = 'NoDraw'
|
Caption = 'NoDraw'
|
||||||
Checked = True
|
Checked = True
|
||||||
DisableIfNoHandler = True
|
|
||||||
Hint = 'Display "No Draw" tiles'
|
Hint = 'Display "No Draw" tiles'
|
||||||
ImageIndex = 18
|
ImageIndex = 18
|
||||||
OnExecute = acNoDrawExecute
|
OnExecute = acNoDrawExecute
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2008 Andreas Schneider
|
* Portions Copyright 2009 Andreas Schneider
|
||||||
*)
|
*)
|
||||||
unit UfrmMain;
|
unit UfrmMain;
|
||||||
|
|
||||||
|
@ -1624,7 +1624,6 @@ end;
|
||||||
procedure TfrmMain.Render;
|
procedure TfrmMain.Render;
|
||||||
var
|
var
|
||||||
drawDistance: Integer;
|
drawDistance: Integer;
|
||||||
offsetX, offsetY: Integer;
|
|
||||||
lowOffX, lowOffY, highOffX, highOffY: Integer;
|
lowOffX, lowOffY, highOffX, highOffY: Integer;
|
||||||
z: ShortInt;
|
z: ShortInt;
|
||||||
mat: TMaterial;
|
mat: TMaterial;
|
||||||
|
@ -1645,6 +1644,7 @@ var
|
||||||
staticsFilter: TStaticFilter;
|
staticsFilter: TStaticFilter;
|
||||||
editing: Boolean;
|
editing: Boolean;
|
||||||
intensity: GLfloat;
|
intensity: GLfloat;
|
||||||
|
item: TWorldItem;
|
||||||
|
|
||||||
procedure GetMapDrawOffset(x, y: Integer; out drawX, drawY: Single);
|
procedure GetMapDrawOffset(x, y: Integer; out drawX, drawY: Single);
|
||||||
begin
|
begin
|
||||||
|
@ -1670,37 +1670,31 @@ begin
|
||||||
rangeX := highOffX - lowOffX;
|
rangeX := highOffX - lowOffX;
|
||||||
rangeY := highOffY - lowOffY;
|
rangeY := highOffY - lowOffY;
|
||||||
|
|
||||||
if acFilter.Checked then
|
{if acFilter.Checked then
|
||||||
staticsFilter := @frmFilter.Filter
|
staticsFilter := @frmFilter.Filter
|
||||||
else
|
else
|
||||||
staticsFilter := nil;
|
staticsFilter := nil;} //TODO : update list on change
|
||||||
|
|
||||||
for j := 0 to rangeX + rangeY - 2 do
|
draw := FLandscape.GetDrawList(FX + lowOffX, FY + lowOffY, rangeX, rangeY,
|
||||||
|
frmBoundaries.tbMinZ.Position, frmBoundaries.tbMaxZ.Position,
|
||||||
|
nil, nil, tbTerrain.Down, tbStatics.Down, //TODO : ghost tile and virtual tile!
|
||||||
|
acNoDraw.Checked, nil); //TODO : statics filter!
|
||||||
|
|
||||||
|
for i := 0 to draw.Count - 1 do
|
||||||
begin
|
begin
|
||||||
if j > rangeY then
|
item := TWorldItem(draw[i]);
|
||||||
begin
|
|
||||||
startOffX := j - rangeY + 1;
|
GetMapDrawOffset(item.X - FX, item.Y - FY, drawX, drawY);
|
||||||
endOffX := rangeX;
|
|
||||||
end else
|
|
||||||
begin
|
|
||||||
startOffX := 0;
|
|
||||||
endOffX := j;
|
|
||||||
end;
|
|
||||||
for k := startOffX to endOffX do
|
|
||||||
begin
|
|
||||||
offsetY := j - k + lowOffY;
|
|
||||||
offsetX := k + lowOffX;
|
|
||||||
GetMapDrawOffset(offsetX, offsetY, drawX, drawY);
|
|
||||||
|
|
||||||
singleTarget := (CurrentTile <> nil) and
|
singleTarget := (CurrentTile <> nil) and
|
||||||
(FX + offsetX = CurrentTile.X) and
|
(item.X = CurrentTile.X) and
|
||||||
(FY + offsetY = CurrentTile.Y);
|
(item.Y = CurrentTile.Y);
|
||||||
multiTarget := (CurrentTile <> nil) and
|
multiTarget := (CurrentTile <> nil) and
|
||||||
(SelectedTile <> nil) and
|
(SelectedTile <> nil) and
|
||||||
(CurrentTile <> SelectedTile) and
|
(CurrentTile <> SelectedTile) and
|
||||||
PtInRect(tileRect, Point(FX + offsetX, FY + offsetY));
|
PtInRect(tileRect, Point(item.X, item.Y));
|
||||||
|
|
||||||
if acSelect.Checked or dmNetwork.CanWrite(FX + offsetX, FY + offsetY) then
|
if acSelect.Checked or item.CanBeEdited then
|
||||||
begin
|
begin
|
||||||
editing := True;
|
editing := True;
|
||||||
intensity := 1.0;
|
intensity := 1.0;
|
||||||
|
@ -1712,45 +1706,38 @@ begin
|
||||||
SetDarkLights;
|
SetDarkLights;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if editing and acDraw.Checked and (singleTarget or multiTarget) then
|
{if editing and acDraw.Checked and (singleTarget or multiTarget) then
|
||||||
begin
|
begin
|
||||||
ghostTile := FGhostTile;
|
ghostTile := FGhostTile;
|
||||||
if (ghostTile is TMapCell) and (not frmDrawSettings.cbForceAltitude.Checked) then
|
if (ghostTile is TMapCell) and (not frmDrawSettings.cbForceAltitude.Checked) then
|
||||||
ghostTile.Z := FLandscape.MapCell[FX + offsetX, FY + offsetY].Z;
|
ghostTile.Z := FLandscape.MapCell[item.X, item.Y].Z;
|
||||||
end else
|
end else
|
||||||
ghostTile := nil;
|
ghostTile := nil;} //TODO : re add Ghost Tile
|
||||||
|
|
||||||
if frmVirtualLayer.cbShowLayer.Checked then
|
{if frmVirtualLayer.cbShowLayer.Checked then
|
||||||
begin
|
begin
|
||||||
virtualTile := FVirtualLayer[k, j - k];
|
virtualTile := FVirtualLayer[k, j - k];
|
||||||
virtualTile.X := FX + offsetX;
|
virtualTile.X := FX + offsetX;
|
||||||
virtualTile.Y := FY + offsetY;
|
virtualTile.Y := FY + offsetY;
|
||||||
virtualTile.Z := frmVirtualLayer.seZ.Value;
|
virtualTile.Z := frmVirtualLayer.seZ.Value;
|
||||||
end else
|
end else
|
||||||
virtualTile := nil;
|
virtualTile := nil;}
|
||||||
|
|
||||||
draw := FLandscape.GetDrawList(FX + offsetX, FY + offsetY,
|
|
||||||
frmBoundaries.tbMinZ.Position, frmBoundaries.tbMaxZ.Position,
|
|
||||||
ghostTile, virtualTile, tbTerrain.Down, tbStatics.Down,
|
|
||||||
acNoDraw.Checked, staticsFilter);
|
|
||||||
|
|
||||||
for i := 0 to draw.Count - 1 do
|
|
||||||
begin
|
|
||||||
if not editing then
|
if not editing then
|
||||||
highlight := False
|
highlight := False
|
||||||
else if TObject(draw[i]) = virtualTile then
|
{else if item = virtualTile then
|
||||||
highlight := False
|
highlight := False} //todo virtual tile
|
||||||
else if acDelete.Checked and multiTarget and (TObject(draw[i]) is TStaticItem) then
|
else if acDelete.Checked and multiTarget and (item is TStaticItem) then
|
||||||
highlight := True
|
highlight := True
|
||||||
else if ((acElevate.Checked) or (acMove.Checked)) and multiTarget then
|
else if ((acElevate.Checked) or (acMove.Checked)) and multiTarget then
|
||||||
highlight := True
|
highlight := True
|
||||||
else if (acHue.Checked and multiTarget and (TObject(draw[i]) is TMapCell)) then
|
else if (acHue.Checked and multiTarget and (item is TMapCell)) then
|
||||||
highlight := True
|
highlight := True
|
||||||
else
|
else
|
||||||
highlight := (not acSelect.Checked) and
|
highlight := (not acSelect.Checked) and
|
||||||
(not acHue.Checked) and
|
(not acHue.Checked) and
|
||||||
((TObject(draw[i]) = CurrentTile) or
|
(item = CurrentTile) or
|
||||||
((TObject(draw[i]) is TMapCell) and (TObject(draw[i]) = ghostTile)));
|
((item is TMapCell) and (item = ghostTile));
|
||||||
|
|
||||||
if highlight then
|
if highlight then
|
||||||
begin
|
begin
|
||||||
|
@ -1761,11 +1748,11 @@ begin
|
||||||
if acFlat.Checked then
|
if acFlat.Checked then
|
||||||
z := 0
|
z := 0
|
||||||
else
|
else
|
||||||
z := TWorldItem(draw[i]).Z;
|
z := item.Z;
|
||||||
|
|
||||||
glColor4f(intensity, intensity, intensity, 1.0);
|
glColor4f(intensity, intensity, intensity, 1.0);
|
||||||
|
|
||||||
if TObject(draw[i]) = virtualTile then
|
{if TObject(draw[i]) = virtualTile then
|
||||||
begin
|
begin
|
||||||
glBindTexture(GL_TEXTURE_2D, FVLayerMaterial.Texture);
|
glBindTexture(GL_TEXTURE_2D, FVLayerMaterial.Texture);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
@ -1776,9 +1763,9 @@ begin
|
||||||
glEnd;
|
glEnd;
|
||||||
|
|
||||||
FScreenBuffer.Store(Bounds(Trunc(drawX - 22), Trunc(drawY - z * 4), 44, 44), virtualTile, FVLayerMaterial);
|
FScreenBuffer.Store(Bounds(Trunc(drawX - 22), Trunc(drawY - z * 4), 44, 44), virtualTile, FVLayerMaterial);
|
||||||
end else if TObject(draw[i]) is TMapCell then
|
end else} if item is TMapCell then //TODO : virtual tile!
|
||||||
begin
|
begin
|
||||||
cell := TMapCell(draw[i]);
|
cell := TMapCell(item);
|
||||||
|
|
||||||
{if ResMan.Tiledata.LandTiles[cell.TileID].HasFlag(tdfTranslucent) then
|
{if ResMan.Tiledata.LandTiles[cell.TileID].HasFlag(tdfTranslucent) then
|
||||||
glColor4f(intensity, intensity, intensity, 0.5);} //Possible, but probably not like the OSI client
|
glColor4f(intensity, intensity, intensity, 0.5);} //Possible, but probably not like the OSI client
|
||||||
|
@ -1787,9 +1774,9 @@ begin
|
||||||
|
|
||||||
if not acFlat.Checked then
|
if not acFlat.Checked then
|
||||||
begin
|
begin
|
||||||
west := FLandscape.GetLandAlt(FX + offsetX, FY + offsetY + 1, z);
|
west := FLandscape.GetLandAlt(item.X, item.Y + 1, z);
|
||||||
south := FLandscape.GetLandAlt(FX + offsetX + 1, FY + offsetY + 1, z);
|
south := FLandscape.GetLandAlt(item.X + 1, item.Y + 1, z);
|
||||||
east := FLandscape.GetLandAlt(FX + offsetX + 1, FY + offsetY, z);
|
east := FLandscape.GetLandAlt(item.X + 1, item.Y, z);
|
||||||
|
|
||||||
if (west <> z) or (south <> z) or (east <> z) then
|
if (west <> z) or (south <> z) or (east <> z) then
|
||||||
begin
|
begin
|
||||||
|
@ -1801,7 +1788,7 @@ begin
|
||||||
begin
|
begin
|
||||||
mat := FTextureManager.GetArtMaterial(cell.TileID);
|
mat := FTextureManager.GetArtMaterial(cell.TileID);
|
||||||
if (not (ghostTile is TMapCell)) or
|
if (not (ghostTile is TMapCell)) or
|
||||||
(TObject(draw[i]) = ghostTile) then //when we have a ghosttile, only draw that, but still store the real one
|
(item = ghostTile) then //when we have a ghosttile, only draw that, but still store the real one
|
||||||
begin
|
begin
|
||||||
glBindTexture(GL_TEXTURE_2D, mat.Texture);
|
glBindTexture(GL_TEXTURE_2D, mat.Texture);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
@ -1812,18 +1799,18 @@ begin
|
||||||
glEnd;
|
glEnd;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if TObject(draw[i]) <> ghostTile then
|
if item <> ghostTile then
|
||||||
FScreenBuffer.Store(Bounds(Trunc(drawX - 22), Trunc(drawY - z * 4), 44, 44), cell, mat);
|
FScreenBuffer.Store(Bounds(Trunc(drawX - 22), Trunc(drawY - z * 4), 44, 44), cell, mat);
|
||||||
end else // Texture found
|
end else // Texture found
|
||||||
begin
|
begin
|
||||||
if (not (ghostTile is TMapCell)) or
|
if (not (ghostTile is TMapCell)) or
|
||||||
(TObject(draw[i]) = ghostTile) then //when we have a ghosttile, only draw that, but still store the real one
|
(item = ghostTile) then //when we have a ghosttile, only draw that, but still store the real one
|
||||||
begin
|
begin
|
||||||
glBindTexture(GL_TEXTURE_2D, mat.Texture);
|
glBindTexture(GL_TEXTURE_2D, mat.Texture);
|
||||||
//if (not cell.Selected) and (intensity = 1.0) then
|
//if (not cell.Selected) and (intensity = 1.0) then
|
||||||
if not cell.Selected then
|
if not cell.Selected then
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
normals := FLandscape.Normals[offsetX, offsetY];
|
normals := FLandscape.Normals[item.X, item.Y];
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
glNormal3f(normals[3].X, normals[3].Y, normals[3].Z);
|
glNormal3f(normals[3].X, normals[3].Y, normals[3].Z);
|
||||||
glTexCoord2f(0, 1); glVertex2d(drawX - 22, drawY + 22 - west * 4);
|
glTexCoord2f(0, 1); glVertex2d(drawX - 22, drawY + 22 - west * 4);
|
||||||
|
@ -1843,15 +1830,15 @@ begin
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if TObject(draw[i]) <> ghostTile then
|
if item <> ghostTile then
|
||||||
FScreenBuffer.Store(Rect(Trunc(drawX - 22), Trunc(drawY - z * 4), Trunc(drawX + 22), Trunc(drawY + 44 - south * 4)), cell, mat);
|
FScreenBuffer.Store(Rect(Trunc(drawX - 22), Trunc(drawY - z * 4), Trunc(drawX + 22), Trunc(drawY + 44 - south * 4)), cell, mat);
|
||||||
end;
|
end;
|
||||||
end else if TObject(draw[i]) is TStaticItem then
|
end else if item is TStaticItem then
|
||||||
begin
|
begin
|
||||||
staticItem := TStaticItem(draw[i]);
|
staticItem := TStaticItem(item);
|
||||||
|
|
||||||
staticTileData := ResMan.Tiledata.StaticTiles[staticItem.TileID];
|
staticTileData := ResMan.Tiledata.StaticTiles[staticItem.TileID];
|
||||||
if tbSetHue.Down and ((singleTarget and (TObject(draw[i]) = CurrentTile)) or multiTarget) then
|
if tbSetHue.Down and ((singleTarget and (item = CurrentTile)) or multiTarget) then
|
||||||
begin
|
begin
|
||||||
if frmHueSettings.lbHue.ItemIndex > 0 then
|
if frmHueSettings.lbHue.ItemIndex > 0 then
|
||||||
hue := ResMan.Hue.Hues[frmHueSettings.lbHue.ItemIndex - 1]
|
hue := ResMan.Hue.Hues[frmHueSettings.lbHue.ItemIndex - 1]
|
||||||
|
@ -1883,9 +1870,8 @@ begin
|
||||||
if highlight then
|
if highlight then
|
||||||
glDisable(GL_COLOR_LOGIC_OP);
|
glDisable(GL_COLOR_LOGIC_OP);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
draw.Free;
|
draw.Free;
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
FOverlayUI.Draw(oglGameWindow);
|
FOverlayUI.Draw(oglGameWindow);
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -48,7 +48,7 @@ object frmRegionControl: TfrmRegionControl
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object lblX: TLabel
|
object lblX: TLabel
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 13
|
Height = 14
|
||||||
Top = 32
|
Top = 32
|
||||||
Width = 8
|
Width = 8
|
||||||
Caption = 'X'
|
Caption = 'X'
|
||||||
|
@ -57,7 +57,7 @@ object frmRegionControl: TfrmRegionControl
|
||||||
end
|
end
|
||||||
object lblY: TLabel
|
object lblY: TLabel
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 13
|
Height = 14
|
||||||
Top = 60
|
Top = 60
|
||||||
Width = 8
|
Width = 8
|
||||||
Caption = 'Y'
|
Caption = 'Y'
|
||||||
|
@ -213,7 +213,7 @@ object frmRegionControl: TfrmRegionControl
|
||||||
end
|
end
|
||||||
object seX1: TSpinEdit
|
object seX1: TSpinEdit
|
||||||
Left = 20
|
Left = 20
|
||||||
Height = 23
|
Height = 19
|
||||||
Top = 29
|
Top = 29
|
||||||
Width = 50
|
Width = 50
|
||||||
Enabled = False
|
Enabled = False
|
||||||
|
@ -222,7 +222,7 @@ object frmRegionControl: TfrmRegionControl
|
||||||
end
|
end
|
||||||
object seX2: TSpinEdit
|
object seX2: TSpinEdit
|
||||||
Left = 84
|
Left = 84
|
||||||
Height = 23
|
Height = 19
|
||||||
Top = 29
|
Top = 29
|
||||||
Width = 50
|
Width = 50
|
||||||
Enabled = False
|
Enabled = False
|
||||||
|
@ -231,7 +231,7 @@ object frmRegionControl: TfrmRegionControl
|
||||||
end
|
end
|
||||||
object seY1: TSpinEdit
|
object seY1: TSpinEdit
|
||||||
Left = 20
|
Left = 20
|
||||||
Height = 23
|
Height = 19
|
||||||
Top = 56
|
Top = 56
|
||||||
Width = 50
|
Width = 50
|
||||||
Enabled = False
|
Enabled = False
|
||||||
|
@ -240,7 +240,7 @@ object frmRegionControl: TfrmRegionControl
|
||||||
end
|
end
|
||||||
object seY2: TSpinEdit
|
object seY2: TSpinEdit
|
||||||
Left = 84
|
Left = 84
|
||||||
Height = 23
|
Height = 19
|
||||||
Top = 56
|
Top = 56
|
||||||
Width = 50
|
Width = 50
|
||||||
Enabled = False
|
Enabled = False
|
||||||
|
@ -261,6 +261,7 @@ object frmRegionControl: TfrmRegionControl
|
||||||
DefaultText = 'Node'
|
DefaultText = 'Node'
|
||||||
Header.AutoSizeIndex = 0
|
Header.AutoSizeIndex = 0
|
||||||
Header.Columns = <>
|
Header.Columns = <>
|
||||||
|
Header.DefaultHeight = 17
|
||||||
Header.MainColumn = -1
|
Header.MainColumn = -1
|
||||||
Header.Options = [hoColumnResize, hoDrag]
|
Header.Options = [hoColumnResize, hoDrag]
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
@ -304,6 +305,7 @@ object frmRegionControl: TfrmRegionControl
|
||||||
Text = 'Regions'
|
Text = 'Regions'
|
||||||
Width = 158
|
Width = 158
|
||||||
end>
|
end>
|
||||||
|
Header.DefaultHeight = 17
|
||||||
Header.Options = [hoAutoResize, hoVisible]
|
Header.Options = [hoAutoResize, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
Header.Style = hsFlatButtons
|
Header.Style = hsFlatButtons
|
||||||
|
@ -442,8 +444,8 @@ object frmRegionControl: TfrmRegionControl
|
||||||
Top = 1
|
Top = 1
|
||||||
Width = 458
|
Width = 458
|
||||||
Align = alClient
|
Align = alClient
|
||||||
ClientHeight = 378
|
ClientHeight = 374
|
||||||
ClientWidth = 458
|
ClientWidth = 454
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object pbArea: TPaintBox
|
object pbArea: TPaintBox
|
||||||
Left = 0
|
Left = 0
|
||||||
|
|
|
@ -43,6 +43,7 @@ type
|
||||||
FY, FOrgY: Word;
|
FY, FOrgY: Word;
|
||||||
FZ, FOrgZ: ShortInt;
|
FZ, FOrgZ: ShortInt;
|
||||||
FSelected: Boolean;
|
FSelected: Boolean;
|
||||||
|
FCanBeEdited: Boolean;
|
||||||
FLocked: Boolean;
|
FLocked: Boolean;
|
||||||
FChanged: Boolean;
|
FChanged: Boolean;
|
||||||
FPriority: Integer;
|
FPriority: Integer;
|
||||||
|
@ -67,6 +68,7 @@ type
|
||||||
property Y: Word read FY write SetY;
|
property Y: Word read FY write SetY;
|
||||||
property Z: ShortInt read FZ write SetZ;
|
property Z: ShortInt read FZ write SetZ;
|
||||||
property Selected: Boolean read FSelected write SetSelected;
|
property Selected: Boolean read FSelected write SetSelected;
|
||||||
|
property CanBeEdited: Boolean read FCanBeEdited write FCanBeEdited;
|
||||||
property Locked: Boolean read FLocked write SetLocked;
|
property Locked: Boolean read FLocked write SetLocked;
|
||||||
property Changed: Boolean read FChanged;
|
property Changed: Boolean read FChanged;
|
||||||
property Priority: Integer read FPriority write FPriority;
|
property Priority: Integer read FPriority write FPriority;
|
||||||
|
|
Loading…
Reference in New Issue