* Fixed drop down toolbar buttons to correct their state
* Added terrain grid (ported from CentrED+; Thanks to StaticZ!)
This commit is contained in:
parent
1ddaee39d5
commit
39280f927b
|
@ -257,6 +257,8 @@ type
|
||||||
ScreenRect: TRect;
|
ScreenRect: TRect;
|
||||||
DrawQuad: array[0..3,0..1] of TGLint;
|
DrawQuad: array[0..3,0..1] of TGLint;
|
||||||
RealQuad: array[0..3,0..1] of TGLint;
|
RealQuad: array[0..3,0..1] of TGLint;
|
||||||
|
LineWidth: array[0..2] of GLfloat;
|
||||||
|
LineDraw: array[0..2,0..1,0..1] of TGLint;
|
||||||
Item: TWorldItem;
|
Item: TWorldItem;
|
||||||
HighRes: TMaterial;
|
HighRes: TMaterial;
|
||||||
LowRes: TMaterial;
|
LowRes: TMaterial;
|
||||||
|
|
|
@ -123,7 +123,7 @@ object frmMain: TfrmMain
|
||||||
AnchorSideLeft.Control = cbTerrain
|
AnchorSideLeft.Control = cbTerrain
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = cbTerrain
|
AnchorSideTop.Control = cbTerrain
|
||||||
Left = 91
|
Left = 88
|
||||||
Height = 13
|
Height = 13
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 31
|
Width = 31
|
||||||
|
@ -362,7 +362,7 @@ object frmMain: TfrmMain
|
||||||
Left = 158
|
Left = 158
|
||||||
Height = 22
|
Height = 22
|
||||||
Hint = 'Save Preset'
|
Hint = 'Save Preset'
|
||||||
Top = 137
|
Top = 139
|
||||||
Width = 22
|
Width = 22
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Right = 4
|
BorderSpacing.Right = 4
|
||||||
|
@ -414,7 +414,7 @@ object frmMain: TfrmMain
|
||||||
Left = 184
|
Left = 184
|
||||||
Height = 22
|
Height = 22
|
||||||
Hint = 'Delete Preset'
|
Hint = 'Delete Preset'
|
||||||
Top = 137
|
Top = 139
|
||||||
Width = 22
|
Width = 22
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Right = 4
|
BorderSpacing.Right = 4
|
||||||
|
@ -469,7 +469,7 @@ object frmMain: TfrmMain
|
||||||
AnchorSideBottom.Control = cbRandomPreset
|
AnchorSideBottom.Control = cbRandomPreset
|
||||||
Cursor = 63
|
Cursor = 63
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 109
|
Height = 111
|
||||||
Top = 24
|
Top = 24
|
||||||
Width = 202
|
Width = 202
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
@ -517,8 +517,8 @@ object frmMain: TfrmMain
|
||||||
AnchorSideBottom.Control = gbRandom
|
AnchorSideBottom.Control = gbRandom
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 27
|
Height = 25
|
||||||
Top = 137
|
Top = 139
|
||||||
Width = 150
|
Width = 150
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 4
|
||||||
|
@ -571,10 +571,10 @@ object frmMain: TfrmMain
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = tsTiles
|
AnchorSideRight.Control = tsTiles
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 91
|
Left = 88
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 21
|
Top = 21
|
||||||
Width = 107
|
Width = 110
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Right = 16
|
BorderSpacing.Right = 16
|
||||||
OnEditingDone = edFilterEditingDone
|
OnEditingDone = edFilterEditingDone
|
||||||
|
@ -585,10 +585,10 @@ object frmMain: TfrmMain
|
||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideTop.Control = cbTerrain
|
AnchorSideTop.Control = cbTerrain
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 3
|
Left = 4
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 34
|
Top = 34
|
||||||
Width = 73
|
Width = 68
|
||||||
Caption = 'Statics'
|
Caption = 'Statics'
|
||||||
Checked = True
|
Checked = True
|
||||||
OnChange = cbStaticsChange
|
OnChange = cbStaticsChange
|
||||||
|
@ -601,7 +601,7 @@ object frmMain: TfrmMain
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 71
|
Width = 68
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 4
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
Caption = 'Terrain'
|
Caption = 'Terrain'
|
||||||
|
@ -935,18 +935,15 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object tbTerrain: TToolButton
|
object tbTerrain: TToolButton
|
||||||
Left = 274
|
Left = 274
|
||||||
Hint = 'Show Terrain'
|
|
||||||
Top = 2
|
Top = 2
|
||||||
Caption = 'Terrain'
|
Action = acTerrain
|
||||||
Down = True
|
DropdownMenu = pmViewTerrainSettings
|
||||||
ImageIndex = 10
|
|
||||||
OnClick = tbTerrainClick
|
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
Style = tbsCheck
|
Style = tbsDropDown
|
||||||
end
|
end
|
||||||
object tbStatics: TToolButton
|
object tbStatics: TToolButton
|
||||||
Left = 297
|
Left = 309
|
||||||
Top = 2
|
Top = 2
|
||||||
Action = acStatics
|
Action = acStatics
|
||||||
DropdownMenu = pmViewStaticSettings
|
DropdownMenu = pmViewStaticSettings
|
||||||
|
@ -955,7 +952,7 @@ object frmMain: TfrmMain
|
||||||
Style = tbsDropDown
|
Style = tbsDropDown
|
||||||
end
|
end
|
||||||
object tbSeparator5: TToolButton
|
object tbSeparator5: TToolButton
|
||||||
Left = 436
|
Left = 448
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 2
|
Top = 2
|
||||||
Width = 5
|
Width = 5
|
||||||
|
@ -963,7 +960,7 @@ object frmMain: TfrmMain
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
object tbRadarMap: TToolButton
|
object tbRadarMap: TToolButton
|
||||||
Left = 441
|
Left = 453
|
||||||
Hint = 'Radar Map'
|
Hint = 'Radar Map'
|
||||||
Top = 2
|
Top = 2
|
||||||
Caption = 'Radar Map'
|
Caption = 'Radar Map'
|
||||||
|
@ -985,14 +982,14 @@ object frmMain: TfrmMain
|
||||||
Style = tbsCheck
|
Style = tbsCheck
|
||||||
end
|
end
|
||||||
object tbFlat: TToolButton
|
object tbFlat: TToolButton
|
||||||
Left = 401
|
Left = 413
|
||||||
Top = 2
|
Top = 2
|
||||||
Action = acFlat
|
Action = acFlat
|
||||||
DropdownMenu = pmFlatViewSettings
|
DropdownMenu = pmFlatViewSettings
|
||||||
Style = tbsDropDown
|
Style = tbsDropDown
|
||||||
end
|
end
|
||||||
object tbNoDraw: TToolButton
|
object tbNoDraw: TToolButton
|
||||||
Left = 332
|
Left = 344
|
||||||
Top = 2
|
Top = 2
|
||||||
Action = acNoDraw
|
Action = acNoDraw
|
||||||
Style = tbsCheck
|
Style = tbsCheck
|
||||||
|
@ -1011,12 +1008,12 @@ object frmMain: TfrmMain
|
||||||
Action = acUndo
|
Action = acUndo
|
||||||
end
|
end
|
||||||
object tbLightlevel: TToolButton
|
object tbLightlevel: TToolButton
|
||||||
Left = 378
|
Left = 390
|
||||||
Top = 2
|
Top = 2
|
||||||
Action = acLightlevel
|
Action = acLightlevel
|
||||||
end
|
end
|
||||||
object tbWalkable: TToolButton
|
object tbWalkable: TToolButton
|
||||||
Left = 355
|
Left = 367
|
||||||
Top = 2
|
Top = 2
|
||||||
Action = acWalkable
|
Action = acWalkable
|
||||||
Style = tbsCheck
|
Style = tbsCheck
|
||||||
|
@ -2698,6 +2695,13 @@ object frmMain: TfrmMain
|
||||||
OnExecute = acWalkableExecute
|
OnExecute = acWalkableExecute
|
||||||
ShortCut = 16471
|
ShortCut = 16471
|
||||||
end
|
end
|
||||||
|
object acTerrain: TAction
|
||||||
|
Category = 'Settings'
|
||||||
|
Checked = True
|
||||||
|
Hint = 'Show Terrain'
|
||||||
|
ImageIndex = 10
|
||||||
|
OnExecute = acTerrainExecute
|
||||||
|
end
|
||||||
object acStatics: TAction
|
object acStatics: TAction
|
||||||
Category = 'Settings'
|
Category = 'Settings'
|
||||||
Checked = True
|
Checked = True
|
||||||
|
@ -2727,6 +2731,7 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object pmFlatViewSettings: TPopupMenu
|
object pmFlatViewSettings: TPopupMenu
|
||||||
|
OnClose = pmFlatViewSettingsClose
|
||||||
left = 368
|
left = 368
|
||||||
top = 136
|
top = 136
|
||||||
object mnuFlatShowHeight: TMenuItem
|
object mnuFlatShowHeight: TMenuItem
|
||||||
|
@ -2745,6 +2750,7 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object pmViewStaticSettings: TPopupMenu
|
object pmViewStaticSettings: TPopupMenu
|
||||||
Images = ImageList1
|
Images = ImageList1
|
||||||
|
OnClose = pmFlatViewSettingsClose
|
||||||
left = 584
|
left = 584
|
||||||
top = 33
|
top = 33
|
||||||
object mnuShowWalls: TMenuItem
|
object mnuShowWalls: TMenuItem
|
||||||
|
@ -2790,4 +2796,24 @@ object frmMain: TfrmMain
|
||||||
OnClick = mnuShowWallsClick
|
OnClick = mnuShowWallsClick
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object tmToolbarFix: TTimer
|
||||||
|
Enabled = False
|
||||||
|
Interval = 25
|
||||||
|
OnTimer = tmToolbarFixTimer
|
||||||
|
left = 584
|
||||||
|
top = 296
|
||||||
|
end
|
||||||
|
object pmViewTerrainSettings: TPopupMenu
|
||||||
|
OnClose = pmFlatViewSettingsClose
|
||||||
|
left = 584
|
||||||
|
top = 88
|
||||||
|
object mnuShowGrid: TMenuItem
|
||||||
|
Caption = 'Show Grid'
|
||||||
|
OnClick = mnuShowGridClick
|
||||||
|
end
|
||||||
|
object mnuShowBlocks: TMenuItem
|
||||||
|
Caption = 'Show Blocks'
|
||||||
|
OnClick = mnuShowBlocksClick
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,6 +73,7 @@ type
|
||||||
acNoDraw: TAction;
|
acNoDraw: TAction;
|
||||||
acLightlevel: TAction;
|
acLightlevel: TAction;
|
||||||
acStatics: TAction;
|
acStatics: TAction;
|
||||||
|
acTerrain: TAction;
|
||||||
acWalkable: TAction;
|
acWalkable: TAction;
|
||||||
acUndo: TAction;
|
acUndo: TAction;
|
||||||
acVirtualLayer: TAction;
|
acVirtualLayer: TAction;
|
||||||
|
@ -104,6 +105,8 @@ type
|
||||||
lblY: TLabel;
|
lblY: TLabel;
|
||||||
lbClients: TListBox;
|
lbClients: TListBox;
|
||||||
MainMenu1: TMainMenu;
|
MainMenu1: TMainMenu;
|
||||||
|
mnuShowBlocks: TMenuItem;
|
||||||
|
mnuShowGrid: TMenuItem;
|
||||||
mnuChangePassword: TMenuItem;
|
mnuChangePassword: TMenuItem;
|
||||||
mnuShowBridges: TMenuItem;
|
mnuShowBridges: TMenuItem;
|
||||||
mnuShowFoliage: TMenuItem;
|
mnuShowFoliage: TMenuItem;
|
||||||
|
@ -155,6 +158,7 @@ type
|
||||||
pnlChat: TPanel;
|
pnlChat: TPanel;
|
||||||
pnlChatHeader: TPanel;
|
pnlChatHeader: TPanel;
|
||||||
pmFlatViewSettings: TPopupMenu;
|
pmFlatViewSettings: TPopupMenu;
|
||||||
|
pmViewTerrainSettings: TPopupMenu;
|
||||||
spChat: TSplitter;
|
spChat: TSplitter;
|
||||||
spTileList: TSplitter;
|
spTileList: TSplitter;
|
||||||
tbFilter: TToolButton;
|
tbFilter: TToolButton;
|
||||||
|
@ -164,6 +168,7 @@ type
|
||||||
tbUndo: TToolButton;
|
tbUndo: TToolButton;
|
||||||
tbLightlevel: TToolButton;
|
tbLightlevel: TToolButton;
|
||||||
tbWalkable: TToolButton;
|
tbWalkable: TToolButton;
|
||||||
|
tmToolbarFix: TTimer;
|
||||||
tsLocations: TTabSheet;
|
tsLocations: TTabSheet;
|
||||||
tbSetHue: TToolButton;
|
tbSetHue: TToolButton;
|
||||||
tmGrabTileInfo: TTimer;
|
tmGrabTileInfo: TTimer;
|
||||||
|
@ -203,6 +208,7 @@ type
|
||||||
procedure acNoDrawExecute(Sender: TObject);
|
procedure acNoDrawExecute(Sender: TObject);
|
||||||
procedure acSelectExecute(Sender: TObject);
|
procedure acSelectExecute(Sender: TObject);
|
||||||
procedure acStaticsExecute(Sender: TObject);
|
procedure acStaticsExecute(Sender: TObject);
|
||||||
|
procedure acTerrainExecute(Sender: TObject);
|
||||||
procedure acUndoExecute(Sender: TObject);
|
procedure acUndoExecute(Sender: TObject);
|
||||||
procedure acVirtualLayerExecute(Sender: TObject);
|
procedure acVirtualLayerExecute(Sender: TObject);
|
||||||
procedure acWalkableExecute(Sender: TObject);
|
procedure acWalkableExecute(Sender: TObject);
|
||||||
|
@ -245,6 +251,8 @@ type
|
||||||
procedure mnuLargeScaleCommandsClick(Sender: TObject);
|
procedure mnuLargeScaleCommandsClick(Sender: TObject);
|
||||||
procedure mnuRegionControlClick(Sender: TObject);
|
procedure mnuRegionControlClick(Sender: TObject);
|
||||||
procedure mnuShowAnimationsClick(Sender: TObject);
|
procedure mnuShowAnimationsClick(Sender: TObject);
|
||||||
|
procedure mnuShowBlocksClick(Sender: TObject);
|
||||||
|
procedure mnuShowGridClick(Sender: TObject);
|
||||||
procedure mnuShowWallsClick(Sender: TObject);
|
procedure mnuShowWallsClick(Sender: TObject);
|
||||||
procedure mnuShutdownClick(Sender: TObject);
|
procedure mnuShutdownClick(Sender: TObject);
|
||||||
procedure mnuWhiteBackgroundClick(Sender: TObject);
|
procedure mnuWhiteBackgroundClick(Sender: TObject);
|
||||||
|
@ -263,13 +271,14 @@ type
|
||||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||||
procedure oglGameWindowPaint(Sender: TObject);
|
procedure oglGameWindowPaint(Sender: TObject);
|
||||||
procedure oglGameWindowResize(Sender: TObject);
|
procedure oglGameWindowResize(Sender: TObject);
|
||||||
|
procedure pmFlatViewSettingsClose(Sender: TObject);
|
||||||
procedure pmGrabTileInfoPopup(Sender: TObject);
|
procedure pmGrabTileInfoPopup(Sender: TObject);
|
||||||
procedure tbFilterMouseMove(Sender: TObject; Shift: TShiftState; X,
|
procedure tbFilterMouseMove(Sender: TObject; Shift: TShiftState; X,
|
||||||
Y: Integer);
|
Y: Integer);
|
||||||
procedure tbRadarMapClick(Sender: TObject);
|
procedure tbRadarMapClick(Sender: TObject);
|
||||||
procedure tbTerrainClick(Sender: TObject);
|
|
||||||
procedure tmGrabTileInfoTimer(Sender: TObject);
|
procedure tmGrabTileInfoTimer(Sender: TObject);
|
||||||
procedure tmMovementTimer(Sender: TObject);
|
procedure tmMovementTimer(Sender: TObject);
|
||||||
|
procedure tmToolbarFixTimer(Sender: TObject);
|
||||||
procedure vdtRandomClick(Sender: TObject);
|
procedure vdtRandomClick(Sender: TObject);
|
||||||
procedure vdtRandomDragDrop(Sender: TBaseVirtualTree; Source: TObject;
|
procedure vdtRandomDragDrop(Sender: TBaseVirtualTree; Source: TObject;
|
||||||
DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState;
|
DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState;
|
||||||
|
@ -524,6 +533,22 @@ begin
|
||||||
RebuildScreenBuffer;
|
RebuildScreenBuffer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmMain.mnuShowBlocksClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
mnuShowBlocks.Checked := not mnuShowBlocks.Checked;
|
||||||
|
mnuShowGrid.Checked := False; //If ShowBlocks is active, ShowGrid cannot be.
|
||||||
|
RebuildScreenBuffer;
|
||||||
|
FRepaintNeeded := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmMain.mnuShowGridClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
mnuShowGrid.Checked := not mnuShowGrid.Checked;
|
||||||
|
mnuShowBlocks.Checked := False; //If ShowGrid is active, ShowBlocks cannot be.
|
||||||
|
RebuildScreenBuffer;
|
||||||
|
FRepaintNeeded := True;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.mnuShowWallsClick(Sender: TObject);
|
procedure TfrmMain.mnuShowWallsClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
// Update filters. First, start off empty.
|
// Update filters. First, start off empty.
|
||||||
|
@ -1177,6 +1202,12 @@ begin
|
||||||
RebuildScreenBuffer;
|
RebuildScreenBuffer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmMain.acTerrainExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
acTerrain.Checked := not acTerrain.Checked;
|
||||||
|
RebuildScreenBuffer;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.acUndoExecute(Sender: TObject);
|
procedure TfrmMain.acUndoExecute(Sender: TObject);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
@ -1513,6 +1544,11 @@ begin
|
||||||
InvalidateScreenBuffer;
|
InvalidateScreenBuffer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmMain.pmFlatViewSettingsClose(Sender: TObject);
|
||||||
|
begin
|
||||||
|
tmToolbarFix.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.pmGrabTileInfoPopup(Sender: TObject);
|
procedure TfrmMain.pmGrabTileInfoPopup(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
mnuGrabHue.Enabled := CurrentTile is TStaticItem;
|
mnuGrabHue.Enabled := CurrentTile is TStaticItem;
|
||||||
|
@ -1531,11 +1567,6 @@ begin
|
||||||
frmRadarMap.BringToFront;
|
frmRadarMap.BringToFront;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.tbTerrainClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
RebuildScreenBuffer;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TfrmMain.tmGrabTileInfoTimer(Sender: TObject);
|
procedure TfrmMain.tmGrabTileInfoTimer(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
tmGrabTileInfo.Enabled := False;
|
tmGrabTileInfo.Enabled := False;
|
||||||
|
@ -1559,6 +1590,17 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmMain.tmToolbarFixTimer(Sender: TObject);
|
||||||
|
begin
|
||||||
|
// This is a workaround for the TToolButton to not stay "down" when
|
||||||
|
// a popup menu was shown. Thanks to StaticZ for finding that :-)
|
||||||
|
// Only necessary till this is fixed: http://bugs.freepascal.org/view.php?id=15263
|
||||||
|
tmToolbarFix.Enabled := False;
|
||||||
|
tbFlat.Down := acFlat.Checked;
|
||||||
|
tbTerrain.Down := acTerrain.Checked;
|
||||||
|
tbStatics.Down := acStatics.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.vdtRandomClick(Sender: TObject);
|
procedure TfrmMain.vdtRandomClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
node: PVirtualNode;
|
node: PVirtualNode;
|
||||||
|
@ -2237,8 +2279,8 @@ procedure TfrmMain.PrepareScreenBlock(ABlockInfo: PBlockInfo);
|
||||||
var
|
var
|
||||||
item: TWorldItem;
|
item: TWorldItem;
|
||||||
drawX, drawY: Integer;
|
drawX, drawY: Integer;
|
||||||
z, west, south, east: SmallInt;
|
z, west, south, east, tileNorth, tileWest, tileLeft, tileRight: SmallInt;
|
||||||
rawZ, rawWest, rawSouth, rawEast: SmallInt;
|
rawZ, rawWest, rawSouth, rawEast, rawTileNorth, rawTileWest, rawTileLeft, rawTileRight: SmallInt;
|
||||||
staticItem: TStaticItem;
|
staticItem: TStaticItem;
|
||||||
begin
|
begin
|
||||||
//add normals to map tiles and materials where possible
|
//add normals to map tiles and materials where possible
|
||||||
|
@ -2332,6 +2374,22 @@ begin
|
||||||
ABlockInfo^.DrawQuad[2][1] := drawY + 44 - south * 4;
|
ABlockInfo^.DrawQuad[2][1] := drawY + 44 - south * 4;
|
||||||
ABlockInfo^.DrawQuad[3][0] := drawX - 22;
|
ABlockInfo^.DrawQuad[3][0] := drawX - 22;
|
||||||
ABlockInfo^.DrawQuad[3][1] := drawY + 22 - west * 4;
|
ABlockInfo^.DrawQuad[3][1] := drawY + 22 - west * 4;
|
||||||
|
|
||||||
|
// Set lines to visualize the terrain mesh
|
||||||
|
if mnuShowGrid.Checked or mnuShowBlocks.Checked then
|
||||||
|
begin
|
||||||
|
ABlockInfo^.LineWidth[0] := 0.9;
|
||||||
|
ABlockInfo^.LineDraw[0][0] := ABlockInfo^.DrawQuad[0];
|
||||||
|
ABlockInfo^.LineDraw[0][1] := ABlockInfo^.DrawQuad[1];
|
||||||
|
ABlockInfo^.LineWidth[1] := 0.9;
|
||||||
|
ABlockInfo^.LineDraw[1][0] := ABlockInfo^.DrawQuad[0];
|
||||||
|
ABlockInfo^.LineDraw[1][1] := ABlockInfo^.DrawQuad[3];
|
||||||
|
ABlockInfo^.LineWidth[2] := 0.8;
|
||||||
|
//ABlockInfo^.LineDraw[2][0] := ABlockInfo^.DrawQuad[0];
|
||||||
|
//ABlockInfo^.LineDraw[2][1] := ABlockInfo^.DrawQuad[2];
|
||||||
|
ABlockInfo^.LineDraw[2][0] := ABlockInfo^.DrawQuad[1];
|
||||||
|
ABlockInfo^.LineDraw[2][1] := ABlockInfo^.DrawQuad[3];
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
ABlockInfo^.DrawQuad[0][0] := drawX - 22;
|
ABlockInfo^.DrawQuad[0][0] := drawX - 22;
|
||||||
|
@ -2342,6 +2400,32 @@ begin
|
||||||
ABlockInfo^.DrawQuad[2][1] := drawY + ABlockInfo^.LowRes.Height - z * 4;
|
ABlockInfo^.DrawQuad[2][1] := drawY + ABlockInfo^.LowRes.Height - z * 4;
|
||||||
ABlockInfo^.DrawQuad[3][0] := drawX - 22;
|
ABlockInfo^.DrawQuad[3][0] := drawX - 22;
|
||||||
ABlockInfo^.DrawQuad[3][1] := drawY + ABlockInfo^.LowRes.Height - z * 4;
|
ABlockInfo^.DrawQuad[3][1] := drawY + ABlockInfo^.LowRes.Height - z * 4;
|
||||||
|
|
||||||
|
// Set lines to visualize the terrain mesh
|
||||||
|
if mnuShowGrid.Checked or mnuShowBlocks.Checked then
|
||||||
|
begin
|
||||||
|
GetLandAlt(item.X, item.Y - 1, z, rawZ, tileNorth, rawTileNorth);
|
||||||
|
GetLandAlt(item.X - 1, item.Y, z, rawZ, tileWest, rawTileWest);
|
||||||
|
GetLandAlt(item.X - 1, item.Y + 1, z, rawZ, tileLeft, rawTileLeft);
|
||||||
|
GetLandAlt(item.X + 1, item.Y - 1, z, rawZ, tileRight, rawTileRight);
|
||||||
|
if (tileNorth <> z) or (tileRight <> z) then
|
||||||
|
ABlockInfo^.LineWidth[0] := 0.9
|
||||||
|
else
|
||||||
|
ABlockInfo^.LineWidth[0] := 0.8;
|
||||||
|
ABlockInfo^.LineDraw[0][0][0] := drawX;
|
||||||
|
ABlockInfo^.LineDraw[0][0][1] := ABlockInfo^.DrawQuad[0][1];
|
||||||
|
ABlockInfo^.LineDraw[0][1][0] := ABlockInfo^.DrawQuad[1][0];
|
||||||
|
ABlockInfo^.LineDraw[0][1][1] := ABlockInfo^.DrawQuad[1][1] + 22;
|
||||||
|
if (tileWest <> z) or (tileLeft <> z) then
|
||||||
|
ABlockInfo^.LineWidth[1] := 0.9
|
||||||
|
else
|
||||||
|
ABlockInfo^.LineWidth[1] := 0.8;
|
||||||
|
ABlockInfo^.LineDraw[1][0][0] := drawX;
|
||||||
|
ABlockInfo^.LineDraw[1][0][1] := ABlockInfo^.DrawQuad[0][1];
|
||||||
|
ABlockInfo^.LineDraw[1][1][0] := ABlockInfo^.DrawQuad[3][0];
|
||||||
|
ABlockInfo^.LineDraw[1][1][1] := ABlockInfo^.DrawQuad[3][1] - 22;
|
||||||
|
ABlockInfo^.LineWidth[2] := 0.0;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
if item is TVirtualTile then
|
if item is TVirtualTile then
|
||||||
|
@ -2493,6 +2577,86 @@ begin
|
||||||
|
|
||||||
if (blockInfo^.Text <> nil) then
|
if (blockInfo^.Text <> nil) then
|
||||||
blockInfo^.Text.Render(blockInfo^.ScreenRect);
|
blockInfo^.Text.Render(blockInfo^.ScreenRect);
|
||||||
|
|
||||||
|
// Rending mesh terrain
|
||||||
|
if (mnuShowGrid.Checked) and (blockInfo^.Item is TMapCell) then
|
||||||
|
begin
|
||||||
|
glDisable(GL_TEXTURE_2D); // Do not use color texture
|
||||||
|
glEnable(GL_LINE_SMOOTH); // smoothing lines
|
||||||
|
//glDisable(GL_LINE_SMOOTH);
|
||||||
|
|
||||||
|
if (tbFlat.Down) then
|
||||||
|
begin
|
||||||
|
glColor4f(0.8, 0.8, 0.8, 0.9); // Color lines
|
||||||
|
glLineWidth(0.1); // line width
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[0][0]);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[0][1]);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[1][0]);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[1][1]);
|
||||||
|
glEnd;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
if blockInfo^.LineWidth[0] < 0.85
|
||||||
|
then glColor4f(1.0, 1.0, 0.0, 0.5) // Color lines
|
||||||
|
else glColor4f(1.0, 1.0, 1.0, 1.0); // Color lines
|
||||||
|
glLineWidth(blockInfo^.LineWidth[0]); // line width
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[0][0]);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[0][1]);
|
||||||
|
glEnd;
|
||||||
|
if blockInfo^.LineWidth[1] < 0.85
|
||||||
|
then glColor4f(1.0, 1.0, 0.0, 0.5) // Color lines
|
||||||
|
else glColor4f(1.0, 1.0, 1.0, 1.0); // Color lines
|
||||||
|
glLineWidth(blockInfo^.LineWidth[1]); // line width
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[1][0]);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[1][1]);
|
||||||
|
glEnd;
|
||||||
|
if blockInfo^.LineWidth[2] > 0 then
|
||||||
|
begin
|
||||||
|
glColor4f(1.3281, 0.2510, 1.0, 0.8); // Color lines
|
||||||
|
glLineWidth(blockInfo^.LineWidth[2]);// line width
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[2][0]);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[2][1]);
|
||||||
|
glEnd;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
glDisable(GL_LINE_SMOOTH);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
end else if (mnuShowBlocks.Checked) and (blockInfo^.Item is TMapCell) then
|
||||||
|
begin // Rending the grid blocks
|
||||||
|
glDisable(GL_TEXTURE_2D); // Do not use color texture
|
||||||
|
glEnable(GL_LINE_SMOOTH); // smoothing lines
|
||||||
|
|
||||||
|
if (blockInfo^.Item.X mod 8 = 0) then begin
|
||||||
|
glLineWidth(2.0);
|
||||||
|
glColor4f(1.0, 1.0, 0.0, 0.5);
|
||||||
|
end else begin
|
||||||
|
glColor4f(0.8, 0.8, 0.8, 0.9);
|
||||||
|
glLineWidth(0.1);
|
||||||
|
end;
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[1][0]);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[1][1]);
|
||||||
|
glEnd;
|
||||||
|
if (blockInfo^.Item.Y mod 8 = 0) then begin
|
||||||
|
glLineWidth(2.0);
|
||||||
|
glColor4f(1.0, 1.0, 0.0, 0.5);
|
||||||
|
end else begin
|
||||||
|
glColor4f(0.8, 0.8, 0.8, 0.9);
|
||||||
|
glLineWidth(0.1);
|
||||||
|
end;
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[0][0]);
|
||||||
|
glVertex2iv(@blockInfo^.LineDraw[0][1]);
|
||||||
|
glEnd;
|
||||||
|
|
||||||
|
glDisable(GL_LINE_SMOOTH);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (FLightManager.LightLevel > 0) and not acFlat.Checked then
|
if (FLightManager.LightLevel > 0) and not acFlat.Checked then
|
||||||
|
|
Loading…
Reference in New Issue