home *** CD-ROM | disk | FTP | other *** search
- function i2s(i:longint):string;
- var s:string;
- begin
- str(i,s);
- i2s:=s;
- end;
-
- procedure insertnewbrush;
- begin
- brush[numbrushes].x:=-50;
- brush[numbrushes].y:=-50;
- brush[numbrushes].z:=-50;
- brush[numbrushes].xl:=50;
- brush[numbrushes].yl:=50;
- brush[numbrushes].zl:=50;
- brush[numbrushes].texture:=defaulttex;
- curbrush:=numbrushes;
- inc(numbrushes);
-
- end;
-
- procedure drawbrushes;
- var b:byte;
- vx,vy,vz,vxl,vyl,vzl:integer;
- begin
- cleardevice;
- for b:=0 to numbrushes-1 do begin
- setcolor(7); if b=curbrush then setcolor(12);
- with brush[b] do begin
- if curview=0 then if zoommode=1 then rectangle(x+xdiv,y+ydiv,xl+xdiv,yl+ydiv) else
- rectangle((x div zoommode)+xdiv,(y div zoommode)+ydiv,(xl div zoommode)+xdiv,(yl div zoommode)+ydiv);
- if curview=1 then if zoommode=1 then rectangle(y+xdiv,(z*-1)+ydiv,yl+xdiv,(zl*-1)+ydiv) else
- rectangle((y div zoommode)+xdiv,((z div zoommode)*-1)+ydiv,(yl div zoommode)+xdiv,((zl div zoommode)*-1)+ydiv);
- if curview=2 then if zoommode=1 then rectangle(x+xdiv,(z*-1)+ydiv,xl+xdiv,(zl*-1)+ydiv) else
- rectangle((x div zoommode)+xdiv,((z div zoommode)*-1)+ydiv,(xl div zoommode)+xdiv,((zl div zoommode)*-1)+ydiv);
- end;
- setcolor(12);
- with brush[curbrush] do begin
- if curview=0 then if zoommode=1 then rectangle(x+xdiv,y+ydiv,xl+xdiv,yl+ydiv) else
- rectangle((x div zoommode)+xdiv,(y div zoommode)+ydiv,(xl div zoommode)+xdiv,(yl div zoommode)+ydiv);
- if curview=1 then if zoommode=1 then rectangle(y+xdiv,(z*-1)+ydiv,yl+xdiv,(zl*-1)+ydiv) else
- rectangle((y div zoommode)+xdiv,((z div zoommode)*-1)+ydiv,(yl div zoommode)+xdiv,((zl div zoommode)*-1)+ydiv);
- if curview=2 then if zoommode=1 then rectangle(x+xdiv,(z*-1)+ydiv,xl+xdiv,(zl*-1)+ydiv) else
- rectangle((x div zoommode)+xdiv,((z div zoommode)*-1)+ydiv,(xl div zoommode)+xdiv,((zl div zoommode)*-1)+ydiv);
- end;
-
- setcolor(8);
- line(0,470,0,479); line(0,479,10,479);
- if curview=0 then begin
- outtextxy(0,459,'x');
- outtextxy(10,469,'y');
- end;
- if curview=1 then begin
- outtextxy(0,459,'y');
- outtextxy(10,469,'z');
- end;
- if curview=2 then begin
- outtextxy(0,459,'x');
- outtextxy(10,469,'z');
- end;
- end;
-
-
- outtextxy(30,469,'zm:'+i2s(zoommode));
- outtextxy(80,469,i2s((brush[curbrush].x-brush[curbrush].xl)*-1)+' '+i2s((brush[curbrush].y-brush[curbrush].yl)*-1)+' '+
- i2s((brush[curbrush].z-brush[curbrush].zl)*-1)+' '+brush[curbrush].texture);
- if movemode=true then outtextxy(20,459,'M');
- putpixel(0+xdiv,0+ydiv,15);
- end;
-
- procedure getnewdefaulttexture;
-
- begin
- outtextxy(0,40,'Enter default texture for new inserted brushes:');
- gotoxy(1,1);
- readln(defaulttex);
- if numbrushes>0 then drawbrushes else cleardevice;
- end;
-
- procedure deletecurbrush; { this is VERY buggy, i think (not sure) }
- var i:byte;
- begin
- if numbrushes>1 then begin
- for i:=curbrush to numbrushes-1 do begin
- brush[i]:=brush[i+1]
- end;
- dec(numbrushes);
- if curbrush>=numbrushes then curbrush:=0;
- end else begin
- outtextxy(0,0,'gotta have at least one brush...');
- end;
-
- end;
-
-
-
-
-
- procedure getnewmoverate;
-
- begin
- outtextxy(0,40,'Enter new moverate:');
- gotoxy(1,1);
- readln(moverate);
- if numbrushes>0 then drawbrushes else cleardevice;
- end;
-
- procedure save;
- var
- f:file of cube;
- e:file of ent;
- saveas:string;
- i:byte;
- begin
- if numbrushes>0 then begin
- outtextxy(0,40,'Do not give an extension! save as:');
- gotoxy(0,0);
- readln(saveas);
- assign(f,saveas+'.qck');
- rewrite(f);
- for i:=0 to numbrushes-1 do begin
- write(f,brush[i]);
- end;
- close(f);
- assign(e,saveas+'.ent');
- rewrite(e);
- for i:=0 to numentities-1 do begin
- write(e,entity[i]);
- end;
- close(e);
- drawbrushes; outtextxy(0,0,'Saved...');
- end else begin
- outtextxy(0,0,'nothing to save.');
- end;
- end;
-
- procedure insertnewentity;
- begin
- entity[numentities].class:='"info_player_start"';
- entity[numentities].ox:=0;
- entity[numentities].oy:=0;
- entity[numentities].oz:=0;
- entity[numentities].angle:=0;
- curentity:=numentities;
- inc(numentities);
- end;
-
- procedure load;
- var
- f:file of cube;
- e:file of ent;
- l:string;
- i:byte;
- c:cube;
- en:ent;
- label alldone;
- begin
- outtextxy(0,40,'load brush and entity data (use shift-l for brushes only):');
- gotoxy(0,0);
- readln(l);
- if l='' then goto alldone;
- assign(f,l+'.qck');
- reset(f);
- numbrushes:=0;
- repeat
- insertnewbrush;
- read(f,c);
- brush[numbrushes-1]:=c;
- until eof(f);
- close(f);
- assign(e,l+'.ent');
- reset(e);
- numentities:=0;
- repeat
- insertnewentity;
- read(e,en);
- entity[numentities-1]:=en;
- until eof(e);
- close(e);
- alldone:
- end;
-
- procedure oldload;
- var
- f:file of cube;
- l:string;
- i:byte;
- c:cube;
- label alldone;
- begin
- outtextxy(0,40,'brushes only load:');
- gotoxy(0,0);
- readln(l);
- if l='' then goto alldone;
- assign(f,l);
- reset(f);
- numbrushes:=0;
- repeat
- insertnewbrush;
- read(f,c);
- brush[numbrushes-1]:=c;
- until eof(f);
- close(f);
- str(numbrushes,l);
- curview:=0; drawbrushes; outtextxy(0,0,'Loaded '+l+' brushes');
- alldone:
- end;
-
-
-
- procedure texture;
- var t:string;
- begin
- if numbrushes>0 then begin
- outtextxy(0,40,'New texture for this brush:');
- gotoxy(0,0);
- readln(t);
- brush[curbrush].texture:=t;
- end;
- end;
-
-
-
- procedure drawentities;
- var e:byte;
- r:byte;
- begin
- r:=2;
- setcolor(7);
- if numentities>0 then begin
- for e:=0 to numentities do begin
- with entity[e] do begin
- if curview=0 then circle((ox div zoommode)+xdiv,(oy div zoommode)+ydiv,r);
- if curview=1 then circle((oy div zoommode)+xdiv,((oz div zoommode)*-1)+ydiv,r);
- if curview=2 then circle((ox div zoommode)+xdiv,((oz div zoommode)*-1)+ydiv,r);
- end;
- end;
- setcolor(12);
- with entity[curentity] do begin
- if curview=0 then circle((ox div zoommode)+xdiv,(oy div zoommode)+ydiv,r);
- if curview=1 then circle((oy div zoommode)+xdiv,((oz div zoommode)*-1)+ydiv,r);
- if curview=2 then circle((ox div zoommode)+xdiv,((oz div zoommode)*-1)+ydiv,r);
- outtextxy(400,459,'angle: '+i2s(angle));
- outtextxy(400,469,'class: '+class);
-
- end;
-
- end;
- end;
-
- function s2i(s:string):integer;
- var c,i:integer;
- begin
- val(s,i,c);
- s2i:=i;
- end;
-
- procedure curentityangle;
- var s:string;
- i:integer;
- begin
- if numentities>0 then begin
- outtextxy(0,40,'New angle for this entity:');
- gotoxy(0,0);
- readln(s);
- if s='' then i:=0 else i:=s2i(s);
- entity[curentity].angle:=i;
- end;
- drawbrushes;
- drawentities;
- end;
-
- procedure curentityclass;
- var s:string;
- begin
- if numentities>0 then begin
- outtextxy(0,40,'New classname for this entity:');
- gotoxy(0,0);
- readln(s);
- if s='' then s:='info_player_start' else entity[curentity].class:=s;
- end;
- drawbrushes;
- drawentities;
- end;