3 * The Regents of the University of California. All rights reserved.
5 * The game adventure was originally written in Fortran by Will Crowther
6 * and Don Woods. It was later translated to C and enhanced by Jim
7 * Gillogly. This code is derived from software contributed to Berkeley
8 * by Jim Gillogly at The Rand Corporation.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * @(#)init.c 8.1 (Berkeley) 6/2/93
39 * $FreeBSD: src/games/adventure/init.c,v 1.9.2.1 2001/03/05 11:43:11 kris Exp $
40 * $DragonFly: src/games/adventure/init.c,v 1.3 2004/09/12 17:19:58 dillon Exp $
43 /* Re-coding of advent in C: data initialization */
45 #include <sys/types.h>
53 int setbit[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000,
54 010000,020000,040000,0100000};
56 static void linkdata (void);
59 init() /* everything for 1st time run */
61 rdata(); /* read data from orig. file */
67 const char *a,*b,*c,*d,*e;
81 linkdata() /* secondary data manipulation */
85 for (i=1; i<=LOCSIZ; i++)
86 if (ltext[i].seekadr!=0 && travel[i] != 0)
87 if ((travel[i]->tverb)==1) cond[i]=2;
90 { drop(j+100,fixd[j]);
95 if (plac[j]!=0 && fixd[j]<=0) drop(j,plac[j]);
102 for (i=50; i<=maxtrs; i++)
103 { if (ptext[i].seekadr!=0) prop[i] = -1;
107 /* define mnemonics */
108 keys = vocab(DECR(k,e,y,s,\0), 1, 0);
109 lamp = vocab(DECR(l,a,m,p,\0), 1, 0);
110 grate = vocab(DECR(g,r,a,t,e), 1, 0);
111 cage = vocab(DECR(c,a,g,e,\0),1, 0);
112 rod = vocab(DECR(r,o,d,\0,\0),1, 0);
114 steps=vocab(DECR(s,t,e,p,s),1, 0);
115 bird = vocab(DECR(b,i,r,d,\0),1, 0);
116 door = vocab(DECR(d,o,o,r,\0),1, 0);
117 pillow= vocab(DECR(p,i,l,l,o), 1, 0);
118 snake = vocab(DECR(s,n,a,k,e), 1, 0);
119 fissur= vocab(DECR(f,i,s,s,u), 1, 0);
120 tablet= vocab(DECR(t,a,b,l,e), 1, 0);
121 clam = vocab(DECR(c,l,a,m,\0),1, 0);
122 oyster= vocab(DECR(o,y,s,t,e), 1, 0);
123 magzin= vocab(DECR(m,a,g,a,z), 1, 0);
124 dwarf = vocab(DECR(d,w,a,r,f), 1, 0);
125 knife = vocab(DECR(k,n,i,f,e), 1, 0);
126 food = vocab(DECR(f,o,o,d,\0),1, 0);
127 bottle= vocab(DECR(b,o,t,t,l), 1, 0);
128 water = vocab(DECR(w,a,t,e,r), 1, 0);
129 oil = vocab(DECR(o,i,l,\0,\0),1, 0);
130 plant = vocab(DECR(p,l,a,n,t), 1, 0);
132 axe = vocab(DECR(a,x,e,\0,\0), 1, 0);
133 mirror= vocab(DECR(m,i,r,r,o), 1, 0);
134 dragon= vocab(DECR(d,r,a,g,o), 1, 0);
135 chasm = vocab(DECR(c,h,a,s,m), 1, 0);
136 troll = vocab(DECR(t,r,o,l,l), 1, 0);
138 bear = vocab(DECR(b,e,a,r,\0),1, 0);
139 messag= vocab(DECR(m,e,s,s,a), 1, 0);
140 vend = vocab(DECR(v,e,n,d,i), 1, 0);
141 batter= vocab(DECR(b,a,t,t,e), 1, 0);
143 nugget= vocab(DECR(g,o,l,d,\0),1, 0);
144 coins = vocab(DECR(c,o,i,n,s), 1, 0);
145 chest = vocab(DECR(c,h,e,s,t), 1, 0);
146 eggs = vocab(DECR(e,g,g,s,\0),1, 0);
147 tridnt= vocab(DECR(t,r,i,d,e), 1, 0);
148 vase = vocab(DECR(v,a,s,e,\0),1, 0);
149 emrald= vocab(DECR(e,m,e,r,a), 1, 0);
150 pyram = vocab(DECR(p,y,r,a,m), 1, 0);
151 pearl = vocab(DECR(p,e,a,r,l), 1, 0);
152 rug = vocab(DECR(r,u,g,\0,\0),1, 0);
153 chain = vocab(DECR(c,h,a,i,n), 1, 0);
155 back = vocab(DECR(b,a,c,k,\0),0, 0);
156 look = vocab(DECR(l,o,o,k,\0),0, 0);
157 cave = vocab(DECR(c,a,v,e,\0),0, 0);
158 null = vocab(DECR(n,u,l,l,\0),0, 0);
159 entrnc= vocab(DECR(e,n,t,r,a), 0, 0);
160 dprssn= vocab(DECR(d,e,p,r,e), 0, 0);
161 enter = vocab(DECR(e,n,t,e,r), 0, 0);
163 pour = vocab(DECR(p,o,u,r,\0), 2, 0);
164 say = vocab(DECR(s,a,y,\0,\0),2, 0);
165 lock = vocab(DECR(l,o,c,k,\0),2, 0);
166 throw = vocab(DECR(t,h,r,o,w), 2, 0);
167 find = vocab(DECR(f,i,n,d,\0),2, 0);
168 invent= vocab(DECR(i,n,v,e,n), 2, 0);
170 /* initialize dwarves */
184 /* random flags & ctrs */
192 if (rtext[2*i+81].seekadr!=0) maxdie=i+1;
193 numdie=holdng=dkill=foobar=bonus=0;
197 closng=panic=closed=scorng=FALSE;
203 trapdel(sig) /* come here if he hits a del */
207 delhit = 1; /* main checks, treats as QUIT */
208 signal(2,trapdel); /* catch subsequent DELs */
217 hinted[3]=yes(65,1,0);
221 if (hinted[3]) limit=1000; /* better batteries if instrucs */