- Fixed static tiles to be added several times (due to ghost tile replication)
- Added more debug info to UfrmMain
This commit is contained in:
parent
b223f44721
commit
a5082879fe
|
@ -295,12 +295,13 @@
|
||||||
<CodeGeneration>
|
<CodeGeneration>
|
||||||
<SmartLinkUnit Value="True"/>
|
<SmartLinkUnit Value="True"/>
|
||||||
<Optimizations>
|
<Optimizations>
|
||||||
<OptimizationLevel Value="3"/>
|
<OptimizationLevel Value="0"/>
|
||||||
</Optimizations>
|
</Optimizations>
|
||||||
</CodeGeneration>
|
</CodeGeneration>
|
||||||
<Linking>
|
<Linking>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<UseLineInfoUnit Value="False"/>
|
<GenerateDebugInfo Value="True"/>
|
||||||
|
<UseHeaptrc Value="True"/>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
<LinkSmart Value="True"/>
|
<LinkSmart Value="True"/>
|
||||||
<Options>
|
<Options>
|
||||||
|
|
|
@ -463,23 +463,28 @@ end;
|
||||||
procedure TfrmMain.oglGameWindowMouseDown(Sender: TObject;
|
procedure TfrmMain.oglGameWindowMouseDown(Sender: TObject;
|
||||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
if Button = mbRight then
|
Logger.EnterMethod([lcClient, lcDebug], 'MouseDown');
|
||||||
pmTools.PopUp(Mouse.CursorPos.X, Mouse.CursorPos.Y);
|
try
|
||||||
|
if Button = mbRight then
|
||||||
|
pmTools.PopUp(Mouse.CursorPos.X, Mouse.CursorPos.Y);
|
||||||
|
|
||||||
if Button <> mbLeft then
|
if Button <> mbLeft then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
UpdateCurrentTile(X, Y);
|
UpdateCurrentTile(X, Y);
|
||||||
if FOverlayUI.ActiveArrow > -1 then
|
if FOverlayUI.ActiveArrow > -1 then
|
||||||
tmMovement.Enabled := True;
|
tmMovement.Enabled := True;
|
||||||
|
|
||||||
SelectedTile := CurrentTile;
|
SelectedTile := CurrentTile;
|
||||||
if CurrentTile = nil then Exit;
|
if CurrentTile = nil then Exit;
|
||||||
|
|
||||||
if acSelect.Checked then //***** Selection Mode *****//
|
if acSelect.Checked then //***** Selection Mode *****//
|
||||||
tmGrabTileInfo.Enabled := True;
|
tmGrabTileInfo.Enabled := True;
|
||||||
|
|
||||||
FRepaintNeeded := True;
|
FRepaintNeeded := True;
|
||||||
|
finally
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'MouseDown');
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.oglGameWindowMouseEnter(Sender: TObject);
|
procedure TfrmMain.oglGameWindowMouseEnter(Sender: TObject);
|
||||||
|
@ -518,6 +523,7 @@ var
|
||||||
lastTile: TWorldItem;
|
lastTile: TWorldItem;
|
||||||
offsetX, offsetY: Integer;
|
offsetX, offsetY: Integer;
|
||||||
begin
|
begin
|
||||||
|
Logger.EnterMethod([lcClient, lcDebug], 'MouseMove');
|
||||||
lastTile := CurrentTile;
|
lastTile := CurrentTile;
|
||||||
|
|
||||||
if ssMiddle in Shift then
|
if ssMiddle in Shift then
|
||||||
|
@ -528,13 +534,14 @@ begin
|
||||||
offsetX := lastTile.X - CurrentTile.X;
|
offsetX := lastTile.X - CurrentTile.X;
|
||||||
offsetY := lastTile.Y - CurrentTile.Y;
|
offsetY := lastTile.Y - CurrentTile.Y;
|
||||||
if InRange(offsetX, -8, 8) and InRange(offsetY, -8, 8) then
|
if InRange(offsetX, -8, 8) and InRange(offsetY, -8, 8) then
|
||||||
SetPos(FX - offsetX * 4, FY - offsetY * 4);
|
SetPos(FX - offsetX, FY - offsetY);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
UpdateCurrentTile(X, Y);
|
UpdateCurrentTile(X, Y);
|
||||||
|
|
||||||
FRepaintNeeded := True;
|
FRepaintNeeded := True;
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'MouseMove');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.oglGameWindowMouseUp(Sender: TObject; Button: TMouseButton;
|
procedure TfrmMain.oglGameWindowMouseUp(Sender: TObject; Button: TMouseButton;
|
||||||
|
@ -553,14 +560,19 @@ var
|
||||||
targetTiles: TWorldItemList;
|
targetTiles: TWorldItemList;
|
||||||
targetTile: TWorldItem;
|
targetTile: TWorldItem;
|
||||||
begin
|
begin
|
||||||
|
Logger.EnterMethod([lcClient, lcDebug], 'MouseUp');
|
||||||
if Button <> mbLeft then
|
if Button <> mbLeft then
|
||||||
|
begin
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'MouseUp');
|
||||||
Exit;
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
UpdateCurrentTile(X, Y);
|
UpdateCurrentTile(X, Y);
|
||||||
tmMovement.Enabled := False;
|
tmMovement.Enabled := False;
|
||||||
if CurrentTile = nil then
|
if CurrentTile = nil then
|
||||||
begin
|
begin
|
||||||
SelectedTile := nil;
|
SelectedTile := nil;
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'MouseUp');
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -594,6 +606,7 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Logger.Send([lcClient, lcDebug], 'Virtual tiles', FVirtualTiles.Count);
|
||||||
for i := 0 to FVirtualTiles.Count - 1 do
|
for i := 0 to FVirtualTiles.Count - 1 do
|
||||||
begin
|
begin
|
||||||
tile := FVirtualTiles[i];
|
tile := FVirtualTiles[i];
|
||||||
|
@ -711,12 +724,14 @@ begin
|
||||||
acUndo.Enabled := FUndoList.Count > 0;
|
acUndo.Enabled := FUndoList.Count > 0;
|
||||||
SelectedTile := nil;
|
SelectedTile := nil;
|
||||||
FRepaintNeeded := True;
|
FRepaintNeeded := True;
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'MouseUp');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.oglGameWindowMouseWheel(Sender: TObject; Shift: TShiftState;
|
procedure TfrmMain.oglGameWindowMouseWheel(Sender: TObject; Shift: TShiftState;
|
||||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||||
var
|
var
|
||||||
cursorNeedsUpdate: Boolean;
|
cursorNeedsUpdate: Boolean;
|
||||||
|
newZ: ShortInt;
|
||||||
begin
|
begin
|
||||||
//We want single steps ...
|
//We want single steps ...
|
||||||
WheelDelta := WheelDelta div WHEEL_DELTA;
|
WheelDelta := WheelDelta div WHEEL_DELTA;
|
||||||
|
@ -731,18 +746,26 @@ begin
|
||||||
Handled := True;
|
Handled := True;
|
||||||
end else if not (ssCtrl in Shift) then
|
end else if not (ssCtrl in Shift) then
|
||||||
begin
|
begin
|
||||||
|
FUndoList.Clear;
|
||||||
|
newZ := EnsureRange(CurrentTile.Z + WheelDelta, -128, 127);
|
||||||
if CurrentTile is TStaticItem then
|
if CurrentTile is TStaticItem then
|
||||||
begin
|
begin
|
||||||
|
FUndoList.Add(TElevateStaticPacket.Create(CurrentTile.X, CurrentTile.Y,
|
||||||
|
newZ, CurrentTile.TileID, TStaticItem(CurrentTile).Hue,
|
||||||
|
CurrentTile.Z));
|
||||||
dmNetwork.Send(TElevateStaticPacket.Create(TStaticItem(CurrentTile),
|
dmNetwork.Send(TElevateStaticPacket.Create(TStaticItem(CurrentTile),
|
||||||
EnsureRange(CurrentTile.Z + WheelDelta, -128, 127)));
|
newZ));
|
||||||
cursorNeedsUpdate := True;
|
cursorNeedsUpdate := True;
|
||||||
Handled := True;
|
Handled := True;
|
||||||
end else if CurrentTile is TMapCell then
|
end else if CurrentTile is TMapCell then
|
||||||
begin
|
begin
|
||||||
|
FUndoList.Add(TDrawMapPacket.Create(CurrentTile.X, CurrentTile.Y,
|
||||||
|
CurrentTile.Z, CurrentTile.TileID));
|
||||||
dmNetwork.Send(TDrawMapPacket.Create(CurrentTile.X, CurrentTile.Y,
|
dmNetwork.Send(TDrawMapPacket.Create(CurrentTile.X, CurrentTile.Y,
|
||||||
EnsureRange(CurrentTile.Z + WheelDelta, -128, 127), CurrentTile.TileID));
|
newZ, CurrentTile.TileID));
|
||||||
Handled := True;
|
Handled := True;
|
||||||
end;
|
end;
|
||||||
|
acUndo.Enabled := FUndoList.Count > 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if cursorNeedsUpdate then
|
if cursorNeedsUpdate then
|
||||||
|
@ -1661,8 +1684,13 @@ end;
|
||||||
|
|
||||||
procedure TfrmMain.SetCurrentTile(const AValue: TWorldItem);
|
procedure TfrmMain.SetCurrentTile(const AValue: TWorldItem);
|
||||||
begin
|
begin
|
||||||
|
Logger.EnterMethod([lcClient, lcDebug], 'SetCurrentTile');
|
||||||
if AValue = FCurrentTile then
|
if AValue = FCurrentTile then
|
||||||
|
begin
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'SetCurrentTile');
|
||||||
Exit;
|
Exit;
|
||||||
|
end;
|
||||||
|
Logger.Send([lcClient, lcDebug], 'Value', AValue);
|
||||||
|
|
||||||
if FCurrentTile <> nil then
|
if FCurrentTile <> nil then
|
||||||
FCurrentTile.OnDestroy.UnregisterEvent(@OnTileRemoved);
|
FCurrentTile.OnDestroy.UnregisterEvent(@OnTileRemoved);
|
||||||
|
@ -1687,12 +1715,18 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
UpdateSelection;
|
UpdateSelection;
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'SetCurrentTile');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.SetSelectedTile(const AValue: TWorldItem);
|
procedure TfrmMain.SetSelectedTile(const AValue: TWorldItem);
|
||||||
begin
|
begin
|
||||||
|
Logger.EnterMethod([lcClient, lcDebug], 'SetSelectedTile');
|
||||||
if AValue = FSelectedTile then
|
if AValue = FSelectedTile then
|
||||||
|
begin
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'SetSelectedTile');
|
||||||
Exit;
|
Exit;
|
||||||
|
end;
|
||||||
|
Logger.Send([lcClient, lcDebug], 'Value', AValue);
|
||||||
|
|
||||||
if FSelectedTile <> nil then
|
if FSelectedTile <> nil then
|
||||||
FSelectedTile.OnDestroy.UnregisterEvent(@OnTileRemoved);
|
FSelectedTile.OnDestroy.UnregisterEvent(@OnTileRemoved);
|
||||||
|
@ -1701,6 +1735,7 @@ begin
|
||||||
FSelectedTile.OnDestroy.RegisterEvent(@OnTileRemoved);
|
FSelectedTile.OnDestroy.RegisterEvent(@OnTileRemoved);
|
||||||
|
|
||||||
UpdateSelection;
|
UpdateSelection;
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'SetSelectedTile');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.SetNormalLights;
|
procedure TfrmMain.SetNormalLights;
|
||||||
|
@ -2282,10 +2317,13 @@ procedure TfrmMain.UpdateCurrentTile(AX, AY: Integer);
|
||||||
var
|
var
|
||||||
blockInfo: PBlockInfo;
|
blockInfo: PBlockInfo;
|
||||||
begin
|
begin
|
||||||
|
Logger.EnterMethod([lcClient, lcDebug], 'UpdateCurrentTile');
|
||||||
FOverlayUI.ActiveArrow := FOverlayUI.HitTest(AX, AY);
|
FOverlayUI.ActiveArrow := FOverlayUI.HitTest(AX, AY);
|
||||||
if FOverlayUI.ActiveArrow > -1 then
|
if FOverlayUI.ActiveArrow > -1 then
|
||||||
begin
|
begin
|
||||||
|
Logger.Send([lcClient, lcDebug], 'Overlay active');
|
||||||
CurrentTile := nil;
|
CurrentTile := nil;
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'UpdateCurrentTile');
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -2294,6 +2332,8 @@ begin
|
||||||
CurrentTile := blockInfo^.Item
|
CurrentTile := blockInfo^.Item
|
||||||
else
|
else
|
||||||
CurrentTile := nil;
|
CurrentTile := nil;
|
||||||
|
|
||||||
|
Logger.ExitMethod([lcClient, lcDebug], 'UpdateCurrentTile');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.UpdateFilter;
|
procedure TfrmMain.UpdateFilter;
|
||||||
|
@ -2480,7 +2520,8 @@ begin
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
Logger.Send([lcClient, lcDebug], 'Single Target');
|
Logger.Send([lcClient, lcDebug], 'Single Target');
|
||||||
if acDraw.Checked then
|
if acDraw.Checked and not IsInRect(CurrentTile.X, CurrentTile.Y,
|
||||||
|
FSelection) then
|
||||||
AddGhostTile(CurrentTile.X, CurrentTile.Y, CurrentTile);
|
AddGhostTile(CurrentTile.X, CurrentTile.Y, CurrentTile);
|
||||||
while FScreenBuffer.Iterate(blockInfo) do
|
while FScreenBuffer.Iterate(blockInfo) do
|
||||||
if blockInfo^.State = ssNormal then
|
if blockInfo^.State = ssNormal then
|
||||||
|
@ -2490,6 +2531,7 @@ begin
|
||||||
end;
|
end;
|
||||||
FSelection := selectedRect;
|
FSelection := selectedRect;
|
||||||
end;
|
end;
|
||||||
|
Logger.Send([lcClient, lcDebug], 'Virtual Tiles', FVirtualTiles.Count);
|
||||||
Logger.ExitMethod([lcClient, lcDebug], 'UpdateSelection');
|
Logger.ExitMethod([lcClient, lcDebug], 'UpdateSelection');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue