	SUBROUTINE OUTSID(ID)
C	ROUTINE TO HANDLE OUTSIDE MOVEMENT BY PLAYERS
C----------------------standard common block----------------------------
C 
	COMMON ICR(8,12),IPARM(10),IS1,IS2,NT,ICU(10,10,10,2),CLEAR(8)
	COMMON MARKER(4,3,3)
	LOGICAL*1 ICU,CLEAR
C 
C-----------------------------------------------------------------------
	LOGICAL*1 IOUT(61,5),ANS,BNS,CNS,STRING(78)
	LUN=ICR(ID,8)
	X=-1.
	CALL DELAY(X,LUN,ANS)
	ANS='*'
2	IS=0 ! CLEAR SCREEN
	GOTO 103
1	IF(ANS.EQ.' '.OR.ANS.EQ.'D') GOTO 2  ! CLEAR AND REDRAW SCREEN
3	IF(IS.NE.0) CALL DELAY(X,LUN,ANS)
4	IF(ICR(ID,1).NE.2) GOTO 50  ! NO LONGER ALIVE OUTSIDE CUBE....
C	REDUCE ENERGY:
	IF(ANS.NE.'*') ICR(ID,9)=ICR(ID,9)-(RAN(IS1,IS2)*2.2+1)
103	IF(ICR(ID,9).LE.0) GOTO 60 ! NO ENERGY LEFT
	CALL OSCAN1(ID,I0,J0) ! GET CRAWLER COORDINATES
	CALL OSCAN2(ID,I0,J0,IOUT,IM) ! FILL SCANNING ARRAY IOUT
	CALL OSCAN3(ID,IOUT,IS,ANS,BNS,CNS,IM) ! SHOW DISPLAY
	IS=1   ! OVERPRINT DISPLAY FROM NOW ON
	IF(ANS.EQ.'A') GOTO 10
	IF(ANS.EQ.'R') GOTO 30
	IF(ANS.EQ.'E') GOTO 50
	IF(ANS.EQ.'I') GOTO 25
	GOTO 2
C 
C	ADVANCE:
10	N=1
	IF(BNS.GT.'1'.AND.BNS.LE.'9') N=BNS-48
	M=-1
	IF(CNS.GE.'0'.AND.CNS.LE.'9') M=CNS-48
	IF(M.GE.0) N=N*10+M
C	N IS NOW IN RANGE FROM 1 TO 99.
	IF(N.GT.40) N=N-40
	IF(N.GE.40) N=N-40
C	N IS NOW FROM 1 TO 39.
11	IPARM(9)=0 ! DEBUG WRITES IN OSCAN2 DISABLED
	IF(BNS.EQ.'D'.OR.CNS.EQ.'D') IPARM(9)=1  ! ENABLED
	CALL OMOVE(ID)
	WRITE(LUN,13) N
	N=N-1
	IF(N.LE.0) GOTO 12
13	FORMAT('     <',I2,'>')
	CALL OSCAN1(ID,I0,J0)
	CALL OSCAN2(ID,I0,J0,IOUT,IM)
	IS=-1 ! DON'T PROMPT FOR COMMAND; OVERPRINT DISPLAY
	CALL OSCAN3(ID,IOUT,IS,ANS,BNS,CNS,IM)
	IS=1 ! BACK TO COMMAND PROMPT
	GOTO 11
12	IF(BNS.EQ.'E') GOTO 50  ! RETURN
	GOTO 4
C 
C	ROTATE:
30	N=1
	IF(BNS.GT.'1'.AND.BNS.LE.'9') N=BNS-48
	WRITE(LUN,31)
31	FORMAT(' direction (L,R): ',$)
	READ(LUN,33) ANS
33	FORMAT(A1)
	IF(ANS.EQ.' ') GOTO 1
	IF(ANS.EQ.'R'.OR.ANS.EQ.'L') GOTO 34
	WRITE(LUN,35)
35	FORMAT(' you can`t turn that way')
	GOTO 30
34	DO 36 I=1,N
	ICR(ID,9)=ICR(ID,9)+2 ! ZERO ENERGY TAKEN BY ROTATE
	CALL ROTATE(ANS,ID)
36	CONTINUE
	IF(BNS.EQ.'E') GOTO 50
	IF(N.GT.6) IS=0  ! CLEAR SCREEN ON REDRAW.
	GOTO 4
C 
C	REENTER CUBE:
25	ICR(ID,9)=ICR(ID,9)-1
	IF(IM.EQ.1) GOTO 27
	WRITE(LUN,26)
26	FORMAT(' ..rummmble....ru   >crunch<'/
     C' there`s no doorway here !!!')
	GOTO 1
27	ICR(ID,9)=ICR(ID,9)+2
	CALL ROTATE('D',ID)
	GOTO 10
C 
C	OUT OF ENERGY:
60	WRITE(LUN,61) "33,"33,CLEAR(ID),ID
61	FORMAT(X,A1,'Y  ',2A1/////
     C'      .....crawler',I2,', it doesn`t look good for you.....'/
     C'    you have run out of energy and there is no more to be found'/
     C'   outside the cube.  with no energy the cube finds little'/
     C'    need to keep you around.  it releases its gravitational'/
     C'           pull as you begin to drift away.....')
	X=4.75
	DO 678 I=1,78
	STRING(I)='.'
678	CONTINUE
	DO 62 I=1,25
	X=X*.6
	IF(X.LT..005) X=.005
	CALL DELAY(X,LUN,ANS)
	K=1
	IF(RAN(IS1,IS2).GT..5) K=-1
	DO 65 J=1,78
	N=0
	IF(STRING(J).EQ.' ') N=1
	STRING(J)='('
	IF(K.GT.0) STRING(J)=')'
	IF(J.LT.2.OR.J.GT.77) GOTO 67
	IF(RAN(IS1,IS2).LT..015) STRING(J)=' '
	IF(N.EQ.0) GOTO 67
	IF(RAN(IS1,IS2).LT..65) STRING(J-1)=' '
	IF(RAN(IS1,IS2).LT..65) STRING(J+1)=' '
67	K=-K
65	CONTINUE
	WRITE(LUN,63) STRING
62	CONTINUE
63	FORMAT(X,78A1)
	ICR(ID,1)=0  ! CRAWLER IS DEAD
C 
C	ANNOUNCE DEATH TO EVERYONE ELSE:
	DO 70 I=1,4
	IF(ICR(I,1).EQ.1.OR.ICR(I,1).EQ.2) WRITE(ICR(I,8),71) ID
70	CONTINUE
71	FORMAT('   hmmmm.....   it seems that crawler',I2/
     C'   has just drifted away.....')
	WRITE(5,71) ID
50	RETURN
	END
