aboutsummaryrefslogtreecommitdiff
path: root/devtools/tasmrecover/dreamweb/talk.asm
blob: 91cbb96c6e6f1c77977c0df6cff06834f445237d (plain)
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
;Copyright (c) 1990-2012 by Neil Dodwell
;Released with permission from Neil Dodwell under GPLv2
;See LICENSE file for full license text
Talk	proc	near
	
	mov	talkpos,0
	mov	inmaparea,0
	mov	al,command
	mov	character,al
	call	createpanel
	call	showpanel
	call	showman
	call	showexit
	call	undertextline
	call	convicons
	call	starttalk
	mov	commandtype,255
	call	readmouse
	call	showpointer
	call	worktoscreen
waittalk:	call	delpointer
	call	readmouse
	call	animpointer
	call	showpointer
	call	vsync
	call	dumppointer
	call	dumptextline
	mov	getback,0
	mov	bx,offset cs:talklist
	call	checkcoords
	cmp quitrequested, 0
	jnz finishtalk
	cmp	getback,0
	jz	waittalk
finishtalk:	mov	bx,persondata
	push	cs
	pop	es
	cmp	talkpos,4
	jc	notnexttalk
	mov	al,[es:bx+7]
	or	al,128
	mov	[es:bx+7],al
notnexttalk:	call	redrawmainscrn
	call	worktoscreenm
	cmp	speechloaded,1
	jnz	nospeech
	call	cancelch1
	mov	volumedirection,-1  	;fade (louder)
	mov	volumeto,0	;up to 0 (max)
nospeech:	ret

talklist:	dw	273,320,157,198,getback1
	dw	240,290,2,44,moretalk
	dw	0,320,0,200,blank
	dw	0ffffh

	endp












Convicons	proc	near

	mov	al,character
	and	al,127
	call	getpersframe
	mov	di,234
	mov	bx,2
	mov	currentframe,ax
	call	findsource
	mov	ax,currentframe
	sub	ax,takeoff
	mov	ah,0
	call	showframe
	ret

	endp








Getpersframe	proc	near

	mov	ah,0
	add	ax,ax
	mov	bx,ax
	mov	es,people
	add	bx,personframes
	mov	ax,[es:bx]
	ret

	endp





Starttalk	proc	near

	mov	talkmode,0
	mov	al,character
	and	al,127
	call	getpersontext
	mov	charshift,91+91
	mov	di,66
	mov	bx,64
	mov	dl,241
	mov	al,0
	mov	ah,79
	call	printdirect
	mov	charshift,0
	mov	di,66
	mov	bx,80
	mov	dl,241
	mov	al,0
	mov	ah,0
	call	printdirect

	if	cd
	mov	speechloaded,0
	mov	al,character
	and	al,127
	mov	ah,0
	mov	cx,64
	mul	cx
	mov	cl,"C"
	mov	dl,"R"
	mov	dh,reallocation
	call	loadspeech
	cmp	speechloaded,1
	jnz	nospeech1
	mov	volumedirection,1 	;quieter
	mov	volumeto,6	;quite quiet!
	mov	al,50+12
	call	playchannel1
	endif
nospeech1:	ret

	endp





Getpersontext	proc	near

	mov	ah,0
	mov	cx,64*2
	mul	cx
	mov	si,ax
	mov	es,people
	add	si,persontxtdat
	mov	cx,persontext
	mov	ax,[es:si]
	add	ax,cx
	mov	si,ax
	ret

	endp







Moretalk	proc	near

	;cmp	ch1playing,255
	;jnz	cantredes
	cmp	talkmode,0
	jz	canmore
	call	redes
	ret

canmore:	cmp	commandtype,215
	jz	alreadymore
	mov	commandtype,215
	mov	al,49
	call	commandonly
alreadymore:	mov	ax,mousebutton
	cmp	ax,oldbutton
	jz	nomore
	and	ax,1
	jnz	domoretalk
nomore: 	ret

domoretalk:	mov	talkmode,2
	mov	talkpos,4
	cmp	character,100
	jc	notsecondpart
              	mov	talkpos,48
notsecondpart:	call	dosometalk
	ret

	endp














Dosometalk	proc	near

	if	cd
dospeech:	mov	al,talkpos
	mov	al,character
	and	al,127
	mov	ah,0
	mov	cx,64
	mul	cx
	mov	cx,ax
	mov	al,talkpos
	mov	ah,0
	add	ax,cx
	add	ax,ax
	mov	si,ax

	mov	es,people
	add	si,persontxtdat
	mov	cx,persontext

	mov	ax,[es:si]
	add	ax,cx
	mov	si,ax
	cmp	byte ptr [es:si],0
	jz	endheartalk
       
	push	es si
	call	createpanel
	call	showpanel
	call	showman
	call	showexit
	call	convicons
	pop	si es

	mov	di,164
	mov	bx,64
	mov	dl,144
	mov	al,0
	mov	ah,0
	call	printdirect

	mov	al,character
	and	al,127
	mov	ah,0
	mov	cx,64
	mul	cx
	mov	cl,talkpos
	mov	ch,0
	add	ax,cx
	mov	cl,"C"
	mov	dl,"R"
	mov	dh,reallocation
	call	loadspeech
	cmp	speechloaded,0
	jz	noplay1
	mov	al,62
	call	playchannel1

noplay1:	mov	pointermode,3
	call	worktoscreenm
	mov	cx,180
	call	hangonpq
	jnc $1
	ret

$1:
	inc	talkpos
          
	mov	al,talkpos
          	mov	al,character
	and	al,127
	mov	ah,0
	mov	cx,64
	mul	cx
	mov	cx,ax
	mov	al,talkpos
	mov	ah,0
	add	ax,cx
	add	ax,ax
	mov	si,ax

	mov	es,people
	add	si,persontxtdat
	mov	cx,persontext

	mov	ax,[es:si]
	add	ax,cx
	mov	si,ax
	cmp	byte ptr [es:si],0
	jz	endheartalk
	cmp	byte ptr [es:si],":"
	jz	skiptalk2
	cmp	byte ptr [es:si],32
	jz	skiptalk2
	
	push	es si
	call	createpanel
	call	showpanel
	call	showman
	call	showexit
	call	convicons
	pop	si es

	mov	di,48
	mov	bx,128
	mov	dl,144
	mov	al,0
	mov	ah,0
	call	printdirect

	mov	al,character
	and	al,127
	mov	ah,0
	mov	cx,64
	mul	cx
	mov	cl,talkpos
	mov	ch,0
	add	ax,cx
	mov	cl,"C"
	mov	dl,"R"
	mov	dh,reallocation
	call	loadspeech
	cmp	speechloaded,0
	jz	noplay2
	mov	al,62
	call	playchannel1

noplay2:	mov	pointermode,3
	call	worktoscreenm
	mov	cx,180
	call	hangonpq
	jnc skiptalk2
	ret

skiptalk2:	inc	talkpos
	jmp	dospeech

endheartalk:	mov	pointermode,0
	ret
	
	else

watchtalk:	mov	al,talkpos
	mov	al,character
	and	al,127
	mov	ah,0
	mov	cx,64
	mul	cx
	mov	cx,ax
	mov	al,talkpos
	mov	ah,0
	add	ax,cx
	add	ax,ax
	mov	si,ax

	mov	es,people
	add	si,persontxtdat
	mov	cx,persontext

	mov	ax,[es:si]
	add	ax,cx
	mov	si,ax
	cmp	byte ptr [es:si],0
	jz	endwatchtalk
	
	push	es si
	call	createpanel
	call	showpanel
	call	showman
	call	showexit
	call	convicons
	pop	si es

	mov	di,164
	mov	bx,64
	mov	dl,144
	mov	al,0
	mov	ah,0
	call	printdirect

	mov	pointermode,3
	call	worktoscreenm
	mov	cx,180
	call	hangonpq
	jnc $1
	ret
$1:

	inc	talkpos
          
	mov	al,talkpos
          	mov	al,character
	and	al,127
	mov	ah,0
	mov	cx,64
	mul	cx
	mov	cx,ax
	mov	al,talkpos
	mov	ah,0
	add	ax,cx
	add	ax,ax
	mov	si,ax

	mov	es,people
	add	si,persontxtdat
	mov	cx,persontext

	mov	ax,[es:si]
	add	ax,cx
	mov	si,ax
	cmp	byte ptr [es:si],0
	jz	endwatchtalk
	cmp	byte ptr [es:si],":"
	jz	skiptalk
	cmp	byte ptr [es:si],32
	jz	skiptalk
	
	push	es si
	call	createpanel
	call	showpanel
	call	showman
	call	showexit
	call	convicons
	pop	si es

	mov	di,48
	mov	bx,128
	mov	dl,144
	mov	al,0
	mov	ah,0
	call	printdirect

	mov	pointermode,3
	call	worktoscreenm
	mov	cx,180
	call	hangonpq
	jnc skiptalk
	ret

skiptalk:	inc	talkpos
	jmp	watchtalk

endwatchtalk:	mov	pointermode,0
	ret

	endif

	endp







Hangonpq 	proc	near

	mov	getback,0
	mov	bx,0
hangloopq:	push	cx bx
	call	delpointer
	call	readmouse
	call	animpointer
	call	showpointer
	call	vsync
	call	dumppointer
	call	dumptextline
	mov	bx,offset cs:quitlist
	call	checkcoords
	pop	bx cx
	cmp	getback,1
	jz	quitconv
	cmp quitrequested, 0
	jnz quitconv
	cmp	speechloaded,1
	jnz	notspeaking
            	cmp	ch1playing,255
	jnz	notspeaking
	inc	bx
	cmp	bx,40     	;pause after speech ends
	jz	finishconv
notspeaking:	cmp	mousebutton,0
	jz	hangloopq
	cmp	oldbutton,0
	jnz	hangloopq
finishconv:	call	delpointer
	mov	pointermode,0
	clc
	ret
	
quitconv:	call	delpointer
	mov	pointermode,0
	call	cancelch1
	stc
	ret

quitlist:	dw	273,320,157,198,getback1
	dw	0,320,0,200,blank
	dw	0ffffh

	endp









Redes	proc	near

	cmp	ch1playing,255
	jnz	cantredes
	cmp	talkmode,2
	jz	canredes
cantredes:	call	blank
	ret

canredes:	cmp	commandtype,217
	jz	alreadyreds
	mov	commandtype,217
	mov	al,50
	call	commandonly
alreadyreds:	mov	ax,mousebutton
	and	ax,1
	jnz	doredes
	ret

doredes:	call	delpointer
	call	createpanel
	call	showpanel
	call	showman
	call	showexit
	call	convicons
	call	starttalk
	call	readmouse
	call	showpointer
	call	worktoscreen
	call	delpointer
	ret

	endp