forked from originalgrego/FinalFightAE-Source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ffight_ae_ai_targeting_hijacks.asm
1650 lines (1208 loc) · 37.4 KB
/
ffight_ae_ai_targeting_hijacks.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
;================================================
hijack_ai_targeting:
move.w #$7FFF, ($7FF8, A5)
move.w #$FFFF, ($7FFA, A5)
lea (p1_main_mem,A5), A0
jsr $0280d6
move.w D0, D2
bmi check_p2_ai_target
move.w ($7FF8, A5), D0
cmp.w D0, D2
bmi continue_p1_ai_target
bra check_p2_ai_target
continue_p1_ai_target:
move.w D2, ($7FF8, A5)
move.w #$0000, ($7FFA, A5)
check_p2_ai_target:
lea (p2_main_mem,A5), A0
jsr $0280d6
move.w D0, D2
bmi check_p3_ai_target
move.w ($7FF8, A5), D0
cmp.w D0, D2
bmi continue_p2_ai_target
bra check_p3_ai_target
continue_p2_ai_target:
move.w D2, ($7FF8, A5)
move.w #$0001, ($7FFA, A5)
check_p3_ai_target:
lea (p3_main_mem,A5), A0
jsr $0280d6
move.w D0, D2
bmi finish_ai_target
move.w ($7FF8, A5), D0
cmp.w D0, D2
bmi continue_p3_ai_target
bra finish_ai_target
continue_p3_ai_target:
move.w D2, ($7FF8, A5)
move.w #$0002, ($7FFA, A5)
finish_ai_target:
move.w ($7FFA, A5), D2
bmi all_players_invalid
beq ai_target_player_1
cmp.w #$0001, D2
beq ai_target_player_2
jmp ai_target_player_3
ai_target_player_2:
jmp $0280CC
ai_target_player_1:
jmp $0280C2
all_players_invalid:
jmp $0280BC
;================================================
;================================================
hijack_minor_enemy_targeting:
lea (p2_main_mem,A5), A0
moveq #$2, D1
jsr $27ae6
bne hijack_minor_enemy_targeting_success
lea (p3_main_mem,A5), A0
moveq #$4, D1
jsr $27ae6
bne hijack_minor_enemy_targeting_success
jmp $027AD2
hijack_minor_enemy_targeting_success:
jmp $027AD6
;================================================
;================================================
hijack_shuffle_check_active_player:
move.b (p1_main_mem,A5), D0 ; Active
or.b (p2_main_mem,A5), D0 ; Active
or.b (p3_main_mem,A5), D0 ; Active
beq hijack_shuffle_check_active_player_fail
jmp $027C00
hijack_shuffle_check_active_player_fail:
jmp $027c68
;================================================
;================================================
hijack_shuffle_check_player_8E:
move.b ($5f6,A5), D0 ; $8E
or.b ($6b6,A5), D0 ; $8E
or.b ($6776,A5), D0 ; $8E
bne hijack_shuffle_check_player_8E_success
jmp $027C0E
hijack_shuffle_check_player_8E_success:
jmp $027c64
;================================================
;================================================
hijack_shuffle_try_next_player:
cmpa.w (p1_main_mem, A5), A4 ; Compare to currently targeted player
beq hijack_shuffle_try_next_player_p2
cmpa.w (p2_main_mem, A5), A4 ; Compare to currently targeted player
beq hijack_shuffle_try_next_player_p3
jmp $027C2A ; Player 1
hijack_shuffle_try_next_player_p2:
jmp $027c30
hijack_shuffle_try_next_player_p3:
lea (p3_main_mem, A5), A0
jmp $027C34
;================================================
;================================================
hijack_boss_ai_targeting:
moveq #$1, D3
lea (p2_main_mem,A5), A0
tst.b ($0,A0)
beq check_p3_boss_ai
jsr $040a7c
bne exit_boss_ai
check_p3_boss_ai:
moveq #$2, D3
lea (p3_main_mem,A5), A0
tst.b ($0,A0)
beq bad_p3_target
jmp $040a7c
bad_p3_target:
moveq #$0, D0
exit_boss_ai:
rts
;================================================
;================================================
hijack_andore_switch_player:
movea.l ($80,A6), A1
cmp.b #$1, ($13,A1) ; Check player 2 previously targeted
beq andore_switch_player_try_p3 ; If it was player 2 try player 3
movea.l ($80,A6), A1
cmp.b #$2, ($13,A1) ; Check player 3 previously targeted
beq andore_switch_player_try_p1 ; If it was player 3 try player 1
bra andore_switch_player_try_p2
andore_switch_player_try_p1:
lea (p1_main_mem,A5), A0
moveq #$0, D3
bra andore_switch_player_try_player
andore_switch_player_try_p2:
lea (p2_main_mem,A5), A0
moveq #$1, D3
bra andore_switch_player_try_player
andore_switch_player_try_p3:
lea (p3_main_mem,A5), A0
moveq #$2, D3
andore_switch_player_try_player:
jsr $02E630
beq andore_switch_player_exit ; we done, bad target
jsr $02E610 ; Target considered player
andore_switch_player_exit:
rts
;================================================
;================================================
andore_prox_damage_check:
lea (p1_main_mem,A5), A3
jsr $02de1c
lea (p2_main_mem,A5), A3
jsr $02de1c
lea (p3_main_mem,A5), A3
jsr $02de1c
rts
;================================================
;================================================
hijack_andore_prox_check_other:
bsr andore_prox_damage_check
jmp $02D134
;================================================
;================================================
hijack_andore_butt_slam_prox
bsr andore_prox_damage_check
jmp $02DE0E
;================================================
;================================================
hijack_andore_proximity_results:
jsr $02E630
bsr invert_d0_result
rts
hijack_andore_targeting:
move.l A3, -(A7)
movea.l #hijack_andore_proximity_results, A3
bsr boss_ai_targeting_proximity_start
movea.l (A7)+, A3
bsr invert_d0_result
cmp.b ($88,A6), D3
beq exit_andore_targeting ; Was already targeted
tst.b D0
beq exit_andore_targeting
jsr $02E610
exit_andore_targeting:
rts
;================================================
;================================================
invert_d0_result:
eor.b #$01, D0
rts
;================================================
;================================================
hijack_sodom_initialize:
bsr boss_health_init_common
jmp $040C74
;================================================
;================================================
hijack_sodom_targeting_1:
move.l A3, -(A7)
movea.l #$0004277E, A3
bsr boss_ai_targeting_proximity_start
movea.l (A7)+, A3
rts
hijack_sodom_targeting_2:
move.l A3, -(A7)
movea.l #$000427F8, A3
bsr boss_ai_targeting_proximity_start
movea.l (A7)+, A3
rts
;================================================
;================================================
hijack_major_enemy_hit_tageting:
move.l A3, -(A7)
move.l D2, -(A7)
movea.l #major_enemy_hit_targeting_proximity_calc, A3
bsr boss_ai_targeting_proximity_start
tst.b D0
beq hijack_major_enemy_hit_tageting_finish
lea (p1_main_mem, A5), A0
moveq #$0, D3
hijack_major_enemy_hit_tageting_finish:
move.l (A7)+, D2
movea.l (A7)+, A3
rts
;================================================
;================================================
major_enemy_hit_targeting_proximity_calc:
tst.b (A0)
bne major_enemy_hit_targeting_proximity_calc_continue
move.w #$7FFF, D1
moveq #$1, D0
rts
major_enemy_hit_targeting_proximity_calc_continue:
move.w ($6,A0), D1
sub.w ($6,A6), D1
bpl major_enemy_hit_targeting_proximity_calc_exit
neg.w D1
major_enemy_hit_targeting_proximity_calc_exit:
moveq #$0, D0
rts
;================================================
;================================================
hijack_damnd_targeting_2:
move.l A3, -(A7)
movea.l #$00040718, A3
bsr boss_ai_targeting_proximity_start
movea.l (A7)+, A3
rts
hijack_damnd_targeting_3:
move.l A3, -(A7)
movea.l #$00040792, A3
bsr boss_ai_targeting_proximity_start
movea.l (A7)+, A3
rts
;================================================
;================================================
; G Oriber
hijack_g_oriber_targeting:
move.l A3, -(A7)
move.l D3, -(A7)
movea.l #$00032C00, A3
bsr boss_ai_targeting_proximity_start
move.l (A7)+, D3
movea.l (A7)+, A3
tst.b D0
rts
;------------------------------------------------
hijack_g_oriber_targeting_2:
move.l A3, -(A7)
move.l D3, -(A7)
movea.l #$00032C76, A3
bsr boss_ai_targeting_proximity_start
move.l (A7)+, D3
movea.l (A7)+, A3
tst.b D0
rts
;================================================
;================================================
hijack_andore_boss_proximity:
; Whichever player is the leader of the outro demo will become Boss Andore's target.
; $91 is the leader byte. 00 = leader, !0 = follower
; A0 is set as target player address to Boss Andore's RAM upon return.
lea (p1_main_mem,A5), A0
tst.b (A0)
beq hijack_andore_boss_proximity_2p
tst.b ($91,A0)
beq hijack_andore_boss_proximity_return
hijack_andore_boss_proximity_2p:
lea (p2_main_mem,A5), A0
tst.b (A0)
beq hijack_andore_boss_proximity_3p
tst.b ($91,A0)
beq hijack_andore_boss_proximity_return
hijack_andore_boss_proximity_3p:
lea (p3_main_mem,A5), A0
hijack_andore_boss_proximity_return:
rts
;================================================
;================================================
boss_ai_targeting_proximity_start:
move.w #$7FFF, ($7FF8, A5)
move.w #$FFFF, ($7FFA, A5)
lea (p1_main_mem,A5), A0
jsr (A3)
bne boss_ai_targeting_proximity_check_p2
move D1, D2
move.w ($7FF8, A5), D0
cmp.w D0, D2
bmi boss_ai_targeting_proximity_continue_p1
bra boss_ai_targeting_proximity_check_p2
boss_ai_targeting_proximity_continue_p1:
move.w D2, ($7FF8, A5)
move.w #$0000, ($7FFA, A5)
boss_ai_targeting_proximity_check_p2:
lea (p2_main_mem,A5), A0
jsr (A3)
bne boss_ai_targeting_proximity_check_p3
move D1, D2
move.w ($7FF8, A5), D0
cmp.w D0, D2
bmi boss_ai_targeting_proximity_continue_p2
bra boss_ai_targeting_proximity_check_p3
boss_ai_targeting_proximity_continue_p2:
move.w D2, ($7FF8, A5)
move.w #$0001, ($7FFA, A5)
boss_ai_targeting_proximity_check_p3:
lea (p3_main_mem,A5), A0
jsr (A3)
bne boss_ai_targeting_proximity_finish
move D1, D2
move.w ($7FF8, A5), D0
cmp.w D0, D2
bmi boss_ai_targeting_proximity_continue_p3
bra boss_ai_targeting_proximity_finish
boss_ai_targeting_proximity_continue_p3:
move.w D2, ($7FF8, A5)
move.w #$0003, ($7FFA, A5)
boss_ai_targeting_proximity_finish:
move.w ($7FFA, A5), D2
bmi boss_ai_targeting_proximity_invalid
beq boss_ai_targeting_proximity_select_p1
cmp.w #$0001, D2
beq boss_ai_targeting_proximity_select_p2
jmp boss_ai_targeting_proximity_select_p3
boss_ai_targeting_proximity_select_p1:
lea (p1_main_mem,A5), A0
moveq #$0, D3
moveq #$0, D0
rts
boss_ai_targeting_proximity_select_p2:
lea (p2_main_mem,A5), A0
moveq #$1, D3
moveq #$0, D0
rts
boss_ai_targeting_proximity_select_p3:
lea (p3_main_mem,A5), A0
moveq #$2, D3
moveq #$0, D0
rts
boss_ai_targeting_proximity_invalid:
move.b #$1, D0
rts
;================================================
;================================================
boss_health_init_common:
bsr get_player_count
cmpi.b #$1, D1
bne boss_health_init_check_2p
move.w #$12c, D1 ; 1 player health
rts
boss_health_init_check_2p:
cmpi.b #$2, D1
bne boss_health_init_3p
move.w #$1c2, D1 ; 2 Player health
rts
boss_health_init_3p:
move.w #$258, D1 ; 3 Player health
rts
;================================================
;================================================
hijack_damnd_initialize:
bsr boss_health_init_common
move.b ($546a,A5), D0 ; Load main player status
jmp $03D41C
;================================================
;================================================
hijack_damnd_choose_initial_player:
bsr get_player_count
tst.b D1
beq damnd_choose_initial_player_none_active
bsr boss_choose_random_player
jmp $03D51A
damnd_choose_initial_player_none_active:
jmp $03D4EC
;================================================
;================================================
choose_random_player:
move.b ($546a,A5), D0
choose_random_player_D0:
bsr get_player_count_D0
tst.b D1
beq choose_random_player_none_active
cmpi.b #$1, D1
bne choose_random_player_check_two
bra get_active_player_D0
choose_random_player_check_two:
cmpi.b #$2, D1
bne choose_random_player_three_active
bra get_random_player_two_active_D0
choose_random_player_three_active:
bra get_random_player_three_active
choose_random_player_none_active:
bra return_player_1
;================================================
;================================================
boss_choose_random_player:
bsr choose_random_player
move.b D0, D3
rts
;================================================
;================================================
hijack_damnd_player_status_jmp:
jsr $03D5FC
jmp $03D5A2
;================================================
;================================================
get_random_player_two_active:
move.b ($546a,A5), D0
get_random_player_two_active_D0:
btst #$0, D0
beq get_random_player_two_active_p2_p3
btst #$1, D0
beq get_random_player_two_active_p1_p3
bsr coin_flip
beq return_player_1
bra return_player_2
get_random_player_two_active_p2_p3:
bsr coin_flip
beq return_player_2
bra return_player_3
get_random_player_two_active_p1_p3:
bsr coin_flip
beq return_player_1
bra return_player_3
;================================================
;================================================
coin_flip:
jsr $3bec.w ; Random!?
andi.w #$f, D0 ; Random value clamped to 0 - f
move.w #$aaaa, D1 ; This is odd, but the lowest nibble is all that matters, choose half the bits, #$a
btst D0, D1 ; Check if bit 1 or 3 are set on the lowest nibble
rts
;================================================
;================================================
get_random_player_three_active:
jsr $3bec.w ; Random
andi.w #$ff, D0 ; Random value clamped to 00 - ff
cmpi.b #$55, D0
bpl get_random_player_three_active_check_p2
bra return_player_1
get_random_player_three_active_check_p2:
cmpi.b #$AA, D0
bpl get_random_player_three_active_p3
bra return_player_2
get_random_player_three_active_p3:
bra return_player_3
;================================================
;================================================
return_player_1:
moveq #$0, D0
lea (p1_main_mem, A5), A0
rts
return_player_2:
moveq #$1, D0
lea (p2_main_mem,A5), A0
rts
return_player_3:
moveq #$2, D0
lea (p3_main_mem,A5), A0
rts
;================================================
;================================================
get_active_player:
move.b ($546a,A5), D0
get_active_player_D0:
btst #$0, D0
beq get_active_player_check_p2
bra return_player_1
get_active_player_check_p2:
btst #$1, D0
beq get_active_player_p3
bra return_player_2
get_active_player_p3:
bra return_player_3
;================================================
;================================================
get_player_count:
move.b ($546a,A5), D0
get_player_count_D0:
moveq #$0, D1
btst #$0, D0
beq check_count_p2
addq #$1, D1
check_count_p2:
btst #$1, D0
beq check_count_p3
addq #$1, D1
check_count_p3:
btst #$2, D0
beq get_player_count_exit
addq #$1, D1
get_player_count_exit:
rts
;================================================
;================================================
hijack_minor_enemy_group_targeting_check_common:
beq hijack_minor_enemy_group_targeting_fail_exit
cmp.b #$1, D0
bne hjack_minor_enemy_group_targeting_check_p2
move.l #$00FF115C, D0
rts
hjack_minor_enemy_group_targeting_check_p2:
cmp.b #$2, D0
bne hjack_minor_enemy_group_targeting_p3
move.l #$00FF1164, D0
rts
hjack_minor_enemy_group_targeting_p3:
move.l #$00FFF900, D0
rts
hijack_minor_enemy_group_targeting_fail_exit:
moveq #$0, D0
rts
;================================================
;================================================
hijack_minor_enemy_group_targeting_check:
bsr hijack_minor_enemy_group_targeting_check_common
bne hijack_minor_enemy_group_targeting_exit
jmp $27EA2
hijack_minor_enemy_group_targeting_exit:
jmp $027E52
;================================================
;================================================
hijack_minor_enemy_group_targeting_check_2:
bsr hijack_minor_enemy_group_targeting_check_common
move.l D0, D1
bne hijack_minor_enemy_group_targeting_exit_2
jmp $27CDC
hijack_minor_enemy_group_targeting_exit_2:
jmp $027CD0
;================================================
;====================================================================
hijack_p2_generate_group_data:
tst.w (-$6eac,A5)
beq hijack_p2_generate_group_data_p3
lea (p2_main_mem,A5), A2
lea (-$6e9c,A5), A3 ; P2 level script data?
jsr $2800a
hijack_p2_generate_group_data_p3:
tst.b (p3_main_mem,A5)
bne hijack_p2_generate_group_data_p3_continue
move.w ($412,A5), D0 ; Level scroll x
addi.w #$140, D0
move.w D0, (p3_x_pos,A5)
move.w ($416,A5), D0 ; Level scroll y
addi.w #$30, D0
move.w D0, (p3_y_pos,A5)
move.w D0, (p3_y_pos_origin,A5)
hijack_p2_generate_group_data_p3_continue:
tst.w (-$6eac,A5)
beq hijack_p2_generate_group_data_exit
lea (p3_main_mem, A5), A2
lea (p3_enemy_grouping_data, A5), A3
jsr $2800a
hijack_p2_generate_group_data_exit:
rts
;====================================================================
;====================================================================
hijack_p2_init_group_data:
move.w D0, (-$6e9c,A5) ; p2 group data
move.w D0, (-$6e9a,A5)
move.w D0, (p3_enemy_grouping_data,A5)
jmp $003E04
;====================================================================
;================================================
hijack_edi_initialize:
bsr boss_health_init_common
move.w D1, D0
jmp $045F74
;================================================
;================================================
hijack_abigail_initialize:
bsr boss_health_init_common
move.w D1, D0
add.w #$C8, D0
jmp $04BE50
;================================================
;================================================
hijack_abigail_edi_targeting:
move.l A0, -(A7)
bsr get_player_count
tst.b D1
beq hijack_abigail_edi_targeting_exit
cmp.b #$1, D1
bne hijack_abigail_edi_targeting_more_than_two_active
bsr get_active_player
bsr hijack_abigail_edi_targeting_assign_player
bra hijack_abigail_edi_targeting_exit
hijack_abigail_edi_targeting_more_than_two_active:
subq.w #1, ($82,A6)
bne hijack_abigail_edi_targeting_do_position_check
move.w #$f0, ($82,A6)
bsr choose_random_player
bsr hijack_abigail_edi_targeting_assign_player
bra hijack_abigail_edi_targeting_exit
hijack_abigail_edi_targeting_do_position_check:
bsr abigail_edi_targeting_position_check
hijack_abigail_edi_targeting_exit:
movea.l (A7)+, A0
rts
hijack_abigail_edi_targeting_assign_player:
move.w ($6,A0), ($86,A6)
move.w ($E,A0), ($88,A6)
move.b D0, ($93,A6)
rts
;================================================
;================================================
abigail_edi_targeting_position_check_try_player:
tst.b (A0)
beq abigail_edi_targeting_position_check_try_player_exit_fail
move.w ($6,A0), D0
jsr $046ca4 ; Check x pos
beq abigail_edi_targeting_position_check_try_player_exit_fail
move.w ($e,A0), D0
jsr $046cba ; Check y origin
beq abigail_edi_targeting_position_check_try_player_exit_fail
moveq #$1, D0
rts
abigail_edi_targeting_position_check_try_player_exit_fail:
moveq #$0, D0
rts
;================================================
;================================================
abigail_edi_targeting_position_check:
clr.b ($84,A6)
bsr return_player_1
bsr abigail_edi_targeting_position_check_try_player
beq abigail_edi_targeting_position_check_p2
bset #$0, ($84,A6)
abigail_edi_targeting_position_check_p2:
bsr return_player_2
bsr abigail_edi_targeting_position_check_try_player
beq abigail_edi_targeting_position_check_p3
bset #$1, ($84,A6)
abigail_edi_targeting_position_check_p3:
bsr return_player_3
bsr abigail_edi_targeting_position_check_try_player
beq abigail_edi_targeting_position_check_continue
bset #$2, ($84,A6)
abigail_edi_targeting_position_check_continue:
move.b ($84,A6), D0
beq abigail_edi_targeting_position_check_exit
move.b #$b4, ($99,A6)
bsr choose_random_player_D0
bra hijack_abigail_edi_targeting_assign_player
abigail_edi_targeting_position_check_exit:
rts
;================================================
;================================================
hijack_abigail_edi_reassign_target
tst.b ($93,A6)
bne hijack_abigail_edi_reassign_target_check_p2
jmp $046C38
hijack_abigail_edi_reassign_target_check_p2:
cmp.b #$1, ($93,A6)
bne hijack_abigail_edi_reassign_target_p3
jmp $046C24
hijack_abigail_edi_reassign_target_p3
move.w ($66EE,A5), ($86,A6)
move.w ($66F6,A5), ($88,A6)
move.b #$2, ($93,A6) ; Assign player 3
rts
;================================================
;================================================
hijack_abigail_active_player_check:
bsr boss_active_player_check
beq hijack_abigail_active_player_check_exit
jmp $04c192
hijack_abigail_active_player_check_exit:
jmp $04C208
;================================================
;================================================
hijack_edi_active_player_check:
bsr boss_active_player_check
beq hijack_edi_active_player_check_exit
jmp $046250
hijack_edi_active_player_check_exit:
jmp $046296
;================================================
;================================================
boss_active_player_check:
tst.b ($93,A6) ; Check active player
beq boss_active_player_check_p1
cmp.b #$1, ($93,A6)
bne boss_active_player_check_p3
move.b (p2_main_mem,A5), D0
rts
boss_active_player_check_p3
move.b (p3_main_mem,A5), D0
rts
boss_active_player_check_p1:
move.b (p1_main_mem,A5), D0
rts
;================================================
;================================================
boss_check_active_player_89:
tst.b ($93,A6)
beq boss_check_active_player_89_p1
cmp.b #$1, ($93,A6)
bne boss_check_active_player_89_p3
move.b ($6b1,A5), D0 ; p2 $89
rts
boss_check_active_player_89_p3:
move.b ($6771,A5), D0 ; p3 $89
rts
boss_check_active_player_89_p1:
move.b ($5f1,A5), D0 ; p1 $89
rts
;================================================
;================================================
hijack_rolento_initialize:
jsr $04afd8 ; Even tho this initializes rolentos health table, it does other stuff, please don't delete