#define INDXFILE '/usr/games/lib/dunlib/dindx.dat'
#define TEXTFILE '/usr/games/lib/dunlib/dtext.dat'
C INIT-- DUNGEON INITIALIZATION SUBROUTINE
C COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142
C ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED
C WRITTEN BY R. M. SUPNIK
C MISCELLANEOUS VARIABLES
COMMON /STAR/ MBASE,STRBIT
COMMON /VERS/ VMAJ,VMIN,VEDIT
COMMON /TIME/ PLTIME,SHOUR,SMIN,SSEC
C FIRST CHECK FOR PROTECTION VIOLATION
IF(PROTCT(X)) GO TO 10000
10100 FORMAT('There appears before you a threatening figure clad '
& 'all over'/'in heavy black armor. His legs seem like the '
& 'massive trunk'/'of the oak tree. His broad shoulders and '
& 'helmeted head loom'/'high over your own puny frame, and '
& 'you realize that his powerful'/'arms could easily crush the '
& 'very life from your body. There'/'hangs from his belt a '
& 'veritable arsenal of deadly weapons:'/'sword, mace, ball '
& 'and chain, dagger, lance, and trident.'/'He speaks with a '
& 'commanding voice:'//20X,'"You shall not pass."'//'As '
& 'he grabs you by the neck all grows dim about you.')
10100 FORMAT(' There appears before you a threatening figure clad '
& 'all over'/' in heavy black armor. His legs seem like the '
& 'massive trunk'/' of the oak tree. His broad shoulders and '
& 'helmeted head loom'/' high over your own puny frame, and '
& 'you realize that his powerful'/' arms could easily crush the '
& 'very life from your body. There'/' hangs from his belt a '
& 'veritable arsenal of deadly weapons:'/' sword, mace, ball '
& 'and chain, dagger, lance, and trident.'/' He speaks with a '
& 'commanding voice:'//20X,'"You shall not pass."'//' As '
& 'he grabs you by the neck all grows dim about you.')
C NOW START INITIALIZATION PROPER
C Note: arrays FLAGS & SWITCH are initialized in the following
C DATA statements, instead of using DO loops and assignments
C as used before. This saves some code space.
DATA FLAGS/.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,
& .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,
& .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,
& .TRUE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.TRUE.,
& .FALSE.,.FALSE.,.FALSE.,.TRUE.,.FALSE.,.FALSE.,
& .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,
& .FALSE.,.FALSE.,.FALSE.,.TRUE.,.TRUE.,.FALSE.,
& .TRUE.,.FALSE.,.FALSE.,.FALSE./
DATA SWITCH/0,0,0,0,0,0,0,0,0,
C Note: SWITCH(13) or MLOC is initialized equal to MRB later.
C NOW RESTORE FROM EXISTING INDEX FILE.
IF((I.NE.VMAJ).OR.(J.NE.VMIN))
if(j.EQ.0) CFLAG(i)=.FALSE.
C The RTEXT array is not used here, and isn't read (it's used
C THE INTERNAL DATA BASE IS NOW ESTABLISHED.
C SET UP TO PLAY THE GAME.
1025 CALL ITIME(SHOUR,SMIN,SSEC)
CALL INIRND(or(SHOUR,or(SMIN,SSEC)))
C Normally, PRSFLG is setable in gdt to allow seeing various
C parse results. Since the pdp version does not have gdt,
C PRSFLG is set to show full debugging info when debug is enabled.
C !SET UP STATE VARIABLES.
C !THIEF NOT INTRODUCED BUT
C LOGICAL UNIT NRS: 5=STDIN, 6=STDOUT
C !CLEAR VILLAINS ARRAYS.
C !CLEAR MESSAGE DIRECTORY.
C !CLEAR ADVENTURER'S ARRAYS.
C allow setting gdtflg true if user id matches wizard id
C this way, the wizard doesn't have to recompile to use gdt
if (getuid() .eq. WIZARDID) gdtflg=1
C NOW RESTORE FROM EXISTING INDEX FILE.
OPEN(UNIT=1,file=INDXFILE,status='OLD',
& FORM='FORMATTED',ACCESS='SEQUENTIAL',ERR=1900,recl=1)
& FORM='FORMATTED',ACCESS='SEQUENTIAL',ERR=1900)
IF((I.NE.VMAJ).OR.(J.NE.VMIN))
OPEN(UNIT=DBCH,file=TEXTFILE,status='OLD',
& FORM='UNFORMATTED',ACCESS='DIRECT',
rewind(unit=dbch, err=1950)
150 FORMAT('RESTORING FROM "dindx.dat"')
150 FORMAT(' RESTORING FROM "dindx.dat"')
READ(1,130) MXSCOR,STRBIT,EGMXSC
READ(1,130) RLNT,RDESC2,RDESC1,REXIT,RACTIO,RVAL,RFLAG
READ(1,130) OLNT,ODESC1,ODESC2,ODESCO,OACTIO,OFLAG1,OFLAG2,
& OFVAL,OTVAL,OSIZE,OCAPAC,OROOM,OADV,OCAN,
READ(1,130) R2LNT,OROOM2,RROOM2
READ(1,130) CLNT,CTICK,CACTIO
READ(1,130) VLNT,VILLNS,VPROB,VOPPS,VBEST,VMELEE
READ(1,130) ALNT,AROOM,ASCORE,AVEHIC,AOBJ,AACTIO,ASTREN,AFLAG
READ(1,130) MBASE,MLNT,RTEXT
C THE INTERNAL DATA BASE IS NOW ESTABLISHED.
C SET UP TO PLAY THE GAME.
1025 CALL ITIME(SHOUR,SMIN,SSEC)
CALL INIRND(or(DATARR(1),or(DATARR(2),DATARR(3))),
& or(SHOUR,or(SMIN,SSEC)))
PRINT 1050,RLNT,RMAX,XLNT,XMAX,OLNT,OMAX,MLNT,MMAX,
& VLNT,VMAX,ALNT,AMAX,CLNT,CMAX,R2LNT,R2MAX
1050 FORMAT('USED:'/I5,' OF',I5,' ROOMS'/
& I5,' OF',I5,' OBJECTS'/
& I5,' OF',I5,' MESSAGES'/
& I5,' OF',I5,' VILLAINS'/
& I5,' OF',I5,' ADVENTURERS'/
& I5,' OF',I5,' CLOCK EVENTS'/
& I5,' OF',I5,' ROOM2 SLOTS')
1050 FORMAT(' USED:'/1X,I5,' OF',I5,' ROOMS'/
& 1X,I5,' OF',I5,' EXITS'/
& 1X,I5,' OF',I5,' OBJECTS'/
& 1X,I5,' OF',I5,' MESSAGES'/
& 1X,I5,' OF',I5,' VILLAINS'/
& 1X,I5,' OF',I5,' ADVENTURERS'/
& 1X,I5,' OF',I5,' CLOCK EVENTS'/
& 1X,I5,' OF',I5,' ROOM2 SLOTS')
PRINT 1150,MXSCOR,EGMXSC,RECNO,RDESC2,MBASE,STRBIT
1150 FORMAT('MAX SCORE=',I5/'EG SCORE=',I5/
& 'MAX RECNO=',I5/'RDESC2 BASE=',I5/
& 'MELEE START=',I5/'STAR MASK=',I7)
1150 FORMAT(' MAX SCORE=',I5/' EG SCORE=',I5/
& ' MAX RECNO=',I5/' RDESC2 BASE=',I5/
& ' MELEE START=',I5/' STAR MASK=',I7)
1925 PRINT 920,I,J,K,VMAJ,VMIN,VEDIT
910 FORMAT('I can''t open ',INDXFILE,'.')
920 FORMAT('"dindx.dat" is version ',I1,'.',I1,A1,'.'/
& 'I require version ',I1,'.',I1,A1,'.')
960 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.')
910 FORMAT(' I can''t open ',INDXFILE,'.')
920 FORMAT(' "dindx.dat" is version ',I1,'.',I1,A1,'.'/
& ' I require version ',I1,'.',I1,A1,'.')
960 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 PROTCT-- CHECK FOR USER VIOLATION
C THIS ROUTINE SHOULD BE MODIFIED IF YOU WISH TO ADD SYSTEM
C DEPENDANT PROTECTION AGAINST ABUSE.
C AT THE MOMENT, PLAY IS PERMITTED UNDER ALL CIRCUMSTANCES.
LOGICAL FUNCTION PROTCT(X)