disk8: Initial commit
[pdp8.git] / sw / adventure / RSTRGM.FT
1 C SAVE/RESTORE PROCESSOR
2 C
3 C WRITTEN BY BOB SUPNIK
4 C DISK ENGINEERING
5 C 25-AUG-78
6 C
7 C CURRENT LIMITS:
8 C 750 TRAVEL OPTIONS (TRAVEL, TRVSIZ).
9 C 300 VOCABULARY WORDS (KTAB, ATAB, TABSIZ).
10 C 150 LOCATIONS (LTEXT, STEXT, KEY, COND, ABB, ATLOC, LOCSIZ).
11 C 100 OBJECTS (PLAC, PLACE, FIXD, FIXED, LINK (TWICE), PTEXT, PROP).
12 C 35 "ACTION" VERBS (ACTSPK, VRBSIZ).
13 C 205 RANDOM MESSAGES (RTEXT, RTXSIZ).
14 C 12 DIFFERENT PLAYER CLASSIFICATIONS (CTEXT, CVAL, CLSMAX).
15 C 20 HINTS, LESS 3 (HINTLC, HINTED, HINTS, HNTSIZ).
16 C THERE ARE ALSO LIMITS WHICH CANNOT BE EXCEEDED DUE TO THE STRUCTURE OF
17 C THE DATABASE. (E.G., THE VOCABULARY USES N/1000 TO DETERMINE WORD TYPE,
18 C SO THERE CAN'T BE MORE THAN 1000 WORDS.) THESE UPPER LIMITS ARE:
19 C 1000 NON-SYNONYMOUS VOCABULARY WORDS
20 C 300 LOCATIONS
21 C 100 OBJECTS
22 C
23 SUBROUTINE RSTRGM(F1,F2)
24 LOGICAL F1
25 INTEGER F2
26 C IMPLICIT INTEGER (A-Z)
27 LOGICAL LMWARN,CLOSNG,PANIC,HINTED,
28 1 CLOSED,GAVEUP,SCORNG,DSEEN
29 C
30 COMMON /VERSN/ VMAJ, VMIN, VEDIT
31 INTEGER VMAJ, VMIN, VEDIT
32 COMMON /FILES/ INDXNM, TEXTNM, SAVENM
33 INTEGER INDXNM(3), TEXTNM(3), SAVENM(3)
34 COMMON /TXTCOM/ RTEXT,LINES,ASCVAR,TXTLOC,DATA
35 COMMON /VOCCOM/ KTAB,ATAB,TABSIZ
36 COMMON /PLACOM/ ATLOC,LINK,PLACE,FIXED,HOLDNG
37 COMMON /PTXCOM/ PTEXT
38 COMMON /ABBCOM/ ABB
39 COMMON /MISCOM/ LINUSE,TRVS,CLSSES,OLDLOC,LOC,CVAL,TK,NEWLOC,
40 1 KEY,PLAC,FIXD,ACTSPK,COND,HINTS,HNTMAX,PROP,TALLY,TALLY2,
41 2 HINTLC,CHLOC,CHLOC2,DSEEN,DFLAG,DLOC,DALTLC,KEYS,LAMP,GRATE
42 COMMON /MISCOM/
43 3 CAGE,ROD,ROD2,STEPS,BIRD,DOOR,PILLOW,SNAKE,FISSUR,TABLET,
44 4 CLAM,OYSTER,MAGZIN,DWARF,KNIFE,FOOD,BOTTLE,WATER,OIL,PLANT,
45 5 PLANT2,AXE,MIRROR,DRAGON,CHASM,TROLL,TROLL2,BEAR,MESSAG,VEND,
46 6 BATTER,NUGGET,COINS,CHEST,EGGS,TRIDNT,VASE,EMRALD,PYRAM
47 COMMON /MISCOM/
48 7 PEARL,RUG,CHAIN,BACK,LOOK,CAVE,NULL,ENTRNC,DPRSSN,SAY,LOCK,
49 8 THROW,FIND,INVENT,TURNS,LMWARN,KNFLOC,DETAIL,ABBNUM,
50 9 NUMDIE,MAXDIE,DKILL,FOOBAR,BONUS,CLOCK1,CLOCK2,
51 1 CLOSNG,PANIC,CLOSED,GAVEUP,SCORNG,ODLOC,STREAM,SPICES
52 COMMON /MISC2/ I,RTXSIZ,CLSMAX,LOCSIZ,CTEXT,STEXT,LTEXT,
53 1 SECT,TRAVEL,TRVCON,TRVLOC,TRVSIZ,TABNDX,OBJ,J,K,VERB,HNTSIZ,
54 2 MAXTRS,HINTED,HNTLOC,KK
55 COMMON /MISC3/ATTACK,DTOTAL,OLDLC2,LIMIT,MXSCOR,SCORE,
56 1 STICK,WZDARK
57 C
58 INTEGER LINES(12),DATA(78)
59 C The TRAVEL, TRVCON, and TRVLOC arrays are
60 C Packed with words 0,1,2 holding the data. Saves lots
61 C of wasted space at the expense of some complexity.
62 INTEGER TRAVEL(250), TRVCON(250), TRVLOC(250), TRVSIZ
63 INTEGER KTAB(300),ATAB(300),TABSIZ
64 INTEGER LTEXT(150),STEXT(150),KEY(150),COND(150),ABB(150),
65 1 ATLOC(150)
66 INTEGER PLAC(100),PLACE(100),FIXD(100),FIXED(100),LINK(200),
67 1 PTEXT(100),PROP(100),HOLDNG
68 INTEGER ACTSPK(35)
69 INTEGER RTEXT(205)
70 INTEGER CTEXT(12),CVAL(12)
71 INTEGER HINTLC(20),HINTS(20,4)
72 DIMENSION HINTED(20)
73 INTEGER TK(20),DLOC(6),ODLOC(6)
74 DIMENSION DSEEN(6)
75 INTEGER ASCVAR, TXTLOC, TRVS, CLSSES, OLDLOC
76 INTEGER HNTSIZ, HNTMAX, TALLY, TALLY2, CHLOC, CHLOC2, DFLAG
77 INTEGER DALTLC,GRATE,CAGE,ROD,ROD2,STEPS,BIRD,DOOR,PILLOW,SNAKE
78 INTEGER FISSUR,TABLET,CLAM,OYSTER,MAGZIN,DWARF,KNIFE,FOOD,BOTTLE
79 INTEGER WATER,OIL,PLANT,PLANT2,AXE,MIRROR,DRAGON,CHASM,EMRALD
80 INTEGER BEAR,MESSAG,VEND,BATTER,COINS,CHEST,EGGS,TRIDNT,VASE
81 INTEGER PYRAM,PEARL,RUG,CHAIN,BACK,LOOK,CAVE,NULL,ENTRNC,DPRSSN
82 INTEGER LOCK,THROW,FIND,INVENT,TURNS,KNFLOC,DETAIL,ABBNUM,SAY
83 INTEGER NUMDIE,MAXDIE,DKILL,FOOBAR,BONUS,CLOCK1,CLOCK2
84 INTEGER TROLL,TROLL2,STREAM,SPICES
85 INTEGER RTXSIZ,CLSMAX,LOCSIZ,SECT,TABNDX,OBJ
86 INTEGER VERB,HNTLOC,KK
87 INTEGER ATTACK,DTOTAL,OLDLC2,LIMIT,MXSCOR,SCORE,STICK,WZDARK
88 C
89 C USR call - FORTRAN unit, filename, operation, error flag
90 C Operation is 2, open input; 3 open output; 4 close output.
91 C Calling "CLOSE" on an input file causes it to be deleted!
92 C
93 IF (.NOT. F1) GOTO 10
94 C
95 C Attempt to restore saved database
96 C
97 CALL USR(7, SAVENM, 2, IERR)
98 IF (IERR.NE.0) GOTO 60
99 GOTO 20
100 C
101 C Attempt to restore initial database
102 C
103 10 CALL USR(7, INDXNM, 2, IERR)
104 IF (IERR.EQ.0) GOTO 20
105 F2=-1
106 RETURN
107 C
108 20 READ(7) I1,I2,I3
109 IF((I1.NE.VMAJ).OR.(I2.NE.VMIN)) GO TO 50
110 READ(7) RTEXT,KTAB,ATAB
111 READ(7) ATLOC,LINK,PLACE,FIXED,HOLDNG
112 READ(7) PTEXT,ABB,LINUSE,TRVS,CLSSES
113 READ(7) OLDLOC,LOC,CVAL,NEWLOC,KEY
114 READ(7) PLAC,FIXD,ACTSPK,COND,HINTS
115 READ(7) HNTMAX,PROP,TALLY,TALLY2,HINTLC
116 READ(7) CHLOC,CHLOC2,DSEEN,DFLAG,DLOC,DALTLC
117 READ(7) TURNS,LMWARN,KNFLOC,DETAIL,ABBNUM
118 READ(7) NUMDIE,MAXDIE,DKILL,FOOBAR,BONUS
119 READ(7) CLOCK1,CLOCK2,CLOSNG,PANIC,CLOSED
120 READ(7) GAVEUP,SCORNG,ODLOC,CTEXT,STEXT,LTEXT
121 READ(7) TRAVEL,TRVCON,TRVLOC,MAXTRS,HINTED,HNTLOC
122 READ(7) ATTACK,DTOTAL,OLDLC2,LIMIT,MXSCOR,SCORE,STICK,WZDARK
123 C
124 C CLOSNG = 0
125 IF(F1) CALL SIXOUT('R]ESTORED.@',5,0)
126 F2=0
127 RETURN
128 50 IF(F1) CALL SIXOUT('F]ILE IS OBSOLETE, [RESTORE] FAILS.',18,0)
129 F2=-1
130 RETURN
131 60 CALL SIXOUT('C]AN''T OPEN SAVE FILE, [RESTORE] FAILS.', 22, 0)
132 F2=-1
133 RETURN
134 END