home *** CD-ROM | disk | FTP | other *** search
- program quack2map;
-
- type cube = record
- x,y,z,xl,yl,zl:integer;
- texture:string[9];
- end;
-
-
- type ent = record
- class:string;
- ox,oy,oz:integer;
- angle:integer;
- end;
-
-
- var brush:array[0..255] of cube;
- entity:array[0..63] of ent;
- numbrushes:byte;
- numentities:byte;
-
- procedure load;
- var
- f:file of cube;
- e:file of ent;
- l:string;
- t:string;
-
- i:byte;
- c:cube;
- en:ent;
- begin
- write('Name of brush and entity data files with out extention:');
- readln(t);
- assign(f,t+'.qck');
- reset(f);
- numbrushes:=0;
- repeat
- inc(numbrushes);
- read(f,c);
- brush[numbrushes-1]:=c;
- until eof(f);
- close(f);
- str(numbrushes,l);
- writeln('Loaded '+l+' brushes.');
-
- assign(e,t+'.ent');
- reset(e);
- numentities:=0;
- repeat
- inc(numentities);
- read(e,en);
- entity[numentities-1]:=en;
- until eof(e);
- close(e);
- str(numentities,l);
- writeln('Loaded '+l+' entities.');
- end;
-
- function i2s(i:integer):string;
- var s:string;
- begin
- str(i,s);
- i2s:=s;
- end;
-
- procedure savemap;
- var l:string;
- f:text;
- b:byte;
- begin
- write('write map to:'); readln(l);
- assign(f,l);
- rewrite(f);
- writeln(f,'{');
- writeln(f,'"classname" "worldspawn"');
- for b:=0 to numbrushes-1 do begin
- writeln(f,'{');
- {begin work on side 1}
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].y)+' '+i2s(brush[b].z)+' ) ');
- write(f,'( '+i2s(brush[b].xl)+' '+i2s(brush[b].y)+' '+i2s(brush[b].z)+' ) ');
- write(f,'( '+i2s(brush[b].xl)+' '+i2s(brush[b].yl)+' '+i2s(brush[b].z)+' ) ');
- writeln(f,brush[b].texture+' 0 0 0 1.0 1.0');
- {begin work on side 2}
- write(f,'( '+i2s(brush[b].xl)+' '+i2s(brush[b].y)+' '+i2s(brush[b].zl)+' ) ');
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].y)+' '+i2s(brush[b].zl)+' ) ');
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].yl)+' '+i2s(brush[b].zl)+' ) ');
- writeln(f,brush[b].texture+' 0 0 0 1.0 1.0');
- {begin work on side 3}
- write(f,'( '+i2s(brush[b].xl)+' '+i2s(brush[b].y)+' '+i2s(brush[b].z)+' ) ');
- write(f,'( '+i2s(brush[b].xl)+' '+i2s(brush[b].y)+' '+i2s(brush[b].zl)+' ) ');
- write(f,'( '+i2s(brush[b].xl)+' '+i2s(brush[b].yl)+' '+i2s(brush[b].zl)+' ) ');
- writeln(f,brush[b].texture+' 0 0 0 1.0 1.0');
- {begin work on side 4}
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].y)+' '+i2s(brush[b].zl)+' ) ');
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].y)+' '+i2s(brush[b].z)+' ) ');
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].yl)+' '+i2s(brush[b].z)+' ) ');
- writeln(f,brush[b].texture+' 0 0 0 1.0 1.0');
- {begin work on side 5}
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].y)+' '+i2s(brush[b].z)+' ) ');
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].y)+' '+i2s(brush[b].zl)+' ) ');
- write(f,'( '+i2s(brush[b].xl)+' '+i2s(brush[b].y)+' '+i2s(brush[b].zl)+' ) ');
- writeln(f,brush[b].texture+' 0 0 0 1.0 1.0');
- {begin work on side 6}
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].yl)+' '+i2s(brush[b].zl)+' ) ');
- write(f,'( '+i2s(brush[b].x)+' '+i2s(brush[b].yl)+' '+i2s(brush[b].z)+' ) ');
- write(f,'( '+i2s(brush[b].xl)+' '+i2s(brush[b].yl)+' '+i2s(brush[b].z)+' ) ');
- writeln(f,brush[b].texture+' 0 0 0 1.0 1.0');
- writeln(f,'}');
- end;
- writeln(f,'}');
- for b:=0 to numentities-1 do begin
- writeln(f,'{');
- writeln(f,'"classname" '+entity[b].class);
- writeln(f,'"origin" "'+i2s(entity[b].ox)+' '+i2s(entity[b].oy)+' '+i2s(entity[b].oz)+'"');
- writeln(f,'"angle" "'+i2s(entity[b].angle)+'"');
- writeln(f,'}');
- end;
-
- close(f);
-
- end;
-
-
-
-
- begin
- load;
- savemap;
- end.
-