home *** CD-ROM | disk | FTP | other *** search
/ Superpower (Alt) / SUPERPOWER.iso / q / editoren / mbq311 / quack.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1996-07-12  |  6.2 KB  |  197 lines

  1. {$X+}
  2. program quack;
  3. uses crt,graph;
  4.  
  5. type cube = record
  6.     x,y,z,xl,yl,zl:integer;
  7.     texture:string[9];
  8. end;
  9.  
  10. type ent = record
  11.     class:string;
  12.     ox,oy,oz:integer;
  13.     angle:integer;
  14. end;
  15.  
  16.  
  17. var brush:array[0..255] of cube;
  18.     entity:array[0..63] of ent;
  19.     gDriver,gMode:integer;
  20.     xmax,ymax:string;
  21.     xdiv,ydiv:integer;
  22.     ch:char;
  23.     zoommode:byte;
  24.     defaulttex:string;
  25.     numbrushes:byte;  numentities:byte;
  26.     curbrush:byte;    curentity:byte;
  27.     curview:byte;
  28.     moverate:byte;
  29.     movemode:boolean;
  30.  
  31. {$I procs.pas}
  32.  
  33.  
  34. begin
  35.     numbrushes:=0;
  36.     curview:=0;
  37.     numentities:=0;
  38.     curentity:=0;
  39.     curbrush:=0;
  40.     moverate:=10;
  41.     zoommode:=1;
  42.     movemode:=false;
  43.     gDriver:=detect;
  44.     defaulttex:='TECH07_2';
  45.     initgraph(gDriver,gMode,'');
  46.     if graphresult=grok    then begin
  47.         outtextxy(0,0,'QUACK beta .93   (c) 1996 FearTheFastFoodPickle! software.');
  48.         str(getmaxx+1,xmax); str(getmaxy+1,ymax);
  49.         outtextxy(0,10,xmax+','+ymax);
  50.         outtextxy(0,30,'a key, press one.');
  51.         xdiv:=getmaxx div 2; ydiv:=getmaxy div 2;
  52.         readkey; cleardevice;
  53.     end else begin
  54.         write('graphics prob'); halt;
  55.     end;
  56.  
  57.     repeat
  58.         if numbrushes>0 then drawbrushes;
  59.         if numentities>0 then drawentities;
  60.         repeat until keypressed;
  61.         ch:=readkey;
  62.  
  63.         if ch='L' then oldload;
  64.         if ch='I' then insertnewentity;
  65.         if ch='a' then curentityangle;
  66.         if ch=chr(13) then curentityclass;
  67.         if ch='[' then begin
  68.             inc(curentity);
  69.             if curentity=numentities then curentity:=0;
  70.         end;
  71.         if ch=']' then if curentity>0 then dec(curentity) else curentity:=numentities-1;
  72.         with entity[curentity] do begin;
  73.             if ch='u' then begin
  74.                 if curview=0 then oy:=oy-moverate;
  75.                 if curview>0 then oz:=oz+moverate;
  76.             end;
  77.             if ch='j' then begin
  78.                    if curview=0 then oy:=oy+moverate;
  79.                 if curview>0 then oz:=oz-moverate;
  80.             end;
  81.             if ch='k' then begin
  82.                 if curview=0 then ox:=ox+moverate;
  83.                 if curview=1 then oy:=oy+moverate;
  84.                 if curview=2 then ox:=ox+moverate;
  85.             end;
  86.             if ch='h' then begin
  87.                    if curview=0 then ox:=ox-moverate;
  88.                 if curview=1 then oy:=oy-moverate;
  89.                 if curview=2 then ox:=ox-moverate;
  90.             end;
  91.         end;
  92.  
  93.         if ch=chr(9) then if movemode=true then movemode:=false else movemode:=true;
  94.         if ch='!' then deletecurbrush;
  95.         if ch='z' then zoommode:=1;
  96.         if ch='x' then zoommode:=2;
  97.         if ch='c' then zoommode:=4;
  98.         if ch='v' then zoommode:=6;
  99.         if ch='b' then zoommode:=8;
  100.         if ch='T' then getnewdefaulttexture;
  101.         if ch='m' then getnewmoverate;
  102.         if ch='i' then insertnewbrush;
  103.         if ch='q' then curview:=0;
  104.         if ch='w' then curview:=1;
  105.         if ch='e' then curview:=2;
  106.         if ch='8' then begin
  107.               with brush[curbrush] do begin
  108.             if curview=0 then yl:=yl-moverate;
  109.             if curview>0 then zl:=zl+moverate;
  110.             end;
  111.         end;
  112.         if ch='2' then begin
  113.             with brush[curbrush] do begin
  114.             if curview=0 then yl:=yl+moverate;
  115.             if curview>0 then zl:=zl-moverate;
  116.             end;
  117.         end;
  118.         if ch='6' then begin
  119.               with brush[curbrush] do begin
  120.             if curview=0 then xl:=xl+moverate;
  121.             if curview=1 then yl:=yl+moverate;
  122.             if curview=2 then xl:=xl+moverate;
  123.             end;
  124.         end;
  125.         if ch='4' then begin
  126.             with brush[curbrush] do begin
  127.             if curview=0 then xl:=xl-moverate;
  128.             if curview=1 then yl:=yl-moverate;
  129.             if curview=2 then xl:=xl-moverate;
  130.             end;
  131.         end;
  132.  
  133.         if ch=' ' then begin
  134.             inc(curbrush);
  135.             if curbrush>=numbrushes then curbrush:=0;   { i have bad feeling bout this}
  136.         end;
  137.         if ( ch=chr(8) ) and ( curbrush>0 ) then dec(curbrush);
  138.         if ( ch=chr(8) ) and ( curbrush=0 ) and (numbrushes>0) then curbrush:=numbrushes-1;
  139.         if ch='s' then save;
  140.         if ch='l' then load;
  141.         if ch='t' then texture;
  142.         if ch=chr(0) then begin
  143.             ch:=readkey;
  144.             with brush[curbrush] do begin
  145.                 if ch=chr(72) then begin
  146.                     if curview=0 then y:=y-moverate;
  147.                     if curview>0 then z:=z+moverate;
  148.                     if movemode=true then begin
  149.                         with brush[curbrush] do begin
  150.                             if curview=0 then yl:=yl-moverate;
  151.                             if curview>0 then zl:=zl+moverate;
  152.                         end;
  153.                     end;
  154.                 end;
  155.                 if ch=chr(80) then begin
  156.                     if curview=0 then y:=y+moverate;
  157.                     if curview>0 then z:=z-moverate;
  158.                     if movemode=true then begin
  159.                         with brush[curbrush] do begin
  160.                             if curview=0 then yl:=yl+moverate;
  161.                             if curview>0 then zl:=zl-moverate;
  162.                         end;
  163.                     end;
  164.                 end;
  165.                 if ch=chr(77) then begin
  166.                     if curview=0 then x:=x+moverate;
  167.                     if curview=1 then y:=y+moverate;
  168.                     if curview=2 then x:=x+moverate;
  169.                     if movemode=true then begin
  170.                         with brush[curbrush] do begin
  171.                             if curview=0 then xl:=xl+moverate;
  172.                             if curview=1 then yl:=yl+moverate;
  173.                             if curview=2 then xl:=xl+moverate;
  174.                         end;
  175.                     end;
  176.                 end;
  177.                 if ch=chr(75) then begin
  178.                     if curview=0 then x:=x-moverate;
  179.                     if curview=1 then y:=y-moverate;
  180.                     if curview=2 then x:=x-moverate;
  181.                     if movemode=true then begin
  182.                         with brush[curbrush] do begin
  183.                             if curview=0 then xl:=xl-moverate;
  184.                             if curview=1 then yl:=yl-moverate;
  185.                             if curview=2 then xl:=xl-moverate;
  186.                         end;
  187.                     end;
  188.                 end;
  189.                end;
  190.         end;
  191.     until ch='Q';
  192.     closegraph;
  193. end.
  194.  
  195.  
  196.  
  197.