1
2
3 #include <stdio.h>
4 #include <string.h>
5
6
7 extern char *cause[8], *effect[8], *species[4], *bad_response, *gold[14], *treasure[16];
8 extern char *frog[42], *hint[16], *royal[6], *curse[6], *sss[10], *monster[7], *noise[7];
9 extern char *command[52], *pad, *qpad, *dots;
10 extern char *strength, *intelligence, *dexterity;
11
12 extern int level[512], c[3][4], o[3], p[16], r[3], t[8], w[15][3];
13 extern int x_axis, y_axis, z_axis, temp, master_game, dd, ee, ff, fl, gg, hh, wc, new_game, alive, quit;
14 extern int ah, bf, ot, tt, vf, lf, tc, rf, of, bl, vv, ss, pf, uu, vv, ww, startnewgame;
15 extern char *dim, *bright, *bell;
16 extern FILE *infile, *outfile;
17
18 master_class()
19 {
20
21 int n, m;
22 startnewgame = 0;
23 alive = 1;
24 quit = 0;
25
26 for (n = 1; n <= 512; ++n)
27 {
28 if (level[n - 1] > 99) level[n - 1] = level[n - 1] - 100;
29 }
30
31 for (n = 1; n <= 7; ++n)
32 {
33 do
34 {
35 x_axis = roll(8);
36 y_axis = roll(8);
37 z_axis = roll(8);
38
39 for (m = 1; m <= n; ++m)
40 {
41 if ((w[m - 1][0] == x_axis)&& (w[m - 1][1] == y_axis)&& (w[m - 1][2] == z_axis))
42 {
43 x_axis = roll(8);
44 y_axis = roll(8);
45 z_axis = roll(8);
46 m = 1;
47 }
48 }
49 }
50 while (((level[func_d()- 1] < 13)|| (level[func_d()- 1] > 24))|| ((x_axis == z_axis)&& (y_axis == z_axis)));
51
52 w[n - 1][0] = x_axis;
53 w[n - 1][1] = y_axis;
54 w[n - 1][2] = z_axis;
55 }
56
57 for (n = 8; n <= 15; ++n)
58 {
59 x_axis = roll(8);
60 y_axis = roll(8);
61 z_axis = roll(8);
62
63 for (m = 1; m <= n; ++m)
64 {
65 if ((w[m - 1][0] == x_axis)&& (w[m - 1][1] == y_axis)&& (w[m - 1][2] == z_axis))
66 {
67
68 x_axis = roll(8);
69 y_axis = roll(8);
70 z_axis = roll(8);
71 m = 1;
72 }
73 }
74 w[n - 1][0] = x_axis;
75 w[n - 1][1] = y_axis;
76 w[n - 1][2] = z_axis;
77 }
78
79 x_axis = 1;
80 y_axis = 4;
81 z_axis = 1;
82
83 return 0;
84 }
85
86 beginner_class()
87 {
88 int a, i;
89 char buf[10], zotsav[40];
90
91 startnewgame = 0;
92 alive = 1;
93 quit = 0;
94
95 for (i = 126; i <= 133; ++i)
96 {
97 z_axis = roll(8);
98 setup_xy(i);
99 }
100 i = roll_12() + 100;
101 z_axis = roll(8);
102 setup_xy(i);
103
104 r[0] = x_axis;
105 r[1] = y_axis;
106 r[2] = z_axis;
107
108 i = 109;
109 z_axis = roll(8);
110 setup_xy(i);
111
112 o[0] = x_axis;
113 o[1] = y_axis;
114 o[2] = z_axis;
115
116 i = 101;
117
118 for (a = 1; a <= 3; ++a)
119 {
120 z_axis = roll(8);
121 setup_xy(i);
122 c[a - 1][0] = x_axis;
123 c[a - 1][1] = y_axis;
124 c[a - 1][2] = z_axis;
125 c[a - 1][3] = 0;
126 }
127 bf = 0;
128 ot = 9;
129 tt = 1;
130 vf = 0;
131 lf = 0;
132 tc = 0;
133 gg = 62;
134 rf = 0;
135 of = 0;
136 bl = 0;
137 vv = 8;
138 ss = 0;
139 pf = 0;
140
141 for (i = 1; i <= 8; ++i)
142 {
143 p[i - 1] = 0;
144 p[i + 7] = 0;
145 t[i - 1] = 0;
146 }
147 loadagain:;
148 printf ("\n\nRESTORE AN (O)LD GAME, OR GENERATE A (N)EW ONE? ");
149 temp = fancy_input(5152);
150 if (temp == 52)
151 {
152 printf ("%sPLEASE ENTER SEGMENT NAME OF SAVED GAME:%s ",bright,dim);
153 scanf ("%s",XXXzotsav);
154 getch();
155 printf("\n");
156 infile = fopen (zotsav,"r");
157 if (infile == NULL)
158 {
159 printf ("%sYOU DUMMY! UNABLE TO OPEN THAT SEGMAENT.%s\n",bright,dim);
160 goto loadagain;
161 }
162 for (i = 1; i <= 512; ++i)
163 {
164 fscanf (infile,"%d",&level[i - 1]);
165 }
166 for (i = 1; i <= 8; ++i)
167 {
168 fscanf (infile,"%d",&t[i - 1]);
169 }
170 for (i = 1; i <= 16; ++i)
171 {
172 fscanf (infile,"%d",&p[i - 1]);
173 }
174 for (i = 1; i <= 3; ++i)
175 {
176 fscanf (infile,"%d",&r[i - 1]);
177 fscanf (infile,"%d",&o[i - 1]);
178 for (a = 1; a <= 4; ++a)
179 {
180 fscanf (infile,"%d",&c[i - 1][a - 1]);
181 }
182 for (a = 1; a <= 15; ++a)
183 {
184 fscanf (infile,"%d",&w[a - 1][i - 1]);
185 }
186 }
187 fscanf (infile,"%d",&ah);
188 fscanf (infile,"%d",&bf);
189 fscanf (infile,"%d",&bl);
190 fscanf (infile,"%d",&dd);
191 fscanf (infile,"%d",&ee);
192 fscanf (infile,"%d",&ff);
193 fscanf (infile,"%d",&fl);
194 fscanf (infile,"%d",&gg);
195 fscanf (infile,"%d",&hh);
196 fscanf (infile,"%d",&lf);
197 fscanf (infile,"%d",&master_game);
198 fscanf (infile,"%d",&new_game);
199 fscanf (infile,"%d",&of);
200 fscanf (infile,"%d",&pf);
201 fscanf (infile,"%d",&rf);
202 fscanf (infile,"%d",&ss);
203 fscanf (infile,"%d",&tt);
204 fscanf (infile,"%d",&tc);
205 fscanf (infile,"%d",&uu);
206 fscanf (infile,"%d",&vv);
207 fscanf (infile,"%d",&vf);
208 fscanf (infile,"%d",&ww);
209 fscanf (infile,"%d",&wc);
210 fscanf (infile,"%d",&x_axis);
211 fscanf (infile,"%d",&y_axis);
212 fscanf (infile,"%d",&z_axis);
213
214 fclose (infile);
215 }
216 else
217 {
218 splash();
219
220
221 dd = 2;
222 uu = 6;
223 ww = 10;
224 printf ("\nALL RIGHT, BOLD ONE.\n");
225 printf ("%sYOU MAY BE AN (E)LF, (D)WARF, (M)AN, OR (H)OBBIT.\n",pad);
226 printf ("\nCommand #%d? ",tt);
227 ++tt;
228 temp = fancy_input(508);
229
230 if (temp == 6)
231 {
232 dd = 4;
233 uu = 10;
234 ww = 6;
235 }
236 if (temp == 7)
237 {
238 dd = 3;
239 uu = 8;
240 ww = 8;
241 }
242 if (temp == 8)
243 {
244 dd = 1;
245 uu = 4;
246 ww = 12;
247 ot = 4;
248 }
249 while (temp < 49)
250 {
251 printf ("\nWHICH SEX DO YOU PREFER? ");
252 temp = fancy_input(4850);
253 if (temp == 48)
254 printf ("\n%s** CUTE %s, REAL CUTE. TRY M OR F.\n",pad,species[dd - 1]);
255 }
256 if (temp == 50)
257 ss = 2;
258 if (temp == 49)
259 ss = 3;
260
261 printf ("\nOK, %s, YOU HAVE THE FOLLOWING ATTRIBUTES:\n",species[dd - 1]);
262 printf ("%s%s = %d %s = %d %s = %d\n",pad,strength,uu,intelligence,vv,dexterity,ww);
263 printf ("%sAND %d OTHER POINTS TO ALLOCATE AS YOU WISH.\n",pad,ot);
264
265 uu = uu + alloc_points(strength);
266 if (ot > 0)
267 vv = vv + alloc_points(intelligence);
268 if (ot > 0)
269 {
270 ww = ww + alloc_points(dexterity);
271 if (ot > 0) gg = gg + ot;
272
273 }
274
275 printf("\n\nWELCOME TO N'DIC OUTFITTERS, BOLD %s!\n",species[dd - 1]);
276
277 printf ("\nOK, %s, you have %d gold pieces.\n",species[dd - 1],gg);
278 fl = 0;
279 wc = 0;
280 printf ("\nThese are the types of ARMOR you can buy:\n");
281 printf ("%s(N)one (L)eather-10 (C)hainmail-20 (P)late-30\n",pad);
282 printf ("\nCommand #%d? ",tt);
283 ++tt;
284 temp = fancy_input(913);
285
286 if (temp == 13)
287 ee = 0;
288 if (temp == 9)
289 ee = 1;
290 if (temp == 10)
291 ee = 2;
292 if (temp == 11)
293 ee = 3;
294
295 gg = gg - ee * 10;
296 ah = ee * 7;
297 printf ("\nOK, bold %s, you have %d gold pieces left.\n",species[dd - 1],gg);
298 printf ("\nThese are the types of WEAPONS you can buy:\n");
299 printf ("%s(N)one (D)agger-10 (M)ace-20 (S)word-30\n",pad);
300 printf ("\nCommand #%d? ",tt);
301 ++tt;
302 temp = fancy_input(1215);
303
304 if (temp == 12)
305 ff = 3;
306 if (temp == 13)
307 ff = 0;
308 if (temp == 14)
309 ff = 1;
310 if (temp == 15)
311 ff = 2;
312
313 gg = gg - ff * 10;
314
315 if (gg > 19)
316 {
317 printf ("\nDo you want a LAMP for 20 gold pieces? ");
318 tt = 8;
319 temp = fancy_input(102);
320 if (temp == 2)
321 {
322 lf = 1;
323 gg = gg - 20;
324 }
325 }
326 if (gg >= 1)
327 {
328 printf ("\nOK, %s, you have %d gold pieces left.\n",species[dd - 1],gg);
329 tt = 9;
330 do
331 {
332 printf ("\nFlares cost 1 gold piece each.\n");
333 printf (" %sHow many do you want? ",bright);
334 scanf ("%s",XXXbuf);
335 printf ("%s",dim);
336 temp = atoi(buf);
337 if (temp > gg)
338 printf ("\n%s** YOU CAN ONLY AFFORD %d.\n",pad,gg);
339 }
340 while (temp > gg);
341 getch();
342 if (temp < 0)
343 temp = 0;
344 fl = fl + temp;
345 gg = gg - temp;
346 }
347
348 splash();
349 x_axis = 1;
350 y_axis = 4;
351 z_axis = 1;
352
353
354
355
356
357
358
359 printf ("\n%s",dim);
360 }
361
362 return 0;
363 }
364
365
366
367
368
369
370
371