From e502321f35acd1659abca53e972b8d5d02a0a969 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 18 Dec 2009 14:24:35 +0100 Subject: [PATCH] - Added more nodraw.txt locations - Improved nodraw.txt parsing --- Client/ULandscape.pas | 37 ++++++++++++++++++++++++++++++------- Client/UfrmMain.pas | 8 ++++---- bin/nodraw.txt | 22 +++++++++------------- 3 files changed, 43 insertions(+), 24 deletions(-) diff --git a/Client/ULandscape.pas b/Client/ULandscape.pas index aaef35b..6e009a8 100644 --- a/Client/ULandscape.pas +++ b/Client/ULandscape.pas @@ -1127,21 +1127,44 @@ end; procedure TLandscape.LoadNoDrawMap(AFileName: String); var noDrawFile: TextFile; - line: String; - id: Integer; + line, ids1, ids2: String; + i, id1, id2, splitPos: 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 + if (Length(line) > 0) and (line[1] in ['S', 'T']) then begin - if line[1] = 'S' then - Inc(id, $4000); + splitPos := Pos('-', line); + if splitPos > 1 then + begin + ids1 := Copy(line, 2, splitPos - 2); + ids2 := Copy(line, splitPos + 1, Length(line)); + if TryStrToInt(ids1, id1) and TryStrToInt(ids2, id2) then + begin + if line[1] = 'S' then + begin + Inc(id1, $4000); + Inc(id2, $4000); + end; - if id < FDrawMap.Size then - FDrawMap[id] := False; + for i := id1 to id2 do + if i < FDrawMap.Size then + FDrawMap[i] := False; + end; + end else + begin + ids1 := Copy(line, 2, Length(line)); + if TryStrToInt(ids1, id1) then + begin + if line[1] = 'S' then + Inc(id1, $4000); + if id1 < FDrawMap.Size then + FDrawMap[id1] := False; + end; + end; end; end; CloseFile(noDrawFile); diff --git a/Client/UfrmMain.pas b/Client/UfrmMain.pas index 9d07dec..9be703c 100644 --- a/Client/UfrmMain.pas +++ b/Client/UfrmMain.pas @@ -858,11 +858,11 @@ begin FLandscape.OnStaticInserted := @OnStaticInserted; if FileExists(FAppDir + 'nodraw.txt') then - begin - acNoDraw.Enabled := True; FLandscape.LoadNoDrawMap(FAppDir + 'nodraw.txt'); - end else - acNoDraw.Enabled := False; + if FileExists(FConfigDir + 'nodraw.txt') then + FLandscape.LoadNoDrawMap(FConfigDir + 'nodraw.txt'); + if FileExists(ResMan.GetFile('nodraw.txt')) then + FLandscape.LoadNoDrawMap(ResMan.GetFile('nodraw.txt')); FTextureManager := TLandTextureManager.Create; FScreenBuffer := TScreenBuffer.Create; diff --git a/bin/nodraw.txt b/bin/nodraw.txt index ae9264d..c3f73d0 100644 --- a/bin/nodraw.txt +++ b/bin/nodraw.txt @@ -1,17 +1,13 @@ +# This file contains a list of all tiles to be ignored when the "NoDraw" +# option is not active. +# Lines starting with T are terrain tiles, S indicated static tiles. +# A - between numbers indicates a range of tiles. + +#Terrain T$2 + +#Statics 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$2198-$21A4 S$21BC S$5690