1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/*
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
*/
/*
��� ��� ���� ��� ��� �� ��� ����� ��� �� � ���� ��� ��� ��� �
�� �� � � � � ��� �� � � � � � � ��� ���� � �� ��� �
� � � �� �� ��� � � � � � ��� � �� ��� � � � ��� ���
VISA The new Sez handler. (Replaces Access.) */
#define __visa_implementation__
#include "visa.h"
/*#include "Gyro.h"*/
/*#include "Scrolls.h"*/
/*#include "Acci.h"*/
/*#include "Trip5.h"*/
/*#include "Lucerna.h"*/
namespace Avalanche {
const boolean bubbling = false;
const boolean report_dixi_errors = true;
boolean went_ok;
void unskrimble() {
word fv;
for (fv = 1; fv <= bufsize; fv ++) buffer[fv] = (char)((~(ord(buffer[fv]) - fv)) % 256);
}
void do_the_bubble() {
bufsize += 1;
buffer[bufsize] = '\2';
}
void dixi(char block, byte point) {
untyped_file indexfile, sezfile;
word idx_offset, sez_offset;
boolean error;
error = false;
assign(indexfile, "avalot.idx");
assign(sezfile, "avalot.sez");
reset(indexfile, 1);
seek(indexfile, (ord(upcase(block)) - 65) * 2);
blockread(indexfile, idx_offset, 2);
if (idx_offset == 0) error = true;
seek(indexfile, idx_offset + point * 2);
blockread(indexfile, sez_offset, 2);
if (sez_offset == 0) error = true;
close(indexfile);
went_ok = ! error;
if (error) {
if (report_dixi_errors)
display(string('\7') + "Error accessing scroll " + block + strf(point));
return;
}
reset(sezfile, 1);
seek(sezfile, sez_offset);
blockread(sezfile, bufsize, 2);
blockread(sezfile, buffer, bufsize);
close(sezfile);
unskrimble();
if (bubbling) do_the_bubble();
calldrivers;
}
void speech(byte who, byte subject) {
untyped_file indexfile, sezfile;
word idx_offset, sez_offset, next_idx_offset;
if (subject == 0) {
/* No subject. */
bubbling = true;
report_dixi_errors = false;
dixi('s', who);
bubbling = false;
report_dixi_errors = true;
} else {
/* Subject given. */
assign(indexfile, "converse.avd");
assign(sezfile, "avalot.sez");
went_ok = false; /* Assume that until we know otherwise. */
reset(indexfile, 1);
seek(indexfile, who * 2 - 2);
blockread(indexfile, idx_offset, 2);
blockread(indexfile, next_idx_offset, 2);
if ((idx_offset == 0) ||
((((next_idx_offset - idx_offset) / 2) - 1) < subject)) return;
seek(indexfile, idx_offset + subject * 2);
/*$I-*/
blockread(indexfile, sez_offset, 2);
if ((sez_offset == 0) || (ioresult != 0)) return;
/*$I+*/
close(indexfile);
reset(sezfile, 1);
seek(sezfile, sez_offset);
blockread(sezfile, bufsize, 2);
blockread(sezfile, buffer, bufsize);
close(sezfile);
unskrimble();
do_the_bubble();
calldrivers;
went_ok = true;
}
}
void talkto(byte whom) {
byte fv;
boolean no_matches;
if (person == pardon) {
person = chr(subjnumber);
subjnumber = 0;
}
if (subjnumber == 0)
switch (chr(whom)) {
case pspludwick:
if ((dna.lustie_is_asleep) & (~ dna.obj[potion])) {
dixi('q', 68);
dna.obj[potion] = true;
objectlist;
points(3);
return;
} else {
if (dna.talked_to_crapulus)
switch (dna.given2spludwick) { /* Spludwick - what does he need? */
/* 0 - let it through to use normal routine. */
case RANGE_2(1, 2): {
display(string("Can you get me ") +
get_better(spludwick_order[dna.given2spludwick]) + ", please?" +
"\232\2");
return;
}
break;
case 3: {
dixi('q', 30); /* need any help with the game? */
return;
}
break;
}
else {
dixi('q', 42); /* Haven't talked to Crapulus. Go and talk to him. */
return;
}
}
break;
case pibythneth:
if (dna.givenbadgetoiby) {
dixi('q', 33); /* Thanks a lot! */
return; /* And leave the proc. */
}
break; /* Or... just continue, 'cos he hasn't got it. */
case pdogfood:
if (dna.wonnim) {
/* We've won the game. */
dixi('q', 6); /* "I'm Not Playing!" */
return; /* Zap back. */
} else dna.asked_dogfood_about_nim = true;
break;
case payles:
if (~ dna.ayles_is_awake) {
dixi('q', 43); /* He's fast asleep! */
return;
} else if (~ dna.given_pen_to_ayles) {
dixi('q', 44); /* Can you get me a pen, Avvy? */
return;
}
break;
case pjacques: {
dixi('q', 43);
return;
}
break;
case pgeida:
if (dna.geida_given_potion)
dna.geida_follows = true;
else {
dixi('u', 17);
return;
}
break;
case pspurge:
if (~ dna.sitting_in_pub) {
dixi('q', 71); /* Try going over and sitting down. */
return;
} else {
if (spurge_talk < 5) spurge_talk += 1;
if (spurge_talk > 1) {
/* no. 1 falls through */
dixi('q', 70 + spurge_talk);
return;
}
}
break;
}
else /* On a subject. Is there any reason to block it? */
switch (chr(whom)) {
case payles:
if (~ dna.ayles_is_awake) {
dixi('q', 43); /* He's fast asleep! */
return;
}
break;
}
if (whom > 149) whom -= 149;
no_matches = true;
for (fv = 1; fv <= numtr; fv ++)
if (tr[fv].a.accinum == whom) {
display(string('\23') + chr(fv + 48) + '\4');
no_matches = false;
flush();
}
if (no_matches) display("\23\23\4");
speech(whom, subjnumber);
if (! went_ok) /* File not found! */
dixi('n', whom);
if (subjnumber == 0)
switch (chr(whom + 149)) {
case pcrapulus: {
/* Crapulus: get the badge - first time only */
dna.obj[badge] = true;
objectlist;
dixi('q', 1); /* Circular from Cardiff. */
dna.talked_to_crapulus = true;
whereis[pcrapulus] = 177; /* Crapulus walks off. */
tr[2].vanishifstill = true;
tr[2].walkto(4); /* Walks away. */
points(2);
}
break;
}
}
} // End of namespace Avalanche.
|