home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Party 1994: Try This At Home
/
disk_image.bin
/
source
/
gallery
/
subdirs.exe
/
MAP
/
MAPDATA.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-07-10
|
1KB
|
70 lines
var
MAP : array[0..63,0..63] of byte;
T : text;
procedure MakeMap;
var x,y : integer;
CharMap, s : string;
I : Text;
begin
assign(I,'map.gri'); reset(I);
y := 0;
repeat
readln(I,s);
if s<>'' then
if s[1]<>';' then begin
if length(s)<>64 then CharMap := ' '+s
else begin
for x := 0 to 63 do
MAP[y,x] := Pos(s[x+1],CharMap)-1;
inc(y)
end;
end;
until eof(I);
close(I);
writeln(y,' map lines processed.');
writeln('Map codes: "',CharMap,'".');
end;
Function Hex( x : byte ) : string;
const HexDigits : string = '0123456789abcdef';
var s : string;
b,a : char;
begin
s := HexDigits[ x div 16 +1 ] + HexDigits[ x mod 16 +1 ];
b := ' '; a := ' ';
if s[1] in ['a'..'f'] then b := '0';
if s[2] in ['a'..'f'] then a := 'h';
Hex := b+s+a;
end;
var x,y : integer;
begin
writeln('Reads MAP.GRI and creates MAPDATA.INC include file // A.R-M. 7/93');
writeln;
MakeMap;
assign(T, 'mapdata.inc'); rewrite(T);
writeln(T,'; map data include file');
writeln(T);
for y := 0 to 63 do begin
write(T,' DB ');
for x := 0 to 63 do begin
write(T,Hex(Map[y,x]));
if x <> 63 then write(T,',');
end;
writeln(T);
end;
writeln(T);
close(T);
writeln;
writeln('MAPDATA.INC successfully created.')
end.