- Added optional highlight for (un)walkable tiles
- Fixed lightmanager to draw in the correct color - Fixed TMapBlock and TStaticBlock to correctly initialize itself as "unchanged" - Cleanup in the server project
This commit is contained in:
parent
f2764e928e
commit
d461774816
|
@ -251,6 +251,7 @@ type
|
|||
end;
|
||||
|
||||
TScreenState = (ssNormal, ssFiltered, ssGhost);
|
||||
TWalkRestriction = (wrNone, wrCanWalk, wrCannotWalk);
|
||||
|
||||
PBlockInfo = ^TBlockInfo;
|
||||
TBlockInfo = record
|
||||
|
@ -266,6 +267,7 @@ type
|
|||
HueOverride: Boolean;
|
||||
CheckRealQuad: Boolean;
|
||||
Translucent: Boolean;
|
||||
WalkRestriction: TWalkRestriction;
|
||||
Text: TGLText;
|
||||
Next: PBlockInfo;
|
||||
end;
|
||||
|
|
|
@ -304,6 +304,8 @@ begin
|
|||
if not FInitialized then
|
||||
InitGL;
|
||||
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
if not FValid then
|
||||
UpdateOverlay(AScreenRect);
|
||||
|
||||
|
|
|
@ -967,14 +967,14 @@ object frmMain: TfrmMain
|
|||
OnClick = tbStaticsClick
|
||||
end
|
||||
object tbSeparator5: TToolButton
|
||||
Left = 438
|
||||
Left = 461
|
||||
Top = 2
|
||||
Width = 17
|
||||
Caption = 'tbSeparator5'
|
||||
Style = tbsDivider
|
||||
end
|
||||
object tbRadarMap: TToolButton
|
||||
Left = 455
|
||||
Left = 478
|
||||
Hint = 'Radar Map'
|
||||
Top = 2
|
||||
Caption = 'Radar Map'
|
||||
|
@ -996,7 +996,7 @@ object frmMain: TfrmMain
|
|||
OnMouseMove = tbFilterMouseMove
|
||||
end
|
||||
object tbFlat: TToolButton
|
||||
Left = 403
|
||||
Left = 426
|
||||
Top = 2
|
||||
Action = acFlat
|
||||
DropdownMenu = pmFlatViewSettings
|
||||
|
@ -1020,11 +1020,17 @@ object frmMain: TfrmMain
|
|||
Top = 2
|
||||
Action = acUndo
|
||||
end
|
||||
object ToolButton1: TToolButton
|
||||
Left = 380
|
||||
object tbLightlevel: TToolButton
|
||||
Left = 403
|
||||
Top = 2
|
||||
Action = acLightlevel
|
||||
end
|
||||
object tbWalkable: TToolButton
|
||||
Left = 380
|
||||
Top = 2
|
||||
Action = acWalkable
|
||||
Style = tbsCheck
|
||||
end
|
||||
end
|
||||
object pnlChatHeader: TPanel
|
||||
AnchorSideLeft.Control = pnlChat
|
||||
|
@ -1465,7 +1471,7 @@ object frmMain: TfrmMain
|
|||
left = 264
|
||||
top = 32
|
||||
Bitmap = {
|
||||
4C69160000001000000010000000000000000000000000000000000000000000
|
||||
4C69170000001000000010000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000D9A781FFD39E76FF00000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000ECBEA1FFE7BB9DFFE4B697FFE0B292FFDAAE
|
||||
|
@ -2169,7 +2175,39 @@ object frmMain: TfrmMain
|
|||
FF0088A7BB5D485055F5444545FE3F4141FE3F474AF67D9CB16AFFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF006D9CD4896A9AD2FB6697CFEEFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00709ED6DB6D9C
|
||||
D4FF85B1DAFF5A91B9FF6093CBEAFFFFFF00FFFFFF00808080FF7E7E7EFF7C7C
|
||||
7CFF7A7A7AFF777777FF757575FF727272FF719ED4FF6F9ED6FF87B2DCFFABD3
|
||||
E8FFA9D0E6FF5890B8FF598EC6EAFFFFFF00FFFFFF007D7D7DFF999999FF9999
|
||||
99FF9A9A9AFF9A9A9AFF9B9B9BFF9B9B9BFF6F9DD3FFAAD1E7FFABD1E7FF98C7
|
||||
E1FF91C2DEFF568FB7FF5289C1EAFFFFFF00FFFFFF007A7A7AFF999999FF5291
|
||||
59FF999A99FF9B9B9BFF9C9C9CFF9C9C9CFF6C9AD0FFA7CEE5FF8FC1DFFF89BD
|
||||
DCFF8BBDDCFF538DB6FF4B84BCEAFFFFFF00FFFFFF00777777FF9A9A9AFF3D8A
|
||||
45FF498A4FFF9C9C9CFF9D9D9DFF9D9D9DFF6696CCFFA2CBE3FF89BDDCFF83B9
|
||||
DAFF84B9DAFF518BB5FF437EB6EA44944DFF42914BFF3F8D48FF3D8945FF5DA4
|
||||
65FF5AA061FF45834BFF9E9E9EFF9E9E9EFF6092C9FF9EC7E2FF83B8DAFF7DB4
|
||||
D7FF7EB3D7FF4F89B4FF3B79B1EA41904AFF94D29FFF91D09AFF8DCD96FF89CB
|
||||
92FF84C88DFF519858FF417C46FF9F9F9FFF5A8EC4FF98C3E0FF7CB3D7FF74AF
|
||||
D6FF5EC4EDFF4B88B3FF3473ABEA3E8B46FF8FCE99FF7DC687FF78C381FF73C0
|
||||
7CFF74C07CFF79C281FF49904FFF547F57FF5489BFFF94BFDDFF75ADD4FF63B8
|
||||
E1FF4BD4FFFF428BB8FF2C6EA6EA3B8742FF89CB92FF84C88DFF80C688FF7BC3
|
||||
83FF77C17FFF478F4DFF3B743FFFA1A1A1FF4C84BAFF8DBBDBFF6EA8D1FF66A6
|
||||
D1FF5FB4DFFF4785B1FF2569A1EA37823EFF347E3BFF317937FF2E7534FF4991
|
||||
50FF468F4CFF39733DFFA1A1A1FFA2A2A2FF457EB4FF88B7D9FF67A3CFFF619E
|
||||
CCFF639FCCFF4583B1FF1F649CEAFFFFFF00FFFFFF00606060FFA0A0A0FF3D76
|
||||
41FF367139FFA2A2A2FFA2A2A2FFA3A3A3FF3D79B0FF82B3D7FF629FCCFF5A9A
|
||||
C9FF5E9BCAFF4381AFFF196098EAFFFFFF00FFFFFF005C5C5CFFA1A1A1FF3C73
|
||||
40FFA0A1A1FFA3A3A3FFA3A3A3FFA4A4A4FF3674AAFF7DAFD4FF5B9AC9FF5495
|
||||
C7FF5896C8FF4180AEFF135C94EAFFFFFF00FFFFFF00585858FFA2A2A2FFA2A2
|
||||
A2FFA3A3A3FFA4A4A4FFA4A4A4FFA5A5A5FF2F6FA5FF78ABD2FF78ABD3FF73A7
|
||||
D1FF69A0CDFF407FAEFF0F5991EA999999FF717171FF545454FF515151FF4F4F
|
||||
4FFF4C4C4CFF4A4A4AFF474747FF454545FF25679DFF3274A8FF3D7CAFFF4784
|
||||
B5FF4E8ABAFF3E7EADFF0C578FEAFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF001D639B1619609839145D9562105A
|
||||
92880D5890A4135C92FC0C578FED
|
||||
}
|
||||
end
|
||||
object pmTileList: TPopupMenu
|
||||
|
@ -2657,6 +2695,15 @@ object frmMain: TfrmMain
|
|||
ImageIndex = 21
|
||||
OnExecute = acLightlevelExecute
|
||||
end
|
||||
object acWalkable: TAction
|
||||
Category = 'Settings'
|
||||
AutoCheck = True
|
||||
Caption = 'Walkable'
|
||||
Hint = 'Highlight (un)walkable surfaces'
|
||||
ImageIndex = 22
|
||||
OnExecute = acWalkableExecute
|
||||
ShortCut = 16471
|
||||
end
|
||||
end
|
||||
object tmGrabTileInfo: TTimer
|
||||
Enabled = False
|
||||
|
|
|
@ -69,6 +69,7 @@ type
|
|||
acFlat: TAction;
|
||||
acNoDraw: TAction;
|
||||
acLightlevel: TAction;
|
||||
acWalkable: TAction;
|
||||
acUndo: TAction;
|
||||
acVirtualLayer: TAction;
|
||||
ActionList1: TActionList;
|
||||
|
@ -149,7 +150,8 @@ type
|
|||
tbNoDraw: TToolButton;
|
||||
tbSeparator2: TToolButton;
|
||||
tbUndo: TToolButton;
|
||||
ToolButton1: TToolButton;
|
||||
tbLightlevel: TToolButton;
|
||||
tbWalkable: TToolButton;
|
||||
tsLocations: TTabSheet;
|
||||
tbSetHue: TToolButton;
|
||||
tmGrabTileInfo: TTimer;
|
||||
|
@ -190,6 +192,7 @@ type
|
|||
procedure acSelectExecute(Sender: TObject);
|
||||
procedure acUndoExecute(Sender: TObject);
|
||||
procedure acVirtualLayerExecute(Sender: TObject);
|
||||
procedure acWalkableExecute(Sender: TObject);
|
||||
procedure ApplicationProperties1Idle(Sender: TObject; var Done: Boolean);
|
||||
procedure ApplicationProperties1ShowHint(var HintStr: string;
|
||||
var CanShow: Boolean; var HintInfo: THintInfo);
|
||||
|
@ -525,6 +528,9 @@ end;
|
|||
procedure TfrmMain.oglGameWindowKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
if Shift <> [] then
|
||||
Exit;
|
||||
|
||||
case Key of
|
||||
VK_W, VK_NUMPAD8, VK_UP:
|
||||
MoveBy(-8, -8);
|
||||
|
@ -1125,6 +1131,12 @@ begin
|
|||
frmVirtualLayer.Show;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.acWalkableExecute(Sender: TObject);
|
||||
begin
|
||||
InvalidateFilter;
|
||||
FRepaintNeeded := True;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.acDrawExecute(Sender: TObject);
|
||||
begin
|
||||
acDraw.Checked := True;
|
||||
|
@ -2311,7 +2323,7 @@ end;
|
|||
procedure TfrmMain.Render;
|
||||
var
|
||||
highlight: Boolean;
|
||||
intensity: GLfloat;
|
||||
intensity, red, green, blue: GLfloat;
|
||||
blockInfo: PBlockInfo;
|
||||
item: TWorldItem;
|
||||
begin
|
||||
|
@ -2345,10 +2357,31 @@ begin
|
|||
SetDarkLights;
|
||||
end;
|
||||
|
||||
case blockInfo^.WalkRestriction of
|
||||
wrNone:
|
||||
begin
|
||||
red := 1;
|
||||
green := 1;
|
||||
blue := 1;
|
||||
end;
|
||||
wrCanWalk:
|
||||
begin
|
||||
red := 0.5;
|
||||
green := 1;
|
||||
blue := 0.5;
|
||||
end;
|
||||
wrCannotWalk:
|
||||
begin
|
||||
red := 1;
|
||||
green := 0.5;
|
||||
blue := 0.5;
|
||||
end;
|
||||
end;
|
||||
|
||||
if blockInfo^.Translucent then
|
||||
glColor4f(intensity, intensity, intensity, 0.8)
|
||||
glColor4f(intensity * red, intensity * green, intensity * blue, 0.8)
|
||||
else
|
||||
glColor4f(intensity, intensity, intensity, 1.0);
|
||||
glColor4f(intensity * red, intensity * green, intensity * blue, 1.0);
|
||||
|
||||
highlight := blockInfo^.Highlighted and item.CanBeEdited;
|
||||
|
||||
|
@ -2362,7 +2395,7 @@ begin
|
|||
begin
|
||||
glBindTexture(GL_TEXTURE_2D, blockInfo^.HighRes.Texture);
|
||||
|
||||
if not highlight then
|
||||
if not highlight and (blockInfo^.WalkRestriction = wrNone) then
|
||||
glEnable(GL_LIGHTING);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
@ -2376,7 +2409,7 @@ begin
|
|||
glTexCoord2i(1, 0); glVertex2iv(@blockInfo^.DrawQuad[1]);
|
||||
glEnd;
|
||||
|
||||
if not highlight then
|
||||
if not highlight and (blockInfo^.WalkRestriction = wrNone) then
|
||||
glDisable(GL_LIGHTING);
|
||||
end else
|
||||
begin
|
||||
|
@ -2722,8 +2755,13 @@ end;
|
|||
procedure TfrmMain.UpdateFilter;
|
||||
var
|
||||
blockInfo: PBlockInfo;
|
||||
tileData: TTiledata;
|
||||
staticTileData: TStaticTileData;
|
||||
lastSurface: PBlockInfo;
|
||||
surfaceTop: Integer;
|
||||
begin
|
||||
blockInfo := nil;
|
||||
lastSurface := nil;
|
||||
while FScreenBuffer.Iterate(blockInfo) do
|
||||
begin
|
||||
if blockInfo^.State in [ssNormal, ssFiltered] then
|
||||
|
@ -2739,8 +2777,56 @@ begin
|
|||
begin
|
||||
blockInfo^.State := ssFiltered;
|
||||
end;
|
||||
|
||||
blockInfo^.WalkRestriction := wrNone;
|
||||
if acWalkable.Checked then
|
||||
begin
|
||||
if blockInfo^.Item is TMapCell then
|
||||
begin
|
||||
tileData := ResMan.Tiledata.LandTiles[blockInfo^.Item.TileID];
|
||||
if tdfImpassable in tileData.Flags then
|
||||
begin
|
||||
blockInfo^.WalkRestriction := wrCannotWalk;
|
||||
lastSurface := nil;
|
||||
end else
|
||||
begin
|
||||
blockInfo^.WalkRestriction := wrCanWalk;
|
||||
lastSurface := blockInfo;
|
||||
surfaceTop := blockInfo^.Item.Z;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
staticTileData := ResMan.Tiledata.StaticTiles[blockInfo^.Item.TileID];
|
||||
if (lastSurface <> nil) and (lastSurface^.WalkRestriction = wrCanWalk) and
|
||||
(lastSurface^.Item.X = blockInfo^.Item.X) and
|
||||
(lastSurface^.Item.Y = blockInfo^.Item.Y) and ([tdfSurface,
|
||||
tdfImpassable] * staticTileData.Flags <> []) then
|
||||
begin
|
||||
if (blockInfo^.Item.Z < surfaceTop + 16) and
|
||||
((blockInfo^.Item.Z > lastSurface^.Item.Z + 2) or
|
||||
not (tdfSurface in staticTileData.Flags)) then
|
||||
lastSurface^.WalkRestriction := wrCannotWalk;
|
||||
end;
|
||||
|
||||
if tdfSurface in staticTileData.Flags then
|
||||
begin
|
||||
if tdfImpassable in staticTileData.Flags then
|
||||
begin
|
||||
blockInfo^.WalkRestriction := wrCannotWalk;
|
||||
lastSurface := nil;
|
||||
end else
|
||||
begin
|
||||
blockInfo^.WalkRestriction := wrCanWalk;
|
||||
lastSurface := blockInfo;
|
||||
surfaceTop := blockInfo^.Item.Z + staticTileData.Height;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end; //acWalkable.Checked
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
Include(FScreenBufferState, sbsFiltered);
|
||||
|
||||
if (FLightManager.LightLevel > 0) and not acFlat.Checked then
|
||||
|
|
|
@ -30,7 +30,7 @@ unit ULandscape;
|
|||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, math, UGenericIndex, UMap, UStatics, UWorldItem, UMulBlock,
|
||||
SysUtils, Classes, math, UGenericIndex, UMap, UStatics, UWorldItem,
|
||||
UTileDataProvider, URadarMap,
|
||||
UCacheManager, ULinkedList, UBufferedStreams,
|
||||
UEnhancedMemoryStream, UPacketHandlers, UPackets, UNetState, UEnums;
|
||||
|
@ -207,6 +207,7 @@ begin
|
|||
end;
|
||||
block.Free;
|
||||
end;
|
||||
FChanged := False;
|
||||
end;
|
||||
|
||||
constructor TSeperatedStaticBlock.Create(AData: TStream; AIndex: TGenericIndex);
|
||||
|
@ -558,7 +559,7 @@ end;
|
|||
|
||||
procedure TLandscape.SaveBlock(AWorldBlock: TWorldBlock);
|
||||
var
|
||||
i, j, size: Integer;
|
||||
size: Integer;
|
||||
index: TGenericIndex;
|
||||
begin
|
||||
if AWorldBlock is TMapBlock then
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<PackageName Value="lnetbase"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="15">
|
||||
<Units Count="16">
|
||||
<Unit0>
|
||||
<Filename Value="cedserver.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
|
@ -118,6 +118,11 @@
|
|||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="UStatics"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="../UOLib/UMap.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="UMap"/>
|
||||
</Unit15>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
|
|
@ -31,9 +31,7 @@ uses
|
|||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
SysUtils, Classes, lnetbase, UConfig, UCEDServer, URadarMap,
|
||||
ULargeScaleOperations, UPackets, UAdminHandling, UClientHandling, ULandscape,
|
||||
UPacketHandlers, URegions, UStatics, Logging;
|
||||
SysUtils, UConfig, UCEDServer;
|
||||
|
||||
{$I version.inc}
|
||||
|
||||
|
|
|
@ -173,8 +173,9 @@ begin
|
|||
for iX := 0 to 7 do
|
||||
Cells[iY * 8 + iX] := TMapCell.Create(Self, buffer, AX * 8 + iX, AY * 8 + iY);
|
||||
finally
|
||||
if Assigned(buffer) then FreeAndNil(buffer);
|
||||
buffer.Free;
|
||||
end;
|
||||
FChanged := False;
|
||||
end;
|
||||
|
||||
constructor TMapBlock.Create(AData: TStream);
|
||||
|
|
|
@ -189,6 +189,7 @@ begin
|
|||
FItems.Add(TStaticItem.Create(Self, block, AX, AY));
|
||||
block.Free;
|
||||
end;
|
||||
FChanged := False;
|
||||
end;
|
||||
|
||||
constructor TStaticBlock.Create(AData: TStream; AIndex: TGenericIndex);
|
||||
|
|
Loading…
Reference in New Issue