#define RTEXTFILE '/usr/games/lib/dunlib/rtext.dat'
#define TEXTFILE '/usr/games/lib/dunlib/dtext.dat'
C gets dungeon messages and prints them
C (only used for pdp version)
COMMON /CHAN/ INPCH,OUTCH,DBCH
OPEN(UNIT=9,file=RTEXTFILE,
& status='OLD',IOSTAT=IO,
& FORM='formatted',ACCESS='SEQUENTIAL',err=50)
OPEN(UNIT=DBCH,file=TEXTFILE,
& status='OLD',IOSTAT=IO,
& FORM='UNFORMATTED',ACCESS='DIRECT',recl=76,err=60)
C get numbers and call speaking program
960 FORMAT('I can''t open ',RTEXTFILE,'.')
970 FORMAT('I can''t open ',TEXTFILE,'.')
980 FORMAT('Suddenly a sinister, wraithlike figure appears before '
& 'you,'/'seeming to float in the air. In a low, sorrowful voice'
& ' he says,'/'"Alas, the very nature of the world has changed, '
& 'and the dungeon'/'cannot be found. All must now pass away."'
& ' Raising his oaken staff'/'in farewell, he fades into the '
& 'spreading darkness. In his place'/'appears a tastefully '
& 'lettered sign reading:'//23X,'INITIALIZATION FAILURE'//
& 'The darkness becomes all encompassing, and your vision fails.')
960 FORMAT(' I can''t open ',RTEXTFILE,'.')
970 FORMAT(' I can''t open ',TEXTFILE,'.')
980 FORMAT(' Suddenly a sinister, wraithlike figure appears before '
& 'you,'/' seeming to float in the air. In a low, sorrowful voice'
& ' he says,'/' "Alas, the very nature of the world has changed, '
& 'and the dungeon'/' cannot be found. All must now pass away."'
& ' Raising his oaken staff'/' in farewell, he fades into the '
& 'spreading darkness. In his place'/' appears a tastefully '
& 'lettered sign reading:'//23X,'INITIALIZATION FAILURE'//
& ' The darkness becomes all encompassing, and your vision fails.')
C RSPSB2-- OUTPUT RANDOM MESSAGE WITH SUBSTITUTABLE ARGUMENTS
C CALL RSPSB2(MSGNUM,S1,S2)
INTEGER*2 OLDREC,NEWREC,JREC
COMMON /RMSG/ MLNT,RTEXT(1050)
COMMON /CHAN/ INPCH,OUTCH,DBCH
C CONVERT ALL ARGUMENTS FROM DICTIONARY NUMBERS (IF POSITIVE)
C TO ABSOLUTE RECORD NUMBERS.
READ(UNIT=DBCH,REC=X) OLDREC,B1
B1(I:I)=char(xor(ichar(B1(I:I)),X1))
IF(B1(I:I).EQ.'#') GO TO 1000
IF(B1(I:I).NE.' ') GO TO 600
C 600 WRITE(OUTCH,650) (B1(J:J),J=1,I)
600 PRINT 650, (B1(J:J),J=1,I)
READ(UNIT=DBCH,REC=X) NEWREC,B1
IF(OLDREC.EQ.NEWREC) GO TO 100
C SUBSTITUTION WITH SUBSTITUTABLE AVAILABLE.
C Y IS NUMBER OF RECORD TO SUBSTITUTE.
C 1) COPY REST OF B1 TO B2
C 2) READ SUBSTITUTABLE OVER B1
C 3) RESTORE TAIL OF ORIGINAL B1
C THE IMPLICIT ASSUMPTION HERE IS THAT THE SUBSTITUTABLE STRING
C IS VERY SHORT (i.e. MUCH LESS THAN ONE RECORD).
C READ SUBSTITUTE STRING INTO B3, AND DECRYPT IT:
READ(UNIT=DBCH,REC=Y) JREC,B3
B3(K1:K1)=char(xor(ICHAR(B3(K1:K1)),X1))
C FILL REMAINDER OF B1 WITH CHARACTERS FROM B3:
C FIND END OF SUBSTITUTE STRING IN B1:
IF(B1(J:J).NE.' ') GO TO 1300
C PUT TAIL END OF B1 (NOW IN B2) BACK INTO B1 AFTER SUBSTITUTE STRING:
COMMON /RMSG/ MLNT,RTEXT(1050)