Classic Computer Magazine Archive PROGRAM LISTING: 85-06/STICK3D.ACT


; STICK3D (LISTING 6)

PROC JoyD(INT n) ;0-EDIT,1-ADD
BYTE i,k,f:INT ARRAY pt
IF n=0 THEN f=0 ELSE f=1:n=P(0) FI
n==+1:pt=P+10+8*n:Upt(n):Ucxyz(pt)
Kolor(pt(3) & 15):Maksxsy(pt):Dit(sx,sy)
DO IF n>200 THEN EXIT FI
  WHILE Strig(0)=0 DO
    st=Stick(0):Dit(sx,sy)
    IF st<15 THEN pt(2)==-jy(st)
      Maksxsy(pt):Ucxyz(pt)
    FI Dit(sx,sy)
  OD
  st=Stick(0):Dit(sx,sy)
  IF key<255 THEN k=key:key=255
    IF k=33 THEN n==+1:Upt(n)
      IF pt(3)<16 THEN LineTo(sx,sy)
      ELSE Dot(sx,sy):xnow=sx:ynow=sy FI
      IF f=1 THEN
        FOR i=0 TO 3 DO pt(4+i)=pt(i) OD
      FI pt==+8:Kolor(pt(3) & 15)
      Maksxsy(pt):Ucxyz(pt)
    ELSEIF k=10 THEN pt(3)==! 16:Ucxyz(pt)
    ELSEIF k=18 THEN IncC()
      pt(3)=(pt(3) & 16)+cnow:Ucxyz(pt)
    ELSE key=k:EXIT FI
  FI
  IF st<15 THEN pt(0)==+jx(st)
    pt(1)==-jy(st):Maksxsy(pt):Ucxyz(pt)
  FI Dit(sx,sy)
OD P(0)=n-1:RETURN

PROC JoyF():BYTE i:INT ARRAY pt(3)
IF cnow=0 THEN Kolor(1) FI
FOR i=0 TO 2 DO pt(i)=foc(i) OD
Maksxsy(pt):Dit(sx,sy):Ufoc(pt)
DO
  WHILE Strig(0)=0 DO
    st=Stick(0):Dit(sx,sy)
    IF st<15 THEN pt(2)==-jy(st)
      Maksxsy(pt):Ufoc(pt)
    FI Dit(sx,sy)
  OD
  st=Stick(0):Dit(sx,sy)
  IF key=33 THEN key=255
    FOR i=0 TO 2 DO foc(i)=pt(i) OD
    CLR():Draw(P):Maksxsy(pt)
  ELSEIF key<255 THEN EXIT FI
  IF st<15 THEN pt(0)==+jx(st)
    pt(1)==-jy(st):Maksxsy(pt):Ufoc(pt)
  FI Dit(sx,sy)
OD Ufoc(foc):RETURN

PROC JoyE():INT x,y,z
x=eye(0):y=eye(1):z=eye(2)
DO st=Stick(0):Ueye()
  WHILE Strig(0)=0 DO st=Stick(0)
    eye(2)==-jy(st):eye(3)==+jx(st)
    Ueye()
  OD
  IF key=33 THEN key=255
    FixE():FixM():CLR():Draw(P)
    x=eye(0):y=eye(1):z=eye(2)
  ELSEIF key<255 THEN EXIT FI
  eye(0)==+jx(st):eye(1)==-jy(st)
OD eye(0)=x:eye(1)=y:eye(2)=z:Ueye()
RETURN

PROC JoyC():INT x,y
IF cnow=0 THEN Kolor(1) FI
x=cx:y=cy:Dit(x,y)
DO st=Stick(0):Ucen(x,y):Dit(x,y)
  IF key=33 THEN key=255
    cx=x:cy=y:CLR():Draw(P)
  ELSEIF key<255 THEN EXIT FI
  x==+jx(st):y==+jy(st):Dit(x,y)
OD Ucen(cx,cy):RETURN


Back to previous page