- Fixed TLandscape.FillDrawList to unnecessarily check upper/lower bounds

This commit is contained in:
Andreas Schneider 2009-10-02 18:10:21 +02:00
parent 6c9a474003
commit 7d038013b2
2 changed files with 18 additions and 26 deletions

View File

@ -178,8 +178,8 @@ type
write FOnStaticHued; write FOnStaticHued;
{ Methods } { Methods }
procedure FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth, procedure FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth,
AHeight: Word; AMinZ, AMaxZ: ShortInt; AMap, AStatics: Boolean; AHeight: Word; AMap, AStatics: Boolean; ANoDraw: Boolean;
ANoDraw: Boolean; AAdditionalTiles: TList = nil); AAdditionalTiles: TList = nil);
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);
@ -843,10 +843,9 @@ begin
end; end;
procedure TLandscape.FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth, procedure TLandscape.FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth,
AHeight: Word; AMinZ, AMaxZ: ShortInt; AMap, AStatics: Boolean; AHeight: Word; AMap, AStatics: Boolean; ANoDraw: Boolean;
ANoDraw: Boolean; AAdditionalTiles: TList = nil); AAdditionalTiles: TList = nil);
var var
landAlt: ShortInt;
drawMapCell: TMapCell; drawMapCell: TMapCell;
drawStatics: TList; drawStatics: TList;
i, x, y: Integer; i, x, y: Integer;
@ -860,17 +859,13 @@ begin
begin begin
if AMap then if AMap then
begin begin
landAlt := GetLandAlt(x, y, 0); drawMapCell := GetMapCell(x, y);
if (landAlt >= AMinZ) and (landAlt <= AMaxZ) then if (drawMapCell <> nil) and (ANoDraw or (drawMapCell.TileID > 2)) then
begin begin
drawMapCell := GetMapCell(x, y); drawMapCell.Priority := GetEffectiveAltitude(drawMapCell);
if (drawMapCell <> nil) and (ANoDraw or (drawMapCell.TileID > 2)) then drawMapCell.PriorityBonus := 0;
begin drawMapCell.PrioritySolver := 0;
drawMapCell.Priority := GetEffectiveAltitude(drawMapCell); tempDrawList.Add(drawMapCell);
drawMapCell.PriorityBonus := 0;
drawMapCell.PrioritySolver := 0;
tempDrawList.Add(drawMapCell);
end;
end; end;
end; end;
@ -879,14 +874,12 @@ begin
drawStatics := GetStaticList(x, y); drawStatics := GetStaticList(x, y);
if drawStatics <> nil then if drawStatics <> nil then
for i := 0 to drawStatics.Count - 1 do for i := 0 to drawStatics.Count - 1 do
if (TStaticItem(drawStatics[i]).Z >= AMinZ) and begin
(TStaticItem(drawStatics[i]).Z <= AMaxZ) then TStaticItem(drawStatics[i]).UpdatePriorities(
begin ResMan.Tiledata.StaticTiles[TStaticItem(drawStatics[i]).TileID],
TStaticItem(drawStatics[i]).UpdatePriorities( ADrawList.GetSerial);
ResMan.Tiledata.StaticTiles[TStaticItem(drawStatics[i]).TileID], tempDrawList.Add(drawStatics[i]);
ADrawList.GetSerial); end;
tempDrawList.Add(drawStatics[i]);
end;
end; end;
end; end;
end; end;

View File

@ -2373,9 +2373,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, frmBoundaries.tbMinZ.Position, FRangeX, FRangeY, tbTerrain.Down, tbStatics.Down, acNoDraw.Checked,
frmBoundaries.tbMaxZ.Position, tbTerrain.Down, tbStatics.Down, FVirtualTiles);
acNoDraw.Checked, FVirtualTiles);
//TODO : ghost tile //TODO : ghost tile
//Pre-process the buffer //Pre-process the buffer