1
2
3 #include <stdio.h>
4 #include <string.h>
5
6 extern char *bright, *clrs, *dim, *pad, *qpad, *sss[10], *species[4];
7 extern int x_axis, y_axis, z_axis, ot, dd, ss;
8 extern int level[512], w[15][3], master_game;
9
10
11 roll(s)
12 # 11
13 int s;
14 {
15 unsigned int r;
16 rollagain:
17 r = rand()%s+1;
18 if ( (int) r < 1 ) goto rollagain;
19 if ( (int) r > s ) goto rollagain;
20
21 fflush(stdout);
22 return (int) r;
23 }
24
25 below_nine(s)
26 # 16
27 int s;
28 {
29 if (s == 9) s = 1;
30 if (s == 0) s = 8;
31 return s;
32 }
33
34 below_nineteen(s)
35 # 23
36 int s;
37 {
38 if (s > 18) s = 18;
39 return s;
40 }
41
42 func_d()
43 {
44 return ((64 * (z_axis - 1))+ (8 * (x_axis - 1))+ y_axis);
45 }
46
47 func_e()
48 {
49 int i = 0;
50
51 if (level[func_d()- 1] > 99) i = -1;
52 return (level[func_d()- 1] + 100 * i);
53 }
54
55 roll_12()
56 {
57 return (roll(12)+12);
58 }
59
60 setup_xy(s)
61 # 47
62 int s;
63 {
64 do
65 {
66 x_axis = roll(8);
67 y_axis = roll(8);
68 }
69 while ((level[func_d()- 1] != 101)|| ((x_axis == z_axis)&& (y_axis == z_axis)));
70 level[func_d() - 1] = s;
71 return 0;
72 }
73
74 border(s,a)
75 # 59
76 char *s;
77 # 59
78 int a;
79 {
80 int i;
81
82 for (i = 1; i <= a; ++i)
83 {
84 printf ("%s%s",bright,s);
85 }
86 printf ("%s\n",dim);
87 return 0;
88 }
89
90 alloc_points(s)
91 # 71
92 char *s;
93 {
94 long i;
95
96 do
97 {
98 printf ("\nHow many points to add to %s? ",s);
99 i = (long)getch();
100 i = (long) ( (int) ( (char)i - '0' ) );
101 if (!((int)i < 0) || ((int)i > ot)) printf ("%d", (int)i);
102 }
103 while ( ((int)i < 0) || ((int)i > ot) );
104 ot = ot - (int)i;
105 return (int)i;
106 }
107
108 ident()
109 {
110
111 printf ("\n--- YOU ARE A %s%s%s%s",bright,sss[ss],species[dd - 1],dim);
112 printf (" AT (%s%d%s, ",bright,x_axis,dim);
113 printf ("%s%d%s) LEVEL %s%d%s ---\n",bright,y_axis,dim,bright,z_axis,dim);
114 return 0;
115 }
116
117 splash()
118 {
119 printf ("\n%s",clrs);
120 border ("*",52);
121 printf ("%s%s * * * THE WIZARD'S CASTLE * * *\n",qpad,bright);
122 border ("*",52);
123 return 0;
124 }
125
126 find_money(q)
127 # 110
128 int q;
129 {
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 return 0;
145 }
146
147 initialize()
148 {
149 int m, n;
150
151 master_game = 0;
152
153 for (n = 1; n <= 15; ++n)
154 {
155 for (m = 1; m <= 3; ++m)
156 {
157 w[n - 1][m - 1] = 0;
158 }
159 }
160 return 0;
161 }
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176