- Added external nodraw definition
This commit is contained in:
parent
365fa72dc9
commit
1e84b76c63
|
@ -183,6 +183,7 @@ type
|
||||||
FOnStaticHued: TStaticChangedEvent;
|
FOnStaticHued: TStaticChangedEvent;
|
||||||
FOpenRequests: TBits;
|
FOpenRequests: TBits;
|
||||||
FWriteMap: TBits;
|
FWriteMap: TBits;
|
||||||
|
FDrawMap: TBits;
|
||||||
FMaxStaticID: Cardinal;
|
FMaxStaticID: Cardinal;
|
||||||
{ Methods }
|
{ Methods }
|
||||||
function GetMapBlock(AX, AY: Word): TMapBlock;
|
function GetMapBlock(AX, AY: Word): TMapBlock;
|
||||||
|
@ -228,6 +229,7 @@ type
|
||||||
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);
|
||||||
|
procedure LoadNoDrawMap(AFileName: String);
|
||||||
procedure MoveStatic(AStatic: TStaticItem; AX, AY: Word);
|
procedure MoveStatic(AStatic: TStaticItem; AX, AY: Word);
|
||||||
procedure PrepareBlocks(AX1, AY1, AX2, AY2: Word);
|
procedure PrepareBlocks(AX1, AY1, AX2, AY2: Word);
|
||||||
procedure UpdateBlockAccess;
|
procedure UpdateBlockAccess;
|
||||||
|
@ -601,6 +603,10 @@ begin
|
||||||
Logger.Send([lcClient, lcInfo], 'Landscape recognizes $%x StaticTile IDs.',
|
Logger.Send([lcClient, lcInfo], 'Landscape recognizes $%x StaticTile IDs.',
|
||||||
[FMaxStaticId]);
|
[FMaxStaticId]);
|
||||||
|
|
||||||
|
FDrawMap := TBits.Create($4000 + FMaxStaticID);
|
||||||
|
for i := 0 to FDrawMap.Size - 1 do
|
||||||
|
FDrawMap[i] := True;
|
||||||
|
|
||||||
RegisterPacketHandler($04, TPacketHandler.Create(0, @OnBlocksPacket));
|
RegisterPacketHandler($04, TPacketHandler.Create(0, @OnBlocksPacket));
|
||||||
RegisterPacketHandler($06, TPacketHandler.Create(8, @OnDrawMapPacket));
|
RegisterPacketHandler($06, TPacketHandler.Create(8, @OnDrawMapPacket));
|
||||||
RegisterPacketHandler($07, TPacketHandler.Create(10, @OnInsertStaticPacket));
|
RegisterPacketHandler($07, TPacketHandler.Create(10, @OnInsertStaticPacket));
|
||||||
|
@ -620,6 +626,7 @@ begin
|
||||||
|
|
||||||
FreeAndNil(FOpenRequests);
|
FreeAndNil(FOpenRequests);
|
||||||
FreeAndNil(FWriteMap);
|
FreeAndNil(FWriteMap);
|
||||||
|
FreeAndNil(FDrawMap);
|
||||||
|
|
||||||
RegisterPacketHandler($04, nil);
|
RegisterPacketHandler($04, nil);
|
||||||
RegisterPacketHandler($06, nil);
|
RegisterPacketHandler($06, nil);
|
||||||
|
@ -947,6 +954,7 @@ var
|
||||||
drawStatics: TStaticItemList;
|
drawStatics: TStaticItemList;
|
||||||
i, x, y: Integer;
|
i, x, y: Integer;
|
||||||
tempDrawList: TWorldItemList;
|
tempDrawList: TWorldItemList;
|
||||||
|
staticTileData: TStaticTiledata;
|
||||||
begin
|
begin
|
||||||
ADrawList.Clear;
|
ADrawList.Clear;
|
||||||
tempDrawList := TWorldItemList.Create(False);;
|
tempDrawList := TWorldItemList.Create(False);;
|
||||||
|
@ -957,7 +965,7 @@ begin
|
||||||
if AMap then
|
if AMap 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 FDrawMap[drawMapCell.TileID]) then
|
||||||
begin
|
begin
|
||||||
drawMapCell.Priority := GetEffectiveAltitude(drawMapCell);
|
drawMapCell.Priority := GetEffectiveAltitude(drawMapCell);
|
||||||
drawMapCell.PriorityBonus := 0;
|
drawMapCell.PriorityBonus := 0;
|
||||||
|
@ -972,14 +980,17 @@ begin
|
||||||
if drawStatics <> nil then
|
if drawStatics <> nil then
|
||||||
for i := 0 to drawStatics.Count - 1 do
|
for i := 0 to drawStatics.Count - 1 do
|
||||||
begin
|
begin
|
||||||
drawStatics[i].UpdatePriorities(
|
staticTileData := ResMan.Tiledata.StaticTiles[drawStatics[i].TileID];
|
||||||
ResMan.Tiledata.StaticTiles[drawStatics[i].TileID],
|
if ANoDraw or FDrawMap[drawStatics[i].TileID + $4000] then
|
||||||
|
begin
|
||||||
|
drawStatics[i].UpdatePriorities(staticTileData,
|
||||||
ADrawList.GetSerial);
|
ADrawList.GetSerial);
|
||||||
tempDrawList.Add(drawStatics[i]);
|
tempDrawList.Add(drawStatics[i]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
for i := 0 to AAdditionalTiles.Count - 1 do
|
for i := 0 to AAdditionalTiles.Count - 1 do
|
||||||
tempDrawList.Add(AAdditionalTiles[i]);
|
tempDrawList.Add(AAdditionalTiles[i]);
|
||||||
|
@ -1098,6 +1109,29 @@ begin
|
||||||
ANormals[3] := VectorNorm(VectorAdd(VectorAdd(VectorAdd(north, west), east), south));
|
ANormals[3] := VectorNorm(VectorAdd(VectorAdd(VectorAdd(north, west), east), south));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLandscape.LoadNoDrawMap(AFileName: String);
|
||||||
|
var
|
||||||
|
noDrawFile: TextFile;
|
||||||
|
line: String;
|
||||||
|
id: Integer;
|
||||||
|
begin
|
||||||
|
AssignFile(noDrawFile, AFileName);
|
||||||
|
Reset(noDrawFile);
|
||||||
|
while not EOF(noDrawFile) do
|
||||||
|
begin
|
||||||
|
ReadLn(noDrawFile, line);
|
||||||
|
if TryStrToInt(Copy(line, 2, Length(line)), id) then
|
||||||
|
begin
|
||||||
|
if line[1] = 'S' then
|
||||||
|
Inc(id, $4000);
|
||||||
|
|
||||||
|
if id < FDrawMap.Size then
|
||||||
|
FDrawMap[id] := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
CloseFile(noDrawFile);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLandscape.MoveStatic(AStatic: TStaticItem; AX, AY: Word);
|
procedure TLandscape.MoveStatic(AStatic: TStaticItem; AX, AY: Word);
|
||||||
var
|
var
|
||||||
sourceBlock, targetBlock: TSeperatedStaticBlock;
|
sourceBlock, targetBlock: TSeperatedStaticBlock;
|
||||||
|
|
|
@ -857,6 +857,13 @@ begin
|
||||||
FLandscape.OnStaticHued := @OnStaticHued;
|
FLandscape.OnStaticHued := @OnStaticHued;
|
||||||
FLandscape.OnStaticInserted := @OnStaticInserted;
|
FLandscape.OnStaticInserted := @OnStaticInserted;
|
||||||
|
|
||||||
|
if FileExists(FAppDir + 'nodraw.txt') then
|
||||||
|
begin
|
||||||
|
acNoDraw.Enabled := True;
|
||||||
|
FLandscape.LoadNoDrawMap(FAppDir + 'nodraw.txt');
|
||||||
|
end else
|
||||||
|
acNoDraw.Enabled := False;
|
||||||
|
|
||||||
FTextureManager := TLandTextureManager.Create;
|
FTextureManager := TLandTextureManager.Create;
|
||||||
FScreenBuffer := TScreenBuffer.Create;
|
FScreenBuffer := TScreenBuffer.Create;
|
||||||
FScreenBufferState := [];
|
FScreenBufferState := [];
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
T$2
|
||||||
|
S$1
|
||||||
|
S$2198
|
||||||
|
S$2199
|
||||||
|
S$219A
|
||||||
|
S$219B
|
||||||
|
S$219C
|
||||||
|
S$219D
|
||||||
|
S$219E
|
||||||
|
S$219F
|
||||||
|
S$21A0
|
||||||
|
S$21A1
|
||||||
|
S$21A2
|
||||||
|
S$21A3
|
||||||
|
S$21A4
|
||||||
|
S$21BC
|
||||||
|
S$5690
|
Loading…
Reference in New Issue