-
Notifications
You must be signed in to change notification settings - Fork 8
/
Bank19_20_on_field_gameplay_loop.asm
5837 lines (4782 loc) · 322 KB
/
Bank19_20_on_field_gameplay_loop.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
; Left endzone Front: high =0x06, low = 0x70
; Left endzone Back: high =0x06, low = 0x20
; Right endzone Front: high =0x09, low = 0x90
; Right endzone Back: high =0x09, low = 0xE0
;OUT OF BOUNDS TOP =0x28
;OUT OF BOUNDS BOTTOM = 0xC8
.BASE $8000
OFF_PLAY_PTR_START_ADDR = $A400
PLAY_LIST_START_ADDR = $B400
DEF_REACTION_START_ADDR = $BC00
; *** COULD BE RAPLACED WITH ACTUAL ADDRESS *****
; Main game loop bank BANK 17
;JUMP_PLAYER_INJURED = $8003
;JUMP_CHANGE_PLAYERS = $8009
;JUMP_UPDATE_LARGE_SCOREBOARD = $800F
; player commands bank BANK 21
JUMP_DO_NEXT_PLAYER_COMMAND = $8000
JUMP_WR_JUMP_DIVE_CHECK_PASS = $8006
JUMP_DEF_JUMP_DIVE_CHECK_PASS = $8009
PLAY_SELECT_START = $8800
; player commands bank BANK 23
JUMP_DRAW_GAMEFIELD = $8003
JUMP_START_BANNER_TASK = $9003
JUMP_START_COLL_CHECK_TASK = $9006
; player commands bank BANK 27
LOAD_ALL_SKILLS_ROUTINE = $8018
LOAD_SINGLE_PLAYER_SKILLS_ROUTINE = $801B
OFF_PLAYERS_CHEER_PLAY_PTRS[] = $AE00
INT_RETURN_DEFENSE_PLAY_PTRS[] = $AE18
OFF_RECOVER_ONSIDE_PLAY_PTRS[] = $AE30
OFF_RECOVER_BALL_PLAY_PTRS[] = $AE48
PUNT_COVERAGE_PLAY_PTRS[] = $AE60
OFF_ONSIDE_KICK_RET_PLAY_PTRS[] = $AE78
OFF_RECOVERS_OWN_FUM_PLAY_PTRS[] = $AEA8
OFF_DEFENDS_LOST_FUM_PLAY_PTRS[] = $AEC0
OFF_PLAYERS_CRY_PLAY_PTRS[] = $AF08
DEF_PLAYERS_CRY_PLAY_PTRS[] = $B600
INT_RETURN_PLAY_PTRS[] = $B618
DEF_RECOVER_ONSIDE_PLAY_PTRS[] = $B630
DEF_RECOVER_BALL_PLAY_PTRS[] = $B648
PUNT_RETURN_PLAY_PTRS[] = $B660
DEF_ONSIDE_KICK_RET_PLAY_PTRS[] = $B678
FUM_RET_DEF_PLAY_PTRS[] = $B6A8
DEF_RET_LOST_FUM_PLAY_PTRS[] = $B6C0
DEF_PLAYERS_CHEER_PLAY_PTRS[] = $B708
CHASE_BALL_CARRIER_PLAY_PTRS[] = $B750
; ****CAN GET RID OF JUMP TABLES******
BANK_JUMP_ON_FIELD_GAMEPLAY_START:
JMP ON_FIELD_GAMEPLAY_START ; JUMP ->START P1/P2 GAMEPLAY LOOP
BANK_JUMP_SKP_VS_SKP_INJURY_START:
JMP SKP_VS_SKP_INJURY_START ; JUMP ->SKP MODE INJURY ROUTINE
_F{_GAME_PLAY_START_CHECK_FOR_KICK_TEAM ; DONE
ON_FIELD_GAMEPLAY_START: ; START P1/P2 GAMEPLAY LOOP
LDX #GAMEPLAY_STACK_INDEX ; SET STACK LOCATION = ON FIELD LOOP STACK
TXS ;
LDX #HIGH_LEVEL_GAME_LOGIC_BANK_2 ; SET BANK = BANK 20
JSR SWAP_A000_BANK ; SWAP A000 BANK (X=BANK TO SWAP)
LDA #$00 ;
STA BALL_STATUS_SPECIAL ; CLEAR SPECIAL BALL STATUS
LDA BALL_STATUS ; DOES BALL STATUS = P2 KICKOFF
BEQ P2_KICKOFF_START ; YES-> PLAYER 2 KICKOFF START
JMP P1_KICKOFF_START ; NO-> PLAYER 1 KICKOFF START
_F}_GAME_PLAY_START_CHECK_FOR_KICK_TEAM
_F{_P2_KICKOFF ; DONE
P2_KICKOFF_START: ; PLAYER 2 KICKOFF START
INIT_POSSESSION_STATUS_P2_KICKOFF
BIT BALL_STATUS_SPECIAL ; DOES SPECIAL BALL STATUS= SAFETY?
BVS @set_p2_kickoff_location_safety ;
@set_p2_kickoff_location_regular: ; SET REGULAR KICKOFF LOCATION
SET_YARDLINE_X 65 ;
JMP @set_skills_scroll_fade_in_p2_kickoff
@set_p2_kickoff_location_safety: ; SET SAFETY KICKOFF LOCATION
SET_YARDLINE_X 80
@set_skills_scroll_fade_in_p2_kickoff: ; P2 SET P1/P2 KICKOFF FORMATIONS, PLAYER SKILLS, and SCROLL WINDOW VALUES
SAVE_LOS_X
JSR CLEAR_ALL_NAMETABLES ; CLEAR NAMETABLES()
JSR CHECK_FOR_QTR_OVER ; CHECK FOR QUARTER OVER, RESET BIT & SUSPEND SWITCH TASK IF OVER()
JSR SET_TO_1st_DOWN_CLEAR_RAM_VARS_SPRITES ; SET FIRST DOWN, CLEAR SPRITE DATA AND GRAPHICS, RESET PLAY VARS & ACTIVE PLAYER LOC/ICON()
LDA #$00 ;
STA P1_PLAY_CALL ; CLEAR PLAY CALL HOME
STA P2_PLAY_CALL ; CLEAR PLAY CALL AWAY
JSR GET_P2_CPU_KICKOFF_TYPE ; GET CPU KICKOFF PLAY CALL, P2 KICKING()
LDX #KICKOFF_OFF_FORMATION_ID ; SET OFF FORMATION = KICKOFF RETURN
JSR LOAD_P1_OFF_FORMATION ; LOAD OFFENSE FORMATION P1 ON OFFENSE()
LDX #KICKOFF_DEF_PLAY_ID ; SET DEF PLAY = KICKOFF
JSR LOAD_P2_DEFENSE_PLAY_CODE_ADDRESSES ; LOAD DEFENSE PLAY CODE PTRS P2 ON DEFENSE(X=DEFENSIVE PLAY INDEX)
JSR LOAD_ALL_SKILLS_INTO_PLAYER_RAM ; LOAD ALL PLAYER SKILLS(RS,RP,MS,HP) INTO PLAYER RAM() Bank 27 $85A9
LDA #KICKER_STARTER_ID + P2_SIDE_BITFLAG ;
LDX #RE_POSITION_ID + P2_SIDE_BITFLAG ;
JSR LOAD_SINGLE_PLAYER_SKILLS_TO_PLAYER_RAM ; SET PLAYER SKILLS IN PLAYER RAM (A=PLAYER ID, X=PLAYER POINTER TO LOAD INTO)
LDA #KR_STARTER_ID ;
LDX #RT_POSITION_ID ;
JSR LOAD_SINGLE_PLAYER_SKILLS_TO_PLAYER_RAM ; SET PLAYER SKILLS IN PLAYER RAM (A=PLAYER ID, X=PLAYER POINTER TO LOAD INTO)
JSR SET_P1_MAN_TO_KR_P2_MAN_KICKER ; SET P2 ACTIVE PLAYER TO FIRST PLAYER, P1 ACTIVE PLAYER TO LAST PLAYER()
LDA #MID_HASH_Y ; SET Y LOS TO MIDDLE
STA LOS_Y ;
SET_P2_KICKOFF_SCROLL_LIMITS[]
JSR UPDATE_FIELD_SCROLL_SETTINGS ; UPDATE SCROLL WINDOW VARS(X=LEFT SCROLL, Y=RIGHT SCROLL, A= XSCROLL)
JSR SET_GAME_STATUS_ON_FIELD_START_PLAYER_TASK ; SET GAME STATUS BIT TO ON FIELD & START UPDATE PLAYERS TASK()
JSR FADE_IN_BG_AND_SPR_PAL ; FADE IN PALLETE()
CHECK_FOR_P2_KICKOFF_BALL_SNAP: ; KICKOFF START CHECK
RETURN_1_FRAME
IF_BALL_NOT_SNAPPED[ADDR] CHECK_FOR_P2_KICKOFF_BALL_SNAP
num_tiles = LOCAL_1
num_rows = LOCAL_2
kick_bar_rows = $01
kick_bar_tiles = $0E
@clear_kick_bar_draw_clock_score
RETURN_IN_NUM_FRAMES 10
LDY #<P2_KICK_BAR_PPU_ADDR ; SET PPU LOC = 0x2044
LDX #>P2_KICK_BAR_PPU_ADDR ;
LDA #kick_bar_rows ; SET # ROWS = 1
STA num_rows ;
LDA #kick_bar_tiles ; SET LENGTH = 15 TILES
STA num_tiles ;
JSR FILL_SCREEN_BLANK_TILE_AREA ; FILL PPU LOCATIONS WITH BLANK TILE(X,Y= ADDR, 3F= NUM ROWS, 3E= LENGTH)
RETURN_IN_NUM_FRAMES 4
LDA #REDRAW_CLOCK_SCORE_BANNER_ID ; SET BANNER ID = REDRAW CLOCK AND SCORE BG AND CLOCK
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
CHECK_P2_KICKED_BALL: ; CHECK FOR BALL KICKED
RETURN_1_FRAME
IF_BALL_NOT_KICKED[ADDR] CHECK_P2_KICKED_BALL
@start_clock_set_p1_has_ball:
SET_CLOCK_TO_RUNNING
SET_POSSESSION_STATUS_P1_HAS_BALL
PLAY_SOUND_ID KICK_SOUND
RETURN_IN_NUM_FRAMES 20
LDA #P1_ON_FIELD_SONG_SIDE ; LOAD PLAYER 1 SOUND VALUE
JSR SET_ON_FIELD_SONG ; PLAY SOUND LOOP BASED ON GAME TYPE AND PLAYER (A=PLAYER)
IF_KICK_NOT_ONSIDES[ADDR] CHECK_P1_RECEIVED_KICKOFF
JMP P1_ONSIDES_KICK_RETURN ; YES-> P1 ONSIDES KICK
CHECK_P1_RECEIVED_KICKOFF: ; CHECK FOR KICKOFF RECEIVED
RETURN_1_FRAME
IF_BALL_NOT_RECEIVED[ADDR] CHECK_P1_RECEIVED_KICKOFF
@check_if_P1_out_of_endzone:
COMPARE_BALL_X_TO_YARDLINE 0
BCS @set_los_equal_ball_loc ; YES-> SET STARTING LOCATION TO BALL RECEIVED LOCATION
SAVE_YARDLINE_TO_LOS_X 0
JMP @set_p1_kick_return_scroll_limits ; JUMP-> UPDATE SCROLL WINDOW
@set_los_equal_ball_loc : ; SET STARTING FIELD POSITION TO BALL RECEIVED LOCATION
SET_LOS_X_EQUAL_TO_BALL_X
@set_p1_kick_return_scroll_limits: ; UPDATE SCROLL WINDOW
SET_P1_KR_SCROLL_LIMITS[]
P1_KICKOFF_RETURN_CHECKS: ; P1 KICKOFF RETURN CHECKS
_WHILE CC
RETURN_1_FRAME
JSR CHECK_FOR_TD_P1 ; CHECK FOR P1 ENDZONE CROSS()
JSR CHECK_IF_BALL_FUMBLED ; CHECK FOR FUMBLE()
JSR CHECK_FOR_PLAY_OVER_P1_OOB ; CHECK FOR PLAY OVER OR OUT OF BOUNDS()
_END_WHILE ; PLAY OVER OR BALL OOB? NO-> P1 KICKOFF RETURN CHECKS
@p1_kick_return_over
SET_CLOCK_TO_STOPPED
JSR CHECK_FOR_P1_SAFETY ; CHECK FOR SAFETY P1 ENDZONE()
JSR WAIT_UNTIL_BANNER_DONE_FADE_OUT_PAL ; CHECK FOR BANNER DONE THEN KILL TASKS AND FADE PALLETE()
JSR UPDATE_IN_GAME_TEAM_PLAYER_STATS ; UPDATE SRAM TEAM/PLAYER STATS()
JSR SET_CHAINS_HASH_SET_DOWN_TO_FIRST ; UPDATE FIELD POSITION, HASHMARK, FD MARKER, AND SET DOWN TO 1()
IF_KICK_ONSIDES[ADDR] P1_KICK_RETURN_END
@else:
JSR CHECK_INJURY_KR_PR_P1 ; CHECK FOR INJURY()
P1_KICK_RETURN_END: ; STOP MUSIC, DO P1 PLAY SELECT
JSR STOP_CURRENTLY_PLAYING_SOUND ; STOP CURRENTLY PLAYING SOUND LOOP()
_F}_P2_KICKOFF
_F{_P1_PLAY_SELECT_AND_PLAY_LOAD ; DONE
P1_PLAY_SELECT_START: ; P1 PLAY SELECT START
LDA #CLEAR_ONSCR_BANNER_BANNER_ID ; LOAD CLEAR BANNER
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
LDA #REDRAW_CLOCK_SCORE_BANNER_ID ; SET BANNER ID = REDRAW CLOCK AND SCORE BG AND CLOCK VALUE
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
JSR CHECK_FOR_QTR_OVER ; CHECK FOR QUARTER OVER RESET BIT & SUSPEND SWITCH TASK IF OVER()
JSR CLEAR_RAM_VARS_SPRITES ; CLEAR PLAY STATUS, BALL INFO BYTES,PASS TIMER, PASS TARGETS, AND SPRITES()
LDA #PLAY_CALL_SCREEN_BANK ; SET BANK = 20
SET_ADDR_XY[addr] PLAY_SELECT_START
JSR SWAP_8000_BANK_AND_JUMP_RETURN ; BANK 8000 SWAP AND JUMP (X,Y= ADDR, A= BANK)
IF_P1_PLAY_NOT_SPECIAL_TEAMS[ADDR] P1_REGULAR_PLAY_LOAD
@else_check_fg_punt:
JMP P1_FG_PUNT_CHECK ; YES->P1 FG or PUNT SELECTED
P1_REGULAR_PLAY_LOAD: ; P1 REGULAR PLAY START
JSR P1_ON_OFF_LOAD_PLAY_INFO_PLAYER_RAM ; P1 OFFENSE LOAD PLAY INFORMATION INTO PLAYER RAM(A=PLAY SELECTED) (cut in COM LOGIC HACK)
JSR LOAD_ALL_SKILLS_INTO_PLAYER_RAM ; LOAD ALL PLAYER SKILLS(RS,RP,MS,HP) INTO PLAYER RAM() Bank 27 $85A9
SET_P1_PLAY_START_SCROLL_LIMITS[] ;
JSR UPDATE_FIELD_SCROLL_SETTINGS ; UPDATE SCROLL WINDOW VARS (X=LEFT SCROLL, Y=RIGHT SCROLL, A= SCROLL LOC)
JSR SET_GAME_STATUS_ON_FIELD_START_PLAYER_TASK ; SET GAME STATUS BIT TO ON FIELD & START UPDATE PLAYERS TASK()
JSR SET_SIDELINE_SCROLL_LOC_UPDATE_DOWN_MARKERS ; UPDATE LOS AND FIRST DOWN MARKERS VALUES AND GRAPHICS()
JSR FADE_IN_BG_AND_SPR_PAL ; FADE IN PALLETE()
LDA #SCROLL_DOWN_DIST_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG ; SET BANNER ID = DOWN AND DISTANCE BANNER AND YARD MARKERS, SCROLL FROM FROM RIGHT SIDE
JSR UPDATE_BANNER ; UPDATE TOP BANNER()
RETURN_IN_NUM_FRAMES 60
LDA #SCROLL_CLOCK_SCORE_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG ; SET BANNER ID = NAMES CLOCK AND SCORE + SCROLL FROM FROM RIGHT SIDE
JSR UPDATE_BANNER ; UPDATE TOP BANNER()
RETURN_IN_NUM_FRAMES 8
JSR CHECK_P1_HIKE_P2_PLAYER_CHANGE ; CHECK FOR HIKE AND P2 DEFENDER PLAYER CHANGE()
LDY OFF_PLAY_ADDR ; LOAD OFFENSE PLAY POINTER
LDX OFF_PLAY_ADDR +1 ;
JSR UPDATE_ALL_P1_PLAY_CODE_ADRR_EXCEPT_MAN ; P1 ON OFFENSE UPDATE ALL PLAYER PLAY CODE ADDRESSES (X,Y= PLAY CODE ADDRESS)
LDA #P1_ON_FIELD_SONG_SIDE ; SET PLAYER SIDE FOR SONG = PLAYER 1
JSR SET_ON_FIELD_SONG ; PLAY SOUND LOOP BASED ON GAME TYPE AND PLAYER (A=PLAYER)
IF_P1_PLAY_RUN[ADDR] P1_RUN_PLAY_START
@else_do_p1_pass:
JMP P1_PASS_PLAY_START ; NO-> P1 PASS PLAY START
_F}_P1_PLAY_SELECT_AND_PLAY_LOAD
_F{_P1_RUN_PLAY ; DONE
P1_RUN_PLAY_START: ; P1 RUN PLAY START
INIT_POSSESSION_STATUS_P1_RUN
SET_SPRITE_OFFSCREEN PASS_TGT_INDICATOR_SPR_Y
@p1_run_ball_behind_los: ; BALL BEHIND LOS RUN PLAY LOOP
P1_RECEPTION:
_WHILE CC
RETURN_1_FRAME
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
JSR CHECK_FOR_DRAW_FD_STICK ; CHECK FOR UPDATE LOS MARKERS IF THEY ARE OFF SCREEN()
JSR CHECK_FOR_TD_P1 ; CHECK FOR P1 ENDZONE CROSS()
JSR CHECK_FOR_FUMBLED_SNAP_OR_TOSS ; CHECK FOR FUMBLE IF SHOTGUN SNAP/ RUN TOSS IN PROGRESS ()
JSR CHECK_IF_BALL_FUMBLED ; CHECK FOR FUMBLE()
JSR CHECK_FOR_PLAY_OVER_P1_OOB ; CHECK FOR PLAY OVER OR OUT OF BOUNDS()
BCS P1_PLAY_OVER_NORMAL ; BALL OOB OR PLAY OVER? YES-> P1 PLAY OVER
LDA BALL_X+1 ; IS BALL CARRIER PAST LINE OF SCRIMMAGE?
CMP LOS_X ;
LDA BALL_X+2 ;
SBC LOS_X +1 ;
_END_WHILE
P1_OFFENSE_PAST_LOS_SET_D_CHASE: ; CLEAR TARGET INDICATOR, UPDATE PLAY STATUS, SET DEFENDERS TO CHASE
SET_SPRITE_OFFSCREEN PASS_TGT_INDICATOR_SPR_Y ;
SET_PLAY_STATUS_MAN_CANT_PASS[]
JSR ADD_31MS_TO_P2_MAN_DEFENDER ; ADD 31 MS TO TOP SPEED FOR P2 ACTIVE PLAYER()
LDY #<CHASE_BALL_CARRIER_PLAY_PTRS[] ; SET ADDR = DEFENSE AGRESSIVE CHASE CAN COLLIDE
LDX #>CHASE_BALL_CARRIER_PLAY_PTRS[] ;
JSR UPDATE_ALL_P2_PLAY_CODE_ADRR_EXCEPT_MAN ; UPDATE P2 PLAY CODE ADDRESSES OF NON-MAN CONTROL PLAYERS ONLY (X,Y= PLAY CODE ADDRESS)
P1_RUN_PLAY_CHECKS_PAST_LOS:
_WHILE CC ; RUN PLAY CHECKS WITHOUT LINE OF SCRIMMAGE CHECK
RETURN_1_FRAME
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
JSR CHECK_FOR_DRAW_FD_STICK ; CHECK FOR UPDATE LOS MARKERS IF THEY ARE OFF SCREEN()
JSR CHECK_FOR_TD_P1 ; CHECK FOR P1 ENDZONE CROSS()
JSR CHECK_FOR_FUMBLED_SNAP_OR_TOSS ; CHECK FOR FUMBLE IF SHOTGUN SNAP/ RUN TOSS IN PROGRESS ()
P1_RUN_FUMBLE_CHECKS: ; P1 RUN PLAY FUMBLE CHECKS
JSR CHECK_IF_BALL_FUMBLED ; CHECK FOR FUMBLE()
JSR CHECK_FOR_PLAY_OVER_P1_OOB ; CHECK FOR PLAY OVER OR OUT OF BOUNDS()
_END_WHILE ; NOT FUMBLED OR PLAY NOT OVER? YES-> RUN PLAY CHECKS WITHOUT LINE OF SCRIMMAGE CHECK
_F}_P1_RUN_PLAY
_F{_P1_PLAY_OVER_NORMAL ; DONE
P1_PLAY_OVER_NORMAL: ; P1 PLAY OVER
SET_SPRITE_OFFSCREEN PASS_TGT_INDICATOR_SPR_Y
JSR CHECK_FOR_P1_SAFETY ; CHECK FOR SAFETY P1 ENDZONE()
JSR P1_CHECK_FOR_FIRST_DOWN ; CHECK FOR FIRST DOWN / TURNOVER ON DOWNS()
BCS @p1_turnover_on_downs ; 4TH DOWN STOP> YES->P1 TURNOVER ON DOWNS
@p1_normal_play_end:
JSR WAIT_UNTIL_BANNER_DONE_FADE_OUT_PAL ; CHECK FOR BANNER DONE THEN KILL TASKS AND FADE PALLETE()
JSR UPDATE_IN_GAME_TEAM_PLAYER_STATS ; UPDATE SRAM TEAM/PLAYER STATS()
JSR UPDATE_HASH_ONLY_IF_NOT_FIRST ; UPDATE LINE OF SCRIMMAGE AND HASHMARK TO SNAP FROM()
JSR P1_CHECK_FOR_INJURY_NORM ; CHECK FOR INJURY()
JMP P1_PLAY_SELECT_START ; JUMP->P1 PLAY CALL START
@p1_turnover_on_downs: ; P1 TURNOVER ON DOWNS
JSR END_ALL_TASKS_BUT_CLOCK_AND_DRAW_CLEAR_CUT ; END ALL TASKS BUT CLOCK AND TASK 4& CLEAR CUTSCENE()
JSR P1_CHECK_FOR_INJURY_NORM ; CHECK FOR INJURY()
JMP P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT ; JUMP -> P1 to P2 POSSESION CHANGE TO P2 PLAY SELECT
_F}_P1_PLAY_OVER_NORMAL
_F{_P1_PASS_PLAY ; DONE
P1_PASS_PLAY_START: ; P1 PASS PLAY START
INIT_POSSESSION_STATUS_P1_PASS[] ;
SET_PLAY_STATUS_MAN_CAN_PASS[]
JSR CLEAR_CUTSCENE_TO_PLAY_SET_CUT_RAND ; CLEAR CUTSCENE TO PLAY, SET CUTSCENE RANDOM B6
P1_QB_HASNT_THROWN_BEHIND_LOS_CHECKS: ; QB HASNT PASSED BALL LOOP
RETURN_1_FRAME
JSR UPDATE_CURRENT_TARGET_AND_INDICATOR ; LOAD TARGETS AND SET CURRENT TARGET ICON ()
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
JSR CHECK_FOR_FUMBLED_SNAP_OR_TOSS ; CHECK FOR FUMBLE IF SHOTGUN SNAP/ RUN TOSS IN PROGRESS ()
IF_BALL_FUMBLED[ADDR] P1_RUN_FUMBLE_CHECKS
@else_other_p1_run_checks:
JSR CHECK_FOR_PLAY_OVER_P1_OOB ; CHECK FOR PLAY OVER OR OUT OF BOUNDS()
BCC @qb_past_los_check ; PLAY NOT OVER OR BALL NOT oob? YES-> QB PAST LOS CHECK
@pass_over_no_throw:
JMP P1_PASS_PLAY_OVER_NO_THROW ; NO-> PASS PLAY OVER QB DIDNT THROW BALL
@qb_past_los_check: ; QB PAST LOS CHECK
LDA BALL_X+1 ; IS BALL CARRIER BEHIND LOS
CMP LOS_X ;
LDA BALL_X+2 ;
SBC LOS_X +1 ;
BCC CHECK_FOR_P1_PASS_ATTEMPT ; YES-> CHECK FOR PASS ATTEMPT
JMP P1_OFFENSE_PAST_LOS_SET_D_CHASE ; NO-> CLEAR TARGET INDICATOR, UPDATE PLAY STATUS, SET DEFENDERS TO CHASE
CHECK_FOR_P1_PASS_ATTEMPT: ; CHECK FOR PASS ATTEMPT
IF_PASS_NOT_ATTEMPTED[ADDR] P1_QB_HASNT_THROWN_BEHIND_LOS_CHECKS
@wait_for_pass_qtr_of_the_way: ;
_WHILE NOT_EQUAL ; loop until ball is 1/4 of the way
RETURN_1_FRAME
LDA PLAY_STATUS ; DOES PLAY STATUS = PLAY OVER?
BPL @pass_one_qtr_way_there_check ; NO->P1 WAIT FOR PASS 1/4 OF the WAY LOOP
JMP P1_PLAY_OVER_NORMAL ; YES->RUN PLAY OVER
@pass_one_qtr_way_there_check: ; P1 WAIT FOR PASS 1/4 OF the WAY LOOP
JSR CHECK_FOR_DRAW_FD_STICK ; CHECK FOR UPDATE LOS MARKERS IF THEY ARE OFF SCREEN()
JSR UPDATE_TARGET_INDICATOR ; UPDATE TARGET INDICATOR TO ONSCREEN OR OFFSCREEN()
JSR DO_CUTSCENE_IF_NEEDED ; CHECK FOR CUTSCENE. RETURN WHEN DONE OR IF NO CUTSCENE.
DEC PASS_TIMER_DIV_BY_4 ; PASS TIMER DIVIDED BY 4--
_END_WHILE
LDA #EXCITED_CROWD_SIDELINE_ID ; SET SIDELINE ANIMATION = CROWD MOVING
STA SIDELINE_ANI_TIMER ;
JSR SET_AND_ORDER_BALL_COLLISION_PLAYERS ; CHECK FOR DEFENDER AND WR DISTANCE TO BALL AND ORDER()
P1_CHECK_FOR_PASS_OUTCOME_BALL_IN_AIR: ; P1 PASS ATTEMPT OUTCOME LOOP
_WHILE VALUE_CLEAR
RETURN_1_FRAME
JSR CHECK_FOR_DRAW_FD_STICK ; CHECK FOR UPDATE LOS MARKERS IF THEY ARE OFF SCREEN()
JSR UPDATE_TARGET_INDICATOR ; UPDATE TARGET INDICATOR TO ONSCREEN OR OFFSCREEN()
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
P1_PASS_OUTCOME_CHECK:
SWITCH_A_BIT[] BALL_STATUS
CASE_BIT[bit_addr] 7, P2_INTERCEPTS_PASS
CASE_BIT[bit_addr] 6, P2_TIPS_PASS
CASE_BIT[bit_addr] 5, P1_RECEPTION
@p1_pass_ball_collided_check:
BIT BALL_COLLISION
_END_WHILE
RETURN_IN_NUM_FRAMES 6
@check_for_outcome_after_tip: ; not implemented
IF_PASS_HAS_OUTCOME[ADDR] P1_PASS_OUTCOME_CHECK
P1_PASS_BALL_OOB_OR_HIT_GROUND: ; P1 PASS PLAY OVER
SET_PLAY_STATUS_PLAY_OVER[]
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
SET_SPRITE_OFFSCREEN PASS_TGT_INDICATOR_SPR_Y
SET_CLOCK_TO_STOPPED
LDA #INCOMPLETE_PASS_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
RETURN_IN_NUM_FRAMES 60
JSR END_GAME_FIELD_BALL_MOVE_TASKS ; END GAME FIELD & BALL MOVEMENT TASKS & CLEAR CUTSCENE()
SET_BALL_X_EQUAL_TO_LOS_X
JSR STOP_SOUND_CHECK_TURNOVER_ON_DOWNS ; STOP SOUND LOOP AND CHECK FOR TURNOVER ON DOWNS()
@do_p1_play_select:
BCC @p1_update_stats_hashmark_go_to_play_select ; 4TH DOWN STOP? NO->UPDATE STATS, HASHMARK, DO P1 PLAY SELECT()
@p1_pass_turnover_on_downs:
JMP P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT
@p1_update_stats_hashmark_go_to_play_select: ; UPDATE STATS, HASHMARK, DO P1 PLAY SELECT()
JSR WAIT_UNTIL_BANNER_DONE_FADE_OUT_PAL ; CHECK FOR BANNER DONE THEN KILL TASKS AND FADE PALLETE()
JSR UPDATE_IN_GAME_TEAM_PLAYER_STATS ; UPDATE SRAM TEAM/PLAYER STATS()
JSR UPDATE_HASH_ONLY_IF_NOT_FIRST ; UPDATE LINE OF SCRIMMAGE AND HASHMARK TO SNAP FROM
JMP P1_PLAY_SELECT_START ; JUMP ->PLAYER 1 PLAY SELECT START
_F}_P1_PASS_PLAY
_F{_P1_SACK_OR_SCRAMBLE ; DONE
P1_PASS_PLAY_OVER_NO_THROW: ; PASS PLAY OVER QB DIDNT THROW BALL
LOAD_P1_MAN_PLAYER_POSITION_ONLY ;
BNE P1_PASS_PLAY_OVER_NO_THROW_NO_SACK ; IS QB? NO-> RUN PLAY OVER
IF_BALL_OOB_OR_RECOVERED[ADDR] P1_PASS_PLAY_OVER_NO_THROW_NO_SACK
@check_p1_qb_sacked:
BIT TACKLER_ID ; WAS QB SACKED?
BVC P1_PASS_PLAY_OVER_NO_THROW_NO_SACK ; NO-> RUN PLAY OVER
@set_starter_id_for_cutscene:
LDA TACKLER_ID ; SET P2 ICON AND CUTSCENE PLAYER = DEFENDER ID
CLC ;
ADC #RE_STARTER_ID ;
STA P2_MAN_POS_ID_ICON_STATUS ; SAVE IN P2 ICON
STA DEF_SACK_BALL_BLOCK_STARTER_ID ; SAVE IN CUTSCENE PLAYER
SET_PLAY_STATUS_SACK[] ;
SET_SPRITE_OFFSCREEN PASS_TGT_INDICATOR_SPR_Y
COMPARE_BALL_X_TO_LOCATION[name] FRONT_LEFT_ENDZONE + 1
@if_less_than:
BCC P1_QB_SAFETIED ; YES->P1 QB SAFETIED
@else_check_p1_tod:
JSR STOP_SOUND_CHECK_TURNOVER_ON_DOWNS ; STOP SOUND LOOP AND CHECK FOR TURNOVER ON DOWNS()
@if_p1_sacked_on_4th_down:
BCS P1_QB_SACKED_ON_4TH_DOWN ; 4TH DOWN STOP? YES->P1 QB SACKED AND TURNOVER ON DOWNS
P1_QB_SACKED:
JSR END_ALL_TASKS_BUT_CLOCK_AND_DRAW_CLEAR_CUT
LDA #QB_SACK_SCENE_ID ; SET CUTSCENE ID = QB SACK
JSR DRAW_CUTSCENE_PLAY_OVER ; PLAY BANK 7 CUTSCENE, PLAY IS OVER ( A=CUTSCENE INDEX)
JSR UPDATE_IN_GAME_TEAM_PLAYER_STATS ; UPDATE SRAM TEAM/PLAYER STATS()
JSR UPDATE_HASH_ONLY_IF_NOT_FIRST ; UPDATE LINE OF SCRIMMAGE AND HASHMARK TO SNAP FROM
JSR P1_CHECK_FOR_INJURY_NORM ; CHECK FOR INJURY()
JMP P1_PLAY_SELECT_START ; JUMP ->PLAYER 1 PLAY SELECT START
P1_QB_SACKED_ON_4TH_DOWN: ; P1 QB SACKED AND TURNOVER ON DOWNS
SET_CLOCK_TO_STOPPED
JSR END_ALL_TASKS_BUT_CLOCK_AND_DRAW_CLEAR_CUT
LDA #QB_SACK_SIDE_CHANGE_SCENE_ID ; SET CUTSCENE ID= QB SACK W SIDE CHANGE
JSR DRAW_CUTSCENE_PLAY_OVER ; PLAY BANK 7 CUTSCENE, PLAY IS OVER ( A=CUTSCENE INDEX)
JSR P1_CHECK_FOR_INJURY_NORM ; CHECK FOR INJURY()
JMP P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT
P1_QB_SAFETIED: ; P1 QB SAFETIED
SET_CLOCK_TO_STOPPED
JSR END_ALL_TASKS_BUT_CLOCK_AND_DRAW_CLEAR_CUT ; END ALL TASKS BUT CLOCK AND TASK 4 & CLEAR CUTSCENE()
SET_BALL_STATUS_SPECIAL_SAFETY[]
LDA #SAFETY_POINTS ; SET POINT VALUE= SAFETY POINTS = 2PTS
JSR ADD_PTS_TO_P2_QTR_TOT ; ADD POINTS TO P2 SCORE(A= PTS)
LDA #QB_SACK_SAFETY_SCENE_ID ; SET CUTSCENE ID= QB SAFETIED
JSR DRAW_CUTSCENE_PLAY_OVER ; PLAY BANK 7 CUTSCENE, PLAY IS OVER ( A=CUTSCENE INDEX)
JSR P1_CHECK_FOR_INJURY_NORM ; CHECK FOR INJURY()
RETURN_IN_NUM_FRAMES 8 ;
JMP P1_TO_P2_POSSESSION_CHANGE_P1_KICKOFF ; JUMP-> P1 to P2 POSSESION CHANGE KICKOFF
P1_PASS_PLAY_OVER_NO_THROW_NO_SACK:
JMP P1_PLAY_OVER_NORMAL ; JUMP-> P1 PLAY OVER
_F}_P1_SACK_OR_SCRAMBLE
_F{_P1_SPECIAL_TEAMS_PLAY_TYPE_CHECK ; DONE
P1_FG_PUNT_CHECK: ; FG/PUNT CHECK
LDA P1_PLAY_CALL ; IS P1 PLAY CALL = FG =0X09
CMP #FG_PLAY_CALL_ID ;
BCC P1_PUNT_START ; NO-> P1 PUNT START
JMP P1_FG_START ; YES-> P1 FG START
_F}_P1_SPECIAL_TEAMS_PLAY_TYPE_CHECK
_F{_P1_PUNT_PLAY ; DONE
P1_PUNT_START: ; P1 PUNT START =0X08
INIT_POSSESSION_STATUS_P1_PUNT
@set_off_formation:
LDX #PUNT_OFF_FORMATION_ID ; SET OFFENSIVE FORMATION =PUNT
JSR LOAD_P1_OFF_FORMATION ; LOAD OFFENSE FORMATION P1 ON OFFENSE()
@set_def_play:
LDX #PUNT_DEF_PLAY_ID ; SET DEFENSIVE PLAY = PUNT
JSR LOAD_P2_DEFENSE_PLAY_CODE_ADDRESSES ; LOAD DEFENSE PLAY CODE PTRS P2 ON DEFENSE(X=DEFENSIVE PLAY INDEX)
@load_player_skills:
JSR LOAD_ALL_SKILLS_INTO_PLAYER_RAM ; LOAD ALL PLAYER SKILLS(RS,RP,MS,HP) INTO PLAYER RAM() Bank 27 $85A9
@swap_in_special_teams_players:
LDA #PUNTER_STARTER_ID ; LOAD P1 PUNTER INDEX (00= P1, 17=PUNTER)
LDX #QB_POSITION_ID ; LOAD PLAYER POINTER TO LOAD INTO(00= player 1 side player id=00= first player)
JSR LOAD_SINGLE_PLAYER_SKILLS_TO_PLAYER_RAM ; SET PLAYER SKILLS IN PLAYER RAM (A=PLAYER ID, X=PLAYER POINTER TO LOAD INTO)
LDA #PR_STARTER_ID + P2_SIDE_BITFLAG ; LOAD P2 PR INDEX (80= P2, 19 = PR)
LDX #SS_POSITION_ID + P2_SIDE_BITFLAG ; LOAD PLAYER POINTER TO LOAD SKILLS INTO (80= player 2 side player id=0A= last player)
JSR LOAD_SINGLE_PLAYER_SKILLS_TO_PLAYER_RAM ; SET PLAYER SKILLS IN PLAYER RAM (A=PLAYER ID, X=PLAYER POINTER TO LOAD INTO)
JSR SET_P2_MAN_TO_KR_P1_MAN_KICKER ; SET P1 ACTIVE PLAYER TO FIRST PLAYER, P2 ACTIVE PLAYER TO LAST PLAYER()
@set_scroll_limits:
SET_P1_PUNT_START_SCROLL_LIMITS[]
JSR UPDATE_FIELD_SCROLL_SETTINGS ; UPDATE SCROLL WINDOW VARS (X=LEFT SCROLL, Y=RIGHT SCROLL, A= XSCROLL)
JSR SET_GAME_STATUS_ON_FIELD_START_PLAYER_TASK
JSR FADE_IN_BG_AND_SPR_PAL ; FADE IN PALLETE()
RETURN_IN_NUM_FRAMES 2
JSR CHECK_FOR_SNAP_P2DEF_CHANGE_P1PUNT ; WAIT FOR SNAP()
LDA #P2_ON_FIELD_SONG_SIDE ; LOAD PLAYER 2
JSR SET_ON_FIELD_SONG ; PLAY SOUND LOOP BASED ON GAME TYPE AND PLAYER (A=PLAYER)
P1_CHECK_FOR_BALL_PUNTED: ; P1 PUNT HAS BEEN SNAPPED LOOP
RETURN_1_FRAME
JSR CHECK_FOR_FUMBLED_SNAP_OR_TOSS ; CHECK FOR FUMBLE IF SHOTGUN SNAP/ RUN TOSS IN PROGRESS ()
JSR CHECK_IF_BALL_FUMBLED ; CHECK FOR FUMBLE()
BCC @check_for_punter_tackled ; FUMBLE? NO-> PUNT RETURN CHECKS
@p1_snap_fumbled:
JMP P1_RUN_PLAY_CHECKS_PAST_LOS ; YES->RUN PLAY CHECKS WITHOUT LINE OF SCRIMMAGE CHECK
@check_for_punter_tackled: ;
JSR CHECK_FOR_PLAY_OVER_P1_OOB ; CHECK FOR PLAY OVER OR P1 ACTIVE PLAYER OUT OF BOUNDS
BCC @check_ball_punted ; PLAY OVER OR BALL OOB?
@p1_punter_tackled
JMP P1_SPECIAL_TEAMS_PLAY_OVER ; YES->P1 SPECIAL TEAMS PLAY OVER
@check_ball_punted: ; P1 CHECK FOR BALL PUNTED
IF_BALL_NOT_KICKED[ADDR] P1_CHECK_FOR_BALL_PUNTED
P1_CHECK_FOR_PUNT_BLOCKED: ; P1 BALL HAS BEEN PUNTED
_WHILE EQUAL
RETURN_1_FRAME
JSR CHECK_FOR_PLAY_OVER_P2_OOB ; CHECK FOR PLAY OVER OR P2 ACTIVE PLAYER OUT OF BOUNDS
BCC @check_for_punt_block ; PLAY OVER OR BALL OOB? NO->P1 PUNT BLOCK CHECK
JMP P1_SPECIAL_TEAMS_PLAY_OVER ; JUMP-> P1 SPECIAL TEAMS PLAY OVER
@check_for_punt_block: ; P1 PUNT BLOCK CHECK
BIT BALL_STATUS ; DOES BALL STATUS = PUNT BLOCKED? (OLD HOOK NOT POSSIBLE WITHOUT HACK)
BVC @check_for_punt_cutscene ; NO->P2 RETURN P1 PUNT START
JMP P1_PUNT_BLOCKED_POSS_CHANGE_UNUSED ; YES->P1 to P2 POSSESION CHANGE TO P2 PLAY SELECT
@check_for_punt_cutscene: ; P2 RETURN P1 PUNT START
LDA CUTSCENE_TO_DRAW ; IS THERE A CUTSCENE TO PLAY
_END_WHILE
@do_punt_cutscene:
JSR DO_CUTSCENE_SAVE_INFO_TO_SRAM ; DO CUTSCENE()
CLEAR_CLOCK_SPEED_PUNT
SET_POSSESSION_STATUS_P2_HAS_BALL
RETURN_IN_NUM_FRAMES 8
SET_ADDR_XY[addr] PUNT_COVERAGE_PLAY_PTRS[]
JSR UPDATE_ALL_P1_PLAY_CODE_ADRR_EXCEPT_MAN ; P1 ON OFFENSE UPDATE ALL PLAYER PLAY CODE ADDRESSES (X,Y= PLAY CODE ADDRESS)
SET_ADDR_XY[addr] PUNT_RETURN_PLAY_PTRS[]
JSR UPDATE_ALL_P2_PLAY_CODE_ADRR_EXCEPT_MAN ; UPDATE P2 PLAY CODE ADDRESSES OF NON-MAN CONTROL PLAYERS ONLY (X,Y= PLAY CODE ADDRESS)
P2_PUNT_RETURN_WAIT_FOR_BALL: ; P2 PUNT RETURN WAIT FOR BALL LOOP
RETURN_1_FRAME
BIT BALL_STATUS ; IS PUNT BLOCKED?
BVS P1_PUNT_BLOCKED_POSS_CHANGE_UNUSED ; YES->P1 to P2 POSSESION CHANGE TO P2 PLAY SELECT
JSR P2_CHECK_FOR_TOUCHBACK ; CHECK FOR P2 TOUCHBACK()
BCS P2_TOUCHBACK_POSS_CHANGE ; TOUCHBACK? YES-> P1 to P2 POSSESION CHANGE TO P2 PLAY SELECT
IF_BALL_NOT_RECEIVED[ADDR] P2_PUNT_RETURN_WAIT_FOR_BALL
P2_PUNT_RETURN_CAUGHT_BALL:
@set_p1_punting_stats:
LDX #UPDATE_PUNTS_IN_GAME_INDEX ; SET STAT TO UPDATE = P1 PUNT ATT
JSR UPDATE_P1_NON_QB_STATS[stat] ; UPDATE P1 NON-QB PLAYER STATS(X= STAT TO UPDATE)
JSR CALCULATE_PLAY_DISTANCE_P1 ; CALCULATE DISTANCE FROM INIT LOC(LEFT) CUR LOCATION (RIGHT)()
LDX #UPDATE_PUNT_YDS_IN_GAME_INDEX ; SET STAT TO UPDATE = P1 PUNT YARD
JSR UPDATE_P1_NON_QB_STATS[stat] ; UPDATE P1 NON-QB PLAYER STATS(X= STAT TO UPDATE)
@update_los_and_scroll:
SET_LOS_X_EQUAL_TO_BALL_X
SET_P2_PR_SCROLL_LIMITS[]
@p2_punt_return: ; P2 PUNT RETURN CHECKS
RETURN_1_FRAME
JSR CHECK_FOR_TD_P2 ; CHECK FOR P2 ENDZONE CROSS()
JSR CHECK_IF_BALL_FUMBLED ; CHECK FOR FUMBLE()
JSR CHECK_FOR_PLAY_OVER_P2_OOB ; CHECK FOR PLAY OVER OR P2 ACTIVE PLAYER OUT OF BOUNDS
BCC @p2_punt_return ; PLAY OVER OR OOB? NO-> P2 PUNT RETURN CHECKS
@p2_punt_return_tackled:
JSR CHECK_FOR_P2_SAFETY ; CHECK FOR P2 SAFETY()
JSR P1_to_P2_SIDE_CHANGE_BANNER_AND_MUSIC ; PLAY SIDE CHANGE MUSIC and BANNER P1 to P2()
JSR WAIT_UNTIL_BANNER_DONE_FADE_OUT_PAL ; CHECK FOR BANNER DONE THEN KILL TASKS AND FADE PALLETE()
SET_POSSESSION_STATUS_P2_HAS_BALL_HAD_BALL ; SET POSSESSION STATUS = P2 HAS BALL, P2 LAST HAD BALL, P2 JOYPAD, P2 PALLETE
JSR CHECK_INJURY_KR_PR_P2 ; P2 PR/KR CHECK FOR INJURY()
SET_POSSESSION_STATUS_P1_HAS_BALL_HAD_BALL ; SET POSSESSION STATUS = P1 HAS BALL, P1 LAST HAD BALL FOR POSSESION CHANGE BANNER
P2_TOUCHBACK_POSS_CHANGE:
JMP P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT ; JUMP -> P1 to P2 POSSESION CHANGE TO P2 PLAY SELECT
P1_PUNT_BLOCKED_POSS_CHANGE_UNUSED: ; not implemeneted
JMP P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT
_F}_P1_PUNT_PLAY
_F{_P1_FG_PLAY ; DONE
P1_FG_START: ; P1 FG START
JSR CLEAR_RAM_VARS_SPRITES ; CLEAR PLAY STATUS, BALL INFO BYTES,PASS TIMER, PASS TARGETS, AND SPRITES()
INIT_POSSESSION_STATUS_P1_FG_ATT
LDX #FG_OFF_FORMATION_ID ; SET OFFENSIVE FORMATION = FG
JSR LOAD_P1_OFF_FORMATION ; LOAD OFFENSE FORMATION P1 ON OFFENSE(X=FORMATION INDEX)
LDX #FG_DEF_PLAY_ID ; SET DEFENSIVE PLAY = FG
JSR LOAD_P2_DEFENSE_PLAY_CODE_ADDRESSES ; LOAD DEFENSE PLAY CODE PTRS P2 ON DEFENSE(X=DEFENSIVE PLAY INDEX)
JSR LOAD_ALL_SKILLS_INTO_PLAYER_RAM ; LOAD ALL PLAYER SKILLS(RS,RP,MS,HP) INTO PLAYER RAM() Bank 27 $85A9
LDA #KICKER_STARTER_ID ; SET PLAYER TEAM ID = FG KICKER
LDX #RB1_POSITION_ID ; SET POSITION TO LOAD INTO = RB 1
JSR LOAD_SINGLE_PLAYER_SKILLS_TO_PLAYER_RAM ; SET PLAYER SKILLS IN PLAYER RAM (A=PLAYER ID, X=PLAYER POINTER TO LOAD INTO)
SET_P1_FG_XP_SCROLL_LIMITS[]
JSR UPDATE_FIELD_SCROLL_SETTINGS ; UPDATE SCROLL WINDOW VARS (X=LEFT SCROLL, Y=RIGHT SCROLL, A= XSCROLL)
JSR SET_GAME_STATUS_ON_FIELD_START_PLAYER_TASK
JSR SET_SIDELINE_SCROLL_LOC_UPDATE_DOWN_MARKERS ; UPDATE LOS AND FIRST DOWN MARKERS VALUES AND GRAPHICS()
JSR FADE_IN_BG_AND_SPR_PAL ; FADE IN PALLETE()
LDA #FG_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
RETURN_IN_NUM_FRAMES 60
LDA #SCROLL_CLOCK_SCORE_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
JSR CHECK_P1_HIKE_P2_PLAYER_CHANGE ; CHECK FOR HIKE AND P2 DEFENDER PLAYER CHANGE()
LDA #P1_ON_FIELD_SONG_SIDE ; SET SIDE = P1 SIDE
JSR SET_ON_FIELD_SONG ; PLAY SOUND LOOP BASED ON GAME TYPE AND PLAYER (A= SIDE (P1/P2))
P1_FG_NOT_KICKED_LOOP:
RETURN_1_FRAME
JSR CHECK_FOR_FUMBLED_SNAP_OR_TOSS ; CHECK FOR FUMBLE IF SHOTGUN SNAP/ RUN TOSS IN PROGRESS ()
JSR CHECK_IF_BALL_FUMBLED ; CHECK FOR FUMBLE
BCC @check_for_tackle_kick ;
JMP P1_RUN_PLAY_CHECKS_PAST_LOS ; JUMP -> P1 RUN PLAY CHECKS WITHOUT LINE OF SCRIMMAGE CHECK
@check_for_tackle_kick: ;
JSR CHECK_FOR_PLAY_OVER_P1_OOB ; CHECK FOR PLAY OVER OR OUT OF BOUNDS()
BCS P1_SPECIAL_TEAMS_PLAY_OVER ; P1 SPECIAL TEAMS PLAY OVER
IF_BALL_NOT_KICKED[ADDR] P1_FG_NOT_KICKED_LOOP
@fg_kicked: ; FG KICKED LOOP
_WHILE EQUAL
RETURN_1_FRAME
LDA CUTSCENE_TO_DRAW ; IS THERE A CUTSCENE TO PLAY
_END_WHILE
IF_KICK_NOT_MADE[ADDR] DO_P1_FG_CUTSCENE
@stop_clock_and_add_pts:
SET_CLOCK_TO_STOPPED
LDA #FG_POINTS ; LOAD FG POINTS
JSR ADD_PTS_TO_P1_QTR_TOT ; ADD POINTS TO P1 SCORE (A=PTS)
DO_P1_FG_CUTSCENE: ; CHECK FOR P1 FG BLOCK OR MISS
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
IF_KICK_BLOCKED[ADDR] P1_FG_BLOCKED
IF_KICK_NOT_MADE[ADDR] P1_FG_MISSED
@p1_fg_made_end:
RETURN_IN_NUM_FRAMES 8
JMP P1_TO_P2_POSSESSION_CHANGE_P1_KICKOFF ; JUMP -> P1 to P2 POSSESION CHANGE KICKOFF
P1_SPECIAL_TEAMS_PLAY_OVER: ; P1 SPECIAL TEAMS PLAY OVER
SET_CLOCK_TO_STOPPED
JSR CHECK_FOR_P1_SAFETY ; CHECK FOR SAFETY P1 ENDZONE
JMP P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT
P1_FG_BLOCKED: ; P1 FG BLOCKED
LDA #KICK_BLOCK_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
JSR KICK_BLOCK_RECOVERY ; DO KICK BLOCK RECOVERY ROUTINE
JMP P1_RUN_PLAY_CHECKS_PAST_LOS ; JUMP TO P1 RUN PLAY CHECKS WITHOUT LINE OF SCRIMMAGE CHECK
P1_FG_MISSED: ; P1 FG MISSED
COMPARE_LOS_X_TO_LOCATION[name] P2_TWENTY_YARDLINE
BCC @fg_not_inside_twenty ; NO->END PLAY AND LOAD LOS LOCATION (X) into BALL LOCATION (X)
@set_yardline_to_twenty:
SAVE_YARDLINE_TO_LOS_X 80
@fg_not_inside_twenty: ; END PLAY AND LOAD LOS LOCATION (X) into BALL LOCATION (X)
JSR END_GAME_FIELD_BALL_MOVE_TASKS ; END GAME FIELD & BALL MOVEMENT TASKS & CLEAR CUTSCENE()
SET_PLAY_STATUS_PLAY_OVER[]
SET_BALL_X_EQUAL_TO_LOS_X
JMP P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT ; JUMP -> P1 to P2 POSSESION CHANGE TO P2 PLAY SELECT
_F}_P1_FG_PLAY
_F{_P1_ONSIDES_RETURN ; DONE
P1_ONSIDES_KICK_RETURN: ; P1 ONSIDES KICK RETURN
LDA #ONSIDES_KICK_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
SET_ADDR_XY[addr] OFF_RECOVER_ONSIDE_PLAY_PTRS[]
JSR UPDATE_ALL_P1_PLAY_CODE_ADRR_EXCEPT_MAN ; P1 ON OFFENSE UPDATE ALL PLAYER PLAY CODE ADDRESSES (X,Y= PLAY CODE ADDRESS)
SET_ADDR_XY[addr] DEF_RECOVER_ONSIDE_PLAY_PTRS[]
JSR UPDATE_ALL_P2_PLAY_CODE_ADRR_EXCEPT_MAN ; UPDATE P2 PLAY CODE ADDRESSES OF NON-MAN CONTROL PLAYERS ONLY (X,Y= PLAY CODE ADDRESS)
@recovery_loop:
_WHILE EQUAL ; P1 ONSIDES KICK WAIT FOR BALL TO BE RECOVERED
RETURN_1_FRAME
LDA BALL_STATUS ; DOES BALL STATUS = BALL RECOVERED?
AND #$0C ;
_END_WHILE
AND #$04 ; DID P2 RECOVER KICK?
BNE @p2_def_recovers_onsides ; YES-> P2 RECOVERS ONSIDE INTENDED FOR P1
@p1_off_recovers_onside
SET_LOS_X_EQUAL_TO_BALL_X
SET_P1_KR_SCROLL_LIMITS[]
SET_ADDR_XY[addr] OFF_ONSIDE_KICK_RET_PLAY_PTRS[]
JSR UPDATE_ALL_P1_PLAY_CODE_ADRR ; UPDATE P1 ACTIVE PLAYER PLAY CODE ADDRESS PLAYER ON DEFENSE(X,Y= PLAY CODE ADDRESS)
SET_ADDR_XY[addr] DEF_ONSIDE_KICK_RET_PLAY_PTRS[]
JSR UPDATE_ALL_P2_PLAY_CODE_ADRR_EXCEPT_MAN ; UPDATE P2 PLAY CODE ADDRESSES OF NON-MAN CONTROL PLAYERS ONLY (X,Y= PLAY CODE ADDRESS)
JSR ADD_31MS_TO_P1_MAN_DEFENDER ; ADD 31 MS TO TOP SPEED FOR P1 MAN DEFENDER()(typically not under man control yet)
LDA #SCROLL_IN_ONSCR_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
RETURN_IN_NUM_FRAMES 8
JMP P1_KICKOFF_RETURN_CHECKS ; PLAY OVER OR BALL OOB? NO->P1 KICKOFF RETURN CHECKS
@p2_def_recovers_onsides: ; P2 RECOVERS ONSIDE INTENDED FOR P1
JSR DRAW_RECOVER_TEXT ; DRAW RECOVER TEXT()
JMP P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT
_F}_P1_ONSIDES_RETURN
_F{_P1_PASS_TIPPED_RESULT ; DONE
P2_TIPS_PASS: ; P1 PASS TIPPED
SET_SPRITE_OFFSCREEN PASS_TGT_INDICATOR_SPR_Y
LDA #PASS_BLOCK_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
RETURN_IN_NUM_FRAMES 40
LDA #SCROLL_CLOCK_SCORE_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
P2_TIPS_PASS_OUTCOME_LOOP:
RETURN_1_FRAME
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
JSR CHECK_FOR_PLAY_OVER_P1_OOB ; CHECK FOR PLAY OVER OR OUT OF BOUNDS
BCC CHECK_P2_TIP_PASS_RESULT ; PLAY OVER?
JMP P1_PASS_BALL_OOB_OR_HIT_GROUND ; YES->P1 PASS PLAY OVER
CHECK_P2_TIP_PASS_RESULT: ; CHECK FOR INT
SWITCH_A_BIT[] BALL_STATUS
CASE_BIT[bit_addr] 7, P2_INTERCEPTS_PASS ; checks for jumping int
CASE_BIT[bit_addr] 5, P1_RECEPTION ; checks for jumping rec
@check_ball_after_block: ; CHECK FOR BALL RECOVERED AFTER BLOCK
ASL ; DOES BALL STATUS = BALL RECOVERED
ASL ;
BCS CHECK_WHO_CAUGHT_P2_TIP ; YES->CHECK FOR CATCH/INTERCEPTION AFTER TIP
BIT BALL_COLLISION ; DOES BALL INFO = BALL COLLIDED
BVC P2_TIPS_PASS_OUTCOME_LOOP ; NO-> P1 PASS TIPPED OUTCOME
@ball_collided:
RETURN_IN_NUM_FRAMES 6
LDA BALL_STATUS ; DOES BALL STATUS = INT, REC, BALL CAUGHT AFTER TIP
AND #$A8 ;
BNE P2_TIPS_PASS_OUTCOME_LOOP
@p2_tipped_pass_hit_ground:
JMP P1_PASS_BALL_OOB_OR_HIT_GROUND ; NO-> P1 PASS PLAY OVER
CHECK_WHO_CAUGHT_P2_TIP: ; CHECK FOR CATCH/INTERCEPTION AFTER TIP *** NOT REACHABLE WITHOUT HACK ***
ASL ; DOES BALL STATUS = P1 CAUGHT BALL?
BCC @p1_catches_p1_tip ; YES->
JMP P2_INTERCEPTS_PASS ; YES->PLAYER 2 DEFENDER GETS INTERCEPTION
@p1_catches_p1_tip: ; P1 CATCHES TIPPED BALL
JMP P1_RECEPTION ; JUMP->P1 RUN PLAY CHECKS
_F}_P1_PASS_TIPPED_RESULT
_F{_P1_SAFETIED ; DONE
P1_SAFTIED: ; P1 SAFETIED
PLAY_SOUND_ID SAFETY_SONG
SET_CLOCK_TO_STOPPED
LDA #SAFETY_POINTS ; LOAD P1 SAFETY POINTS
JSR ADD_PTS_TO_P2_QTR_TOT ; ADD POINTS TO P2 SCORE(A= PTS)
SET_BALL_STATUS_SPECIAL_SAFETY[]
LDA #SAFETY_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
RETURN_IN_NUM_FRAMES 60
LDA #P2_TEAM_CITY_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
RETURN_IN_NUM_FRAMES 60 ;
LDA #LARGE_SCORE_SCROLL_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
RETURN_IN_NUM_FRAMES 60 ;
LDA #CLEAR_ONSCR_BANNER_BANNER_ID ; SET BANNER SCENE ID = CLEAR BANNER NAMETABLE 0
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
LDA #$00 ; SET IRQ0 SCROLL LOCATION = NAMETABLE 0
STA IRQ_0_NAMETABLE ;
JMP P1_TO_P2_POSSESSION_CHANGE_P1_KICKOFF ; JUMP-> P1 to P2 POSSESION CHANGE KICKOFF
_F}_P1_SAFETIED
_F{_P1_TD ; DONE
DO_PLAYER_1_TOUCHDOWN: ; PLAYER 1 CROSSED ENDZONE TD
SET_SPRITE_OFFSCREEN PASS_TGT_INDICATOR_SPR_Y
SET_PLAY_STATUS_TOUCHDOWN[]
LDA #JUMPING_CHEERLEADER_SIDELINE_ID ; SET SIDELINE ANIMATION = JUMPING CHEERLEADERS, EXCITED CROWD
STA SIDELINE_ANI_TIMER ;
SET_CLOCK_TO_STOPPED
LDA #TD_POINTS ; LOAD POINTS FOR TOUCHDOWN
JSR ADD_PTS_TO_P1_QTR_TOT ; ADD POINTS TO P1 SCORE (A=PTS)
LDA #TOUCHDOWN_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
IF_P2_LAST_HAD_BALL[ADDR] DO_P1_DEF_TD
P1_OFF_TD:
SET_ADDR_XY[addr] OFF_PLAYERS_CHEER_PLAY_PTRS[]
JSR UPDATE_ALL_P1_PLAY_CODE_ADRR ; UPDATE ALL P1 PLAYERS PLAY CODE(X,Y= PLAY CODE POINTERS START ADDRESS)
SET_ADDR_XY[addr] DEF_PLAYERS_CRY_PLAY_PTRS[]
JSR UPDATE_ALL_P2_PLAY_CODE_ADRR_EXCEPT_MAN ; UPDATE P2 PLAY CODE ADDRESSES OF NON-MAN CONTROL PLAYERS ONLY (X,Y= PLAY CODE ADDRESS)
JSR P1_PLAY_TD_MUSIC_UPDATE_BANNER_UPDATE_STATS
LDX #RUSHING_TOUCHDOWN_SCENE_ID ; SET CUTSCENE ID = P1 RUSHING TD CUTSCENE
IF_PASS_NOT_ATTEMPTED[ADDR] DO_P1_TD_CUTSCENE
@else_set_cutscene_id_to_pass
INX ; CUTSCENE ID++ = P1 PASSING TD CUTSCENE
DO_P1_TD_CUTSCENE: ; DO P1 TD CUTSCENE
TXA ; LOAD CUTSCENE VALUE (PASS OR RUN TD)
JSR DRAW_CUTSCENE_PLAY_OVER ; PLAY BANK 7 CUTSCENE, PLAY IS OVER ( A=CUTSCENE INDEX)
JMP CHECK_IF_XP_KICK_NEEDED_P1 ; JUMP TO P1 XP CHECK
DO_P1_DEF_TD: ; P1 DEFENSIVE TD CELEBRATE START
SET_ADDR_XY[addr] DEF_PLAYERS_CHEER_PLAY_PTRS[]
JSR UPDATE_ALL_P1_PLAY_CODE_ADRR ; UPDATE ALL P1 PLAYERS PLAY CODE(X,Y= PLAY CODE POINTERS START ADDRESS)
SET_ADDR_XY[addr] OFF_PLAYERS_CRY_PLAY_PTRS[]
JSR UPDATE_ALL_P2_PLAY_CODE_ADRR_EXCEPT_MAN ; UPDATE P2 PLAY CODE ADDRESSES OF NON-MAN CONTROL PLAYERS ONLY (X,Y= PLAY CODE ADDRESS)
JSR P1_PLAY_TD_MUSIC_UPDATE_BANNER_UPDATE_STATS
INIT_POSSESSION_STATUS_P1_RUN
LDA #RUSHING_TOUCHDOWN_SCENE_ID ; SET CUTSCENE ID = P1 RUSHING TD CUTSCENE
JSR DRAW_CUTSCENE_PLAY_OVER ; PLAY BANK 7 CUTSCENE, PLAY IS OVER ( A=CUTSCENE INDEX)
JMP CHECK_IF_XP_KICK_NEEDED_P1 ; JUMP -> P1 XP CHECK
P1_PLAY_TD_MUSIC_UPDATE_BANNER_UPDATE_STATS: ; PLAY TD SOUND, DRAW TEAM NAME, SET BALL LOCATION, UPDATE STATS()
RETURN_IN_NUM_FRAMES 2
PLAY_SOUND_ID TOUCHDOWN_DMC
RETURN_IN_NUM_FRAMES 90
LDA #P1_TEAM_CITY_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
RETURN_IN_NUM_FRAMES 90
JSR WAIT_UNTIL_BANNER_DONE_FADE_OUT_PAL ; CHECK FOR BANNER DONE THEN KILL TASKS AND FADE PALLETE()
SET_BALL_X_EQUAL_TO_LOCATION[name] FRONT_RIGHT_ENDZONE
JSR UPDATE_IN_GAME_TEAM_PLAYER_STATS ; UPDATE SRAM TEAM/PLAYER STATS()
RTS ; RETURN
CHECK_IF_XP_KICK_NEEDED_P1: ; P1 XP CHECK
IF_QTR_NOT_OVERTIME[ADDR] P1_XP_START
JSR CHECK_FOR_QTR_OVER ; CHECK FOR QUARTER/GAME OVER RESET BIT & SUSPEND SWITCH TASK IF OVER()
P1_XP_START: ; P1 XP START
JSR SET_TO_1st_DOWN_CLEAR_RAM_VARS_SPRITES ; SET FIRST DOWN, CLEAR SPRITE AND GRAPHICS, RESET PLAY VARS & ACTIVE PLAYER LOC/ICON()
LDA #$00 ; SET P1/P2 PLAY CALL = ZERO
STA P1_PLAY_CALL ;
STA P2_PLAY_CALL ;
INIT_POSSESSION_STATUS_P1_XP
@set_yardline_has_p1_xp:
SAVE_YARDLINE_TO_LOS_X 98 ; Sets yardline 2 yards from endzone
LDA #MID_HASH_Y ; SET LOS Y = MIDDLE OF FIELD
STA LOS_Y ;
LDX #XP_OFF_FORMATION_ID ; SET OFFENSIVE FORMATION = XP FORMATION
JSR LOAD_P1_OFF_FORMATION ; LOAD OFFENSE FORMATION P1 ON OFFENSE()
LDX #XP_DEF_PLAY_ID ; SET DEFENSIVE PLAY = FG/XP
JSR LOAD_P2_DEFENSE_PLAY_CODE_ADDRESSES ; LOAD DEFENSE PLAY CODE PTRS P2 ON DEFENSE(X=DEFENSIVE PLAY INDEX)
JSR LOAD_ALL_SKILLS_INTO_PLAYER_RAM ; LOAD ALL PLAYER SKILLS(RS,RP,MS,HP) INTO PLAYER RAM() Bank 27 $85A9
LDA #KICKER_STARTER_ID ; SET PLAYER ID = KICKER
LDX #RB1_POSITION_ID ; SET POSITION TO LOAD INTO = RB
JSR LOAD_SINGLE_PLAYER_SKILLS_TO_PLAYER_RAM ; SET PLAYER SKILLS IN PLAYER RAM (A=PLAYER ID, X=PLAYER POINTER TO LOAD INTO)
SET_P1_FG_XP_SCROLL_LIMITS[]
JSR UPDATE_FIELD_SCROLL_SETTINGS ; UPDATE SCROLL WINDOW VARS (X=LEFT SCROLL, Y=RIGHT SCROLL, A= XSCROLL)
JSR SET_GAME_STATUS_ON_FIELD_START_PLAYER_TASK
LDA #REDRAW_CLOCK_SCORE_BANNER_ID + SCROLL_BANNER_IN_FROM_RIGHT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
JSR FADE_IN_BG_AND_SPR_PAL ; FADE IN PALLETE()
RETURN_IN_NUM_FRAMES 8
JSR CHECK_P1_HIKE_P2_DEF_CHANGE_NO_CLOCK ; CHECK FOR P1 HIKE AND P2 DEFENDER PLAYER CHANGE NO CLOCK CHECK()
LDA #P1_ON_FIELD_SONG_SIDE ;
JSR SET_ON_FIELD_SONG ; PLAY SOUND LOOP BASED ON GAME TYPE AND PLAYER (A=PLAYER)
CHECK_P1_XP_KICKED: ; WAIT FOR BALL KICKED OR HOLDER TACKLED LOOP
RETURN_1_FRAME
JSR CHECK_FOR_FUMBLED_SNAP_OR_TOSS ; CHECK FOR FUMBLE IF SHOTGUN SNAP/ RUN TOSS IN PROGRESS ()
JSR CHECK_FOR_PLAY_OVER_P1_OOB ; CHECK FOR PLAY OVER OR OUT OF BOUNDS
BCS EXIT_P1_XP ; YES->EXIT P1 XP
IF_BALL_NOT_KICKED[ADDR] CHECK_P1_XP_KICKED
@wait_xp_cutscene_done: ; WAIT UNTIL P1 XP CUTSCENE DONE LOOP
RETURN_1_FRAME
LDA CUTSCENE_TO_DRAW ; CUTSCENE DONE?
BEQ @wait_xp_cutscene_done ; NO->WAIT UNTIL P1 XP CUTSCENE DONE LOOP
IF_KICK_NOT_MADE[ADDR] P1_XP_CHECK_FOR_ADDITIONAL_CUTSCENE
@add_xp_points_to_P1_score
LDA #XP_PTS ; SET PTS TO ADD = P1 EXTRA POINT VALUE
JSR ADD_PTS_TO_P1_QTR_TOT ; ADD POINTS TO P1 SCORE (A=PTS)
P1_XP_CHECK_FOR_ADDITIONAL_CUTSCENE: ; CHECK IF ADDITIONAL CUTSCENE NEEDED
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
EXIT_P1_XP: ; EXIT P1 XP
JMP P1_TO_P2_POSSESSION_CHANGE_P1_KICKOFF ; JUMP-> P1 to P2 POSSESION CHANGE KICKOFF
_F}_P1_TD
_F{_P1_INTERCEPTED ; DONE
P2_INTERCEPTS_PASS: ; PLAYER 2 DEFENDER GETS INTERCEPTION
SET_SPRITE_OFFSCREEN PASS_TGT_INDICATOR_SPR_Y
RETURN_IN_NUM_FRAMES 3
SET_LOS_X_EQUAL_TO_BALL_X
@update_play_code_ptrs:
SET_ADDR_XY[addr] INT_RETURN_DEFENSE_PLAY_PTRS[]
JSR UPDATE_ALL_P1_PLAY_CODE_ADRR ; UPDATE ALL P1 PLAYERS AND ACTIVE MAN PLAYER(X,Y= PLAY CODE ADDRESS)
SET_ADDR_XY[addr] INT_RETURN_PLAY_PTRS[]
JSR UPDATE_ALL_P2_PLAY_CODE_ADRR ; UPDATE ALL P2 PLAYERS AND ACTIVE MAN PLAYER(X,Y= PLAY CODE ADDRESS)
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
LDA #INTERCEPTION_BANNER_ID + SCROLL_BANNER_IN_FROM_LEFT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
LDA #P2_ON_FIELD_SONG_SIDE ; SET SONG SIDE = PLAYER 2
JSR GET_ON_FIELD_SONG_ID ; UPDATE CURRENTLY PLAYING SOUND BASED ON GAME TYPE(A=P1 or P2)
STA ON_FIELD_SONG_TO_PLAY_AFTER_INT ; SAVE SONG ID TO PLAY AFTER INTERCEPTION MUSIC
JSR P2_CHECK_FOR_TOUCHBACK ; CHECK FOR P2 TOUCHBACK()
BCS P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT
RETURN_IN_NUM_FRAMES 60
LDA #SCROLL_CLOCK_SCORE_BANNER_ID + SCROLL_BANNER_IN_FROM_LEFT_BIT_FLAG
JSR UPDATE_BANNER ; UPDATE TOP BANNER(A=BANNER TO DO)
UPDATE_SCROLL_LIMITS_P1_TURNOVER: ; UPDATE SCROLL THRESHOLDS AFTER P2 GETS TURNOVER
SET_P1_INT_PR_FUM_SCROLL_LIMITS[]
@p2_int_pr_fumble_return_checks: ; P2 INTERCEPTION RETURN CHECKS
RETURN_1_FRAME
JSR DO_CUTSCENE_IF_NEEDED ; PLAY CUTSCENE IF NEEDED()
JSR CHECK_FOR_TD_P2 ; CHECK FOR P2 ENDZONE CROSS()
JSR CHECK_IF_BALL_FUMBLED ; CHECK FOR FUMBLE
JSR CHECK_FOR_PLAY_OVER_P2_OOB ; CHECK FOR PLAY OVER OR P2 ACTIVE PLAYER OUT OF BOUNDS
BCC @p2_int_pr_fumble_return_checks ;
JSR CHECK_FOR_P2_SAFETY ; CHECK FOR P2 SAFETY()
JSR STOP_CURRENTLY_PLAYING_SOUND ; STOP CURRENTLY PLAYING SOUND LOOP ()
RETURN_IN_NUM_FRAMES 2
JMP P1_TO_P2_POSSESSION_CHANGE_P2_PLAY_SELECT
_F}_P1_INTERCEPTED
_F{_P1_TO_P2_POSSESSION_CHANGE ; DONE
P1_TO_P2_POSSESSION_CHANGE_P1_KICKOFF: ; P1 to P2 POSSESION CHANGE KICKOFF