* 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"/> <UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/> <AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="7"/> <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"/> <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> </VersionInfo>
<BuildModes Count="7"> <BuildModes Count="7">

View File

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

View File

@ -947,18 +947,15 @@ object frmMain: TfrmMain
end end
object tbStatics: TToolButton object tbStatics: TToolButton
Left = 297 Left = 297
Hint = 'Show Statics'
Top = 2 Top = 2
Caption = 'Statics' Action = acStatics
Down = True DropdownMenu = pmViewStaticSettings
ImageIndex = 11
OnClick = tbStaticsClick
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
Style = tbsCheck Style = tbsDropDown
end end
object tbSeparator5: TToolButton object tbSeparator5: TToolButton
Left = 424 Left = 436
Height = 22 Height = 22
Top = 2 Top = 2
Width = 5 Width = 5
@ -966,7 +963,7 @@ object frmMain: TfrmMain
Style = tbsDivider Style = tbsDivider
end end
object tbRadarMap: TToolButton object tbRadarMap: TToolButton
Left = 429 Left = 441
Hint = 'Radar Map' Hint = 'Radar Map'
Top = 2 Top = 2
Caption = 'Radar Map' Caption = 'Radar Map'
@ -988,14 +985,14 @@ object frmMain: TfrmMain
Style = tbsCheck Style = tbsCheck
end end
object tbFlat: TToolButton object tbFlat: TToolButton
Left = 389 Left = 401
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 = 320 Left = 332
Top = 2 Top = 2
Action = acNoDraw Action = acNoDraw
Style = tbsCheck Style = tbsCheck
@ -1014,12 +1011,12 @@ object frmMain: TfrmMain
Action = acUndo Action = acUndo
end end
object tbLightlevel: TToolButton object tbLightlevel: TToolButton
Left = 366 Left = 378
Top = 2 Top = 2
Action = acLightlevel Action = acLightlevel
end end
object tbWalkable: TToolButton object tbWalkable: TToolButton
Left = 343 Left = 355
Top = 2 Top = 2
Action = acWalkable Action = acWalkable
Style = tbsCheck Style = tbsCheck
@ -2701,6 +2698,13 @@ object frmMain: TfrmMain
OnExecute = acWalkableExecute OnExecute = acWalkableExecute
ShortCut = 16471 ShortCut = 16471
end end
object acStatics: TAction
Category = 'Settings'
Checked = True
Hint = 'Show Statics'
ImageIndex = 11
OnExecute = acStaticsExecute
end
end end
object tmGrabTileInfo: TTimer object tmGrabTileInfo: TTimer
Enabled = False Enabled = False
@ -2739,4 +2743,51 @@ object frmMain: TfrmMain
left = 368 left = 368
top = 208 top = 208
end 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 end

View File

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