-
Notifications
You must be signed in to change notification settings - Fork 5
/
ARAB.ASM
1189 lines (1107 loc) · 23 KB
/
ARAB.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
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
**************************************************************
*
* Software: Mark Turmell
* Initiated: 3/12/91
*
* Modified: Shawn Liptak, 11/16/91 -Cleanup
*
* COPYRIGHT (C) 1991 WILLIAMS ELECTRONICS GAMES, INC.
*
*.Last mod - 11/26/91 22:38
**************************************************************
.TITLE 'TOTAL CARNAGE GAME PROGRAM'
.WIDTH 132
.OPTION B,D,L,T
.MNOLIST
.INCLUDE "MPROC.EQU" ;MPROC EQUATES
.INCLUDE "DISP.EQU" ;DISPLAY PROC. EQUATES
.INCLUDE "\VIDEO\SYS\SYS.INC" ;Z UNIT SYSTEM EQUATES
.INCLUDE "\VIDEO\SYS\MACROS.HDR" ;MACROS DEFINITIONS
.INCLUDE "IMGTBL.GLO"
.INCLUDE "GAME.EQU"
.INCLUDE "AKHBBOSS.TBL"
;SOUNDS EXTERNAL
.REF TURTSND,EXP3
;SYMBOLS EXTERNALLY DEFINED
.REF AFTR_WRP,WAVE,OGUNBUL
.REF XYSKOBJ,BEGINOBJ2,RANGRAND,HALT,RANDPER,PLYROBJS
.REF SCRTST,OUT_FLG,FRANIM,BSTART
;SYMBOLS DEFINED IN THIS FILE
.DEF STRT_GPIT
.DEF TTORSO,START_PJ,BURST,START_PJ2,BOOB_BURST
;UNINITIALIZED RAM DEFINITIONS
.BSS SCNTR,16
.BSS KEEP_BOOB,32
;EQUATES FOR THIS FILE
MYLIST .EQU PDATA+64 ;UHL FRANIM LIST FOR THIS PC UPON DEATH
;SAME AS FROM MINE.ASM
MYSND .EQU PDATA+96 ;UHL SOUND HEADER FOR GOO TYP DEATH
;SAME AS FROM MINE.ASM
;TORSO DATA STRUCTURE
KPTSOBJ .EQU PDATA ;UHL FOR BTR60
;KPTSOBJ IS DEFINED IN T72.ASM
KIND .EQU PDATA+32 ;UHW-KIND OF GUNNER 0=ARAB,1=BTR60
;2=SAND BAG DUDE, 3=BOOB SHIP TURRET
TDIR .EQU PDATA+48 ;UHW OBJECT DIRECTION
TCFLAGS .EQU PDATA+64 ;UHW CONTROL FLAGS FOR OBJECT
TSK_DIR .EQU PDATA+80 ;UHW SEEK DIR FOR SPIN
KPTANKO .EQU PDATA+96 ;UHL 88+32 ;UHL
;KPTANKO IS REFERENCED IN FIEND.ASM!
MODE .EQU PDATA+128 ;UHW
TCNTR .EQU PDATA+144 ;UHW
SPDLY .EQU PDATA+160 ;UHW
FIRED .EQU PDATA+176 ;UHW
TPNTR .EQU PDATA+192 ;UHW
KOFF .EQU PDATA+208 ;UHW
;224
ABSRB .EQU PDATA+256 ;UHW
;ABSRB IS DEFINED IN FIEND.ASM
.TEXT
********************************
STRT_GPIT
;SAND BAGS
;COULD BE GUNPIT,VGUNPIT, OR GUNPIT FLIPPED, OR VGUNPIT FLIPPED
;MOVI CLSNEUT|TYPGATE|SUBLAY,A4 ;WILL BOUNCE OFF OF
;A8=SAND BAGS FOR PIT
MOVK 2,A9 ;TURRET KIND
MOVE *A8(OIMG),A0,L
MOVE *A0(32),A0,L ;DATA ADDR
MOVI GUNPIT2,A1
MOVE *A1(64),A1,L ;DATA ADDR
CMP A0,A1
JRZ SG1
MOVE *A8(OFLAGS),A1
BTST B_FLIPH,A1
JRZ AD3
MOVI VGUNPIT2,A1
MOVE *A1(64),A1,L ;DATA ADDR
CMP A0,A1
JRNZ ADI
MOVI VGUNPIT2,A1 ;CHANGE OIMG TO BE WIMP TYPE
JRUC SG2
AD3 MOVI VGUNPIT2,A1 ;CHANGE OIMG TO BE WIMP TYPE
MOVE A1,*A8(OIMG),L
ADI DIE
;LEFT/RGT GUN PIT
;TURN ON GUNNER DUDE
SG1 MOVI GUNPIT2,A1
SG2 MOVE A1,*A8(OIMG),L
MOVE A13,A10
MOVE @AFTR_WRP,A0
JRNZ ADI ;BR=COMING BACK FROM A WARP!
MOVE *A8(OYPOS),A0
MOVE @WORLDTLY+16,A1
ADDI 250,A1
CMP A0,A1
JRC ADI
CREATE T72PID,TTORSO
DIE
TTORSO
;A8=TANK IMG PNTR
;A9=0 FOR ARAB DUDE,1=GUN ON TOP OF BTR60,2=GUNNER DUDE,3=BOOB SHIP TURRET
;A10=BIG TANK PROC PNTR
;TURN ON TORSO WITH SAME X/Y AS CURRENT A8
MOVK 13,A0 ;9
MOVE A0,*A13(TDIR)
MOVE A0,*A13(TSK_DIR)
CLR A0
MOVE A0,*A13(ABSRB)
MOVE A9,*A13(KIND)
MOVE A0,*A13(MODE)
MOVK 1,A0
MOVE A0,*A13(SPDLY)
MOVE A0,*A13(TCNTR)
MOVE A8,*A13(KPTANKO),L ;TANK OBJECT PNTR
CALLA GETANIXY
CLR A6
CLR A7
MOVE A2,A1
MOVE A3,A0
MOVI 163,A3 ;133
MOVI DMAWNZ,A4
MOVI CLSENMY|TYPTORSO,A5
MOVI FNDGUN9A,A2
MOVE A9,A9 ;CMPI 0,A9
JRZ AD
MOVI CLSENMY|TYPTORSO|SUB60,A5
MOVI TURT9,A2 ;GUN ON BTR60 ;TURT12
CMPI 1,A9
JRZ AD
CMPI 3,A9
JRNZ AD20
;BOOB SHIP TURRET
MOVI CLSENMY|TYPTORSO|SUBBOOB,A5
MOVI BBTURRET1,A2 ;BOOB SHIP GUNNER
JRUC AD
AD20 CMPI 2,A9
JRNZ AD2
;GUNPIT DUDE HZ
MOVI CLSENMY|TYPTORSO|SUBPIT,A5
MOVI PTGNR1,A2 ;PIT GUNNER
;SET THIS GUNNER DOWN AT PROPER X/Y LOCATION
ADDI [14H,0],A0
SUBI [0CH,0],A1
MOVE *A8(OFLAGS),A9
BTST B_FLIPH,A9
JRZ AD
SUBI [29H,0],A0
MOVE *A8(OIMG),A9,L
MOVI VGUNPIT2,A8
CMP A9,A8
JRNZ AD
;VERTICAL GUN PIT DUDE
SUBI [28H,0],A0
SUBI [1AH,0],A1
JRUC AD
AD2
;OTHER GUNNERS!
AD CALLA BEGINOBJ2
MOVE A8,*A10(KPTSOBJ),L
clr a0
move a0,*a8(OCONST)
MOVI 35,B0
MOVI 50,B1
CALLA RANGRAND
MOVE A0,*A13(TCNTR)
MOVI 60*10,A0 ;INITIAL TIME BEFORE WE DO SCTST ON
MOVE A0,*A13(KOFF) ;THIS GUNNER
TLP_TOP
;MODE 0=ROTATE WITH TANK. TORSO WILL ALWAYS POINT AT DIR TANK IS FACING.
;MODE 1=JUST SITTING ON TOP OF TANK, NOT CARING WHAT DIR TORSO IS FACING.
;MODE 2=ACTIVELY SEEKING A DIR TO SHOOT, THEN FIRE AT END OF SEEK.
;MODE 3=ACTIVELY SEEKING TO DIR TANK IS FACING.
;MODE 4=AIM TOWARD PLAYER
;MODE 5=CONTINUE TO FIRE IN CURRENT DIRECTION
;MODE 6=OSCILLATE AND FIRE
MOVE *A13(KIND),A0
subk 2,a0
JRNZ YOSIT
MOVE *A13(KOFF),A0
DEC A0
MOVE A0,*A13(KOFF)
JRNZ NOSIT
MOVI 4*60,A0
MOVE A0,*A13(KOFF)
;CHECK FOR OFF SCRN
CALLA SCRTST
JRZ NOSIT
;KILL OFF
;FALLS IN HERE IF GUNNER IS DOWN BELOW SCREEN OR TO SIDE!
jauc DELOBJDIE
YOSIT CALLR SIT ;ALIGN TORSO EVERY FRAME
NOSIT MOVE @HALT,A0
JRZ DOG1
;NEED TO START THESE GUYS BACK UP AFTER YOU DIE
;CHECK NDSP1 STOP OBJ FLAGS! (NOMOV?)
SLEEPK 2
JRUC TLP_TOP
DOG1
*******************************************************************************
;;TEST A SPECIFIC DIRECTION FOR ALIGNMENT
; MOVK 1,A0
; MOVE A0,*A13(TDIR),W
; CALLA GET_STANDT ;DOES ANI OF CORRECT VIEW
; MOVE A13,A9
; CREATE0 CBALL ;CANNON BALL
; SLEEPK 10
; JRUC TLP_TOP
*******************************************************************************
MOVE *A13(MODE),A1
JRZ NOSPNT
CMPI 4,A1 ;AIM AT PLAYER
JREQ NOSPNT
CMPI 5,A1 ;SHOOTING AT PLAYER
JREQ NOSPNT
CMPI 6,A1 ;SHOOTING AT PLAYER
JREQ NOSPNT
MOVE *A13(SPDLY),A1
CMPI 7,A1
JRLT AF
MOVK 5,A1
AF
DEC A1
MOVE A1,*A13(SPDLY)
JRNN TAG
JRUC NOSPNT
DECIT MOVE *A13(TDIR),A0,W
CALLR INHERE
MOVE A0,*A13(TDIR),W
JRUC OUT
INCIT
MOVE *A13(TDIR),A0,W
CALLR IC
MOVE A0,*A13(TDIR),W
OUT
CALLR GET_STANDT ;DOES ANI OF CORRECT VIEW
JRUC TAG
NOSPNT MOVE *A13(MODE),A0
JRNZ NZ
CALLR MODECHNG
; CALLA STIK
JRUC TAG
NZ CMPI 1,A0
JRNZ SK
;JUST SITTING HERE
CALLR MODECHNG
JRUC TAG
SK CMPI 2,A0
JRNE SK2
;SEEK TO SKDIR, SHOOT(UNLESS MODE=3), THEN CHANGE MODE
SKIN1 MOVE *A13(SPDLY),A0
sll 32-8,a0
srl 32-8,a0
CMPI 7,A0
JRLT SC
MOVK 1,A0
SC
DEC A0
MOVE A0,*A13(SPDLY)
JRNZ TAG
MOVE *A13(TSK_DIR),A1
MOVE *A13(TDIR),A0,W
CALLR WAY
MOVE A0,*A13(TDIR),W
CALLR GET_STANDT ;DOES ANI OF CORRECT VIEW
MOVE A10,A10
JREQ NSPRAY
MOVE A13,A9
CREATE0 CBALL ;CANNON BALL
NSPRAY MOVE *A13(TSK_DIR),A1
MOVE *A13(TDIR),A0
CMP A0,A1
JREQ GDNEWS
MOVK 4,A0
MOVE A0,*A13(SPDLY)
JRUC TAG
;HAVE SEEKED TO CORRECT SKDIR
;SHOOT
GDNEWS
CLR A10
MOVE *A13(MODE),A0
subk 4,a0
JRNE GG
MOVI 900,A0 ;500
CALLA RANDPER
JRC AP
;SWEEPING OSCILLATE BULLETS
DOSWP MOVK 6,A0
MOVE A0,*A13(MODE)
MOVK 6,B0
MOVK 20,B1
CALLA RANGRAND
; MOVE @TANKDIFF,A1
; MOVK 2,A1
CLR A1
ADD A1,A0
MOVE A0,*A13(FIRED)
MOVK 1,A0
MOVE A0,*A13(SPDLY)
CLR A0
MOVE A0,*A13(TPNTR)
JRUC TAG
AP
;NORMAL FIRE AT PLAYER
MOVK 5,A0
MOVE A0,*A13(MODE)
MOVK 4,B0 ;2
MOVK 7,B1
CALLA RANGRAND
; MOVE @TANKDIFF,A1
; MOVK 2,A1
CLR A1
ADD A1,A0
MOVE A0,*A13(FIRED)
MOVK 1,A0
MOVE A0,*A13(SPDLY)
JRUC TAG
GG MOVI 100,A0 ;800
CALLA RANDPER
JRC GG2
;80% BE SMART
;BE SMART
MOVK 4,A0
MOVE A0,*A13(MODE)
JRUC TAG
GG2
MOVK 1,A0
MOVE A0,*A13(MODE)
JRUC TAG
SK2 CMPI 3,A0
JRNE AIM
;SEEK TO DIR OF TANK UNDER THIS TORSO
;NOW LINED UP WITH TANK DIR
;SET MODE TO STICK
CLR A0
MOVE A0,*A13(MODE)
MOVI 01,A0 ;2F
MOVE A0,*A13(TCNTR)
TAG SLEEPK 1
JRUC TLP_TOP
AIM
CMPI 4,A0
JRNZ FIREX
;MODE=4
MOVE @SCNTR,A3
INC A3
MOVE A3,@SCNTR
sll 32-1,a3
srl 32-1-5,a3 ;*32
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
CALLR GETHDR
SLL 3,A0
ADDI CVRT,A0
MOVB *A0,A0
;DIR TO FACE IN A0
;A0=DIR TO SEEK TO FACE PLAYER
MOVE *A13(TDIR),A1
;
CMPI 17,A1
JRC OKAYZ
;FIX BUG
CLR A1
MOVE A1,*A13(TDIR)
OKAYZ
CMP A0,A1
JREQ AIM2
;NOT =
MOVE A0,*A13(TSK_DIR),W
JRUC SKIN1
AIM2
MOVE A13,A9
CREATE0 CBALL
MOVI 400,A0
CALLA RANDPER
JRC DOSWP ;DO SWEEP BULLETS
MOVI 400,A0
CALLA RANDPER
MOVK 4,A0
JRC AIM3 ;DO SWEEP BULLETS
MOVK 3,A0
AIM3 MOVE A0,*A13(MODE)
JRUC TAG
FIREX
CMPI 5,A0
JRNZ OSC
;CONTINUALLY FIRE IN CURRENT DIRECTION
MOVE *A13(SPDLY),A0
DEC A0
MOVE A0,*A13(SPDLY)
JRNN TAG
MOVK 5,A0
MOVE A0,*A13(SPDLY)
MOVE *A13(FIRED),A0
DEC A0
MOVE A0,*A13(FIRED)
JREQ RESET
;FIRE A BULLET
MOVE A13,A9
CREATE0 CBALL
JRUC TAG
RESET
MOVI 900,A0
CALLA RANDPER
JRC SLW
;SEEK PLAYER AGAIN
MOVK 4,A0
MOVE A0,*A13(MODE)
JRUC TAG
SLW MOVK 1,A0
MOVE A0,*A13(MODE)
JRUC TAG
OSC:
CMPI 6,A0
JRNE SWING
;OSCILLATE AND FIRE
MOVE *A13(SPDLY),A0
DEC A0
MOVE A0,*A13(SPDLY)
JRNN TAG
; MOVE @TANKDIFF2,A0
MOVK 6,A0 ;TIE IN TO LEVEL OF DIFFICULTY!
MOVE A0,*A13(SPDLY)
MOVE *A13(FIRED),A0
DEC A0
MOVE A0,*A13(FIRED)
JREQ RESET
;FIRE A BULLET
MOVE A13,A9
CREATE0 CBALL
;NOW ANGLE OFF
MOVE *A13(TPNTR),A0
INC A0
MOVE A0,*A13(TPNTR)
CMPI 9,A0
JRLT AB
MOVK 1,A0
MOVE A0,*A13(TPNTR)
AB SLL 5,A0
ADDI WAYTBL,A0
MOVE *A0,A0,L
JUMP A0
WAYTBL .LONG 0,INCIT,INCIT,DECIT,DECIT,DECIT,DECIT,INCIT,INCIT
SWING:
;SWING AROUND AND AROUND SPRAYING BULLETS
JRUC TAG
MODECHNG
MOVE *A13(TCNTR),A0
sll 32-8,a0
srl 32-8,a0
CMPI 200,A0
JRLT AV
MOVI 30,A0 ;50
AV
DEC A0
MOVE A0,*A13(TCNTR)
JRNN EX
;TCNTR UP, MAYBE RESET MODE
MOVI 35,B0
MOVI 50,B1 ;80
CALLA RANGRAND
MOVE A0,*A13(TCNTR)
MOVI 700,A0
CALLA RANDPER
JRNC EX ;NO CHANGE OF MODE
;COULD BE IN SIT MODE OR STICK MODE
MOVI 1,B0
MOVI 13,B1 ;4
CALLA RANGRAND
CMPI 5,A0
JRLT AK
MOVK 4,A0
AK:
CMPI 1,A0
JREQ SHOOT
MOVE A0,*A13(MODE)
CMPI 3,A0
JREQ EX
MOVE *A13(TDIR),A1
MOVI 4,B0
MOVI 15,B1
CALLA RANGRAND
ADD A0,A1
CMPI 17,A1
JRLT AGN
SUBI 16,A1
AGN MOVE A1,*A13(TSK_DIR)
MOVK 1,A10
EX
MOVE *A13(MODE),A0
CMPI 3,A0
JRNE RTY1
MOVK 1,A0 ;JUST SIT
MOVE A0,*A13(MODE)
RTY1 RETS
SHOOT
;SHOOT
MOVE A13,A9
CREATE0 CBALL
MOVK 1,A0
MOVE A0,*A13(MODE)
RETS
SIT MOVE A8,A0
MOVE *A13(KPTANKO),A8,L
CALLA GETANIXY
;A2=Y,A3=X
MOVE *A0(OFLAGS),A4,W
CALLA GANISAG ;ADJUSTS TORSO
MOVE A0,A8
RETS
;FOR ARAB ON TANK
XOFSET: .LONG 0B0000H,0220000H,02B0000H,0340000H,0370000H,0380000H,02E0000H
.LONG 01E0000H,0F0000H,010000H,0FFFFH,020000H,0,0,010000H,000000H
YOFSET: .LONG 020000H,020000H,020000H,020000H,0D0000H,0210000H,02D0000H
.LONG 02E0000H,0360000H,02F0000H,02C0000H,0200000H,0E0000H,020000H
.LONG 010000H,020000H
;FOR GUN ON TOP OF BTR60
;FOR PUFF OF FIRE NEAR GUN ON TOP OF BTR60 AFTER IT FIRES
XOFSET2:
.LONG 0D0000H,0260000H,02E0000H,03A0000H,03A0000H,0380000H,02E0000H
.LONG 0220000H,0E0000H,030000H,020000H,020000H,0,0,010000H,000000H
YOFSET2:
.LONG 0FFFD0000H,020000H,020000H,020000H,0D0000H,0210000H,02D0000H
.LONG 02F0000H,0360000H,02F0000H,02C0000H,0230000H,0D0000H,020000H
.LONG 010000H,020000H
.LONG 0 ;OUT
;FOR SAND BAG GUNNER
XOFSET3:
.LONG 0E0000H,0270000H,0350000H,03C0000H,04A0000H,03E0000H,0310000H
.LONG 0240000H,0E0000H,010000H,[-3,0],0,[-4,0],[-2,0],[-3,0],0
YOFSET3:
.LONG [-2,0],0,[-2,0],0,0A0000H,0290000H,0340000H ;36
.LONG 03C0000H,03F0000H,03B0000H,0380000H,0280000H,0A0000H,0
.LONG [-3,0],[-2,0]
;FOR BOOB SHIP TURRET
XOFSET4:
.LONG 0,0320000H,0320000H,0320000H,0320000H,02B0000H,0260000H
.LONG 01E0000H,0C0000H,020000H,030000H,040000H,0,0,0,0
YOFSET4:
.LONG 060000H,060000H,060000H,060000H,060000H,0120000H,01A0000H
.LONG 0200000H,0250000H,01F0000H,0190000H,0110000H,060000H,060000H
.LONG 060000H,060000H
XVL: .LONG 0,0B433H,019999H,019999H,019999H,019999H,019999H,0B433H,0
.LONG -0B433H,-019999H,-019999H,-019999H,-019999H,-019999H,-0B433H
YVL: .LONG -019999H,-019999H,-019999H,-0CCCCH,0,0CCCCH,019999H,019999H,019999H
.LONG 019999H,019999H,0CCCCH,0,-0CCCCH,-019999H,-019999H
BXVL: .LONG -019999H,019999H,019999H,019999H,019999H,019999H,019999H,0B433H,0
.LONG -0B433H,-019999H,-019999H,-019999H,-019999H,-019999H,-019999H
BYVL: .LONG 0,0,0,0,0,0CCCCH,019999H,019999H,019999H
.LONG 019999H,019999H,0CCCCH,0,0,0,0
XVL2: .LONG 0,0E8F5H,02147AH,02147AH,02147AH,02147AH,02147AH,0E8F5H,0
.LONG -0E8F5H,-02147AH,-02147AH,-02147AH,-02147AH,-02147AH,-0E8F5H
YVL2: .LONG -02147AH,-02147AH,-02147AH,-010A3CH,0,010A3CH,02147AH,02147AH,02147AH
.LONG 02147AH,02147AH,010A3CH,0,-010A3CH,-02147AH,-02147AH
; 01
; 16 02
; 15 03
; 14 04
; 13 05
; 12 06
; 11 07
; 10 08
; 09
CBALL:
;A9=TORSOS' A13 THAT FIRED THIS BALL
;A8=TORSO IMG
MOVE @WAVE,A0
CMPI 13,A0
JRGE CBL1
;EARLY DESERT GUNNER DUDE
MOVI 250,A0 ;450
CALLA RANDPER
JAC SUCIDE
CBL1
MOVI DMAWNZ,A11 ;FLAGS
MOVE *A9(KPTANKO),A0,L
MOVE *A0(OXVEL),A6,L ;RETAIN TANK VELOCITY
MOVE *A0(OYVEL),A7,L
MOVE *A9(TDIR),A2,W
; 01
; 16 02
; 15 03
; 14 04
; 13 05
; 12 06
; 11 07
; 10 08
; 09
DEC A2
SLL 5,A2
MOVE *A9(KIND),A3
SUBK 3,A3
JRNZ REGBU
;BOOB TURRET
MOVI BXVL,A3
ADD A2,A3
MOVE *A3,A3,L
ADD A3,A6
MOVI BYVL,A3
MOVI BOOB_BURST,A10
MOVE A10,@KEEP_BOOB,L
JRUC BOOB1
REGBU MOVI XVL,A3
ADD A2,A3
MOVE *A3,A3,L
ADD A3,A6
MOVI YVL,A3
MOVI BURST,A10
MOVE A10,@KEEP_BOOB,L
BOOB1
;RECOIL
PUSH A7
;KIND .EQU PDATA+32 ;UHW-KIND OF GUNNER 0=ARAB,1=BTR60
;2=SAND BAG DUDE, 3=BOOB TURRET
MOVI TBLS,A0
MOVE @WAVE,A4
CMPI 18,A4
JRZ KJD
CMPI 17,A4
JRNZ KJ1
KJD MOVI TBLSZ,A0 ;FOR PINK BULLET
KJ1 MOVE *A9(KIND),A4
SLL 5,A4
ADD A4,A0
MOVE *A0,A0,L
MOVE *A9(TDIR),A7
MOVE A7,A10
SLL 4,A7
MOVI TK_SPINFLGS-16,A11
ADD A7,A11
MOVE *A11,A11,W
SLL 1,A7
ADD A0,A7
MOVE *A7,A5,L
CMPI 64,A4
; JRZ SKP
JRNC SKP ;BR=SAND BAG DUDE OR BOOB TURRET
CREATE0 FLAMEIT ;RECOIL GUN
MOVE A4,A4 ;*A9(KIND),A0
JRZ AD7
CREATE0 PUFF ;PUFF OF FIRE AROUND BARREL
JRUC AD7O
SKP CREATE0 PUFF ;PUFF FOR GUNNER DUDE
AD7 CMPI 96,A4
JRZ AD7O
CREATE0 RECOIL
AD7O
;RENTER
PULL A7
ADD A2,A3
MOVE *A3,A3,L
ADD A3,A7
MOVE *A8(OXVAL),A0,L
MOVE *A8(OYVAL),A1,L
MOVE A5,A8
MOVI LSTA,A5
ADD A4,A5
MOVE *A5,A3,L
ADDI LSTB,A4
MOVE *A4,A5,L
ADD A2,A3
MOVE *A3,A3,L
ADD A3,A0
ADD A2,A5
MOVE *A5,A3,L
ADD A3,A1
MOVE A8,A2
;YVAL IN A1
MOVI CLSENMY|TYPGOO,A5 ;ENMY|TYPSHOT,A5
MOVE A11,A4
;ID IN A5
MOVI 160,A3 ;133
;ZPOS IN A3
;XVEL IN A6
;YVEL IN A7
MOVE @KEEP_BOOB,A10,L
START_PJ
CALLA BEGINOBJ2
MOVI TURTSND,A0
CALLA ONESND
START_PJ2
; MOVI BURST,A0
MOVE A10,*A13(MYLIST),L
MOVI EXP3,A0
MOVE A0,*A13(MYSND),L
CLR A9 ;THIS BALL WILL NOT ANIMATE
MOVE A9,*A13(MYPLYR)
JRUC BSTART
TBLS .LONG BANGL1-32,BANGL2-32,BANGL-32,BANGL3-32
TBLSZ .LONG BANGL1-32,BANGL2Z-32,BANGL-32,BANGL3-32
;BOOB SHIP TURRET
BANGL3 .LONG LASER5,LASER5,LASER5,LASER5,LASER5
.LONG LASER4,LASER3,LASER2,LASER1
.LONG LASER2,LASER3,LASER4,LASER5,LASER5
.LONG LASER5,LASER5
BANGL .LONG GNNRBUL12,GNNRBUL115,GNNRBUL11,GNNRBUL10,GNNRBUL9
.LONG GNNRBUL85,GNNRBUL8,GNNRBUL7,GNNRBUL6
.LONG GNNRBUL7,GNNRBUL8,GNNRBUL85,GNNRBUL9,GNNRBUL10
.LONG GNNRBUL11,GNNRBUL115
BANGL1
; .LONG GBUL12,GBUL115,GBUL11,GBUL10,GBUL9
;T72 ARAB
; .LONG GBUL85,GBUL8,GBUL7,GBUL6
; .LONG GBUL7,GBUL8,GBUL85,GBUL9,GBUL10
; .LONG GBUL11,GBUL115
BANGL2 .LONG GUNBUL,GUNBUL,GUNBUL,GUNBUL,GUNBUL,GUNBUL
.LONG GUNBUL,GUNBUL,GUNBUL,GUNBUL,GUNBUL,GUNBUL
.LONG GUNBUL,GUNBUL,GUNBUL,GUNBUL
BANGL2Z .LONG OGUNBUL,OGUNBUL,OGUNBUL,OGUNBUL,OGUNBUL,OGUNBUL
.LONG OGUNBUL,OGUNBUL,OGUNBUL,OGUNBUL,OGUNBUL,OGUNBUL
.LONG OGUNBUL,OGUNBUL,OGUNBUL,OGUNBUL
;BTR60
.LONG GNNRBUL85,GNNRBUL8,GNNRBUL7,GNNRBUL6
.LONG GNNRBUL7,GNNRBUL8,GNNRBUL85,GNNRBUL9,GNNRBUL10
.LONG GNNRBUL11,GNNRBUL115
LSTA .LONG XOFSET,XOFSET2,XOFSET3,XOFSET4
LSTB .LONG YOFSET,YOFSET2,YOFSET3,YOFSET4
BTYPE .LONG GUNBUL,GUNBUL,GUNBUL
BURST .LONG FIRE1
.WORD NEWPALET|5
.LONG BULLET
.LONG FIRE2
.WORD 5
.LONG FIRE3
.WORD 5
.LONG FIRE4
.WORD 5
.LONG FIRE5
.WORD 5
.LONG FIRE6
.WORD 9
.LONG FIRE5
.WORD 5
.LONG FIRE4
.WORD 5
.LONG FIRE3
.WORD 5
.LONG FIRE2
.WORD 3
.LONG 0
BOOB_BURST
.LONG LSPLAT1
.WORD NEWPALET|5
.long GRNFCP
.LONG LSPLAT2
.WORD 5
.LONG LSPLAT1
.WORD 5
.LONG LSPLAT2
.WORD 5
.LONG LSPLAT1
.WORD 5
.LONG LSPLAT2
.WORD 5
.LONG 0
PUFF
;A9=TORSOS' A13 THAT FIRED
;A8=TORSO IMG
MOVE *A9(TDIR),A2
DEC A2
SLL 5,A2
MOVE *A8(OXVAL),A0,L
MOVE *A8(OYVAL),A1,L
MOVE *A9(KIND),A3
CMPI 3,A3
JRNZ OPF1
;BOOB SHIP TURRET PUFF
MOVI XOFSET4,A3
MOVI YOFSET4,A5
MOVI BOOB_PUFL,A9
MOVI LBLAST1,A6
JRUC PF2
OPF1
MOVI GNFR1,A6
MOVI PUFL,A9
CMPI 2,A3
JRZ PF1
MOVI XOFSET2,A3
MOVI YOFSET2,A5
JRUC PF2
PF1 MOVI XOFSET3,A3
MOVI YOFSET3,A5
PF2 ADD A2,A3
MOVE *A3,A3,L
ADD A3,A0
ADD A2,A5
MOVE *A5,A3,L
ADD A3,A1
; MOVI GNFR1,A2
MOVE A6,A2
MOVI CLSDEAD,A5
move *a8(OXVEL),A6,L
move *a8(OYVEL),A7,L
; CLR A6
; CLR A7
MOVI DMAWNZ|M_NOCOLL,A4 ;FLAGS
MOVI 170,A3 ;133
CALLA BEGINOBJ2
; MOVI PUFL,A9
jauc FRQDELDIE
PUFL .LONG GNFR1
.WORD 2
.LONG GNFR2
.WORD 2
.LONG GNFR3
.WORD 2
.LONG 0
BOOB_PUFL
.LONG LBLAST1
.WORD 2
.LONG LBLAST2
.WORD 2
.LONG 0
RECOIL MOVE A10,A0
SLL 4,A0
MOVI XCHG,A1
ADD A0,A1
MOVE *A1,A10,W ;X MOD
MOVI YCHG,A2
ADD A0,A2
MOVE *A2,A9,W
MOVE *A8(OYPOS),A0
ADD A9,A0
MOVE A0,*A8(OYPOS)
MOVE *A8(OXPOS),A0
ADD A10,A0
MOVE A0,*A8(OXPOS)
SLEEPK 2
MOVE *A8(OYPOS),A0
SUB A9,A0
MOVE A0,*A8(OYPOS)
MOVE *A8(OXPOS),A0
SUB A10,A0
MOVE A0,*A8(OXPOS)
DIE
XCHG: .WORD 0,0,-1,-2,-2,-2,-2,-2,-1,0,1,2,2,2,2,2,1
YCHG: .WORD 0,2,2,2,1,0,-1,-2,-2,-2,-2,-2,-1,0,1,2,2
FLAMEIT
;A9=TORSO PROC PNTR
;A10=DIR TORSO FACING
;A8=TORSO PNTR
DEC A10
sll 32-4,a10
srl 32-4,a10
MOVE A10,A1
SLL 5,A1
MOVE *A9(KIND),A0
JRZ AD8
ADDI FLMVW2,A1
JRUC AD8O
AD8 ADDI FLMVW,A1
AD8O MOVE *A1,A1,L
MOVE *A8(OFLAGS),A4,W
CALLA ANI
SLEEPK 3
MOVE *A9(TDIR),A0
DEC A0
CMP A10,A0
JRNZ DOF
;PUT NORMAL NON FLAME VIEW BACK
MOVE A10,A1
SLL 5,A1
MOVE *A9(KIND),A9
JRZ AD5
ADDI TSPINFRMS2,A1
JRUC AD5O
AD5 ADDI TSPINFRMS,A1
AD5O MOVE *A1,A1,L ;NEW OIMG
MOVE *A8(OFLAGS),A4,W
CALLA ANI
DOF DIE
; 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
.EVEN
; 04
; 12 11
; 08 07
; 16 15
; 02 01
; 10 09
; 06 05
; 14 13
; 03
;GETHDR - RETURNS 1 OF 16 DIRECTIONS BASED ON OBJECTS X,Y VELOCITIES
;PARAMS:
; A1 = OBJ X VELOCITY
; A2 = OBJ Y VELOCITY
;RETURNS:
; A0 = 4,B,7,F,1,9,5,D,3,E,6,A,2,10,8,C = CW DIRECTION STARTING AT 12 O'CLOCK
; 4
; 2 1
; 3
GETHDR:
MOVE A1,A3
MOVE A2,A4
ABS A3 ;ABSOLUTE X VELOCITY
ABS A4 ;ABSOLUTE Y VELOCITY
MOVE A3,A5
ADD A4,A5 ;SUM Y+X
JRNE GAD1 ;BR = THERE IS A DIRECTION HERE!
CLR A3 ;STANDING CASE
JRUC SETDVAL
GAD1:
MOVK 3,A5
MOVK 3,A7
MPYU A3,A5 ;CALC 3*X
MPYU A4,A7 ;CALC 3*Y
CMP A7,A3 ;XV>3*YV ?
JRHS GADX ;BR = CHECK X VELOCITY CASE
CMP A5,A4 ;YV>3*XV ?
JRHS GADY ;BR = CHECK Y VELOCITY CASE
;
;DIAGONAL XY VELOCITY CASE
;4 POSSIBLE QUADRANTS 0-3
; 3 2
; 1 0
MOVE A1,A3 ;SAVE X,Y VELOCITIES