xref: /csrg-svn/contrib/dungeon/dinit.F (revision 35973)
1*35973Sbostic#include "files.h"
2*35973Sbostic
3*35973Sbostic#ifndef INDXFILE
4*35973Sbostic#define INDXFILE '/usr/games/lib/dunlib/dindx.dat'
5*35973Sbostic#endif
6*35973Sbostic#ifndef TEXTFILE
7*35973Sbostic#define TEXTFILE '/usr/games/lib/dunlib/dtext.dat'
8*35973Sbostic#endif
9*35973Sbostic#ifndef WIZARDID
10*35973Sbostic#define WIZARDID 0
11*35973Sbostic#endif
12*35973Sbostic
13*35973SbosticC INIT-- DUNGEON INITIALIZATION SUBROUTINE
14*35973SbosticC
15*35973SbosticC COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142
16*35973SbosticC ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED
17*35973SbosticC WRITTEN BY R. M. SUPNIK
18*35973SbosticC
19*35973SbosticC DECLARATIONS
20*35973SbosticC
21*35973Sbostic	LOGICAL FUNCTION INIT(X)
22*35973Sbostic	IMPLICIT INTEGER (A-Z)
23*35973Sbostic#ifndef PDP
24*35973Sbostic	LOGICAL PROTCT
25*35973Sbostic	INTEGER DATARR(3)
26*35973Sbostic#endif PDP
27*35973Sbostic#include "parser.h"
28*35973Sbostic#include "gamestate.h"
29*35973Sbostic#include "state.h"
30*35973Sbostic#include "screen.h"
31*35973Sbostic#include "mindex.h"
32*35973SbosticC
33*35973SbosticC MISCELLANEOUS VARIABLES
34*35973SbosticC
35*35973Sbostic	COMMON /STAR/ MBASE,STRBIT
36*35973Sbostic	COMMON /VERS/ VMAJ,VMIN,VEDIT
37*35973Sbostic	COMMON /TIME/ PLTIME,SHOUR,SMIN,SSEC
38*35973Sbostic#include "io.h"
39*35973Sbostic#include "debug.h"
40*35973Sbostic	COMMON /HYPER/ HFACTR
41*35973Sbostic#include "rooms.h"
42*35973Sbostic#include "rflag.h"
43*35973Sbostic#include "rindex.h"
44*35973Sbostic#include "exits.h"
45*35973Sbostic#include "curxt.h"
46*35973Sbostic#include "xpars.h"
47*35973Sbostic#include "objects.h"
48*35973Sbostic#include "oindex.h"
49*35973Sbostic#include "clock.h"
50*35973Sbostic#include "villians.h"
51*35973Sbostic#include "advers.h"
52*35973Sbostic#include "flags.h"
53*35973SbosticC INIT, PAGE 2
54*35973SbosticC
55*35973Sbostic#ifndef PDP
56*35973Sbostic#ifdef SYSV
57*35973SbosticC make output unbuffered
58*35973Sbostic	call unbuf
59*35973SbosticC
60*35973Sbostic#endif
61*35973SbosticC FIRST CHECK FOR PROTECTION VIOLATION
62*35973SbosticC
63*35973Sbostic	IF(PROTCT(X)) GO TO 10000
64*35973SbosticC						!PROTECTION VIOLATION?
65*35973Sbostic	PRINT 10100
66*35973Sbostic#ifdef NOCC
67*35973Sbostic10100	FORMAT('There appears before you a threatening figure clad '
68*35973Sbostic&	'all over'/'in heavy black armor.  His legs seem like the '
69*35973Sbostic&	'massive trunk'/'of the oak tree.  His broad shoulders and '
70*35973Sbostic&	'helmeted head loom'/'high over your own puny frame, and '
71*35973Sbostic&	'you realize that his powerful'/'arms could easily crush the '
72*35973Sbostic&	'very life from your body.  There'/'hangs from his belt a '
73*35973Sbostic&	'veritable arsenal of deadly weapons:'/'sword, mace, ball '
74*35973Sbostic&	'and chain, dagger, lance, and trident.'/'He speaks with a '
75*35973Sbostic&	'commanding voice:'//20X,'"You shall not pass."'//'As '
76*35973Sbostic&	'he grabs you by the neck all grows dim about you.')
77*35973Sbostic#else NOCC
78*35973Sbostic10100	FORMAT(' There appears before you a threatening figure clad '
79*35973Sbostic&	'all over'/' in heavy black armor.  His legs seem like the '
80*35973Sbostic&	'massive trunk'/' of the oak tree.  His broad shoulders and '
81*35973Sbostic&	'helmeted head loom'/' high over your own puny frame, and '
82*35973Sbostic&	'you realize that his powerful'/' arms could easily crush the '
83*35973Sbostic&	'very life from your body.  There'/' hangs from his belt a '
84*35973Sbostic&	'veritable arsenal of deadly weapons:'/' sword, mace, ball '
85*35973Sbostic&	'and chain, dagger, lance, and trident.'/' He speaks with a '
86*35973Sbostic&	'commanding voice:'//20X,'"You shall not pass."'//' As '
87*35973Sbostic&	'he grabs you by the neck all grows dim about you.')
88*35973Sbostic#endif NOCC
89*35973Sbostic	CALL EXIT
90*35973Sbostic#endif PDP
91*35973SbosticC
92*35973SbosticC NOW START INITIALIZATION PROPER
93*35973SbosticC
94*35973Sbostic#ifdef PDP
95*35973SbosticC
96*35973SbosticC   Note: arrays FLAGS & SWITCH are initialized in the following
97*35973SbosticC           DATA statements, instead of using DO loops and assignments
98*35973SbosticC           as used before.  This saves some code space.
99*35973SbosticC
100*35973Sbostic	DATA FLAGS/.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,
101*35973Sbostic&		   .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,
102*35973Sbostic&		   .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,
103*35973Sbostic&		    .TRUE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.TRUE.,
104*35973Sbostic&		   .FALSE.,.FALSE.,.FALSE.,.TRUE.,.FALSE.,.FALSE.,
105*35973Sbostic&		   .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,
106*35973Sbostic&		   .FALSE.,.FALSE.,.FALSE.,.TRUE.,.TRUE.,.FALSE.,
107*35973Sbostic&		    .TRUE.,.FALSE.,.FALSE.,.FALSE./
108*35973SbosticC
109*35973Sbostic	DATA SWITCH/0,0,0,0,0,0,0,0,0,
110*35973Sbostic&		    4,0,270,0,0,0,0,0,
111*35973Sbostic&		    1,1,0,0,10/
112*35973SbosticC
113*35973SbosticC   Note: SWITCH(13) or MLOC is initialized equal to MRB later.
114*35973SbosticC
115*35973SbosticC
116*35973Sbostic	DATA LTSHFT/10/
117*35973Sbostic	DATA EGSCOR/0/
118*35973Sbostic	DATA EGMXSC/0/
119*35973Sbostic	DATA MXLOAD/100/
120*35973Sbostic	DATA RWSCOR/0/
121*35973Sbostic	DATA DEATHS/0/
122*35973Sbostic	DATA MOVES/0/
123*35973Sbostic	DATA PLTIME/0/
124*35973Sbostic	DATA MUNGRM/0/
125*35973Sbostic	DATA HS/0/
126*35973Sbostic	DATA PRSA/0/
127*35973Sbostic	DATA PRSI/0/
128*35973Sbostic	DATA PRSO/0/
129*35973Sbostic	DATA PRSCON/1/
130*35973Sbostic	DATA OFLAG/0/
131*35973Sbostic	DATA OACT/0/
132*35973Sbostic	DATA OSLOT/0/
133*35973Sbostic	DATA OPREP/0/
134*35973Sbostic	DATA ONAME/0/
135*35973Sbostic	DATA THFFLG/.FALSE./
136*35973Sbostic	DATA THFACT/.TRUE./
137*35973Sbostic	DATA SWDACT/.FALSE./
138*35973Sbostic	DATA SWDSTA/0/
139*35973SbosticC
140*35973Sbostic	DATA RECNO/1/
141*35973Sbostic	DATA MBASE/0/
142*35973Sbostic	DATA INPCH/5/
143*35973Sbostic	DATA OUTCH/5/
144*35973Sbostic	DATA DBCH/2/
145*35973SbosticC
146*35973SbosticC INIT, PAGE 3
147*35973SbosticC
148*35973SbosticC
149*35973Sbostic	DATA DBGFLG/0/
150*35973Sbostic	DATA PRSFLG/0/
151*35973Sbostic	DATA GDTFLG/0/
152*35973SbosticC
153*35973Sbostic	FROMDR=0
154*35973Sbostic	SCOLRM=0
155*35973Sbostic	SCOLAC=0
156*35973Sbostic	INIT=.FALSE.
157*35973Sbostic	MLOC=MRB
158*35973SbosticC
159*35973SbosticC INIT, PAGE 4
160*35973SbosticC
161*35973SbosticC NOW RESTORE FROM EXISTING INDEX FILE.
162*35973SbosticC
163*35973Sbostic	call intrd(i)
164*35973Sbostic	call intrd(j)
165*35973Sbostic	call intrd(k)
166*35973Sbostic	IF((I.NE.VMAJ).OR.(J.NE.VMIN))
167*35973Sbostic&		GO TO 1925
168*35973SbosticC
169*35973Sbostic	call intrd(MXSCOR)
170*35973Sbostic	call intrd(STRBIT)
171*35973Sbostic	call intrd(EGMXSC)
172*35973SbosticC
173*35973Sbostic	call intrd(RLNT)
174*35973Sbostic	call intrd(RDESC2)
175*35973Sbostic	call aryrd(200,RDESC1)
176*35973Sbostic	call aryrd(200,REXIT)
177*35973Sbostic	call aryrd(200,RACTIO)
178*35973Sbostic	call aryrd(200,RVAL)
179*35973Sbostic	call aryrd(200,RFLAG)
180*35973SbosticC
181*35973Sbostic	call intrd(XLNT)
182*35973Sbostic	call aryrd(900,TRAVEL)
183*35973Sbostic	call intrd(OLNT)
184*35973Sbostic	call aryrd(220,ODESC1)
185*35973Sbostic	call aryrd(220,ODESC2)
186*35973Sbostic	call aryrd(220,ODESCO)
187*35973Sbostic	call aryrd(220,OACTIO)
188*35973Sbostic	call aryrd(220,OFLAG1)
189*35973Sbostic	call aryrd(220,OFLAG2)
190*35973Sbostic	call aryrd(220,OFVAL)
191*35973Sbostic	call aryrd(220,OTVAL)
192*35973Sbostic	call aryrd(220,OSIZE)
193*35973Sbostic	call aryrd(220,OCAPAC)
194*35973Sbostic	call aryrd(220,OROOM)
195*35973Sbostic	call aryrd(220,OADV)
196*35973Sbostic	call aryrd(220,OCAN)
197*35973Sbostic	call aryrd(220,OREAD)
198*35973SbosticC
199*35973Sbostic	call intrd(R2LNT)
200*35973Sbostic	call aryrd(20,OROOM2)
201*35973Sbostic	call aryrd(20,RROOM2)
202*35973SbosticC
203*35973Sbostic	call intrd(CLNT)
204*35973Sbostic	call aryrd(25,CTICK)
205*35973Sbostic	call aryrd(25,CACTIO)
206*35973SbosticC
207*35973Sbostic	do 990 i=1,25
208*35973Sbostic	cflag(i)=.TRUE.
209*35973Sbostic	call logrd(j)
210*35973Sbostic	if(j.EQ.0) CFLAG(i)=.FALSE.
211*35973Sbostic990	continue
212*35973SbosticC
213*35973Sbostic	call intrd(VLNT)
214*35973Sbostic	call aryrd(4,VILLNS)
215*35973Sbostic	call aryrd(4,VPROB)
216*35973Sbostic	call aryrd(4,VOPPS)
217*35973Sbostic	call aryrd(4,VBEST)
218*35973Sbostic	call aryrd(4,VMELEE)
219*35973SbosticC
220*35973Sbostic	call intrd(ALNT)
221*35973Sbostic	call aryrd(4,AROOM)
222*35973Sbostic	call aryrd(4,ASCORE)
223*35973Sbostic	call aryrd(4,AVEHIC)
224*35973Sbostic	call aryrd(4,AOBJ)
225*35973Sbostic	call aryrd(4,AACTIO)
226*35973Sbostic	call aryrd(4,ASTREN)
227*35973Sbostic	call aryrd(4,AFLAG)
228*35973SbosticC
229*35973Sbostic	call intrd(MBASE)
230*35973Sbostic	call intrd(MLNT)
231*35973SbosticC
232*35973SbosticC   The RTEXT array is not used here, and isn't read (it's used
233*35973SbosticC   in "speak.F")
234*35973SbosticC
235*35973Sbostic	call initnd
236*35973SbosticC
237*35973SbosticC INIT, PAGE 5
238*35973SbosticC
239*35973SbosticC THE INTERNAL DATA BASE IS NOW ESTABLISHED.
240*35973SbosticC SET UP TO PLAY THE GAME.
241*35973SbosticC
242*35973Sbostic1025	CALL ITIME(SHOUR,SMIN,SSEC)
243*35973Sbostic	CALL INIRND(or(SHOUR,or(SMIN,SSEC)))
244*35973SbosticC
245*35973Sbostic	WINNER=PLAYER
246*35973Sbostic	LASTIT=AOBJ(PLAYER)
247*35973Sbostic	HERE=AROOM(WINNER)
248*35973Sbostic	THFPOS=OROOM(THIEF)
249*35973Sbostic	BLOC=OROOM(BALLO)
250*35973Sbostic	INIT=.TRUE.
251*35973Sbostic#ifdef debug
252*35973SbosticC
253*35973SbosticC	Normally, PRSFLG is setable in gdt to allow seeing various
254*35973SbosticC	parse results.  Since the pdp version does not have gdt,
255*35973SbosticC	PRSFLG is set to show full debugging info when debug is enabled.
256*35973SbosticC
257*35973Sbostic	PRSFLG=65535
258*35973Sbostic#endif debug
259*35973SbosticC
260*35973SbosticC
261*35973Sbostic	RETURN
262*35973SbosticC INIT, PAGE 6
263*35973SbosticC
264*35973SbosticC ERRORS-- INIT FAILS.
265*35973SbosticC
266*35973Sbostic1925	continue
267*35973Sbostic	END
268*35973Sbostic#else PDP
269*35973Sbostic10000	INIT=.FALSE.
270*35973SbosticC						!ASSUME INIT FAILS.
271*35973Sbostic	MMAX=1050
272*35973SbosticC						!SET UP ARRAY LIMITS.
273*35973Sbostic	OMAX=220
274*35973Sbostic	RMAX=200
275*35973Sbostic	VMAX=4
276*35973Sbostic	AMAX=4
277*35973Sbostic	CMAX=25
278*35973Sbostic	FMAX=46
279*35973Sbostic	SMAX=22
280*35973Sbostic	XMAX=900
281*35973Sbostic	R2MAX=20
282*35973Sbostic	DIRMAX=15
283*35973SbosticC
284*35973Sbostic	MLNT=0
285*35973SbosticC						!INIT ARRAY COUNTERS.
286*35973Sbostic	OLNT=0
287*35973Sbostic	RLNT=0
288*35973Sbostic	VLNT=0
289*35973Sbostic	ALNT=0
290*35973Sbostic	CLNT=0
291*35973Sbostic	XLNT=1
292*35973Sbostic	R2LNT=0
293*35973SbosticC
294*35973Sbostic	LTSHFT=10
295*35973SbosticC						!SET UP STATE VARIABLES.
296*35973Sbostic	MXSCOR=LTSHFT
297*35973Sbostic	EGSCOR=0
298*35973Sbostic	EGMXSC=0
299*35973Sbostic	MXLOAD=100
300*35973Sbostic	RWSCOR=0
301*35973Sbostic	DEATHS=0
302*35973Sbostic	MOVES=0
303*35973Sbostic	PLTIME=0
304*35973Sbostic	MUNGRM=0
305*35973Sbostic	HS=0
306*35973Sbostic	PRSA=0
307*35973SbosticC						!CLEAR PARSE VECTOR.
308*35973Sbostic	PRSI=0
309*35973Sbostic	PRSO=0
310*35973Sbostic	PRSCON=1
311*35973Sbostic	OFLAG=0
312*35973SbosticC						!CLEAR ORPHANS.
313*35973Sbostic	OACT=0
314*35973Sbostic	OSLOT=0
315*35973Sbostic	OPREP=0
316*35973Sbostic	ONAME=0
317*35973Sbostic	THFFLG=.FALSE.
318*35973SbosticC						!THIEF NOT INTRODUCED BUT
319*35973Sbostic	THFACT=.TRUE.
320*35973SbosticC						!IS ACTIVE.
321*35973Sbostic	SWDACT=.FALSE.
322*35973SbosticC						!SWORD IS INACTIVE.
323*35973Sbostic	SWDSTA=0
324*35973SbosticC						!SWORD IS OFF.
325*35973SbosticC
326*35973Sbostic	RECNO=1
327*35973SbosticC						!INIT DB FILE POINTER.
328*35973Sbostic	MBASE=0
329*35973SbosticC						!INIT MELEE BASE.
330*35973SbosticC   LOGICAL UNIT NRS: 5=STDIN, 6=STDOUT
331*35973Sbostic	INPCH=5
332*35973SbosticC						!TTY INPUT
333*35973Sbostic	OUTCH=6
334*35973Sbostic	DBCH=2
335*35973SbosticC						!DATA BASE.
336*35973SbosticC INIT, PAGE 3
337*35973SbosticC
338*35973SbosticC INIT ALL ARRAYS.
339*35973SbosticC
340*35973Sbostic	DO 5 I=1,CMAX
341*35973SbosticC						!CLEAR CLOCK EVENTS
342*35973Sbostic	  CFLAG(I)=.FALSE.
343*35973Sbostic	  CTICK(I)=0
344*35973Sbostic	  CACTIO(I)=0
345*35973Sbostic5	CONTINUE
346*35973SbosticC
347*35973Sbostic	DO 10 I=1,FMAX
348*35973SbosticC						!CLEAR FLAGS.
349*35973Sbostic	  FLAGS(I)=.FALSE.
350*35973Sbostic10	CONTINUE
351*35973Sbostic	BUOYF=.TRUE.
352*35973SbosticC						!SOME START AS TRUE.
353*35973Sbostic	EGYPTF=.TRUE.
354*35973Sbostic	CAGETF=.TRUE.
355*35973Sbostic	MR1F=.TRUE.
356*35973Sbostic	MR2F=.TRUE.
357*35973Sbostic	FOLLWF=.TRUE.
358*35973Sbostic	DO 12 I=1,SMAX
359*35973SbosticC						!CLEAR SWITCHES.
360*35973Sbostic	  SWITCH(I)=0
361*35973Sbostic12	CONTINUE
362*35973Sbostic	ORMTCH=4
363*35973SbosticC						!NUMBER OF MATCHES.
364*35973Sbostic	LCELL=1
365*35973Sbostic	PNUMB=1
366*35973Sbostic	MDIR=270
367*35973Sbostic	MLOC=MRB
368*35973Sbostic	CPHERE=10
369*35973SbosticC
370*35973Sbostic	DO 15 I=1,R2MAX
371*35973SbosticC						!CLEAR ROOM 2 ARRAY.
372*35973Sbostic	  RROOM2(I)=0
373*35973Sbostic	  OROOM2(I)=0
374*35973Sbostic15	CONTINUE
375*35973SbosticC
376*35973Sbostic	DO 20 I=1,XMAX
377*35973SbosticC						!CLEAR TRAVEL ARRAY.
378*35973Sbostic	  TRAVEL(I)=0
379*35973Sbostic20	CONTINUE
380*35973SbosticC
381*35973Sbostic	DO 30 I=1,VMAX
382*35973SbosticC						!CLEAR VILLAINS ARRAYS.
383*35973Sbostic	  VOPPS(I)=0
384*35973Sbostic	  VPROB(I)=0
385*35973Sbostic	  VILLNS(I)=0
386*35973Sbostic	  VBEST(I)=0
387*35973Sbostic	  VMELEE(I)=0
388*35973Sbostic30	CONTINUE
389*35973SbosticC
390*35973Sbostic	DO 40 I=1,OMAX
391*35973SbosticC						!CLEAR OBJECT ARRAYS.
392*35973Sbostic	  ODESC1(I)=0
393*35973Sbostic	  ODESC2(I)=0
394*35973Sbostic	  ODESCO(I)=0
395*35973Sbostic	  OREAD(I)=0
396*35973Sbostic	  OACTIO(I)=0
397*35973Sbostic	  OFLAG1(I)=0
398*35973Sbostic	  OFLAG2(I)=0
399*35973Sbostic	  OFVAL(I)=0
400*35973Sbostic	  OTVAL(I)=0
401*35973Sbostic	  OSIZE(I)=0
402*35973Sbostic	  OCAPAC(I)=0
403*35973Sbostic	  OCAN(I)=0
404*35973Sbostic	  OADV(I)=0
405*35973Sbostic	  OROOM(I)=0
406*35973Sbostic40	CONTINUE
407*35973SbosticC
408*35973Sbostic	RDESC2=0
409*35973SbosticC						!CLEAR DESC BASE PTR.
410*35973Sbostic	DO 50 I=1,RMAX
411*35973SbosticC						!CLEAR ROOM ARRAYS.
412*35973Sbostic	  RDESC1(I)=0
413*35973Sbostic	  RACTIO(I)=0
414*35973Sbostic	  RFLAG(I)=0
415*35973Sbostic	  RVAL(I)=0
416*35973Sbostic	  REXIT(I)=0
417*35973Sbostic50	CONTINUE
418*35973SbosticC
419*35973Sbostic	DO 60 I=1,MMAX
420*35973SbosticC						!CLEAR MESSAGE DIRECTORY.
421*35973Sbostic	  RTEXT(I)=0
422*35973Sbostic60	CONTINUE
423*35973SbosticC
424*35973Sbostic	DO 70 I=1,AMAX
425*35973SbosticC						!CLEAR ADVENTURER'S ARRAYS.
426*35973Sbostic	  AROOM(I)=0
427*35973Sbostic	  ASCORE(I)=0
428*35973Sbostic	  AVEHIC(I)=0
429*35973Sbostic	  AOBJ(I)=0
430*35973Sbostic	  AACTIO(I)=0
431*35973Sbostic	  ASTREN(I)=0
432*35973Sbostic	  AFLAG(I)=0
433*35973Sbostic70	CONTINUE
434*35973SbosticC
435*35973Sbostic	DBGFLG=0
436*35973Sbostic	PRSFLG=0
437*35973Sbostic	GDTFLG=0
438*35973SbosticC
439*35973SbosticC allow setting gdtflg true if user id matches wizard id
440*35973SbosticC this way, the wizard doesn't have to recompile to use gdt
441*35973SbosticC
442*35973Sbostic	if (getuid() .eq. WIZARDID) gdtflg=1
443*35973SbosticC
444*35973Sbostic	FROMDR=0
445*35973SbosticC						!INIT SCOL GOODIES.
446*35973Sbostic	SCOLRM=0
447*35973Sbostic	SCOLAC=0
448*35973SbosticC INIT, PAGE 4
449*35973SbosticC
450*35973SbosticC NOW RESTORE FROM EXISTING INDEX FILE.
451*35973SbosticC
452*35973Sbostic	OPEN(UNIT=1,file=INDXFILE,status='OLD',
453*35973Sbostic#ifdef XELOS
454*35973Sbostic&		FORM='FORMATTED',ACCESS='SEQUENTIAL',ERR=1900,recl=1)
455*35973Sbostic#else
456*35973Sbostic&		FORM='FORMATTED',ACCESS='SEQUENTIAL',ERR=1900)
457*35973Sbostic#endif
458*35973Sbostic	rewind(unit=1, err=1900)
459*35973Sbostic	READ(1,130) I,J,K
460*35973SbosticC						!GET VERSION.
461*35973Sbostic	IF((I.NE.VMAJ).OR.(J.NE.VMIN))
462*35973Sbostic&		GO TO 1925
463*35973Sbostic
464*35973Sbostic	OPEN(UNIT=DBCH,file=TEXTFILE,status='OLD',
465*35973Sbostic&		FORM='UNFORMATTED',ACCESS='DIRECT',
466*35973Sbostic&		recl=76,ERR=1950)
467*35973Sbostic	rewind(unit=dbch, err=1950)
468*35973Sbostic
469*35973Sbostic#ifdef debug
470*35973Sbostic	PRINT 150
471*35973Sbostic#ifdef NOCC
472*35973Sbostic150	FORMAT('RESTORING FROM "dindx.dat"')
473*35973Sbostic#else NOCC
474*35973Sbostic150	FORMAT(' RESTORING FROM "dindx.dat"')
475*35973Sbostic#endif NOCC
476*35973Sbostic#endif debug
477*35973Sbostic	READ(1,130) MXSCOR,STRBIT,EGMXSC
478*35973Sbostic	READ(1,130) RLNT,RDESC2,RDESC1,REXIT,RACTIO,RVAL,RFLAG
479*35973Sbostic	READ(1,130) XLNT,TRAVEL
480*35973Sbostic	READ(1,130) OLNT,ODESC1,ODESC2,ODESCO,OACTIO,OFLAG1,OFLAG2,
481*35973Sbostic&		OFVAL,OTVAL,OSIZE,OCAPAC,OROOM,OADV,OCAN,
482*35973Sbostic&		OREAD
483*35973Sbostic	READ(1,130) R2LNT,OROOM2,RROOM2
484*35973Sbostic	READ(1,130) CLNT,CTICK,CACTIO
485*35973Sbostic	READ(1,135) CFLAG
486*35973Sbostic	READ(1,130) VLNT,VILLNS,VPROB,VOPPS,VBEST,VMELEE
487*35973Sbostic	READ(1,130) ALNT,AROOM,ASCORE,AVEHIC,AOBJ,AACTIO,ASTREN,AFLAG
488*35973Sbostic	READ(1,130) MBASE,MLNT,RTEXT
489*35973SbosticC
490*35973Sbostic	CLOSE(1)
491*35973Sbostic	GO TO 1025
492*35973SbosticC						!INIT DONE.
493*35973SbosticC
494*35973SbosticC 130	FORMAT(I8)
495*35973Sbostic130	FORMAT(I6)
496*35973Sbostic135	FORMAT(L4)
497*35973SbosticC INIT, PAGE 5
498*35973SbosticC
499*35973SbosticC THE INTERNAL DATA BASE IS NOW ESTABLISHED.
500*35973SbosticC SET UP TO PLAY THE GAME.
501*35973SbosticC
502*35973Sbostic1025	CALL ITIME(SHOUR,SMIN,SSEC)
503*35973SbosticC						!GET TIME AND DATE.
504*35973SbosticC	CALL IDATE(I,J,K)
505*35973Sbostic	CALL IDATE(DATARR(1))
506*35973Sbostic	CALL INIRND(or(DATARR(1),or(DATARR(2),DATARR(3))),
507*35973Sbostic&		or(SHOUR,or(SMIN,SSEC)))
508*35973SbosticC
509*35973Sbostic	WINNER=PLAYER
510*35973Sbostic	LASTIT=AOBJ(PLAYER)
511*35973Sbostic	HERE=AROOM(WINNER)
512*35973Sbostic	THFPOS=OROOM(THIEF)
513*35973Sbostic	BLOC=OROOM(BALLO)
514*35973Sbostic	INIT=.TRUE.
515*35973SbosticC
516*35973Sbostic#ifdef debug
517*35973Sbostic	PRINT 1050,RLNT,RMAX,XLNT,XMAX,OLNT,OMAX,MLNT,MMAX,
518*35973Sbostic&	  VLNT,VMAX,ALNT,AMAX,CLNT,CMAX,R2LNT,R2MAX
519*35973Sbostic#ifdef NOCC
520*35973Sbostic1050	FORMAT('USED:'/I5,' OF',I5,' ROOMS'/
521*35973Sbostic&	  I5,' OF',I5,' EXITS'/
522*35973Sbostic&	  I5,' OF',I5,' OBJECTS'/
523*35973Sbostic&	  I5,' OF',I5,' MESSAGES'/
524*35973Sbostic&	  I5,' OF',I5,' VILLAINS'/
525*35973Sbostic&	  I5,' OF',I5,' ADVENTURERS'/
526*35973Sbostic&	  I5,' OF',I5,' CLOCK EVENTS'/
527*35973Sbostic&	  I5,' OF',I5,' ROOM2 SLOTS')
528*35973Sbostic#else NOCC
529*35973Sbostic1050	FORMAT(' USED:'/1X,I5,' OF',I5,' ROOMS'/
530*35973Sbostic&	  1X,I5,' OF',I5,' EXITS'/
531*35973Sbostic&	  1X,I5,' OF',I5,' OBJECTS'/
532*35973Sbostic&	  1X,I5,' OF',I5,' MESSAGES'/
533*35973Sbostic&	  1X,I5,' OF',I5,' VILLAINS'/
534*35973Sbostic&	  1X,I5,' OF',I5,' ADVENTURERS'/
535*35973Sbostic&	  1X,I5,' OF',I5,' CLOCK EVENTS'/
536*35973Sbostic&	  1X,I5,' OF',I5,' ROOM2 SLOTS')
537*35973Sbostic#endif NOCC
538*35973Sbostic	PRINT 1150,MXSCOR,EGMXSC,RECNO,RDESC2,MBASE,STRBIT
539*35973Sbostic#ifdef NOCC
540*35973Sbostic1150	FORMAT('MAX SCORE=',I5/'EG SCORE=',I5/
541*35973Sbostic&	  'MAX RECNO=',I5/'RDESC2 BASE=',I5/
542*35973Sbostic&	  'MELEE START=',I5/'STAR MASK=',I7)
543*35973Sbostic#else NOCC
544*35973Sbostic1150	FORMAT(' MAX SCORE=',I5/' EG SCORE=',I5/
545*35973Sbostic&	  ' MAX RECNO=',I5/' RDESC2 BASE=',I5/
546*35973Sbostic&	  ' MELEE START=',I5/' STAR MASK=',I7)
547*35973Sbostic#endif NOCC
548*35973Sbostic	PAUSE 1
549*35973Sbostic#endif debug
550*35973SbosticC
551*35973Sbostic	RETURN
552*35973SbosticC INIT, PAGE 6
553*35973SbosticC
554*35973SbosticC ERRORS-- INIT FAILS.
555*35973SbosticC
556*35973Sbostic1900	PRINT 910
557*35973Sbostic	PRINT 980
558*35973Sbostic	RETURN
559*35973Sbostic1925	PRINT 920,I,J,K,VMAJ,VMIN,VEDIT
560*35973Sbostic	PRINT 980
561*35973Sbostic	RETURN
562*35973Sbostic1950	PRINT 960
563*35973Sbostic	PRINT 980
564*35973Sbostic	RETURN
565*35973Sbostic#ifdef NOCC
566*35973Sbostic910	FORMAT('I can''t open ',INDXFILE,'.')
567*35973Sbostic920	FORMAT('"dindx.dat" is version ',I1,'.',I1,A1,'.'/
568*35973Sbostic&		'I require version ',I1,'.',I1,A1,'.')
569*35973Sbostic960	FORMAT('I can''t open ',TEXTFILE,'.')
570*35973Sbostic980	FORMAT('Suddenly a sinister, wraithlike figure appears before '
571*35973Sbostic&	'you,'/'seeming to float in the air.  In a low, sorrowful voice'
572*35973Sbostic&	' he says,'/'"Alas, the very nature of the world has changed, '
573*35973Sbostic&	'and the dungeon'/'cannot be found.  All must now pass away."'
574*35973Sbostic&	'  Raising his oaken staff'/'in farewell, he fades into the '
575*35973Sbostic&	'spreading darkness.  In his place'/'appears a tastefully '
576*35973Sbostic&	'lettered sign reading:'//23X,'INITIALIZATION FAILURE'//
577*35973Sbostic&	'The darkness becomes all encompassing, and your vision fails.')
578*35973Sbostic#else NOCC
579*35973Sbostic910	FORMAT(' I can''t open ',INDXFILE,'.')
580*35973Sbostic920	FORMAT(' "dindx.dat" is version ',I1,'.',I1,A1,'.'/
581*35973Sbostic&		' I require version ',I1,'.',I1,A1,'.')
582*35973Sbostic960	FORMAT(' I can''t open ',TEXTFILE,'.')
583*35973Sbostic980	FORMAT(' Suddenly a sinister, wraithlike figure appears before '
584*35973Sbostic&	'you,'/' seeming to float in the air.  In a low, sorrowful voice'
585*35973Sbostic&	' he says,'/' "Alas, the very nature of the world has changed, '
586*35973Sbostic&	'and the dungeon'/' cannot be found.  All must now pass away."'
587*35973Sbostic&	'  Raising his oaken staff'/' in farewell, he fades into the '
588*35973Sbostic&	'spreading darkness.  In his place'/' appears a tastefully '
589*35973Sbostic&	'lettered sign reading:'//23X,'INITIALIZATION FAILURE'//
590*35973Sbostic&	' The darkness becomes all encompassing, and your vision fails.')
591*35973Sbostic#endif NOCC
592*35973SbosticC
593*35973Sbostic	END
594*35973SbosticC PROTCT-- CHECK FOR USER VIOLATION
595*35973SbosticC
596*35973SbosticC THIS ROUTINE SHOULD BE MODIFIED IF YOU WISH TO ADD SYSTEM
597*35973SbosticC DEPENDANT PROTECTION AGAINST ABUSE.
598*35973SbosticC
599*35973SbosticC AT THE MOMENT, PLAY IS PERMITTED UNDER ALL CIRCUMSTANCES.
600*35973SbosticC
601*35973Sbostic	LOGICAL FUNCTION PROTCT(X)
602*35973Sbostic	IMPLICIT INTEGER(A-Z)
603*35973SbosticC
604*35973Sbostic	PROTCT=.TRUE.
605*35973Sbostic	RETURN
606*35973Sbostic	END
607*35973Sbostic#endif PDP
608