* Added advanced statics filter (thanks to StaticZ)

This commit is contained in:
Andreas Schneider 2015-05-10 19:48:52 +02:00
parent 699fb78d72
commit ffd0cc1028
4 changed files with 117 additions and 30 deletions

View File

@ -18,7 +18,7 @@
<UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="7"/>
<BuildNr Value="253"/>
<BuildNr Value="257"/>
<StringTable CompanyName="AKS DataBasis" FileDescription="UO CentrED" InternalName="CentrED" LegalCopyright="(c) 2015 Andreas Schneider and StaticZ" OriginalFilename="CentrED.exe" ProductName="CentrED" ProductVersion="0.7.0"/>
</VersionInfo>
<BuildModes Count="7">

View File

@ -21,7 +21,8 @@
* CDDL HEADER END
*
*
* Portions Copyright 2009 Andreas Schneider
* Portions Copyright 2015 Andreas Schneider
* Portions Copyright 2015 StaticZ
*)
unit ULandscape;
@ -33,9 +34,7 @@ uses
SysUtils, Classes, math, matrix, LCLIntf, GL, GLu, ImagingOpenGL, Imaging,
ImagingClasses, ImagingTypes, ImagingUtility,
UGenericIndex, UMap, UStatics, UArt, UTexture, UTiledata, UHue, UWorldItem,
UMulBlock, UAnimData,
UEnhancedMemoryStream, UGLFont,
UCacheManager;
UMulBlock, UAnimData, UEnhancedMemoryStream, UGLFont, UCacheManager;
type
TGlVector3f = array[0..2] of GLfloat;
@ -226,7 +225,7 @@ type
function CanWrite(AX, AY: Word): Boolean;
procedure FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth,
AHeight: Word; AMap, AStatics: Boolean; ANoDraw: Boolean;
AAdditionalTiles: TWorldItemList = nil);
AAdditionalTiles: TWorldItemList = nil; ATileFilters: TTileDataFlags = []);
function GetEffectiveAltitude(ATile: TMapCell): ShortInt;
function GetLandAlt(AX, AY: Word; ADefault: ShortInt): ShortInt;
procedure GetNormals(AX, AY: Word; var ANormals: TNormals);
@ -959,7 +958,7 @@ end;
procedure TLandscape.FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth,
AHeight: Word; AMap, AStatics: Boolean; ANoDraw: Boolean;
AAdditionalTiles: TWorldItemList = nil);
AAdditionalTiles: TWorldItemList; ATileFilters: TTileDataFlags);
var
drawMapCell: TMapCell;
drawStatics: TStaticItemList;
@ -994,6 +993,10 @@ begin
staticTileData := ResMan.Tiledata.StaticTiles[drawStatics[i].TileID];
if ANoDraw or FDrawMap[drawStatics[i].TileID + $4000] then
begin
// Check if filters match
if staticTileData.Flags * ATileFilters <> [] then
Continue;
drawStatics[i].UpdatePriorities(staticTileData,
ADrawList.GetSerial);
tempDrawList.Add(drawStatics[i]);

View File

@ -947,18 +947,15 @@ object frmMain: TfrmMain
end
object tbStatics: TToolButton
Left = 297
Hint = 'Show Statics'
Top = 2
Caption = 'Statics'
Down = True
ImageIndex = 11
OnClick = tbStaticsClick
Action = acStatics
DropdownMenu = pmViewStaticSettings
ParentShowHint = False
ShowHint = True
Style = tbsCheck
Style = tbsDropDown
end
object tbSeparator5: TToolButton
Left = 424
Left = 436
Height = 22
Top = 2
Width = 5
@ -966,7 +963,7 @@ object frmMain: TfrmMain
Style = tbsDivider
end
object tbRadarMap: TToolButton
Left = 429
Left = 441
Hint = 'Radar Map'
Top = 2
Caption = 'Radar Map'
@ -988,14 +985,14 @@ object frmMain: TfrmMain
Style = tbsCheck
end
object tbFlat: TToolButton
Left = 389
Left = 401
Top = 2
Action = acFlat
DropdownMenu = pmFlatViewSettings
Style = tbsDropDown
end
object tbNoDraw: TToolButton
Left = 320
Left = 332
Top = 2
Action = acNoDraw
Style = tbsCheck
@ -1014,12 +1011,12 @@ object frmMain: TfrmMain
Action = acUndo
end
object tbLightlevel: TToolButton
Left = 366
Left = 378
Top = 2
Action = acLightlevel
end
object tbWalkable: TToolButton
Left = 343
Left = 355
Top = 2
Action = acWalkable
Style = tbsCheck
@ -2701,6 +2698,13 @@ object frmMain: TfrmMain
OnExecute = acWalkableExecute
ShortCut = 16471
end
object acStatics: TAction
Category = 'Settings'
Checked = True
Hint = 'Show Statics'
ImageIndex = 11
OnExecute = acStaticsExecute
end
end
object tmGrabTileInfo: TTimer
Enabled = False
@ -2739,4 +2743,51 @@ object frmMain: TfrmMain
left = 368
top = 208
end
object pmViewStaticSettings: TPopupMenu
Images = ImageList1
left = 584
top = 33
object mnuShowWalls: TMenuItem
AutoCheck = True
Caption = 'Walls and Windows'
Checked = True
Hint = 'Display walls and windows'
OnClick = mnuShowWallsClick
end
object mnuShowBridges: TMenuItem
AutoCheck = True
Caption = 'Stairs'
Checked = True
Hint = 'Display ladders, bridges and other objects on which you can climb / descend'
OnClick = mnuShowWallsClick
end
object mnuShowSurfaces: TMenuItem
AutoCheck = True
Caption = 'Surfaces'
Checked = True
Hint = 'Show floors and other surfaces on which you can walk'
OnClick = mnuShowWallsClick
end
object mnuShowRoofs: TMenuItem
AutoCheck = True
Caption = 'Roofs'
Checked = True
Hint = 'Display roofs'
OnClick = mnuShowWallsClick
end
object mnuShowFoliage: TMenuItem
AutoCheck = True
Caption = 'Foliage'
Checked = True
Hint = 'Display the leaves on the trees'
OnClick = mnuShowWallsClick
end
object mnuShowWater: TMenuItem
AutoCheck = True
Caption = 'Water'
Checked = True
Hint = 'Display the water'
OnClick = mnuShowWallsClick
end
end
end

View File

@ -21,7 +21,8 @@
* CDDL HEADER END
*
*
* Portions Copyright 2011 Andreas Schneider
* Portions Copyright 2015 Andreas Schneider
* Portions Copyright 2015 StaticZ
*)
unit UfrmMain;
@ -36,7 +37,7 @@ uses
LCLIntf, UOverlayUI, UStatics, UEnhancedMemoryStream, ActnList,
XMLPropStorage, ImagingClasses, dateutils, UPlatformTypes, UMap, UPacket,
UGLFont, DOM, XMLRead, XMLWrite, strutils, ULightManager, heContnrs,
UContnrExt;
UContnrExt, UTiledata;
type
TAccessChangedListener = procedure(AAccessLevel: TAccessLevel) of object;
@ -72,6 +73,7 @@ type
acFlat: TAction;
acNoDraw: TAction;
acLightlevel: TAction;
acStatics: TAction;
acWalkable: TAction;
acUndo: TAction;
acVirtualLayer: TAction;
@ -104,6 +106,12 @@ type
lbClients: TListBox;
MainMenu1: TMainMenu;
mnuChangePassword: TMenuItem;
mnuShowBridges: TMenuItem;
mnuShowFoliage: TMenuItem;
mnuShowRoofs: TMenuItem;
mnuShowSurfaces: TMenuItem;
mnuShowWalls: TMenuItem;
mnuShowWater: TMenuItem;
mnuWhiteBackground: TMenuItem;
mnuSecurityQuestion: TMenuItem;
mnuShowAnimations: TMenuItem;
@ -138,6 +146,7 @@ type
oglGameWindow: TOpenGLControl;
pcLeft: TPageControl;
pmGrabTileInfo: TPopupMenu;
pmViewStaticSettings: TPopupMenu;
pnlBottom: TPanel;
edX: TSpinEdit;
edY: TSpinEdit;
@ -194,6 +203,7 @@ type
procedure acMoveExecute(Sender: TObject);
procedure acNoDrawExecute(Sender: TObject);
procedure acSelectExecute(Sender: TObject);
procedure acStaticsExecute(Sender: TObject);
procedure acUndoExecute(Sender: TObject);
procedure acVirtualLayerExecute(Sender: TObject);
procedure acWalkableExecute(Sender: TObject);
@ -236,6 +246,7 @@ type
procedure mnuLargeScaleCommandsClick(Sender: TObject);
procedure mnuRegionControlClick(Sender: TObject);
procedure mnuShowAnimationsClick(Sender: TObject);
procedure mnuShowWallsClick(Sender: TObject);
procedure mnuShutdownClick(Sender: TObject);
procedure mnuWhiteBackgroundClick(Sender: TObject);
procedure oglGameWindowDblClick(Sender: TObject);
@ -257,7 +268,6 @@ type
procedure tbFilterMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure tbRadarMapClick(Sender: TObject);
procedure tbStaticsClick(Sender: TObject);
procedure tbTerrainClick(Sender: TObject);
procedure tmGrabTileInfoTimer(Sender: TObject);
procedure tmMovementTimer(Sender: TObject);
@ -337,6 +347,7 @@ type
FSelectionListeners: TSelectionListeners;
FTileHint: TTileHintInfo;
FLightManager: TLightManager;
FTileFilter: TTileDataFlags;
{ Methods }
procedure BuildTileList;
function ConfirmAction: Boolean;
@ -404,7 +415,7 @@ var
implementation
uses
UdmNetwork, UArt, UTiledata, UAdminHandling, UPackets,
UdmNetwork, UArt, UAdminHandling, UPackets,
UfrmAccountControl, UGraphicHelper, ImagingComponents, UfrmDrawSettings,
UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings,
UfrmAbout, UPacketHandlers, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand,
@ -514,6 +525,27 @@ begin
RebuildScreenBuffer;
end;
procedure TfrmMain.mnuShowWallsClick(Sender: TObject);
begin
// Update filters. First, start off empty.
FTileFilter := [];
if not mnuShowWalls.Checked then
FTileFilter := FTileFilter + [tdfWall, tdfWindow];
if not mnuShowBridges.Checked then
FTileFilter := FTileFilter + [tdfBridge, tdfStairBack, tdfStairRight];
if not mnuShowRoofs.Checked then
FTileFilter := FTileFilter + [tdfRoof];
if not mnuShowSurfaces.Checked then
FTileFilter := FTileFilter + [tdfSurface];
if not mnuShowFoliage.Checked then
FTileFilter := FTileFilter + [tdfFoliage];
if not mnuShowWater.Checked then
FTileFilter := FTileFilter + [tdfWet];
// Refresh screen
RebuildScreenBuffer;
end;
procedure TfrmMain.mnuShutdownClick(Sender: TObject);
begin
dmNetwork.Send(TQuitServerPacket.Create(''));
@ -1138,6 +1170,12 @@ begin
ProcessToolState;
end;
procedure TfrmMain.acStaticsExecute(Sender: TObject);
begin
acStatics.Checked := not acStatics.Checked;
RebuildScreenBuffer;
end;
procedure TfrmMain.acUndoExecute(Sender: TObject);
var
packet: TPacket;
@ -1492,11 +1530,6 @@ begin
frmRadarMap.BringToFront;
end;
procedure TfrmMain.tbStaticsClick(Sender: TObject);
begin
RebuildScreenBuffer;
end;
procedure TfrmMain.tbTerrainClick(Sender: TObject);
begin
RebuildScreenBuffer;
@ -2736,8 +2769,8 @@ begin
//Logger.Send([lcClient, lcDebug], 'VirtualTiles', FVirtualTiles.Count);
FLandscape.FillDrawList(FScreenBuffer, FX + FLowOffsetX, FY + FLowOffsetY,
FRangeX, FRangeY, tbTerrain.Down, tbStatics.Down, acNoDraw.Checked,
FVirtualTiles);
FRangeX, FRangeY, tbTerrain.Down, acStatics.Checked, acNoDraw.Checked,
FVirtualTiles, FTileFilter);
//Pre-process the buffer
blockInfo := nil;