- 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;
@ -859,9 +858,6 @@ begin
for y := AY to AY + AWidth do for y := AY to AY + AWidth do
begin begin
if AMap then if AMap then
begin
landAlt := GetLandAlt(x, y, 0);
if (landAlt >= AMinZ) and (landAlt <= AMaxZ) then
begin begin
drawMapCell := GetMapCell(x, y); drawMapCell := GetMapCell(x, y);
if (drawMapCell <> nil) and (ANoDraw or (drawMapCell.TileID > 2)) then if (drawMapCell <> nil) and (ANoDraw or (drawMapCell.TileID > 2)) then
@ -872,15 +868,12 @@ begin
tempDrawList.Add(drawMapCell); tempDrawList.Add(drawMapCell);
end; end;
end; end;
end;
if AStatics then if AStatics then
begin 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
(TStaticItem(drawStatics[i]).Z <= AMaxZ) then
begin begin
TStaticItem(drawStatics[i]).UpdatePriorities( TStaticItem(drawStatics[i]).UpdatePriorities(
ResMan.Tiledata.StaticTiles[TStaticItem(drawStatics[i]).TileID], ResMan.Tiledata.StaticTiles[TStaticItem(drawStatics[i]).TileID],

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