aboutsummaryrefslogtreecommitdiff
path: root/devtools/tasmrecover/dreamweb/newplace.asm
blob: b06a351f5f073a203e7631abade11a234ee0ba44 (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
566
567
568
569
570
571
572
573
574
575
576
577
578
579
;Copyright (c) 1990-2011 by Neil Dodwell
;Released with permission from Neil Dodwell under GPLv2
;See LICENSE file for full license text
;----------------------------------------------------Choosing a new location----

Newplace	proc	near

	cmp	needtotravel,1
	jz	istravel
	cmp	autolocation,-1
	jnz	isautoloc
	ret

isautoloc:	mov	al,autolocation
	mov	newlocation,al
	mov	autolocation,-1
	ret

istravel:	mov	needtotravel,0
	call	selectlocation
	ret

	endp




Selectlocation	proc	near

	mov	inmaparea,0
	call	clearbeforeload
	mov	getback,0
	mov	pointerframe,22
	
	call	readcitypic
	call	showcity       
	call	getridoftemp
	call	readdesticon
	call	loadtraveltext
	call	showpanel
	call	showman
	call	showarrows
	call	showexit
	call	locationpic
	call	undertextline
	mov	commandtype,255
	call	readmouse
	mov	pointerframe,0
	call	showpointer
	call	worktoscreen
	mov	al,9
	mov	ah,255
	call	playchannel0
	mov	newlocation,255

select:
	cmp quitrequested, 0
	jnz quittravel
	call	delpointer
	call	readmouse
	call	showpointer
	call	vsync
	call	dumppointer
	call	dumptextline
	cmp	getback,1
	jz	quittravel
	mov	bx,offset cs:destlist
	call	checkcoords
	cmp	newlocation,255
	jz	select
	mov	al,newlocation
	cmp	al,location
	jz	quittravel

	call	getridoftemp
	call	getridoftemp2
	call	getridoftemp3
	mov	es,traveltext
	call	deallocatemem
	ret

quittravel:	mov	al,reallocation ; was just location
	mov	newlocation,al
	mov	getback,0
	call	getridoftemp
	call	getridoftemp2
	call	getridoftemp3
	mov	es,traveltext
	call	deallocatemem
	ret

destlist:	dw	238,258,4,44,nextdest
	dw	104,124,4,44,lastdest
	dw	280,308,4,44,lookatplace
	dw	104,216,138,192,destselect
	dw	273,320,157,198,getback1
	dw	0,320,0,200,blank
	dw	0ffffh

	endp





Showcity	proc	near

	call	clearwork
	mov	ds,tempgraphics
	mov	di,57
	mov	bx,32
	mov	al,0
	mov	ah,0
	call	showframe
	mov	ds,tempgraphics
	mov	di,120+57
	mov	bx,32
	mov	al,1
	mov	ah,0
	call	showframe
	ret

	endp


	
	
	
Lookatplace	proc	near

	cmp	commandtype,224
	jz	alreadyinfo
	mov	commandtype,224
	mov	al,27
	call	commandonly
alreadyinfo:	mov	ax,mousebutton
	and	ax,1
	jz	noinfo
	cmp	ax,oldbutton
	jz	noinfo

	mov	bl,destpos
	cmp	bl,15
	jnc	noinfo

	push	bx
	call	delpointer
	call	deltextline
	call	getundercentre
	mov	ds,tempgraphics3
	mov	al,0
	mov	ah,0
	mov	di,60
	mov	bx,72
	call	showframe
	mov	al,4
	mov	ah,0
	mov	di,60
	mov	bx,72+55
	call	showframe
	cmp	foreignrelease, 0
	jz $1
	mov	al,4
	mov	ah,0
	mov	di,60
	mov	bx,72+55+21
	call	showframe
$1:
	pop	bx

	mov	bh,0
	add	bx,bx
	mov	es,traveltext
	mov	si,[es:bx]
	add	si,textstart
	call	findnextcolon

	mov	di,63
	mov	bx,84
	cmp	foreignrelease, 0
	jz $2
	mov	bx,84+4
$2:
	mov	dl,191
	mov	al,0
	mov	ah,0
	call	printdirect 
	call	worktoscreenm

	mov	cx,500
	call	hangonp

afterinfo:	mov	pointermode,0
	mov	pointerframe,0
	call	putundercentre
	call	worktoscreenm

noinfo:	ret

	endp




Getundercentre	proc	near

	mov	di,58
	mov	bx,72
	mov	ds,mapstore
	mov	si,0
	mov	cl,254
	mov	ch,110
	call	multiget
	ret

	endp










Putundercentre	proc	near

	mov	di,58
	mov	bx,72
	mov	ds,mapstore
	mov	si,0
	mov	cl,254
	mov	ch,110
	call	multiput
	ret

	endp







Locationpic	proc	near

	call	getdestinfo
	mov	al,[es:si]
	push	es si
	mov	di,0
	cmp	al,6
	jnc	secondlot
	mov	ds,tempgraphics
	add	al,4
	jmp	gotgraphic
secondlot:	sub	al,6
	mov	ds,tempgraphics2
gotgraphic:	add	di,104
	mov	bx,138+14
	mov	ah,0
	call	showframe
	pop	si es
	mov	al,destpos
	cmp	al,reallocation
	jnz	notinthisone
	mov	al,3
	mov	di,104
	mov	bx,140+14
	mov	ds,tempgraphics
	mov	ah,0
	call	showframe
notinthisone:	mov	bl,destpos
	mov	bh,0
	add	bx,bx
	mov	es,traveltext
	mov	si,[es:bx]
	add	si,textstart
	mov	di,50
	mov	bx,20
	mov	dl,241
	mov	al,0
	mov	ah,0
	call	printdirect
	ret

	endp




Getdestinfo	proc	near

	mov	al,destpos
	mov	ah,0
	push	ax
	mov	dx,seg roomscango
	mov	es,dx
	mov	si,offset es:roomscango
	add	si,ax
	mov	cl,[es:si]
	pop	ax
	push	cx
	mov	dx,seg roompics
	mov	es,dx
	mov	si,offset es:roompics
	add	si,ax
	pop	ax
	ret

	endp






Showarrows	proc	near

	mov	di,116-12
	mov	bx,16
	mov	ds,tempgraphics
	mov	al,0
	mov	ah,0
	call	showframe
	mov	di,226+12
	mov	bx,16
	mov	ds,tempgraphics
	mov	al,1
	mov	ah,0
	call	showframe
	mov	di,280
	mov	bx,14
	mov	ds,tempgraphics
	mov	al,2
	mov	ah,0
	call	showframe
	ret

	endp









Nextdest	proc	near

duok:	cmp	commandtype,218
	jz	alreadydu
	mov	commandtype,218
	mov	al,28
	call	commandonly
alreadydu:	mov	ax,mousebutton
	and	ax,1
	jz	nodu
	cmp	ax,oldbutton
	jz	nodu

searchdestup:	inc	destpos
	cmp	destpos,15
	jnz	notlastdest
	mov	destpos,0
notlastdest:	call	getdestinfo
	cmp	al,0
	jz	searchdestup

	mov	newtextline,1
	call	deltextline
	call	delpointer
	call	showpanel
	call	showman
	call	showarrows
	call	locationpic
	call	undertextline
	call	readmouse
	call	showpointer
	call	worktoscreen
	call	delpointer
nodu:	ret

	endp







Lastdest	proc	near

ddok:	cmp	commandtype,219
	jz	alreadydd
	mov	commandtype,219
	mov	al,29
	call	commandonly
alreadydd:	mov	ax,mousebutton
	and	ax,1
	jz	nodd
	cmp	ax,oldbutton
	jz	nodd

searchdestdown: dec	destpos
	cmp	destpos,-1
	jnz	notfirstdest
	mov	destpos,15
notfirstdest:	call	getdestinfo
	cmp	al,0
	jz	searchdestdown

	mov	newtextline,1
	call	deltextline
	call	delpointer
	call	showpanel
	call	showman
	call	showarrows
	call	locationpic
	call	undertextline
	call	readmouse
	call	showpointer
	call	worktoscreen
	call	delpointer
nodd:	ret

	endp








Destselect	proc	near

	cmp	commandtype,222
	jz	alreadytrav
	mov	commandtype,222
	mov	al,30
	call	commandonly
alreadytrav:	mov	ax,mousebutton
	and	ax,1
	jz	notrav
	cmp	ax,oldbutton
	jz	notrav

	call	getdestinfo
	mov	al,destpos
	mov	newlocation,al
notrav: 	ret

	endp



















Getlocation	proc	near

	mov	ah,0
	mov	bx,ax
	mov	dx,seg roomscango
	mov	es,dx
	add	bx,offset es:roomscango
	mov	al,[es:bx]
	ret

	endp


Setlocation	proc	near		;makes a location accessable

	mov	ah,0
	mov	bx,ax
	mov	dx,seg roomscango
	mov	es,dx
	add	bx,offset es:roomscango
	mov	byte ptr [es:bx],1
	ret

	endp




Resetlocation	proc	near		;makes a location inaccessable

	push	ax
	cmp	al,5
	jnz	notdelhotel
	call	purgealocation
	mov	al,21
	call	purgealocation
	mov	al,22
	call	purgealocation
	mov	al,27
	call	purgealocation
	jmp	clearedlocations

notdelhotel:	cmp	al,8
	jnz	notdeltvstud
	call	purgealocation
	mov	al,28
	call	purgealocation
	jmp	clearedlocations

notdeltvstud:	cmp	al,6
	jnz	notdelsarters
	call	purgealocation
	mov	al,20
	call	purgealocation
	mov	al,25
	call	purgealocation
	jmp	clearedlocations

notdelsarters:	cmp	al,13
	jnz	notdelboathouse
	call	purgealocation
	mov	al,29
	call	purgealocation
	jmp	clearedlocations

notdelboathouse:

clearedlocations:	pop	ax
	mov	ah,0
	mov	bx,ax
	mov	dx,seg roomscango
	mov	es,dx
	add	bx,offset es:roomscango
	mov	byte ptr [es:bx],0
	ret

	endp




Readdesticon	proc	near

	mov	dx,offset cs:travelgraphic1
	call	loadintotemp

	mov	dx,offset cs:travelgraphic2
	call	loadintotemp2
	
	mov	dx,offset cs:icongraphics8
	call	loadintotemp3
	ret

	endp




Readcitypic	proc	near

	mov	dx,offset cs:cityname
	call	loadintotemp
	ret

	endp