-
Notifications
You must be signed in to change notification settings - Fork 5
/
LAYER.ASM
2789 lines (2598 loc) · 50.2 KB
/
LAYER.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/28/91
*
* Modified: !
*
* COPYRIGHT (C) 1992 WILLIAMS ELECTRONICS GAMES, INC.
*
*.Last mod - 1/9/92 18:40
**************************************************************
.FILE 'LAYER.ASM'
.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"
;
;SOUNDS EXTERNAL
;
.REF ALTEXP4,MECH1,ALTXP1A,AGLSEXP,GLSEXP,MTING,ONESNDOVR
;SYMBOLS EXTERNALLY DEFINED
;
.REF GETSND,GETCOS,GETSIN,CLNICN,STATUS,SHK_ON
.REF DO_DIFF2,RANDOM,INTO12,RANDPER,RANGRAND,SCRTSTG,FRANIM,WFLG
.REF GET_WVADDR,HALT,ENEMY_RECT,PCNT,PIT2,DO_PUNISH,GPALOBJ
.REF SCORE_IT,FAME4,FAME2,FAME3,FLASHME,TBLST,FIREEXP,SHAKER
.REF missile_firexy,GETFPAL,SCRADD2,P1DATA,P2DATA,WAVE,FIXEDA
.REF PLYROBJS,FRANIMQ,RUNIN,LOWZ,SBOMB,missile_firexy_slow
.ref RNDRNG0
;
;SYMBOLS DEFINED IN THIS FILE
;
.DEF SPAWN_LYR,MAXLYR,LYR_CNT,KILL_LY,YKIL_RNG,SENDGRN,SENDGRN2
.DEF FLAME_LAY,YKIL_LAY,LAY_EXP,PHASE1,LHLPS
.DEF XVL,YVL,STRT_ALAY,BIGBLU,SPAWN_MISL
.DEF DOYV1,DOYV,DOYVP,BOLTS,HLPON,LSHIT,LSDMG
;
;UNINITIALIZED RAM DEFINITIONS
;
.BSS LYR_CNT,16 ;TOTAL TANKS ON SCREEN
.BSS TNK_DN,16
.BSS MAXLYR,16 ;MAX NUMBER OF TANKS ALLOWED ON SCRN
.BSS PTMP,16
.BSS TEMP,32
;
;EQUATES FOR THIS FILE
;
;TANK DATA STRUCTURE
;
CNTR .EQU PDATA ;DELAY FOR OID SWAPPING
SPDY .EQU PDATA+16
DIR .EQU PDATA+32 ;UHW OBJECT DIRECTION
;MYPLYR .EQU PDATA+48 ;UHW PLAYER 1 OR 2 FIRED ME
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
TOTMN .EQU PDATA+224 ;UHW
WAY01 .EQU PDATA+240 ;UHW
ABSRB .EQU PDATA+256 ;UHW
;ABSRB IS DEFINED IN FIEND.ASM
CFLAGS .EQU PDATA+272 ;UHW CONTROL FLAGS FOR OBJECT
MYPATRN .EQU PDATA+288 ;UHL PATTERN LIST ADDRESS
KPANTOBJ .EQU PDATA+320 ;UHL ANTENNA IMG PNTR
LAYTMR .EQU PDATA+352 ;UHW
MRAM .EQU PDATA+368 ;UHL 32*POINTER TO RAM LIST
KPMRAM .EQU PDATA+400 ;UHL CALLA FREEOBJ WITH THIS LATER
DIS .EQU PDATA+432 ;UHW OBJECT DISTANCE COUNT
MYANT .EQU PDATA+448 ;UHL ANTENNA PROC POINTER
;
;
;ANTENNA DATA STRUCTURE
;
;
;EQUATES
;
HSPEED .EQU 07000H ;INITIAL SPEED FOR MINE LAYER
HSPEED2 .EQU HSPEED*2 ;INITIAL SPEED FOR MINE LAYER
HITLAY .EQU 20*30
;
;EQUATES
;
MAXHITS .EQU 10 ;HELPER BLADE DIFFICULTY SETTING
ADLTA .EQU 0381BH ;(411775/(160/2))
;
; LASER/BLADES DATA STRUCTURE
;
PTRX .EQU PDATA ;UHW ;LAST X
PTRY .EQU PDATA+16 ;UHW ;LAST Y
;ANIMTIK .EQU PDATA+32 ;UHL ;FRAME SLEEP TIME
THETA .EQU PDATA+64 ;SHL ;CURRENT PROGRESSION
DELTA .EQU PDATA+96 ;SHL ;DELTA ANGLE
LEG .EQU PDATA+128 ;UHL LEG OF PLAYER WHO COLLECTED ME
HITS .EQU PDATA+160 ;UHW ;HIT CNTR
.TEXT
HELP .WORD >F97E,>24,>80C1,0 ;"HELP"
HLPON:
MMTM SP,A1,A7,A9,A10
; MOVE A0,A9 ;A9=LEG
MOVE *A0(OPLINK),A0,L
MOVE *A0(LEG_PTR),A9,L
MOVE *A0(LSRPTR),A0,L
JRZ SKP
MOVE *A0(OPLINK),A0,L
CLR A1
MOVE A1,*A0(HITS)
JRUC SKP2
SKP CREATE0 LASER
SKP2 CALLA CLNICN
MOVI GETSND,A0
CALLA ONESND
MMFM SP,A1,A7,A9,A10
RETS
; DO LASER MOVEMENT LOGIC
LASER:
;A9=LEG IMG PNTR OF PLAYER WHO TOUCHED ME
CLR A0
MOVE A0,*A13(MYPLYR) ;THIS BLADE WILL NOT SCORE PTS
;VEHICHLES USE THE BLADE OID FOR KILLING GRUNTS, ETC.
;SO THE HELPER BLADE WILL NOT SCORE PTS FOR THE PLAYER
CLR A0
MOVE A0,*A13(HITS)
MOVI ADLTA,A0
MOVE A0,*A13(DELTA),L
MOVI INITAB,A14
CALLA GPALOBJ ;ALLOCATE A COLOR PALETTE
CALLA STFOBJ ;STUFF OBJECT DATA
MOVE A13,*A0(OPLINK),L
CALLA ADJSTWTL ;PUT US IN THE WORLD
CALLA INSOBJ ;INSERT OBJECT INTO LIST
MOVE A0,A10
;A9=CORRECT LEG PTR
MOVE A9,*A13(LEG),L
;A7=A7 ALREADY?
MOVE *A9(OPLINK),A7,L ;LEGS HAVE SAME OPLINK AS TORSO!
;A7 NOW EQUALS TORSO PROC OF PLAYER WHO PICKED UP HELPER ICON
MOVE A0,*A7(LSRPTR),L
;THIS OKAY?
MOVE A9,A8
CALLA GETANIXY ;Y/X POSITION RETURNED IN A2,A3
MOVE A10,A8
ADDI [3,0],A2
MOVE A2,*A8(OYVAL),L
SUBI [10,0],A3
MOVE A3,*A8(OXVAL),L
CLR A0
MOVE A0,*A13(PTRX),W ;OLD X,Y VALUES
MOVE A0,*A13(PTRY),W
MOVE A0,*A13(THETA),L
;
ENCIRCLE:
; MAKE LASER MOVE IN A CIRCLE AROUND PLAYER
CALLR ALIGNXY ;KEEP OBJECT ALIGNED WITH PLAYER
MOVE *A13(THETA),A2,L ;PROGRESSIVE THETA
MOVE *A13(DELTA),A0,L ;NEXT DELTA ANGLE
ADD A2,A0
CALLA GETCOS
MOVE A0,A11
MOVK 3,A0
MPYS A0,A11
MOVE A14,*A13(THETA),L
MOVE A14,A0
CALLA GETSIN
MOVE A0,A3
MOVK 3,A0
MPYS A0,A3
MOVE A3,A10
MOVE *A8(OXVAL),A3,L
MOVE *A8(OYVAL),A4,L
ADD A11,A3
ADD A10,A4
MOVE A3,*A8(OXVAL),L
MOVE A4,*A8(OYVAL),L
SLOOP 1,ENCIRCLE
LASERDIE:
MOVE A11,*A8(OXVEL),L
MOVE A10,*A8(OYVEL),L
FLYER:
CALLA SCRTST
JRNZ LSER
SLOOP 30,FLYER
LSER jauc DELOBJDIE
ALIGNXY:
; KEEP LASER WITHIN X CENTERPOINT OF PLAYER
; PARMS:
;
; A8 = PTR TO PLINDX
;
MOVE *A13(PTRX),A4,W ;OLD X,Y VALUES
MOVE *A13(PTRY),A5,W
MOVE A8,A10
MOVE *A13(LEG),A8,L
CALLA GETANIXY ;Y/X POSITION RETURNED IN A2,A3
MOVE A10,A8
SWAP A2,A3
SRL 16,A2
SRL 16,A3
MOVE A4,A4
JRZ PK
DIFF:
CMP A4,A2
JREQ DOY
JRGT ADDX ;NEW X POS > OLD X POS
SUBX:
SUB A2,A4
MOVE *A8(OXPOS),A6
SUB A4,A6
MOVE A6,*A8(OXPOS)
JRUC DOY
ADDX:
SUB A2,A4
NEG A4
MOVE *A8(OXPOS),A6
ADD A4,A6
MOVE A6,*A8(OXPOS)
DOY:
CMP A5,A3
JREQ PK ;NO DIFFERENCES IN X,Y BYE!
JRGT ADDY ;NEW Y POS > OLD Y POS
SUBY:
SUB A3,A5
MOVE *A8(OYPOS),A6
SUB A5,A6
MOVE A6,*A8(OYPOS)
JRUC PK
ADDY:
SUB A3,A5
NEG A5
MOVE *A8(OYPOS),A6
ADD A5,A6
MOVE A6,*A8(OYPOS)
PK:
MOVE A2,*A13(PTRX),W
MOVE A3,*A13(PTRY),W
RETS
LSDMG:
MMTM SP,A1,A13
MOVE *A8(OPLINK),A13,L ;GET PROCESS ID BACK
MOVE *A13(HITS),A1
INC A1
MOVE A1,*A13(HITS)
CMPI MAXHITS,A1
JRNZ HO
;BLADE TO FLY OFF
;RESET HERE
CALLR LSHIT
HO MMFM SP,A1,A13
RETS
LSHIT:
;CALLED FROM COLLISION ROUTINE
;ALSO CALLED FROM ROBO WHEN PLAYER DIES
;A8=HELPER IMG PNTR
MMTM SP,A0,A7,A13
;PUSHING ENOUGH STUFF HERE?
MOVE *A8(OPLINK),A13,L ;GET PROCESS ID BACK
;HELPER TO FLY OFF
;RESET HERE
MOVE *A13(LEG),A0,L ;GET LEG I SURROUND
MOVE *A0(OPLINK),A0,L ;GET PLAYER PROC
CLR A7
MOVE A7,*A0(LSRPTR),L ;ZERO PLAYER PROC LASER PNTR
MOVE A13,A0
MOVI LASERDIE,A7
CALLA PUTA7 ;THIS HLPR WILL NOW WAKE UP AT A7 ADDR
MMFM SP,A0,A7,A13
RETS
INITAB:
.LONG 0,0,BLADE
.WORD 158,DMAWNZ,CLSPLYR|TYPHLPR
.LONG 0,0
BOLTS
MOVK 10,A10
BLT1 CREATE FUTUREPID,ONEBOLT
DSJS A10,BLT1
MOVE @WORLDTLX+16,A10
ADDI 70,A10
;A10=TARGET FOR CHANGING @RUNIN TO 1
SETR SLEEPK 20
MOVE @WORLDTLX+16,A0,L
CMP A10,A0
JRLT SETR
MOVK 1,A0
MOVE A0,@RUNIN
DIE
ONEBOLT SLEEPK 10
MOVE @WORLDTLX+16,A0
CMPI 580H,A0
JANC SUCIDE
MOVI BOLTX-16,A1
MOVE A10,A2
SLL 4,A2
ADD A2,A1
MOVE *A1,A1,W
CMP A1,A0
JRNC ONEBOLT
ADDI 400,A0
CMP A1,A0
JRC ONEBOLT
;BOLT IS ON SCRN
ADDI BOLTNUM-16,A2
MOVE *A2,A11,W
MOVE A1,A0
SLL 16,A0
MOVE A0,A9
MOVI [559H,0],A1
MOVI VBOLT1,A2
MOVI 150,A3
MOVI DMAWNZ,A4
MOVI CLSNEUT|TYPBOLT,A5
CLR A6
CLR A7
CALLA BEGINOBJ2
CREATE0 DOIT
MOVI ELECSND1,A0
CALLA ONESND
MOVE A9,A0
MOVI [5B2H,0],A1
MOVI VBOLT1,A2
MOVI 150,A3
MOVI DMAWNZ,A4
MOVI CLSNEUT|TYPBOLT,A5
CLR A6
CLR A7
CALLA BEGINOBJ2
MOVI ELECSND2,A0
CALLA ONESND
BL1 MOVI BOLTVF,A9
JSRP FRANIMQ
DSJS A11,BL1
MOVI ELECSND2,A0
CALLA ONESND
MOVE A8,A0
CALLA DELOBJ
MOVE A10,A0
SLL 4,A0
ADDI SLPTIM-16,A0
MOVE *A0,A0,W
CALLA PRCSLP
JRUC ONEBOLT
DOIT
MOVI BOLTVF,A9
JSRP FRANIMQ
DSJS A11,DOIT
MOVE A8,A0
CALLA DELOBJ
DIE
ELECSND1
.WORD >F0E5,>18,>811E,0
ELECSND2
.WORD >F5E5,20,>811F,0
BOLTNUM .WORD 2,5,5,4,2,5,5,2,5,1
SLPTIM .WORD 45,72,45,60,70,45,46,41,53,69
BOLTX .WORD 0E3H,017EH,1ffh,25CH,32AH,3B9H,42EH,4BBH,584H,59CH
BOLTVF
.LONG VBOLT1
.WORD FLIPBITS|3,0
.LONG VBOLT2
.WORD 3
.LONG VBOLT3
.WORD 3
.LONG VBOLT1
.WORD FLIPBITS|3,M_FLIPH
.LONG VBOLT2
.WORD 3
.LONG VBOLT3
.WORD 3
.LONG VBOLT1
.WORD FLIPBITS|3,M_FLIPV
.LONG VBOLT2
.WORD 3
.LONG VBOLT3
.WORD 3
.LONG VBOLT1
.WORD FLIPBITS|3,M_FLIPV|M_FLIPH
.LONG VBOLT2
.WORD 3
.LONG VBOLT3
.WORD 3
.LONG 0
DOYV1 ;FROM TOP OF SCRN DOWN
MOVI -3000H,A0 ;12
MOVE A0,*A8(OYVEL),L
SLEEPK 10
MOVI -1000H,A0 ;12
MOVE A0,*A8(OYVEL),L
SLEEPK 3
MOVI 5000H,A0 ;12
MOVE A0,*A8(OYVEL),L
SLEEPK 15
MOVI 0F000H,A0 ;12
MOVE A0,*A8(OYVEL),L
SLEEPK 015H
MOVI 016000H,A0 ;12
MOVE A0,*A8(OYVEL),L
SLEEPK 0CH
MOVI 01C000H,A0 ;12
MOVE A0,*A8(OYVEL),L
DIE
DOYV MOVI -8000H,A0 ;FROM RIGHT OF SCRN DOWN
MOVE A0,*A8(OYVEL),L
SLEEPK 15
MOVI -4000H,A0
MOVE A0,*A8(OYVEL),L
SLEEPK 15
MOVI 3000H,A0
MOVE A0,*A8(OYVEL),L
SLEEPK 15
MOVI 0C000H,A0
MOVE A0,*A8(OYVEL),L
SLEEPK 15
MOVI 15000H,A0
MOVE A0,*A8(OYVEL),L
DIE
DOYVP MOVI 0FFFE7000H,A0 ;FOR HULK JUMPING UP AND OUT OF PIT
MOVE A0,*A8(OYVEL),L
SLEEPK 18
MOVI 159,A0
MOVE A0,*A8(OZPOS)
SLEEPK 7
MOVI 0FFFF6000H,A0
MOVE A0,*A8(OYVEL),L
SLEEPK 15
MOVI 08000H,A0
MOVE A0,*A8(OYVEL),L
SLEEPK 7
MOVI 0F000H,A0
MOVE A0,*A8(OYVEL),L
SLEEPK 7
MOVI 15000H,A0
MOVE A0,*A8(OYVEL),L
DIE
LHLPS
MOVI HELP,A0
CALLA ONESND
SLEEP 40
MOVI HELP,A0
CALLA ONESND
SLEEP 40
MOVI HELP,A0
CALLA ONESND
SLEEP 40
MOVI HELP,A0
CALLA ONESND
DIE
PHASE1
CLR A1
MOVE A1,*A8(OXVEL),L
MOVE A1,*A8(OYVEL),L
DEC A9
SLL 5,A9
ADDI PLYROBJS,A9
MOVE *A9,A0,L
MOVE *A0(OYPOS),A2 ;A2=Y OF PLYR I HIT
MOVE *A0(OXPOS),A1 ;A1=X
MOVE *A8(OYPOS),A3 ;A3=THIS HULKS' Y
MOVE *A8(OXPOS),A4 ;A4=THIS HULKS' X
CMP A3,A2
RETS
SPAWN_MISL
;SPAWN MISL
MOVI EXCUSE,A0
CALLA ONESND
CREATE BOSSPID,SPM
RETS
SPM SLEEP 50
CALLA FIXEDA
CMPI 5,A10
JRNZ SPFZ
ADDI [-25,42],A9
;A8=CHOSEN RECTANGLE INFO
;A9=[Y,X] OF SPOT TO START FROM
;A10=DIRECTION
SPFZ
MOVI MISL,A2
CALLA GET_WVADDR
MOVE *A0(16),A1,W ;DEC WAVE RAM CNT FOR THIS MISL GROUP
DEC A1
MOVE A1,*A0(16),W
MOVI msllnchsnd,A0
CALLA ONESND
CLR A8
movx a9,a8
SRL 16,a9
MOVI 300,A11
SLL 3,A10
ADDI DTBL,A10
MOVB *A10,A10
;A8=X, A9=Y, A10=Dir, A11=Fuel
JAUC missile_firexy ;START ONE MISL
********************************
* Launch slow tough missile against good player (Process)
* A9=*Plyr leg obj
.DEF SPAWN_MISL_GOOD
SPAWN_MISL_GOOD
movi 60*4,a0
calla RNDRNG0
addk 30,a0
calla PRCSLP ;Sleep random
MOVI EXCUSE,A0
CALLA ONESND
SLEEP 60
MOVI msllnchsnd,A0
CALLA ONESND
MOVE A9,A7 ;*Plyr
MOVE @WORLDTLX+16,A8 ;X
MOVE @WORLDTLY+16,A9 ;Y
addi 200,a8
addi 260,a9
clr a10 ;Dir
movi 500,a11 ;Fuel
jauc missile_firexy_slow
;msllnchsnd .word >f290,10,>812C,0 ;Missile launch
;msllnchsnd .word >f290,10,>80b6,0 ;Missile launch
msllnchsnd .word >f290,10,>80b9,0 ;Missile launch
EXCUSE .word >f9F0,10,>814F,0 ;EXCUSE ME
DTBL .BYTE 0,0,0,8,0,16,0,24,0
.EVEN
KILL_LY
;A8=MINE LAYER IMAGE TO SMART BOMB
;A9=P1DATA OR P2DATA FOR SCORE UPDATE
;SMART BOMB ENTRY
;ENTER HERE WITH SMART BOMB
CREATE0 HSMRT
MOVI CLSDEAD,A0
MOVE A0,*A8(OID)
MOVE *A8(OPLINK),A0,L
MOVI NBLOWME2,A7
CLR A1
CALLA XFERPROC
CLR A0
MOVE A0,*A8(OXVEL),L
MOVE A0,*A8(OYVEL),L
RETS
HSMRT
MOVE A9,A2
;A2=P1DATA OR P2DATA
MOVI HLKPT,A1 ;AMOUNT OF SCORE FOR MINE LAYER!
CALLA SCRADD2 ;DO IT!
MOVE *A8(OYPOS),A2
ADDK 20,A2 ;A2=Y OFFSET
MOVE A2,*A8(OYPOS)
MOVI 300,A0 ;200
MOVE A0,*A8(OZPOS)
MOVI XBOOM2,A9 ;BOOM3 CHANGES PALETTE TO EXPLOSION!
jauc FRQDELDIE
XBOOM2
.LONG XPLD1
.WORD NEWPALET|4
.LONG GRNBOOM
.LONG XPLD2
.WORD 4
.LONG XPLD3
.WORD 4
.LONG XPLD4
.WORD 4
.LONG XPLD5
.WORD 4
.LONG XPLD6
.WORD 4
.LONG XPLD7
.WORD 6
.LONG XPLD8
.WORD 6
.LONG XPLD9
.WORD 6
.LONG XPLD10
.WORD 6
.LONG 0
FLAME_LAY
;MINE LAYER HIT BY BULLET
MMTM SP,A1,A2,A3,A7,A9,A10
PUSH A0
MOVI HITLAY,A3
CALLA DO_PUNISH
PULL A0
JRLT PFT
;KILL MINE LAYER!
;TURN OFF COLLISIONS FOR THIS MINE LAYER
;XFERPROC THIS MINE LAYER TO CODE WHICH TURNS ON SOME FLAMES
;THAT CODE WILL LET IT FLAME FOR AWHILE THEN PUT A FEW EXPLOSIONS
;ON TOP OF IT AND KILL EVERYTHING
;THAT CODE WILL ALSO EXPLODE ALL LAND MINES THIS MINE LAYER HAS LAYED DOWN
;A8=MINE LAYER
;
MOVE *A0(OPLINK),A0,L ;PLAYER PROCESS
MOVI LAYPT,A1
CALLA SCORE_IT ;SCORES SAME AS FIEND
MOVE *A8(OFLAGS),A4
ORI M_NOCOLL,A4 ;NO COLLISIONS
MOVE A4,*A8(OFLAGS)
MOVE *A8(OPLINK),A0,L
MOVI LAY_EXP,A7
CLR A1
CALLA XFERPROC
MMFM SP,A1,A2,A3,A7,A9,A10
RETS
PFT
;FLASH THIS MINE LAYER
MOVI 03F3F0000H,A9
CREATE0 FLASHME
MMFM SP,A1,A2,A3,A7,A9,A10
RETS
YKIL_RNG
;A8=MINE LAYER IMG PNTR
MMTM SP,A1,A2,A7
MOVE *A0(OPLINK),A0,L
MOVI P1DATA,A2
MOVE *A0(PNUM),A0
CMPI 1,A0
JREQ J5
MOVI P2DATA,A2
;A2=P1DATA OR P2DATA
J5 MOVI LAYPT,A1 ;AMOUNT OF SCORE
CALLA SCRADD2
JRUC CONT
YKIL_LAY
;KILL MINE LAYER BECAUSE OF COLLISION WITH RING OR TIME BOMB
;EXTER HERE FROM COLLISION ROUTINE - RINGS KILL MINE LAYER
;A8=MINE LAYER IMG PNTR
MMTM SP,A1,A2,A7
MOVE *A0(OPLINK),A0,L
MOVI LAYPT,A1
CALLA SCORE_IT
CONT
MOVE *A8(OFLAGS),A0
ORI M_NOCOLL,A0
MOVE A0,*A8(OFLAGS)
MOVE *A8(OPLINK),A0,L
MOVI LAY_EXP,A7 ;END OF MINE LAYER DEATH - NO FLAMES
CLR A1
CALLA XFERPROC
MMFM SP,A1,A2,A7
RETS
;
SPAWN_LYR:
;SPAWN TANK IS CALLED FROM 'WAVE OVERLORD' CODE WHICH DISPERSES
;BAD GUYS THROUGHOUT A WAVE
MOVE @HALT,A0
JRNZ TANK_OUT
MOVE @LYR_CNT,A2 ;MOVE BYTE (# TANKS ON SCRN) TO A2
MOVE @MAXLYR,A3
CMP A3,A2 ;TANKS MAXED OUT?
JRGE TANK_OUT ;
CREATE LAYPID,ATNK ;START ONE MINE LAYER
TANK_OUT:
RETS
LOCK LOCKUP
CLRTNK
MOVE A0,*A13(MRAM),L ;CALL FREEOBJ LATER
MOVE A0,*A13(KPMRAM),L
CLR A0
MOVE A0,*A13(MYPLYR) ;FOR WHEN LAYER KILLS GRUNTS!
MOVE A0,*A13(SPDY)
MOVE A0,*A13(TOTMN)
MOVE A0,*A13(ABSRB)
MOVE A0,*A13(CFLAGS)
MOVE A0,*A13(SK_DIR)
MOVK 25,A0
MOVE A0,*A13(CNTR)
MOVE A0,*A13(LAYTMR)
RETS
STRT_ALAY ;A8=*MINE LAYER
MOVI CLSDEAD,A0
MOVE A0,*A8(OID)
; movi LAYPID,a0
; move a0,*a13(PROCID)
move a13,*a8(OPLINK),L
MOVI 2*60,B0 ;3
MOVI 18*60,B1 ;12
CALLA RANGRAND
CALLA PRCSLP
CALLA GETOBJ
JRZ LOCK ;NO FREE OBJECT SPACE
CALLR CLRTNK
;A9=[Y,X] OF SPOT TO START FROM
;A10=DIRECTION
;8 1 2
;7 3
;6 5 4
MOVE *A8(OXPOS),A9
SUBK 15,A9
MOVE *A8(OYVAL),A1,L
MOVY A1,A9
MOVE *A8(OIMG),A0,L
MOVE *A0(32),A0,L ;DATA ADDR
MOVI MTNK6,A1
MOVE *A1(64),A1,L ;DATA ADDR
CMP A0,A1
JRZ SG1
MOVI MTNK9,A1
JRUC SG2
SG1
;LEFT/RGT GUN PIT
;TURN ON GUNNER DUDE
MOVI MTNK6,A1
SG2 MOVE A1,*A8(OIMG),L
MOVK 5,A10
MOVE *A8(OIMG),A0,L
CMPI MTNK9,A0
JRNZ JIN
MOVK 7,A10
MOVE *A8(OFLAGS),A0
BTST B_FLIPH,A0
JRZ JIN
MOVK 3,A10
JIN MOVK 2,A1
MOVE A1,*A13(LEVEL),W
CALLA DELOBJA8
CALLR JINHR ;TURN ON IMG, SET LOCATION, DIRECTION
MOVE @LYR_CNT,A0
INC A0
MOVE A0,@LYR_CNT
JRUC ATNK2
ATNK:
;YES A NEW MINE LAYER WILL APPEAR
;UPDATE WAVE_INFO RAM TABLE TO REFLECT THIS NEW ENTRY!
;THIS TANK WAS SPAWNED FROM 'WAVE OVERLORD' CODE
CALLA GETOBJ
JRZ LOCK ;NO FREE OBJECT SPACE
CALLR CLRTNK
CALLR INIT_TNK ;TURN ON IMG, SET LOCATION, DIRECTION
CALLR SETUP_TNK ;INC CNT, SET DIR, SET DEATH FLAG, ETC
ATNK2 MOVI 500,A0
CALLA RANDPER
JRNC NORED
;RED MINE LAYER
MOVK 4,A0
MOVE A0,*A13(LAYTMR)
MOVI MTNKP2,A0 ;GRNTB,A0 ;GRNTP ;ALWAYS SOLDIER
CALLA GETFPAL ;GET A COLOR MAP ASSIGNMENT
MOVE A0,*A8(OPAL),W ;STORE THE NEW PALETTE
MOVI HSPEED2,A1 ;TANK SPEED
MOVE A0,*A13(SPDY)
JRUC ARED
NORED MOVI HSPEED,A1 ;TANK SPEED
ARED CALLA DO_DIFF2
CLR A0
move A0,*a8(OCONST)
MOVE *A13(DIR),A0
CALLA INTO12
CALLR GET_RUN ;GET FIRST FRANIM PNTR FOR
;THIS TANKS DIRECTION
;SELECT A RANDOM PATTERN FOR MINE LAYER ENTERING FROM THIS DIRECTION
MOVE *A13(DIR),A0
SLL 5,A0
ADDI PATLST,A0
MOVE *A0,A0,L
MOVE @PTMP,A1
INC A1
MOVE A1,@PTMP
ANDI 03H,A1
SLL 5,A1
ADD A1,A0
MOVE *A0,A0,L
MOVE *A0+,A1,W ;GET FIRST DISTANCE CNT
MOVE *A13(SPDY),A3
JRZ NOSPD0
;SPEEDY MINE LAYER
SRL 1,A1
NOSPD0
MOVE A0,*A13(MYPATRN),L
MOVE A1,*A13(DIS)
;
; LOOP TOP FOR TANKS
;
MOVE A13,A10
CREATE0 ANTENNA
MOVE A0,*A13(MYANT),L ;KEEP FOR WHEN MINE LAYER DIES
; MOVI MECH1,A0 ;MECHANICAL ARRIVAL SND
; CALLA ONESND
;BEEP BEEP HORN SND
LUP_TP:
;TOP OF TANK LOGIC
MOVE @HALT,A0
JRZ TMV
SLEEPK 1
JRUC LUP_TP
TMV
MOVE *A13(CNTR),A3
ANDI 07H,A3
DEC A3
JRNZ TMV3
;SWAP THIS MINE LAYER OID BETWEEN PLAYER/HELPER AND MINE LAYER
MOVK 1,A3
MOVI CLSPLYR|TYPHLPR|SUBLAY,A1
MOVE *A8(OID),A0
ANDI 0FFFFH,A0
CMPI CLSENMY|TYPLAYR,A0
JRZ TMV2
MOVK 3,A3
MOVI CLSENMY|TYPLAYR,A1
TMV2 MOVE A1,*A8(OID)
TMV3
MOVE A3,*A13(CNTR)
MOVE *A13(CFLAGS),A0
BTST 0,A0
JRZ NOSPN
;THIS TANK IS SPINNING, DO SPIN
MOVE *A13(SK_DIR),A1
MOVE *A13(DIR),A0,W
CALLR WAY
JRC DIT ;INC
;DEC=CLRC
CLR A1 ;MOVI 0,A1
MOVE A1,*A13(WAY01)
JRUC DIT0
DIT MOVK 1,A1
MOVE A1,*A13(WAY01)
DIT0
MOVE A0,*A13(DIR),W
CALLR GET_STAND ;DOES ANI OF CORRECT VIEW
MOVE *A13(SK_DIR),A1
MOVE *A13(DIR),A0,W
CMP A0,A1
JREQ GOODNEWS
;ANI IN NEW STAND/SPIN DIR
SLEEPK 4
JRUC LUP_TP
GOODNEWS:
SLEEPK 20
CALLR GET_RUN ;ZEROS STAND FLAG ALSO
MOVE *A13(DIR),A0
CALLA INTO12 ;GET PROPER VELOCITY FOR THIS DIR
SLEEPK 1
JRUC LUP_TP
NOSPN: MOVE *A13(DIS),A0 ;UPDATE DISTANCE COUNT
DEC A0
MOVE A0,*A13(DIS) ;STUFF NEW COUNT
JRNZ DOTNK ;BR=CONTINUE CURRENT DIRECTION
;TIME TO GET NEW DISTANCE AND NEW DIRECTION
MOVE *A13(MYPATRN),A10,L
MOVE *A10+,A11,W ;GET NEW DIRECTION
JRZ PATDN ;BR=PATTERN FINISHED
CLR A0
MOVE A0,*A8(OXVEL),L
MOVE A0,*A8(OYVEL),L
SLEEPK 20
MOVE *A10+,A2,W ;GET NEW DIS
MOVE *A13(SPDY),A3
JRZ NOSPD
;SPEEDY MINE LAYER
SRL 1,A2
NOSPD MOVE A2,*A13(DIS) ;STUFF NEW COUNT
MOVE A10,*A13(MYPATRN),L
MOVE A11,*A13(SK_DIR)
;TANK WILL SEEK TO A 45 DEGREE ANGLE (1,4,7,10)
MOVK 1,A0 ;TANK WILL SPIN TO SK_DIR
MOVE A0,*A13(CFLAGS) ;I WILL SPIN!
MOR SLEEPK 1
JRUC LUP_TP
PATDN
;PATTERN FINISHED
;DELETE ANTENNA, MINE LAYER
;DIE
CALLA SCRTST
JRNZ NBLOWME
;I AM STILL ON SCRN! CONTINUE IN THIS DIRECTION
MOVK 20,A0
MOVE A0,*A13(DIS)
JRUC MOR
NBLOWME
;I AM OFF SCRN
CALLA DELOBJA8
NBLOWME2 ;ENTRY FOR SMART BOMB
MOVE *A13(MYANT),A0,L
CALLA KILL
MOVE *A13(KPANTOBJ),A0,L
CALLA DELOBJ
MOVE @LYR_CNT,A0
DEC A0
MOVE A0,@LYR_CNT
MOVE *A13(KPMRAM),A10,L
MOVE *A13(TOTMN),A0 ;FLAG FOR I HAVE ALREADY
JRNN EXPEM ;KILLED MY LAND MINES
EXP_2_MANY
DIE
EXPEM
MOVK 12,A11
MOVE A10,A9
ND0 DEC A11
JRZ EXP_2_MANY
MOVE *A9+,A0,L
JRZ NDN
CALLA ISOBJ
JRZ ND0
MOVE *A0(OIMG),A1,L
CMPI M1,A1 ;LAND MINE
JRNZ ND0
MOVI DMAWNZ|M_NOCOLL,A1 ;LAND MINE NO COLLIDE ON
MOVE A1,*A0(OFLAGS)
MOVE A0,A8
MOVI MTING,A0 ;LAND MINE EXPLOSION SND
CALLA ONESND
CREATE0 KMINE
SLEEPK 6
JRUC ND0
NDN MOVE A10,A0 ;MOVE *A13(KPMRAM),A0,L
CALLA FREEOBJ
DIE
KMINE
MOVE A8,A10
CREATE0 KM2
CREATE0 KM2
CREATE0 KM2
SLEEPK 4 ;KILL ORIGINAL LAND MINE
move a10,a8
jauc DELOBJDIE
KM2
MOVI -08000H,B0
MOVI 08000H,B1
CALLA RANGRAND
MOVE A0,A6
MOVI -08000H,B0
MOVI 08000H,B1
CALLA RANGRAND
MOVE A0,A7
MOVI FIREEXP,A9
MOVE *A8(OXVAL),A0,L
MOVE *A8(OYVAL),A1,L
ADDI [5,0],A0
ADDI [5,0],A1
MOVI 292,A3 ;241 ;282
MOVI DMAWNZ|M_NOCOLL,A4 ;NON-ZERO VALUE
MOVI CLSNEUT|TYPNEUT,A5
MOVI CLD1,A2
CALLA BEGINOBJ2
;CREATE EXPLOSION, AND THEN DIE
jauc FRQDELDIE