forked from historicalsource/smashtv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFATMAN.ASM
982 lines (905 loc) · 17.9 KB
/
FATMAN.ASM
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
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
.FILE "FATMAN.ASM"
.TITLE "ROBO-RAMA GAME PROGRAM"
.WIDTH 132
.OPTION B,D,L,T
.MNOLIST
;
; INITIATED: APRIL 26,1989
; MODIFIED: !
; SOFTWARE: MARK TURMELL
;
; COPYRIGHT (C) 1989 WILLIAMS ELECTRONICS GAMES, INC.
;
;
; GET THE SYSTEM STUFF
.INCLUDE "MPROC.EQU" ;MPROC EQUATES
.INCLUDE "DISP.EQU" ;DISPLAY PROC. EQUATES
.include "sys.inc" ;z unit system equates
.include "macros.hdr" ;macros definitions
.INCLUDE "IMGTBL.GLO"
.INCLUDE "ROBO.EQU"
;
;SOUNDS EXTERNAL
;
.REF EXP3HI,EXP1,GDTH1,UGH2,UGH3
;
;SYMBOLS EXTERNALLY DEFINED
;
.REF GET_VALID_DOOR,SPINFLGS,FRANIM_DIE
.REF BEGINOBJ2,BEGINOBJ,RANGRAND,FRANIM,INTO,BIG2,FATHITS
.REF P1DATA,SCRADD2,GET_WVADDR,DO_DIFF2,RANDPER,SHAKER,SHK_ON
.REF GAMSTATE,WAVEYX,P2DATA
.REF KEEPXY,RAMXY,WAVE_RAM,HALT,EHALT
.REF GETANIXY,PLYROBJS,FLASHME
.REF SET_GATE_2,DRINF
.REF WAVE,CVRT2,GETFPAL
.REF BOOM3
.REF FROMDR,PCNT
.REF INFOTBL,GETADIR2,XYSKOBJ,BULL_TOP,MEBNCS
.REF ADPCS2,PCTOT
;
;SYMBOLS DEFINED IN THIS FILE
;
.DEF SPAWN_FAT,ONSCRN_FAT,MAXFAT,FAT_CNT,MAXFAT,GETUGH
.DEF KILL_F1,PUSH_FT,KILL_F2,YKIL_FT,KILL_F2_NO
;
;UNINITIALIZED RAM DEFINITIONS
;
.BSS SCNTR,8
.BSS MAXFAT,8 ;MAX NUMBER OF FAT ALLOWED ON SCRN
.BSS FAT_CNT,16 ;TOTAL FAT ON SCREEN
.BSS TMP,16
; .BSS FAT_DN,16
;
;EQUATES FOR THIS FILE
;
;FAT DATA STRUCTURE
;
;DELYDT .EQU PDATA ;UHB-OBJECT AGE
INDEX .EQU PDATA+8 ;UHB-INDEX 0,1,2,3,4
DIR .EQU PDATA+16 ;UHW OBJECT DIRECTION
DIS .EQU PDATA+32 ;OBJECT DISTANCE COUNT
CFLAGS .EQU PDATA+48 ;CONTROL FLAGS FOR OBJECT
SK_DIR .EQU PDATA+64 ;SEEK DIR FOR SPIN
LEVEL .EQU PDATA+80 ;DIFFICULTY LEVEL FOR SPEEDS ETC.
HSPD .EQU PDATA+96
H2SPD .EQU PDATA+128
VSPD .EQU PDATA+160
V2SPD .EQU PDATA+192
ABSRB .EQU PDATA+224 ;UHB
;
;TANK/SHRAPNEL BULLET DATA STRUCTURE
;
BNCS .EQU PDATA ;UHB
LAST .EQU PDATA+8 ;UHB
FDLY .EQU PDATA+16 ;UHB ;FRANIM DELAY
;
HSPEED .EQU 08000H
;MAXHIT .EQU 10
.TEXT
SPAWN_FAT:
;SPAWN FAT IS CALLED FROM 'WAVE OVERLORD' CODE WHICH DISPERSES
;BAD GUYS THROUGHOUT A WAVE
MOVE @FAT_CNT,A2 ;MOVE BYTE (# FAT ON SCRN) TO A2
MOVB @MAXFAT,A3
CMP A3,A2 ;FAT MAXED OUT?
JRGT FAT_OUT ;
MOVE @HALT,A0
JRNZ FAT_OUT
CREATE FATPID,AFAT ;START ONE FAT
FAT_OUT:
RETS
ONSCRN_FAT:
;A2=# OF FATMEN TO CREATE ON SCREEN
MOVE A2,A10
OH1 PUSH A10 ;CREATE A BUNCH OF THEM
CREATE FATPID,OFAT
PULL A10
DSJS A10,OH1
RETS
OFAT:
;OFAT IS CALLED AT THE START OF A WAVE TO PLACE X # OF FAT ON SCREEN
;AT THE BEGINNING OF A WAVE
DEC A10 ;INDEX 0,1,2,3,4
MOVB A10,*A13(INDEX)
; MOVK 1,A0
; MOVE A0,*A13(DIR)
SLL 5,A10
MOVI DIRTBL,A0
ADD A10,A0
MOVE *A0,A0
MOVE A0,*A13(DIR)
ADDI CRNRYX,A10
MOVE *A10,A0,L
MOVE A0,A1
SLL 16,A0 ;A0=X
ANDI 0FFFF0000H,A1 ;A1=Y
;A0 & A1 ARE SET UP
;ADD IN OFFSETS FOR THIS PARTICULAR ARENA
MOVE @GAMSTATE,A2
CMPI INAMODE,A2
JREQ DMD
MOVE @WAVEYX,A2,L
;A2=PACKED OFFSETS
MOVX A2,A3
SLL 16,A3
ADD A3,A0 ;ADJUSTED A0 XVAL!
ANDI 0FFFF0000H,A2
ADD A2,A1 ;ADJUSTED A1 YVAL!
DMD
;A0,A1 ARE SETUP.
CALLR IH1 ;INIT FAT (BEGINOBJ)
CALLA BEGINOBJ2
MOVE *A8(OPAL),A0,L
ANDI 0FFFFH,A0
MOVE A0,*A8(OPAL),L
CALLR SETUP_FAT ;INC CNT, SET DIR, SET DEATH FLAG, ETC
MOVI HSPEED,A1 ;FAT SPEED
CALLA DO_DIFF2 ;SET UP HIS RAM SPEED AREA
CALLR GET_DIS ;SET DISTANCE CNT FOR THIS DIR
CALLR GET_STAND ;FAT STANDS AND SPINS UNTIL A MATCH
;THIS GETS CORRECT OIMG, OFLAGS
MOVE @WAVE,A0
CMPI 8,A0
JRLO APAA
;CHANGE TO PURPLE PAL
MOVI BP,A0
CALLA GETFPAL ;GET A COLOR MAP ASSIGNMENT
MOVE A0,*A8(OPAL),W ;STORE THE NEW PALETTE
APAA
JRUC LUP_TOP
AFAT:
;YES A NEW FAT WILL APPEAR
;UPDATE WAVE_INFO RAM TABLE TO REFLECT THIS NEW ENTRY!
;THIS FAT WAS SPAWNED FROM 'WAVE OVERLORD' CODE
;
CALLR INIT_FAT ;INITIAL FAT PARAMS (BEGINOBJ)
CALLR SETUP_FAT ;INC CNT, SET DIR, SET DEATH FLAG, ETC
MOVI HSPEED,A1
CALLA DO_DIFF2
MOVE *A13(DIR),A0
CALLA INTO
CALLR GET_RUN ;GET FIRST FRANIM PNTR FOR
;THIS FAT DIRECTION
MOVK 3,A0 ;FAT WILL SPIN TO SK_DIR
MOVE A0,*A13(CFLAGS)
MOVE @WAVE,A0
CMPI 7,A0
JRLO APA
;CHANGE TO PURPLE PAL
MOVI BP,A0
CALLA GETFPAL ;GET A COLOR MAP ASSIGNMENT
MOVE A0,*A8(OPAL),W ;STORE THE NEW PALETTE
APA
;
;
; LOOP TOP FOR FATMAN
;
LUP_TOP:
;TOP OF FAT LOGIC
MOVE @HALT,A0
JRNZ GOTOP0
MOVE @EHALT,A0
JRZ MV ;BR=HALT ALL FAT!!
;PLAYER IS WALKING INTO ARENA
CLR A0
MOVE A0,*A8(OXVEL),L
MOVE A0,*A8(OYVEL),L
SLEEP 2
JRUC LUP_TOP
MV:
MOVE *A13(CFLAGS),A0
BTST 0,A0
JRZ NOSPN
;THIS FAT MAN IS SPINNING, DO SPIN
MOVE *A13(SK_DIR),A1
MOVE *A13(DIR),A0,W
CALLR WAY
MOVE *A13(SK_DIR),A1
MOVE *A13(DIR),A0,W
CMP A0,A1
JREQ GOODNEWS
;ANI IN NEW STAND/SPIN DIR
; CALLA GET_STAND
GOTOP SLEEP 5
JRUC LUP_TOP
GOTOP0 SLEEP 5
MOVK 15,A0 ;5
MOVE A0,*A13(DIS)
JRUC LUP_TOP
SHKX .BYTE 01,-2,0,1,-1,-1,1,-1,1,1,-1
SHKY .BYTE -1,1,2,-1,1,-1,-2,1,0,-2,2
.EVEN
GOODNEWS:
MOVE *A13(DIS),A0
JRNZ GD2
;THIS GUY TO EXPLODE
SLEEP 40 ;SHAKE A BIT!
MOVK 10,A9
LPS MOVE A9,A0
SLL 3,A0
MOVI SHKX,A1
ADD A0,A1
MOVB *A1,A1
ADDI SHKY,A0
MOVB *A0,A0
MOVE *A8(OXPOS),A2,W
ADD A1,A2
MOVE A2,*A8(OXPOS),W
MOVE *A8(OYPOS),A2,W
ADD A0,A2
MOVE A2,*A8(OYPOS),W
SLEEP 2
DSJS A9,LPS
MOVE *A13(DIR),A9
CLR A10
CREATE 0,SHRAPNL
MOVK 1,A10
CREATE 0,SHRAPNL
MOVK 2,A10
CREATE 0,SHRAPNL
MOVK 3,A10
CREATE 0,SHRAPNL
MOVK 4,A10
CREATE 0,SHRAPNL
CREATE 0,FAT_EXP ;BULLETS DIR WILL BE IN A10
;FAT_EXP WHEN IT WAKES UP
MOVE A13,A0
CALLA KILL ;KILLS PROCESS IN A0
MOVE A8,A0
CALLA DELOBJ
DIE
YKIL_FT MMTM SP,A1,A2,A7,A9
;KILL FATGUY! WITH BULLETS
MOVB @PCTOT,A2
CMPI 019H,A2
JRGE FE0
;HAVE ROOM FOR PIECES
PUSH A0
CREATE 0,ADPCS2
PULL A0
FE0
MMFM SP,A1,A2,A7,A9
JRUC KILL_F1
PUSH_FT
;A8=FAT IMG PNTR, A0=KILLER IMG PNTR
MMTM SP,A1,A2,A7,A9
MOVE *A8(OPLINK),A1,L
MOVB *A1(ABSRB),A2
INC A2
MOVB A2,*A1(ABSRB)
MOVE @FATHITS,A7
CMP A7,A2
JRNE PFT
MOVB @PCTOT,A2
CMPI 019H,A2
JRGE FE
;HAVE ROOM FOR PIECES
PUSH A0
CREATE 0,ADPCS2
PULL A0
FE
MMFM SP,A1,A2,A7,A9
JRUC KILL_F1
GETUGH
MOVI UGH2,A0 ;SQUEAL!
MOVB @PCNT,A1
ANDI 1,A1
JRZ YAG
MOVI UGH3,A0 ;OOF
YAG
CALLA ONESND
RETS
PFT
;FLASH THIS GUY
PUSH A0
CALLA GETUGH
MOVI 03F3F0000H,A9
CREATE 0,FLASHME
PULL A0
MOVE *A0(OPLINK),A1,L
;WILL BE BOGUS IF SOMETHING OTHER THAN A BULLET STRUCK FAT
MOVE *A1(BLTDIR),A2
SLL 3,A2
MOVI YAD,A0
ADD A2,A0
MOVB *A0,A10 ;A10=AMOUT TO ADD TO Y OF FATMAN
MOVE *A8(OYPOS),A0,W
MOVE *A8(OXPOS),A1,W
SLL 16,A0
MOVX A1,A0 ;GET TOP LEFT OF OBJECT
MOVE @WORLDTL,A1,L
SUBXY A1,A0 ;SUBTRACT OUT WORLD BASE
MOVX A0,A1
SLL 16,A1 ;A1=X,A0=Y
ADD A10,A0
CMPI 0280000H,A0
JRLT SKP
CMPI 0E10000H,A0
JRGE SKP
;OKAY
MOVE *A8(OYPOS),A0,W
ADD A10,A0
MOVE A0,*A8(OYPOS)
SKP
ADDI XAD,A2
MOVB *A2,A2 ;A1=AMOUNT TO ADD TO X OF FAT
ADD A2,A1
CMPI 0200000H,A1
JRLT SKP2
CMPI 015C0000H,A1
JRGE SKP2
MOVE *A8(OXPOS),A0
ADD A0,A2
MOVE A2,*A8(OXPOS)
SKP2
; MOVI GDTH1,A0
; CALLA ONESND
MMFM SP,A1,A2,A7,A9
RETS
YAD: .BYTE 0,-6,-6,0,6,6,6,0,-6
XAD: .BYTE 0,0,6,6,6,0,-6,-6,-6
.EVEN
KILL_F1 ;KILL FAT GUY BECAUSE OF SMART BOMB OR COLLISION WITH RING
;OR BULLETS
;EXTER HERE FROM COLLISION ROUTINE - RINGS KILL FATMAN
;ENTER HERE WITH SMART BOMB
;A8=FAT IMG PNTR
MMTM SP,A1,A2,A7
MOVE *A0(OPLINK),A0,L
MOVB *A0(MYPLYR),A0
MOVI P1DATA,A2
CMPI 1,A0
JREQ J5
CMPI 2,A0
JRNZ J55
MOVI P2DATA,A2
J5
;A2=P1DATA OR P2DATA
MOVI FATPT,A1 ;AMOUNT OF SCORE
CALLA SCRADD2 ;DO IT!
J55 MOVE *A8(OPLINK),A0,L
CALLA KILL ;KILLS PROCESS IN A0
MOVE A8,A0
; CALLA DELPAL ;NEEDED? NOT IF IN PLYR PAL!
CALLA DELOBJ
CREATE 0,FEXP
;EXP3
; CALLA GETUGH
MOVI EXP3HI,A0
CALLA ONESND
MMFM SP,A1,A2,A7
RETS
KILL_F2 ;KILL FAT GUY BECAUSE OF SMART BOMB
;ENTER HERE WITH SMART BOMB
;A8=FAT IMG PNTR
;A9=P1/P2DATA
MOVE A9,A2
;A2=P1DATA OR P2DATA
MOVI FATPT,A1 ;AMOUNT OF SCORE
CALLA SCRADD2 ;DO IT!
KILL_F2_NO
MOVE *A8(OPLINK),A0,L
CALLA KILL ;KILLS PROCESS IN A0
MOVI CLSNEUT|TYPNEUT,A0
MOVE A0,*A8(OID)
CLR A0
MOVE A0,*A8(OXVEL),L
MOVE A0,*A8(OYVEL),L
MOVE @FAT_CNT,A3 ;DELETE A FAT FROM CNT
DEC A3
MOVE A3,@FAT_CNT
CREATE 0,KILL_F3
RETS
KILL_F3
MOVE *A8(OYPOS),A2
ADDI 05H,A2 ;A2=Y OFFSET
MOVE A2,*A8(OYPOS)
MOVI BOOM3,A9 ;BOOM3 CHANGES PALETTE TO EXPLOSION!
JAUC FRANIM_DIE
; MOVK 1,A1
; JSRP FRANIM
; MOVE A8,A0
; CALLA DELPAL ;NEEDED? NOT IF IN PLYR PAL!
; CALLA DELOBJ
; DIE
FAT_EXP:
;ONLY NORMAL EXPLODE HAS CHUNKS
MOVB @PCTOT,A2
CMPI 018H,A2
JRGE FEXP
;HAVE ROOM FOR PIECES
CREATE 0,ADPCS2
MOVB @SHK_ON,A0
JRNZ FEXP
MOVI 7,A10
CALLA SHAKER
FEXP
MOVI EXP3HI,A0 ;FAT GUY EXPLODE
CALLA ONESND
MOVE @FAT_CNT,A3 ;DELETE A FAT FROM CNT
DEC A3
MOVE A3,@FAT_CNT
;TURN ON FIRE BALL EXP ALSO
CREATE 0,BIG2
DIE
;KILL
GD2
MOVE *A13(CFLAGS),A0
CMPI 3,A0
JREQ GD3
CALLR GET_RUN ;ZEROS STAND FLAG ALSO
CALLR GET_DIS ;SEND FOR THIS DISTANCE
MOVE *A13(DIR),A0
CALLA INTO ;GET PROPER VELOCITY FOR THIS DIR
SLEEP 1
JRUC LUP_TOP
GD3
MOVK 2,A0
MOVE A0,*A13(CFLAGS)
SLEEP 1
JRUC LUP_TOP
NOSPN:
MOVE *A13(DIS),A0 ;UPDATE DISTANCE COUNT
DEC A0
MOVE A0,*A13(DIS) ;STUFF NEW COUNT
JRNZ ADOT ;BR=CONTINUE CURRENT DIRECTION
MOVE *A13(CFLAGS),A0
CMPI 2,A0
JRNE AP
;GUY WALKED IN THRU DOOR, NOW TURN ACCORDINGLY
CALLR GET_DIS
MOVB *A13(INDEX),A0
SLL 3,A0
ADDI SKINDX2,A0
JRUC INHERE
;TIME TO SEEK TOWARD PLAYER AND EXPLODE
;START SEEK
AP
MOVB @SCNTR,A3
INC A3
MOVB A3,@SCNTR
ANDI 01,A3
SLL 5,A3
MOVI PLYROBJS,A2
ADD A3,A2
MOVE *A2,A0,L ;GET FIRST ENTRY
JRNZ PX
XORI 32,A3
ADDI PLYROBJS,A3
MOVE *A3,A0,L
PX CALLA XYSKOBJ
MOVE A5,A1
MOVE A6,A2
CALLA GETADIR2
SLL 3,A0
ADDI CVRT,A0
INHERE:
MOVB *A0,A0
MOVE A0,*A13(SK_DIR)
MOVK 1,A0 ;FAT WILL SPIN TO SK_DIR
MOVE A0,*A13(CFLAGS)
CLR A0
MOVE A0,*A8(OXVEL),L
MOVE A0,*A8(OYVEL),L
SLEEP 1
JRUC LUP_TOP
; 01
; 16 02
; 15 03
; 14 04
; 13 05
; 12 06
; 11 07
; 10 08
; 09
;701
;6 2
;543
;CVRT .BYTE 0,5,13,9,1,7,11,3,15,6,12,2,16,8,10,4
;CVRT2 .BYTE 0,05,13,09,01,07,11,03,15
CVRT .BYTE 0,3,7,5,1,4,6,2,8
.EVEN
; 04
; 12 11
; 08 07
; 16 15
; 02 01
; 10 09
; 06 05
; 14 13
; 03
ADOT
; MOVB *A13(DELYDT),A0
; JRZ KS
; DEC A0
; MOVB A0,*A13(DELYDT)
; JRUC DOANI
;KS
MOVE *A8(OYPOS),A0,W
MOVE *A8(OXPOS),A1,W
SLL 16,A0
MOVX A1,A0 ;GET TOP LEFT OF OBJECT
MOVE @WORLDTL,A1,L
SUBXY A1,A0 ;SUBTRACT OUT WORLD BASE
MOVX A0,A1
SLL 16,A1 ;A1=X,A0=Y
MOVE *A13(DIR),A2,W
CMPI 1,A2
JREQ U1
CMPI 3,A2
JREQ U2
CMPI 5,A2
JREQ U3
;LFT
CMPI 0200000H,A1
JRGE DOANI
MOVK 1,A0
JRUC CRCT
U1: CMPI 0280000H,A0
JRGE DOANI
MOVK 3,A0
JRUC CRCT
U2: CMPI 015C0000H,A1
JRLT DOANI
MOVK 5,A0
JRUC CRCT
U3: CMPI 0DD0000H,A0 ;E1
JRLT DOANI
MOVK 7,A0
CRCT:
;CORRECT WALL HIT
MOVE A0,*A13(SK_DIR),W
;FAT MAN WILL SEEK TO A 45 DEGREE ANGLE
MOVK 1,A0 ;FAT WILL SPIN TO SK_DIR
MOVE A0,*A13(CFLAGS)
CLR A0
MOVE A0,*A8(OXVEL),L
MOVE A0,*A8(OYVEL),L
; MOVI 20,A1
; MOVB A1,*A13(DELYDT)
SLEEP 1
JRUC LUP_TOP
CRNRYX: .LONG [40,40],[40,360],[235,40],[235,360]
.LONG [70,90],[90,300],[190,110],[180,310],[200,240]
DIRTBL .LONG 1,1,1,1,3,1,1,1,1
SKFAT .BYTE 3,5,1,7,3,7,3,5,1
SKINDX: .BYTE 0,3,1,2,4,5,6,7,8
SKINDX2:
.BYTE 1,3,7,5,5,7,3,1,3
.EVEN
;DO FRANIM ANIMATION ON THIS MOVING FAT
DOANI CLR A1
JSRP FRANIM
JRNC CHECK_NEXT ;BR=NOT AT END OF SCRIPT YET
CALLR GET_RUN
CHECK_NEXT:
JRUC LUP_TOP
GET_SK:
MOVB *A13(INDEX),A0
SLL 3,A0
ADDI SKFAT,A0
MOVB *A0,A0
MOVE A0,*A13(SK_DIR)
MOVK 1,A0 ;FAT WILL SPIN TO SK_DIR
MOVE A0,*A13(CFLAGS)
; MOVI 40,A1
; MOVB A1,*A13(DELYDT)
RETS
SETUP_FAT:
;DIR IS BASED ON WHAT DOOR HE IS ENTERING THROUGH!
;IF THIS IS AN ONSCREEN FAT, THEN ANY DIR IS OKAY!
;
CALLR GET_SK
;
; UPDATE FAT COUNT
;
CLR A0
MOVB A0,*A13(ABSRB)
MOVE @FAT_CNT,A0
INC A0
MOVE A0,@FAT_CNT
MOVI FAT,A2
CALLA GET_WVADDR
MOVE *A0(32),A1,W ;GET DIFFICULTY LEVEL
MOVE A1,*A13(LEVEL),W
MOVE *A0(16),A1,W ;DEC WAVE RAM CNT FOR THIS FAT
DEC A1
MOVE A1,*A0(16),W
RETS
;
GET_DIS:
MOVI 30,B0
MOVI 100,B1
CALLA RANGRAND
MOVE A0,*A13(DIS) ;TIME BEFORE WE GET NEW VELOCITIES
RETS
YVTBL .LONG 0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8
XVTBL .LONG 0,X1,X2,X3,X4,X5,X6,X7,X8
X8: .LONG 0,-10000H,-1C000H,-20000H,-20000H
Y8: .LONG -18000H,-1C000H,-1A000H,-10000H,0
;Y8: .LONG -18000H,-1C000H,10000H,-10000H,0
;
X1: .LONG -20000H,-10000H,0,10000H,20000H ;UP
Y1: .LONG -10000H,-18000H,-1C000H,-18000H,-10000H
X2: .LONG 0,10000H,1C000H,20000H,20000H
Y2: .LONG -18000H,-1C000H,-1A000H,-10000H,0
X3: .LONG 10000H,20000H,23000H,20000H,10000H
Y3: .LONG -20000H,-10000H,0,10000H,20000H
X4: .LONG 0,10000H,1C000H,20000H,20000H
Y4: .LONG 18000H,1C000H,1A000H,10000H,0
X5: .LONG -20000H,-10000H,0,10000H,20000H
Y5: .LONG 10000H,18000H,1C000H,18000H,10000H
X6: .LONG 0,-10000H,-1C000H,-20000H,-20000H
Y6: .LONG 18000H,1C000H,1A000H,10000H,0
X7: .LONG -10000H,-20000H,-23000H,-20000H,-10000H
Y7: .LONG -20000H,-10000H,0,10000H,20000H
SHRAPNL:
;TURN ON OBJECT AT CORRECT XY
;GET VELOCITY BASED ON DIRECTION IN A9 INDEX INTO TABLE WITH A10
SLL 5,A9
MOVI YVTBL,A0
ADD A9,A0
MOVE *A0,A7,L
ADDI XVTBL,A9 ;GET VELOCITY TABLE
MOVE *A9,A6,L
SLL 5,A10
ADD A10,A6
MOVE *A6,A6,L
ADD A10,A7
MOVE *A7,A7,L
CALLA GETANIXY
* A2 = APOINT OYVAL, 32 BITS *
* A3 = APOINT OXVAL, 32 BITS *
MOVE A2,A1
MOVE A3,A0
MOVI 133,A3 ;159
MOVI DMAWNZ|M_PIXSCAN,A4
MOVI CLSENMY|TYPCBALL,A5
MOVI MTL1,A2
CALLA BEGINOBJ2
MOVI SHRAP,A9
MOVI SHRAP,A10
MOVK 1,A0
MOVB A0,*A13(FDLY) ;FRANIM DELAY
JAUC BULL_TOP
WAY:
;A1=SEEK DIR
;A0=DIR IMAGE IS FACING NOW
SUB A0,A1
MOVE A1,A2
ABS A1
CMPI 5,A1
JRLT N0
NEG A2
N0: BTST 31,A2
JRZ IC
DEC A0
JRP T1
MOVK 8,A0
JRUC T1
IC: INC A0 ;ROTATE TOWARD PLAYER
CMPI 9,A0
JRNE T1
MOVK 1,A0
T1: MOVE A0,*A13(DIR),W
CALLA GET_STAND ;DOES ANI OF CORRECT VIEW
RETS
GET_RUN:
;GET FRANIM BASE ADDRESS FOR THIS FAT MANS DIRECTION
;
MOVE *A13(DIR),A4
ANDI 0FH,A4 ;TAKE OUT
SLL 5,A4 ;*32 FOR LONG WORD LOOKUP TABLE
ADDI WALK_LIST,A4 ;CALCULATE OFFSET IN TABLE
MOVE *A4,A9,L ;MOVE TABLE VALUE INTO A9
;NEW ANIMATION SCRIPT
MOVE *A13(CFLAGS),A0
ANDI 0FFFEH,A0 ;
MOVE A0,*A13(CFLAGS) ;ZERO STANDING/SPIN FLAG
RETS
SPINFRMS:
.LONG new12c,fms105,f9wc,fms75,f6wc,fms75,f9wc,fms105
;SPINFLGS:
; .WORD DMAWNZ,DMAWNZ+M_FLIPH,DMAWNZ+M_FLIPH,DMAWNZ+M_FLIPH,DMAWNZ
; .WORD DMAWNZ,DMAWNZ,DMAWNZ
;SPINFLGS:
; .WORD DMAWNZ,DMAWNZ+M_FLIPH,DMAWNZ+M_FLIPH,DMAWNZ+M_FLIPH,DMAWNZ
; .WORD DMAWNZ,DMAWNZ,DMAWNZ
GET_STAND:
;ANI ONTO SCREEN THIS fat mans STANDING POSITION
MOVE *A13(DIR),A0 ;CURRENT DIR FAT IS FACING
DEC A0
; ANDI 07H,A0 ;TAKE OUT
MOVE A0,A2
SLL 5,A0
ADDI SPINFRMS,A0
MOVE *A0,A1,L ;NEW OIMG
SLL 4,A2
ADDI SPINFLGS,A2
MOVE *A2,A4,W ;NEW OFLAGS
CALLA ANI
RETS
INIT_FAT:
;INITIAL FAT POSITION,IMAGE SHAPE,AGE ETC....
;DO STFOBF AND GET A0 PNTR
;
CALLA GET_VALID_DOOR
INC A0
MOVE A0,@TMP
; MOVI 0,B0
; MOVI 4,B1
; CALLA RANGRAND ;TIE THIS IN WITH DIFFICULTY!
; MOVE A0,A1
; SLL 5,A1
; ADDI DRINF,A1
; MOVE *A1,A1,L
; MOVB *A1,A1
; JRZ G
; CMPI 06,A1
; JRGE G
;DOOR THIS GUY WILL BE SENT TO IS CLOSING RIGHT NOW. SO SEND HIM TO DOOR 4
; MOVI 4,A0 ;DOOR 4
;G MOVE A0,@TMP
;
; DEC A0
;
; MOVE A0,A2
SLL 3,A2
MOVI SKINDX,A1
ADD A2,A1
MOVB *A1,A1
MOVB A1,*A13(INDEX)
SLL 1,A2
MOVI SD,A1
ADD A2,A1
MOVE *A1,A1
MOVE A1,*A13(DIR)
MOVI SX,A1
SLL 1,A2
ADD A2,A1
MOVE *A1,A0,L
MOVI SY,A1
ADD A2,A1
MOVE *A1,A1,L
MMTM SP,A0,A1
MOVE @TMP,A0
MOVI 017H,A1
CALLA SET_GATE_2
MMFM SP,A0,A1
CALLR IH1
CALLA BEGINOBJ
MOVE *A8(OPAL),A0,L
ANDI 0FFFFH,A0
MOVE A0,*A8(OPAL),L
MOVI 20,A3 ;ENOUGH TO GET OUT OF DOOR
MOVE @WAVE,A0
CMPI 4,A0
JREQ IH9
CMPI 6,A0
JREQ IH9
IH8 MOVE A3,*A13(DIS) ;CHANGE BASED ON FAT SPEED?
RETS
IH9
MOVB @PCNT,A0
ANDI 03H,A0
JRNE IH8
MOVI 90,A3 ;ENOUGH TO GET OUT OF DOOR
MOVE A3,*A13(DIS) ;CHANGE BASED ON FAT SPEED?
RETS
IH1: ;ENTER HERE IF ON SCRN FAT
MOVI f6wa,A2 ;DOES NOT MATTER
MOVI 159,A3
MOVI DMAWNZ,A4 ;NON-ZERO VALUE
MOVI CLSENMY|TYPFAT,A5
CLR A6
CLR A7
RETS
SX: .LONG -040000H,01960000H,0CA0000H,0CA0000H
SY: .LONG 0830000H,0830000H,20000H,01100000H ;114
SD: .WORD 3,7,5,1
;812
;7 3
;654
WALK_LIST:
.LONG UP,UP,RGT,RGT,DN,DN,LFT,LFT,RGT
.LONG UP,UP,RGT,RGT,DN,DN,LFT,LFT,RGT
.LONG UP,UP,RGT,RGT,DN,DN,LFT,LFT,RGT
;
;MAN(FAT) ANIMATION TABLES
;
DN
.LONG f6wa
.WORD FLIPBITS|05,0
.LONG f6wb
.WORD 5
.LONG f6wc
.WORD 5
.LONG f6wd
.WORD 5
.LONG f6we
.WORD 5
.LONG f6wd
.WORD 5
.LONG f6wc
.WORD 5
.LONG f6wb
.WORD 5
.LONG 0
RGT
.LONG f9wa
.WORD FLIPBITS|05,(M_FLIPH)
.LONG f9wb
.WORD 5
.LONG f9wc
.WORD 5
.LONG f9wd
.WORD 5
.LONG f9we
.WORD 5
.LONG f9wd
.WORD 5
.LONG f9wc
.WORD 5
.LONG f9wb
.WORD 5
.LONG 0
LFT
.LONG f9wa
.WORD FLIPBITS|05,0
.LONG f9wb
.WORD 5
.LONG f9wc
.WORD 5
.LONG f9wd
.WORD 5
.LONG f9we
.WORD 5
.LONG f9wd
.WORD 5
.LONG f9wc
.WORD 5
.LONG f9wb
.WORD 5
.LONG 0
UP
.LONG new12a
.WORD FLIPBITS|05,0
.LONG new12b
.WORD 5
.LONG new12c
.WORD 5
.LONG new12d
.WORD 5
.LONG new12e
.WORD 5
.LONG new12d
.WORD 5
.LONG new12c
.WORD 5
.LONG new12b
.WORD 5
.LONG 0
SHRAP .LONG MTL1
.WORD 3
.LONG MTL2
.WORD 3
.LONG MTL3
.WORD 3
.LONG MTL4
.WORD 3
.LONG MTL5
.WORD 3
.LONG MTL6
.WORD 3
.LONG MTL7
.WORD 3
.LONG MTL8
.WORD 3
.LONG MTL9
.WORD 3
.LONG MTL10
.WORD 3
.LONG 0
.END